@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.48
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 +211 -1
- package/NOTICE +4 -0
- package/README.md +350 -53
- package/dist/acp-package.d.ts +53 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +3 -4
- package/dist/adapter-facts.js +4 -4
- package/dist/adapters.d.ts +3 -5
- package/dist/adapters.js +1 -31
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/answer-json.d.ts +10 -0
- package/dist/answer-json.js +24 -0
- package/dist/api-only.d.ts +11 -11
- package/dist/api-only.js +16 -11
- package/dist/archil-routes.js +2 -1
- package/dist/browser-live.d.ts +9 -4
- package/dist/browser-live.js +18 -5
- package/dist/cap.js +10 -2
- package/dist/chatgpt-plan.js +2 -1
- package/dist/cli.js +109 -41
- package/dist/composio-made.d.ts +19 -2
- package/dist/composio-made.js +17 -5
- package/dist/composio-preset.d.ts +42 -7
- package/dist/composio-preset.js +106 -70
- package/dist/composio-triggers.d.ts +9 -4
- package/dist/composio-triggers.js +20 -13
- package/dist/computer-attach.d.ts +11 -10
- package/dist/computer-attach.js +13 -14
- package/dist/computer-commands.d.ts +3 -0
- package/dist/computer-commands.js +3 -2
- package/dist/computer-lost.d.ts +4 -0
- package/dist/computer-lost.js +8 -3
- package/dist/computer-routes.d.ts +8 -5
- package/dist/computer-routes.js +7 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +14 -76
- package/dist/computers.js +24 -68
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +6 -0
- package/dist/console/assets/index-CTGegcKt.css +1 -0
- package/dist/console/assets/index-D1Se6mgG.js +715 -0
- package/dist/console/index.html +2 -2
- package/dist/cost-heal.d.ts +13 -0
- package/dist/cost-heal.js +27 -0
- package/dist/dial-relay.d.ts +6 -2
- package/dist/dial-relay.js +9 -12
- package/dist/email/routes.js +2 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -0
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/faux-computers.d.ts +2 -3
- package/dist/faux-computers.js +9 -31
- package/dist/github-connection.js +2 -1
- package/dist/harness-archive.d.ts +19 -2
- package/dist/harness-archive.js +49 -15
- package/dist/harness-check.d.ts +75 -0
- package/dist/harness-check.js +518 -0
- package/dist/harness-cursor.d.ts +28 -0
- package/dist/harness-cursor.js +42 -0
- package/dist/harness-goose.d.ts +4 -29
- package/dist/harness-goose.js +6 -86
- package/dist/harness-module.d.ts +4 -0
- package/dist/harness-module.js +1 -0
- package/dist/harness-owned.d.ts +52 -0
- package/dist/harness-owned.js +92 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +335 -0
- package/dist/harness-table.d.ts +120 -5
- package/dist/harness-table.js +280 -6
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +5 -4
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +14 -0
- package/dist/host.d.ts +10 -3
- package/dist/host.js +17 -3
- package/dist/import-sources.d.ts +2 -0
- package/dist/import-sources.js +2 -0
- package/dist/import-summary.d.ts +15 -5
- package/dist/import-summary.js +24 -8
- package/dist/import.d.ts +24 -4
- package/dist/import.js +108 -26
- package/dist/key-refusal.d.ts +3 -1
- package/dist/key-refusal.js +26 -5
- package/dist/key-words.d.ts +1 -1
- package/dist/key-words.js +4 -4
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +31 -20
- package/dist/learn/compile.js +12 -5
- package/dist/learn/promote.d.ts +80 -2
- package/dist/learn/promote.js +95 -3
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +23 -0
- package/dist/learned-nodes.d.ts +4 -3
- package/dist/learned-workflow.js +4 -1
- package/dist/learning-cost.d.ts +6 -16
- package/dist/learning-cost.js +6 -12
- package/dist/learning-model.d.ts +18 -0
- package/dist/learning-model.js +77 -0
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +1 -1
- package/dist/listen-first.d.ts +10 -0
- package/dist/listen-first.js +25 -1
- package/dist/llms.txt +2 -1
- package/dist/mcp-gateway.d.ts +2 -1
- package/dist/mcp-gateway.js +31 -15
- package/dist/mcp-probe.d.ts +18 -6
- package/dist/mcp-probe.js +41 -8
- package/dist/mcp-secret-writes.d.ts +8 -0
- package/dist/mcp-secret-writes.js +104 -4
- package/dist/mcp-servers-store.d.ts +11 -5
- package/dist/mcp-servers-store.js +46 -20
- package/dist/model-form.d.ts +2 -1
- package/dist/model-form.js +30 -16
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +5 -3
- package/dist/model.js +26 -18
- package/dist/monid.js +1 -1
- package/dist/native/binding.d.ts +4 -0
- package/dist/native/binding.js +9 -0
- package/dist/native/cli.d.ts +3 -2
- package/dist/native/cli.js +6 -5
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +356 -43
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +9 -0
- package/dist/page.js +10 -2
- package/dist/port-models.js +17 -10
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +12 -3
- package/dist/public-address.d.ts +28 -0
- package/dist/public-address.js +62 -0
- package/dist/run-launch.d.ts +1 -1
- package/dist/run-launch.js +1 -1
- package/dist/run-secrets.d.ts +3 -2
- package/dist/run-secrets.js +7 -4
- package/dist/run-trace.js +6 -3
- package/dist/runner/adapter-loop.d.ts +14 -8
- package/dist/runner/adapter-loop.js +58 -24
- package/dist/runner/adapter-run-spec.d.ts +15 -2
- package/dist/runner/adapter-run-spec.js +48 -10
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +6 -26
- package/dist/runner/adapters/pi.d.ts +5 -2
- package/dist/runner/adapters/pi.js +7 -4
- package/dist/runner/audit.d.ts +7 -0
- package/dist/runner/audit.js +15 -6
- package/dist/runner/claim-secrets.js +5 -1
- package/dist/runner/cli-run-spec.js +22 -10
- package/dist/runner/compare-end.d.ts +43 -0
- package/dist/runner/compare-end.js +95 -0
- package/dist/runner/computer-journal.d.ts +3 -0
- package/dist/runner/computer-journal.js +22 -2
- package/dist/runner/conformance/host-tools.d.ts +4 -0
- package/dist/runner/conformance/host-tools.js +14 -0
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +94 -54
- package/dist/runner/held.d.ts +5 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +3 -0
- package/dist/runner/loop-contract.d.ts +10 -0
- package/dist/runner/main.d.ts +5 -5
- package/dist/runner/main.js +62 -11
- package/dist/runner/mcp-claim.js +40 -12
- package/dist/runner/meta-tools.js +4 -2
- package/dist/runner/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +44 -0
- package/dist/runner/presence.js +96 -0
- package/dist/runner/promotion.d.ts +70 -7
- package/dist/runner/promotion.js +178 -28
- package/dist/runner/run-child-host.js +40 -10
- package/dist/runner/runner.d.ts +5 -0
- package/dist/runner/runner.js +8 -0
- package/dist/runner/sdk-loop.js +25 -1
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +19 -7
- package/dist/runner/workflow-first.d.ts +5 -2
- package/dist/runner/workflow-first.js +6 -3
- package/dist/runner/workflow-spec.js +3 -2
- package/dist/runs-over-store.d.ts +7 -2
- package/dist/runs-over-store.js +12 -4
- package/dist/sdk/check.d.ts +31 -0
- package/dist/sdk/check.js +58 -0
- package/dist/sdk/runs.d.ts +11 -3
- package/dist/sdk/runs.js +90 -15
- package/dist/sdk/schema.js +12 -4
- package/dist/secret-writes.d.ts +16 -3
- package/dist/secret-writes.js +28 -3
- package/dist/server-secrets-store.js +5 -0
- package/dist/server.d.ts +34 -2
- package/dist/server.js +437 -90
- package/dist/sign-ins-secrets.js +4 -1
- package/dist/skills/agentrun-serve/SKILL.md +11 -0
- package/dist/slack-url.d.ts +5 -0
- package/dist/slack-url.js +11 -0
- package/dist/slack.d.ts +107 -0
- package/dist/slack.js +292 -0
- package/dist/start-switches.d.ts +28 -0
- package/dist/start-switches.js +37 -0
- package/dist/stats.d.ts +1 -1
- package/dist/stats.js +2 -1
- package/dist/stop-signals.d.ts +11 -0
- package/dist/stop-signals.js +22 -0
- package/dist/store/agent-body.d.ts +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0020_runners.sql +18 -0
- package/dist/store/postgres/store.d.ts +1 -1
- package/dist/store/postgres/store.js +4 -2
- package/dist/store/schema.d.ts +13 -5
- package/dist/store/schema.js +20 -11
- package/dist/store/seal.d.ts +16 -4
- package/dist/store/sqlite/store.d.ts +1 -1
- package/dist/store/sqlite/store.js +112 -28
- package/dist/store/store.d.ts +78 -24
- package/dist/store/store.js +11 -0
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +7 -0
- package/dist/store-reads/cap.js +11 -1
- package/dist/store-reads/journal.js +27 -1
- package/dist/store-reads/learning.d.ts +23 -2
- package/dist/store-reads/learning.js +29 -8
- package/dist/store-reads/runs.d.ts +9 -0
- package/dist/store-reads/runs.js +19 -6
- package/dist/store-reads/stats.d.ts +4 -1
- package/dist/store-reads/stats.js +15 -6
- package/dist/store-view.d.ts +125 -14
- package/dist/store-view.js +156 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/template-eval.js +5 -2
- package/dist/template-github-permissions.d.ts +5 -1
- package/dist/template-github-permissions.js +7 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +8 -0
- package/dist/timeline/timeline.js +30 -0
- package/dist/tool-gate.d.ts +8 -4
- package/dist/tool-gate.js +6 -7
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.d.ts +4 -0
- package/dist/tool-plane.js +12 -12
- package/dist/trigger-adapter.d.ts +3 -4
- package/dist/trigger-adapter.js +2 -2
- package/dist/trigger-composio.js +3 -3
- package/dist/trigger-email.js +0 -2
- package/dist/trigger-feed.js +0 -2
- package/dist/trigger-schedule.js +3 -0
- package/dist/trigger-secrets-shown.d.ts +6 -3
- package/dist/trigger-secrets-shown.js +22 -13
- package/dist/trigger-targets.d.ts +12 -3
- package/dist/trigger-targets.js +90 -10
- package/dist/triggers.d.ts +2 -2
- package/dist/validate.js +5 -1
- package/dist/viewer-credential.d.ts +25 -0
- package/dist/viewer-credential.js +51 -0
- package/dist/webhooks.d.ts +82 -8
- package/dist/webhooks.js +128 -45
- package/dist/wires.d.ts +6 -1
- package/dist/wires.js +5 -0
- package/dist/workspace/attach.d.ts +3 -2
- package/dist/workspace/attach.js +2 -1
- package/dist/workspace/attached-computers.d.ts +6 -8
- package/dist/workspace/attached-computers.js +27 -24
- package/dist/workspace/computer-deps.d.ts +2 -3
- package/dist/workspace/computer-deps.js +3 -6
- package/dist/workspace/computer-for-claim.js +72 -96
- package/dist/workspace/computer-kept.d.ts +0 -7
- package/dist/workspace/computer-kept.js +0 -17
- package/dist/workspace/resolve-computer.d.ts +23 -14
- package/dist/workspace/resolve-computer.js +66 -61
- package/dist/workspace/synced-folder.d.ts +20 -15
- package/dist/workspace/synced-folder.js +33 -43
- package/launcher/agentrun-serve +4 -1
- package/package.json +18 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/templates/code-review/agent.md +2 -3
- package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
- package/templates/code-review/evals/other-repo/case.yaml +0 -1
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { spawn } from "node:child_process";
|
|
|
10
10
|
import { accessSync, chmodSync, constants as fsConstants, statSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { dirname, join, resolve } from "node:path";
|
|
12
12
|
import { defaultData, removeOwnRecord, SERVER_FILE, writeDurableSync } from "./server-fs.js";
|
|
13
|
-
import { REPEAT_MS, stopOnSignals } from "./stop-signals.js";
|
|
13
|
+
import { REPEAT_MS, stopOnce, stopOnSignals } from "./stop-signals.js";
|
|
14
14
|
import { resetPassword } from "./owner.js";
|
|
15
15
|
import { banner } from "./print.js";
|
|
16
16
|
import { parseTokens } from "./api-token.js";
|
|
@@ -31,11 +31,14 @@ installEnvProxy();
|
|
|
31
31
|
const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--faux-github] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--no-runner] [--harness-module MODULE ...]
|
|
32
32
|
agentrun-serve reset-password [--data DIR]
|
|
33
33
|
agentrun-serve validate-template DIR
|
|
34
|
-
agentrun-serve install-harness goose [--data DIR]
|
|
34
|
+
agentrun-serve install-harness goose|cursor [--data DIR]
|
|
35
|
+
agentrun-serve install-harness --recipe FILE [--data DIR]
|
|
36
|
+
agentrun-serve check-harness --recipe FILE [--model PROVIDER/MODEL] [--data DIR] [--report FILE] [--cap USD]
|
|
35
37
|
agentrun-serve eval-template DIR [--case NAME ...] [--runs N] [--server URL | --on-data DIR] [--grader-model PROVIDER/MODEL] [--report FILE] [--faux MODULE]
|
|
36
38
|
agentrun-serve import [--data DIR] [--from claude-code,codex,pi] [--dry-run] [--include-deleted] [--all] [--verbose] [--port N]
|
|
37
39
|
agentrun-serve runner --data DIR [--loops N] [--drain-timeout D] [--name NAME]
|
|
38
40
|
agentrun-serve runner --check --data DIR [--name NAME]
|
|
41
|
+
agentrun-serve native discover|connect --project PATH [--runtime claude-code|codex] [--agent NAME|--profile NAME] [--url URL] [--data DIR]
|
|
39
42
|
|
|
40
43
|
--data DIR the agent store and its runs (default ~/.local/share/agentrun/agents); the token is DIR/.token, mode 0600
|
|
41
44
|
--listen ADDR the address to listen on (default 127.0.0.1); on any other, every Host name is served and the token
|
|
@@ -90,13 +93,11 @@ or not (ChatGPT-plan requests don't count): the next is not sent and the run fai
|
|
|
90
93
|
end, and per refused credential; AGENTRUN_LOG=quiet leaves out the request lines.
|
|
91
94
|
|
|
92
95
|
AGENTRUN_TELEMETRY=0 (or DO_NOT_TRACK=1) turns off the anonymous usage counts (docs/telemetry.md): a random id, the
|
|
93
|
-
version, the platform and how many runs as a range, never prompts, files or keys. Off in CI and under --faux too;
|
|
96
|
+
version, the platform and how many runs as a range, never prompts, files or keys. Off in CI, under a test runner and under --faux too;
|
|
94
97
|
AGENTRUN_TELEMETRY=debug prints each event on stderr and sends none.
|
|
95
98
|
|
|
96
|
-
AGENTRUN_API_ONLY=1 serves the run
|
|
97
|
-
|
|
98
|
-
and usage. Every other address (the page, sign-in, setup, settings, MCP, triggers and their hooks, the rest of agents)
|
|
99
|
-
is a 404, and there are no accounts.
|
|
99
|
+
AGENTRUN_API_ONLY=1 serves the run API alone, for a server behind its caller's backend (the routes in api-only.ts; every
|
|
100
|
+
other address is a 404, and there are no accounts).
|
|
100
101
|
|
|
101
102
|
The page is for one person, who signs in with a password (AGENTRUN_ACCOUNTS=0 turns this off; the token works for
|
|
102
103
|
scripts and the CLI either way). With no AGENTRUN_PUBLIC_URL, listening on loopback, the first visit to the page sets the
|
|
@@ -132,6 +133,23 @@ times in place of its own count; --grader-model is the llm graders' model (defau
|
|
|
132
133
|
model request from MODULE, as the server's --faux does. Progress goes to stderr, a summary to stdout, the whole report
|
|
133
134
|
as JSON to --report FILE. Exit 0 when every case passed, 1 when one failed, 2 when the flags, the package or a case are
|
|
134
135
|
wrong and nothing ran. Real runs cost money: each case's prompt.md caps each of its runs (max_cost_usd).`;
|
|
136
|
+
// A command's --help (or -h), before the command reads anything else it was given: its own lines of USAGE and the
|
|
137
|
+
// paragraph that says what it does, where there is one, on stdout, exit 0. No store is opened and nothing is written,
|
|
138
|
+
// so `reset-password --help` clears no password and `install-harness goose --help` downloads nothing. A command USAGE
|
|
139
|
+
// has no line for (remote-bridge) has no --help of its own.
|
|
140
|
+
const command = process.argv[2];
|
|
141
|
+
const commandArgs = process.argv.slice(3);
|
|
142
|
+
/** The command's own lines of USAGE, the first "usage:" and the rest under it; empty when USAGE has none for it. */
|
|
143
|
+
const commandUsage = USAGE.split("\n")
|
|
144
|
+
.filter((line) => line.trimStart().replace(/^usage: /, "").startsWith(`agentrun-serve ${command} `))
|
|
145
|
+
.map((line, i) => `${i === 0 ? "usage:" : " "} ${line.trimStart()}`)
|
|
146
|
+
.join("\n");
|
|
147
|
+
const optionsEnd = commandArgs.indexOf("--");
|
|
148
|
+
if (commandUsage && (optionsEnd === -1 ? commandArgs : commandArgs.slice(0, optionsEnd)).some((arg) => arg === "--help" || arg === "-h")) {
|
|
149
|
+
const about = USAGE.split("\n\n").find((block) => block.startsWith(`\`agentrun-serve ${command}`));
|
|
150
|
+
console.log([commandUsage, ...(about ? [about] : []), "agentrun-serve --help says what the server's own flags and variables do."].join("\n\n"));
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
135
153
|
if (process.argv[2] === "remote-bridge") {
|
|
136
154
|
const { runRemoteWorkerBridge } = await import("./native/remote-worker-bridge.js");
|
|
137
155
|
await runRemoteWorkerBridge();
|
|
@@ -139,7 +157,7 @@ if (process.argv[2] === "remote-bridge") {
|
|
|
139
157
|
}
|
|
140
158
|
if (process.argv[2] === "native") {
|
|
141
159
|
const { nativeMain } = await import("./native/cli.js");
|
|
142
|
-
process.exit(await nativeMain(process.argv.slice(3)));
|
|
160
|
+
process.exit(await nativeMain(process.argv.slice(3), commandUsage));
|
|
143
161
|
}
|
|
144
162
|
if (process.argv[2] === "reset-password") {
|
|
145
163
|
let dir;
|
|
@@ -155,37 +173,66 @@ if (process.argv[2] === "reset-password") {
|
|
|
155
173
|
console.log(`The password is cleared and every browser is signed out (${target}). The next visit to the page sets a new one.`);
|
|
156
174
|
process.exit(0);
|
|
157
175
|
}
|
|
158
|
-
// A harness its owner installs (harness-goose.ts: Goose
|
|
159
|
-
// checked and unpacked into DIR/harnesses/<name> (harness-archive.ts). 0 once it is there (now or already), 1
|
|
160
|
-
// install failed (its code and the command to try again), 2 for a name it does not install. No provider key is
|
|
176
|
+
// A harness its owner installs (harness-goose.ts: Goose; harness-cursor.ts: Cursor), never a run: its pinned archive
|
|
177
|
+
// downloaded, checked and unpacked into DIR/harnesses/<name> (harness-archive.ts). 0 once it is there (now or already), 1
|
|
178
|
+
// when the install failed (its code and the command to try again), 2 for a name it does not install. No provider key is
|
|
179
|
+
// read, Cursor's included.
|
|
161
180
|
if (process.argv[2] === "install-harness") {
|
|
162
181
|
const usage = (message) => (console.error(`agentrun-serve install-harness: ${message}\n\n${USAGE}`), process.exit(2));
|
|
163
182
|
const read = () => {
|
|
164
183
|
try {
|
|
165
|
-
return parseArgs({ args: process.argv.slice(3), options: { data: { type: "string" } }, allowPositionals: true });
|
|
184
|
+
return parseArgs({ args: process.argv.slice(3), options: { data: { type: "string" }, recipe: { type: "string" } }, allowPositionals: true });
|
|
166
185
|
}
|
|
167
186
|
catch (error) {
|
|
168
187
|
return usage(error.message);
|
|
169
188
|
}
|
|
170
189
|
};
|
|
171
190
|
const { values, positionals } = read();
|
|
172
|
-
|
|
191
|
+
// A recipe's harness (harness-recipe.ts): the recipe loaded under its five rules first, so a refused one downloads
|
|
192
|
+
// nothing; then its release for this platform, as the Goose install does it.
|
|
193
|
+
if (values.recipe !== undefined) {
|
|
194
|
+
if (positionals.length)
|
|
195
|
+
usage("it takes a harness's name or --recipe FILE, not both.");
|
|
196
|
+
const [{ ArchiveInstallFailed }, { installRecipe, loadRecipe, recipeCheckLine, RecipeRefused }] = await Promise.all([import("./harness-archive.js"), import("./harness-recipe.js")]);
|
|
197
|
+
const data = resolve(values.data ?? defaultData());
|
|
198
|
+
try {
|
|
199
|
+
const { recipe, file } = loadRecipe(values.recipe);
|
|
200
|
+
const said = { downloaded: "the archive is downloaded and its sha256 matches the recipe", unpacked: "unpacked", verified: "the binary's sha256 is checked" };
|
|
201
|
+
const { version, installed, binary, pinnedBy } = await installRecipe(recipe, file, data, { onStep: (step) => console.error(`${recipe.label}: ${said[step]}`) });
|
|
202
|
+
const held = { recipe: "the recipe's pin", "first-seen": "the first sha256 an earlier install recorded", recorded: "its sha256 recorded now, as the first one; a later binary that differs is refused" }[pinnedBy];
|
|
203
|
+
console.log(installed === "already"
|
|
204
|
+
? `${recipe.label} ${version} is installed in ${dirname(binary)} (already: the pinned binary is there, so nothing was downloaded; held to ${held}).`
|
|
205
|
+
: `${recipe.label} ${version} is installed in ${dirname(binary)} (now; the binary held to ${held}). Check it with: ${recipeCheckLine(file, data)} --model PROVIDER/MODEL`);
|
|
206
|
+
process.exit(0);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
if (!(error instanceof ArchiveInstallFailed) && !(error instanceof RecipeRefused))
|
|
210
|
+
throw error;
|
|
211
|
+
console.error(error.message);
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// The owner-installed harnesses (harness-owned.ts), each one's id, label, install and what its install checks.
|
|
216
|
+
const installers = await Promise.all([import("./harness-goose.js").then((m) => m.GOOSE), import("./harness-cursor.js").then((m) => m.CURSOR)]);
|
|
217
|
+
const names = installers.map((each) => each.id).join(" or ");
|
|
173
218
|
if (positionals.length !== 1)
|
|
174
|
-
usage(`it takes one harness: ${
|
|
175
|
-
|
|
176
|
-
|
|
219
|
+
usage(`it takes one harness: ${names}.`);
|
|
220
|
+
const chosen = installers.find((each) => each.id === positionals[0]);
|
|
221
|
+
if (!chosen)
|
|
222
|
+
usage(`it installs ${names}, not ${positionals[0]}: claude-agent and codex install on first use, and pi and opencode come with AgentRun.`);
|
|
223
|
+
const { label, install, verified } = chosen;
|
|
177
224
|
const [{ ArchiveInstallFailed }, { acpPackage, ACP_PACKAGE }] = await Promise.all([import("./harness-archive.js"), import("./acp-package.js")]);
|
|
178
225
|
if (!acpPackage()) {
|
|
179
|
-
console.error(
|
|
226
|
+
console.error(`${label}'s adapter (${ACP_PACKAGE}) is not installed beside this server, so it has no pinned release to install.`);
|
|
180
227
|
process.exit(1);
|
|
181
228
|
}
|
|
182
229
|
const data = resolve(values.data ?? defaultData());
|
|
183
230
|
try {
|
|
184
|
-
const said = { downloaded: "the archive is downloaded and its sha256 matches the pin", unpacked: "unpacked", verified
|
|
185
|
-
const { version, installed, binary } = await
|
|
231
|
+
const said = { downloaded: "the archive is downloaded and its sha256 matches the pin", unpacked: "unpacked", verified };
|
|
232
|
+
const { version, installed, binary } = await install(data, { onStep: (step) => console.error(`${label}: ${said[step]}`) });
|
|
186
233
|
console.log(installed === "already"
|
|
187
|
-
?
|
|
188
|
-
:
|
|
234
|
+
? `${label} ${version} is installed in ${dirname(binary)} (already: the pinned release is there, so nothing was downloaded).`
|
|
235
|
+
: `${label} ${version} is installed in ${dirname(binary)} (now). Restart AgentRun to pick it up.`);
|
|
189
236
|
process.exit(0);
|
|
190
237
|
}
|
|
191
238
|
catch (error) {
|
|
@@ -195,6 +242,36 @@ if (process.argv[2] === "install-harness") {
|
|
|
195
242
|
process.exit(1);
|
|
196
243
|
}
|
|
197
244
|
}
|
|
245
|
+
// A recipe's agent run for real and judged (harness-check.ts): its report written as JSON, its stages and the three facts
|
|
246
|
+
// (resume, tool_gate, billing) printed. 0 when every stage passed, 1 when the recipe was refused, its binary is not the
|
|
247
|
+
// installed and pinned one, or a stage failed, 2 for usage. It spends: four short turns on --model, under --cap.
|
|
248
|
+
// `agentrun harness-check` runs it; its own word is check-harness, as install-harness is `agentrun harness install`'s.
|
|
249
|
+
if (process.argv[2] === "check-harness") {
|
|
250
|
+
const usage = (message) => (console.error(`agentrun-serve check-harness: ${message}\n\n${USAGE}`), process.exit(2));
|
|
251
|
+
const read = () => {
|
|
252
|
+
try {
|
|
253
|
+
return parseArgs({ args: process.argv.slice(3), options: { recipe: { type: "string" }, data: { type: "string" }, model: { type: "string" }, report: { type: "string" }, cap: { type: "string" } } });
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
return usage(error.message);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const { values } = read();
|
|
260
|
+
if (!values.recipe)
|
|
261
|
+
usage("--recipe FILE names the recipe to check.");
|
|
262
|
+
const cap = values.cap === undefined ? undefined : Number(values.cap);
|
|
263
|
+
if (cap !== undefined && !(Number.isFinite(cap) && cap > 0 && cap <= 5))
|
|
264
|
+
usage("--cap is the most the check may spend, in USD, above 0 and at most 5.");
|
|
265
|
+
const [{ harnessCheck, printedFacts, writeReport }, { withSecrets }] = await Promise.all([import("./harness-check.js"), import("./secrets.js")]);
|
|
266
|
+
const data = resolve(values.data ?? defaultData());
|
|
267
|
+
const report = await harnessCheck({ recipe: values.recipe, data, env: withSecrets(process.env), ...(values.model ? { model: values.model } : {}), ...(cap !== undefined ? { capUsd: cap } : {}), say: (line) => console.error(line) });
|
|
268
|
+
const file = resolve(values.report ?? `harness-check-${"id" in report.recipe ? report.recipe.id : "recipe"}.json`);
|
|
269
|
+
await writeReport(file, report);
|
|
270
|
+
for (const line of printedFacts(report))
|
|
271
|
+
console.log(line);
|
|
272
|
+
console.log(`report: ${file}`);
|
|
273
|
+
process.exit(report.ok ? 0 : 1);
|
|
274
|
+
}
|
|
198
275
|
// A template package folder checked by the one validator the server runs on the packages it ships (templates.ts): what
|
|
199
276
|
// it holds as one JSON line and 0, or each problem and 1. Nothing in the package runs.
|
|
200
277
|
if (process.argv[2] === "validate-template") {
|
|
@@ -269,22 +346,9 @@ if (process.argv[2] === "eval-template") {
|
|
|
269
346
|
usage(`--report's folder ${folder} is not a folder this command can write in, or the report's path is a folder or a file it can't write.`);
|
|
270
347
|
}
|
|
271
348
|
// The first Ctrl-C (or a stop) cancels the run in progress and cleans up what the eval made, as its end does: a run
|
|
272
|
-
// left going would go on spending. A second one leaves at once
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
let stoppedAt = 0;
|
|
276
|
-
const onStop = () => {
|
|
277
|
-
if (stop.signal.aborted) {
|
|
278
|
-
if (Date.now() - stoppedAt > REPEAT_MS)
|
|
279
|
-
process.exit(130);
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
stoppedAt = Date.now();
|
|
283
|
-
console.error("agentrun-serve eval-template: stopping: cancelling the run in progress and cleaning up (again to leave now)");
|
|
284
|
-
stop.abort();
|
|
285
|
-
};
|
|
286
|
-
process.on("SIGINT", onStop);
|
|
287
|
-
process.on("SIGTERM", onStop);
|
|
349
|
+
// left going would go on spending. A second one leaves at once (stop-signals.ts stopOnce).
|
|
350
|
+
const stop = stopOnce(() => console.error("agentrun-serve eval-template: stopping: cancelling the run in progress and cleaning up (again to leave now)"));
|
|
351
|
+
stop.hook();
|
|
288
352
|
try {
|
|
289
353
|
const report = await evalTemplate({
|
|
290
354
|
dir: resolve(positionals[0]), cases: given.case, ...(given.runs !== undefined ? { runs: Number(given.runs) } : {}),
|
|
@@ -470,8 +534,7 @@ catch (error) {
|
|
|
470
534
|
// (besideRunnerOptions): at most --max-runs runs at once, the rest waiting queued, and on the stop each busy run finishes
|
|
471
535
|
// its turn for up to --drain-timeout.
|
|
472
536
|
let runnerProc;
|
|
473
|
-
// Anonymous usage counts (
|
|
474
|
-
// under --faux. It hears each run's end from the runner beside the server; with --no-runner it counts no runs.
|
|
537
|
+
// Anonymous usage counts (docs/telemetry.md). It hears each run's end from the runner beside the server; with --no-runner it counts no runs.
|
|
475
538
|
const telemetry = startTelemetry({ data: resolve(data), ...(values.faux ? { faux: true } : {}) });
|
|
476
539
|
const { loops, loopsTold, drainMs } = besideRunnerOptions(serveOptions, process.env);
|
|
477
540
|
// A stop asked during the server's start starts no runner: nothing is claimed for the stop to cut.
|
|
@@ -500,6 +563,9 @@ if (!values["no-runner"] && askedAt === undefined) {
|
|
|
500
563
|
process.exit(1);
|
|
501
564
|
}
|
|
502
565
|
console.error(`agentrun-serve: ${error.message}`);
|
|
566
|
+
// And said in the store, as the runner subcommand says it (presence.ts): while no runner that claims is there, the
|
|
567
|
+
// server refuses a launch in these words and fails the runs left queued, never queueing one for good.
|
|
568
|
+
serve.refuseRuns(error.message);
|
|
503
569
|
}
|
|
504
570
|
}
|
|
505
571
|
// A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
|
|
@@ -514,10 +580,12 @@ if (serve.setupUrl && serve.setupOpen)
|
|
|
514
580
|
if (telemetry.notice)
|
|
515
581
|
console.error(telemetry.notice);
|
|
516
582
|
// The console's page, once the server listens: never its sign-in link, whose token would sit in the opener's arguments
|
|
517
|
-
// and the browser's history.
|
|
583
|
+
// and the browser's history. With no owner yet, the setup page instead, its code filled in when setup takes one: the
|
|
584
|
+
// first visit sets the password with nothing to look up. That code works once and for 30 minutes, unlike the token, so
|
|
585
|
+
// the opener's arguments and the browser's history hold nothing that outlasts the setup.
|
|
518
586
|
// API-only: there is no console, so nothing to open.
|
|
519
587
|
if (values.open && !apiOnly && canOpen(process.env))
|
|
520
|
-
spawn(process.platform === "darwin" ? "open" : "xdg-open", [`${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
588
|
+
spawn(process.platform === "darwin" ? "open" : "xdg-open", [serve.setupUrl ?? `${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
521
589
|
const record = join(resolve(data), SERVER_FILE);
|
|
522
590
|
// The record goes only while it is this server's: a server that takes the lock next writes its own, which this stop must
|
|
523
591
|
// not remove. One stop per press or process-manager stop; a later signal, or a stop past its deadline, stops at once
|
package/dist/composio-made.d.ts
CHANGED
|
@@ -4,11 +4,18 @@ export type Made = {
|
|
|
4
4
|
made: boolean;
|
|
5
5
|
};
|
|
6
6
|
/** What a preset server stands on at Composio: the user its address names, its auth config (none for a toolkit with no
|
|
7
|
-
* sign-in) and the connected accounts
|
|
7
|
+
* sign-in; `named`, from a save, when the owner named it: theirs, never recorded as made) and the connected accounts
|
|
8
|
+
* under it. `per_run`: saved with `user_id: "per_run"` (COMPOSIO_PER_RUN), its address names no user and no account,
|
|
9
|
+
* and each run names its own (mcp_auth, composioPerRun); `user` is then that word and `accounts` empty. Only a save made
|
|
10
|
+
* since the mode exists writes it, so a server saved before for a Composio user literally named "per_run" keeps that
|
|
11
|
+
* user until it is saved again. */
|
|
8
12
|
export type ComposioMade = {
|
|
9
13
|
user: string;
|
|
10
|
-
auth_config: Made
|
|
14
|
+
auth_config: (Made & {
|
|
15
|
+
named?: true;
|
|
16
|
+
}) | null;
|
|
11
17
|
accounts: Made[];
|
|
18
|
+
per_run?: true;
|
|
12
19
|
};
|
|
13
20
|
/** What a delete does at Composio beyond the MCP server: what it removes, in order (the accounts before the auth config
|
|
14
21
|
* they are under), and what it keeps, each with whose it stays (`by`: the saved server that uses it too; none: this
|
|
@@ -34,10 +41,20 @@ export declare const storedMade: (made: ComposioMade, row: {
|
|
|
34
41
|
/** A stored record read for the row created at `createdAt`; undefined when there is none, it was written for another row,
|
|
35
42
|
* or it is not one (then nothing beyond the MCP server is removed). */
|
|
36
43
|
export declare function recordedMade(value: unknown, createdAt: number | undefined): ComposioMade | undefined;
|
|
44
|
+
/** Whether the saved server `row` is a per-run Composio server: auth headers (the install's sealed key) and its own
|
|
45
|
+
* record (`recorded`, read at composioMadeKey) saying per_run. Its runs call it as the Composio user and account each
|
|
46
|
+
* names (mcp_auth.<server> = {composio_user_id, connected_account_id?}); one that names none is refused unsent. */
|
|
47
|
+
export declare const composioPerRun: (row: {
|
|
48
|
+
auth: string;
|
|
49
|
+
createdAt: number;
|
|
50
|
+
}, recorded: unknown) => boolean;
|
|
37
51
|
/** A record a save writes, from what the preset found and made (`found`): a thing it found that a record of the server
|
|
38
52
|
* saved before over this row (`was`) or of another saved server (`others`) says was made here stays made here; and the
|
|
39
53
|
* accounts the server saved before had made, under the same auth config and user, stay its own. */
|
|
40
54
|
export declare function madeToWrite(found: ComposioMade, was: ComposioMade | undefined, others: readonly ComposioMade[]): ComposioMade;
|
|
55
|
+
/** The records of the other saved servers (`others`, by name) that say they made the auth config `id`, each as it is to
|
|
56
|
+
* be written once the owner named that config in a save: made by none of them, so none of their deletes removes it. */
|
|
57
|
+
export declare function releasedOf(id: string, others: readonly (readonly [string, ComposioMade, ...unknown[]])[]): [string, ComposioMade][];
|
|
41
58
|
/** What a removed server's record leaves to do, with the records of the servers still saved (`others`, by name): each
|
|
42
59
|
* thing it made that none of them uses is removed; one another uses is kept and passed to that one (`handover`: its record
|
|
43
60
|
* as it is to be written, owning it); one it didn't make is kept. */
|
package/dist/composio-made.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
// made that no other saved server uses (cleanupOf), and passes what another one uses to that one's record, so the last
|
|
7
7
|
// of them to go removes it. What this server didn't make (an auth config or an account the owner had already, or one no
|
|
8
8
|
// record says it made, as for a server saved before this was recorded) is never removed. A save over the server does the
|
|
9
|
-
// same with what the record it replaces made that the new one no longer stands on (droppedOf).
|
|
9
|
+
// same with what the record it replaces made that the new one no longer stands on (droppedOf). An auth config the owner
|
|
10
|
+
// names in a save (auth_config_id) is the owner's from that save on, whoever made it: the record written says it was not
|
|
11
|
+
// made here, and every other record's claim to have made it is let go (releasedOf), so no delete or save removes it.
|
|
10
12
|
import { isObject } from "./validate.js";
|
|
11
13
|
/** The store.settings key a server's record lives under. */
|
|
12
14
|
export const composioMadeKey = (name) => `mcp.composio/${name}`;
|
|
@@ -23,21 +25,31 @@ export function recordedMade(value, createdAt) {
|
|
|
23
25
|
const accounts = value.accounts.map(thingOf);
|
|
24
26
|
if (config === undefined || accounts.some((account) => !account))
|
|
25
27
|
return undefined;
|
|
26
|
-
return { user: value.user, auth_config: config, accounts: accounts };
|
|
28
|
+
return { user: value.user, auth_config: config, accounts: accounts, ...(value.per_run === true ? { per_run: true } : {}) };
|
|
27
29
|
}
|
|
30
|
+
/** Whether the saved server `row` is a per-run Composio server: auth headers (the install's sealed key) and its own
|
|
31
|
+
* record (`recorded`, read at composioMadeKey) saying per_run. Its runs call it as the Composio user and account each
|
|
32
|
+
* names (mcp_auth.<server> = {composio_user_id, connected_account_id?}); one that names none is refused unsent. */
|
|
33
|
+
export const composioPerRun = (row, recorded) => row.auth === "headers" && recordedMade(recorded, row.createdAt)?.per_run === true;
|
|
28
34
|
/** Whether `other` stands on `mine`'s account: under the same auth config, as the same user (Composio's MCP server picks
|
|
29
35
|
* the account by the two). */
|
|
30
|
-
const sharesAccounts = (mine, other) => mine.auth_config !== null && other.auth_config?.id === mine.auth_config.id && other.user === mine.user;
|
|
36
|
+
const sharesAccounts = (mine, other) => mine.auth_config !== null && other.auth_config?.id === mine.auth_config.id && other.user === mine.user && !mine.per_run && !other.per_run;
|
|
31
37
|
/** A record a save writes, from what the preset found and made (`found`): a thing it found that a record of the server
|
|
32
38
|
* saved before over this row (`was`) or of another saved server (`others`) says was made here stays made here; and the
|
|
33
39
|
* accounts the server saved before had made, under the same auth config and user, stay its own. */
|
|
34
40
|
export function madeToWrite(found, was, others) {
|
|
35
41
|
const all = [...(was ? [was] : []), ...others];
|
|
36
42
|
const madeHere = (id) => all.some((r) => r.auth_config?.id === id ? r.auth_config.made : false) || all.some((r) => r.accounts.some((a) => a.id === id && a.made));
|
|
37
|
-
|
|
43
|
+
// One the owner named is theirs, whatever a record says made it.
|
|
44
|
+
const config = found.auth_config && { id: found.auth_config.id, made: !found.auth_config.named && (found.auth_config.made || madeHere(found.auth_config.id)) };
|
|
38
45
|
const accounts = found.accounts.map((a) => ({ id: a.id, made: a.made || madeHere(a.id) }));
|
|
39
46
|
const kept = was && sharesAccounts(found, was) ? was.accounts.filter((a) => a.made && !accounts.some((b) => b.id === a.id)) : [];
|
|
40
|
-
return { user: found.user, auth_config: config, accounts: [...accounts, ...kept] };
|
|
47
|
+
return { user: found.user, auth_config: config, accounts: [...accounts, ...kept], ...(found.per_run ? { per_run: true } : {}) };
|
|
48
|
+
}
|
|
49
|
+
/** The records of the other saved servers (`others`, by name) that say they made the auth config `id`, each as it is to
|
|
50
|
+
* be written once the owner named that config in a save: made by none of them, so none of their deletes removes it. */
|
|
51
|
+
export function releasedOf(id, others) {
|
|
52
|
+
return others.filter(([, record]) => record.auth_config?.id === id && record.auth_config.made).map(([name, record]) => [name, { ...record, auth_config: { id, made: false } }]);
|
|
41
53
|
}
|
|
42
54
|
/** What a removed server's record leaves to do, with the records of the servers still saved (`others`, by name): each
|
|
43
55
|
* thing it made that none of them uses is removed; one another uses is kept and passed to that one (`handover`: its record
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Cleanup, ComposioMade } from "./composio-made.js";
|
|
2
|
+
import { type InputIssue } from "./errors.js";
|
|
2
3
|
import { type Json } from "./validate.js";
|
|
3
4
|
/** Another Composio than the real one, and its fetch: a test's fake (the same seam as `archilControl`). */
|
|
4
5
|
export type ComposioControl = {
|
|
@@ -7,16 +8,29 @@ export type ComposioControl = {
|
|
|
7
8
|
};
|
|
8
9
|
/** The one Composio user a server's actions run as, unless the owner names another. */
|
|
9
10
|
export declare const COMPOSIO_USER = "agentrun";
|
|
11
|
+
/** A Composio toolkit's slug, as a save takes it once trimmed and lower-cased. */
|
|
12
|
+
export declare const COMPOSIO_TOOLKIT: RegExp;
|
|
13
|
+
/** A Composio user id, as a save's `user_id` and a run's binding (mcp_auth's composio_user_id) take it. */
|
|
14
|
+
export declare const COMPOSIO_USER_ID: RegExp;
|
|
15
|
+
/** The `user_id` a save names for a per-run server, reserved for that and never a Composio user: the server keeps no user
|
|
16
|
+
* and no connected account, and each run names its own (mcp_auth.<server> = {composio_user_id, connected_account_id?}). */
|
|
17
|
+
export declare const COMPOSIO_PER_RUN = "per_run";
|
|
18
|
+
/** A Composio connected account's id, as a run's binding names one: Composio's are `ca_` and a short random id. At least
|
|
19
|
+
* 8 characters in all, so the run's redactors (which hold a value of 8 or more) hold every one. */
|
|
20
|
+
export declare const COMPOSIO_ACCOUNT_ID: RegExp;
|
|
21
|
+
/** A Composio auth config's id, as its dashboard and API show it (`ac_` and a nanoid). */
|
|
22
|
+
export declare const COMPOSIO_AUTH_CONFIG_ID: RegExp;
|
|
10
23
|
export type ComposioTool = {
|
|
11
24
|
slug: string;
|
|
12
25
|
name: string;
|
|
13
26
|
description: string;
|
|
14
27
|
};
|
|
15
28
|
/** A Composio call (asking): its JSON answer, or the refusal in words that name its step. */
|
|
16
|
-
export type Ask = (step: string, method: "GET" | "POST" | "PATCH" | "DELETE", path: string, body?: unknown, missing?: string) => Promise<Json>;
|
|
29
|
+
export type Ask = (step: string, method: "GET" | "POST" | "PATCH" | "DELETE", path: string, body?: unknown, missing?: string | InputIssue) => Promise<Json>;
|
|
17
30
|
/** A Composio call as `key`: its JSON answer, or an error in words that name `step` and never the key nor a `sealed`
|
|
18
31
|
* value (a trigger's sealed config), and end with `outcome`, what the failure left (a save's: nothing was saved). A call
|
|
19
|
-
* with sealed values in play passes on none of Composio's words.
|
|
32
|
+
* with sealed values in play passes on none of Composio's words. Composio's 404 is `missing` when given: the words of a
|
|
33
|
+
* toolkit it has not, or the refusal on another field. */
|
|
20
34
|
export declare function asking(control: ComposioControl, key: string, signal: AbortSignal | undefined, outcome?: string, sealed?: readonly string[]): Ask;
|
|
21
35
|
/** POST /settings/mcp-servers/composio/tools: a toolkit's actions, for the console's picker, and whether it needs no sign-in. */
|
|
22
36
|
export declare function composioTools(body: unknown, control: ComposioControl, signal?: AbortSignal): Promise<{
|
|
@@ -24,13 +38,33 @@ export declare function composioTools(body: unknown, control: ComposioControl, s
|
|
|
24
38
|
no_auth: boolean;
|
|
25
39
|
tools: ComposioTool[];
|
|
26
40
|
}>;
|
|
41
|
+
/** The toolkit's Composio-managed auth config not disabled, the one a save that names none stands on: none, if Composio
|
|
42
|
+
* has none for it yet. */
|
|
43
|
+
export declare function managedConfig(ask: Ask, toolkit: string): Promise<string | undefined>;
|
|
27
44
|
/** The address Composio's generate answers, made one this server's client can use: the helper actions that connect an
|
|
28
|
-
* account left off, and the path ended in /mcp (Composio redirects the bare one, which the client refuses on purpose).
|
|
29
|
-
|
|
45
|
+
* account left off, and the path ended in /mcp (Composio redirects the bare one, which the client refuses on purpose).
|
|
46
|
+
* `perRun`: with no user and no connected account in it either, for each run to name its own (composioRunAddress). */
|
|
47
|
+
export declare function composioAddress(generated: string, perRun?: boolean): string;
|
|
48
|
+
/** The Composio user a per-run server's tools are listed as (its save, refresh, preview and an agent's save): Composio's
|
|
49
|
+
* MCP endpoint refuses an address that names no user, its listing too, and any user lists the server's tools. Outside
|
|
50
|
+
* COMPOSIO_USER_ID (the ~), so no save and no run's binding can name it: never stored, never used for a call. */
|
|
51
|
+
export declare const COMPOSIO_LISTING_USER = "agentrun~tool-listing";
|
|
52
|
+
/** The address a per-run Composio server's tools are listed at: its saved one (no user, no account) as
|
|
53
|
+
* COMPOSIO_LISTING_USER. */
|
|
54
|
+
export declare function composioListingAddress(saved: URL): URL;
|
|
55
|
+
/** What a run's requests to a per-run Composio server add to its saved address: the Composio user and, when the run's
|
|
56
|
+
* binding names one, the connected account its calls run as (Composio's MCP endpoint reads both from the query). */
|
|
57
|
+
export declare const composioRunQuery: (binding: {
|
|
58
|
+
readonly user_id: string;
|
|
59
|
+
readonly connected_account_id?: string;
|
|
60
|
+
}) => Record<string, string>;
|
|
30
61
|
/** PUT /settings/mcp-servers/{name}/composio: Composio makes the managed MCP server, `save` keeps it as a saved MCP server
|
|
31
|
-
* (`{url, auth}`: the key a sealed header
|
|
32
|
-
*
|
|
33
|
-
*
|
|
62
|
+
* (`{url, auth}`: the key a sealed header; `prices`, each granted action at `price_usd` when the body names one), and a
|
|
63
|
+
* toolkit that needs the person's account says where to connect it. The auth config is the body's `auth_config_id` (one
|
|
64
|
+
* the owner has, a custom OAuth app's say: read first, and refused unless it is this toolkit's and enabled), else the
|
|
65
|
+
* toolkit's Composio-managed one, found or made. `save` gets what the server stands on there too (`stands`,
|
|
66
|
+
* composio-made.ts): the auth config found or made and the account found or started, each marked whether this save made
|
|
67
|
+
* it, for its delete to remove what was made. */
|
|
34
68
|
export declare function composioSave<T extends {
|
|
35
69
|
tools?: readonly {
|
|
36
70
|
name: string;
|
|
@@ -41,6 +75,7 @@ export declare function composioSave<T extends {
|
|
|
41
75
|
type: "headers";
|
|
42
76
|
headers: Record<string, string>;
|
|
43
77
|
};
|
|
78
|
+
prices?: Record<string, number>;
|
|
44
79
|
}, made: {
|
|
45
80
|
source: "composio";
|
|
46
81
|
toolkit: string | null;
|