@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,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The governed composition: one Deep Agent whose compiled graph carries the
|
|
3
|
+
* machine's position, variables, trail and park records as channels, with the
|
|
4
|
+
* governance middleware enforcing the machine at every turn boundary, model
|
|
5
|
+
* call and tool call.
|
|
6
|
+
*
|
|
7
|
+
* Factored out of `createAgent` so a sub-workflow is composed the same way for
|
|
8
|
+
* a different machine: the {@link AssemblyContext} is everything a composition
|
|
9
|
+
* shares with the root; the machine, its system prompt, its trigger and any
|
|
10
|
+
* inherited denials are what varies.
|
|
11
|
+
*/
|
|
12
|
+
import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
13
|
+
import type { BaseCheckpointSaver } from "@langchain/langgraph";
|
|
14
|
+
import { type AgentMiddleware } from "langchain";
|
|
15
|
+
import { type BackendProtocolV2, type CreateDeepAgentParams } from "deepagents";
|
|
16
|
+
import { type CompiledAgentGraph, type IntrospectableStateGraph } from "../core/deepagents.js";
|
|
17
|
+
import { type WorkflowEventEmitter } from "../core/events.js";
|
|
18
|
+
import { type SessionStore } from "../core/session-store.js";
|
|
19
|
+
import type { SessionZoneRouter } from "../core/session-zone.js";
|
|
20
|
+
import type { SkillPrefixes, SkillRegistry } from "../core/skills.js";
|
|
21
|
+
import type { PricingTable, UsageTracker } from "../core/usage.js";
|
|
22
|
+
import type { Workspace } from "../core/workspace.js";
|
|
23
|
+
import type { MountPrefixes } from "../core/zones.js";
|
|
24
|
+
import { type GovernanceRule } from "../kernel/kernel.js";
|
|
25
|
+
import { type WorkflowMachine } from "../machine/machine.js";
|
|
26
|
+
import { type TriggerInput } from "../machine/triggers.js";
|
|
27
|
+
import type { ResolvedRuntimeContract } from "../runtime/contract.js";
|
|
28
|
+
import type { LoadedRubric, Rubric } from "../rubrics/rubrics.js";
|
|
29
|
+
import { type SubWorkflowRegistry } from "../workflow/sub-workflow.js";
|
|
30
|
+
import { type TurnRunner } from "../workflow/turn-runner.js";
|
|
31
|
+
import type { CreateAgentParams } from "./index.js";
|
|
32
|
+
/**
|
|
33
|
+
* Everything one assembly resolved once and every composition it makes shares.
|
|
34
|
+
* Built by `createAgent`, consumed by {@link composeGoverned}, the plain
|
|
35
|
+
* composition and the delegation registry.
|
|
36
|
+
*/
|
|
37
|
+
export interface AssemblyContext {
|
|
38
|
+
params: CreateAgentParams;
|
|
39
|
+
/** The root workflow's slug — what a diagnostic names, and what a child inherits denials from. */
|
|
40
|
+
workflowName: string;
|
|
41
|
+
workspace: Workspace;
|
|
42
|
+
authoring: Workspace;
|
|
43
|
+
backend: BackendProtocolV2;
|
|
44
|
+
sessionZone: SessionZoneRouter;
|
|
45
|
+
sessionStore: SessionStore;
|
|
46
|
+
mountPrefixes: MountPrefixes;
|
|
47
|
+
checkpointer: BaseCheckpointSaver;
|
|
48
|
+
emit: WorkflowEventEmitter;
|
|
49
|
+
usage: UsageTracker;
|
|
50
|
+
model: BaseChatModel;
|
|
51
|
+
/**
|
|
52
|
+
* The model a **state** runs on: the id it declares (or its workflow's
|
|
53
|
+
* `settings.model`) resolved through the assembly's factory seam and memoized
|
|
54
|
+
* per distinct id; no id resolves to {@link AssemblyContext.model}. Held on the
|
|
55
|
+
* context so a delegated child — governed by its own machine, declaring its own
|
|
56
|
+
* ids — resolves them exactly as the root does.
|
|
57
|
+
*/
|
|
58
|
+
agentModel: (id?: string) => BaseChatModel;
|
|
59
|
+
/**
|
|
60
|
+
* Whether a declared id reaches a model at all. `false` when the host handed
|
|
61
|
+
* `createAgent` an explicit `model` instance, which outranks every declaration;
|
|
62
|
+
* each composition then reports its own inert ids once.
|
|
63
|
+
*/
|
|
64
|
+
honoursDeclaredModels: boolean;
|
|
65
|
+
rubrics: Map<string, Rubric>;
|
|
66
|
+
/**
|
|
67
|
+
* The model a rubric grades on: its declared `model` resolved through the
|
|
68
|
+
* assembly's factory seam, else the `rubric`-role model. Held on the context so
|
|
69
|
+
* a delegated child — which builds its own registry from its own spec — resolves
|
|
70
|
+
* graders the same way the root does.
|
|
71
|
+
*/
|
|
72
|
+
rubricModel: (rubric: Rubric) => BaseChatModel | undefined;
|
|
73
|
+
/** Every subagent the assembly dispatches to, file-loaded and inline, in the Deep Agents shape. */
|
|
74
|
+
subagents: LoadedRubric[];
|
|
75
|
+
skillSources: string[];
|
|
76
|
+
skillRegistry: SkillRegistry;
|
|
77
|
+
skillTable: SkillPrefixes;
|
|
78
|
+
runtimeContract: ResolvedRuntimeContract;
|
|
79
|
+
/** Token prices, from the host option or the environment; absent means cost is never reported. */
|
|
80
|
+
pricing?: PricingTable;
|
|
81
|
+
}
|
|
82
|
+
/** What one governed composition is made for. */
|
|
83
|
+
export interface ComposeInput {
|
|
84
|
+
/** The machine this composition is governed by — the root's, or a delegated one's. */
|
|
85
|
+
machine: WorkflowMachine;
|
|
86
|
+
/** That machine's slug, so a diagnostic about it can name it. */
|
|
87
|
+
workflow: string;
|
|
88
|
+
/** The fully resolved system prompt for that machine. */
|
|
89
|
+
systemPrompt: string;
|
|
90
|
+
/** The assembly-time default trigger. */
|
|
91
|
+
trigger?: TriggerInput;
|
|
92
|
+
/** Host seeds for sessions of this machine (a child seeds per dispatch instead). */
|
|
93
|
+
variables?: Record<string, unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* Denials compiled from every ancestor's `policy`, evaluated ahead of this
|
|
96
|
+
* machine's per-state grants so a delegated machine can narrow what is
|
|
97
|
+
* permitted but never re-grant what an ancestor forbade.
|
|
98
|
+
*/
|
|
99
|
+
inheritedPolicyRules?: GovernanceRule[];
|
|
100
|
+
/** Child compositions, resolved lazily by slug. */
|
|
101
|
+
registry: SubWorkflowRegistry;
|
|
102
|
+
}
|
|
103
|
+
/** One composed governed agent. */
|
|
104
|
+
export interface Composed {
|
|
105
|
+
graph: CompiledAgentGraph;
|
|
106
|
+
/** The session-bound turn runner every entry into a session goes through. */
|
|
107
|
+
driver: TurnRunner;
|
|
108
|
+
/** Release every per-session resource this composition holds. */
|
|
109
|
+
dispose: (sessionId: string) => void;
|
|
110
|
+
/** Whether the tool-mock middleware is wired (see `Agent.toolMocks`). */
|
|
111
|
+
toolMocks: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The graph as a resume reads and drives it: `getState` off the compiled
|
|
114
|
+
* graph, `invoke` through the turn runner under the agent's default config.
|
|
115
|
+
*/
|
|
116
|
+
resumable: IntrospectableStateGraph;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The Deep Agents options the assembly accepts and forwards untouched, in one
|
|
120
|
+
* place so the governed and plain compositions cannot drift about which reach
|
|
121
|
+
* the framework.
|
|
122
|
+
*/
|
|
123
|
+
export declare function frameworkPassthrough(params: CreateAgentParams): Pick<CreateDeepAgentParams, "store" | "interruptOn" | "name">;
|
|
124
|
+
/**
|
|
125
|
+
* The planning scratchpad: `write_todos` is always-on and deepagents 1.11.1 does
|
|
126
|
+
* not register it, so the assembly installs langchain's `todoListMiddleware`.
|
|
127
|
+
* Must sit outermost among the runtime's own middleware so its guidance lands on
|
|
128
|
+
* the system prompt **before** the workflow instrumentation splits it into
|
|
129
|
+
* `[static, volatile]` blocks.
|
|
130
|
+
*/
|
|
131
|
+
export declare function todoMiddleware(): AgentMiddleware;
|
|
132
|
+
/**
|
|
133
|
+
* The subagent parameters both compositions hand the framework: the workflow's
|
|
134
|
+
* grading rubrics, registered so the framework provides the `task` tool the
|
|
135
|
+
* runtime dispatches them through.
|
|
136
|
+
*
|
|
137
|
+
* They are never *disclosed* — `task` is withheld in every state and grantable by
|
|
138
|
+
* nothing — so registering a grader here gives the graded agent no reach; it only
|
|
139
|
+
* gives the runtime a runnable. `generalPurposeAgent: false` holds
|
|
140
|
+
* unconditionally: there is no agent-facing subagent in this SDK, so the
|
|
141
|
+
* framework's default general-purpose one would be a tool nothing may call.
|
|
142
|
+
*/
|
|
143
|
+
export declare function rubricParams(ctx: AssemblyContext): {
|
|
144
|
+
subagents: LoadedRubric[];
|
|
145
|
+
generalPurposeAgent: boolean;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Bind `fn` to a session: the session zone's view (agent-visible paths resolve
|
|
149
|
+
* against that session without its id embedded) plus the event envelope's
|
|
150
|
+
* session context. The single ingress where a session id becomes a store
|
|
151
|
+
* address, so it refuses an id that would escape the session zone or shadow a
|
|
152
|
+
* reserved root name.
|
|
153
|
+
*/
|
|
154
|
+
export declare function sessionBinder(ctx: AssemblyContext): <T>(sessionId: string, fn: () => Promise<T>) => Promise<T>;
|
|
155
|
+
/**
|
|
156
|
+
* The system prompt for one machine: the spec-rendered workflow header followed
|
|
157
|
+
* by the `WORKFLOW.md` prose (HTML comments stripped — notes for whoever opens
|
|
158
|
+
* the file, not for the model), layered with the persona, the platform prompt and
|
|
159
|
+
* the workspace zones by `resolveSystemPrompt`. The graph itself is not here: it
|
|
160
|
+
* is disclosed per model call, for the active state only, by the middleware. A
|
|
161
|
+
* plain agent (no machine) gets no platform prompt: it explains a graph there is
|
|
162
|
+
* none of.
|
|
163
|
+
*/
|
|
164
|
+
export declare function renderSystemPrompt(ctx: AssemblyContext, machine: WorkflowMachine | null, body: string, options: {
|
|
165
|
+
workflow: string;
|
|
166
|
+
}): Promise<string>;
|
|
167
|
+
/** Compose one governed agent for `input.machine`. */
|
|
168
|
+
export declare function composeGoverned(ctx: AssemblyContext, input: ComposeInput): Promise<Composed>;
|
|
169
|
+
/** The denials a direct child inherits from the root machine — the chain's first link. */
|
|
170
|
+
export declare function inheritedDenials(ctx: AssemblyContext, root: WorkflowMachine): GovernanceRule[];
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { mergeConfigs } from "@langchain/core/runnables";
|
|
2
|
+
import { todoListMiddleware } from "langchain";
|
|
3
|
+
import { createDeepAgent } from "deepagents";
|
|
4
|
+
import { AGENT_DEFAULT_CONFIG } from "../agent.js";
|
|
5
|
+
import { asCompiledAgentGraph, asDecisionGraph, } from "../core/deepagents.js";
|
|
6
|
+
import { withEventContext } from "../core/events.js";
|
|
7
|
+
import { resolveSystemPrompt } from "../core/prompt.js";
|
|
8
|
+
import { SessionStoreIdError, sessionIdRejection } from "../core/session-store.js";
|
|
9
|
+
import { TOOL_MOCK_MIDDLEWARE_NAME } from "../core/tool-mocks.js";
|
|
10
|
+
import { loadPromptCacheEnv } from "../env.js";
|
|
11
|
+
import { BUILTIN_HOOK_KINDS } from "../lifecycle/runner.js";
|
|
12
|
+
import { compileForbiddenSkillRules, compileForbiddenMountRules, compileForbidRules, } from "../kernel/kernel.js";
|
|
13
|
+
import { UNGRANTABLE_TOOLS } from "../machine/machine.js";
|
|
14
|
+
import { WorkflowLoadError } from "../machine/load-spec.js";
|
|
15
|
+
import { workflowToolName } from "../machine/tool-names.js";
|
|
16
|
+
import { resolveTrigger } from "../machine/triggers.js";
|
|
17
|
+
import { buildSeededVariables, unguaranteedReferenceWarnings } from "../machine/variables.js";
|
|
18
|
+
import { createScriptExecutor } from "../sandbox/executor.js";
|
|
19
|
+
import { createPtcToolGateway } from "../sandbox/ptc-gateway.js";
|
|
20
|
+
import { createQuickJsSandboxRuntime } from "../sandbox/runtime.js";
|
|
21
|
+
import { createInterpreter } from "../sandbox/tools.js";
|
|
22
|
+
import { createWorkflowInstrumentation } from "../workflow/middleware.js";
|
|
23
|
+
import { resolveHookScript, workflowPaths } from "../workflow/paths.js";
|
|
24
|
+
import { createProviderCacheMiddleware, modelIdOf, NATIVE_CACHE_STRATEGIES, resolveCacheStrategy, resolvePromptCacheConfig, unsupportedCacheMessage, } from "../workflow/prompt-cache.js";
|
|
25
|
+
import { renderWorkflowPrompt, stripHtmlComments } from "../workflow/render-prompt.js";
|
|
26
|
+
import { describeMachineTopology } from "../workflow/session-artifacts.js";
|
|
27
|
+
import { workflowStateSchema } from "../workflow/state.js";
|
|
28
|
+
import { createSubWorkflowDispatcher, SubWorkflowError, } from "../workflow/sub-workflow.js";
|
|
29
|
+
import { createTurnRunner } from "../workflow/turn-runner.js";
|
|
30
|
+
import { createDelegationTool } from "../workflow/workflow-tools.js";
|
|
31
|
+
/**
|
|
32
|
+
* The Deep Agents options the assembly accepts and forwards untouched, in one
|
|
33
|
+
* place so the governed and plain compositions cannot drift about which reach
|
|
34
|
+
* the framework.
|
|
35
|
+
*/
|
|
36
|
+
export function frameworkPassthrough(params) {
|
|
37
|
+
return {
|
|
38
|
+
...(params.store ? { store: params.store } : {}),
|
|
39
|
+
...(params.interruptOn ? { interruptOn: params.interruptOn } : {}),
|
|
40
|
+
...(params.name ? { name: params.name } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The planning scratchpad: `write_todos` is always-on and deepagents 1.11.1 does
|
|
45
|
+
* not register it, so the assembly installs langchain's `todoListMiddleware`.
|
|
46
|
+
* Must sit outermost among the runtime's own middleware so its guidance lands on
|
|
47
|
+
* the system prompt **before** the workflow instrumentation splits it into
|
|
48
|
+
* `[static, volatile]` blocks.
|
|
49
|
+
*/
|
|
50
|
+
export function todoMiddleware() {
|
|
51
|
+
return todoListMiddleware();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The subagent parameters both compositions hand the framework: the workflow's
|
|
55
|
+
* grading rubrics, registered so the framework provides the `task` tool the
|
|
56
|
+
* runtime dispatches them through.
|
|
57
|
+
*
|
|
58
|
+
* They are never *disclosed* — `task` is withheld in every state and grantable by
|
|
59
|
+
* nothing — so registering a grader here gives the graded agent no reach; it only
|
|
60
|
+
* gives the runtime a runnable. `generalPurposeAgent: false` holds
|
|
61
|
+
* unconditionally: there is no agent-facing subagent in this SDK, so the
|
|
62
|
+
* framework's default general-purpose one would be a tool nothing may call.
|
|
63
|
+
*/
|
|
64
|
+
export function rubricParams(ctx) {
|
|
65
|
+
return { subagents: ctx.subagents, generalPurposeAgent: false };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Bind `fn` to a session: the session zone's view (agent-visible paths resolve
|
|
69
|
+
* against that session without its id embedded) plus the event envelope's
|
|
70
|
+
* session context. The single ingress where a session id becomes a store
|
|
71
|
+
* address, so it refuses an id that would escape the session zone or shadow a
|
|
72
|
+
* reserved root name.
|
|
73
|
+
*/
|
|
74
|
+
export function sessionBinder(ctx) {
|
|
75
|
+
return (sessionId, fn) => {
|
|
76
|
+
const rejection = sessionIdRejection(sessionId, ctx.mountPrefixes);
|
|
77
|
+
if (rejection)
|
|
78
|
+
throw new SessionStoreIdError(sessionId, rejection);
|
|
79
|
+
return withEventContext({ sessionId }, () => ctx.sessionZone.sessionScoped(sessionId, fn));
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The system prompt for one machine: the spec-rendered workflow header followed
|
|
84
|
+
* by the `WORKFLOW.md` prose (HTML comments stripped — notes for whoever opens
|
|
85
|
+
* the file, not for the model), layered with the persona, the platform prompt and
|
|
86
|
+
* the workspace zones by `resolveSystemPrompt`. The graph itself is not here: it
|
|
87
|
+
* is disclosed per model call, for the active state only, by the middleware. A
|
|
88
|
+
* plain agent (no machine) gets no platform prompt: it explains a graph there is
|
|
89
|
+
* none of.
|
|
90
|
+
*/
|
|
91
|
+
export function renderSystemPrompt(ctx, machine, body, options) {
|
|
92
|
+
const prose = stripHtmlComments(body).trim();
|
|
93
|
+
const workflowPrompt = machine
|
|
94
|
+
? [renderWorkflowPrompt(machine), prose].filter(Boolean).join("\n\n")
|
|
95
|
+
: prose || null;
|
|
96
|
+
return resolveSystemPrompt(ctx.workspace, {
|
|
97
|
+
platformBackendPath: machine ? workflowPaths(options.workflow).platformPrompt : null,
|
|
98
|
+
workflowPrompt,
|
|
99
|
+
mountPrefixes: ctx.mountPrefixes,
|
|
100
|
+
extra: ctx.params.systemPrompt,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The models one governed composition runs on: the workflow's own (its
|
|
105
|
+
* `settings.model`, else the assembly default) and, per state, whatever that
|
|
106
|
+
* state declares. Resolved here, once per composition, so a configuration
|
|
107
|
+
* problem surfaces at assembly rather than mid-session and the per-call path is
|
|
108
|
+
* a map lookup.
|
|
109
|
+
*
|
|
110
|
+
* The cache strategy travels with the model, because that is what it is a
|
|
111
|
+
* property of: a state running on Claude behind an OpenAI-compatible endpoint
|
|
112
|
+
* needs the explicit breakpoint whatever the workflow's own model is.
|
|
113
|
+
*/
|
|
114
|
+
function resolveStateModels(ctx, machine, workflow, cacheEnabled) {
|
|
115
|
+
const { emit } = ctx;
|
|
116
|
+
const declared = machine.declaredModels();
|
|
117
|
+
const warn = (message) => emit({ type: "warning", scope: "workflow", message });
|
|
118
|
+
// An explicit `model` instance outranks every declared id (see `createAgent`).
|
|
119
|
+
// Reported once per composition, naming every position it makes inert, so a
|
|
120
|
+
// host learns that `modelFactory` is what honours a declaration.
|
|
121
|
+
if (!ctx.honoursDeclaredModels && declared.length > 0) {
|
|
122
|
+
warn(`Workflow '${workflow}' declares ${describeDeclaredModels(machine)}, but an explicit ` +
|
|
123
|
+
`'model' was passed to createAgent, which outranks a declared id: every state runs on ` +
|
|
124
|
+
`the supplied model. Pass 'modelFactory' instead — it is called for the 'agent' role ` +
|
|
125
|
+
`with the declared id as 'requested'.`);
|
|
126
|
+
}
|
|
127
|
+
// The id of a model, read from the instance so every route to one answers the
|
|
128
|
+
// same way — a declared id, `ARCHMAX_MODEL`, an explicit `model`, a
|
|
129
|
+
// `modelFactory`. Memoized per instance beside the cache strategy, which is
|
|
130
|
+
// the other thing resolved once here rather than per call. A model exposing no
|
|
131
|
+
// id resolves to `undefined`: cost then falls back to the response's own id or
|
|
132
|
+
// is omitted, exactly as before.
|
|
133
|
+
const ids = new Map();
|
|
134
|
+
const idOf = (model) => {
|
|
135
|
+
if (!ids.has(model))
|
|
136
|
+
ids.set(model, modelIdOf(model) || undefined);
|
|
137
|
+
return ids.get(model);
|
|
138
|
+
};
|
|
139
|
+
const strategies = new Map();
|
|
140
|
+
const strategyOf = (model) => {
|
|
141
|
+
let strategy = strategies.get(model);
|
|
142
|
+
if (strategy === undefined) {
|
|
143
|
+
strategy = resolveCacheStrategy(model, cacheEnabled);
|
|
144
|
+
// Reported per distinct model: a workflow mixing ids can have one model
|
|
145
|
+
// with no mechanism and another with one.
|
|
146
|
+
if (strategy === "unsupported")
|
|
147
|
+
warn(unsupportedCacheMessage(model));
|
|
148
|
+
strategies.set(model, strategy);
|
|
149
|
+
}
|
|
150
|
+
return strategy;
|
|
151
|
+
};
|
|
152
|
+
const workflowModel = ctx.agentModel(machine.spec.settings?.model);
|
|
153
|
+
const workflowCacheStrategy = strategyOf(workflowModel);
|
|
154
|
+
// Built here, not per call: one model per distinct id, and an id the endpoint
|
|
155
|
+
// cannot serve fails while assembling rather than in the middle of a session.
|
|
156
|
+
const byState = new Map();
|
|
157
|
+
for (const state of Object.keys(machine.spec.states)) {
|
|
158
|
+
const id = machine.modelFor(state);
|
|
159
|
+
if (id === undefined || id === machine.spec.settings?.model)
|
|
160
|
+
continue;
|
|
161
|
+
byState.set(state, ctx.agentModel(id));
|
|
162
|
+
}
|
|
163
|
+
// LangChain's native caching middlewares are graph-level and cannot vary per
|
|
164
|
+
// call, so they stay wired from the workflow's model; a state whose model
|
|
165
|
+
// wants a different native mechanism is named rather than silently mis-cached.
|
|
166
|
+
for (const [state, model] of byState) {
|
|
167
|
+
const strategy = strategyOf(model);
|
|
168
|
+
if (!NATIVE_CACHE_STRATEGIES.has(strategy) && !NATIVE_CACHE_STRATEGIES.has(workflowCacheStrategy)) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (strategy === workflowCacheStrategy)
|
|
172
|
+
continue;
|
|
173
|
+
warn(`State '${state}' of workflow '${workflow}' runs on a model whose prompt-cache mechanism ` +
|
|
174
|
+
`('${strategy}') differs from the workflow model's ('${workflowCacheStrategy}'). ` +
|
|
175
|
+
`Provider-native caching is graph-level and stays wired from the workflow model, so ` +
|
|
176
|
+
`this state's calls are cached as '${workflowCacheStrategy}' allows.`);
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
workflowModel,
|
|
180
|
+
workflowCacheStrategy,
|
|
181
|
+
stateModels: {
|
|
182
|
+
modelFor: (state) => byState.get(state),
|
|
183
|
+
cacheStrategyFor: (state) => {
|
|
184
|
+
const model = byState.get(state);
|
|
185
|
+
return model ? strategyOf(model) : workflowCacheStrategy;
|
|
186
|
+
},
|
|
187
|
+
idFor: (state) => idOf(byState.get(state) ?? workflowModel),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** The declared model positions, as a diagnostic names them. */
|
|
192
|
+
function describeDeclaredModels(machine) {
|
|
193
|
+
const positions = [];
|
|
194
|
+
if (machine.spec.settings?.model)
|
|
195
|
+
positions.push(`settings.model '${machine.spec.settings.model}'`);
|
|
196
|
+
for (const [state, declaration] of Object.entries(machine.spec.states)) {
|
|
197
|
+
if (declaration?.model)
|
|
198
|
+
positions.push(`states.${state}.model '${declaration.model}'`);
|
|
199
|
+
}
|
|
200
|
+
return positions.join(", ");
|
|
201
|
+
}
|
|
202
|
+
/** Compose one governed agent for `input.machine`. */
|
|
203
|
+
export async function composeGoverned(ctx, input) {
|
|
204
|
+
const { params, emit, workspace, authoring } = ctx;
|
|
205
|
+
const target = input.machine;
|
|
206
|
+
const governanceRules = [...(input.inheritedPolicyRules ?? []), ...(params.policyRules ?? [])];
|
|
207
|
+
const settings = target.harnessSettings;
|
|
208
|
+
// Two executors, one sandbox runtime: agent scripts read sources from the
|
|
209
|
+
// agent workspace, hook scripts from the authoring plane the agent cannot
|
|
210
|
+
// address. Sharing the runtime keeps a session's REPL a single session.
|
|
211
|
+
const sandboxRuntime = params.sandboxRuntime ?? createQuickJsSandboxRuntime();
|
|
212
|
+
const sandboxLimits = {
|
|
213
|
+
timeoutMs: settings.timeoutMs,
|
|
214
|
+
memoryLimitBytes: settings.memoryLimitBytes,
|
|
215
|
+
maxPtcCalls: settings.maxPtcCalls,
|
|
216
|
+
maxResultChars: settings.maxResultChars,
|
|
217
|
+
sandboxRuntime,
|
|
218
|
+
};
|
|
219
|
+
const sandboxVersion = ctx.runtimeContract.sandbox;
|
|
220
|
+
const executor = createScriptExecutor({ workspace, sandboxVersion, ...sandboxLimits });
|
|
221
|
+
const hookExecutor = createScriptExecutor({ workspace: authoring, sandboxVersion, ...sandboxLimits });
|
|
222
|
+
// One gateway for both programmatic-tool-call consumers — the model's own
|
|
223
|
+
// sandbox code and lifecycle hook scripts — so a script's `tools.*` call is
|
|
224
|
+
// governed and instrumented by the same kernel and event stream.
|
|
225
|
+
const ptcGateway = createPtcToolGateway({
|
|
226
|
+
machine: target,
|
|
227
|
+
policyRules: governanceRules,
|
|
228
|
+
mountPrefixes: ctx.mountPrefixes,
|
|
229
|
+
skills: ctx.skillTable,
|
|
230
|
+
emit,
|
|
231
|
+
});
|
|
232
|
+
const interpreter = createInterpreter({ executor, ptcNames: [], ptcGateway });
|
|
233
|
+
emit({ type: "interpreter-enabled" });
|
|
234
|
+
// Consumer hook executors may not shadow the built-in kinds.
|
|
235
|
+
const shadowed = Object.keys(params.hookExecutors ?? {}).filter((kind) => BUILTIN_HOOK_KINDS.includes(kind));
|
|
236
|
+
if (shadowed.length > 0) {
|
|
237
|
+
throw new Error(`hookExecutors may not override built-in hook kind(s): ${shadowed.join(", ")}. ` +
|
|
238
|
+
`Register a custom kind under a different name.`);
|
|
239
|
+
}
|
|
240
|
+
// Prompt caching: resolved from the models once, here, so an unsupported model
|
|
241
|
+
// is reported at assembly rather than discovered per call.
|
|
242
|
+
const cacheConfig = resolvePromptCacheConfig({
|
|
243
|
+
option: params.promptCache,
|
|
244
|
+
spec: settings.promptCache,
|
|
245
|
+
env: loadPromptCacheEnv(),
|
|
246
|
+
});
|
|
247
|
+
// Which model each state runs on, and therefore which cache mechanism its
|
|
248
|
+
// calls use. `workflowModel` is this machine's own — `settings.model` when it
|
|
249
|
+
// declares one — so the graph default and the native caching middleware follow
|
|
250
|
+
// the workflow rather than the process environment.
|
|
251
|
+
const { workflowModel, workflowCacheStrategy: cacheStrategy, stateModels } = resolveStateModels(ctx, target, input.workflow, cacheConfig.enabled);
|
|
252
|
+
// Conditional built-ins no state of this workflow discloses: reported so the
|
|
253
|
+
// saving is visible, and used to prune the matching upstream prompt guidance.
|
|
254
|
+
const disclosedAnywhere = new Set(Object.keys(target.spec.states).flatMap((slug) => [...target.disclosedTools(slug)]));
|
|
255
|
+
// `task` is withheld in every state of every assembly, so its upstream
|
|
256
|
+
// guidance is pruned unconditionally rather than per-assembly.
|
|
257
|
+
const withheldBuiltins = [...UNGRANTABLE_TOOLS].filter((tool) => !disclosedAnywhere.has(tool));
|
|
258
|
+
emit({ type: "prompt-shaping", cache: cacheStrategy, withheld: withheldBuiltins });
|
|
259
|
+
// One dispatcher per composition, so the depth, cycle and concurrency bounds
|
|
260
|
+
// are enforced in one place and every dispatch is reported the same way. A
|
|
261
|
+
// child of this composition inherits what it inherited plus its own policy:
|
|
262
|
+
// denials accumulate down the chain, never resetting to the root's.
|
|
263
|
+
const dispatcher = createSubWorkflowDispatcher({
|
|
264
|
+
registry: input.registry,
|
|
265
|
+
machine: target,
|
|
266
|
+
childPolicyRules: [
|
|
267
|
+
...(input.inheritedPolicyRules ?? []),
|
|
268
|
+
...workflowDenials(target, input.workflow),
|
|
269
|
+
],
|
|
270
|
+
onEvent: emit,
|
|
271
|
+
});
|
|
272
|
+
// Validate the assembly-time default trigger (fails closed on an unknown id).
|
|
273
|
+
const defaultTrigger = resolveTrigger(target, input.trigger);
|
|
274
|
+
const seededVariables = buildSeededVariables(input.variables);
|
|
275
|
+
for (const message of unguaranteedReferenceWarnings(target, seededVariables)) {
|
|
276
|
+
emit({ type: "warning", scope: "workflow", message });
|
|
277
|
+
}
|
|
278
|
+
const instrumentation = createWorkflowInstrumentation({
|
|
279
|
+
machine: target,
|
|
280
|
+
executor,
|
|
281
|
+
hookExecutor,
|
|
282
|
+
// Hook paths are workflow-relative and confined to this workflow's `hooks/`.
|
|
283
|
+
resolveHookScript: (declared) => resolveHookScript(input.workflow, declared),
|
|
284
|
+
rubrics: ctx.rubrics,
|
|
285
|
+
ptcNames: [],
|
|
286
|
+
policyRules: governanceRules,
|
|
287
|
+
mountPrefixes: ctx.mountPrefixes,
|
|
288
|
+
skills: ctx.skillRegistry,
|
|
289
|
+
ptcGateway,
|
|
290
|
+
subWorkflows: dispatcher,
|
|
291
|
+
...(params.hookExecutors ? { hookExecutors: params.hookExecutors } : {}),
|
|
292
|
+
onEvent: emit,
|
|
293
|
+
promptShaping: { cacheStrategy, cacheTtl: cacheConfig.ttl, withheldBuiltins },
|
|
294
|
+
stateModels,
|
|
295
|
+
workspace,
|
|
296
|
+
workflowName: input.workflow,
|
|
297
|
+
trigger: { id: defaultTrigger.id },
|
|
298
|
+
seededVariables,
|
|
299
|
+
...(ctx.pricing ? { pricing: ctx.pricing } : {}),
|
|
300
|
+
});
|
|
301
|
+
// Native Anthropic/Bedrock caching is LangChain's own middleware; the
|
|
302
|
+
// OpenAI-compatible Claude path is marked by the workflow instrumentation.
|
|
303
|
+
const providerCacheMiddleware = createProviderCacheMiddleware(cacheStrategy, cacheConfig.ttl);
|
|
304
|
+
// The suspension site leads: it has to be the first middleware with an
|
|
305
|
+
// `afterModel` hook, so its hook runs last after the model and the final
|
|
306
|
+
// router honours its jumps (see `WorkflowInstrumentation`).
|
|
307
|
+
const agentMiddleware = [
|
|
308
|
+
instrumentation.parkMiddleware,
|
|
309
|
+
todoMiddleware(),
|
|
310
|
+
interpreter.middleware,
|
|
311
|
+
instrumentation.middleware,
|
|
312
|
+
...(providerCacheMiddleware ? [providerCacheMiddleware] : []),
|
|
313
|
+
...(params.middleware ?? []),
|
|
314
|
+
];
|
|
315
|
+
// One tool per sibling this machine's allow lists name. A delegation tool's
|
|
316
|
+
// schema feeds the system prompt, so an unusable target fails assembly.
|
|
317
|
+
const delegationTools = [];
|
|
318
|
+
for (const slug of target.delegationTargets()) {
|
|
319
|
+
let signature;
|
|
320
|
+
try {
|
|
321
|
+
signature = await input.registry.signature(slug);
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
const raw = err instanceof SubWorkflowError ? err.message : String(err);
|
|
325
|
+
const detail = raw.replace(/^Cannot run sub-workflow '[^']*':\s*/, "");
|
|
326
|
+
throw new WorkflowLoadError(input.workflow, workflowPaths(input.workflow).workflowYaml, `it allows '${workflowToolName(slug)}', but ${detail}`);
|
|
327
|
+
}
|
|
328
|
+
// `disabled` is dropped: a description is built once at assembly, so
|
|
329
|
+
// "currently disabled" would be stale and destabilize the cacheable prefix.
|
|
330
|
+
const { disabled: _disabled, ...described } = signature;
|
|
331
|
+
delegationTools.push(createDelegationTool({ workflow: slug, ...described }, dispatcher, target.entry));
|
|
332
|
+
}
|
|
333
|
+
const deepAgent = createDeepAgent({
|
|
334
|
+
// The workflow's own model is the graph default; a state that declares its
|
|
335
|
+
// own is switched onto it per call by the governance middleware.
|
|
336
|
+
model: workflowModel,
|
|
337
|
+
backend: ctx.backend,
|
|
338
|
+
// Deliberately no `skills`: upstream's section cannot vary per state; the
|
|
339
|
+
// workflow middleware renders the active state's set instead.
|
|
340
|
+
tools: [...interpreter.tools, ...instrumentation.tools, ...delegationTools, ...(params.tools ?? [])],
|
|
341
|
+
...rubricParams(ctx),
|
|
342
|
+
middleware: agentMiddleware,
|
|
343
|
+
// the harness's prompt is the whole prefix; the upstream base prompt contradicts
|
|
344
|
+
// the platform prompt and is dropped (layer order in `core/prompt.ts`).
|
|
345
|
+
systemPrompt: { prefix: input.systemPrompt, base: null },
|
|
346
|
+
stateSchema: workflowStateSchema,
|
|
347
|
+
checkpointer: ctx.checkpointer,
|
|
348
|
+
...frameworkPassthrough(params),
|
|
349
|
+
});
|
|
350
|
+
const graph = asCompiledAgentGraph(deepAgent.graph);
|
|
351
|
+
// Assembly-time topology summary; the CLI's structured renderer ignores it.
|
|
352
|
+
emit({ type: "graph-topology", topology: describeMachineTopology(target) });
|
|
353
|
+
const driver = createTurnRunner({ graph, emit, bindSession: sessionBinder(ctx), entryState: target.entry });
|
|
354
|
+
return {
|
|
355
|
+
graph,
|
|
356
|
+
driver,
|
|
357
|
+
// Single disposal path for every per-session resource: hook and agent REPL
|
|
358
|
+
// sessions, PTC contexts and tool cache, and the dispatch ledger.
|
|
359
|
+
dispose: (sessionId) => {
|
|
360
|
+
instrumentation.dispose(sessionId);
|
|
361
|
+
interpreter.dispose(sessionId);
|
|
362
|
+
dispatcher.release(sessionId);
|
|
363
|
+
},
|
|
364
|
+
toolMocks: agentMiddleware.some((m) => m.name === TOOL_MOCK_MIDDLEWARE_NAME),
|
|
365
|
+
// Every resume — a decision, a reply, a delivery — is a turn on the session,
|
|
366
|
+
// driven through the same runner an invoke is.
|
|
367
|
+
resumable: {
|
|
368
|
+
getState: (config) => asDecisionGraph(graph).getState(config),
|
|
369
|
+
invoke: (resumeInput, config) => driver.invoke(resumeInput, mergeConfigs(AGENT_DEFAULT_CONFIG, config)),
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* One workflow's **workflow-wide** denials, as rules a descendant inherits:
|
|
375
|
+
* `tools.forbid_always`, `skills.forbid_always` and `mounts.forbid_always`,
|
|
376
|
+
* named with the workflow that declared them. A per-state `forbid` is not
|
|
377
|
+
* inherited — it governs that state's turns, not a child session — and neither
|
|
378
|
+
* is any grant.
|
|
379
|
+
*/
|
|
380
|
+
function workflowDenials(machine, source) {
|
|
381
|
+
return [
|
|
382
|
+
...compileForbidRules(machine.spec.tools?.forbid_always, { scope: "workflow", source }),
|
|
383
|
+
...compileForbiddenSkillRules(machine.spec.skills?.forbid_always ?? [], source),
|
|
384
|
+
...compileForbiddenMountRules(machine.spec.mounts?.forbid_always ?? [], source),
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
/** The denials a direct child inherits from the root machine — the chain's first link. */
|
|
388
|
+
export function inheritedDenials(ctx, root) {
|
|
389
|
+
return workflowDenials(root, ctx.workflowName);
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/assembly/compose.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAwB,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,eAAe,EAAsD,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,oBAAo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,EAAE,CAAC;QACvF,GAAG,0BAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,IAAI,EAAE,EAAE,MAAM,CAAC;QAC/E,GAAG,0BAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,IAAI,EAAE,EAAE,MAAM,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,gBAAgB,CAAC,GAAoB,EAAE,IAAqB;IAC1E,OAAO,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WorkflowMachine } from "../machine/machine.js";
|
|
2
|
+
import { type SubWorkflowRegistry } from "../workflow/sub-workflow.js";
|
|
3
|
+
import { type AssemblyContext } from "./compose.js";
|
|
4
|
+
/** Build the registry the root composition and every child dispatch through. */
|
|
5
|
+
export declare function createDelegationRegistry(ctx: AssemblyContext, root: WorkflowMachine): SubWorkflowRegistry;
|