@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.39
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 +700 -0
- package/README.md +441 -177
- package/dist/adapters.d.ts +4 -1
- package/dist/adapters.js +4 -2
- package/dist/agent-rows.d.ts +1 -3
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +48 -23
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/bash-read-only.js +2 -1
- package/dist/browser-cost.js +52 -93
- package/dist/cap-short.d.ts +12 -0
- package/dist/cap-short.js +60 -0
- package/dist/cap.d.ts +3 -400
- package/dist/cap.js +6 -942
- package/dist/catalog.d.ts +0 -5
- package/dist/catalog.js +2 -6
- package/dist/chatgpt-plan.d.ts +163 -0
- package/dist/chatgpt-plan.js +549 -0
- package/dist/cli.js +26 -6
- package/dist/composio-preset.d.ts +25 -0
- package/dist/composio-preset.js +51 -8
- package/dist/composio-triggers.d.ts +113 -0
- package/dist/composio-triggers.js +411 -0
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +7 -3
- package/dist/computer-live.d.ts +12 -2
- package/dist/computer-live.js +21 -5
- package/dist/computer-routes.d.ts +2 -2
- package/dist/computer-routes.js +2 -2
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +18 -2
- package/dist/computer-view.js +21 -6
- package/dist/computer-viewer.js +40 -13
- package/dist/computers.d.ts +8 -2
- package/dist/computers.js +18 -8
- package/dist/console/assets/index-BNhZs-jp.css +1 -0
- package/dist/console/assets/index-BQv5aOGB.js +700 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -3
- package/dist/decision-cap.d.ts +2 -5
- package/dist/decision-cap.js +3 -6
- package/dist/decision-rows.js +11 -11
- package/dist/decisions.js +4 -0
- package/dist/email/account.d.ts +84 -0
- package/dist/email/account.js +159 -0
- package/dist/email/answer.d.ts +10 -0
- package/dist/email/answer.js +182 -0
- package/dist/email/email-faux.d.ts +95 -0
- package/dist/email/email-faux.js +849 -0
- package/dist/email/labels.d.ts +1 -0
- package/dist/email/labels.js +84 -0
- package/dist/email/mail.d.ts +186 -0
- package/dist/email/mail.js +380 -0
- package/dist/email/names.d.ts +20 -0
- package/dist/email/names.js +40 -0
- package/dist/email/routes.d.ts +9 -0
- package/dist/email/routes.js +50 -0
- package/dist/email/tools.d.ts +20 -0
- package/dist/email/tools.js +517 -0
- package/dist/environment.d.ts +17 -2
- package/dist/environment.js +36 -8
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +12 -0
- package/dist/eval-mailbox.d.ts +103 -0
- package/dist/eval-mailbox.js +236 -0
- package/dist/faux-computers.js +4 -2
- package/dist/graph-view.d.ts +9 -2
- package/dist/graph-view.js +6 -2
- package/dist/harness-install.d.ts +28 -2
- package/dist/harness-install.js +147 -59
- package/dist/harness-opencode/adapter.js +2 -22
- package/dist/harness-opencode/facts.js +5 -4
- package/dist/harness-opencode/host/policy.d.ts +4 -5
- package/dist/harness-opencode/host/policy.js +14 -33
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/versions.d.ts +6 -0
- package/dist/harness-opencode/versions.js +6 -0
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +8 -7
- package/dist/harness.d.ts +12 -0
- package/dist/harness.js +15 -3
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +3 -3
- package/dist/hosted-search.js +51 -32
- package/dist/import-sources.d.ts +1 -1
- package/dist/import-sources.js +3 -3
- package/dist/import.d.ts +21 -0
- package/dist/import.js +186 -1
- package/dist/key-check.d.ts +0 -2
- package/dist/key-check.js +3 -4
- package/dist/key-refusal.d.ts +8 -2
- package/dist/key-refusal.js +16 -13
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +24 -4
- package/dist/learn/check.js +340 -7
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +250 -0
- package/dist/learn/compile.js +507 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +11 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +308 -0
- package/dist/learn/promote.js +321 -0
- package/dist/learn/refit.d.ts +48 -0
- package/dist/learn/refit.js +264 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +19 -16
- package/dist/learn/skills.js +157 -53
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +58 -2
- package/dist/learned-nodes.js +68 -5
- package/dist/learned-workflow.d.ts +58 -32
- package/dist/learned-workflow.js +215 -77
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +4 -4
- package/dist/learning-cost.d.ts +41 -11
- package/dist/learning-cost.js +31 -13
- package/dist/learning-routes.d.ts +12 -2
- package/dist/learning-routes.js +34 -6
- package/dist/learning-words.d.ts +8 -1
- package/dist/learning-words.js +11 -1
- package/dist/learning.d.ts +26 -1
- package/dist/learning.js +7 -4
- package/dist/link-check.d.ts +27 -0
- package/dist/link-check.js +164 -0
- package/dist/llm.js +0 -3
- package/dist/local-models.d.ts +33 -2
- package/dist/local-models.js +43 -5
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +113 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-secret-writes.js +3 -0
- package/dist/mcp-servers-store.d.ts +102 -26
- package/dist/mcp-servers-store.js +151 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model-form.d.ts +11 -0
- package/dist/model-form.js +17 -1
- package/dist/model.d.ts +39 -6
- package/dist/model.js +171 -32
- package/dist/monid.d.ts +50 -29
- package/dist/monid.js +234 -143
- package/dist/native/binding.d.ts +13 -0
- package/dist/native/binding.js +57 -0
- package/dist/native/cli.d.ts +2 -0
- package/dist/native/cli.js +48 -0
- package/dist/native/connection.d.ts +8 -0
- package/dist/native/connection.js +94 -0
- package/dist/native/context.d.ts +6 -0
- package/dist/native/context.js +22 -0
- package/dist/native/discovery.d.ts +27 -0
- package/dist/native/discovery.js +404 -0
- package/dist/native/environment.d.ts +4 -0
- package/dist/native/environment.js +18 -0
- package/dist/native/history.d.ts +20 -0
- package/dist/native/history.js +147 -0
- package/dist/native/instructions.d.ts +21 -0
- package/dist/native/instructions.js +173 -0
- package/dist/native/remote-worker-bridge.d.ts +3 -0
- package/dist/native/remote-worker-bridge.js +278 -0
- package/dist/native/remote.d.ts +187 -0
- package/dist/native/remote.js +492 -0
- package/dist/native/runtime.d.ts +17 -0
- package/dist/native/runtime.js +316 -0
- package/dist/native/runtimes.d.ts +66 -0
- package/dist/native/runtimes.js +41 -0
- package/dist/native/schema.d.ts +46 -0
- package/dist/native/schema.js +41 -0
- package/dist/native/types.d.ts +87 -0
- package/dist/native/types.js +1 -0
- package/dist/observation/http.d.ts +4 -0
- package/dist/observation/http.js +140 -0
- package/dist/observation/observer.d.ts +301 -0
- package/dist/observation/observer.js +919 -0
- package/dist/observation/schema.d.ts +52 -0
- package/dist/observation/schema.js +154 -0
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +705 -126
- package/dist/paid-calls.d.ts +34 -32
- package/dist/paid-calls.js +52 -104
- package/dist/place-offers.d.ts +4 -8
- package/dist/place-offers.js +4 -9
- package/dist/port-models.d.ts +7 -2
- package/dist/port-models.js +5 -2
- package/dist/print.d.ts +4 -2
- package/dist/print.js +4 -3
- package/dist/propose.d.ts +8 -3
- package/dist/propose.js +28 -7
- package/dist/provider.d.ts +5 -1
- package/dist/provider.js +17 -2
- package/dist/push-handler.d.ts +3 -2
- package/dist/push-handler.js +20 -6
- package/dist/reflect-range.js +2 -1
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +13 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +23 -1
- package/dist/run-launch.js +17 -4
- package/dist/run-learning-served.d.ts +84 -0
- package/dist/run-manifest.d.ts +8 -0
- package/dist/run-manifest.js +33 -1
- package/dist/run-reads-over-store.d.ts +3 -3
- package/dist/run-reads-over-store.js +13 -10
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +3 -2
- package/dist/run-timeline-served.js +12 -10
- package/dist/run-view.d.ts +59 -41
- package/dist/run-view.js +128 -64
- package/dist/runnable.d.ts +13 -8
- package/dist/runnable.js +77 -60
- package/dist/runner/adapter-loop.d.ts +60 -15
- package/dist/runner/adapter-loop.js +1406 -464
- package/dist/runner/adapter-run-spec.d.ts +45 -14
- package/dist/runner/adapter-run-spec.js +200 -116
- package/dist/runner/adapters/pi.d.ts +40 -7
- package/dist/runner/adapters/pi.js +149 -38
- package/dist/runner/beside.d.ts +3 -1
- package/dist/runner/beside.js +24 -8
- package/dist/runner/claim-secrets.d.ts +3 -1
- package/dist/runner/claim-secrets.js +28 -4
- package/dist/runner/cli-run-spec.d.ts +30 -0
- package/dist/runner/cli-run-spec.js +150 -66
- package/dist/runner/computer-channel.d.ts +5 -2
- package/dist/runner/computer-channel.js +5 -3
- package/dist/runner/computer-journal.d.ts +6 -0
- package/dist/runner/computer-journal.js +8 -10
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +149 -5
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +8 -5
- package/dist/runner/end-of-run.js +11 -6
- package/dist/runner/feedback-round.d.ts +79 -0
- package/dist/runner/feedback-round.js +127 -0
- package/dist/runner/harness-loops.js +17 -0
- package/dist/runner/journal-kinds.d.ts +55 -13
- package/dist/runner/journal-kinds.js +19 -0
- package/dist/runner/learning-dispatch.d.ts +3 -2
- package/dist/runner/learning-dispatch.js +6 -6
- package/dist/runner/learning-end.d.ts +58 -19
- package/dist/runner/learning-end.js +316 -115
- package/dist/runner/learning-factory.d.ts +3 -0
- package/dist/runner/learning-factory.js +8 -2
- package/dist/runner/learning-loop.d.ts +21 -1
- package/dist/runner/learning-loop.js +24 -6
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +34 -1
- package/dist/runner/loop.js +55 -1
- package/dist/runner/main.d.ts +6 -1
- package/dist/runner/main.js +26 -4
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +20 -53
- package/dist/runner/mcp-run.js +22 -88
- package/dist/runner/meta-tools.d.ts +44 -0
- package/dist/runner/meta-tools.js +344 -0
- package/dist/runner/metrics.d.ts +80 -21
- package/dist/runner/metrics.js +128 -42
- package/dist/runner/model-route.d.ts +12 -3
- package/dist/runner/model-route.js +149 -19
- package/dist/runner/monid-run.d.ts +18 -0
- package/dist/runner/monid-run.js +170 -0
- package/dist/runner/native-loop.d.ts +11 -0
- package/dist/runner/native-loop.js +438 -0
- package/dist/runner/promotion.d.ts +146 -0
- package/dist/runner/promotion.js +803 -0
- package/dist/runner/redact.js +3 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +147 -49
- package/dist/runner/runner.d.ts +7 -1
- package/dist/runner/runner.js +34 -8
- package/dist/runner/sdk-loop.d.ts +7 -0
- package/dist/runner/sdk-loop.js +470 -0
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/spec-holds.d.ts +16 -2
- package/dist/runner/spec-holds.js +42 -14
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-secrets.js +17 -2
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +226 -0
- package/dist/runner/workflow-first.js +293 -0
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +32 -19
- package/dist/runner/workflow-spec.d.ts +5 -1
- package/dist/runner/workflow-spec.js +63 -48
- package/dist/runs-over-store.d.ts +41 -4
- package/dist/runs-over-store.js +64 -22
- package/dist/sdk/runs.d.ts +115 -0
- package/dist/sdk/runs.js +422 -0
- package/dist/sdk/schema.d.ts +175 -0
- package/dist/sdk/schema.js +138 -0
- package/dist/sdk/workflows.d.ts +22 -0
- package/dist/sdk/workflows.js +39 -0
- package/dist/secrets.d.ts +2 -0
- package/dist/secrets.js +19 -1
- package/dist/server.d.ts +108 -20
- package/dist/server.js +874 -157
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/skill-route.d.ts +3 -0
- package/dist/skill-route.js +16 -0
- package/dist/skills/agentrun-serve/SKILL.md +368 -0
- package/dist/stats.d.ts +10 -10
- package/dist/store/agent-body.d.ts +22 -7
- package/dist/store/agent-body.js +23 -14
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/native-command-owner.d.ts +10 -0
- package/dist/store/native-command-owner.js +47 -0
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
- package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
- package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
- package/dist/store/postgres/store.js +3 -0
- package/dist/store/schema.d.ts +16 -0
- package/dist/store/schema.js +47 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.d.ts +8 -1
- package/dist/store/sqlite/run-patch.js +33 -10
- package/dist/store/sqlite/store.js +184 -28
- package/dist/store/store.d.ts +98 -21
- package/dist/store-reads/analytics.d.ts +7 -7
- package/dist/store-reads/analytics.js +23 -5
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/journal.d.ts +30 -1
- package/dist/store-reads/journal.js +141 -83
- package/dist/store-reads/learning.d.ts +179 -13
- package/dist/store-reads/learning.js +230 -68
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +5 -0
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +109 -37
- package/dist/template-eval.d.ts +87 -16
- package/dist/template-eval.js +605 -120
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +274 -52
- package/dist/templates.js +670 -201
- package/dist/text-urls.d.ts +38 -0
- package/dist/text-urls.js +170 -0
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +7 -5
- package/dist/timeline/index.js +7 -5
- package/dist/timeline/labels.d.ts +11 -4
- package/dist/timeline/labels.js +122 -8
- package/dist/timeline/origin.d.ts +20 -6
- package/dist/timeline/origin.js +13 -6
- package/dist/timeline/render-text.js +1 -1
- package/dist/timeline/timeline.d.ts +76 -20
- package/dist/timeline/timeline.js +184 -39
- package/dist/timeline/util.d.ts +5 -0
- package/dist/timeline/util.js +44 -8
- package/dist/timeline/web-calls.d.ts +17 -0
- package/dist/timeline/web-calls.js +106 -0
- package/dist/tool-gate.d.ts +103 -76
- package/dist/tool-gate.js +200 -127
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +29 -0
- package/dist/tool-list.js +50 -0
- package/dist/tool-names.d.ts +76 -0
- package/dist/tool-names.js +101 -0
- package/dist/tool-plane.d.ts +34 -28
- package/dist/tool-plane.js +72 -37
- package/dist/tools.d.ts +59 -15
- package/dist/tools.js +46 -42
- package/dist/trigger-adapter.d.ts +85 -5
- package/dist/trigger-adapter.js +6 -0
- package/dist/trigger-adapters.js +3 -1
- package/dist/trigger-composio.d.ts +10 -0
- package/dist/trigger-composio.js +122 -0
- package/dist/trigger-email.d.ts +4 -0
- package/dist/trigger-email.js +228 -0
- package/dist/trigger-signatures.d.ts +6 -10
- package/dist/trigger-signatures.js +16 -16
- package/dist/trigger-targets.d.ts +1 -1
- package/dist/trigger-targets.js +4 -3
- package/dist/trigger-webhook.js +6 -4
- package/dist/triggers.d.ts +94 -9
- package/dist/triggers.js +263 -62
- package/dist/uploads.d.ts +9 -0
- package/dist/uploads.js +27 -0
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -50
- package/dist/web-fake.d.ts +56 -0
- package/dist/web-fake.js +102 -0
- package/dist/web-fetch-direct.d.ts +3 -0
- package/dist/web-fetch-direct.js +4 -1
- package/dist/web-fetch.d.ts +6 -8
- package/dist/web-fetch.js +10 -53
- package/dist/web-search.d.ts +51 -2
- package/dist/web-search.js +116 -18
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -1
- package/dist/workflow/node-runner.js +10 -2
- package/dist/workspace/archil-claim.d.ts +3 -0
- package/dist/workspace/archil-claim.js +9 -2
- package/dist/workspace/computer-deps.d.ts +25 -9
- package/dist/workspace/computer-deps.js +82 -38
- package/dist/workspace/computer-for-claim.d.ts +60 -4
- package/dist/workspace/computer-for-claim.js +203 -45
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-janitor.d.ts +10 -3
- package/dist/workspace/computer-janitor.js +96 -29
- package/dist/workspace/computer-kept.d.ts +82 -0
- package/dist/workspace/computer-kept.js +147 -0
- package/dist/workspace/computer-mcp.js +4 -3
- package/dist/workspace/computer-ports.d.ts +23 -3
- package/dist/workspace/computer-ports.js +115 -5
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
- package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +33 -1
- package/dist/workspace/resolve-computer.js +37 -16
- package/dist/workspace/revision-skills.d.ts +6 -2
- package/dist/workspace/revision-skills.js +12 -5
- package/dist/workspace/run-end-computers.d.ts +30 -0
- package/dist/workspace/run-end-computers.js +137 -0
- package/dist/workspace/run-tools.d.ts +40 -23
- package/dist/workspace/run-tools.js +46 -19
- package/dist/wrap-up.d.ts +35 -0
- package/dist/wrap-up.js +48 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +13 -9
- package/skills/agentrun-serve/SKILL.md +248 -10
- package/templates/README.md +220 -60
- package/templates/TOOLS.md +168 -0
- package/templates/code-review/agent.md +46 -16
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +3 -3
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
- package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
- package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
- package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +5 -4
- package/templates/code-review/skills/review/REVIEWER.md +5 -4
- package/templates/code-review/skills/review/SKILL.md +11 -6
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +5 -4
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +5 -4
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/host-calls.d.ts +0 -20
- package/dist/host-calls.js +0 -12
- package/dist/runner/adapters/pi-computer.d.ts +0 -7
- package/dist/runner/adapters/pi-computer.js +0 -43
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -38
- package/dist/tool-budget.js +0 -62
- package/dist/workspace/computer-script.d.ts +0 -37
- package/dist/workspace/computer-script.js +0 -138
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Native execution is metadata on the ordinary agent revision. Its source remains owned by the user.
|
|
2
|
+
import { isAbsolute } from 'node:path';
|
|
3
|
+
export const NATIVE_TOOL_BUDGET_UNSUPPORTED = 'Native connections cannot enforce the max_tool_calls limit recorded in this older revision. Save the definition without max_tool_calls and start a new run.';
|
|
4
|
+
export const NATIVE_MODEL_SETTINGS_UNSUPPORTED = 'Native connections use the model and thinking settings of the source project or profile configuration. Remove the AgentRun model and thinking overrides, configure them in the source CLI, and start a new run.';
|
|
5
|
+
export const NATIVE_EXECUTION_SETTINGS_UNSUPPORTED = 'Native connections use the source CLI configuration for tool permissions, grants, approval policy, model tiers and execution settings. AgentRun cannot apply these overrides or provide a different computer, sandbox, checkout or spending limit. Clear the unsupported settings, configure the source project or profile, and start a new run.';
|
|
6
|
+
/** Top-level AgentRun overrides are distinct from native.model, which describes source configuration. */
|
|
7
|
+
export function nativeModelOverrides(value) {
|
|
8
|
+
if (!value || typeof value !== 'object')
|
|
9
|
+
return [];
|
|
10
|
+
return ['model', 'thinking'].filter(field => value[field] !== undefined);
|
|
11
|
+
}
|
|
12
|
+
/** Only compatibility defaults are meaningful here; native.model/skills describe the source, not managed overrides.
|
|
13
|
+
* Read both public definitions and pinned stored bodies so canonicalization cannot hide an ignored restriction.
|
|
14
|
+
* Registration supplies its endpoint's selected runtime; other callers use the stored native binding alone. */
|
|
15
|
+
export function nativeExecutionOverrides(value, registrationRuntime) {
|
|
16
|
+
if (!value || typeof value !== 'object')
|
|
17
|
+
return [];
|
|
18
|
+
const body = value;
|
|
19
|
+
const object = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
20
|
+
const emptyObject = (v) => object(v) && Object.keys(v).length === 0;
|
|
21
|
+
const only = (v, key, expected) => object(v) && v[key] === expected && Object.keys(v).length === 1;
|
|
22
|
+
const fields = [];
|
|
23
|
+
const check = (field, accept, ...aliases) => {
|
|
24
|
+
if ([field, ...aliases].some(key => body[key] !== undefined && !accept(body[key])))
|
|
25
|
+
fields.push(field);
|
|
26
|
+
};
|
|
27
|
+
// Empty per-tool entries canonicalize to no setting too; they express no permission or provider override.
|
|
28
|
+
check('tool_settings', v => object(v) && Object.values(v).every(emptyObject), 'toolSettings');
|
|
29
|
+
check('tools', v => Array.isArray(v) && v.length === 0);
|
|
30
|
+
check('skills', v => emptyObject(v) || (Array.isArray(v) && v.length === 0));
|
|
31
|
+
check('approvals', v => v === 'ask');
|
|
32
|
+
check('model_tiers', emptyObject, 'modelTiers');
|
|
33
|
+
check('computer', v => only(v, 'kind', 'none'));
|
|
34
|
+
check('place', v => only(v, 'mode', 'runner'));
|
|
35
|
+
const runtime = registrationRuntime ?? (object(body.native) ? body.native.runtime : undefined);
|
|
36
|
+
// An explicit managed-to-native connection adopts the selected source harness. An already native definition may
|
|
37
|
+
// name that same harness, but cannot advertise a different one that native dispatch would ignore.
|
|
38
|
+
if (runtime === 'claude-code' || runtime === 'codex')
|
|
39
|
+
check('harness', v => v === (runtime === 'codex' ? 'codex' : 'claude-agent'));
|
|
40
|
+
check('checkout', v => v === 'none');
|
|
41
|
+
check('max_cost_usd', v => v === 0, 'maxCostUsd');
|
|
42
|
+
return fields;
|
|
43
|
+
}
|
|
44
|
+
/** Reject hand-edited references instead of launching in a guessed or relative directory. */
|
|
45
|
+
export function nativeBindingOf(value) {
|
|
46
|
+
const b = value;
|
|
47
|
+
if (b?.remote && (typeof b.remote.target_id !== 'string' || !/^rc_[a-f0-9]{32}$/.test(b.remote.connector_id) || !/^[\w.-]{1,160}$/.test(b.remote.target_id)))
|
|
48
|
+
throw new Error('Invalid remote native reference.');
|
|
49
|
+
if (!b || typeof b !== 'object' || !['claude-code', 'codex'].includes(b.runtime) || typeof b.project !== 'string' || !isAbsolute(b.project) || b.project.includes('\0') || typeof b.machine_id !== 'string' || !b.machine_id || !b.selector || !['project', 'agent', 'profile'].includes(b.selector.kind) || (b.selector.kind !== 'project' && (typeof b.selector.name !== 'string' || !/^[\w.@+-]{1,160}$/.test(b.selector.name))) || typeof b.connected !== 'boolean' || typeof b.fingerprint !== 'string' || !Array.isArray(b.configuration) || !Array.isArray(b.skills) || !Array.isArray(b.mcp_servers) || !Array.isArray(b.issues) || !b.capabilities)
|
|
50
|
+
throw new Error('Invalid native connection: connect the source project using /native/connect.');
|
|
51
|
+
// Keep the defined metadata only. Never persist arbitrary configuration, environment or credentials.
|
|
52
|
+
return { runtime: b.runtime, project: b.project, selector: { kind: b.selector.kind, ...(b.selector.name ? { name: b.selector.name } : {}) }, machine_id: b.machine_id, version: typeof b.version === 'string' ? b.version : null, model: typeof b.model === 'string' ? b.model : null, fingerprint: b.fingerprint, configuration: b.configuration.map(c => ({ path: c.path, sha256: c.sha256 })), skills: b.skills.filter(x => typeof x === 'string'), mcp_servers: b.mcp_servers.filter(x => typeof x === 'string'), state: b.state, issues: b.issues.filter(x => typeof x === 'string'), capabilities: { launch: !!b.capabilities.launch, notes: !!b.capabilities.notes, skills: !!b.capabilities.skills, workflows: false, approval: b.capabilities.approval === 'native' ? 'native' : 'unavailable', usage: !!b.capabilities.usage }, connected: b.connected, ...(typeof b.verified_at === 'string' ? { verified_at: b.verified_at } : {}), ...(b.remote ? { remote: { connector_id: b.remote.connector_id, target_id: b.remote.target_id } } : {}) };
|
|
53
|
+
}
|
|
54
|
+
export function nativeOf(body) {
|
|
55
|
+
const value = body?.native;
|
|
56
|
+
return value === undefined ? undefined : nativeBindingOf(value);
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { defaultData } from '../server-fs.js';
|
|
5
|
+
import { discoverNative } from './discovery.js';
|
|
6
|
+
import { nativeEnvironment } from './environment.js';
|
|
7
|
+
import { secret } from '../secrets.js';
|
|
8
|
+
/** Source-machine handoff: discovery never launches a model; connection uses the existing local server credential. */
|
|
9
|
+
export async function nativeMain(argv) {
|
|
10
|
+
try {
|
|
11
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { project: { type: 'string' }, runtime: { type: 'string' }, agent: { type: 'string' }, profile: { type: 'string' }, url: { type: 'string' }, 'base-url': { type: 'string' }, data: { type: 'string' }, json: { type: 'boolean' } } });
|
|
12
|
+
const operation = positionals[0];
|
|
13
|
+
if (!values.project || !['discover', 'connect'].includes(operation ?? ''))
|
|
14
|
+
throw new Error('usage: agentrun native discover|connect --project PATH [--runtime claude-code|codex] [--agent NAME|--profile NAME] [--url URL] [--data DIR]');
|
|
15
|
+
if (values.runtime !== undefined && !['claude-code', 'codex'].includes(values.runtime))
|
|
16
|
+
throw new Error('runtime must be claude-code or codex');
|
|
17
|
+
if (operation === 'discover') {
|
|
18
|
+
console.log(JSON.stringify(await discoverNative({ project: values.project, runtime: values.runtime, env: nativeEnvironment() }), null, 2));
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
if (!values.runtime)
|
|
22
|
+
throw new Error('connect requires --runtime claude-code or codex');
|
|
23
|
+
if (values.agent && values.profile)
|
|
24
|
+
throw new Error('Choose --agent or --profile, never both.');
|
|
25
|
+
const data = values.data ?? defaultData();
|
|
26
|
+
let recorded;
|
|
27
|
+
try {
|
|
28
|
+
const record = JSON.parse(await readFile(join(data, '.server.json'), 'utf8'));
|
|
29
|
+
if (typeof record.base_url === 'string')
|
|
30
|
+
recorded = record.base_url;
|
|
31
|
+
}
|
|
32
|
+
catch { /* explicit/default URL below */ }
|
|
33
|
+
const url = new URL(values.url ?? values['base-url'] ?? process.env.AGENTRUN_BASE_URL ?? process.env.AGENTRUN_URL ?? recorded ?? 'http://127.0.0.1:7340');
|
|
34
|
+
if (!['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))
|
|
35
|
+
throw new Error('Run AgentRun on this source machine and connect to its loopback URL; hosted native pairing is not available yet.');
|
|
36
|
+
const token = secret('AGENTRUN_API_KEY') || secret('AGENTRUN_TOKEN') || (await readFile(join(data, '.token'), 'utf8')).trim();
|
|
37
|
+
const response = await fetch(new URL('/v2/native/connect', url), { method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, body: JSON.stringify({ project: values.project, runtime: values.runtime, selector: values.agent ? { kind: 'agent', name: values.agent } : values.profile ? { kind: 'profile', name: values.profile } : { kind: 'project' } }) });
|
|
38
|
+
const body = await response.json();
|
|
39
|
+
if (!response.ok)
|
|
40
|
+
throw new Error(body.error?.message ?? `Connection failed (${response.status})`);
|
|
41
|
+
console.log(JSON.stringify(body, null, 2));
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(`agentrun native: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
|
+
return 2;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AgentEntry } from '../agents-store.js';
|
|
2
|
+
import type { Store } from '../store/store.js';
|
|
3
|
+
import type { NativeBinding, NativeTarget } from './types.js';
|
|
4
|
+
export declare function selectedNative(input: unknown, env?: NodeJS.ProcessEnv): Promise<NativeTarget>;
|
|
5
|
+
export declare function connectNative(store: Store, input: unknown, env?: NodeJS.ProcessEnv): Promise<AgentEntry>;
|
|
6
|
+
export declare function updateNative(store: Store, entry: AgentEntry, native: NativeBinding): Promise<AgentEntry>;
|
|
7
|
+
export declare function verifyConnection(store: Store, entry: AgentEntry, env?: NodeJS.ProcessEnv): Promise<AgentEntry>;
|
|
8
|
+
export declare function launchNative(binding: NativeBinding, env?: NodeJS.ProcessEnv): Promise<NativeBinding>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { nativeEnvironment } from "./environment.js";
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
import { ApiError, invalid } from '../errors.js';
|
|
4
|
+
import { createAgent, commitAgent, getAgent, definitionOf } from '../agents-store.js';
|
|
5
|
+
import { nativeOf, nativeModelOverrides, nativeExecutionOverrides, NATIVE_MODEL_SETTINGS_UNSUPPORTED, NATIVE_EXECUTION_SETTINGS_UNSUPPORTED } from './binding.js';
|
|
6
|
+
import { discoverNative, nativeIdentity, verifyNative } from './discovery.js';
|
|
7
|
+
import { snapshotNativeInstructions } from './instructions.js';
|
|
8
|
+
export async function selectedNative(input, env = nativeEnvironment()) {
|
|
9
|
+
const b = input;
|
|
10
|
+
if (!b || typeof b.project !== 'string' || !['claude-code', 'codex'].includes(String(b.runtime)))
|
|
11
|
+
throw new ApiError('input_invalid', 'Choose a source project and Claude Code or Codex.');
|
|
12
|
+
const report = await discoverNative({ project: b.project, runtime: b.runtime, env });
|
|
13
|
+
const selector = b.selector ?? { kind: 'project' };
|
|
14
|
+
const found = report.targets.find(t => t.selector.kind === selector.kind && t.selector.name === selector.name);
|
|
15
|
+
if (!found)
|
|
16
|
+
throw new ApiError('input_invalid', 'That native agent or profile was not discovered in this project. Discover again.');
|
|
17
|
+
return found;
|
|
18
|
+
}
|
|
19
|
+
export async function connectNative(store, input, env = nativeEnvironment()) {
|
|
20
|
+
const overrides = nativeModelOverrides(input);
|
|
21
|
+
if (overrides.length)
|
|
22
|
+
throw invalid(overrides.map(field => ({ field, reason: 'not_allowed', message: NATIVE_MODEL_SETTINGS_UNSUPPORTED })));
|
|
23
|
+
const execution = nativeExecutionOverrides(input, input?.runtime);
|
|
24
|
+
if (execution.length)
|
|
25
|
+
throw invalid(execution.map(field => ({ field, reason: 'not_allowed', message: NATIVE_EXECUTION_SETTINGS_UNSUPPORTED })));
|
|
26
|
+
const target = await selectedNative(input, env);
|
|
27
|
+
const id = `native-${nativeIdentity(target).replace(/^native-/, '').slice(0, 40)}`;
|
|
28
|
+
const before = await getAgent(store, id);
|
|
29
|
+
const old = before && nativeOf(before.revision?.body);
|
|
30
|
+
const native = { ...target, connected: true, ...(old?.fingerprint === target.fingerprint && old.verified_at ? { state: old.state, verified_at: old.verified_at } : {}) };
|
|
31
|
+
if (before)
|
|
32
|
+
return updateNative(store, before, native);
|
|
33
|
+
try {
|
|
34
|
+
return await createAgent(store, { definition: { id, name: `${basename(target.project)}${target.selector.name ? ` · ${target.selector.name}` : ''}`, instructions: '', harness: target.runtime === 'claude-code' ? 'claude-agent' : 'codex', place: { mode: 'runner' }, tools: [], learning: false, native }, skills: {} });
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (error instanceof ApiError && error.code === 'agent_exists') {
|
|
38
|
+
const entry = await getAgent(store, id);
|
|
39
|
+
if (entry)
|
|
40
|
+
return updateNative(store, entry, native);
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function updateNative(store, entry, native) {
|
|
46
|
+
const before = definitionOf(entry.agent, entry.revision, entry.version);
|
|
47
|
+
const old = nativeOf(entry.revision?.body), execution = nativeExecutionOverrides(entry.revision?.body);
|
|
48
|
+
// Disconnect must remain possible, retaining these execution restrictions. Reconnect/conversion must never erase
|
|
49
|
+
// a denial or isolation setting to make the source CLI launchable.
|
|
50
|
+
if (native.connected && execution.length)
|
|
51
|
+
throw invalid(execution.map(field => ({ field: `definition.${field}`, reason: 'not_allowed', message: NATIVE_EXECUTION_SETTINGS_UNSUPPORTED })));
|
|
52
|
+
const overrides = nativeModelOverrides(before);
|
|
53
|
+
// A managed definition must explicitly remove its supported settings before conversion. Native connection
|
|
54
|
+
// management instead normalizes obsolete ignored overrides; it never edits the source CLI configuration.
|
|
55
|
+
if (!nativeOf(entry.revision?.body) && overrides.length)
|
|
56
|
+
throw invalid(overrides.map(field => ({ field: `definition.${field}`, reason: 'not_allowed', message: NATIVE_MODEL_SETTINGS_UNSUPPORTED })));
|
|
57
|
+
const { version: _version, model: _model, thinking: _thinking, harness: _harness, ...definition } = before;
|
|
58
|
+
// The rendered definition supplies a default harness even when none was stored. Preserve the actual native field
|
|
59
|
+
// on disconnect. Reconnect fills an absent legacy harness; managed conversion adopts the selected source harness.
|
|
60
|
+
const sourceHarness = native.runtime === 'claude-code' ? 'claude-agent' : 'codex';
|
|
61
|
+
const harness = old ? (entry.revision.body.harness ?? (native.connected ? sourceHarness : undefined)) : sourceHarness;
|
|
62
|
+
return commitAgent(store, entry, { definition: { ...definition, ...(harness ? { harness } : {}), native } }, { ifCurrent: entry.revision?.id ?? null });
|
|
63
|
+
}
|
|
64
|
+
export async function verifyConnection(store, entry, env = nativeEnvironment()) {
|
|
65
|
+
const before = nativeOf(entry.revision?.body);
|
|
66
|
+
if (!before)
|
|
67
|
+
throw new ApiError('not_found', 'This agent has no native connection.');
|
|
68
|
+
const execution = nativeExecutionOverrides(entry.revision?.body);
|
|
69
|
+
if (execution.length)
|
|
70
|
+
throw invalid(execution.map(field => ({ field: `definition.${field}`, reason: 'not_allowed', message: NATIVE_EXECUTION_SETTINGS_UNSUPPORTED })));
|
|
71
|
+
const target = await selectedNative(before, env);
|
|
72
|
+
const native = await verifyNative(target, { env });
|
|
73
|
+
if (native.state === 'ready') {
|
|
74
|
+
const snapshot = await snapshotNativeInstructions(native);
|
|
75
|
+
if (snapshot.incomplete || snapshot.truncated) {
|
|
76
|
+
native.capabilities = { ...native.capabilities, notes: false, skills: false };
|
|
77
|
+
native.issues.push(`Self-improvement is unavailable: ${snapshot.incomplete ?? 'the declared native instruction files exceed the 64 KiB grading evidence limit.'} Native jobs remain available; no incomplete policy is automatically graded.`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return updateNative(store, entry, { ...native, connected: before.connected });
|
|
81
|
+
}
|
|
82
|
+
export async function launchNative(binding, env = nativeEnvironment()) {
|
|
83
|
+
if (binding.remote)
|
|
84
|
+
throw new ApiError('agent_not_runnable', 'This source target must run through its remote connector, never on the server filesystem.');
|
|
85
|
+
if (!binding.connected)
|
|
86
|
+
throw new ApiError('agent_not_runnable', 'This native connection is disconnected. Reconnect its source project.');
|
|
87
|
+
const fresh = await selectedNative(binding, env);
|
|
88
|
+
if (fresh.machine_id !== binding.machine_id)
|
|
89
|
+
throw new ApiError('agent_not_runnable', 'The source machine is offline or this runner is on another machine. Start AgentRun on the source machine.');
|
|
90
|
+
const checked = await verifyNative(fresh, { env });
|
|
91
|
+
if (checked.state !== 'ready' || !checked.capabilities.launch)
|
|
92
|
+
throw new ApiError('agent_not_runnable', checked.issues.join(' ') || 'Verify the native sign-in on the source machine.');
|
|
93
|
+
return { ...checked, connected: true };
|
|
94
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Additive files under AgentRun's private per-run directory. Native settings and project files are never changed.
|
|
2
|
+
* Relative skill resources stay beside SKILL.md. Reading/executing them still requires native tool permission. */
|
|
3
|
+
export declare function nativeSkillContext(root: string, skills: readonly {
|
|
4
|
+
name: string;
|
|
5
|
+
files?: Record<string, string>;
|
|
6
|
+
}[]): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, resolve, sep } from 'node:path';
|
|
3
|
+
/** Additive files under AgentRun's private per-run directory. Native settings and project files are never changed.
|
|
4
|
+
* Relative skill resources stay beside SKILL.md. Reading/executing them still requires native tool permission. */
|
|
5
|
+
export async function nativeSkillContext(root, skills) {
|
|
6
|
+
const sections = [];
|
|
7
|
+
for (const skill of skills) {
|
|
8
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(skill.name))
|
|
9
|
+
throw new Error('Unsafe learned skill name.');
|
|
10
|
+
const base = resolve(root, skill.name);
|
|
11
|
+
await mkdir(base, { recursive: true, mode: 0o700 });
|
|
12
|
+
for (const [path, content] of Object.entries(skill.files ?? {})) {
|
|
13
|
+
const target = resolve(base, path);
|
|
14
|
+
if (!target.startsWith(base + sep) || path.includes('\\'))
|
|
15
|
+
throw new Error('Unsafe learned skill resource path.');
|
|
16
|
+
await mkdir(dirname(target), { recursive: true, mode: 0o700 });
|
|
17
|
+
await writeFile(target, content, { mode: 0o600, flag: 'wx' });
|
|
18
|
+
}
|
|
19
|
+
sections.push(`## AgentRun learned skill: ${skill.name}\nSkill directory: ${base}\nResolve this skill's relative references from that directory, not the project. Use absolute paths for its resources. Native permissions still apply; if unavailable, report that limitation.\n\n${skill.files?.['SKILL.md'] ?? ''}`);
|
|
20
|
+
}
|
|
21
|
+
return sections.join('\n\n');
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ApiError } from "../errors.js";
|
|
2
|
+
export { NATIVE_MINIMUM_VERSION } from "./runtimes.js";
|
|
3
|
+
import type { NativeBinding, NativeRuntime, NativeTarget } from "./types.js";
|
|
4
|
+
export declare class NativeDiscoveryError extends ApiError {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
/** Resolve only through the supplied native PATH. Never substitutes a bundled managed runtime. */
|
|
8
|
+
export declare function nativeExecutable(runtime: NativeRuntime, env?: NodeJS.ProcessEnv): Promise<string | null>;
|
|
9
|
+
/** Metadata commands are bounded and never contain a prompt or a launch command. */
|
|
10
|
+
export declare function nativeMetadata(binary: string, args: string[], cwd: string, env: NodeJS.ProcessEnv, timeoutMs?: number): Promise<{
|
|
11
|
+
code: number | null;
|
|
12
|
+
stdout: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function nativeIdentity(target: Pick<NativeTarget, "runtime" | "project" | "selector" | "machine_id">): string;
|
|
15
|
+
export declare function discoverNative(options: {
|
|
16
|
+
project: string;
|
|
17
|
+
runtime?: NativeRuntime;
|
|
18
|
+
env?: NodeJS.ProcessEnv;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
machine_id: string;
|
|
21
|
+
targets: NativeTarget[];
|
|
22
|
+
}>;
|
|
23
|
+
/** Checks installed CLI and local sign-in only; this never launches a model or project hooks. */
|
|
24
|
+
export declare function verifyNative(target: NativeTarget | NativeBinding, options?: {
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
}): Promise<NativeBinding>;
|