toolroll 0.9.54 → 0.9.56

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 (350) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +29 -12
  3. package/dist/action-ledger.d.ts +2 -4
  4. package/dist/action-ledger.js +2 -10
  5. package/dist/agent-onboard.js +4 -1
  6. package/dist/approval-policy.d.ts +5 -5
  7. package/dist/approval-policy.js +4 -4
  8. package/dist/approval-rules-ui.d.ts +3 -2
  9. package/dist/approval-rules-ui.js +17 -22
  10. package/dist/assignment-ui.d.ts +3 -2
  11. package/dist/assignment-ui.js +4 -11
  12. package/dist/backup-ui.d.ts +2 -1
  13. package/dist/backup-ui.js +16 -27
  14. package/dist/brand-mark.d.ts +3 -2
  15. package/dist/brand-mark.js +4 -4
  16. package/dist/browser/workspace.css +1 -1
  17. package/dist/browser/workspace.js +25 -25
  18. package/dist/browser-shell.d.ts +2 -1
  19. package/dist/browser-shell.js +9 -9
  20. package/dist/browser-workspace.d.ts +14 -15
  21. package/dist/browser-workspace.js +0 -3
  22. package/dist/budget-alerts.js +3 -3
  23. package/dist/chat-actions.d.ts +23 -18
  24. package/dist/chat-actions.js +110 -88
  25. package/dist/chat-ask.d.ts +2 -2
  26. package/dist/chat-ask.js +5 -5
  27. package/dist/chat-channel.d.ts +15 -15
  28. package/dist/chat-channel.js +20 -20
  29. package/dist/chat-controls.d.ts +0 -4
  30. package/dist/chat-controls.js +0 -1
  31. package/dist/chat-core.js +1 -1
  32. package/dist/chat-delivery-state.js +2 -2
  33. package/dist/chat-delivery.d.ts +2 -2
  34. package/dist/chat-delivery.js +27 -34
  35. package/dist/chat-flow.js +3 -3
  36. package/dist/chat-messages.d.ts +1 -1
  37. package/dist/chat-messages.js +4 -4
  38. package/dist/chat-migration.d.ts +1 -1
  39. package/dist/chat-migration.js +11 -11
  40. package/dist/chat-polish.d.ts +5 -4
  41. package/dist/chat-polish.js +9 -10
  42. package/dist/chat-rooms.js +3 -3
  43. package/dist/chat-warmth.d.ts +2 -2
  44. package/dist/check-levels-ui.d.ts +2 -1
  45. package/dist/check-levels-ui.js +26 -53
  46. package/dist/cli.d.ts +3 -1
  47. package/dist/cli.js +15 -10
  48. package/dist/coding-shipping-ui.d.ts +2 -1
  49. package/dist/coding-shipping-ui.js +6 -6
  50. package/dist/coding-ui.d.ts +3 -1
  51. package/dist/coding-ui.js +30 -29
  52. package/dist/contracts/chat-actions.d.ts +32 -27
  53. package/dist/contracts/chat-actions.js +29 -11
  54. package/dist/contracts/chat-content.d.ts +1 -1
  55. package/dist/contracts/chat-content.js +1 -1
  56. package/dist/contracts/chat-tables.js +4 -4
  57. package/dist/contracts/cli.d.ts +1 -3
  58. package/dist/contracts/console-api.d.ts +7 -7
  59. package/dist/contracts/console-api.js +13 -12
  60. package/dist/contracts/flow-propose.d.ts +3 -3
  61. package/dist/contracts/flow.d.ts +132 -125
  62. package/dist/contracts/flow.js +27 -12
  63. package/dist/contracts/health.d.ts +1 -3
  64. package/dist/contracts/lead-context.d.ts +1 -1
  65. package/dist/contracts/lead-context.js +2 -2
  66. package/dist/contracts/lead-tools.d.ts +20 -18
  67. package/dist/contracts/lead-tools.js +15 -15
  68. package/dist/contracts/stage-output.d.ts +1 -1
  69. package/dist/contracts/stage-output.js +1 -1
  70. package/dist/contracts/store-json.d.ts +23 -22
  71. package/dist/contracts/store-json.js +17 -17
  72. package/dist/contracts/{teammate-turn.d.ts → subagent-turn.d.ts} +5 -5
  73. package/dist/contracts/{teammate-turn.js → subagent-turn.js} +7 -7
  74. package/dist/control-ui.d.ts +5 -4
  75. package/dist/control-ui.js +9 -34
  76. package/dist/converse.d.ts +23 -23
  77. package/dist/converse.js +28 -28
  78. package/dist/coordinator-proposals.d.ts +2 -2
  79. package/dist/coordinator-proposals.js +1 -1
  80. package/dist/coordinator.js +1 -1
  81. package/dist/credentials-ui.d.ts +5 -4
  82. package/dist/credentials-ui.js +23 -24
  83. package/dist/demo-chat.d.ts +3 -3
  84. package/dist/demo-chat.js +29 -76
  85. package/dist/deprecations.d.ts +12 -0
  86. package/dist/deprecations.js +20 -0
  87. package/dist/desktop-update-gate.js +8 -4
  88. package/dist/desktop-update.js +6 -1
  89. package/dist/discord-chat.js +6 -6
  90. package/dist/discord-settings.d.ts +3 -2
  91. package/dist/discord-settings.js +17 -42
  92. package/dist/dispatch.d.ts +1 -1
  93. package/dist/dispatch.js +1 -1
  94. package/dist/envelope.js +10 -1
  95. package/dist/evidence-pack.d.ts +2 -1
  96. package/dist/evidence-pack.js +45 -49
  97. package/dist/export-ui.d.ts +7 -2
  98. package/dist/export-ui.js +4 -10
  99. package/dist/export.js +7 -7
  100. package/dist/flow-engine.d.ts +2 -2
  101. package/dist/flow-engine.js +21 -21
  102. package/dist/flow-gallery-ui.d.ts +4 -3
  103. package/dist/flow-gallery-ui.js +28 -43
  104. package/dist/flow-insights.d.ts +1 -1
  105. package/dist/flow-share.js +13 -8
  106. package/dist/flow-starters-ui.d.ts +2 -1
  107. package/dist/flow-starters-ui.js +12 -15
  108. package/dist/flow-steps.d.ts +5 -5
  109. package/dist/flow-steps.js +19 -19
  110. package/dist/flow-triggers.d.ts +2 -1
  111. package/dist/flow-triggers.js +17 -15
  112. package/dist/flows-cli.js +1 -1
  113. package/dist/flows-ui.d.ts +4 -3
  114. package/dist/flows-ui.js +38 -49
  115. package/dist/flows.js +21 -20
  116. package/dist/guides.js +112 -6
  117. package/dist/html.d.ts +76 -0
  118. package/dist/html.js +173 -0
  119. package/dist/integrations-ui.d.ts +2 -1
  120. package/dist/integrations-ui.js +19 -23
  121. package/dist/invoke.js +1 -1
  122. package/dist/kits-ui.d.ts +5 -4
  123. package/dist/kits-ui.js +22 -24
  124. package/dist/kits.d.ts +12 -12
  125. package/dist/kits.js +31 -31
  126. package/dist/knowledge-ui.d.ts +6 -5
  127. package/dist/knowledge-ui.js +26 -25
  128. package/dist/{mate-cli.d.ts → lead-cli.d.ts} +11 -11
  129. package/dist/{mate-cli.js → lead-cli.js} +38 -38
  130. package/dist/lead-commitments.js +4 -4
  131. package/dist/lead-context.d.ts +12 -2
  132. package/dist/lead-context.js +15 -17
  133. package/dist/{mate-contract.d.ts → lead-contract.d.ts} +3 -3
  134. package/dist/{mate-contract.js → lead-contract.js} +7 -6
  135. package/dist/{mate-doors.d.ts → lead-doors.d.ts} +6 -6
  136. package/dist/{mate-doors.js → lead-doors.js} +24 -24
  137. package/dist/lead-follow.d.ts +5 -5
  138. package/dist/lead-follow.js +9 -9
  139. package/dist/lead-people.d.ts +5 -5
  140. package/dist/lead-people.js +14 -14
  141. package/dist/{mate-progress.d.ts → lead-progress.d.ts} +9 -9
  142. package/dist/{mate-progress.js → lead-progress.js} +3 -3
  143. package/dist/{mate-tools.d.ts → lead-tools.d.ts} +19 -19
  144. package/dist/{mate-tools.js → lead-tools.js} +109 -101
  145. package/dist/{mate.d.ts → lead.d.ts} +27 -27
  146. package/dist/{mate.js → lead.js} +102 -102
  147. package/dist/ledger-view.d.ts +2 -1
  148. package/dist/ledger-view.js +27 -29
  149. package/dist/limits-ui.d.ts +3 -2
  150. package/dist/limits-ui.js +8 -8
  151. package/dist/live-bus.d.ts +50 -8
  152. package/dist/live-bus.js +133 -50
  153. package/dist/mcp-connect.d.ts +1 -1
  154. package/dist/mcp-connect.js +3 -3
  155. package/dist/mcp-core.js +1 -1
  156. package/dist/mcp-oauth.js +35 -36
  157. package/dist/memory-pass.d.ts +2 -2
  158. package/dist/memory-pass.js +7 -7
  159. package/dist/models-ui.d.ts +2 -1
  160. package/dist/models-ui.js +25 -35
  161. package/dist/monitoring-ui.d.ts +4 -3
  162. package/dist/monitoring-ui.js +13 -26
  163. package/dist/notification-rows.d.ts +2 -2
  164. package/dist/openrouter-models.d.ts +2 -1
  165. package/dist/openrouter-models.js +5 -9
  166. package/dist/operate.d.ts +3 -3
  167. package/dist/operate.js +46 -41
  168. package/dist/people-audit-ui.d.ts +2 -1
  169. package/dist/people-audit-ui.js +13 -13
  170. package/dist/policy-ui.d.ts +3 -2
  171. package/dist/policy-ui.js +17 -23
  172. package/dist/policy.d.ts +1 -1
  173. package/dist/principal.d.ts +1 -1
  174. package/dist/principal.js +2 -2
  175. package/dist/project-delete-ui.d.ts +4 -3
  176. package/dist/project-delete-ui.js +16 -28
  177. package/dist/project-delete.d.ts +1 -1
  178. package/dist/project-delete.js +26 -26
  179. package/dist/project-memory.js +1 -1
  180. package/dist/project-tools.d.ts +1 -1
  181. package/dist/project-tools.js +1 -1
  182. package/dist/pull-request-ui.d.ts +2 -1
  183. package/dist/pull-request-ui.js +17 -32
  184. package/dist/recipe-ui.d.ts +8 -7
  185. package/dist/recipe-ui.js +39 -32
  186. package/dist/release-adapters.d.ts +60 -0
  187. package/dist/release-adapters.js +435 -0
  188. package/dist/release-cli.d.ts +24 -0
  189. package/dist/release-cli.js +181 -0
  190. package/dist/release-gate.d.ts +80 -0
  191. package/dist/release-gate.js +150 -0
  192. package/dist/release-links.d.ts +29 -0
  193. package/dist/release-links.js +102 -0
  194. package/dist/release.d.ts +331 -0
  195. package/dist/release.js +550 -0
  196. package/dist/reply-shape.d.ts +2 -1
  197. package/dist/reply-shape.js +5 -5
  198. package/dist/repository-context-ui.d.ts +2 -1
  199. package/dist/repository-context-ui.js +2 -7
  200. package/dist/request-budget-ui.d.ts +2 -1
  201. package/dist/request-budget-ui.js +16 -16
  202. package/dist/result-review.d.ts +2 -3
  203. package/dist/result-review.js +3 -9
  204. package/dist/retention-ui.d.ts +7 -1
  205. package/dist/retention-ui.js +7 -11
  206. package/dist/retention.js +4 -4
  207. package/dist/scope.d.ts +2 -2
  208. package/dist/scout-report.d.ts +1 -1
  209. package/dist/scout-report.js +1 -1
  210. package/dist/serve.d.ts +11 -2
  211. package/dist/serve.js +105 -99
  212. package/dist/server/chat.d.ts +7 -10
  213. package/dist/server/chat.js +984 -1021
  214. package/dist/server/chrome.d.ts +291 -0
  215. package/dist/server/chrome.js +747 -0
  216. package/dist/server/console.css +2819 -0
  217. package/dist/server/flows.d.ts +2 -6
  218. package/dist/server/flows.js +854 -773
  219. package/dist/server/guards.d.ts +1 -1
  220. package/dist/server/guards.js +8 -5
  221. package/dist/server/handler-context.d.ts +1 -1
  222. package/dist/server/handler-context.js +1 -1
  223. package/dist/server/handler-registry.d.ts +8 -6
  224. package/dist/server/handler-registry.js +14 -2
  225. package/dist/server/http.d.ts +274 -0
  226. package/dist/server/http.js +239 -0
  227. package/dist/server/live.d.ts +34 -0
  228. package/dist/server/live.js +309 -0
  229. package/dist/server/pages.d.ts +2 -6
  230. package/dist/server/pages.js +808 -789
  231. package/dist/server/people-tokens.d.ts +1 -6
  232. package/dist/server/people-tokens.js +581 -573
  233. package/dist/server/remote.d.ts +4 -7
  234. package/dist/server/remote.js +39 -70
  235. package/dist/server/render-chat.d.ts +402 -0
  236. package/dist/server/render-chat.js +927 -0
  237. package/dist/server/render-pages.d.ts +535 -0
  238. package/dist/server/render-pages.js +1277 -0
  239. package/dist/server/render-people.d.ts +32 -0
  240. package/dist/server/render-people.js +121 -0
  241. package/dist/server/render-results.d.ts +744 -0
  242. package/dist/server/render-results.js +2237 -0
  243. package/dist/server/render-settings.d.ts +154 -0
  244. package/dist/server/render-settings.js +580 -0
  245. package/dist/server/render-tasks.d.ts +632 -0
  246. package/dist/server/render-tasks.js +2345 -0
  247. package/dist/server/request-context.d.ts +46 -0
  248. package/dist/server/request-context.js +17 -0
  249. package/dist/server/route-table.d.ts +25 -3
  250. package/dist/server/route-table.js +167 -77
  251. package/dist/server/runtime.d.ts +28 -20
  252. package/dist/server/runtime.js +7 -1
  253. package/dist/server/session.d.ts +138 -0
  254. package/dist/server/session.js +94 -0
  255. package/dist/server/settings.d.ts +1 -5
  256. package/dist/server/settings.js +2186 -2121
  257. package/dist/server/task-views.d.ts +11 -4
  258. package/dist/server/task-views.js +26 -22
  259. package/dist/server/tasks.d.ts +9 -9
  260. package/dist/server/tasks.js +1489 -1420
  261. package/dist/server-telemetry.d.ts +4 -3
  262. package/dist/server-telemetry.js +4 -8
  263. package/dist/setup-guide.d.ts +2 -2
  264. package/dist/skills-ui.d.ts +4 -3
  265. package/dist/skills-ui.js +14 -17
  266. package/dist/skills.d.ts +1 -1
  267. package/dist/skills.js +2 -1
  268. package/dist/slack-chat.d.ts +2 -2
  269. package/dist/slack-chat.js +6 -6
  270. package/dist/slack-settings.d.ts +3 -2
  271. package/dist/slack-settings.js +17 -42
  272. package/dist/spend-ui.d.ts +5 -4
  273. package/dist/spend-ui.js +17 -40
  274. package/dist/spend.d.ts +14 -14
  275. package/dist/spend.js +31 -31
  276. package/dist/sso-ui.d.ts +3 -2
  277. package/dist/sso-ui.js +26 -27
  278. package/dist/storage-ui.d.ts +2 -1
  279. package/dist/storage-ui.js +14 -33
  280. package/dist/store-baseline.d.ts +19 -0
  281. package/dist/store-baseline.js +2873 -0
  282. package/dist/store.d.ts +197 -249
  283. package/dist/store.js +747 -3084
  284. package/dist/subagent-admin.d.ts +53 -0
  285. package/dist/{teammate-admin.js → subagent-admin.js} +37 -37
  286. package/dist/{teammate-desk.d.ts → subagent-desk.d.ts} +22 -23
  287. package/dist/{teammate-desk.js → subagent-desk.js} +26 -35
  288. package/dist/{teammate-memory.d.ts → subagent-memory.d.ts} +17 -17
  289. package/dist/{teammate-memory.js → subagent-memory.js} +41 -41
  290. package/dist/{teammate-question.d.ts → subagent-question.d.ts} +6 -6
  291. package/dist/{teammate-question.js → subagent-question.js} +17 -17
  292. package/dist/{teammate-tools.d.ts → subagent-tools.d.ts} +18 -18
  293. package/dist/{teammate-tools.js → subagent-tools.js} +36 -36
  294. package/dist/{teammate-week.d.ts → subagent-week.d.ts} +10 -10
  295. package/dist/{teammate-week.js → subagent-week.js} +23 -23
  296. package/dist/{teammate-work.d.ts → subagent-work.d.ts} +21 -21
  297. package/dist/{teammate-work.js → subagent-work.js} +50 -50
  298. package/dist/subagents-ui.d.ts +22 -0
  299. package/dist/subagents-ui.js +137 -0
  300. package/dist/{teammates.d.ts → subagents.d.ts} +11 -11
  301. package/dist/{teammates.js → subagents.js} +21 -21
  302. package/dist/subscription-chat.d.ts +13 -13
  303. package/dist/subscription-chat.js +19 -19
  304. package/dist/surface.d.ts +19 -2
  305. package/dist/surface.js +20 -33
  306. package/dist/task-composer.d.ts +2 -1
  307. package/dist/task-composer.js +7 -7
  308. package/dist/task-status.d.ts +4 -3
  309. package/dist/task-status.js +15 -16
  310. package/dist/team-cli.d.ts +1 -0
  311. package/dist/team-cli.js +14 -2
  312. package/dist/team-http.d.ts +5 -9
  313. package/dist/team-http.js +5 -63
  314. package/dist/team-leads.js +13 -13
  315. package/dist/team-runtime.d.ts +2 -2
  316. package/dist/team-runtime.js +8 -8
  317. package/dist/team-ui.d.ts +2 -1
  318. package/dist/team-ui.js +2 -5
  319. package/dist/teams-chat.js +6 -6
  320. package/dist/teams-settings.d.ts +3 -2
  321. package/dist/teams-settings.js +20 -31
  322. package/dist/telegram-flow.d.ts +3 -3
  323. package/dist/telegram-flow.js +3 -3
  324. package/dist/{telegram-mate.d.ts → telegram-lead.d.ts} +5 -5
  325. package/dist/{telegram-mate.js → telegram-lead.js} +27 -27
  326. package/dist/telegram-settings.d.ts +3 -2
  327. package/dist/telegram-settings.js +14 -25
  328. package/dist/telegram-status.js +1 -1
  329. package/dist/telegram-team.d.ts +1 -1
  330. package/dist/telegram-team.js +5 -5
  331. package/dist/telegram.d.ts +1 -1
  332. package/dist/telegram.js +9 -30
  333. package/dist/text-limits.d.ts +18 -18
  334. package/dist/text-limits.js +18 -18
  335. package/dist/toolroll-update-ui.d.ts +3 -2
  336. package/dist/toolroll-update-ui.js +35 -39
  337. package/dist/toolroll-update.d.ts +8 -0
  338. package/dist/toolroll-update.js +45 -8
  339. package/dist/tools-ui.d.ts +5 -2
  340. package/dist/tools-ui.js +31 -31
  341. package/dist/when-html.d.ts +11 -3
  342. package/dist/when-html.js +5 -6
  343. package/dist/workspace-ui.d.ts +4 -2
  344. package/dist/workspace-ui.js +10 -10
  345. package/package.json +1 -2
  346. package/dist/server/shared.d.ts +0 -3151
  347. package/dist/server/shared.js +0 -12001
  348. package/dist/teammate-admin.d.ts +0 -53
  349. package/dist/teammates-ui.d.ts +0 -20
  350. package/dist/teammates-ui.js +0 -166
@@ -16,7 +16,7 @@
16
16
  import { z } from "zod";
17
17
  import { TEXT_LIMITS } from "../text-limits.js";
18
18
  import { limited, toModelSchema, versioned } from "./contract.js";
19
- export const FLOW_STAGE_KINDS = ["inbox", "task", "report", "approval", "check", "pull-request", "update", "notify", "sort", "draft", "request", "email", "tool", "wait", "teammate", "send", "choose", "done"];
19
+ export const FLOW_STAGE_KINDS = ["inbox", "task", "report", "approval", "check", "pull-request", "update", "notify", "sort", "draft", "request", "email", "tool", "wait", "subagent", "send", "choose", "done"];
20
20
  export const FLOW_COLORS = ["slate", "blue", "violet", "amber", "green", "rose"];
21
21
  /** How a Pull request zone merges once checks pass. */
22
22
  export const FLOW_MERGE_METHODS = ["squash", "merge", "rebase"];
@@ -105,7 +105,7 @@ export const flowWaitSchema = z.strictObject({
105
105
  });
106
106
  /** A choose zone's option: its button's words, and the zone it leads to (FLOW_END closes the card as Ignored). */
107
107
  export const flowChoiceSchema = z.strictObject({ label: words("label", "flowChoice").min(1), to: z.union([stageRef, z.literal(FLOW_END)]) });
108
- /** A script's or teammate's answer and the zone it leads to. */
108
+ /** A script's or subagent's answer and the zone it leads to. */
109
109
  export const flowRouteSchema = z.strictObject({ answer: z.string().min(1).max(TEXT_LIMITS.flowAnswer).regex(/^[^\n]*$/, { error: "must be one line" }), to: stageRef });
110
110
  /** A time limit on a zone: after this long, the person it waits on is reminded; a Holding, "Person decides" or "Person
111
111
  * chooses" zone can also move the card on (`to`). */
@@ -127,7 +127,7 @@ function zoneSchemas(instructions) {
127
127
  z.strictObject({ id, title, kind: z.literal("inbox"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, limit: move, next, onFail }),
128
128
  z.strictObject({ id, title, kind: z.literal("task"), zone, instructions: text, planning: z.enum(FLOW_PLANNING), approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, repo: words("repo", "flowRepo").min(1).optional(), limit: remind, next, onFail }),
129
129
  z.strictObject({ id, title, kind: z.literal("report"), zone, instructions: text, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, limit: remind, next, onFail }),
130
- z.strictObject({ id, title, kind: z.literal("approval"), zone, instructions: said, planning: nil, approver: words("approver", "flowDecider").min(1).nullable(), toOwner: z.literal(true).optional(), message: message.nullable(), close: nil, script: nil, sort: nil, teammate: zoneId.optional(), limit: move, next, onFail }),
130
+ z.strictObject({ id, title, kind: z.literal("approval"), zone, instructions: said, planning: nil, approver: words("approver", "flowDecider").min(1).nullable(), toOwner: z.literal(true).optional(), message: message.nullable(), close: nil, script: nil, sort: nil, subagent: zoneId.optional(), limit: move, next, onFail }),
131
131
  z.strictObject({ id, title, kind: z.literal("check"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: scriptName, runIn: z.enum(FLOW_RUN_IN).optional(), routes, secrets: z.array(secretName).min(1).max(SECRETS_MAX).optional(), sort: nil, limit: remind, next, onFail }),
132
132
  z.strictObject({ id, title, kind: z.literal("pull-request"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, merge: z.enum(FLOW_MERGE_METHODS).optional(), limit: remind, next, onFail }),
133
133
  z.strictObject({ id, title, kind: z.literal("update"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: z.boolean(), script: nil, sort: nil, limit: remind, next, onFail }),
@@ -138,7 +138,7 @@ function zoneSchemas(instructions) {
138
138
  z.strictObject({ id, title, kind: z.literal("email"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, email: flowEmailSchema, limit: remind, next, onFail }),
139
139
  z.strictObject({ id, title, kind: z.literal("tool"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, tool: flowToolSchema, limit: remind, next, onFail }),
140
140
  z.strictObject({ id, title, kind: z.literal("wait"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, wait: flowWaitSchema, next, onFail }),
141
- z.strictObject({ id, title, kind: z.literal("teammate"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, teammate: zoneId, routes, reply: z.literal(true).optional(), limit: remind, next, onFail }),
141
+ z.strictObject({ id, title, kind: z.literal("subagent"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, subagent: zoneId, routes, reply: z.literal(true).optional(), limit: remind, next, onFail }),
142
142
  z.strictObject({ id, title, kind: z.literal("send"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, limit: remind, next, onFail }),
143
143
  z.strictObject({ id, title, kind: z.literal("choose"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, options: z.array(flowChoiceSchema).min(CHOICES_MIN).max(CHOICES_MAX), limit: move, next: nil, onFail }),
144
144
  z.strictObject({ id, title, kind: z.literal("done"), zone, instructions: said, planning: nil, approver: nil, message: message.nullable(), close: nil, script: nil, sort: nil, next: nil, onFail: nil }),
@@ -210,8 +210,8 @@ const STEP_FIELDS = {
210
210
  /** Like "2 days" ("none" removes it), or minutes. */
211
211
  remindAfter: duration,
212
212
  thenMoveTo: ref,
213
- /** A teammate's short name; "nobody" takes one off. */
214
- teammate: z.string().min(1).max(TEXT_LIMITS.flowTeammate),
213
+ /** A subagent's short name; "nobody" takes one off. */
214
+ subagent: z.string().min(1).max(TEXT_LIMITS.flowSubagent),
215
215
  reply: z.boolean(),
216
216
  options: z.array(flowStepOptionSchema).min(CHOICES_MIN).max(CHOICES_MAX),
217
217
  ifReplied: ref,
@@ -229,7 +229,7 @@ const STEP_KINDS = {
229
229
  inbox: ["next", "ifFails", "remindAfter", "thenMoveTo"],
230
230
  task: ["instructions", "planning", "repo", "next", "ifFails", "remindAfter"],
231
231
  report: ["instructions", "next", "ifFails", "remindAfter"],
232
- approval: ["decider", "teammate", "next", "ifFails", "remindAfter", "thenMoveTo"],
232
+ approval: ["decider", "subagent", "next", "ifFails", "remindAfter", "thenMoveTo"],
233
233
  check: ["script", "runIn", "routes", "secrets", "next", "ifFails", "remindAfter"],
234
234
  "pull-request": ["merge", "next", "ifFails", "remindAfter"],
235
235
  update: ["message", "close", "next", "ifFails", "remindAfter"],
@@ -240,7 +240,7 @@ const STEP_KINDS = {
240
240
  email: ["to", "subject", "body", "next", "ifFails", "remindAfter"],
241
241
  tool: ["server", "tool", "args", "next", "ifFails", "remindAfter"],
242
242
  wait: ["waitFor", "wait", "from", "until", "timeZone", "next", "ifNoReply"],
243
- teammate: ["teammate", "instructions", "routes", "reply", "next", "ifFails", "remindAfter"],
243
+ subagent: ["subagent", "instructions", "routes", "reply", "next", "ifFails", "remindAfter"],
244
244
  send: ["next", "ifFails", "remindAfter"],
245
245
  choose: ["options", "ifReplied", "remindAfter", "ifNoReply", "thenMoveTo"],
246
246
  done: [],
@@ -255,9 +255,9 @@ const stepOf = (kind) => z.strictObject({
255
255
  const STEPS = {
256
256
  inbox: stepOf("inbox"), task: stepOf("task"), report: stepOf("report"), approval: stepOf("approval"), check: stepOf("check"), "pull-request": stepOf("pull-request"),
257
257
  update: stepOf("update"), notify: stepOf("notify"), sort: stepOf("sort"), draft: stepOf("draft"), request: stepOf("request"), email: stepOf("email"),
258
- tool: stepOf("tool"), wait: stepOf("wait"), teammate: stepOf("teammate"), send: stepOf("send"), choose: stepOf("choose"), done: stepOf("done"),
258
+ tool: stepOf("tool"), wait: stepOf("wait"), subagent: stepOf("subagent"), send: stepOf("send"), choose: stepOf("choose"), done: stepOf("done"),
259
259
  };
260
- const stepList = [STEPS.inbox, STEPS.task, STEPS.report, STEPS.approval, STEPS.check, STEPS["pull-request"], STEPS.update, STEPS.notify, STEPS.sort, STEPS.draft, STEPS.request, STEPS.email, STEPS.tool, STEPS.wait, STEPS.teammate, STEPS.send, STEPS.choose, STEPS.done];
260
+ const stepList = [STEPS.inbox, STEPS.task, STEPS.report, STEPS.approval, STEPS.check, STEPS["pull-request"], STEPS.update, STEPS.notify, STEPS.sort, STEPS.draft, STEPS.request, STEPS.email, STEPS.tool, STEPS.wait, STEPS.subagent, STEPS.send, STEPS.choose, STEPS.done];
261
261
  /** A step as the lead, `toolroll flows create/edit`, starters, kits and the gallery describe it, one schema per kind. */
262
262
  export const flowStepSchema = z.discriminatedUnion("kind", stepList);
263
263
  /** A flow's steps, in order: what `flowFromSteps` reads. */
@@ -269,8 +269,23 @@ const fileZone = (step) => step.extend({ id: zoneId, at: fileAt.optional() });
269
269
  export const flowFileZoneSchema = z.discriminatedUnion("kind", [
270
270
  fileZone(STEPS.inbox), fileZone(STEPS.task), fileZone(STEPS.report), fileZone(STEPS.approval), fileZone(STEPS.check), fileZone(STEPS["pull-request"]),
271
271
  fileZone(STEPS.update), fileZone(STEPS.notify), fileZone(STEPS.sort), fileZone(STEPS.draft), fileZone(STEPS.request), fileZone(STEPS.email),
272
- fileZone(STEPS.tool), fileZone(STEPS.wait), fileZone(STEPS.teammate), fileZone(STEPS.send), fileZone(STEPS.choose), fileZone(STEPS.done),
272
+ fileZone(STEPS.tool), fileZone(STEPS.wait), fileZone(STEPS.subagent), fileZone(STEPS.send), fileZone(STEPS.choose), fileZone(STEPS.done),
273
273
  ]);
274
+ /**
275
+ * D5 (schema v117): a subagent step was a "teammate" step, naming its "teammate", and a flow file's needs said
276
+ * "teammate:<handle>". Saved drawings, step lists and flow files from before still read: the old words mean the new ones.
277
+ */
278
+ export function legacySubagentStep(step) {
279
+ if (step === null || typeof step !== "object" || Array.isArray(step))
280
+ return step;
281
+ const row = step;
282
+ if (row["kind"] !== "teammate" && !Object.hasOwn(row, "teammate"))
283
+ return step;
284
+ const { teammate, ...rest } = row;
285
+ return { ...rest, ...(rest["kind"] === "teammate" ? { kind: "subagent" } : {}), ...(teammate !== undefined && rest["subagent"] === undefined ? { subagent: teammate } : {}) };
286
+ }
287
+ /** A flow file's need as it was written before D5 ("teammate:maya"), in today's words. */
288
+ export const legacyFlowNeed = (need) => typeof need === "string" && need.startsWith("teammate:") ? `subagent:${need.slice(9)}` : need;
274
289
  /** The keys people and models write for the ones a step means: refusals suggest them (contract.ts). */
275
290
  export const FLOW_ALIASES = {
276
291
  aliases: {
@@ -370,7 +385,7 @@ export const flowFileSchema = versioned(FLOW_FILE_VERSION, {
370
385
  format: z.literal(FLOW_FILE_FORMAT),
371
386
  name: visible("name", "flowName").min(1),
372
387
  about: visible("about", "flowFileAbout").optional().describe("One line on what the flow does. Untrusted: shown in the import preview."),
373
- needs: z.array(visible("need", "flowFileNeed").min(1)).max(40).optional().describe("What the flow needs to run: github, linear, openrouter, email, tool:<server>, secret:<NAME>, teammate:<handle>, script:<name>."),
388
+ needs: z.array(visible("need", "flowFileNeed").min(1)).max(40).optional().describe("What the flow needs to run: github, linear, openrouter, email, tool:<server>, secret:<NAME>, subagent:<handle>, script:<name>."),
374
389
  parameters: z.array(flowFileParameterSchema).max(20).optional(),
375
390
  zones: z.array(flowFileZoneSchema).min(1).max(FLOW_ZONES_MAX).describe("The zones in order; the first is where cards start."),
376
391
  triggers: z.array(flowFileTriggerSchema).max(10).optional(),
@@ -21,13 +21,12 @@ export declare const healthSnapshotSchema: z.ZodObject<{
21
21
  assets: "assets";
22
22
  auth: "auth";
23
23
  chat: "chat";
24
- "chat-stream": "chat-stream";
25
24
  cli: "cli";
26
25
  console: "console";
27
26
  decisions: "decisions";
28
- "flow-stream": "flow-stream";
29
27
  flows: "flows";
30
28
  health: "health";
29
+ live: "live";
31
30
  mcp: "mcp";
32
31
  metrics: "metrics";
33
32
  other: "other";
@@ -37,7 +36,6 @@ export declare const healthSnapshotSchema: z.ZodObject<{
37
36
  settings: "settings";
38
37
  tasks: "tasks";
39
38
  team: "team";
40
- "team-stream": "team-stream";
41
39
  }> & z.core.$partial, z.ZodObject<{
42
40
  count: z.ZodNumber;
43
41
  p50Ms: z.ZodNullable<z.ZodNumber>;
@@ -64,7 +64,7 @@ export declare const leadContextSchema: z.ZodObject<{
64
64
  aboutYou: z.ZodArray<z.ZodString>;
65
65
  people: z.ZodObject<{
66
66
  people: z.ZodArray<z.ZodString>;
67
- teammates: z.ZodArray<z.ZodString>;
67
+ subagents: z.ZodArray<z.ZodString>;
68
68
  teams: z.ZodArray<z.ZodString>;
69
69
  }, z.core.$strict>;
70
70
  channel: z.ZodNullable<z.ZodObject<{
@@ -36,8 +36,8 @@ export const leadContextSchema = z.strictObject({
36
36
  you: z.strictObject({ firstName: z.string().nullable(), timeZone: z.string(), today: z.string() }),
37
37
  /** Lines the person confirmed about themselves. */
38
38
  aboutYou: z.array(z.string()),
39
- /** The people, AI teammates and team chats the lead works with, one line each. */
40
- people: z.strictObject({ people: z.array(z.string()), teammates: z.array(z.string()), teams: z.array(z.string()) }),
39
+ /** The people, subagents and team chats the lead works with, one line each. */
40
+ people: z.strictObject({ people: z.array(z.string()), subagents: z.array(z.string()), teams: z.array(z.string()) }),
41
41
  channel: z.strictObject({ id: z.enum(LEAD_CHANNELS), fit: z.string(), replyLimit: z.int().nullable() }).nullable(),
42
42
  needsYou: z.array(leadTaskSchema),
43
43
  /** This conversation's follow-through; absent outside one. */
@@ -219,7 +219,7 @@ export declare const LEAD_TOOL_INPUTS: {
219
219
  ifFails: z.ZodOptional<z.ZodString>;
220
220
  next: z.ZodOptional<z.ZodString>;
221
221
  remindAfter: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
222
- teammate: z.ZodOptional<z.ZodString>;
222
+ subagent: z.ZodOptional<z.ZodString>;
223
223
  thenMoveTo: z.ZodOptional<z.ZodString>;
224
224
  }, z.core.$strict>, z.ZodObject<{
225
225
  id: z.ZodOptional<z.ZodString>;
@@ -352,7 +352,7 @@ export declare const LEAD_TOOL_INPUTS: {
352
352
  }, z.core.$strict>, z.ZodObject<{
353
353
  id: z.ZodOptional<z.ZodString>;
354
354
  title: z.ZodString;
355
- kind: z.ZodLiteral<"teammate">;
355
+ kind: z.ZodLiteral<"subagent">;
356
356
  ifFails: z.ZodOptional<z.ZodString>;
357
357
  instructions: z.ZodOptional<z.ZodString>;
358
358
  next: z.ZodOptional<z.ZodString>;
@@ -362,7 +362,7 @@ export declare const LEAD_TOOL_INPUTS: {
362
362
  answer: z.ZodString;
363
363
  goesTo: z.ZodString;
364
364
  }, z.core.$strict>>>;
365
- teammate: z.ZodOptional<z.ZodString>;
365
+ subagent: z.ZodOptional<z.ZodString>;
366
366
  }, z.core.$strict>, z.ZodObject<{
367
367
  id: z.ZodOptional<z.ZodString>;
368
368
  title: z.ZodString;
@@ -458,14 +458,15 @@ export declare const LEAD_TOOL_INPUTS: {
458
458
  timeZone: z.ZodOptional<z.ZodString>;
459
459
  }, z.core.$strict>], "kind">>;
460
460
  }, z.core.$strict>;
461
- readonly get_teammates: z.ZodObject<{
461
+ readonly get_subagents: z.ZodObject<{
462
462
  repo: z.ZodOptional<z.ZodString>;
463
- teammate: z.ZodOptional<z.ZodInt>;
463
+ subagent: z.ZodOptional<z.ZodInt>;
464
464
  }, z.core.$strict>;
465
- readonly propose_teammate: z.ZodObject<{
465
+ readonly propose_subagent: z.ZodObject<{
466
466
  operation: z.ZodEnum<{
467
467
  add_routine: "add_routine";
468
468
  answer: "answer";
469
+ ask: "ask";
469
470
  create: "create";
470
471
  edit_memory: "edit_memory";
471
472
  edit_section: "edit_section";
@@ -497,7 +498,7 @@ export declare const LEAD_TOOL_INPUTS: {
497
498
  limitField: z.ZodOptional<z.ZodString>;
498
499
  limitOver: z.ZodOptional<z.ZodNumber>;
499
500
  repo: z.ZodOptional<z.ZodString>;
500
- teammate: z.ZodOptional<z.ZodInt>;
501
+ subagent: z.ZodOptional<z.ZodInt>;
501
502
  template: z.ZodOptional<z.ZodEnum<{
502
503
  [x: string]: string;
503
504
  }>>;
@@ -907,7 +908,7 @@ export declare const LEAD_TOOL_READ_INPUTS: {
907
908
  ifFails: z.ZodOptional<z.ZodString>;
908
909
  next: z.ZodOptional<z.ZodString>;
909
910
  remindAfter: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
910
- teammate: z.ZodOptional<z.ZodString>;
911
+ subagent: z.ZodOptional<z.ZodString>;
911
912
  thenMoveTo: z.ZodOptional<z.ZodString>;
912
913
  }, z.core.$strict>, z.ZodObject<{
913
914
  id: z.ZodOptional<z.ZodString>;
@@ -1040,7 +1041,7 @@ export declare const LEAD_TOOL_READ_INPUTS: {
1040
1041
  }, z.core.$strict>, z.ZodObject<{
1041
1042
  id: z.ZodOptional<z.ZodString>;
1042
1043
  title: z.ZodString;
1043
- kind: z.ZodLiteral<"teammate">;
1044
+ kind: z.ZodLiteral<"subagent">;
1044
1045
  ifFails: z.ZodOptional<z.ZodString>;
1045
1046
  instructions: z.ZodOptional<z.ZodString>;
1046
1047
  next: z.ZodOptional<z.ZodString>;
@@ -1050,7 +1051,7 @@ export declare const LEAD_TOOL_READ_INPUTS: {
1050
1051
  answer: z.ZodString;
1051
1052
  goesTo: z.ZodString;
1052
1053
  }, z.core.$strict>>>;
1053
- teammate: z.ZodOptional<z.ZodString>;
1054
+ subagent: z.ZodOptional<z.ZodString>;
1054
1055
  }, z.core.$strict>, z.ZodObject<{
1055
1056
  id: z.ZodOptional<z.ZodString>;
1056
1057
  title: z.ZodString;
@@ -1146,14 +1147,15 @@ export declare const LEAD_TOOL_READ_INPUTS: {
1146
1147
  timeZone: z.ZodOptional<z.ZodString>;
1147
1148
  }, z.core.$strict>], "kind">>;
1148
1149
  }, z.core.$strict>;
1149
- readonly get_teammates: z.ZodObject<{
1150
+ readonly get_subagents: z.ZodObject<{
1150
1151
  repo: z.ZodOptional<z.ZodString>;
1151
- teammate: z.ZodOptional<z.ZodInt>;
1152
+ subagent: z.ZodOptional<z.ZodInt>;
1152
1153
  }, z.core.$strict>;
1153
- readonly propose_teammate: z.ZodObject<{
1154
+ readonly propose_subagent: z.ZodObject<{
1154
1155
  operation: z.ZodEnum<{
1155
1156
  add_routine: "add_routine";
1156
1157
  answer: "answer";
1158
+ ask: "ask";
1157
1159
  create: "create";
1158
1160
  edit_memory: "edit_memory";
1159
1161
  edit_section: "edit_section";
@@ -1185,7 +1187,7 @@ export declare const LEAD_TOOL_READ_INPUTS: {
1185
1187
  limitField: z.ZodOptional<z.ZodString>;
1186
1188
  limitOver: z.ZodOptional<z.ZodNumber>;
1187
1189
  repo: z.ZodOptional<z.ZodString>;
1188
- teammate: z.ZodOptional<z.ZodInt>;
1190
+ subagent: z.ZodOptional<z.ZodInt>;
1189
1191
  template: z.ZodOptional<z.ZodEnum<{
1190
1192
  [x: string]: string;
1191
1193
  }>>;
@@ -1656,9 +1658,9 @@ export declare const LEAD_TOOL_OUTPUTS: {
1656
1658
  awaiting: z.ZodString;
1657
1659
  executed: z.ZodLiteral<false>;
1658
1660
  }, z.core.$loose>;
1659
- readonly get_teammates: z.ZodObject<{
1660
- teammates: z.ZodArray<z.ZodObject<{
1661
- teammate: z.ZodNumber;
1661
+ readonly get_subagents: z.ZodObject<{
1662
+ subagents: z.ZodArray<z.ZodObject<{
1663
+ subagent: z.ZodNumber;
1662
1664
  name: z.ZodString;
1663
1665
  working: z.ZodBoolean;
1664
1666
  soul: z.ZodString;
@@ -1666,7 +1668,7 @@ export declare const LEAD_TOOL_OUTPUTS: {
1666
1668
  templates: z.ZodArray<z.ZodUnknown>;
1667
1669
  rule: z.ZodString;
1668
1670
  }, z.core.$loose>;
1669
- readonly propose_teammate: z.ZodObject<{
1671
+ readonly propose_subagent: z.ZodObject<{
1670
1672
  proposal: z.ZodNumber;
1671
1673
  label: z.ZodString;
1672
1674
  awaiting: z.ZodString;
@@ -18,7 +18,7 @@ import { CHECK_RESULTS, RUN_OUTCOMES, TASK_STATES } from "../lead-commitments.js
18
18
  import { PERSON_ID } from "../lead-people.js";
19
19
  import { TASK_SIZES } from "../phase-routing.js";
20
20
  import { ACCEPTANCE_LIMITS } from "../scope.js";
21
- import { TEAMMATE_TEMPLATES } from "../teammates.js";
21
+ import { SUBAGENT_TEMPLATES } from "../subagents.js";
22
22
  import { TEXT_LIMITS } from "../text-limits.js";
23
23
  import { parseContract } from "./contract.js";
24
24
  import { FLOW_ALIASES } from "./flow.js";
@@ -48,8 +48,8 @@ export const acceptance = z.array(acceptanceCriterionSchema).min(1).max(ACCEPTAN
48
48
  const note = z.string().max(LIMITS.note, { error: issue => overBy(LIMITS.note, issue.input) }).describe(`At most ${LIMITS.note} characters; longer is refused with its length, not cut.`);
49
49
  /** Task states a list filters by. */
50
50
  export const LISTED_TASK_STATES = ["queued", "running", "done", "failed", "cancelled"];
51
- /** The shared actions the lead proposes with propose_action; flows and teammates have their own tools. */
52
- const ACTION_OPERATIONS = Object.keys(CHAT_ACTIONS).filter(one => !one.startsWith("flow_") && !one.startsWith("teammate_"));
51
+ /** The shared actions the lead proposes with propose_action; flows and subagents have their own tools. */
52
+ const ACTION_OPERATIONS = Object.keys(CHAT_ACTIONS).filter(one => !one.startsWith("flow_") && !one.startsWith("subagent_"));
53
53
  export const LEAD_TOOL_INPUTS = {
54
54
  get_brief: z.strictObject({ repo: repoId.optional() }),
55
55
  get_project_context: z.strictObject({ repo: repoId, query: text("contextQuery").min(1), mode: z.enum(["search", "impact"]).optional() }),
@@ -84,15 +84,15 @@ export const LEAD_TOOL_INPUTS = {
84
84
  get_flows: z.strictObject({ repo: repoId.optional(), flow: id.optional(), card: id.optional() }),
85
85
  // The flow contract's own schema (src/contracts/flow-propose.ts), never a second one here.
86
86
  propose_flow: proposeFlowInputSchema,
87
- get_teammates: z.strictObject({ repo: repoId.optional(), teammate: id.optional() }),
88
- propose_teammate: z.strictObject({
89
- operation: z.enum(["create", "edit_section", "edit_soul", "pause", "resume", "remove", "note", "answer", "use_tool", "stop_tool", "tool_rule", "forget", "edit_memory", "add_routine", "stop_routine", "undo"]),
90
- section: text("teammateSection").optional(), schedule: text("teammateSchedule").optional(), routine: id.optional(), memory: id.optional(),
91
- tool: text("teammateTool").optional(), action: text("teammateAction").optional(), undoWith: text("teammateAction").optional(), call: id.optional(),
92
- use: z.enum(["free", "ask", "never"]).optional(), limitField: text("teammateAction").optional(), limitOver: z.number().min(0).optional(),
93
- repo: repoId.optional(), teammate: id.optional(), template: enumOf(TEAMMATE_TEMPLATES.map(one => one.id)).optional(),
94
- name: text("teammateName").optional(), soul: text("teammateSoul").optional(), note: text("teammateNote").optional(),
95
- question: id.optional(), choice: text("teammateChoice").optional(), text: text("teammateText").optional(),
87
+ get_subagents: z.strictObject({ repo: repoId.optional(), subagent: id.optional() }),
88
+ propose_subagent: z.strictObject({
89
+ operation: z.enum(["ask", "create", "edit_section", "edit_soul", "pause", "resume", "remove", "note", "answer", "use_tool", "stop_tool", "tool_rule", "forget", "edit_memory", "add_routine", "stop_routine", "undo"]),
90
+ section: text("subagentSection").optional(), schedule: text("subagentSchedule").optional(), routine: id.optional(), memory: id.optional(),
91
+ tool: text("subagentTool").optional(), action: text("subagentAction").optional(), undoWith: text("subagentAction").optional(), call: id.optional(),
92
+ use: z.enum(["free", "ask", "never"]).optional(), limitField: text("subagentAction").optional(), limitOver: z.number().min(0).optional(),
93
+ repo: repoId.optional(), subagent: id.optional(), template: enumOf(SUBAGENT_TEMPLATES.map(one => one.id)).optional(),
94
+ name: text("subagentName").optional(), soul: text("subagentSoul").optional(), note: text("subagentNote").optional(),
95
+ question: id.optional(), choice: text("subagentChoice").optional(), text: text("subagentText").optional(),
96
96
  }),
97
97
  get_flow_insights: z.strictObject({ repo: repoId.optional(), flow: id.optional(), days: z.int().min(1).max(90).optional(), card: id.optional(), entry: id.optional() }),
98
98
  get_skills: z.strictObject({ repo: repoId, version: z.string().regex(/^[a-f0-9]{20}$/).optional(), offset: offset.optional() }),
@@ -165,7 +165,7 @@ const int = z.number().int();
165
165
  const list = z.array(z.unknown());
166
166
  const nullable = (schema) => schema.nullable();
167
167
  const rows = (shape) => z.array(z.looseObject(shape));
168
- /** A proposal drafted as a card the operator confirms (propose_action, propose_flow, propose_teammate). */
168
+ /** A proposal drafted as a card the operator confirms (propose_action, propose_flow, propose_subagent). */
169
169
  const cardDrafted = z.looseObject({ proposal: int, label: str, awaiting: str, executed: z.literal(false) });
170
170
  /** A proposal row drafted by one of the queue, hold, scope and answer tools. */
171
171
  const proposed = (kind, shape = {}) => z.looseObject({ proposal: int, kind: z.literal(kind), awaiting: str, ...shape });
@@ -211,8 +211,8 @@ export const LEAD_TOOL_OUTPUTS = {
211
211
  z.looseObject({ flows: rows({ flow: int, name: str, cards: int, needYou: int, triggers: int }), templates: list, scripts: list, rule: str }),
212
212
  ]),
213
213
  propose_flow: cardDrafted,
214
- get_teammates: z.looseObject({ teammates: rows({ teammate: int, name: str, working: z.boolean(), soul: str }), templates: list, rule: str }),
215
- propose_teammate: cardDrafted,
214
+ get_subagents: z.looseObject({ subagents: rows({ subagent: int, name: str, working: z.boolean(), soul: str }), templates: list, rule: str }),
215
+ propose_subagent: cardDrafted,
216
216
  get_flow_insights: z.union([
217
217
  z.looseObject({ days: int, flows: rows({ flow: int, name: str }) }),
218
218
  z.looseObject({ card: int, entry: int, state: str, log: str }),
@@ -68,7 +68,7 @@ export declare const STAGE_HANDOFFS: {
68
68
  readonly wait: z.ZodObject<{
69
69
  text: z.ZodString;
70
70
  }, z.core.$strict>;
71
- readonly teammate: z.ZodObject<{
71
+ readonly subagent: z.ZodObject<{
72
72
  text: z.ZodString;
73
73
  }, z.core.$strict>;
74
74
  readonly send: z.ZodObject<{
@@ -29,7 +29,7 @@ const words = stageHandoffSchema.pick({ text: true });
29
29
  */
30
30
  export const STAGE_HANDOFFS = {
31
31
  inbox: null, task: words, report: stageHandoffSchema, approval: null, check: words, "pull-request": words, update: words, notify: null,
32
- sort: words, draft: words, request: words, email: words, tool: words, wait: words, teammate: words, send: words, choose: null, done: null,
32
+ sort: words, draft: words, request: words, email: words, tool: words, wait: words, subagent: words, send: words, choose: null, done: null,
33
33
  };
34
34
  /** The extra `{{stage.<id>.<field>}}` fields a zone kind hands on. */
35
35
  export function stageFieldsOf(kind) {
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { z } from "zod";
15
15
  import { type ContractIssue } from "./contract.js";
16
- /** A teammate's rule for one tool action, as `teammates.ts` writes it. */
16
+ /** A subagent's rule for one tool action, as `subagents.ts` writes it. */
17
17
  export declare const savedToolRuleSchema: z.ZodObject<{
18
18
  use: z.ZodEnum<{
19
19
  ask: "ask";
@@ -42,7 +42,7 @@ export declare const savedDecisionOptionSchema: z.ZodObject<{
42
42
  }, z.core.$loose>;
43
43
  declare const STORE_COLUMN_VALUES: {
44
44
  readonly "run_check.suites_json": z.ZodArray<z.ZodUnknown>;
45
- readonly "teammate_suggestion.rule_json": z.ZodObject<{
45
+ readonly "subagent_suggestion.rule_json": z.ZodObject<{
46
46
  use: z.ZodEnum<{
47
47
  ask: "ask";
48
48
  free: "free";
@@ -54,7 +54,7 @@ declare const STORE_COLUMN_VALUES: {
54
54
  }, z.core.$loose>>;
55
55
  undo: z.ZodOptional<z.ZodString>;
56
56
  }, z.core.$loose>;
57
- readonly "teammate_suggestion.was_json": z.ZodObject<{
57
+ readonly "subagent_suggestion.was_json": z.ZodObject<{
58
58
  use: z.ZodEnum<{
59
59
  ask: "ask";
60
60
  free: "free";
@@ -66,15 +66,15 @@ declare const STORE_COLUMN_VALUES: {
66
66
  }, z.core.$loose>>;
67
67
  undo: z.ZodOptional<z.ZodString>;
68
68
  }, z.core.$loose>;
69
- readonly "teammate_suggestion.evidence_json": z.ZodArray<z.ZodNumber>;
70
- readonly "teammate_call.input_json": z.ZodObject<{}, z.core.$loose>;
71
- readonly "teammate_tool.actions_json": z.ZodArray<z.ZodObject<{
69
+ readonly "subagent_suggestion.evidence_json": z.ZodArray<z.ZodNumber>;
70
+ readonly "subagent_call.input_json": z.ZodObject<{}, z.core.$loose>;
71
+ readonly "subagent_tool.actions_json": z.ZodArray<z.ZodObject<{
72
72
  name: z.ZodString;
73
73
  about: z.ZodString;
74
74
  input: z.ZodNullable<z.ZodObject<{}, z.core.$loose>>;
75
75
  readOnly: z.ZodBoolean;
76
76
  }, z.core.$loose>>;
77
- readonly "teammate_tool.rules_json": z.ZodObject<{}, z.core.$catchall<z.ZodObject<{
77
+ readonly "subagent_tool.rules_json": z.ZodObject<{}, z.core.$catchall<z.ZodObject<{
78
78
  use: z.ZodEnum<{
79
79
  ask: "ask";
80
80
  free: "free";
@@ -86,11 +86,11 @@ declare const STORE_COLUMN_VALUES: {
86
86
  }, z.core.$loose>>;
87
87
  undo: z.ZodOptional<z.ZodString>;
88
88
  }, z.core.$loose>>>;
89
- readonly "teammate_question.options_json": z.ZodArray<z.ZodObject<{
89
+ readonly "subagent_question.options_json": z.ZodArray<z.ZodObject<{
90
90
  id: z.ZodString;
91
91
  label: z.ZodString;
92
92
  }, z.core.$loose>>;
93
- readonly "teammate_event.detail_json": z.ZodObject<{}, z.core.$loose>;
93
+ readonly "subagent_event.detail_json": z.ZodObject<{}, z.core.$loose>;
94
94
  readonly "flow_card.source_json": z.ZodObject<{
95
95
  label: z.ZodString;
96
96
  }, z.core.$loose>;
@@ -138,7 +138,7 @@ declare const STORE_COLUMN_VALUES: {
138
138
  method: z.ZodString;
139
139
  paths: z.ZodNumber;
140
140
  }, z.core.$loose>;
141
- readonly "mate_ask.options_json": z.ZodArray<z.ZodString>;
141
+ readonly "lead_ask.options_json": z.ZodArray<z.ZodString>;
142
142
  readonly "lead_config.about_json": z.ZodArray<z.ZodUnknown>;
143
143
  readonly "mutation.result": z.ZodUnknown;
144
144
  readonly "plan_revision.changed_fields": z.ZodArray<z.ZodString>;
@@ -163,7 +163,7 @@ declare const STORE_COLUMN_VALUES: {
163
163
  readonly "task_ref.capability_requirements": z.ZodArray<z.ZodUnknown>;
164
164
  readonly "coordinator_proposal.payload_json": z.ZodObject<{}, z.core.$loose>;
165
165
  readonly "coordinator_proposal.outcome_json": z.ZodObject<{}, z.core.$loose>;
166
- readonly "mate_proposal.payload_json": z.ZodUnion<readonly [z.ZodObject<{
166
+ readonly "lead_proposal.payload_json": z.ZodUnion<readonly [z.ZodObject<{
167
167
  version: z.ZodLiteral<1>;
168
168
  operation: z.ZodEnum<{
169
169
  decision_record: "decision_record";
@@ -198,17 +198,18 @@ declare const STORE_COLUMN_VALUES: {
198
198
  skill_import: "skill_import";
199
199
  skill_restore: "skill_restore";
200
200
  skill_test: "skill_test";
201
+ subagent_answer: "subagent_answer";
202
+ subagent_ask: "subagent_ask";
203
+ subagent_create: "subagent_create";
204
+ subagent_memory: "subagent_memory";
205
+ subagent_note: "subagent_note";
206
+ subagent_routine: "subagent_routine";
207
+ subagent_soul: "subagent_soul";
208
+ subagent_state: "subagent_state";
209
+ subagent_tools: "subagent_tools";
210
+ subagent_undo: "subagent_undo";
201
211
  task_cancel: "task_cancel";
202
212
  task_resume: "task_resume";
203
- teammate_answer: "teammate_answer";
204
- teammate_create: "teammate_create";
205
- teammate_memory: "teammate_memory";
206
- teammate_note: "teammate_note";
207
- teammate_routine: "teammate_routine";
208
- teammate_soul: "teammate_soul";
209
- teammate_state: "teammate_state";
210
- teammate_tools: "teammate_tools";
211
- teammate_undo: "teammate_undo";
212
213
  tool_add: "tool_add";
213
214
  tool_remove: "tool_remove";
214
215
  }>;
@@ -219,7 +220,7 @@ declare const STORE_COLUMN_VALUES: {
219
220
  stamp: z.ZodString;
220
221
  state: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
221
222
  }, z.core.$strict>, z.ZodObject<{}, z.core.$loose>]>;
222
- readonly "mate_proposal.outcome_json": z.ZodObject<{}, z.core.$loose>;
223
+ readonly "lead_proposal.outcome_json": z.ZodObject<{}, z.core.$loose>;
223
224
  readonly "proof_verdict.matrix_json": z.ZodArray<z.ZodObject<{
224
225
  id: z.ZodString;
225
226
  statement: z.ZodString;
@@ -250,7 +251,7 @@ declare const STORE_COLUMN_VALUES: {
250
251
  export type StoreColumn = keyof typeof STORE_COLUMN_VALUES;
251
252
  export type StoreColumnValue<C extends StoreColumn> = z.infer<(typeof STORE_COLUMN_VALUES)[C]>;
252
253
  /** Every JSON column the store reads itself, by `table.column`. */
253
- export declare const STORE_COLUMNS: ("approval_policy.protected_paths" | "backend_grant.mutations" | "backend_grant.paths" | "coordinator_proposal.outcome_json" | "coordinator_proposal.payload_json" | "criterion_review.screenshots_json" | "decision.options" | "flow_card.source_json" | "flow_comment.mentions_json" | "lead_config.about_json" | "mate_ask.options_json" | "mate_proposal.outcome_json" | "mate_proposal.payload_json" | "mutation.result" | "operating_mode.terms_json" | "plan_revision.changed_fields" | "proof_verdict.matrix_json" | "proof_verdict.reasons_json" | "publication_grant.capabilities" | "repair_chain.unresolved_json" | "run_check.suites_json" | "run_checkpoint.snapshot_json" | "run_tool.tools_json" | "runner.agents" | "runner.repos" | "task_ref.capability_requirements" | "task_ref.zones" | "task_scope.acceptance_json" | "task_scope.touches" | "teammate_call.input_json" | "teammate_event.detail_json" | "teammate_question.options_json" | "teammate_suggestion.evidence_json" | "teammate_suggestion.rule_json" | "teammate_suggestion.was_json" | "teammate_tool.actions_json" | "teammate_tool.rules_json" | "tool_seal.tools_json")[];
254
+ export declare const STORE_COLUMNS: ("approval_policy.protected_paths" | "backend_grant.mutations" | "backend_grant.paths" | "coordinator_proposal.outcome_json" | "coordinator_proposal.payload_json" | "criterion_review.screenshots_json" | "decision.options" | "flow_card.source_json" | "flow_comment.mentions_json" | "lead_ask.options_json" | "lead_config.about_json" | "lead_proposal.outcome_json" | "lead_proposal.payload_json" | "mutation.result" | "operating_mode.terms_json" | "plan_revision.changed_fields" | "proof_verdict.matrix_json" | "proof_verdict.reasons_json" | "publication_grant.capabilities" | "repair_chain.unresolved_json" | "run_check.suites_json" | "run_checkpoint.snapshot_json" | "run_tool.tools_json" | "runner.agents" | "runner.repos" | "subagent_call.input_json" | "subagent_event.detail_json" | "subagent_question.options_json" | "subagent_suggestion.evidence_json" | "subagent_suggestion.rule_json" | "subagent_suggestion.was_json" | "subagent_tool.actions_json" | "subagent_tool.rules_json" | "task_ref.capability_requirements" | "task_ref.zones" | "task_scope.acceptance_json" | "task_scope.touches" | "tool_seal.tools_json")[];
254
255
  /** A SQL projection, not a physical column; replay it separately after its owning column. */
255
256
  export declare const STORE_PROJECTIONS: readonly ["run_tool.tools_json.fence"];
256
257
  /** These readers historically only parsed JSON. Shape errors must not change their values or catch boundaries. */
@@ -23,7 +23,7 @@ const savedObject = z.looseObject({});
23
23
  const savedList = z.array(z.unknown());
24
24
  /** An object with a text `label`: a card's source (its reader keeps picking the fields it knows). */
25
25
  const cardSource = z.looseObject({ label: z.string() });
26
- /** A teammate's rule for one tool action, as `teammates.ts` writes it. */
26
+ /** A subagent's rule for one tool action, as `subagents.ts` writes it. */
27
27
  export const savedToolRuleSchema = z.looseObject({
28
28
  use: z.enum(["free", "ask", "never"]),
29
29
  limit: z.looseObject({ field: z.string(), over: z.number() }).optional(),
@@ -59,14 +59,14 @@ const savedMatrixRowSchema = proofCriterionSchema.pick({ id: true, statement: tr
59
59
  }).loose();
60
60
  const STORE_COLUMN_VALUES = {
61
61
  "run_check.suites_json": savedList,
62
- "teammate_suggestion.rule_json": savedToolRuleSchema,
63
- "teammate_suggestion.was_json": savedToolRuleSchema,
64
- "teammate_suggestion.evidence_json": z.array(z.number()),
65
- "teammate_call.input_json": savedObject,
66
- "teammate_tool.actions_json": z.array(savedToolActionSchema),
67
- "teammate_tool.rules_json": z.object({}).catchall(savedToolRuleSchema),
68
- "teammate_question.options_json": z.array(savedQuestionOptionSchema),
69
- "teammate_event.detail_json": savedObject,
62
+ "subagent_suggestion.rule_json": savedToolRuleSchema,
63
+ "subagent_suggestion.was_json": savedToolRuleSchema,
64
+ "subagent_suggestion.evidence_json": z.array(z.number()),
65
+ "subagent_call.input_json": savedObject,
66
+ "subagent_tool.actions_json": z.array(savedToolActionSchema),
67
+ "subagent_tool.rules_json": z.object({}).catchall(savedToolRuleSchema),
68
+ "subagent_question.options_json": z.array(savedQuestionOptionSchema),
69
+ "subagent_event.detail_json": savedObject,
70
70
  "flow_card.source_json": cardSource,
71
71
  "flow_comment.mentions_json": savedList,
72
72
  "task_scope.touches": z.lazy(() => scopeTermsSchema.unwrap().shape.touches.unwrap()),
@@ -81,7 +81,7 @@ const STORE_COLUMN_VALUES = {
81
81
  "run_tool.tools_json": savedToolsSchema,
82
82
  /** `json_extract(tools_json, '$.fence')`: the fence an attempt ran with. */
83
83
  "run_tool.tools_json.fence": savedFenceSchema,
84
- "mate_ask.options_json": z.array(z.string()),
84
+ "lead_ask.options_json": z.array(z.string()),
85
85
  "lead_config.about_json": savedList,
86
86
  "mutation.result": z.unknown(),
87
87
  "plan_revision.changed_fields": z.array(z.string()),
@@ -92,8 +92,8 @@ const STORE_COLUMN_VALUES = {
92
92
  "coordinator_proposal.payload_json": savedObject,
93
93
  "coordinator_proposal.outcome_json": savedObject,
94
94
  // Other proposal kinds have operation-specific fields; the action variant already has a canonical contract.
95
- "mate_proposal.payload_json": z.union([sharedActionSchema, savedObject]),
96
- "mate_proposal.outcome_json": savedObject,
95
+ "lead_proposal.payload_json": z.union([sharedActionSchema, savedObject]),
96
+ "lead_proposal.outcome_json": savedObject,
97
97
  "proof_verdict.matrix_json": z.array(savedMatrixRowSchema),
98
98
  "proof_verdict.reasons_json": savedList,
99
99
  "criterion_review.screenshots_json": savedList,
@@ -107,14 +107,14 @@ export const STORE_COLUMNS = Object.keys(STORE_COLUMN_VALUES).filter(column => c
107
107
  export const STORE_PROJECTIONS = ["run_tool.tools_json.fence"];
108
108
  /** These readers historically only parsed JSON. Shape errors must not change their values or catch boundaries. */
109
109
  export const LEGACY_JSON_COLUMNS = [
110
- "teammate_suggestion.rule_json", "teammate_suggestion.was_json", "teammate_suggestion.evidence_json",
111
- "teammate_call.input_json", "teammate_tool.actions_json", "teammate_tool.rules_json", "teammate_question.options_json",
112
- "teammate_event.detail_json", "task_scope.touches", "task_scope.acceptance_json",
110
+ "subagent_suggestion.rule_json", "subagent_suggestion.was_json", "subagent_suggestion.evidence_json",
111
+ "subagent_call.input_json", "subagent_tool.actions_json", "subagent_tool.rules_json", "subagent_question.options_json",
112
+ "subagent_event.detail_json", "task_scope.touches", "task_scope.acceptance_json",
113
113
  "operating_mode.terms_json", "decision.options", "run_tool.tools_json",
114
- "run_tool.tools_json.fence", "mate_ask.options_json", "mutation.result", "plan_revision.changed_fields",
114
+ "run_tool.tools_json.fence", "lead_ask.options_json", "mutation.result", "plan_revision.changed_fields",
115
115
  "run_checkpoint.snapshot_json", "publication_grant.capabilities",
116
116
  "coordinator_proposal.payload_json", "coordinator_proposal.outcome_json",
117
- "mate_proposal.payload_json", "mate_proposal.outcome_json",
117
+ "lead_proposal.payload_json", "lead_proposal.outcome_json",
118
118
  ];
119
119
  /** One column's versioned envelope: `{ version: 1, value }`, built in memory around the saved bare value. */
120
120
  export function storeColumnSchema(column) {
@@ -1,22 +1,22 @@
1
1
  /**
2
- * A teammate's turn (teammates.ts): one schema for the JSON Schema Claude answers in (`--json-schema`) and the reader
2
+ * A subagent's turn (subagents.ts): one schema for the JSON Schema Claude answers in (`--json-schema`) and the reader
3
3
  * that takes the answer back. One flat object with every field (a root union is refused by the API); fields a turn
4
4
  * does not use are "" (or [] for options).
5
5
  *
6
6
  * The text limits (TURN_LIMITS, from TEXT_LIMITS) are deliberately not in the schema: the CLI refuses an answer a few
7
7
  * characters over one whole, so they are checked after parsing and an answer over one is asked once to shorten
8
- * (teammate-work.ts), then kept whole. What the zone allows — which actions, which answers, a note for a send-back, a
8
+ * (subagent-work.ts), then kept whole. What the zone allows — which actions, which answers, a note for a send-back, a
9
9
  * question for an ask, a tool for a tool call — is checked after parsing too (`readTurn`), by path.
10
10
  *
11
11
  * A turn is kept as the step's decision (`flow_step_run.decision_json`) as it was read, so a saved one is this shape.
12
12
  */
13
13
  import { z } from "zod";
14
14
  import { type ContractResult } from "./contract.js";
15
- /** What a teammate may do on one turn. A decision zone: approve, send back, or hand it to a person. A work zone: pick
15
+ /** What a subagent may do on one turn. A decision zone: approve, send back, or hand it to a person. A work zone: pick
16
16
  * where it goes, ask its person, or say it can't. v94: "use_tool" asks for one tool call. */
17
17
  export declare const TURN_ACTIONS: readonly ["approve", "send_back", "hand_off", "route", "ask", "cant", "use_tool"];
18
18
  export type TurnAction = (typeof TURN_ACTIONS)[number];
19
- export declare const teammateTurnSchema: z.ZodObject<{
19
+ export declare const subagentTurnSchema: z.ZodObject<{
20
20
  action: z.ZodEnum<{
21
21
  approve: "approve";
22
22
  ask: "ask";
@@ -36,7 +36,7 @@ export declare const teammateTurnSchema: z.ZodObject<{
36
36
  input: z.ZodString;
37
37
  remember: z.ZodString;
38
38
  }, z.core.$strip>;
39
- export type TurnAnswer = z.infer<typeof teammateTurnSchema>;
39
+ export type TurnAnswer = z.infer<typeof subagentTurnSchema>;
40
40
  /** What Claude's `--json-schema` is for a turn: the turn schema, exactly. */
41
41
  export declare const TURN_MODEL_SCHEMA: Readonly<Record<string, unknown>>;
42
42
  /** Older and plain-text turns default absent or non-text fields to "", and keep only string options. */