@hearsay-tools/squawk 0.18.0-pr3694.6731 → 0.18.0-pr3695.6779
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +4 -4
- package/dist/ci-wait/tools.d.ts +4 -4
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +99 -30
- package/dist/contract/own-lookup.d.ts +5 -0
- package/dist/contract/run-predicates.d.ts +25 -1
- package/dist/contract/runs.d.ts +34 -3
- package/dist/contract/tool-display.d.ts +8 -2
- package/dist/core/claude-cli-runner.d.ts +6 -0
- package/dist/core/claude-forked-command.d.ts +36 -0
- package/dist/core/claude-forked-command.js +65 -0
- package/dist/core/claude-forked-command.js.map +1 -0
- package/dist/core/claude-ui-mapper.d.ts +2 -1
- package/dist/core/claude-ui-mapper.js +17 -1
- package/dist/core/claude-ui-mapper.js.map +1 -1
- package/dist/core/codex-app-server-runner.d.ts +6 -0
- package/dist/core/cursor-print-runner.d.ts +6 -0
- package/dist/core/cursor-runner.d.ts +6 -0
- package/dist/core/omp-runner.d.ts +6 -0
- package/dist/core/opencode-server-runner.d.ts +6 -0
- package/dist/core/own-lookup.d.ts +1 -5
- package/dist/core/own-lookup.js +1 -7
- package/dist/core/own-lookup.js.map +1 -1
- package/dist/core/pi-runner.d.ts +6 -0
- package/dist/core/runner-facts.d.ts +70 -0
- package/dist/core/runner-facts.js +65 -0
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/delegation/conversations.d.ts +10 -2
- package/dist/delegation/execution-identity.d.ts +13 -5
- package/dist/delegation/execution-identity.js +23 -9
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/routes.d.ts +21 -21
- package/dist/delegation/transport.d.ts +73 -73
- package/dist/runs/legacy-run-rows.d.ts +8 -0
- package/dist/runs/legacy-run-rows.js +19 -0
- package/dist/runs/legacy-run-rows.js.map +1 -1
- package/dist/runs/run-exits.d.ts +1370 -51
- package/dist/runs/run-exits.js +18 -7
- package/dist/runs/run-exits.js.map +1 -1
- package/dist/runs/store.d.ts +16 -4
- package/dist/runs/store.js +4 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/serve-boot.js +1 -0
- package/dist/serve-boot.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/open-in-targets.js +2 -1
- package/dist/server/open-in-targets.js.map +1 -1
- package/dist/server/server.d.ts +1723 -1651
- package/dist/server/server.js +4 -7
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +12 -2
- package/dist/workflows/continuation-admission.js +11 -6
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/execution-account.js +2 -1
- package/dist/workflows/execution-account.js.map +1 -1
- package/dist/workflows/run/auto-resume.d.ts +9 -8
- package/dist/workflows/run/auto-resume.js +17 -27
- package/dist/workflows/run/auto-resume.js.map +1 -1
- package/dist/workflows/run/compose.d.ts +3 -0
- package/dist/workflows/run/compose.js +14 -13
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.js +2 -1
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +6 -3
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/family-reconciler.d.ts +4 -5
- package/dist/workflows/run/family-reconciler.js +9 -19
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/inbox-claims.d.ts +3 -4
- package/dist/workflows/run/inbox-claims.js +7 -17
- package/dist/workflows/run/inbox-claims.js.map +1 -1
- package/dist/workflows/run/input-delivery.d.ts +7 -1
- package/dist/workflows/run/input-delivery.js +19 -19
- package/dist/workflows/run/input-delivery.js.map +1 -1
- package/dist/workflows/run/input-timers.js +3 -2
- package/dist/workflows/run/input-timers.js.map +1 -1
- package/dist/workflows/run/launch-read-resolver.d.ts +7 -2
- package/dist/workflows/run/launch-read-resolver.js +33 -11
- package/dist/workflows/run/launch-read-resolver.js.map +1 -1
- package/dist/workflows/run/liveness-timers.d.ts +101 -0
- package/dist/workflows/run/liveness-timers.js +132 -0
- package/dist/workflows/run/liveness-timers.js.map +1 -0
- package/dist/workflows/run/queued-revival.js +2 -1
- package/dist/workflows/run/queued-revival.js.map +1 -1
- package/dist/workflows/run/run-memory.d.ts +11 -3
- package/dist/workflows/run/run-memory.js +34 -8
- package/dist/workflows/run/run-memory.js.map +1 -1
- package/dist/workflows/run/run-settlement.d.ts +9 -4
- package/dist/workflows/run/run-settlement.js +25 -12
- package/dist/workflows/run/run-settlement.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +2 -2
- package/dist/workflows/run/session-events.js +1 -1
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/squawk-tools.js +2 -0
- package/dist/workflows/run/squawk-tools.js.map +1 -1
- package/dist/workflows/run/step-loop.d.ts +2 -2
- package/dist/workflows/run/step-loop.js +8 -3
- package/dist/workflows/run/step-loop.js.map +1 -1
- package/dist/workflows/run/subagent-waits.d.ts +10 -5
- package/dist/workflows/run/subagent-waits.js +43 -32
- package/dist/workflows/run/subagent-waits.js.map +1 -1
- package/dist/workflows/run/turn-nudges.d.ts +3 -1
- package/dist/workflows/run/turn-nudges.js +9 -6
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/dist/workflows/run/turn-settler.d.ts +7 -2
- package/dist/workflows/run/turn-settler.js +13 -4
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +5 -1
- package/dist/workflows/run/wake-retries.d.ts +5 -7
- package/dist/workflows/run/wake-retries.js +17 -42
- package/dist/workflows/run/wake-retries.js.map +1 -1
- package/dist/workflows/run/worker-executions.js +2 -0
- package/dist/workflows/run/worker-executions.js.map +1 -1
- package/dist/workflows/run/workflow-position.d.ts +1 -0
- package/dist/workflows/run/workflow-position.js +1 -0
- package/dist/workflows/run/workflow-position.js.map +1 -1
- package/dist/workflows/run-scheduling.d.ts +4 -1
- package/dist/workflows/run-scheduling.js +10 -1
- package/dist/workflows/run-scheduling.js.map +1 -1
- package/dist/workflows/run-states.js +6 -3
- package/dist/workflows/run-states.js.map +1 -1
- package/dist/workflows/run.js +9 -2
- package/dist/workflows/run.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-ask-answer.d.mts +2 -0
- package/scripts/mock-opencode-questions.d.mts +14 -0
- package/scripts/mock-pi-rpc.mjs +9 -4
- package/web/dist/assets/{activity-motion-BfsGJx6P.js → activity-motion-BcavmxeG.js} +1 -1
- package/web/dist/assets/{activity-route-C9ZZYiDq.js → activity-route-jS3ps343.js} +1 -1
- package/web/dist/assets/agent-accounts-BAUPVmTO.js +18 -0
- package/web/dist/assets/attention-C6XIgMqB.js +1 -0
- package/web/dist/assets/{commit-diff-panel-Bsbb4jXi.js → commit-diff-panel-DHrhBuja.js} +1 -1
- package/web/dist/assets/{diff-jkg1DSMK.js → diff-CHLFmoKa.js} +2 -2
- package/web/dist/assets/{diff-view-BIQw3vxx.js → diff-view-Oc9yc--2.js} +1 -1
- package/web/dist/assets/{file-preview-JSSyatwL.js → file-preview-DSEFqbTd.js} +1 -1
- package/web/dist/assets/git-toolbar-BV3GJnxs.js +1 -0
- package/web/dist/assets/github-DY-XVRIt.js +1 -0
- package/web/dist/assets/{global-activity-route-__imofk6.js → global-activity-route-CG-KJ5nT.js} +1 -1
- package/web/dist/assets/index-CZhXGODQ.js +17 -0
- package/web/dist/assets/preview-pane-connected-C7InXcOm.js +3 -0
- package/web/dist/assets/{project-router-oKsNlPN6.js → project-router-CbWELZZ9.js} +1 -1
- package/web/dist/assets/project-scope-context-p1OpXpSJ.js +4 -0
- package/web/dist/assets/{prompt-template-menu-BiQJj-nc.js → prompt-template-menu-BFhfpiVS.js} +1 -1
- package/web/dist/assets/{queries-B8cOyvJb.js → queries-BAUtqJph.js} +1 -1
- package/web/dist/assets/{reference-chip-F_Me3F60.js → reference-chip-BaIEdmc_.js} +1 -1
- package/web/dist/assets/{repo-git-DRmhIzGq.js → repo-git-BYZf8TT7.js} +1 -1
- package/web/dist/assets/{report-reader-BklPToJ0.js → report-reader-CpnsI5Gj.js} +1 -1
- package/web/dist/assets/{reports-Brb3vngi.js → reports-CQ9CJc3z.js} +1 -1
- package/web/dist/assets/{run-header-iM0QS8Dj.js → run-header-BIpR0O8Y.js} +1 -1
- package/web/dist/assets/{skills-DETFoSD4.js → skills-DhWGiDDP.js} +1 -1
- package/web/dist/assets/{tab-link-Buy1fRFO.js → tab-link-CT5gqdai.js} +1 -1
- package/web/dist/assets/{task-changes-BPh8L3YW.js → task-changes-D1IOP8et.js} +1 -1
- package/web/dist/assets/{task-commits-jfxhLTWN.js → task-commits-DotXjRQ0.js} +1 -1
- package/web/dist/assets/{task-files-CnYr2Po6.js → task-files-D1oi63kj.js} +1 -1
- package/web/dist/assets/task-github-item-DDYwNNbJ.js +1 -0
- package/web/dist/assets/task-thread-CG_oNpEL.js +9 -0
- package/web/dist/assets/thread-state-B9Zecqrr.js +4 -0
- package/web/dist/assets/use-desktop-Bh8jYA9c.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-bcLfMD2p.js +1 -0
- package/web/dist/assets/{useInfiniteQuery-Yn58_Fkn.js → useInfiniteQuery-DD7iZHIJ.js} +1 -1
- package/web/dist/assets/useQuery-DVAeyc_X.js +1 -0
- package/web/dist/assets/{workflows-DWqcC7Z5.js → workflows-BBP1vcp_.js} +1 -1
- package/web/dist/assets/{ws-DbXGHAke.js → ws-CqtLOaJ8.js} +1 -1
- package/web/dist/index.html +12 -12
- package/web/dist/assets/agent-accounts-CgQv1VV_.js +0 -18
- package/web/dist/assets/attention-BF8NA1XM.js +0 -1
- package/web/dist/assets/git-toolbar-ROfOomb5.js +0 -1
- package/web/dist/assets/github-DajrfIj8.js +0 -1
- package/web/dist/assets/index-BBbLsVNM.js +0 -17
- package/web/dist/assets/preview-pane-connected-CxmrfQWd.js +0 -3
- package/web/dist/assets/project-scope-context-BBVJVcJp.js +0 -4
- package/web/dist/assets/task-github-item-BwoGJR0b.js +0 -1
- package/web/dist/assets/task-thread-CF3FhGcd.js +0 -9
- package/web/dist/assets/thread-state-BstGRhS4.js +0 -4
- package/web/dist/assets/use-desktop-BkNENusj.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-DPiSll_t.js +0 -1
- package/web/dist/assets/useQuery-C1xFF0nd.js +0 -1
|
@@ -638,6 +638,10 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
638
638
|
};
|
|
639
639
|
} | {
|
|
640
640
|
output: {
|
|
641
|
+
ok: false;
|
|
642
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
643
|
+
message: string;
|
|
644
|
+
} | {
|
|
641
645
|
ok: true;
|
|
642
646
|
task: {
|
|
643
647
|
id: string;
|
|
@@ -649,10 +653,6 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
649
653
|
url?: string | undefined;
|
|
650
654
|
};
|
|
651
655
|
note: string;
|
|
652
|
-
} | {
|
|
653
|
-
ok: false;
|
|
654
|
-
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
655
|
-
message: string;
|
|
656
656
|
};
|
|
657
657
|
outputFormat: "json";
|
|
658
658
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
package/dist/ci-wait/tools.d.ts
CHANGED
|
@@ -248,10 +248,6 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
248
248
|
}[];
|
|
249
249
|
isError: boolean;
|
|
250
250
|
details: {
|
|
251
|
-
ok: false;
|
|
252
|
-
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
253
|
-
message: string;
|
|
254
|
-
} | {
|
|
255
251
|
ok: true;
|
|
256
252
|
task: {
|
|
257
253
|
id: string;
|
|
@@ -263,6 +259,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
263
259
|
url?: string | undefined;
|
|
264
260
|
};
|
|
265
261
|
note: string;
|
|
262
|
+
} | {
|
|
263
|
+
ok: false;
|
|
264
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
265
|
+
message: string;
|
|
266
266
|
};
|
|
267
267
|
}>;
|
|
268
268
|
export declare function invokeScheduledTasksTool(input: unknown): Promise<{
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './live-coordination.ts';
|
|
|
45
45
|
export * from './workspace-events.ts';
|
|
46
46
|
export * from './permissions.ts';
|
|
47
47
|
export * from './defined.ts';
|
|
48
|
+
export * from './own-lookup.ts';
|
|
48
49
|
export * from './tool-display.ts';
|
|
49
50
|
export * from './version.ts';
|
|
50
51
|
export * from './active-provider.ts';
|
package/dist/contract/index.js
CHANGED
|
@@ -2524,7 +2524,11 @@ var stepStateSchema = z20.object({
|
|
|
2524
2524
|
profileId: z20.string().optional(),
|
|
2525
2525
|
costUsd: z20.number().optional(),
|
|
2526
2526
|
/** Explicit provenance for engine-generated continuation steps. */
|
|
2527
|
-
synthetic: z20.literal("continuation").optional()
|
|
2527
|
+
synthetic: z20.literal("continuation").optional(),
|
|
2528
|
+
/** On a `synthetic` continuation: the workflow step it continues, recorded once at admission
|
|
2529
|
+
* (ADR 0064). It names the step a later Continue of this session runs as, never the workflow
|
|
2530
|
+
* position. Absent on steps saved before it; those resolve to the chain's last agent step. */
|
|
2531
|
+
continuesStepId: z20.string().optional()
|
|
2528
2532
|
});
|
|
2529
2533
|
var diffStatSchema = z20.object({
|
|
2530
2534
|
adds: z20.number(),
|
|
@@ -2581,6 +2585,7 @@ var runPullRequestSchema = z20.object({
|
|
|
2581
2585
|
url: z20.string().regex(/^https?:\/\/github\.com\/[a-z0-9_.-]+\/[a-z0-9_.-]+\/pull\/\d+\/?(?:[?#][^\s]*)?$/i).optional(),
|
|
2582
2586
|
source: z20.enum(["declared", "created"])
|
|
2583
2587
|
}).refine((entry) => entry.url === void 0 || Number(/\/pull\/(\d+)/i.exec(entry.url)?.[1]) === entry.number, { message: "PR URL and number must agree" });
|
|
2588
|
+
var workflowCursorSchema = z20.object({ stepId: z20.string(), mode: z20.enum(["resume", "start"]) });
|
|
2584
2589
|
var runRecordSchema = z20.object({
|
|
2585
2590
|
id: z20.string(),
|
|
2586
2591
|
title: z20.string(),
|
|
@@ -2598,8 +2603,10 @@ var runRecordSchema = z20.object({
|
|
|
2598
2603
|
stopping: z20.boolean().optional(),
|
|
2599
2604
|
/** Opening Continue message, retained until its first completed turn for crash recovery. */
|
|
2600
2605
|
continuationMessage: continuationMessageSchema.optional(),
|
|
2601
|
-
/**
|
|
2602
|
-
|
|
2606
|
+
/** The workflow step the run goes on from (ADR 0064): `resume` continues that step's session (a
|
|
2607
|
+
* failed attempt awaiting CI recovery or a provider retry), `start` runs it after a Continue
|
|
2608
|
+
* completed the step before it. Only the run exits write it (`runs/run-exits.ts`). */
|
|
2609
|
+
workflowCursor: workflowCursorSchema.optional(),
|
|
2603
2610
|
/** The last turn carried a malformed explicit structured question. */
|
|
2604
2611
|
invalidAsk: z20.boolean().optional(),
|
|
2605
2612
|
/** Owned-run authority; absence is legacy, invalid is explicitly quarantined. */
|
|
@@ -4573,6 +4580,18 @@ var scheduledTasksAnswerSchema = z29.union([
|
|
|
4573
4580
|
]);
|
|
4574
4581
|
|
|
4575
4582
|
// ../contract/src/run-predicates.ts
|
|
4583
|
+
function latestSessionStep(steps, except) {
|
|
4584
|
+
let latest;
|
|
4585
|
+
for (const step of steps) {
|
|
4586
|
+
if (!step.sessionId || step.id === except) continue;
|
|
4587
|
+
if (!latest || !step.startedAt || !latest.startedAt || step.startedAt >= latest.startedAt) latest = step;
|
|
4588
|
+
}
|
|
4589
|
+
return latest;
|
|
4590
|
+
}
|
|
4591
|
+
function latestSession(run) {
|
|
4592
|
+
const step = latestSessionStep(run.steps);
|
|
4593
|
+
return { sessionId: step?.sessionId, backend: step?.backend ?? run.runner ?? "claude", profileId: step?.profileId };
|
|
4594
|
+
}
|
|
4576
4595
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["queued", "running", "waiting"]);
|
|
4577
4596
|
function isLiveStatus(status) {
|
|
4578
4597
|
return LIVE_STATUSES.has(status);
|
|
@@ -5103,6 +5122,11 @@ function defined(value) {
|
|
|
5103
5122
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
5104
5123
|
}
|
|
5105
5124
|
|
|
5125
|
+
// ../contract/src/own-lookup.ts
|
|
5126
|
+
function ownLookup(table, key) {
|
|
5127
|
+
return typeof key === "string" && Object.hasOwn(table, key) ? table[key] : void 0;
|
|
5128
|
+
}
|
|
5129
|
+
|
|
5106
5130
|
// ../contract/src/tool-display.ts
|
|
5107
5131
|
var MAX_LABEL = 120;
|
|
5108
5132
|
function isRecord(value) {
|
|
@@ -5112,21 +5136,25 @@ function oneLine(text) {
|
|
|
5112
5136
|
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
5113
5137
|
return collapsed.length > MAX_LABEL ? `${collapsed.slice(0, MAX_LABEL - 1)}\u2026` : collapsed;
|
|
5114
5138
|
}
|
|
5115
|
-
|
|
5139
|
+
var label = (text) => text === void 0 ? void 0 : oneLine(text);
|
|
5140
|
+
function rawField(input, ...keys) {
|
|
5116
5141
|
if (!isRecord(input)) return void 0;
|
|
5117
5142
|
for (const key of keys) {
|
|
5118
5143
|
const value = input[key];
|
|
5119
|
-
if (typeof value === "string" && value.trim() !== "") return
|
|
5144
|
+
if (typeof value === "string" && value.trim() !== "") return value;
|
|
5120
5145
|
}
|
|
5121
5146
|
return void 0;
|
|
5122
5147
|
}
|
|
5123
|
-
function
|
|
5148
|
+
function field(input, ...keys) {
|
|
5149
|
+
return label(rawField(input, ...keys));
|
|
5150
|
+
}
|
|
5151
|
+
function rawCommand(input) {
|
|
5124
5152
|
if (!isRecord(input)) return void 0;
|
|
5125
5153
|
const command = input.command;
|
|
5126
|
-
if (typeof command === "string" && command.trim() !== "") return
|
|
5154
|
+
if (typeof command === "string" && command.trim() !== "") return command;
|
|
5127
5155
|
if (Array.isArray(command)) {
|
|
5128
5156
|
const argv = command.filter((part) => typeof part === "string");
|
|
5129
|
-
if (argv.length > 0) return
|
|
5157
|
+
if (argv.length > 0) return argv.join(" ");
|
|
5130
5158
|
}
|
|
5131
5159
|
return void 0;
|
|
5132
5160
|
}
|
|
@@ -5143,8 +5171,8 @@ function changePaths(input) {
|
|
|
5143
5171
|
function heuristicLabel(input) {
|
|
5144
5172
|
return field(input, "description", "query", "url", "filePath", "file_path", "path", "pattern", "name");
|
|
5145
5173
|
}
|
|
5146
|
-
function titled(verb,
|
|
5147
|
-
return
|
|
5174
|
+
function titled(verb, label2) {
|
|
5175
|
+
return label2 ? `${verb} ${label2}` : verb;
|
|
5148
5176
|
}
|
|
5149
5177
|
var TOOL_KINDS = /* @__PURE__ */ new Map([
|
|
5150
5178
|
["bash", "execute"],
|
|
@@ -5163,6 +5191,8 @@ var TOOL_KINDS = /* @__PURE__ */ new Map([
|
|
|
5163
5191
|
["task", "task"],
|
|
5164
5192
|
["agent", "task"],
|
|
5165
5193
|
["skill", "task"],
|
|
5194
|
+
["spawnagent", "task"],
|
|
5195
|
+
["subtask", "task"],
|
|
5166
5196
|
["todowrite", "plan"],
|
|
5167
5197
|
["todolist", "plan"],
|
|
5168
5198
|
["plan", "plan"],
|
|
@@ -5172,33 +5202,48 @@ var TOOL_KINDS = /* @__PURE__ */ new Map([
|
|
|
5172
5202
|
["contextcompaction", "other"],
|
|
5173
5203
|
["mcptoolcall", "other"]
|
|
5174
5204
|
]);
|
|
5175
|
-
function
|
|
5205
|
+
function editTarget(key, input) {
|
|
5176
5206
|
switch (key) {
|
|
5177
|
-
case "write":
|
|
5178
|
-
return { toolKind: "edit", title: titled("Write", field(input, "file_path", "filePath", "path")) };
|
|
5179
5207
|
case "notebookedit":
|
|
5180
|
-
return
|
|
5181
|
-
toolKind: "edit",
|
|
5182
|
-
title: titled("Edit", field(input, "notebook_path", "notebookPath", "file_path", "filePath", "path"))
|
|
5183
|
-
};
|
|
5208
|
+
return rawField(input, "notebook_path", "notebookPath", "file_path", "filePath", "path");
|
|
5184
5209
|
case "filechange": {
|
|
5185
5210
|
const paths = changePaths(input);
|
|
5186
|
-
|
|
5187
|
-
return { toolKind: "edit", title: titled("Edit", label) };
|
|
5211
|
+
return paths.length === 1 ? paths[0] : void 0;
|
|
5188
5212
|
}
|
|
5189
5213
|
default:
|
|
5190
|
-
return
|
|
5214
|
+
return rawField(input, "file_path", "filePath", "path");
|
|
5191
5215
|
}
|
|
5192
5216
|
}
|
|
5217
|
+
function editDisplay(key, input) {
|
|
5218
|
+
const verb = key === "write" ? "Write" : "Edit";
|
|
5219
|
+
if (key !== "filechange") return { toolKind: "edit", title: titled(verb, label(editTarget(key, input))) };
|
|
5220
|
+
const paths = changePaths(input);
|
|
5221
|
+
return { toolKind: "edit", title: titled(verb, paths.length > 1 ? `${paths.length} files` : paths[0]) };
|
|
5222
|
+
}
|
|
5223
|
+
function readTarget(key, input) {
|
|
5224
|
+
return key === "imageview" ? rawField(input, "path") : rawField(input, "file_path", "filePath", "path");
|
|
5225
|
+
}
|
|
5193
5226
|
function readDisplay(key, input) {
|
|
5194
|
-
return
|
|
5227
|
+
return { toolKind: "read", title: titled(key === "imageview" ? "View image" : "Read", label(readTarget(key, input))) };
|
|
5228
|
+
}
|
|
5229
|
+
function searchTarget(input) {
|
|
5230
|
+
return rawField(input, "pattern", "query");
|
|
5231
|
+
}
|
|
5232
|
+
function fetchTarget(key, input) {
|
|
5233
|
+
return key === "webfetch" ? rawField(input, "url") : rawField(input, "query");
|
|
5195
5234
|
}
|
|
5196
5235
|
function fetchDisplay(key, input) {
|
|
5197
|
-
return
|
|
5236
|
+
return { toolKind: "fetch", title: titled(key === "webfetch" ? "Fetch" : "Web search", label(fetchTarget(key, input))) };
|
|
5237
|
+
}
|
|
5238
|
+
var skillName = (input) => rawField(input, "skill", "name", "command");
|
|
5239
|
+
var subagentType = (input) => rawField(input, "subagent_type", "subagentType");
|
|
5240
|
+
function taskTarget(key, input) {
|
|
5241
|
+
if (key === "skill") return skillName(input);
|
|
5242
|
+
return rawField(input, "prompt", "task", "description") ?? subagentType(input);
|
|
5198
5243
|
}
|
|
5199
5244
|
function taskDisplay(key, input) {
|
|
5200
5245
|
if (key === "skill") {
|
|
5201
|
-
const skill =
|
|
5246
|
+
const skill = label(skillName(input));
|
|
5202
5247
|
return {
|
|
5203
5248
|
toolKind: "task",
|
|
5204
5249
|
title: skill ? `Skill: ${skill}` : "Skill",
|
|
@@ -5206,13 +5251,13 @@ function taskDisplay(key, input) {
|
|
|
5206
5251
|
};
|
|
5207
5252
|
}
|
|
5208
5253
|
const verb = key === "agent" ? "Agent" : "Task";
|
|
5209
|
-
const subagent =
|
|
5210
|
-
const
|
|
5254
|
+
const subagent = label(subagentType(input));
|
|
5255
|
+
const detail = field(input, "description", "prompt") ?? subagent;
|
|
5211
5256
|
return {
|
|
5212
5257
|
toolKind: "task",
|
|
5213
|
-
title:
|
|
5258
|
+
title: detail ? `${verb}: ${detail}` : verb,
|
|
5214
5259
|
// Don't repeat the subagent type when it is already the title.
|
|
5215
|
-
subtitle:
|
|
5260
|
+
subtitle: detail === subagent ? void 0 : subagent
|
|
5216
5261
|
};
|
|
5217
5262
|
}
|
|
5218
5263
|
function otherDisplay(name, key, input) {
|
|
@@ -5241,7 +5286,7 @@ function toolDisplay(name, input) {
|
|
|
5241
5286
|
case "execute":
|
|
5242
5287
|
return {
|
|
5243
5288
|
toolKind: "execute",
|
|
5244
|
-
title: titled("Ran",
|
|
5289
|
+
title: titled("Ran", label(rawCommand(input))),
|
|
5245
5290
|
subtitle: field(input, "description")
|
|
5246
5291
|
};
|
|
5247
5292
|
case "edit":
|
|
@@ -5251,7 +5296,7 @@ function toolDisplay(name, input) {
|
|
|
5251
5296
|
case "search":
|
|
5252
5297
|
return {
|
|
5253
5298
|
toolKind: "search",
|
|
5254
|
-
title: titled("Search",
|
|
5299
|
+
title: titled("Search", label(searchTarget(input))),
|
|
5255
5300
|
subtitle: field(input, "path")
|
|
5256
5301
|
};
|
|
5257
5302
|
case "fetch":
|
|
@@ -5264,6 +5309,25 @@ function toolDisplay(name, input) {
|
|
|
5264
5309
|
return otherDisplay(name, key, input);
|
|
5265
5310
|
}
|
|
5266
5311
|
}
|
|
5312
|
+
function toolDetailText(name, input) {
|
|
5313
|
+
const key = typeof name === "string" ? name.toLowerCase() : "";
|
|
5314
|
+
switch (TOOL_KINDS.get(key)) {
|
|
5315
|
+
case "execute":
|
|
5316
|
+
return rawCommand(input);
|
|
5317
|
+
case "edit":
|
|
5318
|
+
return editTarget(key, input);
|
|
5319
|
+
case "read":
|
|
5320
|
+
return readTarget(key, input);
|
|
5321
|
+
case "search":
|
|
5322
|
+
return searchTarget(input);
|
|
5323
|
+
case "fetch":
|
|
5324
|
+
return fetchTarget(key, input);
|
|
5325
|
+
case "task":
|
|
5326
|
+
return taskTarget(key, input);
|
|
5327
|
+
default:
|
|
5328
|
+
return void 0;
|
|
5329
|
+
}
|
|
5330
|
+
}
|
|
5267
5331
|
|
|
5268
5332
|
// ../contract/src/version.ts
|
|
5269
5333
|
function isNewerVersion(candidate, current) {
|
|
@@ -5305,7 +5369,7 @@ function imageMimeType(path) {
|
|
|
5305
5369
|
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
5306
5370
|
const dot = name.lastIndexOf(".");
|
|
5307
5371
|
if (dot <= 0) return null;
|
|
5308
|
-
return IMAGE_MIME
|
|
5372
|
+
return ownLookup(IMAGE_MIME, name.slice(dot + 1).toLowerCase()) ?? null;
|
|
5309
5373
|
}
|
|
5310
5374
|
var OS_OPENABLE_EXT = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "avif"]);
|
|
5311
5375
|
function isOsOpenableImage(path) {
|
|
@@ -6180,6 +6244,8 @@ export {
|
|
|
6180
6244
|
isUsageLimitHold,
|
|
6181
6245
|
isValidTimeZone,
|
|
6182
6246
|
isoWeekday,
|
|
6247
|
+
latestSession,
|
|
6248
|
+
latestSessionStep,
|
|
6183
6249
|
liveDemandSchema,
|
|
6184
6250
|
liveEntrySchema,
|
|
6185
6251
|
liveRunBatchResponseSchema,
|
|
@@ -6226,6 +6292,7 @@ export {
|
|
|
6226
6292
|
openTargetSchema,
|
|
6227
6293
|
openTargetsResponseSchema,
|
|
6228
6294
|
openWaitSchema,
|
|
6295
|
+
ownLookup,
|
|
6229
6296
|
ownerInputSchema,
|
|
6230
6297
|
ownerOutputSchema,
|
|
6231
6298
|
parentFileRefusal,
|
|
@@ -6445,6 +6512,7 @@ export {
|
|
|
6445
6512
|
timeZoneOffsetMs,
|
|
6446
6513
|
timerWaitEntrySchema,
|
|
6447
6514
|
toRunSummary,
|
|
6515
|
+
toolDetailText,
|
|
6448
6516
|
toolDisplay,
|
|
6449
6517
|
uiStateBody,
|
|
6450
6518
|
uiStateSchema,
|
|
@@ -6518,6 +6586,7 @@ export {
|
|
|
6518
6586
|
workerWorkspaceSchema,
|
|
6519
6587
|
workersAllowed,
|
|
6520
6588
|
workersWaitingLabel,
|
|
6589
|
+
workflowCursorSchema,
|
|
6521
6590
|
workflowDefSchema,
|
|
6522
6591
|
workflowFileSchema,
|
|
6523
6592
|
workflowLoadIssueSchema,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Look a wire string up in a plain-object table by own keys only. A plain index returns
|
|
3
|
+
* `Object.prototype` members for keys such as `toString`, `constructor` or `__proto__`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ownLookup<V>(table: Readonly<Record<string, V>>, key: unknown): V | undefined;
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import { type ArchiveFinishedScope, type RunRecord } from './runs.ts';
|
|
1
|
+
import { type ArchiveFinishedScope, type RunRecord, type StepState } from './runs.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Facts about a run that the store, the server, the engine and the cockpit all decide on, each
|
|
4
|
+
* defined once here so that no reader restates one in its own code (hearsay-tools/cezarion#1496).
|
|
5
|
+
* Each takes the record, never a bare status, so no caller can miss a usage-limit hold
|
|
6
|
+
* (hearsay-tools/cezarion#1434). `isUsageLimitHold` lives in `usage-limit-hold.ts`; `waits.ts` re-exports it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The step holding the run's latest agent session: of the steps with a session id, the one that
|
|
10
|
+
* started last. A Continue appends its synthetic step, so array order is not time order: a
|
|
11
|
+
* workflow step that ran after a continuation sits before it (hearsay-tools/squawk#3024). A step
|
|
12
|
+
* saved without a start time keeps its array position against its neighbours. `except` leaves out
|
|
13
|
+
* one step, such as the Continue's own.
|
|
14
|
+
*/
|
|
15
|
+
export declare function latestSessionStep<S extends Pick<StepState, 'id' | 'sessionId' | 'startedAt'>>(steps: readonly S[], except?: string): S | undefined;
|
|
16
|
+
/** The latest session's id, the runner that owns it and the account it was opened under. A step
|
|
17
|
+
* saved before backend affinity belongs to the run's runner, and a run with none to Claude. */
|
|
18
|
+
export declare function latestSession(run: {
|
|
19
|
+
steps: readonly Pick<StepState, 'id' | 'sessionId' | 'startedAt' | 'backend' | 'profileId'>[];
|
|
20
|
+
runner?: RunRecord['runner'];
|
|
21
|
+
}): {
|
|
22
|
+
sessionId: string | undefined;
|
|
23
|
+
backend: NonNullable<RunRecord['runner']>;
|
|
24
|
+
profileId: string | undefined;
|
|
25
|
+
};
|
|
2
26
|
/** Status-only live predicate: queued, running or waiting. */
|
|
3
27
|
export declare function isLiveStatus(status: string): boolean;
|
|
4
28
|
type OwnershipInput = Pick<RunRecord, 'status'> & Partial<Pick<RunRecord, 'autoResumeAt'>>;
|
package/dist/contract/runs.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export declare const stepStateSchema: z.ZodObject<{
|
|
|
106
106
|
profileId: z.ZodOptional<z.ZodString>;
|
|
107
107
|
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
108
108
|
synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
|
|
109
|
+
continuesStepId: z.ZodOptional<z.ZodString>;
|
|
109
110
|
}, z.core.$strip>;
|
|
110
111
|
export type StepState = z.infer<typeof stepStateSchema>;
|
|
111
112
|
/** Aggregate diff numbers of a run's worktree vs its base (#389). */
|
|
@@ -194,6 +195,15 @@ export declare const runPullRequestSchema: z.ZodObject<{
|
|
|
194
195
|
}>;
|
|
195
196
|
}, z.core.$strip>;
|
|
196
197
|
export type RunPullRequest = z.infer<typeof runPullRequestSchema>;
|
|
198
|
+
/** The workflow step a run goes on from, and how (ADR 0064). */
|
|
199
|
+
export declare const workflowCursorSchema: z.ZodObject<{
|
|
200
|
+
stepId: z.ZodString;
|
|
201
|
+
mode: z.ZodEnum<{
|
|
202
|
+
resume: "resume";
|
|
203
|
+
start: "start";
|
|
204
|
+
}>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
export type WorkflowCursor = z.infer<typeof workflowCursorSchema>;
|
|
197
207
|
export declare const runRecordSchema: z.ZodObject<{
|
|
198
208
|
archiveWhenDone: z.ZodOptional<z.ZodBoolean>;
|
|
199
209
|
autoMergePr: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -235,7 +245,13 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
235
245
|
restarted: z.ZodOptional<z.ZodLiteral<true>>;
|
|
236
246
|
}, z.core.$strip>>;
|
|
237
247
|
}, z.core.$strip>>;
|
|
238
|
-
|
|
248
|
+
workflowCursor: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
stepId: z.ZodString;
|
|
250
|
+
mode: z.ZodEnum<{
|
|
251
|
+
resume: "resume";
|
|
252
|
+
start: "start";
|
|
253
|
+
}>;
|
|
254
|
+
}, z.core.$strip>>;
|
|
239
255
|
invalidAsk: z.ZodOptional<z.ZodBoolean>;
|
|
240
256
|
delegation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
241
257
|
role: z.ZodLiteral<"root">;
|
|
@@ -2074,6 +2090,7 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
2074
2090
|
profileId: z.ZodOptional<z.ZodString>;
|
|
2075
2091
|
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
2076
2092
|
synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
|
|
2093
|
+
continuesStepId: z.ZodOptional<z.ZodString>;
|
|
2077
2094
|
}, z.core.$strip>>;
|
|
2078
2095
|
workflowDef: z.ZodOptional<z.ZodObject<{
|
|
2079
2096
|
name: z.ZodString;
|
|
@@ -2170,7 +2187,13 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
2170
2187
|
restarted: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2171
2188
|
}, z.core.$strip>>;
|
|
2172
2189
|
}, z.core.$strip>>;
|
|
2173
|
-
|
|
2190
|
+
workflowCursor: z.ZodOptional<z.ZodObject<{
|
|
2191
|
+
stepId: z.ZodString;
|
|
2192
|
+
mode: z.ZodEnum<{
|
|
2193
|
+
resume: "resume";
|
|
2194
|
+
start: "start";
|
|
2195
|
+
}>;
|
|
2196
|
+
}, z.core.$strip>>;
|
|
2174
2197
|
invalidAsk: z.ZodOptional<z.ZodBoolean>;
|
|
2175
2198
|
delegation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2176
2199
|
role: z.ZodLiteral<"root">;
|
|
@@ -4009,6 +4032,7 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
4009
4032
|
profileId: z.ZodOptional<z.ZodString>;
|
|
4010
4033
|
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
4011
4034
|
synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
|
|
4035
|
+
continuesStepId: z.ZodOptional<z.ZodString>;
|
|
4012
4036
|
}, z.core.$strip>>;
|
|
4013
4037
|
workflowDef: z.ZodOptional<z.ZodObject<{
|
|
4014
4038
|
name: z.ZodString;
|
|
@@ -4880,7 +4904,13 @@ export declare const createRunResponseSchema: z.ZodObject<{
|
|
|
4880
4904
|
restarted: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4881
4905
|
}, z.core.$strip>>;
|
|
4882
4906
|
}, z.core.$strip>>;
|
|
4883
|
-
|
|
4907
|
+
workflowCursor: z.ZodOptional<z.ZodObject<{
|
|
4908
|
+
stepId: z.ZodString;
|
|
4909
|
+
mode: z.ZodEnum<{
|
|
4910
|
+
resume: "resume";
|
|
4911
|
+
start: "start";
|
|
4912
|
+
}>;
|
|
4913
|
+
}, z.core.$strip>>;
|
|
4884
4914
|
invalidAsk: z.ZodOptional<z.ZodBoolean>;
|
|
4885
4915
|
delegation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4886
4916
|
role: z.ZodLiteral<"root">;
|
|
@@ -6719,6 +6749,7 @@ export declare const createRunResponseSchema: z.ZodObject<{
|
|
|
6719
6749
|
profileId: z.ZodOptional<z.ZodString>;
|
|
6720
6750
|
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
6721
6751
|
synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
|
|
6752
|
+
continuesStepId: z.ZodOptional<z.ZodString>;
|
|
6722
6753
|
}, z.core.$strip>>;
|
|
6723
6754
|
workflowDef: z.ZodOptional<z.ZodObject<{
|
|
6724
6755
|
name: z.ZodString;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* WebSearch, Task, Agent, Skill, TodoWrite, TaskCreate,
|
|
9
9
|
* TaskUpdate, TaskList, mcp__server__tool
|
|
10
10
|
* - codex: commandExecution, contextCompaction, fileChange, imageView,
|
|
11
|
-
* mcpToolCall, webSearch, plan
|
|
11
|
+
* mcpToolCall, webSearch, plan, spawnAgent (the mapper's subagent row)
|
|
12
12
|
* (codex's checklist arrives as the `turn/plan/updated`
|
|
13
13
|
* notification, not as a tool call — `todoList` is kept below only
|
|
14
14
|
* as tolerance for its non-app-server transports)
|
|
15
|
-
* - opencode: bash, edit, write, read, grep, glob, webfetch, task, todowrite
|
|
15
|
+
* - opencode: bash, edit, write, read, grep, glob, webfetch, task, subtask, todowrite
|
|
16
16
|
*/
|
|
17
17
|
export type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'task' | 'plan' | 'other';
|
|
18
18
|
export interface ToolDisplay {
|
|
@@ -23,3 +23,9 @@ export interface ToolDisplay {
|
|
|
23
23
|
subtitle?: string | undefined;
|
|
24
24
|
}
|
|
25
25
|
export declare function toolDisplay(name: string, input?: unknown): ToolDisplay;
|
|
26
|
+
/**
|
|
27
|
+
* The whole text a tool title's detail shortens, read with the same keys as `toolDisplay`: the
|
|
28
|
+
* command, path, pattern, URL or query, verbatim. An agent's is its full prompt, while its title
|
|
29
|
+
* keeps the description. `undefined` when the title has no detail from one input field.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toolDetailText(name: string, input?: unknown): string | undefined;
|
|
@@ -30,6 +30,11 @@ export declare class ClaudeCliRunner implements AgentRunner {
|
|
|
30
30
|
readonly specSupport: Readonly<Record<keyof AgentRunSpec, import("./agent-runner.ts").SpecFieldSupport>>;
|
|
31
31
|
readonly systemPromptOnResume: "resent";
|
|
32
32
|
readonly facts: {
|
|
33
|
+
readonly childWork: 'nested';
|
|
34
|
+
readonly hookEvents: 'reported';
|
|
35
|
+
readonly nativePermission: 'none';
|
|
36
|
+
readonly transport: 'stdio';
|
|
37
|
+
readonly humanPromptHold: 'none';
|
|
33
38
|
readonly inputDelivery: {
|
|
34
39
|
readonly mode: 'steer';
|
|
35
40
|
readonly consumption: 'observable';
|
|
@@ -44,6 +49,7 @@ export declare class ClaudeCliRunner implements AgentRunner {
|
|
|
44
49
|
readonly costReport: 'cumulative';
|
|
45
50
|
readonly sessionIdSource: 'launch';
|
|
46
51
|
readonly claudeModelAliases: true;
|
|
52
|
+
readonly turnStart: 'on-write';
|
|
47
53
|
};
|
|
48
54
|
readonly inputDelivery: InputDelivery;
|
|
49
55
|
private readonly bin;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed forked commands (hearsay-tools/squawk#1315). A typed `/name` command whose skill has
|
|
3
|
+
* `context: fork` runs a subagent with no spawn call: its `task_started` carries no tool_use_id
|
|
4
|
+
* and arrives before `init`, and its children name a synthetic parent, `forked-command-<name>`.
|
|
5
|
+
* The first child mints one root task item for the fork, so the fork's work nests under it in
|
|
6
|
+
* the same turn. The item stays running until the turn ends: Claude reports the task completed
|
|
7
|
+
* before its children run.
|
|
8
|
+
*/
|
|
9
|
+
import type { UiEvent, UiToolItem } from './ui-events.ts';
|
|
10
|
+
interface ForkedCommandStart {
|
|
11
|
+
readonly description?: string | undefined;
|
|
12
|
+
readonly subagentType?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** The slice of the Claude mapper state that tracks typed forked commands. */
|
|
15
|
+
export interface ForkedCommandState {
|
|
16
|
+
/** Claude's task id → the `task_started` of a typed forked command. Its children name the
|
|
17
|
+
* task in `agent_id`. Cleared when the turn ends. */
|
|
18
|
+
readonly forkedCommandStarts: ReadonlyMap<string, ForkedCommandStart>;
|
|
19
|
+
/** Typed forked commands open in this turn, keyed by the wire parent id their children carry. */
|
|
20
|
+
readonly openForkedCommands: ReadonlyMap<string, UiToolItem>;
|
|
21
|
+
/** Every fork item id minted in this session: a command typed again gets a fresh item id, so
|
|
22
|
+
* each fork nests in its own turn and never overwrites another fork's item. */
|
|
23
|
+
readonly forkedCommandIds: ReadonlySet<string>;
|
|
24
|
+
}
|
|
25
|
+
export declare function withForkedCommandStart<S extends ForkedCommandState>(msg: Record<string, unknown>, state: S): S;
|
|
26
|
+
/** The fork item's start, and the message re-parented under its item id, for a forked command's
|
|
27
|
+
* child; undefined for any other message. */
|
|
28
|
+
export declare function adoptForkedCommand<S extends ForkedCommandState>(msg: Record<string, unknown>, state: S): {
|
|
29
|
+
events: UiEvent[];
|
|
30
|
+
state: S;
|
|
31
|
+
msg: Record<string, unknown>;
|
|
32
|
+
} | undefined;
|
|
33
|
+
/** The turn's end settles every fork it opened: failed when the turn did not end normally
|
|
34
|
+
* (an error or the turn cap), else completed. */
|
|
35
|
+
export declare function completeForkedCommands(state: ForkedCommandState, turnFailed: boolean): UiEvent[];
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed forked commands (hearsay-tools/squawk#1315). A typed `/name` command whose skill has
|
|
3
|
+
* `context: fork` runs a subagent with no spawn call: its `task_started` carries no tool_use_id
|
|
4
|
+
* and arrives before `init`, and its children name a synthetic parent, `forked-command-<name>`.
|
|
5
|
+
* The first child mints one root task item for the fork, so the fork's work nests under it in
|
|
6
|
+
* the same turn. The item stays running until the turn ends: Claude reports the task completed
|
|
7
|
+
* before its children run.
|
|
8
|
+
*/
|
|
9
|
+
const FORKED_COMMAND_PREFIX = 'forked-command-';
|
|
10
|
+
export function withForkedCommandStart(msg, state) {
|
|
11
|
+
const taskId = str(msg.task_id);
|
|
12
|
+
if (taskId === undefined)
|
|
13
|
+
return state;
|
|
14
|
+
const start = { description: str(msg.description), subagentType: str(msg.subagent_type) };
|
|
15
|
+
return { ...state, forkedCommandStarts: new Map(state.forkedCommandStarts).set(taskId, start) };
|
|
16
|
+
}
|
|
17
|
+
/** The fork item's start, and the message re-parented under its item id, for a forked command's
|
|
18
|
+
* child; undefined for any other message. */
|
|
19
|
+
export function adoptForkedCommand(msg, state) {
|
|
20
|
+
const wireId = str(msg.parent_tool_use_id);
|
|
21
|
+
if (wireId === undefined || !wireId.startsWith(FORKED_COMMAND_PREFIX))
|
|
22
|
+
return undefined;
|
|
23
|
+
const open = state.openForkedCommands.get(wireId);
|
|
24
|
+
if (open)
|
|
25
|
+
return { events: [], state, msg: { ...msg, parent_tool_use_id: open.id } };
|
|
26
|
+
const item = startForkedCommandItem(wireId, state, str(msg.agent_id));
|
|
27
|
+
const next = {
|
|
28
|
+
...state,
|
|
29
|
+
openForkedCommands: new Map(state.openForkedCommands).set(wireId, item),
|
|
30
|
+
forkedCommandIds: new Set(state.forkedCommandIds).add(item.id),
|
|
31
|
+
};
|
|
32
|
+
return { events: [{ type: 'item.started', item }], state: next, msg: { ...msg, parent_tool_use_id: item.id } };
|
|
33
|
+
}
|
|
34
|
+
/** The wire id, or the first free `<wire id>-<n>`: a suffixed id can equal another command's
|
|
35
|
+
* wire id (`/review` typed twice, then `/review-2`), so every minted id is checked. */
|
|
36
|
+
function freeForkItemId(wireId, minted) {
|
|
37
|
+
let id = wireId;
|
|
38
|
+
for (let n = 2; minted.has(id); n += 1)
|
|
39
|
+
id = `${wireId}-${n}`;
|
|
40
|
+
return id;
|
|
41
|
+
}
|
|
42
|
+
function startForkedCommandItem(wireId, state, taskId) {
|
|
43
|
+
const start = taskId === undefined ? undefined : state.forkedCommandStarts.get(taskId);
|
|
44
|
+
const item = {
|
|
45
|
+
kind: 'tool',
|
|
46
|
+
id: freeForkItemId(wireId, state.forkedCommandIds),
|
|
47
|
+
name: 'Skill',
|
|
48
|
+
toolKind: 'task',
|
|
49
|
+
title: start?.description ?? `/${wireId.slice(FORKED_COMMAND_PREFIX.length)}`,
|
|
50
|
+
status: 'running',
|
|
51
|
+
};
|
|
52
|
+
if (start?.subagentType !== undefined)
|
|
53
|
+
item.input = { subagent_type: start.subagentType };
|
|
54
|
+
return item;
|
|
55
|
+
}
|
|
56
|
+
/** The turn's end settles every fork it opened: failed when the turn did not end normally
|
|
57
|
+
* (an error or the turn cap), else completed. */
|
|
58
|
+
export function completeForkedCommands(state, turnFailed) {
|
|
59
|
+
const status = turnFailed ? 'failed' : 'completed';
|
|
60
|
+
return [...state.openForkedCommands.values()].map((open) => ({ type: 'item.completed', item: { ...open, status } }));
|
|
61
|
+
}
|
|
62
|
+
function str(value) {
|
|
63
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=claude-forked-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-forked-command.js","sourceRoot":"","sources":["../../src/core/claude-forked-command.ts"],"names":[],"mappings":"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"}
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
* the two id spaces then drift silently — updates land on the wrong row.
|
|
25
25
|
*/
|
|
26
26
|
import type { PlanEntry, PlanStatus, UiEvent, UiToolItem } from './ui-events.ts';
|
|
27
|
-
|
|
27
|
+
import { type ForkedCommandState } from './claude-forked-command.ts';
|
|
28
|
+
export interface ClaudeUiMapperState extends ForkedCommandState {
|
|
28
29
|
/** Used when `system/init` lacks `session_id` (the dry-run mock does). */
|
|
29
30
|
readonly fallbackSessionId?: string | undefined;
|
|
30
31
|
/** True once `system/init` produced `session.started`. */
|