@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/templates.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { GitHubConnectionView } from "./github-connection.js";
|
|
|
4
4
|
import { type Tier } from "./model.js";
|
|
5
5
|
import { type PinValue } from "./tool-gate.js";
|
|
6
6
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
7
|
+
import { type FileSetting } from "./filed-tool.js";
|
|
7
8
|
import { type Json } from "./validate.js";
|
|
8
9
|
import { type Approvals } from "./approvals.js";
|
|
9
10
|
import { type LearningSetting } from "./learning-setting.js";
|
|
@@ -53,7 +54,10 @@ export declare const MAX_EVAL_FILE_BYTES: number;
|
|
|
53
54
|
* sets a permission: an apply's `grants`, the owner's ticks, grant the tools, and each call follows this server's tool settings
|
|
54
55
|
* (a write asks unless the owner allowed it there, a read follows the server's Allow reads, approvals never lifts an ask). `pin`, by tool: the arguments each of its calls must carry (a value, or
|
|
55
56
|
* `${parameters.<name>}`), which apply writes as the tool's pin in the agent's tool settings, so a send goes only to the
|
|
56
|
-
* destination the owner set.
|
|
57
|
+
* destination the owner set. `file`, by tool: where each of its answers is filed whole in the run's files and the paths of it
|
|
58
|
+
* the tool's result shows (filed-tool.ts), which apply writes as the tool's file setting in the agent's tool settings, so
|
|
59
|
+
* the tool's result is a summary, never the answer (the model's own file tools can still open the folder). Absent when
|
|
60
|
+
* the package files none. */
|
|
57
61
|
export type McpNeed = {
|
|
58
62
|
source: McpSource;
|
|
59
63
|
toolkit: string;
|
|
@@ -62,6 +66,7 @@ export type McpNeed = {
|
|
|
62
66
|
reason?: string;
|
|
63
67
|
allow: string[];
|
|
64
68
|
pin: Record<string, Record<string, PinValue>>;
|
|
69
|
+
file?: Record<string, FileSetting>;
|
|
65
70
|
};
|
|
66
71
|
/** One of a package's model choices (manifest `model.choices`): a model and the harness it runs on, which an owner picks
|
|
67
72
|
* by `id` at install (apply's overrides.choice) in place of the package's tier and preference. `label` names it on the
|
|
@@ -121,7 +126,8 @@ export type Package = {
|
|
|
121
126
|
choices?: ModelChoice[];
|
|
122
127
|
};
|
|
123
128
|
effort?: string;
|
|
124
|
-
/** Absent, the tools the server gives a new agent that names none
|
|
129
|
+
/** Absent, the tools the server gives a new agent that names none; with no `computer` list either, its apply is the
|
|
130
|
+
* create that gets Docker's box, refused where that box is not here and the runner has no shell (server.ts saveable). */
|
|
125
131
|
tools?: string[];
|
|
126
132
|
/** MCP servers by their source and toolkit, and the tools of each the agent is granted. One `required` refuses an apply
|
|
127
133
|
* on a server that has saved none that matches; any other is skipped there, with a warning. */
|
|
@@ -304,6 +310,7 @@ export declare function packageView(p: Package): {
|
|
|
304
310
|
required: boolean;
|
|
305
311
|
reason: string | null;
|
|
306
312
|
tools: {
|
|
313
|
+
file?: FileSetting | undefined;
|
|
307
314
|
pin?: Record<string, PinValue> | undefined;
|
|
308
315
|
name: string;
|
|
309
316
|
tool: string;
|
|
@@ -378,6 +385,7 @@ export declare function packageDetail<Pick>(p: Package, computerHere: (p: Packag
|
|
|
378
385
|
required: boolean;
|
|
379
386
|
reason: string | null;
|
|
380
387
|
tools: {
|
|
388
|
+
file?: FileSetting | undefined;
|
|
381
389
|
pin?: Record<string, PinValue> | undefined;
|
|
382
390
|
name: string;
|
|
383
391
|
tool: string;
|
package/dist/templates.js
CHANGED
|
@@ -23,6 +23,7 @@ import { isPinKeys } from "./tool-gate.js";
|
|
|
23
23
|
import { formatToolName, isMcpName, isMonidName, MCP_SERVER_NAME, MCP_TOOL_NAME, mcpToolName, MONID_NAME_WORDS, parseToolName } from "./tool-names.js";
|
|
24
24
|
import { pinIssues, sortedPin } from "./tool-plane.js";
|
|
25
25
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
26
|
+
import { fileIssues } from "./filed-tool.js";
|
|
26
27
|
import { BOUND_TOOLS, toolOf } from "./tools.js";
|
|
27
28
|
import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
|
|
28
29
|
import { MOVE_FIELD } from "./trigger-composio.js";
|
|
@@ -311,6 +312,25 @@ function pinOf(pin, server, tools, at, bad) {
|
|
|
311
312
|
}
|
|
312
313
|
return out;
|
|
313
314
|
}
|
|
315
|
+
/** An mcp entry's `file` read: by tool, each one of the entry's `tools`, its setting checked by the one rule every file
|
|
316
|
+
* setting is (filed-tool.ts fileIssues). Each problem is told through `bad`; a tool whose setting reads is kept. */
|
|
317
|
+
function fileOf(file, tools, at, bad) {
|
|
318
|
+
const out = {};
|
|
319
|
+
if (!isObject(file))
|
|
320
|
+
return bad(`${at} is {<tool>: {folder, show}}, by the entry's tools: each answer of the tool is filed whole in that folder of the run's files, and the tool's result shows only the values at the show paths and the answer's shape`), out;
|
|
321
|
+
for (const [tool, setting] of Object.entries(file)) {
|
|
322
|
+
if (!tools.includes(tool)) {
|
|
323
|
+
bad(`${at}.${tool}: ${tool} is not one of this entry's tools (${tools.join(", ")}): a file setting files the answers of a tool the package lists`);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const issues = fileIssues(setting, `${at}.${tool}`);
|
|
327
|
+
for (const issue of issues)
|
|
328
|
+
bad(issue.message);
|
|
329
|
+
if (!issues.length)
|
|
330
|
+
out[tool] = { folder: setting.folder, show: [...setting.show] };
|
|
331
|
+
}
|
|
332
|
+
return out;
|
|
333
|
+
}
|
|
314
334
|
/** A pin's scalar filled from the apply's `given` parameters (typedFilled: an integer pins an integer), a list's items
|
|
315
335
|
* as text. `empty`: the parameters its placeholders name that were given no value (absent, or ""), so the pin cannot
|
|
316
336
|
* hold what the owner meant. */
|
|
@@ -645,8 +665,9 @@ export function readPackage(from, { evalFixtures = true } = {}) {
|
|
|
645
665
|
const names = isObject(need) && Array.isArray(need.tools) ? need.tools : [];
|
|
646
666
|
const allow = isObject(need) && need.allow !== undefined ? need.allow : [];
|
|
647
667
|
const pin = isObject(need) && need.pin !== undefined ? need.pin : {};
|
|
668
|
+
const file = isObject(need) && need.file !== undefined ? need.file : undefined;
|
|
648
669
|
const reason = isObject(need) ? need.reason : undefined;
|
|
649
|
-
const ok = isObject(need) && !unknownFields(need, ["source", "toolkit", "tools", "required", "reason", "allow", "pin"]).length && MCP_SOURCES.includes(need.source) && typeof need.toolkit === "string" && MCP_SERVER_NAME.test(need.toolkit)
|
|
670
|
+
const ok = isObject(need) && !unknownFields(need, ["source", "toolkit", "tools", "required", "reason", "allow", "pin", "file"]).length && MCP_SOURCES.includes(need.source) && typeof need.toolkit === "string" && MCP_SERVER_NAME.test(need.toolkit)
|
|
650
671
|
&& names.length > 0 && names.every((tool) => typeof tool === "string" && MCP_TOOL_NAME.test(tool)) && new Set(names).size === names.length && (need.required === undefined || typeof need.required === "boolean")
|
|
651
672
|
&& (reason === undefined || (typeof reason === "string" && reason.trim() !== "" && reason.length <= MAX_REASON && !/[\r\n]/.test(reason)))
|
|
652
673
|
&& Array.isArray(allow) && allow.every((tool) => names.includes(tool)) && new Set(allow).size === allow.length;
|
|
@@ -655,14 +676,15 @@ export function readPackage(from, { evalFixtures = true } = {}) {
|
|
|
655
676
|
if (isObject(need) && need.toolkit !== undefined && (typeof need.toolkit !== "string" || !MCP_SERVER_NAME.test(need.toolkit)))
|
|
656
677
|
bad(MANIFEST, `mcp[${i}].toolkit ${JSON.stringify(need.toolkit)} is not a toolkit name: ${MCP_SERVER_NAME.source}, the MCP server name rule, since the package names its tools mcp:<toolkit>/<tool>`);
|
|
657
678
|
else if (!ok)
|
|
658
|
-
bad(MANIFEST, `mcp[${i}] is {source: ${MCP_SOURCES.join(" | ")}, toolkit: the toolkit its tools come from, the name the package calls them by (mcp:<toolkit>/<tool>, ${MCP_SERVER_NAME.source}), tools: its tool names (${MCP_TOOL_NAME.source}), none twice, required?: true or false, reason?: one line of at most ${MAX_REASON} characters on why the agent needs them, allow?: the tools of its tools it asks the owner to allow, pin?: {<tool>: {<argument>: <value>}}}`);
|
|
679
|
+
bad(MANIFEST, `mcp[${i}] is {source: ${MCP_SOURCES.join(" | ")}, toolkit: the toolkit its tools come from, the name the package calls them by (mcp:<toolkit>/<tool>, ${MCP_SERVER_NAME.source}), tools: its tool names (${MCP_TOOL_NAME.source}), none twice, required?: true or false, reason?: one line of at most ${MAX_REASON} characters on why the agent needs them, allow?: the tools of its tools it asks the owner to allow, pin?: {<tool>: {<argument>: <value>}}, file?: {<tool>: {folder, show}}}`);
|
|
659
680
|
else if (need.source === "github" && need.toolkit !== "github")
|
|
660
681
|
bad(MANIFEST, `mcp[${i}]: a github source's toolkit is github (GitHub's MCP server), not ${need.toolkit}`);
|
|
661
682
|
else if (mcp.some((m) => m.toolkit === need.toolkit))
|
|
662
683
|
bad(MANIFEST, `mcp[${i}]: the toolkit ${need.toolkit} is listed twice: its tools are all mcp:${need.toolkit}/<tool>, so they are one entry`);
|
|
663
684
|
else {
|
|
664
685
|
const pinned = pinOf(pin, need.toolkit, names, `mcp[${i}].pin`, (message) => bad(MANIFEST, message));
|
|
665
|
-
|
|
686
|
+
const filed = file === undefined ? undefined : fileOf(file, names, `mcp[${i}].file`, (message) => bad(MANIFEST, message));
|
|
687
|
+
mcp.push({ source: need.source, toolkit: need.toolkit, tools: names, required: need.required === true, ...(typeof reason === "string" ? { reason } : {}), allow: allow, pin: pinned, ...(filed && Object.keys(filed).length ? { file: filed } : {}) });
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
690
|
// A policy by tool: bash's alone (bash-read-only.ts), on a package that grants bash or names no tools (a new agent's
|
|
@@ -1054,7 +1076,7 @@ export function packageView(p) {
|
|
|
1054
1076
|
category: p.category ?? null, tags: p.tags,
|
|
1055
1077
|
output: p.output ? { schema: p.output.schema, json_schema: p.outputSchema ?? null } : null,
|
|
1056
1078
|
harness: p.harness ?? null, model: modelView(p.model), effort: p.effort ?? null, tools: p.tools ?? null, tool_policy: p.toolPolicy ?? null, computer: p.computer ?? null, needs: p.needs ?? null, checkout: p.checkout ?? null,
|
|
1057
|
-
mcp: p.mcp.map(({ source, toolkit, tools, required, reason, allow, pin }) => ({ source, toolkit, required, reason: reason ?? null, tools: tools.map((name) => ({ name, tool: mcpToolName(toolkit, name), asks: allow.includes(name) ? "allow" : "ask", ...(Object.hasOwn(pin, name) ? { pin: pin[name] } : {}) })) })), parameters: p.parameters, input_schema: p.inputSchema ?? null, secrets: p.secrets,
|
|
1079
|
+
mcp: p.mcp.map(({ source, toolkit, tools, required, reason, allow, pin, file }) => ({ source, toolkit, required, reason: reason ?? null, tools: tools.map((name) => ({ name, tool: mcpToolName(toolkit, name), asks: allow.includes(name) ? "allow" : "ask", ...(Object.hasOwn(pin, name) ? { pin: pin[name] } : {}), ...(file && Object.hasOwn(file, name) ? { file: file[name] } : {}) })) })), parameters: p.parameters, input_schema: p.inputSchema ?? null, secrets: p.secrets,
|
|
1058
1080
|
budget: p.budget ?? null, learning: p.learning ?? false, approvals_default: p.approvals ?? "ask", triggers: p.triggers, skills: Object.keys(p.skills).filter((path) => /^[^/]+\/SKILL\.md$/.test(path)).map((path) => path.slice(0, -"/SKILL.md".length)), evals: p.evals,
|
|
1059
1081
|
};
|
|
1060
1082
|
}
|
|
@@ -1353,6 +1375,11 @@ export function compiled(p, parameters, chosen, _deps) {
|
|
|
1353
1375
|
else
|
|
1354
1376
|
settings[name] = { ...settings[name], pin: sortedPin(pin) };
|
|
1355
1377
|
}
|
|
1378
|
+
// A tool's file setting, written as the package states it, ticked or not (it holds once the tool is granted later), as
|
|
1379
|
+
// a pin is: the tool's result is a summary of each answer, never the answer.
|
|
1380
|
+
for (const { server, file } of chosen.mcp)
|
|
1381
|
+
for (const [tool, setting] of Object.entries(file ?? {}))
|
|
1382
|
+
settings[mcpToolName(server, tool)] = { ...settings[mcpToolName(server, tool)], file: { folder: setting.folder, show: [...setting.show] } };
|
|
1356
1383
|
const definition = {
|
|
1357
1384
|
name: p.displayName ? filled(p.displayName, parameters) : p.name, description: p.description, instructions: filled(p.instructions, parameters),
|
|
1358
1385
|
...(chosen.harness ? { harness: chosen.harness } : {}), ...(chosen.model ? { model: chosen.model } : {}), ...(chosen.modelTiers && Object.keys(chosen.modelTiers).length ? { model_tiers: chosen.modelTiers } : {}), ...(p.effort ? { thinking: p.effort } : {}),
|
|
@@ -71,7 +71,7 @@ export declare function foldLabel(tool: string, calls: readonly {
|
|
|
71
71
|
path?: (path: string) => string;
|
|
72
72
|
}): string;
|
|
73
73
|
/** The input worth showing: the base keys first, then the browser and file ones, and last the app a computer's look or act
|
|
74
|
-
* names (never what an act types: its steps; nor a codemode script, which can hold it). */
|
|
74
|
+
* names (never what an act types: its steps; nor a codemode script, which can hold it), then a search's objective. */
|
|
75
75
|
export declare function inputPreview(args: Obj, max: number): string | null;
|
|
76
76
|
/** Files a finished call put in the workspace. */
|
|
77
77
|
export declare function savedPaths(tool: string, args: Obj, result: ToolResultView): string[];
|
package/dist/timeline/labels.js
CHANGED
|
@@ -68,9 +68,9 @@ export function foldLabel(tool, calls, options = {}) {
|
|
|
68
68
|
return subjects.length ? `${head}: ${list(subjects)}` : head;
|
|
69
69
|
}
|
|
70
70
|
/** The input worth showing: the base keys first, then the browser and file ones, and last the app a computer's look or act
|
|
71
|
-
* names (never what an act types: its steps; nor a codemode script, which can hold it). */
|
|
71
|
+
* names (never what an act types: its steps; nor a codemode script, which can hold it), then a search's objective. */
|
|
72
72
|
export function inputPreview(args, max) {
|
|
73
|
-
for (const key of ["description", "command", "query", "file_path", "url", "path", "code", "app"]) {
|
|
73
|
+
for (const key of ["description", "command", "query", "file_path", "url", "path", "code", "app", "objective"]) {
|
|
74
74
|
const value = str(args[key]);
|
|
75
75
|
if (value)
|
|
76
76
|
return cut(scrubUrls(value), max);
|
|
@@ -150,7 +150,8 @@ const fromHost = (a) => {
|
|
|
150
150
|
registerLabel("web_save", (a, result) => `${unfetched(result) ? "Tried to save" : "Saved"} ${savedAt(a, result)}${fromHost(a)}`, { many: (n) => `Saved ${n} files from the web`, subject: (input) => input ?? undefined }, { name: "Save files from the web" });
|
|
151
151
|
registerOutcome("web_save", fetchOutcome);
|
|
152
152
|
registerLabel("web_search", (a) => {
|
|
153
|
-
|
|
153
|
+
// Its first keyword query, else its objective, else the deprecated query alone.
|
|
154
|
+
const query = (Array.isArray(a.queries) ? a.queries.map(str).find(Boolean) : undefined) ?? str(a.objective) ?? str(a.query);
|
|
154
155
|
return query ? `Searched the web for "${cut(scrubUrls(query), 60)}"` : "Searched the web";
|
|
155
156
|
}, { many: (n) => `Searched the web ${n} times`, subject: (input) => (input ? `"${cut(input, 40)}"` : undefined) }, { name: "Search the web" });
|
|
156
157
|
// web_search answers its results and a line asking for citations, or `{error}` when the search gave no answer: failed.
|
|
@@ -53,7 +53,8 @@ export type TimelineEvent = {
|
|
|
53
53
|
paused?: true;
|
|
54
54
|
/** `true` on the `tool_result` row of a call refused before it ran (its host's mark, CALL_REFUSED: a gate's deny, a
|
|
55
55
|
* person's, a call held for an approval the run ended or stopped without): it never ran, so it never failed, though
|
|
56
|
-
* `tool_status` stays `failed` (it did not do its work). A client shows it apart from a call that ran and failed.
|
|
56
|
+
* `tool_status` stays `failed` (it did not do its work). A client shows it apart from a call that ran and failed. Also
|
|
57
|
+
* on a script's (codemode) or a tools_call's row that stopped at such a call (its host tool answered `refused`). */
|
|
57
58
|
refused?: true;
|
|
58
59
|
/** On the usage row, the run's cost. On a paid tool's charge row (a `phase` naming the tool), that charge alone. On a
|
|
59
60
|
* browser call's `tool_use` row, every browser charge booked under that call (BROWSER_CHARGE): its session's time
|
|
@@ -92,8 +93,10 @@ export type TimelineEvent = {
|
|
|
92
93
|
* counts the calls past the record's bound. This projector writes none (store-reads/journal.ts withComputerCalls). */
|
|
93
94
|
computer_calls?: readonly ComputerCallRow[];
|
|
94
95
|
computer_calls_dropped?: number;
|
|
95
|
-
/** On a `tool_use` row of a timeline read with `calls` (TimelineOptions): the call's arguments, each string as
|
|
96
|
-
* makes it
|
|
96
|
+
/** On a `tool_use` row of a timeline read with `calls` (TimelineOptions): the call's arguments, each string as
|
|
97
|
+
* `calls.input` makes it of the arguments as the call came (else as the rows show them), its names and values
|
|
98
|
+
* together cut at `calls.result` characters (inputShown), the bound its output has (a grader reads a long write whole: an issue body, a note, a
|
|
99
|
+
* posted digest). Absent when `holds` withholds them whole. */
|
|
97
100
|
tool_input?: Obj;
|
|
98
101
|
/** On a `tool_result` row of a timeline read with `calls`: the call's output whole to `calls.result` characters (its
|
|
99
102
|
* head past that), as `calls.redact` makes it, its URLs' query values elided as the preview's are; a web call's every
|
|
@@ -133,7 +136,8 @@ export declare const CAPS: {
|
|
|
133
136
|
* web_search's every result keeps its url, title and published date, and a web_fetch its url and title, their snippets
|
|
134
137
|
* and page text cut to fit (web-calls.ts), past this only when its urls alone pass it. */
|
|
135
138
|
export declare const CALL_RESULT_CHARS = 120000;
|
|
136
|
-
/** The most rows a `calls=whole` timeline page holds, and its default: each row's result
|
|
139
|
+
/** The most rows a `calls=whole` timeline page holds, and its default: each row's result, or the names, values and
|
|
140
|
+
* brackets of its call's arguments together (tool_input, inputShown), may be CALL_RESULT_CHARS long. */
|
|
137
141
|
export declare const CALLS_PAGE_ROWS = 100;
|
|
138
142
|
/** A host's marks of a model request: as it leaves (written before it does), and as its stream ends aborted. A request
|
|
139
143
|
* that answered or failed has a `pi.assistant` entry; one aborted before its first content has none; a start with no
|
|
@@ -282,22 +286,30 @@ export type TimelineOptions = {
|
|
|
282
286
|
* this for the full protection: a key a stream wraps with only part of its tail streamed is covered by a held-back
|
|
283
287
|
* tail as long as a key, not by the word holdback. */
|
|
284
288
|
redactLive?: (text: string) => string;
|
|
289
|
+
/** Whether a text holds a held value no cut in place takes (key-refusal.ts withheldWhole, whose join view reads a
|
|
290
|
+
* JSON text's strings joined, property names among them). Read in every read, with `calls` or without, before any
|
|
291
|
+
* row shows what it reads: a call's arguments, each string of which `redact` reads on its own, are read with it as
|
|
292
|
+
* their JSON (argsOf), and a web call's output as it came (web-calls.ts webHeld). A value split across two of their
|
|
293
|
+
* strings, or across a property name and its value, which `redact` and `calls.redact` never read side by side,
|
|
294
|
+
* withholds them whole: the call's rows read it as one with no arguments, or its output's preview, summary and a
|
|
295
|
+
* `calls` read's text read "[redacted]". Default: none withheld. */
|
|
296
|
+
holds?: (text: string) => boolean;
|
|
285
297
|
/** For a reader that grades the run (a template eval): each `tool_use` row carries its call's arguments whole
|
|
286
298
|
* (`tool_input`), and each `tool_result` row the head of its output to `result` characters (`tool_result_text`; a
|
|
287
299
|
* web call's every url, each of its strings redacted on its own), made safe by `redact`, a redactor that reads that
|
|
288
300
|
* far (the rows' own `redact` stops at the head a row shows).
|
|
289
|
-
* Without `redact`, the rows' own. `
|
|
290
|
-
*
|
|
301
|
+
* Without `redact`, the rows' own. `input`: each string of a call's arguments as `tool_input` shows it, read from the
|
|
302
|
+
* arguments as the call came, its head of `shown` characters made safe (the caller cuts it there). The rows' own
|
|
303
|
+
* `redact` stops at the head a row shows, so without `input`, `tool_input` reads the arguments as the rows show them,
|
|
304
|
+
* each string no longer than that head. Arguments `holds` withholds whole have no `tool_input` either way: it reads
|
|
305
|
+
* them as the call came. `held`: whether a number in the arguments shows a held value (a key that is all digits);
|
|
306
|
+
* such a number is shown as "[redacted]". */
|
|
291
307
|
calls?: {
|
|
292
308
|
result: number;
|
|
293
309
|
redact?: (text: string) => string;
|
|
310
|
+
input?: (text: string, shown: number) => string;
|
|
294
311
|
held?: (value: number | bigint) => boolean;
|
|
295
312
|
};
|
|
296
|
-
/** Whether a text holds a held value no cut in place takes (key-refusal.ts withheldWhole). A web call's output is read
|
|
297
|
-
* through it joined, its JSON's strings as they came (web-calls.ts webHeld), before any of its rows shows any of it: a
|
|
298
|
-
* value split across two of its strings, which `redact` and `calls.redact` never read side by side, withholds the
|
|
299
|
-
* output, so its preview, its summary and a `calls` read's text read "[redacted]". Default: none withheld. */
|
|
300
|
-
holds?: (text: string) => boolean;
|
|
301
313
|
};
|
|
302
314
|
/** A tool's calls in a run, and how many failed. */
|
|
303
315
|
export type ToolMetrics = {
|
|
@@ -18,7 +18,8 @@ export const CAPS = { summary: 500, preview: 500, text: 2000, thinking: 100 };
|
|
|
18
18
|
* web_search's every result keeps its url, title and published date, and a web_fetch its url and title, their snippets
|
|
19
19
|
* and page text cut to fit (web-calls.ts), past this only when its urls alone pass it. */
|
|
20
20
|
export const CALL_RESULT_CHARS = 120_000;
|
|
21
|
-
/** The most rows a `calls=whole` timeline page holds, and its default: each row's result
|
|
21
|
+
/** The most rows a `calls=whole` timeline page holds, and its default: each row's result, or the names, values and
|
|
22
|
+
* brackets of its call's arguments together (tool_input, inputShown), may be CALL_RESULT_CHARS long. */
|
|
22
23
|
export const CALLS_PAGE_ROWS = 100;
|
|
23
24
|
/** A host's marks of a model request: as it leaves (written before it does), and as its stream ends aborted. A request
|
|
24
25
|
* that answered or failed has a `pi.assistant` entry; one aborted before its first content has none; a start with no
|
|
@@ -193,13 +194,14 @@ const tokenCount = (value) => (typeof value === "number" && Number.isSafeInteger
|
|
|
193
194
|
/** A usage's tokens: undefined unless it has an input and an output count (a cache count it omits is 0), and unless it
|
|
194
195
|
* has some input. A request that reached a model always sent some, so a usage with none is a writer's zeros for a
|
|
195
196
|
* request it did not measure (an imported transcript's, a harness answer's written with no booking): unknown, never 0.
|
|
196
|
-
* `failed`: a failed request's counts are taken as they are, as its cost is
|
|
197
|
+
* `failed`: a failed request's counts are taken as they are, as its cost is; so are a `folded` usage's (an imported
|
|
198
|
+
* request whose tokens its source counted in a later request of the session). */
|
|
197
199
|
function tokensOf(usage, failed = false) {
|
|
198
200
|
const u = obj(usage);
|
|
199
201
|
const [input, output, cacheRead, cacheWrite] = [tokenCount(u?.input), tokenCount(u?.output), u?.cacheRead === undefined ? 0 : tokenCount(u.cacheRead), u?.cacheWrite === undefined ? 0 : tokenCount(u.cacheWrite)];
|
|
200
202
|
if (input === undefined || output === undefined || cacheRead === undefined || cacheWrite === undefined)
|
|
201
203
|
return undefined;
|
|
202
|
-
return failed || input + cacheRead + cacheWrite > 0 ? { input, cacheRead, cacheWrite, output } : undefined;
|
|
204
|
+
return failed || u?.folded === true || input + cacheRead + cacheWrite > 0 ? { input, cacheRead, cacheWrite, output } : undefined;
|
|
203
205
|
}
|
|
204
206
|
/** A run's model requests as its entries mark them: how many, what they cost and the tokens they used. The usage row
|
|
205
207
|
* and runMetricsOf count through it. `push` says what an entry was: an answer (a `pi.assistant` that is a request), a
|
|
@@ -285,8 +287,9 @@ function createMeter() {
|
|
|
285
287
|
const message = entry.model?.[0];
|
|
286
288
|
const data = obj(entry.data);
|
|
287
289
|
const summaryAnswered = compactionAnswers(entry, sideSummaries);
|
|
288
|
-
if (entry.kind === "pi.assistant" && entry.recordedCall && message) {
|
|
290
|
+
if (entry.kind === "pi.assistant" && (entry.recordedCall || data?.mirrors !== undefined) && message) {
|
|
289
291
|
// A call the loop's record kept (a CLI's, or one a tool of pi's nested): shown as an answer's call, never a request.
|
|
292
|
+
// So is an imported answer whose request another run counts (`mirrors`: an OpenCode request Claude Code also wrote).
|
|
290
293
|
return "call";
|
|
291
294
|
}
|
|
292
295
|
else if (entry.kind === REQUEST_REFUSED) {
|
|
@@ -506,21 +509,70 @@ const blocksOf = (message) => {
|
|
|
506
509
|
const textOf = (message, type = "text", field = "text") => blocksOf(message).filter((block) => block.type === type).map((block) => str(block[field]) ?? "").join("\n").trim();
|
|
507
510
|
/** Every string a row shows goes through here: a URL keeps its origin, path and query keys, then the text is cut. */
|
|
508
511
|
const clean = (text, max) => cut(scrubUrls(text), max);
|
|
509
|
-
/** A call's arguments as `tool_input` carries them,
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
|
|
512
|
+
/** A call's arguments as `tool_input` carries them, at most `budget` characters a row, taken in order: each property
|
|
513
|
+
* name as `redact` makes it, as only this field shows them, each string as `read` makes it of the head it is given,
|
|
514
|
+
* each number, boolean or null as its text (a number `held` names as "[redacted]"), and each array or object its two
|
|
515
|
+
* brackets. Every name and value costs at least one character. The name or string that reaches the budget is cut
|
|
516
|
+
* there, and a number, boolean or null that would pass it shows as "..."; an array or object then ends with one "..."
|
|
517
|
+
* (an item, or a "..." name), and a value reached past it shows as "...", unread, however much it holds. So a row's
|
|
518
|
+
* names, values and brackets come to at most `budget` characters, past which only a "..." for the value it stopped in
|
|
519
|
+
* and one for each array or object still open, whatever its call holds. An object two of whose names come out the
|
|
520
|
+
* same is withheld whole, as "[redacted]", never one value merged over the other. */
|
|
521
|
+
const inputShown = (args, budget, read, redact = (text) => text, held = () => false) => {
|
|
522
|
+
let left = budget;
|
|
523
|
+
const spend = (size) => (left -= Math.max(1, size));
|
|
524
|
+
// A number, boolean or null shows whole or as "...": a cut one would read as another value.
|
|
525
|
+
const scalar = (out) => {
|
|
526
|
+
const text = String(out);
|
|
527
|
+
if (text.length > left) {
|
|
528
|
+
left = 0;
|
|
529
|
+
return "...";
|
|
530
|
+
}
|
|
531
|
+
spend(text.length);
|
|
532
|
+
return out;
|
|
533
|
+
};
|
|
534
|
+
const shown = (value) => {
|
|
535
|
+
if (left <= 3)
|
|
536
|
+
return "...";
|
|
537
|
+
if (typeof value === "string") {
|
|
538
|
+
const text = cut(read(value, left), left);
|
|
539
|
+
spend(text.length);
|
|
540
|
+
return text;
|
|
541
|
+
}
|
|
542
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
543
|
+
return scalar(held(value) ? "[redacted]" : value);
|
|
544
|
+
if (Array.isArray(value)) {
|
|
545
|
+
spend(2);
|
|
546
|
+
const out = [];
|
|
547
|
+
for (const item of value) {
|
|
548
|
+
if (left <= 3)
|
|
549
|
+
return [...out, "..."];
|
|
550
|
+
out.push(shown(item));
|
|
551
|
+
}
|
|
552
|
+
return out;
|
|
553
|
+
}
|
|
554
|
+
if (!value || typeof value !== "object")
|
|
555
|
+
return scalar(value);
|
|
556
|
+
spend(2);
|
|
557
|
+
const entries = [];
|
|
558
|
+
let ended = false;
|
|
559
|
+
for (const [key, item] of Object.entries(value)) {
|
|
560
|
+
if (left <= 3) {
|
|
561
|
+
ended = true;
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
const name = cut(redact(key), left);
|
|
565
|
+
spend(name.length);
|
|
566
|
+
entries.push([name, shown(item)]);
|
|
567
|
+
}
|
|
568
|
+
if (new Set(entries.map(([key]) => key)).size !== entries.length)
|
|
569
|
+
return "[redacted]";
|
|
570
|
+
const out = Object.fromEntries(entries);
|
|
571
|
+
if (ended && !Object.hasOwn(out, "..."))
|
|
572
|
+
out["..."] = "...";
|
|
573
|
+
return out;
|
|
574
|
+
};
|
|
575
|
+
return shown(args);
|
|
524
576
|
};
|
|
525
577
|
/** The rows that show words as a person or the agent wrote them: cut, never scrubbed. */
|
|
526
578
|
const WHOLE = new Set(["user_message", "text_block", "final_answer"]);
|
|
@@ -675,8 +727,32 @@ function createProjector(options) {
|
|
|
675
727
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactValue(item)]));
|
|
676
728
|
return value;
|
|
677
729
|
};
|
|
678
|
-
/**
|
|
679
|
-
const
|
|
730
|
+
/** The arguments of calls a read withholds whole (argsOf). */
|
|
731
|
+
const withheldArgs = new WeakSet();
|
|
732
|
+
/** A call's arguments as its rows may show them: redacted once, where the call is first seen (redactValue). Arguments
|
|
733
|
+
* whose JSON holds a held value no cut in place takes (`holds`: split across two of their
|
|
734
|
+
* strings, or across a property name and its value, which redactValue reads one at a time) are withheld whole, in a
|
|
735
|
+
* read with calls or without: the call's rows read it as one with no arguments, its preview is "[redacted]" and its
|
|
736
|
+
* `tool_input` is left out. */
|
|
737
|
+
const argsOf = (args) => {
|
|
738
|
+
if (argsHeld(args)) {
|
|
739
|
+
const none = {};
|
|
740
|
+
withheldArgs.add(none);
|
|
741
|
+
return none;
|
|
742
|
+
}
|
|
743
|
+
return options.redact ? redactValue(args) : args;
|
|
744
|
+
};
|
|
745
|
+
/** Whether the read withholds `args` whole (argsOf); arguments that cannot be read as JSON are. */
|
|
746
|
+
const argsHeld = (args) => {
|
|
747
|
+
if (!options.holds)
|
|
748
|
+
return false;
|
|
749
|
+
try {
|
|
750
|
+
return options.holds(JSON.stringify(args));
|
|
751
|
+
}
|
|
752
|
+
catch {
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
755
|
+
};
|
|
680
756
|
/** An outcome's words as the summary shows them: its verdict (`failed:`, `refused:`) as read, and only what follows it
|
|
681
757
|
* redacted, so a redaction that takes the whole detail still leaves the verdict, as the row's status says. */
|
|
682
758
|
const saidOf = (text) => {
|
|
@@ -687,8 +763,8 @@ function createProjector(options) {
|
|
|
687
763
|
* which its label, summary and preview are all taken from (resultRow); its details and error flag as they came. */
|
|
688
764
|
const shownOf = (tool, view) => withheld(tool, view.text) ? { ...view, text: "[redacted]", details: redactValue(view.details) }
|
|
689
765
|
: options.redact ? { ...view, text: view.text ? options.redact(view.text) : view.text, details: redactValue(view.details) } : view;
|
|
690
|
-
/** Whether a call of `tool`'s output is withheld whole before any row shows it: a web call's
|
|
691
|
-
* (TimelineOptions.holds). */
|
|
766
|
+
/** Whether a call of `tool`'s output is withheld whole before any row shows it: a web call's output, read as it came
|
|
767
|
+
* through `holds` (TimelineOptions.holds, web-calls.ts webHeld). */
|
|
692
768
|
const withheld = (tool, text) => (options.holds && text ? webHeld(tool, text, options.holds) : false);
|
|
693
769
|
const failure = (text) => scrubUrls(firstLine(str(json(text)?.message) ?? diagnosticOf(text) ?? text)) || "no detail";
|
|
694
770
|
/** Whether a result is a call's refusal before it ran: an error its host marked so in its details (CALL_REFUSED),
|
|
@@ -698,11 +774,18 @@ function createProjector(options) {
|
|
|
698
774
|
const endedWithRun = (view) => view.isError && obj(view.details)?.[CALL_ENDED_WITH_RUN] === true;
|
|
699
775
|
/** A call's name on its rows: a refused one's in plain words (refusedLabel), else its label. */
|
|
700
776
|
const nameFor = (tool, args, view, result) => (refused(view) ? refusedLabel(labelled(tool), shown(args)) : label(tool, args, result));
|
|
701
|
-
/** The `tool_use` row of a call
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
const
|
|
705
|
-
|
|
777
|
+
/** The `tool_use` row of a call: its summary and preview from `args`, as its rows show them (argsOf), and a `calls`
|
|
778
|
+
* read's `tool_input` from `raw`, the arguments as the call came; `fields` is what differs between a stored call and
|
|
779
|
+
* a nested one. Arguments argsOf withholds whole preview as "[redacted]". */
|
|
780
|
+
const useRow = (conv, rowId, callId, name, args, raw, fields) => make("tool_use", conv, rowId, { summary: label(name, args), tool_name: name, tool_use_id: callId, tool_input_preview: withheldArgs.has(args) ? "[redacted]" : inputPreview(args, caps.preview), ...inputOf(args, raw), ...fields });
|
|
781
|
+
/** A `calls` read's `tool_input` (inputShown), at most `calls.result` characters of names and values a row: the raw arguments
|
|
782
|
+
* through `calls.input`, else the arguments as the rows show them. None when the arguments themselves are withheld:
|
|
783
|
+
* argsOf reads `raw` whole through `holds`, so a value split across two of the raw strings withholds both. */
|
|
784
|
+
const inputOf = (args, raw) => {
|
|
785
|
+
if (!options.calls || withheldArgs.has(args))
|
|
786
|
+
return {};
|
|
787
|
+
const { result, input, held } = options.calls;
|
|
788
|
+
const shown = obj(input ? inputShown(raw, result, input, options.redact, held) : inputShown(args, result, (text) => text, options.redact, held));
|
|
706
789
|
return shown ? { tool_input: shown } : {};
|
|
707
790
|
};
|
|
708
791
|
/** A call's output as a `calls` read shows it (tool_result_text): redacted by its redactor, else the rows' own, then its
|
|
@@ -901,7 +984,8 @@ function createProjector(options) {
|
|
|
901
984
|
const [id, name] = [str(block.id), str(block.name)];
|
|
902
985
|
if (block.type !== "toolCall" || !id || !name)
|
|
903
986
|
return;
|
|
904
|
-
const
|
|
987
|
+
const raw = obj(block.arguments) ?? {};
|
|
988
|
+
const args = argsOf(raw);
|
|
905
989
|
if (BROWSER_OPENERS.has(name) && !browsers.has(conv)) {
|
|
906
990
|
browsers.add(conv);
|
|
907
991
|
add(make("phase", conv, `${base}:${index}:session`, { summary: "A live browser session started" }));
|
|
@@ -910,7 +994,7 @@ function createProjector(options) {
|
|
|
910
994
|
// made inside a call of the harness's own (Codex's `exec`) under that call, which its record names. SDK calls keep
|
|
911
995
|
// their validated explicit parent.
|
|
912
996
|
const nesting = (entry.recordedCall ? (entry.parentCall ?? nestingCallOf(id)) : undefined) ?? str(obj(entry.data)?.parentCallId);
|
|
913
|
-
const use = useRow(conv, `${base}:${index}`, id, name, args, { round, ...(nesting ? { parent_tool_use_id: nesting } : {}) });
|
|
997
|
+
const use = useRow(conv, `${base}:${index}`, id, name, args, raw, { round, ...(nesting ? { parent_tool_use_id: nesting } : {}) });
|
|
914
998
|
const before = early.get(`${conv}:${id}`);
|
|
915
999
|
const opened = { conv, name, args, round, use, done: before !== undefined };
|
|
916
1000
|
calls.set(`${conv}:${id}`, opened);
|
|
@@ -1070,7 +1154,7 @@ function createProjector(options) {
|
|
|
1070
1154
|
function nested(conv, id, parent, name, raw) {
|
|
1071
1155
|
const args = argsOf(raw);
|
|
1072
1156
|
const round = calls.get(`${conv}:${parent}`)?.round;
|
|
1073
|
-
const use = useRow(conv, `${conv}:n:${id}`, id, name, args, { round, parent_tool_use_id: parent });
|
|
1157
|
+
const use = useRow(conv, `${conv}:n:${id}`, id, name, args, raw, { round, parent_tool_use_id: parent });
|
|
1074
1158
|
calls.set(`${conv}:${id}`, { conv, name, args, round, use, done: false });
|
|
1075
1159
|
rows.push(use);
|
|
1076
1160
|
return use;
|
|
@@ -7,12 +7,14 @@ export type WebShown = (keep: number) => string;
|
|
|
7
7
|
/** Whether a text holds a held value no cut in place takes (key-refusal.ts withheldWhole): `joined` is `parts` joined
|
|
8
8
|
* by line breaks, for a reader that reads each part by itself too (adapter-run-spec.ts answersCut). */
|
|
9
9
|
export type WebHolds = (joined: string, parts: readonly string[]) => boolean;
|
|
10
|
-
/** Whether `text`, a web call's output, is withheld whole: `holds` (key-refusal.ts withheldWhole)
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
/** Whether `text`, a web call's output, is withheld whole: `holds` (key-refusal.ts withheldWhole) reads the output as it
|
|
11
|
+
* came, through the matcher's join view (redact/match.ts joinOf: a JSON text's strings joined), then its JSON's strings
|
|
12
|
+
* joined by line breaks with the lines after the JSON, once its values alone and once with each property name before its
|
|
13
|
+
* value. They are read in the order the output is written back in (stringsOf) and, where that differs, in the order it
|
|
14
|
+
* was written (writtenStrings). Every reader asks this first: the runner before it stores the answer (answersCut), a
|
|
15
|
+
* timeline before its row shows. Each string is cut on its own wherever the output is shown, so a held value split across
|
|
16
|
+
* two of them, or across a property name and its value, is found only here. False for an output that is not a web
|
|
17
|
+
* call's JSON. */
|
|
16
18
|
export declare function webHeld(tool: string, text: string, holds: WebHolds): boolean;
|
|
17
19
|
/** `text`, a call of `tool`'s output, with `cut` (the run's redactor) applied to each string of its JSON by itself, its
|
|
18
20
|
* property names too, and to the lines after it, never to its JSON line whole: the redactor reads a run of more than
|
|
@@ -78,18 +78,22 @@ function webRead(tool, text) {
|
|
|
78
78
|
}
|
|
79
79
|
return isObj(read) ? { read, end } : undefined;
|
|
80
80
|
}
|
|
81
|
-
/** Whether `text`, a web call's output, is withheld whole: `holds` (key-refusal.ts withheldWhole)
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
81
|
+
/** Whether `text`, a web call's output, is withheld whole: `holds` (key-refusal.ts withheldWhole) reads the output as it
|
|
82
|
+
* came, through the matcher's join view (redact/match.ts joinOf: a JSON text's strings joined), then its JSON's strings
|
|
83
|
+
* joined by line breaks with the lines after the JSON, once its values alone and once with each property name before its
|
|
84
|
+
* value. They are read in the order the output is written back in (stringsOf) and, where that differs, in the order it
|
|
85
|
+
* was written (writtenStrings). Every reader asks this first: the runner before it stores the answer (answersCut), a
|
|
86
|
+
* timeline before its row shows. Each string is cut on its own wherever the output is shown, so a held value split across
|
|
87
|
+
* two of them, or across a property name and its value, is found only here. False for an output that is not a web
|
|
88
|
+
* call's JSON. */
|
|
87
89
|
export function webHeld(tool, text, holds) {
|
|
88
90
|
const web = webRead(tool, text);
|
|
89
91
|
return web ? heldIn(web, text, holds) : false;
|
|
90
92
|
}
|
|
91
93
|
/** webHeld of an output already read (webRead). */
|
|
92
94
|
function heldIn(web, text, holds) {
|
|
95
|
+
if (holds(text, [text]))
|
|
96
|
+
return true;
|
|
93
97
|
const after = web.end < 0 ? [] : [text.slice(web.end + 1)];
|
|
94
98
|
const line = web.end < 0 ? text : text.slice(0, web.end);
|
|
95
99
|
const asked = (strings) => {
|
package/dist/tool-gate.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ export declare function heldAs(name: string, args: unknown): {
|
|
|
31
31
|
readonly tool: string;
|
|
32
32
|
readonly args: unknown;
|
|
33
33
|
} | undefined;
|
|
34
|
+
/** Why a run can't write a file (a screenshot's save_as, a script's op held as write), or undefined where it can: "not
|
|
35
|
+
* given", write is not among the agent's `tools` (none given, none: leaving write out is how its owner keeps it from
|
|
36
|
+
* writing, whatever write's setting says); "denied", write's `permission` is deny; "no approver", it asks and no one can
|
|
37
|
+
* approve (`approvers` false). The one answer the run's gate refuses by and its files note and bound tools offer by. */
|
|
38
|
+
export type WriteBar = "not given" | "denied" | "no approver";
|
|
39
|
+
export declare const writeBar: (tools: readonly string[] | undefined, permission: Permission, approvers: boolean) => WriteBar | undefined;
|
|
34
40
|
/** A session's `{name -> settings key}` map (nameMapOf). */
|
|
35
41
|
export type NameMap = ReadonlyMap<string, string>;
|
|
36
42
|
/** Every name a session on `harness` gives its tools, to the settings key each is held to: the shell family (bash's),
|
|
@@ -190,6 +196,7 @@ export declare function runGate(where: {
|
|
|
190
196
|
}, runId: string, revision: {
|
|
191
197
|
kind: string;
|
|
192
198
|
body: {
|
|
199
|
+
tools?: readonly string[];
|
|
193
200
|
toolSettings?: unknown;
|
|
194
201
|
harness?: string;
|
|
195
202
|
approvals?: Approvals;
|
|
@@ -241,7 +248,8 @@ export declare class RunGate {
|
|
|
241
248
|
runId: string;
|
|
242
249
|
harness?: string;
|
|
243
250
|
computer?: boolean; /** The run's computer kind (its revision's setting): the key a computer tool's refusal and ask name on a tie (kindSetting). */
|
|
244
|
-
kind?: string;
|
|
251
|
+
kind?: string; /** The tools the agent is given (its revision's `tools`): a screenshot's save_as and a script's op held as write are refused unless write is among them; none given, none (writeBar). */
|
|
252
|
+
tools?: readonly string[];
|
|
245
253
|
effectOf?: (name: string) => ToolEffect | undefined; /** The arguments each MCP tool's listing in the run's pin declares (ClaimMcp.argumentsOf), for a pinned tool's closure (pinRefusal). */
|
|
246
254
|
argumentsOf?: ArgumentsOf; /** The harness's adapter facts on the owner's table (its native tools' names, nameMapOf); undefined for one with none. */
|
|
247
255
|
facts: AdapterFacts | undefined;
|
|
@@ -250,6 +258,10 @@ export declare class RunGate {
|
|
|
250
258
|
/** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
|
|
251
259
|
* reaches a live run at its next call; under approvals "never", an ask is an allow. */
|
|
252
260
|
readonly policy: (tool: string) => Permission;
|
|
261
|
+
/** Why this run can't write a file now (writeBar over its agent's tools, write's permission and whether anyone can
|
|
262
|
+
* approve), or undefined where it can: what decide refuses a save_as or a script's write by, and what the run's files
|
|
263
|
+
* note and computer_screenshot's save_as are offered by. */
|
|
264
|
+
readonly writeBar: () => WriteBar | undefined;
|
|
253
265
|
/** The gate's answer for one call before its intent, for a loop that parks and answers asks itself (the runner's adapter
|
|
254
266
|
* loops, pi's and the CLI harnesses'): run it, ask a person, or refuse it with the words the model reads. The order:
|
|
255
267
|
* the deny (with where it was set, and that nothing was sent or charged), a pin, bash's policy (policyRefusal), then
|