@agi-fans/dsh-tui 0.20.0 → 0.22.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 (319) hide show
  1. package/lib/CHANGELOG.md +249 -3
  2. package/lib/chrome/box.d.ts +47 -16
  3. package/lib/chrome/box.js +172 -130
  4. package/lib/chrome/box.js.map +1 -1
  5. package/lib/chrome/code-highlight.d.ts +15 -0
  6. package/lib/chrome/code-highlight.js +60 -4
  7. package/lib/chrome/code-highlight.js.map +1 -1
  8. package/lib/chrome/command-output.d.ts +29 -2
  9. package/lib/chrome/command-output.js +100 -4
  10. package/lib/chrome/command-output.js.map +1 -1
  11. package/lib/chrome/main-screen-renderer.d.ts +18 -0
  12. package/lib/chrome/main-screen-renderer.js +58 -5
  13. package/lib/chrome/main-screen-renderer.js.map +1 -1
  14. package/lib/chrome/markdown.js +30 -10
  15. package/lib/chrome/markdown.js.map +1 -1
  16. package/lib/chrome/relative-time.d.ts +17 -0
  17. package/lib/chrome/relative-time.js +36 -0
  18. package/lib/chrome/relative-time.js.map +1 -1
  19. package/lib/chrome/renderer.d.ts +9 -0
  20. package/lib/chrome/renderer.js +1 -1
  21. package/lib/chrome/renderer.js.map +1 -1
  22. package/lib/chrome/secret-mask.d.ts +35 -0
  23. package/lib/chrome/secret-mask.js +180 -0
  24. package/lib/chrome/secret-mask.js.map +1 -0
  25. package/lib/chrome/status-config.d.ts +161 -51
  26. package/lib/chrome/status-config.js +237 -126
  27. package/lib/chrome/status-config.js.map +1 -1
  28. package/lib/chrome/status-line.d.ts +3 -2
  29. package/lib/chrome/status-line.js +105 -63
  30. package/lib/chrome/status-line.js.map +1 -1
  31. package/lib/chrome/terminal-colors.d.ts +85 -0
  32. package/lib/chrome/terminal-colors.js +230 -0
  33. package/lib/chrome/terminal-colors.js.map +1 -0
  34. package/lib/chrome/terminal-images.d.ts +9 -1
  35. package/lib/chrome/terminal-images.js +27 -4
  36. package/lib/chrome/terminal-images.js.map +1 -1
  37. package/lib/chrome/theme.d.ts +32 -9
  38. package/lib/chrome/theme.js +616 -520
  39. package/lib/chrome/theme.js.map +1 -1
  40. package/lib/chrome/tool-args.d.ts +1 -1
  41. package/lib/chrome/tool-args.js +3 -1
  42. package/lib/chrome/tool-args.js.map +1 -1
  43. package/lib/chrome/tool-renderers.d.ts +2 -0
  44. package/lib/chrome/tool-renderers.js +69 -3
  45. package/lib/chrome/tool-renderers.js.map +1 -1
  46. package/lib/chrome/tools-list.d.ts +1 -4
  47. package/lib/chrome/tools-list.js +1 -41
  48. package/lib/chrome/tools-list.js.map +1 -1
  49. package/lib/chrome/welcome-tips.d.ts +20 -7
  50. package/lib/chrome/welcome-tips.js +22 -41
  51. package/lib/chrome/welcome-tips.js.map +1 -1
  52. package/lib/commands/auth-ids.d.ts +25 -0
  53. package/lib/commands/auth-ids.js +27 -0
  54. package/lib/commands/auth-ids.js.map +1 -0
  55. package/lib/commands/auth-input.d.ts +34 -0
  56. package/lib/commands/auth-input.js +96 -0
  57. package/lib/commands/auth-input.js.map +1 -0
  58. package/lib/commands/auth-providers.d.ts +39 -0
  59. package/lib/commands/auth-providers.js +125 -0
  60. package/lib/commands/auth-providers.js.map +1 -0
  61. package/lib/commands/auth.d.ts +16 -22
  62. package/lib/commands/auth.js +346 -299
  63. package/lib/commands/auth.js.map +1 -1
  64. package/lib/commands/btw.d.ts +27 -0
  65. package/lib/commands/btw.js +59 -0
  66. package/lib/commands/btw.js.map +1 -0
  67. package/lib/commands/diff.js +30 -5
  68. package/lib/commands/diff.js.map +1 -1
  69. package/lib/commands/export.d.ts +1 -1
  70. package/lib/commands/export.js +5 -3
  71. package/lib/commands/export.js.map +1 -1
  72. package/lib/commands/files.d.ts +17 -1
  73. package/lib/commands/files.js +69 -61
  74. package/lib/commands/files.js.map +1 -1
  75. package/lib/commands/integrations.js +18 -6
  76. package/lib/commands/integrations.js.map +1 -1
  77. package/lib/commands/jobs.d.ts +19 -4
  78. package/lib/commands/jobs.js +50 -7
  79. package/lib/commands/jobs.js.map +1 -1
  80. package/lib/commands/model.js +109 -76
  81. package/lib/commands/model.js.map +1 -1
  82. package/lib/commands/permission.js +46 -13
  83. package/lib/commands/permission.js.map +1 -1
  84. package/lib/commands/plugins.js +196 -42
  85. package/lib/commands/plugins.js.map +1 -1
  86. package/lib/commands/schedule.d.ts +29 -0
  87. package/lib/commands/schedule.js +228 -0
  88. package/lib/commands/schedule.js.map +1 -0
  89. package/lib/commands/session-configuration.d.ts +1 -1
  90. package/lib/commands/session-configuration.js +29 -28
  91. package/lib/commands/session-configuration.js.map +1 -1
  92. package/lib/commands/session.js +75 -80
  93. package/lib/commands/session.js.map +1 -1
  94. package/lib/commands/terminal.d.ts +24 -4
  95. package/lib/commands/terminal.js +38 -94
  96. package/lib/commands/terminal.js.map +1 -1
  97. package/lib/commands/trajectory.js +4 -1
  98. package/lib/commands/trajectory.js.map +1 -1
  99. package/lib/definition.d.ts +150 -11
  100. package/lib/index.d.ts +1 -0
  101. package/lib/index.js +1 -0
  102. package/lib/index.js.map +1 -1
  103. package/lib/input/actions.d.ts +51 -0
  104. package/lib/input/actions.js +120 -0
  105. package/lib/input/actions.js.map +1 -0
  106. package/lib/input/editor-discovery.js +2 -2
  107. package/lib/input/editor-discovery.js.map +1 -1
  108. package/lib/input/editor.d.ts +0 -10
  109. package/lib/input/editor.js +11 -9
  110. package/lib/input/editor.js.map +1 -1
  111. package/lib/input/image-paste.d.ts +19 -1
  112. package/lib/input/image-paste.js +82 -1
  113. package/lib/input/image-paste.js.map +1 -1
  114. package/lib/input/keybindings-config.d.ts +15 -4
  115. package/lib/input/keybindings-config.js +57 -35
  116. package/lib/input/keybindings-config.js.map +1 -1
  117. package/lib/input/keys.d.ts +18 -0
  118. package/lib/input/keys.js +48 -3
  119. package/lib/input/keys.js.map +1 -1
  120. package/lib/input/wheel-scroll.d.ts +46 -0
  121. package/lib/input/wheel-scroll.js +69 -0
  122. package/lib/input/wheel-scroll.js.map +1 -0
  123. package/lib/prompt-intents.d.ts +182 -0
  124. package/lib/prompt-intents.js +127 -0
  125. package/lib/prompt-intents.js.map +1 -0
  126. package/lib/runtime/agent-profile.d.ts +5 -0
  127. package/lib/runtime/agent-profile.js +12 -0
  128. package/lib/runtime/agent-profile.js.map +1 -1
  129. package/lib/runtime/approval-rules.d.ts +59 -0
  130. package/lib/runtime/approval-rules.js +179 -0
  131. package/lib/runtime/approval-rules.js.map +1 -0
  132. package/lib/runtime/btw-policy.d.ts +7 -0
  133. package/lib/runtime/btw-policy.js +18 -0
  134. package/lib/runtime/btw-policy.js.map +1 -0
  135. package/lib/runtime/btw.d.ts +47 -0
  136. package/lib/runtime/btw.js +200 -0
  137. package/lib/runtime/btw.js.map +1 -0
  138. package/lib/runtime/cancellable.d.ts +75 -0
  139. package/lib/runtime/cancellable.js +76 -0
  140. package/lib/runtime/cancellable.js.map +1 -0
  141. package/lib/runtime/composer-images.js +5 -4
  142. package/lib/runtime/composer-images.js.map +1 -1
  143. package/lib/runtime/composer-shell.d.ts +30 -0
  144. package/lib/runtime/composer-shell.js +150 -0
  145. package/lib/runtime/composer-shell.js.map +1 -0
  146. package/lib/runtime/file-recovery-local.d.ts +73 -0
  147. package/lib/runtime/file-recovery-local.js +351 -0
  148. package/lib/runtime/file-recovery-local.js.map +1 -0
  149. package/lib/runtime/file-recovery-recording.d.ts +23 -0
  150. package/lib/runtime/file-recovery-recording.js +131 -0
  151. package/lib/runtime/file-recovery-recording.js.map +1 -0
  152. package/lib/runtime/file-recovery-review.d.ts +3 -0
  153. package/lib/runtime/file-recovery-review.js +130 -0
  154. package/lib/runtime/file-recovery-review.js.map +1 -0
  155. package/lib/runtime/file-recovery-store.d.ts +83 -0
  156. package/lib/runtime/file-recovery-store.js +329 -0
  157. package/lib/runtime/file-recovery-store.js.map +1 -0
  158. package/lib/runtime/file-recovery-worker.d.ts +22 -0
  159. package/lib/runtime/file-recovery-worker.js +153 -0
  160. package/lib/runtime/file-recovery-worker.js.map +1 -0
  161. package/lib/runtime/file-review.d.ts +6 -3
  162. package/lib/runtime/file-review.js +44 -7
  163. package/lib/runtime/file-review.js.map +1 -1
  164. package/lib/runtime/herdr-agent.d.ts +4 -13
  165. package/lib/runtime/herdr-agent.js +19 -63
  166. package/lib/runtime/herdr-agent.js.map +1 -1
  167. package/lib/runtime/plain-tui.d.ts +2 -0
  168. package/lib/runtime/plain-tui.js +7 -1
  169. package/lib/runtime/plain-tui.js.map +1 -1
  170. package/lib/runtime/plugin-settings.d.ts +25 -2
  171. package/lib/runtime/plugin-settings.js +329 -31
  172. package/lib/runtime/plugin-settings.js.map +1 -1
  173. package/lib/runtime/provider-local.d.ts +81 -24
  174. package/lib/runtime/provider-local.js +1807 -608
  175. package/lib/runtime/provider-local.js.map +1 -1
  176. package/lib/runtime/runner.js +52 -12
  177. package/lib/runtime/runner.js.map +1 -1
  178. package/lib/runtime/session-archive.d.ts +6 -0
  179. package/lib/runtime/session-archive.js +129 -3
  180. package/lib/runtime/session-archive.js.map +1 -1
  181. package/lib/runtime/session-runtime.js +1 -1
  182. package/lib/runtime/session-runtime.js.map +1 -1
  183. package/lib/runtime/settings-preferences.d.ts +5 -0
  184. package/lib/runtime/settings-preferences.js +34 -0
  185. package/lib/runtime/settings-preferences.js.map +1 -0
  186. package/lib/runtime/startup-notices.js +2 -0
  187. package/lib/runtime/startup-notices.js.map +1 -1
  188. package/lib/runtime/terminal-modes.d.ts +47 -0
  189. package/lib/runtime/terminal-modes.js +86 -0
  190. package/lib/runtime/terminal-modes.js.map +1 -0
  191. package/lib/runtime/terminal-notifications.d.ts +3 -5
  192. package/lib/runtime/terminal-notifications.js +4 -8
  193. package/lib/runtime/terminal-notifications.js.map +1 -1
  194. package/lib/runtime/terminal-probe.d.ts +36 -0
  195. package/lib/runtime/terminal-probe.js +37 -0
  196. package/lib/runtime/terminal-probe.js.map +1 -0
  197. package/lib/runtime/terminal-session.d.ts +57 -0
  198. package/lib/runtime/terminal-session.js +164 -0
  199. package/lib/runtime/terminal-session.js.map +1 -0
  200. package/lib/runtime/terminal-state.d.ts +29 -0
  201. package/lib/runtime/terminal-state.js +62 -0
  202. package/lib/runtime/terminal-state.js.map +1 -0
  203. package/lib/runtime/tool-presentation.js +50 -14
  204. package/lib/runtime/tool-presentation.js.map +1 -1
  205. package/lib/session/external-agents.d.ts +5 -0
  206. package/lib/session/external-agents.js +27 -0
  207. package/lib/session/external-agents.js.map +1 -0
  208. package/lib/session/feature-toggles.d.ts +1 -1
  209. package/lib/session/feature-toggles.js +1 -1
  210. package/lib/session/interaction-adapter.d.ts +1 -6
  211. package/lib/session/interaction-adapter.js +95 -18
  212. package/lib/session/interaction-adapter.js.map +1 -1
  213. package/lib/session/message-queue.js +1 -1
  214. package/lib/session/message-queue.js.map +1 -1
  215. package/lib/session/model-readiness.d.ts +16 -0
  216. package/lib/session/model-readiness.js +43 -0
  217. package/lib/session/model-readiness.js.map +1 -0
  218. package/lib/session/package-metadata.d.ts +8 -0
  219. package/lib/session/package-metadata.js +8 -0
  220. package/lib/session/package-metadata.js.map +1 -1
  221. package/lib/session/project-context.d.ts +5 -0
  222. package/lib/session/project-context.js +36 -0
  223. package/lib/session/project-context.js.map +1 -1
  224. package/lib/session/session-controller.d.ts +10 -13
  225. package/lib/session/session-controller.js +183 -98
  226. package/lib/session/session-controller.js.map +1 -1
  227. package/lib/session/session-library.js +2 -0
  228. package/lib/session/session-library.js.map +1 -1
  229. package/lib/session/session-tree.d.ts +3 -0
  230. package/lib/session/session-tree.js +3 -1
  231. package/lib/session/session-tree.js.map +1 -1
  232. package/lib/session/subagent-roster.d.ts +2 -1
  233. package/lib/session/subagent-roster.js +24 -3
  234. package/lib/session/subagent-roster.js.map +1 -1
  235. package/lib/session/subagent-tracker.d.ts +6 -2
  236. package/lib/session/subagent-tracker.js +49 -2
  237. package/lib/session/subagent-tracker.js.map +1 -1
  238. package/lib/session/tui-settings.d.ts +47 -13
  239. package/lib/session/tui-settings.js +76 -34
  240. package/lib/session/tui-settings.js.map +1 -1
  241. package/lib/session/working-directory.d.ts +4 -0
  242. package/lib/session/working-directory.js +4 -0
  243. package/lib/session/working-directory.js.map +1 -0
  244. package/lib/session/worktrees.d.ts +13 -0
  245. package/lib/session/worktrees.js +49 -0
  246. package/lib/session/worktrees.js.map +1 -0
  247. package/lib/views/approval-rule.d.ts +3 -0
  248. package/lib/views/approval-rule.js +4 -0
  249. package/lib/views/approval-rule.js.map +1 -0
  250. package/lib/views/at-complete.d.ts +8 -0
  251. package/lib/views/at-complete.js +64 -2
  252. package/lib/views/at-complete.js.map +1 -1
  253. package/lib/views/autocomplete.d.ts +22 -2
  254. package/lib/views/autocomplete.js +70 -40
  255. package/lib/views/autocomplete.js.map +1 -1
  256. package/lib/views/copy-targets.d.ts +13 -14
  257. package/lib/views/copy-targets.js +42 -54
  258. package/lib/views/copy-targets.js.map +1 -1
  259. package/lib/views/document-reader.js +18 -5
  260. package/lib/views/document-reader.js.map +1 -1
  261. package/lib/views/event-views.d.ts +1 -1
  262. package/lib/views/event-views.js +60 -6
  263. package/lib/views/event-views.js.map +1 -1
  264. package/lib/views/file-actions.d.ts +12 -0
  265. package/lib/views/file-actions.js +72 -0
  266. package/lib/views/file-actions.js.map +1 -0
  267. package/lib/views/history-search.js +15 -21
  268. package/lib/views/history-search.js.map +1 -1
  269. package/lib/views/hotkeys.d.ts +8 -1
  270. package/lib/views/hotkeys.js +53 -26
  271. package/lib/views/hotkeys.js.map +1 -1
  272. package/lib/views/list-navigation.d.ts +62 -0
  273. package/lib/views/list-navigation.js +73 -0
  274. package/lib/views/list-navigation.js.map +1 -0
  275. package/lib/views/list-view.d.ts +99 -0
  276. package/lib/views/list-view.js +165 -0
  277. package/lib/views/list-view.js.map +1 -0
  278. package/lib/views/prompt-selector.d.ts +34 -4
  279. package/lib/views/prompt-selector.js +270 -134
  280. package/lib/views/prompt-selector.js.map +1 -1
  281. package/lib/views/session-files.d.ts +1 -2
  282. package/lib/views/session-files.js +1 -11
  283. package/lib/views/session-files.js.map +1 -1
  284. package/lib/views/settings-list.d.ts +51 -10
  285. package/lib/views/settings-list.js +267 -315
  286. package/lib/views/settings-list.js.map +1 -1
  287. package/lib/views/trajectory-timeline.d.ts +72 -0
  288. package/lib/views/trajectory-timeline.js +133 -0
  289. package/lib/views/trajectory-timeline.js.map +1 -0
  290. package/lib/views/trajectory.d.ts +15 -4
  291. package/lib/views/trajectory.js +557 -123
  292. package/lib/views/trajectory.js.map +1 -1
  293. package/lib/views/transcript-export.js +9 -0
  294. package/lib/views/transcript-export.js.map +1 -1
  295. package/lib/views/transcript-render.d.ts +97 -25
  296. package/lib/views/transcript-render.js +542 -170
  297. package/lib/views/transcript-render.js.map +1 -1
  298. package/lib/views/transcript-search.d.ts +39 -6
  299. package/lib/views/transcript-search.js +46 -11
  300. package/lib/views/transcript-search.js.map +1 -1
  301. package/lib/views/transcript-types.d.ts +63 -5
  302. package/lib/views/transcript-types.js +23 -11
  303. package/lib/views/transcript-types.js.map +1 -1
  304. package/package.json +95 -65
  305. package/lib/commands/loop.d.ts +0 -52
  306. package/lib/commands/loop.js +0 -307
  307. package/lib/commands/loop.js.map +0 -1
  308. package/lib/commands/steer.d.ts +0 -5
  309. package/lib/commands/steer.js +0 -24
  310. package/lib/commands/steer.js.map +0 -1
  311. package/lib/runtime/terminal-reader.d.ts +0 -11
  312. package/lib/runtime/terminal-reader.js +0 -87
  313. package/lib/runtime/terminal-reader.js.map +0 -1
  314. package/lib/views/agent-hub.d.ts +0 -32
  315. package/lib/views/agent-hub.js +0 -206
  316. package/lib/views/agent-hub.js.map +0 -1
  317. package/lib/views/copy-selector.d.ts +0 -51
  318. package/lib/views/copy-selector.js +0 -139
  319. package/lib/views/copy-selector.js.map +0 -1
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Parsing and validation for credential and provider input.
3
+ *
4
+ * These functions used to live beside the login flows in `commands/auth.ts`,
5
+ * which made that file 1265 lines and mixed three jobs: turning what the reader
6
+ * typed into a value, discovering which providers exist, and orchestrating a
7
+ * login. Only the first is pure — no `Context`, no terminal, no credential
8
+ * store — so it is the part that can be read and tested on its own.
9
+ *
10
+ * @module @agi-fans/dsh-tui/commands/auth-input
11
+ */
12
+ import { type CredentialRef } from '@deepseek-ai/dsh-credentials';
13
+ import { CUSTOM_PROVIDER_VALUE } from './auth-ids.ts';
14
+ export { CUSTOM_PROVIDER_VALUE };
15
+ /** DeepSeek's own API-key console. */
16
+ export declare const DEEPSEEK_API_KEYS_URL = "https://platform.deepseek.com/api_keys";
17
+ /** The listing used to validate a key without reading its body. */
18
+ export declare const DEEPSEEK_MODELS_URL = "https://api.deepseek.com/v1/models";
19
+ /** Protocols a custom provider may speak. */
20
+ export declare const CUSTOM_PROTOCOLS: readonly ["openai-completions", "openai-responses", "anthropic-messages"];
21
+ /** Match DeepSeek's own login normalization without accepting an empty Bearer value. */
22
+ export declare function normalizeDeepSeekApiKey(raw: string): string;
23
+ /** Trim a pasted key and reject an empty Bearer value. */
24
+ export declare function normalizeApiKey(raw: string, providerLabel: string): string;
25
+ /** omdsh-managed credential reference for one catalog provider route. */
26
+ export declare function managedProviderCredentialRef(provider: string): CredentialRef;
27
+ /** Lowercase kebab-case route id used as the permanent provider key. */
28
+ export declare function parseProviderId(raw: string): string;
29
+ /** Absolute http(s) prefix the adapter will call. */
30
+ export declare function parseBaseURL(raw: string): string;
31
+ /** One or more model ids from a comma- or whitespace-separated list. */
32
+ export declare function parseModelIds(raw: string): string[];
33
+ /** Validate a candidate without ever reading or returning a response body. */
34
+ export declare function validateDeepSeekApiKey(apiKey: string, signal: AbortSignal, fetchImpl?: typeof fetch): Promise<void>;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Parsing and validation for credential and provider input.
3
+ *
4
+ * These functions used to live beside the login flows in `commands/auth.ts`,
5
+ * which made that file 1265 lines and mixed three jobs: turning what the reader
6
+ * typed into a value, discovering which providers exist, and orchestrating a
7
+ * login. Only the first is pure — no `Context`, no terminal, no credential
8
+ * store — so it is the part that can be read and tested on its own.
9
+ *
10
+ * @module @agi-fans/dsh-tui/commands/auth-input
11
+ */
12
+ import { credentialRef } from '@deepseek-ai/dsh-credentials';
13
+ import { CUSTOM_PROVIDER_VALUE } from "./auth-ids.js";
14
+ export { CUSTOM_PROVIDER_VALUE };
15
+ /** DeepSeek's own API-key console. */
16
+ export const DEEPSEEK_API_KEYS_URL = 'https://platform.deepseek.com/api_keys';
17
+ /** The listing used to validate a key without reading its body. */
18
+ export const DEEPSEEK_MODELS_URL = 'https://api.deepseek.com/v1/models';
19
+ /** Accepted provider ids: lowercase kebab-case, starting with a letter. */
20
+ const PROVIDER_ID = /^[a-z][a-z0-9-]*$/u;
21
+ /** Protocols a custom provider may speak. */
22
+ export const CUSTOM_PROTOCOLS = ['openai-completions', 'openai-responses', 'anthropic-messages'];
23
+ /** Match DeepSeek's own login normalization without accepting an empty Bearer value. */
24
+ export function normalizeDeepSeekApiKey(raw) {
25
+ return normalizeApiKey(raw, 'DeepSeek');
26
+ }
27
+ /** Trim a pasted key and reject an empty Bearer value. */
28
+ export function normalizeApiKey(raw, providerLabel) {
29
+ const normalized = raw.trim().replace(/^bearer\b\s*/iu, '');
30
+ if (normalized === '')
31
+ throw new Error(`Paste a non-empty ${providerLabel} API key.`);
32
+ return normalized;
33
+ }
34
+ /** omdsh-managed credential reference for one catalog provider route. */
35
+ export function managedProviderCredentialRef(provider) {
36
+ return credentialRef(`OMDSH_${provider.toUpperCase().replace(/[^A-Z0-9]+/gu, '_')}_API_KEY`);
37
+ }
38
+ /** Lowercase kebab-case route id used as the permanent provider key. */
39
+ export function parseProviderId(raw) {
40
+ const id = raw.trim().toLowerCase();
41
+ if (!PROVIDER_ID.test(id)) {
42
+ throw new Error('Provider id must start with a letter and use only lowercase letters, digits, and hyphens.');
43
+ }
44
+ if (id === 'custom' || id === CUSTOM_PROVIDER_VALUE) {
45
+ throw new Error('Choose a different provider id.');
46
+ }
47
+ return id;
48
+ }
49
+ /** Absolute http(s) prefix the adapter will call. */
50
+ export function parseBaseURL(raw) {
51
+ const value = raw.trim().replace(/\/+$/u, '');
52
+ let parsed;
53
+ try {
54
+ parsed = new URL(value);
55
+ }
56
+ catch {
57
+ throw new Error('Base URL must be an absolute http or https URL.');
58
+ }
59
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
60
+ throw new Error('Base URL must be an http or https URL.');
61
+ }
62
+ return value;
63
+ }
64
+ /** One or more model ids from a comma- or whitespace-separated list. */
65
+ export function parseModelIds(raw) {
66
+ const ids = [...new Set(raw.split(/[,\s]+/u).map(item => item.trim()).filter(item => item !== ''))];
67
+ if (ids.length === 0)
68
+ throw new Error('Enter at least one model id.');
69
+ return ids;
70
+ }
71
+ /** Validate a candidate without ever reading or returning a response body. */
72
+ export async function validateDeepSeekApiKey(apiKey, signal, fetchImpl = globalThis.fetch) {
73
+ let response;
74
+ try {
75
+ response = await fetchImpl(DEEPSEEK_MODELS_URL, {
76
+ method: 'GET',
77
+ headers: {
78
+ accept: 'application/json',
79
+ authorization: `Bearer ${apiKey}`,
80
+ },
81
+ signal,
82
+ });
83
+ }
84
+ catch {
85
+ if (signal.aborted)
86
+ throw new Error('DeepSeek login was cancelled.');
87
+ throw new Error('Could not reach DeepSeek to validate the API key. Check your network and try again.');
88
+ }
89
+ if (response.ok)
90
+ return;
91
+ if (response.status === 401 || response.status === 403) {
92
+ throw new Error('DeepSeek rejected this API key. Copy a valid key from the DeepSeek dashboard and try again.');
93
+ }
94
+ throw new Error(`DeepSeek could not validate the API key (HTTP ${response.status}). Try again later.`);
95
+ }
96
+ //# sourceMappingURL=auth-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-input.js","sourceRoot":"","sources":["../../src/commands/auth-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAsB,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,EAAE,qBAAqB,EAAE,CAAA;A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;YAC9C,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,aAAa,EAAE,UAAU,MAAM,EAAE;aAClC;YACD,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;QACpE,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAA;IACxG,CAAC;IACD,IAAI,QAAQ,CAAC,EAAE;QAAE,OAAM;IACvB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAA;IAChH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,QAAQ,CAAC,MAAM,qBAAqB,CAAC,CAAA;AACxG,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Which providers omdsh can sign in to, and how they are classified.
3
+ *
4
+ * `commands/auth.ts` was 1265 lines because it held three jobs at once: what the
5
+ * reader typed (now `auth-input.ts`), which providers exist, and the login flows
6
+ * themselves. This module is the middle one. It reads the Harness roster and the
7
+ * authorization registry and answers questions about it — "what may be listed",
8
+ * "what is this flow", "does this provider have a stored profile" — without
9
+ * showing anything or changing anything.
10
+ *
11
+ * Keeping it separate matters for the same reason the whole TUI is being thinned:
12
+ * a provider rule that lives inside a login prompt can only be tested by driving
13
+ * a terminal. Every function here is a plain Context query.
14
+ *
15
+ * @module @agi-fans/dsh-tui/commands/auth-providers
16
+ */
17
+ import type { Context } from '@deepseek-ai/cordis';
18
+ import type { AuthorizationEntry } from '@deepseek-ai/dsh-authorization';
19
+ import { type CredentialKey } from '@deepseek-ai/dsh-credentials';
20
+ import type { LlmConfigurableProvider } from '@deepseek-ai/dsh-llm';
21
+ export declare function isDeepSeek(entry: LlmConfigurableProvider): boolean;
22
+ export declare function isPiAiLoginable(entry: LlmConfigurableProvider): boolean;
23
+ export declare function providerListId(entry: LlmConfigurableProvider): string;
24
+ export declare function fallbackDeepSeekEntry(): LlmConfigurableProvider;
25
+ export declare function loginableProviders(ctx: Context): LlmConfigurableProvider[];
26
+ export declare function authorizationFlows(ctx: Context): readonly AuthorizationEntry[];
27
+ export declare function isPiAiDeepSeekFlow(flow: AuthorizationEntry): boolean;
28
+ export declare function isAccountFlow(flow: AuthorizationEntry): boolean;
29
+ export declare function loginAuthorizationFlows(ctx: Context): readonly AuthorizationEntry[];
30
+ export declare function catalogAuthorizationFlow(ctx: Context, provider: string): AuthorizationEntry | undefined;
31
+ export declare function catalogProvidersWithoutFlows(ctx: Context): LlmConfigurableProvider[];
32
+ export declare function flowChoiceValue(key: CredentialKey): string;
33
+ export declare function parseFlowChoice(raw: string): CredentialKey | undefined;
34
+ export declare function sectionValue(ctx: Context, namespace: string): unknown;
35
+ export declare function walkPath(root: unknown, path: readonly string[]): unknown;
36
+ export declare function profileApiKeyEnv(ctx: Context, entry: LlmConfigurableProvider): string | undefined;
37
+ export declare function hasStoredProfile(ctx: Context, entry: LlmConfigurableProvider): boolean;
38
+ export declare function logoutableProviders(ctx: Context): LlmConfigurableProvider[];
39
+ export declare function catalogForRecord(ctx: Context, key: CredentialKey): LlmConfigurableProvider | undefined;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Which providers omdsh can sign in to, and how they are classified.
3
+ *
4
+ * `commands/auth.ts` was 1265 lines because it held three jobs at once: what the
5
+ * reader typed (now `auth-input.ts`), which providers exist, and the login flows
6
+ * themselves. This module is the middle one. It reads the Harness roster and the
7
+ * authorization registry and answers questions about it — "what may be listed",
8
+ * "what is this flow", "does this provider have a stored profile" — without
9
+ * showing anything or changing anything.
10
+ *
11
+ * Keeping it separate matters for the same reason the whole TUI is being thinned:
12
+ * a provider rule that lives inside a login prompt can only be tested by driving
13
+ * a terminal. Every function here is a plain Context query.
14
+ *
15
+ * @module @agi-fans/dsh-tui/commands/auth-providers
16
+ */
17
+ import { credentialKey, credentialKeyId, credentialKeyScope, isCredentialKeySegment, parseCredentialKey, } from '@deepseek-ai/dsh-credentials';
18
+ import { DEEPSEEK_API_KEY, DEEPSEEK_PROVIDER, FLOW_VALUE_PREFIX, PI_AI_RECORD_SCOPE, PI_AI_SETTINGS, } from "./auth-ids.js";
19
+ export function isDeepSeek(entry) {
20
+ return entry.provider === DEEPSEEK_PROVIDER;
21
+ }
22
+ export function isPiAiLoginable(entry) {
23
+ return entry.settingsNs === 'llm-pi-ai' && entry.provider !== 'deepseek';
24
+ }
25
+ export function providerListId(entry) {
26
+ return isDeepSeek(entry) ? 'DeepSeek' : entry.provider;
27
+ }
28
+ export function fallbackDeepSeekEntry() {
29
+ return {
30
+ provider: DEEPSEEK_PROVIDER,
31
+ displayName: 'DeepSeek',
32
+ settingsNs: 'llm-deepseek',
33
+ settingsPath: [],
34
+ };
35
+ }
36
+ export function loginableProviders(ctx) {
37
+ const listed = ctx.llm.listConfigurableProviders();
38
+ const loginable = listed.filter(entry => isDeepSeek(entry) || isPiAiLoginable(entry));
39
+ return loginable.length > 0 ? loginable : [fallbackDeepSeekEntry()];
40
+ }
41
+ export function authorizationFlows(ctx) {
42
+ return ctx.get('authorization')?.list() ?? [];
43
+ }
44
+ export function isPiAiDeepSeekFlow(flow) {
45
+ return credentialKeyScope(flow.key) === PI_AI_RECORD_SCOPE && credentialKeyId(flow.key) === 'deepseek';
46
+ }
47
+ export function isAccountFlow(flow) {
48
+ return credentialKeyScope(flow.key) === 'deepseek-account-platform';
49
+ }
50
+ export function loginAuthorizationFlows(ctx) {
51
+ return authorizationFlows(ctx).flatMap(flow => {
52
+ if (isAccountFlow(flow))
53
+ return [];
54
+ if (!isPiAiDeepSeekFlow(flow))
55
+ return [flow];
56
+ const profile = walkPath(sectionValue(ctx, PI_AI_SETTINGS), ['providers', 'deepseek']);
57
+ if (typeof profile !== 'object' || profile === null || Array.isArray(profile))
58
+ return [];
59
+ return [{ ...flow, label: 'DeepSeek (pi-ai compatibility)' }];
60
+ });
61
+ }
62
+ export function catalogAuthorizationFlow(ctx, provider) {
63
+ const authorization = ctx.get('authorization');
64
+ if (authorization === undefined || !isCredentialKeySegment(provider))
65
+ return undefined;
66
+ return authorization.describe(credentialKey(PI_AI_RECORD_SCOPE, provider));
67
+ }
68
+ export function catalogProvidersWithoutFlows(ctx) {
69
+ return loginableProviders(ctx).filter(entry => isDeepSeek(entry) || catalogAuthorizationFlow(ctx, entry.provider) === undefined);
70
+ }
71
+ export function flowChoiceValue(key) {
72
+ return FLOW_VALUE_PREFIX + key;
73
+ }
74
+ export function parseFlowChoice(raw) {
75
+ if (!raw.startsWith(FLOW_VALUE_PREFIX))
76
+ return undefined;
77
+ try {
78
+ return parseCredentialKey(raw.slice(FLOW_VALUE_PREFIX.length));
79
+ }
80
+ catch {
81
+ return undefined;
82
+ }
83
+ }
84
+ export function sectionValue(ctx, namespace) {
85
+ // A provider's configured fields are the live volatile config of its own
86
+ // profile entry, so the roster reads the same values a form would show.
87
+ return ctx.settings.describe().find(row => String(row.ns) === namespace)?.value;
88
+ }
89
+ export function walkPath(root, path) {
90
+ let cursor = root;
91
+ for (const key of path) {
92
+ if (typeof cursor !== 'object' || cursor === null || Array.isArray(cursor))
93
+ return undefined;
94
+ cursor = cursor[key];
95
+ }
96
+ return cursor;
97
+ }
98
+ export function profileApiKeyEnv(ctx, entry) {
99
+ const profile = walkPath(sectionValue(ctx, entry.settingsNs), entry.settingsPath);
100
+ if (isDeepSeek(entry)) {
101
+ if (typeof profile !== 'object' || profile === null || Array.isArray(profile))
102
+ return String(DEEPSEEK_API_KEY);
103
+ const apiKeyEnv = profile['apiKeyEnv'];
104
+ return typeof apiKeyEnv === 'string' && apiKeyEnv.trim() !== '' ? apiKeyEnv : String(DEEPSEEK_API_KEY);
105
+ }
106
+ if (typeof profile !== 'object' || profile === null || Array.isArray(profile))
107
+ return undefined;
108
+ const apiKeyEnv = profile['apiKeyEnv'];
109
+ return typeof apiKeyEnv === 'string' && apiKeyEnv.trim() !== '' ? apiKeyEnv : undefined;
110
+ }
111
+ export function hasStoredProfile(ctx, entry) {
112
+ if (isDeepSeek(entry))
113
+ return true;
114
+ const profile = walkPath(sectionValue(ctx, entry.settingsNs), entry.settingsPath);
115
+ return typeof profile === 'object' && profile !== null && !Array.isArray(profile);
116
+ }
117
+ export function logoutableProviders(ctx) {
118
+ return loginableProviders(ctx).filter(entry => isDeepSeek(entry) || hasStoredProfile(ctx, entry));
119
+ }
120
+ export function catalogForRecord(ctx, key) {
121
+ const id = credentialKeyId(key);
122
+ const scope = credentialKeyScope(key);
123
+ return loginableProviders(ctx).find(entry => entry.provider === id && entry.settingsNs === scope);
124
+ }
125
+ //# sourceMappingURL=auth-providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-providers.js","sourceRoot":"","sources":["../../src/commands/auth-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,eAAe,CAAA;AAEtB,MAAM,UAAU,UAAU,CAAC,KAA8B;IACvD,OAAO,KAAK,CAAC,QAAQ,KAAK,iBAAiB,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAA8B;IAC5D,OAAO,KAAK,CAAC,UAAU,KAAK,WAAW,IAAI,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAA;AAC1E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAA8B;IAC3D,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAA;AACxD,CAAC;AAED,MAAM,UAAU,qBAA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A;AACnG,CAAC"}
@@ -1,38 +1,32 @@
1
1
  /** Interactive credential commands backed by the Harness credential and settings seams. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
- import { type CredentialRef } from '@deepseek-ai/dsh-credentials';
3
+ import { type CredentialKey, type CredentialRef } from '@deepseek-ai/dsh-credentials';
4
4
  import type { LlmConfigurableProvider } from '@deepseek-ai/dsh-llm';
5
+ import { CUSTOM_PROTOCOLS, CUSTOM_PROVIDER_VALUE, DEEPSEEK_API_KEYS_URL, DEEPSEEK_MODELS_URL, managedProviderCredentialRef, normalizeApiKey, normalizeDeepSeekApiKey, parseBaseURL, parseModelIds, parseProviderId, validateDeepSeekApiKey } from './auth-input.ts';
6
+ export { CUSTOM_PROTOCOLS, CUSTOM_PROVIDER_VALUE, DEEPSEEK_API_KEYS_URL, DEEPSEEK_MODELS_URL, managedProviderCredentialRef, normalizeApiKey, normalizeDeepSeekApiKey, parseBaseURL, parseModelIds, parseProviderId, validateDeepSeekApiKey, };
5
7
  export declare const name = "omdsh-command-auth";
6
8
  export declare const inject: string[];
7
9
  export interface Config {
8
10
  /** Open the DeepSeek API-key dashboard when `/login` starts for DeepSeek. */
9
11
  openDashboard?: boolean;
12
+ /** Open the browser for a DeepSeek account sign-in. Defaults to true. */
13
+ openBrowser?: boolean;
10
14
  }
11
15
  export declare const DEEPSEEK_PROVIDER = "deepseek-official";
12
16
  export declare const DEEPSEEK_API_KEY: CredentialRef;
13
- export declare const OMDSH_DEEPSEEK_API_KEY: CredentialRef;
14
17
  export declare const DEEPSEEK_SETTINGS = "llm-deepseek";
15
18
  export declare const PI_AI_SETTINGS = "llm-pi-ai";
16
- export declare const DEEPSEEK_API_KEYS_URL = "https://platform.deepseek.com/api_keys";
17
- export declare const DEEPSEEK_MODELS_URL = "https://api.deepseek.com/v1/models";
18
- export declare const CUSTOM_PROVIDER_VALUE = "__omdsh_custom__";
19
+ /** Sentinel the provider picker returns for "sign in to the DeepSeek account". */
20
+ export declare const DEEPSEEK_ACCOUNT_CHOICE = "__omdsh_deepseek_account__";
21
+ /** Prefix a picker value carries when it names an authorization flow. */
19
22
  export declare const FLOW_VALUE_PREFIX = "__omdsh_flow__:";
20
- /** Match DeepSeek's own login normalization without accepting an empty Bearer value. */
21
- export declare function normalizeDeepSeekApiKey(raw: string): string;
22
- /** Trim a pasted key and reject an empty Bearer value. */
23
- export declare function normalizeApiKey(raw: string, providerLabel: string): string;
24
- /** omdsh-managed credential reference for one catalog provider route. */
25
- export declare function managedProviderCredentialRef(provider: string): CredentialRef;
26
- /** Lowercase kebab-case route id used as the permanent provider key. */
27
- export declare function parseProviderId(raw: string): string;
28
- /** Absolute http(s) prefix the adapter will call. */
29
- export declare function parseBaseURL(raw: string): string;
30
- /** One or more model ids from a comma- or whitespace-separated list. */
31
- export declare function parseModelIds(raw: string): string[];
32
- /** Validate a candidate without ever reading or returning a response body. */
33
- export declare function validateDeepSeekApiKey(apiKey: string, signal: AbortSignal, fetchImpl?: typeof fetch): Promise<void>;
34
- /** Picker labels are route ids; the official adapter keeps the DeepSeek product name. */
35
- export declare function providerListId(entry: LlmConfigurableProvider): string;
36
- /** Best-effort browser launch; the prompt always retains the full URL as a fallback. */
23
+ interface FlowRecordLogout {
24
+ key: CredentialKey;
25
+ label: string;
26
+ writable: boolean;
27
+ }
28
+ type LogoutChoice = LlmConfigurableProvider | FlowRecordLogout | typeof DEEPSEEK_ACCOUNT_CHOICE;
29
+ export declare function isFlowRecordLogout(choice: LogoutChoice): choice is FlowRecordLogout;
30
+ /** Best-effort browser launch for the DeepSeek key dashboard. */
37
31
  export declare function openDeepSeekDashboard(): void;
38
32
  export declare function apply(ctx: Context, config?: Config): void;