@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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OpenOf
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `OpenOf`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/open-effect.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type OpenOf<P extends OpenEffectPart> = [P] extends [never] ? unknown : OpenEffect<P>;
|
|
12
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OpenSecret
|
|
3
|
+
description: "`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)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `OpenSecret`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/http-effect.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type OpenSecret = {
|
|
12
|
+
readonly secret: string;
|
|
13
|
+
readonly path: { readonly secret: string; readonly path: true } & OpenSecretMark;
|
|
14
|
+
} & OpenSecretMark;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`secret(open)`: a secret a packaged Machine names in its auth, a header or a command's env, and
|
|
18
|
+
leaves for its composer to name ([ADR-0054](../decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md)).
|
|
19
|
+
|
|
20
|
+
**Fields**: each field of [`OpenSecretMark`](type-opensecretmark.md), and these:
|
|
21
|
+
|
|
22
|
+
- `secret`: `string`
|
|
23
|
+
- `path`: `{ readonly secret: string; readonly path: true; } & OpenSecretMark`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OpenSecretMark
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `OpenSecretMark`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/http-effect.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type OpenSecretMark = { readonly [openSecretMark]: true };
|
|
12
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PermissiveNoSlotWorkspaceOptions
|
|
3
|
+
description: "The options of a `workspace()` with no Repo Slot and no `input`: it starts with any input."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PermissiveNoSlotWorkspaceOptions`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/workspace.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PermissiveNoSlotWorkspaceOptions = Omit<SandboxOptions<never>, "repos"> & {
|
|
12
|
+
repos?: never;
|
|
13
|
+
input?: never;
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The options of a `workspace()` with no Repo Slot and no `input`: it starts with any input.
|
|
18
|
+
|
|
19
|
+
**Fields**: each field of [`SandboxOptions`](type-sandboxoptions.md), except `repos`, and these:
|
|
20
|
+
|
|
21
|
+
- `repos` (optional): `never`
|
|
22
|
+
|
|
23
|
+
Not present: the Workspace has no Repo Slot. Its Agents work in `/work`.
|
|
24
|
+
- `input` (optional): `never`
|
|
25
|
+
|
|
26
|
+
Not present: a `workspace()` without `input` starts with any input.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PermissiveWorkspaceOptions
|
|
3
|
+
description: "The options of a `workspace()` with no `input`: it starts with any input."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PermissiveWorkspaceOptions`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/workspace.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PermissiveWorkspaceOptions<TSlots extends string, TInput = unknown> = SandboxOptions<TSlots, TInput> & {
|
|
12
|
+
input?: never;
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The options of a `workspace()` with no `input`: it starts with any input. The `input` of a
|
|
17
|
+
per-run Repo Slot is then `unknown`, and the mapper must check it before it reads a field.
|
|
18
|
+
|
|
19
|
+
Use it for a Workspace that a Pool or another Machine starts. The body's `input` type says what
|
|
20
|
+
that input is, and that also types the input of the Workspace. For a Workspace that a caller
|
|
21
|
+
starts, declare `input`.
|
|
22
|
+
|
|
23
|
+
**Fields**: each field of [`SandboxOptions`](type-sandboxoptions.md), and these:
|
|
24
|
+
|
|
25
|
+
- `input` (optional): `never`
|
|
26
|
+
|
|
27
|
+
Not present: a `workspace()` without `input` starts with any input.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PoolMachine
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PoolMachine`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/pool.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PoolMachine<TWorker extends AnyStateMachine, TInput> = StateMachine<
|
|
12
|
+
any,
|
|
13
|
+
any,
|
|
14
|
+
any,
|
|
15
|
+
WrapperActors<"worker", TWorker, "next" | "gate" | "fail">,
|
|
16
|
+
any,
|
|
17
|
+
any,
|
|
18
|
+
any,
|
|
19
|
+
any,
|
|
20
|
+
any,
|
|
21
|
+
TInput,
|
|
22
|
+
PoolOutput,
|
|
23
|
+
any,
|
|
24
|
+
any,
|
|
25
|
+
any
|
|
26
|
+
> &
|
|
27
|
+
JR2Wrapper<TWorker>;
|
|
28
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PoolNextInput
|
|
3
|
+
description: "The input of a Source's `next`: the ids of the items that workers have now, the ids of the items that settled, and the Pool's input."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PoolNextInput`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/pool.ts`. It is an export of `@jr2/orchestrator`, on the [Authoring surface](../authoring-surface.md) page, in Composition.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PoolNextInput<TInput = unknown> = { active: string[]; settled: string[]; input: TInput };
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The input of a Source's `next`: the ids of the items that workers have now, the ids of the items
|
|
15
|
+
that settled, and the Pool's input. So a Source over a list that a Machine holds needs no state
|
|
16
|
+
of its own.
|
|
17
|
+
|
|
18
|
+
**Fields**
|
|
19
|
+
|
|
20
|
+
- `active`: `string[]`
|
|
21
|
+
- `settled`: `string[]`
|
|
22
|
+
- `input`: `TInput`
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PoolSpec
|
|
3
|
+
description: "What you pass to `pool()`: where the items come from, how many workers run at once, and what each worker gets."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PoolSpec`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/pool.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PoolSpec<T, TInput = unknown> = {
|
|
12
|
+
id?: string;
|
|
13
|
+
input?: z.ZodObject;
|
|
14
|
+
source: SourceSpec<T, TInput> | SourceSpec<T>;
|
|
15
|
+
itemId: (item: T) => string;
|
|
16
|
+
cap?: number | ((args: { input: TInput }) => number);
|
|
17
|
+
itemInput?: (item: T, args: { input: TInput }) => unknown;
|
|
18
|
+
onDrained?: "final";
|
|
19
|
+
failures?: "fail" | "report";
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
What you pass to `pool()`: where the items come from, how many workers run at once, and what
|
|
24
|
+
each worker gets.
|
|
25
|
+
|
|
26
|
+
**Fields**
|
|
27
|
+
|
|
28
|
+
- `id` (optional): `string`
|
|
29
|
+
|
|
30
|
+
The Machine id: the name of the Pool in the Console. Default: `"pool"`.
|
|
31
|
+
- `input` (optional): `z.ZodObject`
|
|
32
|
+
|
|
33
|
+
The run input of the Pool, as a zod object: what a caller sends to start a run. `cap` and
|
|
34
|
+
`itemInput` read it, typed by it. A worker never gets it: each worker gets its item. Default:
|
|
35
|
+
none, and then their `input` is `unknown`.
|
|
36
|
+
- `source`: `SourceSpec<T, TInput> | SourceSpec<T>`
|
|
37
|
+
|
|
38
|
+
Where the items come from. Make it with [`source`](source.md).
|
|
39
|
+
- `itemId`: `(item: T) => string`
|
|
40
|
+
|
|
41
|
+
The id of an item. The Pool uses it as the id of the item's worker and in the `active` list
|
|
42
|
+
that `next` gets. It is also the key of that worker's output in `items`. Give each item an id
|
|
43
|
+
of its own, and the same id every time.
|
|
44
|
+
- `cap` (optional): `number | ((args: { input: TInput; }) => number)`
|
|
45
|
+
|
|
46
|
+
The most workers that run at once: a number, or a function of the run input. Default: `1`.
|
|
47
|
+
- `itemInput` (optional): `(item: T, args: { input: TInput; }) => unknown`
|
|
48
|
+
|
|
49
|
+
Make a worker's input from its item and the run input. Default: the item itself.
|
|
50
|
+
- `onDrained` (optional): `"final"`
|
|
51
|
+
|
|
52
|
+
What the Pool does when the Source has no more items and every worker has settled. Only
|
|
53
|
+
`"final"`: the run ends. Default: `"final"`.
|
|
54
|
+
- `failures` (optional): `"fail" | "report"`
|
|
55
|
+
|
|
56
|
+
What the Pool does at the end when one or more workers failed. The Pool catches each worker's
|
|
57
|
+
Failure either way, so one failed item does not stop the other workers. `"fail"`: when the Pool
|
|
58
|
+
ends with failures, `drained` or `deadlocked`, it fails the run with the reason
|
|
59
|
+
`"<n> of <m> items failed"` and the detail `{ status, items, failures }`. `"report"`: the Pool
|
|
60
|
+
ends `done`, with the failures in its output. Default: `"fail"`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PushInput
|
|
3
|
+
description: "The input of a `push` Effect: the Worktree that a cut made, `{ sha }` with `pin`, and `{ message }` with `squash`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PushInput`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/sandbox-effect.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PushInput<O extends PushOptions> = {
|
|
12
|
+
worktree: O extends { slot: infer S extends string } ? `/work/${S}/${string}` : AnyWorktreePath;
|
|
13
|
+
branch?: never;
|
|
14
|
+
to?: never;
|
|
15
|
+
cwd?: never;
|
|
16
|
+
path?: never;
|
|
17
|
+
} & (O["pin"] extends true ? { sha: string } : unknown) &
|
|
18
|
+
(O["squash"] extends true ? { message: string } : unknown);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The input of a `push` Effect: the Worktree that a cut made, `{ sha }` with `pin`, and
|
|
22
|
+
`{ message }` with `squash`. It names no branch: jr2 reads it from the cut's record, so no word of
|
|
23
|
+
a Chart reaches a remote branch. The other keys are refused by name, because each is a key of a
|
|
24
|
+
cut or a Turn, and a mapper's excess key is no compile error otherwise.
|
|
25
|
+
|
|
26
|
+
**Fields**
|
|
27
|
+
|
|
28
|
+
- `worktree`: ``O extends { slot: infer S extends string; } ? `/work/${S}/${string}` : AnyWorktreePath``
|
|
29
|
+
|
|
30
|
+
The Worktree to push: `event.output.path` of its cut, of the push's Repo Slot.
|
|
31
|
+
- `branch` (optional): `never`
|
|
32
|
+
- `to` (optional): `never`
|
|
33
|
+
- `cwd` (optional): `never`
|
|
34
|
+
- `path` (optional): `never`
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PushOptions
|
|
3
|
+
description: The options of `push()`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PushOptions`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/sandbox-effect.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PushOptions = {
|
|
12
|
+
pin?: boolean;
|
|
13
|
+
sign?: boolean;
|
|
14
|
+
squash?: boolean;
|
|
15
|
+
force?: boolean;
|
|
16
|
+
slot?: string;
|
|
17
|
+
timeout?: Duration;
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The options of `push()`.
|
|
22
|
+
|
|
23
|
+
**Fields**
|
|
24
|
+
|
|
25
|
+
- `pin` (optional): `boolean`
|
|
26
|
+
|
|
27
|
+
`true`: the input of the Effect names the commit to push (`{ sha }`, a full commit id, for
|
|
28
|
+
example one that a Gate approved). Default: the tip of the Agent's branch when the Effect
|
|
29
|
+
starts. When the Agent removed that commit from its branch, the remote refuses the push. jr2
|
|
30
|
+
never pushes another commit in its place.
|
|
31
|
+
|
|
32
|
+
When it starts, it refuses a `sha` that is not a full commit id: `push({ pin: true }): its
|
|
33
|
+
input's sha is not a full commit id (got <sha>)`.
|
|
34
|
+
- `sign` (optional): `boolean`
|
|
35
|
+
|
|
36
|
+
`true`: push signed copies of the commits. The `sign` field of the `git.credentials` entry that
|
|
37
|
+
the Binding matches names the key. Default `false`.
|
|
38
|
+
|
|
39
|
+
At `jr2 up`, it refuses an entry with no `sign` field: `<push> signed, and git.credentials
|
|
40
|
+
entry "<match>" holds no sign field — add sign: { sshKey: "<a Secret with identity>", name:
|
|
41
|
+
"<committer name>", email: "<committer email>" } to it; the email must belong to the forge
|
|
42
|
+
account that holds the key (ADR-0051, ADR-0067)`. `<push>` names the push: `workflow
|
|
43
|
+
"<workflow>": push "<slot>" pushes Repo Slot "<name>" (<url>)`.
|
|
44
|
+
- `squash` (optional): `boolean`
|
|
45
|
+
|
|
46
|
+
`true`: push one commit that holds all the changes. The input of the Effect gives its message
|
|
47
|
+
(`{ message }`). Signed, its committer is the signer. Unsigned, it is the `committer` of the
|
|
48
|
+
`git.credentials` entry that the Binding matches. Default `false`.
|
|
49
|
+
|
|
50
|
+
When it starts, it refuses an input with no message: `push({ squash: true }): its input
|
|
51
|
+
carries no message`.
|
|
52
|
+
|
|
53
|
+
At `jr2 up`, it refuses an unsigned squash whose entry has no `sign` and no `committer`:
|
|
54
|
+
`<push> squashed without sign, and git.credentials entry "<match>" holds neither sign nor
|
|
55
|
+
committer — the squashed commit is new and needs a committer; add committer: { name:
|
|
56
|
+
"<committer name>", email: "<committer email>" } to it, or sign the push — push({ squash:
|
|
57
|
+
true, sign: true }) — and add sign: { sshKey: "<a Secret with identity>", name: "<committer
|
|
58
|
+
name>", email: "<committer email>" } to it (ADR-0051, ADR-0067)`.
|
|
59
|
+
- `force` (optional): `boolean`
|
|
60
|
+
|
|
61
|
+
`true`: replace what the remote branch holds. Default `false`.
|
|
62
|
+
- `slot` (optional): `string`
|
|
63
|
+
|
|
64
|
+
The Repo Slot to push. Write it only when the Workspace has more than one.
|
|
65
|
+
|
|
66
|
+
When it starts, it refuses:
|
|
67
|
+
- no `slot` under a Workspace with more than one Repo Slot: `push "<slot>" runs under a
|
|
68
|
+
Workspace carrying more than one Repo Slot (<slots>) — say which: { slot: "<slot>" }
|
|
69
|
+
(ADR-0051)`
|
|
70
|
+
- a `slot` that the Workspace does not have: `push "<slot>" names Repo Slot "<name>", which
|
|
71
|
+
its Workspace does not carry (<slots>)`
|
|
72
|
+
- a Workspace with no Repo Slot: `push "<slot>" runs under a Workspace with no Repo Slot: a
|
|
73
|
+
push publishes a Repo Slot's branch, and there is none — declare one: repos: { app: "<url>" }
|
|
74
|
+
(ADR-0051)`. `jr2 up` refuses it first, with the same reason.
|
|
75
|
+
- `timeout` (optional): [`Duration`](type-duration.md)
|
|
76
|
+
|
|
77
|
+
How long jr2 waits for the push: a number and a unit, such as `"90s"` or `"5m"`. Default
|
|
78
|
+
`"5m"`. With no answer in that time, the output is `unknown`. It refuses a value that is not a
|
|
79
|
+
positive duration: `timeout "<timeout>" is not a positive duration (like "30s", "5m")`.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PushOutput
|
|
3
|
+
description: "The output of a `push` Effect: what the `onDone` of its state gets as `event.output`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PushOutput`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/sandbox-effect.ts`. It is an export of `@jr2/orchestrator`, on the [Authoring surface](../authoring-surface.md) page, in Effects.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PushOutput =
|
|
12
|
+
| Exclude<PushWireOutput, { outcome: "pushed" }>
|
|
13
|
+
| (Omit<Extract<PushWireOutput, { outcome: "pushed" }>, "bundle"> & { sync: SyncState; syncReason?: string })
|
|
14
|
+
| LaterOutcome;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The output of a `push` Effect: what the `onDone` of its state gets as `event.output`. Every
|
|
18
|
+
outcome is output, so route on `outcome`:
|
|
19
|
+
|
|
20
|
+
- `pushed`: the remote has the commit. `published` is the commit on the remote, and `source` is
|
|
21
|
+
the Agent's commit that it comes from. They are the same commit, unless the push was signed or
|
|
22
|
+
squashed. `previous` is what the remote had before, and `unchanged` is `true` when the remote
|
|
23
|
+
had the commit already. `squashed` is `signed` or `unsigned` when the commit on the remote is
|
|
24
|
+
one squashed commit. `via` tells how jr2 found the new commits after a signed push:
|
|
25
|
+
`ancestry`, `pair`, `cherry` or `force`.
|
|
26
|
+
- `rejected`: git or the remote refused the push. `stage` tells where, `reason` tells why, and
|
|
27
|
+
`detail` has the words of git.
|
|
28
|
+
- `diverged`: the commit on the remote is not in the history of the Agent's branch, and jr2
|
|
29
|
+
could not pair it with a commit there. Nothing was pushed. `reason` tells why, and `published`
|
|
30
|
+
and `source` name the two commits.
|
|
31
|
+
- `unknown`: jr2 cannot tell what the push did. `reason` tells why.
|
|
32
|
+
|
|
33
|
+
Beside `pushed`, `sync` tells what jr2 did to the Agent's branch after the push:
|
|
34
|
+
|
|
35
|
+
- `synced`: the commit on the remote is not the Agent's own, and jr2 moved the branch to the
|
|
36
|
+
published commits.
|
|
37
|
+
- `already`: the branch has the published commit already.
|
|
38
|
+
- `skipped`: the remote has the Agent's own commit, so the branch does not move.
|
|
39
|
+
- `busy`: a rebase, merge, cherry-pick or revert of the branch is in progress. Nothing changed.
|
|
40
|
+
- `not-synced`: the branch did not move.
|
|
41
|
+
|
|
42
|
+
With `busy` or `not-synced`, `syncReason` tells why, and jr2 tries again before the next push.
|
|
43
|
+
|
|
44
|
+
The union is open (`LaterOutcome`): give the rest a last arm with no guard.
|
|
45
|
+
|
|
46
|
+
**Forms**: it is one of these objects.
|
|
47
|
+
|
|
48
|
+
- Form 1: `outcome`, `stage`, `reason`, `detail`
|
|
49
|
+
|
|
50
|
+
- `outcome`: `"rejected"`
|
|
51
|
+
- `stage`: `string`
|
|
52
|
+
- `reason`: `string`
|
|
53
|
+
- `detail` (optional): `string`
|
|
54
|
+
- Form 2: `outcome`, `reason`, `published`, `source`
|
|
55
|
+
|
|
56
|
+
- `outcome`: `"diverged"`
|
|
57
|
+
- `reason`: `string`
|
|
58
|
+
- `published`: `string`
|
|
59
|
+
- `source`: `string`
|
|
60
|
+
- Form 3: `outcome`, `reason`
|
|
61
|
+
|
|
62
|
+
- `outcome`: `"unknown"`
|
|
63
|
+
- `reason`: `string`
|
|
64
|
+
- Form 4: `outcome`, `published`, `source`, `previous`, `via`, `unchanged`, `newCommits`, `squashed`, `sync`, `syncReason`
|
|
65
|
+
|
|
66
|
+
- `outcome`: `"pushed"`
|
|
67
|
+
- `published`: `string`
|
|
68
|
+
- `source`: `string`
|
|
69
|
+
- `previous` (optional): `string`
|
|
70
|
+
- `via` (optional): `string`
|
|
71
|
+
- `unchanged` (optional): `boolean`
|
|
72
|
+
- `newCommits` (optional): `number`
|
|
73
|
+
- `squashed` (optional): `"signed" | "unsigned"`
|
|
74
|
+
- `sync`: [`SyncState`](type-syncstate.md)
|
|
75
|
+
- `syncReason` (optional): `string`
|
|
76
|
+
- Form 5: `outcome`, `reason`
|
|
77
|
+
|
|
78
|
+
- `outcome`: `"(a later outcome)"`
|
|
79
|
+
- `reason` (optional): `string`
|
|
80
|
+
|
|
81
|
+
**Example**
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import {
|
|
85
|
+
fail,
|
|
86
|
+
isReady,
|
|
87
|
+
jr2Setup,
|
|
88
|
+
push,
|
|
89
|
+
type PushOutput,
|
|
90
|
+
workspace,
|
|
91
|
+
worktree,
|
|
92
|
+
type Workspaced,
|
|
93
|
+
} from "@jr2/orchestrator";
|
|
94
|
+
|
|
95
|
+
type Input = Workspaced<{ branch: string; sha: string }, "app">;
|
|
96
|
+
|
|
97
|
+
const releaseTree = (context: Input) => `${context.workspace.repos.app}/release` as const;
|
|
98
|
+
|
|
99
|
+
// A push that did not happen (`rejected` or `diverged`) is a different problem from one jr2
|
|
100
|
+
// cannot see (`unknown`).
|
|
101
|
+
const notPushed = (output: PushOutput): boolean =>
|
|
102
|
+
output.outcome === "rejected" || output.outcome === "diverged";
|
|
103
|
+
|
|
104
|
+
const body = jr2Setup({
|
|
105
|
+
types: {} as { context: Input; input: Input },
|
|
106
|
+
actors: { cut: worktree({ expect: "existing" }), publish: push({ pin: true }), fail: fail() },
|
|
107
|
+
}).createMachine({
|
|
108
|
+
id: "release",
|
|
109
|
+
context: ({ input }) => input,
|
|
110
|
+
on: { "workspace.lost": ".lost" },
|
|
111
|
+
initial: "cutting",
|
|
112
|
+
states: {
|
|
113
|
+
cutting: {
|
|
114
|
+
invoke: {
|
|
115
|
+
src: "cut",
|
|
116
|
+
input: ({ context }) => ({ path: releaseTree(context), branch: context.branch }),
|
|
117
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "publishing" }, { target: "notCut" }],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
publishing: {
|
|
121
|
+
invoke: {
|
|
122
|
+
src: "publish",
|
|
123
|
+
input: ({ context }) => ({ worktree: releaseTree(context), sha: context.sha }),
|
|
124
|
+
onDone: [
|
|
125
|
+
{ guard: ({ event }) => event.output.outcome === "pushed", target: "published" },
|
|
126
|
+
{ guard: ({ event }) => notPushed(event.output), target: "notPushed" },
|
|
127
|
+
{ target: "unknown" },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
published: { type: "final" },
|
|
132
|
+
// Not final states: each one fails the run, with its own reason.
|
|
133
|
+
notPushed: { invoke: { src: "fail", input: { reason: "the remote refused the push" } } },
|
|
134
|
+
unknown: { invoke: { src: "fail", input: { reason: "jr2 cannot tell if the push happened" } } },
|
|
135
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
136
|
+
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const machine = workspace(body, {
|
|
141
|
+
repos: { app: { url: "https://github.com/you/app.git" } },
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**See also**
|
|
146
|
+
|
|
147
|
+
- [Push and sign a branch](../../guides/push-and-sign-a-branch.md)
|
|
148
|
+
- [Effects](../../concepts/effects.md)
|
|
149
|
+
- [ADR-0067: An Effect is an actor slot, and runs at most once unless marked idempotent](../decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: PushWireOutput
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `PushWireOutput`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/effector-wire.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type PushWireOutput = z.infer<typeof PushOutputShape>;
|
|
12
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quantity
|
|
3
|
+
description: "A Kubernetes quantity: `\"2Gi\"`, `\"1500m\"`, `\"2\"`, or a plain number (`2` cpus, bytes of memory)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `Quantity`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/size.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type Quantity = string | number;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
A Kubernetes quantity: `"2Gi"`, `"1500m"`, `"2"`, or a plain number (`2` cpus, bytes of memory).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Reached
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `Reached`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/customize.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type Reached<M extends AnyStateMachine> = M extends JR2Wrapper<infer TBody> ? Reached<TBody> : M;
|
|
12
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: RepoSlot
|
|
3
|
+
description: The value of one Repo Slot in `workspace({ repos })`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `RepoSlot`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/parts.ts`. It is an export of `@jr2/orchestrator`, on the [Authoring surface](../authoring-surface.md) page, in Workspaces and Repos.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type RepoSlot<TInput = unknown> =
|
|
12
|
+
| typeof open
|
|
13
|
+
| string
|
|
14
|
+
| Binding
|
|
15
|
+
| ((args: { input: TInput }) => string | Binding);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The value of one Repo Slot in `workspace({ repos })`. One of:
|
|
19
|
+
- a url, or a [`Binding`](type-binding.md) `{ url, ref }`: the Machine names the Repo.
|
|
20
|
+
- [`open`](open.md): the Instance that registers the Machine binds it with `customize()`. `jr2 up`
|
|
21
|
+
refuses a Workflow that leaves it open: ``refusing: workflow "<name>" leaves Repo Slot
|
|
22
|
+
"<slot>" open — bind it where the Machine is registered: export const machine =
|
|
23
|
+
customize(<import>, …) (ADR-0051)``, with the whole `customize` line to paste.
|
|
24
|
+
- a function of the run input, `({ input }) => url` or a [`Binding`](type-binding.md): each run chooses. The
|
|
25
|
+
url must match an entry of `git.credentials` in `jr2.config.ts`, or the run cannot use it.
|
|
26
|
+
|
|
27
|
+
The key of the slot is a directory name under `/work`. It starts with a letter, so never with
|
|
28
|
+
`.`: `/work/.jr2/` is reserved for jr2. `workspace()` and `customize()` refuse a key that does
|
|
29
|
+
not: ``<where>: Repo Slot key "<key>" is not a directory name — a slot becomes `/work/<slot>`,
|
|
30
|
+
`/work/.jr2/` is reserved for jr2, and its order matters, so it starts with a letter and matches
|
|
31
|
+
/^[A-Za-z][A-Za-z0-9._-]*$/ (ADR-0051, ADR-0075).`` They refuse a value of another
|
|
32
|
+
shape: ``<where>: Repo Slot "<slot>" is <what> — a slot is `open`, a url, `{ url, ref? }`, or a
|
|
33
|
+
mapper `({ input }) => url | { url, ref? }` over the door (ADR-0051).``
|
|
34
|
+
|
|
35
|
+
**Example**
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
import { jr2Setup, open, workspace, type RepoSlot, type Workspaced } from "@jr2/orchestrator";
|
|
40
|
+
|
|
41
|
+
const runInput = z.object({ service: z.string() });
|
|
42
|
+
type RunInput = z.infer<typeof runInput>;
|
|
43
|
+
|
|
44
|
+
const service: RepoSlot<RunInput> = ({ input }) => `https://github.com/you/${input.service}.git`;
|
|
45
|
+
|
|
46
|
+
const body = jr2Setup({
|
|
47
|
+
types: {} as { input: Workspaced<RunInput, "service" | "docs" | "config"> },
|
|
48
|
+
}).createMachine({
|
|
49
|
+
id: "body",
|
|
50
|
+
initial: "done",
|
|
51
|
+
states: { done: { type: "final" } },
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// A Machine for a package: the Instance that registers it binds `config`.
|
|
55
|
+
export const deploy = workspace(body, {
|
|
56
|
+
input: runInput,
|
|
57
|
+
repos: {
|
|
58
|
+
service,
|
|
59
|
+
docs: "https://github.com/you/docs.git",
|
|
60
|
+
config: open,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**See also**
|
|
66
|
+
|
|
67
|
+
- [Workspaces](../../concepts/workspaces.md)
|
|
68
|
+
- [Bind a shipped Machine's Open parts](../../guides/bind-open-parts.md)
|
|
69
|
+
- [Give the cluster git credentials](../../guides/give-the-cluster-git-credentials.md)
|
|
70
|
+
- [ADR-0051: A Repo is a slot on the `workspace()` and a cache on the node](../decisions/0051-a-repo-is-a-slot-on-the-workspace-and-a-cache-on-the-node.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: RepoSlotsOf
|
|
3
|
+
description: A type that the Authoring surface names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `RepoSlotsOf`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/customize.ts`. It is type plumbing: it computes a type from the types of a Machine or of its parts, and a workflow module does not write it. The signature of an export, or a type that it names, names this type, so its declaration is here. The [Authoring surface](../authoring-surface.md) page lists each export.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type RepoSlotsOf<M extends AnyStateMachine> = [WorkspaceOf<M>] extends [never]
|
|
12
|
+
? never
|
|
13
|
+
: WorkspaceOf<M> extends JR2Repos<infer TSlots>
|
|
14
|
+
? TSlots
|
|
15
|
+
: never;
|
|
16
|
+
```
|