toolroll 0.9.55 → 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.
- package/CHANGELOG.md +10 -0
- package/README.md +24 -8
- package/dist/action-ledger.d.ts +2 -4
- package/dist/action-ledger.js +2 -10
- package/dist/approval-policy.d.ts +5 -5
- package/dist/approval-policy.js +4 -4
- package/dist/approval-rules-ui.js +2 -2
- package/dist/browser/workspace.js +5 -5
- package/dist/browser-workspace.d.ts +12 -12
- package/dist/budget-alerts.js +3 -3
- package/dist/chat-actions.d.ts +23 -18
- package/dist/chat-actions.js +110 -88
- package/dist/chat-ask.d.ts +2 -2
- package/dist/chat-ask.js +5 -5
- package/dist/chat-channel.d.ts +15 -15
- package/dist/chat-channel.js +20 -20
- package/dist/chat-controls.d.ts +0 -4
- package/dist/chat-controls.js +0 -1
- package/dist/chat-core.js +1 -1
- package/dist/chat-delivery-state.js +2 -2
- package/dist/chat-delivery.d.ts +2 -2
- package/dist/chat-delivery.js +27 -34
- package/dist/chat-flow.js +3 -3
- package/dist/chat-messages.d.ts +1 -1
- package/dist/chat-messages.js +4 -4
- package/dist/chat-migration.d.ts +1 -1
- package/dist/chat-migration.js +11 -11
- package/dist/chat-rooms.js +3 -3
- package/dist/chat-warmth.d.ts +2 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +6 -7
- package/dist/contracts/chat-actions.d.ts +32 -27
- package/dist/contracts/chat-actions.js +29 -11
- package/dist/contracts/chat-content.d.ts +1 -1
- package/dist/contracts/chat-content.js +1 -1
- package/dist/contracts/chat-tables.js +4 -4
- package/dist/contracts/console-api.d.ts +6 -6
- package/dist/contracts/console-api.js +7 -7
- package/dist/contracts/flow-propose.d.ts +3 -3
- package/dist/contracts/flow.d.ts +132 -125
- package/dist/contracts/flow.js +27 -12
- package/dist/contracts/lead-context.d.ts +1 -1
- package/dist/contracts/lead-context.js +2 -2
- package/dist/contracts/lead-tools.d.ts +20 -18
- package/dist/contracts/lead-tools.js +15 -15
- package/dist/contracts/stage-output.d.ts +1 -1
- package/dist/contracts/stage-output.js +1 -1
- package/dist/contracts/store-json.d.ts +23 -22
- package/dist/contracts/store-json.js +17 -17
- package/dist/contracts/{teammate-turn.d.ts → subagent-turn.d.ts} +5 -5
- package/dist/contracts/{teammate-turn.js → subagent-turn.js} +7 -7
- package/dist/converse.d.ts +23 -23
- package/dist/converse.js +28 -28
- package/dist/coordinator-proposals.d.ts +2 -2
- package/dist/coordinator-proposals.js +1 -1
- package/dist/coordinator.js +1 -1
- package/dist/deprecations.d.ts +12 -0
- package/dist/deprecations.js +20 -0
- package/dist/desktop-update-gate.js +8 -4
- package/dist/desktop-update.js +6 -1
- package/dist/discord-chat.js +6 -6
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +1 -1
- package/dist/envelope.js +0 -1
- package/dist/export-ui.js +1 -1
- package/dist/export.js +7 -7
- package/dist/flow-engine.d.ts +2 -2
- package/dist/flow-engine.js +21 -21
- package/dist/flow-insights.d.ts +1 -1
- package/dist/flow-share.js +13 -8
- package/dist/flow-steps.d.ts +5 -5
- package/dist/flow-steps.js +19 -19
- package/dist/flow-triggers.d.ts +1 -1
- package/dist/flow-triggers.js +1 -1
- package/dist/flows-cli.js +1 -1
- package/dist/flows-ui.js +20 -20
- package/dist/flows.js +19 -19
- package/dist/guides.js +4 -3
- package/dist/invoke.js +1 -1
- package/dist/kits-ui.js +5 -5
- package/dist/kits.d.ts +12 -12
- package/dist/kits.js +31 -31
- package/dist/{mate-cli.d.ts → lead-cli.d.ts} +11 -11
- package/dist/{mate-cli.js → lead-cli.js} +38 -38
- package/dist/lead-commitments.js +4 -4
- package/dist/lead-context.d.ts +2 -2
- package/dist/lead-context.js +9 -9
- package/dist/{mate-contract.d.ts → lead-contract.d.ts} +3 -3
- package/dist/{mate-contract.js → lead-contract.js} +7 -6
- package/dist/{mate-doors.d.ts → lead-doors.d.ts} +6 -6
- package/dist/{mate-doors.js → lead-doors.js} +24 -24
- package/dist/lead-follow.d.ts +5 -5
- package/dist/lead-follow.js +9 -9
- package/dist/lead-people.d.ts +5 -5
- package/dist/lead-people.js +14 -14
- package/dist/{mate-progress.d.ts → lead-progress.d.ts} +9 -9
- package/dist/{mate-progress.js → lead-progress.js} +3 -3
- package/dist/{mate-tools.d.ts → lead-tools.d.ts} +19 -19
- package/dist/{mate-tools.js → lead-tools.js} +109 -101
- package/dist/{mate.d.ts → lead.d.ts} +27 -27
- package/dist/{mate.js → lead.js} +102 -102
- package/dist/limits-ui.d.ts +1 -1
- package/dist/limits-ui.js +1 -1
- package/dist/mcp-connect.d.ts +1 -1
- package/dist/mcp-connect.js +3 -3
- package/dist/mcp-core.js +1 -1
- package/dist/memory-pass.d.ts +2 -2
- package/dist/memory-pass.js +7 -7
- package/dist/notification-rows.d.ts +2 -2
- package/dist/operate.d.ts +3 -3
- package/dist/operate.js +35 -34
- package/dist/policy.d.ts +1 -1
- package/dist/principal.d.ts +1 -1
- package/dist/principal.js +2 -2
- package/dist/project-delete-ui.js +1 -1
- package/dist/project-delete.d.ts +1 -1
- package/dist/project-delete.js +26 -26
- package/dist/project-memory.js +1 -1
- package/dist/project-tools.d.ts +1 -1
- package/dist/project-tools.js +1 -1
- package/dist/recipe-ui.js +1 -1
- package/dist/retention.js +4 -4
- package/dist/scope.d.ts +2 -2
- package/dist/scout-report.d.ts +1 -1
- package/dist/scout-report.js +1 -1
- package/dist/serve.js +40 -45
- package/dist/server/chat.d.ts +4 -4
- package/dist/server/chat.js +97 -97
- package/dist/server/chrome.js +3 -3
- package/dist/server/flows.js +69 -62
- package/dist/server/guards.js +3 -3
- package/dist/server/http.d.ts +3 -3
- package/dist/server/http.js +1 -1
- package/dist/server/live.js +6 -6
- package/dist/server/people-tokens.js +1 -1
- package/dist/server/remote.js +12 -10
- package/dist/server/render-chat.d.ts +30 -30
- package/dist/server/render-chat.js +33 -33
- package/dist/server/render-pages.js +2 -2
- package/dist/server/render-settings.d.ts +7 -0
- package/dist/server/render-settings.js +3 -0
- package/dist/server/route-table.js +9 -7
- package/dist/server/runtime.d.ts +13 -13
- package/dist/server/settings.js +14 -13
- package/dist/server/tasks.js +6 -5
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-chat.d.ts +2 -2
- package/dist/slack-chat.js +6 -6
- package/dist/spend-ui.d.ts +3 -3
- package/dist/spend-ui.js +9 -9
- package/dist/spend.d.ts +14 -14
- package/dist/spend.js +31 -31
- package/dist/store-baseline.d.ts +19 -0
- package/dist/store-baseline.js +2873 -0
- package/dist/store.d.ts +197 -249
- package/dist/store.js +747 -3084
- package/dist/subagent-admin.d.ts +53 -0
- package/dist/{teammate-admin.js → subagent-admin.js} +37 -37
- package/dist/{teammate-desk.d.ts → subagent-desk.d.ts} +22 -23
- package/dist/{teammate-desk.js → subagent-desk.js} +26 -35
- package/dist/{teammate-memory.d.ts → subagent-memory.d.ts} +17 -17
- package/dist/{teammate-memory.js → subagent-memory.js} +41 -41
- package/dist/{teammate-question.d.ts → subagent-question.d.ts} +6 -6
- package/dist/{teammate-question.js → subagent-question.js} +17 -17
- package/dist/{teammate-tools.d.ts → subagent-tools.d.ts} +18 -18
- package/dist/{teammate-tools.js → subagent-tools.js} +36 -36
- package/dist/{teammate-week.d.ts → subagent-week.d.ts} +10 -10
- package/dist/{teammate-week.js → subagent-week.js} +23 -23
- package/dist/{teammate-work.d.ts → subagent-work.d.ts} +21 -21
- package/dist/{teammate-work.js → subagent-work.js} +50 -50
- package/dist/subagents-ui.d.ts +22 -0
- package/dist/{teammates-ui.js → subagents-ui.js} +45 -45
- package/dist/{teammates.d.ts → subagents.d.ts} +11 -11
- package/dist/{teammates.js → subagents.js} +21 -21
- package/dist/subscription-chat.d.ts +13 -13
- package/dist/subscription-chat.js +19 -19
- package/dist/surface.d.ts +19 -2
- package/dist/surface.js +7 -31
- package/dist/team-cli.d.ts +1 -0
- package/dist/team-cli.js +14 -2
- package/dist/team-leads.js +13 -13
- package/dist/team-runtime.d.ts +2 -2
- package/dist/team-runtime.js +8 -8
- package/dist/teams-chat.js +6 -6
- package/dist/telegram-flow.d.ts +3 -3
- package/dist/telegram-flow.js +3 -3
- package/dist/{telegram-mate.d.ts → telegram-lead.d.ts} +5 -5
- package/dist/{telegram-mate.js → telegram-lead.js} +27 -27
- package/dist/telegram-status.js +1 -1
- package/dist/telegram-team.d.ts +1 -1
- package/dist/telegram-team.js +5 -5
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +9 -30
- package/dist/text-limits.d.ts +18 -18
- package/dist/text-limits.js +18 -18
- package/dist/toolroll-update.d.ts +8 -0
- package/dist/toolroll-update.js +45 -8
- package/package.json +1 -2
- package/dist/teammate-admin.d.ts +0 -53
- package/dist/teammates-ui.d.ts +0 -21
package/dist/contracts/flow.js
CHANGED
|
@@ -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", "
|
|
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
|
|
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,
|
|
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("
|
|
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
|
|
214
|
-
|
|
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", "
|
|
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
|
-
|
|
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"),
|
|
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.
|
|
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.
|
|
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>,
|
|
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(),
|
|
@@ -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
|
-
|
|
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,
|
|
40
|
-
people: z.strictObject({ people: 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
|
-
|
|
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<"
|
|
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
|
-
|
|
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
|
|
461
|
+
readonly get_subagents: z.ZodObject<{
|
|
462
462
|
repo: z.ZodOptional<z.ZodString>;
|
|
463
|
-
|
|
463
|
+
subagent: z.ZodOptional<z.ZodInt>;
|
|
464
464
|
}, z.core.$strict>;
|
|
465
|
-
readonly
|
|
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
|
-
|
|
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
|
-
|
|
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<"
|
|
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
|
-
|
|
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
|
|
1150
|
+
readonly get_subagents: z.ZodObject<{
|
|
1150
1151
|
repo: z.ZodOptional<z.ZodString>;
|
|
1151
|
-
|
|
1152
|
+
subagent: z.ZodOptional<z.ZodInt>;
|
|
1152
1153
|
}, z.core.$strict>;
|
|
1153
|
-
readonly
|
|
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
|
-
|
|
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
|
|
1660
|
-
|
|
1661
|
-
|
|
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
|
|
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 {
|
|
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
|
|
52
|
-
const ACTION_OPERATIONS = Object.keys(CHAT_ACTIONS).filter(one => !one.startsWith("flow_") && !one.startsWith("
|
|
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
|
-
|
|
88
|
-
|
|
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("
|
|
91
|
-
tool: text("
|
|
92
|
-
use: z.enum(["free", "ask", "never"]).optional(), limitField: text("
|
|
93
|
-
repo: repoId.optional(),
|
|
94
|
-
name: text("
|
|
95
|
-
question: id.optional(), choice: text("
|
|
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,
|
|
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
|
-
|
|
215
|
-
|
|
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
|
|
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,
|
|
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
|
|
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 "
|
|
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 "
|
|
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 "
|
|
70
|
-
readonly "
|
|
71
|
-
readonly "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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" | "
|
|
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
|
|
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
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
96
|
-
"
|
|
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
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
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", "
|
|
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
|
-
"
|
|
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
|
|
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
|
-
* (
|
|
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
|
|
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
|
|
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
|
|
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. */
|