@jr2/orchestrator 0.6.0 → 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 +86 -9
- package/docs/concepts/architecture.md +41 -28
- package/docs/concepts/callers-and-hooks.md +205 -0
- package/docs/concepts/charts.md +7 -5
- package/docs/concepts/composition.md +10 -1
- package/docs/concepts/converge.md +4 -2
- package/docs/concepts/durable-runs.md +43 -16
- package/docs/concepts/effects.md +50 -22
- package/docs/concepts/gates.md +95 -25
- package/docs/concepts/machines-and-workflows.md +5 -4
- package/docs/concepts/pools-and-sources.md +187 -11
- package/docs/concepts/secrets-and-trust.md +73 -33
- package/docs/concepts/the-menu.md +11 -0
- package/docs/concepts/workspaces.md +6 -5
- package/docs/get-started/a-model-decides.md +14 -13
- package/docs/get-started/an-agent-in-a-sandbox.md +43 -34
- package/docs/get-started/connect-a-model.md +1 -1
- package/docs/get-started/create-an-instance.md +17 -14
- package/docs/guides/add-tools-to-the-sandbox.md +55 -11
- 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 +24 -8
- 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/fix-a-failed-converge.md +18 -6
- 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 +9 -6
- package/docs/guides/look-inside-a-sandbox.md +101 -31
- package/docs/guides/open-the-console.md +63 -14
- package/docs/guides/read-a-conversation.md +225 -0
- package/docs/guides/run-a-chart-by-name.md +17 -16
- package/docs/guides/run-one-worker-per-item.md +15 -9
- package/docs/guides/set-an-agents-access-and-dials.md +2 -0
- 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 +1 -1
- package/docs/guides/watch-a-run.md +127 -121
- 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 +17 -7
- package/docs/llms.txt +81 -15
- package/docs/reference/authoring-surface/agent.md +1 -1
- package/docs/reference/authoring-surface/answer.md +1 -1
- package/docs/reference/authoring-surface/arg.md +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/docs/reference/authoring-surface/file.md +1 -1
- 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 +1 -1
- package/docs/reference/authoring-surface/isfailure.md +1 -1
- package/docs/reference/authoring-surface/isready.md +1 -1
- package/docs/reference/authoring-surface/jr2setup.md +13 -3
- package/docs/reference/authoring-surface/mcp.md +107 -0
- package/docs/reference/authoring-surface/open.md +5 -3
- package/docs/reference/authoring-surface/openbody.md +1 -1
- package/docs/reference/authoring-surface/paramsof.md +1 -1
- package/docs/reference/authoring-surface/pool.md +77 -9
- package/docs/reference/authoring-surface/push.md +1 -1
- package/docs/reference/authoring-surface/readyof.md +1 -1
- package/docs/reference/authoring-surface/reread.md +19 -0
- package/docs/reference/authoring-surface/secret.md +1 -1
- 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 +56 -1
- 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 +14 -1
- package/docs/reference/authoring-surface/type-agentmcpserver.md +54 -0
- package/docs/reference/authoring-surface/type-anyframepath.md +1 -1
- package/docs/reference/authoring-surface/type-anyworktreepath.md +1 -1
- package/docs/reference/authoring-surface/type-binding.md +1 -1
- 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-commandoutput.md +1 -1
- package/docs/reference/authoring-surface/type-customize.md +16 -1
- 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 +1 -1
- package/docs/reference/authoring-surface/type-effectbinding.md +12 -2
- package/docs/reference/authoring-surface/type-framepath.md +1 -1
- 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 +1 -1
- package/docs/reference/authoring-surface/type-httpoutput.md +1 -1
- package/docs/reference/authoring-surface/type-jr2config.md +37 -2
- package/docs/reference/authoring-surface/type-lateroutcome.md +1 -1
- 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-openbodydeclaration.md +1 -1
- package/docs/reference/authoring-surface/type-openbodyoutput.md +1 -1
- package/docs/reference/authoring-surface/type-poolnextinput.md +1 -1
- package/docs/reference/authoring-surface/type-poolspec.md +11 -6
- package/docs/reference/authoring-surface/type-pushoutput.md +1 -1
- 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 +1 -1
- 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-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-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 +16 -7
- 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 +1 -1
- package/docs/reference/authoring-surface/type-worktreefound.md +3 -3
- package/docs/reference/authoring-surface/type-worktreeinput.md +1 -1
- package/docs/reference/authoring-surface/type-worktreeoptions.md +1 -1
- package/docs/reference/authoring-surface/type-worktreeoutput.md +1 -1
- package/docs/reference/authoring-surface/type-worktreepath.md +1 -1
- package/docs/reference/authoring-surface/type-worktreeready.md +1 -1
- package/docs/reference/authoring-surface/type-worktreerefused.md +4 -4
- package/docs/reference/authoring-surface/workspace.md +1 -1
- package/docs/reference/authoring-surface/worktree.md +1 -1
- package/docs/reference/authoring-surface.md +88 -167
- package/docs/reference/cli.md +413 -74
- package/docs/reference/config.md +235 -2
- package/docs/reference/decisions/0002-duplex-streaming-actor.md +71 -11
- package/docs/reference/decisions/0005-sandbox-pod-composition.md +14 -10
- package/docs/reference/decisions/0006-agent-control-surface.md +4 -4
- 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 +9 -2
- package/docs/reference/decisions/0013-the-agent-reaches-its-machine-through-a-container-it-cannot-read.md +20 -14
- 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 +18 -14
- package/docs/reference/decisions/0017-pool-over-a-source-port.md +226 -12
- 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 +32 -18
- package/docs/reference/decisions/0021-workspace-continuity-is-a-lease-that-answers-back.md +14 -1
- 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 +116 -34
- package/docs/reference/decisions/0024-an-agents-turn-ends-with-the-state-that-asked-for-it.md +38 -37
- 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 +7 -6
- package/docs/reference/decisions/0028-what-an-agent-may-do-to-the-workspace-is-part-of-its-definition.md +23 -7
- 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 -18
- 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 +4 -3
- 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 +5 -4
- package/docs/reference/decisions/0049-a-machine-carries-its-parts-and-composes-by-invoke.md +19 -19
- package/docs/reference/decisions/0050-what-code-names-config-declares-what-the-cli-names-discovery-finds.md +6 -1
- 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 +7 -0
- package/docs/reference/decisions/0058-a-harness-answers-the-orchestrator-alone.md +13 -7
- package/docs/reference/decisions/0059-a-harness-holds-stand-ins-and-the-custodian-holds-the-keys.md +38 -30
- package/docs/reference/decisions/0062-jr2-briefs-the-agent-on-its-seat-never-on-its-task.md +64 -17
- package/docs/reference/decisions/0063-the-orchestrator-watches-the-cluster.md +2 -1
- 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 +51 -23
- package/docs/reference/decisions/0067-an-effect-is-an-actor-slot-and-runs-at-most-once-unless-marked-idempotent.md +94 -54
- package/docs/reference/decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md +101 -47
- 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 +17 -13
- 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/0075-a-machine-cuts-a-worktree-and-the-workspace-only-clones.md +4 -3
- package/docs/reference/decisions/0076-an-agents-control-credential-lives-only-where-no-workspace-code-runs.md +37 -10
- 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 +6 -4
- package/docs/reference/glossary.md +96 -42
- package/docs/reference/hooks.md +1077 -0
- package/docs/reference/http-api.md +976 -149
- package/docs/why.md +2 -1
- package/package.json +10 -3
- package/src/actor.ts +36 -10
- package/src/agent.ts +50 -0
- package/src/assembly-checks.ts +530 -4
- package/src/callers.ts +245 -0
- package/src/chart.ts +52 -7
- package/src/config.ts +550 -1
- package/src/conversations.ts +453 -0
- package/src/custodian.ts +8 -2
- package/src/customize.ts +143 -4
- package/src/dispatch-effect.ts +142 -26
- package/src/durability.ts +2 -0
- package/src/duration.ts +20 -0
- package/src/effect-checks.ts +2 -1
- package/src/effect.ts +60 -7
- package/src/effector-wire.ts +272 -27
- package/src/gate-brand.ts +16 -0
- package/src/gate.ts +634 -48
- package/src/harness-client.ts +10 -4
- package/src/held-secrets.ts +72 -23
- package/src/holds.ts +2 -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 +76 -38
- package/src/http.ts +889 -94
- package/src/index.ts +16 -5
- package/src/instance.ts +196 -26
- package/src/internal.ts +22 -3
- package/src/machine-doc.ts +26 -1
- package/src/mcp-effect.ts +424 -0
- package/src/mount-digest.ts +41 -7
- package/src/names.ts +64 -2
- package/src/notices.ts +138 -10
- package/src/open-body.ts +25 -11
- package/src/open-effect.ts +17 -4
- package/src/open.ts +4 -2
- package/src/parts.ts +87 -9
- package/src/party.ts +2 -1
- package/src/pick.ts +2 -2
- package/src/pool.ts +1142 -163
- package/src/registration.ts +203 -13
- package/src/run-host.ts +1509 -171
- package/src/run-list.ts +191 -0
- package/src/sandbox-kube.ts +53 -5
- package/src/secret-placement.ts +239 -33
- package/src/server.ts +53 -4
- package/src/setup.ts +72 -32
- package/src/snapshot-store.ts +565 -48
- package/src/steer.ts +111 -0
- package/src/stub-harness.ts +6 -2
- package/src/tokens.ts +263 -22
- package/src/wire.ts +17 -0
- package/src/workspace.ts +50 -6
- package/src/worktree.ts +3 -3
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: pool
|
|
3
|
-
description: "Make a Pool: a Machine that runs one worker
|
|
3
|
+
description: "Make a Pool: a Machine that runs one worker for each item that a Source gives, with at most `cap` workers at once."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# `pool`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/pool.ts`. It is an export of `@jr2/orchestrator`,
|
|
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
9
|
|
|
10
10
|
## Overload 1
|
|
11
11
|
|
|
@@ -19,9 +19,12 @@ function pool<
|
|
|
19
19
|
): PoolMachine<TWorker, z.infer<TSchema>>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Make a Pool: a Machine that runs one worker
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
Make a Pool: a Machine that runs one worker for each item that a Source gives, with at most
|
|
23
|
+
`cap` workers at once. Use it as the root of a Workflow (`export const machine = pool(…)`), or
|
|
24
|
+
compose it in another Machine.
|
|
25
|
+
|
|
26
|
+
The worker is a Machine, which runs inside the Pool's run, or a `dispatch(...)` slot, which makes
|
|
27
|
+
each item a run of its own (a Pool of runs, which stands; see the third form).
|
|
25
28
|
|
|
26
29
|
The run ends when the Source has no item ready and no worker runs. Its output is
|
|
27
30
|
`{ status, items, failures }`: `status` is `"drained"` when no item is left, or `"deadlocked"`
|
|
@@ -51,9 +54,10 @@ its own.
|
|
|
51
54
|
The run input of the Pool, as a zod object: what a caller sends to start a run. `cap` and
|
|
52
55
|
`itemInput` read it, typed by it. A worker never gets it: each worker gets its item. Default:
|
|
53
56
|
none, and then their `input` is `unknown`.
|
|
54
|
-
- `source`: `SourceSpec<T, TInput> | SourceSpec<T>`
|
|
57
|
+
- `source`: `SourceSpec<T, TInput> | SourceSpec<T> | ReadSourceSpec<T, TInput> | ReadSourceSpec<T>`
|
|
55
58
|
|
|
56
|
-
Where the items come from. Make it with [`source`](source.md).
|
|
59
|
+
Where the items come from: a pull or a read Source. Make it with [`source`](source.md). A push Source
|
|
60
|
+
needs a standing Pool of runs.
|
|
57
61
|
- `itemId`: `(item: T) => string`
|
|
58
62
|
|
|
59
63
|
The id of an item. The Pool uses it as the id of the item's worker and in the `active` list
|
|
@@ -76,6 +80,9 @@ its own.
|
|
|
76
80
|
ends with failures, `drained` or `deadlocked`, it fails the run with the reason
|
|
77
81
|
`"<n> of <m> items failed"` and the detail `{ status, items, failures }`. `"report"`: the Pool
|
|
78
82
|
ends `done`, with the failures in its output. Default: `"fail"`.
|
|
83
|
+
- `standing` (optional): `false`
|
|
84
|
+
|
|
85
|
+
A Pool of child Machines never stands: a child cannot be handed over.
|
|
79
86
|
|
|
80
87
|
**Returns**: The Pool, as a Machine.
|
|
81
88
|
|
|
@@ -151,9 +158,10 @@ an example.
|
|
|
151
158
|
The run input of the Pool, as a zod object: what a caller sends to start a run. `cap` and
|
|
152
159
|
`itemInput` read it, typed by it. A worker never gets it: each worker gets its item. Default:
|
|
153
160
|
none, and then their `input` is `unknown`.
|
|
154
|
-
- `source`: `SourceSpec<T, TInput> | SourceSpec<T>`
|
|
161
|
+
- `source`: `SourceSpec<T, TInput> | SourceSpec<T> | ReadSourceSpec<T, TInput> | ReadSourceSpec<T>`
|
|
155
162
|
|
|
156
|
-
Where the items come from. Make it with [`source`](source.md).
|
|
163
|
+
Where the items come from: a pull or a read Source. Make it with [`source`](source.md). A push Source
|
|
164
|
+
needs a standing Pool of runs.
|
|
157
165
|
- `itemId`: `(item: T) => string`
|
|
158
166
|
|
|
159
167
|
The id of an item. The Pool uses it as the id of the item's worker and in the `active` list
|
|
@@ -176,6 +184,9 @@ an example.
|
|
|
176
184
|
ends with failures, `drained` or `deadlocked`, it fails the run with the reason
|
|
177
185
|
`"<n> of <m> items failed"` and the detail `{ status, items, failures }`. `"report"`: the Pool
|
|
178
186
|
ends `done`, with the failures in its output. Default: `"fail"`.
|
|
187
|
+
- `standing` (optional): `false`
|
|
188
|
+
|
|
189
|
+
A Pool of child Machines never stands: a child cannot be handed over.
|
|
179
190
|
|
|
180
191
|
**Returns**: The Pool, as a Machine.
|
|
181
192
|
|
|
@@ -184,3 +195,60 @@ an example.
|
|
|
184
195
|
- [Run one worker per item](../../guides/run-one-worker-per-item.md)
|
|
185
196
|
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
186
197
|
- [ADR-0017: The run loop is a jr2 `pool` over a generalized source port](../decisions/0017-pool-over-a-source-port.md)
|
|
198
|
+
|
|
199
|
+
## Overload 3
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
function pool<
|
|
203
|
+
I,
|
|
204
|
+
T,
|
|
205
|
+
>(
|
|
206
|
+
worker: EffectLogic<I, DispatchOutput>,
|
|
207
|
+
spec: StandingPoolSpec<T, I>,
|
|
208
|
+
): StandingPoolMachine
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Make a standing Pool of runs: each item that the Source gives is a run of the `dispatch` slot's
|
|
212
|
+
Workflow, keyed by `itemId` in that Workflow, with at most `cap` live at once ([ADR-0017](../decisions/0017-pool-over-a-source-port.md)). The
|
|
213
|
+
slot says `wait: true` and has no `target`. The Pool never ends by itself: when it has no work, it
|
|
214
|
+
waits for a Hook's delivery, a `reread` or its `pollEvery`. A run that ends in any way frees its
|
|
215
|
+
slot, and is a `settled` mark on the run's feed; it is never the Pool's error, because the run is
|
|
216
|
+
not the Pool's child. Use it as the top Machine of its Workflow, in a file of its own.
|
|
217
|
+
|
|
218
|
+
**Parameters**
|
|
219
|
+
|
|
220
|
+
- `worker` ([`EffectLogic`](type-effectlogic.md)): The `dispatch(...)` slot of the Workflow that runs each item.
|
|
221
|
+
- `spec`: The Source, the item id, the cap and the run's body. See [`StandingPoolSpec`](type-standingpoolspec.md).
|
|
222
|
+
|
|
223
|
+
**Returns**: The standing Pool, as a Machine.
|
|
224
|
+
|
|
225
|
+
**Example**
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { z } from "zod";
|
|
229
|
+
import { carry, dispatch, pool, skip, source } from "@jr2/orchestrator";
|
|
230
|
+
import type {} from "@jr2/orchestrator/hooks/gitlab";
|
|
231
|
+
|
|
232
|
+
const failed = z.object({ sha: z.string() });
|
|
233
|
+
|
|
234
|
+
export const machine = pool(dispatch("triage", { input: failed, wait: true }), {
|
|
235
|
+
id: "pipelines",
|
|
236
|
+
standing: true,
|
|
237
|
+
source: source({
|
|
238
|
+
item: failed,
|
|
239
|
+
hooks: {
|
|
240
|
+
gitlab: {
|
|
241
|
+
"pipeline.failed": ({ payload }) =>
|
|
242
|
+
payload.object_attributes.sha === "" ? skip("no commit") : carry({ sha: payload.object_attributes.sha }),
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
}),
|
|
246
|
+
itemId: (p) => `pipeline-${p.sha}`,
|
|
247
|
+
cap: 4,
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**See also**
|
|
252
|
+
|
|
253
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
254
|
+
- [ADR-0017: The run loop is a jr2 `pool` over a generalized source port](../decisions/0017-pool-over-a-source-port.md)
|
|
@@ -5,7 +5,7 @@ description: "Make a `push` Effect: it pushes the branch of a Worktree to the Bi
|
|
|
5
5
|
|
|
6
6
|
# `push`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/sandbox-effect.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/sandbox-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 push<const O extends PushOptions>(options?: O): EffectLogic<PushInput<O>, PushOutput>
|
|
@@ -5,7 +5,7 @@ description: The `ready` output of an `onDone` arm that `isReady` guards.
|
|
|
5
5
|
|
|
6
6
|
# `readyOf`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/worktree.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, 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
9
|
|
|
10
10
|
```ts
|
|
11
11
|
function readyOf<O extends { outcome: string }>(output: O): Extract<O, { outcome: "ready" }>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: reread
|
|
3
|
+
description: Read the Source again.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `reread`
|
|
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 reread(): Reread
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the Source again. The Pool calls its `next`, or runs its `read`, at once; a read that runs
|
|
15
|
+
now reads once more after it ends. Only a Source that can read gives it.
|
|
16
|
+
|
|
17
|
+
**See also**
|
|
18
|
+
|
|
19
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
@@ -5,7 +5,7 @@ description: "Name an Effect secret: `secret(\"jira\")`."
|
|
|
5
5
|
|
|
6
6
|
# `secret`
|
|
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
|
## Overload 1
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ description: "A guard that is true for an event that one party sent, and false f
|
|
|
5
5
|
|
|
6
6
|
# `sentBy`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/party.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Function, in `@jr2/orchestrator/src/party.ts`. 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 sentBy<const Id extends string>(id: Id): { type: typeof SENT_BY; params: { id: Id } }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: skip
|
|
3
|
+
description: Bring nothing, and say why.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `skip`
|
|
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 skip(reason: string): Skip
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Bring nothing, and say why. The reason goes in the Hook's answer and in its hook log.
|
|
15
|
+
|
|
16
|
+
**Parameters**
|
|
17
|
+
|
|
18
|
+
- `reason`: Why the delivery brings nothing, for a person to read.
|
|
19
|
+
|
|
20
|
+
**See also**
|
|
21
|
+
|
|
22
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
@@ -5,7 +5,9 @@ description: "Declare a Source: where a `pool()` gets its work items, one at a t
|
|
|
5
5
|
|
|
6
6
|
# `source`
|
|
7
7
|
|
|
8
|
-
Function, in `@jr2/orchestrator/src/pool.ts`. It is an export of `@jr2/orchestrator`,
|
|
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
|
+
## Overload 1
|
|
9
11
|
|
|
10
12
|
```ts
|
|
11
13
|
function source<T, TInput = unknown>(spec: SourceSpec<T, TInput>): SourceSpec<T, TInput>
|
|
@@ -49,3 +51,56 @@ export const issues = source<Issue>({
|
|
|
49
51
|
- [Run one worker per item](../../guides/run-one-worker-per-item.md)
|
|
50
52
|
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
51
53
|
- [ADR-0017: The run loop is a jr2 `pool` over a generalized source port](../decisions/0017-pool-over-a-source-port.md)
|
|
54
|
+
|
|
55
|
+
## Overload 2
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
function source<const S extends z.ZodType>(spec: {
|
|
59
|
+
item: S;
|
|
60
|
+
hooks: SourceHooks<Carry<z.output<NoInfer<S>>>, {}>;
|
|
61
|
+
hold?: number;
|
|
62
|
+
reply?: SourceReply<z.output<NoInfer<S>>>;
|
|
63
|
+
}): PushSourceSpec<z.output<S>>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Declare a PUSH Source: the schema of an item, and the handlers that carry it. Only a standing
|
|
67
|
+
Pool of runs takes it.
|
|
68
|
+
|
|
69
|
+
**Parameters**
|
|
70
|
+
|
|
71
|
+
- `spec`: `item`, `hooks`, `hold` and `reply`. See [`PushSourceSpec`](type-pushsourcespec.md).
|
|
72
|
+
|
|
73
|
+
- `item`: `S`
|
|
74
|
+
- `hooks`: `SourceHooks<Carry<z.output<NoInfer<S>>>, {}>`
|
|
75
|
+
- `hold` (optional): `number`
|
|
76
|
+
- `reply` (optional): `SourceReply<z.output<NoInfer<S>>>`
|
|
77
|
+
|
|
78
|
+
**Returns**: The same spec.
|
|
79
|
+
|
|
80
|
+
**See also**
|
|
81
|
+
|
|
82
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
83
|
+
|
|
84
|
+
## Overload 3
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
function source<
|
|
88
|
+
T,
|
|
89
|
+
TInput = unknown,
|
|
90
|
+
R extends AnyActorLogic = AnyActorLogic,
|
|
91
|
+
>(
|
|
92
|
+
spec: ReadSourceSpec<T, TInput, R>,
|
|
93
|
+
): ReadSourceSpec<T, TInput, R>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Declare a READ Source: a read of the whole set, and the items in its answer.
|
|
97
|
+
|
|
98
|
+
**Parameters**
|
|
99
|
+
|
|
100
|
+
- `spec`: `read`, `items`, `wake`, `pollEvery`, `hooks` and `reply`. See [`ReadSourceSpec`](type-readsourcespec.md).
|
|
101
|
+
|
|
102
|
+
**Returns**: The same spec.
|
|
103
|
+
|
|
104
|
+
**See also**
|
|
105
|
+
|
|
106
|
+
- [Pools and Sources](../../concepts/pools-and-sources.md)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: steer
|
|
3
|
+
description: "Send a Steering message to one Agent of this Machine: an action for a transition."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `steer`
|
|
7
|
+
|
|
8
|
+
Function, in `@jr2/orchestrator/src/steer.ts`. It is an export of `@jr2/orchestrator`, in the [Steering](group-steering.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
function steer<
|
|
12
|
+
TContext extends MachineContext,
|
|
13
|
+
TExpressionEvent extends EventObject,
|
|
14
|
+
TParams extends ParameterizedObject["params"] | undefined,
|
|
15
|
+
TEvent extends EventObject,
|
|
16
|
+
TActor extends ProvidedActor,
|
|
17
|
+
>(
|
|
18
|
+
agent: string,
|
|
19
|
+
text: string | ((args: SteerArgs<TContext, TExpressionEvent>) => string),
|
|
20
|
+
opts: { from?: Sender | ((args: SteerArgs<TContext, TExpressionEvent>) => Sender | undefined) } = {},
|
|
21
|
+
): ActionFunction<TContext, TExpressionEvent, TEvent, TParams, TActor, never, never, never, never>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Send a Steering message to one Agent of this Machine: an action for a transition. The Agent hears
|
|
25
|
+
the text once, without an interrupt. When a Turn of the Agent is open, its Harness adds the text
|
|
26
|
+
at the Turn's next step boundary. Otherwise the text waits for the Agent's next Turn in this
|
|
27
|
+
Machine instance. When this Machine instance ends first, the message is not delivered.
|
|
28
|
+
|
|
29
|
+
A Steering message is not an event: no guard reads it, and no Gate takes it. The Agent decides
|
|
30
|
+
what to do with it, and acts on the workflow only by its picks.
|
|
31
|
+
|
|
32
|
+
Use it to relay what one Agent says to another. Give `from` the Sender of the event (the
|
|
33
|
+
`sender` field that the Orchestrator writes on it): the Agent then reads the text as the word of
|
|
34
|
+
a peer, not as an order. When the Sender is a Gate, the Agent reads the text as what the Gate
|
|
35
|
+
received, not as an order. With no `from`, the Agent reads the text as the workflow's own.
|
|
36
|
+
|
|
37
|
+
`agent` is the name of an Agent in this Machine's `actors`. A text longer than 16 KiB is cut.
|
|
38
|
+
The Machine can steer an Agent whose definition says `steerable: false`: that refuses Callers
|
|
39
|
+
only.
|
|
40
|
+
|
|
41
|
+
**Parameters**
|
|
42
|
+
|
|
43
|
+
- `agent`
|
|
44
|
+
- `text`
|
|
45
|
+
- `opts`
|
|
46
|
+
|
|
47
|
+
- `from` (optional): `Sender | ((args: SteerArgs<TContext, TExpressionEvent>) => Sender | undefined)`
|
|
48
|
+
|
|
49
|
+
**Example**
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { z } from "zod";
|
|
53
|
+
import { agent, defineEvent, jr2Setup, steer } from "@jr2/orchestrator";
|
|
54
|
+
|
|
55
|
+
const done = defineEvent({ name: "done", description: "The draft is ready.", input: z.object({}) });
|
|
56
|
+
const note = defineEvent({
|
|
57
|
+
name: "note",
|
|
58
|
+
description: "Send the draft back to the writer, with what to change.",
|
|
59
|
+
input: z.object({ text: z.string().min(1) }),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const machine = jr2Setup({
|
|
63
|
+
events: [done, note],
|
|
64
|
+
actors: {
|
|
65
|
+
writer: agent({ model: "anthropic/claude-haiku-5-5", instructions: "You write.", workspace: "none" }),
|
|
66
|
+
reviewer: agent({ model: "anthropic/claude-haiku-5-5", instructions: "You review.", workspace: "none" }),
|
|
67
|
+
},
|
|
68
|
+
}).createMachine({
|
|
69
|
+
initial: "writing",
|
|
70
|
+
states: {
|
|
71
|
+
writing: {
|
|
72
|
+
invoke: { src: "writer", input: { prompt: "Write the notes.", continue: true } },
|
|
73
|
+
on: { done: "reviewing" },
|
|
74
|
+
},
|
|
75
|
+
reviewing: {
|
|
76
|
+
invoke: { src: "reviewer", input: { prompt: "Review the notes." } },
|
|
77
|
+
on: {
|
|
78
|
+
// The writer's next Turn hears the note as the reviewer's word, not as an order.
|
|
79
|
+
note: {
|
|
80
|
+
target: "writing",
|
|
81
|
+
actions: steer("writer", ({ event }) => event.text, { from: ({ event }) => event.sender }),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**See also**
|
|
90
|
+
|
|
91
|
+
- [Steer an Agent](../../guides/steer-an-agent.md)
|
|
92
|
+
- [Agents and Turns](../../concepts/agents-and-turns.md)
|
|
93
|
+
- [ADR-0002: The agent actor is a duplex channel; its control plane is Menu tool calls](../decisions/0002-duplex-streaming-actor.md)
|
|
@@ -5,7 +5,7 @@ description: "Make a string from literal text and Effect secrets, as a tagged te
|
|
|
5
5
|
|
|
6
6
|
# `text`
|
|
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 text<
|
|
@@ -5,7 +5,7 @@ description: "An Agent's definition: which model it runs, its instructions, and
|
|
|
5
5
|
|
|
6
6
|
# `AgentDefinition`
|
|
7
7
|
|
|
8
|
-
Type, in `@jr2/orchestrator/src/agent.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Type, in `@jr2/orchestrator/src/agent.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
11
|
type AgentDefinition = {
|
|
@@ -14,6 +14,8 @@ type AgentDefinition = {
|
|
|
14
14
|
description?: string;
|
|
15
15
|
thinkingLevel?: ThinkingLevel;
|
|
16
16
|
workspace?: WorkspaceAccess;
|
|
17
|
+
mcp?: readonly AgentMcpServer[];
|
|
18
|
+
steerable?: boolean;
|
|
17
19
|
};
|
|
18
20
|
```
|
|
19
21
|
|
|
@@ -55,6 +57,17 @@ cannot change `instructions` or `workspace`.
|
|
|
55
57
|
Worktree: cut it with `{ path, detach: sha }`, then give that `path` as `cwd`.
|
|
56
58
|
- `"none"`: no Working tools. The Agent only reads its prompt and picks from its Menu. Its Turn
|
|
57
59
|
runs on the Instance Harness, not in a Sandbox, so it needs no `workspace()` around it.
|
|
60
|
+
- `mcp` (optional): `readonly AgentMcpServer[]`
|
|
61
|
+
|
|
62
|
+
The MCP servers whose tools the Agent gets, each with its allowlist: see
|
|
63
|
+
[`AgentMcpServer`](type-agentmcpserver.md). The tools join the Agent's tools, after its Working tools and before
|
|
64
|
+
its Menu. A call to one is not a pick, and the Turn goes on after it. Default: none. A composer
|
|
65
|
+
replaces the whole list with `customize(machine, { agents: { <slot>: { mcp: [...] } } })`.
|
|
66
|
+
- `steerable` (optional): `boolean`
|
|
67
|
+
|
|
68
|
+
May a Caller send this Agent a Steering message? Default: `true`. With `false`,
|
|
69
|
+
`POST /runs/:runId/steering` and `jr2 steer` refuse it, and `GET /runs/:runId/agents` says
|
|
70
|
+
`steerable: false`. The Machine can still steer the Agent with the `steer` action.
|
|
58
71
|
|
|
59
72
|
**Example**
|
|
60
73
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AgentMcpServer
|
|
3
|
+
description: One MCP server that an Agent uses, and the tools that it may call there.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `AgentMcpServer`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/agent.ts`. It is an export of `@jr2/orchestrator`, in the [Agents](group-agents.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type AgentMcpServer = {
|
|
12
|
+
server: string;
|
|
13
|
+
tools?: readonly string[] | "*";
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
One MCP server that an Agent uses, and the tools that it may call there.
|
|
18
|
+
|
|
19
|
+
- `server` is a name of the `mcp` block of `jr2.config.ts`. `jr2 up` refuses a name that the
|
|
20
|
+
block does not declare, and prints the `customize()` line that binds the Agent to one it does.
|
|
21
|
+
- `tools` is the allowlist. A remote server needs it: a list of tool names, or `"*"` for every
|
|
22
|
+
tool. The Harness offers and runs only those tools. When Workspace code in the Agent's Sandbox
|
|
23
|
+
can spend the server's secret, `jr2 up` takes only `"*"`, because a list would then not be a
|
|
24
|
+
limit. A stdio server takes no `tools`: the Agent gets every tool of the server.
|
|
25
|
+
|
|
26
|
+
The model reads each tool as `mcp__<server>__<tool>`. A tool name in the list must keep that name
|
|
27
|
+
within `[A-Za-z0-9_-]` and 128 characters.
|
|
28
|
+
|
|
29
|
+
**Fields**
|
|
30
|
+
|
|
31
|
+
- `server`: `string`
|
|
32
|
+
|
|
33
|
+
A server name of the `mcp` block of `jr2.config.ts`.
|
|
34
|
+
- `tools` (optional): `readonly string[] | "*"`
|
|
35
|
+
|
|
36
|
+
The allowlist: tool names of the server, or `"*"` for every tool. Required for a remote
|
|
37
|
+
server; absent for a stdio server.
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { agent } from "@jr2/orchestrator";
|
|
43
|
+
|
|
44
|
+
export const triage = agent({
|
|
45
|
+
model: "anthropic/claude-haiku-5-5",
|
|
46
|
+
instructions: "You read the ticket and post a summary to the channel.",
|
|
47
|
+
workspace: "none",
|
|
48
|
+
mcp: [{ server: "slack-acme", tools: ["post_message", "read_channel"] }],
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**See also**
|
|
53
|
+
|
|
54
|
+
- [ADR-0079: An Agent holds MCP tools, a Machine calls them as an Effect, and the Machine is the approval](../decisions/0079-an-agent-holds-mcp-tools-a-machine-calls-them-as-an-effect-and-the-machine-is-the-approval.md)
|
|
@@ -5,7 +5,7 @@ description: "A Turn's Frame: a Worktree, or `/work`, stated."
|
|
|
5
5
|
|
|
6
6
|
# `AnyFramePath`
|
|
7
7
|
|
|
8
|
-
Type, in `@jr2/orchestrator/src/worktree.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Type, 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
9
|
|
|
10
10
|
```ts
|
|
11
11
|
type AnyFramePath = "/work" | `/work/${string}`;
|
|
@@ -5,7 +5,7 @@ description: "A Worktree of any Repo Slot: what a kit factory states, before `jr
|
|
|
5
5
|
|
|
6
6
|
# `AnyWorktreePath`
|
|
7
7
|
|
|
8
|
-
Type, in `@jr2/orchestrator/src/worktree.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Type, 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
9
|
|
|
10
10
|
```ts
|
|
11
11
|
type AnyWorktreePath = `/work/${string}/${string}`;
|
|
@@ -5,7 +5,7 @@ description: "The repository of a Repo Slot: `{ url, ref }`."
|
|
|
5
5
|
|
|
6
6
|
# `Binding`
|
|
7
7
|
|
|
8
|
-
Type, in `@jr2/orchestrator/src/parts.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Type, in `@jr2/orchestrator/src/parts.ts`. It is an export of `@jr2/orchestrator`, in the [Workspaces and Repos](group-workspaces-and-repos.md) group of the [Authoring surface](../authoring-surface.md) page.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
type Binding = {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Caller
|
|
3
|
+
description: "A request's Caller (ADR-0078): who acts, through which authenticator, and what it may do."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `Caller`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/tokens.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type Caller = {
|
|
12
|
+
via: "token" | "jwt" | "hook";
|
|
13
|
+
name: string;
|
|
14
|
+
shown?: string;
|
|
15
|
+
may: Scopes;
|
|
16
|
+
onBehalfOf?: string;
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A request's Caller ([ADR-0078](../decisions/0078-a-caller-comes-from-one-authenticator-seam-and-acts-within-its-scopes.md)): who acts, through which authenticator, and what it may do.
|
|
21
|
+
|
|
22
|
+
**Fields**
|
|
23
|
+
|
|
24
|
+
- `via`: `"token" | "jwt" | "hook"`
|
|
25
|
+
|
|
26
|
+
The authenticator that made the Caller: `token` (the Instance token or a named token), `jwt`
|
|
27
|
+
or `hook`.
|
|
28
|
+
- `name`: `string`
|
|
29
|
+
|
|
30
|
+
The Caller's name for that authenticator: `instance`, a named token's name, a JWT's `sub`, a
|
|
31
|
+
Hook's name.
|
|
32
|
+
- `shown` (optional): `string`
|
|
33
|
+
|
|
34
|
+
The name that jr2 shows, when it is not `name` (a JWT's `email`).
|
|
35
|
+
- `may`: [`Scopes`](../config.md#callers-tokens-name-may)
|
|
36
|
+
|
|
37
|
+
What the Caller may do.
|
|
38
|
+
- `onBehalfOf` (optional): `string`
|
|
39
|
+
|
|
40
|
+
The Caller's claim about the party it acts for. jr2 records it and never checks it.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CallerRecord
|
|
3
|
+
description: "A Caller as a run records it (ADR-0078): who acted, and the party it says it acted for."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `CallerRecord`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/callers.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type CallerRecord = {
|
|
12
|
+
via: Caller["via"];
|
|
13
|
+
name: string;
|
|
14
|
+
shown?: string;
|
|
15
|
+
onBehalfOf?: string;
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A Caller as a run records it ([ADR-0078](../decisions/0078-a-caller-comes-from-one-authenticator-seam-and-acts-within-its-scopes.md)): who acted, and the party it says it acted for. Never its
|
|
20
|
+
scopes.
|
|
21
|
+
|
|
22
|
+
**Fields**
|
|
23
|
+
|
|
24
|
+
- `via`: `Caller["via"]`
|
|
25
|
+
- `name`: `string`
|
|
26
|
+
- `shown` (optional): `string`
|
|
27
|
+
|
|
28
|
+
The name that jr2 shows, when it is not `name` (a JWT's `email`).
|
|
29
|
+
- `onBehalfOf` (optional): `string`
|
|
30
|
+
|
|
31
|
+
The Caller's claim about the party it acts for. jr2 records it and never checks it, except for
|
|
32
|
+
a Hook, whose signature covers it.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Carry
|
|
3
|
+
description: What `carry(item)` gives.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `Carry`
|
|
7
|
+
|
|
8
|
+
Type, in `@jr2/orchestrator/src/pool.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
type Carry<T> = { readonly [VERDICT]: "carry"; readonly item: T };
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
What `carry(item)` gives. Only a push Source (one with an `item` schema) gives it.
|
|
15
|
+
|
|
16
|
+
**Fields**
|
|
17
|
+
|
|
18
|
+
- `[VERDICT]`: `"carry"`
|
|
19
|
+
- `item`: `T`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ChainLink
|
|
3
|
-
description:
|
|
3
|
+
description: One reply since the pick, as the author reads it.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# `ChainLink`
|
|
@@ -13,7 +13,7 @@ type ChainLink<TActor extends ProvidedActor, TEvent extends EventObject> =
|
|
|
13
13
|
| { kind: "event"; event: Exclude<TEvent, { type: `${string}.${string}` }> };
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
One reply since the pick, as the author reads it
|
|
17
|
-
(`src`); or an event that answered a state below the Agent's — a Gate's answer, a nested Agent's
|
|
16
|
+
One reply since the pick, as the author reads it. It is an invoked actor's output, typed by its
|
|
17
|
+
slot (`src`); or an event that answered a state below the Agent's — a Gate's answer, a nested Agent's
|
|
18
18
|
pick — typed by the Machine's events. A reply is from outside the Machine: the events it sends
|
|
19
19
|
itself are not links.
|
|
@@ -5,7 +5,7 @@ description: "The output of a `command` Effect: what the `onDone` of its state g
|
|
|
5
5
|
|
|
6
6
|
# `CommandOutput`
|
|
7
7
|
|
|
8
|
-
Type, in `@jr2/orchestrator/src/effect.ts`. It is an export of `@jr2/orchestrator`,
|
|
8
|
+
Type, 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
|
type CommandOutput = (ExecOutcome & { dirty?: boolean }) | Unknown | LaterOutcome;
|