| fix(model): deep-clone nested content in cloneMessages
cloneMessages used spread to shallow-copy content blocks, leaving
CanonicalToolResultBlock.content and CanonicalToolCallBlock.input
as shared references between original and clone. Extract a shared
clone utility that deep-copies these nested structures and replace
three duplicate private implementations.
Co-authored-by: Cursor <cursoragent@cursor.com>
| 8 天前 |
| feat(agent): implement subagent status tracking and event handling
- Introduced new subagent status events including "subagent_started", "subagent_completed", and "subagent_status" to track the lifecycle and activity of subagents.
- Added functionality to emit heartbeats and update subagent status based on tool execution events.
- Enhanced the AgentLoop to manage subagent execution with an event pump, allowing for real-time status updates during tool execution.
- Updated the SubAgentSession to forward relevant events to the parent context, ensuring visibility of subagent activities.
- Adjusted the UI components to reflect subagent statuses and errors appropriately.
This update improves the monitoring and management of subagents within the agent loop, enhancing overall system responsiveness and user feedback.
| 15 天前 |
| fix(agent): post-routing compaction for smaller context-window models
When tokenSaver routes from a large-window model (e.g. sonnet 200k) to
a smaller one (e.g. qwen 32k), compaction still evaluated against the
original model's window — never triggering for the routed model's
actual limit. Split router.stream() into decide()+execute() in
AgentLoop and insert a second tryAutoCompact pass using the routed
model's maxContextTokens when it is smaller than the agent's default.
Co-authored-by: Cursor <cursoragent@cursor.com>
| 8 天前 |
| fix(model): deep-clone nested content in cloneMessages
cloneMessages used spread to shallow-copy content blocks, leaving
CanonicalToolResultBlock.content and CanonicalToolCallBlock.input
as shared references between original and clone. Extract a shared
clone utility that deep-copies these nested structures and replace
three duplicate private implementations.
Co-authored-by: Cursor <cursoragent@cursor.com>
| 8 天前 |
| refactor: update subagent definitions to replace omitClaudeMd with omitProjectInstructions for clarity
- Updated comments and documentation to reflect the change in terminology.
- Adjusted subagent definitions to use omitProjectInstructions instead of omitClaudeMd.
- Ensured consistency across related files in the context of system prompt handling.
| 6 天前 |
| feat(tool): align edit_file/read_file with robust edit design
- Partial reads now register write snapshots, allowing edits after
ranged read_file calls instead of requiring a full read
- Layered stale check: full-read snapshots fall back to content hash
comparison; partial-read snapshots reject on mtime change directly
- Persist writeSnapshots and readFileState across session recreation
via AgentLoop.snapshotFileState → TurnRunner → AgentSession →
createLocalGateway.recreateSession seedState pipeline
- Two-level old_string matching: exact match first, then curly-quote
normalized match via new editNormalization.ts module
- Pre-process new_string: strip trailing whitespace (except markdown)
- Improved error messages: echo old_string on not-found, show match
count on ambiguous matches
- Tool descriptions now explicitly state read-before-write constraint
and character-exact old_string requirement
- Updated and added tests covering all new behavior (30 tests pass)
Co-authored-by: Cursor <cursoragent@cursor.com>
| 8 天前 |
| feat: align event and hook semantics — add 16 AgentEvent + 3 GatewayEvent types, wire 9 previously empty hooks
Every lifecycle.dispatch() call now has a corresponding named AgentEvent
or GatewayEvent, fulfilling the "event >= hook" design principle. Introduces
AgentEventEmitter buffer/drain pattern for non-generator contexts (ToolRuntime,
CompactionEngine), bindServer deferred-broadcast for cross-session events
(ConfigChange, WorktreeCreate/Remove), and @todo markers for 3 hooks without
clear trigger points (Notification, CwdChanged, FileChanged).
Co-authored-by: Cursor <cursoragent@cursor.com>
| 20 天前 |