@gajae-code/coding-agent 0.15.5 → 0.16.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 (272) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/dist/types/async/job-manager.d.ts +83 -0
  3. package/dist/types/cli/args.d.ts +2 -0
  4. package/dist/types/cli/auth-gateway-cli.d.ts +17 -0
  5. package/dist/types/cli/model-presets-cli.d.ts +9 -0
  6. package/dist/types/cli/root-flags.d.ts +14 -0
  7. package/dist/types/cli/update-cli.d.ts +15 -0
  8. package/dist/types/cli.d.ts +7 -0
  9. package/dist/types/commands/auth-gateway.d.ts +3 -0
  10. package/dist/types/commands/gc.d.ts +13 -0
  11. package/dist/types/commands/launch.d.ts +10 -0
  12. package/dist/types/commands/model-presets.d.ts +21 -0
  13. package/dist/types/config/autorouting-tier-map.d.ts +120 -0
  14. package/dist/types/config/file-lock.d.ts +54 -2
  15. package/dist/types/config/internal/model-preset-registry-test-state.d.ts +4 -0
  16. package/dist/types/config/internal/model-preset-registry-test-support.d.ts +3 -0
  17. package/dist/types/config/keybindings.d.ts +3 -2
  18. package/dist/types/config/model-preset-registry.d.ts +368 -0
  19. package/dist/types/config/model-profile-activation.d.ts +39 -0
  20. package/dist/types/config/model-profiles.d.ts +5 -3
  21. package/dist/types/config/model-registry.d.ts +17 -5
  22. package/dist/types/config/settings-schema.d.ts +19 -1
  23. package/dist/types/config/settings.d.ts +2 -0
  24. package/dist/types/coordinator-mcp/model-preset.d.ts +7 -5
  25. package/dist/types/coordinator-mcp/projection-scan.d.ts +54 -0
  26. package/dist/types/crash/record-loader.d.ts +15 -0
  27. package/dist/types/extensibility/extensions/types.d.ts +2 -5
  28. package/dist/types/gjc-runtime/empty-delete-gc.d.ts +58 -0
  29. package/dist/types/gjc-runtime/gc-runtime.d.ts +2 -0
  30. package/dist/types/gjc-runtime/launch-worktree-reservation.d.ts +21 -0
  31. package/dist/types/gjc-runtime/managed-owner-supervisor.d.ts +2 -0
  32. package/dist/types/gjc-runtime/session-state-lock.d.ts +35 -6
  33. package/dist/types/gjc-runtime/session-state-sidecar.d.ts +72 -1
  34. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +1 -0
  35. package/dist/types/gjc-runtime/tmux-sessions.d.ts +27 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/main.d.ts +3 -1
  38. package/dist/types/master-mode/context.d.ts +21 -0
  39. package/dist/types/master-mode/first-request.d.ts +34 -0
  40. package/dist/types/master-mode/snapshot.d.ts +32 -0
  41. package/dist/types/modes/components/frictionless-onboarding-selector.d.ts +10 -0
  42. package/dist/types/modes/components/jobs-overlay-model.d.ts +4 -2
  43. package/dist/types/modes/components/oauth-selector.d.ts +1 -0
  44. package/dist/types/modes/components/status-line/model-name.d.ts +18 -0
  45. package/dist/types/modes/components/status-line/priority-row.d.ts +34 -0
  46. package/dist/types/modes/components/status-line/segments.d.ts +10 -0
  47. package/dist/types/modes/jobs-observer.d.ts +36 -0
  48. package/dist/types/modes/print-mode.d.ts +17 -0
  49. package/dist/types/modes/ui-language.d.ts +7 -1
  50. package/dist/types/sdk/broker/broker.d.ts +80 -1
  51. package/dist/types/sdk/broker/endpoint-authority.d.ts +24 -0
  52. package/dist/types/sdk/broker/index.d.ts +3 -0
  53. package/dist/types/sdk/broker/lifecycle.d.ts +26 -0
  54. package/dist/types/sdk/broker/master-capability.d.ts +10 -0
  55. package/dist/types/sdk/broker/session-index.d.ts +40 -11
  56. package/dist/types/sdk/broker/session-scope.d.ts +72 -0
  57. package/dist/types/sdk/broker/spawn-authority.d.ts +201 -0
  58. package/dist/types/sdk/broker/spawn-substrate.d.ts +30 -0
  59. package/dist/types/sdk/broker/state-version.d.ts +4 -1
  60. package/dist/types/sdk/broker/worktree-occupancy.d.ts +28 -0
  61. package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -0
  62. package/dist/types/sdk/bus/index.d.ts +6 -0
  63. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +3 -0
  64. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +4 -0
  65. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
  66. package/dist/types/sdk/cli/index.d.ts +1 -0
  67. package/dist/types/sdk/cli/master-cli.d.ts +63 -0
  68. package/dist/types/sdk/cli/rows.d.ts +4 -3
  69. package/dist/types/sdk/cli/session-cli.d.ts +18 -2
  70. package/dist/types/sdk/client/client.d.ts +3 -2
  71. package/dist/types/sdk/client/discovery.d.ts +1 -0
  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/host.d.ts +10 -0
  77. package/dist/types/sdk/host/model-pin.d.ts +7 -2
  78. package/dist/types/sdk/host/sdk-run-capability.d.ts +1 -0
  79. package/dist/types/sdk/host/session-runtime.d.ts +67 -1
  80. package/dist/types/sdk/lifecycle/broker-client.d.ts +6 -0
  81. package/dist/types/sdk/lifecycle/service.d.ts +15 -3
  82. package/dist/types/sdk/lifecycle-session.d.ts +2 -0
  83. package/dist/types/sdk/prompt-deadline-manager.d.ts +11 -1
  84. package/dist/types/sdk/protocol/adapter-validation.d.ts +2 -0
  85. package/dist/types/sdk/router/session-router.d.ts +11 -0
  86. package/dist/types/sdk/session.d.ts +16 -0
  87. package/dist/types/sdk/startup-capability.d.ts +2 -1
  88. package/dist/types/session/account-inventory.d.ts +1 -0
  89. package/dist/types/session/agent-session.d.ts +24 -7
  90. package/dist/types/session/credential-store-errors.d.ts +1 -0
  91. package/dist/types/session/fold-coordinator.d.ts +201 -0
  92. package/dist/types/session/sdk-run-capability-internal.d.ts +7 -0
  93. package/dist/types/session/sdk-run-capability.d.ts +2 -0
  94. package/dist/types/session/session-manager.d.ts +65 -0
  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/telemetry/control.d.ts +11 -0
  98. package/dist/types/telemetry/events.d.ts +20 -0
  99. package/dist/types/telemetry/index.d.ts +3 -0
  100. package/dist/types/telemetry/transport.d.ts +22 -0
  101. package/dist/types/tools/bash-interactive.d.ts +23 -0
  102. package/dist/types/tools/bash.d.ts +4 -0
  103. package/dist/types/tools/gh.d.ts +8 -0
  104. package/dist/types/tools/index.d.ts +10 -5
  105. package/dist/types/web/search/providers/base.d.ts +9 -4
  106. package/dist/types/web/search/providers/xai.d.ts +2 -1
  107. package/dist/types/web/search/types.d.ts +14 -0
  108. package/package.json +10 -7
  109. package/scripts/generate-hotkeys-docs.ts +4 -0
  110. package/scripts/generate-sdk-operation-inventory.ts +9 -3
  111. package/scripts/verify-gjc-sdk-canonicalization.ts +35 -1
  112. package/src/async/job-manager.ts +671 -39
  113. package/src/cli/accounts-cli.ts +9 -5
  114. package/src/cli/args.ts +17 -0
  115. package/src/cli/auth-broker-cli.ts +40 -12
  116. package/src/cli/auth-gateway-cli.ts +273 -97
  117. package/src/cli/config-cli.ts +2 -2
  118. package/src/cli/fast-help.ts +4 -0
  119. package/src/cli/model-presets-cli.ts +100 -0
  120. package/src/cli/root-flags.ts +5 -0
  121. package/src/cli/update-cli.ts +117 -16
  122. package/src/cli.ts +6 -2
  123. package/src/commands/auth-gateway.ts +12 -8
  124. package/src/commands/gc.ts +19 -0
  125. package/src/commands/launch.ts +86 -18
  126. package/src/commands/model-presets.ts +24 -0
  127. package/src/commands/sdk.ts +113 -21
  128. package/src/config/autorouting-tier-map.ts +44 -0
  129. package/src/config/file-lock-gc.ts +9 -4
  130. package/src/config/file-lock.ts +890 -99
  131. package/src/config/internal/model-preset-registry-test-state.ts +28 -0
  132. package/src/config/internal/model-preset-registry-test-support.ts +11 -0
  133. package/src/config/keybindings.ts +6 -2
  134. package/src/config/model-preset-registry.ts +2795 -0
  135. package/src/config/model-profile-activation.ts +115 -28
  136. package/src/config/model-profile-contract.ts +4 -1
  137. package/src/config/model-profiles.ts +56 -14
  138. package/src/config/model-registry.ts +1044 -122
  139. package/src/config/model-resolver.ts +5 -0
  140. package/src/config/settings-schema.ts +19 -1
  141. package/src/config/settings.ts +11 -1
  142. package/src/coordinator-mcp/model-preset.ts +32 -17
  143. package/src/coordinator-mcp/projection-scan.ts +592 -0
  144. package/src/coordinator-mcp/question-state.ts +9 -11
  145. package/src/coordinator-mcp/server.ts +111 -42
  146. package/src/coordinator-mcp/session-reaper.ts +9 -3
  147. package/src/crash/index-store.ts +2 -0
  148. package/src/crash/record-loader.ts +10 -0
  149. package/src/extensibility/extensions/loader.ts +0 -1
  150. package/src/extensibility/extensions/types.ts +2 -3
  151. package/src/extensibility/gjc-plugins/runtime-adapters.ts +1 -0
  152. package/src/gjc-runtime/empty-delete-gc.ts +301 -0
  153. package/src/gjc-runtime/gc-render.ts +29 -0
  154. package/src/gjc-runtime/gc-runtime.ts +174 -11
  155. package/src/gjc-runtime/launch-worktree-reservation.ts +242 -0
  156. package/src/gjc-runtime/managed-owner-supervisor.ts +63 -51
  157. package/src/gjc-runtime/session-state-lock.ts +1321 -147
  158. package/src/gjc-runtime/session-state-sidecar.ts +1004 -25
  159. package/src/gjc-runtime/tmux-owner-isolation-cli.ts +4 -7
  160. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -2
  161. package/src/gjc-runtime/tmux-sessions.ts +252 -13
  162. package/src/hooks/skill-state.ts +6 -0
  163. package/src/index.ts +1 -0
  164. package/src/internal-urls/docs-index.generated.ts +14 -13
  165. package/src/internal-urls/issue-pr-protocol.ts +4 -2
  166. package/src/lsp/config.ts +4 -3
  167. package/src/lsp/path-trust.ts +12 -6
  168. package/src/main.ts +66 -4
  169. package/src/master-mode/context.ts +50 -0
  170. package/src/master-mode/first-request.ts +65 -0
  171. package/src/master-mode/snapshot.ts +205 -0
  172. package/src/modes/acp/acp-agent.ts +616 -161
  173. package/src/modes/components/footer.ts +4 -2
  174. package/src/modes/components/frictionless-onboarding-selector.ts +48 -2
  175. package/src/modes/components/jobs-overlay-model.ts +99 -16
  176. package/src/modes/components/model-selector.ts +158 -18
  177. package/src/modes/components/oauth-selector.ts +6 -1
  178. package/src/modes/components/settings-selector.ts +1 -0
  179. package/src/modes/components/status-line/model-name.ts +53 -0
  180. package/src/modes/components/status-line/priority-row.ts +107 -0
  181. package/src/modes/components/status-line/segments.ts +29 -10
  182. package/src/modes/components/tool-status-header.ts +151 -15
  183. package/src/modes/controllers/extension-ui-controller.ts +1 -1
  184. package/src/modes/controllers/input-controller.ts +51 -6
  185. package/src/modes/controllers/selector-controller.ts +191 -96
  186. package/src/modes/interactive-mode.ts +14 -1
  187. package/src/modes/jobs-observer.ts +149 -16
  188. package/src/modes/print-mode.ts +64 -0
  189. package/src/modes/runtime-init.ts +1 -1
  190. package/src/modes/ui-language.ts +49 -2
  191. package/src/modes/utils/injected-user-submission.ts +15 -1
  192. package/src/prompts/system/master-mode.md +28 -0
  193. package/src/prompts/tools/bash.md +2 -2
  194. package/src/prompts/tools/fold-receipt.md +3 -0
  195. package/src/prompts/tools/job.md +1 -1
  196. package/src/sdk/acp/adapter.ts +17 -2
  197. package/src/sdk/broker/broker.ts +1671 -34
  198. package/src/sdk/broker/endpoint-authority.ts +86 -0
  199. package/src/sdk/broker/ensure.ts +5 -0
  200. package/src/sdk/broker/index.ts +3 -0
  201. package/src/sdk/broker/lifecycle.ts +217 -46
  202. package/src/sdk/broker/master-capability.ts +232 -0
  203. package/src/sdk/broker/session-index.ts +121 -17
  204. package/src/sdk/broker/session-scope.ts +272 -0
  205. package/src/sdk/broker/spawn-authority.ts +1031 -0
  206. package/src/sdk/broker/spawn-substrate.ts +548 -0
  207. package/src/sdk/broker/state-version.ts +26 -14
  208. package/src/sdk/broker/transport.ts +1 -0
  209. package/src/sdk/broker/worktree-occupancy.ts +90 -0
  210. package/src/sdk/bus/chat-daemon-control.ts +5 -2
  211. package/src/sdk/bus/chat-daemon-runtime.ts +46 -5
  212. package/src/sdk/bus/index.ts +51 -4
  213. package/src/sdk/bus/kind-aware-reconciliation.ts +36 -6
  214. package/src/sdk/bus/prompt-reconciliation.ts +28 -4
  215. package/src/sdk/bus/slack-conversation.ts +5 -1
  216. package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
  217. package/src/sdk/cli/index.ts +1 -0
  218. package/src/sdk/cli/master-cli.ts +259 -0
  219. package/src/sdk/cli/rows.ts +11 -8
  220. package/src/sdk/cli/session-cli.ts +276 -6
  221. package/src/sdk/client/client.ts +14 -8
  222. package/src/sdk/client/discovery.ts +3 -1
  223. package/src/sdk/host/control/dispatch.ts +101 -37
  224. package/src/sdk/host/control/index.ts +2 -0
  225. package/src/sdk/host/control/operations.ts +2 -0
  226. package/src/sdk/host/control/runtime-gate.ts +203 -11
  227. package/src/sdk/host/host.ts +27 -2
  228. package/src/sdk/host/model-pin.ts +185 -25
  229. package/src/sdk/host/sdk-run-capability.ts +1 -0
  230. package/src/sdk/host/session-runtime.test.ts +581 -43
  231. package/src/sdk/host/session-runtime.ts +655 -101
  232. package/src/sdk/lifecycle/broker-client.ts +28 -0
  233. package/src/sdk/lifecycle/service.ts +279 -20
  234. package/src/sdk/lifecycle-session.ts +10 -2
  235. package/src/sdk/prompt-deadline-manager.ts +16 -1
  236. package/src/sdk/protocol/adapter-validation.ts +27 -0
  237. package/src/sdk/protocol/operation-inventory.generated.json +53 -2
  238. package/src/sdk/protocol/operation-registry.ts +17 -4
  239. package/src/sdk/router/session-router.ts +294 -154
  240. package/src/sdk/session.ts +440 -167
  241. package/src/sdk/startup-capability.ts +1 -0
  242. package/src/session/account-inventory.ts +27 -11
  243. package/src/session/agent-session.ts +1292 -180
  244. package/src/session/blob-store.ts +15 -5
  245. package/src/session/credential-store-errors.ts +2 -0
  246. package/src/session/fold-coordinator.ts +433 -0
  247. package/src/session/internal/managed-session-storage.ts +153 -78
  248. package/src/session/sdk-run-capability-internal.ts +15 -0
  249. package/src/session/sdk-run-capability.ts +2 -0
  250. package/src/session/session-manager.ts +342 -28
  251. package/src/session/yield-queue.ts +24 -10
  252. package/src/setup/frictionless-onboarding.ts +2 -0
  253. package/src/setup/provider-presets.json +1 -1
  254. package/src/slash-commands/helpers/credential-switch.ts +6 -1
  255. package/src/task/executor.ts +19 -3
  256. package/src/telemetry/control.ts +26 -0
  257. package/src/telemetry/events.ts +1268 -0
  258. package/src/telemetry/index.ts +3 -0
  259. package/src/telemetry/transport.ts +87 -0
  260. package/src/tools/bash-interactive.ts +182 -85
  261. package/src/tools/bash.ts +1028 -109
  262. package/src/tools/gh.ts +104 -48
  263. package/src/tools/github-cache.ts +2 -2
  264. package/src/tools/index.ts +11 -5
  265. package/src/tools/tool-catalog.generated.ts +1 -1
  266. package/src/web/search/provider.ts +120 -11
  267. package/src/web/search/providers/anthropic.ts +89 -17
  268. package/src/web/search/providers/base.ts +9 -4
  269. package/src/web/search/providers/gemini.ts +87 -15
  270. package/src/web/search/providers/openai-compatible.ts +23 -8
  271. package/src/web/search/providers/xai.ts +98 -12
  272. package/src/web/search/types.ts +16 -0
@@ -219,6 +219,12 @@ export declare const SETTINGS_SCHEMA: {
219
219
  readonly description: "Hard maximum runtime for an SDK prompt from acceptance, bounding progress-aware renewals.";
220
220
  readonly validate: (value: number) => boolean;
221
221
  };
222
+ readonly "sdk.masterOrphanGraceMs": {
223
+ readonly type: "number";
224
+ readonly default: 120000;
225
+ readonly description: "Grace period before a master-spawned child orphaned by confirmed master loss is closed.";
226
+ readonly validate: (value: number) => boolean;
227
+ };
222
228
  readonly "notifications.enabled": {
223
229
  readonly type: "boolean";
224
230
  readonly default: false;
@@ -604,7 +610,7 @@ export declare const SETTINGS_SCHEMA: {
604
610
  };
605
611
  readonly "ui.language": {
606
612
  readonly type: "enum";
607
- readonly values: readonly ["en", "ko", "ja"];
613
+ readonly values: readonly ["en", "ko", "zh", "ja"];
608
614
  readonly default: "en";
609
615
  readonly ui: {
610
616
  readonly tab: "appearance";
@@ -616,6 +622,9 @@ export declare const SETTINGS_SCHEMA: {
616
622
  }, {
617
623
  readonly value: "ko";
618
624
  readonly label: "Korean (한국어)";
625
+ }, {
626
+ readonly value: "zh";
627
+ readonly label: "Chinese (简体中文)";
619
628
  }, {
620
629
  readonly value: "ja";
621
630
  readonly label: "Japanese (日本語)";
@@ -1888,6 +1897,15 @@ export declare const SETTINGS_SCHEMA: {
1888
1897
  }];
1889
1898
  };
1890
1899
  };
1900
+ readonly "telemetry.enabled": {
1901
+ readonly type: "boolean";
1902
+ readonly default: false;
1903
+ readonly ui: {
1904
+ readonly tab: "interaction";
1905
+ readonly label: "Anonymous Usage Telemetry";
1906
+ readonly description: "Send minimal allowlisted update and adoption events. Disabled by default; no prompts, paths, environment, identity, or arbitrary errors are collected.";
1907
+ };
1908
+ };
1891
1909
  readonly "starReminder.enabled": {
1892
1910
  readonly type: "boolean";
1893
1911
  readonly default: true;
@@ -145,6 +145,8 @@ export declare class Settings implements NotificationSettingsReader {
145
145
  onChanged(listener: (path: SettingPath) => void): () => void;
146
146
  /** Whether durable settings mutations are permitted for the loaded configuration. */
147
147
  canWriteDurableConfig(): boolean;
148
+ /** Whether this instance can publish a mutation to a durable config file. */
149
+ canPersistDurableConfig(): boolean;
148
150
  /**
149
151
  * Set a setting value (sync).
150
152
  * Updates global settings and reserves its background persistence slot before
@@ -2,20 +2,22 @@ export interface CoordinatorModelProfile {
2
2
  name: string;
3
3
  }
4
4
  /**
5
- * Loads the merged built-in + custom model-profile names from `models.yml`
5
+ * Loads the merged embedded + accepted registry + custom model-profile names
6
6
  * without loading the session-host model registry. The child still owns
7
7
  * profile activation; this validates the selection before session creation.
8
8
  */
9
9
  export type CoordinatorModelProfileLoader = () => Map<string, CoordinatorModelProfile> | Promise<Map<string, CoordinatorModelProfile>>;
10
10
  /**
11
- * Thrown by the default loader when `models.yml` exists but is invalid or
12
- * unreadable. This lets the resolver fail closed with a distinct, stable reason
13
- * instead of silently collapsing a broken registry to the built-ins-only set
14
- * (which would misreport a caller's valid custom profile as unknown).
11
+ * Thrown by the default loader when `models.yml` or the accepted preset
12
+ * registry is invalid or unreadable. This lets the resolver fail closed with a
13
+ * distinct, stable reason instead of silently collapsing a broken registry to
14
+ * the built-ins-only set (which would misreport a caller's valid custom
15
+ * profile as unknown).
15
16
  */
16
17
  export declare class CoordinatorModelProfileRegistryError extends Error {
17
18
  constructor(cause?: unknown);
18
19
  }
20
+ export declare function createCoordinatorModelProfileLoader(agentDir: string): CoordinatorModelProfileLoader;
19
21
  export declare const loadCoordinatorModelProfiles: CoordinatorModelProfileLoader;
20
22
  export type CoordinatorMpresetResolution = {
21
23
  ok: true;
@@ -0,0 +1,54 @@
1
+ /** Test-only platform seam; production always follows the host platform. */
2
+ export declare const ProjectionScanTestHooks: {
3
+ platform?: NodeJS.Platform;
4
+ };
5
+ /** Post-filter parse-candidate cap. Exhaustion returns an explicit incomplete result. */
6
+ export declare const COORDINATOR_JSON_SCAN_CAP = 10000;
7
+ /** Number of fresh authoritative attempts allowed for a scan that observed churn. */
8
+ export declare const COORDINATOR_JSON_SCAN_RETRY_ATTEMPTS = 3;
9
+ export interface ProjectionScanStat {
10
+ size: number | bigint;
11
+ dev?: number | bigint;
12
+ ino?: number | bigint;
13
+ nlink?: number | bigint;
14
+ mtimeNs?: number | bigint;
15
+ ctimeNs?: number | bigint;
16
+ isDirectory?(): boolean;
17
+ isFile(): boolean;
18
+ isSymbolicLink(): boolean;
19
+ }
20
+ export interface ProjectionScanFs {
21
+ readdir(dir: string): Promise<string[]>;
22
+ lstat(file: string): Promise<ProjectionScanStat>;
23
+ readFile(file: string, encoding: "utf8", expected?: ProjectionScanStat): Promise<string>;
24
+ /** Optional descriptor-bound reader used by the production filesystem. */
25
+ readFileSafe?: (file: string, encoding: "utf8", expected?: ProjectionScanStat) => Promise<string>;
26
+ /** Optional pinned directory authority used for enumeration and every child operation. */
27
+ openDirectory?: (dir: string) => Promise<ProjectionScanDirectory>;
28
+ }
29
+ export interface ProjectionScanDirectory {
30
+ readonly stat: ProjectionScanStat;
31
+ readdir(): Promise<string[]>;
32
+ lstat(entry: string): Promise<ProjectionScanStat>;
33
+ readFile(entry: string, encoding: "utf8", expected?: ProjectionScanStat): Promise<string>;
34
+ close(): Promise<void>;
35
+ }
36
+ export interface ProjectionScanResult {
37
+ values: unknown[];
38
+ parsed: number;
39
+ capped: boolean;
40
+ skippedDebris: number;
41
+ skippedEmpty: number;
42
+ /** Candidates that changed or disappeared after enumeration. */
43
+ raced: number;
44
+ /** True when the scan cannot be authoritative for its caller. */
45
+ incomplete: boolean;
46
+ }
47
+ export declare function isCoordinatorScanDebrisName(name: string): boolean;
48
+ export declare function listCoordinatorJsonFiles(dir: string, io?: ProjectionScanFs, cap?: number): Promise<ProjectionScanResult>;
49
+ /**
50
+ * Retry only scans invalidated by observed directory/file churn. A candidate cap,
51
+ * unsupported authority, parse error, or any other failure remains fail-closed.
52
+ * Each attempt acquires a new authority, so no partial result crosses attempts.
53
+ */
54
+ export declare function listCoordinatorJsonFilesWithRetry(dir: string, io?: ProjectionScanFs, cap?: number, maxAttempts?: number): Promise<ProjectionScanResult>;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Crash-log record recovery.
3
+ *
4
+ * The crash log is an append-only text file written by concurrent processes; it
5
+ * is explicitly **not** a parseable database. The field corpus contains at least
6
+ * one interleaved record (two headers merged onto one line), and throwable text
7
+ * is arbitrary multiline content. Recovery therefore trusts only a complete
8
+ * v1 record whose terminal identity line matches a fingerprint recomputed from
9
+ * that record's own header and stack.
10
+ *
11
+ * Records written before that line existed are `unmatchable` and are never
12
+ * offered for reporting — no retroactive mining is attempted or claimed.
13
+ */
14
+ import { type CrashProvenance } from "@gajae-code/utils";
1
15
  export interface LoadedCrashRecord {
2
16
  readonly fingerprint: string;
3
17
  readonly fpv: number;
@@ -9,6 +23,7 @@ export interface LoadedCrashRecord {
9
23
  readonly body: string;
10
24
  /** The `Name: message` part of the header line. */
11
25
  readonly headline: string;
26
+ readonly provenance?: CrashProvenance;
12
27
  }
13
28
  export declare function parseCrashRecords(contents: string): LoadedCrashRecord[];
14
29
  /** Complete v1 records whose marker fingerprint is recomputed from their diagnostic text. */
@@ -344,7 +344,7 @@ export interface ExtensionContext {
344
344
  cleanedArgs?: string;
345
345
  }) => void;
346
346
  preflightSignal?: AbortSignal;
347
- sdkRunToken?: string;
347
+ sdkRunCapability?: unknown;
348
348
  }): Promise<unknown>;
349
349
  setPlanMode?(on: boolean): unknown;
350
350
  operateGoal?(op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string): Promise<unknown>;
@@ -844,8 +844,6 @@ export interface ExtensionAPI {
844
844
  startsOwnRun: boolean;
845
845
  }) => void;
846
846
  preflightSignal?: AbortSignal;
847
- /** Internal SDK correlation owner for an exact queued follow-up. */
848
- sdkRunToken?: string;
849
847
  }): Promise<void>;
850
848
  /** Append a custom entry to the session for state persistence (not sent to LLM). */
851
849
  appendEntry<T = unknown>(customType: string, data?: T): void;
@@ -1031,8 +1029,6 @@ export type SendUserMessageHandler = (content: string | (TextContent | ImageCont
1031
1029
  removed?: boolean;
1032
1030
  }) => void;
1033
1031
  preflightSignal?: AbortSignal;
1034
- /** Internal SDK correlation owner for an exact queued follow-up. */
1035
- sdkRunToken?: string;
1036
1032
  }) => void | Promise<void>;
1037
1033
  export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
1038
1034
  export type GetActiveToolsHandler = () => string[];
@@ -1169,6 +1165,7 @@ export interface ExtensionContextActions {
1169
1165
  cleanedArgs?: string;
1170
1166
  }) => void;
1171
1167
  preflightSignal?: AbortSignal;
1168
+ sdkRunCapability?: unknown;
1172
1169
  }) => Promise<unknown>;
1173
1170
  setPlanMode?: (on: boolean) => unknown;
1174
1171
  operateGoal?: (op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string) => Promise<unknown>;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Official GC of already-quarantined empty `.gjc-delete-*` receipts.
3
+ * Roots are operator operands — never hardcoded host paths.
4
+ */
5
+ import type { BigIntStats } from "node:fs";
6
+ import { exactUnlinkDirect } from "@gajae-code/natives";
7
+ export declare const EMPTY_DELETE_PREFIX = ".gjc-delete-";
8
+ export interface EmptyDeleteIdentity {
9
+ dev: bigint;
10
+ ino: bigint;
11
+ nlink: bigint;
12
+ size: bigint;
13
+ mtimeNs: bigint;
14
+ parentDev: bigint;
15
+ parentIno: bigint;
16
+ sha256: string;
17
+ }
18
+ export interface EmptyDeleteGcRecord {
19
+ root: string;
20
+ path: string;
21
+ action: "would_remove" | "removed" | "kept" | "skipped";
22
+ reason: string;
23
+ identity?: EmptyDeleteIdentity;
24
+ /** A dry-run candidate is an observation, never deletion authority. */
25
+ observationOnly?: boolean;
26
+ /** Retained-object paths a native direct unlink left behind; operator-recoverable only there. */
27
+ retainedPaths?: {
28
+ detached?: string;
29
+ successor?: string;
30
+ placeholder?: string;
31
+ unknown?: string;
32
+ };
33
+ }
34
+ export interface EmptyDeleteGcReport {
35
+ dry_run: boolean;
36
+ roots: string[];
37
+ records: EmptyDeleteGcRecord[];
38
+ would_remove: number;
39
+ removed: number;
40
+ kept: number;
41
+ skipped: number;
42
+ errors: string[];
43
+ }
44
+ export interface EmptyDeleteGcOptions {
45
+ roots: string[];
46
+ prune: boolean;
47
+ }
48
+ export interface EmptyDeleteGcDependencies {
49
+ /** Internal seam for deterministic collect-to-prune race tests. */
50
+ collect?: (root: string) => Promise<EmptyDeleteGcRecord[]>;
51
+ exactUnlinkDirect?: typeof exactUnlinkDirect;
52
+ }
53
+ export declare function collectEmptyDeleteReceipts(root: string, deps?: {
54
+ lstat?: (file: string, options: {
55
+ bigint: true;
56
+ }) => Promise<BigIntStats>;
57
+ }): Promise<EmptyDeleteGcRecord[]>;
58
+ export declare function runEmptyDeleteGc(options: EmptyDeleteGcOptions, deps?: EmptyDeleteGcDependencies): Promise<EmptyDeleteGcReport>;
@@ -12,6 +12,7 @@
12
12
  * error all mean KEEP — a live process is never signalled or killed.
13
13
  * - Dry-run by default: nothing is deleted unless `--prune`/`--force`.
14
14
  */
15
+ import { type EmptyDeleteGcReport } from "./empty-delete-gc";
15
16
  import { type GcSessionScopeUsage } from "./gc-session-scope";
16
17
  export type GcStore = "harness_leases" | "file_locks" | "tmux_sessions" | "registry_entries" | "local_roots";
17
18
  export declare const GC_STORES: readonly GcStore[];
@@ -127,6 +128,7 @@ export interface GcReport {
127
128
  * PID-liveness axis above is unchanged by its absence or presence.
128
129
  */
129
130
  disk?: GcDiskReport;
131
+ empty_delete_receipts?: EmptyDeleteGcReport;
130
132
  }
131
133
  export interface GcRunResult {
132
134
  stdout: string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Cross-process reservation for a deterministic launch-worktree path.
3
+ *
4
+ * The durable session index is the long-lived ownership record, but a newly
5
+ * planned worktree has no index row yet. This reservation closes that interval:
6
+ * it is acquired before preparation and removed after `host_registered` is
7
+ * durably appended to the index.
8
+ */
9
+ export interface LaunchWorktreeReservation {
10
+ release(): Promise<void>;
11
+ }
12
+ /** Test seam for seeding a dead-owner reservation at the exact production path. */
13
+ export declare function launchWorktreeReservationDirectoryForTest(agentDir: string, worktreePath: string): string;
14
+ /**
15
+ * Atomically claim `worktreePath`, returning `null` only when another live or
16
+ * unverified launch already owns the same deterministic target. A dead or
17
+ * PID-reused owner is reclaimed before retrying the exclusive directory create.
18
+ */
19
+ export declare function reserveLaunchWorktree(agentDir: string, worktreePath: string): Promise<LaunchWorktreeReservation | null>;
20
+ /** Remove the transient reservation only after the matching worktree is indexed. */
21
+ export declare function releaseLaunchWorktreeReservationAfterRegistration(agentDir: string, worktreePath: string): Promise<void>;
@@ -6,6 +6,8 @@ export declare const MANAGED_OWNER_GENERATION_ENV = "GJC_TMUX_OWNER_GENERATION";
6
6
  export declare const MANAGED_OWNER_STATE_DIR_ENV = "GJC_TMUX_OWNER_STATE_DIR";
7
7
  export declare const MANAGED_OWNER_RUN_ID_ENV = "GJC_MANAGED_OWNER_RUN_ID";
8
8
  export declare const MANAGED_OWNER_INCARNATION_ENV = "GJC_MANAGED_OWNER_INCARNATION";
9
+ /** Suppresses command-derived durable artifacts for Broker-owned opaque spawn children. */
10
+ export declare const MANAGED_OWNER_REDACT_COMMAND_ENV = "GJC_MANAGED_OWNER_REDACT_COMMAND";
9
11
  export interface ManagedOwnerBinding {
10
12
  schema_version: 2;
11
13
  generation: string;
@@ -62,6 +62,12 @@ export declare const SessionStateLockTestHooks: {
62
62
  unqualifiedOwnerIsLocal?: boolean;
63
63
  /** @internal Runs after final live-owner validation and before descriptor rewrite. */
64
64
  afterCurrentOwnerValidation?: (file: string) => void | Promise<void>;
65
+ /** @internal Fault seam immediately before a held owner record rewrite mutates bytes. */
66
+ beforeOwnerRecordRewrite?: (file: string) => void | Promise<void>;
67
+ /** @internal Fault seam immediately before final transition-generation validation. */
68
+ beforeTransitionReleaseLstat?: (transitionDir: string) => void | Promise<void>;
69
+ /** @internal Fault seam immediately before setup generation capture. */
70
+ beforeTransitionSetupLstat?: (transitionDir: string) => void | Promise<void>;
65
71
  /**
66
72
  * @internal Runs after a live owner has been proven and immediately before its
67
73
  * final pathname capture for release. Tests use it to replace the pathname and
@@ -69,10 +75,30 @@ export declare const SessionStateLockTestHooks: {
69
75
  */
70
76
  beforeCurrentOwnerRelease?: (file: string) => void | Promise<void>;
71
77
  beforeLegacyDirectoryRemoval?: (lockDir: string) => void | Promise<void>;
78
+ /** @internal Last quarantine name minted in the current lock cycle (tests). */
79
+ lastQuarantineName?: string;
80
+ /** @internal Count of quarantine names minted in the current lock cycle (tests). */
81
+ quarantineMints?: number;
82
+ /** @internal Force the next mint to this name so leftover-collision tests can plant it. */
83
+ forcedQuarantineName?: string;
84
+ /** @internal Observes bounded acquisition retries without changing their timing. */
85
+ afterAcquireContention?: (lockFile: string, attempt: number, elapsedMs: number) => void;
72
86
  };
73
87
  /** Raised when the lock could not be acquired; callers map it to their own refusal. */
88
+ export type SessionStateLockUnavailableReason = "acquire_timeout" | "legacy_directory_owner_unprovenanced" | "lock_initialization_failed" | "lock_inspection_failed" | "lock_owner_live_or_unverifiable" | "lock_owner_record_fresh" | "lock_owner_record_unprovenanced" | "lock_release_failed" | "transition_claim_timeout" | "unsafe_lock_path_type";
89
+ interface SessionStateLockUnavailableDetails {
90
+ lockPath: string;
91
+ reason: SessionStateLockUnavailableReason;
92
+ attempts?: number;
93
+ elapsedMs?: number;
94
+ cause?: unknown;
95
+ }
74
96
  export declare class SessionStateLockUnavailableError extends Error {
75
- constructor(cause?: unknown);
97
+ readonly lockPath?: string;
98
+ readonly reason?: SessionStateLockUnavailableReason;
99
+ readonly attempts?: number;
100
+ readonly elapsedMs?: number;
101
+ constructor(causeOrDetails?: unknown | SessionStateLockUnavailableDetails);
76
102
  }
77
103
  /**
78
104
  * The identity-bound deletion primitives this lock is built on.
@@ -85,7 +111,7 @@ export declare class SessionStateLockUnavailableError extends Error {
85
111
  * caller proved. A replacement is therefore never deleted, by construction rather than by
86
112
  * a narrower window.
87
113
  */
88
- export type SessionStateLockNativeBindings = Pick<typeof import("@gajae-code/natives"), "exactRemoveDirectoryTree" | "exactUnlink" | "snapshotDirectoryTree">;
114
+ export type SessionStateLockNativeBindings = Pick<typeof import("@gajae-code/natives"), "exactRemoveDirectoryTree" | "exactUnlink" | "exactUnlinkDirect" | "snapshotDirectoryTree">;
89
115
  /** How the deletion primitives are obtained. Throwing means they are unavailable. */
90
116
  type SessionStateLockNativeLoader = () => SessionStateLockNativeBindings;
91
117
  /**
@@ -102,12 +128,15 @@ type SessionStateLockNativeLoader = () => SessionStateLockNativeBindings;
102
128
  */
103
129
  export declare function setSessionStateLockNativeBindings(load: SessionStateLockNativeLoader | undefined): void;
104
130
  /**
105
- * Decide what actually occupies the lock path, without following it.
131
+ * Verified empty leftover at a reserved quarantine name is incomplete debris, not
132
+ * in-progress cleanup.
106
133
  *
107
- * @internal exported as the seam these decisions are tested through: a live legacy
108
- * directory owner must be provably left alone without waiting out a real stale window.
134
+ * Deletion authority is the native identity-bound direct unlink — never a plain
135
+ * pathname unlink. A replacement planted at the reserved name between observation
136
+ * and deletion has a different inode identity and is refused by construction.
109
137
  */
110
- export declare function reclaimStaleSessionStateLock(lockFile: string): Promise<void>;
138
+ export declare function removeVerifiedEmptyQuarantine(directory: string, name: string): Promise<void>;
139
+ export declare function reclaimStaleSessionStateLock(lockFile: string, quarantineName?: string): Promise<void>;
111
140
  /**
112
141
  * Serialize one read-modify-write of `stateFile` against every other holder of
113
142
  * `<stateFile>.lock`.
@@ -33,6 +33,13 @@ export declare const __sessionStateSidecarPerfCounters: {
33
33
  persistFromEventCalls: number;
34
34
  reset(): void;
35
35
  };
36
+ /** Test-only barriers for deterministic rescope transaction race coverage. */
37
+ export declare const __sessionStateSidecarTestHooks: {
38
+ afterRescopeLocksAcquired?: () => void | Promise<void>;
39
+ beforeRescopeJournalWrite?: (cwd: string) => void | Promise<void>;
40
+ beforePersistFromEvent?: (eventType: string, cwd: string) => void | Promise<void>;
41
+ beforeRescopePublish?: () => void | Promise<void>;
42
+ };
36
43
  interface RuntimeStateEvent {
37
44
  type: string;
38
45
  messages?: unknown[];
@@ -168,6 +175,12 @@ export interface RuntimeStateContext {
168
175
  ownerTerminal?: OwnerTerminalContext | null;
169
176
  /** Internal fail-closed marker set only when managed owner metadata is malformed or missing. */
170
177
  ownerTerminalMetadataInvalid?: boolean;
178
+ /**
179
+ * The session file as it was BEFORE a committed rescope, used only by
180
+ * {@link relocateCoordinatorRuntimeStateForRescope} to authenticate the predecessor
181
+ * payload against its old identity. Absent outside a move.
182
+ */
183
+ previousSessionFile?: string | null;
171
184
  }
172
185
  export type TerminalRuntimeStateStatus = {
173
186
  terminal: true;
@@ -195,7 +208,65 @@ export declare function persistCoordinatorRuntimeStateFromEvent(event: RuntimeSt
195
208
  * sidecar never trusts a model-supplied name.
196
209
  */
197
210
  observation?: CoordinatorToolObservation): Promise<void>;
211
+ export declare function persistCoordinatorWorkerIntegrationOutcome(context: RuntimeStateContext, outcome: {
212
+ kind: "worker_integration" | "terminal_persistence";
213
+ status: "completed" | "failed" | "timed_out";
214
+ correlationId?: string;
215
+ error?: string;
216
+ }): Promise<void>;
217
+ export declare function prepareCoordinatorRuntimeStateRescope(input: {
218
+ moveId?: string;
219
+ sessionId: string;
220
+ previousCwd: string;
221
+ newCwd: string;
222
+ previousCwdIdentity?: {
223
+ dev: bigint;
224
+ ino: bigint;
225
+ };
226
+ newCwdIdentity?: {
227
+ dev: bigint;
228
+ ino: bigint;
229
+ };
230
+ previousSessionFile?: string | null;
231
+ newSessionFile?: string | null;
232
+ }): Promise<string>;
233
+ export declare function markCoordinatorRuntimeStateRescopePublishing(context: RuntimeStateContext, previousCwd: string, moveId: string): Promise<void>;
234
+ export declare function clearCoordinatorRuntimeStateRescope(context: RuntimeStateContext, expectedMoveId?: string, previousCwd?: string): Promise<void>;
235
+ /**
236
+ * Cheap synchronous probe for a pending rescope-recovery journal at this cwd. Sessions
237
+ * that never moved (the overwhelming majority) have none, so callers use this to avoid
238
+ * arming a startup-turn barrier for a no-op recovery \u2014 an armed barrier is not free even
239
+ * when it resolves immediately: it flips the session's startup gate from absent to present
240
+ * and reorders barrier-gated post-turn work.
241
+ */
242
+ export declare function hasCoordinatorRuntimeStateRescopeJournal(context: RuntimeStateContext): boolean;
243
+ export declare function recoverCoordinatorRuntimeStateRescope(context: RuntimeStateContext): Promise<void>;
244
+ /**
245
+ * Repairs the coordinator-shared runtime state after a committed cwd rescope, for every
246
+ * move surface (`move_session`, TUI `/move`, SDK/ACP `session.cwd.move`) through the one
247
+ * shared {@link SessionManager.moveTo} seam.
248
+ *
249
+ * The identity fence in {@link assertPreviousRuntimeStateIdentity} rejects any write whose
250
+ * predecessor payload records a different cwd/workdir than the live session. A rescope
251
+ * changes the session cwd but leaves the predecessor payload pointing at the launch root,
252
+ * so every later persist for the session would be refused as a foreign marker.
253
+ *
254
+ * The predecessor is fully authenticated against its OLD identity before it is trusted:
255
+ * signed mode verifies the predecessor's key id and Ed25519 signature; unsigned mode
256
+ * requires an exact old cwd/workdir/session-file match (the same checks the fence applies).
257
+ * Only a predecessor that passes is rewritten to the new identity and re-signed. When the
258
+ * state file is cwd-derived rather than pinned by
259
+ * {@link GJC_COORDINATOR_SESSION_STATE_FILE_ENV}, the payload is migrated to the new path
260
+ * and the orphaned launch-root file is removed. A payload already self-healed at the new
261
+ * cwd is left untouched.
262
+ *
263
+ * Both the old and new cwd-derived paths are locked (new first, then old) so a concurrent
264
+ * writer at either path serializes behind this repair. Best-effort by contract: the move
265
+ * is already durable, so a failure here is logged by the caller and never resurfaced as a
266
+ * rescope rejection.
267
+ */
268
+ export declare function relocateCoordinatorRuntimeStateForRescope(context: RuntimeStateContext, previousCwd: string): Promise<boolean>;
198
269
  export declare function ownerTerminalContextFromEnvironment(): OwnerTerminalContext | "invalid" | null;
199
270
  export declare function persistCoordinatorRuntimeStateFromPostmortem(reason: postmortem.Reason, context: RuntimeStateContext): Promise<void>;
200
- export declare function registerCoordinatorRuntimeStateFinalizer(context: RuntimeStateContext): () => void;
271
+ export declare function registerCoordinatorRuntimeStateFinalizer(context: RuntimeStateContext, resolveContext?: () => RuntimeStateContext): () => void;
201
272
  export {};
@@ -149,6 +149,7 @@ export interface TmuxOwnerIsolationExecutionDependencies {
149
149
  spawn(argv: string[], stdinLine?: string): {
150
150
  exitCode: number | null;
151
151
  stdout?: string;
152
+ stderr?: string;
152
153
  };
153
154
  probeServer(socketKey: string): TmuxServerProof;
154
155
  /** Reads the published owner generation immediately around direct execution. */
@@ -1,5 +1,23 @@
1
1
  import { type ProviderAuthority } from "./tmux-common";
2
2
  import { type OwnerIsolationProbeSync, type OwnerVerdict, type PlanResponse, type TmuxOwnerIsolationExecutionDependencies, type TmuxOwnerIsolationExecutionResult } from "./tmux-owner-isolation";
3
+ export interface ManagedTmuxLaunchSpec {
4
+ childSessionId: string;
5
+ cwd: string;
6
+ argv: readonly string[];
7
+ env?: Readonly<Record<string, string>>;
8
+ }
9
+ export interface ManagedTmuxLaunchProof {
10
+ name: string;
11
+ nativeSessionId: string;
12
+ serverPid: number;
13
+ serverStartTime: string;
14
+ ownerGeneration: string;
15
+ sessionId: string;
16
+ sessionStateFile: string;
17
+ pid: number;
18
+ providerIdentity: string;
19
+ psmuxIncarnation?: string;
20
+ }
3
21
  export interface GjcTmuxSessionStatus {
4
22
  name: string;
5
23
  attached: boolean;
@@ -73,9 +91,12 @@ export interface ForceCloseOwnerDependencies {
73
91
  listPanePids(sessionName: string, env: NodeJS.ProcessEnv): number[];
74
92
  /** Test/runtime seam for an exact owner-exit observer; durable validation remains authoritative. */
75
93
  waitForOwnerExitVerdict?(): Promise<OwnerVerdict>;
94
+ /** Broker close pin; production callers use this to reject reused session identity. */
95
+ expectedManagedProof?: ManagedTmuxLaunchProof;
76
96
  }
77
97
  export interface CreateGjcTmuxSessionOptions {
78
98
  platform?: NodeJS.Platform;
99
+ launch?: ManagedTmuxLaunchSpec;
79
100
  }
80
101
  export type CreateOwnerIsolationTestDependencies = {
81
102
  probe?: Partial<OwnerIsolationProbeSync>;
@@ -93,6 +114,12 @@ export declare function findGjcTmuxSessionByName(sessionName: string, env?: Node
93
114
  export declare function findGjcTmuxSessionByScope(project: string, branch: string | null | undefined, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus | undefined;
94
115
  export declare function statusGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
95
116
  export declare function createGjcTmuxSession(env?: NodeJS.ProcessEnv, options?: CreateGjcTmuxSessionOptions): GjcTmuxSessionStatus;
117
+ /** Launches one Broker-owned child through the managed owner path and returns only re-proof inputs. */
118
+ export declare function createManagedGjcTmuxSession(spec: ManagedTmuxLaunchSpec, env?: NodeJS.ProcessEnv, options?: Omit<CreateGjcTmuxSessionOptions, "launch">): ManagedTmuxLaunchProof;
119
+ /** Re-proves every mutable multiplexer identity field before a Broker effect. */
120
+ export declare function verifyManagedGjcTmuxSession(expected: ManagedTmuxLaunchProof, env?: NodeJS.ProcessEnv): "verified" | "mismatch" | "gone";
121
+ /** Closes only an identity that passes the same exhaustive verification used for replay and reaping. */
122
+ export declare function forceCloseManagedGjcTmuxSession(expected: ManagedTmuxLaunchProof, env?: NodeJS.ProcessEnv): Promise<GjcTmuxSessionStatus>;
96
123
  /** Proves a managed reusable name still resolves to one immutable session on one server. */
97
124
  export declare function proveGjcTmuxSessionMutationTarget(sessionName: string, env?: NodeJS.ProcessEnv, provisionalAuthority?: ProviderAuthority): ProvenTmuxSessionIdentity;
98
125
  /** @internal */
@@ -28,6 +28,7 @@ export * from "./session/session-dump-format";
28
28
  export * from "./session/session-manager";
29
29
  export * from "./task/executor";
30
30
  export type * from "./task/types";
31
+ export * from "./telemetry";
31
32
  export * from "./tools";
32
33
  export * from "./utils/git";
33
34
  export { HookEditorComponent as ExtensionEditorComponent, HookInputComponent as ExtensionInputComponent, HookSelectorComponent as ExtensionSelectorComponent, };
@@ -47,7 +47,9 @@ export interface InteractiveModeNotify {
47
47
  kind: "warn" | "error" | "info";
48
48
  message: string;
49
49
  }
50
- export declare function submitInteractiveInput(mode: Pick<InteractiveMode, "markPendingSubmissionStarted" | "finishPendingSubmission" | "showError" | "checkShutdownRequested" | "waitForAgentEnd">, session: Pick<AgentSession, "prompt" | "promptCustomMessage">, input: SubmittedUserInput): Promise<void>;
50
+ export declare function submitInteractiveInput(mode: Pick<InteractiveMode, "markPendingSubmissionStarted" | "finishPendingSubmission" | "showError" | "checkShutdownRequested" | "waitForAgentEnd">, session: Pick<AgentSession, "prompt" | "promptCustomMessage"> & {
51
+ continuePersistedHistory?: AgentSession["continuePersistedHistory"];
52
+ }, input: SubmittedUserInput): Promise<void>;
51
53
  type StartupModelProfileArgs = {
52
54
  session: AgentSession;
53
55
  settings: Settings;
@@ -0,0 +1,21 @@
1
+ import type { Args } from "../cli/args";
2
+ export type MasterScope = "repo" | "pwd" | "global";
3
+ /**
4
+ * Process-local master authority. Its capability accessor is deliberately the
5
+ * only way to reach the raw capability; this context is never serializable.
6
+ */
7
+ export interface MasterModeContext {
8
+ readonly scope: MasterScope;
9
+ readonly ownerSessionId: string;
10
+ readonly attestationEpoch: string;
11
+ getCapability(): string;
12
+ }
13
+ export declare function createMasterModeContext(scope: MasterScope, ownerSessionId: string, attestationEpoch: string): MasterModeContext;
14
+ /** Reject routes that cannot establish an interactive, durable master session. */
15
+ export declare function assertMasterLaunchArgs(parsed: Args): void;
16
+ export declare function assertMasterLaunchDisposition(input: {
17
+ master: boolean | undefined;
18
+ isInteractive: boolean;
19
+ autoPrint: boolean;
20
+ nonInteractiveError?: string;
21
+ }): void;
@@ -0,0 +1,34 @@
1
+ import type { MasterScope } from "./context";
2
+ import { type MasterPeerSnapshotLifecycle } from "./snapshot";
3
+ export declare const MASTER_PEER_SNAPSHOT_CUSTOM_TYPE = "master-peer-snapshot";
4
+ /** The injected message shape consumed by the agent-session contributor seam. */
5
+ export interface MasterPeerSnapshotMessage {
6
+ customType: string;
7
+ content: string;
8
+ display: false;
9
+ attribution: "agent";
10
+ }
11
+ export interface MasterPeerSnapshotContributorInput {
12
+ readonly lifecycle: MasterPeerSnapshotLifecycle;
13
+ readonly ownerSessionId: string;
14
+ /** Current transcript/session identity; differs from ownerSessionId after a branch or switch. */
15
+ readonly getSessionId?: () => string;
16
+ readonly scope: MasterScope;
17
+ /** Live cwd accessor; resolved at injection time, not at registration. */
18
+ readonly getCwd: () => string;
19
+ /**
20
+ * Whether a prior injection was persisted to the session branch. A persisted
21
+ * block proves a first request was accepted, so later turns never duplicate
22
+ * it; a pre-accept cancellation persists nothing and the next attempt
23
+ * re-collects a fresh snapshot.
24
+ */
25
+ readonly hasPersistedInjection: () => boolean;
26
+ readonly onError?: (error: unknown) => void;
27
+ }
28
+ /**
29
+ * Builds the one-shot before-agent-start contributor that injects the scoped,
30
+ * no-probe master peer snapshot immediately before the first accepted provider
31
+ * request. Idle masters never collect: the snapshot is gathered only when a
32
+ * prompt actually starts.
33
+ */
34
+ export declare function createMasterPeerSnapshotContributor(input: MasterPeerSnapshotContributorInput): () => Promise<MasterPeerSnapshotMessage | undefined>;
@@ -0,0 +1,32 @@
1
+ import { type ResolvedScopeV1, type ScopeNameV1, type ScopeRequestV1, type SdkSearchResultV1, type SdkSearchRowV1 } from "../sdk/broker/session-scope";
2
+ import type { SessionLifecycleActor, SessionListOutcome, SessionListRequest } from "../sdk/lifecycle/service";
3
+ export type MasterPeerSnapshot = {
4
+ readonly status: SdkSearchResultV1["status"];
5
+ readonly scope: ResolvedScopeV1;
6
+ readonly observedAt: string;
7
+ readonly indexSeq?: number;
8
+ readonly rows: readonly SdkSearchRowV1[];
9
+ readonly truncated?: boolean;
10
+ };
11
+ /** The scoped Broker surface needed for the one-time master peer snapshot. */
12
+ export interface MasterPeerSnapshotLifecycle {
13
+ list(request: Omit<SessionListRequest, "operation">): Promise<SessionListOutcome>;
14
+ }
15
+ export interface CollectMasterPeerSnapshotInput {
16
+ readonly lifecycle: MasterPeerSnapshotLifecycle;
17
+ readonly actor: SessionLifecycleActor;
18
+ readonly ownerSessionId: string;
19
+ readonly currentSessionId?: string;
20
+ readonly scope: ScopeNameV1;
21
+ readonly requestAnchor: ScopeRequestV1["requestAnchor"];
22
+ readonly timeoutMs?: number;
23
+ }
24
+ /**
25
+ * Collects the first-request peer snapshot through scoped Broker session.list.
26
+ * It deliberately has no Router or endpoint-probe dependency.
27
+ */
28
+ export declare function collectMasterPeerSnapshot(input: CollectMasterPeerSnapshotInput): Promise<MasterPeerSnapshot>;
29
+ /** Escapes untrusted metadata before it is placed in fixed prompt framing. */
30
+ export declare function escapeMasterPeerSnapshotText(input: string): string;
31
+ /** Renders the fixed, escaped prompt block for one master peer observation. */
32
+ export declare function renderMasterPeerSnapshot(snapshot: MasterPeerSnapshot): string;