@gajae-code/coding-agent 0.15.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/dist/types/async/job-manager.d.ts +83 -0
  3. package/dist/types/cli/args.d.ts +2 -0
  4. package/dist/types/cli/auth-gateway-cli.d.ts +17 -0
  5. package/dist/types/cli/model-presets-cli.d.ts +9 -0
  6. package/dist/types/cli/root-flags.d.ts +14 -0
  7. package/dist/types/cli/update-cli.d.ts +15 -0
  8. package/dist/types/cli.d.ts +7 -0
  9. package/dist/types/commands/auth-gateway.d.ts +3 -0
  10. package/dist/types/commands/gc.d.ts +13 -0
  11. package/dist/types/commands/launch.d.ts +10 -0
  12. package/dist/types/commands/model-presets.d.ts +21 -0
  13. package/dist/types/config/autorouting-tier-map.d.ts +120 -0
  14. package/dist/types/config/file-lock.d.ts +54 -2
  15. package/dist/types/config/internal/model-preset-registry-test-state.d.ts +4 -0
  16. package/dist/types/config/internal/model-preset-registry-test-support.d.ts +3 -0
  17. package/dist/types/config/keybindings.d.ts +3 -2
  18. package/dist/types/config/model-preset-registry.d.ts +368 -0
  19. package/dist/types/config/model-profile-activation.d.ts +39 -0
  20. package/dist/types/config/model-profiles.d.ts +5 -3
  21. package/dist/types/config/model-registry.d.ts +17 -5
  22. package/dist/types/config/settings-schema.d.ts +19 -1
  23. package/dist/types/config/settings.d.ts +2 -0
  24. package/dist/types/coordinator-mcp/model-preset.d.ts +7 -5
  25. package/dist/types/coordinator-mcp/projection-scan.d.ts +54 -0
  26. package/dist/types/crash/record-loader.d.ts +15 -0
  27. package/dist/types/extensibility/extensions/types.d.ts +2 -5
  28. package/dist/types/gjc-runtime/empty-delete-gc.d.ts +58 -0
  29. package/dist/types/gjc-runtime/gc-runtime.d.ts +2 -0
  30. package/dist/types/gjc-runtime/launch-worktree-reservation.d.ts +21 -0
  31. package/dist/types/gjc-runtime/managed-owner-supervisor.d.ts +2 -0
  32. package/dist/types/gjc-runtime/session-state-lock.d.ts +35 -6
  33. package/dist/types/gjc-runtime/session-state-sidecar.d.ts +72 -1
  34. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +1 -0
  35. package/dist/types/gjc-runtime/tmux-sessions.d.ts +27 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/main.d.ts +3 -1
  38. package/dist/types/master-mode/context.d.ts +21 -0
  39. package/dist/types/master-mode/first-request.d.ts +34 -0
  40. package/dist/types/master-mode/snapshot.d.ts +32 -0
  41. package/dist/types/modes/components/frictionless-onboarding-selector.d.ts +10 -0
  42. package/dist/types/modes/components/jobs-overlay-model.d.ts +4 -2
  43. package/dist/types/modes/components/oauth-selector.d.ts +1 -0
  44. package/dist/types/modes/components/status-line/model-name.d.ts +18 -0
  45. package/dist/types/modes/components/status-line/priority-row.d.ts +34 -0
  46. package/dist/types/modes/components/status-line/segments.d.ts +10 -0
  47. package/dist/types/modes/jobs-observer.d.ts +36 -0
  48. package/dist/types/modes/print-mode.d.ts +17 -0
  49. package/dist/types/modes/ui-language.d.ts +7 -1
  50. package/dist/types/sdk/broker/broker.d.ts +80 -1
  51. package/dist/types/sdk/broker/endpoint-authority.d.ts +24 -0
  52. package/dist/types/sdk/broker/index.d.ts +3 -0
  53. package/dist/types/sdk/broker/lifecycle.d.ts +26 -0
  54. package/dist/types/sdk/broker/master-capability.d.ts +10 -0
  55. package/dist/types/sdk/broker/session-index.d.ts +40 -11
  56. package/dist/types/sdk/broker/session-scope.d.ts +72 -0
  57. package/dist/types/sdk/broker/spawn-authority.d.ts +201 -0
  58. package/dist/types/sdk/broker/spawn-substrate.d.ts +30 -0
  59. package/dist/types/sdk/broker/state-version.d.ts +4 -1
  60. package/dist/types/sdk/broker/worktree-occupancy.d.ts +28 -0
  61. package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -0
  62. package/dist/types/sdk/bus/index.d.ts +6 -0
  63. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +3 -0
  64. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +4 -0
  65. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
  66. package/dist/types/sdk/cli/index.d.ts +1 -0
  67. package/dist/types/sdk/cli/master-cli.d.ts +63 -0
  68. package/dist/types/sdk/cli/rows.d.ts +4 -3
  69. package/dist/types/sdk/cli/session-cli.d.ts +18 -2
  70. package/dist/types/sdk/client/client.d.ts +3 -2
  71. package/dist/types/sdk/client/discovery.d.ts +1 -0
  72. package/dist/types/sdk/host/control/dispatch.d.ts +10 -0
  73. package/dist/types/sdk/host/control/index.d.ts +1 -1
  74. package/dist/types/sdk/host/control/operations.d.ts +2 -0
  75. package/dist/types/sdk/host/control/runtime-gate.d.ts +21 -7
  76. package/dist/types/sdk/host/host.d.ts +10 -0
  77. package/dist/types/sdk/host/model-pin.d.ts +7 -2
  78. package/dist/types/sdk/host/sdk-run-capability.d.ts +1 -0
  79. package/dist/types/sdk/host/session-runtime.d.ts +67 -1
  80. package/dist/types/sdk/lifecycle/broker-client.d.ts +6 -0
  81. package/dist/types/sdk/lifecycle/service.d.ts +15 -3
  82. package/dist/types/sdk/lifecycle-session.d.ts +2 -0
  83. package/dist/types/sdk/prompt-deadline-manager.d.ts +11 -1
  84. package/dist/types/sdk/protocol/adapter-validation.d.ts +2 -0
  85. package/dist/types/sdk/router/session-router.d.ts +11 -0
  86. package/dist/types/sdk/session.d.ts +16 -0
  87. package/dist/types/sdk/startup-capability.d.ts +2 -1
  88. package/dist/types/session/account-inventory.d.ts +1 -0
  89. package/dist/types/session/agent-session.d.ts +24 -7
  90. package/dist/types/session/credential-store-errors.d.ts +1 -0
  91. package/dist/types/session/fold-coordinator.d.ts +201 -0
  92. package/dist/types/session/sdk-run-capability-internal.d.ts +7 -0
  93. package/dist/types/session/sdk-run-capability.d.ts +2 -0
  94. package/dist/types/session/session-manager.d.ts +65 -0
  95. package/dist/types/session/yield-queue.d.ts +5 -4
  96. package/dist/types/setup/frictionless-onboarding.d.ts +1 -0
  97. package/dist/types/telemetry/control.d.ts +11 -0
  98. package/dist/types/telemetry/events.d.ts +20 -0
  99. package/dist/types/telemetry/index.d.ts +3 -0
  100. package/dist/types/telemetry/transport.d.ts +22 -0
  101. package/dist/types/tools/bash-interactive.d.ts +23 -0
  102. package/dist/types/tools/bash.d.ts +4 -0
  103. package/dist/types/tools/gh.d.ts +8 -0
  104. package/dist/types/tools/index.d.ts +10 -5
  105. package/dist/types/web/search/providers/base.d.ts +9 -4
  106. package/dist/types/web/search/providers/xai.d.ts +2 -1
  107. package/dist/types/web/search/types.d.ts +14 -0
  108. package/package.json +10 -7
  109. package/scripts/generate-hotkeys-docs.ts +4 -0
  110. package/scripts/generate-sdk-operation-inventory.ts +9 -3
  111. package/scripts/verify-gjc-sdk-canonicalization.ts +35 -1
  112. package/src/async/job-manager.ts +671 -39
  113. package/src/cli/accounts-cli.ts +9 -5
  114. package/src/cli/args.ts +17 -0
  115. package/src/cli/auth-broker-cli.ts +40 -12
  116. package/src/cli/auth-gateway-cli.ts +273 -97
  117. package/src/cli/config-cli.ts +2 -2
  118. package/src/cli/fast-help.ts +4 -0
  119. package/src/cli/model-presets-cli.ts +100 -0
  120. package/src/cli/root-flags.ts +5 -0
  121. package/src/cli/update-cli.ts +117 -16
  122. package/src/cli.ts +6 -2
  123. package/src/commands/auth-gateway.ts +12 -8
  124. package/src/commands/gc.ts +19 -0
  125. package/src/commands/launch.ts +86 -18
  126. package/src/commands/model-presets.ts +24 -0
  127. package/src/commands/sdk.ts +113 -21
  128. package/src/config/autorouting-tier-map.ts +44 -0
  129. package/src/config/file-lock-gc.ts +9 -4
  130. package/src/config/file-lock.ts +890 -99
  131. package/src/config/internal/model-preset-registry-test-state.ts +28 -0
  132. package/src/config/internal/model-preset-registry-test-support.ts +11 -0
  133. package/src/config/keybindings.ts +6 -2
  134. package/src/config/model-preset-registry.ts +2795 -0
  135. package/src/config/model-profile-activation.ts +115 -28
  136. package/src/config/model-profile-contract.ts +4 -1
  137. package/src/config/model-profiles.ts +56 -14
  138. package/src/config/model-registry.ts +1044 -122
  139. package/src/config/model-resolver.ts +5 -0
  140. package/src/config/settings-schema.ts +19 -1
  141. package/src/config/settings.ts +11 -1
  142. package/src/coordinator-mcp/model-preset.ts +32 -17
  143. package/src/coordinator-mcp/projection-scan.ts +592 -0
  144. package/src/coordinator-mcp/question-state.ts +9 -11
  145. package/src/coordinator-mcp/server.ts +111 -42
  146. package/src/coordinator-mcp/session-reaper.ts +9 -3
  147. package/src/crash/index-store.ts +2 -0
  148. package/src/crash/record-loader.ts +10 -0
  149. package/src/extensibility/extensions/loader.ts +0 -1
  150. package/src/extensibility/extensions/types.ts +2 -3
  151. package/src/extensibility/gjc-plugins/runtime-adapters.ts +1 -0
  152. package/src/gjc-runtime/empty-delete-gc.ts +301 -0
  153. package/src/gjc-runtime/gc-render.ts +29 -0
  154. package/src/gjc-runtime/gc-runtime.ts +174 -11
  155. package/src/gjc-runtime/launch-worktree-reservation.ts +242 -0
  156. package/src/gjc-runtime/managed-owner-supervisor.ts +63 -51
  157. package/src/gjc-runtime/session-state-lock.ts +1321 -147
  158. package/src/gjc-runtime/session-state-sidecar.ts +1004 -25
  159. package/src/gjc-runtime/tmux-owner-isolation-cli.ts +4 -7
  160. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -2
  161. package/src/gjc-runtime/tmux-sessions.ts +252 -13
  162. package/src/hooks/skill-state.ts +6 -0
  163. package/src/index.ts +1 -0
  164. package/src/internal-urls/docs-index.generated.ts +14 -13
  165. package/src/internal-urls/issue-pr-protocol.ts +4 -2
  166. package/src/lsp/config.ts +4 -3
  167. package/src/lsp/path-trust.ts +12 -6
  168. package/src/main.ts +66 -4
  169. package/src/master-mode/context.ts +50 -0
  170. package/src/master-mode/first-request.ts +65 -0
  171. package/src/master-mode/snapshot.ts +205 -0
  172. package/src/modes/acp/acp-agent.ts +616 -161
  173. package/src/modes/components/footer.ts +4 -2
  174. package/src/modes/components/frictionless-onboarding-selector.ts +48 -2
  175. package/src/modes/components/jobs-overlay-model.ts +99 -16
  176. package/src/modes/components/model-selector.ts +158 -18
  177. package/src/modes/components/oauth-selector.ts +6 -1
  178. package/src/modes/components/settings-selector.ts +1 -0
  179. package/src/modes/components/status-line/model-name.ts +53 -0
  180. package/src/modes/components/status-line/priority-row.ts +107 -0
  181. package/src/modes/components/status-line/segments.ts +29 -10
  182. package/src/modes/components/tool-status-header.ts +151 -15
  183. package/src/modes/controllers/extension-ui-controller.ts +1 -1
  184. package/src/modes/controllers/input-controller.ts +51 -6
  185. package/src/modes/controllers/selector-controller.ts +191 -96
  186. package/src/modes/interactive-mode.ts +14 -1
  187. package/src/modes/jobs-observer.ts +149 -16
  188. package/src/modes/print-mode.ts +64 -0
  189. package/src/modes/runtime-init.ts +1 -1
  190. package/src/modes/ui-language.ts +49 -2
  191. package/src/modes/utils/injected-user-submission.ts +15 -1
  192. package/src/prompts/system/master-mode.md +28 -0
  193. package/src/prompts/tools/bash.md +2 -2
  194. package/src/prompts/tools/fold-receipt.md +3 -0
  195. package/src/prompts/tools/job.md +1 -1
  196. package/src/sdk/acp/adapter.ts +17 -2
  197. package/src/sdk/broker/broker.ts +1671 -34
  198. package/src/sdk/broker/endpoint-authority.ts +86 -0
  199. package/src/sdk/broker/ensure.ts +5 -0
  200. package/src/sdk/broker/index.ts +3 -0
  201. package/src/sdk/broker/lifecycle.ts +217 -46
  202. package/src/sdk/broker/master-capability.ts +232 -0
  203. package/src/sdk/broker/session-index.ts +121 -17
  204. package/src/sdk/broker/session-scope.ts +272 -0
  205. package/src/sdk/broker/spawn-authority.ts +1031 -0
  206. package/src/sdk/broker/spawn-substrate.ts +548 -0
  207. package/src/sdk/broker/state-version.ts +26 -14
  208. package/src/sdk/broker/transport.ts +1 -0
  209. package/src/sdk/broker/worktree-occupancy.ts +90 -0
  210. package/src/sdk/bus/chat-daemon-control.ts +5 -2
  211. package/src/sdk/bus/chat-daemon-runtime.ts +46 -5
  212. package/src/sdk/bus/index.ts +51 -4
  213. package/src/sdk/bus/kind-aware-reconciliation.ts +36 -6
  214. package/src/sdk/bus/prompt-reconciliation.ts +28 -4
  215. package/src/sdk/bus/slack-conversation.ts +5 -1
  216. package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
  217. package/src/sdk/cli/index.ts +1 -0
  218. package/src/sdk/cli/master-cli.ts +259 -0
  219. package/src/sdk/cli/rows.ts +11 -8
  220. package/src/sdk/cli/session-cli.ts +276 -6
  221. package/src/sdk/client/client.ts +14 -8
  222. package/src/sdk/client/discovery.ts +3 -1
  223. package/src/sdk/host/control/dispatch.ts +101 -37
  224. package/src/sdk/host/control/index.ts +2 -0
  225. package/src/sdk/host/control/operations.ts +2 -0
  226. package/src/sdk/host/control/runtime-gate.ts +203 -11
  227. package/src/sdk/host/host.ts +27 -2
  228. package/src/sdk/host/model-pin.ts +185 -25
  229. package/src/sdk/host/sdk-run-capability.ts +1 -0
  230. package/src/sdk/host/session-runtime.test.ts +581 -43
  231. package/src/sdk/host/session-runtime.ts +655 -101
  232. package/src/sdk/lifecycle/broker-client.ts +28 -0
  233. package/src/sdk/lifecycle/service.ts +279 -20
  234. package/src/sdk/lifecycle-session.ts +10 -2
  235. package/src/sdk/prompt-deadline-manager.ts +16 -1
  236. package/src/sdk/protocol/adapter-validation.ts +27 -0
  237. package/src/sdk/protocol/operation-inventory.generated.json +53 -2
  238. package/src/sdk/protocol/operation-registry.ts +17 -4
  239. package/src/sdk/router/session-router.ts +294 -154
  240. package/src/sdk/session.ts +440 -167
  241. package/src/sdk/startup-capability.ts +1 -0
  242. package/src/session/account-inventory.ts +27 -11
  243. package/src/session/agent-session.ts +1292 -180
  244. package/src/session/blob-store.ts +15 -5
  245. package/src/session/credential-store-errors.ts +2 -0
  246. package/src/session/fold-coordinator.ts +433 -0
  247. package/src/session/internal/managed-session-storage.ts +153 -78
  248. package/src/session/sdk-run-capability-internal.ts +15 -0
  249. package/src/session/sdk-run-capability.ts +2 -0
  250. package/src/session/session-manager.ts +342 -28
  251. package/src/session/yield-queue.ts +24 -10
  252. package/src/setup/frictionless-onboarding.ts +2 -0
  253. package/src/setup/provider-presets.json +1 -1
  254. package/src/slash-commands/helpers/credential-switch.ts +6 -1
  255. package/src/task/executor.ts +19 -3
  256. package/src/telemetry/control.ts +26 -0
  257. package/src/telemetry/events.ts +1268 -0
  258. package/src/telemetry/index.ts +3 -0
  259. package/src/telemetry/transport.ts +87 -0
  260. package/src/tools/bash-interactive.ts +182 -85
  261. package/src/tools/bash.ts +1028 -109
  262. package/src/tools/gh.ts +104 -48
  263. package/src/tools/github-cache.ts +2 -2
  264. package/src/tools/index.ts +11 -5
  265. package/src/tools/tool-catalog.generated.ts +1 -1
  266. package/src/web/search/provider.ts +120 -11
  267. package/src/web/search/providers/anthropic.ts +89 -17
  268. package/src/web/search/providers/base.ts +9 -4
  269. package/src/web/search/providers/gemini.ts +87 -15
  270. package/src/web/search/providers/openai-compatible.ts +23 -8
  271. package/src/web/search/providers/xai.ts +98 -12
  272. package/src/web/search/types.ts +16 -0
@@ -1,3 +1,5 @@
1
+ import type { NativeDirectoryTreeResult, NativeExactUnlinkResult } from "@gajae-code/natives";
2
+ import { renameDirectoryNoReplacePathAsync, renameNoReplacePathAsync } from "@gajae-code/natives";
1
3
  export interface FileLockOptions {
2
4
  staleMs?: number;
3
5
  retries?: number;
@@ -9,8 +11,16 @@ export interface FileLockOptions {
9
11
  /** Previous local host identities accepted only when deciding stale-owner reclamation. */
10
12
  previousOwnerHostIds?: readonly string[];
11
13
  }
14
+ /** Release retries cover transient Windows/Dropbox handle denial without extending the lock indefinitely. */
15
+ export declare const FILE_LOCK_RELEASE_RETRY_ATTEMPTS = 5;
16
+ export declare const FILE_LOCK_RELEASE_RETRY_DELAY_MS = 10;
12
17
  export declare const FileLockTestHooks: {
13
18
  afterParentMkdir?: (lockPath: string) => void | Promise<void>;
19
+ nativePublicationBindings?: () => {
20
+ renameNoReplacePathAsync: typeof renameNoReplacePathAsync;
21
+ renameDirectoryNoReplacePathAsync: typeof renameDirectoryNoReplacePathAsync;
22
+ };
23
+ nativeQuarantineBindings?: () => NativeFileLockBindings;
14
24
  };
15
25
  /**
16
26
  * Returns the OS-provided process start timestamp for PID-reuse detection.
@@ -25,16 +35,46 @@ export declare const FileLockTestHooks: {
25
35
  */
26
36
  export declare function processStartTime(pid: number): string | null;
27
37
  /** @internal */
38
+ export interface FileLockGcObservation {
39
+ info: FileLockOwnerToken;
40
+ bytes: string;
41
+ identity: GenericFileLockDirIdentity;
42
+ }
43
+ /** Capture owner bytes and the identity proving those exact bytes came from this tree. */
44
+ export declare function readFileLockObservationForGc(lockDir: string): Promise<FileLockGcObservation | null>;
45
+ /** @internal */
28
46
  export declare function readFileLockInfoForGc(lockDir: string): Promise<FileLockOwnerToken | null>;
29
47
  /** Owner identity stamped into a `<file>.lock/info` record. */
30
48
  export interface FileLockOwnerToken {
31
49
  pid: number;
32
50
  start_time?: string;
51
+ /** Encoding marker for the canonical UTC process-start identity. */
52
+ start_time_format?: string;
33
53
  owner_host_id?: string;
54
+ /** Unique acquisition generation, present on locks created by this runtime. */
55
+ owner_token?: string;
34
56
  timestamp: number;
35
57
  }
36
58
  /** Outcome of a guarded lock-dir removal attempt (`removeFileLockDirForGc`). */
37
- export type FileLockGcRemoval = "removed" | "owner_changed" | "missing";
59
+ export type FileLockGcRemoval = "removed" | "owner_changed" | "missing" | "cleanup_failed";
60
+ /** Identity evidence carried by the generic stale verdict into a later removal. */
61
+ export interface GenericFileLockDirIdentity {
62
+ rootDev: string;
63
+ rootIno: string;
64
+ infoDev: string;
65
+ infoIno: string;
66
+ infoNlink: string;
67
+ infoSize: string;
68
+ infoMtimeNs: string;
69
+ infoCtimeNs: string;
70
+ infoSha256: string;
71
+ }
72
+ export type GenericFileLockDirStaleVerdict = {
73
+ stale: false;
74
+ } | {
75
+ stale: true;
76
+ identity: GenericFileLockDirIdentity;
77
+ };
38
78
  /**
39
79
  * @internal
40
80
  * Fail-closed removal of a lock dir whose owner is expected to be dead or
@@ -52,7 +92,7 @@ export type FileLockGcRemoval = "removed" | "owner_changed" | "missing";
52
92
  * directory, so the residual read->unlink window cannot be fully eliminated,
53
93
  * but the reclaim-after-stale scenario the issue describes is now guarded.
54
94
  */
55
- export declare function removeFileLockDirForGc(lockDir: string, expected: FileLockOwnerToken): Promise<FileLockGcRemoval>;
95
+ export declare function removeFileLockDirForGc(lockDir: string, expected: FileLockOwnerToken, preVerdictIdentity?: GenericFileLockDirIdentity): Promise<FileLockGcRemoval>;
56
96
  /**
57
97
  * @internal
58
98
  * READ-ONLY verdict on an EXISTING generic `<file>.lock/` directory that another lock
@@ -71,6 +111,17 @@ export declare function removeFileLockDirForGc(lockDir: string, expected: FileLo
71
111
  * the object is no longer the one that was judged.
72
112
  */
73
113
  export declare function genericFileLockDirIsStale(lockDir: string, staleMs: number, ownerHostId?: string): Promise<boolean>;
114
+ /**
115
+ * Render a generic stale verdict together with the root and owner-file identity that
116
+ * verdict actually observed. A caller that removes the directory must require a later
117
+ * native snapshot to carry this same identity; a snapshot taken only after a clone was
118
+ * installed is not authority for the stale verdict.
119
+ */
120
+ export declare function genericFileLockDirStaleVerdict(lockDir: string, staleMs: number, ownerHostId?: string): Promise<GenericFileLockDirStaleVerdict>;
121
+ type NativeFileLockBindings = {
122
+ snapshotDirectoryTree(lockPath: string): NativeDirectoryTreeResult;
123
+ exactRemoveDirectoryTree(lockPath: string, snapshot: NonNullable<NativeDirectoryTreeResult["snapshot"]>): NativeExactUnlinkResult;
124
+ };
74
125
  /**
75
126
  * Serializes all contenders, including callers in the same process. Because this
76
127
  * API exposes no ownership token, recursive acquisition is indistinguishable
@@ -78,3 +129,4 @@ export declare function genericFileLockDirIsStale(lockDir: string, staleMs: numb
78
129
  * that fact through its own `lockHeld` path instead of acquiring it again.
79
130
  */
80
131
  export declare function withFileLock<T>(filePath: string, fn: () => Promise<T>, options?: FileLockOptions): Promise<T>;
132
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ModelPresetRegistryTrustedKey } from "../model-preset-registry";
2
+ export declare function getModelPresetRegistryTestTrustedKeys(agentDir: string): ReadonlyMap<string, ModelPresetRegistryTrustedKey> | undefined;
3
+ export declare function modelPresetRegistryTestUrlsAllowed(agentDir: string): boolean;
4
+ export declare function runWithModelPresetRegistryTestTrust<T>(agentDir: string, trustedKeys: ReadonlyMap<string, ModelPresetRegistryTrustedKey>, operation: () => T): T;
@@ -0,0 +1,3 @@
1
+ import type { ModelPresetRegistryTrustedKey } from "../model-preset-registry";
2
+ /** Runs one test operation with scoped trust. This module is denied by package exports. */
3
+ export declare function withModelPresetRegistryTestTrust<T>(agentDir: string, trustedKeys: ReadonlyMap<string, ModelPresetRegistryTrustedKey>, operation: () => T): T;
@@ -60,6 +60,7 @@ declare module "@gajae-code/tui" {
60
60
  }
61
61
  export declare function defaultMessageQueueKeysForPlatform(platform?: NodeJS.Platform): KeyId;
62
62
  export declare function defaultClipboardPasteImageKeysForPlatform(platform?: NodeJS.Platform): KeyId[];
63
+ export declare function defaultForegroundFoldKeysForPlatform(platform?: NodeJS.Platform): KeyId[];
63
64
  /**
64
65
  * All keybindings definitions: TUI + app-specific.
65
66
  */
@@ -241,8 +242,8 @@ export declare const KEYBINDINGS: {
241
242
  readonly description: "Expand tools";
242
243
  };
243
244
  readonly "app.tool.backgroundFold": {
244
- readonly defaultKeys: "ctrl+b";
245
- readonly description: "Fold/background supported foreground tool";
245
+ readonly defaultKeys: KeyId[];
246
+ readonly description: "Fold supported foreground tool into a background job";
246
247
  };
247
248
  readonly "app.editor.external": {
248
249
  readonly defaultKeys: "ctrl+g";
@@ -0,0 +1,368 @@
1
+ import type { Api, Model } from "@gajae-code/ai/core";
2
+ import * as z from "zod/v4";
3
+ import { type ModelProfileDefinition } from "./model-profiles";
4
+ import type { ModelsConfig } from "./models-config-schema";
5
+ export declare const MODEL_PRESET_REGISTRY_CONTRACT_VERSION = "1.0.0";
6
+ export declare const DEFAULT_MODEL_PRESET_REGISTRY_URL = "https://raw.githubusercontent.com/Yeachan-Heo/gajae-code-presets/dev/latest.json";
7
+ export declare const MODEL_PRESET_REGISTRY_REFRESH_INTERVAL_MS: number;
8
+ export declare const MODEL_PRESET_REGISTRY_STARTUP_DELAY_MS = 30000;
9
+ export declare const MODEL_PRESET_REGISTRY_MAX_MANIFEST_BYTES: number;
10
+ export declare const MODEL_PRESET_REGISTRY_MAX_SNAPSHOT_BYTES: number;
11
+ export declare const MODEL_PRESET_REGISTRY_MAX_PROFILES_BYTES: number;
12
+ export declare const MODEL_PRESET_REGISTRY_MAX_PRESETS_BYTES: number;
13
+ export interface ModelPresetRegistryTrustedKey {
14
+ keyId: string;
15
+ publicKeyPem: string;
16
+ validFrom: string;
17
+ revokedAt?: string;
18
+ }
19
+ export declare const ModelPresetRegistryManifestSchema: z.ZodObject<{
20
+ schemaVersion: z.ZodLiteral<"1.0.0">;
21
+ signed: z.ZodObject<{
22
+ registryRevision: z.ZodNumber;
23
+ revision: z.ZodString;
24
+ publishedAt: z.ZodString;
25
+ compatibility: z.ZodObject<{
26
+ consumerContract: z.ZodObject<{
27
+ minVersion: z.ZodString;
28
+ maxVersion: z.ZodString;
29
+ }, z.core.$strict>;
30
+ }, z.core.$strict>;
31
+ snapshot: z.ZodObject<{
32
+ path: z.ZodString;
33
+ sha256: z.ZodString;
34
+ bytes: z.ZodNumber;
35
+ count: z.ZodNumber;
36
+ }, z.core.$strict>;
37
+ contents: z.ZodObject<{
38
+ presets: z.ZodObject<{
39
+ path: z.ZodString;
40
+ sha256: z.ZodString;
41
+ bytes: z.ZodNumber;
42
+ count: z.ZodNumber;
43
+ }, z.core.$strict>;
44
+ profiles: z.ZodObject<{
45
+ path: z.ZodString;
46
+ sha256: z.ZodString;
47
+ bytes: z.ZodNumber;
48
+ count: z.ZodNumber;
49
+ }, z.core.$strict>;
50
+ }, z.core.$strict>;
51
+ provenance: z.ZodObject<{
52
+ sourceRepository: z.ZodLiteral<"https://github.com/Yeachan-Heo/gajae-code">;
53
+ sourceRevision: z.ZodString;
54
+ sourcePaths: z.ZodArray<z.ZodString>;
55
+ generatedBy: z.ZodString;
56
+ generatedAt: z.ZodString;
57
+ }, z.core.$strict>;
58
+ }, z.core.$strict>;
59
+ signature: z.ZodObject<{
60
+ algorithm: z.ZodLiteral<"Ed25519">;
61
+ keyId: z.ZodString;
62
+ value: z.ZodString;
63
+ }, z.core.$strict>;
64
+ }, z.core.$strict>;
65
+ export declare const ModelPresetRegistrySnapshotSchema: z.ZodObject<{
66
+ schemaVersion: z.ZodLiteral<"1.0.0">;
67
+ registryRevision: z.ZodNumber;
68
+ revision: z.ZodString;
69
+ compatibility: z.ZodObject<{
70
+ consumerContract: z.ZodObject<{
71
+ minVersion: z.ZodString;
72
+ maxVersion: z.ZodString;
73
+ }, z.core.$strict>;
74
+ }, z.core.$strict>;
75
+ provenance: z.ZodObject<{
76
+ sourceRepository: z.ZodLiteral<"https://github.com/Yeachan-Heo/gajae-code">;
77
+ sourceRevision: z.ZodString;
78
+ sourcePaths: z.ZodArray<z.ZodString>;
79
+ generatedBy: z.ZodString;
80
+ generatedAt: z.ZodString;
81
+ }, z.core.$strict>;
82
+ contents: z.ZodObject<{
83
+ presets: z.ZodObject<{
84
+ path: z.ZodString;
85
+ sha256: z.ZodString;
86
+ bytes: z.ZodNumber;
87
+ count: z.ZodNumber;
88
+ }, z.core.$strict>;
89
+ profiles: z.ZodObject<{
90
+ path: z.ZodString;
91
+ sha256: z.ZodString;
92
+ bytes: z.ZodNumber;
93
+ count: z.ZodNumber;
94
+ }, z.core.$strict>;
95
+ }, z.core.$strict>;
96
+ }, z.core.$strict>;
97
+ export declare const ModelPresetRegistryProfilesSchema: z.ZodObject<{
98
+ schemaVersion: z.ZodLiteral<"1.0.0">;
99
+ revision: z.ZodString;
100
+ dynamicProviders: z.ZodArray<z.ZodString>;
101
+ profiles: z.ZodArray<z.ZodObject<{
102
+ id: z.ZodString;
103
+ displayName: z.ZodString;
104
+ providerGroup: z.ZodString;
105
+ requiredProviders: z.ZodArray<z.ZodString>;
106
+ alternativeProviderGroups: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
107
+ roleBindings: z.ZodObject<{
108
+ default: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
109
+ executor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
110
+ architect: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
111
+ planner: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
112
+ critic: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
113
+ }, z.core.$strict>;
114
+ }, z.core.$strict>>;
115
+ }, z.core.$strict>;
116
+ export declare const ModelPresetRegistryPresetsSchema: z.ZodObject<{
117
+ schemaVersion: z.ZodLiteral<"1.0.0">;
118
+ revision: z.ZodString;
119
+ presets: z.ZodArray<z.ZodObject<{
120
+ id: z.ZodString;
121
+ provider: z.ZodString;
122
+ name: z.ZodString;
123
+ api: z.ZodEnum<{
124
+ "anthropic-messages": "anthropic-messages";
125
+ "azure-openai-responses": "azure-openai-responses";
126
+ "bedrock-converse-stream": "bedrock-converse-stream";
127
+ "cursor-agent": "cursor-agent";
128
+ "google-gemini-cli": "google-gemini-cli";
129
+ "google-generative-ai": "google-generative-ai";
130
+ "google-vertex": "google-vertex";
131
+ "ollama-chat": "ollama-chat";
132
+ "openai-codex-responses": "openai-codex-responses";
133
+ "openai-completions": "openai-completions";
134
+ "openai-responses": "openai-responses";
135
+ }>;
136
+ reasoning: z.ZodBoolean;
137
+ input: z.ZodArray<z.ZodEnum<{
138
+ image: "image";
139
+ text: "text";
140
+ }>>;
141
+ output: z.ZodOptional<z.ZodArray<z.ZodEnum<{
142
+ image: "image";
143
+ text: "text";
144
+ }>>>;
145
+ cost: z.ZodObject<{
146
+ input: z.ZodNumber;
147
+ output: z.ZodNumber;
148
+ cacheRead: z.ZodNumber;
149
+ cacheWrite: z.ZodNumber;
150
+ }, z.core.$strict>;
151
+ contextWindow: z.ZodNumber;
152
+ maxTokens: z.ZodNumber;
153
+ compat: z.ZodOptional<z.ZodObject<{
154
+ maxTokensField: z.ZodOptional<z.ZodLiteral<"max_tokens">>;
155
+ reasoningContentField: z.ZodOptional<z.ZodLiteral<"reasoning_content">>;
156
+ thinkingFormat: z.ZodOptional<z.ZodLiteral<"zai">>;
157
+ reasoningEffortMap: z.ZodOptional<z.ZodObject<{
158
+ minimal: z.ZodOptional<z.ZodEnum<{
159
+ high: "high";
160
+ low: "low";
161
+ max: "max";
162
+ medium: "medium";
163
+ minimal: "minimal";
164
+ xhigh: "xhigh";
165
+ }>>;
166
+ low: z.ZodOptional<z.ZodEnum<{
167
+ high: "high";
168
+ low: "low";
169
+ max: "max";
170
+ medium: "medium";
171
+ minimal: "minimal";
172
+ xhigh: "xhigh";
173
+ }>>;
174
+ medium: z.ZodOptional<z.ZodEnum<{
175
+ high: "high";
176
+ low: "low";
177
+ max: "max";
178
+ medium: "medium";
179
+ minimal: "minimal";
180
+ xhigh: "xhigh";
181
+ }>>;
182
+ high: z.ZodOptional<z.ZodEnum<{
183
+ high: "high";
184
+ low: "low";
185
+ max: "max";
186
+ medium: "medium";
187
+ minimal: "minimal";
188
+ xhigh: "xhigh";
189
+ }>>;
190
+ xhigh: z.ZodOptional<z.ZodEnum<{
191
+ high: "high";
192
+ low: "low";
193
+ max: "max";
194
+ medium: "medium";
195
+ minimal: "minimal";
196
+ xhigh: "xhigh";
197
+ }>>;
198
+ max: z.ZodOptional<z.ZodEnum<{
199
+ high: "high";
200
+ low: "low";
201
+ max: "max";
202
+ medium: "medium";
203
+ minimal: "minimal";
204
+ xhigh: "xhigh";
205
+ }>>;
206
+ }, z.core.$strict>>;
207
+ requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
208
+ requiresReasoningContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
209
+ supportsDeveloperRole: z.ZodOptional<z.ZodBoolean>;
210
+ supportsMultipleSystemMessages: z.ZodOptional<z.ZodBoolean>;
211
+ supportsReasoningEffort: z.ZodOptional<z.ZodBoolean>;
212
+ supportsStore: z.ZodOptional<z.ZodBoolean>;
213
+ supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
214
+ supportsUsageInStreaming: z.ZodOptional<z.ZodBoolean>;
215
+ }, z.core.$strict>>;
216
+ thinking: z.ZodOptional<z.ZodObject<{
217
+ mode: z.ZodEnum<{
218
+ "anthropic-adaptive": "anthropic-adaptive";
219
+ "anthropic-budget-effort": "anthropic-budget-effort";
220
+ budget: "budget";
221
+ effort: "effort";
222
+ "google-level": "google-level";
223
+ }>;
224
+ minLevel: z.ZodOptional<z.ZodEnum<{
225
+ high: "high";
226
+ low: "low";
227
+ max: "max";
228
+ medium: "medium";
229
+ minimal: "minimal";
230
+ xhigh: "xhigh";
231
+ }>>;
232
+ maxLevel: z.ZodOptional<z.ZodEnum<{
233
+ high: "high";
234
+ low: "low";
235
+ max: "max";
236
+ medium: "medium";
237
+ minimal: "minimal";
238
+ xhigh: "xhigh";
239
+ }>>;
240
+ defaultLevel: z.ZodOptional<z.ZodEnum<{
241
+ high: "high";
242
+ low: "low";
243
+ max: "max";
244
+ medium: "medium";
245
+ minimal: "minimal";
246
+ xhigh: "xhigh";
247
+ }>>;
248
+ levels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
249
+ high: "high";
250
+ low: "low";
251
+ max: "max";
252
+ medium: "medium";
253
+ minimal: "minimal";
254
+ xhigh: "xhigh";
255
+ }>>>;
256
+ }, z.core.$strict>>;
257
+ longContextPricing: z.ZodOptional<z.ZodObject<{
258
+ threshold: z.ZodNumber;
259
+ cost: z.ZodObject<{
260
+ input: z.ZodNumber;
261
+ output: z.ZodNumber;
262
+ cacheRead: z.ZodNumber;
263
+ cacheWrite: z.ZodNumber;
264
+ }, z.core.$strict>;
265
+ }, z.core.$strict>>;
266
+ applyPatchToolType: z.ZodOptional<z.ZodLiteral<"freeform">>;
267
+ preferWebsockets: z.ZodOptional<z.ZodBoolean>;
268
+ premiumMultiplier: z.ZodOptional<z.ZodNumber>;
269
+ priority: z.ZodOptional<z.ZodNumber>;
270
+ contextPromotionTarget: z.ZodOptional<z.ZodString>;
271
+ }, z.core.$strict>>;
272
+ }, z.core.$strict>;
273
+ export type ModelPresetRegistryManifest = z.infer<typeof ModelPresetRegistryManifestSchema>;
274
+ export type ModelPresetRegistrySnapshot = z.infer<typeof ModelPresetRegistrySnapshotSchema>;
275
+ export type ModelPresetRegistryProfiles = z.infer<typeof ModelPresetRegistryProfilesSchema>;
276
+ export type ModelPresetRegistryPresets = z.infer<typeof ModelPresetRegistryPresetsSchema>;
277
+ export interface ModelPresetRegistryDependencies {
278
+ agentDir?: string;
279
+ manifestUrl?: string;
280
+ fetch?: typeof fetch;
281
+ now?: () => Date;
282
+ timeoutMs?: number;
283
+ maxManifestBytes?: number;
284
+ maxSnapshotBytes?: number;
285
+ maxProfilesBytes?: number;
286
+ maxPresetsBytes?: number;
287
+ maxStateBytes?: number;
288
+ automaticRefresh?: boolean;
289
+ startupDelayMs?: number;
290
+ refreshIntervalMs?: number;
291
+ knownManifestSha256?: string;
292
+ }
293
+ export interface AcceptedModelPresetRegistry {
294
+ profiles: Map<string, ModelProfileDefinition>;
295
+ presets: Model<Api>[];
296
+ dynamicProviders: string[];
297
+ revision?: number;
298
+ revisionId?: string;
299
+ manifestSha256?: string;
300
+ keyId?: string;
301
+ sourceRevision?: string;
302
+ retainedProfiles: string[];
303
+ retainedPresets: string[];
304
+ error?: string;
305
+ disabled: boolean;
306
+ pinnedRevision?: number;
307
+ }
308
+ export type ModelPresetRegistryRefreshResult = {
309
+ status: "updated";
310
+ revision: number;
311
+ revisionId: string;
312
+ manifestSha256: string;
313
+ retainedProfiles: string[];
314
+ retainedPresets: string[];
315
+ } | {
316
+ status: "not_modified";
317
+ revision?: number;
318
+ } | {
319
+ status: "disabled";
320
+ revision?: number;
321
+ };
322
+ export interface ModelPresetRegistryStatus {
323
+ contractVersion: string;
324
+ source: "embedded" | "registry";
325
+ cacheHealth: "empty" | "valid" | "corrupt";
326
+ activeRevision?: number;
327
+ activeRevisionId?: string;
328
+ highestSeenRevision?: number;
329
+ manifestSha256?: string;
330
+ snapshotSha256?: string;
331
+ profilesSha256?: string;
332
+ presetsSha256?: string;
333
+ keyId?: string;
334
+ sourceRevision?: string;
335
+ acceptedAt?: string;
336
+ publishedAt?: string;
337
+ lastCheckedAt?: string;
338
+ lastError?: string;
339
+ disabled: boolean;
340
+ pinnedRevision?: number;
341
+ retainedProfiles: string[];
342
+ retainedPresets: string[];
343
+ historyRevisions: number[];
344
+ profileCount: number;
345
+ presetCount: number;
346
+ }
347
+ export declare function canonicalModelPresetRegistryJson(value: unknown): string;
348
+ export declare function loadAcceptedModelPresetRegistry(agentDir?: string, dependencies?: Omit<ModelPresetRegistryDependencies, "agentDir">): AcceptedModelPresetRegistry;
349
+ /**
350
+ * Async accepted-registry loader for validation paths that can await disk I/O.
351
+ * It mirrors the synchronous loader's fail-closed result contract while using
352
+ * Bun file reads for state/control payloads.
353
+ */
354
+ export declare function loadAcceptedModelPresetRegistryAsync(agentDir?: string, dependencies?: Omit<ModelPresetRegistryDependencies, "agentDir">): Promise<AcceptedModelPresetRegistry>;
355
+ export declare function loadAcceptedModelPresetProfiles(agentDir?: string, dependencies?: Omit<ModelPresetRegistryDependencies, "agentDir">): AcceptedModelPresetRegistry;
356
+ export declare function loadEffectiveModelProfiles(userProfiles: ModelsConfig["profiles"] | undefined, agentDir?: string, dependencies?: Omit<ModelPresetRegistryDependencies, "agentDir">): Map<string, ModelProfileDefinition>;
357
+ export declare function refreshModelPresetRegistry(dependencies?: ModelPresetRegistryDependencies): Promise<ModelPresetRegistryRefreshResult>;
358
+ export declare function setModelPresetRegistryDisabled(options: ModelPresetRegistryDependencies & {
359
+ disabled: boolean;
360
+ }): Promise<void>;
361
+ export declare function setModelPresetRegistryPin(options: ModelPresetRegistryDependencies & {
362
+ revision?: number;
363
+ }): Promise<void>;
364
+ export declare function rollbackModelPresetRegistry(options: ModelPresetRegistryDependencies & {
365
+ revision?: number;
366
+ }): Promise<void>;
367
+ export declare function getModelPresetRegistryStatus(dependencies?: ModelPresetRegistryDependencies): ModelPresetRegistryStatus;
368
+ export declare function refreshModelPresetRegistryInBackground(dependencies?: ModelPresetRegistryDependencies, onAccepted?: () => void): () => Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { ThinkingLevel } from "@gajae-code/agent-core";
2
2
  import type { Api, Model } from "@gajae-code/ai/core";
3
3
  import type { AgentSession, DefaultFallbackRuntimeState } from "../session/agent-session";
4
+ import { type ModelProfileDefinition } from "./model-profiles";
4
5
  export { resolveModelProfileName } from "./model-profile-contract";
5
6
  import { type GjcModelAssignmentTargetId, type ModelRegistry } from "./model-registry";
6
7
  import { type ModelSelectorValue } from "./model-selector-value";
@@ -129,6 +130,44 @@ export declare class ModelProfileCredentialError extends Error {
129
130
  constructor(profileLabel: string, providers: readonly string[], role?: string);
130
131
  }
131
132
  export declare function formatModelProfileCredentialError(profileLabel: string, providers: readonly string[]): string;
133
+ /**
134
+ * Resolve the explicitly configured OpenAI-compatible proxy provider id for a
135
+ * preset. Returns undefined when unset or empty. Passwords/labels are never
136
+ * treated as proxy ids here; only lowercase provider ids from settings.
137
+ */
138
+ export declare function resolveProxyProviderId(settings: Pick<Settings, "get"> | undefined): string | undefined;
139
+ export type ProxyProviderConfig = {
140
+ status: "unset";
141
+ } | {
142
+ status: "configured";
143
+ id: string;
144
+ } | {
145
+ status: "invalid";
146
+ value: string;
147
+ };
148
+ export declare function inspectProxyProviderId(settings: Pick<Settings, "get"> | undefined): ProxyProviderConfig;
149
+ /** Passive surfaces fail closed on malformed settings instead of throwing. */
150
+ export declare function tryResolveProxyProviderId(settings: Pick<Settings, "get"> | undefined): string | undefined;
151
+ export type ModelProfileProxyMode = "fallback" | "always";
152
+ export declare function resolveProxyMode(settings: Pick<Settings, "get"> | undefined): ModelProfileProxyMode;
153
+ /**
154
+ * Rewrite a qualified provider selector so its model is served through the
155
+ * configured proxy. The proxy catalog uses sub-provider-prefixed model ids
156
+ * (e.g. `xiaomi/mimo-v2.5-pro` under `litellm`). Exact provider-prefixed
157
+ * matches win; a unique final-segment match is accepted for gateways that do
158
+ * not retain the upstream provider prefix. Missing or ambiguous matches fail
159
+ * closed rather than leaving an unauthenticated role selector behind.
160
+ */
161
+ export declare function getProxyRoutableProviders(profile: ModelProfileDefinition): ReadonlySet<string>;
162
+ /**
163
+ * Profile sources whose non-default qualified role bindings are part of the
164
+ * activation contract. Proxy rewrites run before role resolution, so a
165
+ * rewritten selector satisfies this prerequisite when its concrete proxy
166
+ * model is present in the effective catalog. Embedded built-ins intentionally
167
+ * retain their legacy tolerance for stale qualified role tails.
168
+ */
169
+ export declare function requiresQualifiedModelProfileRoleResolution(profile: Pick<ModelProfileDefinition, "source">): boolean;
170
+ export declare function rewriteSelectorForProxy(selector: string, proxyProvider: string, proxyMode: ModelProfileProxyMode, allModels: Model<Api>[], directlyAuthenticated: ReadonlySet<string>, routableProviders: ReadonlySet<string>): string;
132
171
  export declare function prepareModelProfileActivation(options: PrepareModelProfileActivationOptions): Promise<PreparedModelProfileActivation>;
133
172
  export declare function applyPreparedModelProfileActivation(prepared: PreparedModelProfileActivation, options?: ApplyModelProfileActivationOptions): Promise<void>;
134
173
  export interface MaterializeModelProfileForDeletionResult {
@@ -5,6 +5,7 @@ export interface ModelProfileDefinition {
5
5
  name: string;
6
6
  requiredProviders: string[];
7
7
  displayName?: string;
8
+ providerGroup?: string;
8
9
  /**
9
10
  * Optional groups of providers that are interchangeable fallbacks.
10
11
  * Each group is an array of provider ids where at least one must be
@@ -16,7 +17,7 @@ export interface ModelProfileDefinition {
16
17
  */
17
18
  alternativeProviderGroups?: readonly (readonly string[])[];
18
19
  modelMapping: Partial<Record<ModelProfileRole, ModelSelectorValue>>;
19
- source: "builtin" | "user";
20
+ source: "builtin" | "registry" | "user";
20
21
  }
21
22
  export interface ResolvedProfileBinding {
22
23
  defaultSelector?: ModelSelectorValue;
@@ -45,10 +46,11 @@ export interface ModelProfilePresentation {
45
46
  displayName: string;
46
47
  providerGroup: string;
47
48
  }
48
- export declare function getModelProfilePresentation(profile: string | Pick<ModelProfileDefinition, "name" | "displayName">): ModelProfilePresentation;
49
+ export declare function getModelProfilePresentation(profile: string | Pick<ModelProfileDefinition, "name" | "displayName" | "providerGroup">): ModelProfilePresentation;
49
50
  export declare function formatModelProfileDisplayLabel(profile: Pick<ModelProfileDefinition, "name" | "displayName">): string;
50
51
  export declare function groupModelProfilesForPresetLanding(profiles: ReadonlyMap<string, ModelProfileDefinition>): Map<string, ModelProfileDefinition[]>;
51
52
  export declare function recommendModelProfileForProvider(providerId: string, profiles: ReadonlyMap<string, ModelProfileDefinition>): ModelProfileDefinition | undefined;
52
- export declare function mergeModelProfiles(userProfiles?: ModelsConfig["profiles"]): Map<string, ModelProfileDefinition>;
53
+ export type RegistryModelProfilesInput = ReadonlyMap<string, ModelProfileDefinition> | readonly ModelProfileDefinition[] | Readonly<Record<string, ModelProfileDefinition>>;
54
+ export declare function mergeModelProfiles(userProfiles?: ModelsConfig["profiles"], registryProfiles?: RegistryModelProfilesInput): Map<string, ModelProfileDefinition>;
53
55
  export declare function resolveProfileBindings(definition: ModelProfileDefinition): ResolvedProfileBinding;
54
56
  export declare function formatAvailableProfileNames(profiles: ReadonlyMap<string, ModelProfileDefinition>): string;
@@ -4,10 +4,11 @@ import { type ThemeColor } from "../modes/theme/theme";
4
4
  import { type ActiveProviderDescriptor } from "../sdk/providers";
5
5
  import type { AuthStorage } from "../session/auth-storage";
6
6
  import type { ActiveSearchModelContext, WebSearchMode } from "../web/search/types";
7
- import { type ConfigError, ConfigFile } from "./config-file";
7
+ import { ConfigError, ConfigFile } from "./config-file";
8
8
  import { isAuthenticated, kNoAuth } from "./model-auth";
9
9
  import { type ConfiguredModelBindings } from "./model-bindings-applier";
10
10
  import { type ProviderDiscoveryState } from "./model-discovery-manager";
11
+ import { type ModelPresetRegistryDependencies } from "./model-preset-registry";
11
12
  export type { ProviderDiscoveryState, ProviderDiscoveryStatus } from "./model-discovery-manager";
12
13
  import { type CanonicalModelIndex, type CanonicalModelRecord, type CanonicalModelVariant, type ModelEquivalenceConfig } from "./model-equivalence";
13
14
  import { type ModelProfileDefinition } from "./model-profiles";
@@ -301,6 +302,7 @@ export declare const ModelsConfigFile: ConfigFile<{
301
302
  }>;
302
303
  /** Provider override config (baseUrl, headers, apiKey, compat, transport) without custom models */
303
304
  interface ProviderOverride {
305
+ api?: Api;
304
306
  baseUrl?: string;
305
307
  headers?: Record<string, string>;
306
308
  apiKey?: string;
@@ -309,6 +311,7 @@ interface ProviderOverride {
309
311
  transport?: Model<Api>["transport"];
310
312
  requestTransform?: ModelRequestTransform;
311
313
  cacheRetention?: CacheRetention;
314
+ isOAuth?: boolean;
312
315
  }
313
316
  /**
314
317
  * Merge a freshly discovered model with the matching bundled/configured entry
@@ -349,12 +352,13 @@ export declare class ModelRegistry {
349
352
  /**
350
353
  * @param authStorage - Auth storage for API key resolution
351
354
  */
352
- constructor(authStorage: AuthStorage, modelsPath?: string, registrySettings?: Pick<Settings, "get" | "getGlobal">);
355
+ constructor(authStorage: AuthStorage, modelsPath?: string, registrySettings?: Pick<Settings, "get" | "getGlobal">, modelPresetRegistryDependencies?: ModelPresetRegistryDependencies);
356
+ dispose(): Promise<void>;
353
357
  onCatalogChanged(listener: () => void): () => void;
354
358
  /** Replace the read-only settings snapshot used by profile-scoped resolution. */
355
359
  setScopedSettings(settingsReader: Pick<Settings, "get" | "getGlobal">): void;
356
360
  /**
357
- * Reload models from disk (built-in + custom from models.json).
361
+ * Reload models from disk (embedded + accepted registry + custom from models.yml).
358
362
  */
359
363
  refresh(strategy?: ModelRefreshStrategy): Promise<void>;
360
364
  refreshInBackground(strategy?: ModelRefreshStrategy): void;
@@ -384,8 +388,8 @@ export declare class ModelRegistry {
384
388
  /** The currently configured modelBindings, for pre-profile baseline lookup. */
385
389
  getConfiguredModelBindings(): ConfiguredModelBindings | undefined;
386
390
  /**
387
- * Get all models (built-in + custom).
388
- * If models.json had errors, returns only built-in models.
391
+ * Get all models (embedded + accepted registry + custom).
392
+ * If models.yml had errors, returns embedded plus accepted registry models.
389
393
  */
390
394
  getAll(): Model<Api>[];
391
395
  /** Provider ids declared in models.yml, including override-only providers. */
@@ -405,6 +409,12 @@ export declare class ModelRegistry {
405
409
  * with case-sensitive exact strings.
406
410
  */
407
411
  autoroutingProviderOrder(): readonly string[];
412
+ /**
413
+ * Provider priority for automatic model selection. Explicit provider order
414
+ * wins first, followed by omitted OAuth providers, then other providers;
415
+ * catalog order breaks ties within each policy band.
416
+ */
417
+ automaticProviderOrder(sessionId?: string): readonly string[];
408
418
  getCanonicalModels(options?: CanonicalModelQueryOptions): CanonicalModelRecord[];
409
419
  /**
410
420
  * Batch form of {@link resolveCanonicalModel} over every canonical record:
@@ -520,6 +530,8 @@ export declare class ModelRegistry {
520
530
  * Get the base URL associated with a provider, if any model defines one.
521
531
  */
522
532
  getProviderBaseUrl(provider: string): string | undefined;
533
+ /** Opaque owner token for registry-scoped AuthStorage reads. */
534
+ getAuthStorageOwner(): object;
523
535
  getProviderWebSearchMode(provider: string): WebSearchMode | undefined;
524
536
  getActiveSearchModelContext(model: Model<Api>): ActiveSearchModelContext;
525
537
  /**