@jr2/orchestrator 0.5.1 → 0.7.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/console/components/app.ts +55 -15
- package/console/components/bottom-drawer.ts +259 -0
- package/console/components/drawer.ts +14 -6
- package/console/components/fleet.ts +36 -13
- package/console/components/machine-pane.ts +61 -5
- package/console/components/nav.ts +54 -8
- package/console/conversation.ts +161 -0
- package/console/login.ts +123 -0
- package/console/main.ts +600 -60
- package/console/store.ts +611 -64
- package/console/style.css +231 -0
- package/docs/agents-block.md +2 -2
- package/docs/concepts/agents-and-turns.md +142 -29
- package/docs/concepts/architecture.md +60 -34
- package/docs/concepts/callers-and-hooks.md +205 -0
- package/docs/concepts/charts.md +13 -8
- package/docs/concepts/composition.md +10 -1
- package/docs/concepts/converge.md +7 -2
- package/docs/concepts/durable-runs.md +43 -16
- package/docs/concepts/effects.md +133 -50
- package/docs/concepts/gates.md +95 -25
- package/docs/concepts/machines-and-workflows.md +14 -4
- package/docs/concepts/pools-and-sources.md +193 -17
- package/docs/concepts/secrets-and-trust.md +186 -62
- package/docs/concepts/the-menu.md +14 -0
- package/docs/concepts/workspaces.md +135 -56
- package/docs/get-started/a-model-decides.md +14 -13
- package/docs/get-started/an-agent-in-a-sandbox.md +46 -35
- package/docs/get-started/connect-a-model.md +1 -1
- package/docs/get-started/create-an-instance.md +17 -14
- package/docs/get-started/have-your-assistant-write-a-machine.md +111 -40
- package/docs/get-started/install.md +4 -0
- package/docs/guides/add-tools-to-the-sandbox.md +72 -15
- package/docs/guides/answer-a-gate-from-a-forge.md +304 -0
- package/docs/guides/answer-a-gate.md +74 -37
- package/docs/guides/bind-open-parts.md +29 -12
- package/docs/guides/call-an-mcp-tool-from-a-machine.md +572 -0
- package/docs/guides/cancel-a-run.md +26 -16
- package/docs/guides/cut-a-worktree.md +560 -0
- package/docs/guides/fix-a-failed-converge.md +19 -7
- package/docs/guides/give-a-caller-a-scope.md +203 -0
- package/docs/guides/give-an-agent-mcp-tools.md +422 -0
- package/docs/guides/iterate-on-a-machine-on-kind.md +10 -9
- package/docs/guides/let-an-agent-write-a-chart.md +14 -7
- package/docs/guides/look-inside-a-sandbox.md +115 -42
- package/docs/guides/move-from-kind-to-a-shared-cluster.md +16 -0
- package/docs/guides/open-the-console.md +63 -14
- package/docs/guides/push-and-sign-a-branch.md +67 -21
- package/docs/guides/read-a-conversation.md +225 -0
- package/docs/guides/run-a-chart-by-name.md +17 -16
- package/docs/guides/run-a-command-or-call-a-url.md +84 -41
- package/docs/guides/run-one-worker-per-item.md +34 -27
- package/docs/guides/set-an-agents-access-and-dials.md +69 -22
- package/docs/guides/size-a-workspace.md +19 -6
- package/docs/guides/start-a-run-for-each-alert.md +290 -0
- package/docs/guides/start-a-run-from-a-run.md +18 -16
- package/docs/guides/start-a-run.md +24 -18
- package/docs/guides/steer-an-agent.md +332 -0
- package/docs/guides/use-a-hosted-provider.md +7 -1
- package/docs/guides/watch-a-run.md +146 -117
- package/docs/guides/write-a-hook-kind.md +238 -0
- package/docs/guides/write-a-tool-as-an-mcp-server.md +351 -0
- package/docs/guides/write-a-workflow.md +18 -8
- package/docs/llms.txt +110 -23
- package/docs/reference/authoring-surface/agent.md +35 -12
- package/docs/reference/authoring-surface/answer.md +20 -4
- package/docs/reference/authoring-surface/arg.md +28 -6
- package/docs/reference/authoring-surface/basic.md +1 -1
- package/docs/reference/authoring-surface/bearer.md +1 -1
- package/docs/reference/authoring-surface/branchname.md +15 -0
- package/docs/reference/authoring-surface/carry.md +23 -0
- package/docs/reference/authoring-surface/chartschema.md +1 -1
- package/docs/reference/authoring-surface/chartschemafor.md +1 -1
- package/docs/reference/authoring-surface/command.md +37 -22
- package/docs/reference/authoring-surface/customize.md +4 -1
- package/docs/reference/authoring-surface/defineconfig.md +1 -1
- package/docs/reference/authoring-surface/defineevent.md +1 -1
- package/docs/reference/authoring-surface/dispatch.md +5 -4
- package/docs/reference/authoring-surface/fail.md +18 -5
- package/docs/reference/authoring-surface/file.md +37 -17
- package/docs/reference/authoring-surface/frompick.md +1 -1
- package/docs/reference/authoring-surface/gate.md +118 -0
- package/docs/reference/authoring-surface/group-agents.md +15 -0
- package/docs/reference/authoring-surface/group-charts.md +16 -0
- package/docs/reference/authoring-surface/group-composition.md +25 -0
- package/docs/reference/authoring-surface/group-config.md +17 -0
- package/docs/reference/authoring-surface/group-effects.md +48 -0
- package/docs/reference/authoring-surface/group-failure.md +13 -0
- package/docs/reference/authoring-surface/group-gates.md +16 -0
- package/docs/reference/authoring-surface/group-machine-and-events.md +15 -0
- package/docs/reference/authoring-surface/group-steering.md +12 -0
- package/docs/reference/authoring-surface/group-types-these-signatures-name.md +137 -0
- package/docs/reference/authoring-surface/group-workspaces-and-repos.md +15 -0
- package/docs/reference/authoring-surface/http.md +109 -9
- package/docs/reference/authoring-surface/isfailure.md +1 -1
- package/docs/reference/authoring-surface/isready.md +14 -0
- package/docs/reference/authoring-surface/jr2setup.md +14 -4
- package/docs/reference/authoring-surface/mcp.md +107 -0
- package/docs/reference/authoring-surface/open.md +41 -8
- package/docs/reference/authoring-surface/openbody.md +1 -1
- package/docs/reference/authoring-surface/paramsof.md +23 -5
- package/docs/reference/authoring-surface/pool.md +79 -11
- package/docs/reference/authoring-surface/push.md +31 -13
- package/docs/reference/authoring-surface/readyof.md +21 -0
- package/docs/reference/authoring-surface/reread.md +19 -0
- package/docs/reference/authoring-surface/secret.md +26 -5
- package/docs/reference/authoring-surface/sentby.md +1 -1
- package/docs/reference/authoring-surface/skip.md +22 -0
- package/docs/reference/authoring-surface/source.md +59 -4
- package/docs/reference/authoring-surface/steer.md +93 -0
- package/docs/reference/authoring-surface/text.md +1 -1
- package/docs/reference/authoring-surface/type-agentdefinition.md +16 -3
- package/docs/reference/authoring-surface/type-agentmcpserver.md +54 -0
- package/docs/reference/authoring-surface/type-agentslots.md +4 -1
- 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-bindactors.md +14 -0
- package/docs/reference/authoring-surface/type-binding.md +6 -7
- package/docs/reference/authoring-surface/type-caller.md +40 -0
- package/docs/reference/authoring-surface/type-callerrecord.md +32 -0
- package/docs/reference/authoring-surface/type-carry.md +19 -0
- package/docs/reference/authoring-surface/type-chainlink.md +3 -3
- package/docs/reference/authoring-surface/type-commandinput.md +4 -3
- package/docs/reference/authoring-surface/type-commandoptions.md +0 -22
- package/docs/reference/authoring-surface/type-commandoutput.md +23 -5
- package/docs/reference/authoring-surface/type-customize.md +20 -3
- package/docs/reference/authoring-surface/type-delivered.md +17 -0
- package/docs/reference/authoring-surface/type-deliveredevent.md +18 -0
- package/docs/reference/authoring-surface/type-dispatchdefinition.md +4 -3
- package/docs/reference/authoring-surface/type-dispatchoutput.md +9 -2
- package/docs/reference/authoring-surface/type-doorlessinput.md +19 -0
- package/docs/reference/authoring-surface/type-effectbinding.md +12 -2
- package/docs/reference/authoring-surface/type-filebody.md +4 -8
- package/docs/reference/authoring-surface/type-framepath.md +14 -0
- package/docs/reference/authoring-surface/type-gatebinding.md +15 -0
- package/docs/reference/authoring-surface/type-gatehooks.md +12 -0
- package/docs/reference/authoring-surface/type-gatelook.md +37 -0
- package/docs/reference/authoring-surface/type-gateoutcome.md +32 -0
- package/docs/reference/authoring-surface/type-gatereply.md +19 -0
- package/docs/reference/authoring-surface/type-gateslot.md +21 -0
- package/docs/reference/authoring-surface/type-gateslotinput.md +13 -0
- package/docs/reference/authoring-surface/type-gateslotparts.md +18 -0
- package/docs/reference/authoring-surface/type-gateslots.md +12 -0
- package/docs/reference/authoring-surface/type-gatetypesat.md +13 -0
- package/docs/reference/authoring-surface/type-hostinjectedinput.md +3 -5
- package/docs/reference/authoring-surface/type-httpdefinition.md +6 -3
- package/docs/reference/authoring-surface/type-httpfileinput.md +20 -0
- package/docs/reference/authoring-surface/type-httpoutput.md +8 -2
- package/docs/reference/authoring-surface/type-jr2config.md +37 -2
- package/docs/reference/authoring-surface/type-lateroutcome.md +21 -0
- package/docs/reference/authoring-surface/type-lends.md +5 -1
- package/docs/reference/authoring-surface/type-lookoutput.md +14 -0
- package/docs/reference/authoring-surface/type-mcpcalloutput.md +78 -0
- package/docs/reference/authoring-surface/type-mcpnotreturned.md +42 -0
- package/docs/reference/authoring-surface/type-mcpoptions.md +47 -0
- package/docs/reference/authoring-surface/type-mcpoutput.md +50 -0
- package/docs/reference/authoring-surface/type-mcpreadoutput.md +53 -0
- package/docs/reference/authoring-surface/type-mcpremoteserver.md +50 -0
- package/docs/reference/authoring-surface/type-mcpserver.md +41 -0
- package/docs/reference/authoring-surface/type-mcpstdioserver.md +42 -0
- package/docs/reference/authoring-surface/type-namedsecret.md +4 -4
- package/docs/reference/authoring-surface/type-namestart.md +77 -0
- package/docs/reference/authoring-surface/type-noslotworkspaceoptions.md +1 -6
- package/docs/reference/authoring-surface/type-notworktreekeys.md +12 -0
- package/docs/reference/authoring-surface/type-openbodydeclaration.md +1 -1
- package/docs/reference/authoring-surface/type-openbodyoutput.md +1 -1
- package/docs/reference/authoring-surface/type-opencommandinput.md +7 -2
- package/docs/reference/authoring-surface/type-permissivenoslotworkspaceoptions.md +1 -6
- package/docs/reference/authoring-surface/type-permissiveworkspaceoptions.md +5 -10
- package/docs/reference/authoring-surface/type-poolnextinput.md +22 -0
- package/docs/reference/authoring-surface/type-poolspec.md +11 -6
- package/docs/reference/authoring-surface/type-pushinput.md +22 -3
- package/docs/reference/authoring-surface/type-pushoutput.md +33 -8
- package/docs/reference/authoring-surface/type-pushsourcespec.md +38 -0
- package/docs/reference/authoring-surface/type-readsourcespec.md +47 -0
- package/docs/reference/authoring-surface/type-reposlot.md +6 -6
- package/docs/reference/authoring-surface/type-reread.md +18 -0
- package/docs/reference/authoring-surface/type-runsconfig.md +41 -0
- package/docs/reference/authoring-surface/type-sandboxoptions.md +11 -4
- package/docs/reference/authoring-surface/type-sender.md +26 -1
- package/docs/reference/authoring-surface/type-sendercallerfield.md +14 -0
- package/docs/reference/authoring-surface/type-size.md +1 -1
- package/docs/reference/authoring-surface/type-skip.md +19 -0
- package/docs/reference/authoring-surface/type-slothandles.md +5 -13
- package/docs/reference/authoring-surface/type-sourcehooks.md +23 -0
- package/docs/reference/authoring-surface/type-sourcein.md +25 -0
- package/docs/reference/authoring-surface/type-sourcereply.md +18 -0
- package/docs/reference/authoring-surface/type-sourcespec.md +26 -17
- package/docs/reference/authoring-surface/type-sourceverdict.md +49 -0
- package/docs/reference/authoring-surface/type-standingpoolmachine.md +12 -0
- package/docs/reference/authoring-surface/type-standingpoolspec.md +51 -0
- package/docs/reference/authoring-surface/type-steerargs.md +20 -0
- package/docs/reference/authoring-surface/type-thinkinglevel.md +1 -1
- package/docs/reference/authoring-surface/type-usercontainer.md +1 -1
- package/docs/reference/authoring-surface/type-workspaced.md +30 -9
- package/docs/reference/authoring-surface/type-workspacehandles.md +5 -6
- package/docs/reference/authoring-surface/type-workspaceoptions.md +1 -13
- 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 +66 -38
- package/docs/reference/authoring-surface/worktree.md +71 -0
- package/docs/reference/authoring-surface.md +88 -147
- package/docs/reference/cli.md +413 -74
- package/docs/reference/config.md +248 -6
- package/docs/reference/decisions/0001-operator-owned-generic-sandbox.md +10 -9
- package/docs/reference/decisions/0002-duplex-streaming-actor.md +81 -14
- package/docs/reference/decisions/0004-worktree-provisioning-model.md +27 -21
- package/docs/reference/decisions/0005-sandbox-pod-composition.md +39 -25
- package/docs/reference/decisions/0006-agent-control-surface.md +6 -3
- package/docs/reference/decisions/0007-durable-machine-state.md +1 -1
- package/docs/reference/decisions/0009-cli-and-instance-interface.md +150 -49
- package/docs/reference/decisions/0010-bdd-acceptance-tests.md +5 -3
- package/docs/reference/decisions/0011-workflow-defined-events.md +256 -12
- package/docs/reference/decisions/0012-workspace-wrapper-machine.md +39 -32
- package/docs/reference/decisions/0013-the-agent-reaches-its-machine-through-a-container-it-cannot-read.md +54 -30
- package/docs/reference/decisions/0014-observation-is-open-run-state-is-not.md +53 -27
- package/docs/reference/decisions/0015-authoring-surface-absorbs-the-mechanism.md +26 -16
- package/docs/reference/decisions/0016-agent-turn-mechanics-are-internal.md +9 -7
- package/docs/reference/decisions/0017-pool-over-a-source-port.md +226 -10
- package/docs/reference/decisions/0018-instance-agents-are-definitions-jr2-assembles-the-harness.md +15 -7
- package/docs/reference/decisions/0019-one-converging-command-against-the-current-context.md +53 -27
- package/docs/reference/decisions/0021-workspace-continuity-is-a-lease-that-answers-back.md +16 -2
- package/docs/reference/decisions/0022-observation-is-a-level-triggered-feed.md +4 -4
- package/docs/reference/decisions/0023-the-harness-prints-the-conversation.md +124 -43
- package/docs/reference/decisions/0024-an-agents-turn-ends-with-the-state-that-asked-for-it.md +36 -38
- package/docs/reference/decisions/0025-cancel-ends-a-run-stop-parks-it.md +10 -5
- package/docs/reference/decisions/0027-the-harness-is-jr2s-own-server-flue-retires-the-wire-stays.md +16 -7
- package/docs/reference/decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md +36 -19
- package/docs/reference/decisions/0029-a-menu-is-fixed-for-a-conversation-and-a-turn-is-told-its-allowed-picks.md +18 -10
- package/docs/reference/decisions/0030-a-snapshot-names-the-machine-it-was-written-under.md +3 -2
- package/docs/reference/decisions/0031-menu-only-agents-run-on-the-instance-harness.md +23 -15
- package/docs/reference/decisions/0032-the-console-unlocks-with-a-callers-credential.md +101 -0
- package/docs/reference/decisions/0033-a-machine-declares-the-input-that-starts-it.md +22 -22
- package/docs/reference/decisions/0034-the-console-renders-with-preact-and-the-server-erases-the-types.md +6 -6
- package/docs/reference/decisions/0037-an-instance-builds-its-sandbox-images-jr2-injects-the-harness.md +13 -12
- package/docs/reference/decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md +23 -23
- package/docs/reference/decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md +6 -1
- package/docs/reference/decisions/0051-a-repo-is-a-slot-on-the-workspace-and-a-cache-on-the-node.md +57 -46
- package/docs/reference/decisions/0052-a-sandbox-lands-where-an-ordinary-pod-lands-and-the-cache-follows-it.md +5 -0
- package/docs/reference/decisions/0053-a-fetch-inside-the-pod-asks-the-node-cache-and-the-cache-asks-the-remote.md +20 -8
- package/docs/reference/decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md +55 -40
- package/docs/reference/decisions/0055-a-release-is-a-pushed-tag-and-the-publish-guard-is-the-credential.md +14 -13
- package/docs/reference/decisions/0057-a-turn-is-its-frame-its-dials-and-whether-it-continues.md +31 -24
- package/docs/reference/decisions/0058-a-harness-answers-the-orchestrator-alone.md +18 -10
- package/docs/reference/decisions/0059-a-harness-holds-stand-ins-and-the-custodian-holds-the-keys.md +137 -86
- package/docs/reference/decisions/0062-jr2-briefs-the-agent-on-its-seat-never-on-its-task.md +165 -91
- package/docs/reference/decisions/0063-the-orchestrator-watches-the-cluster.md +7 -7
- package/docs/reference/decisions/0064-a-workspace-waits-for-capacity.md +2 -2
- package/docs/reference/decisions/0065-a-persist-survives-a-crash-and-history-is-kept-for-a-set-time.md +109 -0
- package/docs/reference/decisions/0066-a-model-tier-runs-a-real-model-and-a-change-to-what-it-reads-runs-the-tier.md +53 -23
- package/docs/reference/decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md +221 -153
- package/docs/reference/decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md +161 -96
- package/docs/reference/decisions/0069-the-orchestrator-is-a-kit-image-and-an-instance-publishes-its-assembly.md +32 -9
- package/docs/reference/decisions/0070-a-machine-lends-its-parts-to-a-chart.md +48 -33
- package/docs/reference/decisions/0071-a-run-starts-a-run-through-a-dispatch-effect.md +56 -30
- package/docs/reference/decisions/0072-the-docs-ship-inside-the-kit-and-an-instances-agents-md-indexes-them.md +35 -25
- package/docs/reference/decisions/0073-a-machine-fails-a-run-with-fail-and-an-uncaught-failure-ends-it-failed.md +1 -1
- package/docs/reference/decisions/0075-a-machine-cuts-a-worktree-and-the-workspace-only-clones.md +296 -0
- package/docs/reference/decisions/0076-an-agents-control-credential-lives-only-where-no-workspace-code-runs.md +347 -0
- package/docs/reference/decisions/0077-jr2-requires-landlock-on-every-sandbox-node.md +79 -0
- package/docs/reference/decisions/0078-a-caller-comes-from-one-authenticator-seam-and-acts-within-its-scopes.md +285 -0
- package/docs/reference/decisions/0079-an-agent-holds-mcp-tools-a-machine-calls-them-as-an-effect-and-the-machine-is-the-approval.md +198 -0
- package/docs/reference/decisions.md +9 -4
- package/docs/reference/glossary.md +138 -45
- package/docs/reference/hooks.md +1077 -0
- package/docs/reference/http-api.md +988 -123
- package/docs/reference/machines.md +0 -1
- package/docs/why.md +7 -5
- package/package.json +10 -3
- package/src/actor.ts +194 -42
- package/src/agent.ts +56 -6
- package/src/ambient.ts +3 -5
- package/src/assembly-checks.ts +530 -4
- package/src/callers.ts +245 -0
- package/src/chart.ts +238 -26
- package/src/charts.ts +9 -2
- package/src/config.ts +566 -7
- package/src/conversations.ts +453 -0
- package/src/custodian.lua +17 -5
- package/src/custodian.ts +257 -77
- package/src/customize.ts +154 -7
- package/src/dispatch-effect.ts +142 -26
- package/src/durability.ts +2 -0
- package/src/duration.ts +20 -0
- package/src/effect-checks.ts +52 -4
- package/src/effect.ts +401 -132
- package/src/effector-wire.ts +278 -30
- package/src/fail.ts +17 -4
- package/src/gate-brand.ts +16 -0
- package/src/gate.ts +634 -48
- package/src/harness-client.ts +84 -35
- package/src/harness-env.ts +33 -0
- package/src/held-secrets.ts +197 -39
- package/src/holds.ts +5 -2
- package/src/hook-kinds/discord.ts +92 -0
- package/src/hook-kinds/door.ts +107 -0
- package/src/hook-kinds/github.ts +89 -0
- package/src/hook-kinds/gitlab.ts +72 -0
- package/src/hook-kinds/hook.ts +7 -0
- package/src/hook-kinds/index.ts +465 -0
- package/src/hook-kinds/slack.ts +151 -0
- package/src/hook-kinds/webhook.ts +113 -0
- package/src/hooks.ts +506 -0
- package/src/http-effect.ts +164 -70
- package/src/http.ts +933 -99
- package/src/index.ts +30 -5
- package/src/instance.ts +196 -26
- package/src/internal.ts +23 -3
- package/src/kube-client.ts +6 -3
- package/src/machine-doc.ts +29 -5
- package/src/mcp-effect.ts +424 -0
- package/src/model-keys.ts +24 -0
- package/src/mount-digest.ts +41 -7
- package/src/names.ts +82 -7
- package/src/notices.ts +576 -59
- package/src/open-body.ts +110 -30
- package/src/open-effect.ts +17 -4
- package/src/open.ts +40 -7
- package/src/parts.ts +125 -35
- package/src/party.ts +35 -1
- package/src/pick.ts +43 -9
- package/src/pool.ts +1172 -172
- package/src/registration.ts +249 -17
- package/src/repo-identity.ts +7 -3
- package/src/repos.ts +20 -2
- package/src/run-host.ts +1614 -190
- package/src/run-list.ts +191 -0
- package/src/sandbox-effect.ts +217 -66
- package/src/sandbox-kube.ts +116 -21
- package/src/secret-placement.ts +248 -35
- package/src/server.ts +53 -4
- package/src/setup.ts +158 -38
- package/src/snapshot-store.ts +565 -48
- package/src/steer.ts +111 -0
- package/src/stub-harness.ts +6 -2
- package/src/tokens.ts +362 -46
- package/src/vocabulary.ts +23 -4
- package/src/wire.ts +27 -10
- package/src/workspace.ts +314 -259
- package/src/worktree.ts +249 -0
- package/docs/reference/authoring-surface/type-noslotspec.md +0 -26
- package/docs/reference/authoring-surface/type-workspacespec.md +0 -37
- package/docs/reference/decisions/0032-the-console-unlocks-with-the-instance-token.md +0 -61
- package/docs/reference/decisions/0065-a-persist-survives-a-crash-and-history-is-a-week.md +0 -65
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: carry
|
|
3
|
+
description: Give the item itself.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `carry`
|
|
7
|
+
|
|
8
|
+
Function, in `@jr2/orchestrator/src/pool.ts`. It is an export of `@jr2/orchestrator`, in the [Composition](group-composition.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
function carry<T>(item: T): Carry<T>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Give the item itself. The Pool holds it, in its run's blob, until it claims it. Only a push
|
|
15
|
+
Source gives it.
|
|
16
|
+
|
|
17
|
+
**Parameters**
|
|
18
|
+
|
|
19
|
+
- `item`: The item, of the type of the Source's `item` schema.
|
|
20
|
+
|
|
21
|
+
**See also**
|
|
22
|
+
|
|
23
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
@@ -5,7 +5,7 @@ description: The Chart grammar, as a zod schema.
|
|
|
5
5
|
|
|
6
6
|
# `chartSchema`
|
|
7
7
|
|
|
8
|
-
Constant, in `@jr2/orchestrator/src/chart.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Constant, in `@jr2/orchestrator/src/chart.ts`. It is an export of `@jr2/orchestrator`, in the [Charts](group-charts.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
const chartSchema: z.ZodType<ChartText>
|
|
@@ -5,7 +5,7 @@ description: The Chart grammar for one Open body, as a zod schema.
|
|
|
5
5
|
|
|
6
6
|
# `chartSchemaFor`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/chart.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/chart.ts`. It is an export of `@jr2/orchestrator`, in the [Charts](group-charts.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function chartSchemaFor(decl: OpenBodyDeclaration): z.ZodType<ChartText>
|
|
@@ -5,7 +5,7 @@ description: "Make a `command` Effect: an actor slot that runs one program in th
|
|
|
5
5
|
|
|
6
6
|
# `command`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/harness-client.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/harness-client.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
## Overload 1
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ function command<
|
|
|
16
16
|
>(
|
|
17
17
|
argv: A,
|
|
18
18
|
options?: Opt,
|
|
19
|
-
): EffectLogic<CommandInput<A, Opt["pin"]>, CommandOutput> & OpenOf<EnvOpenParts<Opt>>
|
|
19
|
+
): EffectLogic<CommandInput<A, Opt["pin"], Opt>, CommandOutput> & OpenOf<EnvOpenParts<Opt>>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Make a `command` Effect: an actor slot that runs one program in the Workspace's Sandbox when a
|
|
@@ -29,8 +29,8 @@ shell, write it: `["sh", "-c", "…"]`.
|
|
|
29
29
|
|
|
30
30
|
Where it runs:
|
|
31
31
|
- With no Effect secret in `env`, in the Harness container of the enclosing Workspace's Sandbox.
|
|
32
|
-
It runs in the Worktree of
|
|
33
|
-
Agent's Working tools also run in this container.
|
|
32
|
+
It runs in the Worktree that `worktree` of the invoke's input names, or in `/work` in a
|
|
33
|
+
Workspace with no Repo Slot. The Agent's Working tools also run in this container.
|
|
34
34
|
- With an Effect secret in `env`, in the Sandbox Effector, against a commit of the branch. This
|
|
35
35
|
is the branch tip when it starts, or with `pin: true` the commit that the invoke's `input.sha`
|
|
36
36
|
names. The output then says `dirty: true` when the Worktree held edits that the command did
|
|
@@ -67,11 +67,9 @@ It refuses, when you call it:
|
|
|
67
67
|
And when it starts, with no Effect secret in `env`:
|
|
68
68
|
- outside a `workspace()`: `command "<slot>" runs in the Harness container of a Workspace, and
|
|
69
69
|
its state is not inside a workspace() — invoke it from a Workspace's body (ADR-0067)`
|
|
70
|
-
- no `
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- a `slot` that the Workspace does not have: `command "<slot>" names Repo Slot "<name>", which
|
|
74
|
-
its Workspace does not carry (<slots>)`
|
|
70
|
+
- no `worktree` under Repo Slots: `` command "<slot>" runs under a Workspace with Repo Slots
|
|
71
|
+
(<slots>) and its input names no `worktree`: say which, a Worktree that a cut gave or
|
|
72
|
+
`<slot>/default` ``
|
|
75
73
|
- an `arg()` with no string in `input`: `command "<slot>": argv slot <<name>> has no string
|
|
76
74
|
value in its input (got <type>) — map it in the invoke's input`. The angle brackets around the
|
|
77
75
|
arg's name are in the text: `argv slot <file>`. `<type>` is `nothing` when `input` has no such
|
|
@@ -80,15 +78,13 @@ And when it starts, with no Effect secret in `env`:
|
|
|
80
78
|
And when it starts, with an Effect secret in `env`:
|
|
81
79
|
- outside a `workspace()`: `command "<slot>" runs in the Sandbox Effector of a Workspace, and its
|
|
82
80
|
state is not inside a workspace() — invoke it from a Workspace's body (ADR-0067)`
|
|
83
|
-
- no `slot` under a Workspace with more than one Repo Slot: `command "<slot>" runs under a
|
|
84
|
-
Workspace carrying more than one Repo Slot (<slots>) — say which: { slot: "<slot>" }
|
|
85
|
-
(ADR-0051)`
|
|
86
81
|
- a Workspace with no Repo Slot: `command "<slot>" runs under a Workspace with no Repo Slot: a
|
|
87
82
|
command with an Effect secret runs against one commit of a Repo Slot's branch, and there is
|
|
88
83
|
none — declare a Repo Slot, or name no secret in its env, and it runs in /work beside the Agent
|
|
89
84
|
(ADR-0051)`. `jr2 up` refuses it first, with the same reason
|
|
90
|
-
- a `
|
|
91
|
-
|
|
85
|
+
- a `worktree` that no cut made in this Sandbox: the output is `exited` 127, with `no cut made
|
|
86
|
+
<path> in this Sandbox: cut it with worktree()` in its tail. A detached Worktree gets the same
|
|
87
|
+
form
|
|
92
88
|
- `pin: true` and an `input.sha` that is not a full commit id: `command "<slot>" (pin): its
|
|
93
89
|
input's sha is not a full commit id`
|
|
94
90
|
- an `arg()` with no string in `input`: the same text as above.
|
|
@@ -98,8 +94,7 @@ And when it starts, with an Effect secret in `env`:
|
|
|
98
94
|
- `argv`: The program and its arguments: strings and `arg("name")` entries. Or `open`, in a
|
|
99
95
|
Machine that you publish as a package, for the Instance that registers it to bind with
|
|
100
96
|
`customize()`.
|
|
101
|
-
- `options` ([`CommandOptions`](type-commandoptions.md)): Optional. `
|
|
102
|
-
where the Workspace has more than one. `timeout`: `"90s"`, `"10m"` or `"1h"`, default
|
|
97
|
+
- `options` ([`CommandOptions`](type-commandoptions.md)): Optional. `timeout`: `"90s"`, `"10m"` or `"1h"`, default
|
|
103
98
|
`"10m"`; when it expires, the output is `timeout`. `tail`: how many characters of the end of
|
|
104
99
|
the output stream to keep, default 4096. `env`: environment variables. Each value is
|
|
105
100
|
`secret("name")` for the value of an Effect secret, or `secret("name").path` for the path of a
|
|
@@ -112,26 +107,46 @@ And when it starts, with an Effect secret in `env`:
|
|
|
112
107
|
|
|
113
108
|
```ts
|
|
114
109
|
import { z } from "zod";
|
|
115
|
-
import {
|
|
110
|
+
import {
|
|
111
|
+
arg,
|
|
112
|
+
command,
|
|
113
|
+
fail,
|
|
114
|
+
isReady,
|
|
115
|
+
jr2Setup,
|
|
116
|
+
workspace,
|
|
117
|
+
worktree,
|
|
118
|
+
type Workspaced,
|
|
119
|
+
} from "@jr2/orchestrator";
|
|
116
120
|
|
|
117
121
|
const runInput = z.object({ branch: z.string() });
|
|
118
122
|
type BodyInput = Workspaced<z.infer<typeof runInput>, "app">;
|
|
119
123
|
|
|
124
|
+
const testTree = (context: BodyInput) => `${context.workspace.repos.app}/test` as const;
|
|
125
|
+
|
|
120
126
|
const body = jr2Setup({
|
|
121
|
-
types: {} as { input: BodyInput },
|
|
127
|
+
types: {} as { input: BodyInput; context: BodyInput },
|
|
122
128
|
actors: {
|
|
129
|
+
cut: worktree(),
|
|
123
130
|
tests: command(["node", "--test", arg("file")], { timeout: "5m" }),
|
|
124
131
|
fail: fail(),
|
|
125
132
|
},
|
|
126
133
|
}).createMachine({
|
|
127
134
|
id: "check",
|
|
135
|
+
context: ({ input }) => input,
|
|
128
136
|
on: { "workspace.lost": ".lost" },
|
|
129
|
-
initial: "
|
|
137
|
+
initial: "cutting",
|
|
130
138
|
states: {
|
|
139
|
+
cutting: {
|
|
140
|
+
invoke: {
|
|
141
|
+
src: "cut",
|
|
142
|
+
input: ({ context }) => ({ path: testTree(context), branch: context.branch }),
|
|
143
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "testing" }, { target: "notCut" }],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
131
146
|
testing: {
|
|
132
147
|
invoke: {
|
|
133
148
|
src: "tests",
|
|
134
|
-
input: { file: "test/greet.test.js" },
|
|
149
|
+
input: ({ context }) => ({ file: "test/greet.test.js", worktree: testTree(context) }),
|
|
135
150
|
onDone: [
|
|
136
151
|
{
|
|
137
152
|
guard: ({ event }) => event.output.outcome === "exited" && event.output.code === 0,
|
|
@@ -144,6 +159,7 @@ const body = jr2Setup({
|
|
|
144
159
|
passed: { type: "final" },
|
|
145
160
|
// Not final states: each one fails the run, and the run ends `failed`.
|
|
146
161
|
failed: { invoke: { src: "fail", input: { reason: "the test did not pass" } } },
|
|
162
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
147
163
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
148
164
|
},
|
|
149
165
|
});
|
|
@@ -151,7 +167,6 @@ const body = jr2Setup({
|
|
|
151
167
|
export const machine = workspace(body, {
|
|
152
168
|
input: runInput,
|
|
153
169
|
repos: { app: "https://github.com/you/app.git" },
|
|
154
|
-
spec: ({ input }) => ({ branch: input.branch }),
|
|
155
170
|
});
|
|
156
171
|
```
|
|
157
172
|
|
|
@@ -170,7 +185,7 @@ function command<
|
|
|
170
185
|
>(
|
|
171
186
|
argv: typeof open,
|
|
172
187
|
options?: Opt,
|
|
173
|
-
): EffectLogic<OpenCommandInput<Opt["pin"]>, CommandOutput> & OpenEffect<"argv" | EnvOpenParts<Opt>>
|
|
188
|
+
): EffectLogic<OpenCommandInput<Opt["pin"], Opt>, CommandOutput> & OpenEffect<"argv" | EnvOpenParts<Opt>>
|
|
174
189
|
```
|
|
175
190
|
|
|
176
191
|
Make a `command` Effect whose argv is Open: `command(open, options)`, in a Machine that you
|
|
@@ -5,7 +5,7 @@ description: Retune the parts that a Machine carries, without a change to the mo
|
|
|
5
5
|
|
|
6
6
|
# `customize`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/customize.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/customize.ts`. It is an export of `@jr2/orchestrator`, in the [Composition](group-composition.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function customize<M extends AnyStateMachine>(machine: M, parts: Customize<M>): M
|
|
@@ -24,6 +24,9 @@ refuse most mistakes when you compile. At run time, `customize()` also throws:
|
|
|
24
24
|
- `customize(): machine "<id>" carries no Agent slot "<slot>" — its Agents are: <slots>`
|
|
25
25
|
- `customize(): machine "<id>" composes no Machine under "<slot>" — the Machines it composes are: <slots>`
|
|
26
26
|
- `customize(): machine "<id>" carries no Effect slot "<slot>" — its Effects are: <slots>`
|
|
27
|
+
- `customize(): machine "<id>" carries no Gate slot "<slot>" — its Gate slots are: <slots>`
|
|
28
|
+
- `` customize(): Gate slot "<slot>"'s look is bound once, to a look or "none" — not `open` again ``, and the
|
|
29
|
+
refusals of a look that `gate()` makes
|
|
27
30
|
- `customize(): machine "<id>" declares no Repo Slot "<slot>" — its slots are: <slots>`
|
|
28
31
|
- `customize(): machine "<id>" declares its Repo Slots open as a map — name at least one`
|
|
29
32
|
- `` customize(): `repos` say what a SANDBOX is made of, how big it is and which Repos it
|
|
@@ -5,7 +5,7 @@ description: "Declare the config of an Instance: the default export of `jr2.conf
|
|
|
5
5
|
|
|
6
6
|
# `defineConfig`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/config.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/config.ts`. It is an export of `@jr2/orchestrator`, in the [Config](group-config.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function defineConfig(c: JR2Config): JR2Config
|
|
@@ -5,7 +5,7 @@ description: "Define one workflow event: an event that an Agent or the caller of
|
|
|
5
5
|
|
|
6
6
|
# `defineEvent`
|
|
7
7
|
|
|
8
|
-
Function, in `src/define-event.ts` of `@jr2/agent-protocol`, a dependency of `@jr2/orchestrator`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `src/define-event.ts` of `@jr2/agent-protocol`, a dependency of `@jr2/orchestrator`. It is an export of `@jr2/orchestrator`, in the [Machine and events](group-machine-and-events.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function defineEvent<const Name extends string, Input extends z.ZodObject>(def: {
|
|
@@ -5,7 +5,7 @@ description: "Make a `dispatch` Effect: it starts a run of a Workflow."
|
|
|
5
5
|
|
|
6
6
|
# `dispatch`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/dispatch-effect.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/dispatch-effect.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function dispatch<
|
|
@@ -69,9 +69,10 @@ It refuses:
|
|
|
69
69
|
How long the Effect waits: by default 30s for the start, and 10m with `wait`.
|
|
70
70
|
- `target` (optional): `{ url: string; token: NamedSecret; } | typeof open`
|
|
71
71
|
|
|
72
|
-
A different Orchestrator: `url` is its origin, and `token` is the secret that holds
|
|
73
|
-
|
|
74
|
-
<slot>: { target: { url, token
|
|
72
|
+
A different Orchestrator: `url` is its origin, and `token` is the secret that holds the token
|
|
73
|
+
of a Caller of it with `start` for the Workflow, and `read` too when `wait` is true. Or `open`,
|
|
74
|
+
which the composer binds with `customize(<import>, { effects: { <slot>: { target: { url, token
|
|
75
|
+
} } } })`. Without it, the run starts in this Orchestrator.
|
|
75
76
|
|
|
76
77
|
**Returns**: An Effect, for `actors`.
|
|
77
78
|
|
|
@@ -5,7 +5,7 @@ description: "Fail the run: the Part a Machine invokes to end work that did not
|
|
|
5
5
|
|
|
6
6
|
# `fail`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/fail.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/fail.ts`. It is an export of `@jr2/orchestrator`, in the [Failure](group-failure.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function fail(): FailSlot
|
|
@@ -37,24 +37,37 @@ It refuses an input that is not a Failure's, and the run ends `error`: ``fail: t
|
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
39
|
import { z } from "zod";
|
|
40
|
-
import { command, fail, jr2Setup, workspace, type Workspaced } from "@jr2/orchestrator";
|
|
40
|
+
import { command, fail, isReady, jr2Setup, workspace, worktree, type Workspaced } from "@jr2/orchestrator";
|
|
41
41
|
|
|
42
42
|
const runInput = z.object({ branch: z.string() });
|
|
43
|
+
type BodyInput = Workspaced<z.infer<typeof runInput>, "app">;
|
|
44
|
+
|
|
45
|
+
const testTree = (context: BodyInput) => `${context.workspace.repos.app}/test` as const;
|
|
43
46
|
|
|
44
47
|
const body = jr2Setup({
|
|
45
|
-
types: {} as { input:
|
|
48
|
+
types: {} as { input: BodyInput; context: BodyInput },
|
|
46
49
|
actors: {
|
|
50
|
+
cut: worktree(),
|
|
47
51
|
tests: command(["npm", "test"], { timeout: "15m" }),
|
|
48
52
|
fail: fail(),
|
|
49
53
|
},
|
|
50
54
|
}).createMachine({
|
|
51
55
|
id: "check",
|
|
56
|
+
context: ({ input }) => input,
|
|
52
57
|
on: { "workspace.lost": ".lost" },
|
|
53
|
-
initial: "
|
|
58
|
+
initial: "cutting",
|
|
54
59
|
states: {
|
|
60
|
+
cutting: {
|
|
61
|
+
invoke: {
|
|
62
|
+
src: "cut",
|
|
63
|
+
input: ({ context }) => ({ path: testTree(context), branch: context.branch }),
|
|
64
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "testing" }, { target: "notCut" }],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
55
67
|
testing: {
|
|
56
68
|
invoke: {
|
|
57
69
|
src: "tests",
|
|
70
|
+
input: ({ context }) => ({ worktree: testTree(context) }),
|
|
58
71
|
onDone: [
|
|
59
72
|
{
|
|
60
73
|
guard: ({ event }) => event.output.outcome === "exited" && event.output.code === 0,
|
|
@@ -67,6 +80,7 @@ const body = jr2Setup({
|
|
|
67
80
|
// Not a final state: the run ends `failed`, and the Workspace deletes the Sandbox.
|
|
68
81
|
failing: { invoke: { src: "fail", input: { reason: "npm test did not pass" } } },
|
|
69
82
|
passed: { type: "final" },
|
|
83
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
70
84
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
71
85
|
},
|
|
72
86
|
});
|
|
@@ -74,7 +88,6 @@ const body = jr2Setup({
|
|
|
74
88
|
export const machine = workspace(body, {
|
|
75
89
|
input: runInput,
|
|
76
90
|
repos: { app: "https://github.com/you/app.git" },
|
|
77
|
-
spec: ({ input }) => ({ branch: input.branch }),
|
|
78
91
|
});
|
|
79
92
|
```
|
|
80
93
|
|
|
@@ -5,25 +5,28 @@ description: "Make a Worktree file the body of an `http` Effect: `body: file(\"d
|
|
|
5
5
|
|
|
6
6
|
# `file`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/http-effect.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/http-effect.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function file<S extends z.ZodType | undefined = undefined>(path: FromInput<S, string>, options: {
|
|
12
|
-
slot?: string;
|
|
13
12
|
segments?: FromInput<S, readonly string[]>;
|
|
14
13
|
contentType?: string;
|
|
15
14
|
} = {}): FileBody<S>
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
Make a Worktree file the body of an `http` Effect: `body: file("dist/report.pdf")`. The Effect
|
|
19
|
-
then runs in the Sandbox Effector of the Workspace whose body invokes it.
|
|
20
|
-
|
|
18
|
+
then runs in the Sandbox Effector of the Workspace whose body invokes it. Under a Workspace with
|
|
19
|
+
Repo Slots, the invoke's input names the Worktree: `input: { worktree: "/work/app/fix" }`. It is a
|
|
20
|
+
Worktree that a cut of this run made. That Effector opens the file in that Worktree and sends it.
|
|
21
|
+
In a Workspace with no Repo Slot, the input names no `worktree`, and the path is relative to
|
|
21
22
|
`/work`, the folder that its steps share. Use it with `PUT`, `POST` or `PATCH`. `path` and
|
|
22
23
|
`segments` can be functions of the input of the Effect.
|
|
23
24
|
|
|
24
|
-
Some paths and files give the output `refused`, and then nothing is sent. The
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Some inputs, paths and files give the output `refused`, and then nothing is sent. The `worktree`
|
|
26
|
+
has no cut in this Sandbox: `no cut made <path> in this Sandbox: cut it with worktree(); nothing
|
|
27
|
+
was sent`. Or the input names a `worktree` in a Workspace with no Repo Slot. Or the path has a
|
|
28
|
+
symlink in it, has `..`, or is absolute. Or the file is a FIFO, a directory, or a file with more
|
|
29
|
+
than one link.
|
|
27
30
|
|
|
28
31
|
It refuses, when you call it:
|
|
29
32
|
- a path that is not a string or a function: `file(path): the path is a string, or a function of
|
|
@@ -43,16 +46,17 @@ And at `jr2 up`, an Effect that no `workspace()` invokes: `workflow "<workflow>"
|
|
|
43
46
|
there is no Worktree to read; invoke it from a workspace()'s body, or send a json or text body
|
|
44
47
|
(ADR-0068)`.
|
|
45
48
|
|
|
49
|
+
And when it starts, under a Workspace with Repo Slots, an input with no `worktree`: ``http
|
|
50
|
+
"<slot>" reads a Worktree file, under a Workspace with Repo Slots, and its input names no
|
|
51
|
+
`worktree` ``.
|
|
52
|
+
|
|
46
53
|
**Parameters**
|
|
47
54
|
|
|
48
|
-
- `path` ([`FromInput`](type-frominput.md)): The file, relative to the Worktree of the
|
|
49
|
-
with no Repo Slot: a string, or a function of the input of the Effect
|
|
55
|
+
- `path` ([`FromInput`](type-frominput.md)): The file, relative to the Worktree that `worktree` of the input names, or to
|
|
56
|
+
`/work` in a Workspace with no Repo Slot: a string, or a function of the input of the Effect
|
|
57
|
+
that gives one.
|
|
50
58
|
- `options`: Optional. Each field says what it does.
|
|
51
59
|
|
|
52
|
-
- `slot` (optional): `string`
|
|
53
|
-
|
|
54
|
-
The Repo Slot whose Worktree holds the file. Write it only when the Workspace has more than
|
|
55
|
-
one.
|
|
56
60
|
- `segments` (optional): `FromInput<S, readonly string[]>`
|
|
57
61
|
|
|
58
62
|
Path segments that jr2 adds to the end of the url, as `path` does in `request` for a json or
|
|
@@ -73,17 +77,22 @@ import {
|
|
|
73
77
|
fail,
|
|
74
78
|
file,
|
|
75
79
|
http,
|
|
80
|
+
isReady,
|
|
76
81
|
jr2Setup,
|
|
77
82
|
secret,
|
|
78
83
|
workspace,
|
|
84
|
+
worktree,
|
|
79
85
|
type Workspaced,
|
|
80
86
|
} from "@jr2/orchestrator";
|
|
81
87
|
|
|
82
88
|
type Input = Workspaced<{}, "app">;
|
|
83
89
|
|
|
90
|
+
const reportTree = (context: Input) => `${context.workspace.repos.app}/report` as const;
|
|
91
|
+
|
|
84
92
|
const body = jr2Setup({
|
|
85
93
|
types: {} as { context: Input; input: Input },
|
|
86
94
|
actors: {
|
|
95
|
+
cut: worktree(),
|
|
87
96
|
build: command(["npm", "run", "report"]),
|
|
88
97
|
upload: http({
|
|
89
98
|
method: "PUT",
|
|
@@ -100,18 +109,29 @@ const body = jr2Setup({
|
|
|
100
109
|
id: "report",
|
|
101
110
|
context: ({ input }) => input,
|
|
102
111
|
on: { "workspace.lost": ".lost" },
|
|
103
|
-
initial: "
|
|
112
|
+
initial: "cutting",
|
|
104
113
|
states: {
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
cutting: {
|
|
115
|
+
invoke: {
|
|
116
|
+
src: "cut",
|
|
117
|
+
input: ({ context }) => ({ path: reportTree(context), branch: "report" }),
|
|
118
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "building" }, { target: "notCut" }],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
building: {
|
|
122
|
+
invoke: { src: "build", input: ({ context }) => ({ worktree: reportTree(context) }), onDone: "uploading" },
|
|
123
|
+
},
|
|
124
|
+
uploading: {
|
|
125
|
+
invoke: { src: "upload", input: ({ context }) => ({ worktree: reportTree(context) }), onDone: "done" },
|
|
126
|
+
},
|
|
107
127
|
done: { type: "final" },
|
|
128
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
108
129
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
109
130
|
},
|
|
110
131
|
});
|
|
111
132
|
|
|
112
133
|
export const machine = workspace(body, {
|
|
113
134
|
repos: { app: { url: "https://github.com/you/app.git" } },
|
|
114
|
-
spec: () => ({ branch: "report" }),
|
|
115
135
|
});
|
|
116
136
|
```
|
|
117
137
|
|
|
@@ -5,7 +5,7 @@ description: "Make the `input` of the invoke of a state that a pick enters: the
|
|
|
5
5
|
|
|
6
6
|
# `fromPick`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/pick.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/pick.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
## Overload 1
|
|
11
11
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: gate
|
|
3
|
+
description: "The Gate: an input that a run waits for from outside the run (ADR-0011)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `gate`
|
|
7
|
+
|
|
8
|
+
Function, in `@jr2/orchestrator/src/gate.ts`. It is an export of `@jr2/orchestrator`, in the [Gates](group-gates.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
function gate<
|
|
12
|
+
const D extends readonly EventDef[],
|
|
13
|
+
M extends z.ZodObject = z.ZodObject<{}>,
|
|
14
|
+
R extends AnyActorLogic = never,
|
|
15
|
+
>(
|
|
16
|
+
spec: {
|
|
17
|
+
readonly meta?: M;
|
|
18
|
+
readonly delivers: D;
|
|
19
|
+
readonly hooks?: GateHooks<z.output<NoInfer<M>>, Delivered<D>>;
|
|
20
|
+
readonly look?: GateLook<z.output<NoInfer<M>>, Delivered<D>, R> | typeof open | "none";
|
|
21
|
+
readonly reply?: GateReply<z.output<NoInfer<M>>, Delivered<D>>;
|
|
22
|
+
},
|
|
23
|
+
): GateSlot<z.output<M>, Delivered<D>>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The Gate: an input that a run waits for from outside the run ([ADR-0011](../decisions/0011-workflow-defined-events.md)).
|
|
27
|
+
|
|
28
|
+
`gate({ … })` declares a GATE SLOT that also hears a Hook: put it in `actors` and invoke it by
|
|
29
|
+
its key. A plain Gate needs no value: jr2Setup puts it in each Machine as `invoke: { src: "gate" }`.
|
|
30
|
+
Its accepted set derives from the invoking state's transitions, and a Caller answers it with
|
|
31
|
+
`jr2 send`, the Console or `POST /runs/:runId/gates/:gate/events`.
|
|
32
|
+
|
|
33
|
+
- `meta`: a zod object of the meta that the invoking state sets. The Gate checks it when it
|
|
34
|
+
opens, and the handlers, the look and `reply` read it typed.
|
|
35
|
+
- `delivers`: the events that the handlers and the look can give. An event whose def leaves the
|
|
36
|
+
audience unset reads as `audience: "external"`, so no Agent below the Gate has it on its Menu.
|
|
37
|
+
`createMachine` refuses an entry that the Gate's derived accepted set does not hold.
|
|
38
|
+
- `hooks`: a handler for each Hook kind id and event key. A handler reads `{ payload, meta,
|
|
39
|
+
caller }` and gives one event of `delivers`, or `undefined` to ignore the delivery. It is pure
|
|
40
|
+
and synchronous. A throw is a refusal that the hook log keeps; it never faults the run.
|
|
41
|
+
- `look`: the Gate's read of the fact that it waits for (see [`GateLook`](type-gatelook.md)), `"none"` for a
|
|
42
|
+
Gate that hears a command, or `open` for the composer to bind with
|
|
43
|
+
`customize(m, { gates: { <slot>: { look } } })`. With no look and no `after` on the invoking
|
|
44
|
+
state, or with an Open look, `jr2 up` warns.
|
|
45
|
+
- `reply`: the text that the person who acted reads, for a Hook kind whose answer a person reads.
|
|
46
|
+
|
|
47
|
+
It throws on a spec that it cannot run: an unknown key, a `delivers` that is empty or that holds an
|
|
48
|
+
entry `defineEvent` did not make, a handler that is not a function, or a look whose read is not an
|
|
49
|
+
`http` Effect marked `idempotent: true` or a promise.
|
|
50
|
+
|
|
51
|
+
**Parameters**
|
|
52
|
+
|
|
53
|
+
- `spec`
|
|
54
|
+
|
|
55
|
+
- `meta` (optional): `M`
|
|
56
|
+
|
|
57
|
+
A zod object for the meta that the invoking state sets. The Gate checks it when it opens.
|
|
58
|
+
- `delivers`: `D`
|
|
59
|
+
|
|
60
|
+
The events that the handlers and the look can give.
|
|
61
|
+
- `hooks` (optional): `GateHooks<z.output<NoInfer<M>>, Delivered<D>>`
|
|
62
|
+
|
|
63
|
+
The handlers, by Hook kind id and event key.
|
|
64
|
+
- `look` (optional): `GateLook<z.output<NoInfer<M>>, Delivered<D>, R> | typeof open | "none"`
|
|
65
|
+
|
|
66
|
+
The look, `"none"` for a Gate that hears a command, or `open` for its composer to bind.
|
|
67
|
+
- `reply` (optional): `GateReply<z.output<NoInfer<M>>, Delivered<D>>`
|
|
68
|
+
|
|
69
|
+
The text that the person who acted reads.
|
|
70
|
+
|
|
71
|
+
**Example**
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { z } from "zod";
|
|
75
|
+
import type {} from "@jr2/orchestrator/hooks/github";
|
|
76
|
+
import { defineEvent, gate, jr2Setup } from "@jr2/orchestrator";
|
|
77
|
+
|
|
78
|
+
const approve = defineEvent({ name: "approve", input: z.object({ by: z.string() }) });
|
|
79
|
+
|
|
80
|
+
const review = gate({
|
|
81
|
+
meta: z.object({ pr: z.string(), sha: z.string() }),
|
|
82
|
+
delivers: [approve],
|
|
83
|
+
hooks: {
|
|
84
|
+
github: {
|
|
85
|
+
"pull_request_review.submitted": ({ payload, meta }) =>
|
|
86
|
+
payload.pull_request.html_url === meta.pr &&
|
|
87
|
+
payload.review.commit_id === meta.sha &&
|
|
88
|
+
payload.review.state === "approved"
|
|
89
|
+
? { type: "approve", by: payload.review.user.login }
|
|
90
|
+
: undefined,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
look: "none",
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const machine = jr2Setup({
|
|
97
|
+
types: {} as { context: { pr: string; sha: string }; input: { pr: string; sha: string } },
|
|
98
|
+
events: [approve],
|
|
99
|
+
actors: { review },
|
|
100
|
+
}).createMachine({
|
|
101
|
+
id: "pr",
|
|
102
|
+
context: ({ input }) => input,
|
|
103
|
+
initial: "inReview",
|
|
104
|
+
states: {
|
|
105
|
+
inReview: {
|
|
106
|
+
invoke: { src: "review", input: ({ context }) => ({ meta: { pr: context.pr, sha: context.sha } }) },
|
|
107
|
+
on: { approve: "merged" },
|
|
108
|
+
},
|
|
109
|
+
merged: { type: "final" },
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**See also**
|
|
115
|
+
|
|
116
|
+
- [Gates](../../concepts/gates.md)
|
|
117
|
+
- [Answer a Gate from a forge](../../guides/answer-a-gate-from-a-forge.md)
|
|
118
|
+
- [ADR-0011: Control events are workflow-defined and delivered by closure, not routed](../decisions/0011-workflow-defined-events.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Authoring surface: Agents"
|
|
3
|
+
description: An Agent slot and the definition it carries (ADR-0028, ADR-0049).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authoring surface: Agents
|
|
7
|
+
|
|
8
|
+
This page is one group of the names that `@jr2/orchestrator` exports from its root, on the [Authoring surface](../authoring-surface.md) page. It gives each name its kind and the first sentence of its TSDoc. Each name has a page of its own, in this folder.
|
|
9
|
+
|
|
10
|
+
An Agent slot and the definition it carries ([ADR-0028](../decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md), [ADR-0049](../decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md)).
|
|
11
|
+
|
|
12
|
+
- [`agent`](agent.md) (function): Make an Agent: an actor slot that runs one Turn of a model each time a state invokes it.
|
|
13
|
+
- [`AgentDefinition`](type-agentdefinition.md) (type): An Agent's definition: which model it runs, its instructions, and what it may do to the Workspace.
|
|
14
|
+
- [`AgentMcpServer`](type-agentmcpserver.md) (type): One MCP server that an Agent uses, and the tools that it may call there.
|
|
15
|
+
- [`ThinkingLevel`](type-thinkinglevel.md) (type): How hard the model thinks before it answers: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"` or `"xhigh"`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Authoring surface: Charts"
|
|
3
|
+
description: "The Open body a Chart wrapper places in `actors`, and the grammar a planner's pick declares, whole or narrowed to one wrapper (ADR-0070)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authoring surface: Charts
|
|
7
|
+
|
|
8
|
+
This page is one group of the names that `@jr2/orchestrator` exports from its root, on the [Authoring surface](../authoring-surface.md) page. It gives each name its kind and the first sentence of its TSDoc. Each name has a page of its own, in this folder.
|
|
9
|
+
|
|
10
|
+
The Open body a Chart wrapper places in `actors`, and the grammar a planner's pick declares, whole or narrowed to one wrapper ([ADR-0070](../decisions/0070-a-machine-lends-its-parts-to-a-chart.md)).
|
|
11
|
+
|
|
12
|
+
- [`openBody`](openbody.md) (function): Make an Open body: the actor slot that a Chart binds.
|
|
13
|
+
- [`OpenBodyDeclaration`](type-openbodydeclaration.md) (type): What an Open body declares: the parts that it lends a Chart, what the Agents of a Chart can have, and the limits of a Chart.
|
|
14
|
+
- [`OpenBodyOutput`](type-openbodyoutput.md) (type): The output of an Open body.
|
|
15
|
+
- [`chartSchema`](chartschema.md) (constant): The Chart grammar, as a zod schema.
|
|
16
|
+
- [`chartSchemaFor`](chartschemafor.md) (function): The Chart grammar for one Open body, as a zod schema.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Authoring surface: Composition"
|
|
3
|
+
description: "A part left Open, a Machine's parts retuned, a Pool over a Source (ADR-0017, ADR-0049, ADR-0054, ADR-0060)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authoring surface: Composition
|
|
7
|
+
|
|
8
|
+
This page is one group of the names that `@jr2/orchestrator` exports from its root, on the [Authoring surface](../authoring-surface.md) page. It gives each name its kind and the first sentence of its TSDoc. Each name has a page of its own, in this folder.
|
|
9
|
+
|
|
10
|
+
A part left Open, a Machine's parts retuned, a Pool over a Source ([ADR-0017](../decisions/0017-pool-over-a-source-port.md), [ADR-0049](../decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md), [ADR-0054](../decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md), [ADR-0060](../decisions/0060-a-workspace-states-its-size-and-jr2-reserves-all-of-it.md)).
|
|
11
|
+
|
|
12
|
+
- [`open`](open.md) (constant): Leave a part of a Machine Open: for the Instance that registers the Machine to bind with `customize()`.
|
|
13
|
+
- [`customize`](customize.md) (function): Retune the parts that a Machine carries, without a change to the module that exports it.
|
|
14
|
+
- [`Customize`](type-customize.md) (type): The parts of one Machine that `customize()` can retune: its Agents, its Open Effects, the Machines it composes, and the Sandbox of its `workspace()`.
|
|
15
|
+
- [`EffectBinding`](type-effectbinding.md) (type): The values that bind the Open parts of one Effect.
|
|
16
|
+
- [`Size`](type-size.md) (type): The Size of a Workspace: the most memory and cpu that its whole Sandbox can use.
|
|
17
|
+
- [`UserContainer`](type-usercontainer.md) (type): The User Container in its object form: its image, and its part of the Workspace's Size.
|
|
18
|
+
- [`carry`](carry.md) (function): Give the item itself.
|
|
19
|
+
- [`pool`](pool.md) (function): Make a Pool: a Machine that runs one worker for each item that a Source gives, with at most `cap` workers at once.
|
|
20
|
+
- [`reread`](reread.md) (function): Read the Source again.
|
|
21
|
+
- [`skip`](skip.md) (function): Bring nothing, and say why.
|
|
22
|
+
- [`source`](source.md) (function): Declare a Source: where a `pool()` gets its work items, one at a time.
|
|
23
|
+
- [`PoolNextInput`](type-poolnextinput.md) (type): 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.
|
|
24
|
+
- [`SourceReply`](type-sourcereply.md) (type): The text that the person who acted reads, from this Source's verdict (ADR-0011, ADR-0017).
|
|
25
|
+
- [`SourceVerdict`](type-sourceverdict.md) (type): A Source's verdict on one delivery, as its `reply` reads it (ADR-0017).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Authoring surface: Config"
|
|
3
|
+
description: "`jr2.config.ts`, the deployment facts a Machine cannot carry (ADR-0050)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authoring surface: Config
|
|
7
|
+
|
|
8
|
+
This page is one group of the names that `@jr2/orchestrator` exports from its root, on the [Authoring surface](../authoring-surface.md) page. It gives each name its kind and the first sentence of its TSDoc. Each name has a page of its own, in this folder.
|
|
9
|
+
|
|
10
|
+
`jr2.config.ts`, the deployment facts a Machine cannot carry ([ADR-0050](../decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md)).
|
|
11
|
+
|
|
12
|
+
- [`defineConfig`](defineconfig.md) (function): Declare the config of an Instance: the default export of `jr2.config.ts`.
|
|
13
|
+
- [`JR2Config`](type-jr2config.md) (type): The shape of `jr2.config.ts`: the deployment facts of an Instance, which a Machine cannot carry.
|
|
14
|
+
- [`McpRemoteServer`](type-mcpremoteserver.md) (type): A remote MCP server, which the Harness reaches over Streamable HTTP.
|
|
15
|
+
- [`McpServer`](type-mcpserver.md) (type): One MCP server of the Instance: a `McpRemoteServer` (`url`) or a `McpStdioServer` (`command`).
|
|
16
|
+
- [`McpStdioServer`](type-mcpstdioserver.md) (type): A stdio MCP server: a program of the Sandbox Image that the Harness starts for each Agent conversation, through jr2's spawner, inside the Agent's confinement.
|
|
17
|
+
- [`RunsConfig`](type-runsconfig.md) (type): How long jr2 keeps an ended run, and the volume that keeps it (ADR-0065).
|