@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
@@ -0,0 +1,273 @@
1
+ import { type WorkflowEventHandler } from "../core/events.js";
2
+ import type { Workspace } from "../core/workspace.js";
3
+ import type { MountPrefixes } from "../core/zones.js";
4
+ import { type GuardResolutionFailure } from "./allow.js";
5
+ import { type VariableStore } from "./variables.js";
6
+ import { type WorkflowSpecPaths } from "./load-spec.js";
7
+ import { type SessionPath, type TriggerBinding } from "./triggers.js";
8
+ import { ALWAYS_ALLOWED_TOOLS, UNGRANTABLE_TOOLS, ESSENTIAL_TOOLS } from "./tool-names.js";
9
+ import { type ForbidEntry, type HarnessSettings, type LifecycleHook, type MachineSpec, type MachineTransition } from "./types.js";
10
+ export { ALWAYS_ALLOWED_TOOLS, ESSENTIAL_TOOLS, UNGRANTABLE_TOOLS };
11
+ /**
12
+ * Read-only context a guard check consults: the run's variables (for `${{…}}`
13
+ * substitution) and a sink for the first unresolvable reference, which the
14
+ * kernel escalates to a terminal run failure rather than a retryable block.
15
+ */
16
+ export interface GuardContext {
17
+ variables?: VariableStore;
18
+ onUnresolved?: (failure: GuardResolutionFailure) => void;
19
+ }
20
+ /**
21
+ * The compiled workflow: what the runtime consults for transitions, tool
22
+ * surfaces, enabled skills and trigger wiring. A pure view over the parsed
23
+ * `spec` — no workspace, no file access. Declarations are read off `spec`
24
+ * directly (`machine.spec.states[slug].instructions`); the methods here are the
25
+ * derived answers.
26
+ */
27
+ export declare class WorkflowMachine {
28
+ readonly spec: MachineSpec;
29
+ /**
30
+ * Host-declared tool names treated as essential — always disclosed and
31
+ * permitted in every state, exactly like the built-in {@link ESSENTIAL_TOOLS}.
32
+ */
33
+ private readonly extraEssential;
34
+ /**
35
+ * The entry state: the `manual` start state, else the first declared start
36
+ * state, else the first declared state — so a machine always has one.
37
+ */
38
+ readonly entry: string;
39
+ private bindingsCache?;
40
+ private constructor();
41
+ /**
42
+ * Load the machine from its two files, or `null` when nothing loads to a
43
+ * usable machine. Load problems other than a missing file are emitted as
44
+ * `warning` events.
45
+ */
46
+ static load(workspace: Workspace, paths: WorkflowSpecPaths, onEvent?: WorkflowEventHandler): Promise<WorkflowMachine | null>;
47
+ /** Construct a machine from an already-parsed spec. */
48
+ static fromSpec(spec: MachineSpec, extraEssentialTools?: Iterable<string>): WorkflowMachine;
49
+ /**
50
+ * Stable content hash of the spec, written into a session's first checkpoint
51
+ * and compared on resume.
52
+ */
53
+ get specHash(): string;
54
+ /** Whether this machine is out of service (see {@link specDisabled}). */
55
+ get disabled(): boolean;
56
+ /** Runtime knobs from `settings`, defaults applied. */
57
+ get harnessSettings(): HarnessSettings;
58
+ /**
59
+ * The model id `state`'s turns run on, or `undefined` when the workflow leaves
60
+ * the choice to the assembly. The one place the chain is derived — the state's
61
+ * `model`, else the root's `settings.model` — so nothing re-implements the
62
+ * precedence. An unknown slug reads as the workflow's own declaration, which is
63
+ * what the runtime wants for a position it cannot resolve.
64
+ */
65
+ modelFor(state: string): string | undefined;
66
+ /**
67
+ * Every distinct model id this spec declares, in a stable order (the root's
68
+ * first, then each state's in declaration order). What assembly builds a model
69
+ * for, and what it names when an explicit `model` instance makes them inert.
70
+ */
71
+ declaredModels(): string[];
72
+ /**
73
+ * The skills the workflow grants in **every** state: the root's
74
+ * `allow_always`, resolved against the registry. A state's `skills.allow`
75
+ * adds to this list, exactly as `tools.allow` adds to `tools.allow_always`.
76
+ * An absent key grants nothing, the same as `allow_always: []`. A declared
77
+ * slug the registry does not provide is dropped (and reported by `validate`).
78
+ */
79
+ workflowAlwaysSkills(available: readonly string[]): string[];
80
+ /** The slugs `skills.forbid_always` denies in every state of this workflow. */
81
+ workflowForbiddenSkills(): string[];
82
+ /**
83
+ * The slugs denied while `state` is active, from either level. Declaration
84
+ * order, workflow-wide first, so a caller rendering them is byte-stable.
85
+ */
86
+ forbiddenSkills(state: string): string[];
87
+ /**
88
+ * Which level denies `slug` in `state`, or `undefined` if neither does — so a
89
+ * refusal can say whether a list forbade the bundle or nothing granted it.
90
+ */
91
+ skillDenial(state: string, slug: string): "workflow" | "state" | undefined;
92
+ /**
93
+ * The skills enabled while `state` is active — the one answer the kernel's
94
+ * skill rule, prompt disclosure, the PTC listing redaction and `validate` all
95
+ * consult.
96
+ *
97
+ * The grant is additive: the state's own `skills.allow` followed by the root's
98
+ * `allow_always`, each in declaration order, deduplicated by slug. The denial
99
+ * beats it: anything `skills.forbid_always` or the state's `skills.forbid`
100
+ * names is removed, so **deny beats allow and no narrower level widens a
101
+ * denial**. Order is declaration order from the frozen spec, so everything
102
+ * rendered from this — the prompt's skills section above all — is byte-stable
103
+ * across the model calls of a turn.
104
+ */
105
+ enabledSkills(state: string, available: readonly string[]): string[];
106
+ /**
107
+ * The governed mounts the workflow enables in **every** state: the root's
108
+ * `mounts.allow_always`, filtered to the names the host declared governed. A
109
+ * state's `mounts.allow` adds to this list, exactly as `skills.allow` adds to
110
+ * `skills.allow_always`. An absent key grants nothing, the same as
111
+ * `allow_always: []`. A name the table does not govern is dropped (and
112
+ * reported by `validate`) — an ungoverned mount needs no grant.
113
+ */
114
+ workflowAlwaysMounts(governed: readonly string[]): string[];
115
+ /**
116
+ * The names `mounts.forbid_always` denies in every state of this workflow —
117
+ * governed or not, since a denial subtracts an ungoverned mount's standing
118
+ * visibility too.
119
+ */
120
+ workflowForbiddenMounts(): string[];
121
+ /**
122
+ * The mount names denied while `state` is active, from either level.
123
+ * Declaration order, workflow-wide first, so a caller rendering them is
124
+ * byte-stable.
125
+ */
126
+ forbiddenMounts(state: string): string[];
127
+ /**
128
+ * Which level denies `name` in `state`, or `undefined` if neither does — so a
129
+ * refusal can say whether a list forbade the mount or nothing enabled it.
130
+ */
131
+ mountDenial(state: string, name: string): "workflow" | "state" | undefined;
132
+ /**
133
+ * The **governed** mounts enabled while `state` is active — the one answer the
134
+ * kernel's mount rule, prompt disclosure, the listing redaction and `validate`
135
+ * all consult. Ungoverned mounts are not in it: they are visible in every
136
+ * state without a grant, and `forbiddenMounts` is what takes one away.
137
+ *
138
+ * The grant is additive: the state's own `mounts.allow` followed by the root's
139
+ * `allow_always`, each in declaration order, deduplicated by name. The denial
140
+ * beats it: anything `mounts.forbid_always` or the state's `mounts.forbid`
141
+ * names is removed, so **deny beats allow and no narrower level widens a
142
+ * denial**. Order is declaration order from the frozen spec, so everything
143
+ * rendered from this is byte-stable across the model calls of a turn.
144
+ */
145
+ enabledMounts(state: string, governed: readonly string[]): string[];
146
+ /**
147
+ * Whether writes to `name` are permitted while `state` is active — the second
148
+ * half of a mount grant, beside which states may see it at all.
149
+ *
150
+ * A mount is writable here only when the host declared it writable **and** no
151
+ * applicable grant narrowed it to `read`. Read-only is a restriction, so it
152
+ * behaves like every other restriction in this schema: whichever level asks
153
+ * for it gets it, and no narrower level widens it back. `read_write` on a
154
+ * mount the host serves read-only is therefore inert (reported by `validate`)
155
+ * — the host's posture is the ceiling, not a default to argue with.
156
+ *
157
+ * An ungoverned mount takes the host's posture in every state: it carries no
158
+ * grant to qualify.
159
+ */
160
+ mountWritable(state: string, name: string, mounts: MountPrefixes): boolean;
161
+ transitionTargets(from: string): string[];
162
+ getTransition(from: string, to: string): MachineTransition | undefined;
163
+ /** The state a failed turn routes to (`on_error`), if declared and present. */
164
+ onError(state: string): string | undefined;
165
+ /** A state with no declared outgoing transitions is terminal (ends the run). */
166
+ isTerminal(state: string): boolean;
167
+ /** Whether a state is a human decision state (a person picks the edge). */
168
+ isHumanState(state: string): boolean;
169
+ /**
170
+ * States a run can reach: the start states plus everything transitively
171
+ * reachable through transitions and `on_error` routes. A state no start state
172
+ * reaches is dead in the definition, so nothing it declares widens the surface.
173
+ */
174
+ reachableStates(): Set<string>;
175
+ /** Each state's normalized `before`/`after` hook lists, for states declaring any. */
176
+ lifecycleHooks(): Record<string, LifecycleHook>;
177
+ /**
178
+ * The sibling workflows this machine may delegate to: every
179
+ * `archmax_workflow_<slug>` named in `tools.allow_always` and in the given
180
+ * state's `tools.allow` — or, with no state, in any **reachable** state's.
181
+ * Naming a target in governance *is* declaring the delegation.
182
+ */
183
+ delegationTargets(state?: string): string[];
184
+ /** Run variables this state must have set before it may be left. */
185
+ requiredVariables(state: string): string[];
186
+ private allowEntries;
187
+ private allowAlwaysEntries;
188
+ /**
189
+ * The effective essential set: the built-ins plus the host's `essentialTools`.
190
+ * Unconditional — no property of a workspace or a spec adds to it, and `task`
191
+ * is in it under no circumstances (see {@link UNGRANTABLE_TOOLS}).
192
+ */
193
+ private essentialTools;
194
+ /**
195
+ * Every denial entry that applies in `state`: the workflow's `forbid_always`
196
+ * followed by the state's own `forbid`. Order is presentational only — both
197
+ * block, and a denial is evaluated ahead of every grant.
198
+ */
199
+ forbidEntries(state: string): ForbidEntry[];
200
+ /**
201
+ * The entries that govern `state`, in precedence order — the one derivation
202
+ * enforcement and disclosure both read. A tool is decided by exactly one tier:
203
+ * the state's own entries when they name it (the narrower constraint, even for
204
+ * an essential tool); else the essential grant; else `allow_always`. An
205
+ * `allow_always` entry for a tool the state mentions or that is essential is
206
+ * therefore inert.
207
+ */
208
+ private effectiveEntries;
209
+ /**
210
+ * Whether a tool call is statically permitted in `state`. Closed by default:
211
+ * the always-allowed controls pass; otherwise some effective entry must name
212
+ * the tool and match its arguments.
213
+ */
214
+ checkAllowed(state: string, tool: string, args: Record<string, unknown>, ctx?: GuardContext): boolean;
215
+ /**
216
+ * The tool names disclosed to the model while `state` is active: every tool
217
+ * an effective entry names plus the controls (`archmax_advance` omitted for a
218
+ * terminal state, where every call to it would be rejected), minus the tools
219
+ * denied here by name. Name-level only — argument enforcement stays with the
220
+ * kernel at call time.
221
+ */
222
+ disclosedTools(state: string): Set<string>;
223
+ private renderEntry;
224
+ /**
225
+ * Model-facing description of what `checkAllowed` enforces in a state: the
226
+ * effective entries in precedence order, minus any tool denied here by name,
227
+ * then the always-allowed controls the state discloses. A denial that leaves
228
+ * the tool usable for other arguments (a guarded entry) leaves it listed —
229
+ * the same line disclosure draws — so the model's picture matches enforcement
230
+ * either way.
231
+ */
232
+ describeAllowed(state: string): string;
233
+ /**
234
+ * Model-facing lines describing the argument constraints that bind in a
235
+ * state, rendered through the same resolver the kernel enforces with so an
236
+ * unresolved reference is shown as unresolved-and-named rather than as a
237
+ * placeholder the model might pass literally. Empty when none bind.
238
+ */
239
+ describeArgConstraints(state: string, variables?: VariableStore): string[];
240
+ /**
241
+ * Every trigger the spec declares, read from the states that declare them —
242
+ * computed once per machine.
243
+ */
244
+ triggerBindings(): Map<string, TriggerBinding>;
245
+ /** The declared start states as `{ trigger, state }` pairs, in declaration order. */
246
+ startStates(): {
247
+ trigger: string;
248
+ state: string;
249
+ }[];
250
+ /**
251
+ * The state a trigger enters, or `undefined` for an id no state declares.
252
+ * `manual` is the one entry for every ingress — the CLI, an SDK invocation
253
+ * naming no trigger, a host firing that names it, and a delegation.
254
+ */
255
+ startStateForTrigger(id: string): string | undefined;
256
+ /** The session path declared for a trigger, if it declares one. */
257
+ sessionPathForTrigger(id: string): SessionPath | undefined;
258
+ /**
259
+ * The host-resolved `message:` declaration for a trigger: the parsed path,
260
+ * `false` for "firings carry no message", or `undefined` when undeclared.
261
+ */
262
+ messagePathForTrigger(id: string): SessionPath | false | undefined;
263
+ /** The host-resolved `connection:` slug declared for a trigger, if any. */
264
+ connectionForTrigger(id: string): string | undefined;
265
+ /** The run variables a firing of this trigger must supply, if declared. */
266
+ requiresForTrigger(id: string): string[] | undefined;
267
+ /**
268
+ * The run variables a run started through this trigger guarantees are set when
269
+ * it completes, if declared — the only variables that cross a sub-run boundary
270
+ * upward.
271
+ */
272
+ returnsForTrigger(id: string): string[] | undefined;
273
+ }