@agentproto/runtime 2.0.0 → 2.1.0
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/README.md +3 -3
- package/dist/config.d.ts +40 -1
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.ts +245 -10
- package/dist/index.mjs +8393 -7885
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AcpMcpServer, AcpPermissionResolution } from '@agentproto/acp';
|
|
|
6
6
|
import { SessionMode } from '@agentproto/acp/client';
|
|
7
7
|
export { SessionMode } from '@agentproto/acp/client';
|
|
8
8
|
import { ChildProcess } from 'node:child_process';
|
|
9
|
-
import { S as SessionConfig, P as Posture, C as ContextProfile,
|
|
9
|
+
import { R as RouteSpec, S as SessionConfig, P as Posture, C as ContextProfile, E as EffortLevel, A as AuthMethod, a as CanonicalPosture } from './session-config-DIf6wYYP.js';
|
|
10
10
|
export { D as DeclaredAdapterMode, c as composeMode, d as decomposeMode } from './session-config-DIf6wYYP.js';
|
|
11
11
|
import { CostBudget, AuthProfile, CostBudgetScope } from '@agentproto/auth';
|
|
12
12
|
export { CostBudget, CostBudgetScope } from '@agentproto/auth';
|
|
@@ -950,10 +950,15 @@ interface RunCommandInput {
|
|
|
950
950
|
cwd: string;
|
|
951
951
|
stdin?: string;
|
|
952
952
|
timeoutMs: number;
|
|
953
|
+
/** Extra env for the spawned command — today only the daemon's own
|
|
954
|
+
* session-identity vars (see {@link SESSION_ID_ENV}), merged on top of
|
|
955
|
+
* `process.env`/`withSanePath`. Not caller-exposed by `command_execute`'s
|
|
956
|
+
* tool schema, so there's no forgery surface here yet — merged plainly. */
|
|
957
|
+
env?: Record<string, string>;
|
|
953
958
|
}
|
|
954
959
|
|
|
955
960
|
/**
|
|
956
|
-
* Completion-policy supervisor — WP1 + WP2 + WP3 + WP4 + WP5 + WP6 + WP7.
|
|
961
|
+
* Completion-policy supervisor — WP1 + WP2 + WP3 + WP4 + WP5 + WP6 + WP7 + WP-D.
|
|
957
962
|
*
|
|
958
963
|
* WP7 (judge-gate): a gate may be a judge AGENT instead of a shell command —
|
|
959
964
|
* `gate: { judge: { adapter, model?, prompt, timeoutMs? } }`. When the trigger
|
|
@@ -969,6 +974,25 @@ interface RunCommandInput {
|
|
|
969
974
|
* gate left in `gating` at crash is re-armed to `watching` like any active
|
|
970
975
|
* policy and simply re-runs the judge — no in-flight judge is persisted.
|
|
971
976
|
*
|
|
977
|
+
* WP-D (structured verdict): a judge may OPTIONALLY answer with a fenced JSON
|
|
978
|
+
* block (`{decision, summary?, findings?}`, `findings: [{severity, file?,
|
|
979
|
+
* note}]`) instead of (immediately before) the plain `VERDICT:` line —
|
|
980
|
+
* `parseJsonVerdict` is tried first, falling back to the WP7 text-line parser
|
|
981
|
+
* `parseVerdict` when no JSON block validates. Either way `decision` alone
|
|
982
|
+
* drives pass/fail; `findings`' severities are never thresholded by the
|
|
983
|
+
* engine (see `JudgeVerdict`'s doc in `session-event-bus.ts` for the
|
|
984
|
+
* argument). The result is persisted as `PolicyRunState.verdict`, overwritten
|
|
985
|
+
* — not merged — on every gate run, and echoed on `policy:passed` /
|
|
986
|
+
* `policy:failed`. Fail-safe is unchanged: an unparseable-by-either-path
|
|
987
|
+
* reply still FAILs and leaves `verdict` unset.
|
|
988
|
+
*
|
|
989
|
+
* WP-D also lets a judge gate pick its own billing identity —
|
|
990
|
+
* `JudgeGateSpec.judge.access`/`route`/`mode` passthrough to the judge spawn
|
|
991
|
+
* (see `runJudge`) — so a rate-limited/revoked default wallet doesn't have to
|
|
992
|
+
* fail every judge gate in the daemon. A ranked, automatic-fail-over WALLET
|
|
993
|
+
* LADDER across multiple profiles is explicitly OUT of scope here (see
|
|
994
|
+
* `runJudge`'s doc) — this is a single explicit pin, not fail-over.
|
|
995
|
+
*
|
|
972
996
|
*
|
|
973
997
|
* State machine per attached policy:
|
|
974
998
|
* watching → gating → acting → done
|
|
@@ -1079,6 +1103,32 @@ interface JudgeGateSpec {
|
|
|
1079
1103
|
/** Max wall-clock for the judge turn before it is killed + FAIL.
|
|
1080
1104
|
* Default 120_000ms. */
|
|
1081
1105
|
timeoutMs?: number;
|
|
1106
|
+
/**
|
|
1107
|
+
* Named billing credential to pin the judge spawn to (WP-D) — resolved
|
|
1108
|
+
* via `resolveAccessProfileAuth` (the same profile → credential chain
|
|
1109
|
+
* `agent_start`'s `access.profileRef` uses) and forwarded to the judge's
|
|
1110
|
+
* `startSession({auth})`. Omitted ⇒ today's behaviour: the judge spawns
|
|
1111
|
+
* on whatever the daemon's default/ambient wallet resolves to for
|
|
1112
|
+
* `adapter`. This is a single EXPLICIT pin, not a ranked list with
|
|
1113
|
+
* automatic fail-over across profiles — see `runJudge`'s doc for why a
|
|
1114
|
+
* wallet LADDER is out of scope here. An unresolvable profile fails the
|
|
1115
|
+
* gate (fail-safe FAIL), same as any other judge-spawn failure.
|
|
1116
|
+
*/
|
|
1117
|
+
access?: {
|
|
1118
|
+
profileRef?: string;
|
|
1119
|
+
};
|
|
1120
|
+
/** Decomposed route identity for the judge spawn (custom gateway /
|
|
1121
|
+
* preset id) — same shape and forwarding as `agent_start`'s `route`.
|
|
1122
|
+
* Only consulted together with `access.profileRef` (eligibility +
|
|
1123
|
+
* `resolveAuthSpec`'s `routeGateway`); a bare `route` with no profile is
|
|
1124
|
+
* NOT resolved (see `runJudge`'s doc) — the judge spawns on the
|
|
1125
|
+
* adapter's ambient default in that case, same as omitting `route`. */
|
|
1126
|
+
route?: RouteSpec;
|
|
1127
|
+
/** AIP-45 mode id forwarded to the judge's `startSession({mode})` (e.g.
|
|
1128
|
+
* claude-code's `plan`/`bypass-permissions`). Forwarded as-is — the
|
|
1129
|
+
* driver validates it against the adapter's manifest, same as any other
|
|
1130
|
+
* spawn. */
|
|
1131
|
+
mode?: string;
|
|
1082
1132
|
};
|
|
1083
1133
|
}
|
|
1084
1134
|
/**
|
|
@@ -1193,6 +1243,16 @@ interface PolicyRunState {
|
|
|
1193
1243
|
exitCode: number;
|
|
1194
1244
|
at: string;
|
|
1195
1245
|
};
|
|
1246
|
+
/**
|
|
1247
|
+
* Structured judge-gate verdict (WP-D). Set when the gate is a judge gate
|
|
1248
|
+
* (`JudgeGateSpec`) and the judge's reply parsed — either a structured JSON
|
|
1249
|
+
* block or, lacking one, the plain `VERDICT: PASS|FAIL` text line (in which
|
|
1250
|
+
* case only `decision` is populated). Absent for shell/cost gates, and for
|
|
1251
|
+
* a judge gate whose reply was wholly unparseable (fail-safe FAIL — see
|
|
1252
|
+
* `state.error` for why). Overwritten (not merged) on every gate run, so a
|
|
1253
|
+
* nudge-and-retry round never carries a stale verdict forward.
|
|
1254
|
+
*/
|
|
1255
|
+
verdict?: JudgeVerdict;
|
|
1196
1256
|
/**
|
|
1197
1257
|
* The exact commit prepared at the green gate (WP5). Set when entering
|
|
1198
1258
|
* `awaiting-ack` (or just before a direct commit) so that an ack arriving
|
|
@@ -1600,6 +1660,37 @@ declare function createTaskLedger(opts: {
|
|
|
1600
1660
|
*/
|
|
1601
1661
|
|
|
1602
1662
|
type SessionEventType = "session:turn-end" | "session:awaiting-input" | "session:permission-request" | "session:permission-resolved" | "session:exited" | "session:reaped" | "session:resumed" | "session:spawned" | "session:command-done" | "session:model-changed" | "session:config-changed" | "session:renamed" | "policy:passed" | "policy:failed" | "policy:commit-ready" | "policy:committed" | "cron:fired" | "cron:succeeded" | "cron:failed" | "activity:changed" | "task:changed";
|
|
1663
|
+
/**
|
|
1664
|
+
* Fixed severity vocabulary for a judge-gate finding (WP-D). Deliberately
|
|
1665
|
+
* small and fixed so `policy_status` output is comparable across different
|
|
1666
|
+
* judge gates — but the engine never interprets it as a pass/fail threshold;
|
|
1667
|
+
* see `JudgeVerdict`'s doc for why.
|
|
1668
|
+
*/
|
|
1669
|
+
type VerdictSeverity = "info" | "low" | "medium" | "high" | "critical";
|
|
1670
|
+
/** One finding inside a structured judge verdict — mirrors the shape a real
|
|
1671
|
+
* consumer (the agentik-studio push gate reviewer) already produces. */
|
|
1672
|
+
interface VerdictFinding {
|
|
1673
|
+
severity: VerdictSeverity;
|
|
1674
|
+
file?: string;
|
|
1675
|
+
note: string;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Structured judge-gate verdict (WP-D), an optional richer alternative to the
|
|
1679
|
+
* plain `VERDICT: PASS|FAIL` text line WP7 already parses. `decision` is the
|
|
1680
|
+
* SAME single bit the text line always carried: the engine's pass/fail comes
|
|
1681
|
+
* directly from `decision`, never computed from `findings`' severities.
|
|
1682
|
+
* Severity thresholds are deliberately the CALLER's business — encoded in the
|
|
1683
|
+
* judge's own prompt ("FAIL if any finding is high or above"), not baked into
|
|
1684
|
+
* this engine, because "what severity blocks" is domain vocabulary that
|
|
1685
|
+
* differs per gate (a security review and a style lint don't share a bar).
|
|
1686
|
+
* `summary`/`findings` are informational only, persisted so an operator
|
|
1687
|
+
* reading a FAILED gate learns WHY it failed, not just THAT it failed.
|
|
1688
|
+
*/
|
|
1689
|
+
interface JudgeVerdict {
|
|
1690
|
+
decision: "PASS" | "FAIL";
|
|
1691
|
+
summary?: string;
|
|
1692
|
+
findings?: VerdictFinding[];
|
|
1693
|
+
}
|
|
1603
1694
|
/**
|
|
1604
1695
|
* Structured detail on why a session is awaiting input, when derivable.
|
|
1605
1696
|
* `source: "structured"` — a driver-reported ACP-style prompt (e.g. a tool
|
|
@@ -1866,6 +1957,9 @@ interface PolicyPassedEvent {
|
|
|
1866
1957
|
type: "policy:passed";
|
|
1867
1958
|
policyId: string;
|
|
1868
1959
|
sessionId: string;
|
|
1960
|
+
/** The judge's structured verdict (WP-D), when the gate was a judge gate
|
|
1961
|
+
* and the judge emitted a parseable one. Absent for shell/cost gates. */
|
|
1962
|
+
verdict?: JudgeVerdict;
|
|
1869
1963
|
ts: string;
|
|
1870
1964
|
}
|
|
1871
1965
|
/** Emitted by the supervisor when a completion policy's gate fails. */
|
|
@@ -1874,6 +1968,10 @@ interface PolicyFailedEvent {
|
|
|
1874
1968
|
policyId: string;
|
|
1875
1969
|
sessionId: string;
|
|
1876
1970
|
exitCode?: number;
|
|
1971
|
+
/** The judge's structured verdict (WP-D), when the gate was a judge gate
|
|
1972
|
+
* and the judge emitted a parseable one. Absent for shell/cost gates, and
|
|
1973
|
+
* for a judge gate whose reply was unparseable (fail-safe FAIL). */
|
|
1974
|
+
verdict?: JudgeVerdict;
|
|
1877
1975
|
ts: string;
|
|
1878
1976
|
}
|
|
1879
1977
|
/**
|
|
@@ -3089,18 +3187,30 @@ declare const WORKTREE_ISOLATION_ENV = "AGENTPROTO_WORKTREES_ISOLATION";
|
|
|
3089
3187
|
declare const DEFAULT_WORKTREE_ISOLATION: WorktreeIsolationMode;
|
|
3090
3188
|
/**
|
|
3091
3189
|
* The `agent_start.worktree` field. `true` isolates with an auto-minted slug;
|
|
3092
|
-
* an object additionally pins the slug and/or base ref
|
|
3093
|
-
*
|
|
3190
|
+
* an object additionally pins the slug and/or base ref, and can opt into
|
|
3191
|
+
* async provisioning (`async: true` — see `WorktreeRequest.async`); `false`
|
|
3192
|
+
* (or omitted) is "no explicit request" — the policy mode decides.
|
|
3094
3193
|
*/
|
|
3095
3194
|
type WorktreeField = boolean | {
|
|
3096
3195
|
slug?: string;
|
|
3097
3196
|
base?: string;
|
|
3197
|
+
async?: boolean;
|
|
3098
3198
|
};
|
|
3099
3199
|
/** The caller's explicit request, normalized — `undefined` when the field is
|
|
3100
3200
|
* absent or `false`, otherwise the (possibly empty) slug/base overrides. */
|
|
3101
3201
|
interface WorktreeRequest {
|
|
3102
3202
|
slug?: string;
|
|
3103
3203
|
base?: string;
|
|
3204
|
+
/** Opt-in: return a real, registered session as soon as it's minted,
|
|
3205
|
+
* provisioning the worktree in the BACKGROUND instead of blocking
|
|
3206
|
+
* `agent_start`'s response on `git worktree add` + the repo's setup
|
|
3207
|
+
* hooks (which can run minutes — see `session-spawn.ts`'s async-provision
|
|
3208
|
+
* branch). Deliberately opt-in, not the default: existing callers that
|
|
3209
|
+
* built on a synchronous ok/fail result (this package's own
|
|
3210
|
+
* `worktree_provision_failed` test coverage among them) keep exactly
|
|
3211
|
+
* today's behaviour unless they ask for the early return. Default
|
|
3212
|
+
* false. */
|
|
3213
|
+
async?: boolean;
|
|
3104
3214
|
}
|
|
3105
3215
|
/** What the runtime hands the provisioner. `cwd` is where the session would
|
|
3106
3216
|
* otherwise spawn; the provisioner resolves the owning repo from it. */
|
|
@@ -3271,6 +3381,15 @@ declare function toWorktreeStatusView(entry: unknown): WorktreeStatusView;
|
|
|
3271
3381
|
*/
|
|
3272
3382
|
/** `gc`'s three classes, mirrored runtime-local (matches `GcClass`). */
|
|
3273
3383
|
type WorktreeGcClass = "reclaim" | "salvage" | "hold";
|
|
3384
|
+
/**
|
|
3385
|
+
* `gc`'s one reclaim reason, mirrored runtime-local (matches `GcReclaimReason`).
|
|
3386
|
+
* Set only on a `reclaim`-class entry/outcome that was promoted out of `hold`
|
|
3387
|
+
* by the dep-bump exemption (`resolveGcClass` in `@agentproto/worktree`) —
|
|
3388
|
+
* absent for an ordinary merged/fresh reclaim, so its presence alone is the
|
|
3389
|
+
* "why does this line have unpushed commits and still leave" signal a human
|
|
3390
|
+
* reading the plan/outcome table needs.
|
|
3391
|
+
*/
|
|
3392
|
+
type WorktreeGcReclaimReason = "dep-bump";
|
|
3274
3393
|
/**
|
|
3275
3394
|
* One entry of the dry-run plan — a runtime-local projection of a
|
|
3276
3395
|
* `GcPlanEntry`. `tree` / `integration` / `liveness` are flattened to their
|
|
@@ -3282,6 +3401,8 @@ interface WorktreeGcPlanEntryView {
|
|
|
3282
3401
|
branch: string | null;
|
|
3283
3402
|
head: string;
|
|
3284
3403
|
class: WorktreeGcClass;
|
|
3404
|
+
/** Set only when `class === "reclaim"` via the dep-bump exemption. */
|
|
3405
|
+
reclaimReason?: WorktreeGcReclaimReason;
|
|
3285
3406
|
tree: string;
|
|
3286
3407
|
integration: {
|
|
3287
3408
|
state: string;
|
|
@@ -3303,6 +3424,8 @@ interface WorktreeGcOutcomeView {
|
|
|
3303
3424
|
path: string;
|
|
3304
3425
|
branch: string | null;
|
|
3305
3426
|
result: "reclaimed" | "salvaged" | "held" | "skipped-dirty" | "aborted-reclassified" | "aborted-vanished" | "failed";
|
|
3427
|
+
/** Set only for a `reclaimed` outcome via the dep-bump exemption. */
|
|
3428
|
+
reclaimReason?: WorktreeGcReclaimReason;
|
|
3306
3429
|
/** Set only for `salvaged`. */
|
|
3307
3430
|
salvageDir?: string;
|
|
3308
3431
|
/** Set only for `aborted-reclassified`. */
|
|
@@ -3434,6 +3557,15 @@ type AgentAdapterResolver = (slug: string) => Promise<{
|
|
|
3434
3557
|
* command-sandbox`'s `loadAdapterSpawnSandboxConfig`), or stays
|
|
3435
3558
|
* unconfined if that's unset too. */
|
|
3436
3559
|
commandSandbox?: SandboxMode;
|
|
3560
|
+
/** Extra env for the spawned adapter process — forwarded verbatim to the
|
|
3561
|
+
* driver's `runtime.start({ env })`, which the AIP-45 driver already
|
|
3562
|
+
* applies LAST (after manifest/mode/option env and billing-auth), so
|
|
3563
|
+
* these keys always win. `spawnAgentSession` (session-spawn.ts) uses
|
|
3564
|
+
* this to inject the daemon's own session-identity vars
|
|
3565
|
+
* (`SESSION_ID_ENV`/`WORKSPACE_SLUG_ENV`, see sessions.ts) — there is
|
|
3566
|
+
* no caller-facing `env` passthrough on `agent_start` today, so this is
|
|
3567
|
+
* daemon-authored only, not a general escape hatch. */
|
|
3568
|
+
env?: Record<string, string>;
|
|
3437
3569
|
}): Promise<AgentSessionLike>;
|
|
3438
3570
|
/** Display label for the descriptor's `command` field. */
|
|
3439
3571
|
commandPreview?: string;
|
|
@@ -3864,6 +3996,32 @@ interface AgentStreamEvent {
|
|
|
3864
3996
|
tokensIn?: number;
|
|
3865
3997
|
tokensOut?: number;
|
|
3866
3998
|
}
|
|
3999
|
+
/**
|
|
4000
|
+
* Env vars the registry injects into every process it spawns on a session's
|
|
4001
|
+
* behalf (agent-cli adapters, PTY/terminal, and generic `spawn()` — see
|
|
4002
|
+
* `spawn()`/`spawnPty()` below; `spawnAgent()` doesn't own the child process,
|
|
4003
|
+
* so `session-spawn.ts` injects these itself before calling the adapter
|
|
4004
|
+
* resolver's `startSession()`). Two vars, deliberately: `SESSION_ID_ENV` is
|
|
4005
|
+
* the opaque identity a hook/script needs to report back or nest a child
|
|
4006
|
+
* session under (`parentSessionId`); `WORKSPACE_SLUG_ENV` costs nothing to
|
|
4007
|
+
* add (always resolved before spawn) and turns "which session" into "which
|
|
4008
|
+
* session in which workspace" without a round-trip. `label`/`name` are
|
|
4009
|
+
* deliberately NOT carried — they're optional, mutable (renameable) and
|
|
4010
|
+
* absent on most sessions, so a hook could not depend on them; a caller that
|
|
4011
|
+
* needs one can look it up via `SESSION_ID_ENV` + `session_list`.
|
|
4012
|
+
*
|
|
4013
|
+
* THE RULE (identity forgery + inheritance, see spawn()/spawnPty()): these
|
|
4014
|
+
* are assigned into the child's env LAST — after both `process.env` and any
|
|
4015
|
+
* caller-supplied `input.env` have been merged — so a caller can never
|
|
4016
|
+
* override or forge them, and a freshly minted id always wins over whatever
|
|
4017
|
+
* (if anything) happened to be ambient. The daemon process itself is never a
|
|
4018
|
+
* session, so `process.env` never carries a stale value to begin with; the
|
|
4019
|
+
* assign-last rule is what makes that true by construction rather than by
|
|
4020
|
+
* accident, and is what guarantees a child spawned from inside a session
|
|
4021
|
+
* gets its OWN id rather than inheriting its parent's.
|
|
4022
|
+
*/
|
|
4023
|
+
declare const SESSION_ID_ENV = "AGENTPROTO_SESSION_ID";
|
|
4024
|
+
declare const WORKSPACE_SLUG_ENV = "AGENTPROTO_WORKSPACE_SLUG";
|
|
3867
4025
|
type SessionKind = "terminal" | "agent-cli" | "command" | "browser";
|
|
3868
4026
|
type SessionStatus = "starting" | "running" | "exited" | "killed" | "error";
|
|
3869
4027
|
/**
|
|
@@ -4685,6 +4843,42 @@ interface SessionsRegistry {
|
|
|
4685
4843
|
* descriptor. The agent stays alive — call `sendPrompt(id, ...)`
|
|
4686
4844
|
* for follow-up turns until `kill(id)` closes it. */
|
|
4687
4845
|
spawnAgent(input: SpawnAgentInput): SessionDescriptor;
|
|
4846
|
+
/** Register a STARTING placeholder for an agent-cli spawn whose worktree
|
|
4847
|
+
* provisioning (or other pre-flight work) hasn't finished yet — the
|
|
4848
|
+
* async-worktree-provisioning half of WP-F. Every field `spawnAgent`
|
|
4849
|
+
* would otherwise consume up front is known already (model/label/
|
|
4850
|
+
* parentage/etc. never depend on the tree existing); only the
|
|
4851
|
+
* agentSession-derived fields (pid, adapterSessionId, commandPreview,
|
|
4852
|
+
* resumable) are missing, because the driver hasn't started yet. `cwd`
|
|
4853
|
+
* is the caller's BEST KNOWN cwd at this point — the pre-worktree repo
|
|
4854
|
+
* path when the final worktree path isn't minted yet — and gets
|
|
4855
|
+
* overwritten by `settlePendingAgent`'s real `cwd` once known. Returns a
|
|
4856
|
+
* stable id + `status: "starting"` immediately; no initial prompt is
|
|
4857
|
+
* dispatched here (see `settlePendingAgent`'s `initialPrompt` — a
|
|
4858
|
+
* prompt must never be sent into a tree that isn't built yet). */
|
|
4859
|
+
spawnAgentPending(input: SpawnAgentPendingInput): SessionDescriptor;
|
|
4860
|
+
/** Resolve a placeholder created by `spawnAgentPending`, once the deferred
|
|
4861
|
+
* work (worktree provisioning + the driver's `startSession`) finishes.
|
|
4862
|
+
*
|
|
4863
|
+
* `ok: true` binds the now-live `agentSession`, refreshes `cwd`/
|
|
4864
|
+
* `worktreePath`/`worktreeId` from the FINAL cwd, flips `status` to
|
|
4865
|
+
* `"running"`, and — only now, with the tree and the driver session both
|
|
4866
|
+
* real — fires the deferred `initialPrompt` (fire-and-forget, same as
|
|
4867
|
+
* `spawnAgent`'s own initial-prompt dispatch).
|
|
4868
|
+
*
|
|
4869
|
+
* `ok: false` flips `status` to `"error"` and stamps `lastError` with the
|
|
4870
|
+
* (readable) failure reason, so a spawn that can never run ends VISIBLY
|
|
4871
|
+
* instead of sitting in `"starting"` forever — mirrors `markCrashed`'s
|
|
4872
|
+
* terminal-failure shape. Emits `session:exited` either way nothing sits
|
|
4873
|
+
* silently; a webhook/policy gate watching this id learns the outcome
|
|
4874
|
+
* without polling.
|
|
4875
|
+
*
|
|
4876
|
+
* Race guard: a no-op (and, on `ok: true`, a best-effort teardown of the
|
|
4877
|
+
* just-started `agentSession` — never leak a live, unsupervised process)
|
|
4878
|
+
* when the placeholder is no longer `"starting"` — e.g. an operator
|
|
4879
|
+
* killed it mid-provision. A terminal descriptor is never resurrected.
|
|
4880
|
+
* Also a no-op for an unknown id (the row was removed entirely). */
|
|
4881
|
+
settlePendingAgent(id: string, outcome: PendingAgentOutcome): void;
|
|
4688
4882
|
/** Spawn a process under a real PTY (node-pty). Bytes flow through
|
|
4689
4883
|
* the registry's byte ring buffer + emitter; attach with
|
|
4690
4884
|
* `attachPty(id, ...)`. Throws when the registry was constructed
|
|
@@ -5293,6 +5487,34 @@ interface SpawnAgentInput {
|
|
|
5293
5487
|
* onto `SessionDescriptor.keepAlive`. Default false. */
|
|
5294
5488
|
keepAlive?: boolean;
|
|
5295
5489
|
}
|
|
5490
|
+
/** `SpawnAgentInput` minus the fields that only exist once the driver's
|
|
5491
|
+
* `startSession` has actually run — see `spawnAgentPending`'s doc for why
|
|
5492
|
+
* everything else is safe to record up front. */
|
|
5493
|
+
type SpawnAgentPendingInput = Omit<SpawnAgentInput, "agentSession" | "commandPreview" | "resumable" | "nativeTerminalResume" | "initialPrompt">;
|
|
5494
|
+
/** The deferred outcome `settlePendingAgent` resolves a placeholder with —
|
|
5495
|
+
* see that method's doc. */
|
|
5496
|
+
type PendingAgentOutcome = {
|
|
5497
|
+
ok: true;
|
|
5498
|
+
agentSession: AgentSessionLike;
|
|
5499
|
+
/** The real cwd (the provisioned worktree, or unchanged when nothing
|
|
5500
|
+
* needed isolating) — replaces the placeholder's best-known cwd. */
|
|
5501
|
+
cwd: string;
|
|
5502
|
+
commandPreview?: string;
|
|
5503
|
+
resumable?: boolean;
|
|
5504
|
+
nativeTerminalResume?: boolean;
|
|
5505
|
+
readUsage?: () => Promise<{
|
|
5506
|
+
costUsd?: number;
|
|
5507
|
+
tokensIn?: number;
|
|
5508
|
+
tokensOut?: number;
|
|
5509
|
+
} | null>;
|
|
5510
|
+
/** Dispatched now that the tree + driver session both exist — never
|
|
5511
|
+
* passed to `spawnAgentPending`, which would race the tree. */
|
|
5512
|
+
initialPrompt?: string;
|
|
5513
|
+
} | {
|
|
5514
|
+
ok: false;
|
|
5515
|
+
/** Short, readable — stamped verbatim onto `SessionDescriptor.lastError`. */
|
|
5516
|
+
message: string;
|
|
5517
|
+
};
|
|
5296
5518
|
interface SpawnSessionInput {
|
|
5297
5519
|
kind: SessionKind;
|
|
5298
5520
|
workspaceSlug: string;
|
|
@@ -5349,6 +5571,13 @@ interface SpawnPtyInput {
|
|
|
5349
5571
|
resumeVia?: string;
|
|
5350
5572
|
}
|
|
5351
5573
|
interface RecordCommandInput {
|
|
5574
|
+
/** Pre-minted id (`mintSessionId()`), when the caller minted one BEFORE
|
|
5575
|
+
* running the command so it could inject {@link SESSION_ID_ENV} into the
|
|
5576
|
+
* child's own env — see `command-tools.ts`'s `command_execute` and
|
|
5577
|
+
* `cron-scheduler.ts`'s command-action executor. Omitted ⇒ minted here,
|
|
5578
|
+
* same as before this field existed (a command run some other way, with
|
|
5579
|
+
* no env to inject into, e.g. tests). */
|
|
5580
|
+
id?: string;
|
|
5352
5581
|
workspaceSlug: string;
|
|
5353
5582
|
/** Working directory the command actually ran in (post cwd-anchoring).
|
|
5354
5583
|
* Matched against a fresh session's cwd by `findPriorCommandSessionId`. */
|
|
@@ -5793,11 +6022,17 @@ declare function registerBuiltinRoutes(): Promise<void>;
|
|
|
5793
6022
|
*
|
|
5794
6023
|
* Backed straight by the static catalog's `getModelsByProvider`
|
|
5795
6024
|
* (`@agentproto/model-catalog`, `registry/index.ts`) — a pure query over the
|
|
5796
|
-
* kind-organized catalogs, so NO adapters, NO profiles, NO host wiring.
|
|
5797
|
-
*
|
|
5798
|
-
*
|
|
5799
|
-
*
|
|
5800
|
-
*
|
|
6025
|
+
* kind-organized catalogs, so NO adapters, NO profiles, NO host wiring.
|
|
6026
|
+
* `getModelsByProvider` is itself router-aware: OpenRouter's route table is
|
|
6027
|
+
* spread into `LLM_PRICING_CATALOG` upstream (`llm/catalog.ts`), so an
|
|
6028
|
+
* `openrouter` query returns that full, large list with bare ids; Requesty
|
|
6029
|
+
* and HuggingFace are NOT spread into that catalog — spreading a second
|
|
6030
|
+
* router's bare-id pricing there would repoint direct-vendor ids at router
|
|
6031
|
+
* pricing (`route-identity/index.ts`) — so `getModelsByProvider` instead
|
|
6032
|
+
* folds their generated route tables in directly, emitting `vendor/
|
|
6033
|
+
* product@route` ids. All three routers enumerate through the same path;
|
|
6034
|
+
* the picker paginates client-side. NEVER log the rows: OpenRouter alone is
|
|
6035
|
+
* thousands.
|
|
5801
6036
|
*/
|
|
5802
6037
|
|
|
5803
6038
|
interface CatalogProviderModelsQuery {
|
|
@@ -7494,4 +7729,4 @@ interface GatewayHandle {
|
|
|
7494
7729
|
*/
|
|
7495
7730
|
declare function createGateway(opts: CreateGatewayOptions): Promise<GatewayHandle>;
|
|
7496
7731
|
|
|
7497
|
-
export { type ActivityKind, type ActivityListFilter, type ActivityPolicyLister, type ActivityProjector, type ActivityProjectorRegistry, type ActivityProjectorSession, type ActivityRecord, type ActivitySource, type ActivityState, type ActivityWaitingOn, type ActivityWorkflowLister, AdapterAuthDescriptor, type AdapterCapabilitiesLister, type AdapterInstallResult, type AdapterListEntry, type AgentAdapterInstaller, type AgentAdapterLister, type AgentAdapterResolver, type AgentSessionLike, type AgentStreamEvent, type AnthropicReaderConfig, AnthropicRemainingQuotaReader, type AttachPolicyInput, type AttachSandboxOpts, type AttachSandboxResult, AuthMethod, BUCKETS_ROOT, type BrowserAdapterHandle, type BrowserAdapterInfo, type BrowserAdapterLister, type BrowserAdapterResolver, BuildHeartbeatAgent, CanonicalPosture, type CatalogModelsLister, CatalogModelsQuery, CatalogModelsResponse, type CatalogProviderModel, type CatalogProviderModelsQuery, type CatalogProviderModelsResponse, type CatalogProviderPricing, type ClaudeNativeRef, type CommitSpec, type CompletionPolicySupervisor, ContextProfile, type ConversationIndexRecord, type ConversationNativeRef, type CostBudgetDecision, type CrashDetectSummary, type CrashReaperRegistry, type CreateGatewayOptions, type CreateOfferInput, type CreatedOffer, DEFAULT_BUCKET, DEFAULT_ORCHESTRATOR_TOOLS, DEFAULT_WORKTREE_ISOLATION, DeclaredAdapterOption, type DeclaredAdapterPreset, type EagerResumeFailReason, type EagerResumeOutcome, type EagerResumeSkipReason, type EagerResumeSummary, EffortLevel, type GateSpec, type GatewayHandle, type HermesNativeRef, INBOUND_PROVIDERS, type IdleReapSummary, type IdleReaperRegistry, type InboundEndpoint, type InboundEndpointStore, type InboundEndpointStoreOptions, type InboundEnqueuePrompt, type InboundIsSessionAlive, type InboundMessage, type InboundProvider, type InboundRestartSession, type InboundRouteMode, type InboundRouterDeps, type InboundRouterLog, type InboundSpawnForContact, type InboundWatcher, type JudgeGateSpec, LEGACY_SESSIONS_FILE, type LocatedConversation, type LocatedConversationByPath, type McpCredentialDeps, type MigrationMarker, type NormalizeInboundResult, type OnFailSpec, type OpenPrResolver, type OrchestratorGatewayDeps, type OrchestratorInjection, type OrchestratorInjector, type OrchestratorInjectorDeps, type OrchestratorMcpServerFactory, type OrchestratorScope, type OrphanReaperRegistry, PAIRINGS_VERSION, POSTURE_NATIVE_ALIASES, POSTURE_PREAMBLES, type PairingChannelContext, type PairingChannelHandle, type PairingChannelMode, type PairingRecord, type PairingRegistry, type PairingRegistryDeps, type PendingPermission, type PermissionRespondInput, type PermissionRespondResult, type PolicyRunState, type PolicyRunStatus, Posture, type PostureResolution, type PrResolvedState, type PrStateResolver, type PresetInfo, type PricingResolver, type QuotaReadableProfile, type QuotaStoreFile, type QuotaStoreOptions, type ReconnectLogGate, type RegisterBrowserInput, type RegisterPairingToolsOptions, type RegisterSessionInput, type RemainingQuota, type RemainingQuotaReader, type ResolveNativeLinkInput, ResolvedAuthSpec, ResumeDisabledError, type RouteAwareLaunchConfig, type RouteAwareLaunchConfigInput, RouteSpec, type RuntimeMeta, type SandboxAdapterInfo, type SandboxConnectionDescriptor, type SandboxProviderCapabilities, type SandboxProviderHandle, type SandboxProviderLister, type SandboxProviderResolver, type ScopeTokenRegistry, SessionConfig, type SessionDescriptor, type SessionKind, type SessionObserver, type SessionSnapshots, type SessionStatus, type SessionUsage, type SessionWaitEvent, type SessionWaitResult, type SessionsRegistry, type ShellGateSpec, type SpawnAgentInput, type SpawnSessionInput, type StoredProfileQuota, TASK_STATUSES, type TaskCaller, type TaskChangedEvent, type TaskClaimInput, type TaskCreateInput, type TaskGateOutcome, type TaskGateRunner, type TaskLedger, type TaskLedgerRegistry, type TaskLedgerSessionSlice, type TaskListFilter, type TaskRecord, type TaskStatus, type TaskUpdateInput, type TaskVerification, type TaskVerifySupervisor, type TaskWriteResult, type TokenPricing, type TransmitterBinding, type TransmitterBindingStore, type TunnelDescriptor, type TunnelProvider, type TunnelStatus, type UsageBucket, type UsageComputeInput, type UsageRollup, type UsageSnapshotRecord, type UsageSource, WORKTREE_ISOLATION_ENV, type WatcherDescriptor, type WatcherStartInput, WorkspaceFs, type WorktreeDecision, type WorktreeField, type WorktreeGcClass, type WorktreeGcOutcomeView, type WorktreeGcPlanEntryView, type WorktreeGcResult, type WorktreeGcRunInput, type WorktreeGcRunner, WorktreeIsolationMode, type WorktreeProvisionOutcome, type WorktreeProvisionRequest, type WorktreeProvisioner, type WorktreeRequest, type WorktreeStatusLister, type WorktreeStatusView, activityCounts, appendConversationRecord, attachSandbox, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, canonicalForModeId, claudeProjectSlug, composeSessionObservers, conversationIndexPath, createActivityProjector, createFileStepCache, createGateway, createInboundEndpointStore, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPairingRegistry, createPrProvenanceReconciler, createReconnectLogGate, createScopeTokenRegistry, createSupervisorTaskGateRunner, createTaskLedger, daemonRegistryDir, decideWorktreeIsolation, declaredPresetToProviderPreset, deriveSessionUsage, enrichRollupWithProviderQuota, enrichWithRemainingQuota, evaluateCostBudget, filterActivities, findConversationRecord, findNativeMode, formatToolCall, formatToolResult, getMcpCredentialDeps, isAgentCliAuthConfigured, isClosedTaskStatus, isSafeBucketSlug, isTerminalActivityState, listBuckets, listPresets, loadQuotaStore, loadWorktreeIsolation, locateConversationByNativePath, locateConversationBySessionId, makeBrowserAdapterLister, migrateLegacySessionsFile, migrationMarkerPath, monitorPolicyWait, monitorSessionWait, narrowOrchestratorTools, normalizeInbound, normalizeModeId, normalizeWorktreeField, parseAnthropicRateLimitHeaders, parseTaskStatus, parseWindow, parseWorktreeIsolationMode, policyToActivities, policyWatchesSession, prToActivities, projectSessionUsage, readConversationIndex, readDaemonRegistry, readProfileQuota, readRegisteredSlugs, readRuntimeMeta, readUsageSnapshots, reapOrphanedDescendants, recordProfileQuota, registerBuiltinRoutes, registerPairingTools, registerSandboxAttachTool, resolveBucketSlug, resolveNativeLink, resolvePosture, rollupUsage, runCrashDetectPass, runEagerResumePass, runIdleReapPass, setMcpCredentialDeps, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, toWorktreeStatusView, turnToActivities, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, verifyInboundSignature, workflowToActivities, writeDaemonRegistryEntry };
|
|
7732
|
+
export { type ActivityKind, type ActivityListFilter, type ActivityPolicyLister, type ActivityProjector, type ActivityProjectorRegistry, type ActivityProjectorSession, type ActivityRecord, type ActivitySource, type ActivityState, type ActivityWaitingOn, type ActivityWorkflowLister, AdapterAuthDescriptor, type AdapterCapabilitiesLister, type AdapterInstallResult, type AdapterListEntry, type AgentAdapterInstaller, type AgentAdapterLister, type AgentAdapterResolver, type AgentSessionLike, type AgentStreamEvent, type AnthropicReaderConfig, AnthropicRemainingQuotaReader, type AttachPolicyInput, type AttachSandboxOpts, type AttachSandboxResult, AuthMethod, BUCKETS_ROOT, type BrowserAdapterHandle, type BrowserAdapterInfo, type BrowserAdapterLister, type BrowserAdapterResolver, BuildHeartbeatAgent, CanonicalPosture, type CatalogModelsLister, CatalogModelsQuery, CatalogModelsResponse, type CatalogProviderModel, type CatalogProviderModelsQuery, type CatalogProviderModelsResponse, type CatalogProviderPricing, type ClaudeNativeRef, type CommitSpec, type CompletionPolicySupervisor, ContextProfile, type ConversationIndexRecord, type ConversationNativeRef, type CostBudgetDecision, type CrashDetectSummary, type CrashReaperRegistry, type CreateGatewayOptions, type CreateOfferInput, type CreatedOffer, DEFAULT_BUCKET, DEFAULT_ORCHESTRATOR_TOOLS, DEFAULT_WORKTREE_ISOLATION, DeclaredAdapterOption, type DeclaredAdapterPreset, type EagerResumeFailReason, type EagerResumeOutcome, type EagerResumeSkipReason, type EagerResumeSummary, EffortLevel, type GateSpec, type GatewayHandle, type HermesNativeRef, INBOUND_PROVIDERS, type IdleReapSummary, type IdleReaperRegistry, type InboundEndpoint, type InboundEndpointStore, type InboundEndpointStoreOptions, type InboundEnqueuePrompt, type InboundIsSessionAlive, type InboundMessage, type InboundProvider, type InboundRestartSession, type InboundRouteMode, type InboundRouterDeps, type InboundRouterLog, type InboundSpawnForContact, type InboundWatcher, type JudgeGateSpec, LEGACY_SESSIONS_FILE, type LocatedConversation, type LocatedConversationByPath, type McpCredentialDeps, type MigrationMarker, type NormalizeInboundResult, type OnFailSpec, type OpenPrResolver, type OrchestratorGatewayDeps, type OrchestratorInjection, type OrchestratorInjector, type OrchestratorInjectorDeps, type OrchestratorMcpServerFactory, type OrchestratorScope, type OrphanReaperRegistry, PAIRINGS_VERSION, POSTURE_NATIVE_ALIASES, POSTURE_PREAMBLES, type PairingChannelContext, type PairingChannelHandle, type PairingChannelMode, type PairingRecord, type PairingRegistry, type PairingRegistryDeps, type PendingPermission, type PermissionRespondInput, type PermissionRespondResult, type PolicyRunState, type PolicyRunStatus, Posture, type PostureResolution, type PrResolvedState, type PrStateResolver, type PresetInfo, type PricingResolver, type QuotaReadableProfile, type QuotaStoreFile, type QuotaStoreOptions, type ReconnectLogGate, type RegisterBrowserInput, type RegisterPairingToolsOptions, type RegisterSessionInput, type RemainingQuota, type RemainingQuotaReader, type ResolveNativeLinkInput, ResolvedAuthSpec, ResumeDisabledError, type RouteAwareLaunchConfig, type RouteAwareLaunchConfigInput, RouteSpec, type RuntimeMeta, SESSION_ID_ENV, type SandboxAdapterInfo, type SandboxConnectionDescriptor, type SandboxProviderCapabilities, type SandboxProviderHandle, type SandboxProviderLister, type SandboxProviderResolver, type ScopeTokenRegistry, SessionConfig, type SessionDescriptor, type SessionKind, type SessionObserver, type SessionSnapshots, type SessionStatus, type SessionUsage, type SessionWaitEvent, type SessionWaitResult, type SessionsRegistry, type ShellGateSpec, type SpawnAgentInput, type SpawnSessionInput, type StoredProfileQuota, TASK_STATUSES, type TaskCaller, type TaskChangedEvent, type TaskClaimInput, type TaskCreateInput, type TaskGateOutcome, type TaskGateRunner, type TaskLedger, type TaskLedgerRegistry, type TaskLedgerSessionSlice, type TaskListFilter, type TaskRecord, type TaskStatus, type TaskUpdateInput, type TaskVerification, type TaskVerifySupervisor, type TaskWriteResult, type TokenPricing, type TransmitterBinding, type TransmitterBindingStore, type TunnelDescriptor, type TunnelProvider, type TunnelStatus, type UsageBucket, type UsageComputeInput, type UsageRollup, type UsageSnapshotRecord, type UsageSource, WORKSPACE_SLUG_ENV, WORKTREE_ISOLATION_ENV, type WatcherDescriptor, type WatcherStartInput, WorkspaceFs, type WorktreeDecision, type WorktreeField, type WorktreeGcClass, type WorktreeGcOutcomeView, type WorktreeGcPlanEntryView, type WorktreeGcReclaimReason, type WorktreeGcResult, type WorktreeGcRunInput, type WorktreeGcRunner, WorktreeIsolationMode, type WorktreeProvisionOutcome, type WorktreeProvisionRequest, type WorktreeProvisioner, type WorktreeRequest, type WorktreeStatusLister, type WorktreeStatusView, activityCounts, appendConversationRecord, attachSandbox, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, canonicalForModeId, claudeProjectSlug, composeSessionObservers, conversationIndexPath, createActivityProjector, createFileStepCache, createGateway, createInboundEndpointStore, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPairingRegistry, createPrProvenanceReconciler, createReconnectLogGate, createScopeTokenRegistry, createSupervisorTaskGateRunner, createTaskLedger, daemonRegistryDir, decideWorktreeIsolation, declaredPresetToProviderPreset, deriveSessionUsage, enrichRollupWithProviderQuota, enrichWithRemainingQuota, evaluateCostBudget, filterActivities, findConversationRecord, findNativeMode, formatToolCall, formatToolResult, getMcpCredentialDeps, isAgentCliAuthConfigured, isClosedTaskStatus, isSafeBucketSlug, isTerminalActivityState, listBuckets, listPresets, loadQuotaStore, loadWorktreeIsolation, locateConversationByNativePath, locateConversationBySessionId, makeBrowserAdapterLister, migrateLegacySessionsFile, migrationMarkerPath, monitorPolicyWait, monitorSessionWait, narrowOrchestratorTools, normalizeInbound, normalizeModeId, normalizeWorktreeField, parseAnthropicRateLimitHeaders, parseTaskStatus, parseWindow, parseWorktreeIsolationMode, policyToActivities, policyWatchesSession, prToActivities, projectSessionUsage, readConversationIndex, readDaemonRegistry, readProfileQuota, readRegisteredSlugs, readRuntimeMeta, readUsageSnapshots, reapOrphanedDescendants, recordProfileQuota, registerBuiltinRoutes, registerPairingTools, registerSandboxAttachTool, resolveBucketSlug, resolveNativeLink, resolvePosture, rollupUsage, runCrashDetectPass, runEagerResumePass, runIdleReapPass, setMcpCredentialDeps, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, toWorktreeStatusView, turnToActivities, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, verifyInboundSignature, workflowToActivities, writeDaemonRegistryEntry };
|