@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
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# jr2
|
|
2
2
|
|
|
3
|
-
> A kit for agentic workflows as xstate Machines, run on Kubernetes. These are the docs of Kit version 0.
|
|
3
|
+
> A kit for agentic workflows as xstate Machines, run on Kubernetes. These are the docs of Kit version 0.7.0, as plain Markdown.
|
|
4
4
|
|
|
5
5
|
## Home
|
|
6
6
|
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
- [Machines and Workflows](concepts/machines-and-workflows.md): What a Machine and a Workflow are, the door of a run, the Vocabulary, and Emits.
|
|
25
25
|
- [Agents and Turns](concepts/agents-and-turns.md): What an Agent is, what one Turn of an Agent holds, how a Turn ends, and what jr2 does when a Turn fails.
|
|
26
26
|
- [The Menu](concepts/the-menu.md): How an Agent picks from the events that its Machine takes, and how the Machine decides what each pick does.
|
|
27
|
-
- [Gates](concepts/gates.md): How a run waits for an event from a person, the CLI, the Console, a
|
|
28
|
-
- [Effects](concepts/effects.md): How a Machine runs a command, calls a URL, pushes a branch or starts a run
|
|
27
|
+
- [Gates](concepts/gates.md): How a run waits for an event from a person, the CLI, the Console, a Hook or a CI job.
|
|
28
|
+
- [Effects](concepts/effects.md): How a Machine runs a command, calls a URL or an MCP tool, pushes a branch or starts a run.
|
|
29
29
|
- [Workspaces](concepts/workspaces.md): How a Workflow gets a Sandbox with a git Worktree or a shared folder, and how long it keeps it.
|
|
30
30
|
- [Composition](concepts/composition.md): How a Machine composes Machines that you import, and how you bind the parts that they leave Open.
|
|
31
31
|
- [Charts](concepts/charts.md): How an Agent writes a Machine as data at run time, which cannot reach the process of the Orchestrator.
|
|
32
|
-
- [Pools and Sources](concepts/pools-and-sources.md): How a Pool runs one worker
|
|
32
|
+
- [Pools and Sources](concepts/pools-and-sources.md): How a Pool runs one worker for each item of a Source, how a Hook brings items, and how its run ends.
|
|
33
33
|
- [Architecture](concepts/architecture.md): What runs on your computer, in the cluster and in a Sandbox, and which part does what.
|
|
34
34
|
- [Secrets and trust](concepts/secrets-and-trust.md): Where jr2 keeps each credential, which tokens it makes, and what a caller can see and do without one.
|
|
35
|
+
- [Callers and Hooks](concepts/callers-and-hooks.md): Who acts on an Instance from outside its Machines, what each one may do, and what a Hook does.
|
|
35
36
|
- [Converge](concepts/converge.md): What jr2 up makes in the cluster from your Instance folder, and the Assembly that it publishes.
|
|
36
37
|
- [Durable runs](concepts/durable-runs.md): How a run survives a restart of the Orchestrator, what ends it, and how long jr2 keeps a run that ended.
|
|
37
38
|
|
|
@@ -39,13 +40,17 @@
|
|
|
39
40
|
|
|
40
41
|
- [Start a run](guides/start-a-run.md): Start a run of a Workflow from the CLI, from the Console, or with a call to the HTTP API.
|
|
41
42
|
- [Answer a Gate](guides/answer-a-gate.md): Send an event to an open Gate of a run, from the CLI, the Console, a webhook handler or a CI job.
|
|
43
|
+
- [Answer a Gate from a forge](guides/answer-a-gate-from-a-forge.md): Make a Gate that a review on GitHub or GitLab answers, and that looks for the review it waits for.
|
|
44
|
+
- [Steer an Agent](guides/steer-an-agent.md): Send free text to one Agent of a live run, from the CLI, from HTTP, or from the Machine itself.
|
|
42
45
|
- [Watch a run](guides/watch-a-run.md): See where a run is and what its Agents do: in the CLI, in the Console, and in the pod log.
|
|
46
|
+
- [Read a conversation](guides/read-a-conversation.md): Read what an Agent said and did in a run, live or after the run ended, with jr2 logs or the Console.
|
|
43
47
|
- [Look inside a Sandbox](guides/look-inside-a-sandbox.md): Open a shell in the Sandbox of a run, and read the branch that its Agent works on.
|
|
44
48
|
- [Cancel a run](guides/cancel-a-run.md): End a live run with CANCEL, and delete its Sandboxes or keep them to look inside.
|
|
45
|
-
- [Open the Console](guides/open-the-console.md): Forward the port of the Orchestrator, open the Console, and unlock it with
|
|
49
|
+
- [Open the Console](guides/open-the-console.md): Forward the port of the Orchestrator, open the Console, and unlock it with a token or a login.
|
|
46
50
|
- [Use a local model](guides/use-a-local-model.md): Connect your Agents to a model on an OpenAI-compatible endpoint, with or without TLS and a key.
|
|
47
51
|
- [Use a hosted provider or a gateway](guides/use-a-hosted-provider.md): Give your Agents a model from a hosted provider, directly or through a gateway.
|
|
48
52
|
- [Give the cluster git credentials](guides/give-the-cluster-git-credentials.md): Give the cluster a token or an ssh key to clone and push your Repos, and choose which Repos a run can name.
|
|
53
|
+
- [Give a Caller a scope](guides/give-a-caller-a-scope.md): Make a named token for a CI job or a bridge, give it only the scopes that it needs, and rotate it.
|
|
49
54
|
- [Move from kind to a shared cluster](guides/move-from-kind-to-a-shared-cluster.md): Converge an Instance into a shared cluster, with a registry, Sandbox nodes, priority classes and a quota.
|
|
50
55
|
- [Mirror the Kit images](guides/mirror-the-kit-images.md): Copy the Kit images and the Pinned image into your own registry, and make the cluster pull them from there.
|
|
51
56
|
- [Upgrade the Kit version](guides/upgrade-the-kit-version.md): Move an Instance to a new Kit version. jr2 up converges it and updates the jr2 block in AGENTS.md.
|
|
@@ -55,12 +60,18 @@
|
|
|
55
60
|
- [Write a Workflow](guides/write-a-workflow.md): Write a module in workflows/ that exports a Machine, with the input that starts a run and its Vocabulary.
|
|
56
61
|
- [Bind a shipped Machine's Open parts](guides/bind-open-parts.md): Register a Machine from a package as a Workflow, and bind the parts that it leaves Open with customize().
|
|
57
62
|
- [Set an Agent's access and Dials](guides/set-an-agents-access-and-dials.md): Choose what an Agent can do to the Workspace, and set the Dials and continue of one Turn.
|
|
63
|
+
- [Give an Agent MCP tools](guides/give-an-agent-mcp-tools.md): Declare MCP servers in jr2.config.ts, and give an Agent the tools that it can call on each server.
|
|
64
|
+
- [Cut a Worktree](guides/cut-a-worktree.md): Make a Worktree with worktree(), choose what a cut refuses, and remove a Worktree.
|
|
58
65
|
- [Run a command or call a URL with an Effect](guides/run-a-command-or-call-a-url.md): Run a program or call a URL as an Effect, give it input from a pick, and route on its output.
|
|
59
|
-
- [
|
|
66
|
+
- [Call an MCP tool from a Machine](guides/call-an-mcp-tool-from-a-machine.md): Call a tool of an MCP server as an Effect, after the approval of a person, and route on its output.
|
|
67
|
+
- [Push and sign a branch](guides/push-and-sign-a-branch.md): Push the branch of a Worktree, and sign its commits with a key that the Agent never reads.
|
|
60
68
|
- [Start a run from a run](guides/start-a-run-from-a-run.md): Use a dispatch Effect to start a run of a Workflow from a Machine, in this Instance or in a different one.
|
|
61
69
|
- [Add tools to the Sandbox](guides/add-tools-to-the-sandbox.md): Put the programs that your Agents use into the Sandbox Image, or run a service in a User Container.
|
|
70
|
+
- [Write a tool as an MCP server](guides/write-a-tool-as-an-mcp-server.md): Write a small MCP server in TypeScript, put it in the Sandbox Image, and give its tool to an Agent.
|
|
62
71
|
- [Size a Workspace](guides/size-a-workspace.md): Give a Workspace the memory and cpu that its Sandbox needs, and see how jr2 divides them in the pod.
|
|
63
72
|
- [Run one worker per item](guides/run-one-worker-per-item.md): Make a Pool that runs one worker Machine for each item that a Source gives, and run it.
|
|
73
|
+
- [Start a run for each alert](guides/start-a-run-for-each-alert.md): Make a standing Pool that starts one run for each alert that an outside service sends to a Hook.
|
|
74
|
+
- [Write a Hook kind](guides/write-a-hook-kind.md): Write the kind of a service that jr2 ships no kind for, declare a Hook of it, and hear it at a Gate.
|
|
64
75
|
- [Publish a Machine as an npm package](guides/publish-a-machine-as-an-npm-package.md): Ship a Machine in an npm package that names the Kit as a peer, and register it in an Instance.
|
|
65
76
|
- [Let an Agent write a Chart](guides/let-an-agent-write-a-chart.md): Write a Chart wrapper whose planner Agent writes a Chart, runs it, and corrects it.
|
|
66
77
|
- [Run a Chart by name](guides/run-a-chart-by-name.md): Keep a Chart under a name, as a Chart file or a runtime Chart, and run it with jr2 run.
|
|
@@ -68,21 +79,39 @@
|
|
|
68
79
|
## Reference
|
|
69
80
|
|
|
70
81
|
- [Authoring surface](reference/authoring-surface.md): Every name that @jr2/orchestrator exports from its root, by group, with a link to its page: its signature, its TSDoc, and an example.
|
|
82
|
+
- [Authoring surface: Machine and events](reference/authoring-surface/group-machine-and-events.md): The setup a workflow writes its Machine with, the events its parties send, and the guard that makes a writing decline other senders (ADR-0011, ADR-0015).
|
|
83
|
+
- [Authoring surface: Gates](reference/authoring-surface/group-gates.md): A Gate slot hears a Hook (ADR-0011).
|
|
84
|
+
- [Authoring surface: Failure](reference/authoring-surface/group-failure.md): The Part a Machine invokes to fail its run, and the guard that tells a Failure from a defect in an `onError` (ADR-0073).
|
|
85
|
+
- [Authoring surface: Agents](reference/authoring-surface/group-agents.md): An Agent slot and the definition it carries (ADR-0028, ADR-0049).
|
|
86
|
+
- [Authoring surface: Workspaces and Repos](reference/authoring-surface/group-workspaces-and-repos.md): A Sandbox and the Repo Slots it binds (ADR-0012, ADR-0051).
|
|
87
|
+
- [Authoring surface: Effects](reference/authoring-surface/group-effects.md): Work a Machine does outside itself, as an actor slot (ADR-0067, ADR-0068, ADR-0071, ADR-0079), and what an author writes between a pick and that work.
|
|
88
|
+
- [Authoring surface: Steering](reference/authoring-surface/group-steering.md): The Machine's free text to one of its Agents, which the Agent hears once (ADR-0002).
|
|
89
|
+
- [Authoring surface: Composition](reference/authoring-surface/group-composition.md): A part left Open, a Machine's parts retuned, a Pool over a Source (ADR-0017, ADR-0049, ADR-0054, ADR-0060).
|
|
90
|
+
- [Authoring surface: Charts](reference/authoring-surface/group-charts.md): 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).
|
|
91
|
+
- [Authoring surface: Config](reference/authoring-surface/group-config.md): `jr2.config.ts`, the deployment facts a Machine cannot carry (ADR-0050).
|
|
92
|
+
- [Authoring surface: Types these signatures name](reference/authoring-surface/group-types-these-signatures-name.md): The signature of an export, or a type here, names each of these types.
|
|
71
93
|
- [`defineEvent`](reference/authoring-surface/defineevent.md): Define one workflow event: an event that an Agent or the caller of a Gate may send into your Machine.
|
|
72
94
|
- [`jr2Setup`](reference/authoring-surface/jr2setup.md): Set up a Machine that takes workflow events: the jr2 form of xstate's `setup()`.
|
|
73
95
|
- [`sentBy`](reference/authoring-surface/sentby.md): A guard that is true for an event that one party sent, and false for an event that another party sent: `guard: sentBy("coder")`.
|
|
74
96
|
- [`HostInjectedInput`](reference/authoring-surface/type-hostinjectedinput.md): The fields that jr2 adds to the input of the Machine that a run starts, beside the input that the caller sent.
|
|
97
|
+
- [`gate`](reference/authoring-surface/gate.md): The Gate: an input that a run waits for from outside the run (ADR-0011).
|
|
98
|
+
- [`Delivered`](reference/authoring-surface/type-delivered.md): One plain event of a list of defs: `{ type: "approve", by }`.
|
|
99
|
+
- [`GateLook`](reference/authoring-surface/type-gatelook.md): A Gate's read of the fact that it waits for (ADR-0011).
|
|
100
|
+
- [`GateOutcome`](reference/authoring-surface/type-gateoutcome.md): What a delivery did at one open Gate.
|
|
101
|
+
- [`GateReply`](reference/authoring-surface/type-gatereply.md): The text that the person who acted reads.
|
|
75
102
|
- [`fail`](reference/authoring-surface/fail.md): Fail the run: the Part a Machine invokes to end work that did not succeed.
|
|
76
103
|
- [`isFailure`](reference/authoring-surface/isfailure.md): Is this error a Failure, which a state invoked `fail` to make?
|
|
77
104
|
- [`agent`](reference/authoring-surface/agent.md): Make an Agent: an actor slot that runs one Turn of a model each time a state invokes it.
|
|
78
105
|
- [`AgentDefinition`](reference/authoring-surface/type-agentdefinition.md): An Agent's definition: which model it runs, its instructions, and what it may do to the Workspace.
|
|
106
|
+
- [`AgentMcpServer`](reference/authoring-surface/type-agentmcpserver.md): One MCP server that an Agent uses, and the tools that it may call there.
|
|
79
107
|
- [`ThinkingLevel`](reference/authoring-surface/type-thinkinglevel.md): How hard the model thinks before it answers: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"` or `"xhigh"`.
|
|
80
|
-
- [`workspace`](reference/authoring-surface/workspace.md): Run a body Machine in a Sandbox: a pod of its own, with a
|
|
81
|
-
- [`Workspaced`](reference/authoring-surface/type-workspaced.md): The input of a `workspace()` body: the run input, plus `workspace`, the handles that the Workspace adds (`workspace.repos`,
|
|
108
|
+
- [`workspace`](reference/authoring-surface/workspace.md): Run a body Machine in a Sandbox: a pod of its own, with a clone of each Repo Slot.
|
|
109
|
+
- [`Workspaced`](reference/authoring-surface/type-workspaced.md): The input of a `workspace()` body: the run input, plus `workspace`, the handles that the Workspace adds (`workspace.repos`, the folder of each Repo Slot).
|
|
82
110
|
- [`Binding`](reference/authoring-surface/type-binding.md): The repository of a Repo Slot: `{ url, ref }`.
|
|
83
111
|
- [`RepoSlot`](reference/authoring-surface/type-reposlot.md): The value of one Repo Slot in `workspace({ repos })`.
|
|
84
112
|
- [`arg`](reference/authoring-surface/arg.md): Mark one argv entry of a `command` that the input of the Effect fills.
|
|
85
113
|
- [`CommandOutput`](reference/authoring-surface/type-commandoutput.md): The output of a `command` Effect: what the `onDone` of its state gets as `event.output`.
|
|
114
|
+
- [`LaterOutcome`](reference/authoring-surface/type-lateroutcome.md): A value of `outcome` that this kit does not give.
|
|
86
115
|
- [`command`](reference/authoring-surface/command.md): Make a `command` Effect: an actor slot that runs one program in the Workspace's Sandbox when a state invokes it.
|
|
87
116
|
- [`basic`](reference/authoring-surface/basic.md): Make the `auth` of an `http` Effect that sends `Authorization: Basic <value>`, where the value is the base64 of `user:password`.
|
|
88
117
|
- [`bearer`](reference/authoring-surface/bearer.md): Make the `auth` of an `http` Effect that sends `Authorization: Bearer <value>`, with the value of an Effect secret.
|
|
@@ -91,21 +120,47 @@
|
|
|
91
120
|
- [`secret`](reference/authoring-surface/secret.md): Name an Effect secret: `secret("jira")`.
|
|
92
121
|
- [`text`](reference/authoring-surface/text.md): Make a string from literal text and Effect secrets, as a tagged template: `` text`Token ${secret("x")}` ``.
|
|
93
122
|
- [`HttpOutput`](reference/authoring-surface/type-httpoutput.md): The output of an `http` Effect: what the `onDone` of its state gets as `event.output`.
|
|
94
|
-
- [`push`](reference/authoring-surface/push.md): Make a `push` Effect: it pushes the branch of
|
|
123
|
+
- [`push`](reference/authoring-surface/push.md): Make a `push` Effect: it pushes the branch of a Worktree to the Binding of its Repo Slot.
|
|
95
124
|
- [`PushOutput`](reference/authoring-surface/type-pushoutput.md): The output of a `push` Effect: what the `onDone` of its state gets as `event.output`.
|
|
125
|
+
- [`branchName`](reference/authoring-surface/branchname.md): A kit schema for a pick param that names a branch.
|
|
126
|
+
- [`isReady`](reference/authoring-surface/isready.md): Is it `ready`?
|
|
127
|
+
- [`readyOf`](reference/authoring-surface/readyof.md): The `ready` output of an `onDone` arm that `isReady` guards.
|
|
128
|
+
- [`worktree`](reference/authoring-surface/worktree.md): Make a `worktree` Effect: it cuts a Worktree of a Repo Slot, or reads the one that is there.
|
|
129
|
+
- [`AnyFramePath`](reference/authoring-surface/type-anyframepath.md): A Turn's Frame: a Worktree, or `/work`, stated.
|
|
130
|
+
- [`AnyWorktreePath`](reference/authoring-surface/type-anyworktreepath.md): A Worktree of any Repo Slot: what a kit factory states, before `jr2Setup` narrows it to the slots of the body.
|
|
131
|
+
- [`FramePath`](reference/authoring-surface/type-framepath.md): A Turn's Frame in a Workspace with the Repo Slots `S`.
|
|
132
|
+
- [`WorktreeFound`](reference/authoring-surface/type-worktreefound.md): What a cut found.
|
|
133
|
+
- [`WorktreeInput`](reference/authoring-surface/type-worktreeinput.md): The input of a `worktree()`: a branch Worktree, or a detached one.
|
|
134
|
+
- [`WorktreeOptions`](reference/authoring-surface/type-worktreeoptions.md): The options of `worktree()`.
|
|
135
|
+
- [`WorktreeOutput`](reference/authoring-surface/type-worktreeoutput.md): The output of a `worktree()`.
|
|
136
|
+
- [`WorktreePath`](reference/authoring-surface/type-worktreepath.md): A Worktree of the Repo Slots `S`.
|
|
137
|
+
- [`WorktreeReady`](reference/authoring-surface/type-worktreeready.md): Type, an export of @jr2/orchestrator.
|
|
138
|
+
- [`WorktreeRefused`](reference/authoring-surface/type-worktreerefused.md): No Worktree, and nothing changed.
|
|
96
139
|
- [`dispatch`](reference/authoring-surface/dispatch.md): Make a `dispatch` Effect: it starts a run of a Workflow.
|
|
97
140
|
- [`DispatchOutput`](reference/authoring-surface/type-dispatchoutput.md): The output of a `dispatch` Effect.
|
|
141
|
+
- [`mcp`](reference/authoring-surface/mcp.md): The `mcp` Effects (ADR-0067, ADR-0079): `mcp.call(server, tool, { input })` calls a tool, `mcp.read(server, uri)` reads a resource, and `mcp.prompt(server, name, { input })` gets a prompt.
|
|
142
|
+
- [`McpOptions`](reference/authoring-surface/type-mcpoptions.md): The options of an `mcp` Effect.
|
|
143
|
+
- [`McpCallOutput`](reference/authoring-surface/type-mcpcalloutput.md): The output of an `mcp.call` Effect: what the `onDone` of its state gets as `event.output`.
|
|
144
|
+
- [`McpOutput`](reference/authoring-surface/type-mcpoutput.md): The output of any `mcp` Effect: a call's, a read's or a prompt's.
|
|
145
|
+
- [`McpReadOutput`](reference/authoring-surface/type-mcpreadoutput.md): The output of an `mcp.read` or an `mcp.prompt` Effect.
|
|
98
146
|
- [`answer`](reference/authoring-surface/answer.md): Set what the Agent reads when jr2 answers its pick.
|
|
99
147
|
- [`fromPick`](reference/authoring-surface/frompick.md): Make the `input` of the invoke of a state that a pick enters: the params of the pick go to the input of the invoked actor by name.
|
|
100
148
|
- [`paramsOf`](reference/authoring-surface/paramsof.md): Read the params of a pick from the event that entered the state.
|
|
149
|
+
- [`steer`](reference/authoring-surface/steer.md): Send a Steering message to one Agent of this Machine: an action for a transition.
|
|
101
150
|
- [`open`](reference/authoring-surface/open.md): Leave a part of a Machine Open: for the Instance that registers the Machine to bind with `customize()`.
|
|
102
151
|
- [`customize`](reference/authoring-surface/customize.md): Retune the parts that a Machine carries, without a change to the module that exports it.
|
|
103
152
|
- [`Customize`](reference/authoring-surface/type-customize.md): The parts of one Machine that `customize()` can retune: its Agents, its Open Effects, the Machines it composes, and the Sandbox of its `workspace()`.
|
|
104
153
|
- [`EffectBinding`](reference/authoring-surface/type-effectbinding.md): The values that bind the Open parts of one Effect.
|
|
105
154
|
- [`Size`](reference/authoring-surface/type-size.md): The Size of a Workspace: the most memory and cpu that its whole Sandbox can use.
|
|
106
155
|
- [`UserContainer`](reference/authoring-surface/type-usercontainer.md): The User Container in its object form: its image, and its part of the Workspace's Size.
|
|
107
|
-
- [`
|
|
156
|
+
- [`carry`](reference/authoring-surface/carry.md): Give the item itself.
|
|
157
|
+
- [`pool`](reference/authoring-surface/pool.md): Make a Pool: a Machine that runs one worker for each item that a Source gives, with at most `cap` workers at once.
|
|
158
|
+
- [`reread`](reference/authoring-surface/reread.md): Read the Source again.
|
|
159
|
+
- [`skip`](reference/authoring-surface/skip.md): Bring nothing, and say why.
|
|
108
160
|
- [`source`](reference/authoring-surface/source.md): Declare a Source: where a `pool()` gets its work items, one at a time.
|
|
161
|
+
- [`PoolNextInput`](reference/authoring-surface/type-poolnextinput.md): 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.
|
|
162
|
+
- [`SourceReply`](reference/authoring-surface/type-sourcereply.md): The text that the person who acted reads, from this Source's verdict (ADR-0011, ADR-0017).
|
|
163
|
+
- [`SourceVerdict`](reference/authoring-surface/type-sourceverdict.md): A Source's verdict on one delivery, as its `reply` reads it (ADR-0017).
|
|
109
164
|
- [`openBody`](reference/authoring-surface/openbody.md): Make an Open body: the actor slot that a Chart binds.
|
|
110
165
|
- [`OpenBodyDeclaration`](reference/authoring-surface/type-openbodydeclaration.md): What an Open body declares: the parts that it lends a Chart, what the Agents of a Chart can have, and the limits of a Chart.
|
|
111
166
|
- [`OpenBodyOutput`](reference/authoring-surface/type-openbodyoutput.md): The output of an Open body.
|
|
@@ -113,10 +168,17 @@
|
|
|
113
168
|
- [`chartSchemaFor`](reference/authoring-surface/chartschemafor.md): The Chart grammar for one Open body, as a zod schema.
|
|
114
169
|
- [`defineConfig`](reference/authoring-surface/defineconfig.md): Declare the config of an Instance: the default export of `jr2.config.ts`.
|
|
115
170
|
- [`JR2Config`](reference/authoring-surface/type-jr2config.md): The shape of `jr2.config.ts`: the deployment facts of an Instance, which a Machine cannot carry.
|
|
171
|
+
- [`McpRemoteServer`](reference/authoring-surface/type-mcpremoteserver.md): A remote MCP server, which the Harness reaches over Streamable HTTP.
|
|
172
|
+
- [`McpServer`](reference/authoring-surface/type-mcpserver.md): One MCP server of the Instance: a `McpRemoteServer` (`url`) or a `McpStdioServer` (`command`).
|
|
173
|
+
- [`McpStdioServer`](reference/authoring-surface/type-mcpstdioserver.md): 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.
|
|
174
|
+
- [`RunsConfig`](reference/authoring-surface/type-runsconfig.md): How long jr2 keeps an ended run, and the volume that keeps it (ADR-0065).
|
|
116
175
|
- [`EventSemantics`](reference/authoring-surface/type-eventsemantics.md): How the party that sends an event gets its answer.
|
|
117
176
|
- [`EventAudience`](reference/authoring-surface/type-eventaudience.md): Who may send an event: `"agent"` (an Agent, as a pick from its Menu), `"external"` (the caller of a Gate), or `"any"` (both).
|
|
118
177
|
- [`EventDef`](reference/authoring-surface/type-eventdef.md): A workflow event, as `defineEvent` gives it back: plain, frozen data and a zod schema, safe to import anywhere.
|
|
119
178
|
- [`WorkflowEvent`](reference/authoring-surface/type-workflowevent.md): The type of `event` in a Machine that `jr2Setup` makes: each workflow event in its `events`, and each Mechanism event.
|
|
179
|
+
- [`GateSlot`](reference/authoring-surface/type-gateslot.md): A Gate with parts that the Machine carries.
|
|
180
|
+
- [`Duration`](reference/authoring-surface/type-duration.md): A length of time: a positive number and a unit, `s`, `m` or `h`.
|
|
181
|
+
- [`CallerRecord`](reference/authoring-surface/type-callerrecord.md): A Caller as a run records it (ADR-0078): who acted, and the party it says it acted for.
|
|
120
182
|
- [`FailSlot`](reference/authoring-surface/type-failslot.md): The logic `fail()` returns: `failLogic` with the brand the walk reads.
|
|
121
183
|
- [`Failure`](reference/authoring-surface/type-failure.md): A Failure as `isFailure` narrows an error to it: the payload's fields, on the error itself.
|
|
122
184
|
- [`AgentDeclaration`](reference/authoring-surface/type-agentdeclaration.md): What `agent()` takes: an `AgentDefinition`, except that `model` can also be `open`.
|
|
@@ -126,7 +188,7 @@
|
|
|
126
188
|
- [`WithoutEmptyIndex`](reference/authoring-surface/type-withoutemptyindex.md): The fields of the run input `T`.
|
|
127
189
|
- [`PermissiveWorkspaceOptions`](reference/authoring-surface/type-permissiveworkspaceoptions.md): The options of a `workspace()` with no `input`: it starts with any input.
|
|
128
190
|
- [`PermissiveNoSlotWorkspaceOptions`](reference/authoring-surface/type-permissivenoslotworkspaceoptions.md): The options of a `workspace()` with no Repo Slot and no `input`: it starts with any input.
|
|
129
|
-
- [`WorkspaceHandles`](reference/authoring-surface/type-workspacehandles.md): What the body of a `workspace()` gets as `input.workspace`: the
|
|
191
|
+
- [`WorkspaceHandles`](reference/authoring-surface/type-workspacehandles.md): What the body of a `workspace()` gets as `input.workspace`: the folder of each Repo Slot.
|
|
130
192
|
- [`ExecOutcome`](reference/authoring-surface/type-execoutcome.md): How an exec ended.
|
|
131
193
|
- [`Unknown`](reference/authoring-surface/type-unknown.md): The output `{ outcome: "unknown", reason }`: the Effect may have acted, and jr2 cannot tell.
|
|
132
194
|
- [`Arg`](reference/authoring-surface/type-arg.md): One entry of a command's argv that the input of the Effect fills, as `arg("name")` makes it.
|
|
@@ -136,35 +198,47 @@
|
|
|
136
198
|
- [`Secret`](reference/authoring-surface/type-secret.md): What `secret("name")` gives: an Effect secret, by its name in the `secrets` list of `jr2.config.ts`.
|
|
137
199
|
- [`Text`](reference/authoring-surface/type-text.md): What the `text` template gives: a string of literal text and Effect secrets, in order.
|
|
138
200
|
- [`FromInput`](reference/authoring-surface/type-frominput.md): A value of a file body's part: as written, or from the Effect's input.
|
|
139
|
-
- [`FileBody`](reference/authoring-surface/type-filebody.md): `file(path, {
|
|
201
|
+
- [`FileBody`](reference/authoring-surface/type-filebody.md): `file(path, { segments?, contentType? })`: a Worktree file as an `http` body.
|
|
140
202
|
- [`HttpDefinition`](reference/authoring-surface/type-httpdefinition.md): An `http` Effect's definition.
|
|
203
|
+
- [`HttpFileInput`](reference/authoring-surface/type-httpfileinput.md): The input of an `http` Effect with a Worktree file as its body.
|
|
141
204
|
- [`OpenSecret`](reference/authoring-surface/type-opensecret.md): `secret(open)`: a secret a packaged Machine names in its auth, a header or a command's env, and leaves for its composer to name (ADR-0054).
|
|
142
205
|
- [`PushOptions`](reference/authoring-surface/type-pushoptions.md): The options of `push()`.
|
|
143
|
-
- [`PushInput`](reference/authoring-surface/type-pushinput.md): The input of a `push` Effect: `{ sha }` with `pin`, and `{ message }` with `squash`.
|
|
206
|
+
- [`PushInput`](reference/authoring-surface/type-pushinput.md): The input of a `push` Effect: the Worktree that a cut made, `{ sha }` with `pin`, and `{ message }` with `squash`.
|
|
207
|
+
- [`NameStart`](reference/authoring-surface/type-namestart.md): What a Worktree's name may start with: neither `.` nor `-`, and not the end of the path.
|
|
144
208
|
- [`DispatchDefinition`](reference/authoring-surface/type-dispatchdefinition.md): The definition of a `dispatch` Effect (ADR-0071).
|
|
145
209
|
- [`DispatchInput`](reference/authoring-surface/type-dispatchinput.md): A dispatch's input: the run's body — the slot's schema's type, or any JSON object.
|
|
146
210
|
- [`DispatchOpenParts`](reference/authoring-surface/type-dispatchopenparts.md): The Open part a dispatch definition states: its target, when it is `open`.
|
|
147
|
-
- [`
|
|
211
|
+
- [`McpNotReturned`](reference/authoring-surface/type-mcpnotreturned.md): The outcomes that an `mcp` Effect gives besides `returned`.
|
|
212
|
+
- [`ChainLink`](reference/authoring-surface/type-chainlink.md): One reply since the pick, as the author reads it.
|
|
213
|
+
- [`SteerArgs`](reference/authoring-surface/type-steerargs.md): The arguments a `steer` text or `from` function gets: the Machine's context and the event that the transition takes.
|
|
214
|
+
- [`Sender`](reference/authoring-surface/type-sender.md): Who delivered an event: an Agent by its slot, or a Gate by its invoke id (ADR-0015).
|
|
148
215
|
- [`Quantity`](reference/authoring-surface/type-quantity.md): A Kubernetes quantity: `"2Gi"`, `"1500m"`, `"2"`, or a plain number (`2` cpus, bytes of memory).
|
|
149
|
-
- [`
|
|
150
|
-
- [`
|
|
216
|
+
- [`Carry`](reference/authoring-surface/type-carry.md): What `carry(item)` gives.
|
|
217
|
+
- [`PoolSpec`](reference/authoring-surface/type-poolspec.md): What you pass to `pool()` with a child Machine as its worker.
|
|
218
|
+
- [`StandingPoolSpec`](reference/authoring-surface/type-standingpoolspec.md): What you pass to `pool()` for a Pool of runs.
|
|
219
|
+
- [`Reread`](reference/authoring-surface/type-reread.md): What `reread()` gives.
|
|
220
|
+
- [`Skip`](reference/authoring-surface/type-skip.md): What `skip(reason)` gives: the delivery brings nothing, and the reason says why.
|
|
221
|
+
- [`SourceSpec`](reference/authoring-surface/type-sourcespec.md): A pull Source.
|
|
222
|
+
- [`SourceHooks`](reference/authoring-surface/type-sourcehooks.md): A Source's handlers, by Hook kind and event key.
|
|
223
|
+
- [`PushSourceSpec`](reference/authoring-surface/type-pushsourcespec.md): A push Source.
|
|
224
|
+
- [`ReadSourceSpec`](reference/authoring-surface/type-readsourcespec.md): A read Source.
|
|
151
225
|
- [`OpenBodyLogic`](reference/authoring-surface/type-openbodylogic.md): The logic `openBody()` returns: actor logic that carries the brand.
|
|
152
226
|
- [`Lends`](reference/authoring-surface/type-lends.md): The parts of the Chart wrapper that a Chart can use, by their keys in `actors`, `guards`, `actions` and `delays`.
|
|
153
227
|
- [`Ceilings`](reference/authoring-surface/type-ceilings.md): The limits that an Open body sets on its Chart.
|
|
154
228
|
- [`ChartText`](reference/authoring-surface/type-charttext.md): The Chart text (ADR-0070).
|
|
155
|
-
- [`
|
|
229
|
+
- [`DeliveredEvent`](reference/authoring-surface/type-deliveredevent.md): A workflow event as delivered into a Machine: the def's name as `type`, plus its payload.
|
|
230
|
+
- [`Caller`](reference/authoring-surface/type-caller.md): A request's Caller (ADR-0078): who acts, through which authenticator, and what it may do.
|
|
156
231
|
- [`FailureInput`](reference/authoring-surface/type-failureinput.md): What a Failure carries: `reason`, text for a person, and `detail`, optional JSON for a machine reader.
|
|
157
232
|
- [`SandboxOptions`](reference/authoring-surface/type-sandboxoptions.md): The options of a `workspace()` that say what its Sandbox is made of and which Repos it clones.
|
|
158
|
-
- [`WorkspaceSpec`](reference/authoring-surface/type-workspacespec.md): What the `spec` of a `workspace()` returns: the branch that the Workspace works on, and two optional fields.
|
|
159
|
-
- [`NoSlotSpec`](reference/authoring-surface/type-noslotspec.md): What the `spec` of a `workspace()` with no Repo Slot returns: only `workGroup`.
|
|
160
233
|
- [`SlotHandles`](reference/authoring-surface/type-slothandles.md): The handles of a Workspace that declares Repo Slots.
|
|
161
|
-
- [`Duration`](reference/authoring-surface/type-duration.md): A length of time: a positive number and a unit, `s`, `m` or `h`.
|
|
162
234
|
- [`CommandEnv`](reference/authoring-surface/type-commandenv.md): The `env` of a `command`: for each variable, `secret("name")` for the value of an Effect secret, or `secret("name").path` for the path of a file that holds it.
|
|
163
235
|
- [`TextPart`](reference/authoring-surface/type-textpart.md): One part of a `Text`: `{ text }`, literal text, or `{ secret }`, the name of an Effect secret.
|
|
164
236
|
- [`HttpMethod`](reference/authoring-surface/type-httpmethod.md): The method of an `http` Effect: `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE` or `OPTIONS`.
|
|
165
237
|
- [`HttpRequestParts`](reference/authoring-surface/type-httprequestparts.md): What the `request` of an `http` definition returns: the part of the request that changes for each run.
|
|
166
|
-
- [`NamedSecret`](reference/authoring-surface/type-namedsecret.md): A
|
|
238
|
+
- [`NamedSecret`](reference/authoring-surface/type-namedsecret.md): A secret bound to a name, never `secret(open)`.
|
|
239
|
+
- [`SenderCallerField`](reference/authoring-surface/type-sendercallerfield.md): A field of a `Sender`'s Caller that jr2 can verify.
|
|
167
240
|
- [`SourceNextResult`](reference/authoring-surface/type-sourcenextresult.md): What the `next` of a Source resolves to: an item, to claim it; `null`, when no item is ready now; or `{ item, open }`, where `open` is the number of items that exist but are not ready.
|
|
241
|
+
- [`SourceIn`](reference/authoring-surface/type-sourcein.md): What a Source's handler reads beside `payload`.
|
|
168
242
|
- [`OpenBodySlot`](reference/authoring-surface/type-openbodyslot.md): The brand an Open body slot carries, as `definition` marks an Agent slot (ADR-0049).
|
|
169
243
|
- [`ChartJson`](reference/authoring-surface/type-chartjson.md): Plain JSON.
|
|
170
244
|
- [`ChartEvent`](reference/authoring-surface/type-chartevent.md): An event a Chart mints: its payload is a JSON Schema object, built into zod at admission.
|
|
@@ -179,18 +253,23 @@
|
|
|
179
253
|
- [`ToProvidedActor`](reference/authoring-surface/type-toprovidedactor.md): A type that the Authoring surface names.
|
|
180
254
|
- [`MergedActors`](reference/authoring-surface/type-mergedactors.md): A type that the Authoring surface names.
|
|
181
255
|
- [`ToParameterizedObject`](reference/authoring-surface/type-toparameterizedobject.md): A type that the Authoring surface names.
|
|
256
|
+
- [`BindActors`](reference/authoring-surface/type-bindactors.md): A type that the Authoring surface names.
|
|
182
257
|
- [`SentByGuards`](reference/authoring-surface/type-sentbyguards.md): A type that the Authoring surface names.
|
|
258
|
+
- [`GateHooks`](reference/authoring-surface/type-gatehooks.md): A type that the Authoring surface names.
|
|
259
|
+
- [`EventFrom`](reference/authoring-surface/type-eventfrom.md): A type that the Authoring surface names.
|
|
260
|
+
- [`LookOutput`](reference/authoring-surface/type-lookoutput.md): A type that the Authoring surface names.
|
|
183
261
|
- [`AgentLogic`](reference/authoring-surface/type-agentlogic.md): A type that the Authoring surface names.
|
|
184
262
|
- [`BodyAcceptsDoor`](reference/authoring-surface/type-bodyacceptsdoor.md): A type that the Authoring surface names.
|
|
185
263
|
- [`WorkspaceMachine`](reference/authoring-surface/type-workspacemachine.md): A type that the Authoring surface names.
|
|
264
|
+
- [`DoorlessInput`](reference/authoring-surface/type-doorlessinput.md): A type that the Authoring surface names.
|
|
186
265
|
- [`BodyAcceptsSlots`](reference/authoring-surface/type-bodyacceptsslots.md): A type that the Authoring surface names.
|
|
187
266
|
- [`EffectLogic`](reference/authoring-surface/type-effectlogic.md): A type that the Authoring surface names.
|
|
188
267
|
- [`OpenOf`](reference/authoring-surface/type-openof.md): A type that the Authoring surface names.
|
|
189
268
|
- [`EnvOpenParts`](reference/authoring-surface/type-envopenparts.md): A type that the Authoring surface names.
|
|
190
269
|
- [`OpenEffect`](reference/authoring-surface/type-openeffect.md): A type that the Authoring surface names.
|
|
191
270
|
- [`MarkedIf`](reference/authoring-surface/type-markedif.md): A type that the Authoring surface names.
|
|
192
|
-
- [`HttpInput`](reference/authoring-surface/type-httpinput.md): A type that the Authoring surface names.
|
|
193
271
|
- [`HttpOpenParts`](reference/authoring-surface/type-httpopenparts.md): A type that the Authoring surface names.
|
|
272
|
+
- [`HttpInput`](reference/authoring-surface/type-httpinput.md): A type that the Authoring surface names.
|
|
194
273
|
- [`PushWireOutput`](reference/authoring-surface/type-pushwireoutput.md): A type that the Authoring surface names.
|
|
195
274
|
- [`SyncState`](reference/authoring-surface/type-syncstate.md): A type that the Authoring surface names.
|
|
196
275
|
- [`AnswerAction`](reference/authoring-surface/type-answeraction.md): A type that the Authoring surface names.
|
|
@@ -199,15 +278,23 @@
|
|
|
199
278
|
- [`OpenEffectSlots`](reference/authoring-surface/type-openeffectslots.md): A type that the Authoring surface names.
|
|
200
279
|
- [`BindingOf`](reference/authoring-surface/type-bindingof.md): A type that the Authoring surface names.
|
|
201
280
|
- [`LogicAt`](reference/authoring-surface/type-logicat.md): A type that the Authoring surface names.
|
|
281
|
+
- [`GateSlots`](reference/authoring-surface/type-gateslots.md): A type that the Authoring surface names.
|
|
282
|
+
- [`GateBinding`](reference/authoring-surface/type-gatebinding.md): A type that the Authoring surface names.
|
|
283
|
+
- [`GateTypesAt`](reference/authoring-surface/type-gatetypesat.md): A type that the Authoring surface names.
|
|
202
284
|
- [`ChildSlots`](reference/authoring-surface/type-childslots.md): A type that the Authoring surface names.
|
|
203
285
|
- [`ChildAt`](reference/authoring-surface/type-childat.md): A type that the Authoring surface names.
|
|
204
286
|
- [`RepoSlotsOf`](reference/authoring-surface/type-reposlotsof.md): A type that the Authoring surface names.
|
|
205
287
|
- [`WorkspaceOf`](reference/authoring-surface/type-workspaceof.md): A type that the Authoring surface names.
|
|
206
288
|
- [`PoolMachine`](reference/authoring-surface/type-poolmachine.md): A type that the Authoring surface names.
|
|
207
|
-
- [`
|
|
289
|
+
- [`StandingPoolMachine`](reference/authoring-surface/type-standingpoolmachine.md): A type that the Authoring surface names.
|
|
290
|
+
- [`GateSlotInput`](reference/authoring-surface/type-gateslotinput.md): A type that the Authoring surface names.
|
|
291
|
+
- [`GateSlotParts`](reference/authoring-surface/type-gateslotparts.md): A type that the Authoring surface names.
|
|
208
292
|
- [`ArgNames`](reference/authoring-surface/type-argnames.md): A type that the Authoring surface names.
|
|
293
|
+
- [`WorktreeKey`](reference/authoring-surface/type-worktreekey.md): A type that the Authoring surface names.
|
|
294
|
+
- [`NotWorktreeKeys`](reference/authoring-surface/type-notworktreekeys.md): A type that the Authoring surface names.
|
|
209
295
|
- [`OpenSecretMark`](reference/authoring-surface/type-opensecretmark.md): A type that the Authoring surface names.
|
|
210
296
|
- [@jr2/machines](reference/machines.md): The Machines that @jr2/machines ships: their input, their output, and their Open parts.
|
|
297
|
+
- [Hook kinds](reference/hooks.md): Every name that @jr2/orchestrator/hooks exports: the interface of a Hook kind, the kinds that jr2 ships, and webhook().
|
|
211
298
|
- [jr2.config.ts](reference/config.md): Every field of jr2.config.ts: its type, whether it is required, its default, and what it does.
|
|
212
299
|
- [CLI](reference/cli.md): Every jr2 command: its synopsis, its arguments, flags and env vars, and what it prints.
|
|
213
300
|
- [HTTP API](reference/http-api.md): Every route of the Orchestrator's HTTP API, by access band, and the types of its bodies and answers.
|
|
@@ -5,10 +5,14 @@ description: "Make an Agent: an actor slot that runs one Turn of a model each ti
|
|
|
5
5
|
|
|
6
6
|
# `agent`
|
|
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 [Agents](group-agents.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
|
-
function agent
|
|
11
|
+
function agent<
|
|
12
|
+
const D extends AgentDeclaration,
|
|
13
|
+
>(
|
|
14
|
+
declaration: D,
|
|
15
|
+
): AgentLogic & (D extends { workspace: "none" } ? { readonly definition: { readonly workspace: "none" } } : unknown)
|
|
12
16
|
```
|
|
13
17
|
|
|
14
18
|
Make an Agent: an actor slot that runs one Turn of a model each time a state invokes it. Put it
|
|
@@ -16,8 +20,9 @@ under `actors` in `jr2Setup`, and invoke it by its key: `actors: { coder: agent(
|
|
|
16
20
|
`invoke: { src: "coder", input: { prompt } }`. The key is the Agent's name.
|
|
17
21
|
|
|
18
22
|
The invoke's `input` is the Turn: `prompt` (required), `cwd`, `model`, `thinkingLevel` and
|
|
19
|
-
`continue`. `cwd` is the absolute directory where the Working tools work.
|
|
20
|
-
|
|
23
|
+
`continue`. `cwd` is the absolute directory where the Working tools work. Under Repo Slots it
|
|
24
|
+
is required: a Worktree that a cut made, `<slot>/default` to read, or `/work`. An Agent with
|
|
25
|
+
`workspace: "none"`, and a Workspace with no Repo Slot, need no `cwd`. `continue: true` continues the Agent's conversation
|
|
21
26
|
in this Machine. Absent, each Turn starts a new conversation. `continue` is the literal `true`,
|
|
22
27
|
not a `boolean`. A Turn can join only a conversation that an earlier Turn started with
|
|
23
28
|
`continue: true`. Thus in a retry loop, put `continue: true` on each Turn, also on the first, so
|
|
@@ -43,10 +48,9 @@ When a Turn starts, it refuses:
|
|
|
43
48
|
- a key in `input` that a Turn does not have: ``agent "<slot>": the Turn's input carries
|
|
44
49
|
`<key>`, which a Turn has no use for — its input is its Frame (`prompt`, `cwd`), its Dials
|
|
45
50
|
(`model`, `thinkingLevel`), and `continue` (ADR-0057)``
|
|
46
|
-
- no `cwd` under
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
the kit gives no slot a meaning (ADR-0051) and a Turn's Frame is where it works (ADR-0057)``
|
|
51
|
+
- no `cwd` under Repo Slots: ``turn <id>: agent "<slot>" works under a Workspace with Repo Slots
|
|
52
|
+
(<slots>) and its Turn framed no `cwd`: say where it works, a Worktree, or `cwd: "/work"` above
|
|
53
|
+
them (ADR-0057)``
|
|
50
54
|
- a `cwd` that is not an absolute path: ``agent "<slot>": the Turn's Frame carries a `cwd` that
|
|
51
55
|
is not an absolute path — the Frame says WHERE this Turn works (ADR-0057), and a Turn rooted
|
|
52
56
|
anywhere else would work in the wrong directory silently``. The Harness makes this refusal
|
|
@@ -70,7 +74,16 @@ When a Turn starts, it refuses:
|
|
|
70
74
|
|
|
71
75
|
```ts
|
|
72
76
|
import { z } from "zod";
|
|
73
|
-
import {
|
|
77
|
+
import {
|
|
78
|
+
agent,
|
|
79
|
+
defineEvent,
|
|
80
|
+
fail,
|
|
81
|
+
isReady,
|
|
82
|
+
jr2Setup,
|
|
83
|
+
workspace,
|
|
84
|
+
worktree,
|
|
85
|
+
type Workspaced,
|
|
86
|
+
} from "@jr2/orchestrator";
|
|
74
87
|
|
|
75
88
|
const finish = defineEvent({
|
|
76
89
|
name: "finish",
|
|
@@ -80,6 +93,8 @@ const finish = defineEvent({
|
|
|
80
93
|
const runInput = z.object({ branch: z.string() });
|
|
81
94
|
type BodyInput = Workspaced<z.infer<typeof runInput>, "app">;
|
|
82
95
|
|
|
96
|
+
const fixTree = (context: BodyInput) => `${context.workspace.repos.app}/fix` as const;
|
|
97
|
+
|
|
83
98
|
const body = jr2Setup({
|
|
84
99
|
types: {} as { input: BodyInput; context: BodyInput },
|
|
85
100
|
events: [finish],
|
|
@@ -88,26 +103,35 @@ const body = jr2Setup({
|
|
|
88
103
|
model: "anthropic/claude-haiku-5-5",
|
|
89
104
|
instructions: "You fix failing tests. You change no test.",
|
|
90
105
|
}),
|
|
106
|
+
cut: worktree(),
|
|
91
107
|
fail: fail(),
|
|
92
108
|
},
|
|
93
109
|
}).createMachine({
|
|
94
110
|
id: "fix",
|
|
95
111
|
context: ({ input }) => input,
|
|
96
112
|
on: { "workspace.lost": ".lost", "agent.fault": ".failed" },
|
|
97
|
-
initial: "
|
|
113
|
+
initial: "cutting",
|
|
98
114
|
states: {
|
|
115
|
+
cutting: {
|
|
116
|
+
invoke: {
|
|
117
|
+
src: "cut",
|
|
118
|
+
input: ({ context }) => ({ path: fixTree(context), branch: context.branch }),
|
|
119
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "coding" }, { target: "notCut" }],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
99
122
|
coding: {
|
|
100
123
|
invoke: {
|
|
101
124
|
src: "coder",
|
|
102
125
|
input: ({ context }) => ({
|
|
103
126
|
prompt: "Make `node --test` pass, then commit.",
|
|
104
|
-
cwd: context
|
|
127
|
+
cwd: fixTree(context),
|
|
105
128
|
thinkingLevel: "high",
|
|
106
129
|
}),
|
|
107
130
|
},
|
|
108
131
|
on: { finish: "done" },
|
|
109
132
|
},
|
|
110
133
|
done: { type: "final" },
|
|
134
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
111
135
|
failed: { invoke: { src: "fail", input: { reason: "the Agent's Turn could not go on" } } },
|
|
112
136
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
113
137
|
},
|
|
@@ -116,7 +140,6 @@ const body = jr2Setup({
|
|
|
116
140
|
export const machine = workspace(body, {
|
|
117
141
|
input: runInput,
|
|
118
142
|
repos: { app: "https://github.com/you/app.git" },
|
|
119
|
-
spec: ({ input }) => ({ branch: input.branch }),
|
|
120
143
|
});
|
|
121
144
|
```
|
|
122
145
|
|
|
@@ -5,7 +5,7 @@ description: Set what the Agent reads when jr2 answers its pick.
|
|
|
5
5
|
|
|
6
6
|
# `answer`
|
|
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
|
```ts
|
|
11
11
|
function answer<
|
|
@@ -61,8 +61,10 @@ import {
|
|
|
61
61
|
command,
|
|
62
62
|
defineEvent,
|
|
63
63
|
fail,
|
|
64
|
+
isReady,
|
|
64
65
|
jr2Setup,
|
|
65
66
|
workspace,
|
|
67
|
+
worktree,
|
|
66
68
|
type Workspaced,
|
|
67
69
|
} from "@jr2/orchestrator";
|
|
68
70
|
|
|
@@ -80,6 +82,8 @@ const finished = defineEvent({
|
|
|
80
82
|
|
|
81
83
|
type Input = Workspaced<{}, "app">;
|
|
82
84
|
|
|
85
|
+
const fixTree = (context: Input) => `${context.workspace.repos.app}/fix` as const;
|
|
86
|
+
|
|
83
87
|
const body = jr2Setup({
|
|
84
88
|
types: {} as { context: Input; input: Input },
|
|
85
89
|
events: [runTests, finished],
|
|
@@ -88,6 +92,7 @@ const body = jr2Setup({
|
|
|
88
92
|
model: "anthropic/claude-haiku-5-5",
|
|
89
93
|
instructions: "You are a careful engineer.",
|
|
90
94
|
}),
|
|
95
|
+
cut: worktree(),
|
|
91
96
|
tests: command(["npm", "test"]),
|
|
92
97
|
fail: fail(),
|
|
93
98
|
},
|
|
@@ -95,10 +100,20 @@ const body = jr2Setup({
|
|
|
95
100
|
id: "fix-tests",
|
|
96
101
|
context: ({ input }) => input,
|
|
97
102
|
on: { "workspace.lost": ".lost", "agent.fault": ".failed" },
|
|
98
|
-
initial: "
|
|
103
|
+
initial: "cutting",
|
|
99
104
|
states: {
|
|
105
|
+
cutting: {
|
|
106
|
+
invoke: {
|
|
107
|
+
src: "cut",
|
|
108
|
+
input: ({ context }) => ({ path: fixTree(context), branch: "fix-tests" }),
|
|
109
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "coding" }, { target: "notCut" }],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
100
112
|
coding: {
|
|
101
|
-
invoke: {
|
|
113
|
+
invoke: {
|
|
114
|
+
src: "coder",
|
|
115
|
+
input: ({ context }) => ({ prompt: "Make the tests pass.", cwd: fixTree(context) }),
|
|
116
|
+
},
|
|
102
117
|
on: { finished: "done" },
|
|
103
118
|
initial: "ready",
|
|
104
119
|
states: {
|
|
@@ -106,6 +121,7 @@ const body = jr2Setup({
|
|
|
106
121
|
testing: {
|
|
107
122
|
invoke: {
|
|
108
123
|
src: "tests",
|
|
124
|
+
input: ({ context }) => ({ worktree: fixTree(context) }),
|
|
109
125
|
onDone: {
|
|
110
126
|
target: "ready",
|
|
111
127
|
// The Agent reads this string, not the whole output of the command.
|
|
@@ -120,6 +136,7 @@ const body = jr2Setup({
|
|
|
120
136
|
},
|
|
121
137
|
},
|
|
122
138
|
done: { type: "final" },
|
|
139
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
123
140
|
failed: { invoke: { src: "fail", input: { reason: "the Agent's Turn could not go on" } } },
|
|
124
141
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
125
142
|
},
|
|
@@ -127,7 +144,6 @@ const body = jr2Setup({
|
|
|
127
144
|
|
|
128
145
|
export const machine = workspace(body, {
|
|
129
146
|
repos: { app: { url: "https://github.com/you/app.git" } },
|
|
130
|
-
spec: () => ({ branch: "fix-tests" }),
|
|
131
147
|
});
|
|
132
148
|
```
|
|
133
149
|
|
|
@@ -5,7 +5,7 @@ description: Mark one argv entry of a `command` that the input of the Effect fil
|
|
|
5
5
|
|
|
6
6
|
# `arg`
|
|
7
7
|
|
|
8
|
-
Constant, in `@jr2/orchestrator/src/effect.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Constant, in `@jr2/orchestrator/src/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
|
const arg: <const N extends string>(name: N) => Arg<N>
|
|
@@ -26,30 +26,52 @@ map it in the invoke's input`. The angle brackets around the name are in the tex
|
|
|
26
26
|
**Example**
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
arg,
|
|
31
|
+
command,
|
|
32
|
+
fail,
|
|
33
|
+
isReady,
|
|
34
|
+
jr2Setup,
|
|
35
|
+
workspace,
|
|
36
|
+
worktree,
|
|
37
|
+
type Workspaced,
|
|
38
|
+
} from "@jr2/orchestrator";
|
|
30
39
|
|
|
31
40
|
type Input = Workspaced<{ file: string }, "app">;
|
|
32
41
|
|
|
42
|
+
const lintTree = (context: Input) => `${context.workspace.repos.app}/lint` as const;
|
|
43
|
+
|
|
33
44
|
const body = jr2Setup({
|
|
34
45
|
types: {} as { context: Input; input: Input },
|
|
35
|
-
actors: { lint: command(["npx", "eslint", arg("file")]), fail: fail() },
|
|
46
|
+
actors: { cut: worktree(), lint: command(["npx", "eslint", arg("file")]), fail: fail() },
|
|
36
47
|
}).createMachine({
|
|
37
48
|
id: "lint",
|
|
38
49
|
context: ({ input }) => input,
|
|
39
50
|
on: { "workspace.lost": ".lost" },
|
|
40
|
-
initial: "
|
|
51
|
+
initial: "cutting",
|
|
41
52
|
states: {
|
|
53
|
+
cutting: {
|
|
54
|
+
invoke: {
|
|
55
|
+
src: "cut",
|
|
56
|
+
input: ({ context }) => ({ path: lintTree(context), branch: "lint" }),
|
|
57
|
+
onDone: [{ guard: ({ event }) => isReady(event.output), target: "lint" }, { target: "notCut" }],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
42
60
|
lint: {
|
|
43
|
-
invoke: {
|
|
61
|
+
invoke: {
|
|
62
|
+
src: "lint",
|
|
63
|
+
input: ({ context }) => ({ file: context.file, worktree: lintTree(context) }),
|
|
64
|
+
onDone: "done",
|
|
65
|
+
},
|
|
44
66
|
},
|
|
45
67
|
done: { type: "final" },
|
|
68
|
+
notCut: { invoke: { src: "fail", input: { reason: "the Worktree was not cut" } } },
|
|
46
69
|
lost: { invoke: { src: "fail", input: { reason: "the Sandbox is gone" } } },
|
|
47
70
|
},
|
|
48
71
|
});
|
|
49
72
|
|
|
50
73
|
export const machine = workspace(body, {
|
|
51
74
|
repos: { app: { url: "https://github.com/you/app.git" } },
|
|
52
|
-
spec: () => ({ branch: "lint" }),
|
|
53
75
|
});
|
|
54
76
|
```
|
|
55
77
|
|
|
@@ -5,7 +5,7 @@ description: "Make the `auth` of an `http` Effect that sends `Authorization: Bas
|
|
|
5
5
|
|
|
6
6
|
# `basic`
|
|
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 basic<
|
|
@@ -5,7 +5,7 @@ description: "Make the `auth` of an `http` Effect that sends `Authorization: Bea
|
|
|
5
5
|
|
|
6
6
|
# `bearer`
|
|
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 bearer<const S extends Secret>(s: S): MarkedIf<S, { readonly bearer: Secret }>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: branchName
|
|
3
|
+
description: A kit schema for a pick param that names a branch.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `branchName`
|
|
7
|
+
|
|
8
|
+
Constant, in `@jr2/orchestrator/src/worktree.ts`. It is an export of `@jr2/orchestrator`, in the [Effects](group-effects.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
const branchName: ZodString
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
A kit schema for a pick param that names a branch. For example:
|
|
15
|
+
`input: z.object({ branch: branchName })`.
|