@archmax-ai/harness 0.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/LICENSE +21 -0
- package/README.md +219 -0
- package/dist/agent.d.ts +174 -0
- package/dist/agent.js +140 -0
- package/dist/agent.js.map +1 -0
- package/dist/assembly/compose.d.ts +170 -0
- package/dist/assembly/compose.js +391 -0
- package/dist/assembly/compose.js.map +1 -0
- package/dist/assembly/delegation-registry.d.ts +5 -0
- package/dist/assembly/delegation-registry.js +118 -0
- package/dist/assembly/delegation-registry.js.map +1 -0
- package/dist/assembly/index.d.ts +192 -0
- package/dist/assembly/index.js +265 -0
- package/dist/assembly/index.js.map +1 -0
- package/dist/assembly/plain.d.ts +7 -0
- package/dist/assembly/plain.js +41 -0
- package/dist/assembly/plain.js.map +1 -0
- package/dist/authoring-skill/archmax-harness/README.md +76 -0
- package/dist/authoring-skill/archmax-harness/SKILL.md +241 -0
- package/dist/authoring-skill/archmax-harness/references/backend-integration.md +626 -0
- package/dist/authoring-skill/archmax-harness/references/cases.md +41 -0
- package/dist/authoring-skill/archmax-harness/references/diagnostics.md +51 -0
- package/dist/authoring-skill/archmax-harness/references/hook-and-test-scripts.md +1070 -0
- package/dist/authoring-skill/archmax-harness/references/hooks-and-scripts.md +82 -0
- package/dist/authoring-skill/archmax-harness/references/wiring.md +101 -0
- package/dist/authoring-skill/archmax-harness/references/workflow-schema.md +1631 -0
- package/dist/authoring-skill/archmax-harness/references/workflow-yaml.md +241 -0
- package/dist/behaviour/support.d.ts +232 -0
- package/dist/behaviour/support.js +339 -0
- package/dist/behaviour/support.js.map +1 -0
- package/dist/cli/banner.d.ts +11 -0
- package/dist/cli/banner.js +29 -0
- package/dist/cli/banner.js.map +1 -0
- package/dist/cli/bootstrap.d.ts +33 -0
- package/dist/cli/bootstrap.js +153 -0
- package/dist/cli/bootstrap.js.map +1 -0
- package/dist/cli/command.d.ts +39 -0
- package/dist/cli/command.js +97 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/state-flow.d.ts +46 -0
- package/dist/cli/state-flow.js +268 -0
- package/dist/cli/state-flow.js.map +1 -0
- package/dist/cli/style.d.ts +41 -0
- package/dist/cli/style.js +64 -0
- package/dist/cli/style.js.map +1 -0
- package/dist/cli/turn.d.ts +41 -0
- package/dist/cli/turn.js +161 -0
- package/dist/cli/turn.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +426 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/code-description.d.ts +22 -0
- package/dist/core/code-description.js +38 -0
- package/dist/core/code-description.js.map +1 -0
- package/dist/core/deepagents.d.ts +183 -0
- package/dist/core/deepagents.js +128 -0
- package/dist/core/deepagents.js.map +1 -0
- package/dist/core/events.d.ts +350 -0
- package/dist/core/events.js +205 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/frontmatter.d.ts +15 -0
- package/dist/core/frontmatter.js +32 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/listing-redact.d.ts +37 -0
- package/dist/core/listing-redact.js +88 -0
- package/dist/core/listing-redact.js.map +1 -0
- package/dist/core/match.d.ts +26 -0
- package/dist/core/match.js +75 -0
- package/dist/core/match.js.map +1 -0
- package/dist/core/message-readers.d.ts +84 -0
- package/dist/core/message-readers.js +159 -0
- package/dist/core/message-readers.js.map +1 -0
- package/dist/core/messages.d.ts +49 -0
- package/dist/core/messages.js +85 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/mount-prompt.d.ts +28 -0
- package/dist/core/mount-prompt.js +55 -0
- package/dist/core/mount-prompt.js.map +1 -0
- package/dist/core/mount-redact.d.ts +28 -0
- package/dist/core/mount-redact.js +32 -0
- package/dist/core/mount-redact.js.map +1 -0
- package/dist/core/mounts.d.ts +88 -0
- package/dist/core/mounts.js +147 -0
- package/dist/core/mounts.js.map +1 -0
- package/dist/core/path-mapping.d.ts +52 -0
- package/dist/core/path-mapping.js +113 -0
- package/dist/core/path-mapping.js.map +1 -0
- package/dist/core/platform-prompt.generated.d.ts +2 -0
- package/dist/core/platform-prompt.generated.js +4 -0
- package/dist/core/platform-prompt.generated.js.map +1 -0
- package/dist/core/prompt.d.ts +42 -0
- package/dist/core/prompt.js +75 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/session-id.d.ts +38 -0
- package/dist/core/session-id.js +61 -0
- package/dist/core/session-id.js.map +1 -0
- package/dist/core/session-store.d.ts +85 -0
- package/dist/core/session-store.js +149 -0
- package/dist/core/session-store.js.map +1 -0
- package/dist/core/session-zone.d.ts +54 -0
- package/dist/core/session-zone.js +82 -0
- package/dist/core/session-zone.js.map +1 -0
- package/dist/core/skill-prompt.d.ts +31 -0
- package/dist/core/skill-prompt.js +54 -0
- package/dist/core/skill-prompt.js.map +1 -0
- package/dist/core/skill-redact.d.ts +15 -0
- package/dist/core/skill-redact.js +27 -0
- package/dist/core/skill-redact.js.map +1 -0
- package/dist/core/skills.d.ts +172 -0
- package/dist/core/skills.js +214 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/tool-mocks.d.ts +23 -0
- package/dist/core/tool-mocks.js +39 -0
- package/dist/core/tool-mocks.js.map +1 -0
- package/dist/core/tool-telemetry.d.ts +16 -0
- package/dist/core/tool-telemetry.js +40 -0
- package/dist/core/tool-telemetry.js.map +1 -0
- package/dist/core/usage.d.ts +114 -0
- package/dist/core/usage.js +226 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/core/workspace-context.d.ts +136 -0
- package/dist/core/workspace-context.js +178 -0
- package/dist/core/workspace-context.js.map +1 -0
- package/dist/core/workspace-prompt.d.ts +7 -0
- package/dist/core/workspace-prompt.js +102 -0
- package/dist/core/workspace-prompt.js.map +1 -0
- package/dist/core/workspace-router.d.ts +61 -0
- package/dist/core/workspace-router.js +145 -0
- package/dist/core/workspace-router.js.map +1 -0
- package/dist/core/workspace.d.ts +85 -0
- package/dist/core/workspace.js +193 -0
- package/dist/core/workspace.js.map +1 -0
- package/dist/core/zones.d.ts +181 -0
- package/dist/core/zones.js +202 -0
- package/dist/core/zones.js.map +1 -0
- package/dist/env.d.ts +99 -0
- package/dist/env.js +271 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +265 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/kernel.d.ts +192 -0
- package/dist/kernel/kernel.js +751 -0
- package/dist/kernel/kernel.js.map +1 -0
- package/dist/lifecycle/hook-shape.d.ts +44 -0
- package/dist/lifecycle/hook-shape.js +66 -0
- package/dist/lifecycle/hook-shape.js.map +1 -0
- package/dist/lifecycle/runner.d.ts +177 -0
- package/dist/lifecycle/runner.js +372 -0
- package/dist/lifecycle/runner.js.map +1 -0
- package/dist/lifecycle/transcript.d.ts +27 -0
- package/dist/lifecycle/transcript.js +43 -0
- package/dist/lifecycle/transcript.js.map +1 -0
- package/dist/machine/allow.d.ts +65 -0
- package/dist/machine/allow.js +107 -0
- package/dist/machine/allow.js.map +1 -0
- package/dist/machine/delegation.d.ts +9 -0
- package/dist/machine/delegation.js +10 -0
- package/dist/machine/delegation.js.map +1 -0
- package/dist/machine/diagnostic.d.ts +14 -0
- package/dist/machine/diagnostic.js +2 -0
- package/dist/machine/diagnostic.js.map +1 -0
- package/dist/machine/lint-spec.d.ts +4 -0
- package/dist/machine/lint-spec.js +266 -0
- package/dist/machine/lint-spec.js.map +1 -0
- package/dist/machine/load-spec.d.ts +90 -0
- package/dist/machine/load-spec.js +120 -0
- package/dist/machine/load-spec.js.map +1 -0
- package/dist/machine/machine.d.ts +273 -0
- package/dist/machine/machine.js +551 -0
- package/dist/machine/machine.js.map +1 -0
- package/dist/machine/mount-grants.d.ts +25 -0
- package/dist/machine/mount-grants.js +24 -0
- package/dist/machine/mount-grants.js.map +1 -0
- package/dist/machine/slug.d.ts +14 -0
- package/dist/machine/slug.js +17 -0
- package/dist/machine/slug.js.map +1 -0
- package/dist/machine/spec-schema.d.ts +662 -0
- package/dist/machine/spec-schema.js +717 -0
- package/dist/machine/spec-schema.js.map +1 -0
- package/dist/machine/tool-names.d.ts +98 -0
- package/dist/machine/tool-names.js +144 -0
- package/dist/machine/tool-names.js.map +1 -0
- package/dist/machine/triggers.d.ts +114 -0
- package/dist/machine/triggers.js +165 -0
- package/dist/machine/triggers.js.map +1 -0
- package/dist/machine/types.d.ts +186 -0
- package/dist/machine/types.js +12 -0
- package/dist/machine/types.js.map +1 -0
- package/dist/machine/validate-spec.d.ts +42 -0
- package/dist/machine/validate-spec.js +29 -0
- package/dist/machine/validate-spec.js.map +1 -0
- package/dist/machine/variables.d.ts +196 -0
- package/dist/machine/variables.js +415 -0
- package/dist/machine/variables.js.map +1 -0
- package/dist/public/cli.d.ts +15 -0
- package/dist/public/cli.js +14 -0
- package/dist/public/cli.js.map +1 -0
- package/dist/public/messages.d.ts +33 -0
- package/dist/public/messages.js +33 -0
- package/dist/public/messages.js.map +1 -0
- package/dist/public/sandbox.d.ts +99 -0
- package/dist/public/sandbox.js +32 -0
- package/dist/public/sandbox.js.map +1 -0
- package/dist/public/spec.d.ts +147 -0
- package/dist/public/spec.js +149 -0
- package/dist/public/spec.js.map +1 -0
- package/dist/public/testing.d.ts +71 -0
- package/dist/public/testing.js +39 -0
- package/dist/public/testing.js.map +1 -0
- package/dist/rubrics/rubrics.d.ts +135 -0
- package/dist/rubrics/rubrics.js +145 -0
- package/dist/rubrics/rubrics.js.map +1 -0
- package/dist/runtime/contract.d.ts +73 -0
- package/dist/runtime/contract.js +96 -0
- package/dist/runtime/contract.js.map +1 -0
- package/dist/sandbox/assets/parts/core.js +22 -0
- package/dist/sandbox/assets/parts/lifecycle-hook.js +47 -0
- package/dist/sandbox/bridge.d.ts +16 -0
- package/dist/sandbox/bridge.js +95 -0
- package/dist/sandbox/bridge.js.map +1 -0
- package/dist/sandbox/executor.d.ts +46 -0
- package/dist/sandbox/executor.js +119 -0
- package/dist/sandbox/executor.js.map +1 -0
- package/dist/sandbox/imports.d.ts +33 -0
- package/dist/sandbox/imports.js +67 -0
- package/dist/sandbox/imports.js.map +1 -0
- package/dist/sandbox/prelude.d.ts +12 -0
- package/dist/sandbox/prelude.js +51 -0
- package/dist/sandbox/prelude.js.map +1 -0
- package/dist/sandbox/ptc-gateway.d.ts +104 -0
- package/dist/sandbox/ptc-gateway.js +167 -0
- package/dist/sandbox/ptc-gateway.js.map +1 -0
- package/dist/sandbox/runtime.d.ts +59 -0
- package/dist/sandbox/runtime.js +51 -0
- package/dist/sandbox/runtime.js.map +1 -0
- package/dist/sandbox/tools.d.ts +34 -0
- package/dist/sandbox/tools.js +147 -0
- package/dist/sandbox/tools.js.map +1 -0
- package/dist/sessions/operations.d.ts +79 -0
- package/dist/sessions/operations.js +121 -0
- package/dist/sessions/operations.js.map +1 -0
- package/dist/sessions/resolve.d.ts +97 -0
- package/dist/sessions/resolve.js +145 -0
- package/dist/sessions/resolve.js.map +1 -0
- package/dist/sessions/resume.d.ts +242 -0
- package/dist/sessions/resume.js +288 -0
- package/dist/sessions/resume.js.map +1 -0
- package/dist/sessions/scope.d.ts +99 -0
- package/dist/sessions/scope.js +145 -0
- package/dist/sessions/scope.js.map +1 -0
- package/dist/sessions/summary.d.ts +65 -0
- package/dist/sessions/summary.js +56 -0
- package/dist/sessions/summary.js.map +1 -0
- package/dist/testing/assertions.d.ts +30 -0
- package/dist/testing/assertions.js +231 -0
- package/dist/testing/assertions.js.map +1 -0
- package/dist/testing/case-document.d.ts +141 -0
- package/dist/testing/case-document.js +51 -0
- package/dist/testing/case-document.js.map +1 -0
- package/dist/testing/case-schema.d.ts +29 -0
- package/dist/testing/case-schema.js +519 -0
- package/dist/testing/case-schema.js.map +1 -0
- package/dist/testing/discovery.d.ts +10 -0
- package/dist/testing/discovery.js +24 -0
- package/dist/testing/discovery.js.map +1 -0
- package/dist/testing/driver.d.ts +78 -0
- package/dist/testing/driver.js +117 -0
- package/dist/testing/driver.js.map +1 -0
- package/dist/testing/grade.d.ts +116 -0
- package/dist/testing/grade.js +261 -0
- package/dist/testing/grade.js.map +1 -0
- package/dist/testing/interpreter.d.ts +55 -0
- package/dist/testing/interpreter.js +103 -0
- package/dist/testing/interpreter.js.map +1 -0
- package/dist/testing/mock-middleware.d.ts +5 -0
- package/dist/testing/mock-middleware.js +33 -0
- package/dist/testing/mock-middleware.js.map +1 -0
- package/dist/testing/runner.d.ts +205 -0
- package/dist/testing/runner.js +266 -0
- package/dist/testing/runner.js.map +1 -0
- package/dist/testing/target.d.ts +27 -0
- package/dist/testing/target.js +21 -0
- package/dist/testing/target.js.map +1 -0
- package/dist/validate/validate.d.ts +41 -0
- package/dist/validate/validate.js +669 -0
- package/dist/validate/validate.js.map +1 -0
- package/dist/workflow/agent-tools.d.ts +10 -0
- package/dist/workflow/agent-tools.js +10 -0
- package/dist/workflow/agent-tools.js.map +1 -0
- package/dist/workflow/checkpointer.d.ts +52 -0
- package/dist/workflow/checkpointer.js +200 -0
- package/dist/workflow/checkpointer.js.map +1 -0
- package/dist/workflow/control-tools.d.ts +174 -0
- package/dist/workflow/control-tools.js +468 -0
- package/dist/workflow/control-tools.js.map +1 -0
- package/dist/workflow/governance.d.ts +104 -0
- package/dist/workflow/governance.js +546 -0
- package/dist/workflow/governance.js.map +1 -0
- package/dist/workflow/middleware.d.ts +85 -0
- package/dist/workflow/middleware.js +283 -0
- package/dist/workflow/middleware.js.map +1 -0
- package/dist/workflow/on-error.d.ts +25 -0
- package/dist/workflow/on-error.js +58 -0
- package/dist/workflow/on-error.js.map +1 -0
- package/dist/workflow/parks.d.ts +46 -0
- package/dist/workflow/parks.js +513 -0
- package/dist/workflow/parks.js.map +1 -0
- package/dist/workflow/paths.d.ts +67 -0
- package/dist/workflow/paths.js +108 -0
- package/dist/workflow/paths.js.map +1 -0
- package/dist/workflow/prompt-cache.d.ts +70 -0
- package/dist/workflow/prompt-cache.js +103 -0
- package/dist/workflow/prompt-cache.js.map +1 -0
- package/dist/workflow/prompt-pruning.d.ts +20 -0
- package/dist/workflow/prompt-pruning.js +83 -0
- package/dist/workflow/prompt-pruning.js.map +1 -0
- package/dist/workflow/render-prompt.d.ts +45 -0
- package/dist/workflow/render-prompt.js +140 -0
- package/dist/workflow/render-prompt.js.map +1 -0
- package/dist/workflow/runtime-config.d.ts +7 -0
- package/dist/workflow/runtime-config.js +9 -0
- package/dist/workflow/runtime-config.js.map +1 -0
- package/dist/workflow/session-artifacts.d.ts +90 -0
- package/dist/workflow/session-artifacts.js +134 -0
- package/dist/workflow/session-artifacts.js.map +1 -0
- package/dist/workflow/session-view.d.ts +31 -0
- package/dist/workflow/session-view.js +94 -0
- package/dist/workflow/session-view.js.map +1 -0
- package/dist/workflow/snapshot.d.ts +14 -0
- package/dist/workflow/snapshot.js +97 -0
- package/dist/workflow/snapshot.js.map +1 -0
- package/dist/workflow/state.d.ts +347 -0
- package/dist/workflow/state.js +322 -0
- package/dist/workflow/state.js.map +1 -0
- package/dist/workflow/sub-workflow.d.ts +174 -0
- package/dist/workflow/sub-workflow.js +392 -0
- package/dist/workflow/sub-workflow.js.map +1 -0
- package/dist/workflow/tool-service.d.ts +48 -0
- package/dist/workflow/tool-service.js +291 -0
- package/dist/workflow/tool-service.js.map +1 -0
- package/dist/workflow/turn-boundary.d.ts +39 -0
- package/dist/workflow/turn-boundary.js +128 -0
- package/dist/workflow/turn-boundary.js.map +1 -0
- package/dist/workflow/turn-runner.d.ts +40 -0
- package/dist/workflow/turn-runner.js +122 -0
- package/dist/workflow/turn-runner.js.map +1 -0
- package/dist/workflow/workflow-tools.d.ts +46 -0
- package/dist/workflow/workflow-tools.js +90 -0
- package/dist/workflow/workflow-tools.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness/sandbox` — the typed authoring surface for lifecycle hook
|
|
3
|
+
* scripts. Inside the QuickJS sandbox these names are provided by the prelude
|
|
4
|
+
* and the import line is stripped before evaluation; importing from here buys
|
|
5
|
+
* IDE completion for the hook input, nothing at runtime.
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* import { veto, ok } from "@archmax-ai/harness/sandbox";
|
|
9
|
+
* /** Vetoes a refund the policy forbids. *\/
|
|
10
|
+
* export default async function hook({ state, phase, variables, messages, tools }) {
|
|
11
|
+
* const refund = JSON.parse(await tools.readFile({ file_path: "scratchpad/refund.json" }));
|
|
12
|
+
* if (refund.decision !== "denied") return veto(`order ${refund.orderId} is not eligible`);
|
|
13
|
+
* return ok();
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Returning nothing is `ok`; throwing is a veto (hooks are fail-closed).
|
|
18
|
+
*/
|
|
19
|
+
export function ok(reason = "ok") {
|
|
20
|
+
return { verdict: "ok", reason };
|
|
21
|
+
}
|
|
22
|
+
export function veto(reason) {
|
|
23
|
+
return { verdict: "veto", reason };
|
|
24
|
+
}
|
|
25
|
+
export function correct(reason) {
|
|
26
|
+
return { verdict: "correct", reason };
|
|
27
|
+
}
|
|
28
|
+
/** Alias for `export default`: `export default defineHook(async (input) => …)`. Identity at runtime. */
|
|
29
|
+
export function defineHook(fn) {
|
|
30
|
+
return fn;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/public/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAmFH,MAAM,UAAU,EAAE,CAAC,MAAM,GAAG,IAAI;IAC9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,MAAc;IACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness/spec` — the workflow vocabulary with **no runtime behind it**:
|
|
3
|
+
* the `workflow.yaml` schema, the pure validator, the slug, variable and
|
|
4
|
+
* session-path grammars, the reserved names and the path conventions.
|
|
5
|
+
*
|
|
6
|
+
* Browser-safe by construction: nothing reachable from here imports `node:*`,
|
|
7
|
+
* LangGraph, Deep Agents, the sandbox or a filesystem library, and a unit test
|
|
8
|
+
* walks this module's import graph to keep it that way. An editor bundles it
|
|
9
|
+
* into a page; an API request path that only has to parse or validate a spec
|
|
10
|
+
* imports it without loading the runtime.
|
|
11
|
+
*
|
|
12
|
+
* What is **not** here, because it cannot be pure: loading a spec from a
|
|
13
|
+
* backend (`loadMachineSpec`), compiling one (`WorkflowMachine`), the full
|
|
14
|
+
* validator (`validateWorkflow`, which also probes the kernel and reads hook
|
|
15
|
+
* scripts), resolving a trigger against a machine, and every store and mount.
|
|
16
|
+
* Those stay on the package root.
|
|
17
|
+
*
|
|
18
|
+
* Several names here are also on the root. That is deliberate: this subpath
|
|
19
|
+
* exists for the weight of the import, not to move the names — and a test pins
|
|
20
|
+
* that a shared name is the same binding on both.
|
|
21
|
+
*/
|
|
22
|
+
export {
|
|
23
|
+
/** The whole `workflow.yaml` document. Parse with it and pass the **output** on; never compose it into another schema. */
|
|
24
|
+
machineSpecSchema,
|
|
25
|
+
/** One state. */
|
|
26
|
+
machineStateSchema,
|
|
27
|
+
/** A trigger's declaration under a state's `triggers:`. Loose: host keys pass through. */
|
|
28
|
+
triggerDeclarationSchema,
|
|
29
|
+
/** A state's `triggers:` mapping — trigger id to declaration (or `null`). */
|
|
30
|
+
stateTriggersSchema,
|
|
31
|
+
/** One transition. */
|
|
32
|
+
machineTransitionSchema, transitionTypeSchema, stateTypeSchema, stateBudgetSchema, allowEntrySchema, forbidEntrySchema,
|
|
33
|
+
/** The `*` entry a `forbid` list uses to refuse every tool. */
|
|
34
|
+
FORBID_ANY_TOOL, toolsBlockSchema, skillsBlockSchema, mountAccessSchema, mountGrantEntrySchema, mountsBlockSchema, workflowMountsConfigSchema, hookSchema, hookSpecSchema, rubricDeclarationSchema, workflowToolsConfigSchema, workflowSkillsConfigSchema, machineSettingsSchema, machinePromptCacheSettingsSchema, workflowTestsConfigSchema, runtimeMetadataSchema, specExtensionsSchema,
|
|
35
|
+
/** The loose slot for host metadata at the root, on a state and on a rubric. */
|
|
36
|
+
specMetadataSchema,
|
|
37
|
+
/** Shape plus document-level cross-references, as one total function. */
|
|
38
|
+
parseMachineSpec,
|
|
39
|
+
/** The document-level rules alone, over a spec the shape has accepted. */
|
|
40
|
+
refineSpec, } from "../machine/spec-schema.js";
|
|
41
|
+
export type { SpecSchemaIssue } from "../machine/spec-schema.js";
|
|
42
|
+
export type { MachineSpec, MachineState, MachineTransition, TransitionType, Hook, HookSpec, StateBudget, AllowEntry, ForbidEntry, ToolsBlock, SkillsBlock, MountAccess, MountGrantEntry, MountsBlock, WorkflowMountsConfig, StateType, WorkflowToolsConfig, WorkflowSkillsConfig, MachineSettings, MachinePromptCacheSettings, WorkflowTestsConfig, RuntimeMetadata, TriggerDeclaration, SpecExtensions, SpecMetadata, RubricDeclaration, } from "../machine/types.js";
|
|
43
|
+
/** Whether a spec declares itself out of service (`disabled: true`). */
|
|
44
|
+
export { specDisabled } from "../machine/types.js";
|
|
45
|
+
export {
|
|
46
|
+
/** Everything the document alone can say: shape, cross-references and lint, as diagnostics. */
|
|
47
|
+
validateSpec,
|
|
48
|
+
/** One structural issue as an error-severity diagnostic. */
|
|
49
|
+
schemaIssueDiagnostic, } from "../machine/validate-spec.js";
|
|
50
|
+
export type { SpecValidation } from "../machine/validate-spec.js";
|
|
51
|
+
/** The advisories alone, over a spec the schema has accepted. */
|
|
52
|
+
export { lintSpec } from "../machine/lint-spec.js";
|
|
53
|
+
export type { Diagnostic, DiagnosticSeverity } from "../machine/diagnostic.js";
|
|
54
|
+
export { normalizeMountGrants } from "../machine/mount-grants.js";
|
|
55
|
+
export type { NormalizedMountGrant } from "../machine/mount-grants.js";
|
|
56
|
+
export {
|
|
57
|
+
/** The mount a canonical relative path addresses, longest key first. */
|
|
58
|
+
mountNameOf,
|
|
59
|
+
/** The mount a glob can only ever match inside, or `null` when it is broader. */
|
|
60
|
+
mountNameOfPattern, } from "../core/zones.js";
|
|
61
|
+
export {
|
|
62
|
+
/** A `before:`/`after:` declaration as a flat list of hooks. */
|
|
63
|
+
normalizeHooks,
|
|
64
|
+
/** A hook's kind (`script`, `subagent`, a custom one). */
|
|
65
|
+
hookKind,
|
|
66
|
+
/** A hook's value: the script path, the rubric name. */
|
|
67
|
+
hookValue,
|
|
68
|
+
/** The keys that ride beside a hook's kind (`max_iterations`) rather than naming one. */
|
|
69
|
+
HOOK_SIDECAR_KEYS, } from "../lifecycle/hook-shape.js";
|
|
70
|
+
export { SLUG_PATTERN, isSlug } from "../machine/slug.js";
|
|
71
|
+
export { MANUAL_TRIGGER, DEFAULT_TRIGGER_ID,
|
|
72
|
+
/** Parse a dotted session path (`triggers.-1.conversationId`). */
|
|
73
|
+
parseSessionPath,
|
|
74
|
+
/** Resolve a parsed session path against a firing's variables. */
|
|
75
|
+
resolveSessionId,
|
|
76
|
+
/** The session id a firing of a trigger resolves to under a spec, or `undefined` when the runtime would mint one. */
|
|
77
|
+
sessionIdForTrigger,
|
|
78
|
+
/** Every trigger a spec declares, keyed by id, with the state each enters. */
|
|
79
|
+
triggerBindings,
|
|
80
|
+
/** The trigger ids one state declares. */
|
|
81
|
+
stateTriggerIds,
|
|
82
|
+
/** Every variable a spec's `requires` declarations guarantee. */
|
|
83
|
+
declaredVariableNames, } from "../machine/triggers.js";
|
|
84
|
+
export type { SessionPath, SessionPathParse, TriggerBinding, TriggerInput, ResolvedTrigger, } from "../machine/triggers.js";
|
|
85
|
+
export { VARIABLE_NAME_PATTERN,
|
|
86
|
+
/** The reserved variable holding the session's current trigger id. */
|
|
87
|
+
TRIGGER_VARIABLE,
|
|
88
|
+
/** The reserved variable naming the session's task for a listing. */
|
|
89
|
+
TITLE_VARIABLE, TITLE_MAX_LENGTH,
|
|
90
|
+
/** Whether a glob or text carries a `${{…}}` reference. */
|
|
91
|
+
hasVariableReference,
|
|
92
|
+
/** Every `${{…}}` reference in a glob or text. */
|
|
93
|
+
parseReferences,
|
|
94
|
+
/** Why a reference cannot be written, or `undefined` when it can. */
|
|
95
|
+
referenceError,
|
|
96
|
+
/** Step into a structured value along a dotted path. */
|
|
97
|
+
resolvePath,
|
|
98
|
+
/** Substitute every reference in a text against a variable store. */
|
|
99
|
+
resolveText, } from "../machine/variables.js";
|
|
100
|
+
export type { VariableReference, VariableStore, VariableEntry } from "../machine/variables.js";
|
|
101
|
+
export { ARCHMAX_TOOL_PREFIX, ADVANCE_TOOL, RESET_TOOL, WAIT_TOOL, EVAL_TOOL, RUN_TOOL, GET_VARIABLES_TOOL, SET_VARIABLES_TOOL,
|
|
102
|
+
/** The tool name a runtime note's call pair wears; registered nowhere. */
|
|
103
|
+
NOTE_TOOL, WORKFLOW_TOOL_PREFIX, workflowToolName, workflowSlugFromToolName, isWorkflowToolName,
|
|
104
|
+
/** Whether a name is one the runtime owns (`archmax_*`). */
|
|
105
|
+
isReservedToolName,
|
|
106
|
+
/** The control tools: advance, reset, wait, get/set variables. */
|
|
107
|
+
HARNESS_CONTROL_TOOLS,
|
|
108
|
+
/** Tools permitted in every state regardless of `allow`. */
|
|
109
|
+
ALWAYS_ALLOWED_TOOLS,
|
|
110
|
+
/** The always-on built-ins a state's own entry may narrow but `allow_always` cannot add to. */
|
|
111
|
+
ESSENTIAL_TOOLS,
|
|
112
|
+
/** Tools no list may grant (`task`). */
|
|
113
|
+
UNGRANTABLE_TOOLS, ReservedToolNameError, } from "../machine/tool-names.js";
|
|
114
|
+
export { DEFAULT_SUB_WORKFLOW_DEPTH, DEFAULT_SUB_WORKFLOW_CONCURRENCY } from "../machine/delegation.js";
|
|
115
|
+
export { SESSION_INTERNAL_DIRS, SESSION_OFFLOAD_DIRS, SESSION_OPEN_DIR, SESSION_AGNOSTIC_PREFIX, SESSION_AGNOSTIC_PREFIXES, NO_MOUNTS,
|
|
116
|
+
/** Every session-area name the runtime owns at the workspace root. */
|
|
117
|
+
sessionAreaNames, classifyWorkspacePath, isReservedRootName, isSessionAgnosticPath,
|
|
118
|
+
/** The prefixes the authoring backend serves (`workflows`), reserved at the root. */
|
|
119
|
+
AUTHORING_PREFIXES, isAuthoringPrefix,
|
|
120
|
+
/** The authoring prefix a canonical path addresses, or `null`. */
|
|
121
|
+
authoringPlanePrefix, describeAuthoringPrefix, } from "../core/zones.js";
|
|
122
|
+
export type { MountPrefixes, WorkspaceZone, AuthoringPrefix } from "../core/zones.js";
|
|
123
|
+
export {
|
|
124
|
+
/** Why a session id cannot own a session folder, or `null` when it can. */
|
|
125
|
+
sessionIdRejection, SessionStoreIdError,
|
|
126
|
+
/** Directory of the zero-config filesystem session store (`sessions`). */
|
|
127
|
+
DEFAULT_SESSIONS_DIR, } from "../core/session-id.js";
|
|
128
|
+
export {
|
|
129
|
+
/** Whether one session was dispatched by another, at any depth. */
|
|
130
|
+
isChildSessionOf,
|
|
131
|
+
/** The session that dispatched this one, or `undefined` at the top level. */
|
|
132
|
+
parentSessionIdOf,
|
|
133
|
+
/** The id a child session gets: `<parent>~<identity>`. */
|
|
134
|
+
childSessionId,
|
|
135
|
+
/** A dispatch identity: `<state>:<workflow>:<ordinal>`. */
|
|
136
|
+
subRunIdentity, } from "../sessions/scope.js";
|
|
137
|
+
export { DEFAULT_WORKFLOW,
|
|
138
|
+
/** Where a hook script lives, relative to its workflow directory. */
|
|
139
|
+
HOOKS_DIR, PLATFORM_PROMPT_PATH, PLATFORM_BACKEND_PROMPT_PATH,
|
|
140
|
+
/** The authored paths of one workflow (`workflow.yaml`, `WORKFLOW.md`, `tests/`, `hooks/`). */
|
|
141
|
+
workflowPaths,
|
|
142
|
+
/** The runtime-internal layout of one session's folder. */
|
|
143
|
+
sessionPaths,
|
|
144
|
+
/** Resolve a hook's declared `script:` to an authoring-backend path, or refuse it with a reason. */
|
|
145
|
+
resolveHookScript, } from "../workflow/paths.js";
|
|
146
|
+
export { parseCodeDescription } from "../core/code-description.js";
|
|
147
|
+
export type { CodeDescription } from "../core/code-description.js";
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness/spec` — the workflow vocabulary with **no runtime behind it**:
|
|
3
|
+
* the `workflow.yaml` schema, the pure validator, the slug, variable and
|
|
4
|
+
* session-path grammars, the reserved names and the path conventions.
|
|
5
|
+
*
|
|
6
|
+
* Browser-safe by construction: nothing reachable from here imports `node:*`,
|
|
7
|
+
* LangGraph, Deep Agents, the sandbox or a filesystem library, and a unit test
|
|
8
|
+
* walks this module's import graph to keep it that way. An editor bundles it
|
|
9
|
+
* into a page; an API request path that only has to parse or validate a spec
|
|
10
|
+
* imports it without loading the runtime.
|
|
11
|
+
*
|
|
12
|
+
* What is **not** here, because it cannot be pure: loading a spec from a
|
|
13
|
+
* backend (`loadMachineSpec`), compiling one (`WorkflowMachine`), the full
|
|
14
|
+
* validator (`validateWorkflow`, which also probes the kernel and reads hook
|
|
15
|
+
* scripts), resolving a trigger against a machine, and every store and mount.
|
|
16
|
+
* Those stay on the package root.
|
|
17
|
+
*
|
|
18
|
+
* Several names here are also on the root. That is deliberate: this subpath
|
|
19
|
+
* exists for the weight of the import, not to move the names — and a test pins
|
|
20
|
+
* that a shared name is the same binding on both.
|
|
21
|
+
*/
|
|
22
|
+
// --- The schema --------------------------------------------------------------
|
|
23
|
+
export {
|
|
24
|
+
/** The whole `workflow.yaml` document. Parse with it and pass the **output** on; never compose it into another schema. */
|
|
25
|
+
machineSpecSchema,
|
|
26
|
+
/** One state. */
|
|
27
|
+
machineStateSchema,
|
|
28
|
+
/** A trigger's declaration under a state's `triggers:`. Loose: host keys pass through. */
|
|
29
|
+
triggerDeclarationSchema,
|
|
30
|
+
/** A state's `triggers:` mapping — trigger id to declaration (or `null`). */
|
|
31
|
+
stateTriggersSchema,
|
|
32
|
+
/** One transition. */
|
|
33
|
+
machineTransitionSchema, transitionTypeSchema, stateTypeSchema, stateBudgetSchema, allowEntrySchema, forbidEntrySchema,
|
|
34
|
+
/** The `*` entry a `forbid` list uses to refuse every tool. */
|
|
35
|
+
FORBID_ANY_TOOL, toolsBlockSchema, skillsBlockSchema, mountAccessSchema, mountGrantEntrySchema, mountsBlockSchema, workflowMountsConfigSchema, hookSchema, hookSpecSchema, rubricDeclarationSchema, workflowToolsConfigSchema, workflowSkillsConfigSchema, machineSettingsSchema, machinePromptCacheSettingsSchema, workflowTestsConfigSchema, runtimeMetadataSchema, specExtensionsSchema,
|
|
36
|
+
/** The loose slot for host metadata at the root, on a state and on a rubric. */
|
|
37
|
+
specMetadataSchema,
|
|
38
|
+
/** Shape plus document-level cross-references, as one total function. */
|
|
39
|
+
parseMachineSpec,
|
|
40
|
+
/** The document-level rules alone, over a spec the shape has accepted. */
|
|
41
|
+
refineSpec, } from "../machine/spec-schema.js";
|
|
42
|
+
/** Whether a spec declares itself out of service (`disabled: true`). */
|
|
43
|
+
export { specDisabled } from "../machine/types.js";
|
|
44
|
+
// --- Validation and advisories --------------------------------------------------
|
|
45
|
+
export {
|
|
46
|
+
/** Everything the document alone can say: shape, cross-references and lint, as diagnostics. */
|
|
47
|
+
validateSpec,
|
|
48
|
+
/** One structural issue as an error-severity diagnostic. */
|
|
49
|
+
schemaIssueDiagnostic, } from "../machine/validate-spec.js";
|
|
50
|
+
/** The advisories alone, over a spec the schema has accepted. */
|
|
51
|
+
export { lintSpec } from "../machine/lint-spec.js";
|
|
52
|
+
// --- Mount grants -----------------------------------------------------------------
|
|
53
|
+
export { normalizeMountGrants } from "../machine/mount-grants.js";
|
|
54
|
+
export {
|
|
55
|
+
/** The mount a canonical relative path addresses, longest key first. */
|
|
56
|
+
mountNameOf,
|
|
57
|
+
/** The mount a glob can only ever match inside, or `null` when it is broader. */
|
|
58
|
+
mountNameOfPattern, } from "../core/zones.js";
|
|
59
|
+
// --- Hooks ------------------------------------------------------------------------
|
|
60
|
+
export {
|
|
61
|
+
/** A `before:`/`after:` declaration as a flat list of hooks. */
|
|
62
|
+
normalizeHooks,
|
|
63
|
+
/** A hook's kind (`script`, `subagent`, a custom one). */
|
|
64
|
+
hookKind,
|
|
65
|
+
/** A hook's value: the script path, the rubric name. */
|
|
66
|
+
hookValue,
|
|
67
|
+
/** The keys that ride beside a hook's kind (`max_iterations`) rather than naming one. */
|
|
68
|
+
HOOK_SIDECAR_KEYS, } from "../lifecycle/hook-shape.js";
|
|
69
|
+
// --- Slugs, triggers, variables --------------------------------------------------
|
|
70
|
+
export { SLUG_PATTERN, isSlug } from "../machine/slug.js";
|
|
71
|
+
export { MANUAL_TRIGGER, DEFAULT_TRIGGER_ID,
|
|
72
|
+
/** Parse a dotted session path (`triggers.-1.conversationId`). */
|
|
73
|
+
parseSessionPath,
|
|
74
|
+
/** Resolve a parsed session path against a firing's variables. */
|
|
75
|
+
resolveSessionId,
|
|
76
|
+
/** The session id a firing of a trigger resolves to under a spec, or `undefined` when the runtime would mint one. */
|
|
77
|
+
sessionIdForTrigger,
|
|
78
|
+
/** Every trigger a spec declares, keyed by id, with the state each enters. */
|
|
79
|
+
triggerBindings,
|
|
80
|
+
/** The trigger ids one state declares. */
|
|
81
|
+
stateTriggerIds,
|
|
82
|
+
/** Every variable a spec's `requires` declarations guarantee. */
|
|
83
|
+
declaredVariableNames, } from "../machine/triggers.js";
|
|
84
|
+
export { VARIABLE_NAME_PATTERN,
|
|
85
|
+
/** The reserved variable holding the session's current trigger id. */
|
|
86
|
+
TRIGGER_VARIABLE,
|
|
87
|
+
/** The reserved variable naming the session's task for a listing. */
|
|
88
|
+
TITLE_VARIABLE, TITLE_MAX_LENGTH,
|
|
89
|
+
/** Whether a glob or text carries a `${{…}}` reference. */
|
|
90
|
+
hasVariableReference,
|
|
91
|
+
/** Every `${{…}}` reference in a glob or text. */
|
|
92
|
+
parseReferences,
|
|
93
|
+
/** Why a reference cannot be written, or `undefined` when it can. */
|
|
94
|
+
referenceError,
|
|
95
|
+
/** Step into a structured value along a dotted path. */
|
|
96
|
+
resolvePath,
|
|
97
|
+
/** Substitute every reference in a text against a variable store. */
|
|
98
|
+
resolveText, } from "../machine/variables.js";
|
|
99
|
+
// --- Tool names ---------------------------------------------------------------------
|
|
100
|
+
export { ARCHMAX_TOOL_PREFIX, ADVANCE_TOOL, RESET_TOOL, WAIT_TOOL, EVAL_TOOL, RUN_TOOL, GET_VARIABLES_TOOL, SET_VARIABLES_TOOL,
|
|
101
|
+
/** The tool name a runtime note's call pair wears; registered nowhere. */
|
|
102
|
+
NOTE_TOOL, WORKFLOW_TOOL_PREFIX, workflowToolName, workflowSlugFromToolName, isWorkflowToolName,
|
|
103
|
+
/** Whether a name is one the runtime owns (`archmax_*`). */
|
|
104
|
+
isReservedToolName,
|
|
105
|
+
/** The control tools: advance, reset, wait, get/set variables. */
|
|
106
|
+
HARNESS_CONTROL_TOOLS,
|
|
107
|
+
/** Tools permitted in every state regardless of `allow`. */
|
|
108
|
+
ALWAYS_ALLOWED_TOOLS,
|
|
109
|
+
/** The always-on built-ins a state's own entry may narrow but `allow_always` cannot add to. */
|
|
110
|
+
ESSENTIAL_TOOLS,
|
|
111
|
+
/** Tools no list may grant (`task`). */
|
|
112
|
+
UNGRANTABLE_TOOLS, ReservedToolNameError, } from "../machine/tool-names.js";
|
|
113
|
+
export { DEFAULT_SUB_WORKFLOW_DEPTH, DEFAULT_SUB_WORKFLOW_CONCURRENCY } from "../machine/delegation.js";
|
|
114
|
+
// --- The root namespace ---------------------------------------------------------------
|
|
115
|
+
export { SESSION_INTERNAL_DIRS, SESSION_OFFLOAD_DIRS, SESSION_OPEN_DIR, SESSION_AGNOSTIC_PREFIX, SESSION_AGNOSTIC_PREFIXES, NO_MOUNTS,
|
|
116
|
+
/** Every session-area name the runtime owns at the workspace root. */
|
|
117
|
+
sessionAreaNames, classifyWorkspacePath, isReservedRootName, isSessionAgnosticPath,
|
|
118
|
+
/** The prefixes the authoring backend serves (`workflows`), reserved at the root. */
|
|
119
|
+
AUTHORING_PREFIXES, isAuthoringPrefix,
|
|
120
|
+
/** The authoring prefix a canonical path addresses, or `null`. */
|
|
121
|
+
authoringPlanePrefix, describeAuthoringPrefix, } from "../core/zones.js";
|
|
122
|
+
// --- Session ids -----------------------------------------------------------------------
|
|
123
|
+
export {
|
|
124
|
+
/** Why a session id cannot own a session folder, or `null` when it can. */
|
|
125
|
+
sessionIdRejection, SessionStoreIdError,
|
|
126
|
+
/** Directory of the zero-config filesystem session store (`sessions`). */
|
|
127
|
+
DEFAULT_SESSIONS_DIR, } from "../core/session-id.js";
|
|
128
|
+
export {
|
|
129
|
+
/** Whether one session was dispatched by another, at any depth. */
|
|
130
|
+
isChildSessionOf,
|
|
131
|
+
/** The session that dispatched this one, or `undefined` at the top level. */
|
|
132
|
+
parentSessionIdOf,
|
|
133
|
+
/** The id a child session gets: `<parent>~<identity>`. */
|
|
134
|
+
childSessionId,
|
|
135
|
+
/** A dispatch identity: `<state>:<workflow>:<ordinal>`. */
|
|
136
|
+
subRunIdentity, } from "../sessions/scope.js";
|
|
137
|
+
// --- Paths -------------------------------------------------------------------------------
|
|
138
|
+
export { DEFAULT_WORKFLOW,
|
|
139
|
+
/** Where a hook script lives, relative to its workflow directory. */
|
|
140
|
+
HOOKS_DIR, PLATFORM_PROMPT_PATH, PLATFORM_BACKEND_PROMPT_PATH,
|
|
141
|
+
/** The authored paths of one workflow (`workflow.yaml`, `WORKFLOW.md`, `tests/`, `hooks/`). */
|
|
142
|
+
workflowPaths,
|
|
143
|
+
/** The runtime-internal layout of one session's folder. */
|
|
144
|
+
sessionPaths,
|
|
145
|
+
/** Resolve a hook's declared `script:` to an authoring-backend path, or refuse it with a reason. */
|
|
146
|
+
resolveHookScript, } from "../workflow/paths.js";
|
|
147
|
+
// --- Scripts -------------------------------------------------------------------------------
|
|
148
|
+
export { parseCodeDescription } from "../core/code-description.js";
|
|
149
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/public/spec.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness/testing` — the case engine behind `archmax test`.
|
|
3
|
+
*
|
|
4
|
+
* A subpath of its own so a production import never pulls in test machinery: a
|
|
5
|
+
* host that builds cases programmatically, drives a suite in CI, or mocks tools
|
|
6
|
+
* imports here, and everything else imports the root.
|
|
7
|
+
*
|
|
8
|
+
* Cases are declarative YAML documents interpreted **host-side** — no sandbox
|
|
9
|
+
* is involved. See the testing guide.
|
|
10
|
+
*/
|
|
11
|
+
export {
|
|
12
|
+
/** Discover and run a workflow's cases. */
|
|
13
|
+
runTests,
|
|
14
|
+
/** Find and parse a suite's case files. */
|
|
15
|
+
discoverCases,
|
|
16
|
+
/** Drive one discovered case against an agent under test. */
|
|
17
|
+
runCase,
|
|
18
|
+
/** Reduce a case's assertion records to a verdict. */
|
|
19
|
+
reduceVerdict,
|
|
20
|
+
/** The process exit code a verdict implies. */
|
|
21
|
+
exitCodeForVerdict,
|
|
22
|
+
/** Refuse a target that is not workflow-governed, on the runner's own terms. */
|
|
23
|
+
assertWorkflowGovernedTarget, } from "../testing/runner.js";
|
|
24
|
+
export type {
|
|
25
|
+
/** One case's outcome. */
|
|
26
|
+
CaseResult,
|
|
27
|
+
/** A single assertion's record. */
|
|
28
|
+
AssertionRecord,
|
|
29
|
+
/** Whether an assertion passed, failed, or never ran. */
|
|
30
|
+
AssertionStatus,
|
|
31
|
+
/** A case's settled verdict. */
|
|
32
|
+
CaseVerdict,
|
|
33
|
+
/** A verdict's status: passed, failed, or skipped. */
|
|
34
|
+
CaseStatus,
|
|
35
|
+
/** Options for {@link runTests}. */
|
|
36
|
+
RunTestsOptions,
|
|
37
|
+
/** What {@link runTests} returns. */
|
|
38
|
+
RunTestsResult,
|
|
39
|
+
/** Why a whole suite ran no cases. */
|
|
40
|
+
SuiteSkip,
|
|
41
|
+
/** A parsed (or unparseable) case file, as {@link discoverCases} reports it. */
|
|
42
|
+
DiscoveredCase,
|
|
43
|
+
/** Options for {@link runCase}. */
|
|
44
|
+
RunCaseOptions, } from "../testing/runner.js";
|
|
45
|
+
/** Build the agent under test. Replaceable via `runTests({ createTarget })`. */
|
|
46
|
+
export { createCaseTarget } from "../testing/target.js";
|
|
47
|
+
export type { CaseTargetOptions } from "../testing/target.js";
|
|
48
|
+
export {
|
|
49
|
+
/** Parse one case document, for a host that builds or validates cases itself. */
|
|
50
|
+
parseCaseDocument,
|
|
51
|
+
/** The inverse: a case document back to YAML, in the grammar's key order. */
|
|
52
|
+
serializeCaseDocument,
|
|
53
|
+
/** The prose-length bounds a case's `title` and `description` are held to. */
|
|
54
|
+
CASE_TITLE_MAX_LENGTH, CASE_DESCRIPTION_MAX_LENGTH,
|
|
55
|
+
/** A structural problem in a case document. */
|
|
56
|
+
CaseSchemaError, } from "../testing/case-schema.js";
|
|
57
|
+
export type {
|
|
58
|
+
/** A parsed case. */
|
|
59
|
+
CaseDocument,
|
|
60
|
+
/** One entry of a case's flat `steps` list. */
|
|
61
|
+
CaseStep,
|
|
62
|
+
/** A declarative assertion. */
|
|
63
|
+
CaseExpectation,
|
|
64
|
+
/** A declared trigger start condition. */
|
|
65
|
+
CaseTriggerDecl,
|
|
66
|
+
/** One seeded workspace file. */
|
|
67
|
+
CaseWorkspaceEntry, } from "../testing/case-schema.js";
|
|
68
|
+
/** Middleware that intercepts declared tool mocks, for a caller-built target. */
|
|
69
|
+
export { createToolMockMiddleware } from "../testing/mock-middleware.js";
|
|
70
|
+
/** The partial-match vocabulary shared by `calledTool.input` assertions and `whenInput` mocks. */
|
|
71
|
+
export { partialMatch } from "../core/match.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness/testing` — the case engine behind `archmax test`.
|
|
3
|
+
*
|
|
4
|
+
* A subpath of its own so a production import never pulls in test machinery: a
|
|
5
|
+
* host that builds cases programmatically, drives a suite in CI, or mocks tools
|
|
6
|
+
* imports here, and everything else imports the root.
|
|
7
|
+
*
|
|
8
|
+
* Cases are declarative YAML documents interpreted **host-side** — no sandbox
|
|
9
|
+
* is involved. See the testing guide.
|
|
10
|
+
*/
|
|
11
|
+
export {
|
|
12
|
+
/** Discover and run a workflow's cases. */
|
|
13
|
+
runTests,
|
|
14
|
+
/** Find and parse a suite's case files. */
|
|
15
|
+
discoverCases,
|
|
16
|
+
/** Drive one discovered case against an agent under test. */
|
|
17
|
+
runCase,
|
|
18
|
+
/** Reduce a case's assertion records to a verdict. */
|
|
19
|
+
reduceVerdict,
|
|
20
|
+
/** The process exit code a verdict implies. */
|
|
21
|
+
exitCodeForVerdict,
|
|
22
|
+
/** Refuse a target that is not workflow-governed, on the runner's own terms. */
|
|
23
|
+
assertWorkflowGovernedTarget, } from "../testing/runner.js";
|
|
24
|
+
/** Build the agent under test. Replaceable via `runTests({ createTarget })`. */
|
|
25
|
+
export { createCaseTarget } from "../testing/target.js";
|
|
26
|
+
export {
|
|
27
|
+
/** Parse one case document, for a host that builds or validates cases itself. */
|
|
28
|
+
parseCaseDocument,
|
|
29
|
+
/** The inverse: a case document back to YAML, in the grammar's key order. */
|
|
30
|
+
serializeCaseDocument,
|
|
31
|
+
/** The prose-length bounds a case's `title` and `description` are held to. */
|
|
32
|
+
CASE_TITLE_MAX_LENGTH, CASE_DESCRIPTION_MAX_LENGTH,
|
|
33
|
+
/** A structural problem in a case document. */
|
|
34
|
+
CaseSchemaError, } from "../testing/case-schema.js";
|
|
35
|
+
/** Middleware that intercepts declared tool mocks, for a caller-built target. */
|
|
36
|
+
export { createToolMockMiddleware } from "../testing/mock-middleware.js";
|
|
37
|
+
/** The partial-match vocabulary shared by `calledTool.input` assertions and `whenInput` mocks. */
|
|
38
|
+
export { partialMatch } from "../core/match.js";
|
|
39
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/public/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO;AACL,2CAA2C;AAC3C,QAAQ;AACR,2CAA2C;AAC3C,aAAa;AACb,6DAA6D;AAC7D,OAAO;AACP,sDAAsD;AACtD,aAAa;AACb,+CAA+C;AAC/C,kBAAkB;AAClB,gFAAgF;AAChF,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAyB9B,gFAAgF;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO;AACL,iFAAiF;AACjF,iBAAiB;AACjB,6EAA6E;AAC7E,qBAAqB;AACrB,8EAA8E;AAC9E,qBAAqB,EACrB,2BAA2B;AAC3B,+CAA+C;AAC/C,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAenC,iFAAiF;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,kGAAkG;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grading rubrics: the standards a state's exit is measured against, declared
|
|
3
|
+
* inline on the hook that applies them and dispatched by the runtime alone.
|
|
4
|
+
*
|
|
5
|
+
* This module is only the *vocabulary* — the verdict contract, the payload a
|
|
6
|
+
* grader receives, the rejection wording, and the projection from a loaded spec
|
|
7
|
+
* into a registry. There is deliberately no loader, no file format and no merge
|
|
8
|
+
* path: a rubric is spec content, so the spec's own schema is the one thing that
|
|
9
|
+
* has to accept it, and nothing outside assembly builds a registry.
|
|
10
|
+
*
|
|
11
|
+
* A rubric has no author-given name. Its identity is its **position** — the
|
|
12
|
+
* state, the phase, and its index in that phase's hook list — which is also how
|
|
13
|
+
* its retry budget is keyed, so two graders on one state can never share a
|
|
14
|
+
* budget or be confused for one another in an event.
|
|
15
|
+
*/
|
|
16
|
+
import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
17
|
+
import type { CreateDeepAgentParams } from "deepagents";
|
|
18
|
+
import type { MachineSpec, RubricDeclaration } from "../machine/types.js";
|
|
19
|
+
/** A grader in the Deep Agents shape, registered for the runtime's own `task` dispatch. */
|
|
20
|
+
export type LoadedRubric = NonNullable<CreateDeepAgentParams["subagents"]>[number];
|
|
21
|
+
/** The verdict vocabulary. `correct` asks for another iteration; `veto` blocks outright. */
|
|
22
|
+
export type RubricVerdict = "ok" | "correct" | "veto";
|
|
23
|
+
export interface RubricVerdictResult {
|
|
24
|
+
verdict: RubricVerdict;
|
|
25
|
+
reason: string;
|
|
26
|
+
/** The rubric that produced this verdict; absent for a script hook's own verdict. */
|
|
27
|
+
rubric?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The structured output a rubric with an iteration budget must return. Applied
|
|
31
|
+
* automatically, so a grader's output is a contract rather than a prompt
|
|
32
|
+
* convention.
|
|
33
|
+
*/
|
|
34
|
+
export declare const RUBRIC_VERDICT_SCHEMA: {
|
|
35
|
+
readonly type: "object";
|
|
36
|
+
readonly properties: {
|
|
37
|
+
readonly verdict: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly enum: readonly ["ok", "correct", "veto"];
|
|
40
|
+
};
|
|
41
|
+
readonly reason: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly required: readonly ["verdict", "reason"];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* One registry entry: the declaration plus the positional id the runtime
|
|
49
|
+
* dispatches it under. The id is internal — it appears in operator-facing events
|
|
50
|
+
* and never in a prompt — so it is built for uniqueness, not for authoring.
|
|
51
|
+
*/
|
|
52
|
+
export interface Rubric extends RubricDeclaration {
|
|
53
|
+
id: string;
|
|
54
|
+
state: string;
|
|
55
|
+
phase: "before" | "after";
|
|
56
|
+
index: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The id one inline rubric is registered and dispatched under. Positional
|
|
60
|
+
* because an inline rubric has no name: reordering a phase's hooks re-keys them,
|
|
61
|
+
* which is the same class of change as editing the spec at all (it moves the
|
|
62
|
+
* spec hash).
|
|
63
|
+
*/
|
|
64
|
+
export declare function rubricId(state: string, phase: "before" | "after", index: number): string;
|
|
65
|
+
/** Whether a value is a usable verdict. Anything else has graded nothing. */
|
|
66
|
+
export declare function isRubricVerdict(value: unknown): value is RubricVerdictResult;
|
|
67
|
+
/**
|
|
68
|
+
* The structured-output schema every dispatch requests: the verdict schema,
|
|
69
|
+
* unconditionally.
|
|
70
|
+
*
|
|
71
|
+
* Not conditional on `max_iterations`, as it was when a grader was a subagent
|
|
72
|
+
* that might also be a general-purpose helper. A rubric only ever grades, so a
|
|
73
|
+
* grader that needs no retries still has to answer in the verdict vocabulary —
|
|
74
|
+
* and without the schema its answer arrives as prose, parses to no verdict, and
|
|
75
|
+
* fails closed on a transition the author expected it to wave through.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveRubricResponseFormat(_rubric: RubricDeclaration): Record<string, unknown> | undefined;
|
|
78
|
+
/** The compact task payload a grader is handed: the request, the transcript, and where it happened. */
|
|
79
|
+
export declare function buildRubricTaskDescription(args: Record<string, unknown>): string;
|
|
80
|
+
/**
|
|
81
|
+
* What an `after`-hook verdict does to an `archmax_advance` attempt.
|
|
82
|
+
*
|
|
83
|
+
* `reason` is `null` when the transition may proceed. The other two are decided
|
|
84
|
+
* here, together, because they are mutually exclusive and were not: a `correct`
|
|
85
|
+
* whose budget is already spent is `budgetExhausted` and bills nothing, while
|
|
86
|
+
* only a `correct` that actually got its retry is `consumesIteration`. Billing
|
|
87
|
+
* an attempt that was never granted costs the state its budget for good on
|
|
88
|
+
* re-entry (issue #62).
|
|
89
|
+
*/
|
|
90
|
+
export interface RubricTransitionOutcome {
|
|
91
|
+
reason: string | null;
|
|
92
|
+
/** A `correct` refused because the hook's `max_iterations` are already spent. */
|
|
93
|
+
budgetExhausted: boolean;
|
|
94
|
+
/** This block granted a retry, so it spends one of the hook's iterations. */
|
|
95
|
+
consumesIteration: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Map an `after`-hook verdict to an `archmax_advance` rejection outcome. One
|
|
99
|
+
* implementation for every hook kind: the retry flow (bounded iterations with
|
|
100
|
+
* remaining-attempt guidance) is identical whether the verdict came from a
|
|
101
|
+
* rubric or a script — only the label differs (`rubric` vs `hook`).
|
|
102
|
+
*/
|
|
103
|
+
export declare function rubricTransitionOutcome(verdict: RubricVerdictResult, opts: {
|
|
104
|
+
maxIterations: number;
|
|
105
|
+
iterationsUsed: number;
|
|
106
|
+
to?: string;
|
|
107
|
+
}): RubricTransitionOutcome;
|
|
108
|
+
/**
|
|
109
|
+
* The rejection reason alone, for callers that do not decide the retry budget.
|
|
110
|
+
*/
|
|
111
|
+
export declare function rubricTransitionReason(verdict: RubricVerdictResult, opts: {
|
|
112
|
+
maxIterations: number;
|
|
113
|
+
iterationsUsed: number;
|
|
114
|
+
to?: string;
|
|
115
|
+
}): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* The rubric registry for one machine: every inline rubric its states declare,
|
|
118
|
+
* keyed by {@link rubricId}. Walks the spec rather than reading a root block,
|
|
119
|
+
* because a grader lives on the hook that applies it.
|
|
120
|
+
*
|
|
121
|
+
* Scoped to this spec, so a delegated child is graded by its own standards; two
|
|
122
|
+
* states declaring the same criteria produce two entries, which is the accepted
|
|
123
|
+
* cost of a state being legible on its own.
|
|
124
|
+
*/
|
|
125
|
+
export declare function rubricsFromSpec(spec: Pick<MachineSpec, "states">): Map<string, Rubric>;
|
|
126
|
+
/**
|
|
127
|
+
* Project the registry into the Deep Agents subagent shape so the framework
|
|
128
|
+
* registers the `task` tool the runtime dispatches through. These are never
|
|
129
|
+
* disclosed to the agent: `task` is withheld in every state and grantable by
|
|
130
|
+
* nothing, so registering a grader here gives the graded agent no reach.
|
|
131
|
+
*
|
|
132
|
+
* `model` resolves the grader's own model when it declared one, else the
|
|
133
|
+
* assembly's `rubric`-role model.
|
|
134
|
+
*/
|
|
135
|
+
export declare function rubricsAsSubagents(registry: Map<string, Rubric>, modelFor?: (rubric: Rubric) => BaseChatModel | undefined): LoadedRubric[];
|