@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,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace root namespace — and the one thing in it the framework owns.
|
|
3
|
+
*
|
|
4
|
+
* The root **is the current run**: the executing session's folder in the
|
|
5
|
+
* configured session store, served as the default route of the workspace
|
|
6
|
+
* `CompositeBackend`. The framework's path vocabulary stops at the run areas
|
|
7
|
+
* below; **which directories are authored is workspace shape, not framework
|
|
8
|
+
* knowledge**, resolved per assembly into an {@link AuthoredMounts} table by
|
|
9
|
+
* discovery or consumer declaration (see {@link resolveAuthoredMounts}).
|
|
10
|
+
*
|
|
11
|
+
* Every consumer that needs to know "which zone is this path in?" — the decision
|
|
12
|
+
* kernel, the workspace router's routing and root shaping, and static
|
|
13
|
+
* validation — classifies through {@link classifyWorkspacePath} with that one
|
|
14
|
+
* resolved table, so runtime enforcement and validation cannot disagree.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The mount keys of one workspace, split by shape and write posture — the input
|
|
18
|
+
* every path classification takes. Produced by `resolveMounts` (`core/mounts.ts`)
|
|
19
|
+
* from the very keys the composite routes on, so routing and classification cannot
|
|
20
|
+
* drift. Declared here, with the classifier that consumes it, so this namespace
|
|
21
|
+
* module stays a leaf: composition depends on classification, never the reverse.
|
|
22
|
+
*/
|
|
23
|
+
export interface MountPrefixes {
|
|
24
|
+
/** Directory mount names (no slashes), e.g. `["skills", "workflows"]`. */
|
|
25
|
+
readonly dirs: readonly string[];
|
|
26
|
+
/** Exact-path file mount names, e.g. `["AGENTS.md"]`. */
|
|
27
|
+
readonly files: readonly string[];
|
|
28
|
+
/** Names of mounts declared writable; excluded from the read-only rules. */
|
|
29
|
+
readonly writable: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Names of mounts the host declared `governed`: closed by default, reachable
|
|
32
|
+
* only from the states a `mounts` list enables (see
|
|
33
|
+
* `WorkflowMachine.enabledMounts`). A name absent from this list is visible
|
|
34
|
+
* in every state, which is what every table without the flag resolves to.
|
|
35
|
+
*/
|
|
36
|
+
readonly governed: readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* Names of directory mounts the host declared `searchable: false`: the
|
|
39
|
+
* runtime never searches them on its own initiative (a root-wide `grep` or
|
|
40
|
+
* `glob` skips them), while a search addressed at one still reaches its
|
|
41
|
+
* backend so the backend can answer with its own refusal. A file mount is
|
|
42
|
+
* never listed here — a file is not searched as a tree. Not a governance
|
|
43
|
+
* concern: the kernel and `validate` do not read it.
|
|
44
|
+
*/
|
|
45
|
+
readonly unsearchable: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
/** No mounts: every path resolves in the run root. */
|
|
48
|
+
export declare const NO_MOUNTS: MountPrefixes;
|
|
49
|
+
/**
|
|
50
|
+
* Runtime-internal run areas: checkpoint records, observability artifacts, and
|
|
51
|
+
* the cross-session content-addressed spec snapshots. Written by the runtime
|
|
52
|
+
* through the workspace, never addressable by agent tools.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SESSION_INTERNAL_DIRS: readonly ["checkpoints", "artifacts", "_specs"];
|
|
55
|
+
/**
|
|
56
|
+
* Context-offload areas. Deep Agents' filesystem and summarization middleware
|
|
57
|
+
* write to these fixed root paths when a tool result or human message exceeds
|
|
58
|
+
* its eviction threshold, and hand the model a pointer to read back. Because
|
|
59
|
+
* the session store serves the root, they land in `<sessionId>/…` with no upstream
|
|
60
|
+
* patching. Agent-readable (it must follow the pointer), never agent-writable.
|
|
61
|
+
*/
|
|
62
|
+
export declare const SESSION_OFFLOAD_DIRS: readonly ["large_tool_results", "conversation_history"];
|
|
63
|
+
/**
|
|
64
|
+
* The run's working area: intermediate files *and* the results a state produces.
|
|
65
|
+
* Always agent-readable/writable, independent of state policy — one area, so an
|
|
66
|
+
* author never has to decide which of two working directories a file belongs in.
|
|
67
|
+
*
|
|
68
|
+
* Being always-open is the trade: a state cannot narrow *where inside it* a write
|
|
69
|
+
* may land. A workflow that needs the write itself governed names an ordinary run
|
|
70
|
+
* path instead (anything else in the root classifies as `run`, matched against the
|
|
71
|
+
* state's `tools.allow` like any other argument).
|
|
72
|
+
*/
|
|
73
|
+
export declare const SESSION_OPEN_DIR = "scratchpad";
|
|
74
|
+
/**
|
|
75
|
+
* Cross-session reserved prefix inside the session store, resolved at the store
|
|
76
|
+
* root whether or not a session is bound (see `SessionZoneRouter`).
|
|
77
|
+
*/
|
|
78
|
+
export declare const SESSION_AGNOSTIC_PREFIX = "_specs";
|
|
79
|
+
/**
|
|
80
|
+
* Store prefixes that resolve to the root whether or not a session is bound:
|
|
81
|
+
* data shared across sessions, like a spec snapshot. One list, so a second such
|
|
82
|
+
* prefix is a one-line change.
|
|
83
|
+
*/
|
|
84
|
+
export declare const SESSION_AGNOSTIC_PREFIXES: readonly string[];
|
|
85
|
+
/** Whether a run-store-relative path addresses a session-agnostic prefix. */
|
|
86
|
+
export declare function isSessionAgnosticPath(rel: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Zone of a canonical workspace path:
|
|
89
|
+
*
|
|
90
|
+
* - `authored` — read-only authored mount or authored root file
|
|
91
|
+
* - `run-internal` — runtime-only run area (no agent access)
|
|
92
|
+
* - `run-offload` — runtime-managed offload area (agent read-only)
|
|
93
|
+
* - `run-open` — `scratchpad/…` (always agent read/write)
|
|
94
|
+
* - `run` — anything else in the run root; governed by the active state's
|
|
95
|
+
* `tools.allow`
|
|
96
|
+
* - `escapes` — climbs above the workspace root
|
|
97
|
+
* - `root` — the workspace root itself
|
|
98
|
+
*/
|
|
99
|
+
export type WorkspaceZone = "authored" | "run-internal" | "run-offload" | "run-open" | "run" | "escapes" | "root";
|
|
100
|
+
/**
|
|
101
|
+
* Session-area names the framework owns at the workspace root. An authored
|
|
102
|
+
* directory may not shadow one of these, and a session id may not be one of them.
|
|
103
|
+
*/
|
|
104
|
+
export declare function sessionAreaNames(): string[];
|
|
105
|
+
/** @deprecated Older spelling of {@link sessionAreaNames}; kept for one release. */
|
|
106
|
+
export declare const runAreaNames: typeof sessionAreaNames;
|
|
107
|
+
/**
|
|
108
|
+
* The authoring prefixes: the workspace-root names holding what the **runtime**
|
|
109
|
+
* reads. `workflows/` carries the machine specs — grading rubrics included — the
|
|
110
|
+
* prose addenda, the lifecycle hook scripts, and the offline test cases a session
|
|
111
|
+
* is enforced with. It is served by the *authoring* backend and is not routed into
|
|
112
|
+
* the agent's workspace composite.
|
|
113
|
+
*
|
|
114
|
+
* It is reserved rather than merely omitted: a workspace that mounted it would hand
|
|
115
|
+
* a session its own spec, its sibling workflows' specs, the tests grading it, and
|
|
116
|
+
* the criteria (with the iteration budget) of the rubric that vetoes it. Refusing
|
|
117
|
+
* the key makes the isolation a property of composition instead of a rule
|
|
118
|
+
* something downstream could relax.
|
|
119
|
+
*
|
|
120
|
+
* Still a **set**, though it holds one member: the classification is the contract
|
|
121
|
+
* and its cardinality is incidental. One list, three consumers — mount resolution,
|
|
122
|
+
* the decision kernel's script diagnostic, and static validation — so a further
|
|
123
|
+
* prefix is a one-line change and the three can never disagree about what the
|
|
124
|
+
* authoring backend serves. Declared here, with the rest of the root namespace
|
|
125
|
+
* vocabulary, so a browser-safe consumer can read it without the mount composition.
|
|
126
|
+
*/
|
|
127
|
+
export declare const AUTHORING_PREFIXES: readonly ["workflows"];
|
|
128
|
+
/** A root name on the authoring backend. */
|
|
129
|
+
export type AuthoringPrefix = (typeof AUTHORING_PREFIXES)[number];
|
|
130
|
+
/** Whether a bare root name is an authoring prefix. */
|
|
131
|
+
export declare function isAuthoringPrefix(name: string): name is AuthoringPrefix;
|
|
132
|
+
/**
|
|
133
|
+
* The authoring prefix a **canonicalized** relative path addresses, or `null`
|
|
134
|
+
* when it addresses none. The matched prefix is returned rather than a boolean so
|
|
135
|
+
* a caller can name it — and describe its content with
|
|
136
|
+
* {@link describeAuthoringPrefix} — in the diagnostic it produces.
|
|
137
|
+
*/
|
|
138
|
+
export declare function authoringPlanePrefix(rel: string): AuthoringPrefix | null;
|
|
139
|
+
/** The noun phrase naming what an authoring prefix holds. */
|
|
140
|
+
export declare function describeAuthoringPrefix(prefix: AuthoringPrefix): string;
|
|
141
|
+
/**
|
|
142
|
+
* The mount name a **canonicalized** relative path addresses, or `null` when it
|
|
143
|
+
* addresses none — the longest matching name, so a nested key (`catalogs/eu`)
|
|
144
|
+
* wins over a single-segment one (`catalogs`) mounted beside it, and a sibling
|
|
145
|
+
* under the same first segment (`catalogs/uk`) matches neither.
|
|
146
|
+
*
|
|
147
|
+
* Longest prefix rather than first segment because a mount key of several
|
|
148
|
+
* segments is an ordinary mount: the composite already routes the longer prefix
|
|
149
|
+
* first, so classification has to agree or a nested mount would be governed as
|
|
150
|
+
* a run path.
|
|
151
|
+
*/
|
|
152
|
+
export declare function mountNameOf(rel: string, mounts?: MountPrefixes): string | null;
|
|
153
|
+
/**
|
|
154
|
+
* Whether a glob or path pattern can only ever match inside one mount — the
|
|
155
|
+
* shape `validate` needs to spot a `tools.allow` entry that contradicts the
|
|
156
|
+
* state's enabled mounts. Returns the mount name when the pattern's literal
|
|
157
|
+
* prefix (everything before its first wildcard) is already inside a mount, else
|
|
158
|
+
* `null`: a broader pattern is left to the runtime rule, which refuses the
|
|
159
|
+
* unreachable paths call by call.
|
|
160
|
+
*/
|
|
161
|
+
export declare function mountNameOfPattern(pattern: string, mounts?: MountPrefixes): string | null;
|
|
162
|
+
/**
|
|
163
|
+
* Classify a workspace path against the workspace's resolved authored mounts.
|
|
164
|
+
* Canonicalizes first (leading slashes stripped, `.`/`//` segments dropped, `..`
|
|
165
|
+
* applied) so equivalent spellings — `./data/x`, `//data/x`, `data/./x` — land in
|
|
166
|
+
* the same zone and none can be dodged with a prefix.
|
|
167
|
+
*
|
|
168
|
+
* With no table supplied, nothing classifies as `authored` — a caller probing the
|
|
169
|
+
* kernel in isolation gets run-state classification. That is safe because authored
|
|
170
|
+
* mounts refuse writes themselves (see `mountSubtree({ readOnly })`), so the
|
|
171
|
+
* kernel's read-only rule is the diagnostic layer rather than the only enforcement.
|
|
172
|
+
*/
|
|
173
|
+
export declare function classifyWorkspacePath(path: string, mounts?: MountPrefixes): WorkspaceZone;
|
|
174
|
+
/**
|
|
175
|
+
* Whether `name` is reserved at the workspace root. Used to refuse a session id
|
|
176
|
+
* that would route its own run folder (`<sessionId>/checkpoints/…`) into a run
|
|
177
|
+
* area or a declared mount. Without a mount table only the framework-owned run
|
|
178
|
+
* areas are reserved — a colliding mount name then fails loudly at the read-only
|
|
179
|
+
* mount instead of silently corrupting authored content.
|
|
180
|
+
*/
|
|
181
|
+
export declare function isReservedRootName(name: string, mounts?: MountPrefixes): boolean;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { canonicalizeRelPath } from "./workspace.js";
|
|
2
|
+
/** No mounts: every path resolves in the run root. */
|
|
3
|
+
export const NO_MOUNTS = {
|
|
4
|
+
dirs: [],
|
|
5
|
+
files: [],
|
|
6
|
+
writable: [],
|
|
7
|
+
governed: [],
|
|
8
|
+
unsearchable: [],
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Runtime-internal run areas: checkpoint records, observability artifacts, and
|
|
12
|
+
* the cross-session content-addressed spec snapshots. Written by the runtime
|
|
13
|
+
* through the workspace, never addressable by agent tools.
|
|
14
|
+
*/
|
|
15
|
+
export const SESSION_INTERNAL_DIRS = ["checkpoints", "artifacts", "_specs"];
|
|
16
|
+
/**
|
|
17
|
+
* Context-offload areas. Deep Agents' filesystem and summarization middleware
|
|
18
|
+
* write to these fixed root paths when a tool result or human message exceeds
|
|
19
|
+
* its eviction threshold, and hand the model a pointer to read back. Because
|
|
20
|
+
* the session store serves the root, they land in `<sessionId>/…` with no upstream
|
|
21
|
+
* patching. Agent-readable (it must follow the pointer), never agent-writable.
|
|
22
|
+
*/
|
|
23
|
+
export const SESSION_OFFLOAD_DIRS = ["large_tool_results", "conversation_history"];
|
|
24
|
+
/**
|
|
25
|
+
* The run's working area: intermediate files *and* the results a state produces.
|
|
26
|
+
* Always agent-readable/writable, independent of state policy — one area, so an
|
|
27
|
+
* author never has to decide which of two working directories a file belongs in.
|
|
28
|
+
*
|
|
29
|
+
* Being always-open is the trade: a state cannot narrow *where inside it* a write
|
|
30
|
+
* may land. A workflow that needs the write itself governed names an ordinary run
|
|
31
|
+
* path instead (anything else in the root classifies as `run`, matched against the
|
|
32
|
+
* state's `tools.allow` like any other argument).
|
|
33
|
+
*/
|
|
34
|
+
export const SESSION_OPEN_DIR = "scratchpad";
|
|
35
|
+
/**
|
|
36
|
+
* Cross-session reserved prefix inside the session store, resolved at the store
|
|
37
|
+
* root whether or not a session is bound (see `SessionZoneRouter`).
|
|
38
|
+
*/
|
|
39
|
+
export const SESSION_AGNOSTIC_PREFIX = "_specs";
|
|
40
|
+
/**
|
|
41
|
+
* Store prefixes that resolve to the root whether or not a session is bound:
|
|
42
|
+
* data shared across sessions, like a spec snapshot. One list, so a second such
|
|
43
|
+
* prefix is a one-line change.
|
|
44
|
+
*/
|
|
45
|
+
export const SESSION_AGNOSTIC_PREFIXES = [SESSION_AGNOSTIC_PREFIX];
|
|
46
|
+
/** Whether a run-store-relative path addresses a session-agnostic prefix. */
|
|
47
|
+
export function isSessionAgnosticPath(rel) {
|
|
48
|
+
return SESSION_AGNOSTIC_PREFIXES.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`));
|
|
49
|
+
}
|
|
50
|
+
const INTERNAL_DIR_SET = new Set(SESSION_INTERNAL_DIRS);
|
|
51
|
+
const OFFLOAD_DIR_SET = new Set(SESSION_OFFLOAD_DIRS);
|
|
52
|
+
/**
|
|
53
|
+
* Session-area names the framework owns at the workspace root. An authored
|
|
54
|
+
* directory may not shadow one of these, and a session id may not be one of them.
|
|
55
|
+
*/
|
|
56
|
+
export function sessionAreaNames() {
|
|
57
|
+
return [
|
|
58
|
+
...SESSION_INTERNAL_DIRS,
|
|
59
|
+
...SESSION_OFFLOAD_DIRS,
|
|
60
|
+
SESSION_OPEN_DIR,
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
/** @deprecated Older spelling of {@link sessionAreaNames}; kept for one release. */
|
|
64
|
+
export const runAreaNames = sessionAreaNames;
|
|
65
|
+
const SESSION_AREA_SET = new Set(sessionAreaNames());
|
|
66
|
+
// --- The authoring prefixes ------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* The authoring prefixes: the workspace-root names holding what the **runtime**
|
|
69
|
+
* reads. `workflows/` carries the machine specs — grading rubrics included — the
|
|
70
|
+
* prose addenda, the lifecycle hook scripts, and the offline test cases a session
|
|
71
|
+
* is enforced with. It is served by the *authoring* backend and is not routed into
|
|
72
|
+
* the agent's workspace composite.
|
|
73
|
+
*
|
|
74
|
+
* It is reserved rather than merely omitted: a workspace that mounted it would hand
|
|
75
|
+
* a session its own spec, its sibling workflows' specs, the tests grading it, and
|
|
76
|
+
* the criteria (with the iteration budget) of the rubric that vetoes it. Refusing
|
|
77
|
+
* the key makes the isolation a property of composition instead of a rule
|
|
78
|
+
* something downstream could relax.
|
|
79
|
+
*
|
|
80
|
+
* Still a **set**, though it holds one member: the classification is the contract
|
|
81
|
+
* and its cardinality is incidental. One list, three consumers — mount resolution,
|
|
82
|
+
* the decision kernel's script diagnostic, and static validation — so a further
|
|
83
|
+
* prefix is a one-line change and the three can never disagree about what the
|
|
84
|
+
* authoring backend serves. Declared here, with the rest of the root namespace
|
|
85
|
+
* vocabulary, so a browser-safe consumer can read it without the mount composition.
|
|
86
|
+
*/
|
|
87
|
+
export const AUTHORING_PREFIXES = ["workflows"];
|
|
88
|
+
/**
|
|
89
|
+
* What each prefix holds, as a noun phrase a diagnostic can drop into a sentence.
|
|
90
|
+
* Kept per-prefix rather than collapsed into "the authoring backend" so a
|
|
91
|
+
* diagnostic describes the prefix the consumer actually named.
|
|
92
|
+
*/
|
|
93
|
+
const AUTHORING_CONTENT = {
|
|
94
|
+
workflows: "machine specs, grading rubrics, hook scripts, and test cases",
|
|
95
|
+
};
|
|
96
|
+
/** Whether a bare root name is an authoring prefix. */
|
|
97
|
+
export function isAuthoringPrefix(name) {
|
|
98
|
+
return AUTHORING_PREFIXES.includes(name);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The authoring prefix a **canonicalized** relative path addresses, or `null`
|
|
102
|
+
* when it addresses none. The matched prefix is returned rather than a boolean so
|
|
103
|
+
* a caller can name it — and describe its content with
|
|
104
|
+
* {@link describeAuthoringPrefix} — in the diagnostic it produces.
|
|
105
|
+
*/
|
|
106
|
+
export function authoringPlanePrefix(rel) {
|
|
107
|
+
for (const prefix of AUTHORING_PREFIXES) {
|
|
108
|
+
if (rel === prefix || rel.startsWith(`${prefix}/`))
|
|
109
|
+
return prefix;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
/** The noun phrase naming what an authoring prefix holds. */
|
|
114
|
+
export function describeAuthoringPrefix(prefix) {
|
|
115
|
+
return AUTHORING_CONTENT[prefix];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The mount name a **canonicalized** relative path addresses, or `null` when it
|
|
119
|
+
* addresses none — the longest matching name, so a nested key (`catalogs/eu`)
|
|
120
|
+
* wins over a single-segment one (`catalogs`) mounted beside it, and a sibling
|
|
121
|
+
* under the same first segment (`catalogs/uk`) matches neither.
|
|
122
|
+
*
|
|
123
|
+
* Longest prefix rather than first segment because a mount key of several
|
|
124
|
+
* segments is an ordinary mount: the composite already routes the longer prefix
|
|
125
|
+
* first, so classification has to agree or a nested mount would be governed as
|
|
126
|
+
* a run path.
|
|
127
|
+
*/
|
|
128
|
+
export function mountNameOf(rel, mounts = NO_MOUNTS) {
|
|
129
|
+
let match = null;
|
|
130
|
+
for (const name of mounts.dirs) {
|
|
131
|
+
if ((rel === name || rel.startsWith(`${name}/`)) && name.length > (match?.length ?? -1)) {
|
|
132
|
+
match = name;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const name of mounts.files) {
|
|
136
|
+
// A file mount is an exact path: `AGENTS.md.bak` is not captured.
|
|
137
|
+
if (rel === name && name.length > (match?.length ?? -1))
|
|
138
|
+
match = name;
|
|
139
|
+
}
|
|
140
|
+
return match;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Whether a glob or path pattern can only ever match inside one mount — the
|
|
144
|
+
* shape `validate` needs to spot a `tools.allow` entry that contradicts the
|
|
145
|
+
* state's enabled mounts. Returns the mount name when the pattern's literal
|
|
146
|
+
* prefix (everything before its first wildcard) is already inside a mount, else
|
|
147
|
+
* `null`: a broader pattern is left to the runtime rule, which refuses the
|
|
148
|
+
* unreachable paths call by call.
|
|
149
|
+
*/
|
|
150
|
+
export function mountNameOfPattern(pattern, mounts = NO_MOUNTS) {
|
|
151
|
+
const literal = canonicalizeRelPath(pattern).path.split(/[*?[{]/, 1)[0] ?? "";
|
|
152
|
+
const upToSegment = literal.slice(0, literal.lastIndexOf("/") + 1).replace(/\/+$/, "");
|
|
153
|
+
if (upToSegment === "")
|
|
154
|
+
return null;
|
|
155
|
+
return mountNameOf(upToSegment, mounts);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Classify a workspace path against the workspace's resolved authored mounts.
|
|
159
|
+
* Canonicalizes first (leading slashes stripped, `.`/`//` segments dropped, `..`
|
|
160
|
+
* applied) so equivalent spellings — `./data/x`, `//data/x`, `data/./x` — land in
|
|
161
|
+
* the same zone and none can be dodged with a prefix.
|
|
162
|
+
*
|
|
163
|
+
* With no table supplied, nothing classifies as `authored` — a caller probing the
|
|
164
|
+
* kernel in isolation gets run-state classification. That is safe because authored
|
|
165
|
+
* mounts refuse writes themselves (see `mountSubtree({ readOnly })`), so the
|
|
166
|
+
* kernel's read-only rule is the diagnostic layer rather than the only enforcement.
|
|
167
|
+
*/
|
|
168
|
+
export function classifyWorkspacePath(path, mounts = NO_MOUNTS) {
|
|
169
|
+
const { path: rel, escapes } = canonicalizeRelPath(path);
|
|
170
|
+
if (escapes)
|
|
171
|
+
return "escapes";
|
|
172
|
+
if (rel === "")
|
|
173
|
+
return "root";
|
|
174
|
+
const [top] = rel.split("/");
|
|
175
|
+
const mount = mountNameOf(rel, mounts);
|
|
176
|
+
// A writable mount is not authored: its paths are governed like run paths.
|
|
177
|
+
if (mount != null && !mounts.writable.includes(mount))
|
|
178
|
+
return "authored";
|
|
179
|
+
if (INTERNAL_DIR_SET.has(top))
|
|
180
|
+
return "run-internal";
|
|
181
|
+
if (OFFLOAD_DIR_SET.has(top))
|
|
182
|
+
return "run-offload";
|
|
183
|
+
if (top === SESSION_OPEN_DIR)
|
|
184
|
+
return "run-open";
|
|
185
|
+
return "run";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Whether `name` is reserved at the workspace root. Used to refuse a session id
|
|
189
|
+
* that would route its own run folder (`<sessionId>/checkpoints/…`) into a run
|
|
190
|
+
* area or a declared mount. Without a mount table only the framework-owned run
|
|
191
|
+
* areas are reserved — a colliding mount name then fails loudly at the read-only
|
|
192
|
+
* mount instead of silently corrupting authored content.
|
|
193
|
+
*/
|
|
194
|
+
export function isReservedRootName(name, mounts = NO_MOUNTS) {
|
|
195
|
+
if (SESSION_AREA_SET.has(name))
|
|
196
|
+
return true;
|
|
197
|
+
// A nested mount name reserves its own first segment too: a session folder
|
|
198
|
+
// called `catalogs` would route `catalogs/eu/…` into the mount.
|
|
199
|
+
const firstSegments = [...mounts.dirs, ...mounts.files].map((mount) => mount.split("/")[0]);
|
|
200
|
+
return firstSegments.includes(name);
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=zones.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zones.js","sourceRoot":"","sources":["../../src/core/zones.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAkDrD,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,oBAAoB,EAAE,sBAAsB,CAAU,CAAC;AAE5F;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,g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AAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
2
|
+
import { ChatOpenAI } from "@langchain/openai";
|
|
3
|
+
import { type PricingTable } from "./core/usage.js";
|
|
4
|
+
/**
|
|
5
|
+
* Package install root — the directory containing this file's parent (`dist/`
|
|
6
|
+
* when published/built, `src/` in development). Used only to locate assets
|
|
7
|
+
* bundled with the package, never the consumer's workspace or configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PACKAGE_ROOT: string;
|
|
10
|
+
/** Installed package implementation version, read from the package's `package.json`. */
|
|
11
|
+
export declare const PACKAGE_VERSION: string;
|
|
12
|
+
/**
|
|
13
|
+
* The authoring skill bundled with the package — the parent directory holding
|
|
14
|
+
* `archmax-harness/` (`SKILL.md` + `references/*.md`), which teaches a coding agent how
|
|
15
|
+
* to author a workspace. Resolved to `dist/authoring-skill` when built or
|
|
16
|
+
* installed, with a repo-checkout fallback to the top-level `skills/` when
|
|
17
|
+
* running from `src/`. Consumers mount it directly so the skill always matches
|
|
18
|
+
* the installed SDK version instead of a synced copy.
|
|
19
|
+
*/
|
|
20
|
+
export declare const BUNDLED_AUTHORING_SKILL_DIR: string;
|
|
21
|
+
/** @deprecated Use {@link BUNDLED_AUTHORING_SKILL_DIR}; same value, kept for one release. */
|
|
22
|
+
export declare const BUNDLED_SKILLS_DIR: string;
|
|
23
|
+
/** Resolve the agent workspace root: an explicit path, else the consumer's cwd. */
|
|
24
|
+
export declare function resolveWorkspaceRoot(rootDir?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Load `.env` from the resolved workspace root (or cwd) if present.
|
|
27
|
+
*
|
|
28
|
+
* Two rules, in this order: the real process environment always wins, and a
|
|
29
|
+
* later `.env` wins over an earlier one. The second is why this does not just
|
|
30
|
+
* call `dotenv.config` — dotenv never overrides an already-set variable, and it
|
|
31
|
+
* cannot tell its own earlier assignment from a real environment variable. The
|
|
32
|
+
* import-time cwd load below is an earlier one, so without the distinction a
|
|
33
|
+
* stray `.env` in whatever directory the process happened to start in would
|
|
34
|
+
* silently outrank the workspace root that owns the configuration (issue #23).
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadDotenv(rootDir?: string): void;
|
|
37
|
+
export interface AgentEnv {
|
|
38
|
+
apiBaseUrl: string;
|
|
39
|
+
apiKey: string;
|
|
40
|
+
model: string;
|
|
41
|
+
temperature?: number;
|
|
42
|
+
maxTokens?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the model streams responses (default true). Streaming is what
|
|
45
|
+
* makes `agent-text-delta` lifecycle events flow; invoke results are
|
|
46
|
+
* unchanged. Set `ARCHMAX_STREAMING=0` for OpenAI-compatible endpoints that
|
|
47
|
+
* misbehave under SSE.
|
|
48
|
+
*/
|
|
49
|
+
streaming?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Read the OpenAI-compatible model configuration from the `ARCHMAX_*` environment keys. */
|
|
52
|
+
export declare function loadEnv(): AgentEnv;
|
|
53
|
+
/** Build a `ChatOpenAI` model pointed at any OpenAI-compatible endpoint. */
|
|
54
|
+
export declare function createChatModel(env?: AgentEnv): ChatOpenAI;
|
|
55
|
+
/**
|
|
56
|
+
* Prompt-cache configuration from the environment: `ARCHMAX_PROMPT_CACHE`
|
|
57
|
+
* (default on) and `ARCHMAX_PROMPT_CACHE_TTL` (`5m` | `1h`).
|
|
58
|
+
*/
|
|
59
|
+
export declare function loadPromptCacheEnv(): {
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
ttl?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Token prices from the environment, in USD per 1M tokens, applying to whatever
|
|
65
|
+
* model is configured: `ARCHMAX_PRICE_INPUT`, `ARCHMAX_PRICE_OUTPUT`,
|
|
66
|
+
* `ARCHMAX_PRICE_CACHE_READ`, `ARCHMAX_PRICE_CACHE_WRITE`. Returns `undefined`
|
|
67
|
+
* when none are set, so cost is omitted rather than reported as zero.
|
|
68
|
+
*/
|
|
69
|
+
export declare function loadPricingEnv(): PricingTable | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The role a model plays in the runtime: the workflow `agent` (turns), a `judge`
|
|
72
|
+
* (the offline case grader), or a `rubric` (a grading rubric dispatched by a
|
|
73
|
+
* lifecycle hook). A {@link ModelFactory} may return a different model per role.
|
|
74
|
+
*/
|
|
75
|
+
export type ModelRole = "agent" | "judge" | "rubric";
|
|
76
|
+
/**
|
|
77
|
+
* Supplies the chat model for a given role, so library users can run the runtime
|
|
78
|
+
* against any LangChain `BaseChatModel` (e.g. Amazon Bedrock via
|
|
79
|
+
* `ChatBedrockConverse`) without forking. The default
|
|
80
|
+
* ({@link defaultModelFactory}) is role-independent and returns the
|
|
81
|
+
* env-configured OpenAI-compatible model, so existing `.env` setups and the
|
|
82
|
+
* bundled offline test cases are unchanged.
|
|
83
|
+
*
|
|
84
|
+
* `env` is a thunk, not a value: a factory that brings its own credentials (a
|
|
85
|
+
* host resolving the model from its own configuration) never calls it, and
|
|
86
|
+
* {@link loadEnv} — which throws on a missing `ARCHMAX_API_BASE_URL` — is then
|
|
87
|
+
* never reached. Calling it more than once is cheap; the assembly memoizes.
|
|
88
|
+
*/
|
|
89
|
+
export type ModelFactory = (role: ModelRole, env: () => AgentEnv,
|
|
90
|
+
/**
|
|
91
|
+
* The model id the caller asked for — today, the `model` a grading rubric
|
|
92
|
+
* declares. Additive: a factory that ignores it behaves exactly as one written
|
|
93
|
+
* before rubrics could name a model, and no error is raised for an unhonoured
|
|
94
|
+
* request. The default factory applies it over `ARCHMAX_MODEL`, keeping the
|
|
95
|
+
* configured endpoint and credentials.
|
|
96
|
+
*/
|
|
97
|
+
requested?: string) => BaseChatModel;
|
|
98
|
+
/** The default, role-independent model factory: the env-configured `ChatOpenAI`. */
|
|
99
|
+
export declare const defaultModelFactory: ModelFactory;
|