@otto-code/protocol 0.5.1 → 0.5.4

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.
package/dist/messages.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { TerminalActivitySchema } from "./terminal-activity.js";
3
+ import { RunSchema } from "./orchestration.js";
3
4
  import { ArtifactMetadataSchema } from "./artifacts/types.js";
4
5
  import { ArtifactListRequestSchema, ArtifactCreateRequestSchema, ArtifactUpdateRequestSchema, ArtifactRegenerateRequestSchema, ArtifactCancelRequestSchema, ArtifactDeleteRequestSchema, ArtifactStarRequestSchema, ArtifactGetContentRequestSchema, ArtifactListResponseSchema, ArtifactCreateResponseSchema, ArtifactUpdateResponseSchema, ArtifactRegenerateResponseSchema, ArtifactCancelResponseSchema, ArtifactDeleteResponseSchema, ArtifactStarResponseSchema, ArtifactGetContentResponseSchema, ArtifactCreatedNotificationSchema, ArtifactUpdatedNotificationSchema, ArtifactDeletedNotificationSchema, } from "./artifacts/rpc-schemas.js";
5
6
  import { CLIENT_CAPS } from "./client-capabilities.js";
@@ -139,13 +140,20 @@ export const MutableGitHostingConfigSchema = z
139
140
  // agent-personalities.ts) so personalities persisted before the split keep their
140
141
  // role rather than silently losing it.
141
142
  export const PERSONALITY_ROLES = [
143
+ // Surfaces — the interactive / host-facing entry points.
142
144
  "chatter",
143
145
  "artificer",
144
146
  "scheduler",
145
- "writer",
146
- "coder",
147
+ // Thinking workers — read-only, return structured findings, never edit.
148
+ "researcher",
149
+ "planner",
147
150
  "judger",
148
151
  "advisor",
152
+ // Making workers — produce code, design, or short text.
153
+ "coder",
154
+ "designer",
155
+ "writer",
156
+ // Conductor — the sole role whose whole job is planning and driving a team.
149
157
  "orchestrator",
150
158
  ];
151
159
  // Two glow colors for the personality's thinking spinner (BlobLoader glowA/glowB).
@@ -198,6 +206,75 @@ const MutableAgentPersonalitiesConfigSchema = z
198
206
  personalities: z.array(AgentPersonalitySchema).default([]),
199
207
  })
200
208
  .passthrough();
209
+ // Patch shape declared explicitly rather than via .partial(): partial() keeps
210
+ // the personalities .default([]), so a patch touching the section without an
211
+ // explicit personalities array would have an empty array injected and
212
+ // deep-merge would wipe the stored roster.
213
+ const MutableAgentPersonalitiesConfigPatchSchema = z
214
+ .object({
215
+ personalities: z.array(AgentPersonalitySchema).optional(),
216
+ })
217
+ .passthrough();
218
+ // A team's avatar. v1 ships only `color` (hex, validated at the editor like
219
+ // spinner colors); `imageId` is reserved for the future themed avatar set —
220
+ // when present it wins over color, and color stays the fallback so an old
221
+ // client that doesn't know `imageId` keeps rendering the swatch. Plain
222
+ // strings for forward compat.
223
+ const AgentTeamAvatarSchema = z
224
+ .object({
225
+ color: z.string().min(1).optional(),
226
+ imageId: z.string().min(1).optional(),
227
+ })
228
+ .passthrough();
229
+ // A named, per-host grouping of agent personalities that acts as an operating
230
+ // template: which personalities are on deck, plus a shared team prompt stacked
231
+ // directly ahead of the member's personality prompt at spawn. `id` is the
232
+ // stable identity everything binds to; `name` is a freely-renamable label.
233
+ // `memberIds` bind personality ids (order = display order) — an entry pointing
234
+ // at a deleted personality is tolerated and ignored everywhere, then pruned on
235
+ // the next save of that team. Membership is many-to-many.
236
+ export const AgentTeamSchema = z
237
+ .object({
238
+ id: z.string().min(1),
239
+ name: z.string().min(1),
240
+ avatar: AgentTeamAvatarSchema.optional(),
241
+ teamPrompt: z.string().optional(),
242
+ memberIds: z.array(z.string().min(1)).optional(),
243
+ })
244
+ .passthrough();
245
+ const MutableAgentTeamsConfigSchema = z
246
+ .object({
247
+ teams: z.array(AgentTeamSchema).default([]),
248
+ // The host's active team id; null/absent = no team active (exactly legacy
249
+ // behavior). Host-scoped daemon config rather than device-local: the team
250
+ // prompt is applied daemon-side at spawn, so headless spawns (MCP
251
+ // create_agent, schedule runs) must see it, and a patch from any client
252
+ // hot-reloads the switch to every connected client.
253
+ activeTeamId: z.string().nullable().optional(),
254
+ })
255
+ .passthrough();
256
+ // Patch shape declared explicitly rather than via .partial(): partial() keeps
257
+ // the teams .default([]), so a patch that only touches activeTeamId would have
258
+ // an empty array injected and deep-merge would wipe the stored teams.
259
+ const MutableAgentTeamsConfigPatchSchema = z
260
+ .object({
261
+ teams: z.array(AgentTeamSchema).optional(),
262
+ activeTeamId: z.string().nullable().optional(),
263
+ })
264
+ .passthrough();
265
+ export const ModelTierSchema = z.enum(["deep", "standard", "fast"]);
266
+ // A user's explicit tier tag for one model of one provider. The daemon stamps
267
+ // `model.tier` at ingest, preferring a matching override here over inference
268
+ // (see model-tiers.ts). Stored as an array (not a nested record) so a patch
269
+ // replaces it wholesale — that's how a tag gets cleared, since deep-merge can't
270
+ // delete a record key.
271
+ export const ModelTierOverrideSchema = z
272
+ .object({
273
+ provider: z.string().min(1),
274
+ modelId: z.string().min(1),
275
+ tier: ModelTierSchema,
276
+ })
277
+ .passthrough();
201
278
  export const MutableDaemonConfigSchema = z
202
279
  .object({
203
280
  mcp: z
@@ -220,6 +297,14 @@ export const MutableDaemonConfigSchema = z
220
297
  // feature; defaults to an empty roster so a new client parsing an old
221
298
  // daemon's config still sees a well-formed section.
222
299
  agentPersonalities: MutableAgentPersonalitiesConfigSchema.default({ personalities: [] }),
300
+ // Per-host agent teams + the active team id. Gated by the agentTeams
301
+ // feature; defaults to an empty section so a new client parsing an old
302
+ // daemon's config still sees a well-formed shape.
303
+ agentTeams: MutableAgentTeamsConfigSchema.default({ teams: [] }),
304
+ // Per-host user overrides of model tiers, keyed by provider + model id.
305
+ // Gated by the modelTierOverrides feature; defaults empty so a new client
306
+ // parsing an old daemon's config still sees a well-formed array.
307
+ modelTierOverrides: z.array(ModelTierOverrideSchema).default([]),
223
308
  })
224
309
  .passthrough();
225
310
  export const MutableDaemonConfigPatchSchema = z
@@ -245,7 +330,14 @@ export const MutableDaemonConfigPatchSchema = z
245
330
  // Gated by server_info features.agentPersonalities. A patch replaces the
246
331
  // full roster (read-modify-write the array), matching how terminalProfiles
247
332
  // and metadataGeneration.providers patch.
248
- agentPersonalities: MutableAgentPersonalitiesConfigSchema.partial().optional(),
333
+ agentPersonalities: MutableAgentPersonalitiesConfigPatchSchema.optional(),
334
+ // Gated by server_info features.agentTeams. A `teams` patch replaces the
335
+ // full array (read-modify-write), matching agentPersonalities;
336
+ // `activeTeamId: null` deactivates the team without touching the array.
337
+ agentTeams: MutableAgentTeamsConfigPatchSchema.optional(),
338
+ // Gated by server_info features.modelTierOverrides. Replaces the full array
339
+ // (read-modify-write), so removing an entry clears that model's tag.
340
+ modelTierOverrides: z.array(ModelTierOverrideSchema).optional(),
249
341
  })
250
342
  .partial()
251
343
  .passthrough();
@@ -308,6 +400,12 @@ const AgentModelDefinitionSchema = z.object({
308
400
  contextWindowMaxTokens: z.number().optional(),
309
401
  thinkingOptions: z.array(AgentSelectOptionSchema).optional(),
310
402
  defaultThinkingOptionId: z.string().optional(),
403
+ // Daemon-stamped capability tier (deep/standard/fast). Optional: absent on old
404
+ // daemons and on models neither classified nor user-tagged.
405
+ tier: ModelTierSchema.optional(),
406
+ // False when the model can't run the provider's "auto" permission mode.
407
+ // Optional: absent on old daemons and when supported/unknown.
408
+ supportsAutoMode: z.boolean().optional(),
311
409
  });
312
410
  export const ProviderSnapshotEntrySchema = z.object({
313
411
  provider: AgentProviderSchema,
@@ -693,6 +791,13 @@ export const AgentSnapshotPayloadSchema = z.object({
693
791
  persistence: AgentPersistenceHandleSchema.nullable(),
694
792
  runtimeInfo: AgentRuntimeInfoSchema.optional(),
695
793
  lastUsage: AgentUsageSchema.optional(),
794
+ // Honest cumulative token total (Σ across the whole run) from the provider,
795
+ // for the subagents-track cost readout — the only currency that works for
796
+ // cost-less local models. Observed subagents source it from the provider's
797
+ // per-task usage.total_tokens (already cumulative-per-subagent). Purely
798
+ // additive; absent ⇒ no readout. Old clients ignore it.
799
+ // See projects/subagents-cleanup/subagents-cleanup.md (Item 3).
800
+ cumulativeTokens: z.number().optional(),
696
801
  lastError: z.string().optional(),
697
802
  title: z.string().nullable(),
698
803
  labels: z.record(z.string(), z.string()).default({}),
@@ -1224,6 +1329,38 @@ export const ProviderUsageListRequestMessageSchema = z.object({
1224
1329
  type: z.literal("provider.usage.list.request"),
1225
1330
  requestId: z.string(),
1226
1331
  });
1332
+ // Daemon-wide "fun stats" counters — see docs/data-model.md ActivityStatsStore.
1333
+ // Every field defaults to 0 so old and new daemons/clients stay compatible as
1334
+ // counters are added later.
1335
+ export const ActivityCountersSchema = z.object({
1336
+ messagesSent: z.number().default(0),
1337
+ messagesReceived: z.number().default(0),
1338
+ tokensSent: z.number().default(0),
1339
+ tokensReceived: z.number().default(0),
1340
+ agentsCreated: z.number().default(0),
1341
+ runsOrchestrated: z.number().default(0),
1342
+ subagentsInvoked: z.number().default(0),
1343
+ backgroundTasksInvoked: z.number().default(0),
1344
+ thoughts: z.number().default(0),
1345
+ toolsCalled: z.number().default(0),
1346
+ artifactsCreated: z.number().default(0),
1347
+ schedulesExecuted: z.number().default(0),
1348
+ });
1349
+ export const StatsActivityGetRequestMessageSchema = z.object({
1350
+ type: z.literal("stats.activity.get.request"),
1351
+ requestId: z.string(),
1352
+ });
1353
+ export const StatsActivityGetResponseMessageSchema = z.object({
1354
+ type: z.literal("stats.activity.get.response"),
1355
+ payload: z.object({
1356
+ requestId: z.string(),
1357
+ today: ActivityCountersSchema,
1358
+ yesterday: ActivityCountersSchema,
1359
+ last7Days: ActivityCountersSchema,
1360
+ last30Days: ActivityCountersSchema,
1361
+ allTime: ActivityCountersSchema,
1362
+ }),
1363
+ });
1227
1364
  export const AgentContextGetUsageRequestMessageSchema = z.object({
1228
1365
  type: z.literal("agent.context.get_usage.request"),
1229
1366
  agentId: z.string(),
@@ -1359,6 +1496,56 @@ export const AgentSubagentStopResponseMessageSchema = z.object({
1359
1496
  type: z.literal("agent.subagent.stop.response"),
1360
1497
  payload: AgentActionResponsePayloadSchema,
1361
1498
  });
1499
+ // A background shell task launched by a provider's own Bash tool (Claude:
1500
+ // run_in_background). Not an agent, not a subagent — a plain shell process
1501
+ // the daemon tracks for the parent agent's Background Tasks track.
1502
+ // COMPAT(backgroundShellTasks): added in v0.5.3, drop the gate when daemon floor >= v0.5.3.
1503
+ export const BackgroundShellTaskInfoSchema = z.object({
1504
+ id: z.string(),
1505
+ parentAgentId: z.string(),
1506
+ provider: z.string(),
1507
+ command: z.string().optional(),
1508
+ description: z.string().optional(),
1509
+ status: z.enum(["running", "idle", "error", "closed"]),
1510
+ requiresAttention: z.boolean().optional(),
1511
+ createdAt: z.string(),
1512
+ updatedAt: z.string(),
1513
+ archivedAt: z.string().optional(),
1514
+ });
1515
+ // Pushed with the full current set of background shell tasks for a parent
1516
+ // agent whenever any of them changes (start/progress/settle/clear) — same
1517
+ // full-list reconciliation shape as TerminalsChangedSchema.
1518
+ export const BackgroundShellTasksChangedSchema = z.object({
1519
+ type: z.literal("background_shell_tasks_changed"),
1520
+ payload: z.object({
1521
+ parentAgentId: z.string(),
1522
+ tasks: z.array(BackgroundShellTaskInfoSchema),
1523
+ }),
1524
+ });
1525
+ // Stop a running background shell task. The daemon resolves it to the owning
1526
+ // provider session's task and calls stopTask, same as agent.subagent.stop.
1527
+ export const AgentBackgroundTaskStopRequestMessageSchema = z.object({
1528
+ type: z.literal("agent.background_task.stop.request"),
1529
+ parentAgentId: z.string(),
1530
+ taskId: z.string(),
1531
+ requestId: z.string(),
1532
+ });
1533
+ export const AgentBackgroundTaskStopResponseMessageSchema = z.object({
1534
+ type: z.literal("agent.background_task.stop.response"),
1535
+ payload: AgentActionResponsePayloadSchema,
1536
+ });
1537
+ // Clear one or more terminal background shell tasks from the track. Still-live
1538
+ // tasks are stopped best-effort first.
1539
+ export const AgentBackgroundTaskClearRequestMessageSchema = z.object({
1540
+ type: z.literal("agent.background_task.clear.request"),
1541
+ parentAgentId: z.string(),
1542
+ taskIds: z.array(z.string()),
1543
+ requestId: z.string(),
1544
+ });
1545
+ export const AgentBackgroundTaskClearResponseMessageSchema = z.object({
1546
+ type: z.literal("agent.background_task.clear.response"),
1547
+ payload: AgentActionResponsePayloadSchema,
1548
+ });
1362
1549
  // Switch a running agent to an Agent Personality (or clear with null). The
1363
1550
  // daemon re-resolves the id against the roster + the agent's cwd provider
1364
1551
  // snapshot and applies the full personality live — system prompt, identity
@@ -1525,6 +1712,80 @@ export const CheckoutGitLogAppendedNotificationSchema = z.object({
1525
1712
  entries: z.array(GitOperationLogEntrySchema),
1526
1713
  }),
1527
1714
  });
1715
+ // ── Orchestration runs (agent-orchestration) ────────────────────────────────
1716
+ // Daemon-owned multi-agent Run projection + control. Gated by
1717
+ // server_info.features.agentOrchestration. See projects/agent-orchestration.
1718
+ export const RunsGetSnapshotRequestSchema = z.object({
1719
+ type: z.literal("runs.get_snapshot.request"),
1720
+ requestId: z.string(),
1721
+ });
1722
+ export const RunsGetSnapshotResponseSchema = z.object({
1723
+ type: z.literal("runs.get_snapshot.response"),
1724
+ payload: z.object({
1725
+ runs: z.array(RunSchema),
1726
+ requestId: z.string(),
1727
+ }),
1728
+ });
1729
+ // Single-run push, broadcast on every phase/status change. Clients merge by id.
1730
+ export const RunsUpdatedNotificationSchema = z.object({
1731
+ type: z.literal("runs.updated.notification"),
1732
+ payload: z.object({
1733
+ run: RunSchema,
1734
+ }),
1735
+ });
1736
+ // Answer an attended run's `gate` phase (approve or reject, with an optional
1737
+ // note). `accepted` is false when the run wasn't awaiting a gate.
1738
+ export const RunsGateRespondRequestSchema = z.object({
1739
+ type: z.literal("runs.gate_respond.request"),
1740
+ runId: z.string(),
1741
+ phaseId: z.string(),
1742
+ approved: z.boolean(),
1743
+ note: z.string().optional(),
1744
+ requestId: z.string(),
1745
+ });
1746
+ export const RunsGateRespondResponseSchema = z.object({
1747
+ type: z.literal("runs.gate_respond.response"),
1748
+ payload: z.object({
1749
+ runId: z.string(),
1750
+ accepted: z.boolean(),
1751
+ requestId: z.string(),
1752
+ }),
1753
+ });
1754
+ export const RunsCancelRequestSchema = z.object({
1755
+ type: z.literal("runs.cancel.request"),
1756
+ runId: z.string(),
1757
+ requestId: z.string(),
1758
+ });
1759
+ export const RunsCancelResponseSchema = z.object({
1760
+ type: z.literal("runs.cancel.response"),
1761
+ payload: z.object({
1762
+ runId: z.string(),
1763
+ canceled: z.boolean(),
1764
+ requestId: z.string(),
1765
+ }),
1766
+ });
1767
+ // Delete every finished (done/failed/canceled) run from disk and memory.
1768
+ // Active/paused runs are left untouched. Gated by
1769
+ // server_info.features.runsClear.
1770
+ export const RunsClearRequestSchema = z.object({
1771
+ type: z.literal("runs.clear.request"),
1772
+ requestId: z.string(),
1773
+ });
1774
+ export const RunsClearResponseSchema = z.object({
1775
+ type: z.literal("runs.clear.response"),
1776
+ payload: z.object({
1777
+ runIds: z.array(z.string()),
1778
+ requestId: z.string(),
1779
+ }),
1780
+ });
1781
+ // Broadcast to every connected client (including the requester) so all
1782
+ // caches drop the same runs, mirroring runs.updated.notification's upsert.
1783
+ export const RunsClearedNotificationSchema = z.object({
1784
+ type: z.literal("runs.cleared.notification"),
1785
+ payload: z.object({
1786
+ runIds: z.array(z.string()),
1787
+ }),
1788
+ });
1528
1789
  // Namespaced successor to checkout_commit_request: per-file selection and
1529
1790
  // structured errors. Gated by server_info.features.checkoutGitCommit; the flat
1530
1791
  // RPC stays accepted for old clients.
@@ -2223,6 +2484,7 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
2223
2484
  RefreshProvidersSnapshotRequestMessageSchema,
2224
2485
  ProviderDiagnosticRequestMessageSchema,
2225
2486
  ProviderUsageListRequestMessageSchema,
2487
+ StatsActivityGetRequestMessageSchema,
2226
2488
  AgentContextGetUsageRequestMessageSchema,
2227
2489
  ResumeAgentRequestMessageSchema,
2228
2490
  ImportAgentRequestMessageSchema,
@@ -2239,6 +2501,8 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
2239
2501
  SetAgentFeatureRequestMessageSchema,
2240
2502
  AgentDetachRequestMessageSchema,
2241
2503
  AgentSubagentStopRequestMessageSchema,
2504
+ AgentBackgroundTaskStopRequestMessageSchema,
2505
+ AgentBackgroundTaskClearRequestMessageSchema,
2242
2506
  AgentPersonalitySetRequestMessageSchema,
2243
2507
  AgentRewindRequestMessageSchema,
2244
2508
  AgentPermissionResponseMessageSchema,
@@ -2250,6 +2514,10 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
2250
2514
  CheckoutGitCommitAgentRequestSchema,
2251
2515
  CheckoutGitRollbackRequestSchema,
2252
2516
  CheckoutGitGetOperationLogRequestSchema,
2517
+ RunsGetSnapshotRequestSchema,
2518
+ RunsGateRespondRequestSchema,
2519
+ RunsCancelRequestSchema,
2520
+ RunsClearRequestSchema,
2253
2521
  CheckoutMergeRequestSchema,
2254
2522
  CheckoutMergeFromBaseRequestSchema,
2255
2523
  CheckoutPullRequestSchema,
@@ -2526,6 +2794,8 @@ export const ServerInfoStatusPayloadSchema = z
2526
2794
  artifacts: z.boolean().optional(),
2527
2795
  // COMPAT(observedSubagents): added in v0.4.3, drop the gate when daemon floor >= v0.4.3.
2528
2796
  observedSubagents: z.boolean().optional(),
2797
+ // COMPAT(backgroundShellTasks): added in v0.5.3, drop the gate when daemon floor >= v0.5.3.
2798
+ backgroundShellTasks: z.boolean().optional(),
2529
2799
  // COMPAT(textEditor): added in v0.4.4, drop the gate when daemon floor >= v0.4.4.
2530
2800
  textEditor: z.boolean().optional(),
2531
2801
  // COMPAT(projectSearch): added in v0.4.4, drop the gate when daemon floor >= v0.4.4.
@@ -2552,6 +2822,16 @@ export const ServerInfoStatusPayloadSchema = z
2552
2822
  checkoutGitRollback: z.boolean().optional(),
2553
2823
  // COMPAT(checkoutGitLog): added in v0.5.1, drop the gate when daemon floor >= v0.5.1.
2554
2824
  checkoutGitLog: z.boolean().optional(),
2825
+ // COMPAT(agentTeams): added in v0.5.2, drop the gate when daemon floor >= v0.5.2.
2826
+ agentTeams: z.boolean().optional(),
2827
+ // COMPAT(modelTierOverrides): added in v0.5.2, drop the gate when daemon floor >= v0.5.2.
2828
+ modelTierOverrides: z.boolean().optional(),
2829
+ // COMPAT(agentOrchestration): added in v0.5.3, drop the gate when daemon floor >= v0.5.3.
2830
+ agentOrchestration: z.boolean().optional(),
2831
+ // COMPAT(activityStats): added in v0.5.3, drop the gate when daemon floor >= v0.5.3.
2832
+ activityStats: z.boolean().optional(),
2833
+ // COMPAT(runsClear): added in v0.5.3, drop the gate when daemon floor >= v0.5.3.
2834
+ runsClear: z.boolean().optional(),
2555
2835
  })
2556
2836
  .optional(),
2557
2837
  })
@@ -3109,6 +3389,11 @@ export const CancelAgentResponseMessageSchema = z.object({
3109
3389
  requestId: z.string(),
3110
3390
  agentId: z.string(),
3111
3391
  agent: AgentSnapshotPayloadSchema.nullable(),
3392
+ // Whether an in-flight run was actually interrupted. False when the agent
3393
+ // had nothing running (already finished, still initializing), so clients
3394
+ // can say "nothing to stop" instead of silently no-oping. Purely additive;
3395
+ // absent ⇒ unknown (old daemon). See projects/subagents-cleanup/subagents-cleanup.md (Item 2).
3396
+ cancelled: z.boolean().optional(),
3112
3397
  }),
3113
3398
  });
3114
3399
  export const ClearAgentAttentionResponseMessageSchema = z.object({
@@ -4701,6 +4986,9 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
4701
4986
  SetAgentFeatureResponseMessageSchema,
4702
4987
  AgentDetachResponseMessageSchema,
4703
4988
  AgentSubagentStopResponseMessageSchema,
4989
+ AgentBackgroundTaskStopResponseMessageSchema,
4990
+ AgentBackgroundTaskClearResponseMessageSchema,
4991
+ BackgroundShellTasksChangedSchema,
4704
4992
  AgentPersonalitySetResponseMessageSchema,
4705
4993
  AgentRewindResponseMessageSchema,
4706
4994
  UpdateAgentResponseMessageSchema,
@@ -4723,6 +5011,12 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
4723
5011
  CheckoutGitRollbackResponseSchema,
4724
5012
  CheckoutGitGetOperationLogResponseSchema,
4725
5013
  CheckoutGitLogAppendedNotificationSchema,
5014
+ RunsGetSnapshotResponseSchema,
5015
+ RunsUpdatedNotificationSchema,
5016
+ RunsGateRespondResponseSchema,
5017
+ RunsCancelResponseSchema,
5018
+ RunsClearResponseSchema,
5019
+ RunsClearedNotificationSchema,
4726
5020
  CheckoutMergeResponseSchema,
4727
5021
  CheckoutMergeFromBaseResponseSchema,
4728
5022
  CheckoutPullResponseSchema,
@@ -4775,6 +5069,7 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
4775
5069
  RefreshProvidersSnapshotResponseMessageSchema,
4776
5070
  ProviderDiagnosticResponseMessageSchema,
4777
5071
  ProviderUsageListResponseMessageSchema,
5072
+ StatsActivityGetResponseMessageSchema,
4778
5073
  AgentContextGetUsageResponseMessageSchema,
4779
5074
  ListCommandsResponseSchema,
4780
5075
  ListTerminalsResponseSchema,
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Model → tier classification, shared by the daemon (stamps `model.tier` at
3
+ * ingest) and the app (reads `model.tier`). Pure and dependency-free — no zod,
4
+ * no I/O.
5
+ *
6
+ * Deliberately NO name-pattern guessing: the official model ids are public
7
+ * record, so we classify what we KNOW (the shipped catalog) and leave everything
8
+ * else `undefined` = "Unknown". Size-in-the-name heuristics are unreliable
9
+ * (a Qwen-32B coder ≠ a Qwen-32B instruct), so we don't pretend — the user tags
10
+ * an Unknown model with an override and that's it.
11
+ *
12
+ * Resolution order for a single model:
13
+ * 1. user override (a per-model tag persisted in host config),
14
+ * 2. the shipped catalog of known models,
15
+ * else undefined ("Unknown"). At generation the consumer's context-window
16
+ * heuristic still fills a slot so a team can bind, but that's a last resort, not
17
+ * a claim about the model's tier.
18
+ */
19
+ import type { AgentModelDefinition, ModelTier } from "./agent-types.js";
20
+ export declare const KNOWN_MODEL_TIERS: Readonly<Record<string, ModelTier>>;
21
+ export declare function catalogTier(modelId: string): ModelTier | undefined;
22
+ /**
23
+ * Infer a model's tier from the shipped catalog alone (no guessing). Undefined
24
+ * for models we don't ship an id for — those read as "Unknown" until the user
25
+ * tags one.
26
+ */
27
+ export declare function inferModelTier(model: Pick<AgentModelDefinition, "id">): ModelTier | undefined;
28
+ /**
29
+ * The tier to stamp on a model at ingest: an explicit user override wins,
30
+ * otherwise the catalog. Undefined ("Unknown") leaves the model tier-less until
31
+ * the user tags it; the consumer's generation heuristic still binds a slot.
32
+ */
33
+ export declare function resolveModelTier(model: Pick<AgentModelDefinition, "id">, override: ModelTier | undefined): ModelTier | undefined;
34
+ //# sourceMappingURL=model-tiers.d.ts.map
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Model → tier classification, shared by the daemon (stamps `model.tier` at
3
+ * ingest) and the app (reads `model.tier`). Pure and dependency-free — no zod,
4
+ * no I/O.
5
+ *
6
+ * Deliberately NO name-pattern guessing: the official model ids are public
7
+ * record, so we classify what we KNOW (the shipped catalog) and leave everything
8
+ * else `undefined` = "Unknown". Size-in-the-name heuristics are unreliable
9
+ * (a Qwen-32B coder ≠ a Qwen-32B instruct), so we don't pretend — the user tags
10
+ * an Unknown model with an override and that's it.
11
+ *
12
+ * Resolution order for a single model:
13
+ * 1. user override (a per-model tag persisted in host config),
14
+ * 2. the shipped catalog of known models,
15
+ * else undefined ("Unknown"). At generation the consumer's context-window
16
+ * heuristic still fills a slot so a team can bind, but that's a last resort, not
17
+ * a claim about the model's tier.
18
+ */
19
+ // Shipped catalog of known, official model ids (public record). Matched
20
+ // case-insensitively against the exact model id; decorated ids that miss here
21
+ // fall through to patterns.
22
+ export const KNOWN_MODEL_TIERS = {
23
+ // Anthropic (Claude) — the full Claude Code manifest. Tiering rule: 1M-context
24
+ // Opus variants are "deep", non-1M Opus and Sonnet are "standard", Haiku is
25
+ // "fast". Fable (1M, most powerful) is "deep".
26
+ "claude-fable-5": "deep",
27
+ "claude-opus-4-8[1m]": "deep",
28
+ "claude-opus-4-8": "standard",
29
+ "claude-opus-4-7[1m]": "deep",
30
+ "claude-opus-4-7": "standard",
31
+ "claude-opus-4-6[1m]": "deep",
32
+ "claude-opus-4-6": "standard",
33
+ "claude-sonnet-5": "standard",
34
+ "claude-sonnet-4-6[1m]": "standard",
35
+ "claude-sonnet-4-6": "standard",
36
+ "claude-haiku-4-5": "fast",
37
+ "claude-haiku-4-5-20251001": "fast",
38
+ // OpenAI (GPT / o-series)
39
+ "gpt-5": "deep",
40
+ "gpt-5-mini": "fast",
41
+ "gpt-5-nano": "fast",
42
+ o3: "deep",
43
+ "o3-mini": "fast",
44
+ "o4-mini": "fast",
45
+ "gpt-4.1": "standard",
46
+ "gpt-4.1-mini": "fast",
47
+ "gpt-4o": "standard",
48
+ "gpt-4o-mini": "fast",
49
+ // Google (Gemini)
50
+ "gemini-2.5-pro": "deep",
51
+ "gemini-2.5-flash": "fast",
52
+ "gemini-2.5-flash-lite": "fast",
53
+ "gemini-2.0-flash": "fast",
54
+ // DeepSeek
55
+ "deepseek-r1": "deep",
56
+ "deepseek-v3": "deep",
57
+ "deepseek-chat": "standard",
58
+ "deepseek-reasoner": "deep",
59
+ // Alibaba (Qwen) hosted tiers
60
+ "qwen-max": "deep",
61
+ "qwen-plus": "standard",
62
+ "qwen-turbo": "fast",
63
+ // xAI (Grok)
64
+ "grok-4": "deep",
65
+ "grok-3": "deep",
66
+ "grok-3-mini": "fast",
67
+ // Mistral
68
+ "mistral-large-latest": "deep",
69
+ "mistral-large": "deep",
70
+ "mistral-medium": "standard",
71
+ "mistral-small": "fast",
72
+ };
73
+ export function catalogTier(modelId) {
74
+ return KNOWN_MODEL_TIERS[modelId.toLowerCase()];
75
+ }
76
+ /**
77
+ * Infer a model's tier from the shipped catalog alone (no guessing). Undefined
78
+ * for models we don't ship an id for — those read as "Unknown" until the user
79
+ * tags one.
80
+ */
81
+ export function inferModelTier(model) {
82
+ return catalogTier(model.id);
83
+ }
84
+ /**
85
+ * The tier to stamp on a model at ingest: an explicit user override wins,
86
+ * otherwise the catalog. Undefined ("Unknown") leaves the model tier-less until
87
+ * the user tags it; the consumer's generation heuristic still binds a slot.
88
+ */
89
+ export function resolveModelTier(model, override) {
90
+ return override ?? inferModelTier(model);
91
+ }
92
+ //# sourceMappingURL=model-tiers.js.map