@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@archmax-ai/harness` — a generic, backend-driven agent runtime built on LangChain Deep
|
|
3
|
+
* Agents. Assemble a governed agent with {@link createAgent}, point it at a
|
|
4
|
+
* workspace of authored workflows, and drive it like any Deep Agent.
|
|
5
|
+
*
|
|
6
|
+
* The runtime reads its entire agent definition (machine spec, system prompt,
|
|
7
|
+
* skills, scripts) and session state through a single Deep Agents
|
|
8
|
+
* backend, so the same code runs over a local filesystem, a store, a sandbox, or
|
|
9
|
+
* a remote backend without modification.
|
|
10
|
+
*
|
|
11
|
+
* **What is public.** This barrel is the supported surface, and every export
|
|
12
|
+
* carries a docstring saying what it is for. It is deliberately small: an export
|
|
13
|
+
* is here because a real consumer needs it, not because a module happened to
|
|
14
|
+
* expose it. Adjacent surfaces live on their own subpaths — `@archmax-ai/harness/testing`
|
|
15
|
+
* (the case engine), `@archmax-ai/harness/cli` (the state-flow renderer), and
|
|
16
|
+
* `@archmax-ai/harness/sandbox` (hook and script authoring) — so a production import never
|
|
17
|
+
* pulls in test machinery.
|
|
18
|
+
*
|
|
19
|
+
* Two **light** subpaths mirror part of this surface without the runtime behind
|
|
20
|
+
* it: `@archmax-ai/harness/spec` (the schema, the pure validator and the grammars —
|
|
21
|
+
* browser-safe) and `@archmax-ai/harness/messages` (transcript readers). A name on
|
|
22
|
+
* both is the same binding.
|
|
23
|
+
*
|
|
24
|
+
* Anything not exported here is internal and may change without a major version.
|
|
25
|
+
*/
|
|
26
|
+
// --- Assembly -----------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Assemble an agent: Deep Agents' own parameters plus `workflow`. Omit `workflow`
|
|
29
|
+
* for a plain Deep Agent; supply it and the same agent is governed by that
|
|
30
|
+
* machine. Returns a wrapper over the compiled graph — `invoke` / `stream` /
|
|
31
|
+
* `graph` — with governance under `.workflow`.
|
|
32
|
+
*/
|
|
33
|
+
export { createAgent } from "./assembly/index.js";
|
|
34
|
+
/** The wrapper class {@link createAgent} returns. */
|
|
35
|
+
export { ArchmaxAgent } from "./agent.js";
|
|
36
|
+
/**
|
|
37
|
+
* Read a session that must be parked in `status` — the checkpointed status **and**
|
|
38
|
+
* a live suspension — or `null`. What every resume asks before touching the graph.
|
|
39
|
+
*/
|
|
40
|
+
export { readParkedSession } from "./sessions/resume.js";
|
|
41
|
+
export {
|
|
42
|
+
/** The park record a session's checkpointed values hold, on either channel, or `null`. */
|
|
43
|
+
pendingParkOf,
|
|
44
|
+
/** The state a park record names, across the current and the deprecated spelling. */
|
|
45
|
+
parkedStateOf, } from "./workflow/state.js";
|
|
46
|
+
// --- Errors -------------------------------------------------------------------
|
|
47
|
+
//
|
|
48
|
+
// Each is thrown by assembly or by a public operation, so a consumer that wants
|
|
49
|
+
// to distinguish a cause from a message needs the class.
|
|
50
|
+
export {
|
|
51
|
+
/** A named workflow has no loadable machine spec — assembly fails closed. */
|
|
52
|
+
WorkflowLoadError,
|
|
53
|
+
/** A turn would start a session on a workflow that declares `disabled: true`. */
|
|
54
|
+
WorkflowDisabledError, } from "./machine/load-spec.js";
|
|
55
|
+
/** A trigger id the machine does not declare. */
|
|
56
|
+
export { UnknownTriggerError } from "./machine/triggers.js";
|
|
57
|
+
/** A host tool wearing a reserved `archmax_` name. */
|
|
58
|
+
export { ReservedToolNameError } from "./machine/tool-names.js";
|
|
59
|
+
/** A seeded variable name that is not a legal identifier. */
|
|
60
|
+
export { InvalidVariableNameError } from "./machine/variables.js";
|
|
61
|
+
/** A mount key shadows a session area. */
|
|
62
|
+
export { MountCollisionError } from "./core/mounts.js";
|
|
63
|
+
export {
|
|
64
|
+
/** A custom `backend` was supplied without a `sessionStore`. */
|
|
65
|
+
SessionStoreRequiredError,
|
|
66
|
+
/** A session id that would escape its zone or shadow a reserved name. */
|
|
67
|
+
SessionStoreIdError,
|
|
68
|
+
/** A session operation the configured store cannot perform (delete, list). */
|
|
69
|
+
SessionStoreCapabilityError, } from "./core/session-store.js";
|
|
70
|
+
export {
|
|
71
|
+
/** The authoring backend was also served by a writable mount. */
|
|
72
|
+
AuthoringBackendExposedError,
|
|
73
|
+
/** @deprecated Older spelling of {@link AuthoringBackendExposedError}; kept for one release. */
|
|
74
|
+
AuthoringPlaneExposedError,
|
|
75
|
+
/** A partly composed workspace needed a filesystem default and no `rootDir` was given. */
|
|
76
|
+
WorkspaceRootRequiredError, } from "./core/workspace-context.js";
|
|
77
|
+
/** A workspace declared a `runtime.version` this build does not implement. */
|
|
78
|
+
export { UnsupportedRuntimeContractError } from "./runtime/contract.js";
|
|
79
|
+
export {
|
|
80
|
+
/** A decision or reply for a session not parked at a human state. */
|
|
81
|
+
SessionNotParkedError,
|
|
82
|
+
/** A decision naming a target the parked state does not declare. */
|
|
83
|
+
InvalidDecisionTargetError,
|
|
84
|
+
/** A reply with nothing to answer. */
|
|
85
|
+
EmptyMessageError,
|
|
86
|
+
/** A delivery to a session not parked with `archmax_wait`. */
|
|
87
|
+
SessionNotAwaitingInputError,
|
|
88
|
+
/** A delivery naming no trigger id. */
|
|
89
|
+
MissingDeliveryTriggerError, } from "./sessions/resume.js";
|
|
90
|
+
/** A firing for a session whose turn is still in progress. */
|
|
91
|
+
export { SessionNotResumableError } from "./sessions/resolve.js";
|
|
92
|
+
// --- Workspace composition ----------------------------------------------------
|
|
93
|
+
/** The conventional mount table for a filesystem workspace. */
|
|
94
|
+
export { defaultMounts } from "./core/mounts.js";
|
|
95
|
+
/** Rebase one backend so it can serve several mounts. */
|
|
96
|
+
export { mountSubtree } from "./core/path-mapping.js";
|
|
97
|
+
export {
|
|
98
|
+
/** Filesystem session store (the zero-config default). */
|
|
99
|
+
createFilesystemSessionStore,
|
|
100
|
+
/** Session store over any Deep Agents backend (e.g. S3). */
|
|
101
|
+
createBackendSessionStore,
|
|
102
|
+
/** Ephemeral session store, for tests and one-shot sessions. */
|
|
103
|
+
createMemorySessionStore, } from "./core/session-store.js";
|
|
104
|
+
/** Whether a name is reserved at the workspace root (a session area or a mount). */
|
|
105
|
+
export { isReservedRootName } from "./core/zones.js";
|
|
106
|
+
/** Why a session id cannot own a session folder, or `null` when it can — the rule every ingress applies. */
|
|
107
|
+
export { sessionIdRejection } from "./core/session-id.js";
|
|
108
|
+
/** Whether one session was dispatched by another (`<parent>~<state>:<workflow>:<n>`), at any depth. */
|
|
109
|
+
export { isChildSessionOf } from "./sessions/scope.js";
|
|
110
|
+
/** Which zone a workspace path belongs to — the kernel's own classifier (a host maps evidence paths with it). */
|
|
111
|
+
export { classifyWorkspacePath } from "./core/zones.js";
|
|
112
|
+
/**
|
|
113
|
+
* Build the workspace composite the assembly uses. Public because a consumer
|
|
114
|
+
* serving authored content from its own backend needs the same composition.
|
|
115
|
+
*/
|
|
116
|
+
export { createWorkspaceContext } from "./core/workspace-context.js";
|
|
117
|
+
/** Where a workspace may override the bundled platform prompt (`.platform/system/GRAPH_STATE.md`). */
|
|
118
|
+
export { PLATFORM_BACKEND_PROMPT_PATH } from "./workflow/paths.js";
|
|
119
|
+
// --- Prompt and message plumbing ---------------------------------------------
|
|
120
|
+
//
|
|
121
|
+
// Blessed internals. A consumer that assembles its own agent needs exactly these
|
|
122
|
+
// to compose a system prompt and read what a session said.
|
|
123
|
+
/** Compose the system prompt from persona, platform, zones and workflow layers. */
|
|
124
|
+
export { resolveSystemPrompt } from "./core/prompt.js";
|
|
125
|
+
/** Bind a `name → tool` map in the shape the `tools` option takes. */
|
|
126
|
+
export { toolsFromMap } from "./workflow/agent-tools.js";
|
|
127
|
+
/** A message's text, whatever content-block shape it arrived in. */
|
|
128
|
+
export { contentToString } from "./core/messages.js";
|
|
129
|
+
/** Whether a message is the assistant's turn. */
|
|
130
|
+
export { isAiMessage } from "./core/messages.js";
|
|
131
|
+
/** The last thing the agent said to the person; tool results and runtime notes are skipped. */
|
|
132
|
+
export { lastAgentText } from "./core/messages.js";
|
|
133
|
+
/**
|
|
134
|
+
* Whether the runtime wrote a transcript message rather than a person — a
|
|
135
|
+
* decision, an arrival, an error route, a completion check, a child's result.
|
|
136
|
+
* A host slicing a turn out of a session's messages, or rendering a transcript,
|
|
137
|
+
* asks this instead of inferring authorship from role.
|
|
138
|
+
*/
|
|
139
|
+
export { isRuntimeNote } from "./core/messages.js";
|
|
140
|
+
/** Which kind of runtime note a message is, or `null` if a person wrote it. */
|
|
141
|
+
export { runtimeNoteKind } from "./core/messages.js";
|
|
142
|
+
/** Parse a sandbox script's leading description block. */
|
|
143
|
+
export { parseCodeDescription } from "./core/code-description.js";
|
|
144
|
+
// --- The machine --------------------------------------------------------------
|
|
145
|
+
/** Load and shape-check a `workflow.yaml` without assembling an agent. */
|
|
146
|
+
export { loadMachineSpec } from "./machine/load-spec.js";
|
|
147
|
+
/** A `before:`/`after:` declaration as a flat list of hooks. */
|
|
148
|
+
export { normalizeHooks } from "./lifecycle/hook-shape.js";
|
|
149
|
+
/** The compiled machine, as `agent.workflow.machine` exposes it. */
|
|
150
|
+
export { WorkflowMachine } from "./machine/machine.js";
|
|
151
|
+
/** Statically validate a workflow scaffold — no model calls. */
|
|
152
|
+
export { validateWorkflow } from "./validate/validate.js";
|
|
153
|
+
/**
|
|
154
|
+
* The dispatcher's default delegation bounds. Public because a host configuring
|
|
155
|
+
* `bounds` needs to know what it is overriding.
|
|
156
|
+
*/
|
|
157
|
+
export { DEFAULT_SUB_WORKFLOW_DEPTH, DEFAULT_SUB_WORKFLOW_CONCURRENCY, } from "./machine/delegation.js";
|
|
158
|
+
// --- Names a host must not hard-code -----------------------------------------
|
|
159
|
+
export {
|
|
160
|
+
/** The entry trigger id (`manual`). */
|
|
161
|
+
MANUAL_TRIGGER,
|
|
162
|
+
/** The trigger applied when none is supplied (same value as `MANUAL_TRIGGER`). */
|
|
163
|
+
DEFAULT_TRIGGER_ID,
|
|
164
|
+
/** The session id a firing of a trigger resolves to under a spec, or `undefined` when the runtime mints one. */
|
|
165
|
+
sessionIdForTrigger, } from "./machine/triggers.js";
|
|
166
|
+
/** Default workflow slug when none is named. */
|
|
167
|
+
export { DEFAULT_WORKFLOW } from "./workflow/paths.js";
|
|
168
|
+
export {
|
|
169
|
+
/** Prefix of every delegation tool name. */
|
|
170
|
+
WORKFLOW_TOOL_PREFIX,
|
|
171
|
+
/** The delegation tool name for a workflow slug. */
|
|
172
|
+
workflowToolName,
|
|
173
|
+
/** The workflow slug a delegation tool name refers to. */
|
|
174
|
+
workflowSlugFromToolName, } from "./machine/tool-names.js";
|
|
175
|
+
// --- Token accounting ---------------------------------------------------------
|
|
176
|
+
/** Fold `model-usage` events into per-session totals and cost. */
|
|
177
|
+
export { createUsageTracker } from "./core/usage.js";
|
|
178
|
+
/** Render a usage summary for a footer or a log line. */
|
|
179
|
+
export { formatUsage } from "./core/usage.js";
|
|
180
|
+
// --- Environment --------------------------------------------------------------
|
|
181
|
+
//
|
|
182
|
+
// A backend that assembles its own runtime needs these and there is no `./env`
|
|
183
|
+
// subpath. Dropping one is a silent break: destructuring a missing named export
|
|
184
|
+
// off a dynamic `import()` yields `undefined`.
|
|
185
|
+
/** Build the env-configured chat model to pass as `model`. */
|
|
186
|
+
export { createChatModel } from "./env.js";
|
|
187
|
+
export {
|
|
188
|
+
/**
|
|
189
|
+
* The bundled authoring skill's parent directory (holding `archmax-harness/`), so an
|
|
190
|
+
* authoring agent's reference always matches the installed SDK.
|
|
191
|
+
*/
|
|
192
|
+
BUNDLED_AUTHORING_SKILL_DIR,
|
|
193
|
+
/** @deprecated Use `BUNDLED_AUTHORING_SKILL_DIR`; same value. */
|
|
194
|
+
BUNDLED_SKILLS_DIR, } from "./env.js";
|
|
195
|
+
/** This package's version, as session metadata records it. */
|
|
196
|
+
export { PACKAGE_VERSION } from "./env.js";
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { WorkflowMachine } from "../machine/machine.js";
|
|
2
|
+
import type { ForbidEntry } from "../machine/types.js";
|
|
3
|
+
import type { VariableStore } from "../machine/variables.js";
|
|
4
|
+
import { type MountPrefixes } from "../core/mounts.js";
|
|
5
|
+
import { type SkillPrefixes } from "../core/skills.js";
|
|
6
|
+
import type { LifecycleDecision } from "../lifecycle/runner.js";
|
|
7
|
+
/**
|
|
8
|
+
* The decision kernel: a single pure, synchronous function that produces every
|
|
9
|
+
* governance verdict from the machine spec, a snapshot of checkpointed workflow
|
|
10
|
+
* state, and a proposed action. Effectful work (running hooks/judges) happens in
|
|
11
|
+
* `LifecycleRunner`; its outputs are reduced here as {@link HookFact}s so the
|
|
12
|
+
* kernel stays pure and both runtime enforcement and static validation share one
|
|
13
|
+
* code path.
|
|
14
|
+
*/
|
|
15
|
+
export type VerdictDecision = "allow" | "block";
|
|
16
|
+
export interface Verdict {
|
|
17
|
+
decision: VerdictDecision;
|
|
18
|
+
/**
|
|
19
|
+
* A block the agent cannot recover from by retrying: the harness could not
|
|
20
|
+
* evaluate the declared governance at all. The middleware ends the turn as a
|
|
21
|
+
* failure (routed by `on_error`) rather than returning a retryable error.
|
|
22
|
+
* Absent means an ordinary, recoverable block.
|
|
23
|
+
*/
|
|
24
|
+
terminal?: boolean;
|
|
25
|
+
/** Stable identifier for the rule that produced this verdict (for diagnostics/tests). */
|
|
26
|
+
ruleId: string;
|
|
27
|
+
/** Human-readable explanation, present on `block`. */
|
|
28
|
+
reason?: string;
|
|
29
|
+
/** Tool-call blocks: whether the block should surface as a warn-level event. */
|
|
30
|
+
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
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Who initiated a tool call. `agent` (the default) is a call the model made
|
|
55
|
+
* directly; `script` is a programmatic call from a sandbox script, governed
|
|
56
|
+
* identically to an agent call in the same state; `lifecycle` is a programmatic
|
|
57
|
+
* call from a lifecycle hook, which runs on harness authority and skips the
|
|
58
|
+
* per-state allow list and nothing else.
|
|
59
|
+
*/
|
|
60
|
+
export type ToolCallOrigin = "agent" | "script" | "lifecycle";
|
|
61
|
+
export type ProposedAction = {
|
|
62
|
+
kind: "tool-call";
|
|
63
|
+
state: string;
|
|
64
|
+
tool: string;
|
|
65
|
+
args: Record<string, unknown>;
|
|
66
|
+
/** Defaults to `agent` when absent. */
|
|
67
|
+
origin?: ToolCallOrigin;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the call was made during a **reply-only turn** — the run parked,
|
|
70
|
+
* the model handed no tools. Supplied by the caller that knows which turn
|
|
71
|
+
* it is in; absent means an ordinary turn.
|
|
72
|
+
*/
|
|
73
|
+
replyOnly?: boolean;
|
|
74
|
+
} | {
|
|
75
|
+
kind: "transition";
|
|
76
|
+
from: string;
|
|
77
|
+
to: string;
|
|
78
|
+
reason?: string;
|
|
79
|
+
hookFacts: HookFact[];
|
|
80
|
+
} | {
|
|
81
|
+
kind: "enter-state";
|
|
82
|
+
state: string;
|
|
83
|
+
hookFacts: HookFact[];
|
|
84
|
+
};
|
|
85
|
+
/** Read-only context a governance rule may consult. */
|
|
86
|
+
export interface RuleApi {
|
|
87
|
+
machine: WorkflowMachine;
|
|
88
|
+
/**
|
|
89
|
+
* The run's variables, so a guard's `${{name}}` references resolve. Absent,
|
|
90
|
+
* every reference is unresolvable and fails closed: the guard blocks.
|
|
91
|
+
*/
|
|
92
|
+
variables?: VariableStore;
|
|
93
|
+
/**
|
|
94
|
+
* The workspace's resolved mount keys, supplied by the caller — the kernel
|
|
95
|
+
* holds no list of authored directory names. Absent, no path classifies as
|
|
96
|
+
* authored, which is safe because read-only mounts refuse writes themselves.
|
|
97
|
+
*/
|
|
98
|
+
mountPrefixes?: MountPrefixes;
|
|
99
|
+
/**
|
|
100
|
+
* The workspace's resolved skill bundles (slug → bundle prefix), supplied by
|
|
101
|
+
* the caller. Absent or empty, no path lands inside a bundle and
|
|
102
|
+
* {@link skillRule} never fires.
|
|
103
|
+
*/
|
|
104
|
+
skills?: SkillPrefixes;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A single governance rule: a pure function over a proposed action that either
|
|
108
|
+
* returns a {@link Verdict} (its opinion) or `null` (abstain). The kernel folds
|
|
109
|
+
* the ordered rule pipeline and the first non-null verdict wins; when every rule
|
|
110
|
+
* abstains the default is allow.
|
|
111
|
+
*/
|
|
112
|
+
export type GovernanceRule = (action: ProposedAction, api: RuleApi) => Verdict | null;
|
|
113
|
+
/**
|
|
114
|
+
* Agent tools that scripts may never invoke through programmatic tool calling
|
|
115
|
+
* (PTC): every harness control tool (including both sandbox entry points, so
|
|
116
|
+
* sandboxed code cannot re-enter the sandbox) plus a bare `eval`. Owned by
|
|
117
|
+
* governance so the interpreter and the lifecycle runner cannot drift.
|
|
118
|
+
*/
|
|
119
|
+
export declare const PTC_EXCLUDED_TOOLS: ReadonlySet<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Whether a workspace-relative path targets the read-only authored zone (an
|
|
122
|
+
* authored mount or an authored root file), via the shared table in
|
|
123
|
+
* `core/zones.ts` so runtime, mount routing, and validation agree.
|
|
124
|
+
*/
|
|
125
|
+
export declare function isReadOnlyZonePath(path: string, mounts?: MountPrefixes): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Reduce a single lifecycle-hook fact to a verdict. Fail-closed: an execution
|
|
128
|
+
* error is a veto. `before` hooks gate entry with `ok`/`veto` only — a `correct`
|
|
129
|
+
* at entry has nothing to retry, so it reduces to a veto and never consumes the
|
|
130
|
+
* correction budget. Within an `after` veto window any hook's `correct` (script
|
|
131
|
+
* or subagent judge alike) enters the same bounded correction flow, budgeted by
|
|
132
|
+
* the hook's `max_corrections`.
|
|
133
|
+
*/
|
|
134
|
+
export declare function reduceHookFact(fact: HookFact, opts: {
|
|
135
|
+
phase: "before" | "after" | "tool";
|
|
136
|
+
veto: boolean;
|
|
137
|
+
to?: string;
|
|
138
|
+
}): Verdict;
|
|
139
|
+
/**
|
|
140
|
+
* An **ancestor's** `mounts.forbid_always`, as rules the descendant inherits.
|
|
141
|
+
* The mount twin of {@link compileForbiddenSkillRules}: a child machine resolves
|
|
142
|
+
* its own enabled set and cannot see a caller's denial, so the denial travels as
|
|
143
|
+
* a rule — any path under one of those mounts is refused, whatever the child
|
|
144
|
+
* granted itself, and the refusal names the workflow that denied it.
|
|
145
|
+
*
|
|
146
|
+
* A workflow-wide denial binds a hook and a rubric grader too, so this rule —
|
|
147
|
+
* unlike {@link mountRule} — does not exempt the `lifecycle` origin.
|
|
148
|
+
*/
|
|
149
|
+
export declare function compileForbiddenMountRules(names: readonly string[], source: string): GovernanceRule[];
|
|
150
|
+
/**
|
|
151
|
+
* An **ancestor's** `skills.forbid_always`, as rules the descendant inherits. A
|
|
152
|
+
* child machine resolves its own enabled set and cannot see a caller's denial,
|
|
153
|
+
* so the denial travels as a rule: any path inside one of those bundles is
|
|
154
|
+
* refused, whatever the child granted itself.
|
|
155
|
+
*/
|
|
156
|
+
export declare function compileForbiddenSkillRules(slugs: readonly string[], source: string): GovernanceRule[];
|
|
157
|
+
/** Where a denial was declared, which decides its scope, ruleId and wording. */
|
|
158
|
+
export type ForbidScope = "workflow" | "state";
|
|
159
|
+
/**
|
|
160
|
+
* Compile a `forbid_always` (root) or `forbid` (state) list into governance
|
|
161
|
+
* rules. One implementation for both positions: the entries share the `allow`
|
|
162
|
+
* grammar, so `normalizeAllowEntry` and the argument-guard matcher are the same
|
|
163
|
+
* ones the grant side uses, and the two differ only in what they match and how
|
|
164
|
+
* the refusal reads.
|
|
165
|
+
*
|
|
166
|
+
* A denial is evaluated ahead of every grant and every consumer rule, so **deny
|
|
167
|
+
* beats allow and no narrower level widens a denial**: nothing reaches past a
|
|
168
|
+
* workflow's `forbid_always`, and nothing in a state reaches past its `forbid`.
|
|
169
|
+
* An entry naming the tool `*` denies every tool; an entry with argument guards
|
|
170
|
+
* denies only the calls those guards match.
|
|
171
|
+
*
|
|
172
|
+
* Returns an empty list for an empty declaration, so the pipeline is unchanged
|
|
173
|
+
* for a workflow that denies nothing. Pure — the same rules run at runtime and
|
|
174
|
+
* in the validator.
|
|
175
|
+
*/
|
|
176
|
+
export declare function compileForbidRules(entries: readonly ForbidEntry[] | undefined, options: {
|
|
177
|
+
scope: ForbidScope;
|
|
178
|
+
/** The state the entries belong to. Required for `scope: "state"`. */
|
|
179
|
+
state?: string;
|
|
180
|
+
/**
|
|
181
|
+
* The workflow that declared this denial, named in the block reason when it
|
|
182
|
+
* is an **ancestor** of the governed machine — a delegated machine inherits
|
|
183
|
+
* every ancestor's denials, so the refusal must say whose rule stopped it.
|
|
184
|
+
*/
|
|
185
|
+
source?: string;
|
|
186
|
+
}): GovernanceRule[];
|
|
187
|
+
/**
|
|
188
|
+
* The single governance decision function. Given the machine, a proposed action,
|
|
189
|
+
* and any consumer-supplied governance rules, return a typed verdict. Pure and
|
|
190
|
+
* synchronous, so runtime enforcement and static validation share one path.
|
|
191
|
+
*/
|
|
192
|
+
export declare function decide(machine: WorkflowMachine, action: ProposedAction, customRules?: GovernanceRule[], mountPrefixes?: MountPrefixes, variables?: VariableStore, skills?: SkillPrefixes): Verdict;
|