@parcha/agentrun-serve 0.1.0-beta.57 → 0.1.0-beta.59
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 +376 -0
- package/README.md +393 -118
- 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/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 -4
- package/dist/api-only.js +2 -4
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +7 -5
- package/dist/box-paths.js +12 -8
- 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 +5 -0
- package/dist/chatgpt-plan.js +25 -11
- package/dist/claude-login-token.d.ts +121 -0
- package/dist/claude-login-token.js +797 -0
- package/dist/claude-login.d.ts +119 -34
- package/dist/claude-login.js +551 -79
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli.js +325 -328
- 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 +40 -19
- package/dist/computer-attach.js +326 -62
- 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 +12 -11
- package/dist/computers.js +11 -8
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-BztxEAvb.js +166 -0
- package/dist/console/assets/index-LwNL4L9q.js +619 -0
- package/dist/console/assets/share-L84tlUDW.js +6 -0
- package/dist/console/assets/styles-CaRKlHke.js +291 -0
- package/dist/console/assets/styles-DQo8rzY-.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.d.ts +25 -4
- package/dist/dial-relay.js +139 -5
- 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 +13 -5
- package/dist/env-switch.js +24 -6
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +12 -4
- package/dist/fal-price.js +110 -26
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- 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.js +9 -6
- 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 +8 -0
- package/dist/harness-table.js +17 -6
- 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.d.ts +11 -8
- package/dist/import.js +437 -186
- package/dist/key-refusal.d.ts +9 -2
- package/dist/key-refusal.js +86 -32
- package/dist/learn/audit.d.ts +8 -5
- package/dist/learn/audit.js +15 -7
- package/dist/learn/compile.d.ts +5 -2
- package/dist/learn/compile.js +45 -21
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/ledger.d.ts +173 -0
- package/dist/learn/ledger.js +225 -0
- package/dist/learn/promote.d.ts +82 -39
- package/dist/learn/promote.js +61 -66
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- 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 +40 -21
- package/dist/learning-cost.js +30 -21
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +9 -0
- package/dist/live-reach.js +9 -0
- package/dist/mcp-api-only-origins.d.ts +23 -3
- package/dist/mcp-api-only-origins.js +57 -17
- package/dist/mcp-gateway.d.ts +16 -2
- package/dist/mcp-gateway.js +41 -3
- 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-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/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/model.d.ts +5 -4
- package/dist/model.js +7 -6
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +234 -61
- 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 +59 -34
- package/dist/place-offers.js +100 -58
- package/dist/place.d.ts +13 -14
- package/dist/place.js +56 -41
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +5 -4
- package/dist/provider.js +26 -13
- package/dist/redact/match.d.ts +27 -9
- package/dist/redact/match.js +266 -57
- 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.js +16 -3
- package/dist/run-learning-served.d.ts +2 -2
- 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.js +3 -1
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.js +2 -2
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +97 -63
- package/dist/runner/adapter-run-spec.d.ts +34 -14
- package/dist/runner/adapter-run-spec.js +120 -75
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +8 -5
- package/dist/runner/audit.js +37 -17
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +29 -13
- package/dist/runner/claim-secrets.d.ts +27 -18
- package/dist/runner/claim-secrets.js +61 -47
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +93 -46
- package/dist/runner/compare-end.d.ts +2 -1
- package/dist/runner/compare-end.js +25 -10
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/harness-loops.js +3 -3
- package/dist/runner/held.d.ts +19 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +22 -4
- package/dist/runner/learned-first.js +20 -4
- package/dist/runner/learning-end.d.ts +2 -8
- package/dist/runner/learning-end.js +11 -19
- 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.d.ts +11 -6
- package/dist/runner/main.js +24 -18
- package/dist/runner/mcp-claim.js +24 -7
- package/dist/runner/mcp-run.d.ts +3 -6
- package/dist/runner/mcp-run.js +3 -4
- 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 +10 -8
- package/dist/runner/presence.d.ts +11 -4
- package/dist/runner/presence.js +11 -6
- package/dist/runner/promotion.d.ts +25 -13
- package/dist/runner/promotion.js +125 -50
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.js +1 -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 +38 -12
- package/dist/runner/run-child-host.js +231 -83
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +5 -3
- package/dist/runner/runner.js +14 -10
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/sdk-loop.js +8 -8
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +17 -3
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +138 -37
- package/dist/runner/workflow-first.js +230 -99
- package/dist/runner/workflow-spec.js +2 -2
- 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/runs.d.ts +6 -0
- package/dist/sdk/runs.js +89 -10
- 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 +51 -9
- package/dist/secrets.js +311 -21
- package/dist/server-keys.d.ts +4 -3
- package/dist/server-keys.js +4 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +33 -10
- package/dist/server.js +454 -136
- 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/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- 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/0028_learning_ledger.sql +44 -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/store.js +4 -0
- package/dist/store/schema.d.ts +44 -4
- package/dist/store/schema.js +111 -11
- package/dist/store/seal.d.ts +4 -1
- 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 +19 -2
- package/dist/store/sqlite/run-patch.js +67 -2
- package/dist/store/sqlite/store.d.ts +3 -0
- package/dist/store/sqlite/store.js +177 -32
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +74 -25
- package/dist/store/store.js +14 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/learning.d.ts +102 -136
- package/dist/store-reads/learning.js +251 -302
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.js +10 -7
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +91 -9
- package/dist/template-eval.js +448 -105
- package/dist/template-import.d.ts +0 -10
- package/dist/template-import.js +5 -10
- 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 +14 -14
- package/dist/timeline/web-calls.js +18 -30
- 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 +50 -11
- package/dist/tool-plane.js +94 -30
- 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 +32 -0
- package/dist/web-holds.js +86 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +75 -28
- package/dist/web-save.d.ts +4 -9
- package/dist/web-save.js +27 -55
- 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/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +38 -11
- package/dist/workspace/attached-computers.js +81 -16
- package/dist/workspace/computer-deps.d.ts +29 -7
- package/dist/workspace/computer-deps.js +36 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +166 -57
- 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 +8 -3
- package/dist/workspace/computer-providers.js +12 -5
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- 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.d.ts +91 -0
- package/dist/workspace/paired-route.js +152 -0
- 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 +6 -0
- package/dist/wrapped.d.ts +8 -2
- package/dist/wrapped.js +21 -6
- package/package.json +12 -13
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +25 -9
- package/dist/console/assets/backend-DVhHzJX2.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-okP-y8PK.js +0 -747
package/dist/harness-keys.js
CHANGED
|
@@ -248,7 +248,7 @@ export class HarnessKeysOverStore {
|
|
|
248
248
|
const entry = this.current.get(row);
|
|
249
249
|
if (!entry || this.bound(recipe, name))
|
|
250
250
|
return [];
|
|
251
|
-
const why = "unreadable" in entry.opened ? entry.opened.unreadable : "recipe_changed";
|
|
251
|
+
const why = "unreadable" in entry.opened ? entry.opened.unreadable : entry.recipe === undefined ? "not_bound" : "recipe_changed";
|
|
252
252
|
return [{ name: row, why }];
|
|
253
253
|
});
|
|
254
254
|
return { id: recipe.id, label: recipe.label, named: true, keys, kept: this.kept(recipe.id, recipe.keys), ready: this.saved(recipe), reenter };
|
|
@@ -313,7 +313,7 @@ export class HarnessKeysOverStore {
|
|
|
313
313
|
/** DELETE: `key`'s value for `held`'s harness gone from its runs, kept as a retired row for the cut. A row that does not
|
|
314
314
|
* open under this server's seal key is removed too, so no claim counts it saved. */
|
|
315
315
|
async remove(held, key) {
|
|
316
|
-
known(held, key);
|
|
316
|
+
known(held, key, true);
|
|
317
317
|
const row = harnessKeyRow(held.id, key);
|
|
318
318
|
await this.serial(async () => {
|
|
319
319
|
const was = this.current.get(row);
|
|
@@ -344,10 +344,13 @@ export class HarnessKeysOverStore {
|
|
|
344
344
|
this.retired.set(of, list);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
/** 422 unless `key` is one `recipe` runs on (or, for a DELETE, one
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
/** 422 unless `key` is one `recipe` runs on (or, for a DELETE, one it holds): a key no recipe names is never saved. A
|
|
348
|
+
* DELETE's refusal names the keys held, which for an id no recipe names are kept keys, never ones it runs on. */
|
|
349
|
+
function known(recipe, key, remove = false) {
|
|
350
|
+
if (recipe.keys.includes(key))
|
|
351
|
+
return;
|
|
352
|
+
const keys = recipe.keys.join(", ");
|
|
353
|
+
throw invalid([{ field: "key", reason: "not_an_option", message: remove ? `${recipe.label}'s keys are ${keys}.` : `${recipe.label} runs on ${keys}.` }]);
|
|
351
354
|
}
|
|
352
355
|
/** What a PUT may save: `body.value`, text of 8 to 1024 bytes with no whitespace or control character, for a key the
|
|
353
356
|
* recipe names. No message holds the value. */
|
|
@@ -17,6 +17,8 @@ export const facts = Object.freeze({
|
|
|
17
17
|
thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
|
|
18
18
|
// OpenCode's model requests carry no provider-hosted tool: no search of its own.
|
|
19
19
|
ownModel: false,
|
|
20
|
+
// Its proxy forwards with the fetch it is handed: a model the route translates onto its wire runs on it.
|
|
21
|
+
forwardsRoute: true,
|
|
20
22
|
normalizeModel: (model) => model,
|
|
21
23
|
// The server is named first, as the other lines name a package beside it: OpenCode's CLI is an optional peer of the
|
|
22
24
|
// server's own.
|
|
@@ -46,7 +46,7 @@ export declare function acpRecipeFor(recipe: Recipe, binary: string, release: Re
|
|
|
46
46
|
}): AcpRecipe;
|
|
47
47
|
/** What recipeEntryOf builds `recipe`'s entry from: its installed `binary` and `release`, the route of each start (it
|
|
48
48
|
* may throw a HarnessUnavailable), the check before each start, and what harness-check adds (its log, its variables,
|
|
49
|
-
* the
|
|
49
|
+
* the recorder its model proxy forwards through). `missing` and `hidden` are a server's (recipeServerEntry). */
|
|
50
50
|
export interface RecipeEntryOptions extends AcpEntryHost {
|
|
51
51
|
readonly recipe: Recipe;
|
|
52
52
|
readonly binary: string;
|
|
@@ -56,8 +56,14 @@ export interface RecipeEntryOptions extends AcpEntryHost {
|
|
|
56
56
|
beforeStart(command: string): Promise<void>;
|
|
57
57
|
/** The variables beside the recipe's env at each start: the egress proxy's (harness-egress.ts egressVars). */
|
|
58
58
|
vars(): Readonly<Record<string, string>>;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
/** harness-check's recorder, over the next hop the proxy forwards with: the route's own fetch for a model it translates
|
|
60
|
+
* (ModuleLaunch.fetch), undefined for the network. Whatever it returns is what the proxy forwards with, so a check
|
|
61
|
+
* runs the hop a server's run takes. */
|
|
62
|
+
readonly record?: (next: typeof fetch | undefined) => typeof fetch;
|
|
63
|
+
/** `held`: a held run its model kept from running (harness-table.ts AcpPlanEntryOptions.missing), asked for no key. */
|
|
64
|
+
missing?(env: NodeJS.ProcessEnv, launch?: {
|
|
65
|
+
readonly held: boolean;
|
|
66
|
+
}): Promise<string | undefined>;
|
|
61
67
|
hidden?(env: NodeJS.ProcessEnv): string | undefined;
|
|
62
68
|
}
|
|
63
69
|
/** `recipe`'s whole entry, as an ACP agent outside the built-ins starts (harness-table.ts acpEntryOf). Proxy-billed: as a
|
|
@@ -63,7 +63,9 @@ export function acpRecipeFor(recipe, binary, release, route, { vars = {}, model
|
|
|
63
63
|
state: [...recipe.state],
|
|
64
64
|
declares: { ...recipe.declares },
|
|
65
65
|
billing: recipe.model.billing === "proxy" ? { kind: "proxy" } : { kind: "plan", maxTurns: recipe.model.maxTurns, maxToolCalls: recipe.model.maxToolCalls },
|
|
66
|
-
...(recipe.
|
|
66
|
+
...(recipe.allowFile ? { allowFile: { path: recipe.allowFile.path, form: recipe.allowFile.form } } : {}),
|
|
67
|
+
...(recipe.announces ? { announces: recipe.announces } : {}),
|
|
68
|
+
...(recipe.quirks.mcpCall || recipe.quirks.permissionTie ? { quirks: { ...(recipe.quirks.mcpCall ? { mcpCall: recipe.quirks.mcpCall } : {}), ...(recipe.quirks.permissionTie ? { permissionTie: recipe.quirks.permissionTie } : {}) } } : {}),
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
71
|
/** `recipe`'s whole entry, as an ACP agent outside the built-ins starts (harness-table.ts acpEntryOf). Proxy-billed: as a
|
|
@@ -83,8 +85,9 @@ export function recipeEntryOf(options) {
|
|
|
83
85
|
recipe: (launch) => acpRecipeFor(recipe, binary, release, options.route(launch.env), { vars: options.vars(), model: launch.model }),
|
|
84
86
|
proxy: (launch) => {
|
|
85
87
|
const hostEnv = recipe.model.billing === "proxy" ? (recipe.model.hostEnv ?? "ANTHROPIC_HOST") : "ANTHROPIC_HOST";
|
|
86
|
-
// The
|
|
87
|
-
|
|
88
|
+
// The route's own fetch for a model it translates (ModuleLaunch.fetch), else the network; under harness-check, its
|
|
89
|
+
// recorder over that hop.
|
|
90
|
+
const forward = options.record ? options.record(launch.fetch) : launch.fetch;
|
|
88
91
|
const messagesProxy = acp.gooseProxy({ model: launch.model, provider: launch.provider, price: launch.price, log: launch.log, ...(forward ? { fetch: forward } : {}) });
|
|
89
92
|
return async (session) => {
|
|
90
93
|
// The proxy's own address, under the recipe's variable, beside the key that opens it alone (never a provider's).
|
|
@@ -98,7 +101,8 @@ export function recipeEntryOf(options) {
|
|
|
98
101
|
}, host)
|
|
99
102
|
: acpEntryOf({
|
|
100
103
|
facts: { ...acp.cursorFacts, id: recipe.id, label: recipe.label },
|
|
101
|
-
|
|
104
|
+
// A held run its model kept from running never starts its agent: it reads no route, and is laid no key.
|
|
105
|
+
recipe: (launch) => acpRecipeFor(recipe, binary, release, launch.held ? { on: "keys" } : options.route(launch.env, launch.probe === true), { vars: options.vars(), model: launch.model }),
|
|
102
106
|
beforeStart: options.beforeStart,
|
|
103
107
|
...checks,
|
|
104
108
|
...(options.hidden ? { hidden: options.hidden } : {}),
|
|
@@ -126,8 +130,11 @@ export function recipeServerEntry(loaded, data, { signIn = false } = {}) {
|
|
|
126
130
|
const route = (env) => serverRoute(recipe, loaded.file, data, env, { signIn, saved: harnessKeysSavedHere(data, recipe.id) });
|
|
127
131
|
const start = (env) => serverRoute(recipe, loaded.file, data, env, { signIn });
|
|
128
132
|
/** Why it cannot run on `env`, in words that end with the command that fixes it; undefined when it can. Nothing is
|
|
129
|
-
* digested here (each start is, beforeStart): the tree pin and the check's note are compared.
|
|
130
|
-
|
|
133
|
+
* digested here (each start is, beforeStart): the tree pin and the check's note are compared. Where `held` (a held
|
|
134
|
+
* run its model kept from running, whose agent never starts and whose claim laid no key), its install and check
|
|
135
|
+
* alone: no route is asked, so neither a key nor a sign-in is, and a run's own process, which holds no server's
|
|
136
|
+
* record of the keys saved here (harnessKeysSavedHere), holds its computer as a runner's claim does. */
|
|
137
|
+
const why = (env, held = false) => {
|
|
131
138
|
const install = recipeInstall(data, recipe, loaded.file, env, platform);
|
|
132
139
|
if ("code" in install)
|
|
133
140
|
return `${install.code}: ${install.message}`;
|
|
@@ -135,6 +142,8 @@ export function recipeServerEntry(loaded, data, { signIn = false } = {}) {
|
|
|
135
142
|
if (!checked || checked.recipe !== loaded.sha256 || checked.tree !== install.tree.sha256 || checked.platform !== platform) {
|
|
136
143
|
return `${HARNESS_NOT_CHECKED}: ${recipe.label} runs on this server once harness-check passes for this recipe and this install${checked ? " (the recipe or its install changed since the last check that passed)" : ""}. Check it with: ${recipeCheckLine(loaded.file, data, env)}`;
|
|
137
144
|
}
|
|
145
|
+
if (held)
|
|
146
|
+
return undefined;
|
|
138
147
|
const on = route(env);
|
|
139
148
|
return "refused" in on ? `${on.refused}: ${on.message}` : undefined;
|
|
140
149
|
};
|
|
@@ -167,8 +176,8 @@ export function recipeServerEntry(loaded, data, { signIn = false } = {}) {
|
|
|
167
176
|
if (off)
|
|
168
177
|
throw new Error(`${off.code}: ${command} does not start: ${off.message}`);
|
|
169
178
|
},
|
|
170
|
-
missing: async (env) => {
|
|
171
|
-
const lacks = why(env);
|
|
179
|
+
missing: async (env, launch) => {
|
|
180
|
+
const lacks = why(env, launch?.held === true);
|
|
172
181
|
if (lacks)
|
|
173
182
|
return lacks;
|
|
174
183
|
// A start that failed is tried again at the next run, never kept.
|
|
@@ -179,6 +188,6 @@ export function recipeServerEntry(loaded, data, { signIn = false } = {}) {
|
|
|
179
188
|
egressUrl ??= (await egress).url;
|
|
180
189
|
return undefined;
|
|
181
190
|
},
|
|
182
|
-
hidden: why,
|
|
191
|
+
hidden: (env) => why(env),
|
|
183
192
|
});
|
|
184
193
|
}
|
package/dist/harness-recipe.d.ts
CHANGED
|
@@ -81,13 +81,34 @@ export interface Recipe {
|
|
|
81
81
|
readonly env: Readonly<Record<string, string>>;
|
|
82
82
|
readonly model: RecipeModel;
|
|
83
83
|
readonly files: Readonly<Record<string, string>>;
|
|
84
|
+
/** A file in the private HOME the adapter writes at each start from that start's tools, in the form the agent reads
|
|
85
|
+
* (Goose's `.config/goose/permission.yaml`, `goose-permission`): the agent runs our tools without asking. */
|
|
86
|
+
readonly allowFile?: {
|
|
87
|
+
readonly path: string;
|
|
88
|
+
readonly form: string;
|
|
89
|
+
};
|
|
90
|
+
/** Where the agent's tool_call names which tool it calls, each a dotted path into it: `tool` (with `server`, our
|
|
91
|
+
* tool's own name; without, `<prefix><tool>`), `server` (must be `agentrun`), `prefix` (without `server`: default
|
|
92
|
+
* `agentrun__`, agy's `mcp_agentrun_`; it names our server), `args` (default rawInput), and `extras`, fields beside
|
|
93
|
+
* the arguments the MCP call never carries (agy's `toolSummary`), left out when they hold text. A call it names as
|
|
94
|
+
* another tool is the agent's own; absent, calls are matched to MCP calls by their arguments alone (AcpAnnounces). */
|
|
95
|
+
readonly announces?: {
|
|
96
|
+
readonly tool: string;
|
|
97
|
+
readonly server?: string;
|
|
98
|
+
readonly prefix?: string;
|
|
99
|
+
readonly args?: string;
|
|
100
|
+
readonly extras?: readonly string[];
|
|
101
|
+
};
|
|
84
102
|
readonly state: readonly string[];
|
|
85
103
|
readonly declares: {
|
|
86
104
|
readonly load: boolean;
|
|
87
105
|
readonly mcp: "http" | "stdio";
|
|
88
106
|
};
|
|
107
|
+
/** `permissionTie: "title"`: the adapter answers the agent's permission request for one of our announced calls
|
|
108
|
+
* allow_once (Cursor's way); absent, every request goes to the server's gate. */
|
|
89
109
|
readonly quirks: {
|
|
90
110
|
readonly mcpCall?: "match" | "mint";
|
|
111
|
+
readonly permissionTie?: "title";
|
|
91
112
|
};
|
|
92
113
|
readonly signIn?: RecipeSignIn;
|
|
93
114
|
}
|
package/dist/harness-recipe.js
CHANGED
|
@@ -59,7 +59,7 @@ export class RecipeRefused extends Error {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
/** The fields a recipe has. */
|
|
62
|
-
const FIELDS = new Set(["id", "label", "release", "args", "keys", "keyMethod", "env", "model", "files", "state", "declares", "quirks", "signIn", "description", "$schema"]);
|
|
62
|
+
const FIELDS = new Set(["id", "label", "release", "args", "keys", "keyMethod", "env", "model", "files", "allowFile", "announces", "state", "declares", "quirks", "signIn", "description", "$schema"]);
|
|
63
63
|
/** Fields that would run something of the recipe's own at install or start (rule 4). */
|
|
64
64
|
const INSTALL_FIELDS = new Set(["install", "installCommand", "postinstall", "preinstall", "setup", "script", "scripts", "run", "hooks", "update"]);
|
|
65
65
|
/** Fields that would name a binary other than the release's archive (rule 2). */
|
|
@@ -332,6 +332,22 @@ export function recipeProblems(parsed) {
|
|
|
332
332
|
if (typeof content !== "string")
|
|
333
333
|
say(RECIPE_CODES.invalid, `the file ${JSON.stringify(path)}'s content must be a string`);
|
|
334
334
|
}
|
|
335
|
+
if (r.allowFile !== undefined) {
|
|
336
|
+
const allow = r.allowFile;
|
|
337
|
+
if (!isPlain(allow) || typeof allow.path !== "string" || typeof allow.form !== "string" || Object.keys(allow).some((k) => k !== "path" && k !== "form"))
|
|
338
|
+
say(RECIPE_CODES.invalid, 'allowFile is { "path": a file in the private HOME, "form": the form its agent reads }');
|
|
339
|
+
else {
|
|
340
|
+
const path = insideHome(allow.path);
|
|
341
|
+
if (!path)
|
|
342
|
+
say(RECIPE_CODES.paths, `the allowFile ${JSON.stringify(allow.path)} must be a path inside the session's private HOME`);
|
|
343
|
+
else if (isPlain(r.files) && Object.keys(r.files).some((file) => insideHome(file) === path))
|
|
344
|
+
say(RECIPE_CODES.invalid, `the allowFile ${JSON.stringify(allow.path)} is also one of files: the adapter writes it from each start's tools`);
|
|
345
|
+
// The forms are the ACP package's (ALLOW_FILE_FORMS), the one definition. Without that package no recipe runs.
|
|
346
|
+
const forms = acpPackage()?.ALLOW_FILE_FORMS;
|
|
347
|
+
if (forms !== undefined && !forms.includes(allow.form))
|
|
348
|
+
say(RECIPE_CODES.invalid, `the allowFile form ${JSON.stringify(allow.form)} is none of ${forms.join(", ")}`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
335
351
|
if (r.state !== undefined && !strings(r.state))
|
|
336
352
|
say(RECIPE_CODES.paths, "state is a list of folders in the private HOME");
|
|
337
353
|
else
|
|
@@ -341,8 +357,12 @@ export function recipeProblems(parsed) {
|
|
|
341
357
|
const declares = r.declares;
|
|
342
358
|
if (!isPlain(declares) || typeof declares.load !== "boolean" || (declares.mcp !== "http" && declares.mcp !== "stdio"))
|
|
343
359
|
say(RECIPE_CODES.invalid, 'declares is { "load": true or false, "mcp": "http" or "stdio" }');
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
// The announces field, and the title tie that needs it: the ACP package's rule (announcesProblems), the one definition.
|
|
361
|
+
// Without that package no recipe runs.
|
|
362
|
+
for (const words of acpPackage()?.announcesProblems(r.announces, isPlain(r.quirks) ? r.quirks.permissionTie : undefined) ?? [])
|
|
363
|
+
say(RECIPE_CODES.invalid, words);
|
|
364
|
+
if (r.quirks !== undefined && (!isPlain(r.quirks) || Object.keys(r.quirks).some((k) => k !== "mcpCall" && k !== "permissionTie") || (r.quirks.mcpCall !== undefined && r.quirks.mcpCall !== "match" && r.quirks.mcpCall !== "mint") || (r.quirks.permissionTie !== undefined && r.quirks.permissionTie !== "title")))
|
|
365
|
+
say(RECIPE_CODES.invalid, 'quirks is { "mcpCall": "match" or "mint", "permissionTie": "title" }');
|
|
346
366
|
if (r.description !== undefined && typeof r.description !== "string")
|
|
347
367
|
say(RECIPE_CODES.invalid, "description is a string");
|
|
348
368
|
return problems;
|
|
@@ -372,6 +392,8 @@ export function parseRecipe(text) {
|
|
|
372
392
|
env: r.env ?? {},
|
|
373
393
|
model: r.model,
|
|
374
394
|
files: Object.fromEntries(Object.entries(r.files ?? {}).map(([path, content]) => [insideHome(path), content])),
|
|
395
|
+
...(r.allowFile ? { allowFile: Object.freeze({ path: insideHome(r.allowFile.path), form: r.allowFile.form }) } : {}),
|
|
396
|
+
...(r.announces ? { announces: Object.freeze({ tool: r.announces.tool, ...(r.announces.server !== undefined ? { server: r.announces.server } : {}), ...(r.announces.prefix !== undefined ? { prefix: r.announces.prefix } : {}), ...(r.announces.args !== undefined ? { args: r.announces.args } : {}), ...(r.announces.extras !== undefined ? { extras: Object.freeze([...r.announces.extras]) } : {}) }) } : {}),
|
|
375
397
|
state: (r.state ?? []).map((path) => insideHome(path)),
|
|
376
398
|
declares: r.declares,
|
|
377
399
|
quirks: r.quirks ?? {},
|
package/dist/harness-table.d.ts
CHANGED
|
@@ -179,12 +179,20 @@ export type PlanLaunch = Omit<ModuleLaunch, "provider" | "price" | "skills"> & {
|
|
|
179
179
|
* check), never to start its agent: a recipe's route reads its server's listing then, and only what a claim laid when
|
|
180
180
|
* its agent starts (harness-recipe-entry.ts). */
|
|
181
181
|
readonly probe?: boolean;
|
|
182
|
+
/** Set for a held run its model kept from running (AdapterNeeds.heldRefusal): its agent never starts, so a recipe's
|
|
183
|
+
* route reads no key for it (harness-recipe-entry.ts). */
|
|
184
|
+
readonly held?: boolean;
|
|
182
185
|
};
|
|
183
186
|
/** What serve gives acpEntryOf for an ACP agent billed to its owner's plan (its facts' wire `plan`): Cursor's entry and
|
|
184
187
|
* harness-check's plan-billed recipes. Not the kit's: a module's acpEntry is proxy-billed. `missing` may throw a
|
|
185
188
|
* HarnessUnavailable of its own, which keeps the fix (install, pins) it names; `recipe` may throw one too (a key unset). */
|
|
186
189
|
export interface AcpPlanEntryOptions extends ModuleChecks, Pick<HarnessEntry, "ownKeys" | "card" | "hidden"> {
|
|
187
190
|
readonly facts: AdapterFacts;
|
|
191
|
+
/** As ModuleChecks.missing. `held`: the run is held, its model kept from running (AdapterNeeds.heldRefusal), so its
|
|
192
|
+
* agent never starts and its claim laid no key: what only a key or a sign-in fixes is not asked, its install still is. */
|
|
193
|
+
missing?(env: NodeJS.ProcessEnv, launch?: {
|
|
194
|
+
readonly held: boolean;
|
|
195
|
+
}): string | undefined | Promise<string | undefined>;
|
|
188
196
|
recipe(launch: PlanLaunch): AcpRecipe | Promise<AcpRecipe>;
|
|
189
197
|
beforeStart?(command: string): Promise<void>;
|
|
190
198
|
}
|
package/dist/harness-table.js
CHANGED
|
@@ -85,8 +85,9 @@ function adapterEntry(facts, make, extra = {}) {
|
|
|
85
85
|
...extra,
|
|
86
86
|
// Its wire's vendor's model, or that vendor's on OpenRouter; behind serve's gateway, on the wire it serves, any id,
|
|
87
87
|
// which is the gateway's own string and names no provider here. One that runs on a ChatGPT plan, the plan's models.
|
|
88
|
-
// A model the route translates onto its wire (wires.ts routed: an Ollama model on Messages),
|
|
89
|
-
|
|
88
|
+
// A model the route translates onto its wire (wires.ts routed: an Ollama model on Messages or Responses), where its
|
|
89
|
+
// proxy forwards with the route's fetch (its forwardsRoute fact), except behind a gateway.
|
|
90
|
+
runs: (env, model) => (gateway && Boolean(env.AGENT_MODEL_BASE_URL)) || model.slice(0, Math.max(0, model.indexOf("/"))) === vendor || onOpenRouter(model, vendor) || (onPlan && model.startsWith(`${PLAN_PROVIDER}/`)) || (facts.forwardsRoute === true && routedId(wire, model) && !env.AGENT_MODEL_BASE_URL),
|
|
90
91
|
onWire: (env) => facts.ownModel || openRouterOnly(wire, env),
|
|
91
92
|
model: async (env, ref, available) => (facts.ownModel && !available ? undefined : modelOn(wire, env, ref, id)),
|
|
92
93
|
priceModel: (env, model) => priceModelFor(wire, env, model, id),
|
|
@@ -189,6 +190,10 @@ const ACP_PROMISES = Object.freeze({ resume: "load", tool_gate: "permission", bi
|
|
|
189
190
|
/** As ACP_PROMISES, with a resume by a new session given the conversation so far: a module's ACP agent's, unless it
|
|
190
191
|
* says "load" (AcpEntryOptions.resume). */
|
|
191
192
|
const ACP_RESTART_PROMISES = Object.freeze({ ...ACP_PROMISES, resume: "restart" });
|
|
193
|
+
/** Goose's: as ACP_PROMISES, its tool calls held by its config. Its recipe's allowFile (Goose's permission file, written at
|
|
194
|
+
* each start) allows each tool of the run by name, so Goose asks nothing for a call of ours and the host's gate is asked at
|
|
195
|
+
* the MCP call. */
|
|
196
|
+
const GOOSE_PROMISES = Object.freeze({ ...ACP_PROMISES, tool_gate: "config" });
|
|
192
197
|
/** The code a module's ACP entry is refused by at its first launch when it promises resume "load" and its recipe
|
|
193
198
|
* declares no session/load (AcpEntryOptions.resume). */
|
|
194
199
|
export const HARNESS_RESUME_UNDECLARED = "HARNESS_RESUME_UNDECLARED";
|
|
@@ -233,8 +238,12 @@ function acpPlanEntryOf(options, host = {}) {
|
|
|
233
238
|
const prefix = `${id}/`;
|
|
234
239
|
const make = async (env, needs, probe = false) => {
|
|
235
240
|
const { fixOf, harnessLog } = await import("./adapters.js");
|
|
241
|
+
// A held run its model kept from running never starts its agent: it is asked for no key or sign-in (`missing`), its
|
|
242
|
+
// route reads no key (PlanLaunch.held), its recipe names none (no keys, and no keyEnv naming one, which the adapter
|
|
243
|
+
// refuses), and its start is refused in its create's words.
|
|
244
|
+
const held = needs.heldRefusal;
|
|
236
245
|
// What no key fixes is said first, as for the built-in harnesses' binaries.
|
|
237
|
-
const lacks = await options.missing?.(env);
|
|
246
|
+
const lacks = await options.missing?.(env, { held: held !== undefined });
|
|
238
247
|
if (lacks)
|
|
239
248
|
throw new HarnessUnavailable(lacks);
|
|
240
249
|
const acp = acpPackage();
|
|
@@ -244,9 +253,11 @@ function acpPlanEntryOf(options, host = {}) {
|
|
|
244
253
|
throw new HarnessUnavailable(`${label} runs ${label}'s models, named ${prefix}<model-id>; the run's model is ${needs.model.provider}/${needs.model.modelId}.`);
|
|
245
254
|
const log = host.log ?? harnessLog(id, env);
|
|
246
255
|
try {
|
|
247
|
-
const recipe = await ownKeysOnly(facts, await options.recipe({ model: needs.model.modelId, log, ...(needs.confine ? { confine: needs.confine } : {}), env, ...(probe ? { probe } : {}) }));
|
|
256
|
+
const recipe = await ownKeysOnly(facts, await options.recipe({ model: needs.model.modelId, log, ...(needs.confine ? { confine: needs.confine } : {}), env, ...(probe ? { probe } : {}), ...(held !== undefined ? { held: true } : {}) }));
|
|
257
|
+
const beforeStart = held !== undefined ? async () => { throw new HarnessUnavailable(held); } : options.beforeStart;
|
|
258
|
+
const { keyEnv: _handedAs, ...keyless } = recipe;
|
|
248
259
|
// Its keys (recipe.keys) are read from the run's environment, which holds its own (ownKeys: run-secrets.ts keysFor).
|
|
249
|
-
return acp.acpAdapter({ recipe, ...(
|
|
260
|
+
return acp.acpAdapter({ recipe: held !== undefined ? { ...keyless, keys: [] } : recipe, ...(beforeStart ? { beforeStart } : {}), ...(needs.confine ? { confine: needs.confine } : {}), env, log });
|
|
250
261
|
}
|
|
251
262
|
catch (error) {
|
|
252
263
|
if (error instanceof HarnessUnavailable)
|
|
@@ -397,7 +408,7 @@ const BUILTIN = Object.freeze({
|
|
|
397
408
|
throw gooseRefused(found.missing);
|
|
398
409
|
return undefined;
|
|
399
410
|
},
|
|
400
|
-
promises:
|
|
411
|
+
promises: GOOSE_PROMISES,
|
|
401
412
|
hidden: gooseHidden,
|
|
402
413
|
}),
|
|
403
414
|
} : {}),
|
package/dist/helper-env.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/** The names a helper program gets, from the server's environment, when they are set.
|
|
1
|
+
/** The names a helper program gets, from the server's environment, when they are set. LD_LIBRARY_PATH and
|
|
2
|
+
* DYLD_LIBRARY_PATH stay out on purpose: a library path is a load-path hijack (an empty entry is the helper's working
|
|
3
|
+
* directory) for a program reading a hostile file, and no install needs it (the image's ffmpeg is static; apt, Homebrew,
|
|
4
|
+
* Nix and conda builds find their libraries by rpath or install name). A build that does goes behind a wrapper on PATH. */
|
|
2
5
|
export declare const HELPER_ENV_NAMES: readonly ["PATH", "LANG", "LC_ALL", "TMPDIR"];
|
|
3
6
|
/** A helper program's environment: HELPER_ENV_NAMES from `from` (the server's own by default), nothing else. */
|
|
4
7
|
export declare function helperEnv(from?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
package/dist/helper-env.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// to be found, the locale and the temp directory, and nothing else. The server's own environment holds secrets (model and
|
|
3
3
|
// tool keys, its token), and a helper parsing a hostile document must not hold them: any process of the same user can read
|
|
4
4
|
// a process's environment from /proc/<pid>/environ.
|
|
5
|
-
/** The names a helper program gets, from the server's environment, when they are set.
|
|
5
|
+
/** The names a helper program gets, from the server's environment, when they are set. LD_LIBRARY_PATH and
|
|
6
|
+
* DYLD_LIBRARY_PATH stay out on purpose: a library path is a load-path hijack (an empty entry is the helper's working
|
|
7
|
+
* directory) for a program reading a hostile file, and no install needs it (the image's ffmpeg is static; apt, Homebrew,
|
|
8
|
+
* Nix and conda builds find their libraries by rpath or install name). A build that does goes behind a wrapper on PATH. */
|
|
6
9
|
export const HELPER_ENV_NAMES = ["PATH", "LANG", "LC_ALL", "TMPDIR"];
|
|
7
10
|
/** A helper program's environment: HELPER_ENV_NAMES from `from` (the server's own by default), nothing else. */
|
|
8
11
|
export function helperEnv(from = process.env) {
|
package/dist/host-check.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/** The name a Host header gives,
|
|
2
|
-
|
|
3
|
-
export declare function hostName(header: string | undefined): string | undefined;
|
|
1
|
+
/** The name a Host header gives, without its port (hostParts). */
|
|
2
|
+
export declare const hostName: (header: string | undefined) => string | undefined;
|
|
4
3
|
/** Whether a Host name (as hostName gives it) is this machine's own: localhost, an IPv4 loopback address or [::1]. Not a name
|
|
5
4
|
* an operator allowed (--allow-host, AGENTRUN_PUBLIC_URL): those pass the server's Host check, and a route that reads this
|
|
6
5
|
* machine's files asks for more. */
|
package/dist/host-check.js
CHANGED
|
@@ -3,21 +3,27 @@
|
|
|
3
3
|
// the check is on the name alone. The port is not part of it: through a tunnel (`ssh -L 8080:localhost:7340`), a proxy in
|
|
4
4
|
// front, or a server that took the next free port, a browser sends the port it opened, which is not the server's, and a
|
|
5
5
|
// page that rebound its name gains nothing from any port.
|
|
6
|
-
/**
|
|
7
|
-
* header that is not `name` or `name:port`: no user part, no path, no empty
|
|
8
|
-
|
|
6
|
+
/** A Host header's name, lowercased (an IPv6 address keeps its brackets), and its port when it names one. Undefined for a
|
|
7
|
+
* header that is not `name` or `name:port`: no user part, no path, no empty, non-numeric or out-of-range port. */
|
|
8
|
+
function hostParts(header) {
|
|
9
9
|
const match = /^(\[[0-9a-f:.]+\]|[a-z0-9._-]+)(?::(\d{1,5}))?$/.exec(String(header ?? "").trim().toLowerCase());
|
|
10
|
-
|
|
10
|
+
if (!match)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (match[2] === undefined)
|
|
13
|
+
return { name: match[1] };
|
|
14
|
+
const port = Number(match[2]);
|
|
15
|
+
return port <= 65535 ? { name: match[1], port } : undefined;
|
|
11
16
|
}
|
|
17
|
+
/** The name a Host header gives, without its port (hostParts). */
|
|
18
|
+
export const hostName = (header) => hostParts(header)?.name;
|
|
12
19
|
/** Whether a Host name (as hostName gives it) is this machine's own: localhost, an IPv4 loopback address or [::1]. Not a name
|
|
13
20
|
* an operator allowed (--allow-host, AGENTRUN_PUBLIC_URL): those pass the server's Host check, and a route that reads this
|
|
14
21
|
* machine's files asks for more. */
|
|
15
22
|
export const isLoopbackName = (name) => name === "localhost" || name === "[::1]" || (name !== undefined && /^127(\.\d{1,3}){3}$/.test(name));
|
|
16
23
|
/** The port a Host header names (1 to 65535), or undefined for none, or for a header that is not `name` or `name:port`. */
|
|
17
24
|
export function hostPort(header) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
return port >= 1 && port <= 65535 ? port : undefined;
|
|
25
|
+
const port = hostParts(header)?.port ?? 0;
|
|
26
|
+
return port >= 1 ? port : undefined;
|
|
21
27
|
}
|
|
22
28
|
/** The names a server listening on loopback `host` answers to: this machine's (localhost, 127.0.0.1, [::1], and `host`
|
|
23
29
|
* itself), each --allow-host name, and the name of the address people open (AGENTRUN_PUBLIC_URL), which a proxy in
|
package/dist/hosted-search.js
CHANGED
|
@@ -144,5 +144,5 @@ export async function hostedSearched(query, n, ref, signal, models) {
|
|
|
144
144
|
// Results found, and a later search of the same request failing all the same (too_many_requests after hits): the run
|
|
145
145
|
// gets the results, and the breaker the limit its codes name (no Retry-After reaches here: 60 s).
|
|
146
146
|
const limit = limitOf(read.codes().join(" "));
|
|
147
|
-
return { answer: { provider: "native", query, results: read.hits().slice(0, n), ...(said ? { text: clip(said, ANSWER_MAX) } : {}) }, ...(limit ? { limit } : {}) };
|
|
147
|
+
return { answer: { provider: "native", objective: query, queries: [query], results: read.hits().slice(0, n), ...(said ? { text: clip(said, ANSWER_MAX) } : {}) }, ...(limit ? { limit } : {}) };
|
|
148
148
|
}
|
package/dist/import.d.ts
CHANGED
|
@@ -47,7 +47,9 @@ export declare const MAX_CANDIDATES = 500;
|
|
|
47
47
|
/** The most of one instructions or skill file read, and of one agent's skill files together. */
|
|
48
48
|
export declare const MAX_FILE_BYTES: number;
|
|
49
49
|
export declare const MAX_SKILL_BYTES: number;
|
|
50
|
-
/** The project's skill folders, each `<dir>/<name>/` with its SKILL.md, by where each harness keeps them.
|
|
50
|
+
/** The project's skill folders, each `<dir>/<name>/` with its SKILL.md, by where each harness keeps them. OpenCode reads
|
|
51
|
+
* `skill/` and `skills/` in each of its config folders, the project's `.opencode` among them. A home's own folders (its
|
|
52
|
+
* ~/.config/opencode, ~/.claude) are no project's, and none is read. */
|
|
51
53
|
export declare const SKILL_DIRS: string[];
|
|
52
54
|
export type ImportOptions = {
|
|
53
55
|
/** The home whose sessions are read (the person's own). */
|
|
@@ -58,7 +60,8 @@ export type ImportOptions = {
|
|
|
58
60
|
/** Keep projects whose directory is gone (a deleted worktree's, a moved checkout's): each still its own agent, with no
|
|
59
61
|
* instructions or skills to read. */
|
|
60
62
|
deleted?: boolean;
|
|
61
|
-
/** The environment whose key-shaped values are cut out of everything written
|
|
63
|
+
/** The environment whose key-shaped values are cut out of everything written, and where each source keeps its own
|
|
64
|
+
* folders (CLAUDE_CONFIG_DIR, CODEX_HOME, OpenCode's XDG_DATA_HOME and OPENCODE_DB). */
|
|
62
65
|
env: NodeJS.ProcessEnv;
|
|
63
66
|
/** The tool keys saved through the settings API, opened (tool-keys.ts' `values`): cut out by the same rule. */
|
|
64
67
|
stored?: Record<string, string>;
|
|
@@ -95,7 +98,7 @@ export type ImportCandidate = {
|
|
|
95
98
|
last_active: string | null;
|
|
96
99
|
};
|
|
97
100
|
/** Why a session file or a project's file is left out, by kind, as the left-out counts group them (leftOutLines). */
|
|
98
|
-
export type LeftOut = "gone" | "temp" | "live" | "large" | "unread" | "no-project" | "no-words" | "copies" | "vanished" | "file";
|
|
101
|
+
export type LeftOut = "gone" | "temp" | "live" | "large" | "unread" | "no-project" | "no-words" | "mirror" | "copies" | "vanished" | "file";
|
|
99
102
|
/** `session`, when the file was read: the session it holds (`<source>:<id>`), so a session of two files (a resumed Codex
|
|
100
103
|
* thread) is counted once. */
|
|
101
104
|
export type Skipped = {
|
|
@@ -112,9 +115,11 @@ export type ProjectPlan = {
|
|
|
112
115
|
};
|
|
113
116
|
/** `already`: the session files an earlier import took whole, left unread; `held`, the runs an import would not take
|
|
114
117
|
* again: theirs, and (when measuring) those of planned sessions the store holds already. `children`: the locators of each
|
|
115
|
-
* session's subagents, whose usage is its run's: Claude Code's by the locator (locatorKey) of the session file beside them, Codex's by `source:thread
|
|
116
|
-
* no parent, counted in a summary's totals alone. `found`: each other planned session measured,
|
|
118
|
+
* session's subagents, whose usage is its run's: Claude Code's by the locator (locatorKey) of the session file beside them, Codex's by `source:thread`. `untied`, those
|
|
119
|
+
* of subagents whose file names no parent, counted in a summary's totals alone. `found`: each other planned session measured,
|
|
117
120
|
* when the plan was made to (`measure`). `stopped`: `signal` ended the listing with session files still unlisted. */
|
|
121
|
+
/** `mirrorIds`: each Claude Code session id a request names (`mirrors`) that the import keeps as another (a hash: it
|
|
122
|
+
* holds a key), by the id as named: the mirror rule looks a request's session up by the id as kept. */
|
|
118
123
|
export type Plan = {
|
|
119
124
|
projects: ProjectPlan[];
|
|
120
125
|
skipped: Skipped[];
|
|
@@ -125,6 +130,7 @@ export type Plan = {
|
|
|
125
130
|
locator: Locator;
|
|
126
131
|
source: Source;
|
|
127
132
|
}[];
|
|
133
|
+
mirrorIds?: Map<string, string>;
|
|
128
134
|
found?: Found[];
|
|
129
135
|
secretsFound?: number;
|
|
130
136
|
stopped?: true;
|
|
@@ -158,9 +164,6 @@ export type ImportReport = {
|
|
|
158
164
|
* With `env`, the values of its keys are cut from a name and a folder as the import cuts them. */
|
|
159
165
|
export declare function candidatesOf(plan: Pick<Plan, "projects">, env?: NodeJS.ProcessEnv): ImportCandidate[];
|
|
160
166
|
export declare const agentIdOf: (cwd: string) => string;
|
|
161
|
-
/** What an import would take: the sessions under `home`, by project, with what it leaves out and why. Keeps no turns
|
|
162
|
-
* (with `measure`, only until each session is measured), and reads no file `store`'s imports already read whole and
|
|
163
|
-
* that has not changed since. */
|
|
164
167
|
export declare function planImport({ home, sources, all, deleted, now, temp: tempDir, measure, env, stored, own, signal, keys: scan, onKeys, only }: ImportOptions, store?: ImportStore): Promise<Plan>;
|
|
165
168
|
/** The subagents tied to no session: each one's tokens and tool calls, for a summary's totals, each response once. */
|
|
166
169
|
export declare function untiedFound(plan: Plan): Promise<Found[]>;
|