@parcha/agentrun-serve 0.1.0-beta.58 → 0.1.0-beta.60
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 +402 -1
- package/README.md +516 -190
- package/dist/acp-package.d.ts +5 -1
- package/dist/acp-package.js +19 -2
- package/dist/adapters.d.ts +23 -2
- package/dist/adapters.js +106 -33
- package/dist/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- package/dist/agents-store.js +1 -1
- package/dist/answer-text.d.ts +3 -0
- package/dist/answer-text.js +22 -0
- package/dist/api-only.d.ts +2 -2
- package/dist/api-only.js +3 -3
- package/dist/archil-routes.d.ts +4 -1
- package/dist/archil-routes.js +15 -12
- package/dist/archil-settings.d.ts +18 -8
- package/dist/archil-settings.js +35 -17
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +3 -2
- package/dist/box-paths.js +5 -4
- package/dist/browser-computer.d.ts +3 -8
- package/dist/browser-computer.js +12 -35
- package/dist/browser-cost.js +94 -20
- package/dist/capacity.d.ts +1 -1
- package/dist/capacity.js +3 -3
- package/dist/chatgpt-plan.d.ts +7 -0
- package/dist/chatgpt-plan.js +35 -11
- package/dist/claude-login-token.d.ts +20 -11
- package/dist/claude-login-token.js +175 -107
- package/dist/claude-login.d.ts +124 -33
- package/dist/claude-login.js +562 -85
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli-learning/connections.js +1 -1
- package/dist/cli.js +323 -292
- package/dist/composio-made.d.ts +1 -6
- package/dist/composio-made.js +1 -6
- package/dist/composio-owners.d.ts +26 -0
- package/dist/composio-owners.js +36 -0
- package/dist/composio-preset.d.ts +56 -23
- package/dist/composio-preset.js +173 -77
- package/dist/composio-triggers.d.ts +4 -4
- package/dist/composio-triggers.js +6 -7
- package/dist/compute-cost.js +11 -2
- package/dist/computer-attach.d.ts +6 -3
- package/dist/computer-attach.js +41 -29
- package/dist/computer-held-routes.d.ts +1 -1
- package/dist/computer-held-routes.js +9 -4
- package/dist/computer-keys.d.ts +11 -1
- package/dist/computer-keys.js +26 -1
- package/dist/computer-record.js +3 -1
- package/dist/computer-view.d.ts +5 -3
- package/dist/computer-view.js +10 -6
- package/dist/computer-viewer.js +36 -7
- package/dist/computers.d.ts +2 -1
- package/dist/computers.js +6 -3
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-QnwGVBeU.js +166 -0
- package/dist/console/assets/index-DZi-muIj.js +629 -0
- package/dist/console/assets/share-pz61zIn9.js +6 -0
- package/dist/console/assets/styles-CcceGcu2.js +291 -0
- package/dist/console/assets/styles-fjQBFfMv.css +1 -0
- package/dist/console/index.html +4 -3
- package/dist/console/share.html +17 -0
- package/dist/decisions.d.ts +17 -7
- package/dist/decisions.js +41 -15
- package/dist/dial-relay.js +10 -4
- package/dist/docker-daemon.js +4 -5
- package/dist/docker-host-addresses.js +29 -11
- package/dist/email/account.d.ts +6 -0
- package/dist/email/account.js +6 -0
- package/dist/email/authentication.d.ts +21 -0
- package/dist/email/authentication.js +106 -0
- package/dist/email/email-faux.d.ts +11 -2
- package/dist/email/email-faux.js +21 -5
- package/dist/email/mail.d.ts +25 -0
- package/dist/email/mail.js +58 -2
- package/dist/email/names.js +2 -2
- package/dist/email/tools.d.ts +9 -4
- package/dist/email/tools.js +95 -13
- package/dist/env-switch.d.ts +12 -2
- package/dist/env-switch.js +23 -3
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/factory-activity.d.ts +68 -0
- package/dist/factory-activity.js +153 -0
- package/dist/factory-runs.d.ts +11 -0
- package/dist/factory-runs.js +52 -0
- package/dist/fal-price.d.ts +11 -1
- package/dist/fal-price.js +33 -0
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- package/dist/graph-served.d.ts +10 -5
- package/dist/graph-served.js +40 -10
- package/dist/handed-values.js +1 -2
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +45 -12
- package/dist/harness-keys.d.ts +1 -2
- package/dist/harness-keys.js +10 -8
- package/dist/harness-opencode/facts.js +2 -0
- package/dist/harness-recipe-entry.d.ts +9 -3
- package/dist/harness-recipe-entry.js +18 -9
- package/dist/harness-recipe.d.ts +21 -0
- package/dist/harness-recipe.js +25 -3
- package/dist/harness-table.d.ts +12 -0
- package/dist/harness-table.js +21 -6
- package/dist/harness.js +6 -2
- package/dist/helper-env.d.ts +4 -1
- package/dist/helper-env.js +4 -1
- package/dist/host-check.d.ts +2 -3
- package/dist/host-check.js +13 -7
- package/dist/hosted-search.js +1 -1
- package/dist/import-worker.js +2 -2
- package/dist/import.d.ts +20 -8
- package/dist/import.js +448 -187
- package/dist/key-refusal.d.ts +14 -2
- package/dist/key-refusal.js +97 -33
- package/dist/learn/audit.d.ts +28 -27
- package/dist/learn/audit.js +87 -62
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +35 -43
- package/dist/learn/commit.js +62 -270
- package/dist/learn/compile.d.ts +9 -6
- package/dist/learn/compile.js +51 -28
- package/dist/learn/corrections.js +1 -1
- package/dist/learn/delete.d.ts +5 -12
- package/dist/learn/delete.js +17 -30
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/forget-run.d.ts +16 -0
- package/dist/learn/forget-run.js +53 -0
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning-of.d.ts +0 -4
- package/dist/learn/learning-of.js +0 -5
- package/dist/learn/ledger.d.ts +32 -29
- package/dist/learn/ledger.js +26 -19
- package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
- package/dist/learn/{folder.js → legacy/folder.js} +4 -7
- package/dist/learn/legacy/place.d.ts +16 -0
- package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
- package/dist/learn/legacy/scrub.d.ts +28 -0
- package/dist/learn/legacy/scrub.js +258 -0
- package/dist/learn/promote.d.ts +119 -102
- package/dist/learn/promote.js +119 -262
- package/dist/learn/reset-ledger.d.ts +18 -0
- package/dist/learn/reset-ledger.js +14 -0
- package/dist/learn/rows.d.ts +186 -0
- package/dist/learn/rows.js +376 -0
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- package/dist/learned-nodes.d.ts +8 -5
- package/dist/learned-nodes.js +8 -5
- package/dist/learned-workflow.d.ts +2 -1
- package/dist/learned-workflow.js +13 -10
- package/dist/learning-cost.d.ts +25 -8
- package/dist/learning-cost.js +23 -8
- package/dist/learning-reset.d.ts +1 -1
- package/dist/learning-reset.js +9 -11
- package/dist/learning-routes.d.ts +60 -81
- package/dist/learning-routes.js +187 -360
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +2 -0
- package/dist/learning.d.ts +18 -24
- package/dist/learning.js +35 -66
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +7 -0
- package/dist/live-reach.js +7 -0
- package/dist/mcp-api-only-origins.d.ts +15 -0
- package/dist/mcp-api-only-origins.js +40 -0
- package/dist/mcp-gateway.d.ts +22 -2
- package/dist/mcp-gateway.js +85 -11
- package/dist/mcp-oauth.d.ts +1 -1
- package/dist/mcp-oauth.js +3 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +3 -0
- package/dist/mcp-resources.d.ts +1 -1
- package/dist/mcp-secret-writes.d.ts +24 -2
- package/dist/mcp-secret-writes.js +30 -2
- package/dist/mcp-servers-store.d.ts +52 -14
- package/dist/mcp-servers-store.js +165 -61
- package/dist/mcp-sources.d.ts +1 -2
- package/dist/mcp-sources.js +1 -2
- package/dist/mcp-store.d.ts +5 -5
- package/dist/mcp-store.js +3 -3
- package/dist/mcp.js +1 -1
- package/dist/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/native/discovery.d.ts +6 -0
- package/dist/native/discovery.js +14 -1
- package/dist/native/remote.d.ts +5 -0
- package/dist/native/remote.js +16 -0
- package/dist/native/runtime.js +3 -2
- package/dist/observation/observer.d.ts +6 -6
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +290 -79
- package/dist/otel/genai.d.ts +83 -7
- package/dist/otel/genai.js +69 -9
- package/dist/otel/tracer.d.ts +42 -13
- package/dist/otel/tracer.js +241 -56
- package/dist/page.d.ts +7 -1
- package/dist/page.js +76 -22
- package/dist/paid-calls.d.ts +6 -4
- package/dist/paid-calls.js +15 -7
- package/dist/place-offers.d.ts +58 -34
- package/dist/place-offers.js +96 -54
- package/dist/place.d.ts +41 -20
- package/dist/place.js +97 -47
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +17 -8
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +42 -9
- package/dist/redact/match.js +356 -54
- package/dist/run-census.d.ts +1 -1
- package/dist/run-census.js +4 -5
- package/dist/run-cut.js +4 -5
- package/dist/run-export-store.d.ts +15 -0
- package/dist/run-export-store.js +30 -0
- package/dist/run-export.d.ts +139 -0
- package/dist/run-export.js +379 -0
- package/dist/run-file-cut.d.ts +5 -0
- package/dist/run-file-cut.js +13 -0
- package/dist/run-launch.d.ts +3 -3
- package/dist/run-launch.js +16 -3
- package/dist/run-learning-served.d.ts +3 -3
- package/dist/run-learning-served.js +1 -1
- package/dist/run-listing.d.ts +1 -1
- package/dist/run-model-key.d.ts +15 -6
- package/dist/run-model-key.js +30 -31
- package/dist/run-reads-over-store.js +4 -4
- package/dist/run-secrets.js +3 -5
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +8 -5
- package/dist/runnable.js +26 -9
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +94 -47
- package/dist/runner/adapter-run-spec.d.ts +14 -1
- package/dist/runner/adapter-run-spec.js +73 -46
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +10 -9
- package/dist/runner/audit.js +64 -67
- package/dist/runner/beside.js +5 -6
- package/dist/runner/claim-secrets.d.ts +10 -3
- package/dist/runner/claim-secrets.js +29 -13
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +87 -58
- package/dist/runner/compare-end.d.ts +2 -3
- package/dist/runner/compare-end.js +30 -11
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.js +3 -4
- package/dist/runner/held.d.ts +5 -12
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +8 -2
- package/dist/runner/journal-kinds.js +23 -5
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +23 -7
- package/dist/runner/learning-end.d.ts +14 -24
- package/dist/runner/learning-end.js +52 -94
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- package/dist/runner/live-ticker.js +7 -5
- package/dist/runner/loop-contract.d.ts +0 -2
- package/dist/runner/loop.d.ts +7 -0
- package/dist/runner/loop.js +1 -0
- package/dist/runner/main.js +13 -12
- package/dist/runner/mcp-claim.js +21 -5
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/meta-tools.js +3 -2
- package/dist/runner/metrics.d.ts +7 -0
- package/dist/runner/metrics.js +19 -0
- package/dist/runner/model-route.d.ts +10 -7
- package/dist/runner/model-route.js +79 -15
- package/dist/runner/native-loop.js +12 -11
- package/dist/runner/presence.d.ts +1 -4
- package/dist/runner/presence.js +6 -8
- package/dist/runner/promotion.d.ts +39 -36
- package/dist/runner/promotion.js +168 -112
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -1
- package/dist/runner/responses-fetch.d.ts +36 -0
- package/dist/runner/responses-fetch.js +511 -0
- package/dist/runner/run-child-host.d.ts +21 -14
- package/dist/runner/run-child-host.js +187 -141
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +3 -4
- package/dist/runner/runner.js +13 -9
- package/dist/runner/sdk-loop.js +10 -12
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +120 -32
- package/dist/runner/workflow-first.js +218 -94
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.js +8 -7
- package/dist/save-once.d.ts +14 -0
- package/dist/save-once.js +31 -0
- package/dist/scrub-command.d.ts +34 -31
- package/dist/scrub-command.js +116 -147
- package/dist/sdk/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +26 -7
- package/dist/sdk/runs.js +194 -78
- package/dist/seal-key.js +4 -4
- package/dist/secret-cut.d.ts +3 -0
- package/dist/secret-cut.js +7 -1
- package/dist/secret-rules.d.ts +8 -1
- package/dist/secret-rules.js +482 -53
- package/dist/secrets.d.ts +55 -9
- package/dist/secrets.js +345 -21
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +10 -3
- package/dist/server-keys.js +16 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +30 -18
- package/dist/server.js +520 -238
- package/dist/share-context.d.ts +22 -0
- package/dist/share-context.js +76 -0
- package/dist/shell-lex.d.ts +105 -0
- package/dist/shell-lex.js +646 -0
- package/dist/sign-ins-store.d.ts +5 -7
- package/dist/sign-ins-store.js +12 -16
- package/dist/sign-ins.d.ts +7 -11
- package/dist/sign-ins.js +40 -41
- package/dist/skills/agentrun-serve/SKILL.md +5 -2
- package/dist/source-sync/auxiliary.js +2 -2
- package/dist/start-switches.d.ts +6 -5
- package/dist/start-switches.js +8 -4
- package/dist/stats.d.ts +5 -1
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/dialect.d.ts +4 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/mcp-record-keys.d.ts +10 -0
- package/dist/store/mcp-record-keys.js +13 -0
- package/dist/store/postgres/dialect.js +2 -0
- package/dist/store/postgres/migrations/0029_run_launch_census_settle.sql +28 -0
- package/dist/store/postgres/migrations/0030_learning_ledger_epoch.sql +40 -0
- package/dist/store/postgres/migrations/0031_learning_ledger_calls.sql +12 -0
- package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +60 -11
- package/dist/store/schema.js +147 -17
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- package/dist/store/sqlite/run-launch.d.ts +3 -10
- package/dist/store/sqlite/run-launch.js +12 -23
- package/dist/store/sqlite/run-patch.d.ts +17 -10
- package/dist/store/sqlite/run-patch.js +50 -13
- package/dist/store/sqlite/store.d.ts +9 -0
- package/dist/store/sqlite/store.js +194 -46
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +286 -38
- package/dist/store/store.js +27 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +50 -45
- package/dist/store-reads/learning.js +153 -116
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +49 -17
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +72 -9
- package/dist/template-eval.js +358 -64
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- package/dist/timeline/labels.d.ts +1 -1
- package/dist/timeline/labels.js +4 -3
- package/dist/timeline/timeline.d.ts +23 -11
- package/dist/timeline/timeline.js +115 -31
- package/dist/timeline/web-calls.d.ts +8 -6
- package/dist/timeline/web-calls.js +10 -6
- package/dist/tool-gate.d.ts +13 -1
- package/dist/tool-gate.js +43 -3
- package/dist/tool-keys-store.js +2 -4
- package/dist/tool-keys.d.ts +11 -0
- package/dist/tool-keys.js +16 -0
- package/dist/tool-plane.d.ts +54 -13
- package/dist/tool-plane.js +103 -32
- package/dist/tools.d.ts +5 -1
- package/dist/tools.js +7 -7
- package/dist/trigger-email.js +12 -6
- package/dist/triggers.d.ts +15 -34
- package/dist/triggers.js +119 -126
- package/dist/validate.d.ts +8 -1
- package/dist/validate.js +163 -23
- package/dist/web-fake.d.ts +2 -1
- package/dist/web-fake.js +8 -6
- package/dist/web-fetch.d.ts +8 -6
- package/dist/web-fetch.js +13 -11
- package/dist/web-holds.d.ts +34 -0
- package/dist/web-holds.js +89 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +76 -28
- package/dist/web-save.js +23 -12
- package/dist/web-search.js +14 -25
- package/dist/wires.d.ts +4 -3
- package/dist/wires.js +5 -4
- package/dist/workspace/archil-claim.d.ts +12 -5
- package/dist/workspace/archil-claim.js +45 -5
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +6 -2
- package/dist/workspace/attached-computers.js +5 -4
- package/dist/workspace/computer-deps.d.ts +23 -6
- package/dist/workspace/computer-deps.js +38 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +160 -54
- package/dist/workspace/computer-intervals.d.ts +2 -0
- package/dist/workspace/computer-intervals.js +1 -1
- package/dist/workspace/computer-janitor.d.ts +48 -14
- package/dist/workspace/computer-janitor.js +153 -44
- package/dist/workspace/computer-kept.d.ts +158 -32
- package/dist/workspace/computer-kept.js +288 -63
- package/dist/workspace/computer-providers.d.ts +19 -4
- package/dist/workspace/computer-providers.js +40 -6
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +2 -3
- package/dist/workspace/local.js +41 -1
- package/dist/workspace/mount-revoke-left.d.ts +31 -0
- package/dist/workspace/mount-revoke-left.js +72 -0
- package/dist/workspace/paired-route.js +4 -5
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- package/dist/workspace/resolve-computer.d.ts +5 -2
- package/dist/workspace/resolve-computer.js +9 -3
- package/dist/workspace/run-end-computers.d.ts +11 -5
- package/dist/workspace/run-end-computers.js +153 -28
- package/dist/workspace/run-tools.d.ts +22 -3
- package/dist/workspace/run-tools.js +17 -5
- package/dist/workspace/run-workspace.d.ts +14 -1
- package/dist/workspace/run-workspace.js +34 -1
- package/dist/workspace/workspace.d.ts +7 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -14
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +22 -6
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/backend-CSAWUqtZ.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-DPh29cyz.js +0 -747
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/dist/acp-package.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ export type AcpPackage = {
|
|
|
51
51
|
cursorRootOf(binary: string, cmd: string): string | undefined;
|
|
52
52
|
/** The form a model id an ACP agent lists takes (Cursor's `gpt-5.4-nano[reasoning=medium]` among them). */
|
|
53
53
|
readonly MODEL_ID: RegExp;
|
|
54
|
+
/** The forms a recipe's allowFile may take (`goose-permission`). */
|
|
55
|
+
readonly ALLOW_FILE_FORMS: readonly string[];
|
|
56
|
+
/** What is wrong with a recipe's announces field, and with a title tie without it, each in words. */
|
|
57
|
+
announcesProblems(announces: unknown, permissionTie: unknown): string[];
|
|
54
58
|
/** The form a sign-in method's id an ACP agent lists takes (`gemini-api-key`): a recipe's keyMethod is checked by it. */
|
|
55
59
|
readonly AUTH_METHOD: RegExp;
|
|
56
60
|
acpPlatform(): string | undefined;
|
|
@@ -73,5 +77,5 @@ export type AcpPackage = {
|
|
|
73
77
|
verifyPinnedTree(root: string, sha256: string): Promise<void>;
|
|
74
78
|
};
|
|
75
79
|
/** The package, or undefined where it is not installed beside serve. Only its absence is: a package that is there and
|
|
76
|
-
* fails to load throws. */
|
|
80
|
+
* fails to load throws. Its adapter factories take serve's debug switch (withDebug). */
|
|
77
81
|
export declare function acpPackage(): AcpPackage | undefined;
|
package/dist/acp-package.js
CHANGED
|
@@ -6,8 +6,25 @@ import { createRequire } from "node:module";
|
|
|
6
6
|
export const ACP_PACKAGE = "@parcha/agentrun-harness-acp";
|
|
7
7
|
const requireHere = createRequire(import.meta.url);
|
|
8
8
|
let loaded;
|
|
9
|
+
/** serve's one debug switch for the ACP adapter, AGENTRUN_LOG=debug, read as each adapter is made: it logs each call the
|
|
10
|
+
* agent announces, by its ids and names only (the package's AcpHarnessOptions.debug). Serve owns the variable, so the
|
|
11
|
+
* package never reads it. */
|
|
12
|
+
const debugOption = () => (process.env.AGENTRUN_LOG === "debug" ? { debug: true } : {});
|
|
13
|
+
/** `pkg` with each adapter factory it exports (every function named `...Adapter`: acpAdapter, gooseAdapter,
|
|
14
|
+
* cursorAdapter) handed serve's debug switch at each call. Here, where serve loads the package, so no place that builds
|
|
15
|
+
* an ACP agent's adapter has to remember it. */
|
|
16
|
+
function withDebug(pkg) {
|
|
17
|
+
const made = { ...pkg };
|
|
18
|
+
for (const [name, value] of Object.entries(pkg)) {
|
|
19
|
+
if (typeof value !== "function" || !name.endsWith("Adapter"))
|
|
20
|
+
continue;
|
|
21
|
+
const factory = value;
|
|
22
|
+
made[name] = (options) => factory({ ...options, ...debugOption() });
|
|
23
|
+
}
|
|
24
|
+
return Object.freeze(made);
|
|
25
|
+
}
|
|
9
26
|
/** The package, or undefined where it is not installed beside serve. Only its absence is: a package that is there and
|
|
10
|
-
* fails to load throws. */
|
|
27
|
+
* fails to load throws. Its adapter factories take serve's debug switch (withDebug). */
|
|
11
28
|
export function acpPackage() {
|
|
12
29
|
if (loaded === undefined) {
|
|
13
30
|
let found = true;
|
|
@@ -17,7 +34,7 @@ export function acpPackage() {
|
|
|
17
34
|
catch {
|
|
18
35
|
found = false;
|
|
19
36
|
}
|
|
20
|
-
loaded = found ? requireHere(ACP_PACKAGE) : null;
|
|
37
|
+
loaded = found ? withDebug(requireHere(ACP_PACKAGE)) : null;
|
|
21
38
|
}
|
|
22
39
|
return loaded ?? undefined;
|
|
23
40
|
}
|
package/dist/adapters.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export declare function installedHere(name: string, from?: string): string | und
|
|
|
22
22
|
* (~/.agentrun) is not the server's default, and after the server's own command when the store is not its default.
|
|
23
23
|
*/
|
|
24
24
|
export declare function npxLine(spec: string, env?: NodeJS.ProcessEnv, installed?: (name: string) => string | undefined): string;
|
|
25
|
+
/** Set by the agentrun launcher (start.mjs) on the server it starts when the installer's command (install.sh's
|
|
26
|
+
* <root>/bin/agentrun) is what runs it: that command's path. The person's login shell has that command, never npx or
|
|
27
|
+
* the installer's Node, so a refusal names it. */
|
|
28
|
+
export declare const INSTALLED_COMMAND_ENV = "AGENTRUN_INSTALLED_COMMAND";
|
|
25
29
|
/**
|
|
26
30
|
* A start the agentrun launcher made (NPX_PACKAGE_ENV: by npx, or by the installer's bin/agentrun and its service, the
|
|
27
31
|
* same launcher) that a data directory refused because an earlier version wrote it (store.ts StoreFromEarlierVersion,
|
|
@@ -29,8 +33,14 @@ export declare function npxLine(spec: string, env?: NodeJS.ProcessEnv, installed
|
|
|
29
33
|
* then the two ways on as commands to paste. That command keeps its data in ~/.agentrun wherever it is run, so a new
|
|
30
34
|
* folder alone is not a new AgentRun. First, the old folder moved aside whole, so the same command starts this version
|
|
31
35
|
* where it was, and the earlier version still opens what it holds; then this version on a new, empty folder: the same
|
|
32
|
-
* command with --data. Nothing is deleted either way.
|
|
33
|
-
*
|
|
36
|
+
* command with --data. Nothing is deleted either way. The command is the one that started this server, as the launcher
|
|
37
|
+
* says (INSTALLED_COMMAND_ENV): the installer's, else npx's; never read from what the folder holds.
|
|
38
|
+
*
|
|
39
|
+
* The installer keeps its Node, its packages and its command in the folder beside the data (install.sh: node/, lib/,
|
|
40
|
+
* bin/agentrun). When that command started this from the folder refused, it or its service has no npx at hand, moving
|
|
41
|
+
* the folder takes the command, and the service starts on the refused folder whatever another command says. So there the
|
|
42
|
+
* one way on is the folder moved aside, then the installer run again for this same version (by default it installs the
|
|
43
|
+
* latest). Any other error, or a start the launcher did not make, is undefined: the refusal's own words stand.
|
|
34
44
|
*/
|
|
35
45
|
export declare function earlierDataRefusal(error: unknown, data: string, env?: NodeJS.ProcessEnv, exists?: (path: string) => boolean): string | undefined;
|
|
36
46
|
/** The port the server was started on when `--port` named one, and whether `--open` was given (1 or 0): set by its CLI
|
|
@@ -94,6 +104,8 @@ export type AdapterNeeds = {
|
|
|
94
104
|
models: {
|
|
95
105
|
getModel(provider: string, id: string): {
|
|
96
106
|
cost?: Partial<ModelCost>;
|
|
107
|
+
contextWindow?: number;
|
|
108
|
+
maxTokens?: number;
|
|
97
109
|
} | undefined;
|
|
98
110
|
};
|
|
99
111
|
confine?: ConfineChild;
|
|
@@ -103,6 +115,15 @@ export type AdapterNeeds = {
|
|
|
103
115
|
zone?: string;
|
|
104
116
|
heldRefusal?: string;
|
|
105
117
|
};
|
|
118
|
+
/** The limits of a model the route translates onto a harness's wire (`provider.fetch`: provider.ts routedProvider), for
|
|
119
|
+
* an adapter that takes them: its window and its most output tokens, from the model's pi-ai entry in the run's models
|
|
120
|
+
* (`needs.models`), the entry the route's own model is. Its window is what every request asks Ollama for
|
|
121
|
+
* (options.num_ctx: ollama-provider.ts contextOf, at most 64k), and its output ceiling half that, at most 16,384. None
|
|
122
|
+
* for a model not routed, or one with no entry: its adapter's own defaults. */
|
|
123
|
+
export declare function routedLimits(provider: Pick<Provider, "fetch">, needs: AdapterNeeds): {
|
|
124
|
+
contextWindow?: number;
|
|
125
|
+
maxOutputTokens?: number;
|
|
126
|
+
};
|
|
106
127
|
/** Where a run's adapter sends its model's requests (providerFor), or, for a held run its model kept from running at its
|
|
107
128
|
* create, the stand-in (heldRefusedProvider): no key is read, and its proxy refuses every request in the create's words,
|
|
108
129
|
* sending none. */
|
package/dist/adapters.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
// Claude Agent SDK and codex's Codex are installed on first use into the data's harnesses directory and loaded from there
|
|
5
5
|
// alone (harness-install.ts); opencode's pinned CLI that is missing says so with the one line that installs it: an npm
|
|
6
6
|
// install beside serve, or, when serve runs from npx, the npx line that runs it with the missing package.
|
|
7
|
-
import { accessSync, constants, existsSync, readFileSync, statSync } from "node:fs";
|
|
8
|
-
import { homedir } from "node:os";
|
|
7
|
+
import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
9
8
|
import { dirname, join, resolve, sep } from "node:path";
|
|
10
9
|
import { fileURLToPath } from "node:url";
|
|
11
10
|
import { facts as claudeFacts } from "@parcha/agentrun-harness-claude/facts";
|
|
12
11
|
import { facts as codexFacts } from "@parcha/agentrun-harness-codex/facts";
|
|
13
12
|
import { facts as openCodeFacts } from "./harness-opencode/facts.js";
|
|
14
|
-
import { CLAUDE_SDK, codexBinaryIn, HarnessNotInstalled, installDirOf, installLine, loadSdk } from "./harness-install.js";
|
|
13
|
+
import { CLAUDE_SDK, codexBinaryIn, HarnessNotInstalled, installDirOf, installLine, loadSdk, shellWord } from "./harness-install.js";
|
|
14
|
+
import { commandData } from "./harness-owned.js";
|
|
15
15
|
import { DATA_ENV, defaultData } from "./files.js";
|
|
16
16
|
import { harnessOf, onAdapter } from "./harness-table.js";
|
|
17
17
|
import { HarnessUnavailable, heldRefusedProvider, providerFor } from "./provider.js";
|
|
@@ -48,7 +48,20 @@ export function installedHere(name, from = fileURLToPath(import.meta.url)) {
|
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* How the person started this server, for a command that starts it the same way again: the agentrun launcher's package
|
|
53
|
+
* when it made the start (NPX_PACKAGE_ENV, `@parcha/agentrun@<version>`), npx's `-y ` as they ran it, and the flags after
|
|
54
|
+
* any --data (startedWith): the port they named, and the browser as they had it (`npx @parcha/agentrun` opens it unless
|
|
55
|
+
* --no-open, agentrun-serve only with --open).
|
|
56
|
+
*/
|
|
57
|
+
function startedAs(env) {
|
|
58
|
+
const door = env[NPX_PACKAGE_ENV];
|
|
59
|
+
const launcher = door !== undefined && /^@parcha\/agentrun@\d[\w.+-]*$/.test(door) ? door : undefined;
|
|
60
|
+
const port = env[STARTED_PORT_ENV];
|
|
61
|
+
const open = env[STARTED_OPEN_ENV];
|
|
62
|
+
const flags = [...(port && /^\d{1,5}$/.test(port) ? [`--port ${port}`] : []), ...(launcher ? (open === "0" ? ["--no-open"] : []) : open === "1" ? ["--open"] : [])];
|
|
63
|
+
return { launcher, yes: env.npm_config_yes === "true" ? "-y " : "", flags: flags.map((flag) => ` ${flag}`).join("") };
|
|
64
|
+
}
|
|
52
65
|
/**
|
|
53
66
|
* The one command that starts this same AgentRun again with `spec` beside it: the command the person ran
|
|
54
67
|
* (`npx @parcha/agentrun`, which NPX_PACKAGE_ENV names, or the server's own), this server's version, every other
|
|
@@ -57,8 +70,7 @@ const shellWord = (word) => (/^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.rep
|
|
|
57
70
|
* (~/.agentrun) is not the server's default, and after the server's own command when the store is not its default.
|
|
58
71
|
*/
|
|
59
72
|
export function npxLine(spec, env = {}, installed = installedHere) {
|
|
60
|
-
const
|
|
61
|
-
const command = door !== undefined && /^@parcha\/agentrun@\d[\w.+-]*$/.test(door) ? door : undefined;
|
|
73
|
+
const { launcher: command, yes, flags } = startedAs(env);
|
|
62
74
|
const own = spec.slice(0, spec.lastIndexOf("@"));
|
|
63
75
|
const kept = HARNESS_PACKAGES.filter((name) => name !== own).flatMap((name) => {
|
|
64
76
|
const version = installed(name);
|
|
@@ -68,12 +80,7 @@ export function npxLine(spec, env = {}, installed = installedHere) {
|
|
|
68
80
|
const packages = [...(command ? [command] : []), `@parcha/agentrun-serve@${SERVE_VERSION}`, ...kept, spec];
|
|
69
81
|
const data = env[DATA_ENV];
|
|
70
82
|
const named = data && (command || resolve(data) !== resolve(defaultData(env))) ? ` --data ${shellWord(resolve(data))}` : "";
|
|
71
|
-
|
|
72
|
-
// `npx @parcha/agentrun` opens it unless --no-open, agentrun-serve only with --open.
|
|
73
|
-
const yes = env.npm_config_yes === "true" ? "-y " : "";
|
|
74
|
-
const port = env[STARTED_PORT_ENV];
|
|
75
|
-
const flags = [...(port && /^\d{1,5}$/.test(port) ? [`--port ${port}`] : []), ...(command && env[STARTED_OPEN_ENV] === "0" ? ["--no-open"] : []), ...(!command && env[STARTED_OPEN_ENV] === "1" ? ["--open"] : [])];
|
|
76
|
-
return `npx ${yes}${packages.map((name) => `-p ${name}`).join(" ")} ${command ? "agentrun" : "agentrun-serve"}${named}${flags.map((flag) => ` ${flag}`).join("")}`;
|
|
83
|
+
return `npx ${yes}${packages.map((name) => `-p ${name}`).join(" ")} ${command ? "agentrun" : "agentrun-serve"}${named}${flags}`;
|
|
77
84
|
}
|
|
78
85
|
/** The first of `base`, `base-2`, `base-3`… that is not there. */
|
|
79
86
|
const freeName = (base, exists) => {
|
|
@@ -82,6 +89,42 @@ const freeName = (base, exists) => {
|
|
|
82
89
|
name = `${base}-${n}`;
|
|
83
90
|
return name;
|
|
84
91
|
};
|
|
92
|
+
/** Set by the agentrun launcher (start.mjs) on the server it starts when the installer's command (install.sh's
|
|
93
|
+
* <root>/bin/agentrun) is what runs it: that command's path. The person's login shell has that command, never npx or
|
|
94
|
+
* the installer's Node, so a refusal names it. */
|
|
95
|
+
export const INSTALLED_COMMAND_ENV = "AGENTRUN_INSTALLED_COMMAND";
|
|
96
|
+
/** Whether `a` and `b` name one file through any symlink (a home folder reached by a link): their real paths when both
|
|
97
|
+
* are there, else the paths as given. */
|
|
98
|
+
const sameFile = (a, b) => {
|
|
99
|
+
try {
|
|
100
|
+
return realpathSync(a) === realpathSync(b);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return resolve(a) === resolve(b);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/** The file a shell runs for `agentrun` on `path`: the first executable one in its folders, in order, or undefined. */
|
|
107
|
+
const agentrunOnPath = (path) => {
|
|
108
|
+
for (const dir of path.split(":")) {
|
|
109
|
+
if (!dir)
|
|
110
|
+
continue;
|
|
111
|
+
const found = join(dir, "agentrun");
|
|
112
|
+
try {
|
|
113
|
+
if (statSync(found).isFile()) {
|
|
114
|
+
accessSync(found, constants.X_OK);
|
|
115
|
+
return found;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch { }
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
};
|
|
122
|
+
/** The installer's command as the person types it: `agentrun` when that is what their PATH runs (the installer adds its
|
|
123
|
+
* folder to the login shell's), else its path, so a paste never starts another install's copy found earlier on PATH. */
|
|
124
|
+
const typedCommand = (command, env) => {
|
|
125
|
+
const first = agentrunOnPath(env.PATH ?? "");
|
|
126
|
+
return first !== undefined && sameFile(first, command) ? "agentrun" : shellWord(command);
|
|
127
|
+
};
|
|
85
128
|
/**
|
|
86
129
|
* A start the agentrun launcher made (NPX_PACKAGE_ENV: by npx, or by the installer's bin/agentrun and its service, the
|
|
87
130
|
* same launcher) that a data directory refused because an earlier version wrote it (store.ts StoreFromEarlierVersion,
|
|
@@ -89,38 +132,51 @@ const freeName = (base, exists) => {
|
|
|
89
132
|
* then the two ways on as commands to paste. That command keeps its data in ~/.agentrun wherever it is run, so a new
|
|
90
133
|
* folder alone is not a new AgentRun. First, the old folder moved aside whole, so the same command starts this version
|
|
91
134
|
* where it was, and the earlier version still opens what it holds; then this version on a new, empty folder: the same
|
|
92
|
-
* command with --data. Nothing is deleted either way.
|
|
93
|
-
*
|
|
135
|
+
* command with --data. Nothing is deleted either way. The command is the one that started this server, as the launcher
|
|
136
|
+
* says (INSTALLED_COMMAND_ENV): the installer's, else npx's; never read from what the folder holds.
|
|
137
|
+
*
|
|
138
|
+
* The installer keeps its Node, its packages and its command in the folder beside the data (install.sh: node/, lib/,
|
|
139
|
+
* bin/agentrun). When that command started this from the folder refused, it or its service has no npx at hand, moving
|
|
140
|
+
* the folder takes the command, and the service starts on the refused folder whatever another command says. So there the
|
|
141
|
+
* one way on is the folder moved aside, then the installer run again for this same version (by default it installs the
|
|
142
|
+
* latest). Any other error, or a start the launcher did not make, is undefined: the refusal's own words stand.
|
|
94
143
|
*/
|
|
95
144
|
export function earlierDataRefusal(error, data, env = {}, exists = existsSync) {
|
|
96
145
|
const refused = error;
|
|
97
146
|
const earlier = refused?.name === "StoreFromEarlierVersion" || (refused?.name === "SchemaVersionUnknown" && typeof refused.found === "number" && typeof refused.known === "number" && refused.found < refused.known);
|
|
98
|
-
const
|
|
99
|
-
if (!earlier || typeof refused?.message !== "string" ||
|
|
147
|
+
const { launcher, yes, flags } = startedAs(env);
|
|
148
|
+
if (!earlier || typeof refused?.message !== "string" || launcher === undefined)
|
|
100
149
|
return undefined;
|
|
101
150
|
const dir = resolve(data);
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const flags = `${port && /^\d{1,5}$/.test(port) ? ` --port ${port}` : ""}${env[STARTED_OPEN_ENV] === "0" ? " --no-open" : ""}`;
|
|
105
|
-
const command = `npx ${yes}${door}`;
|
|
151
|
+
const installed = env[INSTALLED_COMMAND_ENV] ? resolve(env[INSTALLED_COMMAND_ENV]) : undefined;
|
|
152
|
+
const command = installed === undefined ? `npx ${yes}${launcher}` : typedCommand(installed, env);
|
|
106
153
|
// The launcher's own folder when --data names none (agentrun start.mjs): this same command opens `dir` again with no
|
|
107
154
|
// --data only when `dir` is it.
|
|
108
|
-
const launcherData = resolve(env
|
|
109
|
-
const again = `${command}${dir === launcherData ? "" : ` --data ${shellWord(dir)}`}${flags}`;
|
|
110
|
-
const fresh = freeName(`${dir}-new`, exists);
|
|
155
|
+
const launcherData = resolve(commandData(env));
|
|
111
156
|
const aside = freeName(`${dir}-earlier`, exists);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
157
|
+
const mv = `mv ${shellWord(dir)} ${shellWord(aside)}`;
|
|
158
|
+
const back = `The earlier version opens the old data with --data ${shellWord(aside)}.`;
|
|
159
|
+
// The store's own refusal already says to add them again; an earlier release's schema says it only in the lines cut here.
|
|
160
|
+
const again = refused.name === "SchemaVersionUnknown" ? " Add your agents, MCP servers, keys and sign-ins again in this version." : "";
|
|
161
|
+
// Through real paths: a home folder reached by a link names the same command.
|
|
162
|
+
if (installed !== undefined && sameFile(installed, join(dir, "bin", "agentrun"))) {
|
|
163
|
+
const version = launcher.slice(launcher.lastIndexOf("@") + 1);
|
|
164
|
+
return [
|
|
165
|
+
refused.message.split("\n")[0],
|
|
166
|
+
`To keep all of it and start this version in ${dir}: ${mv}, then run the installer again for this version: curl -fsSL https://agentrun.ai/install | sh -s -- --version ${version}. Moving the folder takes the installer's Node, packages and command with it (node/, lib/, bin/agentrun); the installer puts this version's back.`,
|
|
167
|
+
back,
|
|
168
|
+
`Nothing is deleted.${again}`,
|
|
169
|
+
].join("\n");
|
|
170
|
+
}
|
|
171
|
+
const fresh = freeName(`${dir}-new`, exists);
|
|
115
172
|
return [
|
|
116
173
|
refused.message.split("\n")[0],
|
|
117
|
-
// Moved aside first: every later command (doctor, the harness commands
|
|
118
|
-
//
|
|
119
|
-
`To keep all of it where the earlier version still opens it and start this version in ${dir}:
|
|
174
|
+
// Moved aside first: every later command (doctor, the harness commands) then finds this version where it looks with
|
|
175
|
+
// nothing more to remember; a new folder means the same --data on each of them.
|
|
176
|
+
`To keep all of it where the earlier version still opens it and start this version in ${dir}: ${mv}, then ${command}${dir === launcherData ? "" : ` --data ${shellWord(dir)}`}${flags}. ${back}`,
|
|
120
177
|
`Or start this version on a new, empty folder: ${command} --data ${shellWord(fresh)}${flags}`,
|
|
121
178
|
` (every later agentrun command then takes the same --data: without it, they open ${launcherData})`,
|
|
122
|
-
|
|
123
|
-
`Either way, nothing is deleted.${refused.name === "SchemaVersionUnknown" ? " Add your agents, MCP servers, keys and sign-ins again in this version." : ""}`,
|
|
179
|
+
`Either way, nothing is deleted.${again}`,
|
|
124
180
|
].join("\n");
|
|
125
181
|
}
|
|
126
182
|
/** The port the server was started on when `--port` named one, and whether `--open` was given (1 or 0): set by its CLI
|
|
@@ -211,6 +267,19 @@ function unavailable(facts, error, npx, env) {
|
|
|
211
267
|
const hinted = installHint(said, facts.install.npmLine, facts.install.spec, npx, env);
|
|
212
268
|
return new HarnessUnavailable(hinted, hinted === said ? fixOf(facts, error) : undefined);
|
|
213
269
|
}
|
|
270
|
+
/** The limits of a model the route translates onto a harness's wire (`provider.fetch`: provider.ts routedProvider), for
|
|
271
|
+
* an adapter that takes them: its window and its most output tokens, from the model's pi-ai entry in the run's models
|
|
272
|
+
* (`needs.models`), the entry the route's own model is. Its window is what every request asks Ollama for
|
|
273
|
+
* (options.num_ctx: ollama-provider.ts contextOf, at most 64k), and its output ceiling half that, at most 16,384. None
|
|
274
|
+
* for a model not routed, or one with no entry: its adapter's own defaults. */
|
|
275
|
+
export function routedLimits(provider, needs) {
|
|
276
|
+
if (!provider.fetch)
|
|
277
|
+
return {};
|
|
278
|
+
const entry = needs.models.getModel(needs.model.provider, needs.model.modelId);
|
|
279
|
+
const whole = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
280
|
+
const [window, ceiling] = [entry?.contextWindow, entry?.maxTokens];
|
|
281
|
+
return { ...(whole(window) ? { contextWindow: window } : {}), ...(whole(ceiling) ? { maxOutputTokens: ceiling } : {}) };
|
|
282
|
+
}
|
|
214
283
|
/** Where a run's adapter sends its model's requests (providerFor), or, for a held run its model kept from running at its
|
|
215
284
|
* create, the stand-in (heldRefusedProvider): no key is read, and its proxy refuses every request in the create's words,
|
|
216
285
|
* sending none. */
|
|
@@ -400,7 +469,9 @@ export async function codexOf(env, needs, load = () => import("@parcha/agentrun-
|
|
|
400
469
|
// On a ChatGPT plan: the plan's rules on its route (no output limit, no input count), billed to it, never priced here.
|
|
401
470
|
const provider = providerOf(codexFacts.wire, env, needs, codexFacts.id);
|
|
402
471
|
const plan = provider.billing === "plan";
|
|
403
|
-
|
|
472
|
+
// A model the route translates onto the wire (an Ollama model): both of its proxies forward with the route's own fetch,
|
|
473
|
+
// Codex's live web search, which the translation cannot run, is not offered, and its window and output ceiling are the route's (routedLimits).
|
|
474
|
+
return codex.codexAdapter({ model: provider.modelId, provider: { origin: provider.origin, credential: provider.credential, ...(plan ? { plan } : {}), ...(provider.refused ? { refused: provider.refused } : {}) }, price: plan ? () => null : priceOf({ ...needs, model: provider.priceModel }), log: harnessLog(codexFacts.id, env), ...routedLimits(provider, needs), ...(provider.fetch ? { fetch: provider.fetch } : nativeOptions(codexFacts, env).webSearch === "live" ? { webSearch: "live" } : {}), ...(needs.confine ? { confine: needs.confine } : {}), ...(needs.skills?.length ? { skills: needs.skills } : {}), ...(standIn ? { standIn } : binary ? { binary } : {}) });
|
|
404
475
|
}
|
|
405
476
|
/** opencode's adapter, from `load` (this server's own, src/harness-opencode; a test gives its own). Its model goes where
|
|
406
477
|
* its wire's do (providerFor): serve's gateway (AGENT_MODEL_BASE_URL), OpenAI or OpenRouter, on the Responses API,
|
|
@@ -427,7 +498,9 @@ export async function opencodeOf(env, needs, load = () => import("./harness-open
|
|
|
427
498
|
// adapter reads: each SKILL.md goes as servedSkill writes it (its name and description, as a prompt reads them, on one
|
|
428
499
|
// line each), so a CRLF file or a folded description is listed by its own words.
|
|
429
500
|
const skills = needs.skills && servedSkills(needs.skills);
|
|
430
|
-
|
|
501
|
+
// A model the route translates onto the wire (an Ollama model): its proxies forward with the route's own fetch, and its
|
|
502
|
+
// window and output ceiling are the route's (routedLimits).
|
|
503
|
+
return opencode.openCodeAdapter({ model: provider.modelId, provider: { origin: provider.origin, credential: provider.credential }, price: priceOf({ ...needs, model: provider.priceModel }), log: harnessLog(openCodeFacts.id, env), ...routedLimits(provider, needs), ...(provider.fetch ? { fetch: provider.fetch } : {}), ...(needs.confine ? { confine: needs.confine } : {}), ...(skills?.length ? { skills } : {}), ...(standIn ? { standIn } : {}) });
|
|
431
504
|
}
|
|
432
505
|
/** Why `harness` cannot run here, or undefined when it can (its entry's refusal): its package and pins, its provider, and
|
|
433
506
|
* the adapter's own check of the model `given` names (with none, a model of its wire's vendor: whether it runs here at
|
package/dist/agent-delete.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { type PurgeKept, type Store } from "./store/index.js";
|
|
2
|
-
/** The delete of an agent's learning: the server's is the learning module's deleteLearning over the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ledger and watermark (`keepResetLedger`) and deletes the folder on the agent's own disk too (`agentDisk`), which the
|
|
7
|
-
* agent's delete removes whole in its step 3. */
|
|
2
|
+
/** The delete of an agent's learning: the server's is the learning module's deleteLearning over the store's learning
|
|
3
|
+
* rows (learn/delete.ts). Idempotent; refuses with LearningInFlight while learning work of the agent is in flight. A
|
|
4
|
+
* reset of the agent's learning (learning-reset.ts), whose agent and runs stay, keeps its reset ledger and watermark
|
|
5
|
+
* (`keepResetLedger`). */
|
|
8
6
|
export type DeleteLearning = (store: Store, agentId: string, options?: {
|
|
9
7
|
keepResetLedger?: boolean;
|
|
10
|
-
agentDisk?: boolean;
|
|
11
8
|
}) => Promise<unknown>;
|
|
12
9
|
/** A point of a delete a test may stop it at (AgentDeleteHost.at). An agent's: after step 1, after step 2, in step 3
|
|
13
10
|
* between a trigger's removal upstream and its settings', between its settings' and its row's, and in step 3 once its
|
|
@@ -50,8 +47,8 @@ export interface AgentDeleteHost {
|
|
|
50
47
|
madeFrom(runId: string): Promise<string[]>;
|
|
51
48
|
/** What agent `agentId`'s learning copied from run `runId`, gone: the grades it keeps of the run dropped, its promotion
|
|
52
49
|
* records' disagreements naming the run blanked, their decisions, numbers and run ids kept (learn/promote.ts
|
|
53
|
-
* forgetRunCopies), and
|
|
54
|
-
* Idempotent: a purged run's DELETE runs it again. */
|
|
50
|
+
* forgetRunCopies), and every SDK run's inbox that holds its workflow text emptied of it (sdk/runs.ts forgetSdkCopies).
|
|
51
|
+
* Idempotent: run before the run's purge and again after it commits, and a purged run's DELETE runs it again. */
|
|
55
52
|
forgetCopies(agentId: string, runId: string): Promise<void>;
|
|
56
53
|
/** What run `runId`'s spend reads from its journal, read before its purge removes it (store-reads/cap.ts). */
|
|
57
54
|
kept(runId: string): Promise<PurgeKept>;
|
package/dist/agent-delete.js
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
// finish; a DELETE of a purged run is 204 again. A live run (not final, or held by a runner) refuses its purge with 409
|
|
8
8
|
// run_not_final and nothing purged. The runs made from a run are purged before it: one a claim made after the DELETE read
|
|
9
9
|
// them is found by the store's purge under the run's row lock (RunsMadeFromLeft, 409 naming it), and one made once the run
|
|
10
|
-
// is purged is refused at its create (RunPurged). A run's purge
|
|
11
|
-
//
|
|
12
|
-
// merges, while the folder's git keeps their bytes until a learning reset or the agent's purge deletes it.
|
|
10
|
+
// is purged is refused at its create (RunPurged). A run's purge deletes its agent's learning rows that hold its text (the
|
|
11
|
+
// store's purge, Store.learning purgeRun) and blanks what its agent's records copied from it (forgetCopies).
|
|
13
12
|
//
|
|
14
13
|
// Another system's agent is first marked refusing new runs (its archive time, set with its triggers off in one commit, read
|
|
15
14
|
// by every path that would start a run), then its runs are cancelled and waited for, then its learning goes, then its
|
|
@@ -117,6 +116,9 @@ export async function purgeRun(host, runId) {
|
|
|
117
116
|
await host.at?.("run_made_from_gone", runId);
|
|
118
117
|
await host.forgetCopies(run.agentId, runId);
|
|
119
118
|
await purgeOneOrRefuse(host, run.agentId, runId, runId, true);
|
|
119
|
+
// Again after the purge committed: a copy written meanwhile (an SDK start's inbox, which checks its writers after it is
|
|
120
|
+
// written) is seen by this pass, or saw the purge itself.
|
|
121
|
+
await host.forgetCopies(run.agentId, runId);
|
|
120
122
|
}
|
|
121
123
|
/** The one per-run step of both purges: the figures its spend's readers read from its journal, its things outside its
|
|
122
124
|
* rows, then its rows (a tombstone). Its store's refusal of a run gone live again since it was read (a follow-up opened
|
package/dist/agent-package.js
CHANGED
|
@@ -15,6 +15,7 @@ import { toolOf } from "./tools.js";
|
|
|
15
15
|
import { configSecrets, SEALED_FIELD, SEALED_MASK } from "./trigger-composio.js";
|
|
16
16
|
import { CATCHUP_WINDOW_S } from "./triggers.js";
|
|
17
17
|
import { isObject, MODEL_TIER_NAMES, stable } from "./validate.js";
|
|
18
|
+
import { fileIssues } from "./filed-tool.js";
|
|
18
19
|
import { PAIRED_ID_PREFIX } from "./workspace/attached-computers.js";
|
|
19
20
|
/** What an export's note can be about: the document's enum of them (openapi.ts), so a note of a kind not here fails the
|
|
20
21
|
* build, and an answer the document does not list fails its schema check. */
|
|
@@ -145,9 +146,16 @@ export function agentPackage(input) {
|
|
|
145
146
|
if (!clear.length)
|
|
146
147
|
pin[tool] = held;
|
|
147
148
|
}
|
|
149
|
+
// A file setting travels as it is: a folder of the run's files and the paths the tool's result shows, never a value.
|
|
150
|
+
const file = {};
|
|
151
|
+
for (const tool of granted) {
|
|
152
|
+
const held = settings[mcpToolName(server, tool)]?.file;
|
|
153
|
+
if (held !== undefined && !fileIssues(held, `file.${tool}`).length)
|
|
154
|
+
file[tool] = held;
|
|
155
|
+
}
|
|
148
156
|
const reason = origin?.mcp.find((need) => need.source === saved.source.source && need.toolkit === toolkit)?.reason;
|
|
149
157
|
// Required where a composio trigger runs on it (as a package's composio trigger must); else skipped where none matches.
|
|
150
|
-
mcp.push({ source: saved.source.source, toolkit, tools: granted, ...(composioServers.has(server) ? { required: true } : {}), ...(reason ? { reason } : {}), ...(Object.keys(pin).length ? { pin } : {}) });
|
|
158
|
+
mcp.push({ source: saved.source.source, toolkit, tools: granted, ...(composioServers.has(server) ? { required: true } : {}), ...(reason ? { reason } : {}), ...(Object.keys(pin).length ? { pin } : {}), ...(Object.keys(file).length ? { file } : {}) });
|
|
151
159
|
}
|
|
152
160
|
// What the tool settings hold beyond a pin of a granted MCP tool and bash's policy is this server's.
|
|
153
161
|
for (const [tool, setting] of Object.entries(settings)) {
|
|
@@ -161,6 +169,8 @@ export function agentPackage(input) {
|
|
|
161
169
|
else
|
|
162
170
|
blocked.push({ kind: "tool_setting", name: tool, reason: "Its arguments are pinned, and a package pins MCP tools alone: without the pin the agent would get more than it has here." });
|
|
163
171
|
}
|
|
172
|
+
if (setting.file !== undefined && !ofNeed)
|
|
173
|
+
remade.push({ kind: "tool_setting", name: tool, reason: "Its answers are filed (a file setting) on a tool the agent is not granted: set it again on the target if the tool is granted there." });
|
|
164
174
|
if (setting.permission === "allow")
|
|
165
175
|
remade.push({ kind: "tool_setting", name: tool, reason: "It runs without asking here: allow it again on the target." });
|
|
166
176
|
const own = ["provider", "scope"].filter((key) => setting[key] !== undefined);
|
package/dist/agents-store.js
CHANGED
|
@@ -86,7 +86,7 @@ function revisionInputOf(definition, files) {
|
|
|
86
86
|
if (isObject(definition.workflow))
|
|
87
87
|
return { kind: "workflow", workflow: definition.workflow, ...(definition.approvals === "never" ? { approvals: "never" } : {}), ...common, ...capped };
|
|
88
88
|
// true, false or the loop's numbers (learning-setting.ts), checked by validate.ts and again by the body.
|
|
89
|
-
const learning = definition.learning !== undefined && learningSettingIssue(definition.learning) === undefined ? { learning: definition.learning } : {};
|
|
89
|
+
const learning = definition.learning !== undefined && learningSettingIssue(definition.learning, "learning") === undefined ? { learning: definition.learning } : {};
|
|
90
90
|
return {
|
|
91
91
|
kind: "agentic",
|
|
92
92
|
instructions: definition.instructions,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** `answer`'s body as text, read up to `max` bytes; undefined once it is longer (the rest is cancelled, never read). A
|
|
2
|
+
* body that breaks off while it is read throws, as `answer.text()` would. */
|
|
3
|
+
export declare function textUpTo(answer: Response, max: number): Promise<string | undefined>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// An answer's body read with a cap: what a call to another service reads of its answer, so no answer is held whole in
|
|
2
|
+
// memory however long it is.
|
|
3
|
+
/** `answer`'s body as text, read up to `max` bytes; undefined once it is longer (the rest is cancelled, never read). A
|
|
4
|
+
* body that breaks off while it is read throws, as `answer.text()` would. */
|
|
5
|
+
export async function textUpTo(answer, max) {
|
|
6
|
+
const reader = answer.body?.getReader();
|
|
7
|
+
if (!reader)
|
|
8
|
+
return "";
|
|
9
|
+
const chunks = [];
|
|
10
|
+
let size = 0;
|
|
11
|
+
for (;;) {
|
|
12
|
+
const { done, value } = await reader.read();
|
|
13
|
+
if (done)
|
|
14
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
15
|
+
size += value.byteLength;
|
|
16
|
+
if (size > max) {
|
|
17
|
+
await reader.cancel().catch(() => { });
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
chunks.push(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/api-only.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type { Route } from "./server.js";
|
|
|
7
7
|
* of an agent made here is purged too (deleteRun): the token may archive and delete that whole agent below, every
|
|
8
8
|
* run of it purged, so one run of it is no more;
|
|
9
9
|
* - a run's computer, take-over, hand-back and viewer link go to the backend, which has no owner's session here;
|
|
10
|
-
* - a backend reads what its agents learned (loop, promotions, cost per run, a run's learning), cut as the
|
|
11
|
-
* and resets it (deleteAgentLearning: the agent and its runs kept) when it erases what an agent learned;
|
|
10
|
+
* - a backend reads what its agents learned (loop, promotions, audits, cost per run, a run's learning), cut as the
|
|
11
|
+
* console's, and resets it (deleteAgentLearning: the agent and its runs kept) when it erases what an agent learned;
|
|
12
12
|
* - a run's usage lines (what its cost.usd joins, by meter) are a read of that run alone, cut as the run's read is;
|
|
13
13
|
* - an operator or a scaler reads the runners' capacity (getCapacity, capacity.ts) from the server whose runners run apart;
|
|
14
14
|
* - a backend reads the saved MCP servers' names (listMcpServerNames), never a URL or a credential;
|
package/dist/api-only.js
CHANGED
|
@@ -14,8 +14,8 @@ import { LAUNCH_HOOK_SECRET_ENV, LAUNCH_HOOK_URL_ENV } from "./trigger-launch-ho
|
|
|
14
14
|
* of an agent made here is purged too (deleteRun): the token may archive and delete that whole agent below, every
|
|
15
15
|
* run of it purged, so one run of it is no more;
|
|
16
16
|
* - a run's computer, take-over, hand-back and viewer link go to the backend, which has no owner's session here;
|
|
17
|
-
* - a backend reads what its agents learned (loop, promotions, cost per run, a run's learning), cut as the
|
|
18
|
-
* and resets it (deleteAgentLearning: the agent and its runs kept) when it erases what an agent learned;
|
|
17
|
+
* - a backend reads what its agents learned (loop, promotions, audits, cost per run, a run's learning), cut as the
|
|
18
|
+
* console's, and resets it (deleteAgentLearning: the agent and its runs kept) when it erases what an agent learned;
|
|
19
19
|
* - a run's usage lines (what its cost.usd joins, by meter) are a read of that run alone, cut as the run's read is;
|
|
20
20
|
* - an operator or a scaler reads the runners' capacity (getCapacity, capacity.ts) from the server whose runners run apart;
|
|
21
21
|
* - a backend reads the saved MCP servers' names (listMcpServerNames), never a URL or a credential;
|
|
@@ -44,7 +44,7 @@ export const API_ONLY_ROUTES = new Set([
|
|
|
44
44
|
"getRunComputer", "takeOverRunComputer", "handBackRunComputer", "createRunComputerViewer",
|
|
45
45
|
"listComputers", "listRunningComputers", "getWorkspaceArchil",
|
|
46
46
|
"getAgentArchil", "deleteAgentArchil", "deleteAgent", "deleteAgentLearning", "deleteRun",
|
|
47
|
-
"getLearningLoop", "listLearningPromotions", "getLearningCost", "getRunLearning",
|
|
47
|
+
"getLearningLoop", "listLearningPromotions", "listLearningAudits", "getLearningCost", "getRunLearning",
|
|
48
48
|
"getRun", "getRunUsage", "listRuns", "listAllRuns", "getTimeline",
|
|
49
49
|
"sendMessage", "stopRun", "cancelRun", "raiseRunCap", "gradeRun",
|
|
50
50
|
"listRunFiles", "readRunFile",
|
package/dist/archil-routes.d.ts
CHANGED
|
@@ -6,13 +6,16 @@ export declare const ARCHIL_ROUTES: ReadonlySet<string>;
|
|
|
6
6
|
/** The key names the Archil settings take, as the document names them. */
|
|
7
7
|
export declare const ARCHIL_KEY_NAMES: readonly string[];
|
|
8
8
|
/** The Archil settings as the owner reads them, with `source` while on (the server's environment, or saved through the
|
|
9
|
-
* PUT, "console"): the account key as `secret`, its SecretMeta,
|
|
9
|
+
* PUT, "console") and `s3UrlFrom` (the region's own S3 URL, or one given): the account key as `secret`, its SecretMeta,
|
|
10
|
+
* never a value. `regions`: each region serve knows, with its S3 URL, which a PUT naming it may leave out. */
|
|
10
11
|
export type ArchilView = {
|
|
11
12
|
on: boolean;
|
|
12
13
|
source?: "env" | "console";
|
|
13
14
|
region?: string;
|
|
14
15
|
s3Url?: string;
|
|
16
|
+
s3UrlFrom?: "region" | "given";
|
|
15
17
|
image?: string;
|
|
18
|
+
regions: Readonly<Record<string, string>>;
|
|
16
19
|
secret: KeyMeta;
|
|
17
20
|
};
|
|
18
21
|
export type ArchilTest = {
|
package/dist/archil-routes.js
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
// disk: each agent has its own, made on its first run that needs one (workspace/run-disk.ts), and a run's launch may
|
|
4
4
|
// name another. The one kept credential is the account key, sealed under the claim's row name ("archil.api_key"). No
|
|
5
5
|
// disk token is kept: a computer's mount credential is minted per run from the account key.
|
|
6
|
-
// GET /v2/workspace/archil on or off, the settings and where from (the server's environment, else saved),
|
|
6
|
+
// GET /v2/workspace/archil on or off, the settings and where from (the server's environment, else saved), the
|
|
7
|
+
// S3 URL's (the region's, or given), each region serve knows with its S3 URL, and
|
|
7
8
|
// the account key as the shared secret shape: set or not, where from, when changed
|
|
8
9
|
// (never a value)
|
|
9
10
|
// PUT /v2/workspace/archil the settings row replaced, and the account key sealed when given (null removes it);
|
|
10
|
-
// the exec image, when given,
|
|
11
|
+
// the S3 URL, left out, the region's (one serve knows); the exec image, when given,
|
|
12
|
+
// pinned by digest
|
|
11
13
|
// DELETE /v2/workspace/archil off (the settings row removed; the key is kept, for turning it on again)
|
|
12
14
|
// POST /v2/workspace/archil/test one listing of the account's disks at the region's control plane, with the
|
|
13
15
|
// account key opened as a claim opens it: { ok, detail } or { ok: false, why }
|
|
@@ -20,7 +22,7 @@
|
|
|
20
22
|
// key_set_by_server: they are changed where the server is started, as a tool key its launcher sets is, never saved here
|
|
21
23
|
// to no effect.
|
|
22
24
|
// archilRoute holds the routes' rules, so serve's dispatch only calls it and sends the answer, or the ApiError's status.
|
|
23
|
-
import { agentDiskOf, ARCHIL_API_KEY_ROW, ARCHIL_SETTINGS_ENV, archilSettingsFromEnv, archilSettingsIssues, archilSettingsOf, clearArchilSettings, forgetAgentDisk, loadArchilSettings, saveArchilSettings, storeAgentDisk } from "./archil-settings.js";
|
|
25
|
+
import { agentDiskOf, ARCHIL_API_KEY_ROW, ARCHIL_S3_URLS, ARCHIL_SETTINGS_ENV, archilSettingsFromEnv, archilSettingsIssues, archilSettingsOf, clearArchilSettings, forgetAgentDisk, loadArchilSettings, s3UrlFromOf, saveArchilSettings, storeAgentDisk } from "./archil-settings.js";
|
|
24
26
|
import { ApiError, invalid } from "./errors.js";
|
|
25
27
|
import { envValue, keyMetaOf } from "./key-meta.js";
|
|
26
28
|
import { registerNotSecretWrite, registerSecretPage, registerSecretWrite, secretName } from "./secret-writes.js";
|
|
@@ -67,7 +69,7 @@ export async function liveRunsOnDisk(runs, agentId, diskId) {
|
|
|
67
69
|
}
|
|
68
70
|
return count;
|
|
69
71
|
}
|
|
70
|
-
const OFF = `Archil is off on this server: save its region
|
|
72
|
+
const OFF = `Archil is off on this server: save its region and account key (PUT /v2/workspace/archil), or start the server with ${ARCHIL_SETTINGS_ENV.region} and ARCHIL_API_KEY; a region serve doesn't know needs its S3 URL too (s3Url, ${ARCHIL_SETTINGS_ENV.s3Url})`;
|
|
71
73
|
const nonEmpty = (value) => typeof value === "string" && value.trim() !== "";
|
|
72
74
|
const describe = (error) => String(error?.message ?? error).replace(/\s+/g, " ").slice(0, 300);
|
|
73
75
|
const statusOf = (error) => {
|
|
@@ -81,8 +83,8 @@ export function createArchilRoutes(options) {
|
|
|
81
83
|
const removals = new Map();
|
|
82
84
|
async function view() {
|
|
83
85
|
const settings = await loadArchilSettings(store, env);
|
|
84
|
-
const shown = settings === undefined ? {} : { source: archilSettingsFromEnv(env) ? "env" : "console", region: settings.region, s3Url: settings.s3Url, ...(settings.image !== undefined ? { image: settings.image } : {}) };
|
|
85
|
-
return { on: settings !== undefined, ...shown, secret: (await keyMetaOf(store, [SECRET], env))[0] };
|
|
86
|
+
const shown = settings === undefined ? {} : { source: archilSettingsFromEnv(env) ? "env" : "console", region: settings.region, s3Url: settings.s3Url, s3UrlFrom: s3UrlFromOf(settings), ...(settings.image !== undefined ? { image: settings.image } : {}) };
|
|
87
|
+
return { on: settings !== undefined, ...shown, regions: ARCHIL_S3_URLS, secret: (await keyMetaOf(store, [SECRET], env))[0] };
|
|
86
88
|
}
|
|
87
89
|
/** A change refused while the server's environment sets the settings: nothing saved would take effect. */
|
|
88
90
|
function refuseWhileEnv() {
|
|
@@ -95,7 +97,7 @@ export function createArchilRoutes(options) {
|
|
|
95
97
|
async function save(body) {
|
|
96
98
|
refuseWhileEnv();
|
|
97
99
|
if (typeof body !== "object" || body === null || Array.isArray(body))
|
|
98
|
-
throw new ApiError("input_invalid", "the body is a JSON object: { region, s3Url
|
|
100
|
+
throw new ApiError("input_invalid", "the body is a JSON object: { region, s3Url?, image?, keys? }");
|
|
99
101
|
const given = body;
|
|
100
102
|
const issues = unknownFields(given, ["region", "s3Url", "image", "keys"]).map((issue) => issue.field === "diskId" ? { ...issue, message: "There is no server-wide disk: each agent has its own, made on its first run, and a run may name another (archil_disk on its start)." } : issue);
|
|
101
103
|
issues.push(...archilSettingsIssues(given));
|
|
@@ -286,11 +288,12 @@ export function createArchilRoutes(options) {
|
|
|
286
288
|
}
|
|
287
289
|
}
|
|
288
290
|
/** Agent `agentId`'s learning folder on disk `diskId` deleted over the disk's file API: agents/<agent>/learning and
|
|
289
|
-
* everything under it
|
|
290
|
-
* agent's own or one its launch named (the caller's: never made, renamed or removed here), and the
|
|
291
|
-
* exec
|
|
292
|
-
*
|
|
293
|
-
*
|
|
291
|
+
* everything under it, which a Mode 2 run's end wrote, before learning moved to the store's rows, on the disk its
|
|
292
|
+
* claim mounted, the agent's own or one its launch named (the caller's: never made, renamed or removed here), and the
|
|
293
|
+
* folder a learning exec spilled beside it (workspace/archil.ts spillFolderOf). Nothing reads it any more; a run's
|
|
294
|
+
* purge removes it from a disk the run's launch named, as it did before (server.ts forgetRun). Nothing else on the
|
|
295
|
+
* disk is touched: the agent's runs' folders stay. Done again, it does nothing: a folder not there is gone, and so is
|
|
296
|
+
* the folder of a disk Archil says is gone. Archil off, or no account key, is 503 unavailable; a delete Archil refuses
|
|
294
297
|
* (a computer that still holds the folder, Archil not reached) is 424 upstream_failed, what was not deleted left for
|
|
295
298
|
* the next call. */
|
|
296
299
|
async function removeLearningFolder(agentId, diskId) {
|