Commit Graph

34 Commits

Author SHA1 Message Date
Nikhil
a824078f6d fix: compaction config for small context windows (≤32K) (#466)
* fix: compaction config for small context windows (≤32K)

Raise COMPACTION_SMALL_CONTEXT_WINDOW from 16K to 32K so models like
Haiku 4.5 (30K context) use proportional 50% reserve instead of the
fixed 20K reserve. Also scale fixedOverhead for small contexts (capped
at 40% of context window) to prevent the doom loop where overhead alone
triggers compaction on every step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add compaction tuning guidance to limits constants

Explain the relationship between SMALL_CONTEXT_WINDOW and
FIXED_OVERHEAD so devs know the 24K minimum constraint when
tweaking these values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:12:20 -07:00
Nikhil
5b27933c63 feat: add 2-stage pruning to compaction pipeline (#455)
* feat: add 2-stage pruning to compaction pipeline before LLM summarization

Add two new lightweight stages to the compaction prepareStep pipeline that
recover context tokens cheaply before falling back to expensive LLM
summarization:

- Stage 2: Use AI SDK's pruneMessages to remove old tool call/result
  pairs beyond the last 6 messages entirely
- Stage 3: Replace remaining tool output values with short placeholders
  ("[Cleared — N chars]") while preserving tool call structure and IDs

Both stages re-estimate tokens from message content (not stale step
usage) after modifying messages. The existing LLM summarization and
sliding window fallback remain as Stage 4.

Also adds estimateTokensForThreshold() helper, clearToolOutputs()
function, and COMPACTION_PRUNE_KEEP_RECENT_MESSAGES /
COMPACTION_CLEAR_OUTPUT_MIN_CHARS constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: reorder compaction pipeline — truncate before clear, protect recent tools

- Stage 0: Check threshold, return untouched when under (no data loss)
- Stage 1: Prune old tool call/result pairs beyond last 6 messages
- Stage 2: Truncate large tool outputs to 15K chars (keeps partial content)
- Stage 3: Clear old tool outputs with placeholders, protect last 2
- Stage 4: LLM-based compaction with sliding window fallback

clearToolOutputs now accepts keepRecentCount parameter (default 2) to
skip the N most recent tool messages from clearing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: limits fixes

* fix: address review — preserve toKeep context, derive test values from constants

- When Stage 3 (clearToolOutputs) doesn't resolve overflow, pass
  truncated (not cleared) messages to Stage 4 so toKeep retains
  meaningful tool outputs for the agent's immediate context
- Add comment explaining intentional conservatism in post-prune
  token estimation (step usage is stale, must re-estimate safely)
- Refactor computeConfig tests to derive expected values from
  AGENT_LIMITS constants instead of hardcoding magic numbers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 10:41:34 -07:00
Nikhil
7d20768d8e feat: persist large tool outputs to disk (#452)
* feat: persist large tool outputs to disk

* fix: address PR review comments for tool output limits

* chore: raise filesystem read line limit to 500
2026-03-10 09:25:19 -07:00
Dani Akash
f35ac0ddd3 feat: new onboarding tools (#385)
* feat: new tools for breadcrumbs

* feat: setup scheduled task card

* feat: added dismiss cooldown

* chore: update prompt

* fix: support api key tool

* fix: prompt text to limit nudges

* fix: scheduled tasks card

* fix: update nudges prompt

* feat: skip nudges when user dismisses nudge

* fix: ensure nudges only show if they are not dismissed

* Revert "fix: ensure nudges only show if they are not dismissed"

This reverts commit d825254698829b8e9941aae7873bd440027d0c74.

* Revert "feat: skip nudges when user dismisses nudge"

This reverts commit 12b552b454d10ec4209b88668fc48681423ff6fc.

* Revert "fix: update nudges prompt"

This reverts commit 80b7520b953b4d3cbed2ed477b9e508e39938dca.

* feat: update agent with mcp when new mcp connection is added

* feat: created connect apps option as a blocking card system

* feat: schedule tasks passive without dismiss

* fix: nudges and prompt texts

* fix: biome lint errors

* fix: review comments

* fix: resolve comments

* fix: review comments

* fix: review comments

* fix: auto resolve state

* fix: eliminate the race where the async delete could resolve after the
new session

* feat: track ignored apps list

* fix: empty response text object on message reply

* feat: sync previously connected mcps

* feat: sync integrations with klavis

* feat: account for unauthenticated connections

* fix: analytics events

* fix: typescript issues

* fix: klavis client issue

* fix: invalid mcps causing entire responses from failing

* fix: prompt with card for integrations when the integration fails

* fix: prompt structure to support declined apps

* fix: refresh session on mcp changes
2026-03-10 17:44:10 +05:30
shivammittal274
b6b45404ee feat: add agent skills system with catalog, loader, and UI (#450)
* feat: add agent skills system with catalog, loader, and UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: return 500 for server errors in PUT/DELETE skill routes

Previously both handlers returned 404 for all errors, masking filesystem
failures (disk full, permission denied) as "not found". Now only
"not found" errors return 404; everything else returns 500.

* fix: align SKILL.md format with agentskills.io spec

- Move `enabled` and `version` into `metadata` field (spec only allows
  name, description, license, compatibility, metadata, allowed-tools)
- Frontmatter `name` now matches directory name (lowercase kebab-case)
- Human-readable name stored in `metadata.display-name`
- Add index signature to SkillMetadata for arbitrary string keys
- Validate frontmatter with type guard in getSkill (remove unsafe cast)
- updateSkill now preserves existing frontmatter fields (license, etc.)
- Tighten buildSkillMd param from Record<string, unknown> to SkillFrontmatter

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:24:05 +05:30
shivammittal274
44071cb0f4 fix: fix compaction tool output truncation and token estimation (#448)
- truncateToolOutputs: handle all output.type variants (text, json,
  content) by checking output.value directly instead of branching on
  type. The old code missed type 'content' (array of content parts),
  causing 1M+ char tool results to pass through untouched.

- estimateTokens: change chars/4 to chars/3 — HTML/Markdown content
  tokenizes at ~3.14 chars/token empirically, not 4.

- COMPACTION_FIXED_OVERHEAD: 5K → 12K to account for system prompt
  (~2.5K tokens) + tool definitions as JSON Schema (~8-9K tokens).

- Apply truncateToolOutputs in prepareStep (Stage 0) before token
  estimation, not just during summarization.
2026-03-10 02:39:54 +05:30
Nikhil
a91bef1cd1 feat: remove legacy gemini agent and provider adapter (#415)
* feat: remove legacy gemini agent and provider adapter

* fix: remove redundant run graph schema refine
2026-03-05 10:34:43 -08:00
Felarof
609341a445 feat: add Kimi/Moonshot partnership branding with feature flag
## Summary
- Add `VITE_PUBLIC_KIMI_LAUNCH` feature flag controlling Kimi partnership branding
- BrowserOS provider card shows "Powered by Kimi K2.5 from Moonshot AI" badge and "Extended usage limits for the next 2 weeks!" when flag is on
- Moonshot/Kimi highlighted as "Recommended" in provider templates
- LLM Hub defaults to Kimi, ChatGPT, Claude, Gemini (with legacy defaults migration)
- Kimi hub row shows "Powered by Moonshot AI" flare
- Model selector locked to kimi-k2.5
- "How to get a Kimi API key" link in provider dialog
- Moonshot provider fully integrated across frontend and backend
2026-03-04 17:55:40 -08:00
Dani Akash
52f9dfb2e4 feat: soul and memory (#401)
* feat: install fuse.js

* feat: implement soul and basic memory system

* fix: memory recall

* fix: memory search pattern

* feat: create soul.md file progressively

* fix: soul vs core memory

* fix: provide a soul read tool

* feat: display soul on settings page

* feat: refresh soul document

* fix: chat mode avoids memory and soul tools

* fix: date construction on memory cleanup

* fix: atomicity of write operation

* chore: upgrade biome
2026-03-04 19:12:47 +05:30
shivammittal274
de52afbc55 feat: generalized compaction prompts with split turn handling (#391)
* feat: generalized compaction prompts with split turn handling

Replace browser-specific XML prompts with domain-agnostic markdown format.
Add split turn detection and parallel summarization for large single-turn
conversations. Switch compaction from generateText to streamText for
Fireworks API compatibility. Add comprehensive unit and E2E tests (84 total).

* fix: address code review issues for compaction (PR #391)

Enforce COMPACTION_MAX_SUMMARIZATION_INPUT cap, extract shared
callSummarizer helper, add runtime type guard for experimental_context,
move magic constants to AGENT_LIMITS, and remove dead constants.

* fix: cap truncatedTurnPrefix input to maxSummarizationInput

Apply the same sliding window cap to turn prefix messages that was
already applied to toSummarize, preventing unbounded LLM input for
long single-turn conversations with many tool calls.

* fix: reduce browseros-auto default context window to 200K

The 400K setting caused compaction to trigger at ~383K, but the actual
model limit is 262K. Conversations hit the hard limit before compaction
could kick in.
2026-03-03 17:20:18 +05:30
Nikhil
d84feb105c feat: add different signal for sigterm and sigint (#390) 2026-03-02 18:23:22 -08:00
Nikhil
47a70b43de feat: improve scroll reliability and tool response latency (#374)
* feat: improve scroll reliability and tool response latency

* fix: address PR review comments for fix_scroll_tool
2026-02-27 09:24:29 -08:00
Nikhil
d7bb80e04e feat: cdp keep alive and exit strategy (#365)
* feat: cdp keep alive and exit strategy

* fix: self-kill if health checks don't arrive

* fix: timer cdp race

* fix: stale this
2026-02-26 13:52:15 -08:00
Nikhil
f27858f9a7 fix: cdp retry on disconnect and crash (#357)
* fix: cdp retry on disconnect and crash

* fix: review comments

* fix: review comments
2026-02-23 15:17:40 -08:00
Nikhil Sonti
52f2ebeffd fix: default context window to 200k 2026-02-23 14:59:07 -08:00
Nikhil
81a6d20fe8 feat: cdp tools (#353)
* feat: unified CDP + controller tools architecture

Merge CDP and controller tools into a single Browser abstraction with
backend-agnostic tool definitions. Replaces old separate cdp/controller
tool registries with unified registry, adds new tools (bookmarks,
tab-groups, history, keyboard, mouse, snapshot, content-markdown).

* feat: fix bookmarks and history, move browseros-info tool

* chore: bump server version

* fix: increase console truncate limit

* fix: previous conversation fix

* chore: bump server version

* fix: tab-group cdp

* fix: update types based on pdl

* fix: enable tab grouping

* fix: prompt enable tab grouping

* chore: bump server version
2026-02-23 07:28:45 -08:00
Nikhil Sonti
f9933ccedc fix: move const to shared for cdp timeout 2026-02-06 13:24:47 -08:00
shivammittal274
23abfdf6f4 feat: add MCP transport auto-detection for custom servers (#307)
Automatically detect whether custom MCP servers use Streamable HTTP or
SSE transport by probing with a POST request before creating the config.

- Add detectMcpTransport() utility that probes the server endpoint
- If POST returns 200 with JSON/event-stream, use Streamable HTTP
- If POST returns 404/405 or fails, fall back to SSE transport
- Cache detection results per URL with 1-hour TTL
- Skip caching for transient errors (5xx, network failures)

Known servers (browseros-mcp, klavis-strata) skip detection and use
Streamable HTTP directly.
2026-02-06 23:24:27 +05:30
Nikhil
24b46f664b feat: server port fixes (#286)
* feat: new start script with manual and watch mode

* fix: disable sentry in dev builds

* feat: remove bind with retry

* feat: verify port exists
2026-01-31 16:31:21 -08:00
Nikhil Sonti
36fe8790b0 fix: remove watchdog constants 2026-01-30 09:59:00 -08:00
Nikhil
ad4e391b9c feat: health watch to self terminate process on crash (#256)
* feat: health watch to self terminate process on crash

* feat: add tests
2026-01-20 16:09:57 -08:00
Nikhil
132ca01151 feat: add page load wait for /nav (#247) 2026-01-19 17:45:15 -08:00
Nikhil
eacdfaf579 feat: config + codegen env handling (#242)
* feat: better INLINE & PROD env handling

* chore: bump server version

* feat: refactor config ts better
2026-01-16 16:53:06 -08:00
shivammittal274
f977257e3e fix: graph execution on different window (#233)
* fix: graph execution on different window

* fix: pass screenshot tools only if support images (#237)
2026-01-15 13:22:18 -08:00
Nikhil
4d77a02e9e feat: gemini supports file write and shell (#225)
* fix: tempDir is executionDir and create per session execution dir

* fix: move create() in gemini-agent to top

* fix: log(debug) directories

* fix: chat routes bug

* feat: support userSessionDir in /chat request schema

* fix: clean-up un-used types

* fix: lint errors
2026-01-14 15:26:17 -08:00
shivammittal274
472147db25 chore: refactor agent sdk (#215)
* chore: reafctor agent sdk

* chore: graph create update endpoint return ai sdk stream (#216)

* chore: graph create update endpoint return ai sdk stream

* chore: graph create update endpoint return ai sdk stream

* chore: graph create update endpoint return ai sdk stream

* chore: graph create update endpoint return ai sdk stream

* chore: improve agent ui stream

* chore: improve agent ui stream

* chore: improve agent ui stream

* chore: refactored llm config and ui stream based on bun version

* chore: refactored llm config and ui stream based on bun version
2026-01-14 13:00:32 +05:30
Nikhil
ce78a4a8d3 feat: better port binding - retry + exit codes for chromium (#200)
* fix: crash if port not available

* fix: better exit codes

* fix: better error code detection

* fix: review feedback and lint errors
2026-01-09 18:23:04 -08:00
Nikhil
9b1887fe3b fix: klavis timeout (#197)
* fix: debug log for browserosid for debugging

* fix: klavis client timeout

* fix: re-enable klavis mcp
2026-01-09 14:08:40 -08:00
Nikhil
9854870291 feat: better dev workflow (#188)
* fix: controller-ext is built separately

* fix: remove un-used scripts in agent/

* fix: rename to assistant

* fix: add build scripts

* feat: new start:dev to start both

* fix: update gitignore

* feat: --new-ports support for dev:start

* feat: update start-all to support port and new data dir

* fix: add help insturctions for start:dev
2026-01-08 10:09:24 -08:00
shivammittal274
2ac655b69e fix: context window size (#171) 2026-01-07 17:13:00 +05:30
Felarof
384a5e35ef fix: remove checkbox in LLM chat and hub page -- dead code 2026-01-02 11:19:18 -08:00
Nikhil
47b9c1894d feat: implement agent-sdk (#145)
* feat: agent-sdk outline

* feat: unit tests for agent-sdk

* feat: implement /sdk routes

* feat: integration test for agent-sdk with server

* feat: ENV to disble headless mode for testing

* feat: act() integration test working

* chore: refactor package/shared to have constants/ and /types separately

* feat: verify() and extract() sdk APIs

* feat: extract() use remote endpoint for extraction

* feat: verify() implemented - lazy parsing to avoid strong schema checks

* fix: remove generateStructuredOutput as not models support it

* fix: clean-up LLM types and use zod schema

* fix: typecheck vitetest error

* fix: remove directly calling GeminiAgent in sdk act()

* fix: lefthook for refactor warning

* fix: refactor routes/sdk to move business logic out
2026-01-01 17:38:40 -08:00
Felarof
1044888d9a feat: fix mono repo setup (#139)
* chore: fix monorepo setup

1) use single .env.development file at the root

2) update package.json to contain commands to start server and agent

3) rename "Assistant" package name to "agent"

4) rename HTTP_MCP_PORT to SERVER_PORT

* chore: update README

* chore: update .env.example
2025-12-30 11:39:55 -08:00
Dani Akash
f5cba0c3eb fix: incorrect exports of shared package (#135)
* fix: incorrect exports of shared package

* fix: reference to shared directory
2025-12-29 12:39:34 +05:30