@jr2/orchestrator 0.4.1 → 0.5.1

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 (327) hide show
  1. package/README.md +20 -2
  2. package/console/components/app.ts +2 -0
  3. package/console/components/fleet.ts +14 -1
  4. package/console/components/machine-pane.ts +41 -2
  5. package/console/main.ts +13 -1
  6. package/console/store.ts +102 -6
  7. package/console/style.css +21 -0
  8. package/docs/agents-block.md +5 -0
  9. package/docs/concepts/agents-and-turns.md +442 -0
  10. package/docs/concepts/architecture.md +230 -0
  11. package/docs/concepts/charts.md +143 -0
  12. package/docs/concepts/composition.md +357 -0
  13. package/docs/concepts/converge.md +254 -0
  14. package/docs/concepts/durable-runs.md +189 -0
  15. package/docs/concepts/effects.md +603 -0
  16. package/docs/concepts/gates.md +208 -0
  17. package/docs/concepts/machines-and-workflows.md +289 -0
  18. package/docs/concepts/pools-and-sources.md +230 -0
  19. package/docs/concepts/secrets-and-trust.md +222 -0
  20. package/docs/concepts/the-menu.md +378 -0
  21. package/docs/concepts/workspaces.md +678 -0
  22. package/docs/get-started/a-model-decides.md +563 -0
  23. package/docs/get-started/an-agent-in-a-sandbox.md +381 -0
  24. package/docs/get-started/connect-a-model.md +248 -0
  25. package/docs/get-started/create-an-instance.md +194 -0
  26. package/docs/get-started/have-your-assistant-write-a-machine.md +922 -0
  27. package/docs/get-started/install.md +126 -0
  28. package/docs/guides/add-tools-to-the-sandbox.md +295 -0
  29. package/docs/guides/answer-a-gate.md +304 -0
  30. package/docs/guides/bind-open-parts.md +223 -0
  31. package/docs/guides/cancel-a-run.md +146 -0
  32. package/docs/guides/clean-up.md +206 -0
  33. package/docs/guides/fix-a-failed-converge.md +361 -0
  34. package/docs/guides/give-the-cluster-git-credentials.md +222 -0
  35. package/docs/guides/iterate-on-a-machine-on-kind.md +190 -0
  36. package/docs/guides/let-an-agent-write-a-chart.md +226 -0
  37. package/docs/guides/look-inside-a-sandbox.md +174 -0
  38. package/docs/guides/mirror-the-kit-images.md +176 -0
  39. package/docs/guides/move-from-kind-to-a-shared-cluster.md +302 -0
  40. package/docs/guides/open-the-console.md +91 -0
  41. package/docs/guides/publish-a-machine-as-an-npm-package.md +350 -0
  42. package/docs/guides/push-and-sign-a-branch.md +486 -0
  43. package/docs/guides/run-a-chart-by-name.md +270 -0
  44. package/docs/guides/run-a-command-or-call-a-url.md +544 -0
  45. package/docs/guides/run-one-worker-per-item.md +321 -0
  46. package/docs/guides/set-an-agents-access-and-dials.md +375 -0
  47. package/docs/guides/size-a-workspace.md +204 -0
  48. package/docs/guides/start-a-run-from-a-run.md +237 -0
  49. package/docs/guides/start-a-run.md +207 -0
  50. package/docs/guides/upgrade-the-kit-version.md +240 -0
  51. package/docs/guides/use-a-hosted-provider.md +208 -0
  52. package/docs/guides/use-a-local-model.md +313 -0
  53. package/docs/guides/watch-a-run.md +326 -0
  54. package/docs/guides/write-a-workflow.md +318 -0
  55. package/docs/index.md +44 -0
  56. package/docs/llms.txt +216 -0
  57. package/docs/reference/authoring-surface/agent.md +128 -0
  58. package/docs/reference/authoring-surface/answer.md +140 -0
  59. package/docs/reference/authoring-surface/arg.md +60 -0
  60. package/docs/reference/authoring-surface/basic.md +62 -0
  61. package/docs/reference/authoring-surface/bearer.md +53 -0
  62. package/docs/reference/authoring-surface/chartschema.md +23 -0
  63. package/docs/reference/authoring-surface/chartschemafor.md +48 -0
  64. package/docs/reference/authoring-surface/command.md +191 -0
  65. package/docs/reference/authoring-surface/customize.md +64 -0
  66. package/docs/reference/authoring-surface/defineconfig.md +41 -0
  67. package/docs/reference/authoring-surface/defineevent.md +114 -0
  68. package/docs/reference/authoring-surface/dispatch.md +126 -0
  69. package/docs/reference/authoring-surface/fail.md +83 -0
  70. package/docs/reference/authoring-surface/file.md +122 -0
  71. package/docs/reference/authoring-surface/frompick.md +277 -0
  72. package/docs/reference/authoring-surface/http.md +159 -0
  73. package/docs/reference/authoring-surface/isfailure.md +58 -0
  74. package/docs/reference/authoring-surface/jr2setup.md +237 -0
  75. package/docs/reference/authoring-surface/open.md +74 -0
  76. package/docs/reference/authoring-surface/openbody.md +86 -0
  77. package/docs/reference/authoring-surface/paramsof.md +125 -0
  78. package/docs/reference/authoring-surface/pool.md +186 -0
  79. package/docs/reference/authoring-surface/push.md +112 -0
  80. package/docs/reference/authoring-surface/secret.md +118 -0
  81. package/docs/reference/authoring-surface/sentby.md +83 -0
  82. package/docs/reference/authoring-surface/source.md +51 -0
  83. package/docs/reference/authoring-surface/text.md +62 -0
  84. package/docs/reference/authoring-surface/type-agentdeclaration.md +27 -0
  85. package/docs/reference/authoring-surface/type-agentdefinition.md +80 -0
  86. package/docs/reference/authoring-surface/type-agentlogic.md +15 -0
  87. package/docs/reference/authoring-surface/type-agentslots.md +12 -0
  88. package/docs/reference/authoring-surface/type-answeraction.md +12 -0
  89. package/docs/reference/authoring-surface/type-arg.md +19 -0
  90. package/docs/reference/authoring-surface/type-argnames.md +12 -0
  91. package/docs/reference/authoring-surface/type-binding.md +62 -0
  92. package/docs/reference/authoring-surface/type-bindingof.md +12 -0
  93. package/docs/reference/authoring-surface/type-bodyacceptsdoor.md +15 -0
  94. package/docs/reference/authoring-surface/type-bodyacceptsslots.md +17 -0
  95. package/docs/reference/authoring-surface/type-ceilings.md +41 -0
  96. package/docs/reference/authoring-surface/type-chainlink.md +19 -0
  97. package/docs/reference/authoring-surface/type-chartaction.md +46 -0
  98. package/docs/reference/authoring-surface/type-chartagent.md +28 -0
  99. package/docs/reference/authoring-surface/type-chartevent.md +20 -0
  100. package/docs/reference/authoring-surface/type-chartguard.md +20 -0
  101. package/docs/reference/authoring-surface/type-chartinvoke.md +28 -0
  102. package/docs/reference/authoring-surface/type-chartjson.md +14 -0
  103. package/docs/reference/authoring-surface/type-chartstate.md +46 -0
  104. package/docs/reference/authoring-surface/type-charttext.md +40 -0
  105. package/docs/reference/authoring-surface/type-charttransition.md +22 -0
  106. package/docs/reference/authoring-surface/type-charttransitions.md +14 -0
  107. package/docs/reference/authoring-surface/type-chartvalue.md +15 -0
  108. package/docs/reference/authoring-surface/type-childat.md +12 -0
  109. package/docs/reference/authoring-surface/type-childslots.md +12 -0
  110. package/docs/reference/authoring-surface/type-commandenv.md +15 -0
  111. package/docs/reference/authoring-surface/type-commandinput.md +19 -0
  112. package/docs/reference/authoring-surface/type-commandoptions.md +78 -0
  113. package/docs/reference/authoring-surface/type-commandoutput.md +104 -0
  114. package/docs/reference/authoring-surface/type-customize.md +109 -0
  115. package/docs/reference/authoring-surface/type-dispatchdefinition.md +39 -0
  116. package/docs/reference/authoring-surface/type-dispatchinput.md +14 -0
  117. package/docs/reference/authoring-surface/type-dispatchopenparts.md +14 -0
  118. package/docs/reference/authoring-surface/type-dispatchoutput.md +65 -0
  119. package/docs/reference/authoring-surface/type-duration.md +15 -0
  120. package/docs/reference/authoring-surface/type-effectbinding.md +93 -0
  121. package/docs/reference/authoring-surface/type-effectlogic.md +12 -0
  122. package/docs/reference/authoring-surface/type-envopenparts.md +14 -0
  123. package/docs/reference/authoring-surface/type-eventaudience.md +27 -0
  124. package/docs/reference/authoring-surface/type-eventdef.md +45 -0
  125. package/docs/reference/authoring-surface/type-eventfrom.md +16 -0
  126. package/docs/reference/authoring-surface/type-eventsemantics.md +26 -0
  127. package/docs/reference/authoring-surface/type-execoutcome.md +34 -0
  128. package/docs/reference/authoring-surface/type-failslot.md +14 -0
  129. package/docs/reference/authoring-surface/type-failure.md +19 -0
  130. package/docs/reference/authoring-surface/type-failureinput.md +20 -0
  131. package/docs/reference/authoring-surface/type-filebody.md +41 -0
  132. package/docs/reference/authoring-surface/type-frominput.md +14 -0
  133. package/docs/reference/authoring-surface/type-hostinjectedinput.md +58 -0
  134. package/docs/reference/authoring-surface/type-httpdefinition.md +101 -0
  135. package/docs/reference/authoring-surface/type-httpinput.md +12 -0
  136. package/docs/reference/authoring-surface/type-httpmethod.md +14 -0
  137. package/docs/reference/authoring-surface/type-httpopenparts.md +12 -0
  138. package/docs/reference/authoring-surface/type-httpoutput.md +89 -0
  139. package/docs/reference/authoring-surface/type-httprequestparts.md +33 -0
  140. package/docs/reference/authoring-surface/type-jr2config.md +126 -0
  141. package/docs/reference/authoring-surface/type-lends.md +38 -0
  142. package/docs/reference/authoring-surface/type-logicat.md +12 -0
  143. package/docs/reference/authoring-surface/type-markedif.md +12 -0
  144. package/docs/reference/authoring-surface/type-mergedactors.md +12 -0
  145. package/docs/reference/authoring-surface/type-namedsecret.md +25 -0
  146. package/docs/reference/authoring-surface/type-noslotspec.md +26 -0
  147. package/docs/reference/authoring-surface/type-noslotworkspaceoptions.md +32 -0
  148. package/docs/reference/authoring-surface/type-openbodydeclaration.md +40 -0
  149. package/docs/reference/authoring-surface/type-openbodylogic.md +14 -0
  150. package/docs/reference/authoring-surface/type-openbodyoutput.md +42 -0
  151. package/docs/reference/authoring-surface/type-openbodyslot.md +18 -0
  152. package/docs/reference/authoring-surface/type-opencommandinput.md +17 -0
  153. package/docs/reference/authoring-surface/type-openeffect.md +12 -0
  154. package/docs/reference/authoring-surface/type-openeffectslots.md +12 -0
  155. package/docs/reference/authoring-surface/type-openof.md +12 -0
  156. package/docs/reference/authoring-surface/type-opensecret.md +23 -0
  157. package/docs/reference/authoring-surface/type-opensecretmark.md +12 -0
  158. package/docs/reference/authoring-surface/type-permissivenoslotworkspaceoptions.md +31 -0
  159. package/docs/reference/authoring-surface/type-permissiveworkspaceoptions.md +32 -0
  160. package/docs/reference/authoring-surface/type-poolmachine.md +28 -0
  161. package/docs/reference/authoring-surface/type-poolspec.md +60 -0
  162. package/docs/reference/authoring-surface/type-pushinput.md +15 -0
  163. package/docs/reference/authoring-surface/type-pushoptions.md +79 -0
  164. package/docs/reference/authoring-surface/type-pushoutput.md +124 -0
  165. package/docs/reference/authoring-surface/type-pushwireoutput.md +12 -0
  166. package/docs/reference/authoring-surface/type-quantity.md +14 -0
  167. package/docs/reference/authoring-surface/type-reached.md +12 -0
  168. package/docs/reference/authoring-surface/type-reposlot.md +70 -0
  169. package/docs/reference/authoring-surface/type-reposlotsof.md +16 -0
  170. package/docs/reference/authoring-surface/type-sandboxoptions.md +77 -0
  171. package/docs/reference/authoring-surface/type-secret.md +25 -0
  172. package/docs/reference/authoring-surface/type-sender.md +19 -0
  173. package/docs/reference/authoring-surface/type-sentbyguards.md +12 -0
  174. package/docs/reference/authoring-surface/type-size.md +85 -0
  175. package/docs/reference/authoring-surface/type-slothandles.md +32 -0
  176. package/docs/reference/authoring-surface/type-sourcenextresult.md +17 -0
  177. package/docs/reference/authoring-surface/type-sourcespec.md +44 -0
  178. package/docs/reference/authoring-surface/type-syncstate.md +12 -0
  179. package/docs/reference/authoring-surface/type-text.md +19 -0
  180. package/docs/reference/authoring-surface/type-textpart.md +24 -0
  181. package/docs/reference/authoring-surface/type-thinkinglevel.md +39 -0
  182. package/docs/reference/authoring-surface/type-toparameterizedobject.md +14 -0
  183. package/docs/reference/authoring-surface/type-toprovidedactor.md +14 -0
  184. package/docs/reference/authoring-surface/type-unknown.md +21 -0
  185. package/docs/reference/authoring-surface/type-usercontainer.md +77 -0
  186. package/docs/reference/authoring-surface/type-withoutemptyindex.md +20 -0
  187. package/docs/reference/authoring-surface/type-workflowevent.md +46 -0
  188. package/docs/reference/authoring-surface/type-workspaceaccess.md +16 -0
  189. package/docs/reference/authoring-surface/type-workspaced.md +94 -0
  190. package/docs/reference/authoring-surface/type-workspacehandles.md +23 -0
  191. package/docs/reference/authoring-surface/type-workspacemachine.md +29 -0
  192. package/docs/reference/authoring-surface/type-workspaceof.md +13 -0
  193. package/docs/reference/authoring-surface/type-workspaceoptions.md +39 -0
  194. package/docs/reference/authoring-surface/type-workspacespec.md +37 -0
  195. package/docs/reference/authoring-surface/workspace.md +259 -0
  196. package/docs/reference/authoring-surface.md +197 -0
  197. package/docs/reference/cli.md +433 -0
  198. package/docs/reference/config.md +756 -0
  199. package/docs/reference/decisions/0001-operator-owned-generic-sandbox.md +113 -0
  200. package/docs/reference/decisions/0002-duplex-streaming-actor.md +110 -0
  201. package/docs/reference/decisions/0004-worktree-provisioning-model.md +124 -0
  202. package/docs/reference/decisions/0005-sandbox-pod-composition.md +230 -0
  203. package/docs/reference/decisions/0006-agent-control-surface.md +47 -0
  204. package/docs/reference/decisions/0007-durable-machine-state.md +109 -0
  205. package/docs/reference/decisions/0008-orchestrator-as-deployed-app.md +60 -0
  206. package/docs/reference/decisions/0009-cli-and-instance-interface.md +275 -0
  207. package/docs/reference/decisions/0010-bdd-acceptance-tests.md +160 -0
  208. package/docs/reference/decisions/0011-workflow-defined-events.md +141 -0
  209. package/docs/reference/decisions/0012-workspace-wrapper-machine.md +103 -0
  210. package/docs/reference/decisions/0013-the-agent-reaches-its-machine-through-a-container-it-cannot-read.md +157 -0
  211. package/docs/reference/decisions/0014-observation-is-open-run-state-is-not.md +95 -0
  212. package/docs/reference/decisions/0015-authoring-surface-absorbs-the-mechanism.md +265 -0
  213. package/docs/reference/decisions/0016-agent-turn-mechanics-are-internal.md +124 -0
  214. package/docs/reference/decisions/0017-pool-over-a-source-port.md +69 -0
  215. package/docs/reference/decisions/0018-instance-agents-are-definitions-jr2-assembles-the-harness.md +111 -0
  216. package/docs/reference/decisions/0019-one-converging-command-against-the-current-context.md +275 -0
  217. package/docs/reference/decisions/0020-private-ca-trust-is-a-named-concept.md +60 -0
  218. package/docs/reference/decisions/0021-workspace-continuity-is-a-lease-that-answers-back.md +100 -0
  219. package/docs/reference/decisions/0022-observation-is-a-level-triggered-feed.md +103 -0
  220. package/docs/reference/decisions/0023-the-harness-prints-the-conversation.md +176 -0
  221. package/docs/reference/decisions/0024-an-agents-turn-ends-with-the-state-that-asked-for-it.md +439 -0
  222. package/docs/reference/decisions/0025-cancel-ends-a-run-stop-parks-it.md +65 -0
  223. package/docs/reference/decisions/0026-a-turn-that-is-over-is-never-prompted.md +62 -0
  224. package/docs/reference/decisions/0027-the-harness-is-jr2s-own-server-flue-retires-the-wire-stays.md +237 -0
  225. package/docs/reference/decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md +89 -0
  226. package/docs/reference/decisions/0029-a-menu-is-fixed-for-a-conversation-and-a-turn-is-told-its-allowed-picks.md +154 -0
  227. package/docs/reference/decisions/0030-a-snapshot-names-the-machine-it-was-written-under.md +100 -0
  228. package/docs/reference/decisions/0031-menu-only-agents-run-on-the-instance-harness.md +190 -0
  229. package/docs/reference/decisions/0032-the-console-unlocks-with-the-instance-token.md +61 -0
  230. package/docs/reference/decisions/0033-a-machine-declares-the-input-that-starts-it.md +127 -0
  231. package/docs/reference/decisions/0034-the-console-renders-with-preact-and-the-server-erases-the-types.md +57 -0
  232. package/docs/reference/decisions/0035-a-runaway-turn-is-ended-rerolled-once-then-a-fault.md +92 -0
  233. package/docs/reference/decisions/0036-a-turn-compacts-its-own-context-mid-flight.md +138 -0
  234. package/docs/reference/decisions/0037-an-instance-builds-its-sandbox-images-jr2-injects-the-harness.md +196 -0
  235. package/docs/reference/decisions/0038-jr2-up-builds-every-image-it-deploys.md +170 -0
  236. package/docs/reference/decisions/0039-image-garbage-collects-by-reachability.md +115 -0
  237. package/docs/reference/decisions/0041-a-build-the-host-already-holds-is-not-spent-again.md +64 -0
  238. package/docs/reference/decisions/0042-ready-is-not-routable-an-admission-retries-its-connection.md +142 -0
  239. package/docs/reference/decisions/0043-the-kit-is-tested-as-installed-a-local-registry-stands-in-for-npm.md +170 -0
  240. package/docs/reference/decisions/0044-kit-images-live-at-a-canonical-home-a-self-host-mirrors-it.md +85 -0
  241. package/docs/reference/decisions/0045-the-platform-joins-the-image-address-and-the-cluster-chooses-it.md +82 -0
  242. package/docs/reference/decisions/0046-a-converge-failure-carries-its-diagnosis.md +34 -0
  243. package/docs/reference/decisions/0047-the-git-ssh-key-source-is-the-users-choice.md +47 -0
  244. package/docs/reference/decisions/0048-the-orchestrator-boots-without-its-repos.md +36 -0
  245. package/docs/reference/decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md +126 -0
  246. package/docs/reference/decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md +73 -0
  247. package/docs/reference/decisions/0051-a-repo-is-a-slot-on-the-workspace-and-a-cache-on-the-node.md +227 -0
  248. package/docs/reference/decisions/0052-a-sandbox-lands-where-an-ordinary-pod-lands-and-the-cache-follows-it.md +81 -0
  249. package/docs/reference/decisions/0053-a-fetch-inside-the-pod-asks-the-node-cache-and-the-cache-asks-the-remote.md +111 -0
  250. package/docs/reference/decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md +126 -0
  251. package/docs/reference/decisions/0055-a-release-is-a-pushed-tag-and-the-publish-guard-is-the-credential.md +107 -0
  252. package/docs/reference/decisions/0056-a-global-jr2-hands-off-to-the-instances-own-and-an-instance-has-one-kit-version.md +62 -0
  253. package/docs/reference/decisions/0057-a-turn-is-its-frame-its-dials-and-whether-it-continues.md +152 -0
  254. package/docs/reference/decisions/0058-a-harness-answers-the-orchestrator-alone.md +106 -0
  255. package/docs/reference/decisions/0059-a-harness-holds-stand-ins-and-the-custodian-holds-the-keys.md +384 -0
  256. package/docs/reference/decisions/0060-a-workspace-states-its-size-and-jr2-reserves-all-of-it.md +111 -0
  257. package/docs/reference/decisions/0061-a-memory-kill-ends-the-agents-processes-not-the-harness.md +83 -0
  258. package/docs/reference/decisions/0062-jr2-briefs-the-agent-on-its-seat-never-on-its-task.md +212 -0
  259. package/docs/reference/decisions/0063-the-orchestrator-watches-the-cluster.md +83 -0
  260. package/docs/reference/decisions/0064-a-workspace-waits-for-capacity.md +79 -0
  261. package/docs/reference/decisions/0065-a-persist-survives-a-crash-and-history-is-a-week.md +65 -0
  262. package/docs/reference/decisions/0066-a-model-tier-runs-a-real-model-and-a-change-to-what-it-reads-runs-the-tier.md +550 -0
  263. package/docs/reference/decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md +430 -0
  264. package/docs/reference/decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md +464 -0
  265. package/docs/reference/decisions/0069-the-orchestrator-is-a-kit-image-and-an-instance-publishes-its-assembly.md +180 -0
  266. package/docs/reference/decisions/0070-a-machine-lends-its-parts-to-a-chart.md +323 -0
  267. package/docs/reference/decisions/0071-a-run-starts-a-run-through-a-dispatch-effect.md +183 -0
  268. package/docs/reference/decisions/0072-the-docs-ship-inside-the-kit-and-an-instances-agents-md-indexes-them.md +144 -0
  269. package/docs/reference/decisions/0073-a-machine-fails-a-run-with-fail-and-an-uncaught-failure-ends-it-failed.md +122 -0
  270. package/docs/reference/decisions/0074-an-unrouted-mechanism-event-is-refused-at-load-and-faults-the-run.md +76 -0
  271. package/docs/reference/decisions.md +83 -0
  272. package/docs/reference/glossary.md +648 -0
  273. package/docs/reference/http-api.md +1348 -0
  274. package/docs/reference/machines.md +190 -0
  275. package/docs/reference/mechanism-events.md +72 -0
  276. package/docs/why.md +206 -0
  277. package/package.json +5 -3
  278. package/src/actor.ts +541 -79
  279. package/src/agent.ts +114 -38
  280. package/src/ambient.ts +2 -1
  281. package/src/assembly-checks.ts +189 -7
  282. package/src/cause.ts +234 -0
  283. package/src/chart.ts +169 -37
  284. package/src/charts.ts +34 -6
  285. package/src/config.ts +430 -178
  286. package/src/custodian.ts +74 -22
  287. package/src/customize.ts +188 -46
  288. package/src/dispatch-effect.ts +945 -0
  289. package/src/door-compat.ts +217 -0
  290. package/src/durability.ts +11 -4
  291. package/src/effect.ts +341 -44
  292. package/src/effector-wire.ts +160 -11
  293. package/src/fail.ts +209 -0
  294. package/src/harness-client.ts +541 -47
  295. package/src/http-effect.ts +495 -53
  296. package/src/http.ts +427 -16
  297. package/src/index.ts +60 -82
  298. package/src/instance.ts +68 -8
  299. package/src/internal.ts +84 -0
  300. package/src/machine-doc.ts +21 -3
  301. package/src/mechanism-routes.ts +168 -0
  302. package/src/model-keys.generated.ts +53 -0
  303. package/src/model-keys.ts +18 -58
  304. package/src/notices.ts +66 -13
  305. package/src/open-body.ts +159 -23
  306. package/src/open-effect.ts +81 -8
  307. package/src/open.ts +59 -6
  308. package/src/parts.ts +184 -13
  309. package/src/party.ts +68 -2
  310. package/src/pick.ts +463 -11
  311. package/src/pool.ts +247 -36
  312. package/src/registration.ts +83 -4
  313. package/src/repos.ts +2 -1
  314. package/src/run-host.ts +565 -31
  315. package/src/run-output.ts +38 -0
  316. package/src/sandbox-effect.ts +273 -38
  317. package/src/sandbox-kube.ts +3 -1
  318. package/src/secret-placement.ts +52 -17
  319. package/src/server.ts +3 -0
  320. package/src/setup.ts +239 -56
  321. package/src/size.ts +121 -9
  322. package/src/snapshot-store.ts +54 -10
  323. package/src/stub-harness.ts +44 -16
  324. package/src/timers.ts +14 -1
  325. package/src/vocabulary.ts +69 -14
  326. package/src/wire.ts +90 -16
  327. package/src/workspace.ts +697 -175
@@ -0,0 +1,318 @@
1
+ ---
2
+ title: Write a Workflow
3
+ description: Write a module in workflows/ that exports a Machine, with the input that starts a run and its Vocabulary.
4
+ ---
5
+
6
+ # Write a Workflow
7
+
8
+ Write a module in `workflows/` that exports a [Machine](../reference/glossary.md#machine), so that the
9
+ [Instance](../reference/glossary.md#instance) registers it as a [Workflow](../reference/glossary.md#workflow).
10
+
11
+ The module contract has three parts:
12
+
13
+ - The file is `workflows/<name>.ts`. `<name>` is the name of the Workflow. `jr2 run <name>` starts it.
14
+ - The file exports its Machine as `machine`. jr2 reads no other export.
15
+ - The Machine holds all that it needs: its [Vocabulary](../reference/glossary.md#vocabulary), its
16
+ [Agents](../reference/glossary.md#agent), its [Effects](../reference/glossary.md#effect) and its
17
+ [Sandbox Image](../reference/glossary.md#sandbox-image). The Workflow is only a name for it.
18
+
19
+ ## The example
20
+
21
+ This module is the Workflow `rollout`. A run waits at a [Gate](../reference/glossary.md#gate) until a person sends
22
+ `promote` or `roll_back`. It has no Agent, so you can try it with no model. Save it as `workflows/rollout.ts`:
23
+
24
+ ```ts
25
+ import { assign, emit } from "xstate";
26
+ import { z } from "zod";
27
+ import { defineEvent, fail, jr2Setup, type HostInjectedInput } from "@jr2/orchestrator";
28
+
29
+ // The door: the input that starts a run. jr2 checks each start against this schema.
30
+ const runInput = z.object({
31
+ service: z.string().min(1).describe("The service to roll out."),
32
+ version: z.string().min(1).describe("The version to roll out."),
33
+ // A field with a default is optional for the caller. The run starts with the default.
34
+ canaryPercent: z.number().int().min(1).max(50).default(10).describe("The percent of hosts in the canary."),
35
+ });
36
+ type RunInput = z.infer<typeof runInput>;
37
+
38
+ // jr2 adds instanceId to the input of the root Machine of a run. No caller sends it.
39
+ type Input = RunInput & HostInjectedInput;
40
+ type Context = Input & { reason?: string };
41
+
42
+ // The Vocabulary: the events that this Machine takes. Here, a person sends them to the Gate.
43
+ const promote = defineEvent({
44
+ name: "promote",
45
+ description: "The canary is healthy. Roll out the version to all hosts.",
46
+ input: z.object({}),
47
+ });
48
+ const rollBack = defineEvent({
49
+ name: "roll_back",
50
+ description: "Stop the rollout. Say why.",
51
+ input: z.object({ reason: z.string().min(1) }),
52
+ });
53
+
54
+ // jr2 reads only this export. The file name, rollout.ts, gives the Workflow its name: rollout.
55
+ export const machine = jr2Setup({
56
+ types: {} as {
57
+ input: Input;
58
+ context: Context;
59
+ emitted: { type: "decided"; promoted: boolean };
60
+ },
61
+ events: [promote, rollBack],
62
+ actors: { fail: fail() },
63
+ }).createMachine({
64
+ id: "rollout",
65
+ input: runInput,
66
+ context: ({ input }) => ({ ...input }),
67
+ initial: "canary",
68
+ states: {
69
+ // A Gate. The run waits here until a person sends promote or roll_back.
70
+ canary: {
71
+ invoke: {
72
+ src: "gate",
73
+ input: ({ context }) => ({
74
+ meta: {
75
+ service: context.service,
76
+ version: context.version,
77
+ canaryPercent: context.canaryPercent,
78
+ instanceId: context.instanceId,
79
+ },
80
+ }),
81
+ },
82
+ on: {
83
+ promote: { target: "promoted", actions: emit({ type: "decided", promoted: true }) },
84
+ roll_back: {
85
+ target: "rolledBack",
86
+ actions: [assign({ reason: ({ event }) => event.reason }), emit({ type: "decided", promoted: false })],
87
+ },
88
+ },
89
+ },
90
+ promoted: { type: "final" },
91
+ // A person stopped the rollout, and the run ends here. Not a final state: the run ends `failed`,
92
+ // with the person's reason, and `jr2 run` exits 1.
93
+ rolledBack: { invoke: { src: "fail", input: ({ context }) => ({ reason: context.reason! }) } },
94
+ },
95
+ });
96
+ ```
97
+
98
+ The parts of the module:
99
+
100
+ - **The door.** The `input` of `createMachine` is a zod object. It is the input that starts a run. jr2 examines each
101
+ start against it, and it starts the run with the input that zod parsed. Thus `canaryPercent` gets its default when the
102
+ caller does not send it. Give the same type to `types.input`, with `z.infer`, so that TypeScript and jr2 agree.
103
+ - **`instanceId`.** jr2 adds `instanceId` to the input of the root Machine of a run. Add
104
+ [`HostInjectedInput`](../reference/authoring-surface/type-hostinjectedinput.md) to the input type when the Machine
105
+ reads it. Do not put it in the door. No caller sends it.
106
+ - **The Vocabulary.** Make each event with [`defineEvent`](../reference/authoring-surface/defineevent.md), and list it
107
+ in the `events` of [`jr2Setup`](../reference/authoring-surface/jr2setup.md). Write its name as an `on` key on each
108
+ state that takes it.
109
+ - **The Gate.** The state `canary` invokes `gate`. The Gate takes the events of the `on` keys of that state. Its `meta`
110
+ is the data that `jr2 status` and the [Console](../reference/glossary.md#console) show to the person who answers.
111
+ - **The [Emit](../reference/glossary.md#emit).** `emit()` tells the people who watch the run what happened. It does not
112
+ move the Machine. Declare its type in `types.emitted`.
113
+
114
+ A Machine with a door uses `jr2Setup`, also when it takes no workflow event. Then leave out `events`, as in
115
+ `jr2Setup()`. The `setup()` of [xstate](https://xstate.js.org) does not read the `input` of `createMachine`. TypeScript
116
+ accepts a zod `input` there, but no door reads it, so `jr2 up` refuses that Machine. Without the refusal, a run would
117
+ start with any input, and the Console start form would be only a field for JSON. Only a Machine with no door and no
118
+ workflow event can use `setup()`, as the `ping` Workflow that `jr2 init` writes does.
119
+
120
+ ## Give the run an output
121
+
122
+ The output of a run is the `output` at the root of `createMachine`, beside `id` and `states`. The status of the run
123
+ shows it as `output`. When a different Machine invokes this Machine, the `onDone` of that invoke gets it as
124
+ `event.output`. The `rollout` example has no root `output`. Thus a run of it that ends `done` has no output, and its
125
+ result is only in its `context`.
126
+
127
+ xstate does not use the `output` of a final state as the output of the Machine. It gives that output to the root
128
+ `output` as `event.output`. Thus a Machine that has an `output` only on its final states has no output. TypeScript does
129
+ not find this error, but `createMachine` refuses it when the module loads (see [the refusal](#rules)). Write the root
130
+ `output` in one of these two forms:
131
+
132
+ - From the context: `output: ({ context }) => ({ reason: context.reason })`.
133
+ - From the final state that ended the run: `output: ({ event }) => event.output as Output`, with an `output` on each
134
+ final state. The example of [Gates](../concepts/gates.md) does this.
135
+
136
+ Give the same type to `types.output`.
137
+
138
+ A final state inside a compound state can have an `output` without a root `output`. The `onDone` of that compound state
139
+ gets it as `event.output`. A Machine with no `output`, such as `rollout`, is also correct.
140
+
141
+ ## Fail the run
142
+
143
+ A final state means that the work succeeded: the run ends `done`. When the Machine could not do its work, invoke
144
+ [`fail`](../reference/authoring-surface/fail.md) from a state. Put it under `actors` as `fail: fail()`, and give it a
145
+ `reason`:
146
+
147
+ ```ts
148
+ failed: { invoke: { src: "fail", input: { reason: "the tests did not pass", detail: { code: 1 } } } },
149
+ ```
150
+
151
+ The run ends `failed`, and its output is the `{ reason, detail }` of the [Failure](../reference/glossary.md#failure).
152
+ `jr2 run` exits with `1`. Do not throw from a promise to fail. A throw is a defect: the run ends `error`, with no
153
+ output, and nobody can tell it from a bug in the kit. A Failure deletes the Sandbox of each `workspace()` that it goes
154
+ through. To keep the work for a person to read, wait at a Gate before the state that fails.
155
+
156
+ The same rule applies to the decision of a person. A decision that sends the work back, such as a `reject` that goes
157
+ back to the coder, is a usual route. A decision that ends the run, such as `roll_back` in `rollout` or a `reject` at a
158
+ Gate, goes to a state that invokes `fail` with the reason of the person, as `rolledBack` does. Do not put a
159
+ `{ outcome: "rejected" }` in the output type for it. When the job of the Machine is the decision itself, such as a
160
+ triage where "no" is a correct answer, the decision is a final state, and the Machine puts the decision in its output.
161
+
162
+ A Failure goes up through each parent Machine. To catch it, guard an `onError` with
163
+ [`isFailure`](../reference/authoring-surface/isfailure.md):
164
+ `onError: [{ guard: ({ event }) => isFailure(event.error), target: "replan" }, { target: "broken" }]`.
165
+ [How a run ends](../concepts/machines-and-workflows.md#how-a-run-ends) tells more.
166
+
167
+ ## Register it and run it
168
+
169
+ Run [`jr2 up`](../reference/cli.md#up) in the Instance folder. `jr2 up` typechecks the Instance, then loads each module
170
+ in `workflows/` before it changes the cluster. An error in a module stops it. The
171
+ [Orchestrator](../reference/glossary.md#orchestrator) runs only the Machines that the last `jr2 up` gave it.
172
+ [Iterate on a Machine on kind](iterate-on-a-machine-on-kind.md) gives the loop.
173
+
174
+ ```sh
175
+ jr2 up
176
+ ```
177
+
178
+ Start a run in one terminal. The run waits at the Gate, so `jr2 run` stays attached. The output uses the kind cluster
179
+ `jr2` and the Instance `my-instance` from [Get started](../get-started/install.md):
180
+
181
+ ```sh
182
+ jr2 run rollout --input '{"service":"billing","version":"1.4.0"}'
183
+ ```
184
+
185
+ ```text
186
+ → context kind-jr2 / namespace my-instance
187
+ run b7c3d871-e3ae-46af-8bb3-774913bcd6cc (rollout) — attached
188
+ → active "canary"
189
+ ```
190
+
191
+ Your run id is different. When your Instance folder has a `.env` file, the output starts with one more line, `→ .env:`,
192
+ with the keys that the CLI took from it. In a second terminal, answer the Gate. Write the run id in place of `<run id>`,
193
+ or its first 4 characters or more:
194
+
195
+ ```sh
196
+ jr2 send <run id> --gate canary --event roll_back --input '{"reason":"The error rate went up."}'
197
+ ```
198
+
199
+ ```text
200
+ → context kind-jr2 / namespace my-instance
201
+ delivered roll_back to gate "canary" on b7c3d871-e3ae-46af-8bb3-774913bcd6cc
202
+ ```
203
+
204
+ In the first terminal, the run ends. A `roll_back` ends the rollout, so the run ends `failed`, with the reason of the
205
+ person as its output, and `jr2 run` exits with `1`. Its `context` holds the default of `canaryPercent`, the `instanceId`
206
+ that jr2 added, and the `reason`:
207
+
208
+ ```text
209
+ emit {"type":"decided","promoted":false}
210
+ → active "rolledBack"
211
+ → failed "rolledBack"
212
+ failed: The error rate went up.
213
+ {"runId":"b7c3d871-e3ae-46af-8bb3-774913bcd6cc","workflow":"rollout","instanceId":"b79e7e8b-6289-4dbc-a9a3-be945f8b1173","status":"failed","value":"rolledBack","context":{"service":"billing","version":"1.4.0","canaryPercent":10,"instanceId":"b79e7e8b-6289-4dbc-a9a3-be945f8b1173","reason":"The error rate went up."},"children":[],"waiting":[],"held":[],"assembly":"83858e28b054","output":{"reason":"The error rate went up."}}
214
+ ```
215
+
216
+ Your instance id and your `assembly` hash are different.
217
+
218
+ [Start a run](start-a-run.md) gives the other ways to start a run. [Answer a Gate](answer-a-gate.md) gives the other
219
+ ways to answer one.
220
+
221
+ ## Put shared code in a file that jr2 does not register
222
+
223
+ jr2 registers each `.ts` file in `workflows/`, also a file that a different Workflow imports. It does not register a
224
+ file whose name starts with `_`, or a `.d.ts` file. Thus put the code that two Workflows share in a file such as
225
+ `workflows/_events.ts`, or outside `workflows/`. Import it with its `.ts` extension:
226
+ `import { promote } from "./_events.ts";`.
227
+
228
+ ## Rules
229
+
230
+ - `jr2 up` changes nothing when the Instance does not typecheck. It prints
231
+ `refusing: this instance does not typecheck — nothing was built and nothing was applied`, then each line of the output
232
+ of the compiler.
233
+ - `npm run typecheck` does not find a refusal of `defineEvent`, `createMachine` or `workspace()`. These refusals occur
234
+ when a module loads. `jr2 up` loads each module after the typecheck and before it connects to the cluster, so a
235
+ refusal stops it before it changes the cluster.
236
+ - Run [`jr2 check`](../reference/cli.md#check) (`npm run check` in the scaffold) to find these errors without a cluster.
237
+ It runs the typecheck and the load of each module that `jr2 up` runs first, with the same code, and it gives the same
238
+ refusals. It exits with `1` when it refuses. Run it before you say that a change is done. Do not import a workflow
239
+ module with `node`: in an installed Instance, `node` cannot load the Kit, because the Kit is TypeScript under
240
+ `node_modules`. The `jr2` binary can.
241
+ - The name of a Workflow file has lower-case letters, digits and `-`, such as `release-notes.ts`. `jr2 up` refuses a
242
+ different name, and gives the name to use:
243
+ ``error: <folder>/workflows/<file>.ts: a Workflow is named by its filename stem, in lowercase letters, digits and "-", so that `jr2 run` and a `dispatch` slot name it the same way — rename it to <name>.ts (ADR-0071)``
244
+ - `jr2 up` refuses a module with no `machine` export. It prints the error and exits with `1`:
245
+ ``error: workflow "<name>" (<file>) has no `machine` named export (module contract, ADR-0011/0015: `export const machine`)``
246
+ - `defineEvent` refuses a name with a character other than a letter, a digit, `_` or `-`:
247
+ `defineEvent: invalid name "<name>" — must match /^[a-zA-Z0-9_-]+$/ (it becomes an MCP tool name and an xstate event type)`
248
+ - `defineEvent` refuses an input with a `sender` field:
249
+ ``defineEvent: "<name>" declares `sender` in its input — the Orchestrator writes that field on every delivered event (who sent it); name the payload field something else``
250
+ - `createMachine` refuses an `on` key that no listed event has. The compiler does not always find this error.
251
+ `jr2 check` and `jr2 up` find it when they load the module:
252
+ `machine "<id>" handles event "<key>", which no def in jr2Setup({ events }) declares (declared: <names>) — a typo, or a missing defineEvent`.
253
+ An `on` key with a `.` is a jr2 or xstate event, such as `agent.fault`, and you do not list it.
254
+ - `createMachine` refuses a listed event that no state takes:
255
+ `machine "<id>" declares "<name>", which no state handles — a pick no state takes is on no Menu and no Gate: handle it, or drop it from jr2Setup({ events })`
256
+ - `createMachine` refuses an entry of `events` that `defineEvent` did not make, and a name that you list two times:
257
+ ``machine "<id>": `events` entry is not a defineEvent() def: <entry>`` and
258
+ `` machine "<id>": duplicate event "<name>" in `events` ``
259
+ - `createMachine` refuses an `agent()`, an Effect or a `workspace()` that a state writes in its `invoke.src`. Put it
260
+ under `actors`, and invoke it by its key:
261
+ `machine "<id>": state "<state>" invokes <part> inline — a Part is a key of actors, so it has a name that the ledger, the report and customize() share: actors: { <name>: <factory>(...) }, then invoke: { src: "<name>" }`
262
+ - `jr2 up` refuses a registered Machine that has a zod `input` if `setup()` or `createMachine()` of xstate made the
263
+ Machine in place of `jr2Setup`. The compiler does not find this error:
264
+ ``refusing: workflow "<workflow>": machine "<id>" has a zod `input` on createMachine, but jr2Setup did not make this Machine, so no door reads that input: a run starts with any input, and the Console start form is only a field for JSON — make the Machine with jr2Setup in place of setup() or createMachine() (leave out `events` if it takes no workflow event) (ADR-0033)``.
265
+ The Orchestrator refuses a publish of that Machine with the same line.
266
+ - `createMachine` refuses an `output` on a final state directly below the root when the root has no `output`, because
267
+ the run then has no output (see [Give the run an output](#give-the-run-an-output)). Move the `output` to the root, or
268
+ pass it on from the root:
269
+ `machine "<id>": final state "<state>" declares an output, and the root has no output — xstate v5 gives a run only its root output, so this output reaches nothing and the run ends with none: write it at the root, as output: ({ context }) => ..., or keep it on the final state and pass it on with output: ({ event }) => event.output at the root`.
270
+ With more than one such final state, the refusal names each one and puts the words in the plural:
271
+ `final states "<state>", "<state>" declare an output`, `these outputs reach nothing`, `write one at the root` and
272
+ `keep them on the final states and pass them on`. `jr2 check` and `jr2 up` also refuse this in a Machine that you make
273
+ with the `setup()` of xstate, and in a child Machine.
274
+ - `createMachine` refuses a state that invokes an Agent when no `agent.fault` route is on that state or on a state above
275
+ it. jr2 sends `agent.fault` when the Turn of the Agent cannot go on. Route it on the state, or one time on the root:
276
+ `machine "<id>": state "<state>" invokes an Agent, and no route for "agent.fault" is on it or on a state above — jr2 sends agent.fault when the Agent's Turn cannot go on, and with no route the run faults: route it on that state or on a state above it, as on: { "agent.fault": "<the state that handles it>" } (ADR-0074)`.
277
+ With more than one such state, the refusal names each one: `states "<state>", "<state>" invoke an Agent` and
278
+ `is on them`. A state that invokes an [Open body](../concepts/charts.md) that lends an Agent or allows a model gets
279
+ the same refusal, with `invokes an Open body that can run an Agent`: the Open body sends the `agent.fault` of a
280
+ Chart's Agent that the Chart does not route to the Machine. `jr2 check` and `jr2 up` also refuse this in a Machine
281
+ that you make with the `setup()` of xstate, and in a child Machine.
282
+ - `workspace()` refuses a body with a state that is not final when no `workspace.lost` route is on that state or on a
283
+ state above it. `workspace()` sends `workspace.lost` to the body when its Sandbox is gone. Route it on the root of the
284
+ body:
285
+ `workspace(): the body "<id>" has a state "<state>" that is not final, and no route for "workspace.lost" is on it or on a state above — jr2 sends workspace.lost to the body when its Sandbox is gone, and with no route the run faults: route it on the body's root, as on: { "workspace.lost": "<the state that handles it>" } (ADR-0074)`.
286
+ A compound state whose final child has no `onDone` is a state that the body stays in, so it needs the route too.
287
+ - When a run gets `agent.fault` or `workspace.lost` and no transition takes it, for example because the guard of its
288
+ route is false, the run ends `error`. Its fault names the event, the state and the reason (ADR-0074).
289
+ - `fail` refuses an input that has no `reason`, or a `reason` that is empty. The compiler finds a missing `reason`, but
290
+ not an empty one. The run ends `error`, and its fault is:
291
+ `fail: the input must be { reason: string; detail?: unknown } with a reason that is not empty (got <value>) — invoke: { src: "fail", input: { reason: "the tests failed" } } (ADR-0073)`.
292
+ - `workspace()` refuses a body that declares a door. Declare the door with the `input` option of `workspace()`:
293
+ ``workspace(): the body "<id>" declares its own run input, which nothing will ever serve or enforce — the wrapper feeds the body the run input PLUS the injected `workspace` handles, so the body's schema is not the door. Move it to the wrapper: workspace(body, { input, spec }) (ADR-0033).``
294
+ - `jr2 up` prints each refusal of `defineEvent`, `createMachine` and `workspace()` as `error: <refusal>`, and exits with
295
+ `1`. It changes nothing in the cluster.
296
+ - The Orchestrator refuses a start whose input does not agree with the door, with the status code `400`:
297
+ `invalid input for workflow "<workflow>": <issues>`. `<issues>` is the list of the problems as JSON. `jr2 run` prints
298
+ `error: invalid input for workflow "<workflow>": <issues>` and exits with `1`. No run starts.
299
+ - The Orchestrator refuses a name that no file in `workflows/` registers, with the status code `404`:
300
+ `no workflow registered as "<workflow>"`.
301
+
302
+ ## Read next
303
+
304
+ - [Machines and Workflows](../concepts/machines-and-workflows.md)
305
+ - [ADR-0011](../reference/decisions/0011-workflow-defined-events.md): the events are the Workflow's, and jr2 delivers
306
+ them.
307
+ - [ADR-0015](../reference/decisions/0015-authoring-surface-absorbs-the-mechanism.md): `jr2Setup`, the Vocabulary and the
308
+ module contract.
309
+ - [ADR-0033](../reference/decisions/0033-a-machine-declares-the-input-that-starts-it.md): the door.
310
+ - [ADR-0050](../reference/decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md): jr2
311
+ finds a Workflow by its file name.
312
+ - [Gates](../concepts/gates.md) and [The Menu](../concepts/the-menu.md)
313
+ - [Set an Agent's access and Dials](set-an-agents-access-and-dials.md), to add an Agent to the Machine.
314
+ - [Bind a shipped Machine's Open parts](bind-open-parts.md), to register a Machine from a package.
315
+ - Reference: [`jr2Setup`](../reference/authoring-surface/jr2setup.md),
316
+ [`defineEvent`](../reference/authoring-surface/defineevent.md),
317
+ [`HostInjectedInput`](../reference/authoring-surface/type-hostinjectedinput.md),
318
+ [`GET /workflows/:name`](../reference/http-api.md#get-workflows-name)
package/docs/index.md ADDED
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: Home
3
+ description: jr2 is a Kit for agentic workflows. You write each one as an xstate Machine, and jr2 runs it.
4
+ ---
5
+
6
+ # Home
7
+
8
+ jr2 is a Kit for agentic workflows. Each workflow is written as an [xstate](https://xstate.js.org)
9
+ [Machine](https://stately.ai/docs/machines), and jr2 runs it on Kubernetes. An [Agent](reference/glossary.md#agent) that
10
+ works on a [Repo](reference/glossary.md#repo) works in a [Sandbox](reference/glossary.md#sandbox): a pod with its own
11
+ filesystem, network and processes. Your [Assistant](reference/glossary.md#assistant) writes the Machines, and you review
12
+ the graph.
13
+
14
+ jr2 supports two primary patterns for making Agent-enabled workflows. You can let the Machine decide the order of the
15
+ work, and give each Agent one step of it in a [Turn](reference/glossary.md#turn). Or an Agent can decide when each step
16
+ runs, and the Machine runs that step and limits the next choices
17
+ ([how to choose](concepts/the-menu.md#keep-the-turn-or-end-it)). In both patterns, the Machine sets what each step does.
18
+ An Agent can also write a [Chart](reference/glossary.md#chart), much like a "dynamic workflow": jr2 checks it against
19
+ the parts that your Machine lends it, and then executes it at runtime.
20
+
21
+ ## Start in three commands
22
+
23
+ These commands install the jr2 CLI, make an [Instance](reference/glossary.md#instance) in the folder `my-instance`, and
24
+ converge it into the cluster of your current kubectl context. First, install the tools and make the kind cluster, as
25
+ [Install](get-started/install.md) tells you:
26
+
27
+ ```sh
28
+ npm i -g @jr2/cli
29
+ jr2 init my-instance && cd my-instance && npm install
30
+ jr2 up
31
+ ```
32
+
33
+ `jr2 init` writes one [Workflow](reference/glossary.md#workflow), `ping`, that runs with no model. The Get started
34
+ tutorial gives these steps one at a time, and then runs `ping`.
35
+
36
+ ## Where to go next
37
+
38
+ - [Why jr2](why.md) shows the parts of jr2, gives the problems that each part solves, and follows one run through them.
39
+ - [Get started](get-started/install.md) is a tutorial. It goes from the install to a branch that an Agent fixed and that
40
+ you approved.
41
+ - [Concepts](concepts/machines-and-workflows.md) explains each idea of jr2. For the picture of what runs where, read
42
+ [Architecture](concepts/architecture.md).
43
+ - [Guides](guides/start-a-run.md) gives the steps for one task on each page.
44
+ - [Reference](reference/authoring-surface.md) gives each export, config field, command and HTTP route, from the code.
package/docs/llms.txt ADDED
@@ -0,0 +1,216 @@
1
+ # jr2
2
+
3
+ > A kit for agentic workflows as xstate Machines, run on Kubernetes. These are the docs of Kit version 0.5.1, as plain Markdown.
4
+
5
+ ## Home
6
+
7
+ - [Home](index.md): jr2 is a Kit for agentic workflows. You write each one as an xstate Machine, and jr2 runs it.
8
+
9
+ ## Why jr2
10
+
11
+ - [Why jr2](why.md): The parts of jr2, the problems of agentic workflows that each part solves, and one run through them.
12
+
13
+ ## Get started
14
+
15
+ - [Install](get-started/install.md): Install the tools that jr2 needs and the jr2 CLI, and make a kind cluster on your computer.
16
+ - [Create an Instance](get-started/create-an-instance.md): Make an Instance folder, converge it into the kind cluster, run its first Workflow, and open the Console.
17
+ - [Connect a model](get-started/connect-a-model.md): Add a model to the Instance, with its key or its address in .env, and converge the Instance again.
18
+ - [A model decides](get-started/a-model-decides.md): Write a Workflow in which a model chooses the next state, and answer its question at a Gate.
19
+ - [An Agent in a Sandbox](get-started/an-agent-in-a-sandbox.md): A coder Agent fixes a bug in your fork of jr2, in a Sandbox. You push its branch, and approve.
20
+ - [Have your Assistant write a Machine](get-started/have-your-assistant-write-a-machine.md): Ask your Assistant for a Machine, read its graph in the Console, then run it and approve the push.
21
+
22
+ ## Concepts
23
+
24
+ - [Machines and Workflows](concepts/machines-and-workflows.md): What a Machine and a Workflow are, the door of a run, the Vocabulary, and Emits.
25
+ - [Agents and Turns](concepts/agents-and-turns.md): What an Agent is, what one Turn of an Agent holds, how a Turn ends, and what jr2 does when a Turn fails.
26
+ - [The Menu](concepts/the-menu.md): How an Agent picks from the events that its Machine takes, and how the Machine decides what each pick does.
27
+ - [Gates](concepts/gates.md): How a run waits for an event from a person, the CLI, the Console, a webhook or a CI job.
28
+ - [Effects](concepts/effects.md): How a Machine runs a command, calls a URL, pushes a branch or starts a run, at most once.
29
+ - [Workspaces](concepts/workspaces.md): How a Workflow gets a Sandbox with a git Worktree or a shared folder, and how long it keeps it.
30
+ - [Composition](concepts/composition.md): How a Machine composes Machines that you import, and how you bind the parts that they leave Open.
31
+ - [Charts](concepts/charts.md): How an Agent writes a Machine as data at run time, which cannot reach the process of the Orchestrator.
32
+ - [Pools and Sources](concepts/pools-and-sources.md): How a Pool runs one worker Machine for each work item that a Source gives, and how its run ends.
33
+ - [Architecture](concepts/architecture.md): What runs on your computer, in the cluster and in a Sandbox, and which part does what.
34
+ - [Secrets and trust](concepts/secrets-and-trust.md): Where jr2 keeps each credential, which tokens it makes, and what a caller can see and do without one.
35
+ - [Converge](concepts/converge.md): What jr2 up makes in the cluster from your Instance folder, and the Assembly that it publishes.
36
+ - [Durable runs](concepts/durable-runs.md): How a run survives a restart of the Orchestrator, what ends it, and how long jr2 keeps a run that ended.
37
+
38
+ ## Guides
39
+
40
+ - [Start a run](guides/start-a-run.md): Start a run of a Workflow from the CLI, from the Console, or with a call to the HTTP API.
41
+ - [Answer a Gate](guides/answer-a-gate.md): Send an event to an open Gate of a run, from the CLI, the Console, a webhook handler or a CI job.
42
+ - [Watch a run](guides/watch-a-run.md): See where a run is and what its Agents do: in the CLI, in the Console, and in the pod log.
43
+ - [Look inside a Sandbox](guides/look-inside-a-sandbox.md): Open a shell in the Sandbox of a run, and read the branch that its Agent works on.
44
+ - [Cancel a run](guides/cancel-a-run.md): End a live run with CANCEL, and delete its Sandboxes or keep them to look inside.
45
+ - [Open the Console](guides/open-the-console.md): Forward the port of the Orchestrator, open the Console, and unlock it with the Instance token.
46
+ - [Use a local model](guides/use-a-local-model.md): Connect your Agents to a model on an OpenAI-compatible endpoint, with or without TLS and a key.
47
+ - [Use a hosted provider or a gateway](guides/use-a-hosted-provider.md): Give your Agents a model from a hosted provider, directly or through a gateway.
48
+ - [Give the cluster git credentials](guides/give-the-cluster-git-credentials.md): Give the cluster a token or an ssh key to clone and push your Repos, and choose which Repos a run can name.
49
+ - [Move from kind to a shared cluster](guides/move-from-kind-to-a-shared-cluster.md): Converge an Instance into a shared cluster, with a registry, Sandbox nodes, priority classes and a quota.
50
+ - [Mirror the Kit images](guides/mirror-the-kit-images.md): Copy the Kit images and the Pinned image into your own registry, and make the cluster pull them from there.
51
+ - [Upgrade the Kit version](guides/upgrade-the-kit-version.md): Move an Instance to a new Kit version. jr2 up converges it and updates the jr2 block in AGENTS.md.
52
+ - [Clean up](guides/clean-up.md): Remove old images and unused Repo resources with jr2 gc, and remove an Instance with jr2 down.
53
+ - [Fix a failed converge](guides/fix-a-failed-converge.md): Read what jr2 up prints when it refuses or fails, and fix the cause.
54
+ - [Iterate on a Machine on kind](guides/iterate-on-a-machine-on-kind.md): Change a Machine, converge the change into your kind cluster, and run it again.
55
+ - [Write a Workflow](guides/write-a-workflow.md): Write a module in workflows/ that exports a Machine, with the input that starts a run and its Vocabulary.
56
+ - [Bind a shipped Machine's Open parts](guides/bind-open-parts.md): Register a Machine from a package as a Workflow, and bind the parts that it leaves Open with customize().
57
+ - [Set an Agent's access and Dials](guides/set-an-agents-access-and-dials.md): Choose what an Agent can do to the Workspace, and set the Dials and continue of one Turn.
58
+ - [Run a command or call a URL with an Effect](guides/run-a-command-or-call-a-url.md): Run a program or call a URL as an Effect, give it input from a pick, and route on its output.
59
+ - [Push and sign a branch](guides/push-and-sign-a-branch.md): Push the branch of a Workspace, and sign its commits with a key that the Agent never reads.
60
+ - [Start a run from a run](guides/start-a-run-from-a-run.md): Use a dispatch Effect to start a run of a Workflow from a Machine, in this Instance or in a different one.
61
+ - [Add tools to the Sandbox](guides/add-tools-to-the-sandbox.md): Put the programs that your Agents use into the Sandbox Image, or run a service in a User Container.
62
+ - [Size a Workspace](guides/size-a-workspace.md): Give a Workspace the memory and cpu that its Sandbox needs, and see how jr2 divides them in the pod.
63
+ - [Run one worker per item](guides/run-one-worker-per-item.md): Make a Pool that runs one worker Machine for each item that a Source gives, and run it.
64
+ - [Publish a Machine as an npm package](guides/publish-a-machine-as-an-npm-package.md): Ship a Machine in an npm package that names the Kit as a peer, and register it in an Instance.
65
+ - [Let an Agent write a Chart](guides/let-an-agent-write-a-chart.md): Write a Chart wrapper whose planner Agent writes a Chart, runs it, and corrects it.
66
+ - [Run a Chart by name](guides/run-a-chart-by-name.md): Keep a Chart under a name, as a Chart file or a runtime Chart, and run it with jr2 run.
67
+
68
+ ## Reference
69
+
70
+ - [Authoring surface](reference/authoring-surface.md): Every name that @jr2/orchestrator exports from its root, by group, with a link to its page: its signature, its TSDoc, and an example.
71
+ - [`defineEvent`](reference/authoring-surface/defineevent.md): Define one workflow event: an event that an Agent or the caller of a Gate may send into your Machine.
72
+ - [`jr2Setup`](reference/authoring-surface/jr2setup.md): Set up a Machine that takes workflow events: the jr2 form of xstate's `setup()`.
73
+ - [`sentBy`](reference/authoring-surface/sentby.md): A guard that is true for an event that one party sent, and false for an event that another party sent: `guard: sentBy("coder")`.
74
+ - [`HostInjectedInput`](reference/authoring-surface/type-hostinjectedinput.md): The fields that jr2 adds to the input of the Machine that a run starts, beside the input that the caller sent.
75
+ - [`fail`](reference/authoring-surface/fail.md): Fail the run: the Part a Machine invokes to end work that did not succeed.
76
+ - [`isFailure`](reference/authoring-surface/isfailure.md): Is this error a Failure, which a state invoked `fail` to make?
77
+ - [`agent`](reference/authoring-surface/agent.md): Make an Agent: an actor slot that runs one Turn of a model each time a state invokes it.
78
+ - [`AgentDefinition`](reference/authoring-surface/type-agentdefinition.md): An Agent's definition: which model it runs, its instructions, and what it may do to the Workspace.
79
+ - [`ThinkingLevel`](reference/authoring-surface/type-thinkinglevel.md): How hard the model thinks before it answers: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"` or `"xhigh"`.
80
+ - [`workspace`](reference/authoring-surface/workspace.md): Run a body Machine in a Sandbox: a pod of its own, with a Worktree of each Repo Slot on one branch.
81
+ - [`Workspaced`](reference/authoring-surface/type-workspaced.md): The input of a `workspace()` body: the run input, plus `workspace`, the handles that the Workspace adds (`workspace.repos`, `workspace.branch`, `workspace.review`).
82
+ - [`Binding`](reference/authoring-surface/type-binding.md): The repository of a Repo Slot: `{ url, ref }`.
83
+ - [`RepoSlot`](reference/authoring-surface/type-reposlot.md): The value of one Repo Slot in `workspace({ repos })`.
84
+ - [`arg`](reference/authoring-surface/arg.md): Mark one argv entry of a `command` that the input of the Effect fills.
85
+ - [`CommandOutput`](reference/authoring-surface/type-commandoutput.md): The output of a `command` Effect: what the `onDone` of its state gets as `event.output`.
86
+ - [`command`](reference/authoring-surface/command.md): Make a `command` Effect: an actor slot that runs one program in the Workspace's Sandbox when a state invokes it.
87
+ - [`basic`](reference/authoring-surface/basic.md): Make the `auth` of an `http` Effect that sends `Authorization: Basic <value>`, where the value is the base64 of `user:password`.
88
+ - [`bearer`](reference/authoring-surface/bearer.md): Make the `auth` of an `http` Effect that sends `Authorization: Bearer <value>`, with the value of an Effect secret.
89
+ - [`file`](reference/authoring-surface/file.md): Make a Worktree file the body of an `http` Effect: `body: file("dist/report.pdf")`.
90
+ - [`http`](reference/authoring-surface/http.md): Make an `http` Effect: a call to a URL, with Effect secrets that the Agent never reads.
91
+ - [`secret`](reference/authoring-surface/secret.md): Name an Effect secret: `secret("jira")`.
92
+ - [`text`](reference/authoring-surface/text.md): Make a string from literal text and Effect secrets, as a tagged template: `` text`Token ${secret("x")}` ``.
93
+ - [`HttpOutput`](reference/authoring-surface/type-httpoutput.md): The output of an `http` Effect: what the `onDone` of its state gets as `event.output`.
94
+ - [`push`](reference/authoring-surface/push.md): Make a `push` Effect: it pushes the branch of the Workspace to the Binding of its Repo Slot.
95
+ - [`PushOutput`](reference/authoring-surface/type-pushoutput.md): The output of a `push` Effect: what the `onDone` of its state gets as `event.output`.
96
+ - [`dispatch`](reference/authoring-surface/dispatch.md): Make a `dispatch` Effect: it starts a run of a Workflow.
97
+ - [`DispatchOutput`](reference/authoring-surface/type-dispatchoutput.md): The output of a `dispatch` Effect.
98
+ - [`answer`](reference/authoring-surface/answer.md): Set what the Agent reads when jr2 answers its pick.
99
+ - [`fromPick`](reference/authoring-surface/frompick.md): Make the `input` of the invoke of a state that a pick enters: the params of the pick go to the input of the invoked actor by name.
100
+ - [`paramsOf`](reference/authoring-surface/paramsof.md): Read the params of a pick from the event that entered the state.
101
+ - [`open`](reference/authoring-surface/open.md): Leave a part of a Machine Open: for the Instance that registers the Machine to bind with `customize()`.
102
+ - [`customize`](reference/authoring-surface/customize.md): Retune the parts that a Machine carries, without a change to the module that exports it.
103
+ - [`Customize`](reference/authoring-surface/type-customize.md): The parts of one Machine that `customize()` can retune: its Agents, its Open Effects, the Machines it composes, and the Sandbox of its `workspace()`.
104
+ - [`EffectBinding`](reference/authoring-surface/type-effectbinding.md): The values that bind the Open parts of one Effect.
105
+ - [`Size`](reference/authoring-surface/type-size.md): The Size of a Workspace: the most memory and cpu that its whole Sandbox can use.
106
+ - [`UserContainer`](reference/authoring-surface/type-usercontainer.md): The User Container in its object form: its image, and its part of the Workspace's Size.
107
+ - [`pool`](reference/authoring-surface/pool.md): Make a Pool: a Machine that runs one worker Machine for each item that a Source gives, with at most `cap` workers at once.
108
+ - [`source`](reference/authoring-surface/source.md): Declare a Source: where a `pool()` gets its work items, one at a time.
109
+ - [`openBody`](reference/authoring-surface/openbody.md): Make an Open body: the actor slot that a Chart binds.
110
+ - [`OpenBodyDeclaration`](reference/authoring-surface/type-openbodydeclaration.md): What an Open body declares: the parts that it lends a Chart, what the Agents of a Chart can have, and the limits of a Chart.
111
+ - [`OpenBodyOutput`](reference/authoring-surface/type-openbodyoutput.md): The output of an Open body.
112
+ - [`chartSchema`](reference/authoring-surface/chartschema.md): The Chart grammar, as a zod schema.
113
+ - [`chartSchemaFor`](reference/authoring-surface/chartschemafor.md): The Chart grammar for one Open body, as a zod schema.
114
+ - [`defineConfig`](reference/authoring-surface/defineconfig.md): Declare the config of an Instance: the default export of `jr2.config.ts`.
115
+ - [`JR2Config`](reference/authoring-surface/type-jr2config.md): The shape of `jr2.config.ts`: the deployment facts of an Instance, which a Machine cannot carry.
116
+ - [`EventSemantics`](reference/authoring-surface/type-eventsemantics.md): How the party that sends an event gets its answer.
117
+ - [`EventAudience`](reference/authoring-surface/type-eventaudience.md): Who may send an event: `"agent"` (an Agent, as a pick from its Menu), `"external"` (the caller of a Gate), or `"any"` (both).
118
+ - [`EventDef`](reference/authoring-surface/type-eventdef.md): A workflow event, as `defineEvent` gives it back: plain, frozen data and a zod schema, safe to import anywhere.
119
+ - [`WorkflowEvent`](reference/authoring-surface/type-workflowevent.md): The type of `event` in a Machine that `jr2Setup` makes: each workflow event in its `events`, and each Mechanism event.
120
+ - [`FailSlot`](reference/authoring-surface/type-failslot.md): The logic `fail()` returns: `failLogic` with the brand the walk reads.
121
+ - [`Failure`](reference/authoring-surface/type-failure.md): A Failure as `isFailure` narrows an error to it: the payload's fields, on the error itself.
122
+ - [`AgentDeclaration`](reference/authoring-surface/type-agentdeclaration.md): What `agent()` takes: an `AgentDefinition`, except that `model` can also be `open`.
123
+ - [`WorkspaceAccess`](reference/authoring-surface/type-workspaceaccess.md): What an Agent may do to the Workspace: `"write"`, `"read"` or `"none"`.
124
+ - [`WorkspaceOptions`](reference/authoring-surface/type-workspaceoptions.md): The options of a `workspace()` that declares the input that starts a run.
125
+ - [`NoSlotWorkspaceOptions`](reference/authoring-surface/type-noslotworkspaceoptions.md): The options of a `workspace()` with no Repo Slot that declares the input that starts a run.
126
+ - [`WithoutEmptyIndex`](reference/authoring-surface/type-withoutemptyindex.md): The fields of the run input `T`.
127
+ - [`PermissiveWorkspaceOptions`](reference/authoring-surface/type-permissiveworkspaceoptions.md): The options of a `workspace()` with no `input`: it starts with any input.
128
+ - [`PermissiveNoSlotWorkspaceOptions`](reference/authoring-surface/type-permissivenoslotworkspaceoptions.md): The options of a `workspace()` with no Repo Slot and no `input`: it starts with any input.
129
+ - [`WorkspaceHandles`](reference/authoring-surface/type-workspacehandles.md): What the body of a `workspace()` gets as `input.workspace`: the path of each Worktree, and the branch.
130
+ - [`ExecOutcome`](reference/authoring-surface/type-execoutcome.md): How an exec ended.
131
+ - [`Unknown`](reference/authoring-surface/type-unknown.md): The output `{ outcome: "unknown", reason }`: the Effect may have acted, and jr2 cannot tell.
132
+ - [`Arg`](reference/authoring-surface/type-arg.md): One entry of a command's argv that the input of the Effect fills, as `arg("name")` makes it.
133
+ - [`CommandOptions`](reference/authoring-surface/type-commandoptions.md): The options of `command()`: the Repo Slot it runs in, how long it can run, how much of its output it keeps, its Effect secrets, and the commit it runs against.
134
+ - [`CommandInput`](reference/authoring-surface/type-commandinput.md): A command's input: one string per argv slot, and with `pin` the approved commit (`{ sha }`); none when there is neither.
135
+ - [`OpenCommandInput`](reference/authoring-surface/type-opencommandinput.md): The input of a `command(open)`: a string for each `arg()` of the argv that the Instance binds, and with `pin`, the commit (`{ sha }`).
136
+ - [`Secret`](reference/authoring-surface/type-secret.md): What `secret("name")` gives: an Effect secret, by its name in the `secrets` list of `jr2.config.ts`.
137
+ - [`Text`](reference/authoring-surface/type-text.md): What the `text` template gives: a string of literal text and Effect secrets, in order.
138
+ - [`FromInput`](reference/authoring-surface/type-frominput.md): A value of a file body's part: as written, or from the Effect's input.
139
+ - [`FileBody`](reference/authoring-surface/type-filebody.md): `file(path, { slot?, segments?, contentType? })`: a Worktree file as an `http` body.
140
+ - [`HttpDefinition`](reference/authoring-surface/type-httpdefinition.md): An `http` Effect's definition.
141
+ - [`OpenSecret`](reference/authoring-surface/type-opensecret.md): `secret(open)`: a secret a packaged Machine names in its auth, a header or a command's env, and leaves for its composer to name (ADR-0054).
142
+ - [`PushOptions`](reference/authoring-surface/type-pushoptions.md): The options of `push()`.
143
+ - [`PushInput`](reference/authoring-surface/type-pushinput.md): The input of a `push` Effect: `{ sha }` with `pin`, and `{ message }` with `squash`.
144
+ - [`DispatchDefinition`](reference/authoring-surface/type-dispatchdefinition.md): The definition of a `dispatch` Effect (ADR-0071).
145
+ - [`DispatchInput`](reference/authoring-surface/type-dispatchinput.md): A dispatch's input: the run's body — the slot's schema's type, or any JSON object.
146
+ - [`DispatchOpenParts`](reference/authoring-surface/type-dispatchopenparts.md): The Open part a dispatch definition states: its target, when it is `open`.
147
+ - [`ChainLink`](reference/authoring-surface/type-chainlink.md): One reply since the pick, as the author reads it: an invoked actor's output, typed by its slot (`src`); or an event that answered a state below the Agent's — a Gate's answer, a nested Agent's pick — typed by the Machine's events.
148
+ - [`Quantity`](reference/authoring-surface/type-quantity.md): A Kubernetes quantity: `"2Gi"`, `"1500m"`, `"2"`, or a plain number (`2` cpus, bytes of memory).
149
+ - [`PoolSpec`](reference/authoring-surface/type-poolspec.md): What you pass to `pool()`: where the items come from, how many workers run at once, and what each worker gets.
150
+ - [`SourceSpec`](reference/authoring-surface/type-sourcespec.md): Where a Pool gets its work items: the Source.
151
+ - [`OpenBodyLogic`](reference/authoring-surface/type-openbodylogic.md): The logic `openBody()` returns: actor logic that carries the brand.
152
+ - [`Lends`](reference/authoring-surface/type-lends.md): The parts of the Chart wrapper that a Chart can use, by their keys in `actors`, `guards`, `actions` and `delays`.
153
+ - [`Ceilings`](reference/authoring-surface/type-ceilings.md): The limits that an Open body sets on its Chart.
154
+ - [`ChartText`](reference/authoring-surface/type-charttext.md): The Chart text (ADR-0070).
155
+ - [`Sender`](reference/authoring-surface/type-sender.md): Who delivered an event: an Agent by its slot, or a Gate by its invoke id (ADR-0015).
156
+ - [`FailureInput`](reference/authoring-surface/type-failureinput.md): What a Failure carries: `reason`, text for a person, and `detail`, optional JSON for a machine reader.
157
+ - [`SandboxOptions`](reference/authoring-surface/type-sandboxoptions.md): The options of a `workspace()` that say what its Sandbox is made of and which Repos it clones.
158
+ - [`WorkspaceSpec`](reference/authoring-surface/type-workspacespec.md): What the `spec` of a `workspace()` returns: the branch that the Workspace works on, and two optional fields.
159
+ - [`NoSlotSpec`](reference/authoring-surface/type-noslotspec.md): What the `spec` of a `workspace()` with no Repo Slot returns: only `workGroup`.
160
+ - [`SlotHandles`](reference/authoring-surface/type-slothandles.md): The handles of a Workspace that declares Repo Slots.
161
+ - [`Duration`](reference/authoring-surface/type-duration.md): A length of time: a positive number and a unit, `s`, `m` or `h`.
162
+ - [`CommandEnv`](reference/authoring-surface/type-commandenv.md): The `env` of a `command`: for each variable, `secret("name")` for the value of an Effect secret, or `secret("name").path` for the path of a file that holds it.
163
+ - [`TextPart`](reference/authoring-surface/type-textpart.md): One part of a `Text`: `{ text }`, literal text, or `{ secret }`, the name of an Effect secret.
164
+ - [`HttpMethod`](reference/authoring-surface/type-httpmethod.md): The method of an `http` Effect: `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE` or `OPTIONS`.
165
+ - [`HttpRequestParts`](reference/authoring-surface/type-httprequestparts.md): What the `request` of an `http` definition returns: the part of the request that changes for each run.
166
+ - [`NamedSecret`](reference/authoring-surface/type-namedsecret.md): A named secret, never `secret(open)`: where a definition's Open part is a whole that holds a secret — a dispatch's target (ADR-0071) — the secret is bound with it, to a name, so the mark `secret(open)` carries may not be present.
167
+ - [`SourceNextResult`](reference/authoring-surface/type-sourcenextresult.md): What the `next` of a Source resolves to: an item, to claim it; `null`, when no item is ready now; or `{ item, open }`, where `open` is the number of items that exist but are not ready.
168
+ - [`OpenBodySlot`](reference/authoring-surface/type-openbodyslot.md): The brand an Open body slot carries, as `definition` marks an Agent slot (ADR-0049).
169
+ - [`ChartJson`](reference/authoring-surface/type-chartjson.md): Plain JSON.
170
+ - [`ChartEvent`](reference/authoring-surface/type-chartevent.md): An event a Chart mints: its payload is a JSON Schema object, built into zod at admission.
171
+ - [`ChartAgent`](reference/authoring-surface/type-chartagent.md): An Agent a Chart mints: the plain fields of an Agent definition (ADR-0049).
172
+ - [`ChartState`](reference/authoring-surface/type-chartstate.md): A state node.
173
+ - [`ChartValue`](reference/authoring-surface/type-chartvalue.md): A value whose strings may hold `{{<root>.<path>}}` placeholders and whose objects may be `{ "$ref": "<root>.<path>" }`.
174
+ - [`ChartInvoke`](reference/authoring-surface/type-chartinvoke.md): An invoke: a lent Agent, Effect or Machine, a minted Agent, or the kit's `gate` or `fail`.
175
+ - [`ChartTransitions`](reference/authoring-surface/type-charttransitions.md): One transition or a list, in xstate's order.
176
+ - [`ChartAction`](reference/authoring-surface/type-chartaction.md): An action.
177
+ - [`ChartTransition`](reference/authoring-surface/type-charttransition.md): A transition: a target alone, or the object form.
178
+ - [`ChartGuard`](reference/authoring-surface/type-chartguard.md): A guard: a lent guard by name, with or without params, `jr2.sentBy`, `jr2.failure`, or `not`/`and`/`or`.
179
+ - [`ToProvidedActor`](reference/authoring-surface/type-toprovidedactor.md): A type that the Authoring surface names.
180
+ - [`MergedActors`](reference/authoring-surface/type-mergedactors.md): A type that the Authoring surface names.
181
+ - [`ToParameterizedObject`](reference/authoring-surface/type-toparameterizedobject.md): A type that the Authoring surface names.
182
+ - [`SentByGuards`](reference/authoring-surface/type-sentbyguards.md): A type that the Authoring surface names.
183
+ - [`AgentLogic`](reference/authoring-surface/type-agentlogic.md): A type that the Authoring surface names.
184
+ - [`BodyAcceptsDoor`](reference/authoring-surface/type-bodyacceptsdoor.md): A type that the Authoring surface names.
185
+ - [`WorkspaceMachine`](reference/authoring-surface/type-workspacemachine.md): A type that the Authoring surface names.
186
+ - [`BodyAcceptsSlots`](reference/authoring-surface/type-bodyacceptsslots.md): A type that the Authoring surface names.
187
+ - [`EffectLogic`](reference/authoring-surface/type-effectlogic.md): A type that the Authoring surface names.
188
+ - [`OpenOf`](reference/authoring-surface/type-openof.md): A type that the Authoring surface names.
189
+ - [`EnvOpenParts`](reference/authoring-surface/type-envopenparts.md): A type that the Authoring surface names.
190
+ - [`OpenEffect`](reference/authoring-surface/type-openeffect.md): A type that the Authoring surface names.
191
+ - [`MarkedIf`](reference/authoring-surface/type-markedif.md): A type that the Authoring surface names.
192
+ - [`HttpInput`](reference/authoring-surface/type-httpinput.md): A type that the Authoring surface names.
193
+ - [`HttpOpenParts`](reference/authoring-surface/type-httpopenparts.md): A type that the Authoring surface names.
194
+ - [`PushWireOutput`](reference/authoring-surface/type-pushwireoutput.md): A type that the Authoring surface names.
195
+ - [`SyncState`](reference/authoring-surface/type-syncstate.md): A type that the Authoring surface names.
196
+ - [`AnswerAction`](reference/authoring-surface/type-answeraction.md): A type that the Authoring surface names.
197
+ - [`AgentSlots`](reference/authoring-surface/type-agentslots.md): A type that the Authoring surface names.
198
+ - [`Reached`](reference/authoring-surface/type-reached.md): A type that the Authoring surface names.
199
+ - [`OpenEffectSlots`](reference/authoring-surface/type-openeffectslots.md): A type that the Authoring surface names.
200
+ - [`BindingOf`](reference/authoring-surface/type-bindingof.md): A type that the Authoring surface names.
201
+ - [`LogicAt`](reference/authoring-surface/type-logicat.md): A type that the Authoring surface names.
202
+ - [`ChildSlots`](reference/authoring-surface/type-childslots.md): A type that the Authoring surface names.
203
+ - [`ChildAt`](reference/authoring-surface/type-childat.md): A type that the Authoring surface names.
204
+ - [`RepoSlotsOf`](reference/authoring-surface/type-reposlotsof.md): A type that the Authoring surface names.
205
+ - [`WorkspaceOf`](reference/authoring-surface/type-workspaceof.md): A type that the Authoring surface names.
206
+ - [`PoolMachine`](reference/authoring-surface/type-poolmachine.md): A type that the Authoring surface names.
207
+ - [`EventFrom`](reference/authoring-surface/type-eventfrom.md): A type that the Authoring surface names.
208
+ - [`ArgNames`](reference/authoring-surface/type-argnames.md): A type that the Authoring surface names.
209
+ - [`OpenSecretMark`](reference/authoring-surface/type-opensecretmark.md): A type that the Authoring surface names.
210
+ - [@jr2/machines](reference/machines.md): The Machines that @jr2/machines ships: their input, their output, and their Open parts.
211
+ - [jr2.config.ts](reference/config.md): Every field of jr2.config.ts: its type, whether it is required, its default, and what it does.
212
+ - [CLI](reference/cli.md): Every jr2 command: its synopsis, its arguments, flags and env vars, and what it prints.
213
+ - [HTTP API](reference/http-api.md): Every route of the Orchestrator's HTTP API, by access band, and the types of its bodies and answers.
214
+ - [Mechanism events](reference/mechanism-events.md): The events that jr2 itself sends into every jr2Setup Machine, and their payloads.
215
+ - [Glossary](reference/glossary.md): The terms of jr2: what each one means, and the words to avoid.
216
+ - [Decisions](reference/decisions.md): Every architecture decision record of jr2, by number.