apex-code 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/README.md +7 -8
  3. package/dist/cli/agent-lifecycle.d.ts +24 -0
  4. package/dist/cli/agent-lifecycle.d.ts.map +1 -0
  5. package/dist/cli/agent-lifecycle.js +126 -0
  6. package/dist/cli/agent-lifecycle.js.map +1 -0
  7. package/dist/cli/args.d.ts +13 -12
  8. package/dist/cli/args.d.ts.map +1 -1
  9. package/dist/cli/args.js +80 -30
  10. package/dist/cli/args.js.map +1 -1
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +4 -130
  13. package/dist/cli.js.map +1 -1
  14. package/dist/config.d.ts +1 -1
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +1 -1
  17. package/dist/config.js.map +1 -1
  18. package/dist/core/agent-session-services.d.ts.map +1 -1
  19. package/dist/core/agent-session-services.js +0 -8
  20. package/dist/core/agent-session-services.js.map +1 -1
  21. package/dist/core/agent-session.d.ts +160 -0
  22. package/dist/core/agent-session.d.ts.map +1 -1
  23. package/dist/core/agent-session.js +265 -0
  24. package/dist/core/agent-session.js.map +1 -1
  25. package/dist/core/delegation/agents.d.ts.map +1 -1
  26. package/dist/core/delegation/agents.js +2 -1
  27. package/dist/core/delegation/agents.js.map +1 -1
  28. package/dist/core/delegation/runtime.d.ts +674 -1
  29. package/dist/core/delegation/runtime.d.ts.map +1 -1
  30. package/dist/core/delegation/runtime.js +1338 -66
  31. package/dist/core/delegation/runtime.js.map +1 -1
  32. package/dist/core/extensions/loader.d.ts.map +1 -1
  33. package/dist/core/extensions/loader.js +3 -4
  34. package/dist/core/extensions/loader.js.map +1 -1
  35. package/dist/core/extensions/source-runtime.d.ts +4 -5
  36. package/dist/core/extensions/source-runtime.d.ts.map +1 -1
  37. package/dist/core/extensions/source-runtime.js +4 -5
  38. package/dist/core/extensions/source-runtime.js.map +1 -1
  39. package/dist/core/formatter-lifecycle.d.ts +2 -1
  40. package/dist/core/formatter-lifecycle.d.ts.map +1 -1
  41. package/dist/core/formatter-lifecycle.js +2 -1
  42. package/dist/core/formatter-lifecycle.js.map +1 -1
  43. package/dist/core/hooks/types.d.ts +2 -3
  44. package/dist/core/hooks/types.d.ts.map +1 -1
  45. package/dist/core/hooks/types.js +2 -3
  46. package/dist/core/hooks/types.js.map +1 -1
  47. package/dist/core/http-idle-timeout.d.ts +3 -5
  48. package/dist/core/http-idle-timeout.d.ts.map +1 -1
  49. package/dist/core/http-idle-timeout.js +3 -5
  50. package/dist/core/http-idle-timeout.js.map +1 -1
  51. package/dist/core/mcp/config.d.ts +18 -1
  52. package/dist/core/mcp/config.d.ts.map +1 -1
  53. package/dist/core/mcp/config.js +24 -7
  54. package/dist/core/mcp/config.js.map +1 -1
  55. package/dist/core/mcp/connector.d.ts +2 -3
  56. package/dist/core/mcp/connector.d.ts.map +1 -1
  57. package/dist/core/mcp/connector.js.map +1 -1
  58. package/dist/core/mcp/oauth/authorize.d.ts +2 -0
  59. package/dist/core/mcp/oauth/authorize.d.ts.map +1 -1
  60. package/dist/core/mcp/oauth/authorize.js +5 -2
  61. package/dist/core/mcp/oauth/authorize.js.map +1 -1
  62. package/dist/core/mcp/oauth/mcp-token.d.ts +4 -6
  63. package/dist/core/mcp/oauth/mcp-token.d.ts.map +1 -1
  64. package/dist/core/mcp/oauth/mcp-token.js +5 -7
  65. package/dist/core/mcp/oauth/mcp-token.js.map +1 -1
  66. package/dist/core/mcp/runtime.d.ts +1 -0
  67. package/dist/core/mcp/runtime.d.ts.map +1 -1
  68. package/dist/core/mcp/runtime.js +2 -1
  69. package/dist/core/mcp/runtime.js.map +1 -1
  70. package/dist/core/package-manager.d.ts.map +1 -1
  71. package/dist/core/package-manager.js +0 -15
  72. package/dist/core/package-manager.js.map +1 -1
  73. package/dist/core/permissions/store.d.ts +6 -11
  74. package/dist/core/permissions/store.d.ts.map +1 -1
  75. package/dist/core/permissions/store.js +23 -51
  76. package/dist/core/permissions/store.js.map +1 -1
  77. package/dist/core/project-resources.d.ts +62 -0
  78. package/dist/core/project-resources.d.ts.map +1 -0
  79. package/dist/core/project-resources.js +42 -0
  80. package/dist/core/project-resources.js.map +1 -0
  81. package/dist/core/sdk.d.ts +62 -12
  82. package/dist/core/sdk.d.ts.map +1 -1
  83. package/dist/core/sdk.js +313 -44
  84. package/dist/core/sdk.js.map +1 -1
  85. package/dist/core/session-share.d.ts +6 -8
  86. package/dist/core/session-share.d.ts.map +1 -1
  87. package/dist/core/session-share.js +9 -12
  88. package/dist/core/session-share.js.map +1 -1
  89. package/dist/core/settings-manager.d.ts +0 -21
  90. package/dist/core/settings-manager.d.ts.map +1 -1
  91. package/dist/core/settings-manager.js +4 -12
  92. package/dist/core/settings-manager.js.map +1 -1
  93. package/dist/core/tools/bash.d.ts.map +1 -1
  94. package/dist/core/tools/bash.js +0 -47
  95. package/dist/core/tools/bash.js.map +1 -1
  96. package/dist/core/tools/delegate.d.ts +8 -0
  97. package/dist/core/tools/delegate.d.ts.map +1 -1
  98. package/dist/core/tools/delegate.js +33 -3
  99. package/dist/core/tools/delegate.js.map +1 -1
  100. package/dist/core/tools/web-fetch.d.ts.map +1 -1
  101. package/dist/core/tools/web-fetch.js +4 -8
  102. package/dist/core/tools/web-fetch.js.map +1 -1
  103. package/dist/core/tools/web-search-exa.d.ts +3 -6
  104. package/dist/core/tools/web-search-exa.d.ts.map +1 -1
  105. package/dist/core/tools/web-search-exa.js +5 -8
  106. package/dist/core/tools/web-search-exa.js.map +1 -1
  107. package/dist/core/trust-manager.d.ts +6 -5
  108. package/dist/core/trust-manager.d.ts.map +1 -1
  109. package/dist/core/trust-manager.js +42 -19
  110. package/dist/core/trust-manager.js.map +1 -1
  111. package/dist/core/web-search-provider.d.ts +0 -10
  112. package/dist/core/web-search-provider.d.ts.map +1 -1
  113. package/dist/core/web-search-provider.js +2 -16
  114. package/dist/core/web-search-provider.js.map +1 -1
  115. package/dist/core/workspace/git-observer.d.ts +16 -0
  116. package/dist/core/workspace/git-observer.d.ts.map +1 -1
  117. package/dist/core/workspace/git-observer.js +8 -1
  118. package/dist/core/workspace/git-observer.js.map +1 -1
  119. package/dist/core/workspace/git-worktree-owner.d.ts +89 -0
  120. package/dist/core/workspace/git-worktree-owner.d.ts.map +1 -0
  121. package/dist/core/workspace/git-worktree-owner.js +240 -0
  122. package/dist/core/workspace/git-worktree-owner.js.map +1 -0
  123. package/dist/main.d.ts +0 -1
  124. package/dist/main.d.ts.map +1 -1
  125. package/dist/main.js +22 -3
  126. package/dist/main.js.map +1 -1
  127. package/dist/modes/acp/server.d.ts +43 -1
  128. package/dist/modes/acp/server.d.ts.map +1 -1
  129. package/dist/modes/acp/server.js +78 -0
  130. package/dist/modes/acp/server.js.map +1 -1
  131. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  132. package/dist/modes/interactive/components/settings-selector.js +1 -1
  133. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  134. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  135. package/dist/modes/interactive/interactive-mode.js +0 -29
  136. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  137. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  138. package/dist/modes/rpc/rpc-mode.js +38 -0
  139. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  140. package/dist/modes/rpc/rpc-types.d.ts +110 -0
  141. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  142. package/dist/modes/rpc/rpc-types.js.map +1 -1
  143. package/dist/utils/tools-manager.d.ts +0 -25
  144. package/dist/utils/tools-manager.d.ts.map +1 -1
  145. package/dist/utils/tools-manager.js +3 -52
  146. package/dist/utils/tools-manager.js.map +1 -1
  147. package/dist/utils/version-check.d.ts +0 -2
  148. package/dist/utils/version-check.d.ts.map +1 -1
  149. package/dist/utils/version-check.js +0 -2
  150. package/dist/utils/version-check.js.map +1 -1
  151. package/docs/settings.md +2 -7
  152. package/npm-shrinkwrap.json +5 -5
  153. package/package.json +2 -2
  154. package/dist/core/sandbox/bwrap-arguments.d.ts +0 -41
  155. package/dist/core/sandbox/bwrap-arguments.d.ts.map +0 -1
  156. package/dist/core/sandbox/bwrap-arguments.js +0 -136
  157. package/dist/core/sandbox/bwrap-arguments.js.map +0 -1
  158. package/dist/core/sandbox/child-entry.d.ts +0 -2
  159. package/dist/core/sandbox/child-entry.d.ts.map +0 -1
  160. package/dist/core/sandbox/child-entry.js +0 -24
  161. package/dist/core/sandbox/child-entry.js.map +0 -1
  162. package/dist/core/sandbox/cli-launch.d.ts +0 -162
  163. package/dist/core/sandbox/cli-launch.d.ts.map +0 -1
  164. package/dist/core/sandbox/cli-launch.js +0 -366
  165. package/dist/core/sandbox/cli-launch.js.map +0 -1
  166. package/dist/core/sandbox/cli-supervisor.d.ts +0 -31
  167. package/dist/core/sandbox/cli-supervisor.d.ts.map +0 -1
  168. package/dist/core/sandbox/cli-supervisor.js +0 -147
  169. package/dist/core/sandbox/cli-supervisor.js.map +0 -1
  170. package/dist/core/sandbox/default-hosts.d.ts +0 -28
  171. package/dist/core/sandbox/default-hosts.d.ts.map +0 -1
  172. package/dist/core/sandbox/default-hosts.js +0 -69
  173. package/dist/core/sandbox/default-hosts.js.map +0 -1
  174. package/dist/core/sandbox/full-access.d.ts +0 -28
  175. package/dist/core/sandbox/full-access.d.ts.map +0 -1
  176. package/dist/core/sandbox/full-access.js +0 -63
  177. package/dist/core/sandbox/full-access.js.map +0 -1
  178. package/dist/core/sandbox/git-identity.d.ts +0 -57
  179. package/dist/core/sandbox/git-identity.d.ts.map +0 -1
  180. package/dist/core/sandbox/git-identity.js +0 -78
  181. package/dist/core/sandbox/git-identity.js.map +0 -1
  182. package/dist/core/sandbox/host-approval.d.ts +0 -42
  183. package/dist/core/sandbox/host-approval.d.ts.map +0 -1
  184. package/dist/core/sandbox/host-approval.js +0 -99
  185. package/dist/core/sandbox/host-approval.js.map +0 -1
  186. package/dist/core/sandbox/linux-backend.d.ts +0 -48
  187. package/dist/core/sandbox/linux-backend.d.ts.map +0 -1
  188. package/dist/core/sandbox/linux-backend.js +0 -328
  189. package/dist/core/sandbox/linux-backend.js.map +0 -1
  190. package/dist/core/sandbox/macos-backend.d.ts +0 -30
  191. package/dist/core/sandbox/macos-backend.d.ts.map +0 -1
  192. package/dist/core/sandbox/macos-backend.js +0 -385
  193. package/dist/core/sandbox/macos-backend.js.map +0 -1
  194. package/dist/core/sandbox/network-proxy.d.ts +0 -38
  195. package/dist/core/sandbox/network-proxy.d.ts.map +0 -1
  196. package/dist/core/sandbox/network-proxy.js +0 -153
  197. package/dist/core/sandbox/network-proxy.js.map +0 -1
  198. package/dist/core/sandbox/network-refusal.d.ts +0 -24
  199. package/dist/core/sandbox/network-refusal.d.ts.map +0 -1
  200. package/dist/core/sandbox/network-refusal.js +0 -72
  201. package/dist/core/sandbox/network-refusal.js.map +0 -1
  202. package/dist/core/sandbox/policy.d.ts +0 -40
  203. package/dist/core/sandbox/policy.d.ts.map +0 -1
  204. package/dist/core/sandbox/policy.js +0 -55
  205. package/dist/core/sandbox/policy.js.map +0 -1
  206. package/dist/core/sandbox/profiles.d.ts +0 -25
  207. package/dist/core/sandbox/profiles.d.ts.map +0 -1
  208. package/dist/core/sandbox/profiles.js +0 -23
  209. package/dist/core/sandbox/profiles.js.map +0 -1
  210. package/dist/core/sandbox/rpc/command-client.d.ts +0 -28
  211. package/dist/core/sandbox/rpc/command-client.d.ts.map +0 -1
  212. package/dist/core/sandbox/rpc/command-client.js +0 -86
  213. package/dist/core/sandbox/rpc/command-client.js.map +0 -1
  214. package/dist/core/sandbox/rpc/command-proxy.d.ts +0 -48
  215. package/dist/core/sandbox/rpc/command-proxy.d.ts.map +0 -1
  216. package/dist/core/sandbox/rpc/command-proxy.js +0 -120
  217. package/dist/core/sandbox/rpc/command-proxy.js.map +0 -1
  218. package/dist/core/sandbox/rpc/credential-client.d.ts +0 -20
  219. package/dist/core/sandbox/rpc/credential-client.d.ts.map +0 -1
  220. package/dist/core/sandbox/rpc/credential-client.js +0 -170
  221. package/dist/core/sandbox/rpc/credential-client.js.map +0 -1
  222. package/dist/core/sandbox/rpc/credential-proxy.d.ts +0 -44
  223. package/dist/core/sandbox/rpc/credential-proxy.d.ts.map +0 -1
  224. package/dist/core/sandbox/rpc/credential-proxy.js +0 -287
  225. package/dist/core/sandbox/rpc/credential-proxy.js.map +0 -1
  226. package/dist/core/sandbox/rpc/framing.d.ts +0 -35
  227. package/dist/core/sandbox/rpc/framing.d.ts.map +0 -1
  228. package/dist/core/sandbox/rpc/framing.js +0 -114
  229. package/dist/core/sandbox/rpc/framing.js.map +0 -1
  230. package/dist/core/sandbox/rpc/git-credential-helper.d.ts +0 -47
  231. package/dist/core/sandbox/rpc/git-credential-helper.d.ts.map +0 -1
  232. package/dist/core/sandbox/rpc/git-credential-helper.js +0 -222
  233. package/dist/core/sandbox/rpc/git-credential-helper.js.map +0 -1
  234. package/dist/core/sandbox/rpc/git-credential-proxy.d.ts +0 -66
  235. package/dist/core/sandbox/rpc/git-credential-proxy.d.ts.map +0 -1
  236. package/dist/core/sandbox/rpc/git-credential-proxy.js +0 -209
  237. package/dist/core/sandbox/rpc/git-credential-proxy.js.map +0 -1
  238. package/dist/core/sandbox/supervisor-temp.d.ts +0 -18
  239. package/dist/core/sandbox/supervisor-temp.d.ts.map +0 -1
  240. package/dist/core/sandbox/supervisor-temp.js +0 -21
  241. package/dist/core/sandbox/supervisor-temp.js.map +0 -1
  242. package/dist/core/sandbox/supervisor.d.ts +0 -62
  243. package/dist/core/sandbox/supervisor.d.ts.map +0 -1
  244. package/dist/core/sandbox/supervisor.js +0 -32
  245. package/dist/core/sandbox/supervisor.js.map +0 -1
  246. package/dist/core/sandbox/terminal-handoff.d.ts +0 -68
  247. package/dist/core/sandbox/terminal-handoff.d.ts.map +0 -1
  248. package/dist/core/sandbox/terminal-handoff.js +0 -221
  249. package/dist/core/sandbox/terminal-handoff.js.map +0 -1
  250. package/dist/core/sandbox/terminal-size.d.ts +0 -53
  251. package/dist/core/sandbox/terminal-size.d.ts.map +0 -1
  252. package/dist/core/sandbox/terminal-size.js +0 -126
  253. package/dist/core/sandbox/terminal-size.js.map +0 -1
  254. package/dist/core/sandbox/violations.d.ts +0 -23
  255. package/dist/core/sandbox/violations.d.ts.map +0 -1
  256. package/dist/core/sandbox/violations.js +0 -30
  257. package/dist/core/sandbox/violations.js.map +0 -1
@@ -18,6 +18,7 @@ import { type BashResult } from "./bash-executor.ts";
18
18
  import type { CheckpointSettings } from "./checkpoints/git-checkpoints.ts";
19
19
  import { type SessionCheckpoints } from "./checkpoints/session-checkpoints.ts";
20
20
  import { type CompactionResult } from "./compaction/index.ts";
21
+ import type { ChildRunPolicySnapshot, ChildRunRegistry, ChildRunStatus, ChildRunUsageTotals, ChildSessionStatus, ChildTurnOutcome, ChildWorkspaceRecoveryResult, ChildWorkspaceRequest, DelegationRuntimeOptions } from "./delegation/runtime.ts";
21
22
  import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionErrorListener, type ExtensionMode, ExtensionRunner, type ExtensionUIContext, type InputSource, type ReplacedSessionContext, type SessionStartEvent, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.ts";
22
23
  import { type FormatterRunOutcome } from "./formatter-lifecycle.ts";
23
24
  import type { HookRuntime } from "./hooks/types.ts";
@@ -39,6 +40,7 @@ import { type ToolContractSnapshotEntry } from "./tools/contract-snapshot.ts";
39
40
  import type { DiagnosticsOperations } from "./tools/diagnostics.ts";
40
41
  import type { LspOperations } from "./tools/lsp.ts";
41
42
  import type { WebSearchOperations } from "./tools/web-search.ts";
43
+ import type { VerificationBoundary } from "./verification-lifecycle.ts";
42
44
  import { type VerificationCompletionStatus, type VerificationRecord } from "./verification-lifecycle.ts";
43
45
  import { type GitObserveOptions } from "./workspace/git-observer.ts";
44
46
  import { type WorkspaceStateRecord } from "./workspace/state.ts";
@@ -126,7 +128,35 @@ export type AgentSessionEvent = Exclude<AgentEvent, {
126
128
  };
127
129
  /** Listener function for agent session events */
128
130
  export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
131
+ /**
132
+ * Point-in-time snapshot of the root aggregate budget's counters for this
133
+ * session's whole delegation tree (spec 2026-09-09, "Shared budgets"). Reported
134
+ * by `AgentSession.aggregateBudgetUsage()`; `undefined` there when no aggregate
135
+ * budget is configured.
136
+ */
137
+ export interface AggregateBudgetUsageSnapshot {
138
+ providerRequests: number;
139
+ toolCalls: number;
140
+ maintenanceRequests: number;
141
+ startedAtMs: number;
142
+ }
129
143
  export interface AgentSessionConfig {
144
+ childRunRegistry?: ChildRunRegistry;
145
+ /**
146
+ * The session's delegation runtime options when delegation is configured.
147
+ * Required for `startChildRun`: without it (no permission gate or explicit
148
+ * `delegation` option), spawning children from the protocol surfaces refuses
149
+ * with an actionable error instead of silently fabricating authority.
150
+ */
151
+ delegationRuntime?: DelegationRuntimeOptions;
152
+ /**
153
+ * Reads the root aggregate budget's counters for this session's delegation
154
+ * tree (spec 2026-09-09, "Shared budgets"). Wired by `createAgentSession`
155
+ * when the tree has an aggregate budget (an explicit `aggregateBudget` on
156
+ * the root, or an inherited root aggregate via `sharedBudgetController` on a
157
+ * delegated child); absent means the session has no shared ceiling.
158
+ */
159
+ aggregateBudgetUsage?: () => AggregateBudgetUsageSnapshot;
130
160
  agent: Agent;
131
161
  sessionManager: SessionManager;
132
162
  settingsManager: SettingsManager;
@@ -239,6 +269,8 @@ export interface PromptOptions {
239
269
  /** Internal hook used by RPC mode to observe prompt preflight acceptance or rejection. */
240
270
  preflightResult?: (success: boolean) => void;
241
271
  }
272
+ /** Stable lifecycle of an AgentSession. Terminal states remain queryable. */
273
+ export type AgentSessionLifecycle = "created" | "running" | "waiting" | "completed" | "failed" | "interrupted" | "closed";
242
274
  /** Options for model/thinking mutations. */
243
275
  export interface ModelMutationOptions {
244
276
  /** Persist the new value to global defaults. Defaults to session-only. */
@@ -291,6 +323,10 @@ export interface TreeNavigationResult {
291
323
  workspace?: TreeWorkspaceOutcome;
292
324
  }
293
325
  export declare class AgentSession {
326
+ private _lifecycle;
327
+ private _activePrompt;
328
+ /** Lifecycle is deliberately retained after completion/close for protocol callers. */
329
+ get lifecycle(): AgentSessionLifecycle;
294
330
  readonly agent: Agent;
295
331
  readonly sessionManager: SessionManager;
296
332
  readonly settingsManager: SettingsManager;
@@ -354,6 +390,9 @@ export declare class AgentSession {
354
390
  private readonly _checkpoints;
355
391
  private readonly _hookRuntime;
356
392
  private readonly _backgroundShellRegistry;
393
+ private readonly _childRunRegistry;
394
+ private readonly _delegationRuntime;
395
+ private readonly _aggregateBudgetUsage;
357
396
  private readonly _permissionResponderFactory;
358
397
  /** Worktree checkpoints for this session. Inert unless `checkpoints.enabled` is set. */
359
398
  get checkpoints(): SessionCheckpoints;
@@ -443,6 +482,115 @@ export declare class AgentSession {
443
482
  * Multiple listeners can be added. Returns unsubscribe function for this listener.
444
483
  */
445
484
  subscribe(listener: AgentSessionEventListener): () => void;
485
+ /** Child handles remain available until explicitly closed or this session is disposed. */
486
+ listChildRuns(): {
487
+ handleId: string;
488
+ agentType: string;
489
+ task: string;
490
+ status: ChildSessionStatus;
491
+ attemptCount: number;
492
+ }[];
493
+ /**
494
+ * A point-in-time snapshot of the root aggregate budget's counters for this
495
+ * session's whole delegation tree -- {providerRequests, toolCalls,
496
+ * maintenanceRequests, startedAtMs} (spec 2026-09-09, "Shared budgets").
497
+ * `undefined` when no aggregate budget is configured for the tree.
498
+ */
499
+ aggregateBudgetUsage(): AggregateBudgetUsageSnapshot | undefined;
500
+ private _requireChildRuns;
501
+ waitChildRun(id: string): Promise<import("./delegation/runtime.ts").DelegationResult>;
502
+ retrieveChildRun(id: string): Promise<import("./delegation/runtime.ts").DelegationResult>;
503
+ sendChildInput(id: string, input: string): Promise<void>;
504
+ interruptChildRun(id: string, reason?: string): void;
505
+ closeChildRun(id: string): void;
506
+ /**
507
+ * Non-blocking status snapshot for one child run (spec 2026-09-09, pollable
508
+ * status): `{handleId, agentType, task, status, attempt, attempts, ...}` built
509
+ * from the record/entry alone -- this never awaits a turn, so a caller can
510
+ * poll a running child without blocking (`waitChildRun` stays the blocking
511
+ * form). Unknown ids still error; historical records are served from the
512
+ * persisted record. Observing the status lazily interrupts a running child
513
+ * whose wall-clock deadline has passed.
514
+ */
515
+ childRunStatus(id: string): ChildRunStatus;
516
+ /**
517
+ * The child run's token/cost totals, rolled up from the child's OWN session
518
+ * transcript (`ChildRunRegistry.usageTotals`). `undefined` -- never a throw,
519
+ * never a zero-fill -- when nothing is reachable (an in-memory child without
520
+ * a reachable transcript, or a legacy record without any transcript).
521
+ */
522
+ childRunUsageTotals(id: string): ChildRunUsageTotals | undefined;
523
+ /**
524
+ * Explicitly verify and reactivate a retained child worktree (spec
525
+ * 2026-09-09, "Workspace states and explicit recovery"): the thinnest
526
+ * pass-through over `ChildRunRegistry.recoverWorkspace`. Read-only git
527
+ * inspection through the workspace owner -- the admin entry, the checked-out
528
+ * branch, and the owner's layout -- never a recreate, checkout, reset, or
529
+ * force. On success the workspace state becomes "active" (persisted) and the
530
+ * child can be resumed in the SAME worktree; `{dirty}` reports preserved
531
+ * uncommitted work. Every failed check throws an actionable error naming the
532
+ * failed check and leaving the state unverified.
533
+ */
534
+ recoverChildWorkspace(id: string): Promise<ChildWorkspaceRecoveryResult>;
535
+ /**
536
+ * Start a background child run through the session's own delegation runtime.
537
+ * A thin pass-through over `runDelegation` (registry-backed, always
538
+ * background): admission -- agent resolution, depth bound, capability
539
+ * ceiling -- is the same projection the `delegate` tool uses, so a spawned
540
+ * child can never hold authority the parent cannot cover. Foreground
541
+ * spawning is not offered; protocol clients wait on the returned handle.
542
+ *
543
+ * Idempotent spawn: a supplied `idempotencyKey` that already maps to a
544
+ * handle returns the EXISTING handle with `created: false` and never builds
545
+ * a second child (no budget slot consumed twice); the key persists on the
546
+ * record, so a restarted parent dedupes too. `timeoutMs` caps the child's
547
+ * own run budget at the wall-time gate and records the deadline for lazy
548
+ * status observation.
549
+ */
550
+ startChildRun(agentType: string, task: string, request?: {
551
+ workspace?: ChildWorkspaceRequest;
552
+ idempotencyKey?: string;
553
+ timeoutMs?: number;
554
+ }): Promise<{
555
+ handleId: string;
556
+ created: boolean;
557
+ }>;
558
+ /**
559
+ * Wait for a child run's latest settled turn and return its payload with the
560
+ * registry status after settlement: `{ status, output, outcome }` plus the
561
+ * run's additive linkage fields (`artifactDir`, `sessionFile`,
562
+ * `parentSessionId`, `policy`, `sandboxEnforced`) when the registry snapshot
563
+ * knows them. A failed settlement surfaces as `outcome: "failed"` with the
564
+ * error message as the output rather than a rejection, so protocol waiters
565
+ * get the same payload shape on every settled turn; unknown handles still
566
+ * throw the registry's actionable error.
567
+ */
568
+ waitChildRunResult(id: string): Promise<{
569
+ status: ChildSessionStatus;
570
+ output: string;
571
+ outcome: ChildTurnOutcome;
572
+ artifactDir?: string;
573
+ sessionFile?: string;
574
+ parentSessionId?: string;
575
+ policy?: ChildRunPolicySnapshot;
576
+ sandboxEnforced?: boolean;
577
+ }>;
578
+ /**
579
+ * Resume an interrupted child run in its existing child session.
580
+ *
581
+ * The thinnest pass-through over the session-owned registry: the child keeps its
582
+ * identity, policy ceiling, and session linkage, and no second service or registry
583
+ * is involved. Returns the observed status after the resumed turn settles. The
584
+ * resumed turn's output becomes the run's stored latest result, so a later
585
+ * `waitChildRun` retrieves it; this call itself returns only the observed status.
586
+ *
587
+ * A handle known only as a persisted record (restored from this session's
588
+ * `child_run` log, no live entry in this process) is historically reattached
589
+ * instead: its recorded child session file is reopened through the same
590
+ * construction seam a live delegation uses, then resumed. Live handles keep
591
+ * the interrupted-only contract below.
592
+ */
593
+ resumeChildRun(id: string, input?: string): Promise<ChildSessionStatus>;
446
594
  /** Disconnect from agent events during disposal. */
447
595
  private _disconnectFromAgent;
448
596
  /**
@@ -527,6 +675,7 @@ export declare class AgentSession {
527
675
  * @throws Error if no model selected or no API key available (when not streaming)
528
676
  */
529
677
  prompt(text: string, options?: PromptOptions): Promise<void>;
678
+ private _prompt;
530
679
  private _tryExecuteExtensionCommand;
531
680
  /**
532
681
  * Expand skill commands (/skill:name args) to their full content.
@@ -723,6 +872,17 @@ export declare class AgentSession {
723
872
  }): Promise<FormatterRunOutcome | undefined>;
724
873
  /** The current completion status: verified, failed, unavailable, interrupted, or continued-unverified. */
725
874
  verificationStatus(): VerificationCompletionStatus;
875
+ /** The configured verification boundary, for execution owners enforcing it. */
876
+ verificationBoundary(): VerificationBoundary;
877
+ /**
878
+ * The configured verification policy ids, read through the canonical
879
+ * tracker (refreshed from settings on each call, like requestVerification).
880
+ * Execution owners such as the delegation child gate use the count to tell
881
+ * "no policies configured" (turn proceeds unchanged) from "configured and
882
+ * not verified" (turn fails) -- the completion status alone cannot express
883
+ * that difference, because it reports "unavailable" for both.
884
+ */
885
+ verificationPolicyIds(): string[];
726
886
  /** The live verification record with its bounded evidence, if any. */
727
887
  verificationRecord(): VerificationRecord | undefined;
728
888
  /** Record that the user chose to finish without verification. */