@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,122 @@
|
|
|
1
|
+
import { INTERRUPT } from "@langchain/langgraph";
|
|
2
|
+
import { contentToString, isAiMessage } from "../core/messages.js";
|
|
3
|
+
import { currentWorkflowState } from "./state.js";
|
|
4
|
+
import { DEFAULT_SESSION_ID } from "../sessions/scope.js";
|
|
5
|
+
export function sessionIdOfConfig(config) {
|
|
6
|
+
const id = config?.configurable?.thread_id;
|
|
7
|
+
return typeof id === "string" && id ? id : DEFAULT_SESSION_ID;
|
|
8
|
+
}
|
|
9
|
+
/** Bind every step of an async iterable to the session: `next()` runs in the caller's context, so the binding is per step. */
|
|
10
|
+
async function* boundIterable(sessionId, bind, open) {
|
|
11
|
+
const iterator = (await bind(sessionId, open))[Symbol.asyncIterator]();
|
|
12
|
+
for (;;) {
|
|
13
|
+
const step = await bind(sessionId, () => iterator.next());
|
|
14
|
+
if (step.done)
|
|
15
|
+
return;
|
|
16
|
+
yield step.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function createTurnRunner(opts) {
|
|
20
|
+
const { graph, emit, bindSession } = opts;
|
|
21
|
+
/**
|
|
22
|
+
* Drive one turn via LangGraph streaming (`["values", "messages"]`): each AI
|
|
23
|
+
* chunk with text is an `agent-text-delta` attributed to the current state (a
|
|
24
|
+
* non-streaming model yields one chunk, so deltas flow regardless); the result
|
|
25
|
+
* is the last `values` chunk. A turn that fails mid-stream finalizes the text
|
|
26
|
+
* streamed so far as `agent-text` events flagged `partial`, since the
|
|
27
|
+
* governance hooks that emit the final `agent-text` never ran for it.
|
|
28
|
+
*/
|
|
29
|
+
async function drive(input, config) {
|
|
30
|
+
const stream = await graph.stream(input, {
|
|
31
|
+
...(config ?? {}),
|
|
32
|
+
streamMode: ["values", "messages"],
|
|
33
|
+
});
|
|
34
|
+
let state = opts.entryState;
|
|
35
|
+
const streamedText = new Map();
|
|
36
|
+
let result;
|
|
37
|
+
// A parked turn ends with an interrupt chunk; reported the way `Pregel.invoke`
|
|
38
|
+
// does — the last state with the interrupts under `__interrupt__`.
|
|
39
|
+
const interrupts = [];
|
|
40
|
+
try {
|
|
41
|
+
for await (const item of stream) {
|
|
42
|
+
const [mode, payload] = item;
|
|
43
|
+
if (mode === "messages") {
|
|
44
|
+
const [chunk] = payload;
|
|
45
|
+
if (!isAiMessage(chunk))
|
|
46
|
+
continue;
|
|
47
|
+
const msg = chunk;
|
|
48
|
+
const text = contentToString(msg.content);
|
|
49
|
+
if (!text)
|
|
50
|
+
continue;
|
|
51
|
+
const id = typeof msg.id === "string" && msg.id ? msg.id : undefined;
|
|
52
|
+
const bucket = streamedText.get(id ?? "");
|
|
53
|
+
if (bucket)
|
|
54
|
+
bucket.text += text;
|
|
55
|
+
else
|
|
56
|
+
streamedText.set(id ?? "", { text, ...(id ? { messageId: id } : {}) });
|
|
57
|
+
emit({ type: "agent-text-delta", state, text, ...(id ? { messageId: id } : {}) });
|
|
58
|
+
}
|
|
59
|
+
else if (mode === "values") {
|
|
60
|
+
const values = payload;
|
|
61
|
+
const interrupted = values[INTERRUPT];
|
|
62
|
+
if (Array.isArray(interrupted)) {
|
|
63
|
+
interrupts.push(...interrupted);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
result = values;
|
|
67
|
+
state = currentWorkflowState(result, state);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (result === undefined) {
|
|
71
|
+
if (interrupts.length > 0)
|
|
72
|
+
return { [INTERRUPT]: interrupts };
|
|
73
|
+
throw new Error("the turn's stream ended without a final state");
|
|
74
|
+
}
|
|
75
|
+
return interrupts.length > 0 ? { ...result, [INTERRUPT]: interrupts } : result;
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
// The one `agent-text` that may carry no id: nothing was committed.
|
|
79
|
+
for (const { text, messageId } of streamedText.values()) {
|
|
80
|
+
emit({ type: "agent-text", state, text, partial: true, ...(messageId ? { messageId } : {}) });
|
|
81
|
+
}
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
// `async`, so a refused session id is a rejection like every other failure of
|
|
87
|
+
// the call, never a synchronous throw out of `invoke`.
|
|
88
|
+
async invoke(input, config) {
|
|
89
|
+
return bindSession(sessionIdOfConfig(config), () => drive(input, config));
|
|
90
|
+
},
|
|
91
|
+
stream(input, config) {
|
|
92
|
+
return boundIterable(sessionIdOfConfig(config), bindSession, () => graph.stream(input, config));
|
|
93
|
+
},
|
|
94
|
+
streamEvents(input, config, options) {
|
|
95
|
+
return boundIterable(sessionIdOfConfig(config), bindSession, async () => graph.streamEvents(input, config, options));
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The runner a **plain** (ungoverned) agent drives its graph through: the graph's
|
|
101
|
+
* own `invoke`/`stream`/`streamEvents`, each bound to the session named by
|
|
102
|
+
* `configurable.thread_id`. No machine means no state to attribute text deltas
|
|
103
|
+
* to and no park to settle, so nothing here reshapes the graph's results; what
|
|
104
|
+
* the binding buys is that the agent's `scratchpad/…` and offload paths land
|
|
105
|
+
* under `<sessionId>/` in the session store exactly as a governed session's do,
|
|
106
|
+
* and that a reserved or escaping id is refused before anything is written.
|
|
107
|
+
*/
|
|
108
|
+
export function createPlainTurnRunner(opts) {
|
|
109
|
+
const { graph, bindSession } = opts;
|
|
110
|
+
return {
|
|
111
|
+
async invoke(input, config) {
|
|
112
|
+
return bindSession(sessionIdOfConfig(config), () => graph.invoke(input, config));
|
|
113
|
+
},
|
|
114
|
+
stream(input, config) {
|
|
115
|
+
return boundIterable(sessionIdOfConfig(config), bindSession, () => graph.stream(input, config));
|
|
116
|
+
},
|
|
117
|
+
streamEvents(input, config, options) {
|
|
118
|
+
return boundIterable(sessionIdOfConfig(config), bindSession, async () => graph.streamEvents(input, config, options));
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=turn-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-runner.js","sourceRoot":"","sources":["../../src/workflow/turn-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM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E,MAAM,EAAE,OAAO,CAAC,CACpD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation tools: one per sibling workflow a machine is permitted to call. A
|
|
3
|
+
* workflow's declared signature is its call signature: the `sub-workflow`
|
|
4
|
+
* trigger's `requires:` becomes the tool's parameters and `returns:` the shape
|
|
5
|
+
* of the result, so delegating is an ordinary governed tool call.
|
|
6
|
+
*
|
|
7
|
+
* Unlike the other `archmax_*` tools, the body is real: a delegation tool is the
|
|
8
|
+
* only runtime tool a script may call through the PTC gateway (which runs the
|
|
9
|
+
* kernel verdict by name before the body). One call starts one sub-run; fan-out
|
|
10
|
+
* is parallel tool calls or a script's `Promise.all`, bounded by the dispatcher.
|
|
11
|
+
*/
|
|
12
|
+
import type { StructuredTool } from "@langchain/core/tools";
|
|
13
|
+
import type { SubWorkflowDispatcher, SubWorkflowResult } from "./sub-workflow.js";
|
|
14
|
+
/** What a target declares about itself, as the tool needs to render and enforce it. */
|
|
15
|
+
export interface DelegationTarget {
|
|
16
|
+
/** The `workflows/<slug>/` directory name — the tool's identity. */
|
|
17
|
+
workflow: string;
|
|
18
|
+
/** The target's human label; prose for the description only. */
|
|
19
|
+
title?: string;
|
|
20
|
+
/** Run variables a dispatch must supply. */
|
|
21
|
+
requires?: string[];
|
|
22
|
+
/** Run variables the target guarantees on completion. */
|
|
23
|
+
returns?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The model-facing description, built from the target's own spec: what the
|
|
27
|
+
* runtime enforces and no more. The target's `instructions` are absent — that is
|
|
28
|
+
* the child's brief, and the caller's agent must not act on it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function delegationToolDescription(target: DelegationTarget): string;
|
|
31
|
+
/** The JSON Schema for a call: the target's `requires`, and nothing else named. */
|
|
32
|
+
export declare function delegationToolSchema(target: DelegationTarget): Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* How a completed sub-run is handed to its caller: the declared returns and the
|
|
35
|
+
* closing message as two channels (values read by name, prose read by the
|
|
36
|
+
* model), or the message alone for an unsigned target.
|
|
37
|
+
*/
|
|
38
|
+
export declare function delegationCallResult(result: SubWorkflowResult): string | {
|
|
39
|
+
message: string;
|
|
40
|
+
returns: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Build the callable tool for one target. A call's arguments are values the
|
|
44
|
+
* caller already produced, so nothing is resolved against the run's variables.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createDelegationTool(target: DelegationTarget, dispatcher: SubWorkflowDispatcher, entryState: string): StructuredTool;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation tools: one per sibling workflow a machine is permitted to call. A
|
|
3
|
+
* workflow's declared signature is its call signature: the `sub-workflow`
|
|
4
|
+
* trigger's `requires:` becomes the tool's parameters and `returns:` the shape
|
|
5
|
+
* of the result, so delegating is an ordinary governed tool call.
|
|
6
|
+
*
|
|
7
|
+
* Unlike the other `archmax_*` tools, the body is real: a delegation tool is the
|
|
8
|
+
* only runtime tool a script may call through the PTC gateway (which runs the
|
|
9
|
+
* kernel verdict by name before the body). One call starts one sub-run; fan-out
|
|
10
|
+
* is parallel tool calls or a script's `Promise.all`, bounded by the dispatcher.
|
|
11
|
+
*/
|
|
12
|
+
import { tool } from "langchain";
|
|
13
|
+
import { workflowToolName } from "../machine/tool-names.js";
|
|
14
|
+
import { callingStateFrom } from "../sessions/scope.js";
|
|
15
|
+
/**
|
|
16
|
+
* The model-facing description, built from the target's own spec: what the
|
|
17
|
+
* runtime enforces and no more. The target's `instructions` are absent — that is
|
|
18
|
+
* the child's brief, and the caller's agent must not act on it.
|
|
19
|
+
*/
|
|
20
|
+
export function delegationToolDescription(target) {
|
|
21
|
+
const parts = [];
|
|
22
|
+
const label = target.title?.trim();
|
|
23
|
+
parts.push(`Run the '${target.workflow}' workflow${label ? ` (${label})` : ""} to completion and ` +
|
|
24
|
+
`return its result. It runs as its own governed machine with its own states and tools; ` +
|
|
25
|
+
`your run stays where it is and continues when the call answers.`);
|
|
26
|
+
if (target.requires?.length) {
|
|
27
|
+
parts.push(`It requires ${quoteList(target.requires)}, which the call must supply.`);
|
|
28
|
+
}
|
|
29
|
+
parts.push(target.returns?.length
|
|
30
|
+
? `The result carries ${quoteList(target.returns)} under 'returns', alongside the ` +
|
|
31
|
+
`workflow's closing message under 'message'.`
|
|
32
|
+
: `The result is the workflow's closing message.`);
|
|
33
|
+
parts.push(`One call runs it once; call it again (in the same turn) to run several at once.`);
|
|
34
|
+
return parts.join(" ");
|
|
35
|
+
}
|
|
36
|
+
/** The JSON Schema for a call: the target's `requires`, and nothing else named. */
|
|
37
|
+
export function delegationToolSchema(target) {
|
|
38
|
+
const required = target.requires ?? [];
|
|
39
|
+
return {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: Object.fromEntries(required.map((name) => [
|
|
42
|
+
name,
|
|
43
|
+
{ description: `Required input '${name}', seeded as a locked run variable.` },
|
|
44
|
+
])),
|
|
45
|
+
required: [...required],
|
|
46
|
+
// Open: `requires` states only what is mandatory, and nothing declares the full accepted set.
|
|
47
|
+
additionalProperties: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* How a completed sub-run is handed to its caller: the declared returns and the
|
|
52
|
+
* closing message as two channels (values read by name, prose read by the
|
|
53
|
+
* model), or the message alone for an unsigned target.
|
|
54
|
+
*/
|
|
55
|
+
export function delegationCallResult(result) {
|
|
56
|
+
return result.returns ? { message: result.result, returns: result.returns } : result.result;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build the callable tool for one target. A call's arguments are values the
|
|
60
|
+
* caller already produced, so nothing is resolved against the run's variables.
|
|
61
|
+
*/
|
|
62
|
+
export function createDelegationTool(target, dispatcher, entryState) {
|
|
63
|
+
return tool(async (input, runtimeConfig) => {
|
|
64
|
+
const result = await dispatcher.dispatch({
|
|
65
|
+
workflow: target.workflow,
|
|
66
|
+
...(Object.keys(input ?? {}).length ? { params: input } : {}),
|
|
67
|
+
variables: {},
|
|
68
|
+
config: runtimeConfig,
|
|
69
|
+
state: callingStateFrom(runtimeConfig) ?? entryState,
|
|
70
|
+
...(callIdOf(runtimeConfig) ? { toolCallId: callIdOf(runtimeConfig) } : {}),
|
|
71
|
+
});
|
|
72
|
+
return delegationCallResult(result);
|
|
73
|
+
}, {
|
|
74
|
+
name: workflowToolName(target.workflow),
|
|
75
|
+
description: delegationToolDescription(target),
|
|
76
|
+
schema: delegationToolSchema(target),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/** The id of the tool call being serviced; absent when a script invokes the tool through the PTC bridge. */
|
|
80
|
+
function callIdOf(runtime) {
|
|
81
|
+
const id = runtime?.toolCallId;
|
|
82
|
+
return typeof id === "string" && id ? id : undefined;
|
|
83
|
+
}
|
|
84
|
+
function quoteList(names) {
|
|
85
|
+
const quoted = names.map((n) => `'${n}'`);
|
|
86
|
+
if (quoted.length <= 1)
|
|
87
|
+
return quoted.join("");
|
|
88
|
+
return `${quoted.slice(0, -1).join(", ")} and ${quoted[quoted.length - 1]}`;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=workflow-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-tools.js","sourceRoot":"","sources":["../../src/workflow/workflow-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAexD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAwB;IAChE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EA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,CAAC,KAAe;IAChC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@archmax-ai/harness",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "archmax harness - a generic, backend-driven agent runtime built on LangChain Deep Agents, governed by a declarative workflow machine.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"agent",
|
|
8
|
+
"agents",
|
|
9
|
+
"ai",
|
|
10
|
+
"langchain",
|
|
11
|
+
"deepagents",
|
|
12
|
+
"llm",
|
|
13
|
+
"state-machine",
|
|
14
|
+
"workflow",
|
|
15
|
+
"governance",
|
|
16
|
+
"guardrails",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://archmax-ai.github.io/harness",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/archmax-ai/harness.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/archmax-ai/harness/issues"
|
|
26
|
+
},
|
|
27
|
+
"author": "Archmax AI",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22"
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"module": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./sandbox": {
|
|
41
|
+
"types": "./dist/public/sandbox.d.ts",
|
|
42
|
+
"import": "./dist/public/sandbox.js"
|
|
43
|
+
},
|
|
44
|
+
"./testing": {
|
|
45
|
+
"types": "./dist/public/testing.d.ts",
|
|
46
|
+
"import": "./dist/public/testing.js"
|
|
47
|
+
},
|
|
48
|
+
"./cli": {
|
|
49
|
+
"types": "./dist/public/cli.d.ts",
|
|
50
|
+
"import": "./dist/public/cli.js"
|
|
51
|
+
},
|
|
52
|
+
"./spec": {
|
|
53
|
+
"types": "./dist/public/spec.d.ts",
|
|
54
|
+
"import": "./dist/public/spec.js"
|
|
55
|
+
},
|
|
56
|
+
"./messages": {
|
|
57
|
+
"types": "./dist/public/messages.d.ts",
|
|
58
|
+
"import": "./dist/public/messages.js"
|
|
59
|
+
},
|
|
60
|
+
"./package.json": "./package.json"
|
|
61
|
+
},
|
|
62
|
+
"bin": {
|
|
63
|
+
"archmax": "./dist/cli.js"
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"dist",
|
|
67
|
+
"README.md",
|
|
68
|
+
"LICENSE"
|
|
69
|
+
],
|
|
70
|
+
"scripts": {
|
|
71
|
+
"dev": "tsx src/cli.ts",
|
|
72
|
+
"start": "node dist/cli.js",
|
|
73
|
+
"clean": "rm -rf dist",
|
|
74
|
+
"build": "npm run clean && npm run generate:prompt && tsc -p tsconfig.build.json && npm run copy:assets && chmod +x dist/cli.js",
|
|
75
|
+
"generate:prompt": "node scripts/generate-platform-prompt.mjs",
|
|
76
|
+
"copy:assets": "mkdir -p dist/sandbox/assets && cp -R src/sandbox/assets/parts dist/sandbox/assets/parts && mkdir -p dist/authoring-skill && cp -R skills/archmax-harness dist/authoring-skill/archmax-harness",
|
|
77
|
+
"check:no-secrets": "test -z \"$(find dist -type f -name '.env*' ! -name '.env.example')\" || { echo 'refusing to pack: dist contains an .env file' >&2; exit 1; }",
|
|
78
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
79
|
+
"lint": "eslint .",
|
|
80
|
+
"lint:fix": "eslint . --fix",
|
|
81
|
+
"format": "prettier --write .",
|
|
82
|
+
"format:check": "prettier --check .",
|
|
83
|
+
"test": "vitest run",
|
|
84
|
+
"test:watch": "vitest",
|
|
85
|
+
"docs:dev": "npm --prefix docs run dev",
|
|
86
|
+
"docs:build": "npm --prefix docs run build",
|
|
87
|
+
"hooks:install": "git config core.hooksPath .githooks",
|
|
88
|
+
"prepare": "git config core.hooksPath .githooks || true",
|
|
89
|
+
"prepack": "npm run check:no-secrets",
|
|
90
|
+
"prepublishOnly": "npm run build"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@langchain/core": "^1.2.11",
|
|
94
|
+
"@langchain/langgraph": "^1.4.15",
|
|
95
|
+
"@langchain/langgraph-checkpoint": "^1.1.3",
|
|
96
|
+
"@langchain/openai": "^1.5.13",
|
|
97
|
+
"@langchain/quickjs": "^0.6.3",
|
|
98
|
+
"deepagents": "^1.11.1",
|
|
99
|
+
"dotenv": "^17.4.2",
|
|
100
|
+
"gray-matter": "^4.0.3",
|
|
101
|
+
"just-bash": "^3.4.2",
|
|
102
|
+
"langchain": "^1.5.4",
|
|
103
|
+
"picomatch": "^4.0.7",
|
|
104
|
+
"yaml": "^2.9.1",
|
|
105
|
+
"zod": "^4.6.4"
|
|
106
|
+
},
|
|
107
|
+
"devDependencies": {
|
|
108
|
+
"@eslint/js": "^10.0.1",
|
|
109
|
+
"@types/node": "^26.5.1",
|
|
110
|
+
"@types/picomatch": "^4.0.3",
|
|
111
|
+
"eslint": "^10.10.0",
|
|
112
|
+
"eslint-config-prettier": "^10.1.8",
|
|
113
|
+
"prettier": "^3.9.6",
|
|
114
|
+
"tsx": "^4.23.13",
|
|
115
|
+
"typescript": "^6.0.3",
|
|
116
|
+
"typescript-eslint": "^8.70.0",
|
|
117
|
+
"vitest": "^5.0.0"
|
|
118
|
+
}
|
|
119
|
+
}
|