@agentproto/runtime 2.8.0 → 2.10.1
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 +87 -1
- package/dist/catalog-models.d.ts +68 -2
- package/dist/catalog-models.mjs +53 -5
- package/dist/catalog-models.mjs.map +1 -1
- package/dist/config.d.ts +47 -2
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.ts +399 -13
- package/dist/index.mjs +2733 -871
- package/dist/index.mjs.map +1 -1
- package/dist/pr-provenance.mjs +1 -1
- package/dist/pr-provenance.mjs.map +1 -1
- package/dist/release-check.d.ts +144 -0
- package/dist/release-check.mjs +149 -0
- package/dist/release-check.mjs.map +1 -0
- package/dist/resume-strategies.d.ts +35 -7
- package/dist/resume-strategies.mjs +12 -4
- package/dist/resume-strategies.mjs.map +1 -1
- package/dist/session-presence.d.ts +115 -0
- package/dist/session-presence.mjs +103 -0
- package/dist/session-presence.mjs.map +1 -0
- package/dist/session-story.mjs.map +1 -1
- package/dist/{spawn-defaults-DVgmfxWo.d.ts → spawn-defaults-DUnTfwVK.d.ts} +29 -10
- package/package.json +36 -24
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export { CostBudget, CostBudgetScope } from '@agentproto/auth';
|
|
|
13
13
|
import { R as ResolvedContextContinuityPolicy } from './context-continuity-ib9_bVYM.js';
|
|
14
14
|
import { SandboxMode } from '@agentproto/command-sandbox';
|
|
15
15
|
import { AdapterHandle, SetupField, AdapterResolver, AdapterLister, HarnessCapabilities, AdapterEntry } from '@agentproto/provider-kit';
|
|
16
|
-
import { R as ResolvedAuthSpec, D as DeclaredAdapterOption, A as AdapterAuthDescriptor } from './spawn-defaults-
|
|
17
|
-
export { a as AuthEcho, b as AuthResolutionError, C as CLAUDE_CODE_OAUTH_SOURCE, c as CredentialSource, d as DefaultsAdapterAuthConfig, e as DefaultsAdapterConfig, f as ResolveSubscriptionCredentialInput, g as ResolvedSpawnAuthMaterial, h as ResolvedSpawnDefaults, S as SpawnDefaultsConfig, i as SubscriptionCredentialResolution, j as SubscriptionSourceError, k as credentialFingerprint, n as normalizeSkillsOption, r as resolveAuthSpec, l as resolveSpawnDefaults, m as resolveSubscriptionCredential } from './spawn-defaults-
|
|
16
|
+
import { R as ResolvedAuthSpec, D as DeclaredAdapterOption, A as AdapterAuthDescriptor } from './spawn-defaults-DUnTfwVK.js';
|
|
17
|
+
export { a as AuthEcho, b as AuthResolutionError, C as CLAUDE_CODE_OAUTH_SOURCE, c as CredentialSource, d as DefaultsAdapterAuthConfig, e as DefaultsAdapterConfig, f as ResolveSubscriptionCredentialInput, g as ResolvedSpawnAuthMaterial, h as ResolvedSpawnDefaults, S as SpawnDefaultsConfig, i as SubscriptionCredentialResolution, j as SubscriptionSourceError, k as credentialFingerprint, n as normalizeSkillsOption, r as resolveAuthSpec, l as resolveSpawnDefaults, m as resolveSubscriptionCredential } from './spawn-defaults-DUnTfwVK.js';
|
|
18
18
|
import { CatalogModelsQuery, CatalogModelsResponse } from './catalog-models.js';
|
|
19
19
|
export { CatalogAdapterInput, CatalogAdapterModelInput, CatalogPricing, CatalogProduct, CatalogRoute, CatalogRouteSummary, CatalogVendor, buildCatalogModels } from './catalog-models.js';
|
|
20
20
|
import { FooterSession } from './pr-provenance.js';
|
|
@@ -1251,9 +1251,21 @@ interface PolicyRunState {
|
|
|
1251
1251
|
retries: number;
|
|
1252
1252
|
startedAt: string;
|
|
1253
1253
|
endedAt?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* Result of the most recent gate run. `kind` distinguishes what produced
|
|
1256
|
+
* it — `stdout`/`stderr` (truncated) are only populated for a shell gate;
|
|
1257
|
+
* a judge gate only ever sets `exitCode`/`at` here (its actual verdict
|
|
1258
|
+
* lives in `verdict` below). Consulted by a SIBLING judge gate watching
|
|
1259
|
+
* an overlapping session set (see `findRecentMachineGateResult`) so it
|
|
1260
|
+
* cannot render a verdict blind to an already-known machine result —
|
|
1261
|
+
* see that function's doc for the incident this closes.
|
|
1262
|
+
*/
|
|
1254
1263
|
lastGate?: {
|
|
1255
1264
|
exitCode: number;
|
|
1256
1265
|
at: string;
|
|
1266
|
+
kind?: "shell" | "judge" | "cost";
|
|
1267
|
+
stdout?: string;
|
|
1268
|
+
stderr?: string;
|
|
1257
1269
|
};
|
|
1258
1270
|
/**
|
|
1259
1271
|
* Structured judge-gate verdict (WP-D). Set when the gate is a judge gate
|
|
@@ -2046,6 +2058,17 @@ interface SessionModelChangedEvent {
|
|
|
2046
2058
|
type: "session:model-changed";
|
|
2047
2059
|
sessionId: string;
|
|
2048
2060
|
model: string;
|
|
2061
|
+
/**
|
|
2062
|
+
* The model now believed to be ACTIVE — mirrors
|
|
2063
|
+
* `SessionDescriptor.activeModel`. Absent only for adapters/paths that
|
|
2064
|
+
* predate this field; once populated it's kept in lockstep with `model`
|
|
2065
|
+
* (equal when a switch went through this daemon, divergent when learned
|
|
2066
|
+
* from an adapter's own reply to a `/model` sent as an ordinary prompt).
|
|
2067
|
+
* REPORTED BY THE ADAPTER, NOT INDEPENDENTLY VERIFIED when it diverges
|
|
2068
|
+
* from `model` — see `SessionDescriptor.activeModel`'s doc. A display
|
|
2069
|
+
* hint, never a source of billing/cost truth.
|
|
2070
|
+
*/
|
|
2071
|
+
activeModel?: string;
|
|
2049
2072
|
label?: string;
|
|
2050
2073
|
ts: string;
|
|
2051
2074
|
}
|
|
@@ -3348,6 +3371,35 @@ declare function createActivityProjector(opts: {
|
|
|
3348
3371
|
resolvePrState?: PrStateResolver;
|
|
3349
3372
|
}): ActivityProjector;
|
|
3350
3373
|
|
|
3374
|
+
/**
|
|
3375
|
+
* Daemon-side AGENTS.md resolution + injection (WP-R2).
|
|
3376
|
+
*
|
|
3377
|
+
* The daemon historically had ZERO first-class handling of `AGENTS.md` — it
|
|
3378
|
+
* was read only when an adapter happened to do so natively (opencode by its
|
|
3379
|
+
* own convention, claude-code via `CLAUDE.md`, hermes not at all), and the
|
|
3380
|
+
* supervisor brief told a child to "go read AGENTS.md" by hand, which is a
|
|
3381
|
+
* loterie, not a guarantee. This module makes the daemon resolve and inject
|
|
3382
|
+
* it itself, adapter-agnostic, at spawn time — the same way it already
|
|
3383
|
+
* composes the role disposition (see `role.ts`'s `composeRoleContext`).
|
|
3384
|
+
*
|
|
3385
|
+
* Resolution runs once per spawn, from the session's resolved `cwd`:
|
|
3386
|
+
* - walk UP directory by directory, checking for an `AGENTS.md` at each
|
|
3387
|
+
* level; the FIRST one found (nearest to `cwd`) wins.
|
|
3388
|
+
* - the walk is bounded by the git toplevel of `cwd`'s own repo
|
|
3389
|
+
* (`git rev-parse --show-toplevel` from `cwd`) — it never walks past it
|
|
3390
|
+
* into an outer/parent repo. A nested repo has its own `.git`, so git's
|
|
3391
|
+
* toplevel resolves to the nested root and the walk stops exactly there.
|
|
3392
|
+
* - if `cwd` is not inside a git repo at all, only `cwd` itself is checked
|
|
3393
|
+
* (no walk), falling through to "absent" when nothing is there.
|
|
3394
|
+
*
|
|
3395
|
+
* Injection is a block in the child's single composed initial prompt (there
|
|
3396
|
+
* is no separate system-prompt channel — see `session-spawn.ts`'s
|
|
3397
|
+
* `effectivePrompt` construction): a full inline copy when the file is small
|
|
3398
|
+
* enough, a pointer to read it first when it's large, or nothing extra when
|
|
3399
|
+
* absent — plus a standing cd-contract sentence regardless of mode.
|
|
3400
|
+
*/
|
|
3401
|
+
type AgentsMdMode = "inline" | "pointer" | "absent";
|
|
3402
|
+
|
|
3351
3403
|
/**
|
|
3352
3404
|
* Policy layer for `agent_start.worktree` — the config-driven decision of
|
|
3353
3405
|
* WHETHER to isolate a spawn into its own git worktree, kept deliberately
|
|
@@ -3435,17 +3487,44 @@ type WorktreeProvisionOutcome = {
|
|
|
3435
3487
|
* by the CLI (over `@agentproto/worktree`); absent on a bare runtime.
|
|
3436
3488
|
*/
|
|
3437
3489
|
type WorktreeProvisioner = (req: WorktreeProvisionRequest) => Promise<WorktreeProvisionOutcome>;
|
|
3490
|
+
/**
|
|
3491
|
+
* Injected port: best-effort attempt to reclaim ONE worktree by path, called
|
|
3492
|
+
* when its session reaches a terminal state (see
|
|
3493
|
+
* `SessionDescriptor.worktreeAutoProvisioned` and `createSessionsRegistry`'s
|
|
3494
|
+
* `runWorktreeAutoReclaim` option in `sessions.ts`). Deliberately scoped to
|
|
3495
|
+
* exactly the one path a session's own exit is allowed to touch — never a
|
|
3496
|
+
* repo-wide sweep. The implementation (wired by the CLI over
|
|
3497
|
+
* `@agentproto/worktree`'s `reclaimOneWorktree`) re-classifies fresh and only
|
|
3498
|
+
* ever removes the worktree when that comes back `reclaim` (merged-or-fresh,
|
|
3499
|
+
* clean, idle) — a dirty or held worktree is simply left alone. Must never
|
|
3500
|
+
* reject in a way the caller can't safely ignore; `sessions.ts` treats any
|
|
3501
|
+
* rejection as "couldn't reclaim this time, leave it for a manual or
|
|
3502
|
+
* scheduled `gc` sweep" and logs rather than lets it interrupt session
|
|
3503
|
+
* teardown. Absent on a bare runtime — auto-reclaim is simply skipped, and a
|
|
3504
|
+
* caller-explicit worktree request is never routed through this port at all
|
|
3505
|
+
* (see `WorktreeDecision.provision.implicit`).
|
|
3506
|
+
*/
|
|
3507
|
+
type WorktreeAutoReclaimer = (worktreePath: string) => Promise<void>;
|
|
3438
3508
|
/** The pure decision's three outcomes. `spawn-in-place` may carry a `warn`:
|
|
3439
3509
|
* a non-fatal notice the caller should surface (the child is about to run in
|
|
3440
3510
|
* a shared, dirty checkout it doesn't own). A `warn` never blocks the spawn —
|
|
3441
3511
|
* it's the loud-but-legitimate middle ground between silently spawning into a
|
|
3442
|
-
* shared tree and hard-rejecting an in-place spawn that's normal at depth.
|
|
3512
|
+
* shared tree and hard-rejecting an in-place spawn that's normal at depth.
|
|
3513
|
+
* `provision.implicit` is `true` exactly when the caller made no explicit
|
|
3514
|
+
* `worktree` request and the `"always"` policy provisioned one anyway (the
|
|
3515
|
+
* worktree the caller never asked to keep) — `false` whenever the request
|
|
3516
|
+
* came from the caller itself (`on-request`'s only path here, or `"always"`
|
|
3517
|
+
* with an explicit field). This is the signal `session-spawn.ts` threads
|
|
3518
|
+
* onto the session descriptor so exit-time auto-reclaim (`sessions.ts`)
|
|
3519
|
+
* only ever touches a worktree the daemon minted on its own — a worktree a
|
|
3520
|
+
* caller explicitly asked to keep is never auto-removed. */
|
|
3443
3521
|
type WorktreeDecision = {
|
|
3444
3522
|
action: "spawn-in-place";
|
|
3445
3523
|
warn?: string;
|
|
3446
3524
|
} | {
|
|
3447
3525
|
action: "provision";
|
|
3448
3526
|
request: WorktreeRequest;
|
|
3527
|
+
implicit: boolean;
|
|
3449
3528
|
} | {
|
|
3450
3529
|
action: "reject";
|
|
3451
3530
|
message: string;
|
|
@@ -3571,17 +3650,21 @@ declare function toWorktreeStatusView(entry: unknown): WorktreeStatusView;
|
|
|
3571
3650
|
* Repo-root resolution is shared with the status surface via
|
|
3572
3651
|
* `resolveWorktreeQueryRoot` in `worktree-status.ts`.
|
|
3573
3652
|
*/
|
|
3653
|
+
|
|
3574
3654
|
/** `gc`'s three classes, mirrored runtime-local (matches `GcClass`). */
|
|
3575
3655
|
type WorktreeGcClass = "reclaim" | "salvage" | "hold";
|
|
3576
3656
|
/**
|
|
3577
|
-
* `gc`'s
|
|
3578
|
-
*
|
|
3579
|
-
* by the dep-bump exemption (`resolveGcClass` in
|
|
3580
|
-
* absent for an ordinary merged/fresh reclaim, so
|
|
3581
|
-
* "why does this line have unpushed commits and
|
|
3582
|
-
* reading the plan/outcome table needs.
|
|
3657
|
+
* `gc`'s reclaim reasons, mirrored runtime-local (matches `GcReclaimReason`).
|
|
3658
|
+
* `dep-bump` is set on a `reclaim`-class entry/outcome that was promoted out
|
|
3659
|
+
* of `hold` by the dep-bump exemption (`resolveGcClass` in
|
|
3660
|
+
* `@agentproto/worktree`) — absent for an ordinary merged/fresh reclaim, so
|
|
3661
|
+
* its presence alone is the "why does this line have unpushed commits and
|
|
3662
|
+
* still leave" signal a human reading the plan/outcome table needs.
|
|
3663
|
+
* `orphan` is set on an entry/outcome the orphan scan found — a directory
|
|
3664
|
+
* physically present under the repo's worktree pool with no `git worktree
|
|
3665
|
+
* list` entry at all (see `WorktreeGcPlanEntryView.orphan`).
|
|
3583
3666
|
*/
|
|
3584
|
-
type WorktreeGcReclaimReason = "dep-bump";
|
|
3667
|
+
type WorktreeGcReclaimReason = "dep-bump" | "orphan";
|
|
3585
3668
|
/**
|
|
3586
3669
|
* One entry of the dry-run plan — a runtime-local projection of a
|
|
3587
3670
|
* `GcPlanEntry`. `tree` / `integration` / `liveness` are flattened to their
|
|
@@ -3593,8 +3676,17 @@ interface WorktreeGcPlanEntryView {
|
|
|
3593
3676
|
branch: string | null;
|
|
3594
3677
|
head: string;
|
|
3595
3678
|
class: WorktreeGcClass;
|
|
3596
|
-
/** Set only when `class === "reclaim"` via the dep-bump exemption. */
|
|
3679
|
+
/** Set only when `class === "reclaim"` via the dep-bump exemption or the orphan scan. */
|
|
3597
3680
|
reclaimReason?: WorktreeGcReclaimReason;
|
|
3681
|
+
/**
|
|
3682
|
+
* `true` only for an orphan-scan entry: a directory physically present
|
|
3683
|
+
* under the repo's worktree pool with no `git worktree list` entry at all
|
|
3684
|
+
* (even after a prune). `tree`/`integration`/`liveness` carry no real axis
|
|
3685
|
+
* read for these — git itself can't answer those questions for a
|
|
3686
|
+
* directory it no longer recognizes as a worktree — so they're set to the
|
|
3687
|
+
* literal `"orphan"` placeholder below rather than a fabricated value.
|
|
3688
|
+
*/
|
|
3689
|
+
orphan?: boolean;
|
|
3598
3690
|
tree: string;
|
|
3599
3691
|
integration: {
|
|
3600
3692
|
state: string;
|
|
@@ -3646,6 +3738,17 @@ interface WorktreeGcRunInput {
|
|
|
3646
3738
|
apply: boolean;
|
|
3647
3739
|
salvageDirty: boolean;
|
|
3648
3740
|
includeDetached: boolean;
|
|
3741
|
+
/**
|
|
3742
|
+
* Absolute cwds of every live session the daemon knows about right now —
|
|
3743
|
+
* see `livingSessionCwds` below. Threaded straight to the gc engine's own
|
|
3744
|
+
* `protectedPaths` (`@agentproto/worktree`'s `PlanGcInput`/`ApplyGcOptions`):
|
|
3745
|
+
* a worktree that IS or CONTAINS one of these paths is held, never
|
|
3746
|
+
* reclaimed/salvaged, regardless of what `classify`'s own (snapshot-based)
|
|
3747
|
+
* liveness axis concludes. Optional — a host that can't cheaply enumerate
|
|
3748
|
+
* its own live sessions (or has none, e.g. the bare CLI `worktree gc`
|
|
3749
|
+
* command) omits it and gets exactly today's behavior.
|
|
3750
|
+
*/
|
|
3751
|
+
protectedPaths?: string[];
|
|
3649
3752
|
}
|
|
3650
3753
|
/**
|
|
3651
3754
|
* Injected port: the runtime asks the host to plan (and, when `apply`, execute)
|
|
@@ -4219,6 +4322,22 @@ interface AgentStreamEvent {
|
|
|
4219
4322
|
/** "permission-resolved" chosen option id, when the driver's offered
|
|
4220
4323
|
* options included one (e.g. ACP's `allow_always`). */
|
|
4221
4324
|
optionId?: string;
|
|
4325
|
+
/** "available-commands" full command list — see @agentproto/acp's
|
|
4326
|
+
* `StreamEvent`'s `available-commands` kind. REPLACES any previously
|
|
4327
|
+
* reported list wholesale; it is not a delta. */
|
|
4328
|
+
commands?: Array<{
|
|
4329
|
+
name: string;
|
|
4330
|
+
description?: string;
|
|
4331
|
+
input?: {
|
|
4332
|
+
hint?: string;
|
|
4333
|
+
} | null;
|
|
4334
|
+
_meta?: {
|
|
4335
|
+
scope?: string;
|
|
4336
|
+
path?: string;
|
|
4337
|
+
bareName?: string;
|
|
4338
|
+
qualifiedName?: string;
|
|
4339
|
+
};
|
|
4340
|
+
}>;
|
|
4222
4341
|
}
|
|
4223
4342
|
/**
|
|
4224
4343
|
* Env vars the registry injects into every process it spawns on a session's
|
|
@@ -4329,8 +4448,29 @@ interface QueuedPrompt {
|
|
|
4329
4448
|
/** ISO 8601 timestamp this item was queued. */
|
|
4330
4449
|
queuedAt: string;
|
|
4331
4450
|
/** Same as `enqueuePrompt`'s `opts.source` — carried through to the
|
|
4332
|
-
* turn this item eventually becomes. */
|
|
4451
|
+
* turn this item eventually becomes (transcript provenance). */
|
|
4333
4452
|
source?: string;
|
|
4453
|
+
/** Who/what queued this, for the AFTER-THE-FACT queue UI — DISTINCT
|
|
4454
|
+
* from `source` (transcript provenance). Set from `enqueuePrompt`'s
|
|
4455
|
+
* `opts.origin` at the enqueue site so a human session-operator, an
|
|
4456
|
+
* agent session (`agent_prompt`), and a child's report (`message_parent`)
|
|
4457
|
+
* are cleanly separable when someone inspects the queue later across a
|
|
4458
|
+
* daemon restart. Absent for legacy queued items — `promptOriginLabel`
|
|
4459
|
+
* falls back to `source`, then `"user"`. */
|
|
4460
|
+
origin?: string;
|
|
4461
|
+
}
|
|
4462
|
+
/** One entry in the after-the-fact queue listing (`listQueuedPrompts` /
|
|
4463
|
+
* `session_queue_list` / `GET /sessions/:id/queue`). `position` is the
|
|
4464
|
+
* array index (0 = next to dispatch). */
|
|
4465
|
+
interface QueuedPromptView {
|
|
4466
|
+
id: string;
|
|
4467
|
+
/** Human-readable origin — who queued this ("user", "agent <id>", "child <id>"). */
|
|
4468
|
+
origin: string;
|
|
4469
|
+
/** Short single-line text preview of the message. */
|
|
4470
|
+
preview: string;
|
|
4471
|
+
/** ISO 8601 timestamp the item was queued. */
|
|
4472
|
+
queuedAt: string;
|
|
4473
|
+
position: number;
|
|
4334
4474
|
}
|
|
4335
4475
|
interface SessionDescriptor {
|
|
4336
4476
|
id: string;
|
|
@@ -4438,6 +4578,14 @@ interface SessionDescriptor {
|
|
|
4438
4578
|
* busy descendants. NOTE: in-process subagents a harness runs itself are
|
|
4439
4579
|
* invisible to the daemon between turns, so they don't count here. */
|
|
4440
4580
|
childrenBusy?: number;
|
|
4581
|
+
/** Count of prompts currently sitting in this session's
|
|
4582
|
+
* {@link promptQueue} — a cheap, always-present badge signal for
|
|
4583
|
+
* list/table/panel rendering ("N queued"), derived at read time from
|
|
4584
|
+
* the live queue. Ephemeral, never persisted (the queue itself is).
|
|
4585
|
+
* 0/absent ⇒ nothing waiting. The full per-item detail (origin,
|
|
4586
|
+
* preview, queuedAt, position) lives behind the `session_queue_list`
|
|
4587
|
+
* verb / `GET /sessions/:id/queue` — this is just the scalar badge. */
|
|
4588
|
+
queuedPrompts?: number;
|
|
4441
4589
|
/** Short human-readable string describing the most recent automatic
|
|
4442
4590
|
* failure — currently only stamped by `markCrashed` (e.g. "adapter
|
|
4443
4591
|
* process gone (pid 1234) — session crashed"). Not a stack trace or raw
|
|
@@ -4497,6 +4645,24 @@ interface SessionDescriptor {
|
|
|
4497
4645
|
* the moment a LATER turn completes without one (same reset shape as
|
|
4498
4646
|
* `resumeAttempts`/`restartAttempts`). Detection + signal only. */
|
|
4499
4647
|
lastTurnErroredAt?: string;
|
|
4648
|
+
/** True when the LAST completed turn produced zero assistant output and
|
|
4649
|
+
* zero tool calls (mirrors `SessionTurnEndEvent.empty` — see that
|
|
4650
|
+
* field's doc). Persisted so `monitorSessionWait`'s synchronous
|
|
4651
|
+
* already-in-target-state fast-path (which has only the descriptor to
|
|
4652
|
+
* read, not the triggering bus event) can surface the same "green
|
|
4653
|
+
* turn-end but nothing actually happened" signal the bus/ring branches
|
|
4654
|
+
* get from the event itself. Stamped every `turnCompleted` turn end
|
|
4655
|
+
* (absent, not `false`, on a productive turn) — never set by the
|
|
4656
|
+
* abnormal (error/abort) turn-end path, matching the bus event. */
|
|
4657
|
+
lastTurnEmpty?: boolean;
|
|
4658
|
+
/** The LAST completed turn's `SessionTurnEndEvent.reason` (e.g.
|
|
4659
|
+
* `"completed"`, `"error"`, `"aborted"`), when the adapter/daemon
|
|
4660
|
+
* reported one. Twin of `lastTurnEmpty` — same reason for existing:
|
|
4661
|
+
* the sync fast-path branch of `monitorSessionWait` has no event
|
|
4662
|
+
* object to read `.reason` off, only this descriptor. Stamped at every
|
|
4663
|
+
* turn end (normal or abnormal); absent when the turn ended with no
|
|
4664
|
+
* reason to report. */
|
|
4665
|
+
lastTurnReason?: string;
|
|
4500
4666
|
/** DERIVED, read-time only (never persisted — stripped by `snapshotRows`,
|
|
4501
4667
|
* stamped by `stampInterrupted` in list()/get()/findByIdOrName). True when
|
|
4502
4668
|
* this session died with a turn in flight under a daemon restart —
|
|
@@ -4668,6 +4834,42 @@ interface SessionDescriptor {
|
|
|
4668
4834
|
* `worktreePath` without an id identifies a PATH, which a later worktree
|
|
4669
4835
|
* may reuse; the pair identifies one specific worktree. */
|
|
4670
4836
|
worktreeId?: string;
|
|
4837
|
+
/** `true` only when `worktreePath` was provisioned by the `worktrees.isolation`
|
|
4838
|
+
* policy WITHOUT an explicit `worktree` request from the caller (see
|
|
4839
|
+
* `decideWorktreeIsolation`'s `WorktreeDecision.provision.implicit` in
|
|
4840
|
+
* `worktree-isolation.ts`) — a worktree the caller never asked to keep.
|
|
4841
|
+
* Gates exit-time auto-reclaim (`emitExited` below, via the injected
|
|
4842
|
+
* `WorktreeAutoReclaimer` port): only an implicit worktree is ever a
|
|
4843
|
+
* candidate for automatic removal on session exit. Absent (never `true`)
|
|
4844
|
+
* for a worktree the caller explicitly requested (`worktree: {...}` on
|
|
4845
|
+
* the spawn), which keeps today's manual-cleanup-only behavior unchanged,
|
|
4846
|
+
* and absent for every session persisted before this field existed. */
|
|
4847
|
+
worktreeAutoProvisioned?: boolean;
|
|
4848
|
+
/** Absolute path of the AGENTS.md the daemon resolved for this session's
|
|
4849
|
+
* spawn `cwd` (walking up, bounded by the repo's git toplevel — see
|
|
4850
|
+
* `agents-md.ts`), whose content or pointer was injected into the initial
|
|
4851
|
+
* prompt. Absent when `agentsMdMode` is `"absent"` and for a session
|
|
4852
|
+
* persisted before this field existed. */
|
|
4853
|
+
agentsMd?: string;
|
|
4854
|
+
/** How the resolved AGENTS.md was injected at spawn: `"inline"` (full
|
|
4855
|
+
* content), `"pointer"` (read-it-first instruction), or `"absent"` (the
|
|
4856
|
+
* walk found none — a real, reported state, a consumer distinguishes it
|
|
4857
|
+
* from the field being missing in an old descriptor shape by checking
|
|
4858
|
+
* `=== "absent"`). The daemon's spawn path (`session-spawn.ts`) ALWAYS
|
|
4859
|
+
* stamps this once resolution ran — it is optional on the type only so
|
|
4860
|
+
* legacy persisted descriptors (pre-WP-R2) and non-AGENTS.md-aware
|
|
4861
|
+
* constructor paths don't have to fabricate a value; a freshly-spawned
|
|
4862
|
+
* session always carries it. */
|
|
4863
|
+
agentsMdMode?: AgentsMdMode;
|
|
4864
|
+
/** Absolute path of the per-workspace `RULES.md` the daemon resolved for
|
|
4865
|
+
* this session's spawn workspace (see `workspace-rules.ts`) — read from
|
|
4866
|
+
* the workspace's state bucket (`~/.agentproto/workspaces/<slug>/
|
|
4867
|
+
* RULES.md`) and injected into the initial prompt of EVERY spawn in the
|
|
4868
|
+
* workspace (root and nested, no depth gate). Present only when a rules
|
|
4869
|
+
* file was actually found and injected; `undefined` means absent (there
|
|
4870
|
+
* is no separate inline/pointer/absent tri-state — the field itself being
|
|
4871
|
+
* undefined already means absent). */
|
|
4872
|
+
rulesMd?: string;
|
|
4671
4873
|
/** Pull requests opened while this session was acting on a code host.
|
|
4672
4874
|
*
|
|
4673
4875
|
* This is deliberately session provenance rather than workspace state: a
|
|
@@ -4722,6 +4924,16 @@ interface SessionDescriptor {
|
|
|
4722
4924
|
* may name a gateway route.
|
|
4723
4925
|
*/
|
|
4724
4926
|
adapterProvider?: string;
|
|
4927
|
+
/**
|
|
4928
|
+
* The adapter manifest's `authDescriptor.modelDerivedApiKey` — recorded at
|
|
4929
|
+
* spawn time so a live `setModel` applies the SAME wire normalization the
|
|
4930
|
+
* spawn path used (`normalizeModelForWire`'s `ModelWireOptions.modelDerivedApiKey`
|
|
4931
|
+
* doc): for a `derived-from-model` adapter billed through a gateway/router,
|
|
4932
|
+
* this decides whether the wire model needs the router re-added as a
|
|
4933
|
+
* literal leading segment (opencode/mastracode/jcode/pi/mastra-agent) or
|
|
4934
|
+
* left bare (hermes).
|
|
4935
|
+
*/
|
|
4936
|
+
modelDerivedApiKey?: boolean;
|
|
4725
4937
|
/**
|
|
4726
4938
|
* AIP-45 mode the session was spawned with (`AgentCliStartOptions.config.
|
|
4727
4939
|
* mode` — e.g. claude-code's `plan`/`accept-edits`, a gateway preset mode
|
|
@@ -4736,6 +4948,24 @@ interface SessionDescriptor {
|
|
|
4736
4948
|
mode?: string;
|
|
4737
4949
|
/** The model the session was requested to run (echoed back at spawn). */
|
|
4738
4950
|
model?: string;
|
|
4951
|
+
/**
|
|
4952
|
+
* The model believed to be ACTIVE right now, when it may differ from
|
|
4953
|
+
* `model` above (the requested/spawn-time value). Populated by a
|
|
4954
|
+
* successful live `setModel` (mirrors `model` — the switch went through
|
|
4955
|
+
* this daemon, so both facts agree) or, more importantly, by picking a
|
|
4956
|
+
* model-switch acknowledgement out of an ORDINARY prompt turn whose text
|
|
4957
|
+
* opened with `/model <id>` (`@agentproto/driver-agent-cli`'s
|
|
4958
|
+
* `isModelSwitchAcknowledgement`/`parseModelSwitchCommand` —
|
|
4959
|
+
* `applyModelCommand`'s dedicated control turn never runs for that case,
|
|
4960
|
+
* since the switch never went through `agent_set_model`).
|
|
4961
|
+
*
|
|
4962
|
+
* That second source is REPORTED BY THE ADAPTER'S OWN REPLY TEXT, NOT
|
|
4963
|
+
* INDEPENDENTLY VERIFIED — a deliberately lax match good enough as a
|
|
4964
|
+
* display hint for a UI chip, NEVER a source of billing/cost truth. Never
|
|
4965
|
+
* overwrites `model`: losing the spawn-time request would lose the very
|
|
4966
|
+
* thing that lets a client show the two facts diverging.
|
|
4967
|
+
*/
|
|
4968
|
+
activeModel?: string;
|
|
4739
4969
|
/** Reasoning / compute budget the session resolved to (SPEC §3.1 axis 2).
|
|
4740
4970
|
* A LIVE-switchable axis; echoed here so the effort chip re-opens on it. */
|
|
4741
4971
|
effort?: EffortLevel;
|
|
@@ -4790,6 +5020,24 @@ interface SessionDescriptor {
|
|
|
4790
5020
|
* `"no-pricing"` (tokens present but the model isn't in the catalog — cost
|
|
4791
5021
|
* deliberately left undefined), or `"none"`. Stamped at each turn-end. */
|
|
4792
5022
|
usageSource?: UsageSource;
|
|
5023
|
+
/** Latest known `available_commands_update` payload (see @agentproto/acp's
|
|
5024
|
+
* `StreamEvent`'s `available-commands` kind) — the slash-commands/skills
|
|
5025
|
+
* the agent currently supports. Each notification REPLACES the previous
|
|
5026
|
+
* list wholesale, so this always mirrors the most recent one, not a
|
|
5027
|
+
* merge across notifications. */
|
|
5028
|
+
availableCommands?: Array<{
|
|
5029
|
+
name: string;
|
|
5030
|
+
description?: string;
|
|
5031
|
+
input?: {
|
|
5032
|
+
hint?: string;
|
|
5033
|
+
} | null;
|
|
5034
|
+
_meta?: {
|
|
5035
|
+
scope?: string;
|
|
5036
|
+
path?: string;
|
|
5037
|
+
bareName?: string;
|
|
5038
|
+
qualifiedName?: string;
|
|
5039
|
+
};
|
|
5040
|
+
}>;
|
|
4793
5041
|
/** ACP-level session id (the adapter's own handle — claude-code's
|
|
4794
5042
|
* conversation id, hermes' chat id, …). Set at spawnAgent time
|
|
4795
5043
|
* from `agentSession.sessionId`. Survives across daemon restarts
|
|
@@ -4826,6 +5074,19 @@ interface SessionDescriptor {
|
|
|
4826
5074
|
* Keys are adapter-specific so future adapters can add their own
|
|
4827
5075
|
* ("hermesResumeId", etc.) without changing this type. */
|
|
4828
5076
|
resumeMetadata?: Record<string, string>;
|
|
5077
|
+
/** Extra env this PTY (`kind: "terminal"`) session was spawned with, on
|
|
5078
|
+
* top of `process.env` — e.g. `{ CLAUDE_CONFIG_DIR: "..." }` for a
|
|
5079
|
+
* `pty-native` restart of a claude-code session (see
|
|
5080
|
+
* `ResumeStrategy.configDirEnvVar`, resume-strategies.ts). Once a
|
|
5081
|
+
* restart lands on a bare PTY row, `adapterSlug`/`adapterConfigDir` are
|
|
5082
|
+
* gone (undefined for pty/command kinds, by design — see those fields'
|
|
5083
|
+
* docs), so this is the ONLY way a LATER `pty-plain` restart-of-a-
|
|
5084
|
+
* restart can still know what env the provider's native resume needs —
|
|
5085
|
+
* `session_restart`'s pty-plain branch replays it verbatim, the same way
|
|
5086
|
+
* it already replays `argv`. Absent when the PTY was spawned with no
|
|
5087
|
+
* extra env (a plain `agentproto sessions terminal`, or a `pty-plain`
|
|
5088
|
+
* restart of one). */
|
|
5089
|
+
ptyResumeEnv?: Record<string, string>;
|
|
4829
5090
|
/** Set by the orchestration layer when the agent emits an
|
|
4830
5091
|
* "awaiting-input" turn-end. Cleared on the next turn start.
|
|
4831
5092
|
* Used by `session_monitor` to fast-return without subscribing. */
|
|
@@ -5071,6 +5332,8 @@ interface SessionSummary {
|
|
|
5071
5332
|
/** Busy-descendant count (#session-visibility, subtree rollup) — see
|
|
5072
5333
|
* `SessionDescriptor.childrenBusy`. Drives the "delegating" row state. */
|
|
5073
5334
|
childrenBusy?: number;
|
|
5335
|
+
/** Prompt-queue badge count — see `SessionDescriptor.queuedPrompts`. */
|
|
5336
|
+
queuedPrompts?: number;
|
|
5074
5337
|
label?: string;
|
|
5075
5338
|
title?: string;
|
|
5076
5339
|
renamedByUser?: boolean;
|
|
@@ -5084,6 +5347,12 @@ interface SessionSummary {
|
|
|
5084
5347
|
cwd?: string;
|
|
5085
5348
|
worktreePath?: string;
|
|
5086
5349
|
worktreeId?: string;
|
|
5350
|
+
/** Resolved AGENTS.md path — see `SessionDescriptor.agentsMd`. */
|
|
5351
|
+
agentsMd?: string;
|
|
5352
|
+
/** Injection mode — see `SessionDescriptor.agentsMdMode`. */
|
|
5353
|
+
agentsMdMode?: AgentsMdMode;
|
|
5354
|
+
/** Resolved workspace RULES.md path — see `SessionDescriptor.rulesMd`. */
|
|
5355
|
+
rulesMd?: string;
|
|
5087
5356
|
adapterSlug?: string;
|
|
5088
5357
|
mode?: string;
|
|
5089
5358
|
model?: string;
|
|
@@ -5382,6 +5651,7 @@ interface SessionsRegistry {
|
|
|
5382
5651
|
sendPrompt(id: string, message: unknown, opts?: {
|
|
5383
5652
|
interrupt?: boolean;
|
|
5384
5653
|
source?: string;
|
|
5654
|
+
system?: string;
|
|
5385
5655
|
}): Promise<void>;
|
|
5386
5656
|
/** Fire-and-forget variant of `sendPrompt` for the TURN ITSELF only.
|
|
5387
5657
|
* Admission (resume attempt + the missing/wrong-kind/dead/busy
|
|
@@ -5425,6 +5695,11 @@ interface SessionsRegistry {
|
|
|
5425
5695
|
enqueuePrompt(id: string, message: unknown, opts?: {
|
|
5426
5696
|
interrupt?: boolean;
|
|
5427
5697
|
source?: string;
|
|
5698
|
+
/** Display origin for the after-the-fact queue UI ("user" for a
|
|
5699
|
+
* human operator, agent/child when another session injected this).
|
|
5700
|
+
* Sets `QueuedPrompt.origin` — see that field; does NOT influence
|
|
5701
|
+
* transcript provenance (`source` does that). */
|
|
5702
|
+
origin?: string;
|
|
5428
5703
|
queue?: boolean;
|
|
5429
5704
|
force?: boolean;
|
|
5430
5705
|
queueId?: string;
|
|
@@ -5438,6 +5713,43 @@ interface SessionsRegistry {
|
|
|
5438
5713
|
removeQueuedPrompt(id: string, queueId: string): {
|
|
5439
5714
|
removed: boolean;
|
|
5440
5715
|
};
|
|
5716
|
+
/** Snapshot a session's prompt queue for inspection — the after-the-fact
|
|
5717
|
+
* view of what's sitting in `SessionDescriptor.promptQueue` right now.
|
|
5718
|
+
* Runs the shared preview + origin-label derivation so every consumer
|
|
5719
|
+
* (the `session_queue_list` MCP tool, `GET /sessions/:id/queue`, the CLI,
|
|
5720
|
+
* the VS Code panel) sees identical text. `position` is the array index
|
|
5721
|
+
* (0 = next to dispatch), not stored — derived per call. Returns `null`
|
|
5722
|
+
* when the session is unknown (the caller surfaces 404). */
|
|
5723
|
+
listQueuedPrompts(id: string): QueuedPromptView[] | null;
|
|
5724
|
+
/** Reorder-only force: move an already-queued item to the FRONT of the
|
|
5725
|
+
* queue (position 0) WITHOUT touching any turn currently in flight — it
|
|
5726
|
+
* becomes next-to-dispatch once the current turn (if any) ends. The
|
|
5727
|
+
* queue-reordering counterpart to `deliverQueuedPrompt`'s interrupt-and-
|
|
5728
|
+
* dispatch; the two are deliberately distinct operations. Returns
|
|
5729
|
+
* position after promotion (0 when promoted, -1 when the item/session
|
|
5730
|
+
* isn't found). Never mutates the array in place (the webview diff rules
|
|
5731
|
+
* on `!==` per field). */
|
|
5732
|
+
promoteQueuedPrompt(id: string, queueId: string): {
|
|
5733
|
+
promoted: boolean;
|
|
5734
|
+
position: number;
|
|
5735
|
+
};
|
|
5736
|
+
/** Deliver-now: interrupt whatever's mid-flight (same effect + shared
|
|
5737
|
+
* helper as `enqueuePrompt`'s `interrupt` arm) and immediately dispatch
|
|
5738
|
+
* THIS specific queued item as the new turn, removing it from the queue.
|
|
5739
|
+
* The "I need this NOW" op — distinct from `promoteQueuedPrompt` (which
|
|
5740
|
+
* only reorders; deliver-now cannot wait for the current turn to end).
|
|
5741
|
+
*
|
|
5742
|
+
* Implemented as promote-to-front + interrupt: the cancelled turn's
|
|
5743
|
+
* own `dispatchQueuedPrompt` (in its finally) then drains the promoted
|
|
5744
|
+
* item into a fresh turn. On an idle session (nothing to interrupt) the
|
|
5745
|
+
* promoted item is dispatched directly. Returns:
|
|
5746
|
+
* `{ delivered: false, reason }` — `"no-session"` / `"not-in-queue"`;
|
|
5747
|
+
* `{ delivered: true, interrupted: boolean }` otherwise. */
|
|
5748
|
+
deliverQueuedPrompt(id: string, queueId: string): Promise<{
|
|
5749
|
+
delivered: boolean;
|
|
5750
|
+
reason?: string;
|
|
5751
|
+
interrupted?: boolean;
|
|
5752
|
+
}>;
|
|
5441
5753
|
/** Eagerly resume ONE dead-but-resumable agent-cli session IN PLACE,
|
|
5442
5754
|
* WITHOUT a prompt — the boot-time counterpart to the lazy resume that
|
|
5443
5755
|
* `sendPrompt`/`enqueuePrompt` trigger on the first prompt after a restart
|
|
@@ -5938,11 +6250,24 @@ interface SpawnAgentInput {
|
|
|
5938
6250
|
* {@link SessionDescriptor.adapterProvider} so live `setModel` knows when
|
|
5939
6251
|
* to bare a direct `vendor/product` ref; ignored for derived adapters. */
|
|
5940
6252
|
adapterProvider?: string;
|
|
6253
|
+
/** Manifest-declared `authDescriptor.modelDerivedApiKey` — recorded onto
|
|
6254
|
+
* {@link SessionDescriptor.modelDerivedApiKey} so live `setModel` applies
|
|
6255
|
+
* the same router re-prefixing the spawn path used. */
|
|
6256
|
+
modelDerivedApiKey?: boolean;
|
|
5941
6257
|
/** Optional initial prompt to dispatch immediately. The promise
|
|
5942
6258
|
* the registry returns resolves AFTER the spawn — the prompt
|
|
5943
6259
|
* runs in the background, projecting events into the ring
|
|
5944
6260
|
* buffer. Skip to spawn idle. */
|
|
5945
6261
|
initialPrompt?: string;
|
|
6262
|
+
/** The daemon-composed SYSTEM slice of {@link initialPrompt} — the part
|
|
6263
|
+
* it synthesized ahead of the CALLER's ask (role disposition, lineage
|
|
6264
|
+
* line, AGENTS.md, posture preamble). The adapter still receives the
|
|
6265
|
+
* single concatenated `initialPrompt` unchanged; this metadata lets the
|
|
6266
|
+
* daemon's OWN event stream record that slice as a `system-prompt` turn
|
|
6267
|
+
* (ahead of the `user-prompt`) so UIs can fold it instead of rendering
|
|
6268
|
+
* it as a user bubble. Absent ⇒ the whole `initialPrompt` is treated as
|
|
6269
|
+
* user text (no synthesized preamble, e.g. a human reprompt). */
|
|
6270
|
+
initialPromptSystem?: string;
|
|
5946
6271
|
label?: string;
|
|
5947
6272
|
/** Title to stamp on the descriptor up-front, BEFORE the `initialPrompt`
|
|
5948
6273
|
* turn runs. Set by the spawn path from the CALLER's ask (`input.prompt`),
|
|
@@ -6054,6 +6379,10 @@ interface SpawnAgentInput {
|
|
|
6054
6379
|
* idle-reaper.ts) regardless of how long it sits idle — stamped straight
|
|
6055
6380
|
* onto `SessionDescriptor.keepAlive`. Default false. */
|
|
6056
6381
|
keepAlive?: boolean;
|
|
6382
|
+
/** Recorded verbatim onto {@link SessionDescriptor.worktreeAutoProvisioned}
|
|
6383
|
+
* — see that field's doc. Set by `session-spawn.ts` from
|
|
6384
|
+
* `WorktreeDecision.provision.implicit`. Default false. */
|
|
6385
|
+
worktreeAutoProvisioned?: boolean;
|
|
6057
6386
|
}
|
|
6058
6387
|
/** `SpawnAgentInput` minus the fields that only exist once the driver's
|
|
6059
6388
|
* `startSession` has actually run — see `spawnAgentPending`'s doc for why
|
|
@@ -6078,6 +6407,10 @@ type PendingAgentOutcome = {
|
|
|
6078
6407
|
/** Dispatched now that the tree + driver session both exist — never
|
|
6079
6408
|
* passed to `spawnAgentPending`, which would race the tree. */
|
|
6080
6409
|
initialPrompt?: string;
|
|
6410
|
+
/** The daemon-composed SYSTEM slice of `initialPrompt` (see
|
|
6411
|
+
* `SpawnAgentInput.initialPromptSystem`) — threaded through the
|
|
6412
|
+
* placeholder so the deferred dispatch records it as a system turn. */
|
|
6413
|
+
initialPromptSystem?: string;
|
|
6081
6414
|
} | {
|
|
6082
6415
|
ok: false;
|
|
6083
6416
|
/** Short, readable — stamped verbatim onto `SessionDescriptor.lastError`. */
|
|
@@ -6120,6 +6453,17 @@ interface SpawnPtyInput {
|
|
|
6120
6453
|
* the factory layer (node-pty.spawn options); don't try to clear
|
|
6121
6454
|
* them here. */
|
|
6122
6455
|
env?: Record<string, string>;
|
|
6456
|
+
/** Env vars to strip from the inherited `process.env` before spawning —
|
|
6457
|
+
* same scrub semantics as `ResolvedAuthSpec.unsetEnv` (define-agent-cli.ts's
|
|
6458
|
+
* driver applies this by deleting from its own composed env; `spawnPty` has
|
|
6459
|
+
* no such composition step of its own, so `session_restart`'s pty-native
|
|
6460
|
+
* branch passes it here). Without this, a PTY resume that re-resolves the
|
|
6461
|
+
* session's own billing auth still leaks whatever conflicting credential
|
|
6462
|
+
* (e.g. an ambient `ANTHROPIC_API_KEY`) happens to be in the daemon's own
|
|
6463
|
+
* `process.env` — `env` alone can only ADD/override keys, never remove
|
|
6464
|
+
* one inherited from process.env. Applied AFTER `env` overrides so an
|
|
6465
|
+
* explicit override always wins over a scrub of the same key. */
|
|
6466
|
+
unsetEnv?: string[];
|
|
6123
6467
|
/** User-friendly slug. Used by `findByIdOrName(query)`. Must not
|
|
6124
6468
|
* collide with an existing session's name. */
|
|
6125
6469
|
name?: string;
|
|
@@ -6856,6 +7200,11 @@ interface CatalogProviderModel {
|
|
|
6856
7200
|
/** Per-1M-token pricing for LLM models; `null` for the media kinds, whose
|
|
6857
7201
|
* pricing is per-image/second/character rather than per token. */
|
|
6858
7202
|
pricing: CatalogProviderPricing | null;
|
|
7203
|
+
/** ISO date (`YYYY-MM-DD`) this model first appeared in the catalog, when
|
|
7204
|
+
* known — see `LLMPricing.addedAt` (`model-catalog/src/llm/catalog.ts`)
|
|
7205
|
+
* for the convention. `null` for media kinds and for LLM entries the sync
|
|
7206
|
+
* never stamped (hand-maintained rows). Lets a picker show a "new" badge. */
|
|
7207
|
+
addedAt: string | null;
|
|
6859
7208
|
}
|
|
6860
7209
|
interface CatalogProviderModelsResponse {
|
|
6861
7210
|
/** The provider key that was enumerated (echoed back, trimmed). */
|
|
@@ -8154,6 +8503,10 @@ interface RouteAwareLaunchConfigInput {
|
|
|
8154
8503
|
routeSelection?: "free" | "derived-from-model";
|
|
8155
8504
|
/** Fixed provider for this adapter (e.g. `"anthropic"`), used for wire-model prefix stripping. */
|
|
8156
8505
|
adapterProvider?: string;
|
|
8506
|
+
/** `AdapterAuthDescriptor.modelDerivedApiKey` — see `normalizeModelForWire`'s
|
|
8507
|
+
* `ModelWireOptions.modelDerivedApiKey` doc for why this changes the wire
|
|
8508
|
+
* shape on a gateway-routed `derived-from-model` adapter. */
|
|
8509
|
+
modelDerivedApiKey?: boolean;
|
|
8157
8510
|
/** Skills list folded into `options.skills` per the manifest's declared shape. */
|
|
8158
8511
|
skills?: string[];
|
|
8159
8512
|
/**
|
|
@@ -8234,6 +8587,19 @@ interface SessionWaitResult {
|
|
|
8234
8587
|
* dropped work that was NOT re-run — the in-place resume never auto-retries.
|
|
8235
8588
|
* Absent (not `false`) when the session was not interrupted. */
|
|
8236
8589
|
interrupted?: boolean;
|
|
8590
|
+
/** True when the matched turn-end produced ZERO assistant output and
|
|
8591
|
+
* zero tool calls — a silent no-op (see `SessionTurnEndEvent.empty`'s
|
|
8592
|
+
* doc). Surfaced on `event: "turn-end"` matches across all three
|
|
8593
|
+
* branches (ring-replay, sync fast-path via
|
|
8594
|
+
* `SessionDescriptor.lastTurnEmpty`, bus long-poll) so a caller doesn't
|
|
8595
|
+
* mistake a green turn-end for real progress. Absent (not `false`) on a
|
|
8596
|
+
* normal, productive turn. */
|
|
8597
|
+
empty?: boolean;
|
|
8598
|
+
/** The matched turn-end's `SessionTurnEndEvent.reason` (e.g.
|
|
8599
|
+
* `"completed"`, `"error"`, `"aborted"`), when the adapter/daemon
|
|
8600
|
+
* reported one. `"error"` means the adapter reported a failed turn.
|
|
8601
|
+
* Same three-branch coverage as `empty`. */
|
|
8602
|
+
reason?: string;
|
|
8237
8603
|
}
|
|
8238
8604
|
/**
|
|
8239
8605
|
* Block until one of the listed sessions fires a matching lifecycle event
|
|
@@ -8248,6 +8614,15 @@ interface SessionWaitResult {
|
|
|
8248
8614
|
* `since` is an EventRing cursor: when provided, already-emitted matching
|
|
8249
8615
|
* events for the watched sessions that occurred after that cursor are
|
|
8250
8616
|
* returned immediately (race-free replay) before subscribing to the bus.
|
|
8617
|
+
*
|
|
8618
|
+
* The synchronous already-in-target-state check for `turn-end` ALSO
|
|
8619
|
+
* requires `since` to be present (even `since: 0`) — `turnsCompleted > 0`
|
|
8620
|
+
* never resets, so without a cursor to anchor "since when", it can't tell
|
|
8621
|
+
* a turn this call should wait for apart from any turn the session ever
|
|
8622
|
+
* completed, including ones from long before this call started. A
|
|
8623
|
+
* `since`-less `turn-end` wait (e.g. a fresh `agentproto sessions wait`
|
|
8624
|
+
* process, which has no persisted cursor) always falls through to the real
|
|
8625
|
+
* bus-subscribe long-poll instead.
|
|
8251
8626
|
*/
|
|
8252
8627
|
declare function monitorSessionWait(opts: {
|
|
8253
8628
|
registry: SessionsRegistry;
|
|
@@ -8574,6 +8949,17 @@ interface CreateGatewayOptions {
|
|
|
8574
8949
|
* `worktree_gc` returns a clear "not enabled" error.
|
|
8575
8950
|
*/
|
|
8576
8951
|
runWorktreeGc?: WorktreeGcRunner;
|
|
8952
|
+
/**
|
|
8953
|
+
* Optional best-effort exit-time reclaim of ONE policy-provisioned
|
|
8954
|
+
* (implicit) session's own worktree — powers `SessionDescriptor.
|
|
8955
|
+
* worktreeAutoProvisioned` (see that field's doc in `sessions.ts`).
|
|
8956
|
+
* Injected for the same reason as `runWorktreeGc`: the classify/remove
|
|
8957
|
+
* logic runs over `@agentproto/worktree`, a dependency the runtime
|
|
8958
|
+
* deliberately does NOT take. The CLI wires it (over `reclaimOneWorktree`).
|
|
8959
|
+
* Omitted → exit-time auto-reclaim is simply skipped; an implicit
|
|
8960
|
+
* worktree is still reclaimable manually or via a scheduled `gc` sweep.
|
|
8961
|
+
*/
|
|
8962
|
+
runWorktreeAutoReclaim?: WorktreeAutoReclaimer;
|
|
8577
8963
|
/**
|
|
8578
8964
|
* Optional resolver: given a session's cwd, return the OPEN PR for that
|
|
8579
8965
|
* cwd's git branch (or null). Powers the daemon PR-provenance reconciler,
|
|
@@ -8669,4 +9055,4 @@ interface GatewayHandle {
|
|
|
8669
9055
|
*/
|
|
8670
9056
|
declare function createGateway(opts: CreateGatewayOptions): Promise<GatewayHandle>;
|
|
8671
9057
|
|
|
8672
|
-
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 HarnessPreset, type HarnessPresetValidationDeps, HarnessPresetValidationError, type HarnessPresetsFile, 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 RegisterBrainToolsOptions, 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 SessionCurrentPhase, 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 StallWatchdogRegistry, type StallWatchdogSummary, 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, type WorkspaceBrainSubscriber, type WorkspaceBrainSubscriberOptions, type WorkspaceBrains, 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, addHarnessPreset, appendConversationRecord, attachSandbox, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, canonicalForModeId, claudeProjectSlug, composeSessionObservers, conversationIndexPath, createActivityProjector, createFileStepCache, createGateway, createInboundEndpointStore, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPairingRegistry, createPrProvenanceReconciler, createReconnectLogGate, createScopeTokenRegistry, createSupervisorTaskGateRunner, createTaskLedger, createWorkspaceBrainSubscriber, createWorkspaceBrains, daemonRegistryDir, decideWorktreeIsolation, declaredPresetToProviderPreset, deriveSessionUsage, enrichRollupWithProviderQuota, enrichWithRemainingQuota, evaluateCostBudget, filterActivities, findConversationRecord, findNativeMode, formatToolCall, formatToolResult, getDefaultHarnessPreset, getHarnessPreset, getMcpCredentialDeps, harnessPresetsPath, isAgentCliAuthConfigured, isClosedTaskStatus, isSafeBucketSlug, isTerminalActivityState, listBuckets, listHarnessPresets, listPresets, loadHarnessPresets, 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, readSessionForBrain, readUsageSnapshots, reapOrphanedDescendants, recordProfileQuota, registerBrainTools, registerBuiltinRoutes, registerPairingTools, registerSandboxAttachTool, removeHarnessPreset, resolveBucketSlug, resolveNativeLink, resolvePosture, rollupUsage, runCrashDetectPass, runEagerResumePass, runIdleReapPass, runStallWatchdogPass, setDefaultPreset, setMcpCredentialDeps, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, toWorktreeStatusView, turnToActivities, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, updateHarnessPreset, verifyInboundSignature, workflowToActivities, writeDaemonRegistryEntry };
|
|
9058
|
+
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 HarnessPreset, type HarnessPresetValidationDeps, HarnessPresetValidationError, type HarnessPresetsFile, 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 RegisterBrainToolsOptions, 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 SessionCurrentPhase, 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 StallWatchdogRegistry, type StallWatchdogSummary, 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, type WorkspaceBrainSubscriber, type WorkspaceBrainSubscriberOptions, type WorkspaceBrains, WorkspaceFs, type WorktreeAutoReclaimer, 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, addHarnessPreset, appendConversationRecord, attachSandbox, bucketDir, bucketSessionsFile, bucketTranscriptDir, buildCatalogProviderModels, buildMcpConfigSnippet, buildRouteAwareLaunchConfig, canonicalForModeId, claudeProjectSlug, composeSessionObservers, conversationIndexPath, createActivityProjector, createFileStepCache, createGateway, createInboundEndpointStore, createOrchestratorInjector, createOrchestratorMcpServerFactory, createPairingRegistry, createPrProvenanceReconciler, createReconnectLogGate, createScopeTokenRegistry, createSupervisorTaskGateRunner, createTaskLedger, createWorkspaceBrainSubscriber, createWorkspaceBrains, daemonRegistryDir, decideWorktreeIsolation, declaredPresetToProviderPreset, deriveSessionUsage, enrichRollupWithProviderQuota, enrichWithRemainingQuota, evaluateCostBudget, filterActivities, findConversationRecord, findNativeMode, formatToolCall, formatToolResult, getDefaultHarnessPreset, getHarnessPreset, getMcpCredentialDeps, harnessPresetsPath, isAgentCliAuthConfigured, isClosedTaskStatus, isSafeBucketSlug, isTerminalActivityState, listBuckets, listHarnessPresets, listPresets, loadHarnessPresets, 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, readSessionForBrain, readUsageSnapshots, reapOrphanedDescendants, recordProfileQuota, registerBrainTools, registerBuiltinRoutes, registerPairingTools, registerSandboxAttachTool, removeHarnessPreset, resolveBucketSlug, resolveNativeLink, resolvePosture, rollupUsage, runCrashDetectPass, runEagerResumePass, runIdleReapPass, runStallWatchdogPass, setDefaultPreset, setMcpCredentialDeps, sweepStaleDaemonRegistry, sweepStaleRuntimeMetas, toWorktreeStatusView, turnToActivities, unlinkDaemonRegistryEntry, unlinkRuntimeMeta, updateHarnessPreset, verifyInboundSignature, workflowToActivities, writeDaemonRegistryEntry };
|