@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.34
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/CHANGELOG.md +270 -0
- package/README.md +343 -246
- package/dist/adapters.d.ts +0 -7
- package/dist/adapters.js +11 -22
- package/dist/agent-rows.d.ts +98 -0
- package/dist/agent-rows.js +1 -0
- package/dist/agents-store.d.ts +6 -2
- package/dist/agents-store.js +60 -25
- package/dist/agents.d.ts +9 -125
- package/dist/agents.js +15 -305
- package/dist/answer-json.d.ts +23 -0
- package/dist/answer-json.js +58 -0
- package/dist/api-only.d.ts +14 -0
- package/dist/api-only.js +33 -0
- package/dist/archil-routes.d.ts +1 -1
- package/dist/bash-read-only.d.ts +22 -0
- package/dist/bash-read-only.js +701 -0
- package/dist/box-egress-vm.d.ts +0 -8
- package/dist/box-egress-vm.js +0 -10
- package/dist/box-egress.d.ts +0 -4
- package/dist/box-egress.js +1 -16
- package/dist/box-paths.d.ts +25 -2
- package/dist/box-paths.js +79 -11
- package/dist/box-relay.d.ts +0 -11
- package/dist/box-relay.js +0 -20
- package/dist/box-settings.d.ts +26 -0
- package/dist/box-settings.js +63 -0
- package/dist/boxes.d.ts +21 -1
- package/dist/boxes.js +27 -20
- package/dist/browser-commands.d.ts +5 -2
- package/dist/browser-commands.js +4 -4
- package/dist/browser-computer.d.ts +5 -0
- package/dist/browser-computer.js +21 -0
- package/dist/browser-cost.d.ts +9 -6
- package/dist/browser-cost.js +94 -51
- package/dist/browser-live.d.ts +7 -20
- package/dist/browser-live.js +15 -93
- package/dist/browser-person.d.ts +18 -53
- package/dist/browser-person.js +94 -279
- package/dist/budget.d.ts +0 -4
- package/dist/budget.js +0 -7
- package/dist/cap.d.ts +8 -12
- package/dist/cap.js +12 -27
- package/dist/cli.js +61 -20
- package/dist/closed-pipes.d.ts +2 -0
- package/dist/closed-pipes.js +13 -0
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +2 -0
- package/dist/computer-keys.js +5 -2
- package/dist/computer-setting.d.ts +20 -4
- package/dist/computer-setting.js +25 -5
- package/dist/computers.d.ts +31 -3
- package/dist/computers.js +70 -11
- package/dist/confine.d.ts +120 -0
- package/dist/confine.js +436 -0
- package/dist/console/assets/index-RPHGlXmM.js +540 -0
- package/dist/console/assets/index-opTN5Naq.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/daytona-api.d.ts +0 -11
- package/dist/daytona-api.js +1 -82
- package/dist/decision-rows.d.ts +1 -1
- package/dist/decision-rows.js +1 -1
- package/dist/docker-daemon.d.ts +31 -0
- package/dist/docker-daemon.js +56 -0
- package/dist/docker-host-addresses.d.ts +37 -0
- package/dist/docker-host-addresses.js +110 -0
- package/dist/effort-guidance.js +4 -3
- package/dist/environment.d.ts +0 -3
- package/dist/environment.js +3 -5
- package/dist/errors.d.ts +0 -2
- package/dist/errors.js +6 -9
- package/dist/filed-answer.d.ts +32 -0
- package/dist/filed-answer.js +160 -0
- package/dist/files.d.ts +1 -11
- package/dist/files.js +2 -21
- package/dist/github-connection.d.ts +2 -2
- package/dist/github-connection.js +1 -1
- package/dist/graph-view.d.ts +3 -5
- package/dist/graph-view.js +4 -14
- package/dist/handed-values.d.ts +9 -0
- package/dist/handed-values.js +26 -0
- package/dist/harness-install.d.ts +22 -5
- package/dist/harness-install.js +98 -20
- package/dist/harness-opencode/adapter.d.ts +7 -0
- package/dist/harness-opencode/adapter.js +23 -6
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/verify.d.ts +17 -0
- package/dist/harness-opencode/verify.js +30 -10
- package/dist/harness-table.js +6 -1
- package/dist/harness.d.ts +4 -3
- package/dist/harness.js +16 -1
- package/dist/heard.js +1 -1
- package/dist/held-fd.d.ts +5 -0
- package/dist/held-fd.js +14 -0
- package/dist/host-calls.d.ts +20 -0
- package/dist/host-calls.js +12 -0
- package/dist/host-tools.d.ts +4 -21
- package/dist/host-tools.js +4 -61
- package/dist/host.d.ts +2 -4
- package/dist/host.js +2 -7
- package/dist/import-summary.d.ts +1 -5
- package/dist/import-summary.js +0 -21
- package/dist/import.d.ts +6 -6
- package/dist/import.js +62 -24
- package/dist/key-refusal.d.ts +5 -1
- package/dist/key-refusal.js +19 -4
- package/dist/learn/check.d.ts +6 -2
- package/dist/learn/check.js +83 -29
- package/dist/learn/folder.d.ts +5 -1
- package/dist/learn/folder.js +10 -3
- package/dist/learn/grade.d.ts +14 -0
- package/dist/learn/grade.js +68 -12
- package/dist/learn/index.d.ts +4 -4
- package/dist/learn/index.js +4 -4
- package/dist/learn/reflect.d.ts +31 -2
- package/dist/learn/reflect.js +79 -4
- package/dist/learn/relevance.d.ts +24 -0
- package/dist/learn/relevance.js +91 -0
- package/dist/learn/secrets.d.ts +8 -1
- package/dist/learn/secrets.js +95 -15
- package/dist/learn/skills.d.ts +112 -14
- package/dist/learn/skills.js +556 -52
- package/dist/learned-workflow.d.ts +37 -5
- package/dist/learned-workflow.js +106 -12
- package/dist/learning-routes.d.ts +16 -49
- package/dist/learning-routes.js +46 -36
- package/dist/learning-run.d.ts +6 -250
- package/dist/learning-run.js +11 -665
- package/dist/learning-words.d.ts +12 -5
- package/dist/learning-words.js +18 -9
- package/dist/learning.d.ts +93 -77
- package/dist/learning.js +176 -304
- package/dist/live/stream.js +1 -1
- package/dist/live/translate.js +13 -3
- package/dist/local-models.d.ts +11 -5
- package/dist/local-models.js +13 -8
- package/dist/mcp-gateway.d.ts +11 -52
- package/dist/mcp-gateway.js +44 -148
- package/dist/mcp-oauth.d.ts +10 -14
- package/dist/mcp-oauth.js +14 -32
- package/dist/mcp-probe.d.ts +0 -7
- package/dist/mcp-probe.js +4 -10
- package/dist/mcp-servers-store.d.ts +6 -6
- package/dist/mcp-servers-store.js +13 -15
- package/dist/mcp-store.js +3 -4
- package/dist/mcp.js +4 -3
- package/dist/model.d.ts +6 -7
- package/dist/model.js +43 -27
- package/dist/monid.d.ts +0 -2
- package/dist/monid.js +3 -6
- package/dist/openapi.d.ts +8 -1
- package/dist/openapi.js +124 -50
- package/dist/page.d.ts +1 -3
- package/dist/page.js +9 -19
- package/dist/paid-calls.d.ts +21 -27
- package/dist/paid-calls.js +28 -62
- package/dist/pause.d.ts +0 -2
- package/dist/pause.js +1 -8
- package/dist/place.d.ts +0 -5
- package/dist/place.js +0 -10
- package/dist/print.d.ts +2 -1
- package/dist/print.js +4 -2
- package/dist/propose.js +83 -39
- package/dist/push-handler.d.ts +1 -1
- package/dist/reflect-range.d.ts +25 -0
- package/dist/reflect-range.js +30 -0
- package/dist/refusal-words.d.ts +5 -1
- package/dist/refusal-words.js +5 -1
- package/dist/rows.d.ts +1 -1
- package/dist/run-cut.d.ts +0 -6
- package/dist/run-cut.js +0 -6
- package/dist/run-db.d.ts +2 -13
- package/dist/run-db.js +2 -41
- package/dist/run-launch.d.ts +19 -2
- package/dist/run-launch.js +13 -5
- package/dist/run-learning-served.d.ts +46 -2
- package/dist/run-learning-served.js +26 -7
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-reads-over-store.js +15 -6
- package/dist/run-secrets.d.ts +33 -0
- package/dist/run-secrets.js +53 -0
- package/dist/run-timeline-served.d.ts +5 -1
- package/dist/run-timeline-served.js +19 -5
- package/dist/run-view.d.ts +12 -17
- package/dist/run-view.js +29 -28
- package/dist/runnable.d.ts +18 -10
- package/dist/runnable.js +21 -10
- package/dist/runner/adapter-loop.d.ts +14 -3
- package/dist/runner/adapter-loop.js +464 -62
- package/dist/runner/adapter-run-spec.d.ts +29 -8
- package/dist/runner/adapter-run-spec.js +96 -37
- package/dist/runner/adapters/index.js +11 -1
- package/dist/runner/adapters/pi.d.ts +15 -1
- package/dist/runner/adapters/pi.js +19 -5
- package/dist/runner/beside.d.ts +30 -3
- package/dist/runner/beside.js +54 -12
- package/dist/runner/claim-secrets.d.ts +10 -1
- package/dist/runner/claim-secrets.js +49 -15
- package/dist/runner/cli-run-spec.d.ts +2 -0
- package/dist/runner/cli-run-spec.js +60 -17
- package/dist/runner/commands.js +1 -1
- package/dist/runner/computer-journal.d.ts +15 -2
- package/dist/runner/computer-journal.js +41 -5
- package/dist/runner/conformance/harness.js +118 -8
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/dispatch.d.ts +8 -1
- package/dist/runner/dispatch.js +81 -7
- package/dist/runner/end-of-run.d.ts +8 -2
- package/dist/runner/end-of-run.js +10 -4
- package/dist/runner/github-app.js +1 -1
- package/dist/runner/harness-loops.d.ts +9 -1
- package/dist/runner/harness-loops.js +15 -2
- package/dist/runner/journal-kinds.d.ts +30 -6
- package/dist/runner/journal-kinds.js +20 -5
- package/dist/runner/journal-reader.d.ts +1 -1
- package/dist/runner/journal-reader.js +2 -2
- package/dist/runner/learning-ask.d.ts +4 -0
- package/dist/runner/learning-ask.js +15 -1
- package/dist/runner/learning-end.d.ts +18 -3
- package/dist/runner/learning-end.js +113 -11
- package/dist/runner/learning-loop.d.ts +5 -0
- package/dist/runner/learning-loop.js +26 -6
- package/dist/runner/live-ticker.d.ts +1 -1
- package/dist/runner/live-ticker.js +28 -4
- package/dist/runner/loop-contract.d.ts +3 -2
- package/dist/runner/main.d.ts +64 -10
- package/dist/runner/main.js +165 -27
- package/dist/runner/mcp-claim.d.ts +1 -1
- package/dist/runner/mcp-claim.js +2 -3
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +15 -5
- package/dist/runner/memory-claim.d.ts +9 -0
- package/dist/runner/memory-claim.js +25 -0
- package/dist/runner/metrics.d.ts +33 -1
- package/dist/runner/metrics.js +85 -1
- package/dist/runner/model-route.d.ts +13 -0
- package/dist/runner/model-route.js +154 -11
- package/dist/runner/redact.d.ts +8 -2
- package/dist/runner/redact.js +11 -2
- package/dist/runner/reflect-hook.d.ts +12 -1
- package/dist/runner/reflect-hook.js +33 -3
- package/dist/runner/runner.d.ts +20 -0
- package/dist/runner/runner.js +56 -10
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +3 -3
- package/dist/runner/store-secrets.js +8 -12
- package/dist/runner/text-tools.d.ts +44 -0
- package/dist/runner/text-tools.js +237 -0
- package/dist/runner/workflow-loop.d.ts +6 -0
- package/dist/runner/workflow-loop.js +6 -4
- package/dist/runner/workflow-spec.d.ts +18 -0
- package/dist/runner/workflow-spec.js +68 -26
- package/dist/runs-over-store.d.ts +8 -3
- package/dist/runs-over-store.js +76 -19
- package/dist/seal-key.d.ts +54 -15
- package/dist/seal-key.js +232 -82
- package/dist/sealed-settings-store.d.ts +19 -4
- package/dist/sealed-settings-store.js +9 -9
- package/dist/sealing.d.ts +4 -0
- package/dist/sealing.js +20 -0
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-name.d.ts +9 -0
- package/dist/secret-name.js +15 -0
- package/dist/secret-writes.d.ts +0 -1
- package/dist/secret-writes.js +0 -1
- package/dist/secrets.d.ts +2 -10
- package/dist/secrets.js +21 -17
- package/dist/server-fs.d.ts +4 -0
- package/dist/server-fs.js +8 -2
- package/dist/server-lock.d.ts +0 -24
- package/dist/server-lock.js +1 -80
- package/dist/server-secrets-store.d.ts +4 -4
- package/dist/server-secrets-store.js +10 -32
- package/dist/server-secrets.d.ts +4 -9
- package/dist/server-secrets.js +12 -33
- package/dist/server.d.ts +26 -44
- package/dist/server.js +229 -142
- package/dist/sign-ins-store.d.ts +34 -36
- package/dist/sign-ins-store.js +27 -38
- package/dist/sign-ins.d.ts +2 -119
- package/dist/sign-ins.js +5 -311
- package/dist/standard-webhooks.d.ts +1 -1
- package/dist/standard-webhooks.js +1 -1
- package/dist/stats.d.ts +3 -2
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.d.ts +8 -2
- package/dist/store/agent-body.js +16 -4
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +3 -3
- package/dist/store/open.d.ts +18 -5
- package/dist/store/open.js +23 -3
- package/dist/store/postgres/connection.d.ts +18 -2
- package/dist/store/postgres/connection.js +156 -32
- package/dist/store/postgres/migrate.d.ts +4 -0
- package/dist/store/postgres/migrate.js +27 -3
- package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
- package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
- package/dist/store/postgres/store.d.ts +9 -2
- package/dist/store/postgres/store.js +9 -0
- package/dist/store/schema.js +1 -1
- package/dist/store/seal.js +2 -2
- package/dist/store/sqlite/connection.js +49 -5
- package/dist/store/sqlite/run-patch.d.ts +3 -0
- package/dist/store/sqlite/run-patch.js +3 -0
- package/dist/store/sqlite/store.js +64 -20
- package/dist/store/store.d.ts +38 -6
- package/dist/store/store.js +12 -2
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +22 -4
- package/dist/store-reads/journal.d.ts +25 -6
- package/dist/store-reads/journal.js +173 -21
- package/dist/store-reads/learning.d.ts +26 -8
- package/dist/store-reads/learning.js +12 -4
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-reads/workflow.js +1 -1
- package/dist/store-view.d.ts +5 -1
- package/dist/store-view.js +91 -23
- package/dist/template-eval.d.ts +60 -4
- package/dist/template-eval.js +120 -54
- package/dist/templates.d.ts +24 -10
- package/dist/templates.js +69 -38
- package/dist/timeline/group.d.ts +33 -0
- package/dist/timeline/group.js +77 -0
- package/dist/timeline/index.d.ts +7 -0
- package/dist/timeline/index.js +7 -0
- package/dist/timeline/labels.d.ts +79 -0
- package/dist/timeline/labels.js +150 -0
- package/dist/timeline/origin.d.ts +56 -0
- package/dist/timeline/origin.js +92 -0
- package/dist/timeline/render-text.d.ts +11 -0
- package/dist/timeline/render-text.js +62 -0
- package/dist/timeline/timeline.d.ts +274 -0
- package/dist/timeline/timeline.js +1308 -0
- package/dist/timeline/util.d.ts +17 -0
- package/dist/timeline/util.js +49 -0
- package/dist/tool-gate.d.ts +41 -216
- package/dist/tool-gate.js +79 -540
- package/dist/tool-keys-store.d.ts +11 -12
- package/dist/tool-keys-store.js +24 -31
- package/dist/tool-keys.d.ts +9 -104
- package/dist/tool-keys.js +15 -271
- package/dist/tool-plane.d.ts +14 -42
- package/dist/tool-plane.js +23 -81
- package/dist/tool-settings-store.d.ts +1 -2
- package/dist/tool-settings-store.js +5 -8
- package/dist/tools.d.ts +31 -19
- package/dist/tools.js +101 -108
- package/dist/trigger-adapter.d.ts +2 -2
- package/dist/trigger-schedule.js +2 -1
- package/dist/trigger-secrets-shown.js +5 -1
- package/dist/trigger-targets.d.ts +13 -1
- package/dist/trigger-targets.js +31 -1
- package/dist/triggers.d.ts +2 -2
- package/dist/triggers.js +3 -3
- package/dist/turn-end.d.ts +1 -1
- package/dist/turn-end.js +1 -1
- package/dist/turns.d.ts +0 -6
- package/dist/turns.js +0 -19
- package/dist/uploads.js +1 -1
- package/dist/usage.d.ts +0 -2
- package/dist/usage.js +0 -2
- package/dist/validate.d.ts +2 -0
- package/dist/validate.js +23 -14
- package/dist/webhooks.d.ts +102 -76
- package/dist/webhooks.js +266 -233
- package/dist/workflow-run.d.ts +114 -0
- package/dist/workflow-run.js +144 -0
- package/dist/workspace/beneath.d.ts +19 -0
- package/dist/workspace/beneath.js +106 -0
- package/dist/workspace/computer-deps.d.ts +52 -5
- package/dist/workspace/computer-deps.js +154 -19
- package/dist/workspace/computer-for-claim.d.ts +19 -14
- package/dist/workspace/computer-for-claim.js +77 -16
- package/dist/workspace/computer-hold.d.ts +6 -1
- package/dist/workspace/computer-hold.js +6 -1
- package/dist/workspace/computer-janitor.d.ts +47 -0
- package/dist/workspace/computer-janitor.js +182 -0
- package/dist/workspace/computer-providers.d.ts +6 -2
- package/dist/workspace/computer-providers.js +1 -1
- package/dist/workspace/grep-worker.d.ts +5 -0
- package/dist/workspace/grep-worker.js +9 -6
- package/dist/workspace/index.d.ts +4 -3
- package/dist/workspace/index.js +4 -4
- package/dist/workspace/local.d.ts +11 -2
- package/dist/workspace/local.js +161 -43
- package/dist/workspace/resolve-computer.d.ts +50 -10
- package/dist/workspace/resolve-computer.js +46 -11
- package/dist/workspace/run-tools.d.ts +13 -31
- package/dist/workspace/run-tools.js +10 -27
- package/dist/workspace-paths.d.ts +0 -17
- package/dist/workspace-paths.js +1 -41
- package/dist/workspace.d.ts +0 -17
- package/dist/workspace.js +3 -99
- package/launcher/agentrun-serve +6 -33
- package/package.json +14 -14
- package/templates/README.md +9 -3
- package/templates/inbound-lead/agent.md +1 -1
- package/templates/kyb/agent.md +1 -1
- package/templates/market-monitor/agent.md +2 -2
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/dist/app.d.ts +0 -5
- package/dist/app.js +0 -514
- package/dist/bound-files.d.ts +0 -4
- package/dist/bound-files.js +0 -164
- package/dist/bounds.d.ts +0 -26
- package/dist/bounds.js +0 -137
- package/dist/coding-tools.d.ts +0 -47
- package/dist/coding-tools.js +0 -189
- package/dist/computer-adb.d.ts +0 -12
- package/dist/computer-adb.js +0 -14
- package/dist/console/assets/index-35-7aeIZ.js +0 -519
- package/dist/console/assets/index-Cejbov-Y.css +0 -1
- package/dist/content-filter.d.ts +0 -7
- package/dist/content-filter.js +0 -23
- package/dist/disk.d.ts +0 -33
- package/dist/disk.js +0 -85
- package/dist/door-line.d.ts +0 -23
- package/dist/door-line.js +0 -83
- package/dist/grade.d.ts +0 -63
- package/dist/grade.js +0 -150
- package/dist/harness-app.d.ts +0 -69
- package/dist/harness-app.js +0 -1162
- package/dist/mcp-servers.d.ts +0 -269
- package/dist/mcp-servers.js +0 -456
- package/dist/packs.d.ts +0 -71
- package/dist/packs.js +0 -180
- package/dist/request-start.d.ts +0 -27
- package/dist/request-start.js +0 -381
- package/dist/run-box.d.ts +0 -205
- package/dist/run-box.js +0 -661
- package/dist/run-holder.d.ts +0 -52
- package/dist/run-holder.js +0 -139
- package/dist/runs.d.ts +0 -1200
- package/dist/runs.js +0 -4103
- package/dist/sealed-settings.d.ts +0 -60
- package/dist/sealed-settings.js +0 -178
- package/dist/served-only.d.ts +0 -5
- package/dist/served-only.js +0 -12
- package/dist/sessions.d.ts +0 -6
- package/dist/sessions.js +0 -109
- package/dist/workspace/computer-serves.d.ts +0 -12
- package/dist/workspace/computer-serves.js +0 -15
|
@@ -25,6 +25,5 @@ declare class ToolSettingsOverStore {
|
|
|
25
25
|
put(map: ToolSettingsMap): Promise<ToolSettingsMap>;
|
|
26
26
|
}
|
|
27
27
|
export type { ToolSettingsOverStore };
|
|
28
|
-
/** The
|
|
29
|
-
* at start before the first get(). */
|
|
28
|
+
/** The server's tool settings over the one store: the server awaits load() once at start, before the first get(). */
|
|
30
29
|
export declare function toolSettingsOverStore(store: ToolSettingsStore, warn?: (line: string) => void): ToolSettingsOverStore;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// The server's tool settings over the one store (store.settings)
|
|
2
|
-
// (
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// 204, as writeDurableSync was). The read and write go through loadToolSettings / saveToolSettings; this layer is
|
|
6
|
-
// only the snapshot and the sync surface the switch swaps `new ToolSettings(dir)` for.
|
|
1
|
+
// The server's tool settings over the one store (store.settings): a synchronous get() off an in-memory snapshot the server
|
|
2
|
+
// (the one writer of this row) loads once at start and keeps in step with every put(), and a put() that returns the
|
|
3
|
+
// settings as served, durable before the handler's answer. The read and write go through loadToolSettings /
|
|
4
|
+
// saveToolSettings; this layer is only the snapshot and the sync surface.
|
|
7
5
|
import { SETTINGS_UNREAD } from "./tool-gate.js";
|
|
8
6
|
import { loadToolSettings, saveToolSettings } from "./tool-plane.js";
|
|
9
7
|
class ToolSettingsOverStore {
|
|
@@ -46,8 +44,7 @@ class ToolSettingsOverStore {
|
|
|
46
44
|
return this.get();
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
|
-
/** The
|
|
50
|
-
* at start before the first get(). */
|
|
47
|
+
/** The server's tool settings over the one store: the server awaits load() once at start, before the first get(). */
|
|
51
48
|
export function toolSettingsOverStore(store, warn = (line) => void process.stderr.write(`${line}\n`)) {
|
|
52
49
|
return new ToolSettingsOverStore(store, warn);
|
|
53
50
|
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import { type Extension, type Harness, type ToolRegistration, type Tx } from "@earendil-works/pi-durable";
|
|
3
|
-
import type {
|
|
4
|
-
import type { Revision } from "@parcha/pi-durable-agent";
|
|
5
|
-
import type { CodingSource } from "./coding-tools.js";
|
|
3
|
+
import type { Revision } from "./agent-rows.js";
|
|
6
4
|
import { type Workspace } from "./workspace/index.js";
|
|
5
|
+
import type { ClaimBrowser } from "./workspace/resolve-computer.js";
|
|
7
6
|
import { type Complete } from "./llm.js";
|
|
8
7
|
import { type Ledger, type PaidBooking } from "./paid-calls.js";
|
|
9
8
|
import type { Refusal } from "@parcha/agentrun-kernel";
|
|
9
|
+
import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
10
10
|
import { type Plane, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
11
11
|
import type { DenyFrom, SettingFrom } from "./tool-gate.js";
|
|
12
12
|
import type { LiveHandover, LiveViewerStore } from "./browser-live.js";
|
|
@@ -23,13 +23,19 @@ export declare const FAUX_VENDOR_API_ENV = "AGENTRUN_SERVE_FAUX_VENDOR_API";
|
|
|
23
23
|
/** What the result of `ask_person` says; the person's page shows the question as a waiting row. */
|
|
24
24
|
export declare const asked: (question: string) => string;
|
|
25
25
|
export declare const askPerson: ToolRegistration<TSchema, import("@earendil-works/chord").JsonValue>;
|
|
26
|
+
/** Where a run's tools are bound: the run, by its id, its folder and the folder its tools work in. */
|
|
27
|
+
export type RunWhere = {
|
|
28
|
+
readonly ref: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
};
|
|
31
|
+
readonly root: string;
|
|
32
|
+
readonly work: string;
|
|
33
|
+
};
|
|
26
34
|
/** What a tool's binding gets from the run's process. */
|
|
27
35
|
export type ToolHost = {
|
|
28
|
-
where:
|
|
36
|
+
where: RunWhere;
|
|
29
37
|
/** The run's environment: the server's, without the server's token. */
|
|
30
38
|
env: NodeJS.ProcessEnv;
|
|
31
|
-
/** The run's coding tools, by its place (coding-tools.ts codingSource). */
|
|
32
|
-
coding: CodingSource;
|
|
33
39
|
/** Installs an extension in the run's registry, before the run opens. */
|
|
34
40
|
install(extension: Extension): void;
|
|
35
41
|
/** Runs in the commit that creates each of the run's conversations. */
|
|
@@ -52,16 +58,12 @@ export type ToolHost = {
|
|
|
52
58
|
* takes (adapter-loop AdapterRun.rowSummaryOn): a hand-over's wait sets the row's waiting summary in its waiting
|
|
53
59
|
* entry's commit, and its answer's commit clears it, so the server tells run.needs_input for a run held in its claim. */
|
|
54
60
|
rowSummaryOn?(kind: string, test: (data: Record<string, unknown>) => boolean, summary: string | null): void;
|
|
55
|
-
/** The run is on the runner: its browser hand-over's answers are entries of its journal (a browser_hand_back row the
|
|
56
|
-
* runner applies, the live view's hand-back, the ask's expiry), read and written there, never as answer files
|
|
57
|
-
* (browser-person.ts personHands `answered`). */
|
|
58
|
-
handoverInJournal?: boolean;
|
|
59
61
|
/** The run is on the runner: its live viewers are handed over through the store, not through files in its directory
|
|
60
62
|
* (browser-live.ts putLiveViewer/dropLiveViewer). The browser tool's live-viewer writers hang off this: `put` hands a
|
|
61
63
|
* session's viewer over (its token sealed under the run's `sealKey`), `drop` takes one (or all of the run's) back. The
|
|
62
64
|
* three fields below are what builds these (the one store, the claim the row is written under, the seal key); a tool's
|
|
63
|
-
* binding reads `liveViewers`, never them directly. Absent
|
|
64
|
-
*
|
|
65
|
+
* binding reads `liveViewers`, never them directly. Absent, no viewer is handed over (browser-live.ts
|
|
66
|
+
* sessionHandovers), and nothing is written in the run's folder. */
|
|
65
67
|
liveViewers?: {
|
|
66
68
|
put(handover: LiveHandover): Promise<boolean>;
|
|
67
69
|
drop(tag?: string): Promise<void>;
|
|
@@ -77,11 +79,13 @@ export type ToolHost = {
|
|
|
77
79
|
/** The run's ledger, as the adapter loop hands it (spendcap-1's AdapterRun.ledger): `paid`, the claim's one-ledger
|
|
78
80
|
* booking (the kernel cap's paidCalls, paid-calls.ts PaidBooking), and `pause`, how a refusal at the cap parks the run.
|
|
79
81
|
* The browser passes `paid` to browserSpend, so its calls are held and settled there and a session's release is booked
|
|
80
|
-
* there, never on this process's own spend
|
|
81
|
-
*
|
|
82
|
+
* there, never on this process's own spend; `flush`, the runner's store flush, puts a session's open record on disk
|
|
83
|
+
* before the vendor is asked. The runner installs the browser only with `paid` and the grant, on pi's native route
|
|
84
|
+
* (adapter-run-spec.ts browserListed). */
|
|
82
85
|
ledger?: {
|
|
83
86
|
paid: PaidBooking;
|
|
84
87
|
pause?: (refusal: Refusal) => Promise<void>;
|
|
88
|
+
flush: () => Promise<void>;
|
|
85
89
|
};
|
|
86
90
|
/** The run's one redactor (the runner's: every secret value the runner and the claim hold, in every form): what the
|
|
87
91
|
* browser's answers pass through before pi stores them or the model reads them. Absent on the old per-run process. */
|
|
@@ -90,6 +94,9 @@ export type ToolHost = {
|
|
|
90
94
|
* where a tool files what the run's read finds later (monid's whole answer past the model's cut). Absent, the local
|
|
91
95
|
* folder at `where.work`. */
|
|
92
96
|
workspace?: Workspace;
|
|
97
|
+
/** The agent's computer, where it is a browser (computer-for-claim.ts): the browser tool opens its sessions through the
|
|
98
|
+
* claim's provider and drives each over its CDP URL with pi-browser's raw-CDP driver, in place of the plane's vendor. */
|
|
99
|
+
browserComputer?: ClaimBrowser;
|
|
93
100
|
};
|
|
94
101
|
/** What a name stands for in the run: the pi tools it offers, and the extensions a conversation selects for them. */
|
|
95
102
|
export type ToolBinding = {
|
|
@@ -187,7 +194,7 @@ export declare const savedOnRelease: (row: {
|
|
|
187
194
|
/** On the runner, the per-session hook that verifies the run's saved sign-in: a session that saved to it (savedOnRelease,
|
|
188
195
|
* in a run handed it to save) verifies it under the run's claim, at the session's own end (its time, else now), as the
|
|
189
196
|
* saved mark main reads at the lease's end. Answers whether it verified (sign-ins-store.ts verifyRunSignIn). */
|
|
190
|
-
export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer
|
|
197
|
+
export declare const runSignInSaved: (store: Pick<Store, "runs" | "signIns">, sealKey: Buffer, claim: Claim, kept: RunSignIn) => (row: {
|
|
191
198
|
session: {
|
|
192
199
|
resourceId: string | null;
|
|
193
200
|
releaseReason: string | null;
|
|
@@ -229,6 +236,10 @@ export declare function grantedTools(revision: {
|
|
|
229
236
|
}): Promise<string[]>;
|
|
230
237
|
/** The table's entry for `name`, or undefined for a name it does not hold. */
|
|
231
238
|
export declare const toolOf: (name: string) => ToolEntry | undefined;
|
|
239
|
+
/** The sandbox-only tools a run whose shell is `shell` has (resolve-computer.ts shellPlaceOf): every one in a computer
|
|
240
|
+
* that mounts its folder, bash alone on Mode 2's Archil exec ("local"), none with no shell. The kernel registry's
|
|
241
|
+
* hostToolDefs says which, the one list the run's tools are bound from. The save check asks it for "local" alone. */
|
|
242
|
+
export declare const shellTools: (shell: ShellPlace) => ReadonlySet<string>;
|
|
232
243
|
/** What a stored revision's tools resolve from (tool-plane.ts): the tools it grants, its harness, model and settings. */
|
|
233
244
|
export declare function toolingOf(revision: Revision): Promise<Tooling>;
|
|
234
245
|
/** The variables `entry` needs that `env` does not set, by name. */
|
|
@@ -246,12 +257,13 @@ export declare function toolRefusal(names: readonly string[], env: NodeJS.Proces
|
|
|
246
257
|
* sets none), the default, and what it resolves to on each harness under the server's `settings`: available where any
|
|
247
258
|
* is not unavailable, and missing PARALLEL_API_KEY where Parallel is picked without it. An unavailable tool says why
|
|
248
259
|
* (`reason`). `noBox`: why no box can run a sandbox-only tool here (place.ts noBoxReason), which leaves it
|
|
249
|
-
* unavailable with that reason; undefined, a box can. `
|
|
250
|
-
*
|
|
260
|
+
* unavailable with that reason; undefined, a box can. `runnerShell`: the sandbox-only tools a run on the runner has a
|
|
261
|
+
* shell for here (shellTools: bash on Archil's exec in Mode 2), which need no box. `refused`: the variables of the keys this server was started with
|
|
262
|
+
* that their provider refused at the start (tool-keys-store.ts refused), each with why: a tool that needs one is unavailable,
|
|
251
263
|
* saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
|
|
252
264
|
* and the permissions it may be set to. */
|
|
253
|
-
export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string
|
|
254
|
-
providers?: ("auto" | "native" | "
|
|
265
|
+
export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>, runnerShell?: ReadonlySet<string>) => {
|
|
266
|
+
providers?: ("auto" | "native" | "parallel" | "browserbase" | "kernel" | "off" | "exa-keyless" | "chrome")[] | undefined;
|
|
255
267
|
provider?: string | undefined;
|
|
256
268
|
default_provider?: "auto" | "kernel" | undefined;
|
|
257
269
|
resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent", import("./tool-plane.js").Resolution> | undefined;
|
package/dist/tools.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// The tools a revision may name here: one closed table. Each entry is how the run's process binds the name and which
|
|
2
2
|
// environment variables it needs. A name outside the table cannot be named, and nothing is loaded from anywhere else.
|
|
3
|
-
// The file tools
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// The file tools, `bash` and the background tools (bash_background, bash_output, bash_input, bash_signal, bash_list) bind
|
|
4
|
+
// nothing here: a run's runner binds them from its workspace's registry (workspace/run-tools.ts), each call made on the
|
|
5
|
+
// run's folder or its computer. `bash` and the background tools may be named only by an agent whose place is a box
|
|
6
|
+
// (runnable.ts).
|
|
7
7
|
import { blurbOf } from "./tool-blurbs.js";
|
|
8
|
-
import { appendFileSync
|
|
9
|
-
import { join } from "node:path";
|
|
8
|
+
import { appendFileSync } from "node:fs";
|
|
10
9
|
import { pathToFileURL } from "node:url";
|
|
11
10
|
import { defineExtension, defineTool, ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
12
|
-
import { registerTurnEnding } from "
|
|
11
|
+
import { registerTurnEnding } from "./timeline/index.js";
|
|
13
12
|
import { BACKGROUND_LOG_BYTES, BACKGROUND_MAX, BACKGROUND_PAGE_BYTES } from "./background.js";
|
|
14
13
|
import { isWorkspaceError, localWorkspace } from "./workspace/index.js";
|
|
15
14
|
import { fetchOptions, HTML_READ_CHARS, TEXT_CAP } from "./web-fetch-direct.js";
|
|
@@ -20,6 +19,7 @@ import { DOCUMENTS_ENV, PDF_PAGES_TOOL, pdfPages } from "./pdf-pages.js";
|
|
|
20
19
|
import { monidTool } from "./monid.js";
|
|
21
20
|
import { FAUX_ENV, workflowNodes } from "./model.js";
|
|
22
21
|
import { bookedIn, booking } from "./paid-calls.js";
|
|
22
|
+
import { hostToolDefs } from "@parcha/agentrun-kernel/kernel";
|
|
23
23
|
import { browserPrice, browserSpend } from "./browser-cost.js";
|
|
24
24
|
import { forModel } from "./result.js";
|
|
25
25
|
import { fetchFor, pagesOf, WEB_FETCH_TOOL, webFetchTool } from "./web-fetch.js";
|
|
@@ -27,10 +27,11 @@ import { searchFor, WEB_SEARCH_TOOL, webSearchTool } from "./web-search.js";
|
|
|
27
27
|
import { browserNeeds, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
28
28
|
import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
29
29
|
import { keyNeeded } from "./key-words.js";
|
|
30
|
-
import { handedSignIn
|
|
30
|
+
import { handedSignIn } from "./secrets.js";
|
|
31
31
|
import { redactedAnswer } from "./key-refusal.js";
|
|
32
|
-
import { SIGN_IN_KEY,
|
|
32
|
+
import { SIGN_IN_KEY, vendorsOver } from "./sign-ins.js";
|
|
33
33
|
import { answerIn, answerOnce } from "./runner/hand-back.js";
|
|
34
|
+
import { waitingAsk } from "./browser-commands.js";
|
|
34
35
|
import { runnerSecrets } from "./runner/redact.js";
|
|
35
36
|
import { HANDOVER_WAITING } from "./runner/journal-kinds.js";
|
|
36
37
|
import { runSignIn, verifyRunSignIn } from "./sign-ins-store.js";
|
|
@@ -90,16 +91,14 @@ const webFetchEntry = (name) => ({
|
|
|
90
91
|
// (paid-calls.ts); a part from what the run read makes none and books nothing.
|
|
91
92
|
effect: async (args, run) => bookedIn(run.ledger, async () => fetchFor(run.env, args.url, { ...(await fetchOptions(run.env, FAUX_ENV)), offset: args.offset, maxChars: args.max_chars ?? TEXT_CAP, pages: pagesOf(run.env), signal: run.signal })),
|
|
92
93
|
});
|
|
93
|
-
/** A
|
|
94
|
-
|
|
94
|
+
/** A file or shell tool: listed here for its words and its rules, bound by the run's workspace registry
|
|
95
|
+
* (workspace/run-tools.ts), never by this table. */
|
|
96
|
+
const fileTool = (summary, sandboxOnly = false) => ({
|
|
95
97
|
summary,
|
|
96
98
|
needs: [],
|
|
97
99
|
nodes: !sandboxOnly,
|
|
98
100
|
...(sandboxOnly ? { sandboxOnly: true } : {}),
|
|
99
|
-
bind: async (
|
|
100
|
-
const tools = host.coding.tools.filter((tool) => tool.name === name);
|
|
101
|
-
return { tools, extensions: tools.length ? [host.coding.extension] : [] };
|
|
102
|
-
},
|
|
101
|
+
bind: async () => ({ tools: [], extensions: [] }),
|
|
103
102
|
});
|
|
104
103
|
/** The folder the browser files what it reads in. */
|
|
105
104
|
const EVIDENCE = "evidence";
|
|
@@ -227,7 +226,10 @@ const browserTool = {
|
|
|
227
226
|
summary: "Drive a hosted browser, Browserbase's or Kernel's (picked in tool settings, else whichever's key the server holds): open pages, read and screenshot them, and act on them.",
|
|
228
227
|
// Which vendor's keys it needs is the plane's to say (tool-plane.ts BROWSER_KEYS): neither alone is required.
|
|
229
228
|
needs: [],
|
|
230
|
-
|
|
229
|
+
// No workflow model node takes it (#2098): the runner, where every run goes, binds the browser for an agentic run alone
|
|
230
|
+
// (its reconcile, its release and drain, its live view hang off that run's lifecycle). A node naming it is refused when
|
|
231
|
+
// its definition is saved (runnable.ts), never accepted and then failed at its run.
|
|
232
|
+
nodes: false,
|
|
231
233
|
// Its downloads and uploads go through work/ by path (pi-browser), which a box's command could turn through a link.
|
|
232
234
|
runnerOnly: true,
|
|
233
235
|
bind: async (host) => {
|
|
@@ -239,27 +241,34 @@ const browserTool = {
|
|
|
239
241
|
import("./browser-live.js"),
|
|
240
242
|
import("./browser-person.js"),
|
|
241
243
|
]);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
// The agent's computer, where it is a browser, wins over the plane's pick: the run's sessions are that provider's,
|
|
245
|
+
// opened through the claim and driven over their CDP URL by the raw-CDP driver, with no pi-browser vendor provider,
|
|
246
|
+
// saved sign-in or plane check of their own.
|
|
247
|
+
const computer = host.browserComputer;
|
|
248
|
+
const planeVendor = planeOf(host.env).browser ?? "browserbase";
|
|
249
|
+
const vendor = computer?.provider ?? planeVendor;
|
|
250
|
+
const refused = !computer && isUnavailable(planeVendor) ? new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${whyUnavailable(planeVendor)}.`)) : undefined;
|
|
244
251
|
// The run's saved sign-in: on the runner (one process, many claims) read from the store under this run's own claim
|
|
245
252
|
// (sign-ins-store.ts runSignIn), never from the process; on the old per-run process, over its own secrets' pipe.
|
|
246
253
|
// An agent with none saved has its first made at the vendor now, over this run's own claim keys (host.env), as main's
|
|
247
254
|
// launch makes it: never the process's environment, so one run's keys never make another's.
|
|
248
255
|
const runLog = (line) => void process.stderr.write(`agentrun-serve: run ${host.where.ref.id}: ${line}\n`);
|
|
249
256
|
const vendorFetch = async () => (host.env[FAUX_ENV] ? fauxFetch(host.env, FAUX_VENDOR_API_ENV) : fetch);
|
|
250
|
-
const handed = host.claim ? (refused || !host.store ? undefined : await runSignIn(host.store, host.sealKey, host.claim, vendor, { vendors: vendorsOver(() => host.env, vendorFetch), log: runLog })) : handedSignIn();
|
|
257
|
+
const handed = computer ? undefined : host.claim ? (refused || !host.store || !host.sealKey ? undefined : await runSignIn(host.store, host.sealKey, host.claim, vendor, { vendors: vendorsOver(() => host.env, vendorFetch), log: runLog })) : handedSignIn();
|
|
251
258
|
const kept = !refused && handed?.provider === vendor ? handed : undefined;
|
|
252
259
|
const faux = host.env[FAUX_ENV] ? host.env[FAUX_BROWSER_ENV] : undefined;
|
|
253
|
-
const parts =
|
|
254
|
-
? (await import(
|
|
255
|
-
:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
:
|
|
259
|
-
?
|
|
260
|
-
:
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
const parts = computer
|
|
261
|
+
? { provider: (await import("./browser-computer.js")).claimBrowserProvider(computer), driver: (await import("@parcha/pi-browser/driver/cdp")).cdpDriver() }
|
|
262
|
+
: faux
|
|
263
|
+
? (await import(pathToFileURL(faux).href)).default(host.env, vendor, kept)
|
|
264
|
+
: {
|
|
265
|
+
provider: refused
|
|
266
|
+
? undefined
|
|
267
|
+
: vendor === "kernel"
|
|
268
|
+
? ((kernel) => (kept ? keptProfile(kernel, kept.ref) : kernel))((await import("@parcha/pi-browser/providers/kernel")).kernelProvider({ env: host.env, headless: true }))
|
|
269
|
+
: (await import("@parcha/pi-browser/providers/browserbase")).browserbaseProvider({ env: host.env, profiles: keptContexts(kept?.ref) }),
|
|
270
|
+
driver: (await import("@parcha/pi-browser/driver/stagehand")).stagehandDriver(),
|
|
271
|
+
};
|
|
263
272
|
// The save flag every session carries is this launch's (asHanded), never the one stored with its conversation.
|
|
264
273
|
const handedProvider = parts.provider ? asHanded(parts.provider, kept) : undefined;
|
|
265
274
|
// The owner's live view (browser-live.ts): pi-browser's own viewer on a loopback port of this process's, over every
|
|
@@ -269,13 +278,28 @@ const browserTool = {
|
|
|
269
278
|
const windows = person.personWindows(host.env, Boolean(host.env[FAUX_ENV]));
|
|
270
279
|
const gates = fauxModelWaits(createDrivingGates({ holdIdleMs: windows.holdMs, holdAwayMs: windows.awayMs }), Boolean(host.env[FAUX_ENV]));
|
|
271
280
|
let opened;
|
|
281
|
+
// Every hand-over entry of the run's root conversation, in order: the asks' waiting entries (each ask's one record, in
|
|
282
|
+
// no file the run's agent reaches) and their answers.
|
|
283
|
+
const handovers = async () => (await opened?.commit(async (tx) => {
|
|
284
|
+
const found = [];
|
|
285
|
+
for (let cursor;;) {
|
|
286
|
+
const page = await tx.scanEntries({ conversationId: ROOT_CONVERSATION_ID, order: "ascending" }, 200, cursor);
|
|
287
|
+
for (const entry of page.items)
|
|
288
|
+
if (entry.kind === "agent.handover")
|
|
289
|
+
found.push({ kind: entry.kind, data: entry.data });
|
|
290
|
+
if (page.next === undefined)
|
|
291
|
+
return found;
|
|
292
|
+
cursor = page.next;
|
|
293
|
+
}
|
|
294
|
+
}, context)) ?? [];
|
|
272
295
|
const hands = person.personHands({
|
|
273
|
-
root: host.where.root,
|
|
274
296
|
gates,
|
|
275
297
|
personTime: (what, seconds, options) => spend.personTime(what, seconds, options),
|
|
276
298
|
carry: (tag, seconds) => spend.carry(tag, seconds),
|
|
277
|
-
// The model's words for the person, with every value this run holds cut, whole, before they are cut to their bound
|
|
278
|
-
|
|
299
|
+
// The model's words for the person, with every value this run holds cut, whole, before they are cut to their bound:
|
|
300
|
+
// the run's own cut on the runner (host.redact: the claim's keys too, every tool's, in every form), and the secrets
|
|
301
|
+
// its env holds (runnerSecrets: hostSecrets and every launcher name's value) with its sign-in's pointer.
|
|
302
|
+
redact: (text) => redactedAnswer(host.redact ? host.redact(text) : text, [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])]),
|
|
279
303
|
note: async (kind, data) => {
|
|
280
304
|
// A hand-over's waiting entry, on the runner: the row says the run waits on the person in its browser from that
|
|
281
305
|
// commit (the server tells run.needs_input by it), and no more from its answer's, whoever writes it.
|
|
@@ -287,54 +311,24 @@ const browserTool = {
|
|
|
287
311
|
await opened?.commit(async (tx) => void (await tx.appendEntry(ROOT_CONVERSATION_ID, { kind, data })), context);
|
|
288
312
|
},
|
|
289
313
|
holdMs: windows.holdMs,
|
|
290
|
-
// The
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
for (let cursor;;) {
|
|
309
|
-
const page = await tx.scanEntries({ conversationId: ROOT_CONVERSATION_ID, order: "ascending" }, 200, cursor);
|
|
310
|
-
const found = answerIn(page.items, id);
|
|
311
|
-
if (found)
|
|
312
|
-
return { outcome: found.state, at: found.at, ...(found.reason !== undefined ? { reason: found.reason } : {}) };
|
|
313
|
-
if (page.next === undefined)
|
|
314
|
-
return undefined;
|
|
315
|
-
cursor = page.next;
|
|
316
|
-
}
|
|
317
|
-
}, context)) ?? undefined,
|
|
318
|
-
// The answer written only when the ask has none, read and written in one commit: exactly one answered entry.
|
|
319
|
-
answer: async (id, data) => {
|
|
320
|
-
if (!opened)
|
|
321
|
-
throw new Error("the run's journal is not open");
|
|
322
|
-
const on = opened;
|
|
323
|
-
const { stood } = await answerOnce((change) => on.commit(change, context), ROOT_CONVERSATION_ID, (entries) => {
|
|
324
|
-
const found = answerIn(entries, id);
|
|
325
|
-
return found ? { stood: found } : { write: data, stood: data };
|
|
326
|
-
});
|
|
327
|
-
return { outcome: stood.state, at: stood.at, ...(stood.reason !== undefined ? { reason: stood.reason } : {}) };
|
|
328
|
-
},
|
|
329
|
-
} : {}),
|
|
330
|
-
// Tests only (--faux): the process dies once between an ask's record and its row.
|
|
331
|
-
afterRecord: host.env[FAUX_ENV] && host.env[person.FAUX_ASK_DIES_ENV] ? () => {
|
|
332
|
-
const mark = host.env[person.FAUX_ASK_DIES_ENV];
|
|
333
|
-
if (existsSync(mark))
|
|
334
|
-
return;
|
|
335
|
-
writeFileSync(mark, "");
|
|
336
|
-
process.kill(process.pid, "SIGKILL");
|
|
337
|
-
} : undefined,
|
|
314
|
+
// The asks: the root's waiting hand-over entries.
|
|
315
|
+
asks: async () => (await handovers()).flatMap((entry) => waitingAsk(entry.data) ?? []),
|
|
316
|
+
// An ask's answer: the root's first answered hand-over entry for it (runner/hand-back.ts).
|
|
317
|
+
answered: async (id) => {
|
|
318
|
+
const found = answerIn(await handovers(), id);
|
|
319
|
+
return found ? { outcome: found.state, at: found.at, ...(found.reason !== undefined ? { reason: found.reason } : {}) } : undefined;
|
|
320
|
+
},
|
|
321
|
+
// The answer written only when the ask has none, read and written in one commit: exactly one answered entry.
|
|
322
|
+
answer: async (id, data) => {
|
|
323
|
+
if (!opened)
|
|
324
|
+
throw new Error("the run's journal is not open");
|
|
325
|
+
const on = opened;
|
|
326
|
+
const { stood } = await answerOnce((change) => on.commit(change, context), ROOT_CONVERSATION_ID, (entries) => {
|
|
327
|
+
const found = answerIn(entries, id);
|
|
328
|
+
return found ? { stood: found } : { write: data, stood: data };
|
|
329
|
+
});
|
|
330
|
+
return { outcome: stood.state, at: stood.at, ...(stood.reason !== undefined ? { reason: stood.reason } : {}) };
|
|
331
|
+
},
|
|
338
332
|
});
|
|
339
333
|
const view = createLiveView({ hostOrigin: "'self'", gates, takeOver: { take: (tag) => hands.take(tag) } });
|
|
340
334
|
const watched = handedProvider ? liveViewProvider(handedProvider, view) : undefined;
|
|
@@ -343,34 +337,29 @@ const browserTool = {
|
|
|
343
337
|
throw refused;
|
|
344
338
|
return watched;
|
|
345
339
|
};
|
|
346
|
-
// Each session's viewer reaches the server as it launches, and goes as it ends:
|
|
347
|
-
//
|
|
348
|
-
const viewers = live.sessionHandovers(host.
|
|
340
|
+
// Each session's viewer reaches the server as it launches, and goes as it ends: through the store, under the run's claim
|
|
341
|
+
// (host.liveViewers); never a file in the run's folder, which is the agent's workspace.
|
|
342
|
+
const viewers = live.sessionHandovers(host.liveViewers);
|
|
349
343
|
const onSession = (row, change) => viewers.changed(row, change);
|
|
350
344
|
// Its session time is the run's spend, at its provider's price, and held under the run's cap (browser-cost.ts).
|
|
351
345
|
const providerName = parts.provider?.name ?? vendor;
|
|
352
346
|
const price = browserPrice(providerName, host.env);
|
|
353
347
|
// On the runner, the run's ledger (host.ledger): each call held and settled on its booking, and a session's release one
|
|
354
348
|
// more request there, never this process's own spend. Undefined on the old per-run process: browserSpend's own then.
|
|
355
|
-
const spend = browserSpend(providerName, price, DEFAULT_BROWSER_POLICY.idleReleaseS, (conversation, at) => browser.release(conversation, "close", at), undefined, { paid: host.ledger?.paid, pause: host.ledger?.pause });
|
|
349
|
+
const spend = browserSpend(providerName, price, DEFAULT_BROWSER_POLICY.idleReleaseS, (conversation, at) => browser.release(conversation, "close", at), undefined, { paid: host.ledger?.paid, pause: host.ledger?.pause, flush: host.ledger?.flush });
|
|
356
350
|
// browser_downloads is listed only with a workspace to copy into, and only a provider that keeps a session's downloads
|
|
357
351
|
// (Browserbase's; Kernel's keeps none) has any: without one, uploads still read the run's work/, through `files`.
|
|
358
352
|
const downloads = typeof parts.provider?.downloads === "object";
|
|
359
353
|
const files = downloads ? { workspace: () => host.where.work } : { files: workspaceFiles(host.where.work) };
|
|
360
354
|
// A session that saved to the sign-in, let go: its time, for the sign-in's verified_at when the run's lease ends.
|
|
361
355
|
// On the runner, the store's verified_at under the run's claim (runSignInSaved), never a mark in the run's directory.
|
|
362
|
-
const verify = kept?.save && host.claim && host.store ? runSignInSaved(host.store, host.sealKey, host.claim, kept) : undefined;
|
|
356
|
+
const verify = kept?.save && host.claim && host.store && host.sealKey ? runSignInSaved(host.store, host.sealKey, host.claim, kept) : undefined;
|
|
363
357
|
// Awaited by the session's change, so the release that lets a run's sessions go (beforeRelease) returns only once its
|
|
364
358
|
// last save is verified: the run's end commit, which ends the claim, never fences it.
|
|
365
|
-
const saved =
|
|
366
|
-
? async (row, change) =>
|
|
367
|
-
if (verify)
|
|
368
|
-
await verify(row, change);
|
|
369
|
-
else if (savedOnRelease(row, change))
|
|
370
|
-
writeFileSync(join(host.where.root, SIGN_IN_SAVED), new Date().toISOString(), { mode: 0o600 });
|
|
371
|
-
}
|
|
359
|
+
const saved = verify
|
|
360
|
+
? async (row, change) => void (await verify(row, change))
|
|
372
361
|
: undefined;
|
|
373
|
-
// Both hosts of a session's changes: the live view's hand-over, and the sign-in's
|
|
362
|
+
// Both hosts of a session's changes: the live view's hand-over, and the sign-in's save (its verified_at, in the store).
|
|
374
363
|
const onSessions = async (row, change) => {
|
|
375
364
|
// A session let go ends a wait on the person's answer that kept it open (personWait, below): the run parks.
|
|
376
365
|
if (change === "released")
|
|
@@ -472,27 +461,26 @@ const browserTool = {
|
|
|
472
461
|
}
|
|
473
462
|
finally {
|
|
474
463
|
// Every viewer's token dies with the process's hold on its sessions, and the hand-over with it; the person's
|
|
475
|
-
// holds go, and
|
|
464
|
+
// holds go. The asks are the journal's, and stay there with their answers.
|
|
476
465
|
await view.close();
|
|
477
466
|
hands.close();
|
|
478
467
|
await viewers.released();
|
|
479
|
-
person.dropAsks(host.where.root);
|
|
480
468
|
}
|
|
481
469
|
});
|
|
482
470
|
return { tools, extensions: [extension] };
|
|
483
471
|
},
|
|
484
472
|
};
|
|
485
473
|
export const TOOLS = Object.freeze({
|
|
486
|
-
read: fileTool("
|
|
487
|
-
write: fileTool("
|
|
488
|
-
edit: fileTool("
|
|
489
|
-
bash: fileTool("
|
|
474
|
+
read: fileTool("Read a file in the run's work/; in a sandbox, an image anywhere in the run's box too (a render in /tmp)."),
|
|
475
|
+
write: fileTool("Write a file in the run's work/."),
|
|
476
|
+
edit: fileTool("Edit a file in the run's work/."),
|
|
477
|
+
bash: fileTool("Run a bash command in the run's box, from its work/, never on this server itself: an agent whose place is a sandbox names it, or one on the runner in Mode 2 (Archil), where it runs on Archil's serverless exec. Its output's tail; 120 s unless the call names a timeout, at most 600 s, or 295 s on Archil's exec (longer work: bash_background, in a box).", true),
|
|
490
478
|
// The background tools (background.ts): each call a short command in the run's box, on bash's environment.
|
|
491
|
-
bash_background: fileTool(
|
|
492
|
-
bash_output: fileTool(
|
|
493
|
-
bash_input: fileTool("
|
|
494
|
-
bash_signal: fileTool("
|
|
495
|
-
bash_list: fileTool("
|
|
479
|
+
bash_background: fileTool(`Start a command in the background in the run's box, from its work/, and get its id at once: its stdout and stderr go to work/background/<id>/output.log (the first ${BACKGROUND_LOG_BYTES / (1024 * 1024)} MiB), its stdin is a pipe (a terminal with tty: true), and the run's end ends it; at most ${BACKGROUND_MAX} run at once. Only an agent whose place is a sandbox names it.`, true),
|
|
480
|
+
bash_output: fileTool(`Read a background process's output from a byte offset, at most ${BACKGROUND_PAGE_BYTES / 1024} KiB a call, with whether it still runs, its exit code and the next offset. Sandbox only.`, true),
|
|
481
|
+
bash_input: fileTool("Write text to a running background process's stdin, and close it if asked. Sandbox only.", true),
|
|
482
|
+
bash_signal: fileTool("Send TERM, INT or KILL to a background process's process group. Sandbox only.", true),
|
|
483
|
+
bash_list: fileTool("List the run's background processes: id, state or exit code, output size and command. Sandbox only.", true),
|
|
496
484
|
[ASK_TOOL]: {
|
|
497
485
|
summary: "Ask the person who started the run; the turn ends until a message answers.",
|
|
498
486
|
needs: [],
|
|
@@ -575,6 +563,10 @@ export async function grantedTools(revision) {
|
|
|
575
563
|
}
|
|
576
564
|
/** The table's entry for `name`, or undefined for a name it does not hold. */
|
|
577
565
|
export const toolOf = (name) => (Object.hasOwn(TOOLS, name) ? TOOLS[name] : undefined);
|
|
566
|
+
/** The sandbox-only tools a run whose shell is `shell` has (resolve-computer.ts shellPlaceOf): every one in a computer
|
|
567
|
+
* that mounts its folder, bash alone on Mode 2's Archil exec ("local"), none with no shell. The kernel registry's
|
|
568
|
+
* hostToolDefs says which, the one list the run's tools are bound from. The save check asks it for "local" alone. */
|
|
569
|
+
export const shellTools = (shell) => new Set(hostToolDefs({ maxExecS: 600, shell }).map((def) => def.name).filter((name) => toolOf(name)?.sandboxOnly));
|
|
578
570
|
/** What a stored revision's tools resolve from (tool-plane.ts): the tools it grants, its harness, model and settings. */
|
|
579
571
|
export async function toolingOf(revision) {
|
|
580
572
|
const tools = await grantedTools(revision.kind === "agentic" ? { kind: "agentic", tools: revision.body.tools } : { kind: "workflow", tools: revision.body.tools, workflow: revision.body.workflow });
|
|
@@ -604,18 +596,19 @@ export function toolRefusal(names, env, where = "agent") {
|
|
|
604
596
|
* sets none), the default, and what it resolves to on each harness under the server's `settings`: available where any
|
|
605
597
|
* is not unavailable, and missing PARALLEL_API_KEY where Parallel is picked without it. An unavailable tool says why
|
|
606
598
|
* (`reason`). `noBox`: why no box can run a sandbox-only tool here (place.ts noBoxReason), which leaves it
|
|
607
|
-
* unavailable with that reason; undefined, a box can. `
|
|
608
|
-
*
|
|
599
|
+
* unavailable with that reason; undefined, a box can. `runnerShell`: the sandbox-only tools a run on the runner has a
|
|
600
|
+
* shell for here (shellTools: bash on Archil's exec in Mode 2), which need no box. `refused`: the variables of the keys this server was started with
|
|
601
|
+
* that their provider refused at the start (tool-keys-store.ts refused), each with why: a tool that needs one is unavailable,
|
|
609
602
|
* saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
|
|
610
603
|
* and the permissions it may be set to. */
|
|
611
|
-
export const toolsView = (env, settings = {}, noBox, refused = {}) => {
|
|
604
|
+
export const toolsView = (env, settings = {}, noBox, refused = {}, runnerShell = new Set()) => {
|
|
612
605
|
const views = explainsView(env, settings);
|
|
613
606
|
const picked = withDefaults(settings);
|
|
614
607
|
return Object.entries(TOOLS).map(([name, entry]) => {
|
|
615
608
|
const view = PICKABLE.includes(name) ? views[name] : undefined;
|
|
616
609
|
const plane = view?.resolves;
|
|
617
610
|
const missing = plane && Object.values(plane).includes(NO_PARALLEL_KEY) ? [PARALLEL_KEY_ENV] : missingEnv(entry, env);
|
|
618
|
-
const boxless = entry.sandboxOnly ? noBox : undefined;
|
|
611
|
+
const boxless = entry.sandboxOnly && !runnerShell.has(name) ? noBox : undefined;
|
|
619
612
|
// The browser needs the keys of the vendor it resolves to: one refused at the start leaves it unavailable, never on the
|
|
620
613
|
// other vendor, as a refused Parallel key never moves web_search elsewhere.
|
|
621
614
|
const needs = name === "browser" ? [...new Set(Object.values(plane ?? {}).flatMap(browserNeeds))] : entry.needs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InputIssue } from "./errors.js";
|
|
2
|
-
import type { SettingsSpec } from "./sealed-settings.js";
|
|
2
|
+
import type { SettingsSpec } from "./sealed-settings-store.js";
|
|
3
3
|
type Json = Record<string, unknown>;
|
|
4
4
|
/** A source as the store keeps it: its kind, the adapter's id, and the adapter's own fields. */
|
|
5
5
|
export type Source = {
|
|
@@ -25,7 +25,7 @@ export type TriggerAdapter = {
|
|
|
25
25
|
/** Whether its words are its owner's (a run's message origin `owner`): true only when the owner wrote them as they set
|
|
26
26
|
* it up; never for words that come from outside. */
|
|
27
27
|
owner: boolean;
|
|
28
|
-
/** What it keeps sealed (sealed-settings.ts), for the server or for each trigger: a field it mints (a signing secret)
|
|
28
|
+
/** What it keeps sealed (sealed-settings-store.ts), for the server or for each trigger: a field it mints (a signing secret)
|
|
29
29
|
* is made at a trigger's create and at a rotation, shown once, and goes with the trigger. */
|
|
30
30
|
settings?: SettingsSpec;
|
|
31
31
|
/** Its shapes as a create's error names them: `{kind: "..."}` with its fields. */
|
package/dist/trigger-schedule.js
CHANGED
|
@@ -73,8 +73,9 @@ export const schedule = {
|
|
|
73
73
|
if (given === undefined)
|
|
74
74
|
return bad("at", "invalid", "at is an RFC 3339 date-time with its offset"), undefined;
|
|
75
75
|
const at = Math.floor(given / 1000) * 1000;
|
|
76
|
+
// In words a person reads, on the field (the console's time field; an SDK user's error), never the raw field name.
|
|
76
77
|
if (at <= now)
|
|
77
|
-
return bad("at", "invalid",
|
|
78
|
+
return bad("at", "invalid", `Pick a time in the future: ${second(at)} has already passed.`), undefined;
|
|
78
79
|
return { kind: "schedule", at: second(at) };
|
|
79
80
|
}
|
|
80
81
|
issues.push(...unknownSourceFields(value, ["kind", "every_s", "start_at"]));
|
|
@@ -73,5 +73,9 @@ export function templateApplied(body, minted, shown) {
|
|
|
73
73
|
if (!made)
|
|
74
74
|
return body;
|
|
75
75
|
const said = (one) => shown === "first" && minted.has(one.trigger_id) ? { ...one, signing_secret: minted.get(one.trigger_id) } : { ...one, secret_set: true, note: shown === "replay" ? TEMPLATE_SECRET_SHOWN : TRIGGER_SECRET_WORDS };
|
|
76
|
-
|
|
76
|
+
// The answer that shows every secret drops the warnings saying it is not shown (templateTriggerSecret's): they would
|
|
77
|
+
// sit right above the secret they say is missing. A token's answer or a replay keeps them.
|
|
78
|
+
const showsAll = shown === "first" && made.every((one) => minted.has(one.trigger_id));
|
|
79
|
+
const warnings = showsAll && Array.isArray(body.warnings) ? { warnings: body.warnings.filter((w) => !/^triggers\.\d+\.secret$/.test(String(w.field))) } : {};
|
|
80
|
+
return { ...body, ...warnings, webhook_secrets: made.map(said) };
|
|
77
81
|
}
|
|
@@ -2,7 +2,7 @@ import { type InputIssue } from "./errors.js";
|
|
|
2
2
|
import { type RunMoment, type RunsStore, type StartDeps } from "./runs-over-store.js";
|
|
3
3
|
import type { Store } from "./store/index.js";
|
|
4
4
|
import type { AgentEntry } from "./agents-store.js";
|
|
5
|
-
import type { MessageOrigin } from "
|
|
5
|
+
import type { MessageOrigin } from "./timeline/index.js";
|
|
6
6
|
import type { Json } from "./validate.js";
|
|
7
7
|
import type { RunTrigger, Target } from "./triggers.js";
|
|
8
8
|
/** What the trigger target policy needs that lives elsewhere: the run-start leaves (StartDeps, shared with the create
|
|
@@ -19,7 +19,19 @@ export interface TriggerTargetDeps {
|
|
|
19
19
|
momentOf(runId: string): Promise<RunMoment | undefined>;
|
|
20
20
|
/** A run's v2 status, or null for an unknown run (the run view): the trigger engine's overlap and active-run checks. */
|
|
21
21
|
runStatus(runId: string): Promise<string | null>;
|
|
22
|
+
/** A completed run's result.output as GET /runs/{id} serves it (cut of the secrets it holds; null when it has none), and
|
|
23
|
+
* when it ended; undefined for a run that is unknown or did not complete (the run view). */
|
|
24
|
+
completedOutput(runId: string): Promise<{
|
|
25
|
+
output: unknown;
|
|
26
|
+
endedAt: string | null;
|
|
27
|
+
} | undefined>;
|
|
22
28
|
}
|
|
29
|
+
/** The most bytes of a previous run's result a triggered run is handed, as JSON: past it, it is handed none, said so. */
|
|
30
|
+
export declare const PREVIOUS_RESULT_MAX_BYTES: number;
|
|
31
|
+
/** The words a triggered agentic run's message carries its trigger's previous result in (previousResultOf). */
|
|
32
|
+
export declare const previousResultWords: (runId: string, endedAt: string | null, json: string) => string;
|
|
33
|
+
/** What a triggered run is told when its trigger's previous result is over PREVIOUS_RESULT_MAX_BYTES. */
|
|
34
|
+
export declare const previousResultTooLarge: (runId: string) => string;
|
|
23
35
|
/** The trigger-facing run policy: the subset of the trigger engine's deps this module owns. The engine's other deps (an
|
|
24
36
|
* adapter's sealed settings, the failed-firing webhook) stay server-wired. */
|
|
25
37
|
export type TriggerTargets = {
|