@archmax-ai/harness 0.9.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.
Files changed (207) hide show
  1. package/README.md +58 -14
  2. package/dist/agent.d.ts +4 -6
  3. package/dist/agent.js +4 -6
  4. package/dist/agent.js.map +1 -1
  5. package/dist/assembly/compose.d.ts +5 -24
  6. package/dist/assembly/compose.js +28 -42
  7. package/dist/assembly/compose.js.map +1 -1
  8. package/dist/assembly/delegation-registry.js +3 -14
  9. package/dist/assembly/delegation-registry.js.map +1 -1
  10. package/dist/assembly/index.d.ts +8 -15
  11. package/dist/assembly/index.js +21 -28
  12. package/dist/assembly/index.js.map +1 -1
  13. package/dist/assembly/plain.js +1 -2
  14. package/dist/assembly/plain.js.map +1 -1
  15. package/dist/authoring-skill/archmax-harness/README.md +5 -5
  16. package/dist/authoring-skill/archmax-harness/SKILL.md +72 -30
  17. package/dist/authoring-skill/archmax-harness/references/backend-integration.md +33 -24
  18. package/dist/authoring-skill/archmax-harness/references/cases.md +41 -8
  19. package/dist/authoring-skill/archmax-harness/references/{hook-and-test-scripts.md → code-state-and-test-scripts.md} +599 -339
  20. package/dist/authoring-skill/archmax-harness/references/code-states-and-scripts.md +115 -0
  21. package/dist/authoring-skill/archmax-harness/references/diagnostics.md +40 -7
  22. package/dist/authoring-skill/archmax-harness/references/wiring.md +19 -10
  23. package/dist/authoring-skill/archmax-harness/references/workflow-schema.md +404 -293
  24. package/dist/authoring-skill/archmax-harness/references/workflow-yaml.md +151 -62
  25. package/dist/cli/state-flow.d.ts +1 -1
  26. package/dist/cli/state-flow.js +18 -28
  27. package/dist/cli/state-flow.js.map +1 -1
  28. package/dist/cli/turn.d.ts +1 -1
  29. package/dist/cli/turn.js +1 -1
  30. package/dist/core/code-description.d.ts +3 -3
  31. package/dist/core/code-description.js +3 -3
  32. package/dist/core/deepagents.d.ts +5 -12
  33. package/dist/core/deepagents.js +4 -17
  34. package/dist/core/deepagents.js.map +1 -1
  35. package/dist/core/events.d.ts +23 -42
  36. package/dist/core/events.js +21 -24
  37. package/dist/core/events.js.map +1 -1
  38. package/dist/core/message-readers.d.ts +4 -5
  39. package/dist/core/message-readers.js +3 -8
  40. package/dist/core/message-readers.js.map +1 -1
  41. package/dist/core/messages.d.ts +0 -22
  42. package/dist/core/messages.js +1 -32
  43. package/dist/core/messages.js.map +1 -1
  44. package/dist/core/mounts.js +3 -3
  45. package/dist/core/platform-prompt.generated.js +1 -1
  46. package/dist/core/platform-prompt.generated.js.map +1 -1
  47. package/dist/core/session-zone.d.ts +1 -1
  48. package/dist/core/session-zone.js +1 -1
  49. package/dist/core/workspace-context.d.ts +1 -1
  50. package/dist/core/workspace.d.ts +1 -1
  51. package/dist/core/workspace.js +1 -1
  52. package/dist/core/zones.d.ts +4 -4
  53. package/dist/core/zones.js +5 -5
  54. package/dist/core/zones.js.map +1 -1
  55. package/dist/env.d.ts +9 -9
  56. package/dist/index.d.ts +3 -7
  57. package/dist/index.js +2 -4
  58. package/dist/index.js.map +1 -1
  59. package/dist/kernel/kernel.d.ts +31 -61
  60. package/dist/kernel/kernel.js +54 -112
  61. package/dist/kernel/kernel.js.map +1 -1
  62. package/dist/machine/lint-spec.js +53 -12
  63. package/dist/machine/lint-spec.js.map +1 -1
  64. package/dist/machine/machine.d.ts +36 -18
  65. package/dist/machine/machine.js +62 -51
  66. package/dist/machine/machine.js.map +1 -1
  67. package/dist/machine/spec-schema.d.ts +32 -180
  68. package/dist/machine/spec-schema.js +52 -113
  69. package/dist/machine/spec-schema.js.map +1 -1
  70. package/dist/machine/tool-names.d.ts +34 -16
  71. package/dist/machine/tool-names.js +41 -16
  72. package/dist/machine/tool-names.js.map +1 -1
  73. package/dist/machine/types.d.ts +14 -46
  74. package/dist/machine/types.js +0 -2
  75. package/dist/machine/types.js.map +1 -1
  76. package/dist/machine/validate-spec.d.ts +1 -1
  77. package/dist/public/sandbox.d.ts +59 -95
  78. package/dist/public/sandbox.js +22 -23
  79. package/dist/public/sandbox.js.map +1 -1
  80. package/dist/public/spec.d.ts +13 -20
  81. package/dist/public/spec.js +12 -20
  82. package/dist/public/spec.js.map +1 -1
  83. package/dist/runtime/contract.d.ts +11 -12
  84. package/dist/runtime/contract.js +16 -16
  85. package/dist/runtime/contract.js.map +1 -1
  86. package/dist/sandbox/assets/parts/code-state.js +17 -0
  87. package/dist/sandbox/executor.d.ts +25 -7
  88. package/dist/sandbox/executor.js +56 -57
  89. package/dist/sandbox/executor.js.map +1 -1
  90. package/dist/sandbox/imports.d.ts +10 -10
  91. package/dist/sandbox/imports.js +11 -11
  92. package/dist/sandbox/imports.js.map +1 -1
  93. package/dist/sandbox/prelude.d.ts +5 -6
  94. package/dist/sandbox/prelude.js +38 -35
  95. package/dist/sandbox/prelude.js.map +1 -1
  96. package/dist/sandbox/ptc-gateway.d.ts +19 -18
  97. package/dist/sandbox/ptc-gateway.js +26 -22
  98. package/dist/sandbox/ptc-gateway.js.map +1 -1
  99. package/dist/sessions/resume.d.ts +2 -2
  100. package/dist/sessions/resume.js +1 -1
  101. package/dist/sessions/resume.js.map +1 -1
  102. package/dist/sessions/scope.d.ts +0 -10
  103. package/dist/sessions/scope.js +0 -17
  104. package/dist/sessions/scope.js.map +1 -1
  105. package/dist/sessions/summary.d.ts +1 -1
  106. package/dist/testing/assertions.js +9 -4
  107. package/dist/testing/assertions.js.map +1 -1
  108. package/dist/testing/driver.js +3 -0
  109. package/dist/testing/driver.js.map +1 -1
  110. package/dist/testing/interpreter.d.ts +2 -2
  111. package/dist/testing/runner.d.ts +2 -2
  112. package/dist/validate/validate.d.ts +1 -1
  113. package/dist/validate/validate.js +39 -70
  114. package/dist/validate/validate.js.map +1 -1
  115. package/dist/workflow/automated-controls.d.ts +63 -0
  116. package/dist/workflow/automated-controls.js +158 -0
  117. package/dist/workflow/automated-controls.js.map +1 -0
  118. package/dist/workflow/automated.d.ts +112 -0
  119. package/dist/workflow/automated.js +163 -0
  120. package/dist/workflow/automated.js.map +1 -0
  121. package/dist/workflow/code-state.d.ts +46 -0
  122. package/dist/workflow/code-state.js +26 -0
  123. package/dist/workflow/code-state.js.map +1 -0
  124. package/dist/workflow/control-tools.d.ts +54 -23
  125. package/dist/workflow/control-tools.js +99 -79
  126. package/dist/workflow/control-tools.js.map +1 -1
  127. package/dist/workflow/file-values.d.ts +4 -4
  128. package/dist/workflow/file-values.js +1 -1
  129. package/dist/workflow/file-values.js.map +1 -1
  130. package/dist/workflow/governance.d.ts +11 -22
  131. package/dist/workflow/governance.js +47 -104
  132. package/dist/workflow/governance.js.map +1 -1
  133. package/dist/workflow/grader-state.d.ts +55 -0
  134. package/dist/workflow/grader-state.js +182 -0
  135. package/dist/workflow/grader-state.js.map +1 -0
  136. package/dist/workflow/history.d.ts +11 -0
  137. package/dist/{lifecycle/transcript.js → workflow/history.js} +24 -8
  138. package/dist/workflow/history.js.map +1 -0
  139. package/dist/workflow/middleware.d.ts +14 -17
  140. package/dist/workflow/middleware.js +109 -95
  141. package/dist/workflow/middleware.js.map +1 -1
  142. package/dist/workflow/move-events.d.ts +21 -0
  143. package/dist/workflow/move-events.js +20 -0
  144. package/dist/workflow/move-events.js.map +1 -0
  145. package/dist/workflow/on-error.js +0 -2
  146. package/dist/workflow/on-error.js.map +1 -1
  147. package/dist/workflow/parks.d.ts +9 -2
  148. package/dist/workflow/parks.js +16 -10
  149. package/dist/workflow/parks.js.map +1 -1
  150. package/dist/workflow/paths.d.ts +9 -9
  151. package/dist/workflow/paths.js +19 -19
  152. package/dist/workflow/paths.js.map +1 -1
  153. package/dist/workflow/render-prompt.d.ts +7 -5
  154. package/dist/workflow/render-prompt.js +22 -37
  155. package/dist/workflow/render-prompt.js.map +1 -1
  156. package/dist/workflow/signature-checks.d.ts +2 -2
  157. package/dist/workflow/snapshot.js +5 -29
  158. package/dist/workflow/snapshot.js.map +1 -1
  159. package/dist/workflow/state.d.ts +14 -42
  160. package/dist/workflow/state.js +20 -33
  161. package/dist/workflow/state.js.map +1 -1
  162. package/dist/workflow/sub-workflow.d.ts +3 -3
  163. package/dist/workflow/sub-workflow.js +3 -7
  164. package/dist/workflow/sub-workflow.js.map +1 -1
  165. package/dist/workflow/tool-service.d.ts +1 -9
  166. package/dist/workflow/tool-service.js +21 -24
  167. package/dist/workflow/tool-service.js.map +1 -1
  168. package/dist/workflow/turn-boundary.d.ts +2 -2
  169. package/dist/workflow/turn-boundary.js +10 -15
  170. package/dist/workflow/turn-boundary.js.map +1 -1
  171. package/dist/workflow/turn-runner.js +5 -6
  172. package/dist/workflow/turn-runner.js.map +1 -1
  173. package/package.json +1 -1
  174. package/skills/archmax-harness/README.md +5 -5
  175. package/skills/archmax-harness/SKILL.md +72 -30
  176. package/skills/archmax-harness/references/backend-integration.md +33 -24
  177. package/skills/archmax-harness/references/cases.md +41 -8
  178. package/skills/archmax-harness/references/{hook-and-test-scripts.md → code-state-and-test-scripts.md} +599 -339
  179. package/skills/archmax-harness/references/code-states-and-scripts.md +115 -0
  180. package/skills/archmax-harness/references/diagnostics.md +40 -7
  181. package/skills/archmax-harness/references/wiring.md +19 -10
  182. package/skills/archmax-harness/references/workflow-schema.md +404 -293
  183. package/skills/archmax-harness/references/workflow-yaml.md +151 -62
  184. package/dist/authoring-skill/archmax-harness/references/hooks-and-scripts.md +0 -89
  185. package/dist/lifecycle/hook-shape.d.ts +0 -44
  186. package/dist/lifecycle/hook-shape.js +0 -66
  187. package/dist/lifecycle/hook-shape.js.map +0 -1
  188. package/dist/lifecycle/runner.d.ts +0 -197
  189. package/dist/lifecycle/runner.js +0 -419
  190. package/dist/lifecycle/runner.js.map +0 -1
  191. package/dist/lifecycle/tool-calls.d.ts +0 -9
  192. package/dist/lifecycle/tool-calls.js +0 -57
  193. package/dist/lifecycle/tool-calls.js.map +0 -1
  194. package/dist/lifecycle/transcript.d.ts +0 -31
  195. package/dist/lifecycle/transcript.js.map +0 -1
  196. package/dist/rubrics/rubrics.d.ts +0 -135
  197. package/dist/rubrics/rubrics.js +0 -145
  198. package/dist/rubrics/rubrics.js.map +0 -1
  199. package/dist/sandbox/assets/parts/core.js +0 -22
  200. package/dist/sandbox/assets/parts/lifecycle-hook.js +0 -47
  201. package/dist/sandbox/bridge.d.ts +0 -16
  202. package/dist/sandbox/bridge.js +0 -95
  203. package/dist/sandbox/bridge.js.map +0 -1
  204. package/dist/workflow/visits.d.ts +0 -21
  205. package/dist/workflow/visits.js +0 -45
  206. package/dist/workflow/visits.js.map +0 -1
  207. package/skills/archmax-harness/references/hooks-and-scripts.md +0 -89
@@ -1,197 +0,0 @@
1
- import type { RunnableConfig } from "@langchain/core/runnables";
2
- import type { StructuredTool } from "@langchain/core/tools";
3
- import { type ScriptExecutor, type ScriptOutcome } from "../sandbox/executor.js";
4
- import type { WorkflowMachine } from "../machine/machine.js";
5
- import type { Hook } from "../machine/types.js";
6
- import { type Rubric } from "../rubrics/rubrics.js";
7
- import type { VariableStore } from "../machine/variables.js";
8
- import type { VisitSpan } from "../workflow/visits.js";
9
- import { type WorkflowEventHandler } from "../core/events.js";
10
- export type LifecycleVerdict = "ok" | "correct" | "veto";
11
- /** What a hook said, once its return value has been read. */
12
- export interface LifecycleDecision {
13
- verdict: LifecycleVerdict;
14
- reason: string;
15
- rubric?: string;
16
- }
17
- /**
18
- * Interpret a lifecycle hook's return value into a decision, an error, or
19
- * `null` (no opinion — proceed).
20
- *
21
- * **One contract for every hook kind**, the one `HookResult` declares: a verdict
22
- * object decides, a bare `false` vetoes, returning nothing is `ok`, and any
23
- * *other* object fails closed with its keys named. A hook's return value is its
24
- * verdict and nothing else, so an object that is not one is a verdict its author
25
- * got wrong; reading it as `ok` would silently permit what the hook meant to
26
- * block, with nothing said.
27
- *
28
- * A **script** hook's value arrives already reduced — the sandbox wrapper
29
- * applies the same rules and throws on the last one — so what reaches here from
30
- * a script is a verdict or an error outcome. The rules are restated because a
31
- * custom `hookExecutors` kind hands its value through raw, and a consumer's
32
- * executor is held to the same contract as a script: one governance vocabulary,
33
- * whoever implements the kind.
34
- */
35
- export declare function parseLifecycleDecision(outcome: ScriptOutcome): LifecycleDecision | {
36
- error: string;
37
- } | null;
38
- export interface LifecycleContext {
39
- sessionId: string;
40
- tools: StructuredTool[];
41
- /** The session's whole transcript. */
42
- messages: unknown[];
43
- /** Its visits, in order; the last is the one a hook sees. Absent, the whole transcript is one visit. */
44
- visits?: VisitSpan[];
45
- taskTool?: StructuredTool;
46
- config: RunnableConfig;
47
- /**
48
- * Grade-and-retry iterations already spent, keyed per hook by
49
- * {@link iterationKey} — not per state. Two `after` hooks on one state have
50
- * independent budgets, and a hook that passes cannot clear the count of the
51
- * one still asking for corrections (issue #62).
52
- */
53
- iterations: Record<string, number>;
54
- /**
55
- * The trigger that started the run (`id` + optional `args`), read from
56
- * checkpointed state. Merged into every hook's script arguments so a
57
- * `before`/`after` script can read how the run began.
58
- */
59
- trigger?: {
60
- id: string;
61
- };
62
- /**
63
- * The run's variables at the time the hook runs, as a plain `name → value`
64
- * map. Read-only by construction: the sandbox gets a serialized copy. A hook
65
- * that could *write* variables would be editing the governance inputs of the
66
- * state it judges, which is why the variable tools are excluded from PTC.
67
- */
68
- variables?: Record<string, unknown>;
69
- /**
70
- * The same variables as the checkpointed **store** — value plus lock state —
71
- * for the kernel's `requires` gate. Must be the run's real store: omitted, the
72
- * kernel sees an empty store and refuses to leave any state that declares
73
- * `requires`.
74
- */
75
- variableStore?: VariableStore;
76
- /**
77
- * The abort signal of the turn the hook runs in, read where the hook runs,
78
- * not `config`'s, which is captured at the session's last model call. Once it
79
- * aborts, a script hook's eval settles with an error and its calls are refused.
80
- */
81
- signal?: AbortSignal;
82
- }
83
- /**
84
- * A phase rejection: why the hook phase blocked, and whether the failure is
85
- * **terminal** — a hook execution error or an exhausted correction budget,
86
- * which retrying in place cannot fix (the turn ends rejected, subject to
87
- * `on_error` routing) — as opposed to a recoverable rejection (a deliberate
88
- * veto or a correction with attempts remaining), where the agent stays in the
89
- * state to try again.
90
- */
91
- export interface PhaseRejection {
92
- reason: string;
93
- terminal: boolean;
94
- }
95
- /**
96
- * The result of {@link LifecycleRunner.attemptTransition}: whether the
97
- * transition passed its hooks, and the resulting judge-correction counts for
98
- * the caller to commit to the checkpoint. Correction counts advance even on a
99
- * rejection (a consumed judge correction), so they are returned in both cases.
100
- * `terminal` marks a rejection retrying cannot fix (see {@link PhaseRejection}).
101
- */
102
- export type TransitionOutcome = {
103
- ok: true;
104
- from: string;
105
- to: string;
106
- corrections: Record<string, number>;
107
- } | {
108
- ok: false;
109
- reason: string;
110
- terminal: boolean;
111
- corrections: Record<string, number>;
112
- };
113
- /**
114
- * Executes one lifecycle hook of a given kind, returning the raw
115
- * {@link ScriptOutcome} the runner reduces (parse → kernel verdict → events), so
116
- * every hook kind flows through the same fail-closed path. `script` and
117
- * `rubric` are built in; consumers register additional kinds via
118
- * `createAgent`'s `hookExecutors` option. An executor that throws or returns an
119
- * error outcome vetoes the transition.
120
- */
121
- export type HookExecutor = (hook: Hook, ctx: LifecycleContext, args: Record<string, unknown>) => Promise<ScriptOutcome>;
122
- /**
123
- * Resolves a hook's declared `script:` value to the authoring-plane path its
124
- * source lives at, or refuses it with a reason (see `resolveHookScript`).
125
- */
126
- export type HookScriptResolver = (declared: string) => {
127
- ok: true;
128
- path: string;
129
- } | {
130
- ok: false;
131
- reason: string;
132
- };
133
- /** The built-in hook kinds, which consumer executors may not shadow. */
134
- export declare const BUILTIN_HOOK_KINDS: readonly ["script", "rubric"];
135
- /**
136
- * Runs deterministic `before`/`after` hooks (scripts or grading rubrics) at the
137
- * machine's fixed points, in the same backend-backed interpreter as the model's
138
- * own sandbox tool calls.
139
- */
140
- export declare class LifecycleRunner {
141
- private readonly machine;
142
- private readonly executor;
143
- private readonly rubrics;
144
- private readonly ptcNames;
145
- private readonly emit;
146
- /** Hook kind → executor. Built-ins (`script`, `rubric`) plus registered custom kinds. */
147
- private readonly hookExecutors;
148
- /**
149
- * Maps a hook's declared `script:` value to the path its source is read from.
150
- * Injected so the runner stays ignorant of workspace layout: the harness binds
151
- * it to the running workflow (workflow-relative, confined to `hooks/`). The
152
- * identity default keeps a bare runner working.
153
- */
154
- private readonly resolveScript;
155
- /**
156
- * Per session: the `toolCalls` host function its hooks' sandbox was handed
157
- * (a sandbox keeps its first tools, and a call carries no session), and the
158
- * context of the hook running now, which that function reads. A session's
159
- * hooks run one at a time.
160
- */
161
- private readonly toolCallQueries;
162
- private readonly hookContexts;
163
- /** Deprecations already reported — each is said once per assembly. */
164
- constructor(machine: WorkflowMachine, executor: ScriptExecutor, rubrics: Map<string, Rubric>, ptcNames: string[], hookExecutors?: Record<string, HookExecutor>, onEvent?: WorkflowEventHandler, opts?: {
165
- resolveScript?: HookScriptResolver;
166
- });
167
- resolvePtcTools(allTools: unknown[]): StructuredTool[];
168
- /**
169
- * The runtime's own dispatch for an inline grader, through the framework
170
- * `task` tool. Reached only by {@link runRubric} — never wired into a script's
171
- * sandbox, which has no name to dispatch by.
172
- */
173
- private rubricDispatch;
174
- private runScript;
175
- private runRubric;
176
- /**
177
- * Dispatch a single tagged hook through its kind's registered executor.
178
- * An unknown kind (no registered executor) produces an error outcome that
179
- * reduces to a fail-closed veto — the same path as any hook execution error.
180
- */
181
- private runHook;
182
- private applyDecision;
183
- runPhase(state: string, phase: "before" | "after", ctx: LifecycleContext, extraArgs?: Record<string, unknown>, veto?: boolean): Promise<PhaseRejection | null>;
184
- private runSingleHook;
185
- attemptTransition(from: string, to: string, ctx: LifecycleContext, reason?: string,
186
- /**
187
- * The tool call driving this attempt, when one is. Carried onto the `advance`
188
- * event so a consumer can attribute the transition to the call that made it;
189
- * a transition the runtime itself performs passes nothing.
190
- */
191
- options?: {
192
- callId?: string;
193
- }): Promise<TransitionOutcome>;
194
- dispose(sessionId: string): void;
195
- /** The session's `toolCalls` host function, answering from the hook context running now. */
196
- private toolCallQuery;
197
- }
@@ -1,419 +0,0 @@
1
- import { tool } from "langchain";
2
- import { z } from "zod";
3
- import { runContextFromMessages } from "../core/messages.js";
4
- import { createSubagentBridgeDispatch } from "../sandbox/bridge.js";
5
- import { PROCESS_SESSION, } from "../sandbox/executor.js";
6
- import { resolvePtcTools } from "../sandbox/tools.js";
7
- import { afterHookLabel, hookKind, hookMaxIterations, iterationKey } from "./hook-shape.js";
8
- import { queryToolCalls } from "./tool-calls.js";
9
- import { hookTranscript } from "./transcript.js";
10
- import { buildRubricTaskDescription, isRubricVerdict, resolveRubricResponseFormat, rubricId, } from "../rubrics/rubrics.js";
11
- import { TOOL_CALLS_QUERY } from "../machine/tool-names.js";
12
- import { releaseScopes } from "../sessions/scope.js";
13
- import { createWorkflowEventEmitter, } from "../core/events.js";
14
- import { decide, reduceHookFact } from "../kernel/kernel.js";
15
- /**
16
- * Interpret a lifecycle hook's return value into a decision, an error, or
17
- * `null` (no opinion — proceed).
18
- *
19
- * **One contract for every hook kind**, the one `HookResult` declares: a verdict
20
- * object decides, a bare `false` vetoes, returning nothing is `ok`, and any
21
- * *other* object fails closed with its keys named. A hook's return value is its
22
- * verdict and nothing else, so an object that is not one is a verdict its author
23
- * got wrong; reading it as `ok` would silently permit what the hook meant to
24
- * block, with nothing said.
25
- *
26
- * A **script** hook's value arrives already reduced — the sandbox wrapper
27
- * applies the same rules and throws on the last one — so what reaches here from
28
- * a script is a verdict or an error outcome. The rules are restated because a
29
- * custom `hookExecutors` kind hands its value through raw, and a consumer's
30
- * executor is held to the same contract as a script: one governance vocabulary,
31
- * whoever implements the kind.
32
- */
33
- export function parseLifecycleDecision(outcome) {
34
- if (!outcome.ok)
35
- return { error: outcome.error?.message ?? "script error" };
36
- const value = outcome.value;
37
- if (isRubricVerdict(value)) {
38
- return {
39
- verdict: value.verdict,
40
- reason: value.reason,
41
- ...(value.rubric !== undefined ? { rubric: value.rubric } : {}),
42
- };
43
- }
44
- if (value === false)
45
- return { verdict: "veto", reason: "precondition not met" };
46
- if (value !== null && typeof value === "object") {
47
- return {
48
- error: `hook returned ${describeNonVerdict(value)}, which is not a verdict — return ` +
49
- `{ verdict: "ok" | "correct" | "veto", reason }, false, or nothing at all`,
50
- };
51
- }
52
- return null;
53
- }
54
- /**
55
- * Name a non-verdict object by its keys, never its values, so a diagnostic
56
- * cannot leak what the hook was inspecting. Mirrors `__hookShape` in the
57
- * sandbox prelude, which does the same for a script hook.
58
- */
59
- function describeNonVerdict(value) {
60
- if (Array.isArray(value))
61
- return "an array";
62
- const keys = Object.keys(value);
63
- if (keys.length === 0)
64
- return "an object with no keys";
65
- const shown = keys
66
- .slice(0, 6)
67
- .map((key) => `'${key}'`)
68
- .join(", ");
69
- return `an object with ${keys.length > 6 ? "keys including " : "keys "}${shown}`;
70
- }
71
- /** The built-in hook kinds, which consumer executors may not shadow. */
72
- export const BUILTIN_HOOK_KINDS = ["script", "rubric"];
73
- /** Short raw-output excerpt surfaced when a judge response cannot be parsed. */
74
- function snippet(value) {
75
- let text;
76
- try {
77
- text = typeof value === "string" ? value : JSON.stringify(value);
78
- }
79
- catch {
80
- text = String(value);
81
- }
82
- if (text === undefined || text === "undefined")
83
- text = "(no output)";
84
- return text.length > 200 ? `${text.slice(0, 200)}…` : text;
85
- }
86
- /**
87
- * Runs deterministic `before`/`after` hooks (scripts or grading rubrics) at the
88
- * machine's fixed points, in the same backend-backed interpreter as the model's
89
- * own sandbox tool calls.
90
- */
91
- export class LifecycleRunner {
92
- machine;
93
- executor;
94
- rubrics;
95
- ptcNames;
96
- emit;
97
- /** Hook kind → executor. Built-ins (`script`, `rubric`) plus registered custom kinds. */
98
- hookExecutors;
99
- /**
100
- * Maps a hook's declared `script:` value to the path its source is read from.
101
- * Injected so the runner stays ignorant of workspace layout: the harness binds
102
- * it to the running workflow (workflow-relative, confined to `hooks/`). The
103
- * identity default keeps a bare runner working.
104
- */
105
- resolveScript;
106
- /**
107
- * Per session: the `toolCalls` host function its hooks' sandbox was handed
108
- * (a sandbox keeps its first tools, and a call carries no session), and the
109
- * context of the hook running now, which that function reads. A session's
110
- * hooks run one at a time.
111
- */
112
- toolCallQueries = new Map();
113
- hookContexts = new Map();
114
- /** Deprecations already reported — each is said once per assembly. */
115
- constructor(machine, executor, rubrics, ptcNames, hookExecutors, onEvent, opts = {}) {
116
- this.machine = machine;
117
- this.executor = executor;
118
- this.rubrics = rubrics;
119
- this.ptcNames = ptcNames;
120
- this.emit = createWorkflowEventEmitter(onEvent);
121
- this.resolveScript = opts.resolveScript ?? ((declared) => ({ ok: true, path: declared }));
122
- // Built-ins first; consumer executors add kinds alongside them (built-ins
123
- // are non-shadowable, enforced at assembly).
124
- this.hookExecutors = new Map([
125
- ["script", (hook, ctx, args) => this.runScript(String(hook.script), ctx, args)],
126
- ]);
127
- for (const [kind, exec] of Object.entries(hookExecutors ?? {})) {
128
- this.hookExecutors.set(kind, exec);
129
- }
130
- }
131
- resolvePtcTools(allTools) {
132
- return resolvePtcTools(allTools, this.ptcNames);
133
- }
134
- /**
135
- * The runtime's own dispatch for an inline grader, through the framework
136
- * `task` tool. Reached only by {@link runRubric} — never wired into a script's
137
- * sandbox, which has no name to dispatch by.
138
- */
139
- rubricDispatch(ctx, lifecycleArgs) {
140
- if (!ctx.taskTool)
141
- return undefined;
142
- const base = createSubagentBridgeDispatch(ctx.taskTool, ctx.config, {
143
- emit: this.emit,
144
- ...(typeof lifecycleArgs.state === "string" ? { state: lifecycleArgs.state } : {}),
145
- });
146
- return async (input) => {
147
- const rubric = this.rubrics.get(input.subagentType);
148
- const description = input.description?.trim() ||
149
- buildRubricTaskDescription({ ...lifecycleArgs, ...runContextFromMessages(ctx.messages, visitStartOf(ctx)) });
150
- const responseSchema = input.responseSchema ?? (rubric ? resolveRubricResponseFormat(rubric) : undefined);
151
- return base({
152
- description,
153
- subagentType: input.subagentType,
154
- ...(responseSchema !== undefined
155
- ? { responseSchema: responseSchema }
156
- : {}),
157
- });
158
- };
159
- }
160
- async runScript(script, ctx, args) {
161
- // A hook that cannot be placed is a hook that cannot be trusted: refusing
162
- // here produces an error outcome, and an errored hook vetoes fail-closed —
163
- // the same posture as a hook that throws.
164
- const resolved = this.resolveScript(script);
165
- if (!resolved.ok) {
166
- return {
167
- ok: false,
168
- value: undefined,
169
- logs: [],
170
- error: { message: resolved.reason },
171
- formatted: `error: ${resolved.reason}`,
172
- };
173
- }
174
- this.hookContexts.set(ctx.sessionId, ctx);
175
- return this.executor.runFile(resolved.path, {
176
- sessionId: ctx.sessionId,
177
- sessionNamespace: PROCESS_SESSION,
178
- args,
179
- tools: [...ctx.tools, this.toolCallQuery(ctx.sessionId)],
180
- // No `task()` for a script hook: an inline rubric has no name a script
181
- // could pass, so there is nothing to dispatch by. A script that wants a
182
- // model verdict gets a `rubric` hook declared beside it in the same list.
183
- lifecycle: true,
184
- ...(ctx.signal ? { signal: ctx.signal } : {}),
185
- });
186
- }
187
- async runRubric(name, ctx, args) {
188
- const dispatch = this.rubricDispatch(ctx, args);
189
- if (!dispatch) {
190
- const message = `rubric '${name}' could not be dispatched (no task tool)`;
191
- return { ok: false, value: undefined, logs: [], error: { message }, formatted: `error: ${message}` };
192
- }
193
- const rubric = this.rubrics.get(name);
194
- const responseSchema = rubric ? resolveRubricResponseFormat(rubric) : undefined;
195
- try {
196
- const value = await dispatch({
197
- subagentType: name,
198
- // The grader's payload keeps the compact `userRequest`/`history` view a
199
- // rubric's `instructions` are written against.
200
- description: buildRubricTaskDescription({ ...args, ...runContextFromMessages(ctx.messages, visitStartOf(ctx)) }),
201
- ...(responseSchema !== undefined ? { responseSchema } : {}),
202
- });
203
- // Fail closed on unreadable grader output, exactly like a thrown error: a
204
- // grader whose verdict cannot be read has approved nothing.
205
- const verdict = value && typeof value === "object" && isRubricVerdict(value)
206
- ? { ...value, rubric: name }
207
- : {
208
- verdict: "veto",
209
- reason: `rubric '${name}' returned no parseable verdict: ${snippet(value)}`,
210
- rubric: name,
211
- };
212
- return { ok: true, value: verdict, logs: [], formatted: JSON.stringify(verdict) };
213
- }
214
- catch (err) {
215
- const message = err.message ?? String(err);
216
- return { ok: false, value: undefined, logs: [], error: { message }, formatted: `error: ${message}` };
217
- }
218
- }
219
- /**
220
- * Dispatch a single tagged hook through its kind's registered executor.
221
- * An unknown kind (no registered executor) produces an error outcome that
222
- * reduces to a fail-closed veto — the same path as any hook execution error.
223
- */
224
- async runHook(hook, ctx, args, at) {
225
- const kind = hookKind(hook);
226
- // `rubric` is serviced here rather than through the executor map, because
227
- // dispatching an inline grader needs the hook's *position* — that is the id
228
- // the runtime registered it under, and a `HookExecutor` sees only the hook.
229
- // The kind is still non-shadowable: assembly checks `BUILTIN_HOOK_KINDS`.
230
- if (kind === "rubric") {
231
- return this.runRubric(rubricId(at.state, at.phase, at.index), ctx, args);
232
- }
233
- const executor = kind ? this.hookExecutors.get(kind) : undefined;
234
- if (!executor) {
235
- const message = kind
236
- ? `no executor registered for hook kind '${kind}'`
237
- : `malformed hook (expected a single-key tagged object)`;
238
- return { ok: false, value: undefined, logs: [], error: { message }, formatted: `error: ${message}` };
239
- }
240
- return executor(hook, ctx, args);
241
- }
242
- applyDecision(state, label, decision, ctx, opts) {
243
- this.emit({
244
- type: "hook-verdict",
245
- state,
246
- phase: opts.phase,
247
- label,
248
- verdict: decision.verdict,
249
- reason: decision.reason,
250
- });
251
- const budget = iterationKey(state, opts.phase, opts.index);
252
- const used = ctx.iterations[budget] ?? 0;
253
- // Iteration budget, uniform across hook kinds: the hook-level
254
- // `max_iterations` sidecar wins (it describes *this* state's retry loop); a
255
- // rubric hook falls back to the rubric's own `max_iterations`; otherwise 0
256
- // (a `correct` hard-vetoes).
257
- const rubric = decision.rubric ? this.rubrics.get(decision.rubric) : undefined;
258
- const maxIterations = opts.maxIterations ?? rubric?.max_iterations ?? 0;
259
- // The reduction rule lives in the decision kernel; the runner only executes
260
- // hooks and applies the verdict (correction bookkeeping + events).
261
- const verdict = reduceHookFact({ ...decision, maxIterations, iterationsUsed: used }, { phase: opts.phase, veto: opts.veto, to: opts.to });
262
- if (verdict.decision === "block") {
263
- if (verdict.correctionConsumed)
264
- ctx.iterations[budget] = used + 1;
265
- const reason = verdict.reason ?? decision.reason;
266
- this.emit({ type: "hook-rejected", state, phase: opts.phase, reason });
267
- // Exhausted iteration budget (after-phase correction flow only) cannot be
268
- // fixed by retrying in place; a deliberate veto, an in-budget correction,
269
- // or a before-phase rejection can. The kernel decides which this is, from
270
- // the same reduction that wrote the reason.
271
- return { reason, terminal: verdict.budgetExhausted === true };
272
- }
273
- // Only this hook's own budget is released: a passing hook ahead of a
274
- // correcting one must not hand the latter a fresh budget every attempt.
275
- delete ctx.iterations[budget];
276
- return null;
277
- }
278
- async runPhase(state, phase, ctx, extraArgs, veto = false) {
279
- const hooks = this.machine.lifecycleHooks()[state];
280
- const list = phase === "before" ? hooks?.before : hooks?.after;
281
- if (!list || list.length === 0)
282
- return null;
283
- // The hook input (`HookArgs` in the sandbox): the trigger reaches a hook as
284
- // its bare id — a run's *input* lives in `variables` — and the transcript as
285
- // plain messages.
286
- const scriptArgs = {
287
- state,
288
- phase,
289
- ...(ctx.trigger ? { trigger: ctx.trigger.id } : {}),
290
- variables: ctx.variables ?? {},
291
- messages: hookTranscript(visitMessages(ctx)),
292
- ...extraArgs,
293
- };
294
- const to = typeof extraArgs?.to === "string" ? extraArgs.to : undefined;
295
- // Run hooks in declaration order, short-circuiting on the first that fails.
296
- // The index travels: an inline rubric has no name, so its position in this
297
- // list is its identity — for dispatch and for its own retry budget.
298
- for (const [index, hook] of list.entries()) {
299
- const reject = await this.runSingleHook(state, phase, hook, ctx, scriptArgs, { veto, to, index });
300
- if (reject)
301
- return reject;
302
- }
303
- return null;
304
- }
305
- async runSingleHook(state, phase, hook, ctx, scriptArgs, opts) {
306
- const label = afterHookLabel(hook, opts.index);
307
- this.emit({ type: "hook-start", state, phase, label });
308
- const outcome = await this.runHook(hook, ctx, scriptArgs, {
309
- state,
310
- phase,
311
- index: opts.index,
312
- });
313
- for (const line of outcome.logs) {
314
- if (line.trim()) {
315
- this.emit({ type: "hook-output", state, line: line.trimEnd() });
316
- }
317
- }
318
- const parsed = parseLifecycleDecision(outcome);
319
- if (parsed && "error" in parsed) {
320
- this.emit({ type: "hook-rejected", state, phase, reason: parsed.error });
321
- // A hook that could not execute is a terminal failure: retrying the
322
- // same turn re-runs the same broken hook.
323
- return { reason: parsed.error, terminal: true };
324
- }
325
- if (!parsed) {
326
- if (phase === "before") {
327
- this.emit({ type: "hook-passed", state, phase });
328
- }
329
- return null;
330
- }
331
- const maxIterations = hookMaxIterations(hook);
332
- return this.applyDecision(state, label, parsed, ctx, {
333
- phase,
334
- veto: opts.veto,
335
- to: opts.to,
336
- index: opts.index,
337
- ...(maxIterations !== undefined ? { maxIterations } : {}),
338
- });
339
- }
340
- async attemptTransition(from, to, ctx, reason,
341
- /**
342
- * The tool call driving this attempt, when one is. Carried onto the `advance`
343
- * event so a consumer can attribute the transition to the call that made it;
344
- * a transition the runtime itself performs passes nothing.
345
- */
346
- options) {
347
- // Work on a copy of the correction counts so the attempt never mutates the
348
- // caller's context; the resulting counts are returned for the caller to
349
- // commit to the checkpoint.
350
- const corrections = { ...ctx.iterations };
351
- const localCtx = { ...ctx, iterations: corrections };
352
- // Edge validity is a pure, statically-decidable rule — route it through the
353
- // decision kernel so runtime and `agent validate` agree. Hook reduction runs
354
- // per-hook inside `runPhase` (also kernel-backed via `applyDecision`).
355
- const edgeVerdict = decide(this.machine, { kind: "transition", from, to, hookFacts: [] }, [], undefined, ctx.variableStore ?? {});
356
- if (edgeVerdict.decision === "block") {
357
- return {
358
- ok: false,
359
- reason: edgeVerdict.reason ?? `cannot advance from '${from}' to '${to}'.`,
360
- // An invalid edge is always recoverable: the agent picks a valid target.
361
- terminal: false,
362
- corrections,
363
- };
364
- }
365
- const trimmedReason = reason?.trim();
366
- const afterReject = await this.runPhase(from, "after", localCtx, { from, to, ...(trimmedReason ? { reason: trimmedReason } : {}) }, true);
367
- if (afterReject) {
368
- return { ok: false, reason: afterReject.reason, terminal: afterReject.terminal, corrections };
369
- }
370
- const beforeReject = await this.runPhase(to, "before", localCtx);
371
- if (beforeReject) {
372
- return { ok: false, reason: beforeReject.reason, terminal: beforeReject.terminal, corrections };
373
- }
374
- this.emit({
375
- type: "advance",
376
- from,
377
- to,
378
- ...(trimmedReason ? { reason: trimmedReason } : {}),
379
- ...(options?.callId ? { callId: options.callId } : {}),
380
- });
381
- return { ok: true, from, to, corrections };
382
- }
383
- dispose(sessionId) {
384
- this.executor.dispose(sessionId, PROCESS_SESSION);
385
- releaseScopes(this.toolCallQueries, sessionId);
386
- releaseScopes(this.hookContexts, sessionId);
387
- }
388
- /** The session's `toolCalls` host function, answering from the hook context running now. */
389
- toolCallQuery(sessionId) {
390
- let query = this.toolCallQueries.get(sessionId);
391
- if (!query) {
392
- query = tool(async (filter) => {
393
- const ctx = this.hookContexts.get(sessionId);
394
- return JSON.stringify(ctx ? queryToolCalls(ctx.messages, ctx.visits ?? [], filter) : []);
395
- }, { name: TOOL_CALLS_QUERY, description: "The session's tool calls, for a hook.", schema: toolCallFilterSchema });
396
- this.toolCallQueries.set(sessionId, query);
397
- }
398
- return query;
399
- }
400
- }
401
- /** A hook's `toolCalls` filter; an unknown key is refused, so a misspelt one never matches everything. */
402
- const toolCallFilterSchema = z
403
- .object({
404
- name: z.string().optional(),
405
- state: z.string().optional(),
406
- visit: z.union([z.number().int().positive(), z.literal("current")]).optional(),
407
- status: z.enum(["completed", "pending", "failed", "rejected"]).optional(),
408
- last: z.number().int().positive().optional(),
409
- })
410
- .strict();
411
- /** Where the visit a hook sees begins: the last of the context's visits. */
412
- function visitStartOf(ctx) {
413
- return ctx.visits?.at(-1)?.start ?? 0;
414
- }
415
- /** The messages of the visit a hook sees. */
416
- function visitMessages(ctx) {
417
- return ctx.messages.slice(visitStartOf(ctx));
418
- }
419
- //# sourceMappingURL=runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/lifecycle/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KA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AAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,6CAA6C;AAC7C,SAAS,aAAa,CAAC,GAAqB;IAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { ToolCallFilter, ToolCallRecord } from "../public/sandbox.js";
2
- import { type VisitSpan } from "../workflow/visits.js";
3
- export type { ToolCallFilter, ToolCallRecord };
4
- /**
5
- * The session's domain tool calls in the order they were made, narrowed by
6
- * `filter`. The runtime's control tools are not domain calls, and runtime notes
7
- * are not calls at all.
8
- */
9
- export declare function queryToolCalls(messages: readonly unknown[], visits: readonly VisitSpan[], filter?: ToolCallFilter): ToolCallRecord[];