@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
package/dist/errors.js
CHANGED
|
@@ -32,28 +32,25 @@ export const ERROR_STATUS = {
|
|
|
32
32
|
internal: 500,
|
|
33
33
|
unsupported_here: 501,
|
|
34
34
|
unavailable: 503,
|
|
35
|
-
// This server's own, beside the contract's list (openapi.ts marks them): a tool key its launcher sets, a
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// answer to a browser hand-over that already has a different one (browser-person.ts).
|
|
35
|
+
// This server's own, beside the contract's list (openapi.ts marks them): a tool key its launcher sets, a send to a
|
|
36
|
+
// webhook a 410 turned off, a write to a learning note that names no version it read, a remote MCP server that asks
|
|
37
|
+
// for a credential, does not speak MCP, or fails, a message to a run paused at its cap, which takes one once its cap is
|
|
38
|
+
// raised, a saved sign-in forgotten while a run holds its save lease (sign-ins-store.ts), and an answer to a browser
|
|
39
|
+
// hand-over that already has a different one (browser-person.ts).
|
|
41
40
|
key_set_by_server: 409,
|
|
42
41
|
budget_reached: 409,
|
|
43
|
-
no_sealing_key: 409,
|
|
44
42
|
webhook_off: 409,
|
|
45
43
|
precondition_required: 428,
|
|
46
44
|
auth_required: 422,
|
|
47
45
|
not_mcp: 422,
|
|
48
46
|
upstream_failed: 424,
|
|
49
|
-
store_unreadable: 409,
|
|
50
47
|
wrong_origin: 409,
|
|
51
48
|
sign_in_held: 409,
|
|
52
49
|
handoff_answered: 409,
|
|
53
50
|
computer_not_live: 409,
|
|
54
51
|
scope_taken: 409,
|
|
55
52
|
// Connect GitHub (github-connection.ts): a github trigger on a server with no GitHub App, a second App, a Connect that
|
|
56
|
-
// GitHub could not call back (no public address),
|
|
53
|
+
// GitHub could not call back (no public address), and GitHub that
|
|
57
54
|
// did not answer (a 429, a 5xx, or nothing) while a github_app MCP server's listing token was minted: tried again.
|
|
58
55
|
github_not_connected: 409,
|
|
59
56
|
github_already_connected: 409,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Workspace } from "./workspace/index.js";
|
|
2
|
+
/** The longest line a filed answer keeps: at three bytes of UTF-8 a character at most, well within the 50 KB pi's read
|
|
3
|
+
* shows of one line. */
|
|
4
|
+
export declare const FILED_LINE_MAX = 10000;
|
|
5
|
+
/** The deepest indent a laid-out answer gets, in levels: a value nested deeper starts its own line at this indent. */
|
|
6
|
+
export declare const LAYOUT_DEPTH_MAX = 32;
|
|
7
|
+
/** The most a laid-out answer may grow to, in characters, for `text`: twice its length and 64 Ki more. Past it, the
|
|
8
|
+
* answer is filed as written (its lines broken at FILED_LINE_MAX), so no answer's layout costs more memory than that. */
|
|
9
|
+
export declare const layoutBound: (text: string) => number;
|
|
10
|
+
/** `text` as it is filed: JSON (an object or an array) laid out a value a line when that stays within layoutBound
|
|
11
|
+
* (`laid`), and each line past FILED_LINE_MAX characters broken into pieces of that length (never inside a surrogate
|
|
12
|
+
* pair); `broken`, how many lines were. */
|
|
13
|
+
export declare function fileable(text: string): {
|
|
14
|
+
text: string;
|
|
15
|
+
json: boolean;
|
|
16
|
+
laid: boolean;
|
|
17
|
+
broken: number;
|
|
18
|
+
};
|
|
19
|
+
/** Valid JSON `text` laid out a value a line, two spaces an indent, as JSON.stringify(value, null, 2) lays it out, but
|
|
20
|
+
* from the text's own tokens: a number is copied as written, never parsed, so an integer past 2^53 or a long decimal
|
|
21
|
+
* is filed exactly as the server sent it. The indent stops growing at LAYOUT_DEPTH_MAX levels, and undefined is the
|
|
22
|
+
* answer when the layout would pass layoutBound(text): deep or dense nesting is never padded without end. */
|
|
23
|
+
export declare function laidOut(text: string): string | undefined;
|
|
24
|
+
/** The model's text for `text`, longer than `clip` characters: the filed text's first lines, whole, within `clip`, then
|
|
25
|
+
* a note naming the file (`<folder>/<stem>.txt`, or `.json` for JSON) and the read offset that goes on. A file that
|
|
26
|
+
* cannot be written still answers its start, saying why in the Workspace's words (never an error's message, which
|
|
27
|
+
* names paths). `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
|
|
28
|
+
export declare function filedAnswer(work: Workspace | (() => Workspace), folder: string, stem: string, text: string, clip: number): Promise<string>;
|
|
29
|
+
/** For a unified diff (`diff --git a/... b/...` lines), where each file not wholly shown starts in the filed text and
|
|
30
|
+
* how many lines it runs, so a reader takes the files it needs by range (and passes a generated one by) rather than
|
|
31
|
+
* paging through all of it: "; files past the cut, from the line each starts at (its lines): a.ts 908 (120), ...". */
|
|
32
|
+
export declare function diffIndex(lines: readonly string[], shown: number): string;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// A tool's answer too long for the model to read whole: its start shown, the whole filed in the run's work folder,
|
|
2
|
+
// through its Workspace, where the run's read tool pages through it with offset and limit. No shell is needed, so a run
|
|
3
|
+
// with no computer (a template's agent on a hosted server, say) reads all of it.
|
|
4
|
+
//
|
|
5
|
+
// pi's read pages by line, at most 50 KB a call, and shows only the first 50 KB of a line longer than that (its note
|
|
6
|
+
// then asks for bash). So the file keeps the answer's lines, never one line of JSON around it: JSON is laid out a value
|
|
7
|
+
// a line (within a bound, past which it is filed as written), and a line longer than FILED_LINE_MAX characters is broken
|
|
8
|
+
// into pieces of that length, said in the note. The start shown is the file's first lines, whole, so the note's offset is
|
|
9
|
+
// where the file goes on.
|
|
10
|
+
import { workspaceErrorWords } from "./workspace/index.js";
|
|
11
|
+
/** The longest line a filed answer keeps: at three bytes of UTF-8 a character at most, well within the 50 KB pi's read
|
|
12
|
+
* shows of one line. */
|
|
13
|
+
export const FILED_LINE_MAX = 10_000;
|
|
14
|
+
/** The deepest indent a laid-out answer gets, in levels: a value nested deeper starts its own line at this indent. */
|
|
15
|
+
export const LAYOUT_DEPTH_MAX = 32;
|
|
16
|
+
/** The most a laid-out answer may grow to, in characters, for `text`: twice its length and 64 Ki more. Past it, the
|
|
17
|
+
* answer is filed as written (its lines broken at FILED_LINE_MAX), so no answer's layout costs more memory than that. */
|
|
18
|
+
export const layoutBound = (text) => 2 * text.length + 64 * 1024;
|
|
19
|
+
/** `text` as it is filed: JSON (an object or an array) laid out a value a line when that stays within layoutBound
|
|
20
|
+
* (`laid`), and each line past FILED_LINE_MAX characters broken into pieces of that length (never inside a surrogate
|
|
21
|
+
* pair); `broken`, how many lines were. */
|
|
22
|
+
export function fileable(text) {
|
|
23
|
+
let laid;
|
|
24
|
+
let json = false;
|
|
25
|
+
if (/^\s*[[{]/.test(text)) {
|
|
26
|
+
try {
|
|
27
|
+
JSON.parse(text);
|
|
28
|
+
json = true;
|
|
29
|
+
laid = laidOut(text);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Not JSON after all: filed as it is.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const filed = laid ?? text;
|
|
36
|
+
let broken = 0;
|
|
37
|
+
const lines = filed.split("\n").flatMap((line) => {
|
|
38
|
+
if (line.length <= FILED_LINE_MAX)
|
|
39
|
+
return [line];
|
|
40
|
+
broken++;
|
|
41
|
+
const pieces = [];
|
|
42
|
+
for (let at = 0; at < line.length;) {
|
|
43
|
+
let end = Math.min(at + FILED_LINE_MAX, line.length);
|
|
44
|
+
// A high surrogate at the cut goes with its low one, to the next piece.
|
|
45
|
+
if (end < line.length && /[\uD800-\uDBFF]/.test(line[end - 1]))
|
|
46
|
+
end--;
|
|
47
|
+
pieces.push(line.slice(at, end));
|
|
48
|
+
at = end;
|
|
49
|
+
}
|
|
50
|
+
return pieces;
|
|
51
|
+
});
|
|
52
|
+
return { text: broken ? lines.join("\n") : filed, json, laid: laid !== undefined, broken };
|
|
53
|
+
}
|
|
54
|
+
/** Valid JSON `text` laid out a value a line, two spaces an indent, as JSON.stringify(value, null, 2) lays it out, but
|
|
55
|
+
* from the text's own tokens: a number is copied as written, never parsed, so an integer past 2^53 or a long decimal
|
|
56
|
+
* is filed exactly as the server sent it. The indent stops growing at LAYOUT_DEPTH_MAX levels, and undefined is the
|
|
57
|
+
* answer when the layout would pass layoutBound(text): deep or dense nesting is never padded without end. */
|
|
58
|
+
export function laidOut(text) {
|
|
59
|
+
const bound = layoutBound(text);
|
|
60
|
+
let out = "";
|
|
61
|
+
let depth = 0;
|
|
62
|
+
const pad = () => "\n" + " ".repeat(Math.min(depth, LAYOUT_DEPTH_MAX));
|
|
63
|
+
for (let i = 0; i < text.length; i++) {
|
|
64
|
+
if (out.length > bound)
|
|
65
|
+
return undefined;
|
|
66
|
+
const c = text[i];
|
|
67
|
+
if (c === '"') {
|
|
68
|
+
let j = i + 1;
|
|
69
|
+
while (j < text.length && text[j] !== '"')
|
|
70
|
+
j += text[j] === "\\" ? 2 : 1;
|
|
71
|
+
out += text.slice(i, j + 1);
|
|
72
|
+
i = j;
|
|
73
|
+
}
|
|
74
|
+
else if (c === "{" || c === "[") {
|
|
75
|
+
let j = i + 1;
|
|
76
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
77
|
+
j++;
|
|
78
|
+
if (text[j] === (c === "{" ? "}" : "]")) {
|
|
79
|
+
out += c + text[j];
|
|
80
|
+
i = j;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
depth++;
|
|
84
|
+
out += c + pad();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (c === "}" || c === "]") {
|
|
88
|
+
depth--;
|
|
89
|
+
out += pad() + c;
|
|
90
|
+
}
|
|
91
|
+
else if (c === ",")
|
|
92
|
+
out += "," + pad();
|
|
93
|
+
else if (c === ":")
|
|
94
|
+
out += ": ";
|
|
95
|
+
else if (!/\s/.test(c))
|
|
96
|
+
out += c;
|
|
97
|
+
}
|
|
98
|
+
return out.length > bound ? undefined : out;
|
|
99
|
+
}
|
|
100
|
+
/** The model's text for `text`, longer than `clip` characters: the filed text's first lines, whole, within `clip`, then
|
|
101
|
+
* a note naming the file (`<folder>/<stem>.txt`, or `.json` for JSON) and the read offset that goes on. A file that
|
|
102
|
+
* cannot be written still answers its start, saying why in the Workspace's words (never an error's message, which
|
|
103
|
+
* names paths). `clip` is at least FILED_LINE_MAX, so the start holds at least one line. */
|
|
104
|
+
export async function filedAnswer(work, folder, stem, text, clip) {
|
|
105
|
+
const filed = fileable(text);
|
|
106
|
+
const lines = filed.text.split("\n");
|
|
107
|
+
// Lines as read counts them ("Showing lines 1-560 of <total>"): one more than the newlines.
|
|
108
|
+
const total = lines.length;
|
|
109
|
+
let shown = 0;
|
|
110
|
+
let chars = 0;
|
|
111
|
+
while (shown < total && chars + lines[shown].length + 1 <= clip)
|
|
112
|
+
chars += lines[shown++].length + 1;
|
|
113
|
+
if (shown === 0)
|
|
114
|
+
shown = 1;
|
|
115
|
+
const head = lines.slice(0, shown).join("\n");
|
|
116
|
+
const how = [
|
|
117
|
+
...(filed.laid ? ["its JSON laid out a value a line"] : []),
|
|
118
|
+
...(filed.broken ? [`${filed.broken} line${filed.broken > 1 ? "s" : ""} longer than ${FILED_LINE_MAX.toLocaleString("en-US")} characters broken into pieces of that length`] : []),
|
|
119
|
+
];
|
|
120
|
+
const cut = `\n[cut at line ${shown} of ${total} (${head.length} of ${filed.text.length} characters${how.length ? `; ${how.join("; ")}` : ""}); `;
|
|
121
|
+
const path = `${folder}/${stem}.${filed.json ? "json" : "txt"}`;
|
|
122
|
+
try {
|
|
123
|
+
await (typeof work === "function" ? work() : work).write(path, filed.text);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
return `${head}${cut}the whole answer could not be saved (${workspaceErrorWords(error) ?? error?.code ?? "write failed"})]`;
|
|
127
|
+
}
|
|
128
|
+
return `${head}${cut}the whole answer is in the run's files at ${path}: read it with offset=${shown + 1} to go on${diffIndex(lines, shown)}]`;
|
|
129
|
+
}
|
|
130
|
+
/** The most files a diff's index names, and the longest it runs. */
|
|
131
|
+
const INDEX_FILES = 300;
|
|
132
|
+
const INDEX_CHARS = 12_000;
|
|
133
|
+
/** For a unified diff (`diff --git a/... b/...` lines), where each file not wholly shown starts in the filed text and
|
|
134
|
+
* how many lines it runs, so a reader takes the files it needs by range (and passes a generated one by) rather than
|
|
135
|
+
* paging through all of it: "; files past the cut, from the line each starts at (its lines): a.ts 908 (120), ...". */
|
|
136
|
+
export function diffIndex(lines, shown) {
|
|
137
|
+
const starts = [];
|
|
138
|
+
lines.forEach((line, at) => {
|
|
139
|
+
const match = /^diff --git a\/(.*) b\/(.*)$/.exec(line);
|
|
140
|
+
if (match)
|
|
141
|
+
starts.push({ path: match[2], at: at + 1 });
|
|
142
|
+
});
|
|
143
|
+
if (starts.length === 0)
|
|
144
|
+
return "";
|
|
145
|
+
const rows = [];
|
|
146
|
+
let chars = 0;
|
|
147
|
+
for (let i = 0; i < starts.length; i++) {
|
|
148
|
+
const end = i + 1 < starts.length ? starts[i + 1].at - 1 : lines.length;
|
|
149
|
+
if (end <= shown)
|
|
150
|
+
continue;
|
|
151
|
+
const row = `${starts[i].path} ${starts[i].at} (${end - starts[i].at + 1})`;
|
|
152
|
+
if (rows.length >= INDEX_FILES || chars + row.length > INDEX_CHARS) {
|
|
153
|
+
rows.push("...");
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
rows.push(row);
|
|
157
|
+
chars += row.length + 2;
|
|
158
|
+
}
|
|
159
|
+
return rows.length ? `; files past the cut, from the line each starts at (its lines): ${rows.join(", ")}` : "";
|
|
160
|
+
}
|
package/dist/files.d.ts
CHANGED
|
@@ -4,30 +4,20 @@ export declare const RUN_META = "serve.json";
|
|
|
4
4
|
/** A cancelled run's mark in its directory, written before its process is told: the run's process sends no model
|
|
5
5
|
* request once it is there, however the cancel and the process's start interleave. */
|
|
6
6
|
export declare const RUN_CANCELLED = "cancelled";
|
|
7
|
-
/** A run's launch mark in its directory, written before its process is spawned and removed once that process serves
|
|
8
|
-
* or exits: found at a start, the server went down while it launched the run. */
|
|
9
|
-
export declare const RUN_LAUNCHING = "launching";
|
|
10
|
-
/** Set in a run's process environment when the server opens the run for a person's follow-up to a run whose turn had
|
|
11
|
-
* ended (it answered, or the person stopped it): that open resumes no cut work, so it writes no "resumed" row (app.ts). */
|
|
12
|
-
export declare const FOLLOW_UP_OPEN_ENV = "AGENTRUN_FOLLOW_UP_OPEN";
|
|
13
7
|
/** The server-wide door token, in the data directory: the door of a run an older server started takes it. */
|
|
14
8
|
export declare const DOOR_TOKEN_FILE = ".door-token";
|
|
15
9
|
/** A run's own door token, in its directory, made at its first launch and handed to its process alone (its
|
|
16
10
|
* `--serve-token-file`): the server's calls to that run's door carry it, and so do that run's calls to the box relay
|
|
17
11
|
* (box-relay.ts), which takes a call for a run only with that run's token. */
|
|
18
12
|
export declare const RUN_DOOR_TOKEN = "door-token";
|
|
19
|
-
/** Run directory `dir`'s own door token (RUN_DOOR_TOKEN), when it has one. */
|
|
20
|
-
export declare function runDoorToken(dir: string): string | undefined;
|
|
21
13
|
/** Why a run fails whose launch mark a start finds (`error.details.reason`, openapi.ts). */
|
|
22
14
|
export declare const LAUNCH_LOST = "server_lost_at_launch";
|
|
23
15
|
/** Why a run fails that the store has running with no serve.json: its server went down before it set the run up. */
|
|
24
16
|
export declare const SETUP_LOST = "server_lost_at_setup";
|
|
25
|
-
/** The data directory a run's folder is in: `<data>/disk/agents/<agent>/runs/<run>` (pi-durable-agent runDirIn). */
|
|
26
|
-
export declare const dataOfRun: (runDir: string) => string;
|
|
27
17
|
export declare const HOMES_DIR = "homes";
|
|
28
18
|
/** Paths in an agent's home that only the host reads and writes (another component owns them): the home API reads and
|
|
29
19
|
* writes neither, and lists each by its name alone. `learning` (learning.ts, read through its own API) and `sign-ins`
|
|
30
|
-
* (sign-ins.ts: the agent's saved sign-ins, sealed pointers to its browser vendor's objects, shown without them on
|
|
20
|
+
* (sign-ins-store.ts: the agent's saved sign-ins, sealed pointers to its browser vendor's objects, shown without them on
|
|
31
21
|
* GET /agents/{id}). */
|
|
32
22
|
export declare const HOME_HOST_OWNED: string[];
|
|
33
23
|
/** An agent's home directory's name: its id in lower case, then 16 hex digits of the id's SHA-256. Ids that differ only
|
package/dist/files.js
CHANGED
|
@@ -2,46 +2,27 @@
|
|
|
2
2
|
// The server-wide durable-file plumbing and the data-directory location moved to server-fs.ts; this module re-exports it
|
|
3
3
|
// so callers that still reach for it here keep working until they are pointed at server-fs.ts.
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import {
|
|
6
|
-
import { join, resolve } from "node:path";
|
|
5
|
+
import { join } from "node:path";
|
|
7
6
|
export { DATA_ENV, SERVER_FILE, TOKEN_FILE, agentFolderOf, defaultData, readJson, removeOwnRecord, serialBy, syncDir, tempOf, writeDurable, writeDurableSync, writeWhole } from "./server-fs.js";
|
|
8
7
|
/** The server's own file in each run's directory: the run's title, input and how it was asked to run. */
|
|
9
8
|
export const RUN_META = "serve.json";
|
|
10
9
|
/** A cancelled run's mark in its directory, written before its process is told: the run's process sends no model
|
|
11
10
|
* request once it is there, however the cancel and the process's start interleave. */
|
|
12
11
|
export const RUN_CANCELLED = "cancelled";
|
|
13
|
-
/** A run's launch mark in its directory, written before its process is spawned and removed once that process serves
|
|
14
|
-
* or exits: found at a start, the server went down while it launched the run. */
|
|
15
|
-
export const RUN_LAUNCHING = "launching";
|
|
16
|
-
/** Set in a run's process environment when the server opens the run for a person's follow-up to a run whose turn had
|
|
17
|
-
* ended (it answered, or the person stopped it): that open resumes no cut work, so it writes no "resumed" row (app.ts). */
|
|
18
|
-
export const FOLLOW_UP_OPEN_ENV = "AGENTRUN_FOLLOW_UP_OPEN";
|
|
19
12
|
/** The server-wide door token, in the data directory: the door of a run an older server started takes it. */
|
|
20
13
|
export const DOOR_TOKEN_FILE = ".door-token";
|
|
21
14
|
/** A run's own door token, in its directory, made at its first launch and handed to its process alone (its
|
|
22
15
|
* `--serve-token-file`): the server's calls to that run's door carry it, and so do that run's calls to the box relay
|
|
23
16
|
* (box-relay.ts), which takes a call for a run only with that run's token. */
|
|
24
17
|
export const RUN_DOOR_TOKEN = "door-token";
|
|
25
|
-
/** Run directory `dir`'s own door token (RUN_DOOR_TOKEN), when it has one. */
|
|
26
|
-
export function runDoorToken(dir) {
|
|
27
|
-
try {
|
|
28
|
-
const token = readFileSync(join(dir, RUN_DOOR_TOKEN), "utf8").trim();
|
|
29
|
-
return token && !/\s/.test(token) ? token : undefined;
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
18
|
/** Why a run fails whose launch mark a start finds (`error.details.reason`, openapi.ts). */
|
|
36
19
|
export const LAUNCH_LOST = "server_lost_at_launch";
|
|
37
20
|
/** Why a run fails that the store has running with no serve.json: its server went down before it set the run up. */
|
|
38
21
|
export const SETUP_LOST = "server_lost_at_setup";
|
|
39
|
-
/** The data directory a run's folder is in: `<data>/disk/agents/<agent>/runs/<run>` (pi-durable-agent runDirIn). */
|
|
40
|
-
export const dataOfRun = (runDir) => resolve(runDir, "..", "..", "..", "..", "..");
|
|
41
22
|
export const HOMES_DIR = "homes";
|
|
42
23
|
/** Paths in an agent's home that only the host reads and writes (another component owns them): the home API reads and
|
|
43
24
|
* writes neither, and lists each by its name alone. `learning` (learning.ts, read through its own API) and `sign-ins`
|
|
44
|
-
* (sign-ins.ts: the agent's saved sign-ins, sealed pointers to its browser vendor's objects, shown without them on
|
|
25
|
+
* (sign-ins-store.ts: the agent's saved sign-ins, sealed pointers to its browser vendor's objects, shown without them on
|
|
45
26
|
* GET /agents/{id}). */
|
|
46
27
|
export const HOME_HOST_OWNED = ["learning", "sign-ins"];
|
|
47
28
|
/** An agent's home directory's name: its id in lower case, then 16 hex digits of the id's SHA-256. Ids that differ only
|
|
@@ -79,7 +79,7 @@ export declare class GitHubConnection {
|
|
|
79
79
|
pem: string;
|
|
80
80
|
} | undefined;
|
|
81
81
|
/** Why nothing can be kept: this server keeps no github source's settings (no such source here). Its seal key is always
|
|
82
|
-
* there (seal-key.ts
|
|
82
|
+
* there (seal-key.ts bootSealKey). */
|
|
83
83
|
unwritable(): ApiError | undefined;
|
|
84
84
|
/** The App's settings page on GitHub, where the person deletes it: its owner's (an organization's, or the user's). */
|
|
85
85
|
settingsUrl(): string | undefined;
|
|
@@ -201,7 +201,7 @@ export declare class GitHubConnect {
|
|
|
201
201
|
private mint;
|
|
202
202
|
}
|
|
203
203
|
/** GitHub that did not answer a listing token's call: a 429, a 5xx, a rate limit's 403, or no answer at all. Nothing is
|
|
204
|
-
* learned from it, so nothing is refused for good: try again (mcp-servers.ts, 502 github_failed). */
|
|
204
|
+
* learned from it, so nothing is refused for good: try again (mcp-servers-store.ts, 502 github_failed). */
|
|
205
205
|
type Unanswered = {
|
|
206
206
|
failed: string;
|
|
207
207
|
};
|
|
@@ -112,7 +112,7 @@ export class GitHubConnection {
|
|
|
112
112
|
return appId && pem ? { appId, pem } : undefined;
|
|
113
113
|
}
|
|
114
114
|
/** Why nothing can be kept: this server keeps no github source's settings (no such source here). Its seal key is always
|
|
115
|
-
* there (seal-key.ts
|
|
115
|
+
* there (seal-key.ts bootSealKey). */
|
|
116
116
|
unwritable() {
|
|
117
117
|
return this.settings ? undefined : new ApiError("unavailable", "This server has no GitHub source to keep an App in.");
|
|
118
118
|
}
|
package/dist/graph-view.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export type GraphInput = {
|
|
|
28
28
|
/** The run has ended: a node it never reached is `not_run`, not `pending`, and its store is read, lock-free. */
|
|
29
29
|
ended: boolean;
|
|
30
30
|
workflow: unknown;
|
|
31
|
-
storeFile: string;
|
|
32
31
|
/** The run's directory: its node log is there. */
|
|
33
32
|
root: string;
|
|
34
33
|
/** The run's input: what a map's items are read from before its state has them. */
|
|
@@ -37,10 +36,9 @@ export type GraphInput = {
|
|
|
37
36
|
modelCost: number | null;
|
|
38
37
|
/** How many of its llm calls' answers its node log held when its rows were last read: their cost is in `modelCost`. */
|
|
39
38
|
llmRead?: number;
|
|
40
|
-
/** The one store and a context:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
context?: Context;
|
|
39
|
+
/** The one store and a context: an ended run's view, pin and decisions are read from its journal (store.readJournal). */
|
|
40
|
+
store: Store;
|
|
41
|
+
context: Context;
|
|
44
42
|
};
|
|
45
43
|
export declare function runGraph(given: GraphInput): Promise<{
|
|
46
44
|
read_at: string;
|
package/dist/graph-view.js
CHANGED
|
@@ -15,20 +15,16 @@ const labelOf = (item) => {
|
|
|
15
15
|
return typeof named === "string" || typeof named === "number" ? String(named) : undefined;
|
|
16
16
|
};
|
|
17
17
|
export async function runGraph(given) {
|
|
18
|
-
const
|
|
19
|
-
import("@parcha/agentrun-dsl/graph"),
|
|
20
|
-
import("@parcha/pi-durable-agent/workflow"),
|
|
21
|
-
import("@parcha/agentrun-pi/durable"),
|
|
22
|
-
]);
|
|
18
|
+
const { graphNodeOf, nodeStatus, workflowGraph } = await import("@parcha/agentrun-dsl/graph");
|
|
23
19
|
const { id } = given.run;
|
|
24
20
|
const graph = workflowGraph(given.workflow);
|
|
25
21
|
let view;
|
|
26
22
|
let pin;
|
|
27
23
|
let receipts;
|
|
28
24
|
let readAt = new Date().toISOString();
|
|
29
|
-
if (given.ended
|
|
30
|
-
// From the one store's journal (store.readJournal)
|
|
31
|
-
//
|
|
25
|
+
if (given.ended) {
|
|
26
|
+
// From the one store's journal (store.readJournal): the run's view and pin as readWorkflowRun reads them, and its
|
|
27
|
+
// decisions as receipts.
|
|
32
28
|
const { store, context } = given;
|
|
33
29
|
const [{ decisionsOverStore }, { readWorkflowRunOver }] = await Promise.all([import("./store-reads/decisions.js"), import("./store-reads/workflow.js")]);
|
|
34
30
|
// The one reader of a workflow run's view over A (node status, outcome, escalation): the workflow-loop builder's.
|
|
@@ -45,12 +41,6 @@ export async function runGraph(given) {
|
|
|
45
41
|
}
|
|
46
42
|
receipts = await decisionsOverStore(store, id, context);
|
|
47
43
|
}
|
|
48
|
-
else if (given.ended) {
|
|
49
|
-
// Lock-free, as every server read of a run's database (run-db.ts): nothing made beside it, never a lock to wait on.
|
|
50
|
-
view = await readWorkflowRun({ runId: id, storePath: given.storeFile, revision: { body: { workflow: given.workflow } } }, { unlocked: true });
|
|
51
|
-
pin = (readJournal(given.storeFile, id, { unlocked: true })?.state?.pin) ?? {};
|
|
52
|
-
receipts = durableDecisions(given.storeFile, { unlocked: true });
|
|
53
|
-
}
|
|
54
44
|
else {
|
|
55
45
|
const live = await readLiveView(given.root);
|
|
56
46
|
pin = live?.pin ?? {};
|
package/dist/handed-values.d.ts
CHANGED
|
@@ -21,3 +21,12 @@ export declare function handedValuesOf(deps: {
|
|
|
21
21
|
}): Promise<{
|
|
22
22
|
refs: string[];
|
|
23
23
|
} | "unreadable">;
|
|
24
|
+
/** Why what an agent learned is withheld (403): a pointer of its sign-in can't be read here, so the cut would be shorter
|
|
25
|
+
* than what a note may hold. */
|
|
26
|
+
export declare const WITHHELD_LEARNING = "This server can't read the agent's browser sign-in (its seal key changed or is missing, or the sign-in is damaged), so what it learned is not shown.";
|
|
27
|
+
/** Every sign-in pointer agent `agentId` ever held, live and forgotten (the store keeps every forgotten one, never only
|
|
28
|
+
* the newest), at each vendor that keeps one (each at least MIN_SECRET long, as every cut takes them): what the learning
|
|
29
|
+
* routes cut beside the server's secrets, so a note, a skill or a run's learning that wrote one never shows it. `unreadable` when one does not open under this server's key, or a read
|
|
30
|
+
* fails: what the agent learned may hold that pointer, so it is withheld (WITHHELD_LEARNING), never shown over a
|
|
31
|
+
* shorter list. */
|
|
32
|
+
export declare function agentPointers(signIns: SignInReader | undefined, agentId: string): Promise<string[] | "unreadable">;
|
package/dist/handed-values.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// sign-ins (live and forgotten) opened to find each pointer the mark names (run-view.ts handedPointers). One read for
|
|
4
4
|
// every place that must cut a run of what it was handed: the store-backed run view (store-view.ts) and the runner's
|
|
5
5
|
// learning end (runner/learning-end.ts), which refuses to learn it.
|
|
6
|
+
import { MIN_SECRET } from "./learn/secrets.js";
|
|
6
7
|
import { handedMark, handedPointers } from "./run-view.js";
|
|
7
8
|
import { readLaunchBody } from "./run-launch.js";
|
|
8
9
|
import { keptVendor } from "./tool-plane.js";
|
|
@@ -34,3 +35,28 @@ export async function handedValuesOf(deps, store, runId, known) {
|
|
|
34
35
|
const browser = launch?.plane ? keptVendor(launch.plane).browser : undefined;
|
|
35
36
|
return handedPointers(deps.signIns, runRow.agentId, browser, handedOf(runRow));
|
|
36
37
|
}
|
|
38
|
+
/** The browser vendors that keep a sign-in (sign-ins-store.ts vendorOf). */
|
|
39
|
+
const SIGN_IN_VENDORS = ["browserbase", "kernel"];
|
|
40
|
+
/** Why what an agent learned is withheld (403): a pointer of its sign-in can't be read here, so the cut would be shorter
|
|
41
|
+
* than what a note may hold. */
|
|
42
|
+
export const WITHHELD_LEARNING = "This server can't read the agent's browser sign-in (its seal key changed or is missing, or the sign-in is damaged), so what it learned is not shown.";
|
|
43
|
+
/** Every sign-in pointer agent `agentId` ever held, live and forgotten (the store keeps every forgotten one, never only
|
|
44
|
+
* the newest), at each vendor that keeps one (each at least MIN_SECRET long, as every cut takes them): what the learning
|
|
45
|
+
* routes cut beside the server's secrets, so a note, a skill or a run's learning that wrote one never shows it. `unreadable` when one does not open under this server's key, or a read
|
|
46
|
+
* fails: what the agent learned may hold that pointer, so it is withheld (WITHHELD_LEARNING), never shown over a
|
|
47
|
+
* shorter list. */
|
|
48
|
+
export async function agentPointers(signIns, agentId) {
|
|
49
|
+
if (!signIns)
|
|
50
|
+
return [];
|
|
51
|
+
const refs = [];
|
|
52
|
+
for (const vendor of SIGN_IN_VENDORS) {
|
|
53
|
+
const live = await signIns.peek(agentId, vendor).catch(() => "unreadable");
|
|
54
|
+
const gone = await signIns.forgotten(agentId, vendor).catch(() => "unreadable");
|
|
55
|
+
if (live === "unreadable" || gone === "unreadable" || gone.unreadable)
|
|
56
|
+
return "unreadable";
|
|
57
|
+
if (live)
|
|
58
|
+
refs.push(live.ref);
|
|
59
|
+
refs.push(...gone.refs);
|
|
60
|
+
}
|
|
61
|
+
return [...new Set(refs)].filter((ref) => ref.length >= MIN_SECRET);
|
|
62
|
+
}
|
|
@@ -83,17 +83,34 @@ export declare function npmInstall(entry: HarnessInstallEntry, dir: string, pins
|
|
|
83
83
|
signal?: AbortSignal;
|
|
84
84
|
onKilled?: () => void;
|
|
85
85
|
}): Promise<void>;
|
|
86
|
-
/** Removes Claude Code as an earlier build installed it, at the top of `harnesses` (read-only, as it left it), so the
|
|
87
|
-
* per-harness installs can go in beside nothing: only when the directory holds that layout and nothing else (any other
|
|
88
|
-
* entry, a per-harness install among them, and it is left as it is). Nothing of the old tree is read or kept. Resolves
|
|
89
|
-
* true when it removed one. */
|
|
90
|
-
export declare function removeFlatInstall(harnesses: string): Promise<boolean>;
|
|
91
86
|
/** How long npm has to exit after a SIGTERM before it gets SIGKILL. Once npm writes (its reify), a SIGTERM only marks
|
|
92
87
|
* it: npm finishes the step under way, which waits on every tarball, before it rolls back and exits, so a slow tarball
|
|
93
88
|
* would hold a server's close. npm writes only into the staging directory, which the install removes. */
|
|
94
89
|
export declare const NPM_STOP_GRACE_MS = 5000;
|
|
95
90
|
/** How long the exit of an npm sent SIGKILL is waited for, at most (it is at once): the stop never hangs on it. */
|
|
96
91
|
export declare const NPM_KILLED_WAIT_MS = 5000;
|
|
92
|
+
/** The file an install of a harness into `dir` (`<data>/harnesses/<harness>`) keeps in the data directory while it runs,
|
|
93
|
+
* for every process on this data (a runner beside the server, one of its own, or one in another container on the same
|
|
94
|
+
* volume): the installing host and process, and since when. A failed install leaves why in it until the next install;
|
|
95
|
+
* one that lands removes it. In the data directory, beside `<data>/harnesses`: that directory holds the installs alone. */
|
|
96
|
+
export declare const installMarkOf: (dir: string) => string;
|
|
97
|
+
/** Where a run's claim stands on a harness that installs on first use, in `dir`: "installed" once it is whole; while an
|
|
98
|
+
* install runs (its mark started within INSTALL_TIMEOUT_MS, by a live process when it names this host; another host's
|
|
99
|
+
* process can't be read from here, so its mark is trusted within that bound), it waits for that install, polling, never
|
|
100
|
+
* past that bound; `{ failed }` with the install's own words when the last install failed; "none" when nothing installs
|
|
101
|
+
* it (no mark, one past the bound, or one this host's installer that is gone left), so the caller says what is missing
|
|
102
|
+
* as before. `onWait`: told once, as it starts to wait. `signal` aborted (the run stopped, or its claim lost): it stops
|
|
103
|
+
* waiting and rejects; the install goes on. */
|
|
104
|
+
export declare function installSettled(entry: HarnessInstallEntry, dir: string, pins: HarnessPins, { signal, onWait, pollMs, timeoutMs, isAlive, host }?: {
|
|
105
|
+
signal?: AbortSignal;
|
|
106
|
+
onWait?: () => void;
|
|
107
|
+
pollMs?: number;
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
isAlive?: (pid: number) => boolean;
|
|
110
|
+
host?: string;
|
|
111
|
+
}): Promise<"installed" | "none" | {
|
|
112
|
+
failed: string;
|
|
113
|
+
}>;
|
|
97
114
|
/** The server's one installer of a harness into `dir`: `ensure()` resolves once it is installed whole, installing it first
|
|
98
115
|
* when it is not, and every caller while an install runs waits for that one. A failed install is not kept: the next call
|
|
99
116
|
* tries again. `stop()` stops an install that runs (its npm) and waits, bounded, for it to end. `onInstalled` hears of an
|