@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.47
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 +164 -1
- package/NOTICE +4 -0
- package/README.md +267 -40
- package/dist/acp-package.d.ts +35 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +5 -2
- package/dist/adapter-facts.js +6 -3
- package/dist/adapters.d.ts +7 -0
- package/dist/adapters.js +39 -0
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/api-only.d.ts +7 -10
- package/dist/api-only.js +7 -10
- package/dist/archil-routes.js +2 -1
- package/dist/cap.js +12 -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-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +9 -75
- package/dist/computers.js +20 -66
- package/dist/console/assets/index-BBFzAxLB.js +715 -0
- package/dist/console/assets/index-BRi-Rgq6.css +1 -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 +73 -0
- package/dist/harness-check.js +489 -0
- package/dist/harness-cursor.d.ts +45 -0
- package/dist/harness-cursor.js +121 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +357 -0
- package/dist/harness-table.d.ts +12 -0
- package/dist/harness-table.js +62 -2
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +3 -2
- 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 +1 -0
- package/dist/key-refusal.js +8 -3
- 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 +69 -2
- package/dist/learn/promote.js +95 -3
- 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-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 +1 -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 +22 -8
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +2 -1
- package/dist/model.js +9 -7
- 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 +322 -39
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +8 -0
- package/dist/page.js +9 -1
- 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 +6 -4
- package/dist/runner/adapter-loop.d.ts +10 -7
- package/dist/runner/adapter-loop.js +57 -22
- package/dist/runner/adapter-run-spec.d.ts +12 -0
- package/dist/runner/adapter-run-spec.js +40 -6
- package/dist/runner/adapters/index.js +16 -0
- 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 +15 -7
- 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/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/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +41 -0
- package/dist/runner/presence.js +89 -0
- package/dist/runner/promotion.d.ts +9 -4
- package/dist/runner/promotion.js +33 -14
- 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/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/runs-over-store.d.ts +6 -2
- package/dist/runs-over-store.js +14 -4
- package/dist/sdk/runs.d.ts +1 -1
- package/dist/sdk/runs.js +6 -1
- package/dist/sdk/schema.js +1 -1
- 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 +31 -2
- package/dist/server.js +322 -51
- 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 +106 -27
- package/dist/store/store.d.ts +75 -23
- 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 +123 -14
- package/dist/store-view.js +154 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/timeline/timeline.js +18 -0
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.js +2 -2
- 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 +1 -1
- package/dist/trigger-targets.js +19 -8
- package/dist/triggers.d.ts +2 -2
- 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 +18 -14
- package/dist/workspace/resolve-computer.js +47 -60
- 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 +10 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
|
@@ -3,7 +3,7 @@ import type { RunLaunch } from "../run-launch.js";
|
|
|
3
3
|
import { COST_WINDOW, type RunPath } from "../learning-cost.js";
|
|
4
4
|
export { COST_WINDOW };
|
|
5
5
|
import { type LoopRow } from "../learned-nodes.js";
|
|
6
|
-
import { type CostStop } from "../learn/promote.js";
|
|
6
|
+
import { type Compared, type CostStop } from "../learn/promote.js";
|
|
7
7
|
import type { Skipped } from "../learn/replay-calls.js";
|
|
8
8
|
/** The root entry a run served workflow-first keeps, once the workflow's call ended: which workflow, at which learned
|
|
9
9
|
* revision, under which call, and how it ended. A later claim that finds it never runs the workflow again. */
|
|
@@ -187,13 +187,16 @@ export declare function pathMetrics(launch: RunLaunch, classified: {
|
|
|
187
187
|
not_auditable?: true;
|
|
188
188
|
loops?: LoopRow[];
|
|
189
189
|
replay?: ReplayMetrics;
|
|
190
|
-
audit?: NonNullable<RunLaunch["audit"]
|
|
190
|
+
audit?: NonNullable<RunLaunch["audit"]> & {
|
|
191
|
+
readonly compared?: Compared;
|
|
192
|
+
};
|
|
191
193
|
};
|
|
192
194
|
/** A replay run's record (metrics.replay): the graded run it replayed and how its workflow ended there. */
|
|
193
195
|
export type ReplayMetrics = {
|
|
194
196
|
readonly of: string;
|
|
195
197
|
readonly outcome: ReplayOutcome;
|
|
196
198
|
readonly skipped?: Skipped;
|
|
199
|
+
readonly compared?: Compared;
|
|
197
200
|
};
|
|
198
201
|
/** How a replay run's workflow ended on its input: `skipped_write`, stopped at a write the graded run's recording does not
|
|
199
202
|
* have (learn/replay-calls.ts SKIPPED_WRITE), never run. */
|
|
@@ -32,7 +32,7 @@ export { COST_WINDOW };
|
|
|
32
32
|
import { KINDS } from "./journal-kinds.js";
|
|
33
33
|
import { inputIssues, isObject } from "../validate.js";
|
|
34
34
|
import { endedIn, loopsOf, replaySkippedIn } from "../learned-nodes.js";
|
|
35
|
-
import { sameAnswer } from "../learn/promote.js";
|
|
35
|
+
import { comparedOf, sameAnswer } from "../learn/promote.js";
|
|
36
36
|
/** The root entry a run served workflow-first keeps, once the workflow's call ended: which workflow, at which learned
|
|
37
37
|
* revision, under which call, and how it ended. A later claim that finds it never runs the workflow again. */
|
|
38
38
|
export const WORKFLOW_FIRST = "agentrun.workflow_first";
|
|
@@ -231,9 +231,12 @@ export function servedOf(entries) {
|
|
|
231
231
|
* each loop's exit (`loops`, loopsOf: a quote re-pick is a loop's second pass), when one ran. learning-cost reads path
|
|
232
232
|
* and workflow from here. None for a run that does not learn. */
|
|
233
233
|
export function pathMetrics(launch, classified, entries = []) {
|
|
234
|
+
// The grader's verdict its end-of-run step kept (runner/compare-end.ts), for a replay run and a shadow.
|
|
235
|
+
const compared = comparedOf(entries.findLast((entry) => entry.kind === KINDS.compared)?.data);
|
|
236
|
+
const verdict = compared ? { compared } : {};
|
|
234
237
|
// A shadow run (runner/audit.ts): path `audit` and the run it audits, whatever it did: no learning, no money rule.
|
|
235
238
|
if (launch.audit)
|
|
236
|
-
return { path: "audit", audit: { of: launch.audit.of, workflow: launch.audit.workflow, digest: launch.audit.digest } };
|
|
239
|
+
return { path: "audit", audit: { of: launch.audit.of, workflow: launch.audit.workflow, digest: launch.audit.digest, ...verdict } };
|
|
237
240
|
if (!launch.learning)
|
|
238
241
|
return {};
|
|
239
242
|
const { path, workflow, digest, promotion } = classified ?? { path: "agent", workflow: null };
|
|
@@ -249,7 +252,7 @@ export function pathMetrics(launch, classified, entries = []) {
|
|
|
249
252
|
// evidence. Skipped when a write it needed is not in the graded run's recording (learn/replay-calls.ts): never run.
|
|
250
253
|
const skipped = replaySkippedIn(entries);
|
|
251
254
|
const outcome = skipped ? "skipped_write" : path === "workflow" && workflow === name ? "answered" : path === "handed_back" && workflow === name && endedIn(entries, name) === "escalated" ? "handed_back" : "failed";
|
|
252
|
-
return { path: "replay", ...(launch.learning.seed ? { learned_revision: launch.learning.seed } : {}), workflow: name, workflow_digest: at, ...rows, replay: { of, outcome, ...(skipped ? { skipped } : {}) } };
|
|
255
|
+
return { path: "replay", ...(launch.learning.seed ? { learned_revision: launch.learning.seed } : {}), workflow: name, workflow_digest: at, ...rows, replay: { of, outcome, ...(skipped ? { skipped } : {}), ...verdict } };
|
|
253
256
|
}
|
|
254
257
|
// A served run a trigger started (learn/audit.ts auditableLaunch) is never audited: counted on the promotions read.
|
|
255
258
|
const notAuditable = SERVED_PATHS.includes(path) && !auditableLaunch(launch);
|
|
@@ -51,8 +51,9 @@ export type MessageMode = "steer" | "answer" | "follow_up";
|
|
|
51
51
|
* run's state. `answers: false` is a trigger's message, which never answers a person: refused while the run waits on one,
|
|
52
52
|
* and never a deny of an approval. The mode is the label the v2 answer reports, from the run's moment. `queue`: the steer's
|
|
53
53
|
* write when it is not this run's own (a trigger's: its firing marked with it, within its bound, store.triggers.message),
|
|
54
|
-
* which may skip it, in words.
|
|
55
|
-
|
|
54
|
+
* which may skip it, in words. A runner applies every message, so while every runner here refused to claim, any message
|
|
55
|
+
* (a person's or a trigger's) is refused in their words first, as a start is (prepareLaunch, runner/presence.ts). */
|
|
56
|
+
export declare function message(store: RunsStore & Pick<Store, "agents" | "runners">, moment: RunMoment, content: string, { requestId, answers, origin, queue, launchSealed, beforeSubmit }?: {
|
|
56
57
|
requestId?: string;
|
|
57
58
|
answers?: boolean;
|
|
58
59
|
origin?: unknown;
|
|
@@ -105,6 +106,9 @@ type StartBody = {
|
|
|
105
106
|
export interface StartDeps {
|
|
106
107
|
/** A new run id; defaults to a UUIDv7. */
|
|
107
108
|
readonly newRunId?: () => string;
|
|
109
|
+
/** Why no runner here can take a run, in their words, while every runner there refused to claim (runner/presence.ts
|
|
110
|
+
* runnersRefused); undefined while one can, or none is there yet. A start is refused with it (runner_refused). */
|
|
111
|
+
runnersRefused?(): Promise<string | undefined>;
|
|
108
112
|
/** The create body's field issues, before the agent is read (server.ts runBodyIssues). */
|
|
109
113
|
runBodyIssues(body: Json): InputIssue[];
|
|
110
114
|
/** The revision a run starts on (server.ts pinnedOf): the body's pin, else the agent's current; undefined when none. */
|
package/dist/runs-over-store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nativeOf } from "./native/binding.js";
|
|
1
|
+
import { NATIVE_RUN_OVERRIDES_UNSUPPORTED, nativeOf, nativeRunOverrides } from "./native/binding.js";
|
|
2
2
|
import { launchNative } from "./native/connection.js";
|
|
3
3
|
// The write half of the run's server cut (design 2.1, "the runner takes every run"): the functions the v2 routes call to
|
|
4
4
|
// start a run and to act on one (message, stop, raise, approve, archive), over the one store (A). The old per-run-process
|
|
@@ -29,6 +29,7 @@ import { launchBody } from "./run-launch.js";
|
|
|
29
29
|
import { modelKeyRequired, serverKeyMissing } from "./run-model-key.js";
|
|
30
30
|
import { raiseFollowUpId } from "./run-view.js";
|
|
31
31
|
import { sendCommand } from "./runner/commands.js";
|
|
32
|
+
import { runnersRefused } from "./runner/presence.js";
|
|
32
33
|
import { AgentDeleting, AnswerTaken, ExternalBodyConflict, RunFinal, StoreConstraint, StoreLaunchMissing } from "./store/index.js";
|
|
33
34
|
import { canonical } from "./store/agent-body.js";
|
|
34
35
|
import { toolingOf } from "./tools.js";
|
|
@@ -154,8 +155,12 @@ export const resume = (store, moment) => pauseOrResume(store, moment, false);
|
|
|
154
155
|
* run's state. `answers: false` is a trigger's message, which never answers a person: refused while the run waits on one,
|
|
155
156
|
* and never a deny of an approval. The mode is the label the v2 answer reports, from the run's moment. `queue`: the steer's
|
|
156
157
|
* write when it is not this run's own (a trigger's: its firing marked with it, within its bound, store.triggers.message),
|
|
157
|
-
* which may skip it, in words.
|
|
158
|
+
* which may skip it, in words. A runner applies every message, so while every runner here refused to claim, any message
|
|
159
|
+
* (a person's or a trigger's) is refused in their words first, as a start is (prepareLaunch, runner/presence.ts). */
|
|
158
160
|
export async function message(store, moment, content, { requestId, answers = true, origin, queue, launchSealed, beforeSubmit } = {}) {
|
|
161
|
+
const refused = await runnersRefused(store.runners);
|
|
162
|
+
if (refused !== undefined)
|
|
163
|
+
throw new ApiError("runner_refused", refused);
|
|
159
164
|
if (moment.importedSource !== undefined)
|
|
160
165
|
throw importedRefusal(moment);
|
|
161
166
|
const launchBody = await controlLaunchBody(store, moment.id);
|
|
@@ -562,8 +567,8 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
|
|
|
562
567
|
const native = nativeOf(revision.body);
|
|
563
568
|
if (native && !nativeOf(entry.revision?.body)?.connected)
|
|
564
569
|
throw new ApiError("agent_not_runnable", "This native connection is disconnected. Reconnect its source project before starting any revision.");
|
|
565
|
-
if (native && (body.
|
|
566
|
-
throw new ApiError("input_invalid",
|
|
570
|
+
if (native && nativeRunOverrides(body).length)
|
|
571
|
+
throw new ApiError("input_invalid", NATIVE_RUN_OVERRIDES_UNSUPPORTED);
|
|
567
572
|
if (fileIds.length)
|
|
568
573
|
await deps.readyFiles(fileIds);
|
|
569
574
|
const rbody = revision.body;
|
|
@@ -575,6 +580,11 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
|
|
|
575
580
|
const cap = typeof body.max_cost_usd === "number" ? body.max_cost_usd : rbody.maxCostUsd;
|
|
576
581
|
if (capped && cap === undefined)
|
|
577
582
|
throw invalid([{ field: "max_cost_usd", reason: "missing", message: "Every run a trigger starts is capped: give the trigger's target a max_cost_usd or set the agent's." }]);
|
|
583
|
+
// A run no runner here can claim is never taken to wait for good: refused in the runners' words, once the request reads
|
|
584
|
+
// right and before anything is pinned or made for it (runner/presence.ts).
|
|
585
|
+
const refused = await deps.runnersRefused?.();
|
|
586
|
+
if (refused !== undefined)
|
|
587
|
+
throw new ApiError("runner_refused", refused);
|
|
578
588
|
const place = resolvePlace(rbody.place, deps.fallbackPlace(revision.kind, revision.kind === "agentic" ? (rbody.tools ?? []) : []));
|
|
579
589
|
// Checked as pinned: an earlier revision with no pin is pinned now, once (StartDeps.pinFirst); one that could not be, as
|
|
580
590
|
// its server could not be listed, is refused with the rest (runnable).
|
package/dist/sdk/runs.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Claim, RunOrigin, Store } from "../store/store.js";
|
|
|
2
2
|
import type { AgentEntry } from "../agents-store.js";
|
|
3
3
|
import { type StartDeps } from "../runs-over-store.js";
|
|
4
4
|
import { type LearnedWorkflow } from "../learning.js";
|
|
5
|
-
export type SdkRuntime = "claude-agent-sdk" | "codex-sdk";
|
|
5
|
+
export type SdkRuntime = "claude-agent-sdk" | "codex-sdk" | "eve";
|
|
6
6
|
export type SdkUsage = {
|
|
7
7
|
input_tokens: number | null;
|
|
8
8
|
output_tokens: number | null;
|
package/dist/sdk/runs.js
CHANGED
|
@@ -47,7 +47,7 @@ const usageOf = (value) => {
|
|
|
47
47
|
}
|
|
48
48
|
return result;
|
|
49
49
|
};
|
|
50
|
-
export const sdkOf = (body) => isObject(body) && isObject(body.sdk) && (body.sdk.runtime === "claude-agent-sdk" || body.sdk.runtime === "codex-sdk")
|
|
50
|
+
export const sdkOf = (body) => isObject(body) && isObject(body.sdk) && (body.sdk.runtime === "claude-agent-sdk" || body.sdk.runtime === "codex-sdk" || body.sdk.runtime === "eve")
|
|
51
51
|
? { runtime: body.sdk.runtime }
|
|
52
52
|
: undefined;
|
|
53
53
|
export async function sdkInbox(store, runId) {
|
|
@@ -187,6 +187,11 @@ export class SdkRuns {
|
|
|
187
187
|
const revisionBody = entry.revision.body;
|
|
188
188
|
if (revisionBody.maxCostUsd !== undefined)
|
|
189
189
|
throw new ApiError("agent_not_runnable", "AgentRun cannot enforce a spend cap on an external SDK. Configure the budget in the backend SDK and remove this managed run cap.");
|
|
190
|
+
// A runner keeps an SDK run's evidence and ends it: while every runner here refused to claim, the start is refused in
|
|
191
|
+
// their words, as any start is (prepareLaunch), before the caller holds a receipt it would run on.
|
|
192
|
+
const refused = await deps.runnersRefused?.();
|
|
193
|
+
if (refused !== undefined)
|
|
194
|
+
throw new ApiError("runner_refused", refused);
|
|
190
195
|
const learning = await learningStartFor(deps, entry, pinned.revision, revisionBody, {
|
|
191
196
|
noWorkflows: !workflow,
|
|
192
197
|
...(compile.model ? { model: compile.model } : {}),
|
package/dist/sdk/schema.js
CHANGED
|
@@ -6,7 +6,7 @@ const object = (properties, required = Object.keys(properties)) => ({
|
|
|
6
6
|
properties,
|
|
7
7
|
required,
|
|
8
8
|
});
|
|
9
|
-
export const SDK_BINDING = object({ runtime: { enum: ["claude-agent-sdk", "codex-sdk"] } });
|
|
9
|
+
export const SDK_BINDING = object({ runtime: { enum: ["claude-agent-sdk", "codex-sdk", "eve"] } });
|
|
10
10
|
const usage = object(Object.fromEntries(["input_tokens", "output_tokens", "cache_read_tokens", "cache_write_tokens", "cost_usd"].map((key) => [
|
|
11
11
|
key,
|
|
12
12
|
{ type: [key === "cost_usd" ? "number" : "integer", "null"], minimum: 0 },
|
package/dist/secret-writes.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IncomingMessage } from "node:http";
|
|
2
2
|
/** The one refusal a secret write from anything but the owner's session gets (403 forbidden). */
|
|
3
3
|
export declare const SECRET_WRITE_REFUSAL = "Saving, replacing or removing a secret takes the owner's signed-in session in the console; the API token can't write secrets.";
|
|
4
|
+
/** The refusal's words with where to finish it: the one sentence, then "Finish it in the console: <link>" when the
|
|
5
|
+
* operation has a console page (registerSecretPage). The same link is the error's `details.console_url`. */
|
|
6
|
+
export declare const secretWriteRefusal: (link?: string) => string;
|
|
4
7
|
/**
|
|
5
8
|
* Whether the console a launcher opened on a loopback-bound server with no accounts (no password: the browser that
|
|
6
9
|
* followed the launch link, `/?launch=<code>`, its cookie a session id made at random and kept by the server, never
|
|
@@ -89,13 +92,23 @@ export declare const writesSecret: (operationId: string, body: unknown) => boole
|
|
|
89
92
|
/** Whether this request of `operationId` writes a secret: by its body, or by what it would drop or replace in the store
|
|
90
93
|
* (its plane's stored predicate). The dispatch's one check asks this. */
|
|
91
94
|
export declare function writesSecretFor(operationId: string, body: unknown, request: SecretRequest): Promise<boolean>;
|
|
95
|
+
/** An operation's console page: a fixed path, or one built from the request's non-secret fields. */
|
|
96
|
+
export type SecretPage = string | ((body: unknown, request: SecretRequest) => string | Promise<string>);
|
|
97
|
+
/** Where in the console the owner finishes `operationIds` (each a registered secret write). */
|
|
98
|
+
export declare function registerSecretPage(operationIds: string | readonly string[], page: SecretPage): void;
|
|
99
|
+
/** Whether `operationId` names its console page. */
|
|
100
|
+
export declare const hasSecretPage: (operationId: string) => boolean;
|
|
101
|
+
/** The console page that finishes this request of `operationId`, a path from the console's root; undefined when the
|
|
102
|
+
* console has none for it, or the page could not be built (then the refusal carries no link). */
|
|
103
|
+
export declare function secretPageFor(operationId: string, body: unknown, request: SecretRequest): Promise<string | undefined>;
|
|
92
104
|
type Json = Record<string, unknown>;
|
|
93
105
|
/** The operations of `doc` that write a secret: their request body marks a field `x-agentrun-secret`, or the operation is
|
|
94
106
|
* marked whole (a removal, which has no body). The generated CLI leaves every one of them out. */
|
|
95
107
|
export declare function markedOperations(doc: Json): string[];
|
|
96
|
-
/** The marked operations of `doc` no plane registered a predicate for
|
|
97
|
-
*
|
|
98
|
-
|
|
108
|
+
/** The marked operations of `doc` no plane registered a predicate for nor said on purpose to write no secret
|
|
109
|
+
* (registerNotSecretWrite: a preview's marked fields are kept nowhere): each a route a secret could take past the
|
|
110
|
+
* dispatch check. Empty is the only passing answer. */
|
|
111
|
+
export declare const unguardedOperations: (doc: Json) => string[];
|
|
99
112
|
/** Where a secret came from: the environment the server starts with (which always wins, by the same name), pasted in the
|
|
100
113
|
* console, or obtained by a sign-in (OAuth, Connect); null when it is not set. */
|
|
101
114
|
export type SecretSource = "env" | "console" | "sign-in";
|
package/dist/secret-writes.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { byConsoleSession, byOwnerSession } from "./page.js";
|
|
2
2
|
/** The one refusal a secret write from anything but the owner's session gets (403 forbidden). */
|
|
3
3
|
export const SECRET_WRITE_REFUSAL = "Saving, replacing or removing a secret takes the owner's signed-in session in the console; the API token can't write secrets.";
|
|
4
|
+
/** The refusal's words with where to finish it: the one sentence, then "Finish it in the console: <link>" when the
|
|
5
|
+
* operation has a console page (registerSecretPage). The same link is the error's `details.console_url`. */
|
|
6
|
+
export const secretWriteRefusal = (link) => (link ? `${SECRET_WRITE_REFUSAL} Finish it in the console: ${link}` : SECRET_WRITE_REFUSAL);
|
|
4
7
|
// ---- who may write a secret ------------------------------------------------------------------------------------------
|
|
5
8
|
/**
|
|
6
9
|
* Whether the console a launcher opened on a loopback-bound server with no accounts (no password: the browser that
|
|
@@ -77,6 +80,27 @@ export async function writesSecretFor(operationId, body, request) {
|
|
|
77
80
|
const stored = storedPredicates.get(operationId);
|
|
78
81
|
return stored ? (await stored(body, request)) === true : false;
|
|
79
82
|
}
|
|
83
|
+
const pages = new Map();
|
|
84
|
+
/** Where in the console the owner finishes `operationIds` (each a registered secret write). */
|
|
85
|
+
export function registerSecretPage(operationIds, page) {
|
|
86
|
+
for (const operationId of typeof operationIds === "string" ? [operationIds] : operationIds)
|
|
87
|
+
pages.set(operationId, page);
|
|
88
|
+
}
|
|
89
|
+
/** Whether `operationId` names its console page. */
|
|
90
|
+
export const hasSecretPage = (operationId) => pages.has(operationId);
|
|
91
|
+
/** The console page that finishes this request of `operationId`, a path from the console's root; undefined when the
|
|
92
|
+
* console has none for it, or the page could not be built (then the refusal carries no link). */
|
|
93
|
+
export async function secretPageFor(operationId, body, request) {
|
|
94
|
+
const page = pages.get(operationId);
|
|
95
|
+
if (typeof page !== "function")
|
|
96
|
+
return page;
|
|
97
|
+
try {
|
|
98
|
+
return await page(body, request);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
80
104
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81
105
|
/** Whether `schema` (in `doc`, its $refs followed once each) marks any field `x-agentrun-secret: true`. */
|
|
82
106
|
function marksSecret(doc, schema, seen = new Set()) {
|
|
@@ -113,9 +137,10 @@ export function markedOperations(doc) {
|
|
|
113
137
|
}
|
|
114
138
|
return out;
|
|
115
139
|
}
|
|
116
|
-
/** The marked operations of `doc` no plane registered a predicate for
|
|
117
|
-
*
|
|
118
|
-
|
|
140
|
+
/** The marked operations of `doc` no plane registered a predicate for nor said on purpose to write no secret
|
|
141
|
+
* (registerNotSecretWrite: a preview's marked fields are kept nowhere): each a route a secret could take past the
|
|
142
|
+
* dispatch check. Empty is the only passing answer. */
|
|
143
|
+
export const unguardedOperations = (doc) => markedOperations(doc).filter((operationId) => !registry.has(operationId) && notSecretWriteReason(operationId) === undefined);
|
|
119
144
|
/** A secret's name, "<plane>:<id>": the plane and each part of its id joined with ":" (secretName("computer", provider,
|
|
120
145
|
* KEY) is "computer:<provider>:<KEY>", secretName("workspace", "archil") "workspace:archil"). */
|
|
121
146
|
export function secretName(plane, ...id) {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { sealedSettingsOverStore } from "./sealed-settings-store.js";
|
|
7
7
|
import { besideTheStore } from "./server-secrets.js";
|
|
8
8
|
import { SEAL_KEY_ENV, sealKeyOf } from "./tool-keys.js";
|
|
9
|
+
import { SLACK_CHANNEL, SLACK_URL_SPEC, slackUrlForms } from "./slack.js";
|
|
9
10
|
import { WEBHOOK_CHANNEL, WEBHOOK_SECRET_SPEC } from "./webhooks.js";
|
|
10
11
|
/** The server's own secrets over the store: what it keeps beside the store (besideTheStore), the outbound webhook's
|
|
11
12
|
* signing secret and each one it held before (adapter webhook-out, retired ones too, so a secret replaced or removed stays
|
|
@@ -23,6 +24,10 @@ export async function openServerSecretsOverStore(store, data, env, adapters, say
|
|
|
23
24
|
const webhookSettings = sealedSettingsOverStore(store, WEBHOOK_CHANNEL, WEBHOOK_SECRET_SPEC, key, (fields) => fields.condition === "trigger_setting_unopened" ? say({ condition: "unreadable", name: SEAL_KEY_ENV, data, effect: "this server's webhook secret cannot be read under this seal key, so it is not cut" }) : say(fields));
|
|
24
25
|
await webhookSettings.load();
|
|
25
26
|
secrets.add("webhook", () => webhookSettings.values());
|
|
27
|
+
// Slack's incoming-webhook URL, and each it held before (slack.ts): the URL is the credential, cut as a secret is.
|
|
28
|
+
const slackSettings = sealedSettingsOverStore(store, SLACK_CHANNEL, SLACK_URL_SPEC, key, (fields) => fields.condition === "trigger_setting_unopened" ? say({ condition: "unreadable", name: SEAL_KEY_ENV, data, effect: "this server's Slack URL cannot be read under this seal key, so it is not cut" }) : say(fields));
|
|
29
|
+
await slackSettings.load();
|
|
30
|
+
secrets.add("slack", () => slackSettings.values().flatMap(slackUrlForms));
|
|
26
31
|
const settings = new Map();
|
|
27
32
|
for (const adapter of adapters) {
|
|
28
33
|
if (!adapter.settings)
|
package/dist/server.d.ts
CHANGED
|
@@ -232,6 +232,9 @@ export type ServeOptions = {
|
|
|
232
232
|
* (webhooks.ts), in place of the system resolver's. A test's server answers its example hosts here, so no CI
|
|
233
233
|
* runner's resolver decides what a test sees. */
|
|
234
234
|
webhookLookup?: (host: string) => Promise<string[]>;
|
|
235
|
+
/** A test's seam: the origin Slack's messages are posted to in place of https://hooks.slack.com, each URL's path kept
|
|
236
|
+
* (slack.ts sendTo), so no test reaches Slack. */
|
|
237
|
+
slackTarget?: string;
|
|
235
238
|
};
|
|
236
239
|
/** The switches a run's process gets, each module path resolved: the owner's harness modules (harnessModules), and the test
|
|
237
240
|
* switches, which are empty outside tests. A test's in-process runner takes the same (test/support.mjs
|
|
@@ -281,6 +284,10 @@ export type Serve = {
|
|
|
281
284
|
};
|
|
282
285
|
/** Resolves once every run's listing is current (run-listing.ts Lister.settled): for tests and benchmarks. */
|
|
283
286
|
listingSettled(): Promise<void>;
|
|
287
|
+
/** Says in the store, until the stop, that the runner beside this server refused to claim any run, in `words` (its run
|
|
288
|
+
* isolation refused, cli.ts): while no runner that claims is there, a start is refused in them and the runs queued
|
|
289
|
+
* fail (runner/presence.ts). Once; a second call keeps the first. */
|
|
290
|
+
refuseRuns(words: string): void;
|
|
284
291
|
};
|
|
285
292
|
/** A route: `name` is its operationId in the OpenAPI document (openapi.ts); `capability`, when this server turns it off;
|
|
286
293
|
* `raw`, a route whose body is bytes and not JSON, which the page's session may send with any content type, still only
|
|
@@ -345,6 +352,7 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
345
352
|
reason?: string;
|
|
346
353
|
default_model: string | null;
|
|
347
354
|
installs?: "on_first_use";
|
|
355
|
+
card?: string;
|
|
348
356
|
models: string[];
|
|
349
357
|
free_models: {
|
|
350
358
|
id: string;
|
|
@@ -458,6 +466,9 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
458
466
|
available: boolean;
|
|
459
467
|
harnesses: string[];
|
|
460
468
|
})[];
|
|
469
|
+
/** The switches only the operator sets, in the server's environment at its start (start-switches.ts): each one's state,
|
|
470
|
+
* the value it read and what it allows. Never a secret's value. */
|
|
471
|
+
switches: Record<string, import("./start-switches.js").StartSwitch>;
|
|
461
472
|
/** How this server holds its secrets (secrets.ts, the launcher), and what that does not cover. */
|
|
462
473
|
secrets: {
|
|
463
474
|
names: string[];
|
|
@@ -469,7 +480,7 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
469
480
|
* `models.default`, `models.strong`) with the tools it names of `node_tools`; a node that names no thinking level
|
|
470
481
|
* thinks at the run's effort, or medium. */
|
|
471
482
|
workflows: {
|
|
472
|
-
nodes: ("agent" | "
|
|
483
|
+
nodes: ("agent" | "report" | "extract" | "decide")[];
|
|
473
484
|
node_tools: string[];
|
|
474
485
|
adapters: string[];
|
|
475
486
|
decisions: {
|
|
@@ -582,6 +593,13 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
582
593
|
signing: string;
|
|
583
594
|
at_rest: string;
|
|
584
595
|
};
|
|
596
|
+
/** /settings/slack: one Slack incoming-webhook URL each of `events` is posted to as a readable message (slack.ts); the
|
|
597
|
+
* URL kept sealed, never shown. */
|
|
598
|
+
slack: {
|
|
599
|
+
routes: boolean;
|
|
600
|
+
events: ("run.needs_input" | "run.ended" | "trigger.failed")[];
|
|
601
|
+
at_rest: string;
|
|
602
|
+
};
|
|
585
603
|
/** /triggers: what starts an agent's capped runs with no caller (triggers.ts). */
|
|
586
604
|
triggers: {
|
|
587
605
|
routes: boolean;
|
|
@@ -654,6 +672,7 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
654
672
|
reason?: string;
|
|
655
673
|
default_model: string | null;
|
|
656
674
|
installs?: "on_first_use";
|
|
675
|
+
card?: string;
|
|
657
676
|
models: string[];
|
|
658
677
|
free_models: {
|
|
659
678
|
id: string;
|
|
@@ -767,6 +786,9 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
767
786
|
available: boolean;
|
|
768
787
|
harnesses: string[];
|
|
769
788
|
})[];
|
|
789
|
+
/** The switches only the operator sets, in the server's environment at its start (start-switches.ts): each one's state,
|
|
790
|
+
* the value it read and what it allows. Never a secret's value. */
|
|
791
|
+
switches: Record<string, import("./start-switches.js").StartSwitch>;
|
|
770
792
|
/** How this server holds its secrets (secrets.ts, the launcher), and what that does not cover. */
|
|
771
793
|
secrets: {
|
|
772
794
|
names: string[];
|
|
@@ -778,7 +800,7 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
778
800
|
* `models.default`, `models.strong`) with the tools it names of `node_tools`; a node that names no thinking level
|
|
779
801
|
* thinks at the run's effort, or medium. */
|
|
780
802
|
workflows: {
|
|
781
|
-
nodes: ("agent" | "
|
|
803
|
+
nodes: ("agent" | "report" | "extract" | "decide")[];
|
|
782
804
|
node_tools: string[];
|
|
783
805
|
adapters: string[];
|
|
784
806
|
decisions: {
|
|
@@ -891,6 +913,13 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
891
913
|
signing: string;
|
|
892
914
|
at_rest: string;
|
|
893
915
|
};
|
|
916
|
+
/** /settings/slack: one Slack incoming-webhook URL each of `events` is posted to as a readable message (slack.ts); the
|
|
917
|
+
* URL kept sealed, never shown. */
|
|
918
|
+
slack: {
|
|
919
|
+
routes: boolean;
|
|
920
|
+
events: ("run.needs_input" | "run.ended" | "trigger.failed")[];
|
|
921
|
+
at_rest: string;
|
|
922
|
+
};
|
|
894
923
|
/** /triggers: what starts an agent's capped runs with no caller (triggers.ts). */
|
|
895
924
|
triggers: {
|
|
896
925
|
routes: boolean;
|