@hearsay-tools/squawk 0.18.0-pr3680.6685 → 0.18.0-pr3682.6688
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/contract/index.js +26 -65
- package/dist/contract/tool-display.d.ts +0 -6
- package/dist/delegation/routes.d.ts +15 -15
- package/dist/delegation/transport.d.ts +9 -9
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/workflows/run/auto-resume.d.ts +7 -6
- package/dist/workflows/run/auto-resume.js +16 -25
- 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 +10 -8
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +2 -0
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/family-reconciler.d.ts +4 -3
- package/dist/workflows/run/family-reconciler.js +9 -17
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/inbox-claims.d.ts +3 -2
- package/dist/workflows/run/inbox-claims.js +7 -15
- package/dist/workflows/run/inbox-claims.js.map +1 -1
- package/dist/workflows/run/input-delivery.d.ts +3 -1
- package/dist/workflows/run/input-delivery.js +14 -15
- 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/liveness-timers.d.ts +93 -0
- package/dist/workflows/run/liveness-timers.js +105 -0
- package/dist/workflows/run/liveness-timers.js.map +1 -0
- package/dist/workflows/run/squawk-tools.js +2 -0
- package/dist/workflows/run/squawk-tools.js.map +1 -1
- package/dist/workflows/run/subagent-waits.d.ts +3 -5
- package/dist/workflows/run/subagent-waits.js +13 -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 +3 -1
- package/dist/workflows/run/turn-settler.js +7 -4
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wake-retries.d.ts +5 -5
- package/dist/workflows/run/wake-retries.js +17 -40
- 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.js +12 -1
- package/dist/workflows/run.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{activity-motion-Byq2bDAP.js → activity-motion-DhLXb8Pt.js} +1 -1
- package/web/dist/assets/{activity-route-DOVoEYeM.js → activity-route-CpwAMYLn.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-yvYPlSYE.js → commit-diff-panel-B1KZl0GP.js} +1 -1
- package/web/dist/assets/{diff-C2RMO15Q.js → diff-Ci-qd1lU.js} +2 -2
- package/web/dist/assets/{diff-view-CWbKHh1G.js → diff-view-CWZElKoD.js} +1 -1
- package/web/dist/assets/{file-preview-COkhULYq.js → file-preview-CoWRr13R.js} +1 -1
- package/web/dist/assets/{git-toolbar-CwQJBEEW.js → git-toolbar-BYIni94R.js} +1 -1
- package/web/dist/assets/{github-BVPoqQAS.js → github-CAPNq5vY.js} +1 -1
- package/web/dist/assets/{global-activity-route-BpmNpL7x.js → global-activity-route-DLEwsMA7.js} +1 -1
- package/web/dist/assets/{index-CVQiayw3.js → index-CpwAOct4.js} +3 -3
- package/web/dist/assets/{preview-pane-connected-BRMFnhek.js → preview-pane-connected-CGw_9VuF.js} +3 -3
- package/web/dist/assets/{repo-git-hpNy_S7P.js → repo-git-CzVLCWig.js} +1 -1
- package/web/dist/assets/{report-reader-DzBXed85.js → report-reader-iTBkUgg-.js} +1 -1
- package/web/dist/assets/{reports-D-P-amFb.js → reports-BJF1Cl3C.js} +1 -1
- package/web/dist/assets/{run-header-BsbnNWOf.js → run-header-BxB6gyt1.js} +1 -1
- package/web/dist/assets/{skills-BvttcdLw.js → skills-DvgHKWgK.js} +1 -1
- package/web/dist/assets/{task-changes-DEf1qM--.js → task-changes-CStxhLFG.js} +1 -1
- package/web/dist/assets/{task-commits-C_-FaEmc.js → task-commits-DhpOAdOf.js} +1 -1
- package/web/dist/assets/{task-files-DwAygCy9.js → task-files-COmKUUfN.js} +1 -1
- package/web/dist/assets/{task-github-item-BGhSRb2J.js → task-github-item-BNLeAz58.js} +1 -1
- package/web/dist/assets/task-thread-DjSFvEQe.js +9 -0
- package/web/dist/assets/thread-state-B5tTsVNm.js +4 -0
- package/web/dist/assets/{use-hand-to-agent-state-mMDD8ivJ.js → use-hand-to-agent-state-Ce6QW2j_.js} +1 -1
- package/web/dist/assets/{workflows-CPUpq7AS.js → workflows-CN8uKYnY.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/task-thread-DdOVn3Nn.js +0 -9
- package/web/dist/assets/thread-state-BssWp9kC.js +0 -4
package/dist/contract/index.js
CHANGED
|
@@ -5050,25 +5050,21 @@ function oneLine(text) {
|
|
|
5050
5050
|
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
5051
5051
|
return collapsed.length > MAX_LABEL ? `${collapsed.slice(0, MAX_LABEL - 1)}\u2026` : collapsed;
|
|
5052
5052
|
}
|
|
5053
|
-
|
|
5054
|
-
function rawField(input, ...keys) {
|
|
5053
|
+
function field(input, ...keys) {
|
|
5055
5054
|
if (!isRecord(input)) return void 0;
|
|
5056
5055
|
for (const key of keys) {
|
|
5057
5056
|
const value = input[key];
|
|
5058
|
-
if (typeof value === "string" && value.trim() !== "") return value;
|
|
5057
|
+
if (typeof value === "string" && value.trim() !== "") return oneLine(value);
|
|
5059
5058
|
}
|
|
5060
5059
|
return void 0;
|
|
5061
5060
|
}
|
|
5062
|
-
function
|
|
5063
|
-
return label(rawField(input, ...keys));
|
|
5064
|
-
}
|
|
5065
|
-
function rawCommand(input) {
|
|
5061
|
+
function commandText(input) {
|
|
5066
5062
|
if (!isRecord(input)) return void 0;
|
|
5067
5063
|
const command = input.command;
|
|
5068
|
-
if (typeof command === "string" && command.trim() !== "") return command;
|
|
5064
|
+
if (typeof command === "string" && command.trim() !== "") return oneLine(command);
|
|
5069
5065
|
if (Array.isArray(command)) {
|
|
5070
5066
|
const argv = command.filter((part) => typeof part === "string");
|
|
5071
|
-
if (argv.length > 0) return argv.join(" ");
|
|
5067
|
+
if (argv.length > 0) return oneLine(argv.join(" "));
|
|
5072
5068
|
}
|
|
5073
5069
|
return void 0;
|
|
5074
5070
|
}
|
|
@@ -5085,8 +5081,8 @@ function changePaths(input) {
|
|
|
5085
5081
|
function heuristicLabel(input) {
|
|
5086
5082
|
return field(input, "description", "query", "url", "filePath", "file_path", "path", "pattern", "name");
|
|
5087
5083
|
}
|
|
5088
|
-
function titled(verb,
|
|
5089
|
-
return
|
|
5084
|
+
function titled(verb, label) {
|
|
5085
|
+
return label ? `${verb} ${label}` : verb;
|
|
5090
5086
|
}
|
|
5091
5087
|
var TOOL_KINDS = /* @__PURE__ */ new Map([
|
|
5092
5088
|
["bash", "execute"],
|
|
@@ -5114,48 +5110,33 @@ var TOOL_KINDS = /* @__PURE__ */ new Map([
|
|
|
5114
5110
|
["contextcompaction", "other"],
|
|
5115
5111
|
["mcptoolcall", "other"]
|
|
5116
5112
|
]);
|
|
5117
|
-
function
|
|
5113
|
+
function editDisplay(key, input) {
|
|
5118
5114
|
switch (key) {
|
|
5115
|
+
case "write":
|
|
5116
|
+
return { toolKind: "edit", title: titled("Write", field(input, "file_path", "filePath", "path")) };
|
|
5119
5117
|
case "notebookedit":
|
|
5120
|
-
return
|
|
5118
|
+
return {
|
|
5119
|
+
toolKind: "edit",
|
|
5120
|
+
title: titled("Edit", field(input, "notebook_path", "notebookPath", "file_path", "filePath", "path"))
|
|
5121
|
+
};
|
|
5121
5122
|
case "filechange": {
|
|
5122
5123
|
const paths = changePaths(input);
|
|
5123
|
-
|
|
5124
|
+
const label = paths.length === 1 ? paths[0] : paths.length > 1 ? `${paths.length} files` : void 0;
|
|
5125
|
+
return { toolKind: "edit", title: titled("Edit", label) };
|
|
5124
5126
|
}
|
|
5125
5127
|
default:
|
|
5126
|
-
return
|
|
5128
|
+
return { toolKind: "edit", title: titled("Edit", field(input, "file_path", "filePath", "path")) };
|
|
5127
5129
|
}
|
|
5128
5130
|
}
|
|
5129
|
-
function editDisplay(key, input) {
|
|
5130
|
-
const verb = key === "write" ? "Write" : "Edit";
|
|
5131
|
-
if (key !== "filechange") return { toolKind: "edit", title: titled(verb, label(editTarget(key, input))) };
|
|
5132
|
-
const paths = changePaths(input);
|
|
5133
|
-
return { toolKind: "edit", title: titled(verb, paths.length > 1 ? `${paths.length} files` : paths[0]) };
|
|
5134
|
-
}
|
|
5135
|
-
function readTarget(key, input) {
|
|
5136
|
-
return key === "imageview" ? rawField(input, "path") : rawField(input, "file_path", "filePath", "path");
|
|
5137
|
-
}
|
|
5138
5131
|
function readDisplay(key, input) {
|
|
5139
|
-
return { toolKind: "read", title: titled(
|
|
5140
|
-
}
|
|
5141
|
-
function searchTarget(input) {
|
|
5142
|
-
return rawField(input, "pattern", "query");
|
|
5143
|
-
}
|
|
5144
|
-
function fetchTarget(key, input) {
|
|
5145
|
-
return key === "webfetch" ? rawField(input, "url") : rawField(input, "query");
|
|
5132
|
+
return key === "imageview" ? { toolKind: "read", title: titled("View image", field(input, "path")) } : { toolKind: "read", title: titled("Read", field(input, "file_path", "filePath", "path")) };
|
|
5146
5133
|
}
|
|
5147
5134
|
function fetchDisplay(key, input) {
|
|
5148
|
-
return { toolKind: "fetch", title: titled(
|
|
5149
|
-
}
|
|
5150
|
-
var skillName = (input) => rawField(input, "skill", "name", "command");
|
|
5151
|
-
var subagentType = (input) => rawField(input, "subagent_type", "subagentType");
|
|
5152
|
-
function taskTarget(key, input) {
|
|
5153
|
-
if (key === "skill") return skillName(input);
|
|
5154
|
-
return rawField(input, "prompt", "description") ?? subagentType(input);
|
|
5135
|
+
return key === "webfetch" ? { toolKind: "fetch", title: titled("Fetch", field(input, "url")) } : { toolKind: "fetch", title: titled("Web search", field(input, "query")) };
|
|
5155
5136
|
}
|
|
5156
5137
|
function taskDisplay(key, input) {
|
|
5157
5138
|
if (key === "skill") {
|
|
5158
|
-
const skill =
|
|
5139
|
+
const skill = field(input, "skill", "name", "command");
|
|
5159
5140
|
return {
|
|
5160
5141
|
toolKind: "task",
|
|
5161
5142
|
title: skill ? `Skill: ${skill}` : "Skill",
|
|
@@ -5163,13 +5144,13 @@ function taskDisplay(key, input) {
|
|
|
5163
5144
|
};
|
|
5164
5145
|
}
|
|
5165
5146
|
const verb = key === "agent" ? "Agent" : "Task";
|
|
5166
|
-
const subagent =
|
|
5167
|
-
const
|
|
5147
|
+
const subagent = field(input, "subagent_type", "subagentType");
|
|
5148
|
+
const label = field(input, "description", "prompt") ?? subagent;
|
|
5168
5149
|
return {
|
|
5169
5150
|
toolKind: "task",
|
|
5170
|
-
title:
|
|
5151
|
+
title: label ? `${verb}: ${label}` : verb,
|
|
5171
5152
|
// Don't repeat the subagent type when it is already the title.
|
|
5172
|
-
subtitle:
|
|
5153
|
+
subtitle: label === subagent ? void 0 : subagent
|
|
5173
5154
|
};
|
|
5174
5155
|
}
|
|
5175
5156
|
function otherDisplay(name, key, input) {
|
|
@@ -5198,7 +5179,7 @@ function toolDisplay(name, input) {
|
|
|
5198
5179
|
case "execute":
|
|
5199
5180
|
return {
|
|
5200
5181
|
toolKind: "execute",
|
|
5201
|
-
title: titled("Ran",
|
|
5182
|
+
title: titled("Ran", commandText(input)),
|
|
5202
5183
|
subtitle: field(input, "description")
|
|
5203
5184
|
};
|
|
5204
5185
|
case "edit":
|
|
@@ -5208,7 +5189,7 @@ function toolDisplay(name, input) {
|
|
|
5208
5189
|
case "search":
|
|
5209
5190
|
return {
|
|
5210
5191
|
toolKind: "search",
|
|
5211
|
-
title: titled("Search",
|
|
5192
|
+
title: titled("Search", field(input, "pattern", "query")),
|
|
5212
5193
|
subtitle: field(input, "path")
|
|
5213
5194
|
};
|
|
5214
5195
|
case "fetch":
|
|
@@ -5221,25 +5202,6 @@ function toolDisplay(name, input) {
|
|
|
5221
5202
|
return otherDisplay(name, key, input);
|
|
5222
5203
|
}
|
|
5223
5204
|
}
|
|
5224
|
-
function toolDetailText(name, input) {
|
|
5225
|
-
const key = typeof name === "string" ? name.toLowerCase() : "";
|
|
5226
|
-
switch (TOOL_KINDS.get(key)) {
|
|
5227
|
-
case "execute":
|
|
5228
|
-
return rawCommand(input);
|
|
5229
|
-
case "edit":
|
|
5230
|
-
return editTarget(key, input);
|
|
5231
|
-
case "read":
|
|
5232
|
-
return readTarget(key, input);
|
|
5233
|
-
case "search":
|
|
5234
|
-
return searchTarget(input);
|
|
5235
|
-
case "fetch":
|
|
5236
|
-
return fetchTarget(key, input);
|
|
5237
|
-
case "task":
|
|
5238
|
-
return taskTarget(key, input);
|
|
5239
|
-
default:
|
|
5240
|
-
return void 0;
|
|
5241
|
-
}
|
|
5242
|
-
}
|
|
5243
5205
|
|
|
5244
5206
|
// ../contract/src/version.ts
|
|
5245
5207
|
function isNewerVersion(candidate, current) {
|
|
@@ -6417,7 +6379,6 @@ export {
|
|
|
6417
6379
|
timeZoneOffsetMs,
|
|
6418
6380
|
timerWaitEntrySchema,
|
|
6419
6381
|
toRunSummary,
|
|
6420
|
-
toolDetailText,
|
|
6421
6382
|
toolDisplay,
|
|
6422
6383
|
uiStateBody,
|
|
6423
6384
|
uiStateSchema,
|
|
@@ -23,9 +23,3 @@ 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;
|
|
@@ -90,6 +90,17 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
90
90
|
authFailureId?: string | undefined;
|
|
91
91
|
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
92
92
|
}[];
|
|
93
|
+
} | {
|
|
94
|
+
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
95
|
+
models: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
description: string;
|
|
99
|
+
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
100
|
+
}[];
|
|
101
|
+
source: "cache" | "live" | "unavailable";
|
|
102
|
+
stale: boolean;
|
|
103
|
+
reason?: string | undefined;
|
|
93
104
|
} | {
|
|
94
105
|
tasks: {
|
|
95
106
|
id: string;
|
|
@@ -102,17 +113,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
102
113
|
reason?: string | undefined;
|
|
103
114
|
}[];
|
|
104
115
|
nextOffset?: number | undefined;
|
|
105
|
-
} | {
|
|
106
|
-
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
107
|
-
models: {
|
|
108
|
-
id: string;
|
|
109
|
-
label: string;
|
|
110
|
-
description: string;
|
|
111
|
-
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
112
|
-
}[];
|
|
113
|
-
source: "cache" | "live" | "unavailable";
|
|
114
|
-
stale: boolean;
|
|
115
|
-
reason?: string | undefined;
|
|
116
116
|
};
|
|
117
117
|
outputFormat: "json";
|
|
118
118
|
status: 200;
|
|
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
221
221
|
status: 200;
|
|
222
222
|
input: {
|
|
223
223
|
json: {
|
|
224
|
-
requestIds: string[];
|
|
225
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
226
|
-
timeoutSeconds?: number | undefined;
|
|
227
|
-
} | {
|
|
228
224
|
workerIds: string[];
|
|
229
225
|
timeoutSeconds?: number | undefined;
|
|
230
226
|
mode?: "all" | "any" | "one" | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
requestIds: string[];
|
|
229
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
230
|
+
timeoutSeconds?: number | undefined;
|
|
231
231
|
} | {
|
|
232
232
|
peerIds: string[];
|
|
233
233
|
timeoutSeconds?: number | undefined;
|
|
@@ -57,15 +57,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
57
57
|
"/discover": {
|
|
58
58
|
$post: {
|
|
59
59
|
output: {
|
|
60
|
-
scope: "host-default-account";
|
|
61
|
-
runners: {
|
|
62
|
-
status: "connected" | "disconnected" | "not-installed" | "unknown";
|
|
63
|
-
enabled?: boolean | undefined;
|
|
64
|
-
hint?: string | undefined;
|
|
65
|
-
authFailureId?: string | undefined;
|
|
66
|
-
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
67
|
-
}[];
|
|
68
|
-
} | {
|
|
69
60
|
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
70
61
|
models: {
|
|
71
62
|
id: string;
|
|
@@ -88,6 +79,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
88
79
|
reason?: string | undefined;
|
|
89
80
|
}[];
|
|
90
81
|
nextOffset?: number | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
scope: "host-default-account";
|
|
84
|
+
runners: {
|
|
85
|
+
status: "connected" | "disconnected" | "not-installed" | "unknown";
|
|
86
|
+
enabled?: boolean | undefined;
|
|
87
|
+
hint?: string | undefined;
|
|
88
|
+
authFailureId?: string | undefined;
|
|
89
|
+
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
90
|
+
}[];
|
|
91
91
|
};
|
|
92
92
|
outputFormat: "json";
|
|
93
93
|
status: 200;
|
|
@@ -16,6 +16,12 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
|
|
|
16
16
|
output: {
|
|
17
17
|
generation: string;
|
|
18
18
|
results: ({
|
|
19
|
+
projectId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
type: "error" | "reset";
|
|
22
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
23
|
+
error: string;
|
|
24
|
+
} | {
|
|
19
25
|
projectId: string;
|
|
20
26
|
runId: string;
|
|
21
27
|
type: "batch";
|
|
@@ -29,12 +35,6 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
|
|
|
29
35
|
cursor: string;
|
|
30
36
|
afterSeq: number;
|
|
31
37
|
hasMore: boolean;
|
|
32
|
-
} | {
|
|
33
|
-
projectId: string;
|
|
34
|
-
runId: string;
|
|
35
|
-
type: "error" | "reset";
|
|
36
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
37
|
-
error: string;
|
|
38
38
|
})[];
|
|
39
39
|
};
|
|
40
40
|
outputFormat: "json";
|
|
@@ -7,12 +7,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
7
7
|
output: {
|
|
8
8
|
generation: string;
|
|
9
9
|
results: ({
|
|
10
|
-
projectId: string;
|
|
11
|
-
runId: string;
|
|
12
|
-
type: "error" | "reset";
|
|
13
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
14
|
-
error: string;
|
|
15
|
-
} | {
|
|
16
10
|
projectId: string;
|
|
17
11
|
runId: string;
|
|
18
12
|
type: "batch";
|
|
@@ -26,6 +20,12 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
26
20
|
cursor: string;
|
|
27
21
|
afterSeq: number;
|
|
28
22
|
hasMore: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
projectId: string;
|
|
25
|
+
runId: string;
|
|
26
|
+
type: "error" | "reset";
|
|
27
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
28
|
+
error: string;
|
|
29
29
|
})[];
|
|
30
30
|
};
|
|
31
31
|
outputFormat: "json";
|
|
@@ -2,6 +2,7 @@ import type { RunRecord, RunStore } from '../../runs/store.ts';
|
|
|
2
2
|
import type { ContinueRunOptions } from '../continuation-admission.ts';
|
|
3
3
|
import type { RunExitId } from '../../runs/run-exits.ts';
|
|
4
4
|
import type { RunModuleContext } from './types.ts';
|
|
5
|
+
import { LivenessTimers } from './liveness-timers.ts';
|
|
5
6
|
interface AutoResumeHost {
|
|
6
7
|
move(runId: string, exit: RunExitId, patch: Omit<Parameters<RunStore['updateRun']>[1], 'status'>): RunRecord | undefined;
|
|
7
8
|
continueRun(runId: string, opts: ContinueRunOptions, deferForCapacity: boolean): {
|
|
@@ -48,13 +49,13 @@ export type HoldPlan = {
|
|
|
48
49
|
export declare class AutoResumeScheduler {
|
|
49
50
|
private readonly context;
|
|
50
51
|
private readonly host;
|
|
51
|
-
|
|
52
|
+
private readonly timers;
|
|
53
|
+
/** Armed resumes are `auto-resume` bounds, keyed by run id (spec
|
|
52
54
|
* 2026-08-03-auto-resume-after-usage-limit). The DEADLINE itself lives on the record
|
|
53
|
-
* (`autoResumeAt`) —
|
|
54
|
-
* from the record rather than losing the wait. Runs here are `
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
constructor(context: RunModuleContext, host: AutoResumeHost);
|
|
55
|
+
* (`autoResumeAt`) — the owner holds only the process-local timer, so a restart rebuilds it
|
|
56
|
+
* from the record rather than losing the wait. Runs here are not in `active`, which is why the
|
|
57
|
+
* bound has run scope, not execution scope like the monitoring one. */
|
|
58
|
+
constructor(context: RunModuleContext, host: AutoResumeHost, timers?: LivenessTimers);
|
|
58
59
|
dispose(): void;
|
|
59
60
|
/**
|
|
60
61
|
* The hold a failing run takes instead of `failed` (hearsay-tools/squawk#3337), or undefined when
|
|
@@ -3,6 +3,7 @@ import { parseUsageLimit } from '../../core/usage-limit.js';
|
|
|
3
3
|
import { classifyProviderError, PROVIDER_ERROR_LABELS } from '../../core/provider-error.js';
|
|
4
4
|
import { noJitter, PROVIDER_RETRY_BACKOFF, retryDelayMs } from '../../delegation/retry-backoff.js';
|
|
5
5
|
import { formatWakeInstant } from '../run-scheduling.js';
|
|
6
|
+
import { LivenessTimers } from './liveness-timers.js';
|
|
6
7
|
import { atContinue } from './launch-read-resolver.js';
|
|
7
8
|
import { productName } from '../../home/display.js';
|
|
8
9
|
/**
|
|
@@ -47,20 +48,19 @@ export function retryPrompt(run) {
|
|
|
47
48
|
export class AutoResumeScheduler {
|
|
48
49
|
context;
|
|
49
50
|
host;
|
|
50
|
-
|
|
51
|
+
timers;
|
|
52
|
+
/** Armed resumes are `auto-resume` bounds, keyed by run id (spec
|
|
51
53
|
* 2026-08-03-auto-resume-after-usage-limit). The DEADLINE itself lives on the record
|
|
52
|
-
* (`autoResumeAt`) —
|
|
53
|
-
* from the record rather than losing the wait. Runs here are `
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
constructor(context, host) {
|
|
54
|
+
* (`autoResumeAt`) — the owner holds only the process-local timer, so a restart rebuilds it
|
|
55
|
+
* from the record rather than losing the wait. Runs here are not in `active`, which is why the
|
|
56
|
+
* bound has run scope, not execution scope like the monitoring one. */
|
|
57
|
+
constructor(context, host, timers = new LivenessTimers()) {
|
|
57
58
|
this.context = context;
|
|
58
59
|
this.host = host;
|
|
60
|
+
this.timers = timers;
|
|
59
61
|
}
|
|
60
62
|
dispose() {
|
|
61
|
-
|
|
62
|
-
clearTimeout(timer);
|
|
63
|
-
this.autoResumeTimers.clear();
|
|
63
|
+
this.timers.clearKind('auto-resume');
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* The hold a failing run takes instead of `failed` (hearsay-tools/squawk#3337), or undefined when
|
|
@@ -118,7 +118,7 @@ export class AutoResumeScheduler {
|
|
|
118
118
|
}
|
|
119
119
|
/** Arm the timer of a hold the settlement wrote. Runs before the slot is released (see the caller). */
|
|
120
120
|
armHeldResume(runId) {
|
|
121
|
-
if (this.
|
|
121
|
+
if (this.timers.has('auto-resume', runId))
|
|
122
122
|
return;
|
|
123
123
|
const run = this.context.store.getRun(runId);
|
|
124
124
|
if (!run || !isUsageLimitHold(run))
|
|
@@ -131,9 +131,7 @@ export class AutoResumeScheduler {
|
|
|
131
131
|
* run waits for it (hearsay-tools/cezarion#1236): `waiting`, its error kept for a withdrawal. */
|
|
132
132
|
armAutoResume(runId, deadline, reason) {
|
|
133
133
|
this.host.move(runId, 'hold', { autoResumeAt: new Date(deadline).toISOString(), ...(reason ? { autoResumeReason: reason } : {}) });
|
|
134
|
-
|
|
135
|
-
timer.unref?.();
|
|
136
|
-
this.autoResumeTimers.set(runId, timer);
|
|
134
|
+
this.timers.arm({ kind: 'auto-resume', runId, delayMs: Math.max(0, deadline - Date.now()) }, () => this.fireAutoResume(runId));
|
|
137
135
|
}
|
|
138
136
|
/**
|
|
139
137
|
* The window has reopened. Re-check the record synchronously — hours may have passed, and the
|
|
@@ -141,7 +139,6 @@ export class AutoResumeScheduler {
|
|
|
141
139
|
* ordinary queued-continuation path so it obeys both concurrency caps like any other work.
|
|
142
140
|
*/
|
|
143
141
|
fireAutoResume(runId) {
|
|
144
|
-
this.autoResumeTimers.delete(runId);
|
|
145
142
|
const run = this.context.store.getRun(runId);
|
|
146
143
|
if (!run || !isUsageLimitHold(run))
|
|
147
144
|
return;
|
|
@@ -196,7 +193,7 @@ export class AutoResumeScheduler {
|
|
|
196
193
|
// ones too, so this one loop is the whole cancellation. It reads any resume time, not
|
|
197
194
|
// `isUsageLimitHold`, so a stale one is retired too.
|
|
198
195
|
const pending = new Set([
|
|
199
|
-
...this.
|
|
196
|
+
...this.timers.runsOf('auto-resume'),
|
|
200
197
|
...this.context.store.listRuns().filter((run) => run.autoResumeAt !== undefined).map((run) => run.id),
|
|
201
198
|
]);
|
|
202
199
|
for (const runId of pending)
|
|
@@ -206,7 +203,7 @@ export class AutoResumeScheduler {
|
|
|
206
203
|
for (const run of this.context.store.listRuns()) {
|
|
207
204
|
if (!isUsageLimitHold(run))
|
|
208
205
|
continue;
|
|
209
|
-
if (this.
|
|
206
|
+
if (this.timers.has('auto-resume', run.id))
|
|
210
207
|
continue;
|
|
211
208
|
const deadline = Date.parse(run.autoResumeAt);
|
|
212
209
|
// A deadline that is unreadable, belongs to a run that has spent its cap, or belongs to a
|
|
@@ -241,7 +238,7 @@ export class AutoResumeScheduler {
|
|
|
241
238
|
if (!run)
|
|
242
239
|
return false;
|
|
243
240
|
// Any resume time, not `isUsageLimitHold`: a withdrawal also retires one a record kept by mistake.
|
|
244
|
-
const pending = run.autoResumeAt !== undefined || this.
|
|
241
|
+
const pending = run.autoResumeAt !== undefined || this.timers.has('auto-resume', runId);
|
|
245
242
|
this.withdrawAutoResume(runId, pending ? 'automatic resume cancelled for this task' : undefined);
|
|
246
243
|
if (pending) {
|
|
247
244
|
// This run may have been the last thing holding its account's queue — nothing else will
|
|
@@ -253,10 +250,7 @@ export class AutoResumeScheduler {
|
|
|
253
250
|
/** Retire a pending resume — timer, deadline and counter. The counter goes too because every
|
|
254
251
|
* caller is a fresh epoch: a human Continue, or a resume that re-stamps its own count. */
|
|
255
252
|
clearAutoResume(runId) {
|
|
256
|
-
|
|
257
|
-
if (timer)
|
|
258
|
-
clearTimeout(timer);
|
|
259
|
-
this.autoResumeTimers.delete(runId);
|
|
253
|
+
this.timers.clear('auto-resume', runId);
|
|
260
254
|
const run = this.context.store.getRun(runId);
|
|
261
255
|
if (!run)
|
|
262
256
|
return;
|
|
@@ -285,10 +279,7 @@ export class AutoResumeScheduler {
|
|
|
285
279
|
// note is written only once the withdrawal is on disk (hearsay-tools/cezarion#1236).
|
|
286
280
|
if (this.context.store.getRun(runId))
|
|
287
281
|
this.context.store.commitAutoResumeWithdrawal(runId);
|
|
288
|
-
|
|
289
|
-
if (timer)
|
|
290
|
-
clearTimeout(timer);
|
|
291
|
-
this.autoResumeTimers.delete(runId);
|
|
282
|
+
this.timers.clear('auto-resume', runId);
|
|
292
283
|
if (note && this.context.store.getRun(runId))
|
|
293
284
|
this.context.store.appendEvent(runId, { type: 'note', message: note });
|
|
294
285
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-resume.js","sourceRoot":"","sources":["../../../src/workflows/run/auto-resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAQpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AAE7D,MAAM,kBAAkB,GACtB,yMAAyM,CAAC;AAE5M,MAAM,qBAAqB,GACzB,+CAA+C,WAAW,CAAC,OAAO,CAAC,oKAAoK,CAAC;AAE1O,+GAA+G;AAC/G,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,EAAE,CAC1C,4EAA4E,WAAW,CAAC,OAAO,CAAC,yIAAyI,MAAM,EAAE,CAAC;AAEpP;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAc;IACxC,IAAI,GAAG,CAAC,gBAAgB,KAAK,gBAAgB;QAAE,OAAO,kBAAkB,CAAC;IACzE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE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OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAC3F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACvH,CAAC;CACF"}
|
|
@@ -17,6 +17,7 @@ import { FamilyReconciler } from './family-reconciler.ts';
|
|
|
17
17
|
import * as completionGateReads from './completion-gate.ts';
|
|
18
18
|
import { WaitRegistry } from './wait-registry.ts';
|
|
19
19
|
import { WakeRetries } from './wake-retries.ts';
|
|
20
|
+
import { LivenessTimers } from './liveness-timers.ts';
|
|
20
21
|
import { HumanWaits } from './human-waits.ts';
|
|
21
22
|
import { SubagentWaits } from './subagent-waits.ts';
|
|
22
23
|
import { RunStart } from './run-start.ts';
|
|
@@ -59,6 +60,8 @@ import * as queuedRevival from './queued-revival.ts';
|
|
|
59
60
|
import { type RunRecord, type RunStore, type StepState } from '../../runs/store.ts';
|
|
60
61
|
import { type WorkflowDef } from '../types.ts';
|
|
61
62
|
export interface RunModules {
|
|
63
|
+
/** The one timer owner of every run's liveness bounds (hearsay-tools/squawk#3662). */
|
|
64
|
+
liveness: LivenessTimers;
|
|
62
65
|
memoryGuard: MemoryGuard;
|
|
63
66
|
workerScratchCleanup: WorkerScratchCleanup;
|
|
64
67
|
completionGateHost: completionGateReads.CompletionGateHost;
|
|
@@ -21,6 +21,7 @@ import { WorkerQuestions } from './worker-questions.js';
|
|
|
21
21
|
import { FamilyReconciler } from './family-reconciler.js';
|
|
22
22
|
import { WaitRegistry } from './wait-registry.js';
|
|
23
23
|
import { WakeRetries } from './wake-retries.js';
|
|
24
|
+
import { LivenessTimers } from './liveness-timers.js';
|
|
24
25
|
import { HumanWaits } from './human-waits.js';
|
|
25
26
|
import { SubagentWaits } from './subagent-waits.js';
|
|
26
27
|
import { RunStart } from './run-start.js';
|
|
@@ -50,6 +51,7 @@ import * as queuedRevival from './queued-revival.js';
|
|
|
50
51
|
/** Build modules in dependency order; callbacks read the facade at use time. */
|
|
51
52
|
export function composeRunModules(context, host) {
|
|
52
53
|
const modules = {};
|
|
54
|
+
modules.liveness = new LivenessTimers();
|
|
53
55
|
modules.workerScratchCleanup = new WorkerScratchCleanup(context.store, context.dataDir, id => host.isActive(id) || modules.workerExecutions.has(id) || modules.claims.has(id) || !!host.autosaveCleanupBlocker(id));
|
|
54
56
|
modules.completionGateHost = {
|
|
55
57
|
active: host.active,
|
|
@@ -105,7 +107,7 @@ export function composeRunModules(context, host) {
|
|
|
105
107
|
modules.retries = new WakeRetries(context, {
|
|
106
108
|
owesWake: run => modules.wakeAdmission.owesWake(run), queueWaitWake: id => modules.wakeAdmission.queueWaitWake(id),
|
|
107
109
|
retryWaitAdmission: id => modules.retries.retryWaitAdmission(id),
|
|
108
|
-
});
|
|
110
|
+
}, modules.liveness);
|
|
109
111
|
modules.queuedRevivalHost = {
|
|
110
112
|
move: (id, exit, patch) => host.move(id, exit, patch), isActive: id => host.isActive(id),
|
|
111
113
|
workerExecutionStopped: id => host.workerExecutionStopped(id), ownedJob: run => modules.runStart.ownedJob(run),
|
|
@@ -149,7 +151,7 @@ export function composeRunModules(context, host) {
|
|
|
149
151
|
cancel: id => host.cancel(id),
|
|
150
152
|
retireSettledQuestions: id => modules.workerQuestions.retireSettledQuestions(id), closeRoutedQuestions: id => modules.workerQuestions.closeRoutedQuestions(id),
|
|
151
153
|
reconcileWorkerWaits: id => host.reconcileWorkerWaits(id),
|
|
152
|
-
});
|
|
154
|
+
}, modules.liveness);
|
|
153
155
|
modules.waitEngine = new WaitEngine(context, {
|
|
154
156
|
active: id => host.active.get(id), canProceedWithRun: (id, run) => host.canProceedWithRun(id, run), ciSupervisor: () => host.ciSupervisor,
|
|
155
157
|
reconcileWorkerWaits: family => host.reconcileWorkerWaits(family),
|
|
@@ -187,7 +189,7 @@ export function composeRunModules(context, host) {
|
|
|
187
189
|
waitEngine: modules.waitEngine,
|
|
188
190
|
active: host.active, isParked: id => modules.line.isParked(id), isAdmitted: id => modules.line.isAdmitted(id),
|
|
189
191
|
releaseHeldPark: (id, state) => { modules.wakeAdmission.leaveMonitoringPool(id); modules.turnSettler.armIdleTimer(id, state); },
|
|
190
|
-
}, host.subagentWaitMs().graceMs, host.subagentWaitMs().deadlineMs);
|
|
192
|
+
}, host.subagentWaitMs().graceMs, host.subagentWaitMs().deadlineMs, modules.liveness);
|
|
191
193
|
modules.humanWaits = new HumanWaits(context, { waitEngine: modules.waitEngine, routeWorkerQuestion: id => modules.workerQuestions.routeWorkerQuestion(id) }, MAX_AUTO_CONTINUES);
|
|
192
194
|
modules.sessionHelperHost = {
|
|
193
195
|
active: host.active, line: modules.line, humanWaits: modules.humanWaits, inputReceiptHost: modules.inputReceiptHost,
|
|
@@ -214,7 +216,7 @@ export function composeRunModules(context, host) {
|
|
|
214
216
|
chargeAutomaticWake: id => modules.wakeAdmission.chargeAutomaticWake(id), retryWaitAdmission: id => modules.retries.retryWaitAdmission(id), armIdleTimer: (id, state) => modules.turnSettler.armIdleTimer(id, state),
|
|
215
217
|
openTurnEndHumanWait: (id, state, step, via, note) => modules.turnSettler.openTurnEndHumanWait(id, state, step, via, note),
|
|
216
218
|
settledTurnOutcome: (id, entry, outcome) => host.settledTurnOutcome(id, entry, outcome), queueWaitWake: id => modules.wakeAdmission.queueWaitWake(id),
|
|
217
|
-
}, MAX_AUTO_CONTINUES, COMPLETION_WILL_WAIT, host.noWaitNudgeReplyMs() ?? NO_WAIT_NUDGE_REPLY_MS);
|
|
219
|
+
}, MAX_AUTO_CONTINUES, COMPLETION_WILL_WAIT, host.noWaitNudgeReplyMs() ?? NO_WAIT_NUDGE_REPLY_MS, modules.liveness);
|
|
218
220
|
modules.worktreeAutosave = new WorktreeAutosave(context, { holdForMaintenance: ids => modules.claims.holdForMaintenance(ids),
|
|
219
221
|
reapTerminalScratch: id => modules.runSettlement.reapTerminalScratch(id), releaseSlot: () => modules.line.releaseSlot(),
|
|
220
222
|
saveWorktree: (id, state, reason) => modules.worktreeAutosave.saveWorktree(id, state, reason),
|
|
@@ -245,7 +247,7 @@ export function composeRunModules(context, host) {
|
|
|
245
247
|
settleIdleBoundary: (id, state, session) => modules.inputDelivery.settleIdleBoundary(id, state, session),
|
|
246
248
|
releaseSlot: () => modules.line.releaseSlot(), providerOwnsInboxInput: (id, inputId) => modules.inboxClaims.providerOwnsInboxInput(id, inputId),
|
|
247
249
|
canClaimInboxInput: (id, inputId) => host.canClaimInboxInput(id, inputId),
|
|
248
|
-
armInboxClaimExpiry: id => modules.inboxClaims.armInboxClaimExpiry(id) });
|
|
250
|
+
armInboxClaimExpiry: id => modules.inboxClaims.armInboxClaimExpiry(id) }, modules.liveness);
|
|
249
251
|
modules.repoRootLease = new RepoRootLease(context, { park: id => { modules.line.park(id); }, unpark: id => { modules.line.unpark(id); },
|
|
250
252
|
releaseSlot: () => modules.line.releaseSlot() });
|
|
251
253
|
modules.turnBookkeeper = new TurnBookkeeper(context, { isDisposedDelegatedRun: id => isDisposedDelegatedRun(context.store, () => context.disposed(), id), discoverSkills: () => modules.runSkills.discoverSkills(),
|
|
@@ -261,7 +263,7 @@ export function composeRunModules(context, host) {
|
|
|
261
263
|
recordUsagePeaks: id => recordUsagePeaks(context.store, { isDisposedDelegatedRun: id => isDisposedDelegatedRun(context.store, () => context.disposed(), id) }, id),
|
|
262
264
|
}, sessionEventHost(), launchPreambleHost(), modules.sessionHelperHost, modules.line, modules.runSkills, modules.humanWaits, modules.inputReceiptHost, modules.inputReceiptSteps);
|
|
263
265
|
modules.autoResumeScheduler = new AutoResumeScheduler(context, { move: (id, exit, patch) => host.move(id, exit, patch),
|
|
264
|
-
continueRun: (id, opts, defer) => host.continueRun(id, opts, defer), pump: () => modules.line.pump() });
|
|
266
|
+
continueRun: (id, opts, defer) => host.continueRun(id, opts, defer), pump: () => modules.line.pump() }, modules.liveness);
|
|
265
267
|
modules.recovery = new RunRecovery(context, modules.familyReconciler, modules.workerQuestions, modules.autoResumeScheduler, {
|
|
266
268
|
waitEngine: modules.waitEngine, workerScratchCleanup: modules.workerScratchCleanup, humanWaits: modules.humanWaits,
|
|
267
269
|
inboxClaims: modules.inboxClaims, orphans: modules.orphans,
|
|
@@ -368,7 +370,7 @@ export function composeRunModules(context, host) {
|
|
|
368
370
|
awaitCompletionNudgeReply: (id, state, session) => modules.turnNudges.awaitCompletionNudgeReply(id, state, session),
|
|
369
371
|
noticeParkedWorker: id => modules.workerQuestions.noticeParkedWorker(id), routeWorkerQuestion: id => modules.workerQuestions.routeWorkerQuestion(id),
|
|
370
372
|
settledTurnOutcome: (id, entry, outcome) => host.settledTurnOutcome(id, entry, outcome),
|
|
371
|
-
}, IDLE_TIMEOUT_MS, MAX_AUTO_CONTINUES, COMPLETION_WILL_WAIT, SCHEDULE_WAKEUP_MAX_SECONDS);
|
|
373
|
+
}, IDLE_TIMEOUT_MS, MAX_AUTO_CONTINUES, COMPLETION_WILL_WAIT, SCHEDULE_WAKEUP_MAX_SECONDS, modules.liveness);
|
|
372
374
|
modules.runFinish = new RunFinish(context, modules.completionGateHost, modules.runSettlement, modules.turnSettler, modules.turnNudges, modules.line, {
|
|
373
375
|
move: (...args) => host.move(...args), dropActive: id => host.dropActive(id),
|
|
374
376
|
get waitEngine() { return modules.waitEngine; }, reconcileWorkerWaits: id => host.reconcileWorkerWaits(id),
|
|
@@ -399,7 +401,7 @@ export function composeRunModules(context, host) {
|
|
|
399
401
|
reparkWithoutWaits: (id, state) => modules.wakeAdmission.reparkWithoutWaits(id, state), holdPeerWakesAtCap: id => modules.wakeAdmission.holdPeerWakesAtCap(id),
|
|
400
402
|
reconcileWorkerWaits: () => host.reconcileWorkerWaits(), unreadInputGraceMs: () => host.unreadInputGraceMs(),
|
|
401
403
|
submitAgentInput: (id, state, content, inputs, budget) => modules.inputDelivery.submitAgentInput(id, state, content, inputs, budget),
|
|
402
|
-
}, MAX_AUTO_CONTINUES, ROUTED_QUESTION_REFUSAL);
|
|
404
|
+
}, MAX_AUTO_CONTINUES, ROUTED_QUESTION_REFUSAL, modules.liveness);
|
|
403
405
|
modules.squawkToolsHost = { store: context.store,
|
|
404
406
|
registerWait: (...args) => host.registerWait(...args), registerAsk: (...args) => modules.waitRegistry.registerAsk(...args),
|
|
405
407
|
cancelWait: (...args) => host.cancelWait(...args), acceptDone: (...args) => host.acceptDone(...args),
|