@archmax-ai/harness 0.8.0 → 1.0.0
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/README.md +58 -14
- package/dist/agent.d.ts +4 -4
- package/dist/agent.js +4 -4
- package/dist/assembly/compose.d.ts +5 -24
- package/dist/assembly/compose.js +40 -41
- package/dist/assembly/compose.js.map +1 -1
- package/dist/assembly/delegation-registry.js +3 -14
- package/dist/assembly/delegation-registry.js.map +1 -1
- package/dist/assembly/index.d.ts +18 -15
- package/dist/assembly/index.js +50 -32
- package/dist/assembly/index.js.map +1 -1
- package/dist/assembly/plain.js +1 -2
- package/dist/assembly/plain.js.map +1 -1
- package/dist/authoring-skill/archmax-harness/README.md +5 -5
- package/dist/authoring-skill/archmax-harness/SKILL.md +72 -30
- package/dist/authoring-skill/archmax-harness/references/backend-integration.md +35 -23
- package/dist/authoring-skill/archmax-harness/references/cases.md +44 -10
- package/dist/authoring-skill/archmax-harness/references/{hook-and-test-scripts.md → code-state-and-test-scripts.md} +617 -313
- package/dist/authoring-skill/archmax-harness/references/code-states-and-scripts.md +115 -0
- package/dist/authoring-skill/archmax-harness/references/diagnostics.md +40 -7
- package/dist/authoring-skill/archmax-harness/references/wiring.md +19 -10
- package/dist/authoring-skill/archmax-harness/references/workflow-schema.md +416 -276
- package/dist/authoring-skill/archmax-harness/references/workflow-yaml.md +161 -62
- package/dist/cli/state-flow.d.ts +1 -1
- package/dist/cli/state-flow.js +18 -28
- package/dist/cli/state-flow.js.map +1 -1
- package/dist/cli/turn.d.ts +1 -1
- package/dist/cli/turn.js +2 -3
- package/dist/cli/turn.js.map +1 -1
- package/dist/core/clock.d.ts +26 -0
- package/dist/core/clock.js +64 -0
- package/dist/core/clock.js.map +1 -0
- package/dist/core/code-description.d.ts +3 -3
- package/dist/core/code-description.js +3 -3
- package/dist/core/deepagents.d.ts +5 -5
- package/dist/core/deepagents.js +4 -4
- package/dist/core/events.d.ts +23 -42
- package/dist/core/events.js +21 -24
- package/dist/core/events.js.map +1 -1
- package/dist/core/message-readers.d.ts +22 -2
- package/dist/core/message-readers.js +31 -0
- package/dist/core/message-readers.js.map +1 -1
- package/dist/core/messages.d.ts +1 -23
- package/dist/core/messages.js +2 -35
- package/dist/core/messages.js.map +1 -1
- package/dist/core/mounts.js +3 -3
- package/dist/core/platform-prompt.generated.js +1 -1
- package/dist/core/platform-prompt.generated.js.map +1 -1
- package/dist/core/session-zone.d.ts +1 -1
- package/dist/core/session-zone.js +1 -1
- package/dist/core/workspace-context.d.ts +1 -1
- package/dist/core/workspace.d.ts +1 -1
- package/dist/core/workspace.js +1 -1
- package/dist/core/zones.d.ts +4 -4
- package/dist/core/zones.js +5 -5
- package/dist/core/zones.js.map +1 -1
- package/dist/env.d.ts +9 -9
- package/dist/index.d.ts +3 -7
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/kernel/kernel.d.ts +31 -61
- package/dist/kernel/kernel.js +57 -114
- package/dist/kernel/kernel.js.map +1 -1
- package/dist/machine/allow.d.ts +17 -2
- package/dist/machine/allow.js +16 -6
- package/dist/machine/allow.js.map +1 -1
- package/dist/machine/lint-spec.js +68 -12
- package/dist/machine/lint-spec.js.map +1 -1
- package/dist/machine/machine.d.ts +39 -16
- package/dist/machine/machine.js +72 -49
- package/dist/machine/machine.js.map +1 -1
- package/dist/machine/spec-schema.d.ts +34 -179
- package/dist/machine/spec-schema.js +93 -106
- package/dist/machine/spec-schema.js.map +1 -1
- package/dist/machine/tool-names.d.ts +34 -10
- package/dist/machine/tool-names.js +41 -10
- package/dist/machine/tool-names.js.map +1 -1
- package/dist/machine/tool-paths.d.ts +6 -0
- package/dist/machine/tool-paths.js +10 -0
- package/dist/machine/tool-paths.js.map +1 -1
- package/dist/machine/types.d.ts +14 -38
- package/dist/machine/types.js.map +1 -1
- package/dist/machine/validate-spec.d.ts +1 -1
- package/dist/machine/variables.d.ts +2 -0
- package/dist/machine/variables.js.map +1 -1
- package/dist/public/sandbox.d.ts +62 -66
- package/dist/public/sandbox.js +22 -23
- package/dist/public/sandbox.js.map +1 -1
- package/dist/public/spec.d.ts +12 -19
- package/dist/public/spec.js +11 -19
- package/dist/public/spec.js.map +1 -1
- package/dist/runtime/contract.d.ts +11 -12
- package/dist/runtime/contract.js +16 -16
- package/dist/runtime/contract.js.map +1 -1
- package/dist/sandbox/assets/parts/code-state.js +17 -0
- package/dist/sandbox/executor.d.ts +25 -7
- package/dist/sandbox/executor.js +56 -47
- package/dist/sandbox/executor.js.map +1 -1
- package/dist/sandbox/imports.d.ts +10 -10
- package/dist/sandbox/imports.js +11 -11
- package/dist/sandbox/imports.js.map +1 -1
- package/dist/sandbox/prelude.d.ts +5 -6
- package/dist/sandbox/prelude.js +38 -35
- package/dist/sandbox/prelude.js.map +1 -1
- package/dist/sandbox/ptc-gateway.d.ts +19 -18
- package/dist/sandbox/ptc-gateway.js +26 -22
- package/dist/sandbox/ptc-gateway.js.map +1 -1
- package/dist/sessions/operations.js +4 -5
- package/dist/sessions/operations.js.map +1 -1
- package/dist/sessions/resume.d.ts +12 -7
- package/dist/sessions/resume.js +12 -9
- package/dist/sessions/resume.js.map +1 -1
- package/dist/sessions/summary.d.ts +1 -1
- package/dist/testing/assertions.js +9 -4
- package/dist/testing/assertions.js.map +1 -1
- package/dist/testing/case-document.d.ts +2 -0
- package/dist/testing/case-document.js.map +1 -1
- package/dist/testing/case-schema.d.ts +1 -1
- package/dist/testing/case-schema.js +17 -1
- package/dist/testing/case-schema.js.map +1 -1
- package/dist/testing/driver.d.ts +4 -0
- package/dist/testing/driver.js +22 -3
- package/dist/testing/driver.js.map +1 -1
- package/dist/testing/grade.js +3 -3
- package/dist/testing/grade.js.map +1 -1
- package/dist/testing/interpreter.d.ts +2 -2
- package/dist/testing/interpreter.js +1 -0
- package/dist/testing/interpreter.js.map +1 -1
- package/dist/testing/runner.d.ts +2 -2
- package/dist/validate/validate.d.ts +1 -1
- package/dist/validate/validate.js +39 -70
- package/dist/validate/validate.js.map +1 -1
- package/dist/workflow/automated-controls.d.ts +63 -0
- package/dist/workflow/automated-controls.js +158 -0
- package/dist/workflow/automated-controls.js.map +1 -0
- package/dist/workflow/automated.d.ts +112 -0
- package/dist/workflow/automated.js +163 -0
- package/dist/workflow/automated.js.map +1 -0
- package/dist/workflow/checkpointer.d.ts +7 -0
- package/dist/workflow/checkpointer.js +28 -0
- package/dist/workflow/checkpointer.js.map +1 -1
- package/dist/workflow/code-state.d.ts +46 -0
- package/dist/workflow/code-state.js +26 -0
- package/dist/workflow/code-state.js.map +1 -0
- package/dist/workflow/control-tools.d.ts +54 -23
- package/dist/workflow/control-tools.js +121 -77
- package/dist/workflow/control-tools.js.map +1 -1
- package/dist/workflow/file-values.d.ts +4 -4
- package/dist/workflow/file-values.js +1 -1
- package/dist/workflow/file-values.js.map +1 -1
- package/dist/workflow/governance.d.ts +13 -22
- package/dist/workflow/governance.js +51 -87
- package/dist/workflow/governance.js.map +1 -1
- package/dist/workflow/grader-state.d.ts +55 -0
- package/dist/workflow/grader-state.js +182 -0
- package/dist/workflow/grader-state.js.map +1 -0
- package/dist/workflow/history.d.ts +11 -0
- package/dist/workflow/history.js +64 -0
- package/dist/workflow/history.js.map +1 -0
- package/dist/workflow/middleware.d.ts +14 -17
- package/dist/workflow/middleware.js +106 -74
- package/dist/workflow/middleware.js.map +1 -1
- package/dist/workflow/move-events.d.ts +21 -0
- package/dist/workflow/move-events.js +20 -0
- package/dist/workflow/move-events.js.map +1 -0
- package/dist/workflow/parks.d.ts +9 -2
- package/dist/workflow/parks.js +16 -8
- package/dist/workflow/parks.js.map +1 -1
- package/dist/workflow/paths.d.ts +9 -9
- package/dist/workflow/paths.js +19 -19
- package/dist/workflow/paths.js.map +1 -1
- package/dist/workflow/render-prompt.d.ts +7 -5
- package/dist/workflow/render-prompt.js +22 -37
- package/dist/workflow/render-prompt.js.map +1 -1
- package/dist/workflow/signature-checks.d.ts +2 -2
- package/dist/workflow/snapshot.js +5 -29
- package/dist/workflow/snapshot.js.map +1 -1
- package/dist/workflow/state.d.ts +19 -6
- package/dist/workflow/state.js +24 -8
- package/dist/workflow/state.js.map +1 -1
- package/dist/workflow/sub-workflow.d.ts +3 -3
- package/dist/workflow/tool-service.d.ts +1 -9
- package/dist/workflow/tool-service.js +21 -24
- package/dist/workflow/tool-service.js.map +1 -1
- package/dist/workflow/turn-boundary.d.ts +2 -2
- package/dist/workflow/turn-boundary.js +10 -7
- package/dist/workflow/turn-boundary.js.map +1 -1
- package/dist/workflow/turn-runner.js +30 -2
- package/dist/workflow/turn-runner.js.map +1 -1
- package/package.json +1 -1
- package/skills/archmax-harness/README.md +5 -5
- package/skills/archmax-harness/SKILL.md +72 -30
- package/skills/archmax-harness/references/backend-integration.md +35 -23
- package/skills/archmax-harness/references/cases.md +44 -10
- package/skills/archmax-harness/references/{hook-and-test-scripts.md → code-state-and-test-scripts.md} +617 -313
- package/skills/archmax-harness/references/code-states-and-scripts.md +115 -0
- package/skills/archmax-harness/references/diagnostics.md +40 -7
- package/skills/archmax-harness/references/wiring.md +19 -10
- package/skills/archmax-harness/references/workflow-schema.md +416 -276
- package/skills/archmax-harness/references/workflow-yaml.md +161 -62
- package/dist/authoring-skill/archmax-harness/references/hooks-and-scripts.md +0 -88
- package/dist/lifecycle/hook-shape.d.ts +0 -44
- package/dist/lifecycle/hook-shape.js +0 -66
- package/dist/lifecycle/hook-shape.js.map +0 -1
- package/dist/lifecycle/runner.d.ts +0 -183
- package/dist/lifecycle/runner.js +0 -373
- package/dist/lifecycle/runner.js.map +0 -1
- package/dist/lifecycle/transcript.d.ts +0 -27
- package/dist/lifecycle/transcript.js +0 -43
- package/dist/lifecycle/transcript.js.map +0 -1
- package/dist/rubrics/rubrics.d.ts +0 -135
- package/dist/rubrics/rubrics.js +0 -145
- package/dist/rubrics/rubrics.js.map +0 -1
- package/dist/sandbox/assets/parts/core.js +0 -22
- package/dist/sandbox/assets/parts/lifecycle-hook.js +0 -47
- package/dist/sandbox/bridge.d.ts +0 -16
- package/dist/sandbox/bridge.js +0 -95
- package/dist/sandbox/bridge.js.map +0 -1
- package/skills/archmax-harness/references/hooks-and-scripts.md +0 -88
|
@@ -49,4 +49,11 @@ export declare class BackendCheckpointSaver extends MemorySaver {
|
|
|
49
49
|
* removal is the session store's job. Named `deleteThread` because LangGraph owns the word.
|
|
50
50
|
*/
|
|
51
51
|
deleteThread(sessionId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Drop a session and every child session under it from memory, leaving their
|
|
54
|
+
* record files in the store: unlike {@link deleteThread} nothing is marked, so
|
|
55
|
+
* the next access replays them as after a restart. Synchronous, because
|
|
56
|
+
* `dispose` is.
|
|
57
|
+
*/
|
|
58
|
+
evict(sessionId: string): void;
|
|
52
59
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { MemorySaver, WRITES_IDX_MAP, } from "@langchain/langgraph-checkpoint";
|
|
3
3
|
import { isReservedRootName } from "../core/zones.js";
|
|
4
|
+
import { isChildSessionOf } from "../sessions/scope.js";
|
|
4
5
|
import { sessionPaths } from "./paths.js";
|
|
5
6
|
const enc = (bytes) => Buffer.from(bytes).toString("base64");
|
|
6
7
|
const dec = (b64) => new Uint8Array(Buffer.from(b64, "base64"));
|
|
@@ -124,6 +125,14 @@ export class BackendCheckpointSaver extends MemorySaver {
|
|
|
124
125
|
const sessionId = config.configurable?.thread_id;
|
|
125
126
|
if (sessionId !== undefined)
|
|
126
127
|
await this.ensureLoaded(sessionId);
|
|
128
|
+
// `MemorySaver.put` creates the namespace before it stores the checkpoint, across an
|
|
129
|
+
// await; read in that window, the parent takes the newest of no checkpoints and throws.
|
|
130
|
+
if (sessionId !== undefined && config.configurable?.checkpoint_id === undefined) {
|
|
131
|
+
const ns = config.configurable?.checkpoint_ns ?? "";
|
|
132
|
+
const held = this.storage[sessionId]?.[ns];
|
|
133
|
+
if (held !== undefined && Object.keys(held).length === 0)
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
127
136
|
return super.getTuple(config);
|
|
128
137
|
}
|
|
129
138
|
async *list(config, options) {
|
|
@@ -196,5 +205,24 @@ export class BackendCheckpointSaver extends MemorySaver {
|
|
|
196
205
|
// Marked as replayed (with nothing to replay) so a later access does not resurrect the files.
|
|
197
206
|
this.loading.set(sessionId, Promise.resolve());
|
|
198
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Drop a session and every child session under it from memory, leaving their
|
|
210
|
+
* record files in the store: unlike {@link deleteThread} nothing is marked, so
|
|
211
|
+
* the next access replays them as after a restart. Synchronous, because
|
|
212
|
+
* `dispose` is.
|
|
213
|
+
*/
|
|
214
|
+
evict(sessionId) {
|
|
215
|
+
const covered = (id) => id === sessionId || isChildSessionOf(id, sessionId);
|
|
216
|
+
for (const id of Object.keys(this.storage))
|
|
217
|
+
if (covered(id))
|
|
218
|
+
delete this.storage[id];
|
|
219
|
+
for (const key of Object.keys(this.writes)) {
|
|
220
|
+
if (covered(String(JSON.parse(key)[0])))
|
|
221
|
+
delete this.writes[key];
|
|
222
|
+
}
|
|
223
|
+
for (const id of [...this.loading.keys()])
|
|
224
|
+
if (covered(id))
|
|
225
|
+
this.loading.delete(id);
|
|
226
|
+
}
|
|
199
227
|
}
|
|
200
228
|
//# sourceMappingURL=checkpointer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpointer.js","sourceRoot":"","sources":["../../src/workflow/checkpointer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,WAAW,EACX,cAAc,GAMf,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO1C,MAAM,GAAG,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAA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CAAC;gBAAE,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3C,IAAI,OAAO,CAAC,MAAM,CAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClF,CAAC;QACD,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAAE,IAAI,OAAO,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A code state's run: its `script`, read from the authoring backend, evaluated
|
|
3
|
+
* in the sandbox with its state's input and its state's tools — nothing else.
|
|
4
|
+
*
|
|
5
|
+
* The run decides nothing here: the script moves the session through
|
|
6
|
+
* `tools.archmax_advance` or ends it through `tools.archmax_raise`, which the
|
|
7
|
+
* step recorder holds, and the orchestrator (`automated.ts`) reads the outcome
|
|
8
|
+
* from that record and from whether the script finished cleanly.
|
|
9
|
+
*/
|
|
10
|
+
import type { StructuredTool } from "@langchain/core/tools";
|
|
11
|
+
import type { WorkflowEventEmitter } from "../core/events.js";
|
|
12
|
+
import type { ScriptExecutor } from "../sandbox/executor.js";
|
|
13
|
+
/** Resolves a code state's declared `script` to its authoring-backend path, or refuses it with a reason. */
|
|
14
|
+
export type CodeScriptResolver = (declared: string) => {
|
|
15
|
+
ok: true;
|
|
16
|
+
path: string;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
export interface CodeStateRun {
|
|
22
|
+
emit: WorkflowEventEmitter;
|
|
23
|
+
/** The executor reading sources from the authoring backend. */
|
|
24
|
+
executor: ScriptExecutor;
|
|
25
|
+
resolveScript: CodeScriptResolver;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
state: string;
|
|
28
|
+
/** The state's declared `script`. */
|
|
29
|
+
script: string;
|
|
30
|
+
/** The script's input: `{ state, trigger?, variables }`. */
|
|
31
|
+
input: Record<string, unknown>;
|
|
32
|
+
/** The code state's tools, governed. */
|
|
33
|
+
tools: StructuredTool[];
|
|
34
|
+
/** The names those tools are listed and reached by. */
|
|
35
|
+
surface: readonly string[];
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Run a code state's script. Settles with the error that stopped it, if one did
|
|
40
|
+
* — a script that cannot be placed or read, a foreign import, a throw, a
|
|
41
|
+
* timeout, a cancelled turn — and with nothing when it ran to its end. Each
|
|
42
|
+
* console line is reported as it was logged.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runCodeState(run: CodeStateRun): Promise<{
|
|
45
|
+
error?: string;
|
|
46
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a code state's script. Settles with the error that stopped it, if one did
|
|
3
|
+
* — a script that cannot be placed or read, a foreign import, a throw, a
|
|
4
|
+
* timeout, a cancelled turn — and with nothing when it ran to its end. Each
|
|
5
|
+
* console line is reported as it was logged.
|
|
6
|
+
*/
|
|
7
|
+
export async function runCodeState(run) {
|
|
8
|
+
const resolved = run.resolveScript(run.script);
|
|
9
|
+
if (!resolved.ok)
|
|
10
|
+
return { error: resolved.reason };
|
|
11
|
+
const outcome = await run.executor.runCodeState(resolved.path, {
|
|
12
|
+
sessionId: run.sessionId,
|
|
13
|
+
args: run.input,
|
|
14
|
+
tools: run.tools,
|
|
15
|
+
surface: run.surface,
|
|
16
|
+
...(run.signal ? { signal: run.signal } : {}),
|
|
17
|
+
});
|
|
18
|
+
for (const line of outcome.logs) {
|
|
19
|
+
if (line.trim())
|
|
20
|
+
run.emit({ type: "code-output", state: run.state, line: line.trimEnd() });
|
|
21
|
+
}
|
|
22
|
+
if (outcome.ok)
|
|
23
|
+
return {};
|
|
24
|
+
return { error: outcome.error?.message ?? "the script failed" };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=code-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-state.js","sourceRoot":"","sources":["../../src/workflow/code-state.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAiB;IAClD,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE;QAC7D,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,IAAI,EAAE,GAAG,CAAC,KAAK;QACf,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9C,CAAC,CAAC;IACH,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,IAAI,EAAE;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7F,CAAC;IACD,IAAI,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,CAAC;IAC1B,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,IAAI,mBAAmB,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The control tools: `archmax_advance`, `archmax_wait`, `archmax_reset`,
|
|
3
|
-
* `archmax_raise`, `archmax_get_variables`, `archmax_set_variables
|
|
3
|
+
* `archmax_raise`, `archmax_get_variables`, `archmax_set_variables` — and
|
|
4
|
+
* `archmax_get_history`, which only a grader state is offered.
|
|
4
5
|
*
|
|
5
6
|
* Each is a declaration whose body never runs in a wired assembly: governance
|
|
6
|
-
* intercepts the call in `wrapToolCall`, where checkpointed
|
|
7
|
-
* services it with the handler here. A handler returns the
|
|
8
|
-
* model reads and, when the call changed the run, the `Command`
|
|
7
|
+
* intercepts the session's agent's call in `wrapToolCall`, where checkpointed
|
|
8
|
+
* state is in hand, and services it with the handler here. A handler returns the
|
|
9
|
+
* tool message the model reads and, when the call changed the run, the `Command`
|
|
10
|
+
* committing it. An automated state's controls (`automated-controls.ts`) reuse
|
|
11
|
+
* the same schemas, handlers and {@link transitionUpdate}.
|
|
9
12
|
*/
|
|
10
13
|
import { ToolMessage } from "@langchain/core/messages";
|
|
11
14
|
import type { StructuredTool } from "@langchain/core/tools";
|
|
12
15
|
import { Command } from "@langchain/langgraph";
|
|
13
16
|
import { z } from "zod";
|
|
14
17
|
import { type MountPrefixes } from "../core/zones.js";
|
|
15
|
-
import type { LifecycleContext, LifecycleRunner } from "../lifecycle/runner.js";
|
|
16
18
|
import type { WorkflowMachine } from "../machine/machine.js";
|
|
17
19
|
import { ADVANCE_TOOL, GET_VARIABLES_TOOL, RAISE_TOOL, RESET_TOOL, SET_VARIABLES_TOOL, WAIT_TOOL } from "../machine/tool-names.js";
|
|
18
20
|
import { type UnresolvedGlob, type VariableStore } from "../machine/variables.js";
|
|
19
21
|
import { type FileValueCheck } from "./signature-checks.js";
|
|
20
|
-
import { type PendingDecision, type PendingInput, type RaiseRecord, type WorkflowStateFields } from "./state.js";
|
|
22
|
+
import { type MoveKind, type PendingDecision, type PendingInput, type RaiseRecord, type WorkflowStateFields, type WorkflowUpdate } from "./state.js";
|
|
21
23
|
export { ADVANCE_TOOL, GET_VARIABLES_TOOL, RAISE_TOOL, RESET_TOOL, SET_VARIABLES_TOOL, WAIT_TOOL };
|
|
22
24
|
/** The one refusal shape: an error-status tool message, so the model self-corrects and a view classifies it. */
|
|
23
25
|
export declare function refusal(name: string, toolCallId: string, text: string): ToolMessage;
|
|
@@ -71,36 +73,66 @@ export declare const setVariablesSchema: z.ZodObject<{
|
|
|
71
73
|
export declare function createControlTools(opts?: {
|
|
72
74
|
child?: boolean;
|
|
73
75
|
}): StructuredTool[];
|
|
76
|
+
/** One move along a declared edge, as a trail step and a park will record it. */
|
|
77
|
+
export interface Move {
|
|
78
|
+
to: string;
|
|
79
|
+
/** Who moved the session: its agent, a grader state or a code state. */
|
|
80
|
+
kind: MoveKind;
|
|
81
|
+
reason: string;
|
|
82
|
+
/** Attached evidence paths, already validated; only into a human state. */
|
|
83
|
+
evidence?: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The update a move commits — the target position, the trail step, a cleared
|
|
87
|
+
* rejection marker and a fresh turn budget — plus, into a human state, the park
|
|
88
|
+
* record opened in its closing phase. The one derivation every mover shares: the
|
|
89
|
+
* session's agent through {@link handleAdvance}, and an automated state's run.
|
|
90
|
+
* Messages are the caller's (a tool reply, a runtime note).
|
|
91
|
+
*/
|
|
92
|
+
export declare function transitionUpdate(machine: WorkflowMachine, state: unknown, move: Move): {
|
|
93
|
+
update: WorkflowUpdate;
|
|
94
|
+
park?: PendingDecision;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Why `from` may not be left for `to` right now, or `undefined` when it may: the
|
|
98
|
+
* kernel's transition verdict — the state's `requires` against `variables`, then
|
|
99
|
+
* the declared edge. Every refusal is recoverable: the mover sets what is owed,
|
|
100
|
+
* or picks a valid target.
|
|
101
|
+
*/
|
|
102
|
+
export declare function transitionRefusal(machine: WorkflowMachine, from: string, to: string, variables: VariableStore): string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Evidence an advance attaches, validated for the target: accepted only into a
|
|
105
|
+
* human state, and only paths the session itself could read.
|
|
106
|
+
*/
|
|
107
|
+
export declare function advanceEvidence(machine: WorkflowMachine, to: string, attached: readonly string[], mounts?: MountPrefixes): EvidenceValidation;
|
|
74
108
|
export interface AdvanceRequest {
|
|
75
109
|
/** Tool call id, echoed on the resulting ToolMessage. */
|
|
76
110
|
toolCallId: string;
|
|
77
|
-
/** The id this call is reported under on the event stream (the provider's, else the generated fallback). */
|
|
78
|
-
callId?: string;
|
|
79
111
|
args: Record<string, unknown>;
|
|
80
112
|
/** Checkpointed agent state at the time of the call. */
|
|
81
113
|
state: unknown;
|
|
82
|
-
/** Lifecycle context; its `iterations` are seeded from state and committed back. */
|
|
83
|
-
ctx: LifecycleContext;
|
|
84
114
|
}
|
|
85
115
|
export interface AdvanceOutcome {
|
|
86
116
|
message: Command | ToolMessage;
|
|
87
117
|
moved?: {
|
|
88
118
|
from: string;
|
|
89
119
|
to: string;
|
|
120
|
+
reason: string;
|
|
90
121
|
/** The decision record committed when `to` is a human state. */
|
|
91
122
|
park?: PendingDecision;
|
|
92
123
|
};
|
|
93
124
|
}
|
|
94
125
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* the
|
|
126
|
+
* Service the session's agent's `archmax_advance`: validate the arguments, the
|
|
127
|
+
* evidence and the transition, then commit {@link transitionUpdate} with the
|
|
128
|
+
* reply the agent reads. A refusal leaves the session exactly where it was — no
|
|
129
|
+
* trail step — and replies without erroring the message, so the agent corrects
|
|
130
|
+
* the call rather than reading a failed run.
|
|
98
131
|
*/
|
|
99
132
|
export declare function handleAdvance(opts: {
|
|
100
133
|
machine: WorkflowMachine;
|
|
101
|
-
lifecycle: LifecycleRunner;
|
|
102
134
|
mountPrefixes?: MountPrefixes;
|
|
103
|
-
}, request: AdvanceRequest):
|
|
135
|
+
}, request: AdvanceRequest): AdvanceOutcome;
|
|
104
136
|
/** The accepted `until` forms, quoted verbatim in every rejection. */
|
|
105
137
|
export declare const WAIT_UNTIL_FORMS: string;
|
|
106
138
|
export type WaitUntilResult = {
|
|
@@ -150,9 +182,9 @@ export interface ResetOutcome {
|
|
|
150
182
|
};
|
|
151
183
|
}
|
|
152
184
|
/**
|
|
153
|
-
* Service a reset: move back to the entry state
|
|
154
|
-
*
|
|
155
|
-
*
|
|
185
|
+
* Service a reset: move back to the entry state. Evidence — messages, files,
|
|
186
|
+
* variables, the trail — is left alone: a reset moves the machine, not the
|
|
187
|
+
* history.
|
|
156
188
|
*/
|
|
157
189
|
export declare function handleReset(machine: WorkflowMachine, request: ResetRequest): ResetOutcome;
|
|
158
190
|
export interface RaiseRequest {
|
|
@@ -170,9 +202,9 @@ export interface RaiseOutcome {
|
|
|
170
202
|
* Service a raise: end the session as a failure in the state it was called in.
|
|
171
203
|
* Commits the record and `status: failed`, and drops a pending rejection — the
|
|
172
204
|
* agent's own account of the failure is what the session ends with. The turn
|
|
173
|
-
* ends at the next model hook; nothing routes and
|
|
174
|
-
* session left in place, for invalid arguments or a message making other
|
|
175
|
-
* those run concurrently, so a raise beside them could not mean one thing.
|
|
205
|
+
* ends at the next model hook; nothing routes and nothing further runs. Refused,
|
|
206
|
+
* with the session left in place, for invalid arguments or a message making other
|
|
207
|
+
* calls: those run concurrently, so a raise beside them could not mean one thing.
|
|
176
208
|
*/
|
|
177
209
|
export declare function handleRaise(machine: WorkflowMachine, request: RaiseRequest): RaiseOutcome;
|
|
178
210
|
export interface VariableToolRequest {
|
|
@@ -209,8 +241,7 @@ fileRefusal?: string): SetVariablesOutcome;
|
|
|
209
241
|
export declare function fileReturnsRefusal(machine: WorkflowMachine, state: unknown, args: Record<string, unknown>, check: FileValueCheck): Promise<string | undefined>;
|
|
210
242
|
/** Wrap an `archmax_set_variables` outcome as the update that commits its delta. */
|
|
211
243
|
export declare function setVariablesCommand(outcome: SetVariablesOutcome): Command | ToolMessage;
|
|
212
|
-
|
|
213
|
-
export declare function unmetRequirements(required: string[], store: VariableStore): string[];
|
|
244
|
+
export { unmetRequirements } from "../kernel/kernel.js";
|
|
214
245
|
/**
|
|
215
246
|
* The wording for a `${{…}}` reference in the agent's own tool arguments that
|
|
216
247
|
* could not be resolved: a correctable refusal carrying the two fixes it might
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The control tools: `archmax_advance`, `archmax_wait`, `archmax_reset`,
|
|
3
|
-
* `archmax_raise`, `archmax_get_variables`, `archmax_set_variables
|
|
3
|
+
* `archmax_raise`, `archmax_get_variables`, `archmax_set_variables` — and
|
|
4
|
+
* `archmax_get_history`, which only a grader state is offered.
|
|
4
5
|
*
|
|
5
6
|
* Each is a declaration whose body never runs in a wired assembly: governance
|
|
6
|
-
* intercepts the call in `wrapToolCall`, where checkpointed
|
|
7
|
-
* services it with the handler here. A handler returns the
|
|
8
|
-
* model reads and, when the call changed the run, the `Command`
|
|
7
|
+
* intercepts the session's agent's call in `wrapToolCall`, where checkpointed
|
|
8
|
+
* state is in hand, and services it with the handler here. A handler returns the
|
|
9
|
+
* tool message the model reads and, when the call changed the run, the `Command`
|
|
10
|
+
* committing it. An automated state's controls (`automated-controls.ts`) reuse
|
|
11
|
+
* the same schemas, handlers and {@link transitionUpdate}.
|
|
9
12
|
*/
|
|
10
13
|
import { ToolMessage } from "@langchain/core/messages";
|
|
11
14
|
import { Command } from "@langchain/langgraph";
|
|
@@ -14,6 +17,7 @@ import { z } from "zod";
|
|
|
14
17
|
import { spokeSinceLastHumanMessage } from "../core/messages.js";
|
|
15
18
|
import { canonicalizeRelPath } from "../core/workspace.js";
|
|
16
19
|
import { classifyWorkspacePath, NO_MOUNTS, } from "../core/zones.js";
|
|
20
|
+
import { decide } from "../kernel/kernel.js";
|
|
17
21
|
import { signatureValueIssues } from "../machine/signature.js";
|
|
18
22
|
import { ADVANCE_TOOL, GET_VARIABLES_TOOL, RAISE_TOOL, RESET_TOOL, SET_VARIABLES_TOOL, WAIT_TOOL, } from "../machine/tool-names.js";
|
|
19
23
|
import { normalizeTitle, resolvePath, TITLE_VARIABLE, titleWriteError, VARIABLE_NAME_PATTERN, } from "../machine/variables.js";
|
|
@@ -157,8 +161,7 @@ export function createControlTools(opts = {}) {
|
|
|
157
161
|
return [
|
|
158
162
|
declaration(ADVANCE_TOOL, "Advance the workflow to the next state. Pick `to` from the current state's " +
|
|
159
163
|
"transitions in the graph section above (a slug, never a title). The runtime " +
|
|
160
|
-
"validates the edge,
|
|
161
|
-
"state's tools.", advanceSchema),
|
|
164
|
+
"validates the edge, then unlocks the next state's tools.", advanceSchema),
|
|
162
165
|
declaration(RESET_TOOL, "Start the workflow over from the state the conversation began in, keeping the " +
|
|
163
166
|
"conversation and any work already written. Use it when this state cannot serve " +
|
|
164
167
|
"what was asked: a wrong branch, a path no transition from here reaches, or a " +
|
|
@@ -190,77 +193,102 @@ export function createControlTools(opts = {}) {
|
|
|
190
193
|
];
|
|
191
194
|
}
|
|
192
195
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
+
* The update a move commits — the target position, the trail step, a cleared
|
|
197
|
+
* rejection marker and a fresh turn budget — plus, into a human state, the park
|
|
198
|
+
* record opened in its closing phase. The one derivation every mover shares: the
|
|
199
|
+
* session's agent through {@link handleAdvance}, and an automated state's run.
|
|
200
|
+
* Messages are the caller's (a tool reply, a runtime note).
|
|
196
201
|
*/
|
|
197
|
-
export
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
// Evidence is settled before the transition is attempted, so a refused
|
|
204
|
-
// attachment leaves the run exactly where it was: no hook run, no trail step.
|
|
205
|
-
const attached = parsed.data.evidence ?? [];
|
|
206
|
-
let evidence = [];
|
|
207
|
-
if (attached.length > 0) {
|
|
208
|
-
if (!opts.machine.isHumanState(parsed.data.to)) {
|
|
209
|
-
return refuse(`${ADVANCE_TOOL} rejected: evidence can only be attached when advancing into a human ` +
|
|
210
|
-
`decision state, and '${parsed.data.to}' is not one — nothing would present it. ` +
|
|
211
|
-
`Call again without 'evidence'.`);
|
|
212
|
-
}
|
|
213
|
-
const validated = validateAdvanceEvidence(attached, opts.mountPrefixes);
|
|
214
|
-
if (!validated.ok)
|
|
215
|
-
return refuse(`${ADVANCE_TOOL} rejected: ${validated.reason}`);
|
|
216
|
-
evidence = validated.paths;
|
|
217
|
-
}
|
|
218
|
-
const from = currentWorkflowState(request.state, opts.machine.entry);
|
|
219
|
-
const result = await opts.lifecycle.attemptTransition(from, parsed.data.to, request.ctx, parsed.data.reason, request.callId ? { callId: request.callId } : undefined);
|
|
220
|
-
if (!result.ok) {
|
|
221
|
-
// A terminal rejection is committed as `rejected` so the run routes through
|
|
222
|
-
// `on_error`; a recoverable one keeps the agent in place, replying without
|
|
223
|
-
// erroring the message so it retries rather than reading a failed run.
|
|
224
|
-
return {
|
|
225
|
-
message: commit({
|
|
226
|
-
iterations: { ...result.corrections },
|
|
227
|
-
...(result.terminal ? { rejected: result.reason } : {}),
|
|
228
|
-
messages: [toolReply(ADVANCE_TOOL, request.toolCallId, `${ADVANCE_TOOL} rejected: ${result.reason}`)],
|
|
229
|
-
}),
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
const fields = readWorkflowState(request.state);
|
|
233
|
-
const step = { to: result.to, kind: "agent", reason: parsed.data.reason, ts: Date.now() };
|
|
234
|
-
const moved = {
|
|
235
|
-
workflowState: result.to,
|
|
236
|
-
iterations: { ...result.corrections },
|
|
237
|
-
// The gate ran the target's `before` hook: recorded as done for this visit,
|
|
238
|
-
// so the target's first model call does not run it a second time.
|
|
239
|
-
beforeDone: { ...(fields.beforeDone ?? {}), [result.to]: true },
|
|
202
|
+
export function transitionUpdate(machine, state, move) {
|
|
203
|
+
const fields = readWorkflowState(state);
|
|
204
|
+
const step = { to: move.to, kind: move.kind, reason: move.reason, ts: Date.now() };
|
|
205
|
+
const update = {
|
|
206
|
+
workflowState: move.to,
|
|
240
207
|
// A successful transition clears an earlier rejection marker and starts the target's turn budget afresh.
|
|
241
208
|
...NO_PENDING_FAILURE,
|
|
242
209
|
stateTurns: null,
|
|
243
210
|
auditTrail: [step],
|
|
244
|
-
messages: [
|
|
245
|
-
toolReply(ADVANCE_TOOL, request.toolCallId, `Advanced to state '${result.to}'. You may now use the tools allowed in this state.`),
|
|
246
|
-
],
|
|
247
211
|
};
|
|
248
|
-
if (!
|
|
249
|
-
return {
|
|
250
|
-
}
|
|
212
|
+
if (!machine.isHumanState(move.to))
|
|
213
|
+
return { update };
|
|
251
214
|
// Into a human state: the park record is committed with the transition, so a
|
|
252
215
|
// process that dies before the closing turn still sees a parked session.
|
|
253
216
|
const seq = (fields.decisionCount ?? 0) + 1;
|
|
254
|
-
const park = decisionRecordFor(
|
|
217
|
+
const park = decisionRecordFor(machine, move.to, seq, move.evidence ?? []);
|
|
255
218
|
return {
|
|
256
|
-
|
|
257
|
-
...
|
|
219
|
+
update: {
|
|
220
|
+
...update,
|
|
258
221
|
pendingDecision: park,
|
|
259
222
|
decisionCount: seq,
|
|
260
223
|
status: WORKFLOW_STATUSES.awaitingDecision,
|
|
261
224
|
parkPhase: "closing",
|
|
225
|
+
},
|
|
226
|
+
park,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Why `from` may not be left for `to` right now, or `undefined` when it may: the
|
|
231
|
+
* kernel's transition verdict — the state's `requires` against `variables`, then
|
|
232
|
+
* the declared edge. Every refusal is recoverable: the mover sets what is owed,
|
|
233
|
+
* or picks a valid target.
|
|
234
|
+
*/
|
|
235
|
+
export function transitionRefusal(machine, from, to, variables) {
|
|
236
|
+
const verdict = decide(machine, { kind: "transition", from, to }, [], undefined, variables);
|
|
237
|
+
return verdict.decision === "block" ? (verdict.reason ?? `cannot advance from '${from}' to '${to}'.`) : undefined;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Evidence an advance attaches, validated for the target: accepted only into a
|
|
241
|
+
* human state, and only paths the session itself could read.
|
|
242
|
+
*/
|
|
243
|
+
export function advanceEvidence(machine, to, attached, mounts = NO_MOUNTS) {
|
|
244
|
+
if (attached.length === 0)
|
|
245
|
+
return { ok: true, paths: [] };
|
|
246
|
+
if (!machine.isHumanState(to)) {
|
|
247
|
+
return {
|
|
248
|
+
ok: false,
|
|
249
|
+
reason: `evidence can only be attached when advancing into a human decision state, and '${to}' ` +
|
|
250
|
+
`is not one — nothing would present it. Call again without 'evidence'.`,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return validateAdvanceEvidence(attached, mounts);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Service the session's agent's `archmax_advance`: validate the arguments, the
|
|
257
|
+
* evidence and the transition, then commit {@link transitionUpdate} with the
|
|
258
|
+
* reply the agent reads. A refusal leaves the session exactly where it was — no
|
|
259
|
+
* trail step — and replies without erroring the message, so the agent corrects
|
|
260
|
+
* the call rather than reading a failed run.
|
|
261
|
+
*/
|
|
262
|
+
export function handleAdvance(opts, request) {
|
|
263
|
+
const reply = (text) => toolReply(ADVANCE_TOOL, request.toolCallId, text);
|
|
264
|
+
const parsed = advanceSchema.safeParse(request.args);
|
|
265
|
+
if (!parsed.success) {
|
|
266
|
+
return {
|
|
267
|
+
message: refusal(ADVANCE_TOOL, request.toolCallId, `${ADVANCE_TOOL} rejected: invalid arguments — ${schemaIssues(parsed.error)}`),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const { to, reason } = parsed.data;
|
|
271
|
+
// Evidence is settled before the transition is attempted, so a refused
|
|
272
|
+
// attachment leaves the run exactly where it was.
|
|
273
|
+
const evidence = advanceEvidence(opts.machine, to, parsed.data.evidence ?? [], opts.mountPrefixes);
|
|
274
|
+
if (!evidence.ok)
|
|
275
|
+
return { message: refusal(ADVANCE_TOOL, request.toolCallId, `${ADVANCE_TOOL} rejected: ${evidence.reason}`) };
|
|
276
|
+
const from = currentWorkflowState(request.state, opts.machine.entry);
|
|
277
|
+
const refused = transitionRefusal(opts.machine, from, to, readVariables(request.state));
|
|
278
|
+
if (refused)
|
|
279
|
+
return { message: reply(`${ADVANCE_TOOL} rejected: ${refused}`) };
|
|
280
|
+
const { update, park } = transitionUpdate(opts.machine, request.state, {
|
|
281
|
+
to,
|
|
282
|
+
kind: "agent",
|
|
283
|
+
reason,
|
|
284
|
+
evidence: evidence.paths,
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
message: commit({
|
|
288
|
+
...update,
|
|
289
|
+
messages: [reply(`Advanced to state '${to}'. You may now use the tools allowed in this state.`)],
|
|
262
290
|
}),
|
|
263
|
-
moved: { from, to
|
|
291
|
+
moved: { from, to, reason, ...(park ? { park } : {}) },
|
|
264
292
|
};
|
|
265
293
|
}
|
|
266
294
|
// --- archmax_wait ----------------------------------------------------------------
|
|
@@ -364,9 +392,9 @@ export function entryStateOf(state, machine) {
|
|
|
364
392
|
return (triggerId ? machine.startStateForTrigger(triggerId) : undefined) ?? machine.entry;
|
|
365
393
|
}
|
|
366
394
|
/**
|
|
367
|
-
* Service a reset: move back to the entry state
|
|
368
|
-
*
|
|
369
|
-
*
|
|
395
|
+
* Service a reset: move back to the entry state. Evidence — messages, files,
|
|
396
|
+
* variables, the trail — is left alone: a reset moves the machine, not the
|
|
397
|
+
* history.
|
|
370
398
|
*/
|
|
371
399
|
export function handleReset(machine, request) {
|
|
372
400
|
const parsed = resetSchema.safeParse(request.args);
|
|
@@ -377,17 +405,26 @@ export function handleReset(machine, request) {
|
|
|
377
405
|
}
|
|
378
406
|
const from = currentWorkflowState(request.state, machine.entry);
|
|
379
407
|
const entry = entryStateOf(readWorkflowState(request.state), machine);
|
|
408
|
+
// The locks this run set are released, each value kept; the host's stay. A
|
|
409
|
+
// boundary write is the only one the merge accepts over a lock.
|
|
410
|
+
const released = Object.entries(readVariables(request.state)).filter(([, held]) => held.locked && held.lockedBy === "agent");
|
|
380
411
|
return {
|
|
381
412
|
message: commit({
|
|
382
413
|
workflowState: entry,
|
|
383
|
-
iterations: {},
|
|
384
|
-
beforeDone: {},
|
|
385
414
|
...NO_PENDING_FAILURE,
|
|
386
415
|
stateTurns: null,
|
|
387
416
|
auditTrail: [{ to: entry, kind: "reset", reason: parsed.data.reason, ts: Date.now() }],
|
|
417
|
+
...(released.length > 0
|
|
418
|
+
? {
|
|
419
|
+
variables: Object.fromEntries(released.map(([name, held]) => [name, { value: held.value, locked: false, reseed: true }])),
|
|
420
|
+
}
|
|
421
|
+
: {}),
|
|
388
422
|
messages: [
|
|
389
|
-
toolReply(RESET_TOOL, request.toolCallId, `Reset to state '${entry}'.
|
|
390
|
-
`
|
|
423
|
+
toolReply(RESET_TOOL, request.toolCallId, `Reset to state '${entry}'. Earlier work in the conversation and in scratchpad/ is ` +
|
|
424
|
+
`untouched.` +
|
|
425
|
+
(released.length > 0
|
|
426
|
+
? ` The locks you set are released: ${released.map(([name]) => `'${name}'`).join(", ")} can be written again.`
|
|
427
|
+
: "")),
|
|
391
428
|
],
|
|
392
429
|
}),
|
|
393
430
|
moved: { from, to: entry },
|
|
@@ -415,9 +452,9 @@ function callsInMessageOf(state, toolCallId) {
|
|
|
415
452
|
* Service a raise: end the session as a failure in the state it was called in.
|
|
416
453
|
* Commits the record and `status: failed`, and drops a pending rejection — the
|
|
417
454
|
* agent's own account of the failure is what the session ends with. The turn
|
|
418
|
-
* ends at the next model hook; nothing routes and
|
|
419
|
-
* session left in place, for invalid arguments or a message making other
|
|
420
|
-
* those run concurrently, so a raise beside them could not mean one thing.
|
|
455
|
+
* ends at the next model hook; nothing routes and nothing further runs. Refused,
|
|
456
|
+
* with the session left in place, for invalid arguments or a message making other
|
|
457
|
+
* calls: those run concurrently, so a raise beside them could not mean one thing.
|
|
421
458
|
*/
|
|
422
459
|
export function handleRaise(machine, request) {
|
|
423
460
|
const refuse = (text) => ({ message: refusal(RAISE_TOOL, request.toolCallId, text) });
|
|
@@ -516,6 +553,16 @@ fileRefusal) {
|
|
|
516
553
|
return refuse(`${SET_VARIABLES_TOOL} rejected: '${name}' is locked and cannot be changed ` +
|
|
517
554
|
`(current value: ${JSON.stringify(store[name]?.value)}). Nothing was written.`);
|
|
518
555
|
}
|
|
556
|
+
// An owned variable is decided in its owner alone, and stays changeable there.
|
|
557
|
+
const owner = machine?.ownerOf(name);
|
|
558
|
+
if (owner !== undefined && owner !== currentWorkflowState(request.state, machine.entry)) {
|
|
559
|
+
return refuse(`${SET_VARIABLES_TOOL} rejected: '${name}' belongs to state '${owner}': only '${owner}' can ` +
|
|
560
|
+
`change it. Go back to '${owner}' to change it. Nothing was written.`);
|
|
561
|
+
}
|
|
562
|
+
if (owner !== undefined && lock === true) {
|
|
563
|
+
return refuse(`${SET_VARIABLES_TOOL} rejected: '${name}' belongs to this state, '${owner}', so it stays ` +
|
|
564
|
+
`changeable here and cannot be locked. Retry without \`lock\`. Nothing was written.`);
|
|
565
|
+
}
|
|
519
566
|
if (name === TITLE_VARIABLE) {
|
|
520
567
|
// Refused, not silently dropped: an agent that believes it locked the title must not be lied to.
|
|
521
568
|
if (lock === true) {
|
|
@@ -539,7 +586,7 @@ fileRefusal) {
|
|
|
539
586
|
delta[name] =
|
|
540
587
|
name === TITLE_VARIABLE
|
|
541
588
|
? { value: normalizeTitle(value), locked: false }
|
|
542
|
-
: { value, locked };
|
|
589
|
+
: { value, locked, ...(locked ? { lockedBy: "agent" } : {}) };
|
|
543
590
|
}
|
|
544
591
|
return {
|
|
545
592
|
message: toolReply(SET_VARIABLES_TOOL, request.toolCallId, `Set ${names.join(", ")}${locked ? " (locked)" : ""}.`),
|
|
@@ -592,10 +639,7 @@ export function setVariablesCommand(outcome) {
|
|
|
592
639
|
return outcome.message;
|
|
593
640
|
return commit({ variables: outcome.delta, messages: [outcome.message] });
|
|
594
641
|
}
|
|
595
|
-
|
|
596
|
-
export function unmetRequirements(required, store) {
|
|
597
|
-
return required.filter((name) => store[name] === undefined);
|
|
598
|
-
}
|
|
642
|
+
export { unmetRequirements } from "../kernel/kernel.js";
|
|
599
643
|
/**
|
|
600
644
|
* The wording for a `${{…}}` reference in the agent's own tool arguments that
|
|
601
645
|
* could not be resolved: a correctable refusal carrying the two fixes it might
|