@agentproto/runtime 5.8.0 → 5.10.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.
@@ -43,6 +43,11 @@ interface ExportedMessage {
43
43
  args: string;
44
44
  }[];
45
45
  ts?: number;
46
+ /** Daemon plumbing rather than the work itself: `handoff` marks the handoff
47
+ * question and the source session's reply to it; `preamble` marks the
48
+ * daemon-composed system slice (role, AGENTS.md contract, lineage) of a
49
+ * spawned session's initial prompt. Checkpoints leave these out. */
50
+ internal?: "handoff" | "preamble";
46
51
  }
47
52
  interface ExportedSessionMeta {
48
53
  title?: string;
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { R as RouteSpec, S as SessionConfig, P as Posture, E as EffortLevel, C as ContextProfile, A as AuthMethod } from './session-config-DxIIuJFY.js';
3
- import { a as SpawnBrowserMode, R as ResolvedContextContinuityPolicy } from './spawn-defaults-Cp9SGZex.js';
2
+ import { R as RouteSpec, S as SessionConfig, P as Posture, E as EffortLevel, C as ContextProfile, A as AuthMethod } from './session-config-BUDM7T1B.js';
3
+ import { a as SpawnBrowserMode, R as ResolvedContextContinuityPolicy } from './spawn-defaults-Dm7nbxcP.js';
4
4
  import { AcpPermissionResolution, AcpMcpServer } from '@agentproto/acp';
5
5
  import { SessionMode } from '@agentproto/acp/client';
6
6
  import { ChildProcess } from 'node:child_process';
7
7
  import { CostBudget } from '@agentproto/auth';
8
- import { h as WorktreeIsolationMode } from './config-Gz7q9yfJ.js';
8
+ import { h as WorktreeIsolationMode } from './config-Dsmv-jri.js';
9
9
 
10
10
  /**
11
11
  * Typed, best-effort persistence for the last-seen provider "remaining quota"
@@ -1534,6 +1534,8 @@ interface PolicyRunState {
1534
1534
  exitCode: number;
1535
1535
  at: string;
1536
1536
  kind?: "shell" | "judge" | "cost";
1537
+ /** Shell gates only: the command line that ran (command + args). */
1538
+ command?: string;
1537
1539
  stdout?: string;
1538
1540
  stderr?: string;
1539
1541
  };
@@ -2011,7 +2013,7 @@ declare function createTaskLedger(opts: {
2011
2013
  * list — {@link isKnownSessionEndReason} says so, and callers should fall
2012
2014
  * back to a generic label rather than throw.
2013
2015
  */
2014
- declare const SESSION_END_REASONS: readonly ["daemon-restart", "idle-reaped", "crashed", "operator-completed", "operator-stopped", "cost-cap-exceeded", "policy-cleanup", "parent-exited", "provider-limit", "forgotten", "steward-completed", "steward-abandoned"];
2016
+ declare const SESSION_END_REASONS: readonly ["daemon-restart", "idle-reaped", "crashed", "operator-completed", "operator-stopped", "cost-cap-exceeded", "context-hard-stop", "policy-cleanup", "parent-exited", "provider-limit", "forgotten", "steward-completed", "steward-abandoned"];
2015
2017
  type SessionEndReason = (typeof SESSION_END_REASONS)[number];
2016
2018
  /** True when `reason` is one of {@link SESSION_END_REASONS}. A label
2017
2019
  * lookup, not a wire-format gate — an unrecognized string is still a
@@ -2038,7 +2040,7 @@ declare function isProviderLimitError(message: string | undefined): boolean;
2038
2040
  * and session_monitor MCP tool (long-poll multiplexed).
2039
2041
  */
2040
2042
 
2041
- type SessionEventType = "session:turn-end" | "session:awaiting-input" | "session:awaiting-input-flagged" | "session:awaiting-question-answered" | "session:permission-request" | "session:permission-resolved" | "session:exited" | "session:reaped" | "session:stalled" | "session:stall-cleared" | "session:watcher-attached" | "session:watcher-detached" | "session:bg-tasks-parked" | "session:bg-tasks-cleared" | "session:bg-task" | "session:resumed" | "session:spawned" | "session:provisioning" | "session:command-done" | "session:model-changed" | "session:config-changed" | "session:renamed" | "session:pinned-changed" | "session:artifact-added" | "session:artifact-pinned-changed" | "session:message" | "policy:passed" | "policy:failed" | "policy:commit-ready" | "policy:committed" | "cron:fired" | "cron:succeeded" | "cron:failed" | "activity:changed" | "task:changed" | "workflow:gate-report" | "workflow:suspended" | "workflow:suspend-resumed" | "session:harness-warning" | "approval:requested" | "approval:decided" | "approval:consumed" | "approval:expired";
2043
+ type SessionEventType = "session:turn-end" | "session:awaiting-input" | "session:awaiting-input-flagged" | "session:awaiting-question-answered" | "session:permission-request" | "session:permission-resolved" | "session:exited" | "session:reaped" | "session:stalled" | "session:stall-cleared" | "session:watcher-attached" | "session:watcher-detached" | "session:bg-tasks-parked" | "session:bg-tasks-cleared" | "session:bg-task" | "session:resumed" | "session:spawned" | "session:provisioning" | "session:command-done" | "session:model-changed" | "session:config-changed" | "session:renamed" | "session:pinned-changed" | "session:pinned-reordered" | "session:artifact-added" | "session:artifact-pinned-changed" | "session:message" | "policy:passed" | "policy:failed" | "policy:commit-ready" | "policy:committed" | "cron:fired" | "cron:succeeded" | "cron:failed" | "cron:unhealthy" | "activity:changed" | "task:changed" | "workflow:gate-report" | "workflow:suspended" | "workflow:suspend-resumed" | "session:harness-warning" | "session:handoff-suggested" | "approval:requested" | "approval:decided" | "approval:consumed" | "approval:expired";
2042
2044
  /**
2043
2045
  * Fixed severity vocabulary for a judge-gate finding (WP-D). Deliberately
2044
2046
  * small and fixed so `policy_status` output is comparable across different
@@ -2586,6 +2588,18 @@ interface SessionPinnedEvent {
2586
2588
  pinned: boolean;
2587
2589
  ts: string;
2588
2590
  }
2591
+ /** Emitted when the pinned group is manually reordered
2592
+ * (`session_reorder_pinned`, `POST /sessions/pinned/order` →
2593
+ * `registry.reorderPinned`). `ids` is the requested new order — the full
2594
+ * pinned order is a `session_list` / `GET /sessions` call away. Rides the
2595
+ * same bus distribution as every other lifecycle event, which is how a
2596
+ * live UI learns to resort its pinned group without waiting for its next
2597
+ * snapshot poll. */
2598
+ interface SessionPinnedReorderedEvent {
2599
+ type: "session:pinned-reordered";
2600
+ ids: string[];
2601
+ ts: string;
2602
+ }
2589
2603
  /**
2590
2604
  * Emitted when a new artifact (or a new version of an existing one) is
2591
2605
  * materialized into the session's artifact store (`session_artifact_add`,
@@ -2720,6 +2734,28 @@ interface CronFailedEvent {
2720
2734
  error: string;
2721
2735
  ts: string;
2722
2736
  }
2737
+ /**
2738
+ * Emitted by CronScheduler when a job trips its health threshold: `N`
2739
+ * consecutive non-productive runs (default 2, per-job
2740
+ * `maxConsecutiveFailures`) pause the job (`active:false` + `pausedReason`)
2741
+ * instead of letting it keep firing into a wall. `lastOutcome` is the run
2742
+ * that tripped it; `consecutiveFailures` is the count at trip time (mirrors
2743
+ * the job's own counter and `cron_list`'s `health`). Rides the same bus
2744
+ * fan-out as every other cron event (`session_events_poll`, the webhook
2745
+ * notifier), so an existing global notify URL relays it with no new channel.
2746
+ */
2747
+ interface CronUnhealthyEvent {
2748
+ type: "cron:unhealthy";
2749
+ jobId: string;
2750
+ label?: string;
2751
+ /** Consecutive non-productive runs at the moment the job was paused. */
2752
+ consecutiveFailures: number;
2753
+ /** The real outcome of the run that tripped the threshold. */
2754
+ lastOutcome: "produced" | "empty" | "errored" | "timeout";
2755
+ /** Human-readable pause reason now stored on the job. */
2756
+ reason: string;
2757
+ ts: string;
2758
+ }
2723
2759
  /**
2724
2760
  * Emitted by the activity projector (`activities.ts`) whenever an
2725
2761
  * {@link ActivityRecord}'s state or waitingOn actually changed — the ONE
@@ -2849,6 +2885,31 @@ interface SessionHarnessWarningEvent {
2849
2885
  label?: string;
2850
2886
  ts: string;
2851
2887
  }
2888
+ /** Why a handoff is being suggested. */
2889
+ type HandoffSuggestionReason = "provider-limit" | "quota-threshold";
2890
+ /**
2891
+ * Emitted when agentproto SUGGESTS moving a session to another harness:
2892
+ * the provider reported a usage cap (`provider-limit`) or the remaining
2893
+ * quota fell under `contextContinuity.handoffAtQuotaRemaining`
2894
+ * (`quota-threshold`). A suggestion only — nothing is spawned, the user
2895
+ * runs the `command` (`agentproto sessions handoff <id> --to <harness>`)
2896
+ * to switch. `suggestions` lists installed harnesses with usable
2897
+ * credentials (never the source harness); the event is not emitted when
2898
+ * there are none. Same bus distribution as every other lifecycle event
2899
+ * (`session_events_poll`, SSE, webhooks).
2900
+ */
2901
+ interface SessionHandoffSuggestedEvent {
2902
+ type: "session:handoff-suggested";
2903
+ sessionId: string;
2904
+ fromHarness: string;
2905
+ reason: HandoffSuggestionReason;
2906
+ suggestions: Array<{
2907
+ harness: string;
2908
+ command: string;
2909
+ }>;
2910
+ label?: string;
2911
+ ts: string;
2912
+ }
2852
2913
  /**
2853
2914
  * Emitted by the approvals engine (`approvals/engine.ts`) when an
2854
2915
  * `approval_request` (MCP or `POST /approvals`) raises a new pending
@@ -2897,7 +2958,7 @@ interface ApprovalExpiredEvent {
2897
2958
  taskId?: string;
2898
2959
  ts: string;
2899
2960
  }
2900
- type SessionEvent = SessionTurnEndEvent | SessionAwaitingInputEvent | SessionAwaitingInputFlaggedEvent | SessionAwaitingQuestionAnsweredEvent | SessionPermissionRequestEvent | SessionPermissionResolvedEvent | SessionExitedEvent | SessionReapedEvent | SessionStalledEvent | SessionStallClearedEvent | SessionWatcherAttachedEvent | SessionWatcherDetachedEvent | SessionBgTasksParkedEvent | SessionBgTasksClearedEvent | SessionBgTaskEvent | SessionResumedEvent | SessionSpawnedEvent | SessionProvisioningEvent | SessionCommandDoneEvent | SessionModelChangedEvent | SessionConfigChangedEvent | SessionRenamedEvent | SessionPinnedEvent | SessionArtifactAddedEvent | SessionArtifactPinnedEvent | SessionMessageEvent | PolicyPassedEvent | PolicyFailedEvent | PolicyCommitReadyEvent | PolicyCommittedEvent | CronFiredEvent | CronSucceededEvent | CronFailedEvent | ActivityChangedEvent | TaskChangedEvent | WorkflowGateReportEvent | WorkflowApprovalRequestedEvent | WorkflowApprovalResolvedEvent | WorkflowSuspendedEvent | WorkflowSuspendResumedEvent | SessionHarnessWarningEvent | ApprovalRequestedEvent | ApprovalDecidedEvent | ApprovalConsumedEvent | ApprovalExpiredEvent;
2961
+ type SessionEvent = SessionTurnEndEvent | SessionAwaitingInputEvent | SessionAwaitingInputFlaggedEvent | SessionAwaitingQuestionAnsweredEvent | SessionPermissionRequestEvent | SessionPermissionResolvedEvent | SessionExitedEvent | SessionReapedEvent | SessionStalledEvent | SessionStallClearedEvent | SessionHandoffSuggestedEvent | SessionWatcherAttachedEvent | SessionWatcherDetachedEvent | SessionBgTasksParkedEvent | SessionBgTasksClearedEvent | SessionBgTaskEvent | SessionResumedEvent | SessionSpawnedEvent | SessionProvisioningEvent | SessionCommandDoneEvent | SessionModelChangedEvent | SessionConfigChangedEvent | SessionRenamedEvent | SessionPinnedEvent | SessionPinnedReorderedEvent | SessionArtifactAddedEvent | SessionArtifactPinnedEvent | SessionMessageEvent | PolicyPassedEvent | PolicyFailedEvent | PolicyCommitReadyEvent | PolicyCommittedEvent | CronFiredEvent | CronSucceededEvent | CronFailedEvent | CronUnhealthyEvent | ActivityChangedEvent | TaskChangedEvent | WorkflowGateReportEvent | WorkflowApprovalRequestedEvent | WorkflowApprovalResolvedEvent | WorkflowSuspendedEvent | WorkflowSuspendResumedEvent | SessionHarnessWarningEvent | ApprovalRequestedEvent | ApprovalDecidedEvent | ApprovalConsumedEvent | ApprovalExpiredEvent;
2901
2962
  interface SessionEventBus {
2902
2963
  emit(ev: SessionEvent): void;
2903
2964
  /** Subscribe to a specific event type. Returns an unsubscribe fn. */
@@ -3685,8 +3746,11 @@ interface SessionOutcome {
3685
3746
  * `empty` — no assistant text and no artifacts. */
3686
3747
  status: "produced" | "empty";
3687
3748
  /** Level 2 only: what a judge/declaration decided the session's work
3688
- * amounted to. Absent on a plain Level 1 `"derived"` outcome. */
3689
- verdict?: "done" | "abandoned" | "blocked" | "needs-input";
3749
+ * amounted to. `blocked`/`needs-input` never close (flagged instead);
3750
+ * `abandoned`/`partial`/`failed` all close as not-completed
3751
+ * (`endedReason:"steward-abandoned"`), the verdict nuance kept here.
3752
+ * Absent on a plain Level 1 `"derived"` outcome. */
3753
+ verdict?: "done" | "abandoned" | "partial" | "failed" | "blocked" | "needs-input";
3690
3754
  /** Level 2 only: who reached `verdict` — a session id (a judge agent) or
3691
3755
  * the literal `"steward-rules"` for a deterministic close with no judge
3692
3756
  * in the loop. Absent on a plain Level 1 `"derived"` outcome. */
@@ -3771,6 +3835,36 @@ interface AgentSessionLike {
3771
3835
  * adapter-specific forensics. Undefined for drivers that don't
3772
3836
  * expose a process (e.g. a future non-subprocess transport). */
3773
3837
  pid?: number;
3838
+ /** Whether the driver's transport to the adapter is still usable, read
3839
+ * fresh at call time — mirrors `@agentproto/driver-agent-cli`'s
3840
+ * `AgentCliRuntimeSession.isConnected` without importing it (same
3841
+ * driver-decoupled structural-mirror reasoning as `setModel` below).
3842
+ *
3843
+ * The liveness axis `pid` can't cover: an ACP wrapper process commonly
3844
+ * survives its own JSON-RPC stream, so `processAlive` says "alive" while
3845
+ * every RPC rejects with "ACP connection closed". Projected onto
3846
+ * `SessionDescriptor.adapterConnected` at read time and read by the
3847
+ * crash-detect sweep.
3848
+ *
3849
+ * Optional, and `true`-by-absence on purpose: a sandbox proxy or a
3850
+ * print-arm session has no long-lived connection to lose, so only an
3851
+ * explicit `false` is evidence of death. */
3852
+ isConnected?(): boolean;
3853
+ /** Subscribe to transport death — the push half of the axis `isConnected`
3854
+ * polls. Fires at most once, and SYNCHRONOUSLY if the transport is
3855
+ * already gone when the listener is attached, which is what lets the
3856
+ * registry wire this up at bind time without racing a connection that
3857
+ * died during spawn.
3858
+ *
3859
+ * It fires on an ORDERLY teardown too (the host's own `close()` aborts
3860
+ * the same signal). The registry's listener is safe against that by
3861
+ * construction: it routes into `markCrashed`, which refuses any row that
3862
+ * isn't still `running` — and `kill()`/`reapIdle` both flip `status`
3863
+ * before they close the connection.
3864
+ *
3865
+ * Absent for session shapes with no long-lived connection (sandbox
3866
+ * proxy, print arm, future transports). */
3867
+ onDisconnect?(listener: (err: Error) => void): void;
3774
3868
  send(message: unknown): AsyncIterable<AgentStreamEvent>;
3775
3869
  cancel(): Promise<void>;
3776
3870
  /** Resolve a permission request the driver parked in permission-hold mode
@@ -4052,6 +4146,14 @@ interface AgentStreamEvent {
4052
4146
  * autonomous wake) — see @agentproto/acp's `StreamEvent`. */
4053
4147
  origin?: string;
4054
4148
  }
4149
+ /**
4150
+ * Turn error attached when a turn has produced NO output and NO usage since
4151
+ * its prompt and then goes silent past the stall threshold — the provider is
4152
+ * almost certainly retrying internally (opencode's silent 429 loop) and the
4153
+ * daemon would otherwise only report `stalledSinceMs` with no reason. Set by
4154
+ * `markStalled`; cleared at the next turn-end like every other turn error.
4155
+ */
4156
+ declare const NO_OUTPUT_STALL_TURN_ERROR = "no output since prompt \u2014 provider retrying?";
4055
4157
  /**
4056
4158
  * Env vars the registry injects into every process it spawns on a session's
4057
4159
  * behalf (agent-cli adapters, PTY/terminal, and generic `spawn()` — see
@@ -4178,6 +4280,20 @@ interface QueuedPrompt {
4178
4280
  * as a `session-message` transcript record, and coalesced with any
4179
4281
  * envelope items queued right behind it (never with a plain prompt). */
4180
4282
  envelope?: SessionMessage;
4283
+ /** Opt-in (`enqueuePrompt` `opts.steer`): this item may be injected into
4284
+ * the target's RUNNING turn at the next safe point instead of waiting for
4285
+ * the turn to end — only when the agent advertises steering. Plain
4286
+ * (non-envelope), non-child prompts only. */
4287
+ steer?: boolean;
4288
+ /** ISO 8601 deadline (`deliverWithin`): past it, the pending-prompt sweep
4289
+ * force-delivers this item per {@link deliverVia}. */
4290
+ deliverBy?: string;
4291
+ /** How the sweep forces delivery at {@link deliverBy}: `steer` (inject,
4292
+ * else stay queued), `interrupt` (cancel the turn and run it now), or
4293
+ * `auto` (steer when the agent can, else interrupt). Default `auto`. */
4294
+ deliverVia?: "auto" | "steer" | "interrupt";
4295
+ /** ISO 8601 — when the staleness notice for this item was sent (once). */
4296
+ staleNotifiedAt?: string;
4181
4297
  }
4182
4298
  /** What `enqueuePrompt` resolved to — lets a caller (e.g. MCP `agent_prompt`)
4183
4299
  * tell the user whether the prompt was delivered/started now or PARKED behind
@@ -4187,8 +4303,23 @@ interface QueuedPrompt {
4187
4303
  * idle dispatch, an interrupt that redirected the live turn, a structured-
4188
4304
  * question answer — resolves `queued: false`. */
4189
4305
  interface EnqueuePromptResult {
4306
+ /** Legacy: true ONLY when the prompt is parked in `promptQueue` (not yet
4307
+ * delivered). Prefer `delivery` / `pending`. */
4190
4308
  queued: boolean;
4191
- }
4309
+ /** `delivered` — started as a turn (idle target, or an interrupt);
4310
+ * `steered` — injected into the running turn; `queued-mid-turn` — parked
4311
+ * until the current turn ends (or a steer / `deliverWithin` fires).
4312
+ * `delivery` / `pending` are always set by the registry; optional here so
4313
+ * structural stand-ins that only know `queued` still type-check. */
4314
+ delivery?: PromptDelivery;
4315
+ /** ISO 8601 delivery time, when already delivered. */
4316
+ deliveredAt?: string;
4317
+ /** True while the prompt has NOT reached the target yet. */
4318
+ pending?: boolean;
4319
+ /** Id of the parked item (`delivery: "queued-mid-turn"`). */
4320
+ queueId?: string;
4321
+ }
4322
+ type PromptDelivery = "delivered" | "steered" | "queued-mid-turn";
4192
4323
  /** What `sendMessage` did with a message — truthful, per AIP-46. */
4193
4324
  interface SendMessageResult {
4194
4325
  messageId: string;
@@ -4218,6 +4349,30 @@ interface QueuedPromptView {
4218
4349
  queuedAt: string;
4219
4350
  position: number;
4220
4351
  }
4352
+ /** One prompt still waiting to reach a session, with its age — the
4353
+ * `pendingPrompts` field on `session_list` / `session_recap` so a sender (or
4354
+ * a supervisor reading a truncated list) sees a stuck delivery. `stale` is
4355
+ * set once it has waited past the staleness threshold. */
4356
+ interface PendingPromptView {
4357
+ id: string;
4358
+ /** Same label as `QueuedPromptView.origin`. */
4359
+ origin: string;
4360
+ preview: string;
4361
+ queuedAt: string;
4362
+ /** Milliseconds since `queuedAt` at read time. */
4363
+ ageMs: number;
4364
+ stale?: true;
4365
+ /** ISO 8601 `deliverWithin` deadline, when one was set. */
4366
+ deliverBy?: string;
4367
+ }
4368
+ /** Tally of one `sweepPendingPrompts` pass. */
4369
+ interface PendingPromptSweepSummary {
4370
+ /** Prompts newly reported stale (sender notified). */
4371
+ stale: number;
4372
+ /** Prompts force-delivered because their `deliverWithin` deadline passed. */
4373
+ forced: number;
4374
+ ids: string[];
4375
+ }
4221
4376
  /** Provenance stamped onto a `session_continue_fresh` target by
4222
4377
  * {@link SessionDescriptor.handoff} — which harness the checkpoint moved
4223
4378
  * from/to and when. `fromHarness === toHarness` for a same-harness
@@ -4291,7 +4446,9 @@ interface SessionDescriptor {
4291
4446
  * MCP tool (never by an internal automatic teardown), so it reads as
4292
4447
  * deliberate rather than random;
4293
4448
  * - other internal/automatic reasons: `"cost-cap-exceeded"` (the
4294
- * turn-granular `maxCostUsd` cap tripped), `"policy-cleanup"` (a
4449
+ * turn-granular `maxCostUsd` cap tripped), `"context-hard-stop"` (the
4450
+ * context-continuity hard-stop closed a session past `hardStopAtPct`),
4451
+ * `"policy-cleanup"` (a
4295
4452
  * supervisor gate tore down its own ephemeral judge session),
4296
4453
  * `"parent-exited"` (an orchestrator's dying subtree reap),
4297
4454
  * `"provider-limit"` (a driver-reported subscription/usage-cap error,
@@ -4394,6 +4551,26 @@ interface SessionDescriptor {
4394
4551
  * every process. Ephemeral and opt-in (`session_list`/`agent_sessions_list`
4395
4552
  * `stats`), never persisted; absent for a row with no live process. */
4396
4553
  stats?: Omit<SessionResourceStats, "sessionId">;
4554
+ /** Whether the LIVE agent session's transport to its adapter is still
4555
+ * usable — `AgentCliRuntimeSession.isConnected()`, read at the same
4556
+ * points and with the same ephemeral, never-persisted contract as
4557
+ * {@link processAlive}.
4558
+ *
4559
+ * This is the second, independent liveness axis, and the one `pid` alone
4560
+ * cannot answer. An ACP adapter's wrapper process routinely OUTLIVES its
4561
+ * own JSON-RPC stream: the stream ends (the wrapper closed stdout, the
4562
+ * child it fronts died, the transport errored), `process.kill(pid, 0)`
4563
+ * still succeeds, and the row keeps reporting `running`/`alive` forever
4564
+ * while every prompt rejects with "ACP connection closed". Observed live
4565
+ * on 2026-09-25 (`sess_950d1251`), 40+ minutes after the connection
4566
+ * died, with UIs still showing "Idle · live".
4567
+ *
4568
+ * `false` ⇒ provably dead transport, and the crash-detect sweep's second
4569
+ * ground for marking a row crashed. Absent ⇒ no live binding to ask (a
4570
+ * terminal row, or one whose adapter models no long-lived connection) —
4571
+ * absent is NOT "disconnected", exactly as absent `processAlive` is not
4572
+ * "dead". */
4573
+ adapterConnected?: boolean;
4397
4574
  /** Count of live supervisors currently blocked waiting on this session —
4398
4575
  * HTTP `GET /sessions/:id/wait` long-polls and `session_monitor`
4399
4576
  * subscriptions, both via `monitorSessionWait` (#session-visibility).
@@ -4427,6 +4604,10 @@ interface SessionDescriptor {
4427
4604
  * preview, queuedAt, position) lives behind the `session_queue_list`
4428
4605
  * verb / `GET /sessions/:id/queue` — this is just the scalar badge. */
4429
4606
  queuedPrompts?: number;
4607
+ /** The queued prompts themselves, with age (`PendingPromptView`) — derived
4608
+ * at read time from {@link promptQueue}, never persisted. Absent when
4609
+ * nothing is waiting. */
4610
+ pendingPrompts?: PendingPromptView[];
4430
4611
  /** Short human-readable string describing the most recent automatic
4431
4612
  * failure — currently only stamped by `markCrashed` (e.g. "adapter
4432
4613
  * process gone (pid 1234) — session crashed"). Not a stack trace or raw
@@ -4718,6 +4899,15 @@ interface SessionDescriptor {
4718
4899
  * effects on reaping, notifications, or anything else. Absent (not
4719
4900
  * `false`) for every session that hasn't been pinned. */
4720
4901
  pinned?: boolean;
4902
+ /** Ascending position among pinned sessions — the stored order behind
4903
+ * the pinned group of the CLI table / VS Code webview list. Set by
4904
+ * `registry.setPinned` (append-at-end) and `registry.reorderPinned`
4905
+ * (manual reorder); deleted when the session is unpinned. Absent on
4906
+ * legacy pinned rows persisted before this field existed — those sort
4907
+ * after every ordered pinned session (by `startedAt` asc, then id).
4908
+ * Pure sort/display state, same as `pinned` — never touches the live
4909
+ * agent, keepAlive, or the idle-reaper. */
4910
+ pinnedOrder?: number;
4721
4911
  /** True when the session was spawned under a real PTY (node-pty)
4722
4912
  * instead of `child_process.spawn`. PTY sessions carry raw ANSI
4723
4913
  * bytes (alt-screen, key bindings, colors); attach goes through
@@ -4924,8 +5114,8 @@ interface SessionDescriptor {
4924
5114
  /**
4925
5115
  * Deterministic billing-auth mode + a non-secret credential fingerprint,
4926
5116
  * recorded at spawn time for adapters that resolved an explicit
4927
- * credential (today: claude-code — see `AgentCliAuth.modes` in
4928
- * `@agentproto/driver-agent-cli`). The "verifiability" answer to "what
5117
+ * credential (adapters declaring `authSubscription` and/or an API-key
5118
+ * `provider`). The "verifiability" answer to "what
4929
5119
  * was used": `mode` is the resolved `"subscription" | "api-key"`;
4930
5120
  * `fingerprint` is `credentialFingerprint(mode, credential)` — e.g.
4931
5121
  * `"subscription · sk-ant-oat…3f9c"` — NEVER the raw credential. Absent
@@ -5431,7 +5621,18 @@ interface SessionSummary {
5431
5621
  * `unarchiveSession`. Absent on rows archived before this field existed. */
5432
5622
  archivedAt?: string;
5433
5623
  keepAlive?: boolean;
5624
+ /** Steward wrap-up flag — a blocked/needs-input verdict that deliberately
5625
+ * left the session running; see `SessionDescriptor.wrapupFlag`. */
5626
+ wrapupFlag?: {
5627
+ verdict: "blocked" | "needs-input";
5628
+ note?: string;
5629
+ judgedBy?: string;
5630
+ at: string;
5631
+ };
5434
5632
  pinned?: boolean;
5633
+ /** Ascending position among pinned sessions — see
5634
+ * `SessionDescriptor.pinnedOrder`. */
5635
+ pinnedOrder?: number;
5435
5636
  pty?: boolean;
5436
5637
  name?: string;
5437
5638
  argv?: readonly string[];
@@ -5519,6 +5720,20 @@ interface SessionSummary {
5519
5720
  * (i.e. never wrap) to avoid a regression for sessions/shells that don't
5520
5721
  * use bracketed paste at all. */
5521
5722
  type BracketedPasteMode = "on" | "off" | "unknown";
5723
+ /**
5724
+ * Which death `markCrashed` is recording. Both leave the row equally dead
5725
+ * and equally lazy-resumable — this only picks the `lastError`/banner
5726
+ * wording, so whoever reads the row afterwards knows which liveness axis
5727
+ * actually failed.
5728
+ *
5729
+ * - `"process-gone"` — the pid probe came back dead (`processAlive:
5730
+ * false`). The original, and still the common, crash shape.
5731
+ * - `"transport-closed"` — the adapter's JSON-RPC stream is closed while
5732
+ * its process is (or may be) alive: `AgentSessionLike.isConnected()`
5733
+ * returned false. Invisible to the pid probe, which is exactly why this
5734
+ * ground exists.
5735
+ */
5736
+ type SessionCrashReason = "process-gone" | "transport-closed";
5522
5737
  /**
5523
5738
  * Thrown by the lazy resume path when a resumable session has already failed to
5524
5739
  * resume `MAX_RESUME_ATTEMPTS` times in a row (`canResume` false on a row that
@@ -5681,7 +5896,7 @@ type PermissionRespondResult = {
5681
5896
  * SessionOutcome} / {@link SessionDescriptor.wrapupFlag} for the field
5682
5897
  * meanings. */
5683
5898
  interface CloseWithOutcomeInput {
5684
- verdict: "done" | "abandoned" | "blocked" | "needs-input";
5899
+ verdict: "done" | "abandoned" | "partial" | "failed" | "blocked" | "needs-input";
5685
5900
  /** Overrides the outcome's derived summary when given (e.g. a judge's own
5686
5901
  * written summary) — trimmed the same way `deriveSessionOutcome` trims
5687
5902
  * `lastAssistantText`. Omitted keeps whatever `deriveSessionOutcome`
@@ -5878,7 +6093,27 @@ interface SessionsRegistry {
5878
6093
  * structured-question answer, and noted in the SENDER's transcript
5879
6094
  * as `session-message-sent`. */
5880
6095
  envelope?: SessionMessage;
6096
+ /** On the queue arm, inject this prompt into the target's RUNNING turn
6097
+ * at the next safe point (ACP steering) instead of waiting for the
6098
+ * turn to end — when the agent advertises steering. FIFO among steered
6099
+ * prompts. Ignored for envelopes and child-sourced prompts; absent ⇒
6100
+ * today's park-until-turn-end. A refused steer leaves it queued. */
6101
+ steer?: boolean;
6102
+ /** Deadline in ms: a prompt still queued past it is force-delivered by
6103
+ * the pending-prompt sweep per `deliverVia`. */
6104
+ deliverWithinMs?: number;
6105
+ /** `steer` — inject only (stay queued if it can't); `interrupt` —
6106
+ * cancel the turn and run it; `auto` (default) — steer, else interrupt. */
6107
+ deliverVia?: "auto" | "steer" | "interrupt";
5881
6108
  }): Promise<EnqueuePromptResult>;
6109
+ /** One pass over every prompt queue: force-deliver items past their
6110
+ * `deliverWithin` deadline, and notify the sender (typed `notice` into the
6111
+ * caller's — else the target's parent's — inbox) once per item that has
6112
+ * waited past `staleMs`. Driven on a timer by the daemon; callable directly. */
6113
+ sweepPendingPrompts(opts?: {
6114
+ now?: number;
6115
+ staleMs?: number;
6116
+ }): Promise<PendingPromptSweepSummary>;
5882
6117
  /** Cancel one not-yet-dispatched item in `SessionDescriptor.promptQueue`
5883
6118
  * by id — the composer's per-item "remove" action. Idempotent: an
5884
6119
  * unknown session or an id that's already gone (dispatched, already
@@ -6012,6 +6247,16 @@ interface SessionsRegistry {
6012
6247
  * so `interruptedAtBoot === bootId` means "interrupted by the restart that
6013
6248
  * preceded THIS boot" (continue-interrupted). */
6014
6249
  readonly bootId: string;
6250
+ /** Absolute base dir this registry's per-session transcripts AND index
6251
+ * sidecars live under — the SAME dir the writers use (`sessions.eventsDir`
6252
+ * config > default). Exposed so `session_search`/`session_recap` (and a
6253
+ * daemon-startup backfill) read the sidecars this registry writes without
6254
+ * re-deriving the path. */
6255
+ readonly transcriptBaseDir: string;
6256
+ /** Flush any throttled index-sidecar writes immediately. Called at
6257
+ * shutdown; exposed so a test can assert a trailing write landed without
6258
+ * waiting out the throttle window. Best-effort and synchronous. */
6259
+ flushSessionIndexes(): void;
6015
6260
  /** Book one automatic continue prompt against `id` (increment
6016
6261
  * `autoContinueAttempts`, stamp `lastAutoContinueBoot = bootId`) and
6017
6262
  * persist. Called by the continue-on-boot pass BEFORE it sends, so the
@@ -6211,12 +6456,26 @@ interface SessionsRegistry {
6211
6456
  * MCP verb / `POST /sessions/:id/pin`). `true` flips
6212
6457
  * `SessionDescriptor.pinned` on — pure sort/display state for the CLI
6213
6458
  * table and the VS Code webview's list, which sort a pinned session to
6214
- * the top. `false` clears it. Persists via the same `schedulePersist`
6215
- * every descriptor mutation uses and emits `session:pinned-changed` so a
6459
+ * the top. Pinning a session that isn't pinned yet APPENDS it to the
6460
+ * end of the pinned group (`pinnedOrder` = max pinned order over the
6461
+ * currently pinned + 1, missing treated as -1); re-pinning an already
6462
+ * pinned session keeps its order. `false` clears the pin and deletes
6463
+ * `pinnedOrder`. Persists via the same `schedulePersist` every
6464
+ * descriptor mutation uses and emits `session:pinned-changed` so a
6216
6465
  * live UI resorts without waiting for its next snapshot poll. NEVER
6217
6466
  * touches `keepAlive`, reaper eligibility, or any notification path —
6218
6467
  * pin is quiet, structural state only. Throws when the id is unknown. */
6219
6468
  setPinned(id: string, pinned: boolean): SessionDescriptor;
6469
+ /** Manually reorder the pinned group (the `session_reorder_pinned` MCP
6470
+ * verb / `POST /sessions/pinned/order`). Every id must exist and be
6471
+ * pinned — throws `reorderPinned: ...` otherwise (duplicates rejected
6472
+ * too). Listed ids get `pinnedOrder` 0..n-1 in the given order; every
6473
+ * other pinned session keeps its relative order and is placed after
6474
+ * (legacy pinned rows with no `pinnedOrder` sort by `startedAt` asc,
6475
+ * then id). Persists via `schedulePersist`, emits
6476
+ * `session:pinned-reordered` on the session event bus, and returns the
6477
+ * pinned descriptors in their new order. */
6478
+ reorderPinned(ids: string[]): SessionDescriptor[];
6220
6479
  /** Materialize a new artifact (or version of one) into the session's
6221
6480
  * durable artifact store (`session_artifact_add` MCP verb / `POST
6222
6481
  * /sessions/:id/artifacts`) — see `session-artifacts.ts`. Emits
@@ -6411,8 +6670,19 @@ interface SessionsRegistry {
6411
6670
  * violate — it refuses (returns false, no-op) a session that is not a
6412
6671
  * live (`running`) agent-cli row, so it is idempotent and safe to call on
6413
6672
  * an already-terminal or non-agent-cli row. Returns true iff a row was
6414
- * actually marked crashed. */
6415
- markCrashed(id: string): boolean;
6673
+ * actually marked crashed.
6674
+ *
6675
+ * `reason` names WHICH death was discovered, and is the only thing that
6676
+ * differs between the sweep's two grounds. Omitted ⇒ `"process-gone"`,
6677
+ * the original pid-probe wording ("adapter process gone (pid N) — session
6678
+ * crashed"). `"transport-closed"` is the case a pid probe cannot see: the
6679
+ * wrapper process is still alive but its ACP stream ended, so the row
6680
+ * would otherwise sit `running`/`alive` forever while every prompt
6681
+ * rejects with "ACP connection closed". Only the `lastError`/banner text
6682
+ * changes — every other effect (status, endedReason, cleared binding,
6683
+ * `session:exited`) is identical, because in both cases the session is
6684
+ * equally dead and equally resumable. */
6685
+ markCrashed(id: string, reason?: SessionCrashReason): boolean;
6416
6686
  /** Flip a LIVE, mid-turn agent-cli row to `stalledSinceMs:<ts>` — the
6417
6687
  * primitive the turn-liveness watchdog (`runStallWatchdogPass`) drives on
6418
6688
  * a periodic sweep when a turn's adapter stream has gone silent past the
@@ -6943,4 +7213,4 @@ interface RecordOpenedPrInput {
6943
7213
  url: string;
6944
7214
  }
6945
7215
 
6946
- export { DEFAULT_WORKTREE_PROVISION_CONCURRENCY as $, type ActivityPolicySlice as A, type UsageRollup as B, type CompletionPolicySupervisor as C, type RemainingQuotaReader as D, type UsageSnapshotRecord as E, type SessionAwaitingQuestion as F, type PolicyRunState as G, type PtyFactory as H, type WorktreeAutoReclaimer as I, type ActivityKind as J, type ActivitySource as K, type ActivityState as L, type MessageUrgency as M, type ActivityWaitingOn as N, type AnthropicReaderConfig as O, type PrResolvedState as P, type QuotaReadableProfile as Q, type RestartPolicy as R, type SessionEvent as S, type TaskLedger as T, type UserPreset as U, AnthropicRemainingQuotaReader as V, type WorktreeProvisioner as W, type AttachPolicyInput as X, type CommandGroupStats as Y, type CommitSpec as Z, DEFAULT_WORKTREE_ISOLATION as _, type SessionEventType as a, type TaskUpdateInput as a$, type EagerResumeFailReason as a0, type EagerResumeOutcome as a1, type EagerResumeSkipReason as a2, type GateSpec as a3, type HostInfo as a4, type JudgeGateSpec as a5, type LabeledProcessStatsReport as a6, type LabeledSessionStats as a7, MAX_MESSAGE_DATA_BYTES as a8, MESSAGE_KINDS as a9, type SessionCurrentPhase as aA, type SessionKind as aB, type SessionMessageFrom as aC, type SessionOutcome as aD, type SessionOutcomeArtifact as aE, type SessionOutcomeCompact as aF, type SessionOutcomeLink as aG, type SessionResourceStats as aH, type SessionSnapshots as aI, type SessionStatus as aJ, type ShellGateSpec as aK, type SpawnAgentInput as aL, type SpawnSessionInput as aM, type StatsDetail as aN, type StoredProfileQuota as aO, TASK_STATUSES as aP, type TaskCaller as aQ, type TaskChangedEvent as aR, type TaskClaimInput as aS, type TaskCreateInput as aT, type TaskGateOutcome as aU, type TaskGateRunner as aV, type TaskLedgerRegistry as aW, type TaskLedgerSessionSlice as aX, type TaskListFilter as aY, type TaskRecord as aZ, type TaskStatus as a_, MESSAGE_PREAMBLE as aa, MESSAGE_TAG as ab, MESSAGE_URGENCIES as ac, type MessageDeliveryVia as ad, type MessageFilter as ae, type MessageRelation as af, type MessageTreeNode as ag, type OnFailSpec as ah, type OrphanGroup as ai, type PendingPermission as aj, type PermissionRespondInput as ak, type PermissionRespondResult as al, type PolicyRunStatus as am, type PricingResolver as an, type ProcessDetail as ao, type ProcessStatsReport as ap, type ProcessStatsService as aq, type QuotaStoreFile as ar, type QuotaStoreOptions as as, type RegisterBrowserInput as at, type RegisterSessionInput as au, type RemainingQuota as av, type ResourceStats as aw, ResumeDisabledError as ax, SESSION_END_REASONS as ay, SESSION_ID_ENV as az, type SessionEventBus as b, sanitizeLabel as b$, type TaskVerification as b0, type TaskVerifySupervisor as b1, type TaskWriteResult as b2, type TokenPricing as b3, type UsageBucket as b4, type UsageComputeInput as b5, type UsageDetail as b6, type UsageSource as b7, type UserPresetsFile as b8, WORKSPACE_SLUG_ENV as b9, isProviderLimitError as bA, isTerminalActivityState as bB, listUserPresets as bC, loadQuotaStore as bD, loadUserPresets as bE, loadWorktreeIsolation as bF, matchesMessageFilter as bG, messageFrom as bH, mintMessageId as bI, normalizeCommand as bJ, normalizeWorktreeField as bK, parseAnthropicRateLimitHeaders as bL, parseTaskStatus as bM, parseWindow as bN, parseWorktreeIsolationMode as bO, pickUsageDetail as bP, policyToActivities as bQ, policyWatchesSession as bR, prToActivities as bS, projectSessionUsage as bT, readProfileQuota as bU, recordProfileQuota as bV, renderInboxDigest as bW, renderSessionMessage as bX, renderSessionMessages as bY, resolveRelation as bZ, rollupUsage as b_, WORKTREE_ISOLATION_ENV as ba, WORKTREE_PROVISION_CONCURRENCY_ENV as bb, type WorktreeDecision as bc, type WorktreeProvisionOutcome as bd, type WorktreeProvisionPhase as be, type WorktreeProvisionProgress as bf, type WorktreeProvisionRequest as bg, type WorktreeRequest as bh, activityCounts as bi, compactOutcome as bj, createProcessStatsService as bk, createSessionMessage as bl, createSupervisorTaskGateRunner as bm, createTaskLedger as bn, decideWorktreeIsolation as bo, deleteUserPreset as bp, deriveSessionOutcome as bq, deriveSessionUsage as br, escapeHumanPrompt as bs, escapeMessageBody as bt, filterActivities as bu, getProcessStatsService as bv, getUserPreset as bw, isClosedTaskStatus as bx, isKnownSessionEndReason as by, isMessageAllowed as bz, type SessionsRegistry as c, saveUserPreset as c0, trackWorktreeProvision as c1, turnToActivities as c2, userPresetsPath as c3, workflowToActivities as c4, type RecentSpawnConfig as c5, deriveRecentSpawnConfigs as c6, touchUserPreset as c7, userPresetSchema as c8, type SessionDescriptor as d, type SessionEndReason as e, type ActivityListFilter as f, type ActivityRecord as g, type ActivityTurnSession as h, type ActivityPrSession as i, type ActivityWorkflowRunSlice as j, type ActivityTaskSlice as k, type AgentsMdResolution as l, type SandboxAppServeSpec as m, type WorktreeField as n, type AgentSessionLike as o, type UsageReadContext as p, type UsageReadResult as q, type MessageKind as r, type SessionMessage as s, type AgentStreamEvent as t, type SessionUsage as u, type ToolCallRecord as v, type StatsSessionDescriptor as w, type ProcRow as x, type ProvisionInFlight as y, type ProvisionTracker as z };
7216
+ export { type CommitSpec as $, type ActivityPolicySlice as A, type ProvisionTracker as B, type CompletionPolicySupervisor as C, type SessionCrashReason as D, type UsageRollup as E, type RemainingQuotaReader as F, type UsageSnapshotRecord as G, type SessionAwaitingQuestion as H, type PolicyRunState as I, type PtyFactory as J, type WorktreeAutoReclaimer as K, type ActivityKind as L, type MessageUrgency as M, type ActivitySource as N, type ActivityState as O, type PrResolvedState as P, type QuotaReadableProfile as Q, type RestartPolicy as R, type SessionEvent as S, type TaskLedger as T, type UserPreset as U, type ActivityWaitingOn as V, type WorktreeProvisioner as W, type AnthropicReaderConfig as X, AnthropicRemainingQuotaReader as Y, type AttachPolicyInput as Z, type CommandGroupStats as _, type SessionEventType as a, type TaskListFilter as a$, DEFAULT_WORKTREE_ISOLATION as a0, DEFAULT_WORKTREE_PROVISION_CONCURRENCY as a1, type EagerResumeFailReason as a2, type EagerResumeOutcome as a3, type EagerResumeSkipReason as a4, type GateSpec as a5, type HostInfo as a6, type JudgeGateSpec as a7, type LabeledProcessStatsReport as a8, type LabeledSessionStats as a9, ResumeDisabledError as aA, SESSION_END_REASONS as aB, SESSION_ID_ENV as aC, type SessionCurrentPhase as aD, type SessionKind as aE, type SessionMessageFrom as aF, type SessionOutcome as aG, type SessionOutcomeArtifact as aH, type SessionOutcomeCompact as aI, type SessionOutcomeLink as aJ, type SessionResourceStats as aK, type SessionSnapshots as aL, type SessionStatus as aM, type ShellGateSpec as aN, type SpawnAgentInput as aO, type SpawnSessionInput as aP, type StatsDetail as aQ, type StoredProfileQuota as aR, TASK_STATUSES as aS, type TaskCaller as aT, type TaskChangedEvent as aU, type TaskClaimInput as aV, type TaskCreateInput as aW, type TaskGateOutcome as aX, type TaskGateRunner as aY, type TaskLedgerRegistry as aZ, type TaskLedgerSessionSlice as a_, MAX_MESSAGE_DATA_BYTES as aa, MESSAGE_KINDS as ab, MESSAGE_PREAMBLE as ac, MESSAGE_TAG as ad, MESSAGE_URGENCIES as ae, type MessageDeliveryVia as af, type MessageFilter as ag, type MessageRelation as ah, type MessageTreeNode as ai, NO_OUTPUT_STALL_TURN_ERROR as aj, type OnFailSpec as ak, type OrphanGroup as al, type PendingPermission as am, type PermissionRespondInput as an, type PermissionRespondResult as ao, type PolicyRunStatus as ap, type PricingResolver as aq, type ProcessDetail as ar, type ProcessStatsReport as as, type ProcessStatsService as at, type QuotaStoreFile as au, type QuotaStoreOptions as av, type RegisterBrowserInput as aw, type RegisterSessionInput as ax, type RemainingQuota as ay, type ResourceStats as az, type SessionEventBus as b, renderSessionMessages as b$, type TaskRecord as b0, type TaskStatus as b1, type TaskUpdateInput as b2, type TaskVerification as b3, type TaskVerifySupervisor as b4, type TaskWriteResult as b5, type TokenPricing as b6, type UsageBucket as b7, type UsageComputeInput as b8, type UsageDetail as b9, isClosedTaskStatus as bA, isKnownSessionEndReason as bB, isMessageAllowed as bC, isProviderLimitError as bD, isTerminalActivityState as bE, listUserPresets as bF, loadQuotaStore as bG, loadUserPresets as bH, loadWorktreeIsolation as bI, matchesMessageFilter as bJ, messageFrom as bK, mintMessageId as bL, normalizeCommand as bM, normalizeWorktreeField as bN, parseAnthropicRateLimitHeaders as bO, parseTaskStatus as bP, parseWindow as bQ, parseWorktreeIsolationMode as bR, pickUsageDetail as bS, policyToActivities as bT, policyWatchesSession as bU, prToActivities as bV, projectSessionUsage as bW, readProfileQuota as bX, recordProfileQuota as bY, renderInboxDigest as bZ, renderSessionMessage as b_, type UsageSource as ba, type UserPresetsFile as bb, WORKSPACE_SLUG_ENV as bc, WORKTREE_ISOLATION_ENV as bd, WORKTREE_PROVISION_CONCURRENCY_ENV as be, type WorktreeDecision as bf, type WorktreeProvisionOutcome as bg, type WorktreeProvisionPhase as bh, type WorktreeProvisionProgress as bi, type WorktreeProvisionRequest as bj, type WorktreeRequest as bk, activityCounts as bl, compactOutcome as bm, createProcessStatsService as bn, createSessionMessage as bo, createSupervisorTaskGateRunner as bp, createTaskLedger as bq, decideWorktreeIsolation as br, deleteUserPreset as bs, deriveSessionOutcome as bt, deriveSessionUsage as bu, escapeHumanPrompt as bv, escapeMessageBody as bw, filterActivities as bx, getProcessStatsService as by, getUserPreset as bz, type SessionsRegistry as c, resolveRelation as c0, rollupUsage as c1, sanitizeLabel as c2, saveUserPreset as c3, trackWorktreeProvision as c4, turnToActivities as c5, userPresetsPath as c6, workflowToActivities as c7, type RecentSpawnConfig as c8, deriveRecentSpawnConfigs as c9, touchUserPreset as ca, userPresetSchema as cb, type SessionDescriptor as d, type SessionEndReason as e, type ActivityListFilter as f, type ActivityRecord as g, type ActivityTurnSession as h, type ActivityPrSession as i, type ActivityWorkflowRunSlice as j, type ActivityTaskSlice as k, type AgentsMdResolution as l, type SandboxAppServeSpec as m, type WorktreeField as n, type AgentSessionLike as o, type UsageReadContext as p, type UsageReadResult as q, type MessageKind as r, type SessionMessage as s, type AgentStreamEvent as t, type SessionUsage as u, type ToolCallRecord as v, type PendingPromptView as w, type StatsSessionDescriptor as x, type ProcRow as y, type ProvisionInFlight as z };
@@ -91,6 +91,13 @@ interface ContextContinuityPolicy extends Partial<ContextContinuityThresholds>,
91
91
  mode?: ContextContinuityMode;
92
92
  /** Optional display label for UIs. */
93
93
  label?: string;
94
+ /** Suggest a cross-harness handoff (`session:handoff-suggested`) once the
95
+ * provider-reported remaining quota of the session's auth profile falls to
96
+ * or below this number. Same unit as the `remaining` figure
97
+ * `usage_rollup` shows per profile (Anthropic's unified rate-limit
98
+ * header — a count, not a percentage: the header carries no limit to
99
+ * divide by). Unset = disabled. Suggestion only, never a switch. */
100
+ handoffAtQuotaRemaining?: number;
94
101
  }
95
102
  /**
96
103
  * Fully-resolved, validated policy. This is the shape stored on a session
@@ -100,6 +107,8 @@ interface ResolvedContextContinuityPolicy extends ContextContinuityThresholds, R
100
107
  mode: ContextContinuityMode;
101
108
  /** Effective label (falls back to mode when absent). */
102
109
  label: string;
110
+ /** See {@link ContextContinuityPolicy.handoffAtQuotaRemaining}. */
111
+ handoffAtQuotaRemaining?: number;
103
112
  }
104
113
 
105
114
  /**
@@ -238,7 +247,8 @@ interface McpDefaultsConfig {
238
247
  * 3 — see `deferred-tools.ts`). Default false/absent: every daemon boot
239
248
  * stays eager, byte-identical to pre-existing behaviour — turning this
240
249
  * on is a deliberate operator opt-in. Independent of the per-role
241
- * default (`RoleProfile.deferredTools`, on for `executor`) and the
250
+ * default (`RoleProfile.deferredTools`, on for `executor`), the
251
+ * harness default (`nativeToolSearch` ⇒ eager) and the
242
252
  * per-spawn `agent_start.deferredTools` override, and independent of
243
253
  * the per-mount `?deferred=1|0` query override on `/mcp` — this is only
244
254
  * the BOOT-TIME default for connections that specify neither. */
@@ -355,6 +365,10 @@ interface SpawnDefaultsConfig {
355
365
  * recipient's in-flight turn). Default "deny": downgraded to `steer`
356
366
  * and reported as such. Human (HTTP/CLI) senders always may. */
357
367
  agentInterrupt?: "allow" | "deny";
368
+ /** Minutes a prompt may sit queued behind a running turn before the
369
+ * sender is told it is stuck (typed notice) and it is flagged `stale`
370
+ * in `pendingPrompts`. Default 5. */
371
+ pendingPromptStaleMinutes?: number;
358
372
  };
359
373
  /** Daemon-wide MCP gateway policy. See {@link McpDefaultsConfig}. */
360
374
  mcp?: McpDefaultsConfig;
@@ -1,11 +1,11 @@
1
1
  import 'zod';
2
- import './session-config-DxIIuJFY.js';
3
- import './spawn-defaults-Cp9SGZex.js';
4
- export { c5 as RecentSpawnConfig, U as UserPreset, b8 as UserPresetsFile, bp as deleteUserPreset, c6 as deriveRecentSpawnConfigs, bw as getUserPreset, bC as listUserPresets, bE as loadUserPresets, c0 as saveUserPreset, c7 as touchUserPreset, c8 as userPresetSchema, c3 as userPresetsPath } from './sessions-SrISpFsH.js';
2
+ import './session-config-BUDM7T1B.js';
3
+ import './spawn-defaults-Dm7nbxcP.js';
4
+ export { c8 as RecentSpawnConfig, U as UserPreset, bb as UserPresetsFile, bs as deleteUserPreset, c9 as deriveRecentSpawnConfigs, bz as getUserPreset, bF as listUserPresets, bH as loadUserPresets, c3 as saveUserPreset, ca as touchUserPreset, cb as userPresetSchema, c6 as userPresetsPath } from './sessions-BdgU9X6P.js';
5
5
  import '@agentproto/auth';
6
6
  import '@agentproto/acp';
7
7
  import '@agentproto/command-sandbox';
8
8
  import '@agentproto/model-catalog';
9
9
  import '@agentproto/acp/client';
10
10
  import 'node:child_process';
11
- import './config-Gz7q9yfJ.js';
11
+ import './config-Dsmv-jri.js';