@gajae-code/coding-agent 0.15.6 → 0.16.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.
Files changed (270) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/dist/types/async/job-manager.d.ts +32 -1
  3. package/dist/types/browser-backend.d.ts +12 -0
  4. package/dist/types/cli/args.d.ts +2 -0
  5. package/dist/types/cli/root-flags.d.ts +14 -0
  6. package/dist/types/cli/update-cli.d.ts +14 -0
  7. package/dist/types/cli.d.ts +7 -0
  8. package/dist/types/commands/launch.d.ts +10 -0
  9. package/dist/types/commands/sdk.d.ts +2 -0
  10. package/dist/types/config/autorouting-tier-map.d.ts +24 -0
  11. package/dist/types/config/billing-path.d.ts +25 -0
  12. package/dist/types/config/config-schema-version.d.ts +13 -1
  13. package/dist/types/config/file-lock.d.ts +5 -0
  14. package/dist/types/config/model-registry.d.ts +22 -0
  15. package/dist/types/config/settings-schema.d.ts +27 -8
  16. package/dist/types/config/settings.d.ts +2 -0
  17. package/dist/types/coordinator-mcp/projection-scan.d.ts +8 -0
  18. package/dist/types/crash/record-loader.d.ts +15 -0
  19. package/dist/types/extensibility/extensions/types.d.ts +8 -3
  20. package/dist/types/gjc-runtime/launch-worktree-reservation.d.ts +21 -0
  21. package/dist/types/gjc-runtime/launch-worktree.d.ts +25 -1
  22. package/dist/types/gjc-runtime/managed-owner-supervisor.d.ts +2 -0
  23. package/dist/types/gjc-runtime/session-state-lock.d.ts +22 -0
  24. package/dist/types/gjc-runtime/session-state-sidecar.d.ts +66 -1
  25. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +1 -0
  26. package/dist/types/gjc-runtime/tmux-sessions.d.ts +27 -0
  27. package/dist/types/main.d.ts +1 -0
  28. package/dist/types/master-mode/context.d.ts +21 -0
  29. package/dist/types/master-mode/first-request.d.ts +34 -0
  30. package/dist/types/master-mode/snapshot.d.ts +32 -0
  31. package/dist/types/modes/acp/acp-agent.d.ts +21 -21
  32. package/dist/types/modes/components/frictionless-onboarding-selector.d.ts +10 -0
  33. package/dist/types/modes/components/model-selector.d.ts +4 -0
  34. package/dist/types/modes/components/oauth-selector.d.ts +1 -0
  35. package/dist/types/modes/components/session-selector.d.ts +1 -1
  36. package/dist/types/modes/components/sessions-dashboard.d.ts +2 -1
  37. package/dist/types/modes/components/status-line/model-name.d.ts +18 -0
  38. package/dist/types/modes/components/status-line/priority-row.d.ts +34 -0
  39. package/dist/types/modes/components/status-line/segments.d.ts +10 -0
  40. package/dist/types/modes/interactive-mode.d.ts +16 -2
  41. package/dist/types/modes/print-mode.d.ts +17 -0
  42. package/dist/types/modes/theme/theme.d.ts +2 -1
  43. package/dist/types/modes/types.d.ts +2 -0
  44. package/dist/types/modes/ui-language.d.ts +7 -1
  45. package/dist/types/sdk/broker/broker.d.ts +79 -2
  46. package/dist/types/sdk/broker/endpoint-authority.d.ts +24 -0
  47. package/dist/types/sdk/broker/ensure.d.ts +3 -0
  48. package/dist/types/sdk/broker/index.d.ts +3 -0
  49. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +6 -0
  50. package/dist/types/sdk/broker/lifecycle.d.ts +40 -0
  51. package/dist/types/sdk/broker/master-capability.d.ts +10 -0
  52. package/dist/types/sdk/broker/session-index.d.ts +40 -11
  53. package/dist/types/sdk/broker/session-scope.d.ts +72 -0
  54. package/dist/types/sdk/broker/spawn-authority.d.ts +201 -0
  55. package/dist/types/sdk/broker/spawn-substrate.d.ts +30 -0
  56. package/dist/types/sdk/broker/startup-budget.d.ts +52 -0
  57. package/dist/types/sdk/broker/state-version.d.ts +21 -1
  58. package/dist/types/sdk/broker/worktree-occupancy.d.ts +28 -0
  59. package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -0
  60. package/dist/types/sdk/bus/discord-daemon.d.ts +1 -1
  61. package/dist/types/sdk/bus/index.d.ts +9 -1
  62. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +1 -1
  63. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +1 -1
  64. package/dist/types/sdk/bus/slack-conversation.d.ts +1 -1
  65. package/dist/types/sdk/bus/slack-daemon.d.ts +1 -1
  66. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
  67. package/dist/types/sdk/cli/index.d.ts +1 -0
  68. package/dist/types/sdk/cli/master-cli.d.ts +63 -0
  69. package/dist/types/sdk/cli/rows.d.ts +12 -5
  70. package/dist/types/sdk/cli/session-cli.d.ts +20 -3
  71. package/dist/types/sdk/client/client.d.ts +3 -2
  72. package/dist/types/sdk/host/control/dispatch.d.ts +10 -0
  73. package/dist/types/sdk/host/control/index.d.ts +1 -1
  74. package/dist/types/sdk/host/control/operations.d.ts +2 -0
  75. package/dist/types/sdk/host/control/runtime-gate.d.ts +21 -7
  76. package/dist/types/sdk/host/events.d.ts +1 -0
  77. package/dist/types/sdk/host/host.d.ts +10 -0
  78. package/dist/types/sdk/host/query/cursor.d.ts +4 -2
  79. package/dist/types/sdk/host/query/handlers.d.ts +1 -0
  80. package/dist/types/sdk/host/query/revision-store.d.ts +1 -0
  81. package/dist/types/sdk/host/session-runtime.d.ts +70 -17
  82. package/dist/types/sdk/lifecycle/broker-client.d.ts +6 -0
  83. package/dist/types/sdk/lifecycle/service.d.ts +15 -3
  84. package/dist/types/sdk/lifecycle-session.d.ts +3 -1
  85. package/dist/types/sdk/prompt-deadline-manager.d.ts +2 -5
  86. package/dist/types/sdk/receipt-state.d.ts +2 -0
  87. package/dist/types/sdk/router/session-router.d.ts +6 -0
  88. package/dist/types/sdk/session.d.ts +16 -0
  89. package/dist/types/sdk/startup-capability.d.ts +2 -1
  90. package/dist/types/sdk/turn-result.d.ts +6 -0
  91. package/dist/types/session/agent-session.d.ts +52 -7
  92. package/dist/types/session/credential-store-errors.d.ts +1 -0
  93. package/dist/types/session/fold-coordinator.d.ts +29 -2
  94. package/dist/types/session/session-manager.d.ts +79 -2
  95. package/dist/types/session/yield-queue.d.ts +5 -4
  96. package/dist/types/setup/frictionless-onboarding.d.ts +1 -0
  97. package/dist/types/tools/ask.d.ts +1 -0
  98. package/dist/types/tools/bash.d.ts +16 -0
  99. package/dist/types/tools/browser/launch.d.ts +10 -0
  100. package/dist/types/tools/browser/registry.d.ts +8 -0
  101. package/dist/types/tools/gh.d.ts +8 -0
  102. package/dist/types/tools/index.d.ts +10 -10
  103. package/dist/types/tools/job.d.ts +3 -1
  104. package/dist/types/utils/external-editor.d.ts +7 -0
  105. package/examples/extensions/README.md +1 -1
  106. package/examples/extensions/pirate.ts +7 -4
  107. package/package.json +7 -7
  108. package/scripts/generate-sdk-operation-inventory.ts +13 -1
  109. package/scripts/verify-gjc-sdk-canonicalization.ts +35 -1
  110. package/src/async/job-manager.ts +107 -9
  111. package/src/browser-backend.ts +29 -0
  112. package/src/cli/accounts-cli.ts +9 -5
  113. package/src/cli/args.ts +17 -0
  114. package/src/cli/fast-help.ts +1 -0
  115. package/src/cli/plugin-cli.ts +29 -0
  116. package/src/cli/root-flags.ts +5 -0
  117. package/src/cli/update-cli.ts +140 -23
  118. package/src/commands/launch.ts +86 -18
  119. package/src/commands/sdk.ts +135 -28
  120. package/src/config/autorouting-tier-map.ts +12 -0
  121. package/src/config/billing-path.ts +42 -0
  122. package/src/config/config-schema-version.ts +18 -1
  123. package/src/config/file-lock.ts +158 -83
  124. package/src/config/model-preset-registry.ts +178 -23
  125. package/src/config/model-profiles.ts +5 -5
  126. package/src/config/model-registry.ts +291 -42
  127. package/src/config/model-resolver.ts +5 -0
  128. package/src/config/settings-schema.ts +27 -8
  129. package/src/config/settings.ts +51 -15
  130. package/src/coordinator-mcp/projection-scan.ts +27 -6
  131. package/src/coordinator-mcp/question-state.ts +9 -11
  132. package/src/coordinator-mcp/server.ts +115 -21
  133. package/src/crash/index-store.ts +2 -0
  134. package/src/crash/record-loader.ts +10 -0
  135. package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -1
  136. package/src/extensibility/extensions/runner.ts +27 -0
  137. package/src/extensibility/extensions/types.ts +8 -3
  138. package/src/extensibility/gjc-plugins/installer.ts +51 -11
  139. package/src/extensibility/runtime-skill-discovery.ts +110 -3
  140. package/src/extensibility/skills.ts +22 -12
  141. package/src/gjc-runtime/launch-worktree-reservation.ts +242 -0
  142. package/src/gjc-runtime/launch-worktree.ts +285 -4
  143. package/src/gjc-runtime/managed-owner-supervisor.ts +63 -51
  144. package/src/gjc-runtime/session-state-lock.ts +213 -14
  145. package/src/gjc-runtime/session-state-sidecar.ts +938 -39
  146. package/src/gjc-runtime/tmux-owner-isolation-cli.ts +4 -7
  147. package/src/gjc-runtime/tmux-owner-isolation.ts +18 -3
  148. package/src/gjc-runtime/tmux-sessions.ts +252 -13
  149. package/src/hooks/skill-state.ts +6 -0
  150. package/src/internal-urls/docs-index.generated.ts +15 -15
  151. package/src/internal-urls/issue-pr-protocol.ts +4 -2
  152. package/src/main.ts +61 -3
  153. package/src/master-mode/context.ts +50 -0
  154. package/src/master-mode/first-request.ts +65 -0
  155. package/src/master-mode/snapshot.ts +205 -0
  156. package/src/modes/acp/acp-agent.ts +610 -161
  157. package/src/modes/components/footer.ts +4 -2
  158. package/src/modes/components/frictionless-onboarding-selector.ts +48 -2
  159. package/src/modes/components/model-selector.ts +76 -8
  160. package/src/modes/components/oauth-selector.ts +6 -1
  161. package/src/modes/components/session-selector.ts +23 -15
  162. package/src/modes/components/sessions-dashboard.ts +8 -5
  163. package/src/modes/components/settings-selector.ts +1 -0
  164. package/src/modes/components/status-line/model-name.ts +53 -0
  165. package/src/modes/components/status-line/priority-row.ts +107 -0
  166. package/src/modes/components/status-line/segments.ts +23 -9
  167. package/src/modes/components/tool-status-header.ts +151 -15
  168. package/src/modes/controllers/command-controller.ts +1 -1
  169. package/src/modes/controllers/event-controller.ts +30 -4
  170. package/src/modes/controllers/extension-ui-controller.ts +13 -13
  171. package/src/modes/controllers/input-controller.ts +30 -2
  172. package/src/modes/controllers/selector-controller.ts +200 -98
  173. package/src/modes/interactive-mode.ts +36 -12
  174. package/src/modes/print-mode.ts +64 -0
  175. package/src/modes/prompt-action-autocomplete.ts +30 -4
  176. package/src/modes/runtime-init.ts +12 -9
  177. package/src/modes/theme/theme.ts +5 -0
  178. package/src/modes/types.ts +2 -0
  179. package/src/modes/ui-language.ts +49 -2
  180. package/src/modes/utils/ui-helpers.ts +22 -3
  181. package/src/prompts/agent-fragments/browser-aside.md +22 -0
  182. package/src/prompts/system/master-mode.md +28 -0
  183. package/src/prompts/tools/ask.md +1 -1
  184. package/src/prompts/tools/bash.md +1 -0
  185. package/src/prompts/tools/job.md +1 -1
  186. package/src/sdk/acp/adapter.ts +5 -0
  187. package/src/sdk/broker/broker.ts +1646 -27
  188. package/src/sdk/broker/endpoint-authority.ts +86 -0
  189. package/src/sdk/broker/ensure.ts +81 -3
  190. package/src/sdk/broker/index.ts +3 -0
  191. package/src/sdk/broker/lifecycle-ledger.ts +6 -0
  192. package/src/sdk/broker/lifecycle.ts +440 -75
  193. package/src/sdk/broker/master-capability.ts +232 -0
  194. package/src/sdk/broker/session-index.ts +121 -17
  195. package/src/sdk/broker/session-scope.ts +272 -0
  196. package/src/sdk/broker/spawn-authority.ts +1031 -0
  197. package/src/sdk/broker/spawn-substrate.ts +591 -0
  198. package/src/sdk/broker/startup-budget.ts +144 -2
  199. package/src/sdk/broker/state-version.ts +43 -14
  200. package/src/sdk/broker/transport.ts +1 -0
  201. package/src/sdk/broker/worktree-occupancy.ts +90 -0
  202. package/src/sdk/bus/chat-daemon-control.ts +5 -2
  203. package/src/sdk/bus/chat-daemon-runtime.ts +136 -18
  204. package/src/sdk/bus/discord-daemon.ts +50 -10
  205. package/src/sdk/bus/index.ts +84 -7
  206. package/src/sdk/bus/kind-aware-reconciliation.ts +296 -48
  207. package/src/sdk/bus/lifecycle-commands.ts +4 -0
  208. package/src/sdk/bus/notification-service.ts +22 -5
  209. package/src/sdk/bus/prompt-reconciliation.ts +7 -2
  210. package/src/sdk/bus/reconciliation-store.ts +55 -31
  211. package/src/sdk/bus/slack-conversation.ts +1 -1
  212. package/src/sdk/bus/slack-daemon.ts +72 -38
  213. package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
  214. package/src/sdk/cli/index.ts +1 -0
  215. package/src/sdk/cli/master-cli.ts +259 -0
  216. package/src/sdk/cli/rows.ts +41 -15
  217. package/src/sdk/cli/session-cli.ts +297 -26
  218. package/src/sdk/client/client.ts +14 -8
  219. package/src/sdk/host/control/dispatch.ts +101 -40
  220. package/src/sdk/host/control/index.ts +2 -0
  221. package/src/sdk/host/control/operations.ts +2 -0
  222. package/src/sdk/host/control/runtime-gate.ts +203 -11
  223. package/src/sdk/host/events.ts +1 -0
  224. package/src/sdk/host/host.ts +29 -2
  225. package/src/sdk/host/query/cursor.ts +52 -7
  226. package/src/sdk/host/query/handlers.ts +33 -12
  227. package/src/sdk/host/query/revision-store.ts +12 -0
  228. package/src/sdk/host/session-runtime.test.ts +673 -14
  229. package/src/sdk/host/session-runtime.ts +674 -103
  230. package/src/sdk/host/surface-policy.ts +3 -3
  231. package/src/sdk/lifecycle/broker-client.ts +28 -0
  232. package/src/sdk/lifecycle/service.ts +279 -20
  233. package/src/sdk/lifecycle-session.ts +17 -4
  234. package/src/sdk/prompt-deadline-manager.ts +2 -1
  235. package/src/sdk/protocol/operation-inventory.generated.json +105 -3
  236. package/src/sdk/protocol/operation-registry.ts +14 -4
  237. package/src/sdk/receipt-state.ts +10 -0
  238. package/src/sdk/router/session-router.ts +219 -118
  239. package/src/sdk/session.ts +416 -195
  240. package/src/sdk/startup-capability.ts +1 -0
  241. package/src/sdk/turn-result.ts +22 -0
  242. package/src/session/agent-session.ts +1628 -318
  243. package/src/session/blob-store.ts +15 -5
  244. package/src/session/credential-store-errors.ts +2 -0
  245. package/src/session/fold-coordinator.ts +40 -3
  246. package/src/session/internal/managed-session-storage.ts +153 -78
  247. package/src/session/session-manager.ts +850 -97
  248. package/src/session/yield-queue.ts +24 -10
  249. package/src/setup/frictionless-onboarding.ts +2 -0
  250. package/src/slash-commands/builtin-registry.ts +41 -0
  251. package/src/task/executor.ts +9 -4
  252. package/src/telemetry/events.ts +1138 -12
  253. package/src/tools/ask-contract.test.ts +64 -0
  254. package/src/tools/ask-contract.ts +36 -1
  255. package/src/tools/ask.ts +10 -8
  256. package/src/tools/bash-interactive.ts +11 -2
  257. package/src/tools/bash.ts +412 -75
  258. package/src/tools/browser/launch.ts +37 -0
  259. package/src/tools/browser/registry.ts +99 -9
  260. package/src/tools/cron.ts +6 -4
  261. package/src/tools/descriptors.test.ts +15 -0
  262. package/src/tools/descriptors.ts +5 -1
  263. package/src/tools/gh.ts +104 -48
  264. package/src/tools/github-cache.ts +2 -2
  265. package/src/tools/index.ts +10 -6
  266. package/src/tools/job.ts +4 -1
  267. package/src/tools/monitor.ts +12 -9
  268. package/src/tools/resolve.ts +30 -10
  269. package/src/tools/tool-catalog.generated.ts +2 -2
  270. package/src/utils/external-editor.ts +72 -1
@@ -90,12 +90,13 @@ export interface SdkDispatchContext {
90
90
  readonly connectionId: string | undefined;
91
91
  readonly generation: number;
92
92
  }
93
- /** Request identity retained after an uncertain send for lifecycle reconciliation. */
93
+ /** Request identity retained after an uncertain send. */
94
94
  export interface SdkSentRecord {
95
95
  readonly id: string;
96
96
  readonly operation?: string;
97
97
  readonly idempotencyKey?: string;
98
- readonly fingerprint: string;
98
+ /** Present for lifecycle lookups; `session.spawn` replays through its idempotency key. */
99
+ readonly fingerprint?: string;
99
100
  }
100
101
  export type SdkFrameHandler = (frame: SdkFrame) => void;
101
102
  export type SdkReconnectHandler = () => void;
@@ -31,5 +31,15 @@ export declare class BusyError extends TypedControlError {
31
31
  constructor(message?: string);
32
32
  }
33
33
  export declare function controlRequestFromFrame(frame: Record<string, unknown>): ControlRequest;
34
+ export interface TerminalAbortIdentity {
35
+ input: {
36
+ mode: "terminal";
37
+ scope: "turn" | "owned";
38
+ operator?: true;
39
+ };
40
+ inputHash: string;
41
+ }
42
+ /** One strict, capability-free identity shared by dispatch, durable admission, and delivery observation. */
43
+ export declare function terminalAbortIdentity(input: unknown, operatorAuthorized: boolean): TerminalAbortIdentity | undefined;
34
44
  /** Dispatches a registry-defined per-session control operation. */
35
45
  export declare function dispatchControl(surface: ControlSurface, registryRow: Operation | undefined, request: ControlRequest): Promise<ControlResponse>;
@@ -1,2 +1,2 @@
1
- export { BusyError, type ControlError, type ControlErrorCode, type ControlRequest, type ControlResponse, controlRequestFromFrame, dispatchControl, TypedControlError, } from "./dispatch";
1
+ export { BusyError, type ControlError, type ControlErrorCode, type ControlRequest, type ControlResponse, controlRequestFromFrame, dispatchControl, type TerminalAbortIdentity, TypedControlError, terminalAbortIdentity, } from "./dispatch";
2
2
  export type { AbortScope, ControlInput, ControlSurface, ControlValue } from "./operations";
@@ -10,6 +10,8 @@ export type AbortScope = "turn" | "owned";
10
10
  export interface TerminalAbortInput {
11
11
  mode: "terminal";
12
12
  scope?: AbortScope;
13
+ /** Broker-authorized local override; public SDK callers cannot grant this authority. */
14
+ operator?: boolean;
13
15
  }
14
16
  export type ControlInput = Record<string, unknown>;
15
17
  /**
@@ -1,15 +1,26 @@
1
1
  /**
2
- * Private field carried only on the Broker's endpoint close request.
2
+ * Private fields carried only on Broker-authorized endpoint controls.
3
3
  *
4
- * The value is the lifecycle effect marker bound to the serving process. It is
5
- * never published in endpoint discovery or lifecycle service results; callers
6
- * that do not hold the Broker's indexed lifecycle record cannot satisfy this
7
- * gate.
4
+ * Their values are lifecycle effect markers bound to the serving process. They
5
+ * are never published in endpoint discovery or lifecycle service results;
6
+ * callers that do not hold the Broker's indexed lifecycle record cannot satisfy
7
+ * either gate.
8
8
  */
9
9
  export declare const BROKER_RUNTIME_CLOSE_CAPABILITY_FIELD = "__gjcBrokerCloseCapability";
10
+ /** Private field carried only on the Broker-authorized terminal-abort request. */
11
+ export declare const BROKER_RUNTIME_ABORT_CAPABILITY_FIELD = "__gjcBrokerAbortCapability";
10
12
  export declare function brokerRuntimeCloseCapability(input: unknown): string | undefined;
11
- /** Remove the private close capability before a request is exposed to diagnostics. */
12
- export declare function redactBrokerRuntimeCloseCapability(frame: Record<string, unknown>): Record<string, unknown>;
13
+ export declare function brokerRuntimeAbortCapability(input: unknown): string | undefined;
14
+ /** Remove private Broker capabilities before a request is exposed to diagnostics. */
15
+ export declare function redactBrokerRuntimeCapabilities(frame: Record<string, unknown>): Record<string, unknown>;
16
+ /**
17
+ * Strips caller content from a request frame before it reaches a diagnostic
18
+ * observer. Known protocol operation names and finite enum values survive so
19
+ * instrumentation stays useful; caller-chosen ids and all other values are
20
+ * redacted, including nested objects, so a field this module has never heard
21
+ * of cannot leak.
22
+ */
23
+ export declare function redactObservedRequestContent(frame: Record<string, unknown>): Record<string, unknown>;
13
24
  /**
14
25
  * Runtime-local authority check for the Broker-only graceful close executor.
15
26
  *
@@ -17,3 +28,6 @@ export declare function redactBrokerRuntimeCloseCapability(frame: Record<string,
17
28
  * environment. Generic SDK requests never receive that private marker.
18
29
  */
19
30
  export declare function hasBrokerRuntimeCloseCapability(input: unknown): boolean;
31
+ /** Test-only override for the abort gate; production authority remains process-local. */
32
+ export declare function setBrokerRuntimeAbortCapabilityForTest(capability: string | undefined): void;
33
+ export declare function hasBrokerRuntimeAbortCapability(input: unknown): boolean;
@@ -1,6 +1,7 @@
1
1
  import type { SdkFrame } from "./types";
2
2
  export interface EventFrame extends SdkFrame {
3
3
  type: "event";
4
+ revision?: number;
4
5
  generation: number;
5
6
  seq: number;
6
7
  }
@@ -64,6 +64,16 @@ export interface SessionSdkHostOptions extends HostEndpointAdapters {
64
64
  * that fails is never read as authorization.
65
65
  */
66
66
  activationGate?: SessionActivationGate;
67
+ /** Private one-shot master-capability verification; never durable or public SDK surface. */
68
+ masterCapabilityVerify?: (frame: {
69
+ nonce: unknown;
70
+ attestationEpoch: unknown;
71
+ capability: unknown;
72
+ }) => {
73
+ ok: boolean;
74
+ nonce: string;
75
+ attestationEpoch: string;
76
+ };
67
77
  }
68
78
  /** Shared by the replay filter and transport live broadcasts: a connection
69
79
  * must see the same capability-gated event kinds on both legs, or live and
@@ -15,6 +15,7 @@ export interface CursorEnvelope {
15
15
  issuedAt?: number;
16
16
  /** TTL metadata minted by `CursorRegistry.grant`: wall-clock ms when the cursor expires. */
17
17
  expiresAt?: number;
18
+ purpose?: "checkpoint";
18
19
  position: unknown;
19
20
  direction: string;
20
21
  pageShape: unknown;
@@ -46,6 +47,7 @@ export interface CursorQueryContext {
46
47
  resourceId?: string;
47
48
  direction: string;
48
49
  pageShape: unknown;
50
+ purpose?: "checkpoint";
49
51
  }
50
52
  export declare class CursorError extends Error {
51
53
  readonly code: "cursor_expired" | "invalid_cursor" | "invalid_input" | "resource_gone" | "snapshot_capacity_exceeded";
@@ -64,13 +66,13 @@ export declare class CursorRegistry {
64
66
  private readonly now;
65
67
  constructor(sessionToken: string | Uint8Array, revisions: RevisionStore, now?: () => number);
66
68
  grant(connectionId: string, envelope: CursorEnvelope, resourceKind: string, resourceId: string): Promise<string>;
67
- exchange(cursor: string, connectionId: string, expected: CursorQueryContext, resourceKind: string, resourceId: string): Promise<{
69
+ exchange(cursor: string, connectionId: string, expected: CursorQueryContext, _resourceKind: string, resourceId: string): Promise<{
68
70
  cursor: string;
69
71
  envelope: CursorEnvelope;
70
72
  }>;
71
73
  consume(cursor: string, connectionId: string, expected: CursorQueryContext): CursorEnvelope;
72
74
  release(cursor: string): void;
73
75
  close(): void;
74
- sweep(): void;
76
+ sweep(exceptCursor?: string, at?: number): void;
75
77
  get size(): number;
76
78
  }
@@ -105,6 +105,7 @@ export interface SdkCheckpointRecord {
105
105
  revision: number;
106
106
  generation: number;
107
107
  seq: number;
108
+ idle: boolean;
108
109
  }
109
110
  export declare function isCheckpointRecord(value: unknown): value is SdkCheckpointRecord;
110
111
  export declare class QueryHandlers {
@@ -55,6 +55,7 @@ export declare class RevisionStore {
55
55
  offset: number;
56
56
  } | undefined>;
57
57
  pin(cursorId: string, resourceKind: string, resourceId: string, id: string): Promise<void>;
58
+ transferPin(sourceCursorId: string, replacementCursorId: string): void;
58
59
  unpin(cursorId: string): void;
59
60
  sweep(): void;
60
61
  close(): Promise<void>;
@@ -1,10 +1,29 @@
1
1
  import { type Settings } from "../../config/settings";
2
2
  import type { ExtensionAPI, ExtensionContext } from "../../extensibility/extensions";
3
+ import { type MasterRoleAttestationV2, SessionIndex, type SessionLocatorV2 } from "../broker/session-index";
4
+ import type { SdkPromptTerminalOutcome } from "../prompt-status";
5
+ import { type ReceiptState } from "../receipt-state";
3
6
  import { type TurnResultContent } from "../turn-result";
4
7
  import { SessionSdkHost, type SessionSdkHostOptions } from "./host";
5
8
  import { type SessionSurface } from "./query";
6
9
  import { type SdkCapabilities, type SdkSurfacePolicy } from "./surface-policy";
7
10
  import type { BrokerIndexWriter, SdkFrame } from "./types";
11
+ export type MasterCapabilityReplayState = Map<string, number>;
12
+ export declare function verifyMasterCapabilityFrame(input: {
13
+ frame: {
14
+ nonce: unknown;
15
+ attestationEpoch: unknown;
16
+ capability: unknown;
17
+ };
18
+ expectedCapability: string | undefined;
19
+ expectedEpoch: string | undefined;
20
+ replay: MasterCapabilityReplayState;
21
+ now?: number;
22
+ }): {
23
+ ok: boolean;
24
+ nonce: string;
25
+ attestationEpoch: string;
26
+ };
8
27
  /** Transport-neutral endpoint contract consumed by the SDK session runtime. */
9
28
  export interface SessionSdkTransport {
10
29
  readonly sessionId: string;
@@ -27,6 +46,8 @@ export interface SessionSdkRuntimeOptions extends Omit<SessionSdkHostOptions, "s
27
46
  settings?: Settings;
28
47
  /** Mutable shadow of patched config values merged into query readback. */
29
48
  configOverrides?: Map<string, unknown>;
49
+ /** Stable master lineage identity retained across session switches/branches. */
50
+ masterOwnerSessionId?: string;
30
51
  }
31
52
  export interface SdkOnlyInvocationRecord extends InvocationCorrelation {
32
53
  kind: InvocationKind | "terminal" | "steer";
@@ -39,6 +60,8 @@ export interface SdkOnlyInvocationRecord extends InvocationCorrelation {
39
60
  code: string;
40
61
  message: string;
41
62
  };
63
+ content?: TurnResultContent;
64
+ receiptState?: Exclude<ReceiptState, "absent">;
42
65
  outcome?: unknown;
43
66
  pendingOutcome?: unknown;
44
67
  skillName?: string;
@@ -161,6 +184,8 @@ export interface CreateSdkSessionRuntimeOptions {
161
184
  agentDir: string;
162
185
  /** Lifecycle-owned sessions require broker publication before they become usable. */
163
186
  brokerRegistrationRequired?: boolean;
187
+ /** Trusted broker-issued lifecycle marker bound to lifecycle host index events. */
188
+ lifecycleRequestId?: string;
164
189
  createTransport(input: {
165
190
  sessionId: string;
166
191
  stateRoot: string;
@@ -172,6 +197,12 @@ export interface CreateSdkSessionRuntimeOptions {
172
197
  onSdkRequest?: SessionSdkHostOptions["onRequest"];
173
198
  /** Mutable shadow of patched config values merged into query readback. */
174
199
  configOverrides?: Map<string, unknown>;
200
+ /** In-memory master capability for private broker verification only. */
201
+ masterCapability?: string;
202
+ /** Opaque direct-role epoch this effective host may adopt. */
203
+ masterAttestationEpoch?: string;
204
+ /** Stable master lineage identity retained across session switches/branches. */
205
+ masterOwnerSessionId?: string;
175
206
  /** Private session-owned terminal-abort capabilities; never exposed on ExtensionContext. */
176
207
  terminalAbortSeams?: SdkOnlyTerminalAbortSeams;
177
208
  /** Callback when a frame is admitted to the runtime (test harness). */
@@ -180,6 +211,8 @@ export interface CreateSdkSessionRuntimeOptions {
180
211
  onLifecycleDrainTimeoutForTests?: () => void;
181
212
  /** Test-only observation of bounded failure-diagnostic deduplication state. */
182
213
  onFailureDiagnosticKeyCountForTests?: (count: number) => void;
214
+ /** Test-only observation after a resolved invocation completion is reconciled. */
215
+ onInvocationCompletionReconciledForTests?: (kind: InvocationKind, correlation: InvocationCorrelation) => void;
183
216
  }
184
217
  export interface InvocationCorrelation {
185
218
  commandId: string;
@@ -187,6 +220,14 @@ export interface InvocationCorrelation {
187
220
  }
188
221
  export type InvocationKind = "prompt" | "skill" | "steer";
189
222
  type InvocationStatus = "accepted" | "in_flight" | "terminal_ok" | "failed" | "uncertain";
223
+ type InvocationOutcome = SdkPromptTerminalOutcome;
224
+ type InvocationOutcomeInput = {
225
+ kind: string;
226
+ reason?: unknown;
227
+ code?: unknown;
228
+ message?: unknown;
229
+ provenance?: unknown;
230
+ };
190
231
  export interface InvocationReconciliation {
191
232
  /** Shared v2 reconciliation owner; present for durable terminal admission. */
192
233
  readonly store?: SdkOnlyReconciliationStore;
@@ -197,11 +238,7 @@ export interface InvocationReconciliation {
197
238
  type: "agent_start" | "agent_end";
198
239
  content?: TurnResultContent;
199
240
  hasActivity?: boolean;
200
- outcome?: {
201
- kind: "stopped";
202
- reason: "cancelled";
203
- provenance: "client_cancel";
204
- };
241
+ outcome?: InvocationOutcome;
205
242
  } | {
206
243
  type: "agent_failed";
207
244
  error: unknown;
@@ -224,18 +261,8 @@ export interface InvocationReconciliation {
224
261
  deadlineMaxAt?: number;
225
262
  }>;
226
263
  hydrate(): Promise<void>;
227
- claimPendingOutcome(kind: InvocationKind, correlation: InvocationCorrelation, outcome: {
228
- kind: string;
229
- code: string;
230
- message: string;
231
- provenance?: string;
232
- }): Promise<unknown>;
233
- finalizeOutcome(kind: InvocationKind, correlation: InvocationCorrelation, outcome?: {
234
- kind: string;
235
- code: string;
236
- message: string;
237
- provenance?: string;
238
- }, arg4?: (() => boolean) | {
264
+ claimPendingOutcome(kind: InvocationKind, correlation: InvocationCorrelation, outcome: InvocationOutcomeInput): Promise<InvocationOutcome>;
265
+ finalizeOutcome(kind: InvocationKind, correlation: InvocationCorrelation, outcome?: InvocationOutcomeInput, arg4?: (() => boolean) | {
239
266
  code: string;
240
267
  message: string;
241
268
  }, arg5?: unknown, arg6?: {
@@ -276,6 +303,7 @@ export interface SdkSurfaceFactoryOptions {
276
303
  clientRef?: string;
277
304
  }) => unknown;
278
305
  hostTools?: boolean | (() => boolean);
306
+ getRuntimeHost?: () => SessionSdkHost | undefined;
279
307
  }
280
308
  /** Shared policy, capability, and query-surface factory for every SDK transport. */
281
309
  export interface SdkSurfaceFactory {
@@ -293,6 +321,31 @@ export declare function createSdkSurfaceFactory(options: SdkSurfaceFactoryOption
293
321
  }): SdkSurfaceFactory;
294
322
  /** Register the default-session notification command without loading notification adapters. */
295
323
  export declare function registerSdkOnlyNotificationCommand(api: ExtensionAPI): void;
324
+ export declare function masterAttestationForEffectiveHost(input: {
325
+ masterCapability: string | undefined;
326
+ attestationEpoch: string | undefined;
327
+ ownerSessionId?: string;
328
+ sessionId: string;
329
+ pid: number;
330
+ processIncarnation: string | undefined;
331
+ direct: MasterRoleAttestationV2 | undefined;
332
+ }): MasterRoleAttestationV2 | undefined;
333
+ /**
334
+ * Establish direct master authority for the session currently hosted by this
335
+ * process. Session identity transitions retain the master capability and epoch
336
+ * but require a new direct attestation before their effective endpoint can
337
+ * adopt that authority.
338
+ */
339
+ export declare function reattestMasterSessionIdentity(input: {
340
+ index: SessionIndex;
341
+ locator: SessionLocatorV2;
342
+ masterCapability: string | undefined;
343
+ attestationEpoch: string | undefined;
344
+ ownerSessionId?: string;
345
+ sessionId: string;
346
+ pid: number;
347
+ processIncarnation: string | undefined;
348
+ }): Promise<MasterRoleAttestationV2 | undefined>;
296
349
  /** Install a complete SDK host for a session when notifications are inactive. */
297
350
  export declare function createSdkSessionRuntimeExtension(api: ExtensionAPI, options: CreateSdkSessionRuntimeOptions): void;
298
351
  export {};
@@ -6,3 +6,9 @@ export declare class AgentDirSessionLifecycleClient implements SessionLifecycleC
6
6
  global(operation: SessionLifecycleOperation, input: Record<string, unknown>, options: SessionLifecycleClientRequestOptions): Promise<unknown>;
7
7
  }
8
8
  export declare function createBrokerSessionLifecycleService(agentDir: string): SessionLifecycleService;
9
+ /**
10
+ * Dedicated dispatch for the local master `session.spawn` surface. It shares
11
+ * the lifecycle client's credential boundary but bypasses the generic mutation
12
+ * outcome types: spawn responses are validated by the caller's allowlist.
13
+ */
14
+ export declare function dispatchSpawnGlobal(agentDir: string, input: Record<string, unknown>, idempotencyKey: string, timeoutMs: number): Promise<unknown>;
@@ -1,3 +1,4 @@
1
+ import { type ScopeRequestV1, type SdkSearchResultV1 } from "../broker/session-scope";
1
2
  export type SessionLifecycleOperation = "session.create" | "session.fork" | "session.resume" | "session.close" | "session.delete" | "session.reconcile_uncertain" | "session.list";
2
3
  export interface SessionLifecycleActor {
3
4
  readonly id: string;
@@ -104,6 +105,9 @@ export interface SessionDeleteTarget {
104
105
  export interface SessionListTarget {
105
106
  readonly cwd?: string;
106
107
  readonly resolveSessionId?: string;
108
+ readonly scope?: ScopeRequestV1;
109
+ readonly limit?: number;
110
+ readonly cursor?: string;
107
111
  }
108
112
  interface SessionLifecycleMutationRequestBase<TOperation extends Exclude<SessionLifecycleOperation, "session.list">, TTarget> {
109
113
  readonly operation: TOperation;
@@ -141,7 +145,12 @@ export interface SessionLifecycleListEntry {
141
145
  readonly live?: boolean;
142
146
  readonly endpointGeneration?: number;
143
147
  readonly terminalUncertain?: boolean;
144
- readonly repo?: string;
148
+ readonly cwd?: string;
149
+ readonly locator?: {
150
+ readonly cwd: string;
151
+ readonly worktreeRoot: string | null;
152
+ readonly stateRoot: string;
153
+ };
145
154
  }
146
155
  export interface SessionLifecycleListResult {
147
156
  readonly indexSeq: number;
@@ -149,6 +158,7 @@ export interface SessionLifecycleListResult {
149
158
  readonly warnings: readonly string[];
150
159
  readonly savedSession?: SessionLifecycleSavedSession;
151
160
  }
161
+ export type SessionScopedListResult = SdkSearchResultV1;
152
162
  export interface SessionCreateResult {
153
163
  readonly ok: true;
154
164
  readonly operation: "session.create";
@@ -182,7 +192,7 @@ export interface SessionReconcileUncertainResult {
182
192
  export interface SessionListSuccessResult {
183
193
  readonly ok: true;
184
194
  readonly operation: "session.list";
185
- readonly result: SessionLifecycleListResult;
195
+ readonly result: SessionLifecycleListResult | SessionScopedListResult;
186
196
  }
187
197
  export interface SessionLifecycleError {
188
198
  readonly code: string;
@@ -229,6 +239,7 @@ export type SessionListFailure = {
229
239
  readonly operation: "session.list";
230
240
  readonly certainty: SessionLifecycleCertainty;
231
241
  readonly error: SessionLifecycleError;
242
+ readonly result?: SessionScopedListResult;
232
243
  };
233
244
  export type SessionCreateOutcome = SessionCreateResult | SessionCreateFailure;
234
245
  export type SessionForkOutcome = SessionForkResult | SessionForkFailure;
@@ -254,7 +265,8 @@ export declare function validateSessionLifecycleMutationRequest(request: unknown
254
265
  export declare class SessionLifecycleService {
255
266
  #private;
256
267
  constructor(client: SessionLifecycleClient);
257
- execute(request: SessionLifecycleMutationRequest): Promise<SessionCreateOutcome | SessionForkOutcome | SessionResumeOutcome | SessionCloseOutcome | SessionDeleteOutcome | SessionReconcileUncertainOutcome>;
268
+ scopedList(scope: ScopeRequestV1, limit?: number, cursor?: string): Promise<SessionListOutcome>;
269
+ execute(request: SessionLifecycleMutationRequest, idempotencyKeyOverride?: string): Promise<SessionCreateOutcome | SessionForkOutcome | SessionResumeOutcome | SessionCloseOutcome | SessionDeleteOutcome | SessionReconcileUncertainOutcome>;
258
270
  executeWithIdempotencyKey(request: SessionLifecycleMutationRequest, idempotencyKey: string): Promise<SessionCreateOutcome | SessionForkOutcome | SessionResumeOutcome | SessionCloseOutcome | SessionDeleteOutcome | SessionReconcileUncertainOutcome>;
259
271
  create(request: Omit<SessionCreateRequest, "operation">): Promise<SessionCreateOutcome>;
260
272
  fork(request: Omit<SessionForkRequest, "operation">): Promise<SessionForkOutcome>;
@@ -1,4 +1,4 @@
1
- import type { AgentSession } from "../session/agent-session";
1
+ import { type AgentSession } from "../session/agent-session";
2
2
  import { type CreateAgentSessionOptions } from "./session";
3
3
  import { SdkStartupCapability, type SdkStartupFailure, SdkStartupRollbackTracker } from "./startup-capability";
4
4
  export type CreateLifecycleAgentSessionResult = {
@@ -48,6 +48,8 @@ export type CreateLifecycleAgentSessionOptions = Omit<CreateAgentSessionOptions,
48
48
  * a prepared signal instead of readiness until it is explicitly activated.
49
49
  */
50
50
  readiness?: "immediate" | "deferred";
51
+ /** Broker-issued lifecycle request identity published with host registration. */
52
+ lifecycleRequestId?: string;
51
53
  };
52
54
  /** Internal lifecycle-only session construction with an owner-bound SDK startup result. */
53
55
  export declare function createLifecycleAgentSession(options?: CreateLifecycleAgentSessionOptions): Promise<CreateLifecycleAgentSessionResult>;
@@ -1,5 +1,6 @@
1
1
  import type { KindAwareReconciliation } from "./bus/kind-aware-reconciliation";
2
2
  import type { InvocationCorrelation, InvocationReconciliation } from "./host/session-runtime";
3
+ import type { SdkPromptTerminalOutcome } from "./prompt-status";
3
4
  import type { TurnResultContent } from "./turn-result";
4
5
  type DeadlineReconciliation = InvocationReconciliation | KindAwareReconciliation;
5
6
  export type PromptDeadlineOutcome = {
@@ -11,11 +12,7 @@ export type PromptDeadlineOutcome = {
11
12
  export interface PromptTerminalTransitionEvidence {
12
13
  content?: TurnResultContent;
13
14
  hasActivity?: boolean;
14
- outcome?: {
15
- kind: "stopped";
16
- reason: "cancelled";
17
- provenance: "client_cancel";
18
- };
15
+ outcome?: SdkPromptTerminalOutcome;
19
16
  }
20
17
  export declare class PromptDeadlineManager {
21
18
  #private;
@@ -14,4 +14,6 @@ export interface TerminalReceiptState {
14
14
  }
15
15
  export declare function reportableReceipt({ text, artifactPath }: ReceiptSource): boolean;
16
16
  export declare function receiptStateForTerminal(source: ReceiptSource): Extract<ReceiptState, "present" | "missing">;
17
+ /** Terminal receipt evidence is monotonic: present > missing > unknown. */
18
+ export declare function reduceReceiptState(existing: Exclude<ReceiptState, "absent"> | undefined, incoming: Exclude<ReceiptState, "absent"> | undefined): Exclude<ReceiptState, "absent"> | undefined;
17
19
  export declare function reduceTerminalReceiptState(input: TerminalReceiptInput): TerminalReceiptState;
@@ -117,10 +117,12 @@ export interface SessionRouterClient {
117
117
  send(frame: Record<string, unknown>): void;
118
118
  }
119
119
  /** One frame after the caller's envelope/payload identity correlation. */
120
+ /** One frame after the caller's envelope/payload identity correlation. */
120
121
  export interface SessionRouterFrame {
121
122
  readonly body: Record<string, unknown>;
122
123
  readonly name: string | undefined;
123
124
  readonly sessionId: string | undefined;
125
+ readonly revision?: number;
124
126
  readonly generation: number | undefined;
125
127
  readonly commandId?: string;
126
128
  readonly turnId?: string;
@@ -144,6 +146,8 @@ export interface SessionRouterDeps {
144
146
  onAttachment?: (attachment: SessionAttachment) => Promise<void> | void;
145
147
  /** Called only after the opaque capability becomes externally current. */
146
148
  onAttachmentReady?: (attachment: SessionAttachment) => Promise<void> | void;
149
+ /** Called before deferred replay may perform provider-facing mutations. */
150
+ onReplayReady?: () => Promise<void> | void;
147
151
  /** Called when the Broker index no longer reports an attached session as live. */
148
152
  onSessionRemoved?: (attachment: SessionAttachment, reason?: "removed" | "replaced" | "replaced_same_generation") => Promise<void> | void;
149
153
  /** Narrow provider surface for notification consumers such as Telegram. */
@@ -164,6 +168,8 @@ export interface SessionRouterDeps {
164
168
  export type SessionRouterProviderDeps = Pick<SessionRouterDeps, "createClient" | "createIndex" | "createBrokerClient" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout" | "onReconciled">;
165
169
  export interface SessionRouterOptions {
166
170
  agentDir: string;
171
+ /** Limits attachment to exact ids selected by a Broker-scoped operation. */
172
+ sessionIds?: readonly string[];
167
173
  deps?: SessionRouterDeps;
168
174
  /** Runtime-specific identity validation; Router supplies a conservative fallback. */
169
175
  correlateFrame?: SessionRouterFrameCorrelator;
@@ -7,6 +7,7 @@ import { ModelRegistry } from "../config/model-registry";
7
7
  import { type ScopedModelSelection } from "../config/model-resolver";
8
8
  import { type PromptTemplate } from "../config/prompt-templates";
9
9
  import { Settings, type SkillsSettings } from "../config/settings";
10
+ import type { MasterModeContext } from "../master-mode/context";
10
11
  import type { BashRestrictionProfile } from "../tools/bash-allowed-prefixes";
11
12
  import "../discovery";
12
13
  import type { CustomCommandsLoadResult } from "../extensibility/custom-commands";
@@ -176,6 +177,8 @@ export interface CreateAgentSessionOptions {
176
177
  * @internal CLI-only startup optimization; SDK callers retain synchronous loading by default.
177
178
  */
178
179
  deferMcpConfigStartup?: boolean;
180
+ /** Process-local master authority. Never persist or pass to lifecycle children. */
181
+ masterModeContext?: MasterModeContext;
179
182
  /**
180
183
  * Defer memory backend startup until the caller has applied startup model profiles.
181
184
  * @internal CLI-only ordering guard; SDK callers retain immediate startup by default.
@@ -384,4 +387,17 @@ export declare function createPluginHooksExtension(hooks: ConstrainedPluginHook[
384
387
  export declare function resolveIntentTracingEnabled(intentTracingSetting: boolean | undefined, options: {
385
388
  subSession: boolean;
386
389
  }): boolean;
390
+ /**
391
+ * Order candidates so each known provider's curated default model is tried
392
+ * before the rest of the catalog.
393
+ *
394
+ * Provider catalogs are not ranked by fitness — a withdrawn model whose ID
395
+ * carries an older date suffix sorts ahead of its current replacement — so
396
+ * picking the first credentialed entry can start an unconfigured install on a
397
+ * model the provider no longer serves. `DEFAULT_MODEL_PER_PROVIDER` is the
398
+ * curated table `findInitialModel` already sweeps for the same purpose;
399
+ * reusing it keeps both unconfigured paths on one source of truth. Candidates
400
+ * that are not a provider default keep their original relative order.
401
+ */
402
+ export declare function orderByProviderDefaultFirst(candidates: readonly Model[], providerOrder?: readonly string[]): Model[];
387
403
  export declare function createAgentSession(options?: CreateAgentSessionOptions): Promise<CreateAgentSessionResult>;
@@ -49,6 +49,7 @@ export declare class SdkStartupCapability {
49
49
  #private;
50
50
  readonly rollback?: SdkStartupRollbackTracker | undefined;
51
51
  readonly readiness: "immediate" | "deferred";
52
+ readonly lifecycleRequestId?: string | undefined;
52
53
  get cancelled(): boolean;
53
54
  cancel(): void;
54
55
  /**
@@ -57,7 +58,7 @@ export declare class SdkStartupCapability {
57
58
  * environment so bus wiring can never mistake an inherited process-global
58
59
  * flag for a broker-managed preparation.
59
60
  */
60
- constructor(rollback?: SdkStartupRollbackTracker | undefined, readiness?: "immediate" | "deferred");
61
+ constructor(rollback?: SdkStartupRollbackTracker | undefined, readiness?: "immediate" | "deferred", lifecycleRequestId?: string | undefined);
61
62
  normalizeFailure(phase: SdkStartupPhase, reason: SdkStartupReason, error?: unknown): SdkStartupFailure;
62
63
  get result(): SdkStartupResult | undefined;
63
64
  get promise(): Promise<SdkStartupResult>;
@@ -22,6 +22,7 @@ export interface TurnResultError {
22
22
  code: string;
23
23
  message: string;
24
24
  }
25
+ export type TurnResultReceiptState = "absent" | "present" | "missing" | "unknown";
25
26
  export interface TurnResultPage {
26
27
  status: TurnResultStatus;
27
28
  kind?: "prompt" | "skill";
@@ -31,7 +32,12 @@ export interface TurnResultPage {
31
32
  acceptedAt?: number;
32
33
  startedAt?: number;
33
34
  terminalAt?: number;
35
+ receiptState?: TurnResultReceiptState;
36
+ outcome?: unknown;
34
37
  content?: TurnResultContent;
35
38
  error?: TurnResultError;
36
39
  }
37
40
  export declare function sanitizeTurnResultContent(text: unknown): TurnResultContent | undefined;
41
+ export declare function reportableTurnResultContent(content: TurnResultContent | undefined): boolean;
42
+ /** First reportable invocation-owned content wins; blank evidence remains replaceable. */
43
+ export declare function reduceTurnResultContent(existing: TurnResultContent | undefined, incoming: TurnResultContent | undefined): TurnResultContent | undefined;