@gajae-code/coding-agent 0.18.6 → 0.18.8

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 (302) hide show
  1. package/CHANGELOG.md +318 -1
  2. package/dist/types/async/job-manager.d.ts +1 -1
  3. package/dist/types/capability/mcp.d.ts +2 -0
  4. package/dist/types/capability/skill.d.ts +2 -0
  5. package/dist/types/capability/types.d.ts +6 -0
  6. package/dist/types/cli/public-command-errors.d.ts +3 -1
  7. package/dist/types/cli/setup-cli.d.ts +1 -1
  8. package/dist/types/commands/deep-interview.d.ts +3 -0
  9. package/dist/types/config/autorouting-tier-map.d.ts +348 -9
  10. package/dist/types/config/file-lock.d.ts +1 -0
  11. package/dist/types/config/model-bindings-applier.d.ts +2 -0
  12. package/dist/types/config/model-profile-activation.d.ts +11 -3
  13. package/dist/types/config/model-registry.d.ts +4 -9
  14. package/dist/types/config/settings.d.ts +4 -0
  15. package/dist/types/config/skill-settings-defaults.d.ts +2 -0
  16. package/dist/types/cursor-delete-path.d.ts +1 -0
  17. package/dist/types/cursor-mcp-name.d.ts +8 -0
  18. package/dist/types/customization/inventory.d.ts +2 -0
  19. package/dist/types/debug/report-bundle-parent.d.ts +2 -0
  20. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.d.ts +1 -0
  21. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.d.ts +31 -0
  22. package/dist/types/defaults/gjc-skills.generated.d.ts +5 -6
  23. package/dist/types/discovery/helpers.d.ts +8 -3
  24. package/dist/types/export/html/css-color.d.ts +2 -0
  25. package/dist/types/export/html/template.generated.d.ts +1 -1
  26. package/dist/types/extensibility/extensions/types.d.ts +7 -0
  27. package/dist/types/extensibility/gjc-plugins/runtime-adapters.d.ts +14 -1
  28. package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
  29. package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
  30. package/dist/types/extensibility/runtime-skill-discovery.d.ts +3 -1
  31. package/dist/types/extensibility/skill-management.d.ts +3 -1
  32. package/dist/types/extensibility/skills.d.ts +2 -0
  33. package/dist/types/gjc-runtime/deep-interview-crystallize.d.ts +74 -0
  34. package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +11 -0
  35. package/dist/types/gjc-runtime/gc-runtime.d.ts +5 -0
  36. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +0 -5
  37. package/dist/types/gjc-runtime/state-argv.d.ts +1 -1
  38. package/dist/types/gjc-runtime/state-migrations.d.ts +8 -0
  39. package/dist/types/gjc-runtime/state-runtime.d.ts +95 -0
  40. package/dist/types/gjc-runtime/state-writer.d.ts +11 -1
  41. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +8 -0
  42. package/dist/types/internal-urls/skill-path.d.ts +1 -0
  43. package/dist/types/lsp/workspace-path.d.ts +1 -0
  44. package/dist/types/modes/acp/acp-agent.d.ts +7 -0
  45. package/dist/types/modes/components/custom-editor.d.ts +6 -0
  46. package/dist/types/modes/components/customization/customization-dashboard.d.ts +1 -0
  47. package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
  48. package/dist/types/modes/controllers/input-controller.d.ts +9 -0
  49. package/dist/types/modes/interactive-mode.d.ts +1 -0
  50. package/dist/types/modes/utils/interrupt-ownership.d.ts +3 -0
  51. package/dist/types/modes/utils/keybinding-matchers.d.ts +1 -0
  52. package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
  53. package/dist/types/progress/collect-project-progress.d.ts +38 -0
  54. package/dist/types/progress/progress-contract.d.ts +154 -0
  55. package/dist/types/progress/progress-snapshot.d.ts +11 -0
  56. package/dist/types/progress/project-progress.d.ts +141 -0
  57. package/dist/types/progress/render-progress.d.ts +28 -0
  58. package/dist/types/runtime-mcp/elicitation.d.ts +12 -0
  59. package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
  60. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
  61. package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
  62. package/dist/types/runtime-mcp/types.d.ts +6 -0
  63. package/dist/types/sdk/acp/adapter.d.ts +1 -1
  64. package/dist/types/sdk/broker/broker-exit.d.ts +6 -2
  65. package/dist/types/sdk/broker/broker.d.ts +18 -1
  66. package/dist/types/sdk/broker/lifecycle.d.ts +9 -0
  67. package/dist/types/sdk/broker/session-index.d.ts +12 -6
  68. package/dist/types/sdk/broker/task-artifact-owner-validation.d.ts +55 -0
  69. package/dist/types/sdk/bus/index.d.ts +12 -1
  70. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -1
  71. package/dist/types/sdk/bus/telegram-daemon.d.ts +3 -2
  72. package/dist/types/sdk/client/client.d.ts +2 -0
  73. package/dist/types/sdk/host/host.d.ts +6 -0
  74. package/dist/types/sdk/host/query/handlers.d.ts +3 -0
  75. package/dist/types/sdk/index.d.ts +1 -0
  76. package/dist/types/sdk/router/session-router.d.ts +9 -0
  77. package/dist/types/sdk/session-list.d.ts +1 -1
  78. package/dist/types/sdk/session.d.ts +8 -0
  79. package/dist/types/session/agent-session.d.ts +38 -9
  80. package/dist/types/session/artifacts.d.ts +2 -2
  81. package/dist/types/session/internal/managed-gc-retirement-codec.d.ts +32 -0
  82. package/dist/types/session/internal/managed-session-scope.d.ts +79 -2
  83. package/dist/types/session/internal/managed-session-storage.d.ts +36 -1
  84. package/dist/types/session/internal/managed-task-owner-cleanup.d.ts +62 -0
  85. package/dist/types/session/internal/task-artifact-owner-access.d.ts +19 -0
  86. package/dist/types/session/internal/task-artifact-owner-transcript.d.ts +11 -0
  87. package/dist/types/session/session-manager.d.ts +31 -5
  88. package/dist/types/session/session-retirement.d.ts +71 -0
  89. package/dist/types/session/session-storage.d.ts +62 -48
  90. package/dist/types/session/session-transcript-header.d.ts +2 -0
  91. package/dist/types/session/task-artifact-owner-codec.d.ts +109 -0
  92. package/dist/types/session/task-artifact-owner-retirement.d.ts +7 -0
  93. package/dist/types/session/task-artifact-owner.d.ts +10 -0
  94. package/dist/types/setup/credential-auto-import.d.ts +1 -1
  95. package/dist/types/setup/credential-import.d.ts +6 -4
  96. package/dist/types/skill-state/active-state.d.ts +38 -0
  97. package/dist/types/slash-commands/helpers/progress-report.d.ts +8 -0
  98. package/dist/types/task/executor.d.ts +3 -0
  99. package/dist/types/tools/bash-skill-urls.d.ts +1 -1
  100. package/dist/types/tools/index.d.ts +3 -0
  101. package/dist/types/tools/python.d.ts +9 -1
  102. package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
  103. package/dist/types/tools/restricted-cwd.d.ts +1 -0
  104. package/dist/types/tools/todo-write.d.ts +6 -0
  105. package/dist/types/utils/tools-checksum.d.ts +7 -0
  106. package/package.json +7 -7
  107. package/scripts/generate-sdk-operation-inventory.ts +21 -0
  108. package/scripts/resident-memory-bench.ts +174 -20
  109. package/scripts/verify-managed-empty-stop.ts +28 -0
  110. package/src/async/job-manager.ts +228 -122
  111. package/src/capability/index.ts +18 -0
  112. package/src/capability/mcp.ts +2 -0
  113. package/src/capability/skill.ts +2 -0
  114. package/src/capability/types.ts +6 -0
  115. package/src/cli/auth-broker-cli.ts +1 -1
  116. package/src/cli/config-cli.ts +8 -18
  117. package/src/cli/customize-doctor.ts +15 -2
  118. package/src/cli/public-command-errors.ts +21 -1
  119. package/src/cli/setup-cli.ts +4 -4
  120. package/src/cli/skills-cli.ts +5 -0
  121. package/src/cli-main.ts +7 -8
  122. package/src/commands/deep-interview.ts +47 -8
  123. package/src/commands/sdk.ts +140 -29
  124. package/src/config/autorouting-tier-map.ts +117 -7
  125. package/src/config/file-lock.ts +307 -68
  126. package/src/config/mcp-schema.json +4 -0
  127. package/src/config/model-bindings-applier.ts +20 -0
  128. package/src/config/model-profile-activation.ts +240 -46
  129. package/src/config/model-registry.ts +47 -153
  130. package/src/config/settings.ts +44 -4
  131. package/src/config/skill-settings-defaults.ts +7 -0
  132. package/src/coordinator-mcp/policy.ts +3 -2
  133. package/src/cursor-delete-path.ts +10 -0
  134. package/src/cursor-mcp-name.ts +15 -0
  135. package/src/cursor.ts +13 -2
  136. package/src/customization/inventory.ts +3 -0
  137. package/src/debug/report-bundle-parent.ts +22 -0
  138. package/src/debug/report-bundle.ts +3 -0
  139. package/src/debug/system-info.ts +13 -1
  140. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.ts +67 -4
  141. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.ts +80 -0
  142. package/src/defaults/gjc/skills/deep-interview/SKILL.md +105 -10
  143. package/src/defaults/gjc/skills/ralplan/SKILL.md +6 -4
  144. package/src/defaults/gjc-defaults.test.ts +18 -1
  145. package/src/defaults/gjc-defaults.ts +3 -0
  146. package/src/defaults/gjc-skills.generated.ts +58 -36
  147. package/src/discovery/agents.ts +6 -1
  148. package/src/discovery/builtin.ts +10 -0
  149. package/src/discovery/helpers.ts +168 -23
  150. package/src/discovery/mcp-json.ts +6 -0
  151. package/src/discovery/ssh.ts +9 -4
  152. package/src/discovery/substitute-plugin-root.ts +3 -1
  153. package/src/edit/file-read-cache.ts +1 -1
  154. package/src/eval/py/executor.ts +380 -120
  155. package/src/export/html/css-color.ts +9 -0
  156. package/src/export/html/index.ts +5 -4
  157. package/src/export/html/template.generated.ts +1 -1
  158. package/src/extensibility/extensions/runner.ts +4 -0
  159. package/src/extensibility/extensions/types.ts +7 -0
  160. package/src/extensibility/gjc-plugins/runtime-adapters.ts +73 -8
  161. package/src/extensibility/plugins/manager.ts +3 -2
  162. package/src/extensibility/plugins/marketplace/cache.ts +15 -0
  163. package/src/extensibility/plugins/marketplace/manager.ts +11 -3
  164. package/src/extensibility/plugins/plugin-link-path.ts +12 -0
  165. package/src/extensibility/runtime-skill-discovery.ts +20 -2
  166. package/src/extensibility/skill-management.ts +6 -2
  167. package/src/extensibility/skills.ts +6 -1
  168. package/src/gjc-runtime/deep-interview-crystallize.ts +1814 -0
  169. package/src/gjc-runtime/deep-interview-recorder.ts +20 -2
  170. package/src/gjc-runtime/deep-interview-runtime.ts +1415 -13
  171. package/src/gjc-runtime/deep-interview-stage.ts +98 -21
  172. package/src/gjc-runtime/gc-runtime.ts +206 -8
  173. package/src/gjc-runtime/launch-worktree.ts +14 -4
  174. package/src/gjc-runtime/ralplan-runtime.ts +447 -52
  175. package/src/gjc-runtime/state-argv.ts +2 -0
  176. package/src/gjc-runtime/state-migrations.ts +91 -29
  177. package/src/gjc-runtime/state-runtime.ts +3716 -135
  178. package/src/gjc-runtime/state-writer.ts +83 -8
  179. package/src/gjc-runtime/ultragoal-runtime.ts +16 -4
  180. package/src/gjc-runtime/workflow-manifest.generated.json +70 -42
  181. package/src/gjc-runtime/workflow-manifest.ts +54 -21
  182. package/src/harness-control-plane/operate.ts +12 -4
  183. package/src/harness-control-plane/owner.ts +5 -1
  184. package/src/hashline/parser.ts +48 -9
  185. package/src/hashline/recovery.ts +13 -4
  186. package/src/hindsight/config.ts +9 -3
  187. package/src/internal-urls/docs-index.generated.ts +19 -18
  188. package/src/internal-urls/skill-path.ts +19 -0
  189. package/src/internal-urls/skill-protocol.ts +2 -0
  190. package/src/lsp/edits.ts +6 -0
  191. package/src/lsp/workspace-path.ts +51 -0
  192. package/src/main.ts +195 -31
  193. package/src/modes/acp/acp-agent.ts +163 -7
  194. package/src/modes/components/custom-editor.ts +14 -0
  195. package/src/modes/components/customization/customization-dashboard.ts +12 -0
  196. package/src/modes/components/extensions/extension-dashboard.ts +2 -2
  197. package/src/modes/components/extensions/state-manager.ts +15 -5
  198. package/src/modes/components/model-selector.ts +1 -4
  199. package/src/modes/components/provider-onboarding-selector.ts +1 -1
  200. package/src/modes/components/status-line/segments.ts +4 -0
  201. package/src/modes/controllers/event-controller.ts +11 -4
  202. package/src/modes/controllers/input-controller.ts +74 -29
  203. package/src/modes/controllers/runtime-mcp-command-controller.ts +8 -3
  204. package/src/modes/controllers/selector-controller.ts +28 -15
  205. package/src/modes/interactive-mode.ts +4 -0
  206. package/src/modes/runtime-init.ts +4 -0
  207. package/src/modes/utils/abort-message.ts +3 -1
  208. package/src/modes/utils/interrupt-ownership.ts +12 -0
  209. package/src/modes/utils/keybinding-matchers.ts +4 -0
  210. package/src/modes/utils/macos-option-forwarding.ts +80 -0
  211. package/src/progress/collect-project-progress.ts +153 -0
  212. package/src/progress/progress-contract.ts +172 -0
  213. package/src/progress/progress-snapshot.ts +140 -0
  214. package/src/progress/project-progress.ts +446 -0
  215. package/src/progress/render-progress.ts +209 -0
  216. package/src/prompts/system/master-mode.md +1 -0
  217. package/src/prompts/tools/skill-discovery.md +1 -1
  218. package/src/runtime-mcp/client.ts +13 -4
  219. package/src/runtime-mcp/config-writer.ts +10 -6
  220. package/src/runtime-mcp/config.ts +1 -0
  221. package/src/runtime-mcp/elicitation.ts +142 -0
  222. package/src/runtime-mcp/oauth-flow.ts +5 -0
  223. package/src/runtime-mcp/oauth-public-url.ts +8 -0
  224. package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
  225. package/src/runtime-mcp/smithery-registry.ts +22 -3
  226. package/src/runtime-mcp/transports/http.ts +2 -2
  227. package/src/runtime-mcp/types.ts +6 -0
  228. package/src/sdk/acp/adapter.ts +93 -8
  229. package/src/sdk/broker/broker-exit.ts +52 -23
  230. package/src/sdk/broker/broker.ts +83 -7
  231. package/src/sdk/broker/ensure.ts +2 -0
  232. package/src/sdk/broker/lifecycle.ts +820 -73
  233. package/src/sdk/broker/session-index.ts +191 -81
  234. package/src/sdk/broker/task-artifact-owner-validation.ts +259 -0
  235. package/src/sdk/bus/chat-daemon-cli.ts +38 -1
  236. package/src/sdk/bus/chat-daemon-control.ts +2 -2
  237. package/src/sdk/bus/chat-daemon-runtime.ts +3 -0
  238. package/src/sdk/bus/index.ts +241 -46
  239. package/src/sdk/bus/telegram-daemon-contract.ts +6 -1
  240. package/src/sdk/bus/telegram-daemon.ts +4 -2
  241. package/src/sdk/cli/session-cli.ts +17 -3
  242. package/src/sdk/client/client.ts +28 -8
  243. package/src/sdk/host/host.ts +6 -0
  244. package/src/sdk/host/query/handlers.ts +9 -1
  245. package/src/sdk/host/session-runtime.test.ts +2805 -411
  246. package/src/sdk/host/session-runtime.ts +428 -111
  247. package/src/sdk/host/surface-policy.ts +1 -0
  248. package/src/sdk/index.ts +8 -0
  249. package/src/sdk/lifecycle-session.ts +3 -1
  250. package/src/sdk/mcp/server.ts +15 -3
  251. package/src/sdk/prompt-deadline-manager.ts +15 -0
  252. package/src/sdk/protocol/operation-inventory.generated.json +146 -0
  253. package/src/sdk/protocol/operation-registry.ts +9 -2
  254. package/src/sdk/router/session-router.ts +94 -14
  255. package/src/sdk/session-list.ts +1 -0
  256. package/src/sdk/session.ts +81 -38
  257. package/src/session/agent-session.ts +674 -224
  258. package/src/session/artifacts.ts +174 -70
  259. package/src/session/internal/managed-gc-retirement-codec.ts +319 -0
  260. package/src/session/internal/managed-session-scope.ts +3457 -462
  261. package/src/session/internal/managed-session-storage.ts +482 -61
  262. package/src/session/internal/managed-task-owner-cleanup.ts +473 -0
  263. package/src/session/internal/task-artifact-owner-access.ts +245 -0
  264. package/src/session/internal/task-artifact-owner-transcript.ts +614 -0
  265. package/src/session/session-manager.ts +939 -133
  266. package/src/session/session-retirement.ts +714 -0
  267. package/src/session/session-storage.ts +418 -174
  268. package/src/session/session-transcript-header.ts +17 -0
  269. package/src/session/task-artifact-owner-codec.ts +641 -0
  270. package/src/session/task-artifact-owner-retirement.ts +477 -0
  271. package/src/session/task-artifact-owner.ts +289 -0
  272. package/src/setup/credential-auto-import.ts +12 -3
  273. package/src/setup/credential-import.ts +176 -5
  274. package/src/setup/paseo/announce.ts +6 -1
  275. package/src/skill-state/active-state.ts +132 -2
  276. package/src/slash-commands/builtin-registry.ts +39 -9
  277. package/src/slash-commands/helpers/progress-report.ts +23 -0
  278. package/src/stt/setup.ts +3 -5
  279. package/src/task/commands.ts +3 -1
  280. package/src/task/executor.ts +4 -0
  281. package/src/task/index.ts +6 -0
  282. package/src/tools/ask.ts +205 -6
  283. package/src/tools/ast-edit.ts +4 -0
  284. package/src/tools/bash-allowed-prefixes.ts +15 -0
  285. package/src/tools/bash-skill-urls.ts +56 -3
  286. package/src/tools/bash.ts +48 -79
  287. package/src/tools/descriptors.ts +5 -1
  288. package/src/tools/eval.ts +56 -36
  289. package/src/tools/image-gen.ts +1 -1
  290. package/src/tools/index.ts +3 -0
  291. package/src/tools/python.ts +187 -66
  292. package/src/tools/recipe/index.ts +9 -0
  293. package/src/tools/recipe/recipe-guard.ts +19 -0
  294. package/src/tools/restricted-cwd.ts +10 -0
  295. package/src/tools/skill-discovery.ts +5 -0
  296. package/src/tools/skill.ts +28 -1
  297. package/src/tools/todo-write.ts +10 -1
  298. package/src/tools/tool-catalog.generated.ts +1 -1
  299. package/src/tools/write.ts +1 -0
  300. package/src/utils/tools-checksum.ts +34 -0
  301. package/src/utils/tools-manager.ts +24 -6
  302. package/src/web/search/providers/codex.ts +3 -2
@@ -291,8 +291,13 @@ export declare const SDK_LIFECYCLE_ROUTER_PROTOCOL_VERSION = 1;
291
291
  * so generation-191 owners cannot reap hosts with queued or promoted work.
292
292
  * Generation 193 gates streamed content on negotiated observer capabilities,
293
293
  * so existing owners are replaced before exposing the new observer path.
294
+ * Generation 201 binds queued cancellation and terminal deadlines to the exact
295
+ * consuming run, so pre-fix owners cannot serve the new generic lifecycle path.
296
+ * Generation 202 joins queued-removal terminal publication before ordinary
297
+ * abort acknowledgement, replacing owners that still acknowledge cancellation
298
+ * before its terminal record is durable.
294
299
  */
295
- export declare const DAEMON_GENERATION = 200;
300
+ export declare const DAEMON_GENERATION = 202;
296
301
  /**
297
302
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 7
298
303
  * requires durable publication receipts and acknowledged attachment dispatch,
@@ -9,6 +9,7 @@ import { type DaemonProcessReference } from "./telegram-daemon-control";
9
9
  import { type TelegramSetupPreflight } from "./telegram-setup";
10
10
  export { loadInstallationHostId, loadLegacyInstallationHostId, type MachineIdentityDeps, parseMacPlatformUuid, parseWindowsMachineGuid, } from "../../config/machine-identity";
11
11
  export { DAEMON_GENERATION, NOTIFICATION_EVENT_SCHEMA_VERSION, NOTIFICATION_PROTOCOL_VERSION, SDK_LIFECYCLE_ROUTER_PROTOCOL_VERSION, SERVING_EPOCH, TELEGRAM_TRANSPORT_GENERATION, } from "./telegram-daemon-contract";
12
+ import { POSITIONED_NOTIFICATION_EFFECTS_CAPABILITY } from "../host/host";
12
13
  import { type AgentDirSessionLifecycleService } from "../lifecycle/client";
13
14
  import { type NotificationSubscription, type SessionRouterProviderDeps } from "../router/session-router";
14
15
  import { NotificationOperatorRuntime } from "./operator-runtime";
@@ -136,8 +137,8 @@ export declare const ASK_CONTROLS_CAPABILITY = "ask_controls_v1";
136
137
  export declare const TOOL_ACTIVITY_CAPABILITY = "tool_activity_v2";
137
138
  /** Receive-only compatibility capability for pre-v2 hosts. */
138
139
  export declare const LEGACY_TOOL_ACTIVITY_CAPABILITY = "tool_activity_v1";
139
- /** Opts notification adapters into positioned-only delivery for matching live effects. */
140
- export declare const POSITIONED_NOTIFICATION_EFFECTS_CAPABILITY = "positioned_notification_effects_v1";
140
+ /** Public `sdk/bus/telegram-daemon` path for the canonical `sdk/host` capability token. */
141
+ export { POSITIONED_NOTIFICATION_EFFECTS_CAPABILITY };
141
142
  /**
142
143
  * File-lock options whose acquisition budget covers the full reload-reservation
143
144
  * critical section: the in-lock freshness poll plus the controller's
@@ -58,6 +58,8 @@ export interface SdkClientOptions {
58
58
  }
59
59
  export interface SdkRequestOptions {
60
60
  timeoutMs?: number;
61
+ /** Absolute wall-clock deadline for this request, including connection setup. */
62
+ deadline?: number;
61
63
  idempotencyKey?: string;
62
64
  confirm?: boolean;
63
65
  /**
@@ -85,6 +85,12 @@ export declare const TOOL_ACTIVITY_CAPABILITY = "tool_activity_v2";
85
85
  export declare const TURN_STREAM_CAPABILITY = "turn_stream";
86
86
  /** Capability used by notification adapters that observe a host without owning its work. */
87
87
  export declare const SESSION_HOST_OBSERVER_CAPABILITY = "session_host_observer_v1";
88
+ /**
89
+ * Opts notification adapters into positioned-only delivery for matching live
90
+ * effects: the host excludes a negotiating connection from the raw native leg
91
+ * of every frame its positioned envelope already reached.
92
+ */
93
+ export declare const POSITIONED_NOTIFICATION_EFFECTS_CAPABILITY = "positioned_notification_effects_v1";
88
94
  export declare const CAP_GATED_FRAME_KINDS: ReadonlySet<string>;
89
95
  /** Keep live delivery and replay on one capability gate. */
90
96
  export declare function canDeliverSdkEvent(kind: string, capabilities: ReadonlySet<string> | undefined): boolean;
@@ -1,3 +1,4 @@
1
+ import type { ProjectProgressSnapshot } from "../../../progress/progress-contract.js";
1
2
  import type { ActiveProviderDescriptor } from "../../providers.js";
2
3
  import { type CursorRegistry } from "./cursor.js";
3
4
  import type { RevisionStore } from "./revision-store.js";
@@ -33,6 +34,8 @@ export interface SessionSurface {
33
34
  totalBytes: number;
34
35
  } | undefined>;
35
36
  getJobs(): unknown | Promise<unknown>;
37
+ /** Q32 read-only project progress snapshot (`gjc.project_progress.v1`). */
38
+ getProjectProgress?(): ProjectProgressSnapshot | Promise<ProjectProgressSnapshot>;
36
39
  /** Q26 keyed lookup of a submitted prompt's authoritative reconciliation status. */
37
40
  getPromptStatus?(selector: {
38
41
  commandId?: string;
@@ -1,4 +1,5 @@
1
1
  export { MODEL_PROFILE_DISCOVERY_QUERY, MODEL_PROFILE_ERROR_DETAIL_MAX_BYTES, type ModelProfileCatalogItem, type ModelProfileErrorCode, type ModelProfileErrorDetails, ModelProfileRegistryError, type ModelProfileRegistryErrorDetails, type UnknownModelProfileDetails, UnknownModelProfileError, } from "../config/model-profile-contract";
2
+ export { PROJECT_PROGRESS_SNAPSHOT_SCHEMA, type ProgressSnapshotAttention, type ProgressSnapshotStory, type ProgressSnapshotTodo, type ProgressSnapshotWorkflow, type ProjectProgressSnapshot, } from "../progress/progress-contract";
2
3
  export type { QueuedInputAdmission, QueuedInputDelivery, QueuedInputExecution, QueuedInputQueuePolicy, QueuedInputRemovalReason, QueuedInputSubmission, QueuedInputTerminal, SendUserMessageOptions, TrackedSendUserMessageOptions, } from "../session/agent-session";
3
4
  export * as bus from "./bus";
4
5
  export * from "./diagnostics/observe-broker";
@@ -112,6 +112,7 @@ export interface SessionRouterClient {
112
112
  connect?(): Promise<void>;
113
113
  request(frame: Record<string, unknown>, options?: {
114
114
  timeoutMs?: number;
115
+ deadline?: number;
115
116
  connectedOnly?: boolean;
116
117
  /** Synchronous pre-send observer; a throw aborts the dispatch before the wire. */
117
118
  beforeDispatch?: (context: SdkDispatchContext) => void;
@@ -181,6 +182,13 @@ export interface SessionRouterOptions {
181
182
  attachFilter?: (sessionId: string) => boolean;
182
183
  /** Marks default SDK clients as notification-only observers; demanding by default. */
183
184
  observer?: boolean;
185
+ /**
186
+ * Negotiates positioned-only notification effects on default SDK clients, so the
187
+ * host stops sending them the raw native copy of frames whose positioned
188
+ * envelope already reached them. Only notification-effect publishers opt in;
189
+ * ordinary SDK observers keep both public surfaces.
190
+ */
191
+ positionedNotificationEffects?: boolean;
184
192
  deps?: SessionRouterDeps;
185
193
  /** Runtime-specific identity validation; Router supplies a conservative fallback. */
186
194
  correlateFrame?: SessionRouterFrameCorrelator;
@@ -217,6 +225,7 @@ export declare class SessionRouter {
217
225
  /** Sends an SDK command through the current attachment without exposing its client. */
218
226
  request(sessionId: string, frame: Record<string, unknown>, expectedGeneration?: number, expectedAttachment?: SessionAttachment, options?: {
219
227
  timeoutMs?: number;
228
+ deadline?: number;
220
229
  beforeDispatch?: (context: SdkDispatchContext) => void;
221
230
  onDispatch?: SdkDispatchHandler;
222
231
  dispatchFence?: (dispatch: () => Promise<Record<string, unknown>>) => Promise<Record<string, unknown>>;
@@ -1,6 +1,6 @@
1
1
  export type SessionListPageRecord = Record<string, unknown>;
2
2
  export type SessionListSavedSessionOmissionReason = "scope_unavailable" | "candidate_scan_failed" | "candidate_not_found" | "candidate_ambiguous" | "candidate_invalid" | "identity_incomplete";
3
- export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "atomic_unavailable", "invalid_request", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
3
+ export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "managed_gc_journal_capacity_exceeded", "atomic_unavailable", "invalid_request", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
4
4
  export type SessionListSavedSessionOmissionDetailCode = (typeof SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES)[number];
5
5
  /** Path-free diagnostic for a requested managed transcript that could not be selected safely. */
6
6
  export interface SessionListSavedSessionOmission {
@@ -3,6 +3,7 @@ import { type AuthCredentialSelector, type Model, type ProviderSessionState } fr
3
3
  import { createAppendOnlyContextManager, providerSupportsAppendOnlyAuto, resolveAppendOnlyMode } from "../append-only-mode";
4
4
  import { AsyncJobManager } from "../async";
5
5
  import { type Rule } from "../capability/rule";
6
+ import type { ModelProfileOwnershipMarker } from "../config/model-profile-ownership";
6
7
  import { ModelRegistry } from "../config/model-registry";
7
8
  import { type ScopedModelSelection } from "../config/model-resolver";
8
9
  import { type PromptTemplate } from "../config/prompt-templates";
@@ -82,6 +83,8 @@ export interface CreateAgentSessionOptions {
82
83
  modelPattern?: string;
83
84
  /** Active profile inherited by a nested SDK/subagent session. */
84
85
  activeModelProfile?: string;
86
+ /** Model profile ownership marker for propagating parent profile ownership to subagent sessions. */
87
+ modelProfileOwnershipMarker?: ModelProfileOwnershipMarker;
85
88
  /** Thinking selector. Default: from settings, else unset */
86
89
  thinkingLevel?: ThinkingLevel;
87
90
  /** Runtime substitution metadata for the initial model_change session event. */
@@ -194,6 +197,11 @@ export interface CreateAgentSessionOptions {
194
197
  * @internal lifecycle-only startup guard.
195
198
  */
196
199
  deferOptionalModelRefresh?: boolean;
200
+ /**
201
+ * Defer model profile activation until explicit model pin validation occurs.
202
+ * @internal Lifecycle-only: prevents default profile activation before pin resolution.
203
+ */
204
+ deferModelProfileActivation?: boolean;
197
205
  /** Enable LSP integration (tool, formatting, diagnostics, warmup). Default: true */
198
206
  enableLsp?: boolean;
199
207
  /** Skip Python kernel availability check and prelude warmup */
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * Modes use this class and add their own I/O layer on top.
14
14
  */
15
- import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTool, type MidRunMaintenanceOutcome, type RunSettlementProof, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
15
+ import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTerminalOwnerContext, type AgentTool, type MidRunMaintenanceOutcome, type RunCancellationDomain, type RunSettlementProof, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
16
16
  import type { AttemptScope } from "@gajae-code/agent-core/attempt-scope";
17
17
  import { type CompactionResult, type EmergencyCompactionSample } from "@gajae-code/agent-core/compaction";
18
18
  import type { AssistantMessage, AttemptScopeRef, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolCall, ToolChoice, Usage, UsageReport } from "@gajae-code/ai/core";
@@ -68,7 +68,7 @@ export interface ForkContextSeedOptions {
68
68
  signal?: AbortSignal;
69
69
  }
70
70
  import type { AuthCredentialSelector } from "@gajae-code/ai/core";
71
- import { type AsyncJob, type AsyncJobDeliveryState, AsyncJobManager, type FoldReason, type JobFoldEvent } from "../async";
71
+ import { type AsyncJob, type AsyncJobDeliveryState, AsyncJobManager, type FoldReason, type JobFoldEvent, type SubagentLifecycle } from "../async";
72
72
  import type { Rule } from "../capability/rule";
73
73
  import { type ModelRegistry } from "../config/model-registry";
74
74
  import { type ResolvedModelRoleValue, type ScopedModelSelection } from "../config/model-resolver";
@@ -84,7 +84,7 @@ import type { ExtensionRunner } from "../extensibility/extensions";
84
84
  import { type CompactOptions, type ContextUsage, type ExtensionTranscriptEntry } from "../extensibility/extensions/types";
85
85
  import type { GjcRuntimeSnapshotProvider } from "../extensibility/gjc-plugins/runtime-quarantine";
86
86
  import type { SessionSwitchEvent } from "../extensibility/shared-events";
87
- import { type Skill, type SkillWarning } from "../extensibility/skills";
87
+ import { type ParsedSkillInvocation, type Skill, type SkillWarning } from "../extensibility/skills";
88
88
  import { type FileSlashCommand } from "../extensibility/slash-commands";
89
89
  import { type MemoryGuardClaimsLease } from "../gjc-runtime/memory-guard-owner-claims";
90
90
  import { GoalRuntime } from "../goals/runtime";
@@ -113,7 +113,7 @@ import { type ContributionPrepOptions, type ContributionPrepResult } from "./con
113
113
  import { type FoldAdapter, FoldCoordinator, type ForegroundFoldOutcome } from "./fold-coordinator";
114
114
  import type { MemoryGuardRestoreResult } from "./memory-guard-checkpoint-participant";
115
115
  import { type CustomMessage } from "./messages";
116
- import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManagerCloseOutcome, SessionMemoryStats } from "./session-manager";
116
+ import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManagerCloseOutcome, SessionMemoryStats, SessionArtifactPublication } from "./session-manager";
117
117
  import { SessionManager } from "./session-manager";
118
118
  import { ToolChoiceQueue } from "./tool-choice-queue";
119
119
  import { YieldQueue } from "./yield-queue";
@@ -603,11 +603,7 @@ export declare class SessionDisposalIncompleteError extends Error {
603
603
  constructor(label?: string);
604
604
  }
605
605
  export declare function isSessionDisposalIncompleteError(error: unknown): error is SessionDisposalIncompleteError;
606
- export interface AgentBashArtifactStore {
607
- saveArtifact(content: string, toolType: string): Promise<string | undefined>;
608
- getArtifactPath(id: string): Promise<string | null>;
609
- }
610
- export declare function saveAgentBashOriginalArtifact(store: AgentBashArtifactStore, originalText: string): Promise<BashArtifactSaveResult>;
606
+ export declare function saveAgentBashOriginalArtifact(publication: SessionArtifactPublication, originalText: string): Promise<BashArtifactSaveResult>;
611
607
  type IrcRosterClaim = {
612
608
  token: symbol;
613
609
  signature: string;
@@ -854,6 +850,11 @@ export declare class AgentSession {
854
850
  getAsyncJobSnapshot(options?: {
855
851
  recentLimit?: number;
856
852
  }): AsyncJobSnapshot | null;
853
+ /**
854
+ * Lifecycle status of every subagent owned by this session, read from the
855
+ * manager's stable control-plane records (they outlive AsyncJob eviction).
856
+ */
857
+ getSubagentLifecycleStatuses(): SubagentLifecycle[];
857
858
  /**
858
859
  * Emit a UI-only notice to the session. Surfaces in interactive mode as a
859
860
  * `showWarning` / `showError` / `showStatus` line; non-interactive modes
@@ -1212,6 +1213,20 @@ export declare class AgentSession {
1212
1213
  * @throws Error if no model selected or no API key available (when not streaming)
1213
1214
  */
1214
1215
  prompt(text: string, options?: PromptOptions): Promise<void>;
1216
+ /**
1217
+ * The loaded skill a prompt's text dispatches to, or undefined when `prompt`
1218
+ * would submit it as ordinary text (unknown or disabled `/skill:` names,
1219
+ * chains, or attached images). Single source for dispatch and for callers
1220
+ * that must mirror it, such as startup title seeding.
1221
+ */
1222
+ resolvePromptSkillInvocation(text: string, images?: readonly unknown[]): ParsedSkillInvocation | undefined;
1223
+ /**
1224
+ * Whether `prompt` intercepts this slash text as an extension or custom/MCP
1225
+ * command. Used to keep command arguments away from the title model. Mirrors the
1226
+ * command lookup in `#tryExecuteExtensionCommand` / `#tryExecuteCustomCommand`
1227
+ * without executing anything.
1228
+ */
1229
+ isLocallyHandledSlashCommand(text: string): boolean;
1215
1230
  promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "steerQueuePolicy" | "onPreflightAccepted" | "onPreflightAcceptCommit" | "preflightSignal" | "sdkRunCapability">): Promise<void>;
1216
1231
  /**
1217
1232
  * Queue a steering message to interrupt the agent mid-run.
@@ -1397,6 +1412,8 @@ export declare class AgentSession {
1397
1412
  rebindTerminalAbortSteeringSnapshot(token: number): void;
1398
1413
  discardTerminalAbortSteeringSnapshot(token: number): void;
1399
1414
  getTerminalTurnEpoch(): number | undefined;
1415
+ getTerminalRunOwnerForEvent(event: object): AgentTerminalOwnerContext | undefined;
1416
+ getRunOwnerDomain(handle: string): RunCancellationDomain | undefined;
1400
1417
  /**
1401
1418
  * Tool call ids the run resource ledger currently holds for `handle` (#5637).
1402
1419
  *
@@ -1464,6 +1481,17 @@ export declare class AgentSession {
1464
1481
  }): Promise<void>;
1465
1482
  setActiveModelProfile(name: string | undefined): void;
1466
1483
  getActiveModelProfile(): string | undefined;
1484
+ setUnavailableModelProfile(name: string | undefined): void;
1485
+ getUnavailableModelProfile(): string | undefined;
1486
+ /** Revision fence for deferred activation after a user model selection. */
1487
+ getUserModelSelectionRevision(): number;
1488
+ /** Latest concrete user choice that seeded or cleared the session's sticky canonical variant. */
1489
+ getUserCanonicalVariantSelection(): {
1490
+ revision: number;
1491
+ canonicalVariant: string | undefined;
1492
+ };
1493
+ /** Fence deferred startup profile recovery before an explicit control-surface selection. */
1494
+ markUserModelSelection(): void;
1467
1495
  /**
1468
1496
  * Re-apply vendor-separated delegation after a profile activation changed the
1469
1497
  * role layer. `eagerTasks` is resolved at prompt build time, but under
@@ -1597,6 +1625,7 @@ export declare class AgentSession {
1597
1625
  reason?: TemporaryModelReason;
1598
1626
  providerSessionScope?: TemporaryProviderSessionScope;
1599
1627
  signal?: AbortSignal;
1628
+ shouldMutate?: () => boolean;
1600
1629
  onMutationStarted?: () => void;
1601
1630
  }): Promise<TemporaryProviderSessionScope | void>;
1602
1631
  /** Restore the exact live-model state captured before a failed selector transaction. */
@@ -77,8 +77,8 @@ export declare class ArtifactManager {
77
77
  * Best-effort removal of a previously published named artifact. Used to roll
78
78
  * back staged publications when a transactional operation (e.g. gated
79
79
  * maintenance pruning) is rejected after publication succeeded. Returns false
80
- * when the artifact could not be removed so callers can log the failure
81
- * instead of silently treating the rollback as complete.
80
+ * when the exact named artifact is absent or could not be removed; success does
81
+ * not claim that unrelated native cleanup residue was reclaimed.
82
82
  */
83
83
  removeNamedBestEffort(filename: string): Promise<boolean>;
84
84
  /**
@@ -0,0 +1,32 @@
1
+ import type { SessionStorageFileIdentity } from "../session-storage";
2
+ import { type TaskArtifactOwnerDeletionEvidence, type TaskArtifactOwnerLocator, type TaskArtifactOwnerRetirementContinuation, type TaskArtifactOwnerRetirementOutcome, type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
3
+ export type ManagedGcSessionRetirementState = "prepared" | "artifacts_removed" | "owner_pending" | "owner_retired";
4
+ export interface ManagedGcSessionRetirementTarget {
5
+ readonly transcriptPath: string;
6
+ readonly sessionId: string;
7
+ readonly cwd: string;
8
+ readonly transcriptIdentity: SessionStorageFileIdentity;
9
+ readonly taskArtifactOwnerLocator: TaskArtifactOwnerLocator;
10
+ }
11
+ export interface ManagedGcSessionRetirementReceipt extends ManagedGcSessionRetirementTarget {
12
+ readonly state: ManagedGcSessionRetirementState;
13
+ readonly taskArtifactOwnerDeletionEvidence: TaskArtifactOwnerDeletionEvidence;
14
+ readonly artifactsRemoved?: true;
15
+ readonly ownerRetirementAttempt?: number;
16
+ readonly taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
17
+ readonly taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
18
+ readonly taskArtifactOwnerPayloadRetired?: true;
19
+ readonly taskArtifactOwnerNamespaceRetained?: true;
20
+ readonly taskArtifactOwnerRetired?: true;
21
+ }
22
+ export declare function managedGcRetirementIdentityRecord(identity: SessionStorageFileIdentity): Record<string, unknown>;
23
+ export declare function sameIdentity(left: SessionStorageFileIdentity, right: SessionStorageFileIdentity): boolean;
24
+ export declare function managedGcRetirementIdentityValue(value: unknown): SessionStorageFileIdentity;
25
+ /**
26
+ * Strictly decode one persisted managed-GC receipt. A decoded `owner_retired` outcome is persisted DTO data only;
27
+ * this pure parser does not verify current filesystem state, payload destruction, or writer quiescence. A future
28
+ * journal reader must perform the live physical-retirement proof for the relevant state before treating it as done.
29
+ */
30
+ export declare function parseManagedGcRetirementReceipt(value: unknown, scopeDigest: string, ownerContext: TaskArtifactOwnerStorageContext, target: ManagedGcSessionRetirementTarget): ManagedGcSessionRetirementReceipt;
31
+ /** Check only monotone DTO history; this does not establish physical cleanup or current authority. */
32
+ export declare function continuationExtendsPrevious(previous: TaskArtifactOwnerRetirementContinuation, next: TaskArtifactOwnerRetirementContinuation): boolean;
@@ -1,6 +1,8 @@
1
1
  import type { RecoveryFsRoot } from "@gajae-code/natives";
2
2
  import type { ResumeSessionIdentity } from "../session-manager";
3
3
  import { type NativeDirectoryTreeSnapshot } from "../session-storage";
4
+ import { type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
5
+ import { type ManagedGcSessionRetirementReceipt, type ManagedGcSessionRetirementTarget } from "./managed-gc-retirement-codec";
4
6
  import { type ManagedDirectoryRoot, type ManagedSessionSecurityPolicy, type ManagedStorageLock } from "./managed-session-storage";
5
7
  export declare const MANAGED_SESSION_LAYOUT_VERSION: 2;
6
8
  export declare const MANAGED_SESSION_IDENTITY_VERSION: 1;
@@ -17,6 +19,57 @@ export interface ManagedScope {
17
19
  directoryPath: string;
18
20
  platform: "posix" | "win32";
19
21
  }
22
+ export interface ManagedGcProtocolPathIdentity {
23
+ readonly path: string;
24
+ readonly dev: string;
25
+ readonly ino: string;
26
+ }
27
+ export interface ManagedGcProtocolFileSnapshot {
28
+ readonly name: string;
29
+ readonly dev: string;
30
+ readonly ino: string;
31
+ readonly nlink: string;
32
+ readonly size: number;
33
+ readonly mtimeNs: string;
34
+ readonly ctimeNs: string;
35
+ readonly mode: number;
36
+ readonly sha256: string;
37
+ }
38
+ export type ManagedGcProtocolRole = "locks" | "receipts" | "tombstones";
39
+ export interface ManagedGcProtocolDirectorySnapshot {
40
+ readonly role: ManagedGcProtocolRole;
41
+ readonly path: string;
42
+ readonly dev: string;
43
+ readonly ino: string;
44
+ readonly mtimeNs: string;
45
+ readonly ctimeNs: string;
46
+ readonly mode: number;
47
+ readonly files: readonly ManagedGcProtocolFileSnapshot[];
48
+ }
49
+ /** Read-only protocol data; never a deletion capability. */
50
+ export interface ManagedGcProtocolScopeSnapshot {
51
+ readonly configuredRoot: ManagedGcProtocolPathIdentity;
52
+ readonly profile: ManagedGcProtocolPathIdentity;
53
+ readonly sessionsRoot: ManagedGcProtocolPathIdentity;
54
+ readonly scope: ManagedGcProtocolPathIdentity;
55
+ readonly binding: ManagedGcProtocolFileSnapshot;
56
+ readonly protocol: ManagedGcProtocolPathIdentity;
57
+ readonly protocolMtimeNs: string;
58
+ readonly protocolCtimeNs: string;
59
+ readonly protocolMode: number;
60
+ readonly directories: readonly ManagedGcProtocolDirectorySnapshot[];
61
+ }
62
+ export interface ManagedGcProtocolScopeInput {
63
+ readonly scopePath: string;
64
+ readonly scopeIdentity: ManagedGcProtocolPathIdentity;
65
+ readonly bindingIdentity: ManagedGcProtocolFileSnapshot;
66
+ readonly protocolIdentity: ManagedGcProtocolScopeSnapshot["protocol"] & {
67
+ readonly mtimeNs: string;
68
+ readonly ctimeNs: string;
69
+ readonly mode: number;
70
+ };
71
+ }
72
+ export type ManagedGcProtocolScopeInspector = (inputs: readonly ManagedGcProtocolScopeInput[]) => Promise<readonly ManagedGcProtocolScopeSnapshot[]>;
20
73
  /**
21
74
  * Opaque managed writer authority captured by a trusted destination. The open
22
75
  * transaction must use this authority rather than reacquiring its root from a
@@ -34,7 +87,7 @@ export declare function managedDirectoryIdentityForScope(scope: ManagedScope): {
34
87
  };
35
88
  export declare function managedRootForScope(scope: ManagedScope): ManagedDirectoryRoot;
36
89
  export type ManagedMigrationPolicy = "copy-retain" | "disabled";
37
- export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable" | "capacity_exceeded";
90
+ export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "managed_gc_journal_capacity_exceeded" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable" | "capacity_exceeded";
38
91
  export type ManagedScopeResolution = {
39
92
  kind: "resolved";
40
93
  scope: ManagedScope;
@@ -69,7 +122,7 @@ export type ManagedCandidateListing = {
69
122
  code: "scan_failed" | "unsafe_root" | "invalid_candidate";
70
123
  message: string;
71
124
  };
72
- export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
125
+ export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "managed_gc_journal_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
73
126
  export type ManagedOpenCandidateResult = {
74
127
  kind: "opened";
75
128
  path: string;
@@ -132,6 +185,8 @@ interface ManagedScopeInput {
132
185
  export declare function resolveManagedScope(input: ManagedScopeInput): ManagedScopeResolution;
133
186
  /** Resolve a scope for a synchronous write without mutating an existing ACL mismatch. */
134
187
  export declare function resolveManagedScopeForWrite(input: ManagedScopeInput): ManagedScopeResolution;
188
+ /** Resolve only an existing, authenticated v2 scope; this path never initializes or repairs storage. */
189
+ export declare function resolveManagedGcScopeForRead(input: ManagedScopeInput): ManagedScopeResolution;
135
190
  export declare function canonicalBindingOpenFlags(platform?: NodeJS.Platform): number;
136
191
  export declare function fsyncCanonicalBinding(bindingPath: string, expected: string): void;
137
192
  export declare function ensureManagedScope(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy): Promise<ManagedScopeResolution>;
@@ -201,6 +256,28 @@ export declare function isRecoverableOwnerOnlyModeDrift(error: unknown): boolean
201
256
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
202
257
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
203
258
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
259
+ /** Build owner-storage authority only from a previously prepared trusted managed scope. */
260
+ export declare function taskArtifactOwnerStorageContextForScope(scope: ManagedScope): TaskArtifactOwnerStorageContext;
261
+ /** Bind the first transcript header through FileSessionStorage's descriptor-bound, no-follow snapshot. */
262
+ export declare function bindManagedGcSessionRetirementTarget(scope: ManagedScope, transcriptPathValue: string): ManagedGcSessionRetirementTarget;
263
+ /** Read the prepared authority first, then strictly validate every later receipt against it. */
264
+ export declare function readManagedGcSessionRetirementReceipt(scope: ManagedScope, transcriptPath: string): Promise<ManagedGcSessionRetirementReceipt | undefined>;
265
+ /** Read an authenticated journal without creating lock/receipt directories or repairing security state. */
266
+ export declare function readManagedGcSessionRetirementReceiptReadOnly(scope: ManagedScope, transcriptPath: string): Promise<ManagedGcSessionRetirementReceipt | undefined>;
267
+ /** Discover complete owner journals under authenticated existing v2 scopes without initializing storage. */
268
+ export declare function discoverManagedGcSessionRetirementReceipts(input: {
269
+ agentDir: string;
270
+ sessionsRoot: string;
271
+ }): Promise<readonly {
272
+ readonly scope: ManagedScope;
273
+ readonly receipt: ManagedGcSessionRetirementReceipt;
274
+ }[]>;
275
+ /** Inspect under a live operation lease; returned snapshots never authorize effects. */
276
+ export declare function managedGcProtocolInspectorForLock(scope: ManagedScope, lock: ManagedStorageLock): ManagedGcProtocolScopeInspector;
277
+ /** Bind a read-only protocol inventory to an already prepared scope's root/profile/session identities. */
278
+ export declare function managedGcProtocolScopeInspectorForScope(scope: ManagedScope): ManagedGcProtocolScopeInspector;
279
+ /** Atomically publish one journal state under the managed scope lock; no GC effects are activated here. */
280
+ export declare function publishManagedGcSessionRetirementReceipt(scope: ManagedScope, receipt: ManagedGcSessionRetirementReceipt): Promise<ManagedGcSessionRetirementReceipt>;
204
281
  export declare function artifactTreeReplayCompatible(observed: NativeDirectoryTreeSnapshot, expected: NativeDirectoryTreeSnapshot): boolean;
205
282
  type DetachedArtifactRoot = {
206
283
  originalPath: string;
@@ -5,6 +5,7 @@ export declare const MANAGED_ARTIFACT_MAX_DEPTH = 32;
5
5
  export declare const MANAGED_ARTIFACT_MAX_FILES = 50000;
6
6
  export declare const MANAGED_ARTIFACT_MAX_FILE_BYTES: number;
7
7
  export declare const MANAGED_ARTIFACT_MAX_TOTAL_BYTES: number;
8
+ export declare const MANAGED_SESSION_READ_RANGE_MAX_BYTES: number;
8
9
  export declare const MANAGED_ARTIFACT_COPY_BATCH_SIZE = 256;
9
10
  /** A pre-mutation append fence rejection: no bytes from this append were written. */
10
11
  export declare class ManagedAppendIdentityMismatchError extends Error {
@@ -104,6 +105,8 @@ export interface ManagedBoundedAppendExpectation {
104
105
  readonly ctimeNs: string;
105
106
  readonly sha256: string;
106
107
  }
108
+ /** Exact quarantine names used when native exact-unlink leaves a scrubbed lock inode. */
109
+ export declare function isManagedLockQuarantineName(name: string): boolean;
107
110
  export interface ScrubbedProtocolRemnantReapResult {
108
111
  readonly reaped: number;
109
112
  readonly failures: number;
@@ -135,6 +138,16 @@ export declare function reapScrubbedProtocolRemnantsSync(directory: string, minA
135
138
  */
136
139
  export declare function reapScrubbedProtocolRemnants(directory: string, minAgeMs?: number): Promise<ScrubbedProtocolRemnantReapResult>;
137
140
  export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
141
+ export type LockRecord = {
142
+ attemptId: string;
143
+ pid: number;
144
+ bootId?: string;
145
+ processStartId: string;
146
+ createdAt: number;
147
+ heartbeatAt: number;
148
+ leaseExpiresAt: number;
149
+ released?: boolean;
150
+ };
138
151
  export interface ManagedLockRetirementTestEvent {
139
152
  readonly path: string;
140
153
  readonly attemptId: string;
@@ -168,13 +181,18 @@ export declare function retainManagedDirectoryAuthority(root: ManagedDirectoryRo
168
181
  }): RecoveryFsRoot | undefined;
169
182
  export declare function assertManagedDirectoryRoot(root: ManagedDirectoryRoot): void;
170
183
  export declare function managedSecurityFailureClassification(error: unknown): string | undefined;
184
+ /** Exact, identity-bound read access retained for the lifetime of one managed stream. */
185
+ export interface ManagedSessionReadLease {
186
+ readRange(start: number, length: number): Uint8Array;
187
+ close(): void;
188
+ }
171
189
  /** Internal retained-root capability for one managed descendant subtree. */
172
190
  export declare class ManagedSessionDescendantStore {
173
191
  #private;
174
192
  constructor(root: ManagedDirectoryRoot, baseDir: string, retained?: {
175
193
  authority: RecoveryFsRoot;
176
194
  authorityBaseDir: string;
177
- }, policy?: ManagedSessionSecurityPolicy, profileAgentDir?: string);
195
+ }, policy?: ManagedSessionSecurityPolicy, profileAgentDir?: string, expectedSubtreeRoot?: ManagedDirectoryRoot, access?: "read-only" | "read-write");
178
196
  get dir(): string;
179
197
  get rootAuthority(): ManagedDirectoryRoot;
180
198
  get subtreeRootAuthority(): ManagedDirectoryRoot;
@@ -189,6 +207,11 @@ export declare class ManagedSessionDescendantStore {
189
207
  close(): void;
190
208
  assertBound(): void;
191
209
  verifyRootSecurity(): void;
210
+ /** Capture a directory identity through this store's retained managed root without repairing it. */
211
+ captureDirectoryIdentity(relativePath: string): {
212
+ dev: string;
213
+ ino: string;
214
+ };
192
215
  ensureDirectory(relativePath?: string): ManagedDirectoryRoot;
193
216
  publishNoReplace(relativePath: string, bytes: Uint8Array): Promise<void>;
194
217
  publishNoReplaceSync(relativePath: string, bytes: Uint8Array): void;
@@ -218,8 +241,12 @@ export declare class ManagedSessionDescendantStore {
218
241
  * managed-session indexing without weakening pathname authority.
219
242
  */
220
243
  readRangeExpectedSync(relativePath: string, start: number, length: number, expectedDescriptor?: Pick<SessionStorageStat, "dev" | "ino" | "nlink" | "size" | "mtimeNs" | "ctimeNs">): SessionStorageRangeSnapshot;
244
+ /** Open an identity-bound stream lease; Darwin uses exact bounded range reads per chunk. */
245
+ openReadLease(relativePath: string, expectedDescriptor: Pick<SessionStorageStat, "dev" | "ino" | "nlink" | "size" | "mtimeNs" | "ctimeNs">): ManagedSessionReadLease;
221
246
  /** Read an exact managed file without exposing its pathname as authority. */
222
247
  readExpected(relativePath: string): ManagedFileSnapshot | null;
248
+ /** Read one complete managed file through retained authority after descriptor-size admission. */
249
+ readExpectedBounded(relativePath: string, maxBytes: number, admitSize?: (size: number, descriptor: ManagedFileIdentity) => void): ManagedFileSnapshot | null;
223
250
  /** Remove an exact captured file without reopening its pathname as authority. */
224
251
  removeExpected(relativePath: string, expected: ManagedFileSnapshot): void;
225
252
  /** Remove one exact file without allocating its contents. */
@@ -240,13 +267,21 @@ export declare class ManagedSessionDescendantStore {
240
267
  sourceStoreRelativePath: string;
241
268
  }): ManagedFileSnapshot;
242
269
  removeTreeExpected(relativePath: string, expected: NativeDirectoryTreeSnapshot): void;
270
+ /** Remove one exact managed tree through the parent-identity-bound native protocol. */
271
+ removeTreeExpectedWithParentIdentity(relativePath: string, expected: NativeDirectoryTreeSnapshot, parentIdentity: {
272
+ dev: bigint;
273
+ ino: bigint;
274
+ }): NativeExactUnlinkResult;
243
275
  fsyncTree(): NativeDirectoryTreeSnapshot;
244
276
  }
245
277
  export declare function shouldFsyncManagedDirectory(platform?: NodeJS.Platform): boolean;
278
+ export declare function parseManagedLockRecord(bytes: Uint8Array): LockRecord | undefined;
246
279
  /** Create a managed directory and fail closed unless its owner-only mode/ACL verifies. */
247
280
  export declare function ensureManagedDirectory(pathname: string, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
248
281
  /** Captures a bounded prefix from one no-follow descriptor and rechecks the pathname before use. */
249
282
  export declare function captureManagedFilePrefixNoFollow(pathname: string, maxBytes: number): ManagedFileSnapshot;
283
+ /** Captures a complete no-follow file only after descriptor-size admission and before allocating its bytes. */
284
+ export declare function captureManagedFileNoFollowBounded(pathname: string, maxBytes: number, admitSize?: (size: number, descriptor: ManagedFileIdentity) => void): ManagedFileSnapshot;
250
285
  /** Captures header/hash/copy input from one no-follow descriptor and rechecks the pathname before use. */
251
286
  export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
252
287
  /** Streams a managed file once while retaining only a bounded header prefix and the full descriptor-bound digest. */
@@ -0,0 +1,62 @@
1
+ import type { ResumeSessionIdentity } from "../session-manager";
2
+ import { type VerifiedSessionDeleteResult, type VerifiedSessionDeleteTarget } from "../session-storage";
3
+ import type { TaskArtifactOwnerDeletionEvidence, TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
4
+ import type { ManagedGcSessionRetirementReceipt, ManagedGcSessionRetirementTarget } from "./managed-gc-retirement-codec";
5
+ import type { ManagedGcProtocolScopeInspector } from "./managed-session-scope";
6
+ export interface ManagedGcOwnerCleanupTarget {
7
+ readonly path: string;
8
+ readonly sessionId: string;
9
+ readonly cwd: string;
10
+ readonly identity: ResumeSessionIdentity;
11
+ readonly taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
12
+ }
13
+ /** Authenticated receipt operations and fencing supplied by the prepared managed scope. */
14
+ export interface ManagedGcOwnerCleanupAuthority {
15
+ readonly agentDir: string;
16
+ readonly sessionsRoot: string;
17
+ readonly directoryPath: string;
18
+ readonly storageContext: TaskArtifactOwnerStorageContext;
19
+ readonly inspectProtocol: ManagedGcProtocolScopeInspector;
20
+ readonly assertOwned: () => void;
21
+ readonly bindTarget: (transcriptPath: string) => ManagedGcSessionRetirementTarget;
22
+ readonly readReceipt: (transcriptPath: string) => Promise<ManagedGcSessionRetirementReceipt | undefined>;
23
+ readonly publishReceipt: (receipt: ManagedGcSessionRetirementReceipt) => Promise<ManagedGcSessionRetirementReceipt>;
24
+ readonly findCompletedRetirement: (evidence: TaskArtifactOwnerDeletionEvidence, exceptTranscriptPath: string) => Promise<{
25
+ scope: {
26
+ readonly agentDir: string;
27
+ readonly sessionsRoot: string;
28
+ readonly directoryPath: string;
29
+ };
30
+ receipt: ManagedGcSessionRetirementReceipt;
31
+ } | undefined>;
32
+ }
33
+ export type ManagedGcOwnerProgress = {
34
+ readonly state: "none" | "owner_retired" | "payload_retired" | "pending";
35
+ readonly message?: string;
36
+ };
37
+ export type ManagedGcOwnerDeleteFields = Pick<VerifiedSessionDeleteTarget, "taskArtifactOwnerStorageContext" | "taskArtifactOwnerDeletionEvidence" | "taskArtifactOwnerRetirementOutcome" | "taskArtifactOwnerRetirementContinuation" | "taskArtifactOwnerPayloadRetired" | "taskArtifactOwnerNamespaceRetained" | "deferTaskArtifactOwnerRetirement" | "taskArtifactOwnerRetired">;
38
+ export declare function hasUnsupportedLegacyOwnerTarget(scopeDirectory: string, target: ManagedGcOwnerCleanupTarget): boolean;
39
+ export declare function prepareManagedGcOwnerTarget<T extends ManagedGcOwnerCleanupTarget>(authority: ManagedGcOwnerCleanupAuthority, target: T): Promise<T & ManagedGcOwnerCleanupTarget>;
40
+ export declare function prepareManagedGcOwnerTargets<T extends ManagedGcOwnerCleanupTarget>(authority: ManagedGcOwnerCleanupAuthority, targets: readonly T[]): Promise<(T & ManagedGcOwnerCleanupTarget)[]>;
41
+ export declare function managedGcOwnerDeleteFields(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<ManagedGcOwnerDeleteFields>;
42
+ export declare function publishManagedGcArtifactsRemoved(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<ManagedGcSessionRetirementReceipt | undefined>;
43
+ export declare function retireManagedGcOwnerAfterArtifacts(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, tombstoneTargets: readonly ManagedGcOwnerCleanupTarget[]): Promise<ManagedGcOwnerProgress>;
44
+ export declare function persistManagedGcStorageOwnerDisposition(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, deletion: Extract<VerifiedSessionDeleteResult, {
45
+ kind: "cleanup_pending";
46
+ phase: "task_artifact_owner";
47
+ }>): Promise<ManagedGcOwnerProgress>;
48
+ export declare function managedGcOwnerProgressBeforeDelete(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, tombstoneTargets: readonly ManagedGcOwnerCleanupTarget[], artifactsRemoved: boolean): Promise<ManagedGcOwnerProgress>;
49
+ export declare function taskArtifactOwnerTranscriptResult(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<"none" | "retired" | "payload_retired">;
50
+ export interface ManagedGcOwnerTranscriptDeleteReceipt {
51
+ readonly taskArtifactOwnerTranscriptDeleted?: true;
52
+ }
53
+ export declare function persistManagedGcOwnerTranscriptDeletion<T extends ManagedGcOwnerTranscriptDeleteReceipt>(input: {
54
+ target: ManagedGcOwnerCleanupTarget;
55
+ fallback: T;
56
+ deletion: Extract<VerifiedSessionDeleteResult, {
57
+ kind: "deleted";
58
+ }>;
59
+ readLatest: () => T | undefined;
60
+ nextReceipt: (latest: T) => T;
61
+ publishPending: (receipt: T) => Promise<void>;
62
+ }): Promise<void>;
@@ -0,0 +1,19 @@
1
+ import type { NativeDirectoryTreeSnapshot } from "@gajae-code/natives";
2
+ import { type TaskArtifactOwnerDeletionEvidence, type TaskArtifactOwnerLocator, type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
3
+ import { ManagedSessionDescendantStore } from "./managed-session-storage";
4
+ export interface OwnerManifest extends TaskArtifactOwnerLocator {
5
+ readonly sessionId: string;
6
+ }
7
+ export declare function newSessionRootStore(context: TaskArtifactOwnerStorageContext): ManagedSessionDescendantStore;
8
+ /** Path-backed reader with no retained or recovery-mutable native authority. */
9
+ export declare function newSessionRootReaderStore(context: TaskArtifactOwnerStorageContext): ManagedSessionDescendantStore;
10
+ export declare function readOwnerManifest(store: ManagedSessionDescendantStore, locator: TaskArtifactOwnerLocator, relativePath?: string): OwnerManifest;
11
+ export declare function assertOwnerDirectoryExists(context: TaskArtifactOwnerStorageContext, ownerId: string): void;
12
+ export declare function assertOwnerIdentity(store: ManagedSessionDescendantStore, locator: TaskArtifactOwnerLocator): void;
13
+ export declare function openOwnerStore(context: TaskArtifactOwnerStorageContext, rootStore: ManagedSessionDescendantStore, locator: TaskArtifactOwnerLocator, sessionId: string): ManagedSessionDescendantStore;
14
+ export declare function locatorFromManifest(manifest: OwnerManifest): TaskArtifactOwnerLocator;
15
+ export declare function captureValidatedOwnerTree(context: TaskArtifactOwnerStorageContext, rootStore: ManagedSessionDescendantStore, sessionId: string, locator: TaskArtifactOwnerLocator): NativeDirectoryTreeSnapshot;
16
+ export declare function captureOwnerTreeIfPresent(context: TaskArtifactOwnerStorageContext, rootStore: ManagedSessionDescendantStore, ownerId: string, pathname: string): NativeDirectoryTreeSnapshot | undefined;
17
+ export declare function ownerTreeHasPendingManagedPublication(snapshot: NativeDirectoryTreeSnapshot): boolean;
18
+ /** Capture exact owner evidence without repairing its security, timestamps, or namespace. */
19
+ export declare function captureTaskArtifactOwnerDeletionEvidence(context: TaskArtifactOwnerStorageContext, sessionId: string, locatorValue: unknown): TaskArtifactOwnerDeletionEvidence | undefined;