@gajae-code/coding-agent 0.12.21 → 0.13.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 (222) hide show
  1. package/CHANGELOG.md +67 -2
  2. package/dist/types/cli/args.d.ts +5 -2
  3. package/dist/types/cli/root-flags.d.ts +246 -0
  4. package/dist/types/cli.d.ts +11 -19
  5. package/dist/types/commands/daemon.d.ts +0 -30
  6. package/dist/types/commands/launch.d.ts +11 -19
  7. package/dist/types/commands/quick-lane.d.ts +32 -0
  8. package/dist/types/commands/sdk.d.ts +21 -15
  9. package/dist/types/config/file-lock-gc.d.ts +2 -0
  10. package/dist/types/config/model-equivalence.d.ts +20 -0
  11. package/dist/types/config/model-profile-activation.d.ts +62 -17
  12. package/dist/types/config/model-profiles.d.ts +10 -0
  13. package/dist/types/config/model-registry.d.ts +68 -1
  14. package/dist/types/config/model-resolver.d.ts +15 -4
  15. package/dist/types/config/models-config-schema.d.ts +7 -2
  16. package/dist/types/config/provider-selection-policy.d.ts +62 -0
  17. package/dist/types/config/settings-schema.d.ts +36 -78
  18. package/dist/types/config/settings.d.ts +2 -0
  19. package/dist/types/edit/renderer.d.ts +5 -2
  20. package/dist/types/edit/streaming.d.ts +13 -0
  21. package/dist/types/extensibility/custom-tools/types.d.ts +2 -0
  22. package/dist/types/extensibility/extensions/compact-handler.d.ts +2 -1
  23. package/dist/types/extensibility/extensions/types.d.ts +3 -0
  24. package/dist/types/gjc-runtime/gc-runtime.d.ts +19 -5
  25. package/dist/types/internal-urls/local-protocol.d.ts +1 -0
  26. package/dist/types/modes/components/model-selector.d.ts +0 -2
  27. package/dist/types/modes/components/provider-order-context.d.ts +45 -0
  28. package/dist/types/modes/components/provider-order-editor.d.ts +24 -0
  29. package/dist/types/modes/components/settings-defs.d.ts +5 -1
  30. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  31. package/dist/types/quick-lane/classify.d.ts +40 -0
  32. package/dist/types/runtime/stt-settings-setup.d.ts +18 -0
  33. package/dist/types/sdk/broker/broker.d.ts +56 -2
  34. package/dist/types/sdk/broker/operation-receipt-ledger.d.ts +25 -0
  35. package/dist/types/sdk/broker/session-index.d.ts +83 -2
  36. package/dist/types/sdk/broker/state-version.d.ts +1 -1
  37. package/dist/types/sdk/bus/notification-service.d.ts +6 -0
  38. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +8 -1
  39. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +4 -1
  40. package/dist/types/sdk/bus/telegram-daemon.d.ts +26 -0
  41. package/dist/types/sdk/cli/rows.d.ts +98 -0
  42. package/dist/types/sdk/cli/session-cli.d.ts +35 -3
  43. package/dist/types/sdk/elevation/allowlist.d.ts +20 -0
  44. package/dist/types/sdk/elevation/audit.d.ts +93 -0
  45. package/dist/types/sdk/elevation/capability.d.ts +3 -0
  46. package/dist/types/sdk/elevation/digest.d.ts +72 -0
  47. package/dist/types/sdk/elevation/dispatch-receipt.d.ts +85 -0
  48. package/dist/types/sdk/elevation/grant-ledger.d.ts +163 -0
  49. package/dist/types/sdk/elevation/owner.d.ts +48 -0
  50. package/dist/types/sdk/guides/cache.d.ts +98 -0
  51. package/dist/types/sdk/guides/catalog.d.ts +156 -0
  52. package/dist/types/sdk/guides/cli.d.ts +39 -0
  53. package/dist/types/sdk/guides/manifest.d.ts +66 -0
  54. package/dist/types/sdk/guides/verify.d.ts +66 -0
  55. package/dist/types/sdk/host/control/dispatch.d.ts +8 -0
  56. package/dist/types/sdk/host/control/index.d.ts +1 -1
  57. package/dist/types/sdk/host/control/operations.d.ts +3 -2
  58. package/dist/types/sdk/host/query/cursor.d.ts +10 -0
  59. package/dist/types/sdk/host/query/handlers.d.ts +21 -0
  60. package/dist/types/sdk/host/session-runtime.d.ts +9 -0
  61. package/dist/types/sdk/mcp/server.d.ts +2 -2
  62. package/dist/types/sdk/prompt-status.d.ts +11 -0
  63. package/dist/types/sdk/session.d.ts +4 -0
  64. package/dist/types/sdk/transport/index.d.ts +1 -0
  65. package/dist/types/sdk/transport/relay.d.ts +1 -0
  66. package/dist/types/sdk/transport/serve-cli.d.ts +20 -1
  67. package/dist/types/session/agent-session.d.ts +32 -18
  68. package/dist/types/session/blob-store.d.ts +13 -7
  69. package/dist/types/session/fallback-chain-controller.d.ts +15 -0
  70. package/dist/types/session/internal/managed-session-storage.d.ts +25 -1
  71. package/dist/types/session/internal/session-memory-sidecar.d.ts +5 -5
  72. package/dist/types/session/session-manager.d.ts +139 -10
  73. package/dist/types/session/session-storage.d.ts +48 -0
  74. package/dist/types/setup/provider-onboarding.d.ts +7 -1
  75. package/dist/types/slash-commands/builtin-registry.d.ts +14 -0
  76. package/dist/types/stt/setup.d.ts +2 -0
  77. package/dist/types/task/executor.d.ts +10 -2
  78. package/dist/types/tools/browser/runtime-diagnostics.d.ts +65 -0
  79. package/dist/types/tools/browser/tab-protocol.d.ts +4 -0
  80. package/dist/types/tools/browser/tab-supervisor.d.ts +2 -0
  81. package/dist/types/tools/browser/tab-worker.d.ts +2 -0
  82. package/dist/types/tools/browser.d.ts +2 -0
  83. package/dist/types/tools/image-gen.d.ts +14 -18
  84. package/dist/types/tools/index.d.ts +2 -0
  85. package/dist/types/tools/resource-gc.d.ts +2 -0
  86. package/dist/types/utils/pasted-image-path.d.ts +6 -0
  87. package/package.json +9 -9
  88. package/scripts/generate-sdk-operation-inventory.ts +8 -0
  89. package/scripts/run-test-manifest.ts +61 -21
  90. package/scripts/verify-gjc-sdk-canonicalization.ts +9 -4
  91. package/src/cli/args.ts +62 -9
  92. package/src/cli/completion-cli.ts +1 -0
  93. package/src/cli/fast-help.ts +1 -0
  94. package/src/cli/root-flags.ts +100 -0
  95. package/src/cli/setup-cli.ts +6 -2
  96. package/src/cli.ts +42 -65
  97. package/src/commands/acp.ts +1 -1
  98. package/src/commands/daemon.ts +2 -31
  99. package/src/commands/gc.ts +1 -1
  100. package/src/commands/launch.ts +8 -129
  101. package/src/commands/quick-lane.ts +51 -0
  102. package/src/commands/sdk.ts +200 -26
  103. package/src/commands/setup.ts +4 -2
  104. package/src/config/file-lock-gc.ts +4 -1
  105. package/src/config/model-equivalence.ts +76 -7
  106. package/src/config/model-profile-activation.ts +1115 -265
  107. package/src/config/model-profiles.ts +134 -2
  108. package/src/config/model-registry.ts +352 -50
  109. package/src/config/model-resolver.ts +289 -38
  110. package/src/config/models-config-schema.ts +11 -4
  111. package/src/config/provider-selection-policy.ts +146 -0
  112. package/src/config/settings-schema.ts +50 -77
  113. package/src/config/settings.ts +40 -0
  114. package/src/coordinator-mcp/server.ts +32 -2
  115. package/src/edit/renderer.ts +175 -223
  116. package/src/edit/streaming.ts +108 -1
  117. package/src/export/html/index.ts +57 -7
  118. package/src/extensibility/custom-tools/types.ts +2 -0
  119. package/src/extensibility/extensions/compact-handler.ts +3 -2
  120. package/src/extensibility/extensions/runner.ts +6 -0
  121. package/src/extensibility/extensions/types.ts +3 -0
  122. package/src/gjc-runtime/gc-runtime.ts +379 -20
  123. package/src/gjc-runtime/launch-worktree.ts +5 -1
  124. package/src/gjc-runtime/team-runtime.ts +59 -2
  125. package/src/gjc-runtime/tmux-owner-isolation.ts +19 -0
  126. package/src/gjc-runtime/ultragoal-receipt-freshness.ts +16 -1
  127. package/src/internal-urls/docs-index.generated.ts +17 -13
  128. package/src/internal-urls/local-protocol.ts +1 -0
  129. package/src/main.ts +40 -3
  130. package/src/memories/index.ts +4 -2
  131. package/src/modes/acp/acp-agent.ts +235 -91
  132. package/src/modes/components/model-selector.ts +206 -42
  133. package/src/modes/components/provider-order-context.ts +197 -0
  134. package/src/modes/components/provider-order-editor.ts +441 -0
  135. package/src/modes/components/settings-defs.ts +21 -1
  136. package/src/modes/components/settings-selector.ts +45 -2
  137. package/src/modes/components/tool-execution.ts +47 -15
  138. package/src/modes/controllers/command-controller.ts +6 -3
  139. package/src/modes/controllers/extension-ui-controller.ts +2 -0
  140. package/src/modes/controllers/input-controller.ts +73 -2
  141. package/src/modes/controllers/selector-controller.ts +260 -153
  142. package/src/modes/prompt-suggestion-controller.ts +1 -1
  143. package/src/modes/runtime-init.ts +1 -0
  144. package/src/modes/utils/ui-helpers.ts +18 -0
  145. package/src/prompts/tools/browser.md +1 -0
  146. package/src/quick-lane/classify.ts +257 -0
  147. package/src/rlm/index.ts +1 -1
  148. package/src/runtime/stt-settings-setup.ts +57 -0
  149. package/src/sdk/acp/adapter.ts +2 -1
  150. package/src/sdk/broker/broker.ts +780 -12
  151. package/src/sdk/broker/lifecycle.ts +70 -29
  152. package/src/sdk/broker/operation-receipt-ledger.ts +144 -0
  153. package/src/sdk/broker/session-index.ts +463 -48
  154. package/src/sdk/broker/state-version.ts +13 -9
  155. package/src/sdk/broker/transport.ts +14 -1
  156. package/src/sdk/bus/index.ts +34 -13
  157. package/src/sdk/bus/kind-aware-reconciliation.ts +21 -2
  158. package/src/sdk/bus/notification-service.ts +47 -1
  159. package/src/sdk/bus/prompt-reconciliation.ts +22 -3
  160. package/src/sdk/bus/telegram-daemon-contract.ts +4 -1
  161. package/src/sdk/bus/telegram-daemon.ts +54 -3
  162. package/src/sdk/cli/rows.ts +247 -0
  163. package/src/sdk/cli/session-cli.ts +930 -79
  164. package/src/sdk/elevation/allowlist.ts +54 -0
  165. package/src/sdk/elevation/audit.ts +208 -0
  166. package/src/sdk/elevation/capability.ts +41 -0
  167. package/src/sdk/elevation/digest.ts +129 -0
  168. package/src/sdk/elevation/dispatch-receipt.ts +184 -0
  169. package/src/sdk/elevation/grant-ledger.ts +1142 -0
  170. package/src/sdk/elevation/owner.ts +109 -0
  171. package/src/sdk/guides/cache.ts +363 -0
  172. package/src/sdk/guides/catalog.ts +554 -0
  173. package/src/sdk/guides/cli.ts +235 -0
  174. package/src/sdk/guides/manifest.ts +152 -0
  175. package/src/sdk/guides/verify.ts +178 -0
  176. package/src/sdk/host/control/dispatch.ts +49 -1
  177. package/src/sdk/host/control/index.ts +1 -0
  178. package/src/sdk/host/control/operations.ts +8 -1
  179. package/src/sdk/host/query/cursor.ts +47 -3
  180. package/src/sdk/host/query/handlers.ts +155 -2
  181. package/src/sdk/host/sdk-surface-parity.test.ts +1 -0
  182. package/src/sdk/host/session-runtime.test.ts +391 -1
  183. package/src/sdk/host/session-runtime.ts +308 -73
  184. package/src/sdk/host/surface-policy.ts +3 -0
  185. package/src/sdk/host/websocket-transport.ts +7 -1
  186. package/src/sdk/mcp/server.ts +88 -15
  187. package/src/sdk/prompt-status.ts +8 -0
  188. package/src/sdk/protocol/operation-inventory.generated.json +62 -0
  189. package/src/sdk/protocol/operation-registry.ts +3 -2
  190. package/src/sdk/session.ts +87 -39
  191. package/src/sdk/transport/index.ts +1 -0
  192. package/src/sdk/transport/relay.ts +3 -0
  193. package/src/sdk/transport/serve-cli.ts +111 -24
  194. package/src/secrets/obfuscator.ts +92 -12
  195. package/src/session/agent-session.ts +322 -93
  196. package/src/session/blob-store.ts +60 -8
  197. package/src/session/fallback-chain-controller.ts +35 -0
  198. package/src/session/internal/managed-session-scope.ts +25 -3
  199. package/src/session/internal/managed-session-storage.ts +574 -73
  200. package/src/session/internal/session-memory-sidecar.ts +19 -29
  201. package/src/session/session-manager.ts +2166 -743
  202. package/src/session/session-storage.ts +715 -48
  203. package/src/setup/provider-onboarding.ts +19 -3
  204. package/src/setup/provider-presets.json +3 -1
  205. package/src/slash-commands/builtin-registry.ts +85 -3
  206. package/src/stt/downloader.ts +2 -3
  207. package/src/stt/setup.ts +29 -4
  208. package/src/task/executor.ts +22 -18
  209. package/src/task/index.ts +24 -1
  210. package/src/tools/archive-reader.ts +11 -2
  211. package/src/tools/browser/runtime-diagnostics.ts +249 -0
  212. package/src/tools/browser/tab-protocol.ts +4 -0
  213. package/src/tools/browser/tab-supervisor.ts +5 -0
  214. package/src/tools/browser/tab-worker.ts +36 -1
  215. package/src/tools/browser.ts +7 -0
  216. package/src/tools/image-gen.ts +110 -166
  217. package/src/tools/index.ts +2 -0
  218. package/src/tools/read.ts +1 -1
  219. package/src/tools/resource-gc.ts +6 -1
  220. package/src/tools/tool-catalog.generated.ts +5 -1
  221. package/src/utils/pasted-image-path.ts +93 -0
  222. package/src/web/search/index.ts +3 -3
@@ -443,6 +443,34 @@ export declare const SETTINGS_SCHEMA: {
443
443
  readonly options: "runtime";
444
444
  };
445
445
  };
446
+ readonly "modelProfile.proxyProvider": {
447
+ readonly type: "string";
448
+ readonly default: undefined;
449
+ readonly ui: {
450
+ readonly tab: "model";
451
+ readonly label: "Proxy Provider";
452
+ readonly description: "Configured OpenAI-compatible proxy/gateway provider id (e.g. litellm) used by built-in model presets. Leave unset to keep direct provider endpoints.";
453
+ };
454
+ };
455
+ readonly "modelProfile.proxyMode": {
456
+ readonly type: "enum";
457
+ readonly values: readonly ["fallback", "always"];
458
+ readonly default: "fallback";
459
+ readonly ui: {
460
+ readonly tab: "model";
461
+ readonly label: "Proxy Routing Mode";
462
+ readonly description: "fallback routes only selectors whose direct provider lacks credentials; always routes every proxy-routable built-in preset selector through the configured proxy.";
463
+ readonly options: readonly [{
464
+ readonly value: "fallback";
465
+ readonly label: "Fallback";
466
+ readonly description: "Use the proxy only when direct provider credentials are unavailable";
467
+ }, {
468
+ readonly value: "always";
469
+ readonly label: "Always";
470
+ readonly description: "Route proxy-routable built-in preset selectors through the proxy";
471
+ }];
472
+ };
473
+ };
446
474
  readonly "session.resumeModelBehavior": {
447
475
  readonly type: "enum";
448
476
  readonly values: readonly ["keepSessionModel", "useCurrentDefault", "ask"];
@@ -470,6 +498,11 @@ export declare const SETTINGS_SCHEMA: {
470
498
  readonly modelProviderOrder: {
471
499
  readonly type: "array";
472
500
  readonly default: string[];
501
+ readonly ui: {
502
+ readonly tab: "providers";
503
+ readonly label: "Provider Priority Order";
504
+ readonly description: "Ordered provider priority for automatic model resolution. Providers listed earlier win ties; omitted providers fall back to curated ranking. Unavailable saved entries are retained and skipped at runtime.";
505
+ };
473
506
  };
474
507
  readonly cycleOrder: {
475
508
  readonly type: "array";
@@ -2502,8 +2535,8 @@ export declare const SETTINGS_SCHEMA: {
2502
2535
  };
2503
2536
  readonly "sessionMemory.mode": {
2504
2537
  readonly type: "enum";
2505
- readonly values: readonly ["off", "shadow", "enabled"];
2506
- readonly default: "shadow";
2538
+ readonly values: readonly ["off", "shadow", "enabled", "auto"];
2539
+ readonly default: "auto";
2507
2540
  };
2508
2541
  readonly "sessionMemory.contextOverflowRecovery": {
2509
2542
  readonly type: "boolean";
@@ -4045,81 +4078,6 @@ export declare const SETTINGS_SCHEMA: {
4045
4078
  }];
4046
4079
  };
4047
4080
  };
4048
- readonly "providers.image": {
4049
- readonly type: "enum";
4050
- readonly values: readonly ["auto", "openai", "gemini", "openrouter", "antigravity", "alibaba", "custom"];
4051
- readonly default: "auto";
4052
- readonly ui: {
4053
- readonly tab: "providers";
4054
- readonly label: "Image Generation";
4055
- readonly description: "Provider and model for image generation tool";
4056
- readonly options: readonly [{
4057
- readonly value: "auto";
4058
- readonly label: "Auto";
4059
- readonly description: "Priority: GPT model image tool > Antigravity > OpenRouter > Gemini > Alibaba";
4060
- }, {
4061
- readonly value: "openai";
4062
- readonly label: "OpenAI";
4063
- readonly description: "Uses gpt-image-2 via OpenAI Responses/Codex";
4064
- }, {
4065
- readonly value: "gemini";
4066
- readonly label: "Gemini";
4067
- readonly description: "Requires GEMINI_API_KEY";
4068
- }, {
4069
- readonly value: "openrouter";
4070
- readonly label: "OpenRouter";
4071
- readonly description: "Requires OPENROUTER_API_KEY";
4072
- }, {
4073
- readonly value: "antigravity";
4074
- readonly label: "Antigravity";
4075
- readonly description: "Requires login with google-antigravity";
4076
- }, {
4077
- readonly value: "alibaba";
4078
- readonly label: "Alibaba Bailian";
4079
- readonly description: "Requires ALIBABA_TOKEN_PLAN_API_KEY (wan2.7-image via Token Plan)";
4080
- }, {
4081
- readonly value: "custom";
4082
- readonly label: "Custom";
4083
- readonly description: "OpenAI-compatible endpoint (set providers.imageCustomUrl)";
4084
- }];
4085
- };
4086
- };
4087
- readonly "providers.imageModel": {
4088
- readonly type: "string";
4089
- readonly default: undefined;
4090
- readonly ui: {
4091
- readonly tab: "providers";
4092
- readonly label: "Image Model";
4093
- readonly description: "Override the default image generation model for the selected provider";
4094
- };
4095
- };
4096
- readonly "providers.imageCustomUrl": {
4097
- readonly type: "string";
4098
- readonly default: undefined;
4099
- readonly ui: {
4100
- readonly tab: "providers";
4101
- readonly label: "Image Custom URL";
4102
- readonly description: "Base URL for custom OpenAI-compatible image endpoint";
4103
- };
4104
- };
4105
- readonly "providers.imageCustomKey": {
4106
- readonly type: "string";
4107
- readonly default: undefined;
4108
- readonly ui: {
4109
- readonly tab: "providers";
4110
- readonly label: "Image Custom API Key";
4111
- readonly description: "API key for custom OpenAI-compatible image endpoint";
4112
- };
4113
- };
4114
- readonly "providers.imageCustomKeyEnv": {
4115
- readonly type: "string";
4116
- readonly default: undefined;
4117
- readonly ui: {
4118
- readonly tab: "providers";
4119
- readonly label: "Image Custom API Key Env";
4120
- readonly description: "Environment variable name holding the API key for custom image endpoint";
4121
- };
4122
- };
4123
4081
  readonly "providers.kimiApiFormat": {
4124
4082
  readonly type: "enum";
4125
4083
  readonly values: readonly ["openai", "anthropic"];
@@ -4495,7 +4453,7 @@ export interface ShellMinimizerSettings {
4495
4453
  maxCaptureBytes: number;
4496
4454
  }
4497
4455
  export interface SessionMemorySettings {
4498
- mode: "off" | "shadow" | "enabled";
4456
+ mode: "off" | "shadow" | "enabled" | "auto";
4499
4457
  contextOverflowRecovery: boolean;
4500
4458
  }
4501
4459
  export interface MemoryGuardSettings {
@@ -113,6 +113,8 @@ export declare class Settings implements NotificationSettingsReader {
113
113
  * Apply runtime overrides (not persisted).
114
114
  */
115
115
  override<P extends SettingPath>(path: P, value: SettingValue<P>): void;
116
+ /** Read the exact runtime override without merged defaults. */
117
+ getOverride<P extends SettingPath>(path: P): SettingValue<P> | undefined;
116
118
  /**
117
119
  * Clear a runtime override.
118
120
  */
@@ -11,7 +11,7 @@ import { type VimRenderArgs } from "../tools/vim";
11
11
  import type { EditMode } from "../utils/edit-mode";
12
12
  import type { DiffError, DiffResult } from "./diff";
13
13
  import type { Operation } from "./modes/patch";
14
- import type { PerFileDiffPreview } from "./streaming";
14
+ import { type PerFileDiffPreview } from "./streaming";
15
15
  export { getLspBatchRequest, type LspBatchRequest };
16
16
  export interface EditToolPerFileResult {
17
17
  path: string;
@@ -53,7 +53,7 @@ export interface EditToolDetails {
53
53
  /** Source-of-truth content after the edit; `undefined` for delete operations. */
54
54
  newText?: string;
55
55
  }
56
- interface EditRenderArgs {
56
+ export interface EditRenderArgs {
57
57
  path?: string;
58
58
  file_path?: string;
59
59
  oldText?: string;
@@ -76,6 +76,7 @@ type EditRenderEntry = {
76
76
  rename?: string;
77
77
  move?: string;
78
78
  op?: Operation;
79
+ firstChangedLine?: number;
79
80
  };
80
81
  /** Extended context for edit tool rendering */
81
82
  export interface EditRenderContext {
@@ -108,3 +109,5 @@ export declare const editToolRenderer: {
108
109
  renderContext?: EditRenderContext;
109
110
  }, uiTheme: Theme, args?: EditRenderArgs): Component;
110
111
  };
112
+ export declare function getPerFileEditRenderArgs(args: EditRenderArgs | undefined, path: string, editMode: EditMode | undefined): EditRenderArgs | undefined;
113
+ export declare function getPerFileEditRenderContext(renderContext: EditRenderContext | undefined, path: string): EditRenderContext | undefined;
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import type { Theme } from "../modes/theme/theme";
16
16
  import { type EditMode, resolveEditMode } from "../utils/edit-mode";
17
+ import { type Operation } from "./modes/patch";
17
18
  export interface PerFileDiffPreview {
18
19
  path: string;
19
20
  diff?: string;
@@ -52,6 +53,18 @@ export interface EditStreamingStrategy<Args = unknown> {
52
53
  */
53
54
  renderStreamingFallback(args: Args, uiTheme: Theme): string;
54
55
  }
56
+ export interface EditRequestTargetInventory {
57
+ paths: string[];
58
+ /** Operation of the first target (Create/Delete) when derivable from the
59
+ * request payload (apply_patch/hashline free-form envelopes carry op on the
60
+ * parsed entry, not on the top-level args). */
61
+ firstOp?: Operation;
62
+ parseError?: string;
63
+ }
64
+ export declare function orderedDistinctPaths(paths: readonly (string | undefined)[]): string[];
65
+ export declare function getEditRequestTargetInventory(args: unknown, editMode: EditMode | undefined, options: {
66
+ isPartial: boolean;
67
+ }): EditRequestTargetInventory;
55
68
  /**
56
69
  * Given an edits array parsed from partial JSON, drop the last entry when the
57
70
  * corresponding object in `partialJson` does not yet end with a closed `}`.
@@ -64,6 +64,8 @@ export interface CustomToolContext {
64
64
  sessionManager: ReadonlySessionManager;
65
65
  /** Model registry - use for API key resolution and model retrieval */
66
66
  modelRegistry: ModelRegistry;
67
+ /** Credential-selection identity for provider authentication. */
68
+ credentialSessionId?: string;
67
69
  /** Current model (may be undefined if no model is selected yet) */
68
70
  model: Model | undefined;
69
71
  /** Whether the agent is idle (not streaming) */
@@ -12,8 +12,9 @@ interface CompactableSession {
12
12
  }
13
13
  export declare function runExtensionCompact(session: CompactableSession, instructionsOrOptions: string | CompactOptions | undefined): Promise<void>;
14
14
  interface SetModelCapableSession {
15
+ credentialSessionId?: string;
15
16
  modelRegistry: {
16
- getApiKey(model: Model): Promise<string | undefined>;
17
+ getApiKey(model: Model, sessionId?: string): Promise<string | undefined>;
17
18
  };
18
19
  setModel(model: Model, role?: string, options?: {
19
20
  cause?: string;
@@ -247,6 +247,8 @@ export interface ExtensionContext {
247
247
  sessionMetadata?: ExtensionSessionMetadata;
248
248
  /** Model registry for API key resolution */
249
249
  modelRegistry: ModelRegistry;
250
+ /** Credential-selection identity, distinct from logical/provider cache identity. */
251
+ credentialSessionId?: string;
250
252
  /** Current model (may be undefined) */
251
253
  model: Model | undefined;
252
254
  /** Whether the agent is idle (not streaming) */
@@ -1028,6 +1030,7 @@ export interface ExtensionActions {
1028
1030
  /** Actions for ExtensionContext (ctx.* in event handlers). */
1029
1031
  export interface ExtensionContextActions {
1030
1032
  getModel: () => Model | undefined;
1033
+ getCredentialSessionId?: () => string;
1031
1034
  isIdle: () => boolean;
1032
1035
  /** Stable resource ownership identifier for the active prompt run. */
1033
1036
  getActivePromptHandle?: () => string | undefined;
@@ -166,12 +166,12 @@ export declare function gcHelpText(): string;
166
166
  /** Lazily assemble the real store adapters (kept lazy to avoid import cycles). */
167
167
  export declare function defaultGcAdapters(): Promise<GcStoreAdapter[]>;
168
168
  /** On-disk surfaces the retention axis can reclaim. */
169
- export type GcDiskSurface = "sessions" | "blobs" | "natives" | "backups";
169
+ export type GcDiskSurface = "sessions" | "blobs" | "artifacts" | "natives" | "backups";
170
170
  export declare const GC_DISK_SURFACES: readonly GcDiskSurface[];
171
171
  export type GcDiskAction = "keep" | "would_reclaim" | "reclaimed" | "reclaim_failed";
172
172
  export interface GcDiskRecord {
173
173
  surface: GcDiskSurface;
174
- /** Session id, blob hash, natives version, or backup entry name. */
174
+ /** Session id, blob hash, `<session id>/<filename>` artifact, natives version, or backup entry name. */
175
175
  id: string;
176
176
  path: string;
177
177
  bytes: number;
@@ -185,8 +185,20 @@ export interface GcDiskRecord {
185
185
  withheld?: true;
186
186
  }
187
187
  /**
188
- * Why a surface refused to reclaim anything, and how much it withheld to stay
189
- * fail-closed. Present only when the surface declined.
188
+ * Per-family rollup of a surface whose growth is many small files.
189
+ *
190
+ * The artifacts surface writes one record per file, which answers "what may go"
191
+ * but not "what filled the scope". A family is derived from the filename shape
192
+ * (`*.bash.log`, `.artifact-id-*`, …) rather than a fixed list, so a tool that
193
+ * starts writing a new kind of log is counted the day it ships.
194
+ */
195
+ export interface GcDiskFamilyUsage {
196
+ family: string;
197
+ count: number;
198
+ bytes: number;
199
+ }
200
+ /**
201
+ * Why a surface withheld reclaim candidates because its evidence was incomplete.
190
202
  */
191
203
  export interface GcDiskDeclined {
192
204
  reason: string;
@@ -205,8 +217,10 @@ export interface GcDiskSurfaceReport {
205
217
  kept: number;
206
218
  kept_bytes: number;
207
219
  failed: number;
208
- /** Set when the surface declined to reclaim anything because its evidence was incomplete. */
220
+ /** Set when the surface withheld reclaim candidates because its evidence was incomplete. */
209
221
  declined?: GcDiskDeclined;
222
+ /** Per-family counts and bytes. Only surfaces whose records are individual files set this. */
223
+ families?: GcDiskFamilyUsage[];
210
224
  records: GcDiskRecord[];
211
225
  }
212
226
  export interface GcDiskError {
@@ -18,6 +18,7 @@ export interface LocalProtocolOptions {
18
18
  getArtifactsDir?: () => string | null;
19
19
  isManagedDestination?: () => boolean;
20
20
  getManagedLegacyLocalMigrationSource?: () => ManagedLegacyLocalMigrationSource | null;
21
+ getCredentialSessionId?: () => string | null;
21
22
  getSessionId?: () => string | null;
22
23
  }
23
24
  export declare function initializeLocalRoot(options: LocalProtocolOptions): Promise<string>;
@@ -26,8 +26,6 @@ export type ModelSelectorSelection = {
26
26
  } | {
27
27
  kind: "deleteProfile";
28
28
  profileName: string;
29
- } | {
30
- kind: "imageGeneration";
31
29
  };
32
30
  type RoleSelectCallback = (selection: ModelSelectorSelection) => void | Promise<void>;
33
31
  /**
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Live context for the Provider Priority Order editor (`modelProviderOrder`).
3
+ *
4
+ * Owns the subscriptions that keep the editor current: `modelProviderOrder`
5
+ * settings changes and credential-generation changes on the session auth
6
+ * storage. Snapshots are built on demand from the model registry catalog, so
7
+ * the editor needs no catalog event subscription.
8
+ */
9
+ import type { ModelRegistry } from "../../config/model-registry";
10
+ import type { Settings } from "../../config/settings";
11
+ /** Normalize a persisted provider id the same way provider selection does: trimmed, lowercased. */
12
+ export declare function normalizeProviderId(raw: string): string;
13
+ /** Normalize a persisted provider order the same way provider selection does: trimmed, lowercased, deduplicated, blanks and non-strings dropped. */
14
+ export declare function normalizeProviderOrder(order: readonly unknown[]): string[];
15
+ /** Display label for a provider id, mirroring the model selector tab presentation. */
16
+ export declare function formatProviderOrderLabel(providerId: string): string;
17
+ export interface ProviderOrderEntry {
18
+ /** Normalized provider id (trimmed, lowercased). */
19
+ id: string;
20
+ /** Display label for the provider. */
21
+ label: string;
22
+ /** Whether the provider is present in the model registry catalog right now. */
23
+ available: boolean;
24
+ /** Whether the provider has usable auth for this session. */
25
+ authenticated: boolean;
26
+ /** Whether the provider is currently persisted in `modelProviderOrder`. */
27
+ inOrder: boolean;
28
+ }
29
+ export interface ProviderOrderSnapshot {
30
+ /** Persisted order (normalized, deduplicated). Unavailable entries are retained. */
31
+ order: string[];
32
+ /** Union of registry catalog provider ids and persisted ids. */
33
+ entries: ProviderOrderEntry[];
34
+ }
35
+ export declare class ProviderOrderContext {
36
+ #private;
37
+ constructor(registry: ModelRegistry, settings: Settings, onChange?: () => void, credentialSessionId?: string);
38
+ /** Build the current provider order snapshot from live registry + settings state. */
39
+ snapshot(): ProviderOrderSnapshot;
40
+ /** Persist a new ordered provider list and surface durable write failures. */
41
+ persistOrder(order: readonly string[]): Promise<void>;
42
+ /** Clear the persisted provider order so default resolution applies. */
43
+ resetOrder(): Promise<void>;
44
+ dispose(): void;
45
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Ordered provider priority editor for `modelProviderOrder`.
3
+ *
4
+ * Full-screen custom settings editor (Container + row list, mirroring the
5
+ * StatusLine custom editor layout) with add/remove/move-up/move-down/reset
6
+ * actions that persist to settings immediately. Rows are rebuilt from the live
7
+ * `ProviderOrderContext` snapshot before every render pass, keeping the
8
+ * previously selected provider highlighted when the underlying order or auth
9
+ * state changes. Unavailable persisted providers are retained and dimmed.
10
+ *
11
+ * The editor owns the `ProviderOrderContext` lifecycle: both normal close
12
+ * (`#close`) and external teardown (`dispose()`) release the context
13
+ * subscriptions and dispose the container, idempotently.
14
+ */
15
+ import { Container } from "@gajae-code/tui";
16
+ import { type ProviderOrderContext } from "./provider-order-context";
17
+ export declare class ProviderOrderEditorComponent extends Container {
18
+ #private;
19
+ constructor(context: ProviderOrderContext, onClose: () => void, onError?: (message: string) => void);
20
+ /** Rebuild rows from the current snapshot. Called by the controller on context changes. */
21
+ refresh(): void;
22
+ handleInput(data: string): void;
23
+ dispose(): void;
24
+ }
@@ -38,7 +38,11 @@ export interface SubmenuSettingDef extends BaseSettingDef {
38
38
  export interface TextInputSettingDef extends BaseSettingDef {
39
39
  type: "text";
40
40
  }
41
- export type SettingDef = BooleanSettingDef | EnumSettingDef | SubmenuSettingDef | TextInputSettingDef;
41
+ /** Array setting rendered by a dedicated ordered-list editor (currently only `modelProviderOrder`). */
42
+ export interface ProviderOrderSettingDef extends BaseSettingDef {
43
+ type: "providerOrder";
44
+ }
45
+ export type SettingDef = BooleanSettingDef | EnumSettingDef | SubmenuSettingDef | TextInputSettingDef | ProviderOrderSettingDef;
42
46
  /** Get all setting definitions with UI */
43
47
  export declare function getAllSettingDefs(): SettingDef[];
44
48
  /** Get settings for a specific tab */
@@ -69,6 +69,8 @@ export interface SettingsCallbacks {
69
69
  onPluginsChanged?: () => void;
70
70
  /** Called when asynchronously rebuilt settings content needs a repaint. */
71
71
  onRenderRequested?: () => void;
72
+ /** Create the ordered provider-priority editor for `modelProviderOrder`. */
73
+ createProviderOrderEditor?: (done: () => void) => Container;
72
74
  /** Called when an interactive setting cannot be committed. */
73
75
  onError?: (message: string) => void;
74
76
  /** Called when settings panel is closed */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Deterministic quick-lane classifier (issue #3984).
3
+ *
4
+ * The deep-interview and ralplan skills describe a task-routing surface in
5
+ * prose: small, clearly scoped, low-risk work should take a quick lane
6
+ * (minimal orchestration) while vague, ambiguous, risky, or wide-breadth work
7
+ * keeps the existing deep path. That gate existed only as prompt guidance, so
8
+ * it was not auditable or testable. This module encodes the same signals as
9
+ * deterministic, pure code so eligibility and exclusions are explicit and
10
+ * regression-covered.
11
+ *
12
+ * The classifier is intentionally conservative and fail-closed:
13
+ * - Any exclusion signal forces the `deep` lane, even when the task also names
14
+ * concrete files or symbols. Safety is never overridden by a concrete anchor.
15
+ * - The `deep` lane preserves the existing deep/interview behavior untouched;
16
+ * this module only *classifies*, it never routes or mutates.
17
+ * - A task with neither a concrete anchor nor an exclusion defaults to `deep`
18
+ * because boundness cannot be confirmed.
19
+ */
20
+ export type QuickLane = "quick" | "deep";
21
+ export interface QuickLaneDecision {
22
+ /** The routed lane: `quick` (bounded, direct execution) or `deep` (planning/interview path). */
23
+ lane: QuickLane;
24
+ /** Concrete anchors that made the task eligible for the quick lane (empty when `deep`). */
25
+ reasons: string[];
26
+ /** Exclusions that forced the deep lane (empty when `quick`). */
27
+ exclusions: string[];
28
+ }
29
+ /**
30
+ * Classify a task request into the quick lane (bounded, direct execution) or
31
+ * the deep path (existing planning/interview orchestration).
32
+ *
33
+ * Order of operations (fail-closed):
34
+ * 1. Exclusions are authoritative — any risk/ambiguity/breadth signal (including
35
+ * two or more distinct file-path anchors) forces `deep`, even when concrete
36
+ * anchors are present.
37
+ * 2. Otherwise, any concrete anchor yields `quick`.
38
+ * 3. Otherwise, `deep` (boundness could not be confirmed).
39
+ */
40
+ export declare function classifyQuickLane(input: string): QuickLaneDecision;
@@ -0,0 +1,18 @@
1
+ export interface SttDependencySetupProgress {
2
+ stage: string;
3
+ percent?: number;
4
+ }
5
+ export interface SttDependencySetupOptions {
6
+ modelName?: string;
7
+ onProgress?: (progress: SttDependencySetupProgress) => void;
8
+ }
9
+ export type EnsureSttDependencies = (options?: SttDependencySetupOptions) => Promise<void>;
10
+ export interface ConfigureSttFromSettingsOptions {
11
+ modelName?: string;
12
+ ensureDependencies?: EnsureSttDependencies;
13
+ setEnabled(enabled: false): void;
14
+ flush(): Promise<void>;
15
+ showStatus(message: string): void;
16
+ showError(message: string): void;
17
+ }
18
+ export declare function configureSttFromSettings(options: ConfigureSttFromSettingsOptions): Promise<boolean>;
@@ -1,8 +1,12 @@
1
1
  import type { NativeDirectoryTreeSnapshot } from "@gajae-code/natives";
2
2
  import type { ModelProfileErrorDetails } from "../../config/model-profile-contract";
3
+ import { type ElevationOperation } from "../elevation/digest";
4
+ import { type ElevationAnswerAuthority, type ElevationDispatchOutcome } from "../elevation/dispatch-receipt";
5
+ import { ElevationLedger, type ElevationRequester } from "../elevation/grant-ledger";
3
6
  import { type DirectoryMigrationPolicy } from "../session-directory";
4
7
  import { type BrokerDiscovery, type BrokerPublicationObservation, type RedactedBrokerDiscovery } from "./discovery";
5
8
  import { type LifecycleDurableEffectsReceipt, LifecycleLedger, type LifecycleStartupFailureReceipt } from "./lifecycle-ledger";
9
+ import { OperationReceiptLedger } from "./operation-receipt-ledger";
6
10
  import { SessionIndex } from "./session-index";
7
11
  export interface BrokerSettings {
8
12
  agentDir: string;
@@ -19,7 +23,7 @@ type ResolvedBrokerSettings = {
19
23
  heartbeatTtlMs: number;
20
24
  resolveDirectoryMigration: (_cwd: string) => Promise<DirectoryMigrationPolicy>;
21
25
  };
22
- export type BrokerErrorCode = "idempotency_conflict" | "terminal_uncertain" | "broker_restarting" | "unavailable" | "endpoint_stale" | "resource_gone" | "invalid_input" | "spawn_failed" | "startup_admission_timeout" | "startup_admission_refused" | "readiness_timeout" | "close_refused" | "not_found" | "live_session" | "cleanup_pending" | (string & {});
26
+ export type BrokerErrorCode = "idempotency_conflict" | "terminal_uncertain" | "broker_restarting" | "unavailable" | "endpoint_stale" | "resource_gone" | "invalid_input" | "spawn_failed" | "startup_admission_timeout" | "startup_admission_refused" | "readiness_timeout" | "close_refused" | "not_found" | "live_session" | "cleanup_pending" | "ambiguous_session" | (string & {});
23
27
  export type BrokerCleanupIdentity = {
24
28
  dev: string;
25
29
  ino: string;
@@ -196,6 +200,8 @@ export declare class Broker {
196
200
  readonly settings: ResolvedBrokerSettings;
197
201
  readonly index: SessionIndex;
198
202
  readonly ledger: LifecycleLedger;
203
+ readonly elevation: ElevationLedger;
204
+ readonly operationReceipts: OperationReceiptLedger;
199
205
  discovery: BrokerDiscovery | null;
200
206
  constructor(settings: BrokerSettings);
201
207
  runStartup<T>(queueWaitMs: number, timing: StartupAdmissionTiming, task: (admittedAt: number) => Promise<T>): Promise<StartupAdmissionResult<T>>;
@@ -204,6 +210,15 @@ export declare class Broker {
204
210
  get completion(): Promise<void>;
205
211
  status(): RedactedBrokerDiscovery | null;
206
212
  heartbeat(): Promise<void>;
213
+ /**
214
+ * Production coalesced heartbeat checkpoint seam (C2): delegates to the session
215
+ * index writer, which appends at most one `host_heartbeat` per session per
216
+ * {@link SESSION_HEARTBEAT_INTERVAL_MS} for hosts that are alive and, when recorded,
217
+ * still carry the same OS process incarnation. Returns the number of checkpoints
218
+ * written. Used by the periodic publication watch, by session reads so a fresh
219
+ * registration is observed as live, and by tests.
220
+ */
221
+ heartbeatSessions(now?: number): Promise<number>;
207
222
  /**
208
223
  * Revalidate retained publication ownership and begin one synchronous effect in
209
224
  * the same stack. The callback is the authority boundary: callers must perform
@@ -223,7 +238,46 @@ export declare class Broker {
223
238
  * spawns a child the broker has no authority over.
224
239
  */
225
240
  stop(): Promise<void>;
226
- handleRequest(operation: string, input: Record<string, unknown>, idempotencyKey?: string): Promise<BrokerResponse>;
241
+ handleRequest(operation: string, input: Record<string, unknown>, idempotencyKey?: string, elevationRequestId?: string): Promise<BrokerResponse>;
242
+ /**
243
+ * Elevation issuance (internal). Binds the exact endpoint identity
244
+ * (endpointStateRoot/generation/incarnation) from the live index record;
245
+ * the request digest is broker-computed from the full `{kind,sdkId,input}`
246
+ * triple with the top-level `elevationRequestId` excluded.
247
+ */
248
+ elevationIssue(params: {
249
+ sessionId: string;
250
+ operation: ElevationOperation;
251
+ input: Record<string, unknown>;
252
+ requester: ElevationRequester;
253
+ elevationRequestId?: string;
254
+ expiresInMs?: number;
255
+ }): Promise<BrokerResponse>;
256
+ /**
257
+ * Elevation answer (internal, operator-only). There is no public
258
+ * `elevation.answer` operation: this entry point is reserved for the local
259
+ * operator approval surface and the separately authorized gate-answer
260
+ * source, and the ledger enforces the distinct-answer-source boundary.
261
+ */
262
+ elevationAnswer(params: {
263
+ elevationRequestId: string;
264
+ answer: "approve" | "deny";
265
+ presentedDigest: string;
266
+ answerer: ElevationAnswerAuthority;
267
+ }): Promise<BrokerResponse>;
268
+ /** Single-use grant claim (internal): consumes the grant before dispatch. */
269
+ elevationClaim(params: {
270
+ elevationRequestId: string;
271
+ }): Promise<BrokerResponse>;
272
+ /** Records the dispatch outcome for a claimed grant (internal). */
273
+ elevationDispatch(params: {
274
+ elevationRequestId: string;
275
+ outcome: ElevationDispatchOutcome;
276
+ }): Promise<BrokerResponse>;
277
+ /** Truthful elevation status read (internal; reconciles expiry and crash state). */
278
+ elevationResolve(elevationRequestId: string): Promise<BrokerResponse>;
279
+ /** Truthful elevation listing (internal). */
280
+ elevationList(): Promise<BrokerResponse>;
227
281
  }
228
282
  /** Test-only hook for simulating a process crash after terminal persistence verification. */
229
283
  export declare function setTerminalPersistenceHookForTest(broker: Broker, hook: (() => void) | undefined): void;
@@ -0,0 +1,25 @@
1
+ import type { BrokerResponse } from "./broker";
2
+ export type OperationReserveResult = {
3
+ status: "reserved";
4
+ } | {
5
+ status: "replay";
6
+ response: BrokerResponse;
7
+ } | {
8
+ status: "in_progress";
9
+ } | {
10
+ status: "conflict";
11
+ };
12
+ /**
13
+ * Target-session-scoped idempotency key for a clientRef. Identical refs on
14
+ * different sessions are independent, so a receipt can never replay or
15
+ * conflict across sessions.
16
+ */
17
+ export declare function operationReceiptKey(sessionId: string, clientRef: string): string;
18
+ export declare function operationReceiptDigest(operation: string, input: Record<string, unknown>, sessionId?: string): string;
19
+ export declare class OperationReceiptLedger {
20
+ #private;
21
+ constructor(agentDir: string);
22
+ open(): Promise<void>;
23
+ reserve(clientRef: string, digest: string): Promise<OperationReserveResult>;
24
+ complete(clientRef: string, digest: string, response: BrokerResponse): Promise<void>;
25
+ }