visionclaw 0.1.187-beta.0 → 0.1.187-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/agent/activity-tracker.d.ts +198 -0
  2. package/dist/agent/activity-tracker.d.ts.map +1 -1
  3. package/dist/agent/activity-tracker.js +248 -0
  4. package/dist/agent/activity-tracker.js.map +1 -1
  5. package/dist/agent/command-handlers.d.ts.map +1 -1
  6. package/dist/agent/command-handlers.js +88 -12
  7. package/dist/agent/command-handlers.js.map +1 -1
  8. package/dist/agent/loop.d.ts.map +1 -1
  9. package/dist/agent/loop.js +7 -0
  10. package/dist/agent/loop.js.map +1 -1
  11. package/dist/agent/providers/claude/session.d.ts +64 -0
  12. package/dist/agent/providers/claude/session.d.ts.map +1 -1
  13. package/dist/agent/providers/claude/session.js +117 -0
  14. package/dist/agent/providers/claude/session.js.map +1 -1
  15. package/dist/agent/providers/client-factory.d.ts.map +1 -1
  16. package/dist/agent/providers/client-factory.js +24 -0
  17. package/dist/agent/providers/client-factory.js.map +1 -1
  18. package/dist/agent/stream-handler.d.ts +97 -1
  19. package/dist/agent/stream-handler.d.ts.map +1 -1
  20. package/dist/agent/stream-handler.js +203 -5
  21. package/dist/agent/stream-handler.js.map +1 -1
  22. package/dist/agent/system-prompt.d.ts.map +1 -1
  23. package/dist/agent/system-prompt.js +6 -2
  24. package/dist/agent/system-prompt.js.map +1 -1
  25. package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
  26. package/dist/agent/wake-cycle-runner.js +152 -46
  27. package/dist/agent/wake-cycle-runner.js.map +1 -1
  28. package/dist/config/claude-settings.d.ts +31 -0
  29. package/dist/config/claude-settings.d.ts.map +1 -0
  30. package/dist/config/claude-settings.js +91 -0
  31. package/dist/config/claude-settings.js.map +1 -0
  32. package/dist/config/index.d.ts +24 -0
  33. package/dist/config/index.d.ts.map +1 -1
  34. package/dist/config/index.js +28 -0
  35. package/dist/config/index.js.map +1 -1
  36. package/dist/i18n/messages.d.ts +4 -0
  37. package/dist/i18n/messages.d.ts.map +1 -1
  38. package/dist/i18n/messages.js +6 -2
  39. package/dist/i18n/messages.js.map +1 -1
  40. package/dist/obs/server.d.ts.map +1 -1
  41. package/dist/obs/server.js +35 -0
  42. package/dist/obs/server.js.map +1 -1
  43. package/dist-agent/bundle.cjs +2642 -1995
  44. package/package.json +1 -1
@@ -2,6 +2,93 @@ export interface TodoItem {
2
2
  content: string;
3
3
  status: "pending" | "in_progress" | "completed";
4
4
  }
5
+ /**
6
+ * Compact progress record for a single nested subagent run (one Task
7
+ * tool invocation). Tracked separately from `recentActions` so that a
8
+ * chatty subagent can't flood the primary agent's recent-actions buffer.
9
+ */
10
+ export interface SubagentProgress {
11
+ /** Claude tool_use_id of the Task invocation that spawned this subagent. */
12
+ toolUseId: string;
13
+ /**
14
+ * SDK-issued task_id (a.k.a. agentId) for async Agent runs. Captured from
15
+ * the `task_started` system event and used as a fallback lookup key when
16
+ * later events (notably `task_updated`) arrive without `tool_use_id`.
17
+ */
18
+ taskId?: string;
19
+ subagentType?: string;
20
+ /** Human-readable description, usually from the Task tool input. */
21
+ description?: string;
22
+ startedAt: number;
23
+ completedAt: number | null;
24
+ status: "running" | "completed" | "failed";
25
+ /**
26
+ * The most recent signal we saw from this subagent, formatted for
27
+ * operator display. Typically a truncated tool call or a truncated
28
+ * assistant-text excerpt. Null until the first nested event arrives.
29
+ */
30
+ lastActivity: string | null;
31
+ /** Count of nested tool calls + assistant text blocks observed. */
32
+ actionCount: number;
33
+ }
34
+ /**
35
+ * Per-memory reference inside a {@link MemoryRecallEvent}. Mirrors the SDK
36
+ * schema: an absolute path to the CLI-managed memory file plus a scope tag
37
+ * (the CLI's built-in scopes are `"personal"`, `"project"`, `"local"`,
38
+ * `"agent-memory"`, etc.; we pass whatever the CLI reports through untouched
39
+ * so renderers stay forward-compatible).
40
+ */
41
+ export interface MemoryRecallItem {
42
+ path: string;
43
+ scope?: string;
44
+ }
45
+ /**
46
+ * Per-event record of a CLI auto-memory recall, captured from the SDK's
47
+ * `system/memory_recall` messages. These are informational only — the CLI
48
+ * surfaces any retrieved content directly to the model, we just observe
49
+ * so operators can see what the agent has "remembered".
50
+ *
51
+ * Schema source: the CLI binary declares a Zod schema roughly equivalent to
52
+ * { type: "system", subtype: "memory_recall",
53
+ * mode: "select" | "synthesize",
54
+ * memories: [{ path, scope, content? }],
55
+ * uuid, session_id }
56
+ * `content` only appears in `"synthesize"` mode and is a Sonnet-authored
57
+ * distillation; we deliberately drop it from our record because it can be
58
+ * large (hundreds to thousands of tokens) and isn't needed for operator
59
+ * observability.
60
+ */
61
+ export interface MemoryRecallEvent {
62
+ /** Wall-clock time when we saw the event. */
63
+ observedAt: number;
64
+ /**
65
+ * How the CLI surfaced memories for this recall. Today the CLI emits
66
+ * either `"select"` (returns full file bodies chosen by the parallel
67
+ * selector) or `"synthesize"` (returns a Sonnet-authored paragraph
68
+ * distilled across many tiny memories). Typed as plain `string` to
69
+ * stay forward-compatible with future modes; downstream callers should
70
+ * treat unknown values as opaque.
71
+ */
72
+ mode?: string;
73
+ /** Memory files referenced by this recall event. */
74
+ memories: MemoryRecallItem[];
75
+ }
76
+ /**
77
+ * Snapshot of the CLI's auto-memory state for the current session. Populated
78
+ * from the `memory_paths` field on `system/init` messages plus any
79
+ * `system/memory_recall` events we've seen since session start.
80
+ */
81
+ export interface MemoryStatus {
82
+ /**
83
+ * Map of memory scope → filesystem path as reported by the CLI on
84
+ * `system/init`. The only scope we've observed in the wild is `"auto"`
85
+ * (e.g. `~/.claude/projects/<sanitized-cwd>/memory/`), but the CLI source
86
+ * treats this as an open key/value map so we do too.
87
+ */
88
+ paths: Record<string, string>;
89
+ /** Most-recent N recall events (newest last). */
90
+ recentRecalls: MemoryRecallEvent[];
91
+ }
5
92
  /**
6
93
  * Maintains a rolling summary of the primary agent's current activity.
7
94
  * Read by the fast responder to give context-aware quick replies when the
@@ -14,6 +101,20 @@ export declare class ActivityTracker {
14
101
  private taskStartedAt;
15
102
  private lastTodos;
16
103
  private recentExchanges;
104
+ /**
105
+ * Ordered map of in-flight + recently-completed subagent runs keyed by
106
+ * tool_use_id. Insertion order is preserved by `Map`; we prune oldest
107
+ * completed entries when the map exceeds `MAX_SUBAGENTS`.
108
+ */
109
+ private subagents;
110
+ /**
111
+ * CLI auto-memory state observed this session. Paths come from
112
+ * `system/init` (stable for the life of a query); recall events come
113
+ * from `system/memory_recall`. Survives across wake cycles so operator
114
+ * surfaces like /obs/memory-status can display the most recent info.
115
+ */
116
+ private memoryPaths;
117
+ private memoryRecallEvents;
17
118
  private readonly maxActions;
18
119
  constructor(maxActions?: number);
19
120
  startTask(description: string): void;
@@ -23,6 +124,90 @@ export declare class ActivityTracker {
23
124
  recordToolResult(name: string, outputSummary: string): void;
24
125
  recordTodos(todos: TodoItem[]): void;
25
126
  getTodos(): TodoItem[];
127
+ /**
128
+ * Register a newly-spawned subagent. Safe to call multiple times for
129
+ * the same toolUseId — later calls are treated as no-ops so we don't
130
+ * clobber already-captured progress if events arrive out of order.
131
+ */
132
+ recordSubagentStarted(toolUseId: string, info: {
133
+ subagentType?: string;
134
+ description?: string;
135
+ }): void;
136
+ /**
137
+ * Associate an SDK `task_id` with an already-registered subagent so that
138
+ * subsequent system events lacking `tool_use_id` (notably `task_updated`)
139
+ * can still be routed to the correct entry. No-op if the subagent isn't
140
+ * tracked or already has a taskId — the mapping is stable for the life of
141
+ * the task.
142
+ */
143
+ recordSubagentTaskId(toolUseId: string, taskId: string): void;
144
+ /**
145
+ * Reverse lookup: given an SDK `task_id`, return the tracked subagent.
146
+ * Used by stream-handler to repair events that only carry `task_id`.
147
+ */
148
+ findSubagentByTaskId(taskId: string): SubagentProgress | undefined;
149
+ /**
150
+ * Record a nested event (assistant text or tool call) observed under
151
+ * an active subagent. We keep only the latest activity string plus a
152
+ * counter to avoid per-subagent history growth. No-op if the subagent
153
+ * isn't tracked — stream ordering can produce nested events before we
154
+ * see the parent Task block; callers should always `recordSubagentStarted`
155
+ * first when possible.
156
+ */
157
+ recordSubagentActivity(toolUseId: string, label: string): void;
158
+ /**
159
+ * Record an async subagent progress snapshot from a `task_progress` system
160
+ * event. Unlike {@link recordSubagentActivity}, the SDK supplies a cumulative
161
+ * `toolUses` count, so we *set* `actionCount` instead of incrementing. The
162
+ * `description` and `lastToolName` fields describe the current operation;
163
+ * prefer `lastToolName` when present because descriptions often repeat the
164
+ * subagent title (e.g. "Research Middle East situation") rather than the
165
+ * current step.
166
+ */
167
+ recordSubagentProgress(toolUseId: string, info: {
168
+ toolUses?: number;
169
+ lastToolName?: string;
170
+ description?: string;
171
+ }): void;
172
+ recordSubagentCompleted(toolUseId: string, info: {
173
+ ok: boolean;
174
+ summary?: string;
175
+ }): void;
176
+ /**
177
+ * Returns all tracked subagents in insertion order. Callers that only
178
+ * care about the currently-running ones should filter by status.
179
+ */
180
+ getSubagents(): SubagentProgress[];
181
+ getActiveSubagents(): SubagentProgress[];
182
+ /**
183
+ * Update the known CLI auto-memory paths (typically one, keyed "auto").
184
+ * Safe to call repeatedly — we merge new keys in rather than clobber, so
185
+ * a transient CLI init that omits a known scope won't wipe it.
186
+ *
187
+ * The CLI reports `memory_paths` on every `system/init` event; the payload
188
+ * is stable within a session and only changes if e.g. the operator moved
189
+ * the profile directory. Callers should not filter — we take whatever the
190
+ * CLI gives us.
191
+ */
192
+ recordMemoryPaths(paths: Record<string, unknown>): void;
193
+ /**
194
+ * Record a CLI `system/memory_recall` event. We keep a rolling ring of
195
+ * the most recent N so operator surfaces can show what the CLI has been
196
+ * pulling into context. Stores path/scope metadata only — any
197
+ * `synthesize`-mode content is deliberately dropped (it can be large
198
+ * and is already fed to the model by the CLI).
199
+ */
200
+ recordMemoryRecall(event: {
201
+ mode?: string;
202
+ memories: MemoryRecallItem[];
203
+ }): void;
204
+ /**
205
+ * Snapshot of the observed CLI auto-memory state. Returns a shallow copy
206
+ * so callers can't mutate internal state. Safe to call from /obs and
207
+ * /tasks even when no memory activity has been seen yet — `paths` will
208
+ * simply be empty.
209
+ */
210
+ getMemoryStatus(): MemoryStatus;
26
211
  getTaskDescription(): string;
27
212
  getTaskElapsedMs(): number | null;
28
213
  getRecentActions(): string[];
@@ -34,5 +219,18 @@ export declare class ActivityTracker {
34
219
  clear(): void;
35
220
  private push;
36
221
  private pushExchange;
222
+ /**
223
+ * Bound the subagent map. Running subagents are never evicted — only
224
+ * already-completed ones age out when we exceed the cap. This protects
225
+ * both against runaway growth and against losing in-flight progress
226
+ * for long-running tasks.
227
+ */
228
+ private pruneCompletedSubagents;
37
229
  }
230
+ /**
231
+ * Render a one-line summary of a subagent for `/tasks` and status surfaces.
232
+ * Kept at module scope so it can be reused by command handlers that want
233
+ * a consistent presentation (e.g. /tasks).
234
+ */
235
+ export declare function formatSubagentLine(progress: SubagentProgress): string;
38
236
  //# sourceMappingURL=activity-tracker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-tracker.d.ts","sourceRoot":"","sources":["../../src/agent/activity-tracker.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;CACjD;AAUD;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,sBAAsB,CAAM;IACpC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,iBAAiB,CAAM;IAC/B,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAA2B;IAElD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,UAAU,SAAK;IAI3B,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAQpC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIrC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKvC,cAAc,CAAC,IAAI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,KAAK,IAAI,IAAI;IAeb,OAAO,CAAC,IAAI;IAOZ,OAAO,CAAC,YAAY;IAOpB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;CAYhC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAwBrE"}
@@ -1,6 +1,19 @@
1
1
  import { logger } from "../logger.js";
2
2
  const MAX_EXCHANGES = 10;
3
3
  const EXCHANGE_TEXT_LIMIT = 200;
4
+ const SUBAGENT_ACTIVITY_LIMIT = 120;
5
+ /**
6
+ * Cap the number of subagent records we retain. Active subagents always
7
+ * fit; once completed they age out FIFO when new ones are added. This
8
+ * prevents unbounded growth over a long task that spawns many subagents.
9
+ */
10
+ const MAX_SUBAGENTS = 32;
11
+ /**
12
+ * How many recent CLI auto-memory recall events to retain. Each entry is tiny
13
+ * (a tool name + a truncated query + a few paths) but a chatty recall
14
+ * supervisor could still pile up — this caps memory use with a FIFO ring.
15
+ */
16
+ const MAX_MEMORY_RECALL_EVENTS = 20;
4
17
  /**
5
18
  * Maintains a rolling summary of the primary agent's current activity.
6
19
  * Read by the fast responder to give context-aware quick replies when the
@@ -13,6 +26,20 @@ export class ActivityTracker {
13
26
  taskStartedAt = null;
14
27
  lastTodos = [];
15
28
  recentExchanges = [];
29
+ /**
30
+ * Ordered map of in-flight + recently-completed subagent runs keyed by
31
+ * tool_use_id. Insertion order is preserved by `Map`; we prune oldest
32
+ * completed entries when the map exceeds `MAX_SUBAGENTS`.
33
+ */
34
+ subagents = new Map();
35
+ /**
36
+ * CLI auto-memory state observed this session. Paths come from
37
+ * `system/init` (stable for the life of a query); recall events come
38
+ * from `system/memory_recall`. Survives across wake cycles so operator
39
+ * surfaces like /obs/memory-status can display the most recent info.
40
+ */
41
+ memoryPaths = {};
42
+ memoryRecallEvents = [];
16
43
  maxActions;
17
44
  constructor(maxActions = 15) {
18
45
  this.maxActions = maxActions;
@@ -22,6 +49,7 @@ export class ActivityTracker {
22
49
  this.recentActions = [];
23
50
  this.lastAssistantText = "";
24
51
  this.taskStartedAt = Date.now();
52
+ this.subagents.clear();
25
53
  logger.debug("[activity-tracker] task started");
26
54
  }
27
55
  recordUserMessage(text) {
@@ -49,6 +77,168 @@ export class ActivityTracker {
49
77
  getTodos() {
50
78
  return this.lastTodos;
51
79
  }
80
+ /**
81
+ * Register a newly-spawned subagent. Safe to call multiple times for
82
+ * the same toolUseId — later calls are treated as no-ops so we don't
83
+ * clobber already-captured progress if events arrive out of order.
84
+ */
85
+ recordSubagentStarted(toolUseId, info) {
86
+ if (this.subagents.has(toolUseId))
87
+ return;
88
+ this.subagents.set(toolUseId, {
89
+ toolUseId,
90
+ subagentType: info.subagentType,
91
+ description: info.description,
92
+ startedAt: Date.now(),
93
+ completedAt: null,
94
+ status: "running",
95
+ lastActivity: null,
96
+ actionCount: 0,
97
+ });
98
+ this.pruneCompletedSubagents();
99
+ }
100
+ /**
101
+ * Associate an SDK `task_id` with an already-registered subagent so that
102
+ * subsequent system events lacking `tool_use_id` (notably `task_updated`)
103
+ * can still be routed to the correct entry. No-op if the subagent isn't
104
+ * tracked or already has a taskId — the mapping is stable for the life of
105
+ * the task.
106
+ */
107
+ recordSubagentTaskId(toolUseId, taskId) {
108
+ const entry = this.subagents.get(toolUseId);
109
+ if (!entry)
110
+ return;
111
+ entry.taskId ??= taskId;
112
+ }
113
+ /**
114
+ * Reverse lookup: given an SDK `task_id`, return the tracked subagent.
115
+ * Used by stream-handler to repair events that only carry `task_id`.
116
+ */
117
+ findSubagentByTaskId(taskId) {
118
+ for (const entry of this.subagents.values()) {
119
+ if (entry.taskId === taskId)
120
+ return entry;
121
+ }
122
+ return undefined;
123
+ }
124
+ /**
125
+ * Record a nested event (assistant text or tool call) observed under
126
+ * an active subagent. We keep only the latest activity string plus a
127
+ * counter to avoid per-subagent history growth. No-op if the subagent
128
+ * isn't tracked — stream ordering can produce nested events before we
129
+ * see the parent Task block; callers should always `recordSubagentStarted`
130
+ * first when possible.
131
+ */
132
+ recordSubagentActivity(toolUseId, label) {
133
+ const entry = this.subagents.get(toolUseId);
134
+ if (entry?.status !== "running")
135
+ return;
136
+ const truncated = label.length > SUBAGENT_ACTIVITY_LIMIT
137
+ ? label.substring(0, SUBAGENT_ACTIVITY_LIMIT) + "…"
138
+ : label;
139
+ entry.lastActivity = truncated;
140
+ entry.actionCount += 1;
141
+ }
142
+ /**
143
+ * Record an async subagent progress snapshot from a `task_progress` system
144
+ * event. Unlike {@link recordSubagentActivity}, the SDK supplies a cumulative
145
+ * `toolUses` count, so we *set* `actionCount` instead of incrementing. The
146
+ * `description` and `lastToolName` fields describe the current operation;
147
+ * prefer `lastToolName` when present because descriptions often repeat the
148
+ * subagent title (e.g. "Research Middle East situation") rather than the
149
+ * current step.
150
+ */
151
+ recordSubagentProgress(toolUseId, info) {
152
+ const entry = this.subagents.get(toolUseId);
153
+ if (entry?.status !== "running")
154
+ return;
155
+ if (typeof info.toolUses === "number" && Number.isFinite(info.toolUses)) {
156
+ entry.actionCount = Math.max(entry.actionCount, info.toolUses);
157
+ }
158
+ const label = info.lastToolName ?? info.description;
159
+ if (label && label.length > 0) {
160
+ const truncated = label.length > SUBAGENT_ACTIVITY_LIMIT
161
+ ? label.substring(0, SUBAGENT_ACTIVITY_LIMIT) + "…"
162
+ : label;
163
+ entry.lastActivity = truncated;
164
+ }
165
+ }
166
+ recordSubagentCompleted(toolUseId, info) {
167
+ const entry = this.subagents.get(toolUseId);
168
+ if (!entry)
169
+ return;
170
+ entry.status = info.ok ? "completed" : "failed";
171
+ entry.completedAt = Date.now();
172
+ if (info.summary) {
173
+ const truncated = info.summary.length > SUBAGENT_ACTIVITY_LIMIT
174
+ ? info.summary.substring(0, SUBAGENT_ACTIVITY_LIMIT) + "…"
175
+ : info.summary;
176
+ entry.lastActivity = truncated;
177
+ }
178
+ }
179
+ /**
180
+ * Returns all tracked subagents in insertion order. Callers that only
181
+ * care about the currently-running ones should filter by status.
182
+ */
183
+ getSubagents() {
184
+ return Array.from(this.subagents.values());
185
+ }
186
+ getActiveSubagents() {
187
+ return this.getSubagents().filter((s) => s.status === "running");
188
+ }
189
+ /**
190
+ * Update the known CLI auto-memory paths (typically one, keyed "auto").
191
+ * Safe to call repeatedly — we merge new keys in rather than clobber, so
192
+ * a transient CLI init that omits a known scope won't wipe it.
193
+ *
194
+ * The CLI reports `memory_paths` on every `system/init` event; the payload
195
+ * is stable within a session and only changes if e.g. the operator moved
196
+ * the profile directory. Callers should not filter — we take whatever the
197
+ * CLI gives us.
198
+ */
199
+ recordMemoryPaths(paths) {
200
+ for (const [scope, raw] of Object.entries(paths)) {
201
+ if (typeof raw !== "string" || raw.length === 0)
202
+ continue;
203
+ if (this.memoryPaths[scope] !== raw) {
204
+ this.memoryPaths[scope] = raw;
205
+ logger.debug(`[activity-tracker] memory_paths.${scope} = ${raw}`);
206
+ }
207
+ }
208
+ }
209
+ /**
210
+ * Record a CLI `system/memory_recall` event. We keep a rolling ring of
211
+ * the most recent N so operator surfaces can show what the CLI has been
212
+ * pulling into context. Stores path/scope metadata only — any
213
+ * `synthesize`-mode content is deliberately dropped (it can be large
214
+ * and is already fed to the model by the CLI).
215
+ */
216
+ recordMemoryRecall(event) {
217
+ const entry = {
218
+ observedAt: Date.now(),
219
+ mode: event.mode,
220
+ memories: event.memories.slice(0, 10).map((m) => ({
221
+ path: m.path,
222
+ scope: m.scope,
223
+ })),
224
+ };
225
+ this.memoryRecallEvents.push(entry);
226
+ if (this.memoryRecallEvents.length > MAX_MEMORY_RECALL_EVENTS) {
227
+ this.memoryRecallEvents.shift();
228
+ }
229
+ }
230
+ /**
231
+ * Snapshot of the observed CLI auto-memory state. Returns a shallow copy
232
+ * so callers can't mutate internal state. Safe to call from /obs and
233
+ * /tasks even when no memory activity has been seen yet — `paths` will
234
+ * simply be empty.
235
+ */
236
+ getMemoryStatus() {
237
+ return {
238
+ paths: { ...this.memoryPaths },
239
+ recentRecalls: this.memoryRecallEvents.slice(),
240
+ };
241
+ }
52
242
  getTaskDescription() {
53
243
  return this.currentTaskDescription;
54
244
  }
@@ -92,6 +282,13 @@ export class ActivityTracker {
92
282
  for (const a of this.recentActions)
93
283
  lines.push(` ${a}`);
94
284
  }
285
+ const activeSubagents = this.getActiveSubagents();
286
+ if (activeSubagents.length > 0) {
287
+ lines.push("Active subagents:");
288
+ for (const s of activeSubagents) {
289
+ lines.push(` ${formatSubagentLine(s)}`);
290
+ }
291
+ }
95
292
  return lines.join("\n");
96
293
  }
97
294
  clear() {
@@ -101,6 +298,12 @@ export class ActivityTracker {
101
298
  this.taskStartedAt = null;
102
299
  this.lastTodos = [];
103
300
  this.recentExchanges = [];
301
+ this.subagents.clear();
302
+ // Memory paths + recall history are intentionally preserved across
303
+ // clears: they describe session-level state (where the CLI is writing
304
+ // memory, what it has recalled) and are useful for diagnosing subtle
305
+ // issues like "did auto-memory ever fire in this session?" across
306
+ // wake-cycle boundaries. They only reset when the process restarts.
104
307
  }
105
308
  push(entry) {
106
309
  this.recentActions.push(entry);
@@ -114,5 +317,50 @@ export class ActivityTracker {
114
317
  this.recentExchanges.shift();
115
318
  }
116
319
  }
320
+ /**
321
+ * Bound the subagent map. Running subagents are never evicted — only
322
+ * already-completed ones age out when we exceed the cap. This protects
323
+ * both against runaway growth and against losing in-flight progress
324
+ * for long-running tasks.
325
+ */
326
+ pruneCompletedSubagents() {
327
+ if (this.subagents.size <= MAX_SUBAGENTS)
328
+ return;
329
+ let overflow = this.subagents.size - MAX_SUBAGENTS;
330
+ for (const [id, entry] of this.subagents) {
331
+ if (overflow <= 0)
332
+ break;
333
+ if (entry.status !== "running") {
334
+ this.subagents.delete(id);
335
+ overflow -= 1;
336
+ }
337
+ }
338
+ }
339
+ }
340
+ /**
341
+ * Render a one-line summary of a subagent for `/tasks` and status surfaces.
342
+ * Kept at module scope so it can be reused by command handlers that want
343
+ * a consistent presentation (e.g. /tasks).
344
+ */
345
+ export function formatSubagentLine(progress) {
346
+ const elapsedSec = Math.round(((progress.completedAt ?? Date.now()) - progress.startedAt) / 1000);
347
+ const label = progress.subagentType ?? "subagent";
348
+ const statusIcon = progress.status === "running"
349
+ ? "🔄"
350
+ : progress.status === "completed"
351
+ ? "✅"
352
+ : "❌";
353
+ const parts = [`${statusIcon} ${label}`];
354
+ parts.push(`(${elapsedSec}s, ${progress.actionCount} step${progress.actionCount === 1 ? "" : "s"})`);
355
+ if (progress.description) {
356
+ const desc = progress.description.length > 80
357
+ ? progress.description.substring(0, 80) + "…"
358
+ : progress.description;
359
+ parts.push(`— ${desc}`);
360
+ }
361
+ if (progress.lastActivity) {
362
+ parts.push(`| last: ${progress.lastActivity}`);
363
+ }
364
+ return parts.join(" ");
117
365
  }
118
366
  //# sourceMappingURL=activity-tracker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-tracker.js","sourceRoot":"","sources":["../../src/agent/activity-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAYtC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAClB,sBAAsB,GAAG,EAAE,CAAC;IAC5B,aAAa,GAAa,EAAE,CAAC;IAC7B,iBAAiB,GAAG,EAAE,CAAC;IACvB,aAAa,GAAkB,IAAI,CAAC;IACpC,SAAS,GAAe,EAAE,CAAC;IAC3B,eAAe,GAAwB,EAAE,CAAC;IAEjC,UAAU,CAAS;IAEpC,YAAY,UAAU,GAAG,EAAE;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,SAAS,CAAC,WAAmB;QAC3B,IAAI,CAAC,sBAAsB,GAAG,WAAW,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAA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