@markusylisiurunen/tau 0.3.89 → 0.3.90

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.
@@ -10,7 +10,8 @@ The host makes model calls and runs services such as web search and remote histo
10
10
 
11
11
  | Operation | Where the credential belongs |
12
12
  | --- | --- |
13
- | Main-agent, subagent, sampling, and maintenance model calls | Session host |
13
+ | Main-agent, native Tau subagent, sampling, and maintenance model calls | Session host |
14
+ | Claude Code subagent subscription login | Claude Code on the execution environment |
14
15
  | OpenAI Codex OAuth accounts | Session host home |
15
16
  | Exa-backed `web.search` and `web.fetch` | Session host |
16
17
  | Remote history replication and queries | Session host |
@@ -22,6 +23,8 @@ The host makes model calls and runs services such as web search and remote histo
22
23
 
23
24
  With local `tau`, all of these are usually one machine. With `tau attach`, a key set only in the attached client's shell does not reach the remote host. Run `tau auth` on the host machine, and set host environment variables where `tau serve` or the SDK host runs. See [ownership and scope](ownership-and-scope.md) for the full boundary.
24
25
 
26
+ Claude Code subagents use a Claude subscription login on the execution environment. Sign in with Claude Code there; `tau auth` does not manage this account. Tau checks the account before sending a task and does not fall back to API billing. See [Claude Code subagents](subagents.md#claude-code-subagents) for setup and extra-usage charges.
27
+
25
28
  ## Provider API keys
26
29
 
27
30
  Tau accepts provider API keys in global configuration:
@@ -24,6 +24,8 @@ The built-in `tau_docs` tool also belongs to the host. It reads the documentatio
24
24
 
25
25
  The **execution environment** is the machine the agent can act on. It owns the agent-visible working directory (`cwd`), home, platform, environment, filesystem, processes, project repository, project configuration and content, `AGENTS.md` files, skills, and command resolution.
26
26
 
27
+ [Claude Code subagents](subagents.md#claude-code-subagents) run their model calls here and keep their subscription login and conversation files here. The host starts, observes, and stops these workers through the execution environment. Their credentials remain with Claude Code.
28
+
27
29
  Tau reads files and runs commands through the execution environment, even when it is on the same machine as the host. Each session has exactly one execution environment. Paths shown to the agent and paths passed to its tools are always paths on that environment.
28
30
 
29
31
  ### Telegram runner
@@ -20,6 +20,8 @@ Give each part only the access it needs:
20
20
 
21
21
  Interruption, timeouts, output limits, and process-group termination limit how long and how much a command runs. They do not ask for approval and cannot undo anything already done. Review destructive commands, and use Tau's normal session operations instead of asking an agent to change Tau's internal files.
22
22
 
23
+ [Claude Code subagents](subagents.md#claude-code-subagents) run on the execution environment with permission checks bypassed and the Claude Code sandbox disabled. They load local Claude settings, project instructions, skills, and normally configured MCP servers. Review those files and server permissions before enabling workers. The parent persona controls the selected built-in tools; Claude Code's own configuration controls its MCP connections. Tau disables hooks and nested agents. Managed Claude policies still apply. Claude credentials and transcripts stay on that environment; Tau does not forward host service credentials or MCP connections. Subscription extra usage can incur charges if enabled in the Claude account.
24
+
23
25
  ## Treat project content as executable policy
24
26
 
25
27
  Tau loads more than source files from the execution environment. It reads project `.tau/config.json`, personas, prompts, skills, `.agents/skills`, and `AGENTS.md` from the working directory and its parents. This content can choose models and tools, add instructions, define workflows, and change which of your global client tools are offered.
@@ -6,7 +6,7 @@ Subagents are background agents that the main agent starts and the host supervis
6
6
 
7
7
  Subagents are general-purpose workers. There are no named types. Several can run at once, each with its own task and conversation.
8
8
 
9
- A subagent behaves like the active main persona, wrapped in instructions that Tau maintains. Those instructions and the subagent's description cannot be configured. Put task-specific instructions, including any relevant skill guidance, in the launch prompt.
9
+ A native Tau subagent behaves like the active main persona, wrapped in instructions that Tau maintains. Those instructions and the subagent's description cannot be configured. Put task-specific instructions, including any relevant skill guidance, in the launch prompt.
10
10
 
11
11
  Whether the agent can start subagents depends on the main persona's tool list. Built-in personas, and custom personas that omit `tools`, enable all five subagent tools. A custom persona with a `tools` list that lacks `spawn_agent` cannot start subagents. Leave out all five subagent tools when no subagent interaction is wanted. There is no other setting to turn subagents on or off. See [personas](personas.md).
12
12
 
@@ -18,7 +18,7 @@ The agent follows this rule itself. Tau checks that a launch is valid, but it do
18
18
 
19
19
  ## Tools
20
20
 
21
- A subagent can receive these tools:
21
+ A native Tau subagent can receive these tools. [Claude Code subagents](#claude-code-subagents) use the corresponding Claude Code tools instead:
22
22
 
23
23
  - `bash`
24
24
  - `write`
@@ -32,7 +32,7 @@ A subagent can receive these tools:
32
32
 
33
33
  A subagent gets each of these that the main persona also has. For example, a main persona with `bash`, `edit`, `history`, and `spawn_agent` gives its subagents `bash`, `edit`, and `history`. Names such as `web` and `history` enable the matching capability in the subagent's `code` tool. MCP uses the host's existing connections, whatever the subagent's working directory. There is no separate tool list for subagents.
34
34
 
35
- Every subagent also gets the built-in `tau_docs` tool, and a persona's `tools` list cannot remove it. Subagents never get the subagent tools, client tools, or TUI tools, so a subagent cannot start subagents of its own. See [tools](tools.md) for how tool availability works in general.
35
+ Every native Tau subagent also gets the built-in `tau_docs` tool, and a persona's `tools` list cannot remove it. Subagents never get the subagent tools, client tools, or TUI tools, so a subagent cannot start subagents of its own. See [tools](tools.md) for how tool availability works in general.
36
36
 
37
37
  ## Models and settings
38
38
 
@@ -46,7 +46,7 @@ A model override uses this exact form:
46
46
 
47
47
  The provider is lowercased. The model ID is kept exactly as written and is case-sensitive. Effort is one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`.
48
48
 
49
- The configured list of launch models is an allowlist. It does not choose a default. The main agent should normally omit the `model` argument to `spawn_agent`, and the subagent then uses the active persona's model and reasoning. When `model` is given, it must exactly match an allowlist entry after normalization. The override changes the provider, model, and reasoning, and keeps the other settings.
49
+ The configured list of launch models is an allowlist. It does not choose a default. The main agent should normally omit the `model` argument to `spawn_agent`, and the subagent then uses the active persona's model and reasoning. When `model` is given, it must exactly match an allowlist entry after normalization. For native Tau subagents, the override changes the provider, model, and reasoning, and keeps the other settings.
50
50
 
51
51
  A model ID may be missing from the catalog if its provider is known (see [models](models.md)). An entry with an invalid provider, model, effort, or format makes the configuration field invalid. Duplicate entries are removed.
52
52
 
@@ -67,17 +67,63 @@ Configure the allowlist with `subagents.launchModels` in `config.json`:
67
67
 
68
68
  The nearest `launchModels` list replaces broader ones; lists are not combined. The resulting list applies to every persona that has `spawn_agent`.
69
69
 
70
+ ## Claude Code subagents
71
+
72
+ The `claude-code` launch provider runs Claude Code through Anthropic's Agent SDK. The main agent uses the usual spawn, list, wait, follow-up, and interrupt tools to manage these workers. Claude Code models are available only as explicit subagent launch overrides.
73
+
74
+ Install Claude Code on the session's execution environment, put `claude` on its login-shell `PATH`, and sign in there with a Claude subscription. A login on the host or attached laptop does not reach a separate execution environment. Tau includes Agent SDK 0.3.308, so no separate SDK installation is needed.
75
+
76
+ Add the desired model/effort combinations to the launch allowlist:
77
+
78
+ ```json
79
+ {
80
+ "subagents": {
81
+ "launchModels": [
82
+ "claude-code/claude-opus-5-5:medium",
83
+ "claude-code/claude-sonnet-5-5:medium",
84
+ "claude-code/claude-haiku-5-5:low"
85
+ ]
86
+ }
87
+ }
88
+ ```
89
+
90
+ These are the three supported model IDs. Effort may be `low`, `medium`, `high`, `xhigh`, or `max`. Each permitted combination needs its own allowlist entry. Model availability also depends on the Claude account and installed Claude Code version. If Claude Code rejects a model, Tau reports the failure.
91
+
92
+ Claude Code manages its conversation, retries, and compaction. Each run allows up to 1,024 agentic turns. Tau passes the selected model, effort, working directory, and task. Other Tau model settings, such as service tier, do not apply. Follow-ups resume the same Claude session.
93
+
94
+ The worker uses Claude Code's native system prompt with a short addition: complete the task autonomously, preserve other agents' work, and return a self-contained result. It cannot ask the parent or user for clarification. Tau does not copy the parent conversation, persona prompt, project instructions, or skill descriptions. The worker is instructed to follow applicable project instructions itself.
95
+
96
+ Claude Code loads its user, project, and local settings and discovers its own instructions and skills. The `Skill` tool is always available. Other native tools follow the parent persona's selection:
97
+
98
+ | Inherited Tau tool | Claude Code tools |
99
+ | ------------------ | ---------------------- |
100
+ | `bash` | Bash, Read, Glob, Grep |
101
+ | `view_image` | Read, Glob, Grep |
102
+ | `write` | Write |
103
+ | `edit` | Edit |
104
+ | `web` | WebSearch, WebFetch |
105
+
106
+ Workers receive no Tau `code` capabilities, host MCP connections, `tau_docs`, or client tools. Nested agents and interactive questions are disabled. Hooks and automatic memory are disabled too. Claude Code discovers its own MCP servers from its normal configuration sources, including project and user configuration on the execution environment. These connections are independent of the parent persona's `mcp` tool selection; Tau does not map or forward its host MCP connections. Managed Claude Code policies still apply.
107
+
108
+ Selected tools use `bypassPermissions`, with Claude Code's sandbox disabled. They run with the execution environment's operating-system authority, like Tau's tools. Review the local Claude settings, skills, and MCP configuration before enabling these workers.
109
+
110
+ Tau displays short assistant updates and tool completion summaries. Full tool output stays in Claude Code's conversation files. Tau records SDK-reported assistant token usage as it arrives, so interruption preserves counts already received. Repeated message blocks and resumed messages are counted once. Final SDK totals reconcile these counts and supply cost estimates, including earlier usage when a session resumes. Cost from an interrupted run remains unavailable until the SDK reports it. The latest assistant usage supplies a context-token estimate; after a successful run, the SDK's context summary supplies the window size and a fuller measurement.
111
+
112
+ Before sending the task, Tau checks that the SDK reports a subscription login without API-key authentication. Claude Code keeps its own credentials. Tau removes API and cloud-provider routing overrides from the child environment and provides no API fallback. Fast mode is disabled. Account-level extra usage can still incur charges; disable it in Claude to use only the included subscription allowance. The SDK's dollar estimates do not report subscription charges.
113
+
114
+ Claude workers share the eight-worker limit and the usual subagent lifetime. Interrupting a worker terminates its process group. A follow-up can resume its Claude session while the parent session remains alive. Host restart, session disposal, and rewind remove workers under the same rules as native Tau subagents. Claude's transcript files remain on disk, but Tau does not use them to restore workers after a restart.
115
+
70
116
  ## Working directory
71
117
 
72
118
  `spawn_agent` normally runs the subagent in the main session's `cwd`. The optional `workingDirectory` may be absolute or relative to that `cwd`. Tau resolves it to an absolute path on the execution environment.
73
119
 
74
- When that path differs from the parent's `cwd`, Tau rebuilds the subagent's context for the new directory. It detects the platform and repository there, reads the applicable `AGENTS.md` files, and discovers that directory's skills.
120
+ For native Tau subagents, when that path differs from the parent's `cwd`, Tau rebuilds the subagent's context for the new directory. It detects the platform and repository there, reads the applicable `AGENTS.md` files, and discovers that directory's skills.
75
121
 
76
- The new directory does **not** change the subagent's persona, model catalog, runtime configuration, credentials, or tool policy. Those always come from the parent session. Configuration in the new directory is read only where context needs it, such as for skill discovery.
122
+ For native Tau subagents, the new directory does not change the persona, model catalog, runtime configuration, credentials, or tool policy. Those come from the parent session. Configuration in the new directory is read only where context needs it, such as for skill discovery.
77
123
 
78
124
  `workingDirectory` is always a path on the execution environment, which matters in monorepos and hosted environments. The host and attached clients never resolve it against their own filesystems.
79
125
 
80
- A launch fails if Tau cannot build context for the directory, if the directory is invalid for the environment, or if the environment cannot resolve working directories. A path that resolves to the parent's `cwd`, such as `.`, reuses the parent's context.
126
+ A native Tau launch fails if Tau cannot build context for the directory, if the directory is invalid for the environment, or if the environment cannot resolve working directories. A path that resolves to the parent's `cwd`, such as `.`, reuses the parent's context. Claude Code workers load context themselves in the selected directory; an invalid directory fails when the worker starts.
81
127
 
82
128
  ## Lifecycle and subagent tools
83
129
 
@@ -113,7 +159,7 @@ In the TUI, `Ctrl+G` interrupts the selected running subagent. Interrupting the
113
159
 
114
160
  Subagents belong to the running session on the host, not to an attached TUI. Detaching a client, or losing the connection, does not stop them while the session stays alive. Another client can attach to the session and see their current state.
115
161
 
116
- Subagents do not survive the end of a session on the host or a host restart. Their status may be saved while the session is live, but recovery removes those records, because the subagents' conversations no longer exist. A recovered session cannot send input to an old subagent ID.
162
+ Subagents do not survive the end of a session on the host or a host restart. Their status may be saved while the session is live, but recovery removes those records, because their runtimes no longer exist. A recovered session cannot send input to an old subagent ID.
117
163
 
118
164
  Rewind also removes subagents that were started by an assistant message the rewind removed. Host shutdown or session disposal interrupts and removes all subagents.
119
165
 
@@ -6,6 +6,7 @@ import { createAutoCompactionArchiver } from "../session/auto_compaction_archive
6
6
  import { ToolCatalog } from "../tools/catalog.js";
7
7
  import { appendUsageLogEntry, getUsageCostTotal, getUsageTotals, } from "../usage/logs.js";
8
8
  import { extractAssistantText } from "../utils/messages.js";
9
+ import { ClaudeCodeRuntime } from "./claude_code_runtime.js";
9
10
  import { formatActiveSubagentsForCompaction } from "./format.js";
10
11
  const MAX_ACTIVE_SUBAGENTS = 8;
11
12
  async function raceWithAbort(promise, signal) {
@@ -69,31 +70,43 @@ export class AgentSupervisor {
69
70
  }
70
71
  const id = randomUUID();
71
72
  const runtimeConfig = { ...options.runtimeConfig, workingDirectory };
72
- const persona = {
73
- id: `${options.personaId ?? "agent"}-subagent`,
74
- label: "subagent",
75
- description: "Background agent",
76
- source: "project",
77
- systemPrompt: runtimeConfig.systemPrompt,
78
- model: runtimeConfig.model,
79
- settings: runtimeConfig.settings,
80
- tools: runtimeConfig.tools,
81
- subagentLaunchModels: [],
82
- };
83
- const runtime = new AgentRuntime({
84
- spec: createAgentSpec({
85
- autoCompactThresholdTokens: null,
86
- ...resolveAgentModel(persona, options.config, {
87
- includeModelNotice: true,
88
- deps: this.deps,
73
+ let runtime;
74
+ let reasoning;
75
+ if (runtimeConfig.kind === "claude-code") {
76
+ runtime = new ClaudeCodeRuntime({
77
+ config: runtimeConfig,
78
+ backend: options.backend,
79
+ onEvent: async (event) => await this.recordClaudeCodeEvent(id, event),
80
+ });
81
+ reasoning = runtimeConfig.effort;
82
+ }
83
+ else {
84
+ runtime = new AgentRuntime({
85
+ spec: createAgentSpec({
86
+ autoCompactThresholdTokens: null,
87
+ ...resolveAgentModel({
88
+ id: `${options.personaId ?? "agent"}-subagent`,
89
+ label: "subagent",
90
+ description: "Background agent",
91
+ source: "project",
92
+ systemPrompt: runtimeConfig.systemPrompt,
93
+ model: runtimeConfig.model,
94
+ settings: runtimeConfig.settings,
95
+ tools: runtimeConfig.tools,
96
+ subagentLaunchModels: [],
97
+ }, options.config, {
98
+ includeModelNotice: true,
99
+ deps: this.deps,
100
+ }),
101
+ systemPrompt: runtimeConfig.systemPrompt,
102
+ tools: ToolCatalog.createSubagentRegistry(runtimeConfig.tools, options.backend, workingDirectory, options.config, options.bashJobs, options.history, options.mcp),
89
103
  }),
90
- systemPrompt: runtimeConfig.systemPrompt,
91
- tools: ToolCatalog.createSubagentRegistry(runtimeConfig.tools, options.backend, workingDirectory, options.config, options.bashJobs, options.history, options.mcp),
92
- }),
93
- eventSink: async (event) => await this.recordAgentEvent(id, event),
94
- clock: this.deps.clock,
95
- archiveAutoCompaction: createAutoCompactionArchiver(options.backend),
96
- });
104
+ eventSink: async (event) => await this.recordAgentEvent(id, event),
105
+ clock: this.deps.clock,
106
+ archiveAutoCompaction: createAutoCompactionArchiver(options.backend),
107
+ });
108
+ reasoning = runtime.spec.attribution.reasoningEffort;
109
+ }
97
110
  const createdAt = this.deps.clock.now();
98
111
  const record = {
99
112
  id,
@@ -101,12 +114,11 @@ export class AgentSupervisor {
101
114
  model: {
102
115
  provider: runtimeConfig.model.provider,
103
116
  id: runtimeConfig.model.id,
104
- reasoning: runtime.spec.attribution.reasoningEffort,
117
+ reasoning,
105
118
  },
106
119
  workingDirectory,
107
120
  createdAt,
108
121
  originHistoryEntryId: options.originHistoryEntryId,
109
- runtimeConfig,
110
122
  personaId: options.personaId,
111
123
  runtime,
112
124
  run: {
@@ -122,8 +134,9 @@ export class AgentSupervisor {
122
134
  cacheRead: 0,
123
135
  cacheWrite: 0,
124
136
  contextWindowUsageTokens: 0,
125
- contextWindow: runtimeConfig.model.contextWindow,
137
+ contextWindow: runtimeConfig.kind === "native" ? runtimeConfig.model.contextWindow : 0,
126
138
  },
139
+ claudeMessageUsage: new Map(),
127
140
  toolPresentations: new Map(),
128
141
  blockedToolCalls: new Map(),
129
142
  completion: Promise.resolve(undefined),
@@ -193,15 +206,27 @@ export class AgentSupervisor {
193
206
  record.completion = this.emit({ type: eventType, state: this.toSnapshot(record) })
194
207
  .then(async () => {
195
208
  if (record.run.interruptRequested) {
196
- return {
197
- aborted: true,
198
- terminalResult: { aborted: true },
199
- };
209
+ this.finishInterrupted(record);
210
+ }
211
+ else if (record.runtime instanceof ClaudeCodeRuntime) {
212
+ const completion = await record.runtime.submit(prompt);
213
+ if (record.run.interruptRequested || completion.status === "interrupted") {
214
+ this.finishInterrupted(record);
215
+ }
216
+ else if (completion.result.failed) {
217
+ this.finishFailed(record, {
218
+ kind: "provider-error",
219
+ message: completion.result.response,
220
+ stopReason: "error",
221
+ });
222
+ }
223
+ else {
224
+ this.finishSucceeded(record, completion.result.response);
225
+ }
226
+ }
227
+ else {
228
+ this.applyTurnResult(record, await record.runtime.submit(prompt));
200
229
  }
201
- return await record.runtime.submit(prompt);
202
- })
203
- .then((result) => {
204
- this.applyTurnResult(record, result);
205
230
  return record;
206
231
  })
207
232
  .catch((error) => {
@@ -259,13 +284,16 @@ export class AgentSupervisor {
259
284
  });
260
285
  return;
261
286
  }
287
+ this.finishSucceeded(record, extractAssistantText(result.finalMessage).trim());
288
+ }
289
+ finishSucceeded(record, response) {
262
290
  record.run = {
263
291
  revision: record.run.revision,
264
292
  status: "succeeded",
265
293
  startedAt: record.run.startedAt,
266
294
  finishedAt: this.deps.clock.now(),
267
295
  interruptRequested: false,
268
- response: extractAssistantText(result.finalMessage).trim(),
296
+ response,
269
297
  };
270
298
  }
271
299
  finishInterrupted(record) {
@@ -288,6 +316,99 @@ export class AgentSupervisor {
288
316
  failure,
289
317
  };
290
318
  }
319
+ async recordClaudeCodeEvent(id, event) {
320
+ const record = this.records.get(id);
321
+ if (!record)
322
+ return;
323
+ if (event.type === "usage" || event.type === "result") {
324
+ let reported = event.usage;
325
+ if (event.type === "usage") {
326
+ const previous = record.claudeMessageUsage.get(event.messageId);
327
+ // Final result totals already cover these messages, including resumed replays.
328
+ if (previous === null)
329
+ return;
330
+ const current = {
331
+ input: Math.max(previous?.input ?? 0, event.usage.input),
332
+ output: Math.max(previous?.output ?? 0, event.usage.output),
333
+ cacheRead: Math.max(previous?.cacheRead ?? 0, event.usage.cacheRead),
334
+ cacheWrite: Math.max(previous?.cacheWrite ?? 0, event.usage.cacheWrite),
335
+ };
336
+ record.claudeMessageUsage.set(event.messageId, current);
337
+ reported = {
338
+ input: record.usage.input + current.input - (previous?.input ?? 0),
339
+ output: record.usage.output + current.output - (previous?.output ?? 0),
340
+ cacheRead: record.usage.cacheRead + current.cacheRead - (previous?.cacheRead ?? 0),
341
+ cacheWrite: record.usage.cacheWrite + current.cacheWrite - (previous?.cacheWrite ?? 0),
342
+ };
343
+ if (getUsageTotals(current).total === getUsageTotals(previous).total)
344
+ return;
345
+ record.usage.contextWindowUsageTokens = getUsageTotals(current).total;
346
+ }
347
+ else {
348
+ for (const messageId of record.claudeMessageUsage.keys()) {
349
+ record.claudeMessageUsage.set(messageId, null);
350
+ }
351
+ record.usage.contextWindowUsageTokens = event.usage.contextWindowUsageTokens;
352
+ record.usage.contextWindow = event.usage.contextWindow;
353
+ }
354
+ // SDK totals include the history restored on resume. Record only the delta,
355
+ // and replace (rather than sum) the current context-window measurement.
356
+ const usage = getUsageTotals({
357
+ input: Math.max(0, reported.input - record.usage.input),
358
+ output: Math.max(0, reported.output - record.usage.output),
359
+ cacheRead: Math.max(0, reported.cacheRead - record.usage.cacheRead),
360
+ cacheWrite: Math.max(0, reported.cacheWrite - record.usage.cacheWrite),
361
+ });
362
+ const cost = event.type === "result" ? Math.max(0, event.cost - record.costTotal) : 0;
363
+ // Startup failures can report zero totals even for a resumed session.
364
+ record.costTotal += cost;
365
+ record.usage = {
366
+ ...record.usage,
367
+ input: record.usage.input + usage.input,
368
+ output: record.usage.output + usage.output,
369
+ cacheRead: record.usage.cacheRead + usage.cacheRead,
370
+ cacheWrite: record.usage.cacheWrite + usage.cacheWrite,
371
+ };
372
+ (this.options.recordUsage ?? appendUsageLogEntry)({
373
+ timestamp: this.deps.clock.now(),
374
+ sessionId: record.id,
375
+ personaId: record.personaId,
376
+ provider: record.model.provider,
377
+ model: record.model.id,
378
+ api: "claude-agent-sdk",
379
+ reasoningEffort: record.model.reasoning,
380
+ usage,
381
+ cost: { total: cost },
382
+ agent: { type: "subagent" },
383
+ });
384
+ await this.emit({ type: "subagent_updated", state: this.toSnapshot(record) });
385
+ }
386
+ else if (event.type === "assistant") {
387
+ await this.emit({
388
+ type: "subagent_activity",
389
+ state: this.toSnapshot(record),
390
+ activity: { type: "assistant", text: event.text },
391
+ });
392
+ }
393
+ else if (event.type === "tool") {
394
+ await this.emit({
395
+ type: "subagent_activity",
396
+ state: this.toSnapshot(record),
397
+ activity: {
398
+ type: "tool",
399
+ toolName: event.name,
400
+ outcome: event.failed ? "failed" : "succeeded",
401
+ presentation: {
402
+ action: event.failed ? "failed" : "completed",
403
+ subject: event.subject,
404
+ subjectWrap: "word",
405
+ details: [],
406
+ metadata: [],
407
+ },
408
+ },
409
+ });
410
+ }
411
+ }
291
412
  async recordAgentEvent(id, event) {
292
413
  const record = this.records.get(id);
293
414
  if (!record)
@@ -302,7 +423,7 @@ export class AgentSupervisor {
302
423
  cacheRead: record.usage.cacheRead + usage.cacheRead,
303
424
  cacheWrite: record.usage.cacheWrite + usage.cacheWrite,
304
425
  contextWindowUsageTokens: usage.input + usage.output + usage.cacheRead + usage.cacheWrite,
305
- contextWindow: record.runtimeConfig.model.contextWindow,
426
+ contextWindow: record.usage.contextWindow,
306
427
  };
307
428
  (this.options.recordUsage ?? appendUsageLogEntry)({
308
429
  timestamp: event.message.timestamp,
@@ -1 +1 @@
1
- {"version":3,"file":"agent_supervisor.js","sourceRoot":"","sources":["../../../src/core/subagents/agent_supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAiB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EA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ACzC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC;YAChC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE;SAC3B,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,KAAoB;QACrC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ export const CLAUDE_CODE_PROVIDER = "claude-code";
2
+ export const CLAUDE_CODE_MODEL_IDS = [
3
+ "claude-opus-5-5",
4
+ "claude-sonnet-5-5",
5
+ "claude-haiku-5-5",
6
+ ];
7
+ export function resolveClaudeCodeModel(id) {
8
+ const modelId = CLAUDE_CODE_MODEL_IDS.find((candidate) => candidate === id);
9
+ return modelId ? { provider: CLAUDE_CODE_PROVIDER, id: modelId } : undefined;
10
+ }
11
+ //# sourceMappingURL=claude_code_models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude_code_models.js","sourceRoot":"","sources":["../../../src/core/subagents/claude_code_models.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;CACV,CAAC;AAQX,MAAM,UAAU,sBAAsB,CAAC,EAAU;IAC/C,MAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;IAC5E,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ import { CLAUDE_CODE_MODEL_IDS } from "./claude_code_models.js";
3
+ const tokenCount = z.number().finite().nonnegative();
4
+ const tokenUsageSchema = z.object({
5
+ input: tokenCount,
6
+ output: tokenCount,
7
+ cacheRead: tokenCount,
8
+ cacheWrite: tokenCount,
9
+ });
10
+ export const claudeCodeInputSchema = z.object({
11
+ prompt: z.string(),
12
+ cwd: z.string(),
13
+ model: z.enum(CLAUDE_CODE_MODEL_IDS),
14
+ effort: z.enum(["low", "medium", "high", "xhigh", "max"]),
15
+ tools: z.array(z.string()),
16
+ sessionId: z.string().uuid().optional(),
17
+ });
18
+ export const claudeCodeEventSchema = z.discriminatedUnion("type", [
19
+ z.object({ type: z.literal("session"), id: z.string().uuid() }),
20
+ z.object({ type: z.literal("assistant"), text: z.string().max(8192) }),
21
+ z.object({
22
+ type: z.literal("usage"),
23
+ messageId: z.string().min(1).max(256),
24
+ usage: tokenUsageSchema,
25
+ }),
26
+ z.object({
27
+ type: z.literal("tool"),
28
+ name: z.string().max(256),
29
+ subject: z.string().max(1024),
30
+ failed: z.boolean(),
31
+ }),
32
+ z.object({
33
+ type: z.literal("result"),
34
+ response: z.string().max(4 * 1024 * 1024),
35
+ failed: z.boolean(),
36
+ usage: tokenUsageSchema.extend({
37
+ contextWindowUsageTokens: tokenCount,
38
+ contextWindow: tokenCount,
39
+ }),
40
+ cost: tokenCount,
41
+ }),
42
+ z.object({ type: z.literal("error"), message: z.string().max(8192) }),
43
+ ]);
44
+ //# sourceMappingURL=claude_code_protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude_code_protocol.js","sourceRoot":"","sources":["../../../src/core/subagents/claude_code_protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,WAAW,EAA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