@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.
Files changed (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +219 -0
  3. package/dist/agent.d.ts +174 -0
  4. package/dist/agent.js +140 -0
  5. package/dist/agent.js.map +1 -0
  6. package/dist/assembly/compose.d.ts +170 -0
  7. package/dist/assembly/compose.js +391 -0
  8. package/dist/assembly/compose.js.map +1 -0
  9. package/dist/assembly/delegation-registry.d.ts +5 -0
  10. package/dist/assembly/delegation-registry.js +118 -0
  11. package/dist/assembly/delegation-registry.js.map +1 -0
  12. package/dist/assembly/index.d.ts +192 -0
  13. package/dist/assembly/index.js +265 -0
  14. package/dist/assembly/index.js.map +1 -0
  15. package/dist/assembly/plain.d.ts +7 -0
  16. package/dist/assembly/plain.js +41 -0
  17. package/dist/assembly/plain.js.map +1 -0
  18. package/dist/authoring-skill/archmax-harness/README.md +76 -0
  19. package/dist/authoring-skill/archmax-harness/SKILL.md +241 -0
  20. package/dist/authoring-skill/archmax-harness/references/backend-integration.md +626 -0
  21. package/dist/authoring-skill/archmax-harness/references/cases.md +41 -0
  22. package/dist/authoring-skill/archmax-harness/references/diagnostics.md +51 -0
  23. package/dist/authoring-skill/archmax-harness/references/hook-and-test-scripts.md +1070 -0
  24. package/dist/authoring-skill/archmax-harness/references/hooks-and-scripts.md +82 -0
  25. package/dist/authoring-skill/archmax-harness/references/wiring.md +101 -0
  26. package/dist/authoring-skill/archmax-harness/references/workflow-schema.md +1631 -0
  27. package/dist/authoring-skill/archmax-harness/references/workflow-yaml.md +241 -0
  28. package/dist/behaviour/support.d.ts +232 -0
  29. package/dist/behaviour/support.js +339 -0
  30. package/dist/behaviour/support.js.map +1 -0
  31. package/dist/cli/banner.d.ts +11 -0
  32. package/dist/cli/banner.js +29 -0
  33. package/dist/cli/banner.js.map +1 -0
  34. package/dist/cli/bootstrap.d.ts +33 -0
  35. package/dist/cli/bootstrap.js +153 -0
  36. package/dist/cli/bootstrap.js.map +1 -0
  37. package/dist/cli/command.d.ts +39 -0
  38. package/dist/cli/command.js +97 -0
  39. package/dist/cli/command.js.map +1 -0
  40. package/dist/cli/state-flow.d.ts +46 -0
  41. package/dist/cli/state-flow.js +268 -0
  42. package/dist/cli/state-flow.js.map +1 -0
  43. package/dist/cli/style.d.ts +41 -0
  44. package/dist/cli/style.js +64 -0
  45. package/dist/cli/style.js.map +1 -0
  46. package/dist/cli/turn.d.ts +41 -0
  47. package/dist/cli/turn.js +161 -0
  48. package/dist/cli/turn.js.map +1 -0
  49. package/dist/cli.d.ts +10 -0
  50. package/dist/cli.js +426 -0
  51. package/dist/cli.js.map +1 -0
  52. package/dist/core/code-description.d.ts +22 -0
  53. package/dist/core/code-description.js +38 -0
  54. package/dist/core/code-description.js.map +1 -0
  55. package/dist/core/deepagents.d.ts +183 -0
  56. package/dist/core/deepagents.js +128 -0
  57. package/dist/core/deepagents.js.map +1 -0
  58. package/dist/core/events.d.ts +350 -0
  59. package/dist/core/events.js +205 -0
  60. package/dist/core/events.js.map +1 -0
  61. package/dist/core/frontmatter.d.ts +15 -0
  62. package/dist/core/frontmatter.js +32 -0
  63. package/dist/core/frontmatter.js.map +1 -0
  64. package/dist/core/listing-redact.d.ts +37 -0
  65. package/dist/core/listing-redact.js +88 -0
  66. package/dist/core/listing-redact.js.map +1 -0
  67. package/dist/core/match.d.ts +26 -0
  68. package/dist/core/match.js +75 -0
  69. package/dist/core/match.js.map +1 -0
  70. package/dist/core/message-readers.d.ts +84 -0
  71. package/dist/core/message-readers.js +159 -0
  72. package/dist/core/message-readers.js.map +1 -0
  73. package/dist/core/messages.d.ts +49 -0
  74. package/dist/core/messages.js +85 -0
  75. package/dist/core/messages.js.map +1 -0
  76. package/dist/core/mount-prompt.d.ts +28 -0
  77. package/dist/core/mount-prompt.js +55 -0
  78. package/dist/core/mount-prompt.js.map +1 -0
  79. package/dist/core/mount-redact.d.ts +28 -0
  80. package/dist/core/mount-redact.js +32 -0
  81. package/dist/core/mount-redact.js.map +1 -0
  82. package/dist/core/mounts.d.ts +88 -0
  83. package/dist/core/mounts.js +147 -0
  84. package/dist/core/mounts.js.map +1 -0
  85. package/dist/core/path-mapping.d.ts +52 -0
  86. package/dist/core/path-mapping.js +113 -0
  87. package/dist/core/path-mapping.js.map +1 -0
  88. package/dist/core/platform-prompt.generated.d.ts +2 -0
  89. package/dist/core/platform-prompt.generated.js +4 -0
  90. package/dist/core/platform-prompt.generated.js.map +1 -0
  91. package/dist/core/prompt.d.ts +42 -0
  92. package/dist/core/prompt.js +75 -0
  93. package/dist/core/prompt.js.map +1 -0
  94. package/dist/core/session-id.d.ts +38 -0
  95. package/dist/core/session-id.js +61 -0
  96. package/dist/core/session-id.js.map +1 -0
  97. package/dist/core/session-store.d.ts +85 -0
  98. package/dist/core/session-store.js +149 -0
  99. package/dist/core/session-store.js.map +1 -0
  100. package/dist/core/session-zone.d.ts +54 -0
  101. package/dist/core/session-zone.js +82 -0
  102. package/dist/core/session-zone.js.map +1 -0
  103. package/dist/core/skill-prompt.d.ts +31 -0
  104. package/dist/core/skill-prompt.js +54 -0
  105. package/dist/core/skill-prompt.js.map +1 -0
  106. package/dist/core/skill-redact.d.ts +15 -0
  107. package/dist/core/skill-redact.js +27 -0
  108. package/dist/core/skill-redact.js.map +1 -0
  109. package/dist/core/skills.d.ts +172 -0
  110. package/dist/core/skills.js +214 -0
  111. package/dist/core/skills.js.map +1 -0
  112. package/dist/core/tool-mocks.d.ts +23 -0
  113. package/dist/core/tool-mocks.js +39 -0
  114. package/dist/core/tool-mocks.js.map +1 -0
  115. package/dist/core/tool-telemetry.d.ts +16 -0
  116. package/dist/core/tool-telemetry.js +40 -0
  117. package/dist/core/tool-telemetry.js.map +1 -0
  118. package/dist/core/usage.d.ts +114 -0
  119. package/dist/core/usage.js +226 -0
  120. package/dist/core/usage.js.map +1 -0
  121. package/dist/core/workspace-context.d.ts +136 -0
  122. package/dist/core/workspace-context.js +178 -0
  123. package/dist/core/workspace-context.js.map +1 -0
  124. package/dist/core/workspace-prompt.d.ts +7 -0
  125. package/dist/core/workspace-prompt.js +102 -0
  126. package/dist/core/workspace-prompt.js.map +1 -0
  127. package/dist/core/workspace-router.d.ts +61 -0
  128. package/dist/core/workspace-router.js +145 -0
  129. package/dist/core/workspace-router.js.map +1 -0
  130. package/dist/core/workspace.d.ts +85 -0
  131. package/dist/core/workspace.js +193 -0
  132. package/dist/core/workspace.js.map +1 -0
  133. package/dist/core/zones.d.ts +181 -0
  134. package/dist/core/zones.js +202 -0
  135. package/dist/core/zones.js.map +1 -0
  136. package/dist/env.d.ts +99 -0
  137. package/dist/env.js +271 -0
  138. package/dist/env.js.map +1 -0
  139. package/dist/index.d.ts +265 -0
  140. package/dist/index.js +197 -0
  141. package/dist/index.js.map +1 -0
  142. package/dist/kernel/kernel.d.ts +192 -0
  143. package/dist/kernel/kernel.js +751 -0
  144. package/dist/kernel/kernel.js.map +1 -0
  145. package/dist/lifecycle/hook-shape.d.ts +44 -0
  146. package/dist/lifecycle/hook-shape.js +66 -0
  147. package/dist/lifecycle/hook-shape.js.map +1 -0
  148. package/dist/lifecycle/runner.d.ts +177 -0
  149. package/dist/lifecycle/runner.js +372 -0
  150. package/dist/lifecycle/runner.js.map +1 -0
  151. package/dist/lifecycle/transcript.d.ts +27 -0
  152. package/dist/lifecycle/transcript.js +43 -0
  153. package/dist/lifecycle/transcript.js.map +1 -0
  154. package/dist/machine/allow.d.ts +65 -0
  155. package/dist/machine/allow.js +107 -0
  156. package/dist/machine/allow.js.map +1 -0
  157. package/dist/machine/delegation.d.ts +9 -0
  158. package/dist/machine/delegation.js +10 -0
  159. package/dist/machine/delegation.js.map +1 -0
  160. package/dist/machine/diagnostic.d.ts +14 -0
  161. package/dist/machine/diagnostic.js +2 -0
  162. package/dist/machine/diagnostic.js.map +1 -0
  163. package/dist/machine/lint-spec.d.ts +4 -0
  164. package/dist/machine/lint-spec.js +266 -0
  165. package/dist/machine/lint-spec.js.map +1 -0
  166. package/dist/machine/load-spec.d.ts +90 -0
  167. package/dist/machine/load-spec.js +120 -0
  168. package/dist/machine/load-spec.js.map +1 -0
  169. package/dist/machine/machine.d.ts +273 -0
  170. package/dist/machine/machine.js +551 -0
  171. package/dist/machine/machine.js.map +1 -0
  172. package/dist/machine/mount-grants.d.ts +25 -0
  173. package/dist/machine/mount-grants.js +24 -0
  174. package/dist/machine/mount-grants.js.map +1 -0
  175. package/dist/machine/slug.d.ts +14 -0
  176. package/dist/machine/slug.js +17 -0
  177. package/dist/machine/slug.js.map +1 -0
  178. package/dist/machine/spec-schema.d.ts +662 -0
  179. package/dist/machine/spec-schema.js +717 -0
  180. package/dist/machine/spec-schema.js.map +1 -0
  181. package/dist/machine/tool-names.d.ts +98 -0
  182. package/dist/machine/tool-names.js +144 -0
  183. package/dist/machine/tool-names.js.map +1 -0
  184. package/dist/machine/triggers.d.ts +114 -0
  185. package/dist/machine/triggers.js +165 -0
  186. package/dist/machine/triggers.js.map +1 -0
  187. package/dist/machine/types.d.ts +186 -0
  188. package/dist/machine/types.js +12 -0
  189. package/dist/machine/types.js.map +1 -0
  190. package/dist/machine/validate-spec.d.ts +42 -0
  191. package/dist/machine/validate-spec.js +29 -0
  192. package/dist/machine/validate-spec.js.map +1 -0
  193. package/dist/machine/variables.d.ts +196 -0
  194. package/dist/machine/variables.js +415 -0
  195. package/dist/machine/variables.js.map +1 -0
  196. package/dist/public/cli.d.ts +15 -0
  197. package/dist/public/cli.js +14 -0
  198. package/dist/public/cli.js.map +1 -0
  199. package/dist/public/messages.d.ts +33 -0
  200. package/dist/public/messages.js +33 -0
  201. package/dist/public/messages.js.map +1 -0
  202. package/dist/public/sandbox.d.ts +99 -0
  203. package/dist/public/sandbox.js +32 -0
  204. package/dist/public/sandbox.js.map +1 -0
  205. package/dist/public/spec.d.ts +147 -0
  206. package/dist/public/spec.js +149 -0
  207. package/dist/public/spec.js.map +1 -0
  208. package/dist/public/testing.d.ts +71 -0
  209. package/dist/public/testing.js +39 -0
  210. package/dist/public/testing.js.map +1 -0
  211. package/dist/rubrics/rubrics.d.ts +135 -0
  212. package/dist/rubrics/rubrics.js +145 -0
  213. package/dist/rubrics/rubrics.js.map +1 -0
  214. package/dist/runtime/contract.d.ts +73 -0
  215. package/dist/runtime/contract.js +96 -0
  216. package/dist/runtime/contract.js.map +1 -0
  217. package/dist/sandbox/assets/parts/core.js +22 -0
  218. package/dist/sandbox/assets/parts/lifecycle-hook.js +47 -0
  219. package/dist/sandbox/bridge.d.ts +16 -0
  220. package/dist/sandbox/bridge.js +95 -0
  221. package/dist/sandbox/bridge.js.map +1 -0
  222. package/dist/sandbox/executor.d.ts +46 -0
  223. package/dist/sandbox/executor.js +119 -0
  224. package/dist/sandbox/executor.js.map +1 -0
  225. package/dist/sandbox/imports.d.ts +33 -0
  226. package/dist/sandbox/imports.js +67 -0
  227. package/dist/sandbox/imports.js.map +1 -0
  228. package/dist/sandbox/prelude.d.ts +12 -0
  229. package/dist/sandbox/prelude.js +51 -0
  230. package/dist/sandbox/prelude.js.map +1 -0
  231. package/dist/sandbox/ptc-gateway.d.ts +104 -0
  232. package/dist/sandbox/ptc-gateway.js +167 -0
  233. package/dist/sandbox/ptc-gateway.js.map +1 -0
  234. package/dist/sandbox/runtime.d.ts +59 -0
  235. package/dist/sandbox/runtime.js +51 -0
  236. package/dist/sandbox/runtime.js.map +1 -0
  237. package/dist/sandbox/tools.d.ts +34 -0
  238. package/dist/sandbox/tools.js +147 -0
  239. package/dist/sandbox/tools.js.map +1 -0
  240. package/dist/sessions/operations.d.ts +79 -0
  241. package/dist/sessions/operations.js +121 -0
  242. package/dist/sessions/operations.js.map +1 -0
  243. package/dist/sessions/resolve.d.ts +97 -0
  244. package/dist/sessions/resolve.js +145 -0
  245. package/dist/sessions/resolve.js.map +1 -0
  246. package/dist/sessions/resume.d.ts +242 -0
  247. package/dist/sessions/resume.js +288 -0
  248. package/dist/sessions/resume.js.map +1 -0
  249. package/dist/sessions/scope.d.ts +99 -0
  250. package/dist/sessions/scope.js +145 -0
  251. package/dist/sessions/scope.js.map +1 -0
  252. package/dist/sessions/summary.d.ts +65 -0
  253. package/dist/sessions/summary.js +56 -0
  254. package/dist/sessions/summary.js.map +1 -0
  255. package/dist/testing/assertions.d.ts +30 -0
  256. package/dist/testing/assertions.js +231 -0
  257. package/dist/testing/assertions.js.map +1 -0
  258. package/dist/testing/case-document.d.ts +141 -0
  259. package/dist/testing/case-document.js +51 -0
  260. package/dist/testing/case-document.js.map +1 -0
  261. package/dist/testing/case-schema.d.ts +29 -0
  262. package/dist/testing/case-schema.js +519 -0
  263. package/dist/testing/case-schema.js.map +1 -0
  264. package/dist/testing/discovery.d.ts +10 -0
  265. package/dist/testing/discovery.js +24 -0
  266. package/dist/testing/discovery.js.map +1 -0
  267. package/dist/testing/driver.d.ts +78 -0
  268. package/dist/testing/driver.js +117 -0
  269. package/dist/testing/driver.js.map +1 -0
  270. package/dist/testing/grade.d.ts +116 -0
  271. package/dist/testing/grade.js +261 -0
  272. package/dist/testing/grade.js.map +1 -0
  273. package/dist/testing/interpreter.d.ts +55 -0
  274. package/dist/testing/interpreter.js +103 -0
  275. package/dist/testing/interpreter.js.map +1 -0
  276. package/dist/testing/mock-middleware.d.ts +5 -0
  277. package/dist/testing/mock-middleware.js +33 -0
  278. package/dist/testing/mock-middleware.js.map +1 -0
  279. package/dist/testing/runner.d.ts +205 -0
  280. package/dist/testing/runner.js +266 -0
  281. package/dist/testing/runner.js.map +1 -0
  282. package/dist/testing/target.d.ts +27 -0
  283. package/dist/testing/target.js +21 -0
  284. package/dist/testing/target.js.map +1 -0
  285. package/dist/validate/validate.d.ts +41 -0
  286. package/dist/validate/validate.js +669 -0
  287. package/dist/validate/validate.js.map +1 -0
  288. package/dist/workflow/agent-tools.d.ts +10 -0
  289. package/dist/workflow/agent-tools.js +10 -0
  290. package/dist/workflow/agent-tools.js.map +1 -0
  291. package/dist/workflow/checkpointer.d.ts +52 -0
  292. package/dist/workflow/checkpointer.js +200 -0
  293. package/dist/workflow/checkpointer.js.map +1 -0
  294. package/dist/workflow/control-tools.d.ts +174 -0
  295. package/dist/workflow/control-tools.js +468 -0
  296. package/dist/workflow/control-tools.js.map +1 -0
  297. package/dist/workflow/governance.d.ts +104 -0
  298. package/dist/workflow/governance.js +546 -0
  299. package/dist/workflow/governance.js.map +1 -0
  300. package/dist/workflow/middleware.d.ts +85 -0
  301. package/dist/workflow/middleware.js +283 -0
  302. package/dist/workflow/middleware.js.map +1 -0
  303. package/dist/workflow/on-error.d.ts +25 -0
  304. package/dist/workflow/on-error.js +58 -0
  305. package/dist/workflow/on-error.js.map +1 -0
  306. package/dist/workflow/parks.d.ts +46 -0
  307. package/dist/workflow/parks.js +513 -0
  308. package/dist/workflow/parks.js.map +1 -0
  309. package/dist/workflow/paths.d.ts +67 -0
  310. package/dist/workflow/paths.js +108 -0
  311. package/dist/workflow/paths.js.map +1 -0
  312. package/dist/workflow/prompt-cache.d.ts +70 -0
  313. package/dist/workflow/prompt-cache.js +103 -0
  314. package/dist/workflow/prompt-cache.js.map +1 -0
  315. package/dist/workflow/prompt-pruning.d.ts +20 -0
  316. package/dist/workflow/prompt-pruning.js +83 -0
  317. package/dist/workflow/prompt-pruning.js.map +1 -0
  318. package/dist/workflow/render-prompt.d.ts +45 -0
  319. package/dist/workflow/render-prompt.js +140 -0
  320. package/dist/workflow/render-prompt.js.map +1 -0
  321. package/dist/workflow/runtime-config.d.ts +7 -0
  322. package/dist/workflow/runtime-config.js +9 -0
  323. package/dist/workflow/runtime-config.js.map +1 -0
  324. package/dist/workflow/session-artifacts.d.ts +90 -0
  325. package/dist/workflow/session-artifacts.js +134 -0
  326. package/dist/workflow/session-artifacts.js.map +1 -0
  327. package/dist/workflow/session-view.d.ts +31 -0
  328. package/dist/workflow/session-view.js +94 -0
  329. package/dist/workflow/session-view.js.map +1 -0
  330. package/dist/workflow/snapshot.d.ts +14 -0
  331. package/dist/workflow/snapshot.js +97 -0
  332. package/dist/workflow/snapshot.js.map +1 -0
  333. package/dist/workflow/state.d.ts +347 -0
  334. package/dist/workflow/state.js +322 -0
  335. package/dist/workflow/state.js.map +1 -0
  336. package/dist/workflow/sub-workflow.d.ts +174 -0
  337. package/dist/workflow/sub-workflow.js +392 -0
  338. package/dist/workflow/sub-workflow.js.map +1 -0
  339. package/dist/workflow/tool-service.d.ts +48 -0
  340. package/dist/workflow/tool-service.js +291 -0
  341. package/dist/workflow/tool-service.js.map +1 -0
  342. package/dist/workflow/turn-boundary.d.ts +39 -0
  343. package/dist/workflow/turn-boundary.js +128 -0
  344. package/dist/workflow/turn-boundary.js.map +1 -0
  345. package/dist/workflow/turn-runner.d.ts +40 -0
  346. package/dist/workflow/turn-runner.js +122 -0
  347. package/dist/workflow/turn-runner.js.map +1 -0
  348. package/dist/workflow/workflow-tools.d.ts +46 -0
  349. package/dist/workflow/workflow-tools.js +90 -0
  350. package/dist/workflow/workflow-tools.js.map +1 -0
  351. package/package.json +119 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Archmax AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,219 @@
1
+ # archmax harness
2
+
3
+ **A thin, governed layer over [LangChain Deep
4
+ Agents](https://docs.langchain.com/oss/javascript/deepagents/overview). Every session runs
5
+ under a declarative workflow state machine you author in one YAML file.**
6
+
7
+ The archmax harness is Node/TypeScript and ESM. It assembles one Deep Agent per workflow, serves that agent's
8
+ workspace through a Deep Agents backend, and enforces `workflows/<slug>/workflow.yaml` with
9
+ middleware and a pure decision kernel.
10
+
11
+ The runtime holds no use-case logic. Everything specific to your agent lives as files in your
12
+ workspace: persona, states, tool permissions, hooks, skill bundles, data.
13
+
14
+ - **One file is the source of truth.** `workflow.yaml` is the enforced machine: states,
15
+ transitions, per-state tool governance, lifecycle hooks, budgets, error routing, triggers.
16
+ What the model reads is rendered from the spec, so prose cannot drift from enforcement.
17
+ - **Closed by default, including the graph.** The agent sees the active state's tool surface and
18
+ its outgoing edges. Another state's slug, instructions, transitions and even the state count
19
+ stay out of the prompt. So the cached prefix does not grow with the graph, and a prompt
20
+ injection has no map to steer with.
21
+ - **Enforced by the kernel.** The agent moves only by calling `archmax_advance`. The workflow's
22
+ and the state's `allow`/`forbid` lists cover tools, skills and mounts alike, with deny beating
23
+ allow. The kernel applies them to every call, including the calls a sandboxed script makes.
24
+ Hooks return `ok`, `correct` or `veto`, and they fail closed.
25
+ - **Human-in-the-loop, natively.** A `type: human` state parks the session on a durable
26
+ checkpoint. A person picks the outgoing transition, and the session resumes where it stopped.
27
+ - **Backend-driven and durable.** Specs, prompts, skills and sessions all flow through Deep
28
+ Agents backends: filesystem, store, or remote. Every session is a resumable, inspectable
29
+ folder in a session store you choose.
30
+
31
+ ## Why archmax harness
32
+
33
+ Reliable automation with AI agents should follow the process, and the people who own that
34
+ process should be able to author it. Today that is out of reach for most domain experts.
35
+ Current automation tools fall short in three ways.
36
+
37
+ - **The agent is a step, not the process.** The agent sits inside a fixed graph, so its
38
+ flexibility ends at the edge of one node. The process stays as rigid as the diagram someone
39
+ drew.
40
+ - **The process and its implementation drift apart.** Every business process is restated as a
41
+ technical graph. That makes two artifacts with two owners, and keeping them in step never
42
+ stops costing effort.
43
+ - **Complex data still ends up in code.** Nested payloads, loops and arithmetic land in a code
44
+ node. The person who owns the process cannot read it, let alone change it.
45
+
46
+ The archmax harness turns this around. The agent runs the whole process, and one `workflow.yaml` both
47
+ describes it and enforces it. Data work happens in a sandbox the same rules govern.
48
+
49
+ **Full documentation: <https://archmax-ai.github.io/harness/>**
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ npm install @archmax-ai/harness
55
+ ```
56
+
57
+ Node 22 or later. The model is configured through the environment, against any OpenAI-compatible
58
+ endpoint. The archmax harness reads those keys from a `.env` in the workspace root:
59
+
60
+ ```bash
61
+ ARCHMAX_API_BASE_URL=https://api.example.com/v1
62
+ ARCHMAX_API_KEY=...
63
+ ARCHMAX_MODEL=...
64
+ ```
65
+
66
+ `ARCHMAX_MODEL` is the default. A workflow names the id its states run on with `settings.model`,
67
+ and a single state overrides that with its own `model:`. Either way it is an id, resolved over
68
+ the same endpoint and credentials. So a mechanical state can run on a small model while the state
69
+ whose output a person reads runs on a capable one.
70
+
71
+ See [configuration](https://archmax-ai.github.io/harness/reference/configuration/) for
72
+ every variable.
73
+
74
+ ## Quickstart
75
+
76
+ ### A workspace
77
+
78
+ ```
79
+ my-workspace/
80
+ ├── AGENTS.md # persona
81
+ ├── workflows/order-lookup/
82
+ │ ├── workflow.yaml # the enforced state machine, and its grading rubrics
83
+ │ ├── WORKFLOW.md # optional prose addendum
84
+ │ ├── hooks/check-requester.js # lifecycle hook scripts
85
+ │ └── tests/*.test.yaml # cases for `archmax test`
86
+ ├── skills/<slug>/ # skill bundles: SKILL.md, assets/, scripts/
87
+ └── sessions/ # default session store (gitignored)
88
+ ```
89
+
90
+ ```yaml
91
+ # workflows/order-lookup/workflow.yaml (excerpt)
92
+ title: Order lookup
93
+ instructions: Only ever disclose the requester's own company's orders.
94
+ tools: { forbid_always: [archmax_reset] } # denied in every state; deny beats allow
95
+ skills: { allow_always: [order-data] } # enabled in every state; a state's own
96
+ # `skills.allow` adds, `skills.forbid` subtracts
97
+ mounts: { allow_always: [reference] } # which STATES reach a host-governed mount;
98
+ # a grant may say `access: read` or `read_write`
99
+
100
+ states:
101
+ identify-case:
102
+ triggers:
103
+ manual:
104
+ instructions: Classify the request and archmax_advance to the matching path.
105
+ before: { script: hooks/check-requester.js }
106
+ transitions: # a description is REQUIRED on every edge: the
107
+ # agent is shown this state's edges and nothing
108
+ # else of the graph, so it is all it routes on
109
+ - to: orders-question
110
+ description: The user is asking about orders, status, shipping, or tracking.
111
+ orders-question: # no transitions: terminal
112
+ instructions: Answer from skills/order-data/assets/orders.json.
113
+ # no skills block: the workflow's grant reaches
114
+ # here, and enabling a bundle is the whole grant
115
+ # The standard this state's exit is graded against, declared where it applies.
116
+ # On the authoring plane, so the agent being graded can neither read it nor
117
+ # call it.
118
+ after:
119
+ - rubric:
120
+ max_iterations: 2 # how many times a `correct` may send the agent back
121
+ instructions: Judge the tone of the reply. Return ok, correct or veto with a reason.
122
+ ```
123
+
124
+ `examples/customer-support/` in this repository is a complete reference workspace.
125
+
126
+ ### The CLI
127
+
128
+ ```bash
129
+ npx archmax run order-lookup "Which orders are delayed for Acme?" --root ./my-workspace
130
+ npx archmax test order-lookup --root ./my-workspace # run the workflow's cases
131
+ npx archmax validate order-lookup --root ./my-workspace # static checks, no model calls
132
+ npx archmax sessions --root ./my-workspace # list durable sessions
133
+ npx archmax decide <session> --to approved # resume a session parked at a human state
134
+ npx archmax reply <session> "Any update?" # answer a parked session; it stays parked
135
+ npx archmax deliver <session> --trigger email_reply # resume a session parked with archmax_wait
136
+ ```
137
+
138
+ Results go to stdout and the state flow to stderr. Exit 0 means done or parked, 1 a failure, 2 a
139
+ usage error. See the [CLI reference](https://archmax-ai.github.io/harness/reference/cli/).
140
+
141
+ ### The library
142
+
143
+ ```ts
144
+ import { createAgent } from "@archmax-ai/harness";
145
+
146
+ const agent = await createAgent({
147
+ workflow: "order-lookup",
148
+ workspace: { rootDir: "./my-workspace" },
149
+ });
150
+
151
+ // A turn, a decision, a reply or a delivery: one call, one Outcome.
152
+ const outcome = await agent.workflow!.send("session-42", {
153
+ message: "Which orders are delayed for Acme?",
154
+ });
155
+ console.log(outcome.kind, outcome.state, outcome.reply); // "parked" "refund-review" "..."
156
+
157
+ if (outcome.kind === "parked" && outcome.parkedChannel === "decision") {
158
+ await agent.workflow!.decide("session-42", { target: "approved", comment: "Within policy." });
159
+ }
160
+ ```
161
+
162
+ Omit `workflow` for a plain Deep Agent with the same parameters, or pass `workflow: false` to
163
+ declare an agent ungoverned. `onEvent` receives the typed event stream and
164
+ `workspace.sessionStore` puts sessions elsewhere. `workspace.mounts` composes what the agent can
165
+ see, and marking a mount `governed: true` hands the spec's `mounts` block the decision of which
166
+ states reach it. Marking one `searchable: false` keeps root-wide searches away from a backend
167
+ that must refuse them.
168
+
169
+ Five subpaths keep production imports small:
170
+
171
+ - `@archmax-ai/harness/sandbox`: hook authoring types
172
+ - `@archmax-ai/harness/testing`: the case engine
173
+ - `@archmax-ai/harness/cli`: the state-flow renderer
174
+ - `@archmax-ai/harness/spec`: the `workflow.yaml` schema, the pure validator and the grammars
175
+ - `@archmax-ai/harness/messages`: transcript readers
176
+
177
+ The last two are browser-safe, with no runtime behind them. See the
178
+ [public API reference](https://archmax-ai.github.io/harness/reference/public-api/).
179
+
180
+ ### Authoring with a coding agent
181
+
182
+ The package ships an authoring skill at `dist/authoring-skill/archmax-harness/`. It teaches a coding agent
183
+ the schema, the hook contract, governance, human states, cases and the CLI. The
184
+ `BUNDLED_AUTHORING_SKILL_DIR` export resolves to its parent directory, and the source is
185
+ `skills/archmax-harness/`.
186
+
187
+ ## Documentation
188
+
189
+ - [Quickstart](https://archmax-ai.github.io/harness/getting-started/quickstart/) and
190
+ [installation](https://archmax-ai.github.io/harness/getting-started/installation/)
191
+ - Guides: [the workflow machine](https://archmax-ai.github.io/harness/guides/workflow-machine/),
192
+ [sessions](https://archmax-ai.github.io/harness/guides/sessions/),
193
+ [triggers](https://archmax-ai.github.io/harness/guides/triggers/),
194
+ [skills](https://archmax-ai.github.io/harness/guides/skills/),
195
+ [sub-workflows](https://archmax-ai.github.io/harness/guides/sub-workflows/),
196
+ [testing](https://archmax-ai.github.io/harness/guides/testing/),
197
+ [token efficiency](https://archmax-ai.github.io/harness/guides/token-efficiency/)
198
+ - Reference: [machine spec](https://archmax-ai.github.io/harness/reference/machine-spec/),
199
+ [CLI](https://archmax-ai.github.io/harness/reference/cli/),
200
+ [public API](https://archmax-ai.github.io/harness/reference/public-api/),
201
+ [glossary](https://archmax-ai.github.io/harness/reference/glossary/),
202
+ [changelog](https://archmax-ai.github.io/harness/reference/changelog/)
203
+
204
+ ## Development
205
+
206
+ ```bash
207
+ npm run dev -- run order-lookup "..." --root examples/customer-support
208
+ npm run typecheck && npm test
209
+ npm run docs:dev
210
+ ```
211
+
212
+ Substantive changes flow through [OpenSpec](https://github.com/Fission-AI/OpenSpec) under
213
+ `openspec/`. Documentation, `README.md` and the authoring skill ship in the same change as the
214
+ behaviour they describe. See [CONTRIBUTING.md](CONTRIBUTING.md) and the
215
+ [development setup](https://archmax-ai.github.io/harness/contributing/development/).
216
+
217
+ ## License
218
+
219
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,174 @@
1
+ import { type RunnableConfig } from "@langchain/core/runnables";
2
+ import type { BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
3
+ import type { Graph } from "@langchain/core/runnables/graph";
4
+ import { type AgentInput, type AgentResult, type AgentStreamOptions, type CompiledAgentGraph } from "./core/deepagents.js";
5
+ import type { WorkflowMachine } from "./machine/machine.js";
6
+ import type { MachineSpec } from "./machine/types.js";
7
+ import type { ResolvedTrigger, TriggerInput } from "./machine/triggers.js";
8
+ import type { ResolvedRuntimeContract } from "./runtime/contract.js";
9
+ import type { EmitRunArtifacts, SessionOperations } from "./sessions/operations.js";
10
+ import type { ResolvedSession, ResolveSessionInput } from "./sessions/resolve.js";
11
+ import type { DecideOutcome, DecisionResolution, DeliverOutcome, Outcome, ReplyOutcome, ResumePayload, TriggerDelivery } from "./sessions/resume.js";
12
+ import type { TurnRunner } from "./workflow/turn-runner.js";
13
+ /**
14
+ * The default config an assembled agent carries: the integration metadata
15
+ * tracing backends key off, and the recursion limit a turn runs under when the
16
+ * caller names none. One invoke is one whole turn across states — every hook,
17
+ * model call and tool batch is a super-step — so the limit is generous by
18
+ * design: the authored budgets (`budget.maxTurns`, `maxParks`) are the real
19
+ * bound, and this only stops a turn nothing else bounds.
20
+ */
21
+ export declare const AGENT_DEFAULT_CONFIG: RunnableConfig;
22
+ /**
23
+ * A turn's input to {@link WorkflowSurface.send}: what the person said, and —
24
+ * for a session's opening turn — how it is started and what it is seeded with.
25
+ * On a session parked at a human state the message is answered without moving
26
+ * it; on a session parked with `archmax_wait` the trigger and variables are
27
+ * delivered into it.
28
+ */
29
+ export interface TurnInput {
30
+ /** What the person said. */
31
+ message: string;
32
+ /** How the session is started; defaults to `manual`. */
33
+ trigger?: TriggerInput;
34
+ /** Variables seeded for this turn, locked — the same seeds a delivery carries. */
35
+ variables?: Record<string, unknown>;
36
+ /** Where a firing's session id lives, overriding the trigger's declaration. */
37
+ sessionPath?: string;
38
+ }
39
+ /** What {@link WorkflowSurface.send} takes: a turn, or one of the three resumes. */
40
+ export type SendInput = TurnInput | ResumePayload;
41
+ /**
42
+ * The governance surface of a governed assembly, reached at `agent.workflow`.
43
+ *
44
+ * Carries only what is meaningless without a machine. Everything that describes
45
+ * *the session* — `sessions`, artifacts, spec snapshots, disposal — is on the
46
+ * agent itself, because an ungoverned assembly has those too. `undefined` on a
47
+ * plain assembly, so TypeScript makes the caller handle that.
48
+ */
49
+ export interface WorkflowSurface {
50
+ /** Workflow slug this agent was assembled for. */
51
+ name: string;
52
+ /** The compiled machine backing this agent's workflow. */
53
+ machine: WorkflowMachine;
54
+ /** Map a trigger id to the start state it enters; throws `UnknownTriggerError`. */
55
+ resolveTrigger(trigger?: TriggerInput): ResolvedTrigger;
56
+ /** Resume a session parked at a human state with the person's decision. */
57
+ decide(sessionId: string, resolution: DecisionResolution): Promise<DecideOutcome>;
58
+ /** Reply to a session parked at a human state and get its answer; it stays parked. */
59
+ reply(sessionId: string, message: string): Promise<ReplyOutcome>;
60
+ /** @deprecated Older spelling of {@link reply}; kept for one release. */
61
+ respond(sessionId: string, message: string): Promise<ReplyOutcome>;
62
+ /** Resume a session parked with `archmax_wait` with a delivered firing. */
63
+ deliver(sessionId: string, delivery: TriggerDelivery): Promise<DeliverOutcome>;
64
+ /** Map a firing to the session it belongs to and the disposition it takes — without invoking. */
65
+ resolveSession(input: ResolveSessionInput): Promise<ResolvedSession>;
66
+ /**
67
+ * The one operation a host or the CLI needs: enter `sessionId` with a turn or
68
+ * a resume and get one {@link Outcome} back. A turn is resolved first — a new
69
+ * or finished session takes it as its next turn, a session parked at a human
70
+ * state has it answered as a reply, a session parked with `archmax_wait` has
71
+ * its trigger and variables delivered. `config` merges into the invoke config
72
+ * (a tool-mock declaration, a recursion limit).
73
+ */
74
+ send(sessionId: string, input: SendInput, config?: RunnableConfig): Promise<Outcome>;
75
+ }
76
+ /** The session-level members every assembled agent carries, governed or plain. */
77
+ export interface AgentMembers {
78
+ /** Release every per-session resource held for `sessionId`. Idempotent. */
79
+ dispose(sessionId: string): void;
80
+ /** Runtime contract resolved (and enforced) for this agent. */
81
+ runtimeContract: ResolvedRuntimeContract;
82
+ /**
83
+ * Whether tool mocks declared for a session (`configurable.__toolMocks`, the
84
+ * case engine's `mocks:` channel) intercept **agent-initiated** tool calls —
85
+ * true when the tool-mock middleware is wired. Scripts' PTC calls are always
86
+ * intercepted; without this, interception would be partial, which is why the
87
+ * case engine refuses mock-declaring cases against an agent that lacks it.
88
+ */
89
+ toolMocks: boolean;
90
+ /**
91
+ * Persist the session's graph snapshot, the supplied trajectory and (when
92
+ * governed) its trail, variables and usage under `<sessionId>/artifacts/`.
93
+ * Best-effort: the artifacts directory, or `null` if writing failed.
94
+ */
95
+ emitRunArtifacts: EmitRunArtifacts;
96
+ /** Session handles over the configured session store. */
97
+ sessions: SessionOperations;
98
+ /** Resolve a machine spec persisted to the snapshot store by its `specHash`. */
99
+ getSpecSnapshot(hash: string): Promise<MachineSpec | null>;
100
+ }
101
+ /** @deprecated The members now live on {@link ArchmaxAgent} directly; use `Agent`. */
102
+ export type AgentRunSurface = AgentMembers;
103
+ /**
104
+ * An assembled agent: a wrapper over the compiled Deep Agent graph.
105
+ *
106
+ * This is the shape `createDeepAgent` returns — a thin delegating object holding
107
+ * the compiled graph — mirrored for two reasons. Familiarity: a consumer who
108
+ * knows `createDeepAgent` gets `invoke`/`stream`/`streamEvents`/`graph` where
109
+ * they expect them. Correctness: a compiled graph's `withConfig()` returns a
110
+ * **new** graph, so a governance namespace attached to a graph object would be
111
+ * dropped the first time anyone reconfigured it; {@link ArchmaxAgent.withConfig}
112
+ * rebuilds the wrapper, so `.workflow` survives.
113
+ *
114
+ * Every agent's `invoke`, `stream` and `streamEvents` go through a turn runner
115
+ * that binds the session zone and event context around the call, from
116
+ * `configurable.thread_id`. A governed agent's runner also streams the model's
117
+ * text as `agent-text-delta` events and settles parks; a plain agent's runner
118
+ * drives the graph as-is, bound.
119
+ */
120
+ export declare class ArchmaxAgent implements AgentMembers {
121
+ #private;
122
+ readonly dispose: (sessionId: string) => void;
123
+ readonly runtimeContract: ResolvedRuntimeContract;
124
+ readonly toolMocks: boolean;
125
+ readonly emitRunArtifacts: EmitRunArtifacts;
126
+ readonly sessions: SessionOperations;
127
+ readonly getSpecSnapshot: (hash: string) => Promise<MachineSpec | null>;
128
+ /**
129
+ * Governance for this assembly, or `undefined` when no `workflow` was
130
+ * supplied. Carries only what is meaningless without a machine.
131
+ */
132
+ readonly workflow: WorkflowSurface | undefined;
133
+ constructor(opts: {
134
+ graph: unknown;
135
+ members: AgentMembers;
136
+ workflow?: WorkflowSurface | undefined;
137
+ config?: RunnableConfig;
138
+ /** The session-bound turn runner the assembly drives its graph through. */
139
+ driver?: TurnRunner;
140
+ });
141
+ /** The compiled `CompiledStateGraph` — a real Pregel, for LangGraph-native use. */
142
+ get graph(): CompiledAgentGraph;
143
+ /** The checkpointer the graph was compiled with. */
144
+ get checkpointer(): BaseCheckpointSaver | boolean | undefined;
145
+ /** The LangGraph store the graph was compiled with, when one was supplied. */
146
+ get store(): BaseStore | undefined;
147
+ /**
148
+ * A new agent of the same kind with `config` merged into its defaults.
149
+ * Returns a wrapper, never a bare graph: `.workflow` and the session-level
150
+ * members must survive reconfiguration.
151
+ */
152
+ withConfig(config: RunnableConfig): ArchmaxAgent;
153
+ /** Drive one turn to a settled result. */
154
+ invoke(input: AgentInput, config?: RunnableConfig): Promise<AgentResult>;
155
+ /** Stream one turn's execution. */
156
+ stream(input: AgentInput, options?: AgentStreamOptions): Promise<AsyncIterable<unknown>>;
157
+ /** Stream the framework's own event feed. */
158
+ streamEvents(input: AgentInput, config: RunnableConfig, options?: unknown): AsyncIterable<unknown>;
159
+ getState(config: RunnableConfig, options?: unknown): Promise<unknown>;
160
+ getStateHistory(config: RunnableConfig, options?: unknown): AsyncIterableIterator<unknown>;
161
+ updateState(config: RunnableConfig, values: unknown, asNode?: string): Promise<RunnableConfig>;
162
+ getSubgraphs(namespace?: string, recurse?: boolean): Generator<[string, unknown]>;
163
+ getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, unknown]>;
164
+ getGraphAsync(config?: RunnableConfig): Promise<Graph>;
165
+ }
166
+ /** An assembled agent. See {@link ArchmaxAgent}. */
167
+ export type Agent = ArchmaxAgent;
168
+ /**
169
+ * @deprecated Narrow on `agent.workflow` instead; kept for one release. An
170
+ * {@link Agent} known to be governed: `workflow` is present.
171
+ */
172
+ export type GovernedAgent = Agent & {
173
+ workflow: WorkflowSurface;
174
+ };
package/dist/agent.js ADDED
@@ -0,0 +1,140 @@
1
+ import { mergeConfigs } from "@langchain/core/runnables";
2
+ import { asCompiledAgentGraph, DEFAULT_RECURSION_LIMIT, } from "./core/deepagents.js";
3
+ /**
4
+ * The default config an assembled agent carries: the integration metadata
5
+ * tracing backends key off, and the recursion limit a turn runs under when the
6
+ * caller names none. One invoke is one whole turn across states — every hook,
7
+ * model call and tool batch is a super-step — so the limit is generous by
8
+ * design: the authored budgets (`budget.maxTurns`, `maxParks`) are the real
9
+ * bound, and this only stops a turn nothing else bounds.
10
+ */
11
+ export const AGENT_DEFAULT_CONFIG = {
12
+ metadata: { ls_integration: "archmax-harness" },
13
+ recursionLimit: DEFAULT_RECURSION_LIMIT,
14
+ };
15
+ /**
16
+ * An assembled agent: a wrapper over the compiled Deep Agent graph.
17
+ *
18
+ * This is the shape `createDeepAgent` returns — a thin delegating object holding
19
+ * the compiled graph — mirrored for two reasons. Familiarity: a consumer who
20
+ * knows `createDeepAgent` gets `invoke`/`stream`/`streamEvents`/`graph` where
21
+ * they expect them. Correctness: a compiled graph's `withConfig()` returns a
22
+ * **new** graph, so a governance namespace attached to a graph object would be
23
+ * dropped the first time anyone reconfigured it; {@link ArchmaxAgent.withConfig}
24
+ * rebuilds the wrapper, so `.workflow` survives.
25
+ *
26
+ * Every agent's `invoke`, `stream` and `streamEvents` go through a turn runner
27
+ * that binds the session zone and event context around the call, from
28
+ * `configurable.thread_id`. A governed agent's runner also streams the model's
29
+ * text as `agent-text-delta` events and settles parks; a plain agent's runner
30
+ * drives the graph as-is, bound.
31
+ */
32
+ export class ArchmaxAgent {
33
+ #graph;
34
+ #config;
35
+ #members;
36
+ #driver;
37
+ dispose;
38
+ runtimeContract;
39
+ toolMocks;
40
+ emitRunArtifacts;
41
+ sessions;
42
+ getSpecSnapshot;
43
+ /**
44
+ * Governance for this assembly, or `undefined` when no `workflow` was
45
+ * supplied. Carries only what is meaningless without a machine.
46
+ */
47
+ workflow;
48
+ constructor(opts) {
49
+ this.#graph = asCompiledAgentGraph(opts.graph);
50
+ this.#members = opts.members;
51
+ this.#config = mergeConfigs(AGENT_DEFAULT_CONFIG, opts.config);
52
+ this.#driver = opts.driver;
53
+ this.workflow = opts.workflow;
54
+ this.dispose = opts.members.dispose;
55
+ this.runtimeContract = opts.members.runtimeContract;
56
+ this.toolMocks = opts.members.toolMocks;
57
+ this.emitRunArtifacts = opts.members.emitRunArtifacts;
58
+ this.sessions = opts.members.sessions;
59
+ this.getSpecSnapshot = opts.members.getSpecSnapshot;
60
+ // Bound so the agent survives destructuring — `const { invoke } = agent` is
61
+ // how a caller naturally reaches for one method.
62
+ this.invoke = this.invoke.bind(this);
63
+ this.stream = this.stream.bind(this);
64
+ this.streamEvents = this.streamEvents.bind(this);
65
+ this.withConfig = this.withConfig.bind(this);
66
+ this.getState = this.getState.bind(this);
67
+ this.getStateHistory = this.getStateHistory.bind(this);
68
+ this.updateState = this.updateState.bind(this);
69
+ this.getSubgraphs = this.getSubgraphs.bind(this);
70
+ this.getSubgraphsAsync = this.getSubgraphsAsync.bind(this);
71
+ this.getGraphAsync = this.getGraphAsync.bind(this);
72
+ }
73
+ /** The compiled `CompiledStateGraph` — a real Pregel, for LangGraph-native use. */
74
+ get graph() {
75
+ return this.#graph;
76
+ }
77
+ /** The checkpointer the graph was compiled with. */
78
+ get checkpointer() {
79
+ return this.#graph.checkpointer;
80
+ }
81
+ /** The LangGraph store the graph was compiled with, when one was supplied. */
82
+ get store() {
83
+ return this.#graph.store;
84
+ }
85
+ /**
86
+ * A new agent of the same kind with `config` merged into its defaults.
87
+ * Returns a wrapper, never a bare graph: `.workflow` and the session-level
88
+ * members must survive reconfiguration.
89
+ */
90
+ withConfig(config) {
91
+ return new ArchmaxAgent({
92
+ graph: this.#graph,
93
+ members: this.#members,
94
+ workflow: this.workflow,
95
+ config: mergeConfigs(this.#config, config),
96
+ ...(this.#driver ? { driver: this.#driver } : {}),
97
+ });
98
+ }
99
+ /** Drive one turn to a settled result. */
100
+ invoke(input, config) {
101
+ const merged = mergeConfigs(this.#config, config);
102
+ if (this.#driver)
103
+ return this.#driver.invoke(input, merged);
104
+ return this.#graph.invoke(input, merged);
105
+ }
106
+ /** Stream one turn's execution. */
107
+ async stream(input, options) {
108
+ const merged = mergeConfigs(this.#config, options);
109
+ if (this.#driver)
110
+ return this.#driver.stream(input, merged);
111
+ return this.#graph.stream(input, merged);
112
+ }
113
+ /** Stream the framework's own event feed. */
114
+ streamEvents(input, config, options) {
115
+ const merged = mergeConfigs(this.#config, config);
116
+ if (this.#driver)
117
+ return this.#driver.streamEvents(input, merged, options);
118
+ return this.#graph.streamEvents(input, merged, options);
119
+ }
120
+ // --- Checkpoint surface, delegated to the compiled graph -------------------
121
+ getState(config, options) {
122
+ return this.#graph.getState(mergeConfigs(this.#config, config), options);
123
+ }
124
+ getStateHistory(config, options) {
125
+ return this.#graph.getStateHistory(mergeConfigs(this.#config, config), options);
126
+ }
127
+ updateState(config, values, asNode) {
128
+ return this.#graph.updateState(mergeConfigs(this.#config, config), values, asNode);
129
+ }
130
+ getSubgraphs(namespace, recurse) {
131
+ return this.#graph.getSubgraphs(namespace, recurse);
132
+ }
133
+ getSubgraphsAsync(namespace, recurse) {
134
+ return this.#graph.getSubgraphsAsync(namespace, recurse);
135
+ }
136
+ getGraphAsync(config) {
137
+ return this.#graph.getGraphAsync(config ? mergeConfigs(this.#config, config) : this.#config);
138
+ }
139
+ }
140
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,2BAA2B,CAAC;AAG9E,OAAO,EACL,oBAAoB,EACpB,uBAAuB,GAKxB,MAAM,sBAAsB,CAAC;AAkB9B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAClD,QAAQ,E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