@jr2/orchestrator 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/console/components/app.ts +2 -0
- package/console/components/fleet.ts +14 -1
- package/console/components/machine-pane.ts +41 -2
- package/console/main.ts +13 -1
- package/console/store.ts +102 -6
- package/console/style.css +21 -0
- package/docs/agents-block.md +5 -0
- package/docs/concepts/agents-and-turns.md +478 -0
- package/docs/concepts/architecture.md +243 -0
- package/docs/concepts/charts.md +146 -0
- package/docs/concepts/composition.md +357 -0
- package/docs/concepts/converge.md +257 -0
- package/docs/concepts/durable-runs.md +189 -0
- package/docs/concepts/effects.md +658 -0
- package/docs/concepts/gates.md +208 -0
- package/docs/concepts/machines-and-workflows.md +298 -0
- package/docs/concepts/pools-and-sources.md +230 -0
- package/docs/concepts/secrets-and-trust.md +306 -0
- package/docs/concepts/the-menu.md +381 -0
- package/docs/concepts/workspaces.md +756 -0
- package/docs/get-started/a-model-decides.md +563 -0
- package/docs/get-started/an-agent-in-a-sandbox.md +383 -0
- package/docs/get-started/connect-a-model.md +248 -0
- package/docs/get-started/create-an-instance.md +194 -0
- package/docs/get-started/have-your-assistant-write-a-machine.md +993 -0
- package/docs/get-started/install.md +130 -0
- package/docs/guides/add-tools-to-the-sandbox.md +308 -0
- package/docs/guides/answer-a-gate.md +304 -0
- package/docs/guides/bind-open-parts.md +224 -0
- package/docs/guides/cancel-a-run.md +146 -0
- package/docs/guides/clean-up.md +206 -0
- package/docs/guides/cut-a-worktree.md +560 -0
- package/docs/guides/fix-a-failed-converge.md +361 -0
- package/docs/guides/give-the-cluster-git-credentials.md +222 -0
- package/docs/guides/iterate-on-a-machine-on-kind.md +190 -0
- package/docs/guides/let-an-agent-write-a-chart.md +230 -0
- package/docs/guides/look-inside-a-sandbox.md +177 -0
- package/docs/guides/mirror-the-kit-images.md +176 -0
- package/docs/guides/move-from-kind-to-a-shared-cluster.md +318 -0
- package/docs/guides/open-the-console.md +91 -0
- package/docs/guides/publish-a-machine-as-an-npm-package.md +350 -0
- package/docs/guides/push-and-sign-a-branch.md +532 -0
- package/docs/guides/run-a-chart-by-name.md +270 -0
- package/docs/guides/run-a-command-or-call-a-url.md +587 -0
- package/docs/guides/run-one-worker-per-item.md +322 -0
- package/docs/guides/set-an-agents-access-and-dials.md +420 -0
- package/docs/guides/size-a-workspace.md +217 -0
- package/docs/guides/start-a-run-from-a-run.md +237 -0
- package/docs/guides/start-a-run.md +207 -0
- package/docs/guides/upgrade-the-kit-version.md +240 -0
- package/docs/guides/use-a-hosted-provider.md +214 -0
- package/docs/guides/use-a-local-model.md +313 -0
- package/docs/guides/watch-a-run.md +349 -0
- package/docs/guides/write-a-workflow.md +318 -0
- package/docs/index.md +44 -0
- package/docs/llms.txt +237 -0
- package/docs/reference/authoring-surface/agent.md +151 -0
- package/docs/reference/authoring-surface/answer.md +156 -0
- package/docs/reference/authoring-surface/arg.md +82 -0
- package/docs/reference/authoring-surface/basic.md +62 -0
- package/docs/reference/authoring-surface/bearer.md +53 -0
- package/docs/reference/authoring-surface/branchname.md +15 -0
- package/docs/reference/authoring-surface/chartschema.md +23 -0
- package/docs/reference/authoring-surface/chartschemafor.md +48 -0
- package/docs/reference/authoring-surface/command.md +206 -0
- package/docs/reference/authoring-surface/customize.md +64 -0
- package/docs/reference/authoring-surface/defineconfig.md +41 -0
- package/docs/reference/authoring-surface/defineevent.md +114 -0
- package/docs/reference/authoring-surface/dispatch.md +126 -0
- package/docs/reference/authoring-surface/fail.md +96 -0
- package/docs/reference/authoring-surface/file.md +142 -0
- package/docs/reference/authoring-surface/frompick.md +277 -0
- package/docs/reference/authoring-surface/http.md +259 -0
- package/docs/reference/authoring-surface/isfailure.md +58 -0
- package/docs/reference/authoring-surface/isready.md +14 -0
- package/docs/reference/authoring-surface/jr2setup.md +237 -0
- package/docs/reference/authoring-surface/open.md +105 -0
- package/docs/reference/authoring-surface/openbody.md +86 -0
- package/docs/reference/authoring-surface/paramsof.md +143 -0
- package/docs/reference/authoring-surface/pool.md +186 -0
- package/docs/reference/authoring-surface/push.md +130 -0
- package/docs/reference/authoring-surface/readyof.md +21 -0
- package/docs/reference/authoring-surface/secret.md +139 -0
- package/docs/reference/authoring-surface/sentby.md +83 -0
- package/docs/reference/authoring-surface/source.md +51 -0
- package/docs/reference/authoring-surface/text.md +62 -0
- package/docs/reference/authoring-surface/type-agentdeclaration.md +27 -0
- package/docs/reference/authoring-surface/type-agentdefinition.md +80 -0
- package/docs/reference/authoring-surface/type-agentlogic.md +15 -0
- package/docs/reference/authoring-surface/type-agentslots.md +15 -0
- package/docs/reference/authoring-surface/type-answeraction.md +12 -0
- package/docs/reference/authoring-surface/type-anyframepath.md +14 -0
- package/docs/reference/authoring-surface/type-anyworktreepath.md +15 -0
- package/docs/reference/authoring-surface/type-arg.md +19 -0
- package/docs/reference/authoring-surface/type-argnames.md +12 -0
- package/docs/reference/authoring-surface/type-bindactors.md +14 -0
- package/docs/reference/authoring-surface/type-binding.md +61 -0
- package/docs/reference/authoring-surface/type-bindingof.md +12 -0
- package/docs/reference/authoring-surface/type-bodyacceptsdoor.md +15 -0
- package/docs/reference/authoring-surface/type-bodyacceptsslots.md +17 -0
- package/docs/reference/authoring-surface/type-ceilings.md +41 -0
- package/docs/reference/authoring-surface/type-chainlink.md +19 -0
- package/docs/reference/authoring-surface/type-chartaction.md +46 -0
- package/docs/reference/authoring-surface/type-chartagent.md +28 -0
- package/docs/reference/authoring-surface/type-chartevent.md +20 -0
- package/docs/reference/authoring-surface/type-chartguard.md +20 -0
- package/docs/reference/authoring-surface/type-chartinvoke.md +28 -0
- package/docs/reference/authoring-surface/type-chartjson.md +14 -0
- package/docs/reference/authoring-surface/type-chartstate.md +46 -0
- package/docs/reference/authoring-surface/type-charttext.md +40 -0
- package/docs/reference/authoring-surface/type-charttransition.md +22 -0
- package/docs/reference/authoring-surface/type-charttransitions.md +14 -0
- package/docs/reference/authoring-surface/type-chartvalue.md +15 -0
- package/docs/reference/authoring-surface/type-childat.md +12 -0
- package/docs/reference/authoring-surface/type-childslots.md +12 -0
- package/docs/reference/authoring-surface/type-commandenv.md +15 -0
- package/docs/reference/authoring-surface/type-commandinput.md +20 -0
- package/docs/reference/authoring-surface/type-commandoptions.md +56 -0
- package/docs/reference/authoring-surface/type-commandoutput.md +122 -0
- package/docs/reference/authoring-surface/type-customize.md +111 -0
- package/docs/reference/authoring-surface/type-dispatchdefinition.md +39 -0
- package/docs/reference/authoring-surface/type-dispatchinput.md +14 -0
- package/docs/reference/authoring-surface/type-dispatchopenparts.md +14 -0
- package/docs/reference/authoring-surface/type-dispatchoutput.md +72 -0
- package/docs/reference/authoring-surface/type-doorlessinput.md +19 -0
- package/docs/reference/authoring-surface/type-duration.md +15 -0
- package/docs/reference/authoring-surface/type-effectbinding.md +93 -0
- package/docs/reference/authoring-surface/type-effectlogic.md +12 -0
- package/docs/reference/authoring-surface/type-envopenparts.md +14 -0
- package/docs/reference/authoring-surface/type-eventaudience.md +27 -0
- package/docs/reference/authoring-surface/type-eventdef.md +45 -0
- package/docs/reference/authoring-surface/type-eventfrom.md +16 -0
- package/docs/reference/authoring-surface/type-eventsemantics.md +26 -0
- package/docs/reference/authoring-surface/type-execoutcome.md +34 -0
- package/docs/reference/authoring-surface/type-failslot.md +14 -0
- package/docs/reference/authoring-surface/type-failure.md +19 -0
- package/docs/reference/authoring-surface/type-failureinput.md +20 -0
- package/docs/reference/authoring-surface/type-filebody.md +37 -0
- package/docs/reference/authoring-surface/type-framepath.md +14 -0
- package/docs/reference/authoring-surface/type-frominput.md +14 -0
- package/docs/reference/authoring-surface/type-hostinjectedinput.md +56 -0
- package/docs/reference/authoring-surface/type-httpdefinition.md +104 -0
- package/docs/reference/authoring-surface/type-httpfileinput.md +20 -0
- package/docs/reference/authoring-surface/type-httpinput.md +12 -0
- package/docs/reference/authoring-surface/type-httpmethod.md +14 -0
- package/docs/reference/authoring-surface/type-httpopenparts.md +12 -0
- package/docs/reference/authoring-surface/type-httpoutput.md +95 -0
- package/docs/reference/authoring-surface/type-httprequestparts.md +33 -0
- package/docs/reference/authoring-surface/type-jr2config.md +126 -0
- package/docs/reference/authoring-surface/type-lateroutcome.md +21 -0
- package/docs/reference/authoring-surface/type-lends.md +38 -0
- package/docs/reference/authoring-surface/type-logicat.md +12 -0
- package/docs/reference/authoring-surface/type-markedif.md +12 -0
- package/docs/reference/authoring-surface/type-mergedactors.md +12 -0
- package/docs/reference/authoring-surface/type-namedsecret.md +25 -0
- package/docs/reference/authoring-surface/type-namestart.md +77 -0
- package/docs/reference/authoring-surface/type-noslotworkspaceoptions.md +27 -0
- package/docs/reference/authoring-surface/type-notworktreekeys.md +12 -0
- package/docs/reference/authoring-surface/type-openbodydeclaration.md +40 -0
- package/docs/reference/authoring-surface/type-openbodylogic.md +14 -0
- package/docs/reference/authoring-surface/type-openbodyoutput.md +42 -0
- package/docs/reference/authoring-surface/type-openbodyslot.md +18 -0
- package/docs/reference/authoring-surface/type-opencommandinput.md +22 -0
- package/docs/reference/authoring-surface/type-openeffect.md +12 -0
- package/docs/reference/authoring-surface/type-openeffectslots.md +12 -0
- package/docs/reference/authoring-surface/type-openof.md +12 -0
- package/docs/reference/authoring-surface/type-opensecret.md +23 -0
- package/docs/reference/authoring-surface/type-opensecretmark.md +12 -0
- package/docs/reference/authoring-surface/type-permissivenoslotworkspaceoptions.md +26 -0
- package/docs/reference/authoring-surface/type-permissiveworkspaceoptions.md +27 -0
- package/docs/reference/authoring-surface/type-poolmachine.md +28 -0
- package/docs/reference/authoring-surface/type-poolnextinput.md +22 -0
- package/docs/reference/authoring-surface/type-poolspec.md +60 -0
- package/docs/reference/authoring-surface/type-pushinput.md +34 -0
- package/docs/reference/authoring-surface/type-pushoptions.md +79 -0
- package/docs/reference/authoring-surface/type-pushoutput.md +149 -0
- package/docs/reference/authoring-surface/type-pushwireoutput.md +12 -0
- package/docs/reference/authoring-surface/type-quantity.md +14 -0
- package/docs/reference/authoring-surface/type-reached.md +12 -0
- package/docs/reference/authoring-surface/type-reposlot.md +70 -0
- package/docs/reference/authoring-surface/type-reposlotsof.md +16 -0
- package/docs/reference/authoring-surface/type-sandboxoptions.md +84 -0
- package/docs/reference/authoring-surface/type-secret.md +25 -0
- package/docs/reference/authoring-surface/type-sender.md +19 -0
- package/docs/reference/authoring-surface/type-sentbyguards.md +12 -0
- package/docs/reference/authoring-surface/type-size.md +85 -0
- package/docs/reference/authoring-surface/type-slothandles.md +24 -0
- package/docs/reference/authoring-surface/type-sourcenextresult.md +17 -0
- package/docs/reference/authoring-surface/type-sourcespec.md +44 -0
- package/docs/reference/authoring-surface/type-syncstate.md +12 -0
- package/docs/reference/authoring-surface/type-text.md +19 -0
- package/docs/reference/authoring-surface/type-textpart.md +24 -0
- package/docs/reference/authoring-surface/type-thinkinglevel.md +39 -0
- package/docs/reference/authoring-surface/type-toparameterizedobject.md +14 -0
- package/docs/reference/authoring-surface/type-toprovidedactor.md +14 -0
- package/docs/reference/authoring-surface/type-unknown.md +21 -0
- package/docs/reference/authoring-surface/type-usercontainer.md +77 -0
- package/docs/reference/authoring-surface/type-withoutemptyindex.md +20 -0
- package/docs/reference/authoring-surface/type-workflowevent.md +46 -0
- package/docs/reference/authoring-surface/type-workspaceaccess.md +16 -0
- package/docs/reference/authoring-surface/type-workspaced.md +115 -0
- package/docs/reference/authoring-surface/type-workspacehandles.md +22 -0
- package/docs/reference/authoring-surface/type-workspacemachine.md +29 -0
- package/docs/reference/authoring-surface/type-workspaceof.md +13 -0
- package/docs/reference/authoring-surface/type-workspaceoptions.md +27 -0
- package/docs/reference/authoring-surface/type-worktreefound.md +16 -0
- package/docs/reference/authoring-surface/type-worktreeinput.md +56 -0
- package/docs/reference/authoring-surface/type-worktreekey.md +14 -0
- package/docs/reference/authoring-surface/type-worktreeoptions.md +29 -0
- package/docs/reference/authoring-surface/type-worktreeoutput.md +45 -0
- package/docs/reference/authoring-surface/type-worktreepath.md +16 -0
- package/docs/reference/authoring-surface/type-worktreeready.md +37 -0
- package/docs/reference/authoring-surface/type-worktreerefused.md +21 -0
- package/docs/reference/authoring-surface/workspace.md +287 -0
- package/docs/reference/authoring-surface/worktree.md +71 -0
- package/docs/reference/authoring-surface.md +217 -0
- package/docs/reference/cli.md +433 -0
- package/docs/reference/config.md +765 -0
- package/docs/reference/decisions/0001-operator-owned-generic-sandbox.md +114 -0
- package/docs/reference/decisions/0002-duplex-streaming-actor.md +117 -0
- package/docs/reference/decisions/0004-worktree-provisioning-model.md +130 -0
- package/docs/reference/decisions/0005-sandbox-pod-composition.md +240 -0
- package/docs/reference/decisions/0006-agent-control-surface.md +50 -0
- package/docs/reference/decisions/0007-durable-machine-state.md +109 -0
- package/docs/reference/decisions/0008-orchestrator-as-deployed-app.md +60 -0
- package/docs/reference/decisions/0009-cli-and-instance-interface.md +275 -0
- package/docs/reference/decisions/0010-bdd-acceptance-tests.md +160 -0
- package/docs/reference/decisions/0011-workflow-defined-events.md +141 -0
- package/docs/reference/decisions/0012-workspace-wrapper-machine.md +103 -0
- package/docs/reference/decisions/0013-the-agent-reaches-its-machine-through-a-container-it-cannot-read.md +175 -0
- package/docs/reference/decisions/0014-observation-is-open-run-state-is-not.md +95 -0
- package/docs/reference/decisions/0015-authoring-surface-absorbs-the-mechanism.md +271 -0
- package/docs/reference/decisions/0016-agent-turn-mechanics-are-internal.md +126 -0
- package/docs/reference/decisions/0017-pool-over-a-source-port.md +71 -0
- package/docs/reference/decisions/0018-instance-agents-are-definitions-jr2-assembles-the-harness.md +111 -0
- package/docs/reference/decisions/0019-one-converging-command-against-the-current-context.md +287 -0
- package/docs/reference/decisions/0020-private-ca-trust-is-a-named-concept.md +60 -0
- package/docs/reference/decisions/0021-workspace-continuity-is-a-lease-that-answers-back.md +101 -0
- package/docs/reference/decisions/0022-observation-is-a-level-triggered-feed.md +103 -0
- package/docs/reference/decisions/0023-the-harness-prints-the-conversation.md +175 -0
- package/docs/reference/decisions/0024-an-agents-turn-ends-with-the-state-that-asked-for-it.md +436 -0
- package/docs/reference/decisions/0025-cancel-ends-a-run-stop-parks-it.md +65 -0
- package/docs/reference/decisions/0026-a-turn-that-is-over-is-never-prompted.md +62 -0
- package/docs/reference/decisions/0027-the-harness-is-jr2s-own-server-flue-retires-the-wire-stays.md +245 -0
- package/docs/reference/decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md +90 -0
- package/docs/reference/decisions/0029-a-menu-is-fixed-for-a-conversation-and-a-turn-is-told-its-allowed-picks.md +154 -0
- package/docs/reference/decisions/0030-a-snapshot-names-the-machine-it-was-written-under.md +100 -0
- package/docs/reference/decisions/0031-menu-only-agents-run-on-the-instance-harness.md +193 -0
- package/docs/reference/decisions/0032-the-console-unlocks-with-the-instance-token.md +61 -0
- package/docs/reference/decisions/0033-a-machine-declares-the-input-that-starts-it.md +126 -0
- package/docs/reference/decisions/0034-the-console-renders-with-preact-and-the-server-erases-the-types.md +57 -0
- package/docs/reference/decisions/0035-a-runaway-turn-is-ended-rerolled-once-then-a-fault.md +92 -0
- package/docs/reference/decisions/0036-a-turn-compacts-its-own-context-mid-flight.md +138 -0
- package/docs/reference/decisions/0037-an-instance-builds-its-sandbox-images-jr2-injects-the-harness.md +196 -0
- package/docs/reference/decisions/0038-jr2-up-builds-every-image-it-deploys.md +170 -0
- package/docs/reference/decisions/0039-image-garbage-collects-by-reachability.md +115 -0
- package/docs/reference/decisions/0041-a-build-the-host-already-holds-is-not-spent-again.md +64 -0
- package/docs/reference/decisions/0042-ready-is-not-routable-an-admission-retries-its-connection.md +142 -0
- package/docs/reference/decisions/0043-the-kit-is-tested-as-installed-a-local-registry-stands-in-for-npm.md +170 -0
- package/docs/reference/decisions/0044-kit-images-live-at-a-canonical-home-a-self-host-mirrors-it.md +85 -0
- package/docs/reference/decisions/0045-the-platform-joins-the-image-address-and-the-cluster-chooses-it.md +82 -0
- package/docs/reference/decisions/0046-a-converge-failure-carries-its-diagnosis.md +34 -0
- package/docs/reference/decisions/0047-the-git-ssh-key-source-is-the-users-choice.md +47 -0
- package/docs/reference/decisions/0048-the-orchestrator-boots-without-its-repos.md +36 -0
- package/docs/reference/decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md +126 -0
- package/docs/reference/decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md +73 -0
- package/docs/reference/decisions/0051-a-repo-is-a-slot-on-the-workspace-and-a-cache-on-the-node.md +238 -0
- package/docs/reference/decisions/0052-a-sandbox-lands-where-an-ordinary-pod-lands-and-the-cache-follows-it.md +86 -0
- package/docs/reference/decisions/0053-a-fetch-inside-the-pod-asks-the-node-cache-and-the-cache-asks-the-remote.md +123 -0
- package/docs/reference/decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md +126 -0
- package/docs/reference/decisions/0055-a-release-is-a-pushed-tag-and-the-publish-guard-is-the-credential.md +107 -0
- package/docs/reference/decisions/0056-a-global-jr2-hands-off-to-the-instances-own-and-an-instance-has-one-kit-version.md +62 -0
- package/docs/reference/decisions/0057-a-turn-is-its-frame-its-dials-and-whether-it-continues.md +152 -0
- package/docs/reference/decisions/0058-a-harness-answers-the-orchestrator-alone.md +108 -0
- package/docs/reference/decisions/0059-a-harness-holds-stand-ins-and-the-custodian-holds-the-keys.md +427 -0
- package/docs/reference/decisions/0060-a-workspace-states-its-size-and-jr2-reserves-all-of-it.md +111 -0
- package/docs/reference/decisions/0061-a-memory-kill-ends-the-agents-processes-not-the-harness.md +83 -0
- package/docs/reference/decisions/0062-jr2-briefs-the-agent-on-its-seat-never-on-its-task.md +239 -0
- package/docs/reference/decisions/0063-the-orchestrator-watches-the-cluster.md +82 -0
- package/docs/reference/decisions/0064-a-workspace-waits-for-capacity.md +79 -0
- package/docs/reference/decisions/0065-a-persist-survives-a-crash-and-history-is-a-week.md +65 -0
- package/docs/reference/decisions/0066-a-model-tier-runs-a-real-model-and-a-change-to-what-it-reads-runs-the-tier.md +552 -0
- package/docs/reference/decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md +458 -0
- package/docs/reference/decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md +475 -0
- package/docs/reference/decisions/0069-the-orchestrator-is-a-kit-image-and-an-instance-publishes-its-assembly.md +180 -0
- package/docs/reference/decisions/0070-a-machine-lends-its-parts-to-a-chart.md +334 -0
- package/docs/reference/decisions/0071-a-run-starts-a-run-through-a-dispatch-effect.md +183 -0
- package/docs/reference/decisions/0072-the-docs-ship-inside-the-kit-and-an-instances-agents-md-indexes-them.md +144 -0
- package/docs/reference/decisions/0073-a-machine-fails-a-run-with-fail-and-an-uncaught-failure-ends-it-failed.md +122 -0
- package/docs/reference/decisions/0074-an-unrouted-mechanism-event-is-refused-at-load-and-faults-the-run.md +76 -0
- package/docs/reference/decisions/0075-a-machine-cuts-a-worktree-and-the-workspace-only-clones.md +295 -0
- package/docs/reference/decisions/0076-an-agents-control-credential-lives-only-where-no-workspace-code-runs.md +320 -0
- package/docs/reference/decisions/0077-jr2-requires-landlock-on-every-sandbox-node.md +79 -0
- package/docs/reference/decisions.md +86 -0
- package/docs/reference/glossary.md +687 -0
- package/docs/reference/http-api.md +1386 -0
- package/docs/reference/machines.md +189 -0
- package/docs/reference/mechanism-events.md +72 -0
- package/docs/why.md +207 -0
- package/package.json +5 -3
- package/src/actor.ts +694 -106
- package/src/agent.ts +114 -38
- package/src/ambient.ts +3 -4
- package/src/assembly-checks.ts +189 -7
- package/src/cause.ts +234 -0
- package/src/chart.ts +345 -46
- package/src/charts.ts +43 -8
- package/src/config.ts +440 -178
- package/src/custodian.lua +17 -5
- package/src/custodian.ts +325 -99
- package/src/customize.ts +199 -49
- package/src/dispatch-effect.ts +945 -0
- package/src/door-compat.ts +217 -0
- package/src/durability.ts +11 -4
- package/src/effect-checks.ts +50 -3
- package/src/effect.ts +641 -128
- package/src/effector-wire.ts +165 -13
- package/src/fail.ts +222 -0
- package/src/harness-client.ts +587 -50
- package/src/harness-env.ts +33 -0
- package/src/held-secrets.ts +125 -16
- package/src/holds.ts +3 -0
- package/src/http-effect.ts +556 -58
- package/src/http.ts +480 -30
- package/src/index.ts +74 -82
- package/src/instance.ts +68 -8
- package/src/internal.ts +85 -0
- package/src/kube-client.ts +6 -3
- package/src/machine-doc.ts +24 -7
- package/src/mechanism-routes.ts +168 -0
- package/src/model-keys.generated.ts +53 -0
- package/src/model-keys.ts +42 -58
- package/src/names.ts +19 -6
- package/src/notices.ts +483 -41
- package/src/open-body.ts +242 -40
- package/src/open-effect.ts +81 -8
- package/src/open.ts +90 -6
- package/src/parts.ts +213 -30
- package/src/party.ts +101 -2
- package/src/pick.ts +497 -11
- package/src/pool.ts +282 -50
- package/src/registration.ts +133 -12
- package/src/repo-identity.ts +7 -3
- package/src/repos.ts +22 -3
- package/src/run-host.ts +665 -45
- package/src/run-output.ts +38 -0
- package/src/sandbox-effect.ts +457 -71
- package/src/sandbox-kube.ts +66 -17
- package/src/secret-placement.ts +59 -17
- package/src/server.ts +3 -0
- package/src/setup.ts +325 -62
- package/src/size.ts +121 -9
- package/src/snapshot-store.ts +54 -10
- package/src/stub-harness.ts +44 -16
- package/src/timers.ts +14 -1
- package/src/tokens.ts +107 -32
- package/src/vocabulary.ts +88 -14
- package/src/wire.ts +100 -26
- package/src/workspace.ts +771 -238
- package/src/worktree.ts +249 -0
package/src/index.ts
CHANGED
|
@@ -1,85 +1,77 @@
|
|
|
1
|
-
// @jr2/orchestrator — the
|
|
2
|
-
//
|
|
3
|
-
// (
|
|
1
|
+
// @jr2/orchestrator — the Authoring surface (GLOSSARY.md): the names an author writes in a
|
|
2
|
+
// workflow module or in `jr2.config.ts`, and no other name. A name is here when an author writes
|
|
3
|
+
// it; a name an author only meets through inference (a jr2Setup event union, a gate's input, a
|
|
4
|
+
// pick's Frame) stays internal. A workflow authors against ONE package — `defineEvent`,
|
|
5
|
+
// `jr2Setup`, `workspace`, … all import from "@jr2/orchestrator" (ADR-0015) — and an Assistant that
|
|
6
|
+
// reads this file reads the whole of what it may write.
|
|
4
7
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
+
// Named re-exports only, never `export *`: each name below is a decision, and
|
|
9
|
+
// test/authoring-surface.test.ts pins the list. The kit's own packages (the CLI, the e2e suite,
|
|
10
|
+
// the Harness's tests) import "@jr2/orchestrator/internal", which holds everything here and the
|
|
11
|
+
// runtime besides.
|
|
8
12
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
// The Effect surface (ADR-0067): `command` itself is the wire-bound one, from harness-client.ts;
|
|
14
|
-
// `fromPick`, `paramsOf` and `answer` are what an author writes between a pick and its work.
|
|
15
|
-
export * from "./effect.ts";
|
|
16
|
-
// The http kind (ADR-0068): `http`, `secret`, `bearer`, `basic`, `text`, and the Effector's wire.
|
|
17
|
-
export * from "./http-effect.ts";
|
|
18
|
-
export * from "./sandbox-effect.ts";
|
|
19
|
-
// An Effect's Open parts (ADR-0054): the types `customize({ effects })` reads.
|
|
20
|
-
export type { EffectBinding, OpenEffect, OpenEffectPart } from "./open-effect.ts";
|
|
21
|
-
export { openPartsText } from "./open-effect.ts";
|
|
22
|
-
export * from "./effector-wire.ts";
|
|
23
|
-
export * from "./pick.ts";
|
|
24
|
-
// The Chart (ADR-0070): its grammar (`chartSchema`, which a Chart wrapper's door and a planner's pick
|
|
25
|
-
// import), the door that admits one, and the resolver of its references.
|
|
26
|
-
export * from "./chart.ts";
|
|
27
|
-
// The Open body a Chart binds (`openBody`, the slot constructor a Chart wrapper places in `actors`)
|
|
28
|
-
// and the named Charts of an Instance: Chart files and runtime Charts (ADR-0070).
|
|
29
|
-
export * from "./open-body.ts";
|
|
30
|
-
export * from "./charts.ts";
|
|
31
|
-
export * from "./parts.ts";
|
|
32
|
-
export * from "./size.ts";
|
|
33
|
-
export * from "./customize.ts";
|
|
34
|
-
export * from "./ambient.ts";
|
|
35
|
-
export * from "./config.ts";
|
|
36
|
-
export * from "./repo-identity.ts";
|
|
37
|
-
export * from "./pool.ts";
|
|
38
|
-
export * from "./setup.ts";
|
|
39
|
-
// The author's routing guard (ADR-0015).
|
|
13
|
+
// Machine and events: the setup a workflow writes its Machine with, the events its parties send,
|
|
14
|
+
// and the guard that makes a writing decline other senders (ADR-0011, ADR-0015).
|
|
15
|
+
export { defineEvent } from "@jr2/agent-protocol";
|
|
16
|
+
export { jr2Setup } from "./setup.ts";
|
|
40
17
|
export { sentBy } from "./party.ts";
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
63
|
-
export
|
|
64
|
-
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export
|
|
79
|
-
export
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export
|
|
85
|
-
export
|
|
18
|
+
export type { HostInjectedInput } from "./vocabulary.ts";
|
|
19
|
+
|
|
20
|
+
// Failure: the Part a Machine invokes to fail its run, and the guard that tells a Failure from a
|
|
21
|
+
// defect in an `onError` (ADR-0073).
|
|
22
|
+
export { fail, isFailure } from "./fail.ts";
|
|
23
|
+
|
|
24
|
+
// Agents: an Agent slot and the definition it carries (ADR-0028, ADR-0049).
|
|
25
|
+
export { agent } from "./harness-client.ts";
|
|
26
|
+
export type { AgentDefinition, ThinkingLevel } from "./agent.ts";
|
|
27
|
+
|
|
28
|
+
// Workspaces and Repos: a Sandbox and the Repo Slots it binds (ADR-0012, ADR-0051).
|
|
29
|
+
export { workspace } from "./workspace.ts";
|
|
30
|
+
export type { Workspaced } from "./workspace.ts";
|
|
31
|
+
export type { Binding, RepoSlot } from "./parts.ts";
|
|
32
|
+
|
|
33
|
+
// Effects: work a Machine does outside itself, as an actor slot (ADR-0067, ADR-0068, ADR-0071),
|
|
34
|
+
// and what an author writes between a pick and that work.
|
|
35
|
+
export { arg } from "./effect.ts";
|
|
36
|
+
export type { CommandOutput, LaterOutcome } from "./effect.ts";
|
|
37
|
+
export { command } from "./harness-client.ts";
|
|
38
|
+
export { basic, bearer, file, http, secret, text } from "./http-effect.ts";
|
|
39
|
+
export type { HttpOutput } from "./effector-wire.ts";
|
|
40
|
+
export { push } from "./sandbox-effect.ts";
|
|
41
|
+
export type { PushOutput } from "./sandbox-effect.ts";
|
|
42
|
+
export { branchName, isReady, readyOf, worktree } from "./worktree.ts";
|
|
43
|
+
export type {
|
|
44
|
+
AnyFramePath,
|
|
45
|
+
AnyWorktreePath,
|
|
46
|
+
FramePath,
|
|
47
|
+
WorktreeFound,
|
|
48
|
+
WorktreeInput,
|
|
49
|
+
WorktreeOptions,
|
|
50
|
+
WorktreeOutput,
|
|
51
|
+
WorktreePath,
|
|
52
|
+
WorktreeReady,
|
|
53
|
+
WorktreeRefused,
|
|
54
|
+
} from "./worktree.ts";
|
|
55
|
+
export { dispatch } from "./dispatch-effect.ts";
|
|
56
|
+
export type { DispatchOutput } from "./effect.ts";
|
|
57
|
+
export { answer, fromPick, paramsOf } from "./pick.ts";
|
|
58
|
+
|
|
59
|
+
// Composition: a part left Open, a Machine's parts retuned, a Pool over a Source (ADR-0017,
|
|
60
|
+
// ADR-0049, ADR-0054, ADR-0060).
|
|
61
|
+
export { open } from "./parts.ts";
|
|
62
|
+
export { customize } from "./customize.ts";
|
|
63
|
+
export type { Customize } from "./customize.ts";
|
|
64
|
+
export type { EffectBinding } from "./open-effect.ts";
|
|
65
|
+
export type { Size, UserContainer } from "./size.ts";
|
|
66
|
+
export { pool, source } from "./pool.ts";
|
|
67
|
+
export type { PoolNextInput } from "./pool.ts";
|
|
68
|
+
|
|
69
|
+
// Charts: the Open body a Chart wrapper places in `actors`, and the grammar a planner's pick
|
|
70
|
+
// declares, whole or narrowed to one wrapper (ADR-0070).
|
|
71
|
+
export { openBody } from "./open-body.ts";
|
|
72
|
+
export type { OpenBodyDeclaration, OpenBodyOutput } from "./open-body.ts";
|
|
73
|
+
export { chartSchema, chartSchemaFor } from "./chart.ts";
|
|
74
|
+
|
|
75
|
+
// Config: `jr2.config.ts`, the deployment facts a Machine cannot carry (ADR-0050).
|
|
76
|
+
export { defineConfig } from "./config.ts";
|
|
77
|
+
export type { JR2Config } from "./config.ts";
|
package/src/instance.ts
CHANGED
|
@@ -38,8 +38,17 @@ import {
|
|
|
38
38
|
type ResolvedAssembly,
|
|
39
39
|
} from "./assembly.ts";
|
|
40
40
|
import { assemblyRefusals, type LoadedWorkflow } from "./assembly-checks.ts";
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
chartName,
|
|
43
|
+
NamedCharts,
|
|
44
|
+
readChartFiles,
|
|
45
|
+
readRuntimeCharts,
|
|
46
|
+
splitChartName,
|
|
47
|
+
type ChartCounts,
|
|
48
|
+
type ChartFile,
|
|
49
|
+
} from "./charts.ts";
|
|
42
50
|
import type { ImageRefs } from "./images.ts";
|
|
51
|
+
import { partsOf } from "./parts.ts";
|
|
43
52
|
import { join } from "node:path";
|
|
44
53
|
import { pathToFileURL } from "node:url";
|
|
45
54
|
import type { AddressInfo } from "node:net";
|
|
@@ -56,6 +65,7 @@ import type { SnapshotStore } from "./snapshot-store.ts";
|
|
|
56
65
|
import { createAuthenticator, effectorKey, harnessToken, loadSigningKey, mintInstanceToken } from "./tokens.ts";
|
|
57
66
|
import type { SandboxPort } from "./workspace.ts";
|
|
58
67
|
import type { EffectorPlacement, EffectorTarget } from "./http-effect.ts";
|
|
68
|
+
import { WORKFLOW_NAME } from "./effector-wire.ts";
|
|
59
69
|
|
|
60
70
|
export type InstanceOptions = {
|
|
61
71
|
/** The instance folder: the state volume `.jr2/` (its `state.db` unless `store` is supplied, and
|
|
@@ -119,6 +129,10 @@ export type InstanceOptions = {
|
|
|
119
129
|
* The entrypoint derives it from the pod's namespace (deterministic Service DNS); absent,
|
|
120
130
|
* such a Turn without an explicit `endpoint` faults pointedly. */
|
|
121
131
|
instanceHarness?: string;
|
|
132
|
+
/** The name this Orchestrator gives itself at another Orchestrator's door (ADR-0071): a foreign
|
|
133
|
+
* dispatch's `dispatchedBy.instance`. The entrypoint passes the pod's namespace; absent, a foreign
|
|
134
|
+
* dispatch names an unnamed caller. */
|
|
135
|
+
orchestratorName?: string;
|
|
122
136
|
/** The Instance Effector's headless Service, `host:port` (ADR-0068) — where an http Effect is sent.
|
|
123
137
|
* The entrypoint derives it from the pod's namespace; absent, an http Effect faults pointedly. */
|
|
124
138
|
instanceEffector?: string;
|
|
@@ -287,6 +301,7 @@ export async function startInstance(opts: InstanceOptions): Promise<RunningInsta
|
|
|
287
301
|
resolveDef,
|
|
288
302
|
sandbox: opts.sandbox,
|
|
289
303
|
instanceHarness: opts.instanceHarness,
|
|
304
|
+
...(opts.orchestratorName !== undefined ? { orchestratorName: opts.orchestratorName } : {}),
|
|
290
305
|
harnessBearer: (placement) => harnessToken(signingKey, placement),
|
|
291
306
|
// The Effectors (ADR-0068): each placement's Service, and the key its wire is signed with —
|
|
292
307
|
// derived from the signing key as the Harness bearer is, so nothing is stored. The Instance
|
|
@@ -307,12 +322,15 @@ export async function startInstance(opts: InstanceOptions): Promise<RunningInsta
|
|
|
307
322
|
// says why (ADR-0030). stderr, because it is a fault, not the boot's structured result.
|
|
308
323
|
onRestoreError: (runId, err) =>
|
|
309
324
|
console.error(`restore failed for run ${runId}: ${err instanceof Error ? err.message : err}`),
|
|
325
|
+
// An in-process dispatch of a named Chart the current Assembly left unrunnable answers 409, as
|
|
326
|
+
// the HTTP door does (ADR-0071). The registry is built after the host; this runs only at a start.
|
|
327
|
+
unrunnableChart: (name): string | undefined => charts.get(name)?.unrunnable,
|
|
310
328
|
});
|
|
311
329
|
|
|
312
330
|
// The named Charts (ADR-0070). The runtime ones are read from the volume now, and admitted when
|
|
313
331
|
// the first Assembly binds; with none current, every one waits unrunnable ("not in the current
|
|
314
332
|
// Assembly") and is never deleted.
|
|
315
|
-
const charts = new NamedCharts({ dir: opts.dir, host });
|
|
333
|
+
const charts: NamedCharts = new NamedCharts({ dir: opts.dir, host });
|
|
316
334
|
await charts.load();
|
|
317
335
|
// The current Assembly's own Workflow names (ADR-0069, ADR-0070): its Machines and its Chart
|
|
318
336
|
// files, as its record lists them. `GET /assembly` answers these; the runtime Charts the host
|
|
@@ -352,7 +370,8 @@ export async function startInstance(opts: InstanceOptions): Promise<RunningInsta
|
|
|
352
370
|
// by name. No current Assembly → no Workflows, and the process still serves (ADR-0048).
|
|
353
371
|
if (current) {
|
|
354
372
|
const booted = current;
|
|
355
|
-
|
|
373
|
+
const loaded = await importAssembly(booted.hash, booted.root);
|
|
374
|
+
swap(loaded, await readChartFiles(booted.root, undefined, contextDirsOf(loaded)), booted);
|
|
356
375
|
} else {
|
|
357
376
|
charts.bind({ workflows: [], files: [] });
|
|
358
377
|
}
|
|
@@ -390,11 +409,14 @@ export async function startInstance(opts: InstanceOptions): Promise<RunningInsta
|
|
|
390
409
|
const workflows = await importWorkflows(root);
|
|
391
410
|
// The Assembly's Chart files (ADR-0070): the door admits each against its wrapper, and one
|
|
392
411
|
// that fails refuses the publish naming the file.
|
|
393
|
-
const files = await readChartFiles(root);
|
|
412
|
+
const files = await readChartFiles(root, undefined, contextDirsOf(workflows));
|
|
413
|
+
// The runtime Charts on the volume: a dispatch of a named Chart may resolve to one (ADR-0071).
|
|
414
|
+
const runtimeCharts = (await readRuntimeCharts(opts.dir)).map((c) => ({ name: chartName(c.wrapper, c.name) }));
|
|
394
415
|
const refusals = await assemblyRefusals({
|
|
395
416
|
config,
|
|
396
417
|
workflows,
|
|
397
418
|
charts: files,
|
|
419
|
+
runtimeCharts,
|
|
398
420
|
...(opts.imageMap ? { images: opts.imageMap } : {}),
|
|
399
421
|
root,
|
|
400
422
|
});
|
|
@@ -615,10 +637,22 @@ export async function loadWorkflows(dir: string): Promise<Array<{ name: string;
|
|
|
615
637
|
* `workflows/<wrapper>/<name>.chart.json`, one level below the flat `workflows/*.ts`. The sibling
|
|
616
638
|
* of {@link loadWorkflows}, for `jr2 up`'s host-side walk, which admits each file against its
|
|
617
639
|
* wrapper with `chartFileRefusals`, the check the door's `assemblyRefusals({ charts })` runs. Any other file in a
|
|
618
|
-
* wrapper's directory is ignored and named to `warn
|
|
640
|
+
* wrapper's directory is ignored and named to `warn`, except in a docker context that one of
|
|
641
|
+
* `workflows` names (ADR-0037): jr2 reads that folder too.
|
|
619
642
|
*/
|
|
620
|
-
export function loadCharts(
|
|
621
|
-
|
|
643
|
+
export function loadCharts(
|
|
644
|
+
root: string,
|
|
645
|
+
workflows: LoadedWorkflow[],
|
|
646
|
+
warn?: (line: string) => void,
|
|
647
|
+
): Promise<ChartFile[]> {
|
|
648
|
+
return readChartFiles(root, warn, contextDirsOf(workflows));
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** Every docker context folder the registered Machines name (ADR-0037, ADR-0049): a Sandbox
|
|
652
|
+
* Image, a User Container image or an Effector image that jr2 builds. The Chart discovery does not
|
|
653
|
+
* name a file in one (ADR-0070). */
|
|
654
|
+
function contextDirsOf(workflows: LoadedWorkflow[]): string[] {
|
|
655
|
+
return partsOf(workflows.map((w) => w.machine)).images.map((i) => i.dir);
|
|
622
656
|
}
|
|
623
657
|
|
|
624
658
|
/**
|
|
@@ -629,6 +663,11 @@ export function loadCharts(root: string, warn?: (line: string) => void): Promise
|
|
|
629
663
|
* and the `images/<name>` dirname scan it was also written for both retired with ADR-0049. An
|
|
630
664
|
* ABSENT dir is empty; any other readdir failure (EACCES, ENOTDIR, …) throws — a directory that
|
|
631
665
|
* exists but cannot be read must be loud, never "no modules".
|
|
666
|
+
*
|
|
667
|
+
* A stem is a Workflow name, and a Workflow name has one rule wherever it is written: lowercase
|
|
668
|
+
* letters, digits and "-", the rule a Chart name keeps too (`WORKFLOW_NAME`). So `jr2 run`, the
|
|
669
|
+
* door's path and a `dispatch` slot name the same set of Workflows (ADR-0071), and a stem outside
|
|
670
|
+
* the rule throws here, naming the rename, before anything registers it.
|
|
632
671
|
*/
|
|
633
672
|
export async function discoverModules(moduleDir: string): Promise<Array<{ name: string; file: string }>> {
|
|
634
673
|
let entries: string[];
|
|
@@ -638,10 +677,31 @@ export async function discoverModules(moduleDir: string): Promise<Array<{ name:
|
|
|
638
677
|
if ((err as NodeJS.ErrnoException).code === "ENOENT") return [];
|
|
639
678
|
throw err;
|
|
640
679
|
}
|
|
641
|
-
|
|
680
|
+
const modules = entries
|
|
642
681
|
.filter((f) => f.endsWith(".ts") && !f.endsWith(".d.ts") && !f.startsWith("_"))
|
|
643
682
|
.sort()
|
|
644
683
|
.map((f) => ({ name: f.slice(0, -3), file: join(moduleDir, f) }));
|
|
684
|
+
for (const { name } of modules) {
|
|
685
|
+
if (!WORKFLOW_NAME.test(name)) {
|
|
686
|
+
throw new Error(
|
|
687
|
+
`${join(moduleDir, `${name}.ts`)}: a Workflow is named by its filename stem, in lowercase letters, digits ` +
|
|
688
|
+
`and "-", so that \`jr2 run\` and a \`dispatch\` slot name it the same way — rename it to ` +
|
|
689
|
+
`${kebabOf(name)}.ts (ADR-0071)`,
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return modules;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/** A stem outside the rule, as the rule would spell it: `reviewLoop` and `review_loop` are
|
|
697
|
+
* `review-loop`. */
|
|
698
|
+
function kebabOf(stem: string): string {
|
|
699
|
+
const out = stem
|
|
700
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
701
|
+
.toLowerCase()
|
|
702
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
703
|
+
.replace(/^-+|-+$/g, "");
|
|
704
|
+
return out === "" ? "workflow" : out;
|
|
645
705
|
}
|
|
646
706
|
|
|
647
707
|
/**
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @jr2/orchestrator/internal — NOT for workflow authors. Everything the kit's own packages share
|
|
2
|
+
// that is not on the Authoring surface (index.ts): the run host, the HTTP API, the Harness wire,
|
|
3
|
+
// the Custodian, the Effector wire, the cluster names, the load walk. The CLI, the e2e suite,
|
|
4
|
+
// and any other kit package that imports this one use it. No stability promise: any
|
|
5
|
+
// name here can change or go in any release, so a workflow or a `jr2.config.ts` that imports it
|
|
6
|
+
// is wrong, whatever compiles.
|
|
7
|
+
//
|
|
8
|
+
// It is the whole of index.ts plus the rest, so a kit file imports one specifier. The Orchestrator
|
|
9
|
+
// does NOT speak MCP (ADR-0013): the Harness presents the Menu to its model itself, and reaches the
|
|
10
|
+
// surface here through the Custodian in its pod.
|
|
11
|
+
|
|
12
|
+
export * from "./index.ts";
|
|
13
|
+
|
|
14
|
+
// The wire contract (ADR-0011): `defineEvent` is on the surface; the rest is the kit's.
|
|
15
|
+
export * from "@jr2/agent-protocol";
|
|
16
|
+
export * from "./agent.ts";
|
|
17
|
+
export * from "./effect.ts";
|
|
18
|
+
export * from "./http-effect.ts";
|
|
19
|
+
export * from "./sandbox-effect.ts";
|
|
20
|
+
export * from "./dispatch-effect.ts";
|
|
21
|
+
export type { EffectBinding, OpenEffect, OpenEffectPart } from "./open-effect.ts";
|
|
22
|
+
export { openPartsText } from "./open-effect.ts";
|
|
23
|
+
export * from "./effector-wire.ts";
|
|
24
|
+
export * from "./pick.ts";
|
|
25
|
+
export * from "./chart.ts";
|
|
26
|
+
export * from "./open-body.ts";
|
|
27
|
+
export * from "./charts.ts";
|
|
28
|
+
export * from "./parts.ts";
|
|
29
|
+
export * from "./size.ts";
|
|
30
|
+
export * from "./customize.ts";
|
|
31
|
+
export * from "./ambient.ts";
|
|
32
|
+
export * from "./config.ts";
|
|
33
|
+
export * from "./repo-identity.ts";
|
|
34
|
+
export * from "./pool.ts";
|
|
35
|
+
export * from "./setup.ts";
|
|
36
|
+
export { sentBy } from "./party.ts";
|
|
37
|
+
export * from "./vocabulary.ts";
|
|
38
|
+
export * from "./tokens.ts";
|
|
39
|
+
export * from "./durability.ts";
|
|
40
|
+
export * from "./snapshot-store.ts";
|
|
41
|
+
export * from "./actor.ts";
|
|
42
|
+
// The `gate` actor: jr2Setup pre-registers it and a state invokes it as `src: "gate"`, so no
|
|
43
|
+
// author writes the value (ADR-0015).
|
|
44
|
+
export * from "./gate.ts";
|
|
45
|
+
// The Failure's brand stays in fail.ts, and so does the logic that throws it: the kit makes a Failure
|
|
46
|
+
// only through `fail()` and `workspace()`, which imports that logic from fail.ts (ADR-0073).
|
|
47
|
+
export { failurePayload, isFailSlot } from "./fail.ts";
|
|
48
|
+
export type { Failure, FailSlot, FailureInput } from "./fail.ts";
|
|
49
|
+
export * from "./workspace.ts";
|
|
50
|
+
export * from "./images.ts";
|
|
51
|
+
export * from "./content-hash.ts";
|
|
52
|
+
export * from "./assembly-tar.ts";
|
|
53
|
+
export * from "./assembly.ts";
|
|
54
|
+
export * from "./assembly-checks.ts";
|
|
55
|
+
export * from "./mount-digest.ts";
|
|
56
|
+
export * from "./model-keys.ts";
|
|
57
|
+
export * from "./held-secrets.ts";
|
|
58
|
+
export * from "./secret-placement.ts";
|
|
59
|
+
export * from "./git-push.ts";
|
|
60
|
+
export * from "./git-clone.ts";
|
|
61
|
+
export * from "./custodian.ts";
|
|
62
|
+
export * from "./harness-env.ts";
|
|
63
|
+
export * from "./sandbox-kube.ts";
|
|
64
|
+
export {
|
|
65
|
+
effectorManifestKey,
|
|
66
|
+
LABEL_EFFECTOR_POD,
|
|
67
|
+
readSandboxEffectorManifest,
|
|
68
|
+
sandboxEffectorKeySecret,
|
|
69
|
+
sandboxEffectorObjectsOf,
|
|
70
|
+
type ProjectedSecret,
|
|
71
|
+
type SandboxEffectorManifest,
|
|
72
|
+
} from "./sandbox-effector.ts";
|
|
73
|
+
export * from "./repos.ts";
|
|
74
|
+
export * from "./repo-fetch.ts";
|
|
75
|
+
// Type-only: what a workflow event delivery looks like (the registration TABLE stays internal
|
|
76
|
+
// even here — ADR-0011).
|
|
77
|
+
export type { ChildErrorMarker, DeliveredEvent, PlacingMarker, RunMarker, TurnMarker } from "./registration.ts";
|
|
78
|
+
export * from "./machine-doc.ts";
|
|
79
|
+
export * from "./run-host.ts";
|
|
80
|
+
export * from "./http.ts";
|
|
81
|
+
export * from "./harness-client.ts";
|
|
82
|
+
export * from "./stub-harness.ts";
|
|
83
|
+
export * from "./instance.ts";
|
|
84
|
+
export * from "./server.ts";
|
|
85
|
+
export * from "./names.ts";
|
package/src/kube-client.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface KubeClient {
|
|
|
108
108
|
/** Create; an existing object is a {@link KubeError} with status 409. */
|
|
109
109
|
create<T extends KubeObject>(kind: KubeKind, namespace: string, body: T): Promise<T & KubeObject>;
|
|
110
110
|
/** Delete; true when there was one to delete, false when it was already gone. */
|
|
111
|
-
delete(kind: KubeKind, namespace: string, name: string): Promise<boolean>;
|
|
111
|
+
delete(kind: KubeKind, namespace: string, name: string, opts?: { foreground?: boolean }): Promise<boolean>;
|
|
112
112
|
/** A JSON merge patch — `null` removes a key. `status` patches the status subresource. Answers
|
|
113
113
|
* the object as it stands after the patch. */
|
|
114
114
|
patch<T extends KubeObject>(
|
|
@@ -216,9 +216,12 @@ export function kubeClient(opts: KubeClientOptions = {}): KubeClient {
|
|
|
216
216
|
});
|
|
217
217
|
},
|
|
218
218
|
|
|
219
|
-
delete(kind: KubeKind, ns: string, name: string) {
|
|
219
|
+
delete(kind: KubeKind, ns: string, name: string, opts: { foreground?: boolean } = {}) {
|
|
220
220
|
return writes(async () => {
|
|
221
|
-
|
|
221
|
+
// Foreground: the object stays until its dependents, a Sandbox's pod, are gone.
|
|
222
|
+
const res = await send("DELETE", pathOf(kind, ns, name), {
|
|
223
|
+
...(opts.foreground ? { query: { propagationPolicy: "Foreground" } } : {}),
|
|
224
|
+
});
|
|
222
225
|
if (res.status === 404) {
|
|
223
226
|
await res.body?.cancel();
|
|
224
227
|
return false;
|
package/src/machine-doc.ts
CHANGED
|
@@ -19,7 +19,9 @@ import type { AnyStateMachine, StateNode, TransitionDefinition } from "xstate";
|
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
import type { EventAudience } from "@jr2/agent-protocol";
|
|
21
21
|
import { argvText, isEffect, targetText, type EffectParts } from "./effect.ts";
|
|
22
|
+
import { isFailSlot } from "./fail.ts";
|
|
22
23
|
import { loadWarningsOf, seatsOf, vocabularyOf, type MachineSeat } from "./vocabulary.ts";
|
|
24
|
+
import { open } from "./open.ts";
|
|
23
25
|
|
|
24
26
|
/** One transition of the Machine, id-addressed at both ends. */
|
|
25
27
|
export type MachineTransitionDoc = {
|
|
@@ -40,9 +42,9 @@ export type MachineTransitionDoc = {
|
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
/** An Effect slot's parts, as the doc carries them (ADR-0067): a command's argv (an argv slot reads
|
|
43
|
-
* `<name>`)
|
|
45
|
+
* `<name>`) and its timeout. Its input names its Worktree, so the doc does not (ADR-0075). */
|
|
44
46
|
export type EffectDoc =
|
|
45
|
-
| { kind: "command"; argv: string[]; timeoutMs: number;
|
|
47
|
+
| { kind: "command"; argv: string[]; timeoutMs: number; secrets?: string[]; pin?: true }
|
|
46
48
|
/** An http Effect (ADR-0068): its method, its fixed target, the secrets it names — never a value
|
|
47
49
|
* — and `file` when its body is a Worktree file (ADR-0067). */
|
|
48
50
|
| {
|
|
@@ -55,7 +57,11 @@ export type EffectDoc =
|
|
|
55
57
|
file?: true;
|
|
56
58
|
}
|
|
57
59
|
/** A push (ADR-0067): which options the author set. */
|
|
58
|
-
| { kind: "push"; sign: boolean; squash: boolean; force: boolean; pin: boolean; timeoutMs: number; slot?: string }
|
|
60
|
+
| { kind: "push"; sign: boolean; squash: boolean; force: boolean; pin: boolean; timeoutMs: number; slot?: string }
|
|
61
|
+
/** A dispatch (ADR-0071): the Workflow it starts a run of, whether it waits, and the other
|
|
62
|
+
* Orchestrator's origin (`<open>` while a package leaves it Open); no target is this Orchestrator.
|
|
63
|
+
* The token's secret is named on the parts, never here: the target is what a reader routes on. */
|
|
64
|
+
| { kind: "dispatch"; workflow: string; wait: boolean; target?: string; timeoutMs: number };
|
|
59
65
|
|
|
60
66
|
/** One state of the Machine; `states` nests in document order. */
|
|
61
67
|
export type MachineStateDoc = {
|
|
@@ -67,8 +73,9 @@ export type MachineStateDoc = {
|
|
|
67
73
|
/** Initial child state id (compound only). */
|
|
68
74
|
initial?: string;
|
|
69
75
|
/** Each invoke's id and slot; an Effect's carries its plain-data parts (ADR-0067) — what it runs,
|
|
70
|
-
* where, and for how long, read without running anything.
|
|
71
|
-
|
|
76
|
+
* where, and for how long, read without running anything. `fail`: the slot is a `fail()`, so this
|
|
77
|
+
* state can fail the run (ADR-0073). */
|
|
78
|
+
invoke: Array<{ id: string; src: string; effect?: EffectDoc; fail?: true }>;
|
|
72
79
|
tags: string[];
|
|
73
80
|
description?: string;
|
|
74
81
|
states: MachineStateDoc[];
|
|
@@ -326,6 +333,7 @@ function serializeState(node: StateNode<any, any>, into: MachineTransitionDoc[],
|
|
|
326
333
|
type: node.type,
|
|
327
334
|
invoke: node.invoke.map((inv) => {
|
|
328
335
|
const logic = typeof inv.src === "string" ? scope.actors[inv.src] : undefined;
|
|
336
|
+
if (isFailSlot(logic)) return { id: inv.id, src: srcName(inv.src), fail: true as const };
|
|
329
337
|
if (!isEffect(logic)) return { id: inv.id, src: srcName(inv.src) };
|
|
330
338
|
return { id: inv.id, src: srcName(inv.src), effect: effectDoc(logic.effect) };
|
|
331
339
|
}),
|
|
@@ -404,12 +412,21 @@ function effectDoc(parts: EffectParts): EffectDoc {
|
|
|
404
412
|
const { sign, squash, force, pin, timeoutMs, slot } = parts;
|
|
405
413
|
return { kind: "push", sign, squash, force, pin, timeoutMs, ...(slot ? { slot } : {}) };
|
|
406
414
|
}
|
|
407
|
-
|
|
415
|
+
if (parts.kind === "dispatch") {
|
|
416
|
+
const { workflow, wait, timeoutMs, target } = parts;
|
|
417
|
+
return {
|
|
418
|
+
kind: "dispatch",
|
|
419
|
+
workflow,
|
|
420
|
+
wait,
|
|
421
|
+
...(target === undefined ? {} : { target: target === open ? "<open>" : target.url }),
|
|
422
|
+
timeoutMs,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
const { argv, timeoutMs, secrets, pin } = parts;
|
|
408
426
|
return {
|
|
409
427
|
kind: "command",
|
|
410
428
|
argv: argvText(argv),
|
|
411
429
|
timeoutMs,
|
|
412
|
-
...(slot ? { slot } : {}),
|
|
413
430
|
...(secrets?.length ? { secrets: [...secrets] } : {}),
|
|
414
431
|
...(pin ? { pin } : {}),
|
|
415
432
|
};
|