@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
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Generated from platform-prompt.md by scripts/generate-platform-prompt.mjs. Do not edit.
|
|
2
2
|
/** The bundled platform prompt: how to move through the graph and which tools are the runtime's. */
|
|
3
|
-
export const PLATFORM_PROMPT = "# Graph state execution\n\nYou run inside a **declarative workflow graph**: you occupy one **state** at a\ntime, and its spec governs which tools you may call and which files you may read\nor write.\n\n## How you move\n\n<!-- top-level-only -->\n1. **Name the run first.** Before anything else in your first turn, call\n **`archmax_set_variables({ \"variables\": { \"title\": \"<a few words>\" } })`** — see\n \"Naming the run\" below.\n<!-- /top-level-only -->\n2. Do the current state's work. Write files where its instructions or listed\n mounts say; `scratchpad/` is only the default.\n3. Call **`archmax_advance({ \"to\": \"<next>\", \"reason\": \"<one sentence>\" })`**,\n choosing `to` from the transitions under \"Current state\" by their descriptions.\n `to` takes the target's **slug** — the backticked token on the transition line.\n A parenthesized note gives the edge's type (`approve`, `reject`, `refine`) and\n marks a **human decision node** or a
|
|
3
|
+
export const PLATFORM_PROMPT = "# Graph state execution\n\nYou run inside a **declarative workflow graph**: you occupy one **state** at a\ntime, and its spec governs which tools you may call and which files you may read\nor write.\n\n## How you move\n\n<!-- top-level-only -->\n1. **Name the run first.** Before anything else in your first turn, call\n **`archmax_set_variables({ \"variables\": { \"title\": \"<a few words>\" } })`** — see\n \"Naming the run\" below.\n<!-- /top-level-only -->\n2. Do the current state's work. Write files where its instructions or listed\n mounts say; `scratchpad/` is only the default.\n3. Call **`archmax_advance({ \"to\": \"<next>\", \"reason\": \"<one sentence>\" })`**,\n choosing `to` from the transitions under \"Current state\" by their descriptions.\n `to` takes the target's **slug** — the backticked token on the transition line.\n A parenthesized note gives the edge's type (`approve`, `reject`, `refine`) and\n marks a **human decision node**, a **grader**, a **code** state or a\n **terminal** target. A state with no transitions says so: the run ends there,\n so finish its work and stop.\n4. The runtime validates the edge, and the state's required variables, before the\n next state's tools unlock.\n\n**One transition per message.** A second `archmax_advance` in the same message is\nrefused; chain states over successive turns.\n\n**Text alone ends your turn.** A message with no tool call is the last thing you\ndo until someone writes again: the run stays where it is, and whatever you meant\nto do next never happens. So when the work is to tell the person something *and\nthen* advance, wait or raise, write that text and make the call in the **same\nmessage**.\n\n**A conversation keeps its position.** A new message finds you in the state your\nlast turn ended in. When that state can serve it, stay and answer there: a new\nmessage is not a reason to reset. If it cannot — no transition reaches what was\nasked, or an earlier turn took a wrong path — call\n**`archmax_reset({ \"reason\": \"<one sentence>\" })`** to return to the state the\nconversation began in. The conversation and every file written so far are kept.\nA reset only ever goes back there, so never call it while you are still in that\nstate — nothing has moved you out of it since the conversation began or since\nyour last reset.\n\n**A terminal state you moved into never serves a follow-up.** When a message lands\non a run that was *already sitting* in a terminal state it moved into, reset\n**before** answering, or you skip every state the answer depends on. Three cases\ntake no reset: a run you parked with `archmax_wait`, which resumes where it was on\npurpose; a terminal state you were routed into *this turn*, by your own advance or\na person's decision — do its work, then stop; and a terminal state the\nconversation began in, where a reset would leave you exactly where you are —\nanswer there. Never reset out of a state you just arrived in, and never\n`archmax_wait` for the runtime to move you.\n\n### Waiting and deciding\n\n- Something has to **arrive** from outside the run — an event, a callback, a reply\n someone sends in their own time → call\n **`archmax_wait({ \"reason\": \"<what you are waiting for>\" })`** and stop. You\n resume in **this same state**, with what arrived in your transcript and any\n values it carried in the variables. Waiting for a *time*? Add `\"until\": \"1d\"` (a\n duration or an ISO-8601 instant); an earlier event still resumes you.\n- Someone has to **decide**, approve, review or choose → `archmax_advance` into the\n **human decision node** the author declared for it. The runtime parks the run\n there and presents the options itself: do the work its transitions require,\n advance in, and stop. Never advance out of one yourself, and never `archmax_wait`\n to ask for a decision.\n\n### When the work fails\n\nIf the task **cannot be completed** — a system it depends on keeps failing, what it\nneeds does not exist, the request is one this workflow cannot serve — try to\nrecover once or twice (a retry, another tool, another approach). If that fails\ntoo, call **`archmax_raise({ \"code\": \"<short-token>\", \"reason\": \"<what failed>\" })`**:\nit ends the session as a failure from any state, and whoever started the run\nreads your `code` (e.g. `orders-unavailable`) and `reason`. **When you are about to\ntell the person the task cannot be done, make that call in the same message**: the\nmessage's text is what they read, and no other tool call goes with it. A reply\nthat only explains the failure ends the run as a success. Never raise to finish\nwork that worked, or in place of `archmax_wait`, `archmax_reset` or a human node.\n\n### The state you are in\n\nThe active state's **`instructions`** arrive under a \"Current state\" heading:\nfollow them. You are shown the edges out of this state and nothing else of the\ngraph — there is no map of the workflow to consult. Do not guess at slugs, and do\nnot treat a state named anywhere else (a message, a file, your own earlier turns)\nas somewhere you can move to. Skills the state may use are listed under \"Skills\navailable in this state\", each naming the `SKILL.md` to read first.\n\n**Grader and code states** run on their own, without you: a grader judges the\nwork so far, a code state runs the workflow's own checks. Either may move the run\non, end it, or send it back to you with a note saying what has to change — then\nfix the work rather than arguing with it, and advance again.\n\n## Tools\n\nTool access is **closed by default**: you see only the active state's tools, and\na state may narrow a tool's arguments (e.g. `write_file` to one path). Tools named\n`archmax_*` are the runtime's controls. A blocked call names the tool, the state\nand the policy: fix the call, or advance if you are done.\n\n**Write code instead of many calls.** **`archmax_eval({ \"code\": \"…\" })`**, when\nyour tools include it, runs JavaScript in a sandbox where `tools.*` calls your tools,\ngoverned exactly as your own calls are. Reach for it by default for loops,\nfilters, arithmetic, or more than about two calls whose results feed each other:\n**only your last expression and whatever you `console.log` come back to you**, so\nthe rest of what those tools returned never enters the conversation. The REPL\nkeeps its state between calls. Your code cannot read the run's variables:\ninterpolate a scalar one into it with `${{name}}` (below), or use\n**`archmax_run({ \"file_path\": \"…\" })`**, the same sandbox subject to the state's\npath constraints, whose script receives whole structured values as\n`args.variables`.\n\n<!-- top-level-only -->\n**Naming the run.** `title` is a reserved run variable: a one-line label of a few\nwords (`Refund for order A-1042`) that tells this run apart in a list of runs.\nThis is step 1 above, and it is not optional. Write it from what the request\nalready says, **before** the state's own work and before any other tool call — it\nis a label, not a plan, so never read anything to produce one — and it still goes\nfirst when the state's instructions tell you to do something else first. After\nthat, leave it alone unless the conversation **as a whole** has moved to a\nsubject the old title no longer describes. Judge that against the whole\nconversation, not its latest message: a follow-up, a detail, a correction or a\nside question on the same subject keeps the title. When you do rename, name what\nthe whole conversation is about. Never pass `lock` with it: that call is refused.\n\n<!-- /top-level-only -->\n**Reference a run variable instead of retyping it.** In any text argument,\n`${{name}}` (or `${{name.path.to.value}}`) is replaced with that variable's value\nbefore the call runs, also **inside** a longer string and as often as you like:\n\n```\n\"Thanks — your refund is on its way.\n\n--- Original message ---\n\n${{inbound.text}}\"\n```\n\nPrefer the reference to writing the value out: the value is what you spend tokens\non, and a reference cannot paraphrase, truncate or mistype it.\n`archmax_get_variables` shows what is set; a reference that does not resolve\nrefuses the call and says why. To write `${{…}}` literally, double the dollar:\n`$${{name}}`.\n";
|
|
4
4
|
//# sourceMappingURL=platform-prompt.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-prompt.generated.js","sourceRoot":"","sources":["../../src/core/platform-prompt.generated.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAW,
|
|
1
|
+
{"version":3,"file":"platform-prompt.generated.js","sourceRoot":"","sources":["../../src/core/platform-prompt.generated.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAW,ilQAAilQ,CAAC"}
|
|
@@ -43,7 +43,7 @@ export declare class SessionZoneRouter implements BackendProtocolV2 {
|
|
|
43
43
|
/**
|
|
44
44
|
* Bind id-free run-root addressing to `sessionId` for everything `fn` does
|
|
45
45
|
* (the binding propagates through async continuations, so a whole agent
|
|
46
|
-
* turn — including
|
|
46
|
+
* turn — including automated states, sandboxed scripts, and the inner
|
|
47
47
|
* agent's own checkpoint writes — is covered by wrapping its `invoke`).
|
|
48
48
|
* Concurrent sessions each carry their own binding.
|
|
49
49
|
*/
|
|
@@ -55,7 +55,7 @@ export class SessionZoneRouter {
|
|
|
55
55
|
/**
|
|
56
56
|
* Bind id-free run-root addressing to `sessionId` for everything `fn` does
|
|
57
57
|
* (the binding propagates through async continuations, so a whole agent
|
|
58
|
-
* turn — including
|
|
58
|
+
* turn — including automated states, sandboxed scripts, and the inner
|
|
59
59
|
* agent's own checkpoint writes — is covered by wrapping its `invoke`).
|
|
60
60
|
* Concurrent sessions each carry their own binding.
|
|
61
61
|
*/
|
|
@@ -50,7 +50,7 @@ export interface WorkspaceContextOptions {
|
|
|
50
50
|
mounts?: Record<string, MountSpec>;
|
|
51
51
|
/**
|
|
52
52
|
* Backend serving the **authored governance plane** — `workflows/<slug>/`:
|
|
53
|
-
* machine specs, prose addenda,
|
|
53
|
+
* machine specs, prose addenda, code-state scripts, and offline test
|
|
54
54
|
* cases. Read by the runtime, never routed into the agent's workspace
|
|
55
55
|
* composite, so no agent tool and no PTC call can address it.
|
|
56
56
|
*
|
package/dist/core/workspace.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BackendProtocolV2, FileData, FileInfo } from "deepagents";
|
|
|
3
3
|
* Single file-access layer for the runtime.
|
|
4
4
|
*
|
|
5
5
|
* Every read of a file in the agent workspace — machine config, system prompt,
|
|
6
|
-
*
|
|
6
|
+
* code-state scripts, `archmax_run` sources, session artifacts — flows
|
|
7
7
|
* through here so it is served by the configured LangChain Deep Agents
|
|
8
8
|
* {@link BackendProtocolV2}. Swap the backend (filesystem, store, sandbox,
|
|
9
9
|
* remote) and the whole runtime follows, with no direct `fs` coupling.
|
package/dist/core/workspace.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Single file-access layer for the runtime.
|
|
3
3
|
*
|
|
4
4
|
* Every read of a file in the agent workspace — machine config, system prompt,
|
|
5
|
-
*
|
|
5
|
+
* code-state scripts, `archmax_run` sources, session artifacts — flows
|
|
6
6
|
* through here so it is served by the configured LangChain Deep Agents
|
|
7
7
|
* {@link BackendProtocolV2}. Swap the backend (filesystem, store, sandbox,
|
|
8
8
|
* remote) and the whole runtime follows, with no direct `fs` coupling.
|
package/dist/core/zones.d.ts
CHANGED
|
@@ -104,14 +104,14 @@ export type WorkspaceZone = "authored" | "run-internal" | "run-offload" | "run-o
|
|
|
104
104
|
export declare function sessionAreaNames(): string[];
|
|
105
105
|
/**
|
|
106
106
|
* The authoring prefixes: the workspace-root names holding what the **runtime**
|
|
107
|
-
* reads. `workflows/` carries the machine specs —
|
|
108
|
-
* prose addenda, the
|
|
109
|
-
* is enforced with. It is served by the *authoring* backend and is not routed into
|
|
107
|
+
* reads. `workflows/` carries the machine specs — grader states' criteria
|
|
108
|
+
* included — the prose addenda, the code-state scripts, and the offline test
|
|
109
|
+
* cases a session is enforced with. It is served by the *authoring* backend and is not routed into
|
|
110
110
|
* the agent's workspace composite.
|
|
111
111
|
*
|
|
112
112
|
* It is reserved rather than merely omitted: a workspace that mounted it would hand
|
|
113
113
|
* a session its own spec, its sibling workflows' specs, the tests grading it, and
|
|
114
|
-
* the criteria
|
|
114
|
+
* the criteria a grader state judges it by, and the code its code states run. Refusing
|
|
115
115
|
* the key makes the isolation a property of composition instead of a rule
|
|
116
116
|
* something downstream could relax.
|
|
117
117
|
*
|
package/dist/core/zones.js
CHANGED
|
@@ -64,14 +64,14 @@ const SESSION_AREA_SET = new Set(sessionAreaNames());
|
|
|
64
64
|
// --- The authoring prefixes ------------------------------------------------------
|
|
65
65
|
/**
|
|
66
66
|
* The authoring prefixes: the workspace-root names holding what the **runtime**
|
|
67
|
-
* reads. `workflows/` carries the machine specs —
|
|
68
|
-
* prose addenda, the
|
|
69
|
-
* is enforced with. It is served by the *authoring* backend and is not routed into
|
|
67
|
+
* reads. `workflows/` carries the machine specs — grader states' criteria
|
|
68
|
+
* included — the prose addenda, the code-state scripts, and the offline test
|
|
69
|
+
* cases a session is enforced with. It is served by the *authoring* backend and is not routed into
|
|
70
70
|
* the agent's workspace composite.
|
|
71
71
|
*
|
|
72
72
|
* It is reserved rather than merely omitted: a workspace that mounted it would hand
|
|
73
73
|
* a session its own spec, its sibling workflows' specs, the tests grading it, and
|
|
74
|
-
* the criteria
|
|
74
|
+
* the criteria a grader state judges it by, and the code its code states run. Refusing
|
|
75
75
|
* the key makes the isolation a property of composition instead of a rule
|
|
76
76
|
* something downstream could relax.
|
|
77
77
|
*
|
|
@@ -89,7 +89,7 @@ export const AUTHORING_PREFIXES = ["workflows"];
|
|
|
89
89
|
* diagnostic describes the prefix the consumer actually named.
|
|
90
90
|
*/
|
|
91
91
|
const AUTHORING_CONTENT = {
|
|
92
|
-
workflows: "machine specs,
|
|
92
|
+
workflows: "machine specs, code-state scripts, and test cases",
|
|
93
93
|
};
|
|
94
94
|
/** Whether a bare root name is an authoring prefix. */
|
|
95
95
|
export function isAuthoringPrefix(name) {
|
package/dist/core/zones.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zones.js","sourceRoot":"","sources":["../../src/core/zones.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAkDrD,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,oBAAoB,EAAE,sBAAsB,CAAU,CAAC;AAE5F;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,G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C,2EAA2E;IAC3E,gEAAgE;IAChE,MAAM,aAAa,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/env.d.ts
CHANGED
|
@@ -66,11 +66,11 @@ export declare function loadPromptCacheEnv(): {
|
|
|
66
66
|
*/
|
|
67
67
|
export declare function loadPricingEnv(): PricingTable | undefined;
|
|
68
68
|
/**
|
|
69
|
-
* The role a model plays in the runtime: the workflow `agent` (
|
|
70
|
-
* (the offline case grader), or a `
|
|
71
|
-
*
|
|
69
|
+
* The role a model plays in the runtime: the workflow `agent` (the session's
|
|
70
|
+
* turns), a `judge` (the offline case grader), or a `grader` (a grader state's
|
|
71
|
+
* subagent). A {@link ModelFactory} may return a different model per role.
|
|
72
72
|
*/
|
|
73
|
-
export type ModelRole = "agent" | "judge" | "
|
|
73
|
+
export type ModelRole = "agent" | "judge" | "grader";
|
|
74
74
|
/**
|
|
75
75
|
* Supplies the chat model for a given role, so library users can run the runtime
|
|
76
76
|
* against any LangChain `BaseChatModel` (e.g. Amazon Bedrock via
|
|
@@ -86,11 +86,11 @@ export type ModelRole = "agent" | "judge" | "rubric";
|
|
|
86
86
|
*/
|
|
87
87
|
export type ModelFactory = (role: ModelRole, env: () => AgentEnv,
|
|
88
88
|
/**
|
|
89
|
-
* The model id the caller asked for —
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* request. The default factory applies it over `ARCHMAX_MODEL`,
|
|
93
|
-
* configured endpoint and credentials.
|
|
89
|
+
* The model id the caller asked for — the `model` a state declares (or its
|
|
90
|
+
* workflow's `settings.model`), for the `agent` and `grader` roles. Additive: a
|
|
91
|
+
* factory that ignores it returns its own model, and no error is raised for an
|
|
92
|
+
* unhonoured request. The default factory applies it over `ARCHMAX_MODEL`,
|
|
93
|
+
* keeping the configured endpoint and credentials.
|
|
94
94
|
*/
|
|
95
95
|
requested?: string) => BaseChatModel;
|
|
96
96
|
/** The default, role-independent model factory: the env-configured `ChatOpenAI`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* is here because a real consumer needs it, not because a module happened to
|
|
14
14
|
* expose it. Adjacent surfaces live on their own subpaths — `@archmax-ai/harness/testing`
|
|
15
15
|
* (the case engine), `@archmax-ai/harness/cli` (the state-flow renderer), and
|
|
16
|
-
* `@archmax-ai/harness/sandbox` (
|
|
16
|
+
* `@archmax-ai/harness/sandbox` (code-state script authoring) — so a production import never
|
|
17
17
|
* pulls in test machinery.
|
|
18
18
|
*
|
|
19
19
|
* Two **light** subpaths mirror part of this surface without the runtime behind
|
|
@@ -200,7 +200,7 @@ export { isAiMessage } from "./core/messages.js";
|
|
|
200
200
|
export { lastAgentText } from "./core/messages.js";
|
|
201
201
|
/**
|
|
202
202
|
* Whether the runtime wrote a transcript message rather than a person — a
|
|
203
|
-
* decision, an arrival, an error route,
|
|
203
|
+
* decision, an arrival, an error route, an automated state's move, a child's result.
|
|
204
204
|
* A host slicing a turn out of a session's messages, or rendering a transcript,
|
|
205
205
|
* asks this instead of inferring authorship from role.
|
|
206
206
|
*/
|
|
@@ -208,16 +208,12 @@ export { isRuntimeNote } from "./core/messages.js";
|
|
|
208
208
|
/** Which kind of runtime note a message is, or `null` if a person wrote it. */
|
|
209
209
|
export { runtimeNoteKind } from "./core/messages.js";
|
|
210
210
|
export type { RuntimeNoteKind } from "./core/messages.js";
|
|
211
|
-
/**
|
|
212
|
-
export type { RubricDeclaration } from "./machine/types.js";
|
|
213
|
-
/** Host data the runtime never reads, at the spec root, on a state, or on a rubric. */
|
|
211
|
+
/** Host data the runtime never reads, at the spec root or on a state. */
|
|
214
212
|
export type { SpecMetadata } from "./machine/types.js";
|
|
215
213
|
/** Parse a sandbox script's leading description block. */
|
|
216
214
|
export { parseCodeDescription } from "./core/code-description.js";
|
|
217
215
|
/** Load and shape-check a `workflow.yaml` without assembling an agent. */
|
|
218
216
|
export { loadMachineSpec } from "./machine/load-spec.js";
|
|
219
|
-
/** A `before:`/`after:` declaration as a flat list of hooks. */
|
|
220
|
-
export { normalizeHooks } from "./lifecycle/hook-shape.js";
|
|
221
217
|
export type { MachineSpec, MachineState } from "./machine/types.js";
|
|
222
218
|
/** The compiled machine, as `agent.workflow.machine` exposes it. */
|
|
223
219
|
export { WorkflowMachine } from "./machine/machine.js";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* is here because a real consumer needs it, not because a module happened to
|
|
14
14
|
* expose it. Adjacent surfaces live on their own subpaths — `@archmax-ai/harness/testing`
|
|
15
15
|
* (the case engine), `@archmax-ai/harness/cli` (the state-flow renderer), and
|
|
16
|
-
* `@archmax-ai/harness/sandbox` (
|
|
16
|
+
* `@archmax-ai/harness/sandbox` (code-state script authoring) — so a production import never
|
|
17
17
|
* pulls in test machinery.
|
|
18
18
|
*
|
|
19
19
|
* Two **light** subpaths mirror part of this surface without the runtime behind
|
|
@@ -134,7 +134,7 @@ export { isAiMessage } from "./core/messages.js";
|
|
|
134
134
|
export { lastAgentText } from "./core/messages.js";
|
|
135
135
|
/**
|
|
136
136
|
* Whether the runtime wrote a transcript message rather than a person — a
|
|
137
|
-
* decision, an arrival, an error route,
|
|
137
|
+
* decision, an arrival, an error route, an automated state's move, a child's result.
|
|
138
138
|
* A host slicing a turn out of a session's messages, or rendering a transcript,
|
|
139
139
|
* asks this instead of inferring authorship from role.
|
|
140
140
|
*/
|
|
@@ -146,8 +146,6 @@ export { parseCodeDescription } from "./core/code-description.js";
|
|
|
146
146
|
// --- The machine --------------------------------------------------------------
|
|
147
147
|
/** Load and shape-check a `workflow.yaml` without assembling an agent. */
|
|
148
148
|
export { loadMachineSpec } from "./machine/load-spec.js";
|
|
149
|
-
/** A `before:`/`after:` declaration as a flat list of hooks. */
|
|
150
|
-
export { normalizeHooks } from "./lifecycle/hook-shape.js";
|
|
151
149
|
/** The compiled machine, as `agent.workflow.machine` exposes it. */
|
|
152
150
|
export { WorkflowMachine } from "./machine/machine.js";
|
|
153
151
|
/** Statically validate a workflow scaffold — no model calls. */
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,iFAAiF;AAEjF;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,qDAAqD;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA+C1C;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO;AACL,0FAA0F;AAC1F,aAAa;AACb,iEAAiE;AACjE,aAAa,GACd,MAAM,qBAAqB,CAAC;AAqB7B,iFAAiF;AACjF,EAAE;AACF,gFAAgF;AAChF,yDAAyD;AAEzD,OAAO;AACL,6EAA6E;AAC7E,iBAAiB;AACjB,iFAAiF;AACjF,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,iDAAiD;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,0FAA0F;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,8FAA8F;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,6DAA6D;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,0CAA0C;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO;AACL,gEAAgE;AAChE,yBAAyB;AACzB,yEAAyE;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mFAAmF;AACnF,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AAExE,OAAO;AACL,+CAA+C;AAC/C,eAAe;AACf,8EAA8E;AAC9E,kBAAkB;AAClB,0DAA0D;AAC1D,mBAAmB;AACnB,iDAAiD;AACjD,mBAAmB;AACnB,4EAA4E;AAC5E,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAOhC,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO;AACL,4CAA4C;AAC5C,oBAAoB;AACpB,oDAAoD;AACpD,gBAAgB;AAChB,0DAA0D;AAC1D,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AAWjC,iFAAiF;AAEjF,kEAAkE;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,yDAAyD;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,iFAAiF;AACjF,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+CAA+C;AAE/C,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO;AACL;;;GAGG;AACH,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAClB,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/kernel/kernel.d.ts
CHANGED
|
@@ -3,14 +3,13 @@ import type { ForbidEntry } from "../machine/types.js";
|
|
|
3
3
|
import type { VariableStore } from "../machine/variables.js";
|
|
4
4
|
import { type MountPrefixes } from "../core/mounts.js";
|
|
5
5
|
import { type SkillPrefixes } from "../core/skills.js";
|
|
6
|
-
import type { LifecycleDecision } from "../lifecycle/runner.js";
|
|
7
6
|
/**
|
|
8
7
|
* The decision kernel: a single pure, synchronous function that produces every
|
|
9
8
|
* governance verdict from the machine spec, a snapshot of checkpointed workflow
|
|
10
|
-
* state, and a proposed action
|
|
11
|
-
*
|
|
12
|
-
* kernel
|
|
13
|
-
* code path.
|
|
9
|
+
* state, and a proposed action — a tool call or a transition. Effectful work
|
|
10
|
+
* (running a code state's script, a grader) happens elsewhere and asks the
|
|
11
|
+
* kernel about each call and move it makes, so runtime enforcement and static
|
|
12
|
+
* validation share one code path.
|
|
14
13
|
*/
|
|
15
14
|
export type VerdictDecision = "allow" | "block";
|
|
16
15
|
export interface Verdict {
|
|
@@ -28,38 +27,22 @@ export interface Verdict {
|
|
|
28
27
|
reason?: string;
|
|
29
28
|
/** Tool-call blocks: whether the block should surface as a warn-level event. */
|
|
30
29
|
warn?: boolean;
|
|
31
|
-
/** Transition reductions: whether the deciding hook consumed one of its iterations. */
|
|
32
|
-
correctionConsumed?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Transition reductions: whether the block is a `correct` refused because the
|
|
35
|
-
* hook's `max_iterations` are already spent. Retrying in place cannot clear
|
|
36
|
-
* it, so the runner reports it as a terminal rejection.
|
|
37
|
-
*/
|
|
38
|
-
budgetExhausted?: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A reduced lifecycle-hook outcome. `LifecycleRunner` executes a hook, parses
|
|
42
|
-
* its return value into a {@link LifecycleDecision}, and hands it here (with an
|
|
43
|
-
* optional `error` when the hook could not execute) for reduction.
|
|
44
|
-
*/
|
|
45
|
-
export interface HookFact extends LifecycleDecision {
|
|
46
|
-
/** Present when the hook could not execute; reduces to a fail-closed veto. */
|
|
47
|
-
error?: string;
|
|
48
|
-
/** Bounded grade-and-retry budget for an `after` hook of any kind (0 = none). */
|
|
49
|
-
maxIterations?: number;
|
|
50
|
-
/** Iterations already consumed for this state. */
|
|
51
|
-
iterationsUsed?: number;
|
|
52
30
|
}
|
|
53
31
|
/**
|
|
54
|
-
* Who initiated a tool call
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
32
|
+
* Who initiated a tool call, which decides the authority it runs on:
|
|
33
|
+
*
|
|
34
|
+
* - `agent` (the default): a model's call — the session's agent in an agent
|
|
35
|
+
* state, the grader in a grader state;
|
|
36
|
+
* - `script`: a programmatic call from a sandbox script — the agent's
|
|
37
|
+
* `archmax_eval`/`archmax_run`, or a code state's script — governed exactly as
|
|
38
|
+
* a model's call in the same state;
|
|
39
|
+
* - `runtime`: the runtime's own read of a `file` value, on runtime authority:
|
|
40
|
+
* outside the active state's surface — its allow and forbid lists, its skill
|
|
41
|
+
* and mount grants — but held to its workflow's mount grants, its
|
|
42
|
+
* workflow-wide denials and every safety rule. No script or model ever runs
|
|
43
|
+
* on it.
|
|
61
44
|
*/
|
|
62
|
-
export type ToolCallOrigin = "agent" | "script" | "
|
|
45
|
+
export type ToolCallOrigin = "agent" | "script" | "runtime";
|
|
63
46
|
export type ProposedAction = {
|
|
64
47
|
kind: "tool-call";
|
|
65
48
|
state: string;
|
|
@@ -78,12 +61,9 @@ export type ProposedAction = {
|
|
|
78
61
|
from: string;
|
|
79
62
|
to: string;
|
|
80
63
|
reason?: string;
|
|
81
|
-
hookFacts: HookFact[];
|
|
82
|
-
} | {
|
|
83
|
-
kind: "enter-state";
|
|
84
|
-
state: string;
|
|
85
|
-
hookFacts: HookFact[];
|
|
86
64
|
};
|
|
65
|
+
/** The variables a state still owes before it may be left — its `requires` minus what is set. */
|
|
66
|
+
export declare function unmetRequirements(required: string[], store: VariableStore): string[];
|
|
87
67
|
/** Read-only context a governance rule may consult. */
|
|
88
68
|
export interface RuleApi {
|
|
89
69
|
machine: WorkflowMachine;
|
|
@@ -113,10 +93,13 @@ export interface RuleApi {
|
|
|
113
93
|
*/
|
|
114
94
|
export type GovernanceRule = (action: ProposedAction, api: RuleApi) => Verdict | null;
|
|
115
95
|
/**
|
|
116
|
-
*
|
|
117
|
-
* (PTC): every harness control tool
|
|
118
|
-
* sandboxed code cannot re-enter the
|
|
119
|
-
*
|
|
96
|
+
* Tools an **agent state's** scripts (`archmax_eval`, `archmax_run`) may never
|
|
97
|
+
* invoke through programmatic tool calling (PTC): every harness control tool
|
|
98
|
+
* (including both sandbox entry points, so sandboxed code cannot re-enter the
|
|
99
|
+
* sandbox) plus a bare `eval`. Moving the machine and writing its variables is
|
|
100
|
+
* the model's own governed decision there; the script reads the variables via
|
|
101
|
+
* `args.variables`. A code state is the exception by construction: its script
|
|
102
|
+
* *is* the state, so it is handed its state's controls as its own tools.
|
|
120
103
|
*/
|
|
121
104
|
export declare const PTC_EXCLUDED_TOOLS: ReadonlySet<string>;
|
|
122
105
|
/**
|
|
@@ -125,19 +108,6 @@ export declare const PTC_EXCLUDED_TOOLS: ReadonlySet<string>;
|
|
|
125
108
|
* `core/zones.ts` so runtime, mount routing, and validation agree.
|
|
126
109
|
*/
|
|
127
110
|
export declare function isReadOnlyZonePath(path: string, mounts?: MountPrefixes): boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Reduce a single lifecycle-hook fact to a verdict. Fail-closed: an execution
|
|
130
|
-
* error is a veto. `before` hooks gate entry with `ok`/`veto` only — a `correct`
|
|
131
|
-
* at entry has nothing to retry, so it reduces to a veto and never consumes the
|
|
132
|
-
* correction budget. Within an `after` veto window any hook's `correct` (script
|
|
133
|
-
* or subagent judge alike) enters the same bounded correction flow, budgeted by
|
|
134
|
-
* the hook's `max_corrections`.
|
|
135
|
-
*/
|
|
136
|
-
export declare function reduceHookFact(fact: HookFact, opts: {
|
|
137
|
-
phase: "before" | "after" | "tool";
|
|
138
|
-
veto: boolean;
|
|
139
|
-
to?: string;
|
|
140
|
-
}): Verdict;
|
|
141
111
|
/**
|
|
142
112
|
* An **ancestor's** `mounts.forbid_always`, as rules the descendant inherits.
|
|
143
113
|
* The mount twin of {@link compileForbiddenSkillRules}: a child machine resolves
|
|
@@ -145,8 +115,8 @@ export declare function reduceHookFact(fact: HookFact, opts: {
|
|
|
145
115
|
* a rule — any path under one of those mounts is refused, whatever the child
|
|
146
116
|
* granted itself, and the refusal names the workflow that denied it.
|
|
147
117
|
*
|
|
148
|
-
* A workflow-wide denial binds
|
|
149
|
-
*
|
|
118
|
+
* A workflow-wide denial binds the runtime's own reads too, so this rule binds
|
|
119
|
+
* the `runtime` origin as well.
|
|
150
120
|
*/
|
|
151
121
|
export declare function compileForbiddenMountRules(names: readonly string[], source: string): GovernanceRule[];
|
|
152
122
|
/**
|
|
@@ -154,9 +124,9 @@ export declare function compileForbiddenMountRules(names: readonly string[], sou
|
|
|
154
124
|
* `tools.forbid_always`, `skills.forbid_always` and `mounts.forbid_always`,
|
|
155
125
|
* named with the workflow that declared them. A per-state `forbid` is not
|
|
156
126
|
* inherited — it governs that state's turns, not a child session — and neither
|
|
157
|
-
* is any grant. Compiled as rules, they bind
|
|
158
|
-
*
|
|
159
|
-
* them.
|
|
127
|
+
* is any grant. Compiled as rules, they bind every origin, so a descendant's
|
|
128
|
+
* automated states and the runtime's reads on a child's behalf are held to
|
|
129
|
+
* them.
|
|
160
130
|
*/
|
|
161
131
|
export declare function workflowDenials(machine: WorkflowMachine, source: string): GovernanceRule[];
|
|
162
132
|
/**
|