@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,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `workflow.yaml` shape, as types.
|
|
3
|
+
*
|
|
4
|
+
* Every type here is inferred from `machine/spec-schema.ts` — the schema *is*
|
|
5
|
+
* the spec, and these aliases exist so call sites read as domain vocabulary
|
|
6
|
+
* (`MachineState`) rather than as `z.infer<typeof machineStateSchema>`.
|
|
7
|
+
*/
|
|
8
|
+
import type { z } from "zod";
|
|
9
|
+
import type { allowEntrySchema, hookSchema, forbidEntrySchema, hookSpecSchema, machinePromptCacheSettingsSchema, machineSettingsSchema, machineSpecSchema, machineStateSchema, machineTransitionSchema, stateTypeSchema, runtimeMetadataSchema, skillsBlockSchema, mountsBlockSchema, mountAccessSchema, mountGrantEntrySchema, specExtensionsSchema, rubricDeclarationSchema, specMetadataSchema, stateBudgetSchema, toolsBlockSchema, transitionTypeSchema, triggerDeclarationSchema, workflowTestsConfigSchema, workflowSkillsConfigSchema, workflowMountsConfigSchema, workflowToolsConfigSchema } from "./spec-schema.js";
|
|
10
|
+
/**
|
|
11
|
+
* Semantic classification of an outgoing edge, primarily for **human states**: a
|
|
12
|
+
* UI can render `approve`/`reject`/`refine` as distinct decision buttons, and
|
|
13
|
+
* `none` (the default) is an ordinary route. A human state declares at most one
|
|
14
|
+
* transition of each labeled type. Metadata only on agent states.
|
|
15
|
+
*/
|
|
16
|
+
export type TransitionType = z.infer<typeof transitionTypeSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* One outgoing edge of a state. `description` is **required and non-empty**: the
|
|
19
|
+
* agent is disclosed the active state's edges and nothing else of the graph, so
|
|
20
|
+
* this is the whole of what it routes on — write it for a reader standing in the
|
|
21
|
+
* source state, which knows nothing of the target ("Refunds over $50", never "go
|
|
22
|
+
* to refund-review"). At a human state it is also the decision's button label.
|
|
23
|
+
*/
|
|
24
|
+
export type MachineTransition = z.infer<typeof machineTransitionSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* A single lifecycle hook: a tagged object whose single key names its **kind**
|
|
27
|
+
* (`script`, `rubric`, or a custom kind an executor is registered for) and
|
|
28
|
+
* whose value is the kind's target, optionally beside the reserved
|
|
29
|
+
* `max_iterations` sidecar (the bounded grade-and-retry budget of an `after`
|
|
30
|
+
* hook). A rubric's grading criteria are its `instructions` in the spec's
|
|
31
|
+
* `rubrics:` block, never a hook attribute.
|
|
32
|
+
*/
|
|
33
|
+
export type Hook = z.infer<typeof hookSchema>;
|
|
34
|
+
/** A `before`/`after` field: one hook or an ordered list run in sequence. */
|
|
35
|
+
export type HookSpec = z.infer<typeof hookSpecSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Per-state execution budget. `maxTurns` bounds the model iterations of the
|
|
38
|
+
* turn's agent loop; `timeoutMs` aborts the turn when exceeded; `maxParks` bounds
|
|
39
|
+
* how many times the state may park itself with `archmax_wait`. Any exhaustion
|
|
40
|
+
* is a turn failure subject to `on_error`.
|
|
41
|
+
*/
|
|
42
|
+
export type StateBudget = z.infer<typeof stateBudgetSchema>;
|
|
43
|
+
/** One entry of a `tools.allow` list: a bare tool name, or a constrained shape. */
|
|
44
|
+
export type AllowEntry = z.infer<typeof allowEntrySchema>;
|
|
45
|
+
/**
|
|
46
|
+
* Per-state tool governance. Allow-only: a state with `allow` permits exactly the
|
|
47
|
+
* listed tools/arg-shapes (plus workflow-level `allow_always` grants and the
|
|
48
|
+
* essential surface); a state without one gets the essential surface only.
|
|
49
|
+
*/
|
|
50
|
+
export type ToolsBlock = z.infer<typeof toolsBlockSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* A denial entry: the same grammar as {@link AllowEntry}, plus the tool `*`
|
|
53
|
+
* meaning every tool. Deny beats allow, and no narrower level widens a denial —
|
|
54
|
+
* so a wildcard is safe here and a document-level error in an `allow` list.
|
|
55
|
+
*/
|
|
56
|
+
export type ForbidEntry = z.infer<typeof forbidEntrySchema>;
|
|
57
|
+
/**
|
|
58
|
+
* A **state's** skill governance by slug: what this state adds to the workflow's
|
|
59
|
+
* always-on grant. A skill is enabled only where a list names it — an absent
|
|
60
|
+
* block adds nothing, exactly as `allow: []` does, and exactly as an absent
|
|
61
|
+
* `tools.allow` grants no tool.
|
|
62
|
+
*/
|
|
63
|
+
export type SkillsBlock = z.infer<typeof skillsBlockSchema>;
|
|
64
|
+
/**
|
|
65
|
+
* A **state's** mount governance by name: what this state adds to the
|
|
66
|
+
* workflow's always-on grant, and what it subtracts. A mount the host declared
|
|
67
|
+
* governed is enabled only where a list names it; an ungoverned mount is
|
|
68
|
+
* visible in every state and `forbid` is what takes it away.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* How a state may use a mount it is given: `read` refuses writes there,
|
|
72
|
+
* `read_write` permits them where the host declared the mount writable. The
|
|
73
|
+
* host's posture is the ceiling — `read_write` cannot open a read-only mount —
|
|
74
|
+
* so this key's real work is narrowing a writable mount in the states that only
|
|
75
|
+
* read it.
|
|
76
|
+
*/
|
|
77
|
+
export type MountAccess = z.infer<typeof mountAccessSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* One entry of a mounts grant list: a bare mount name, taking the write posture
|
|
80
|
+
* the host declared, or `{ mount, access }` naming the access this level gives.
|
|
81
|
+
* Normalized to one shape by `normalizeMountGrants` (`machine/mount-grants.ts`).
|
|
82
|
+
*/
|
|
83
|
+
export type MountGrantEntry = z.infer<typeof mountGrantEntrySchema>;
|
|
84
|
+
export type MountsBlock = z.infer<typeof mountsBlockSchema>;
|
|
85
|
+
/**
|
|
86
|
+
* The kind of a state: `agent` (default) runs a Deep Agent turn that picks a
|
|
87
|
+
* transition with `archmax_advance`; `human` parks the session and a person picks
|
|
88
|
+
* the outgoing edge.
|
|
89
|
+
*/
|
|
90
|
+
export type StateType = z.infer<typeof stateTypeSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* One state of the graph, keyed in {@link MachineSpec.states} by its **slug** —
|
|
93
|
+
* its sole identity. Every reference to a state (`to`, `on_error`, the `to` the
|
|
94
|
+
* agent passes to `archmax_advance`, events, artifacts, test assertions) is a
|
|
95
|
+
* slug.
|
|
96
|
+
*
|
|
97
|
+
* `model` names the model id this state's turns run on — an id only, resolved
|
|
98
|
+
* over the endpoint and credentials the assembly is already configured with. It
|
|
99
|
+
* is the most specific position of the chain state → {@link MachineSettings}
|
|
100
|
+
* `model` → the assembly's default, read once through `WorkflowMachine.modelFor`.
|
|
101
|
+
*/
|
|
102
|
+
export type MachineState = z.infer<typeof machineStateSchema>;
|
|
103
|
+
/** Workflow-level tool grants. */
|
|
104
|
+
export type WorkflowToolsConfig = z.infer<typeof workflowToolsConfigSchema>;
|
|
105
|
+
/**
|
|
106
|
+
* Workflow-level skill governance: `allow_always` is enabled in every state and
|
|
107
|
+
* a state's `skills.allow` adds to it; `forbid_always` denies in every state and
|
|
108
|
+
* beats every grant. See {@link SkillsBlock} for the state's half.
|
|
109
|
+
*/
|
|
110
|
+
export type WorkflowSkillsConfig = z.infer<typeof workflowSkillsConfigSchema>;
|
|
111
|
+
/**
|
|
112
|
+
* Workflow-level mount governance: `allow_always` enables its governed mounts
|
|
113
|
+
* in every state and a state's `mounts.allow` adds to it; `forbid_always`
|
|
114
|
+
* denies in every state, beats every grant, and binds every descendant session.
|
|
115
|
+
* See {@link MountsBlock} for the state's half.
|
|
116
|
+
*/
|
|
117
|
+
export type WorkflowMountsConfig = z.infer<typeof workflowMountsConfigSchema>;
|
|
118
|
+
/** Workflow-declared provider prompt-cache settings. */
|
|
119
|
+
export type MachinePromptCacheSettings = z.infer<typeof machinePromptCacheSettingsSchema>;
|
|
120
|
+
/**
|
|
121
|
+
* Sandbox and prompt-cache knobs declared at the spec root, plus `model`: the
|
|
122
|
+
* model id every state of this workflow runs on unless the state names its own.
|
|
123
|
+
* An id only — the endpoint, credentials and sampling stay the assembly's
|
|
124
|
+
* configuration — and it overrides `ARCHMAX_MODEL`, not a host's explicit `model`.
|
|
125
|
+
*/
|
|
126
|
+
export type MachineSettings = z.infer<typeof machineSettingsSchema>;
|
|
127
|
+
/** Offline-test suite configuration declared at the spec root. */
|
|
128
|
+
export type WorkflowTestsConfig = z.infer<typeof workflowTestsConfigSchema>;
|
|
129
|
+
/**
|
|
130
|
+
* Optional runtime contract declaration: the authoring/runtime semantics a
|
|
131
|
+
* workspace expects, independent of the installed npm version.
|
|
132
|
+
*/
|
|
133
|
+
export type RuntimeMetadata = z.infer<typeof runtimeMetadataSchema>;
|
|
134
|
+
/**
|
|
135
|
+
* One trigger's declaration, under the `triggers:` of the state it enters: how
|
|
136
|
+
* its firings map to a session, and the run's signature. The state it sits on
|
|
137
|
+
* is its entry state and the key it sits under is its id, so neither is a key
|
|
138
|
+
* of the declaration.
|
|
139
|
+
*/
|
|
140
|
+
export type TriggerDeclaration = z.infer<typeof triggerDeclarationSchema>;
|
|
141
|
+
/** Workspace-declared expectations the runtime cannot verify from the spec alone. */
|
|
142
|
+
export type SpecExtensions = z.infer<typeof specExtensionsSchema>;
|
|
143
|
+
/**
|
|
144
|
+
* Host data, accepted at three positions: the spec root (an authoring UI's canvas
|
|
145
|
+
* state), a state (a node's position), and a rubric (a display label). Preserved
|
|
146
|
+
* across a load, never read by the runtime, and dropped before the spec is
|
|
147
|
+
* hashed.
|
|
148
|
+
*/
|
|
149
|
+
export type SpecMetadata = z.infer<typeof specMetadataSchema>;
|
|
150
|
+
/**
|
|
151
|
+
* One grading rubric: the standard a state's exit is measured against, declared
|
|
152
|
+
* in the same document as the state whose hook names it. `instructions` carries
|
|
153
|
+
* the criteria and the verdict to return; `max_iterations` bounds the
|
|
154
|
+
* grade-and-retry loop (a hook's own sidecar wins over it); `model` names the id
|
|
155
|
+
* the grader runs on. A rubric is authoring-plane content: the agent it grades
|
|
156
|
+
* can neither read it nor dispatch it.
|
|
157
|
+
*/
|
|
158
|
+
export type RubricDeclaration = z.infer<typeof rubricDeclarationSchema>;
|
|
159
|
+
/** The whole of `workflow.yaml`. */
|
|
160
|
+
export type MachineSpec = z.infer<typeof machineSpecSchema>;
|
|
161
|
+
/** Runtime knobs derived from `settings`, consumed by the harness. */
|
|
162
|
+
export interface HarnessSettings {
|
|
163
|
+
timeoutMs: number;
|
|
164
|
+
memoryLimitBytes?: number;
|
|
165
|
+
maxPtcCalls?: number | null;
|
|
166
|
+
maxResultChars?: number;
|
|
167
|
+
/** Prompt-cache declaration, when present. */
|
|
168
|
+
promptCache?: {
|
|
169
|
+
enabled?: boolean;
|
|
170
|
+
ttl?: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface LifecycleHook {
|
|
174
|
+
/** Normalized ordered `before` hooks (single spec wrapped in a list). */
|
|
175
|
+
before?: Hook[];
|
|
176
|
+
/** Normalized ordered `after` hooks (single spec wrapped in a list). */
|
|
177
|
+
after?: Hook[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Whether a spec declares itself out of service — the single interpretation
|
|
181
|
+
* point for {@link MachineSpec.disabled}; a function because some callers hold a
|
|
182
|
+
* spec that cannot build a machine. Read fail-closed: set unless the value is
|
|
183
|
+
* absent, `null`, or boolean `false`, so a mis-authored truthy value stops the
|
|
184
|
+
* workflow rather than running it.
|
|
185
|
+
*/
|
|
186
|
+
export declare function specDisabled(spec: MachineSpec | null | undefined): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a spec declares itself out of service — the single interpretation
|
|
3
|
+
* point for {@link MachineSpec.disabled}; a function because some callers hold a
|
|
4
|
+
* spec that cannot build a machine. Read fail-closed: set unless the value is
|
|
5
|
+
* absent, `null`, or boolean `false`, so a mis-authored truthy value stops the
|
|
6
|
+
* workflow rather than running it.
|
|
7
|
+
*/
|
|
8
|
+
export function specDisabled(spec) {
|
|
9
|
+
const declared = spec?.disabled;
|
|
10
|
+
return declared !== undefined && declared !== null && declared !== false;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/machine/types.ts"],"names":[],"mappings":"AAuOA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAoC;IAC/D,MAAM,QAAQ,GAAI,IAAkD,EAAE,QAAQ,CAAC;IAC/E,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,KAAK,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything that can be said about a `workflow.yaml` **from the document
|
|
3
|
+
* alone**: the shape (`machineSpecSchema`), the document-level cross-references
|
|
4
|
+
* (`refineSpec`) and the advisories (`lintSpec`), as one list of diagnostics.
|
|
5
|
+
*
|
|
6
|
+
* Pure — no workspace, no backend, no machine — so an editor can show the same
|
|
7
|
+
* findings inline that `archmax validate` prints, and the loader reports exactly
|
|
8
|
+
* these. What needs more than the document (hook scripts on disk, sibling
|
|
9
|
+
* workflows, the skill registry, kernel probes) is `validate/validate.ts`.
|
|
10
|
+
*/
|
|
11
|
+
import type { Diagnostic } from "./diagnostic.js";
|
|
12
|
+
import { type SpecSchemaIssue } from "./spec-schema.js";
|
|
13
|
+
import type { MachineSpec } from "./types.js";
|
|
14
|
+
/** What {@link validateSpec} found. */
|
|
15
|
+
export interface SpecValidation {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the shape and the document rules held — the spec can be compiled
|
|
18
|
+
* into a machine. An advisory (`lint`) never clears this, even at severity
|
|
19
|
+
* `error`: the runtime tolerates what the lint reports and `validate` fails on it.
|
|
20
|
+
*/
|
|
21
|
+
ok: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The typed spec, when the shape held — also beside a document-level error
|
|
24
|
+
* (a dangling target), so the lint could read it and a caller can too.
|
|
25
|
+
*/
|
|
26
|
+
spec?: MachineSpec;
|
|
27
|
+
/** The shape and document-rule findings, each an `error` addressed by its `field`. */
|
|
28
|
+
schema: Diagnostic[];
|
|
29
|
+
/** The advisory findings, warnings and the errors the runtime tolerates. */
|
|
30
|
+
lint: Diagnostic[];
|
|
31
|
+
/** `schema` then `lint`, for a caller that wants one list. */
|
|
32
|
+
diagnostics: Diagnostic[];
|
|
33
|
+
}
|
|
34
|
+
/** A structural issue as a diagnostic: an error at the key an author has to find. */
|
|
35
|
+
export declare function schemaIssueDiagnostic(issue: SpecSchemaIssue): Diagnostic;
|
|
36
|
+
/**
|
|
37
|
+
* Validate a parsed `workflow.yaml` mapping. Total: never throws, and a document
|
|
38
|
+
* the schema refuses still yields every issue the schema found, so an editor
|
|
39
|
+
* can show a blank transition `description` or a misspelled state key inline
|
|
40
|
+
* rather than as one refusal. `file` is left to the caller.
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateSpec(value: unknown): SpecValidation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { lintSpec } from "./lint-spec.js";
|
|
2
|
+
import { parseMachineSpec } from "./spec-schema.js";
|
|
3
|
+
/** A structural issue as a diagnostic: an error at the key an author has to find. */
|
|
4
|
+
export function schemaIssueDiagnostic(issue) {
|
|
5
|
+
return {
|
|
6
|
+
severity: "error",
|
|
7
|
+
message: issue.message,
|
|
8
|
+
...(issue.path ? { field: issue.path } : {}),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validate a parsed `workflow.yaml` mapping. Total: never throws, and a document
|
|
13
|
+
* the schema refuses still yields every issue the schema found, so an editor
|
|
14
|
+
* can show a blank transition `description` or a misspelled state key inline
|
|
15
|
+
* rather than as one refusal. `file` is left to the caller.
|
|
16
|
+
*/
|
|
17
|
+
export function validateSpec(value) {
|
|
18
|
+
const parsed = parseMachineSpec(value);
|
|
19
|
+
const schema = parsed.ok ? [] : parsed.issues.map(schemaIssueDiagnostic);
|
|
20
|
+
const lint = parsed.spec ? lintSpec(parsed.spec) : [];
|
|
21
|
+
return {
|
|
22
|
+
ok: parsed.ok,
|
|
23
|
+
...(parsed.spec ? { spec: parsed.spec } : {}),
|
|
24
|
+
schema,
|
|
25
|
+
lint,
|
|
26
|
+
diagnostics: [...schema, ...lint],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=validate-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-spec.js","sourceRoot":"","sources":["../../src/machine/validate-spec.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAwB,MAAM,kBAAkB,CAAC;AAwB1E,qFAAqF;AACrF,MAAM,UAAU,qBAAqB,CAAC,KAAsB;IAC1D,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtD,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM;QACN,IAAI;QACJ,WAAW,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run-variable references — `${{name}}` and `${{name.dotted.path}}` — in guards,
|
|
3
|
+
* prompts and the arguments the agent writes. One resolver serves the kernel,
|
|
4
|
+
* disclosure, validation and substitution, so a reference means one thing.
|
|
5
|
+
*
|
|
6
|
+
* Three invariants carry the feature's safety: a substituted value is
|
|
7
|
+
* glob-escaped where the output is a *pattern* and verbatim where it is a
|
|
8
|
+
* *value*; resolution fails closed (never the literal `${{…}}` text, never `*`);
|
|
9
|
+
* and traversal reads own properties only (`resolvePath`), so `tags.length` and
|
|
10
|
+
* `constructor` never resolve.
|
|
11
|
+
*/
|
|
12
|
+
import type { WorkflowMachine } from "./machine.js";
|
|
13
|
+
/** The shape a run-variable name must take: a snake_case identifier, never dotted. */
|
|
14
|
+
export declare const VARIABLE_NAME_PATTERN: RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* The built-in variable holding the run's trigger id. Reserved: it is set by the
|
|
17
|
+
* harness at run start, locked, and needs no seed — so a guard may reference
|
|
18
|
+
* `${{trigger}}` without anything supplying it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const TRIGGER_VARIABLE = "trigger";
|
|
21
|
+
/**
|
|
22
|
+
* The built-in variable holding a short label for the task the run is doing.
|
|
23
|
+
* Agent-owned, unlike `trigger`: nothing sets it until the agent does. Two rules
|
|
24
|
+
* follow it everywhere it is written — it is **never locked** (a seed stores it
|
|
25
|
+
* unlocked; `set_variables` refuses `lock: true`), and it is **shape-checked on
|
|
26
|
+
* write** ({@link titleWriteError}). Unrelated to the spec's static `title`
|
|
27
|
+
* fields.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TITLE_VARIABLE = "title";
|
|
30
|
+
/**
|
|
31
|
+
* The longest a title may be. A bound, not a style guide — the system prompt asks
|
|
32
|
+
* for something short, and this only stops something unusable from being stored.
|
|
33
|
+
*/
|
|
34
|
+
export declare const TITLE_MAX_LENGTH = 200;
|
|
35
|
+
/**
|
|
36
|
+
* Check a value destined for {@link TITLE_VARIABLE}, returning the refusal reason
|
|
37
|
+
* or `undefined` when it passes. Shared by both write routes (a seed throws, the
|
|
38
|
+
* agent's `set_variables` is refused). Refuses rather than coerces; trimming is
|
|
39
|
+
* the one coercion allowed.
|
|
40
|
+
*/
|
|
41
|
+
export declare function titleWriteError(value: unknown): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The value to store for a title that has passed {@link titleWriteError} — the
|
|
44
|
+
* trimmed string. Separate from the check so a caller cannot store the untrimmed
|
|
45
|
+
* original by forgetting to.
|
|
46
|
+
*/
|
|
47
|
+
export declare function normalizeTitle(value: string): string;
|
|
48
|
+
/** Thrown when a seeded (or written) variable name is not a valid identifier. */
|
|
49
|
+
export declare class InvalidVariableNameError extends Error {
|
|
50
|
+
readonly variable: string;
|
|
51
|
+
/** Where the name came from, for a message that points at the fix. */
|
|
52
|
+
readonly source: string;
|
|
53
|
+
constructor(variable: string,
|
|
54
|
+
/** Where the name came from, for a message that points at the fix. */
|
|
55
|
+
source?: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Thrown when a seeded `title` is not a usable label — a throw rather than the
|
|
59
|
+
* agent's string refusal, because a bad seed is a host defect that should
|
|
60
|
+
* surface at assembly.
|
|
61
|
+
*/
|
|
62
|
+
export declare class InvalidTitleError extends Error {
|
|
63
|
+
/** The shape problem, in the same words the agent's refusal uses. */
|
|
64
|
+
readonly detail: string;
|
|
65
|
+
/** Where the value came from, for a message that points at the fix. */
|
|
66
|
+
readonly source: string;
|
|
67
|
+
constructor(
|
|
68
|
+
/** The shape problem, in the same words the agent's refusal uses. */
|
|
69
|
+
detail: string,
|
|
70
|
+
/** Where the value came from, for a message that points at the fix. */
|
|
71
|
+
source?: string);
|
|
72
|
+
}
|
|
73
|
+
/** A run variable as stored in checkpointed state. */
|
|
74
|
+
export interface VariableEntry {
|
|
75
|
+
value: unknown;
|
|
76
|
+
locked: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Set only by a **host seeding boundary** (a delivery into a wait-parked
|
|
79
|
+
* session, the start of a turn): the host is re-establishing the session's
|
|
80
|
+
* facts, so this replaces even a settled *locked* value. Everywhere else the
|
|
81
|
+
* merge is first-lock-wins. The variable tools never set it, so no
|
|
82
|
+
* agent-reachable path can bypass a lock.
|
|
83
|
+
*/
|
|
84
|
+
reseed?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** The checkpointed variable store, keyed by name. */
|
|
87
|
+
export type VariableStore = Record<string, VariableEntry>;
|
|
88
|
+
/**
|
|
89
|
+
* Turn a caller's seeds into locked variable entries — the one way a run's
|
|
90
|
+
* opening facts are established, whether by a host's `variables` option, a
|
|
91
|
+
* delivery's seeds, or the arguments a delegation hands a sub-run. Locked because
|
|
92
|
+
* a `${{name}}` guard bound to a seed is worthless if the agent can rewrite it.
|
|
93
|
+
*/
|
|
94
|
+
export declare function buildSeededVariables(seeds: Record<string, unknown> | undefined,
|
|
95
|
+
/** Where the names came from, for a message that points at the fix. */
|
|
96
|
+
source?: string): VariableStore;
|
|
97
|
+
/** One `${{…}}` reference found in a glob, with its span for substitution. */
|
|
98
|
+
export interface VariableReference {
|
|
99
|
+
/** The full matched text, e.g. `${{order.items.0.sku}}`. */
|
|
100
|
+
raw: string;
|
|
101
|
+
/** The variable name (first segment). */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Path segments after the name; empty for a whole-variable reference. */
|
|
104
|
+
path: string[];
|
|
105
|
+
/** Index of `raw` within the glob it was found in. */
|
|
106
|
+
index: number;
|
|
107
|
+
}
|
|
108
|
+
/** Why a reference could not be resolved. Each is a fail-closed outcome. */
|
|
109
|
+
export type UnresolvedReason = "malformed" | "invalid-name" | "unset" | "path-missing" | "non-scalar";
|
|
110
|
+
export interface ResolvedGlob {
|
|
111
|
+
ok: true;
|
|
112
|
+
/** The glob with every reference substituted and glob-escaped. */
|
|
113
|
+
pattern: string;
|
|
114
|
+
}
|
|
115
|
+
export interface UnresolvedGlob {
|
|
116
|
+
ok: false;
|
|
117
|
+
reason: UnresolvedReason;
|
|
118
|
+
/** The reference that could not be resolved (its raw `${{…}}` text). */
|
|
119
|
+
reference: string;
|
|
120
|
+
/** Human-readable explanation, suitable for a governance block reason. */
|
|
121
|
+
detail: string;
|
|
122
|
+
}
|
|
123
|
+
export type GlobResolution = ResolvedGlob | UnresolvedGlob;
|
|
124
|
+
/**
|
|
125
|
+
* Whether a glob contains reference **syntax** — a `${{…}}` reference or an
|
|
126
|
+
* escaped `$${{…}}` literal. Callers use this to skip resolution entirely for the
|
|
127
|
+
* common reference-free glob, so an escape has to answer `true` here: it resolves
|
|
128
|
+
* nothing, but it still needs the pass that turns `$${{x}}` into `${{x}}`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function hasVariableReference(glob: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Every `${{…}}` reference in a glob, in order. A syntactically malformed
|
|
133
|
+
* reference still appears here (with an empty `name`), so callers can report it
|
|
134
|
+
* rather than skip it. An escaped `$${{…}}` is omitted — it is literal text, and
|
|
135
|
+
* reporting it as a reference would make `validate` warn about a variable the
|
|
136
|
+
* author deliberately spelled out.
|
|
137
|
+
*/
|
|
138
|
+
export declare function parseReferences(glob: string): VariableReference[];
|
|
139
|
+
/** Whether a reference is structurally usable (name shape, no empty segments). */
|
|
140
|
+
export declare function referenceError(ref: VariableReference): UnresolvedReason | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Resolve a dotted path against a value, reading own properties only. Returns
|
|
143
|
+
* `undefined` when any segment misses — indistinguishable from a stored
|
|
144
|
+
* `undefined`, which is fine: both are unresolvable for a guard.
|
|
145
|
+
*/
|
|
146
|
+
export declare function resolvePath(value: unknown, path: string[]): unknown;
|
|
147
|
+
/**
|
|
148
|
+
* Escape every picomatch metacharacter so a substituted value is matched as
|
|
149
|
+
* literal text; without it a variable holding `*` or `{a,b}` widens the guard.
|
|
150
|
+
*/
|
|
151
|
+
export declare function escapeGlobLiteral(value: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* Substitute every reference in a glob against the run's variables. Returns the
|
|
154
|
+
* resolved pattern, or the first unresolved reference and why — a glob with an
|
|
155
|
+
* unresolved reference matches nothing at all, so the caller must not fall back
|
|
156
|
+
* to the original text.
|
|
157
|
+
*/
|
|
158
|
+
export declare function resolveGlob(glob: string, variables: VariableStore): GlobResolution;
|
|
159
|
+
/**
|
|
160
|
+
* Substitute every reference in a piece of **prose** (a sub-workflow prompt)
|
|
161
|
+
* verbatim: a prompt is text a model reads, where glob-escaping would teach it
|
|
162
|
+
* to emit backslashes. Failure is still closed — a literal `${{…}}` reaching a
|
|
163
|
+
* model is an instruction it cannot follow.
|
|
164
|
+
*/
|
|
165
|
+
export declare function resolveText(text: string, variables: VariableStore): GlobResolution;
|
|
166
|
+
/**
|
|
167
|
+
* A resolved tool-call argument structure, or the first reference that stopped
|
|
168
|
+
* it. The failure side is the same `UnresolvedGlob` every other consumer reports.
|
|
169
|
+
*/
|
|
170
|
+
export type ArgumentResolution = {
|
|
171
|
+
ok: true;
|
|
172
|
+
args: Record<string, unknown>;
|
|
173
|
+
} | UnresolvedGlob;
|
|
174
|
+
/**
|
|
175
|
+
* Substitute every reference in the **arguments the agent wrote**, verbatim.
|
|
176
|
+
* Walks deep (non-string leaves pass through), fails first-wins and totally (the
|
|
177
|
+
* tool never receives a half-resolved structure), and only reports. Objects are
|
|
178
|
+
* rebuilt with `Object.fromEntries`, which *defines* each key, so a model-emitted
|
|
179
|
+
* `__proto__` becomes a property rather than a prototype.
|
|
180
|
+
*/
|
|
181
|
+
export declare function resolveArguments(args: Record<string, unknown>, variables: VariableStore): ArgumentResolution;
|
|
182
|
+
/**
|
|
183
|
+
* Render a guard glob for the model: the resolved pattern when it resolves, or a
|
|
184
|
+
* short unresolved marker naming the reference. The model is told a constraint
|
|
185
|
+
* exists and what it is waiting on, rather than being shown a placeholder it
|
|
186
|
+
* might try to pass literally into a call that would end the run.
|
|
187
|
+
*/
|
|
188
|
+
export declare function describeGlob(glob: string, variables: VariableStore): string;
|
|
189
|
+
/**
|
|
190
|
+
* Warn about every `${{…}}` guard reference the assembly cannot *guarantee* is
|
|
191
|
+
* set — named by neither the host's seeds, any state's `requires`, nor the
|
|
192
|
+
* built-in `trigger`. A warning, not a throw: `archmax_set_variables` can create
|
|
193
|
+
* any name at runtime, so an upstream state may legitimately establish it; the
|
|
194
|
+
* enforcement is the runtime failure when the guard cannot resolve.
|
|
195
|
+
*/
|
|
196
|
+
export declare function unguaranteedReferenceWarnings(machine: Pick<WorkflowMachine, "spec">, seededVariables: VariableStore): string[];
|