@agi-fans/dsh-tui 0.22.0 → 0.23.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 (279) hide show
  1. package/LICENSE +26 -0
  2. package/lib/CHANGELOG.md +199 -1
  3. package/lib/chrome/box.d.ts +1 -18
  4. package/lib/chrome/box.js +2 -45
  5. package/lib/chrome/box.js.map +1 -1
  6. package/lib/chrome/code-highlight.js +4 -4
  7. package/lib/chrome/code-highlight.js.map +1 -1
  8. package/lib/chrome/command-output.d.ts +0 -1
  9. package/lib/chrome/command-output.js +11 -5
  10. package/lib/chrome/command-output.js.map +1 -1
  11. package/lib/chrome/goal-bar.js +1 -1
  12. package/lib/chrome/goal-bar.js.map +1 -1
  13. package/lib/chrome/main-screen-renderer.js +4 -3
  14. package/lib/chrome/main-screen-renderer.js.map +1 -1
  15. package/lib/chrome/markdown.d.ts +3 -3
  16. package/lib/chrome/markdown.js +85 -36
  17. package/lib/chrome/markdown.js.map +1 -1
  18. package/lib/chrome/md-style.d.ts +5 -2
  19. package/lib/chrome/md-style.js +13 -4
  20. package/lib/chrome/md-style.js.map +1 -1
  21. package/lib/chrome/renderer.d.ts +37 -1
  22. package/lib/chrome/renderer.js.map +1 -1
  23. package/lib/chrome/status-line.d.ts +3 -3
  24. package/lib/chrome/status-line.js +5 -5
  25. package/lib/chrome/status-line.js.map +1 -1
  26. package/lib/chrome/theme.d.ts +8 -3
  27. package/lib/chrome/theme.js +51 -153
  28. package/lib/chrome/theme.js.map +1 -1
  29. package/lib/commands/auth-account.d.ts +9 -0
  30. package/lib/commands/auth-account.js +202 -0
  31. package/lib/commands/auth-account.js.map +1 -0
  32. package/lib/commands/auth.js +238 -414
  33. package/lib/commands/auth.js.map +1 -1
  34. package/lib/commands/diff.js +22 -16
  35. package/lib/commands/diff.js.map +1 -1
  36. package/lib/commands/export.d.ts +0 -1
  37. package/lib/commands/export.js +97 -32
  38. package/lib/commands/export.js.map +1 -1
  39. package/lib/commands/files.js +2 -8
  40. package/lib/commands/files.js.map +1 -1
  41. package/lib/commands/integrations.d.ts +12 -1
  42. package/lib/commands/integrations.js +120 -23
  43. package/lib/commands/integrations.js.map +1 -1
  44. package/lib/commands/jobs-browser.d.ts +3 -0
  45. package/lib/commands/jobs-browser.js +152 -0
  46. package/lib/commands/jobs-browser.js.map +1 -0
  47. package/lib/commands/jobs.d.ts +3 -14
  48. package/lib/commands/jobs.js +26 -18
  49. package/lib/commands/jobs.js.map +1 -1
  50. package/lib/commands/model.d.ts +3 -0
  51. package/lib/commands/model.js +197 -120
  52. package/lib/commands/model.js.map +1 -1
  53. package/lib/commands/open-external.d.ts +2 -0
  54. package/lib/commands/open-external.js +19 -0
  55. package/lib/commands/open-external.js.map +1 -0
  56. package/lib/commands/permission.js +65 -54
  57. package/lib/commands/permission.js.map +1 -1
  58. package/lib/commands/plugins.js +381 -139
  59. package/lib/commands/plugins.js.map +1 -1
  60. package/lib/commands/schedule-catalog.d.ts +12 -0
  61. package/lib/commands/schedule-catalog.js +41 -0
  62. package/lib/commands/schedule-catalog.js.map +1 -0
  63. package/lib/commands/schedule-history.d.ts +4 -0
  64. package/lib/commands/schedule-history.js +62 -0
  65. package/lib/commands/schedule-history.js.map +1 -0
  66. package/lib/commands/schedule.d.ts +12 -15
  67. package/lib/commands/schedule.js +220 -187
  68. package/lib/commands/schedule.js.map +1 -1
  69. package/lib/commands/session-configuration.d.ts +3 -0
  70. package/lib/commands/session-configuration.js +62 -28
  71. package/lib/commands/session-configuration.js.map +1 -1
  72. package/lib/commands/session.js +111 -66
  73. package/lib/commands/session.js.map +1 -1
  74. package/lib/commands/terminal.js +14 -8
  75. package/lib/commands/terminal.js.map +1 -1
  76. package/lib/definition.d.ts +112 -15
  77. package/lib/index.d.ts +1 -0
  78. package/lib/index.js +1 -0
  79. package/lib/index.js.map +1 -1
  80. package/lib/input/actions.d.ts +1 -1
  81. package/lib/input/actions.js +5 -2
  82. package/lib/input/actions.js.map +1 -1
  83. package/lib/input/composer-files.d.ts +2 -0
  84. package/lib/input/composer-files.js +13 -3
  85. package/lib/input/composer-files.js.map +1 -1
  86. package/lib/input/image-paste.d.ts +5 -12
  87. package/lib/input/image-paste.js +32 -28
  88. package/lib/input/image-paste.js.map +1 -1
  89. package/lib/input/key-test.d.ts +5 -0
  90. package/lib/input/key-test.js +19 -0
  91. package/lib/input/key-test.js.map +1 -0
  92. package/lib/input/keys.d.ts +2 -0
  93. package/lib/input/keys.js +4 -1
  94. package/lib/input/keys.js.map +1 -1
  95. package/lib/locale/index.d.ts +6 -0
  96. package/lib/locale/index.js +32 -0
  97. package/lib/locale/index.js.map +1 -0
  98. package/lib/locale/prompt.d.ts +4 -0
  99. package/lib/locale/prompt.js +24 -0
  100. package/lib/locale/prompt.js.map +1 -0
  101. package/lib/locale/zh.d.ts +1114 -0
  102. package/lib/locale/zh.js +1115 -0
  103. package/lib/locale/zh.js.map +1 -0
  104. package/lib/prompt-intents.d.ts +4 -0
  105. package/lib/prompt-intents.js +4 -0
  106. package/lib/prompt-intents.js.map +1 -1
  107. package/lib/runtime/account-settings.d.ts +18 -0
  108. package/lib/runtime/account-settings.js +241 -0
  109. package/lib/runtime/account-settings.js.map +1 -0
  110. package/lib/runtime/agent-profile.d.ts +3 -3
  111. package/lib/runtime/agent-profile.js +4 -4
  112. package/lib/runtime/agent-profile.js.map +1 -1
  113. package/lib/runtime/btw-policy.js +2 -1
  114. package/lib/runtime/btw-policy.js.map +1 -1
  115. package/lib/runtime/btw.js +1 -2
  116. package/lib/runtime/btw.js.map +1 -1
  117. package/lib/runtime/composer-images.d.ts +2 -2
  118. package/lib/runtime/composer-images.js +4 -4
  119. package/lib/runtime/composer-images.js.map +1 -1
  120. package/lib/runtime/composer-shell.js +27 -1
  121. package/lib/runtime/composer-shell.js.map +1 -1
  122. package/lib/runtime/file-browser.d.ts +19 -0
  123. package/lib/runtime/file-browser.js +291 -0
  124. package/lib/runtime/file-browser.js.map +1 -0
  125. package/lib/runtime/file-review.d.ts +6 -9
  126. package/lib/runtime/file-review.js +91 -7
  127. package/lib/runtime/file-review.js.map +1 -1
  128. package/lib/runtime/help-reader.d.ts +12 -0
  129. package/lib/runtime/help-reader.js +50 -0
  130. package/lib/runtime/help-reader.js.map +1 -0
  131. package/lib/runtime/human-interaction.js +1 -1
  132. package/lib/runtime/human-interaction.js.map +1 -1
  133. package/lib/runtime/model-catalog-editor.d.ts +12 -0
  134. package/lib/runtime/model-catalog-editor.js +215 -0
  135. package/lib/runtime/model-catalog-editor.js.map +1 -0
  136. package/lib/runtime/model-settings.d.ts +11 -0
  137. package/lib/runtime/model-settings.js +404 -0
  138. package/lib/runtime/model-settings.js.map +1 -0
  139. package/lib/runtime/plugin-settings.d.ts +4 -1
  140. package/lib/runtime/plugin-settings.js +164 -88
  141. package/lib/runtime/plugin-settings.js.map +1 -1
  142. package/lib/runtime/prompt-browser.d.ts +9 -0
  143. package/lib/runtime/prompt-browser.js +19 -0
  144. package/lib/runtime/prompt-browser.js.map +1 -0
  145. package/lib/runtime/provider-local.d.ts +27 -27
  146. package/lib/runtime/provider-local.js +1264 -308
  147. package/lib/runtime/provider-local.js.map +1 -1
  148. package/lib/runtime/reference-reader.d.ts +15 -0
  149. package/lib/runtime/reference-reader.js +78 -0
  150. package/lib/runtime/reference-reader.js.map +1 -0
  151. package/lib/runtime/runner.js +38 -29
  152. package/lib/runtime/runner.js.map +1 -1
  153. package/lib/runtime/session-runtime.js +1 -1
  154. package/lib/runtime/session-runtime.js.map +1 -1
  155. package/lib/runtime/settings-draft.d.ts +21 -0
  156. package/lib/runtime/settings-draft.js +166 -0
  157. package/lib/runtime/settings-draft.js.map +1 -0
  158. package/lib/runtime/settings-preferences.js +1 -1
  159. package/lib/runtime/settings-preferences.js.map +1 -1
  160. package/lib/runtime/startup-notices.d.ts +0 -1
  161. package/lib/runtime/startup-notices.js +35 -6
  162. package/lib/runtime/startup-notices.js.map +1 -1
  163. package/lib/runtime/subagent-model-selection.js +2 -1
  164. package/lib/runtime/subagent-model-selection.js.map +1 -1
  165. package/lib/runtime/subagent-settings.d.ts +14 -0
  166. package/lib/runtime/subagent-settings.js +288 -0
  167. package/lib/runtime/subagent-settings.js.map +1 -0
  168. package/lib/runtime/terminal-notifications.d.ts +3 -0
  169. package/lib/runtime/terminal-notifications.js +13 -8
  170. package/lib/runtime/terminal-notifications.js.map +1 -1
  171. package/lib/runtime/terminal-probe.d.ts +2 -0
  172. package/lib/runtime/terminal-probe.js +9 -0
  173. package/lib/runtime/terminal-probe.js.map +1 -1
  174. package/lib/runtime/tool-presentation.js.map +1 -1
  175. package/lib/runtime/tool-reader.d.ts +5 -0
  176. package/lib/runtime/tool-reader.js +27 -0
  177. package/lib/runtime/tool-reader.js.map +1 -0
  178. package/lib/runtime/web-settings.d.ts +14 -0
  179. package/lib/runtime/web-settings.js +339 -0
  180. package/lib/runtime/web-settings.js.map +1 -0
  181. package/lib/session/command-attachments.d.ts +17 -0
  182. package/lib/session/command-attachments.js +50 -0
  183. package/lib/session/command-attachments.js.map +1 -0
  184. package/lib/session/context-diagnostics.d.ts +16 -0
  185. package/lib/session/context-diagnostics.js +15 -0
  186. package/lib/session/context-diagnostics.js.map +1 -1
  187. package/lib/session/external-agents.d.ts +3 -1
  188. package/lib/session/external-agents.js +35 -10
  189. package/lib/session/external-agents.js.map +1 -1
  190. package/lib/session/generation-continuation.d.ts +11 -0
  191. package/lib/session/generation-continuation.js +34 -0
  192. package/lib/session/generation-continuation.js.map +1 -0
  193. package/lib/session/goal-controls.d.ts +5 -0
  194. package/lib/session/goal-controls.js +81 -0
  195. package/lib/session/goal-controls.js.map +1 -0
  196. package/lib/session/interaction-adapter.d.ts +7 -3
  197. package/lib/session/interaction-adapter.js +121 -49
  198. package/lib/session/interaction-adapter.js.map +1 -1
  199. package/lib/session/message-queue.d.ts +2 -0
  200. package/lib/session/message-queue.js +102 -17
  201. package/lib/session/message-queue.js.map +1 -1
  202. package/lib/session/pending-inputs.d.ts +30 -0
  203. package/lib/session/pending-inputs.js +183 -0
  204. package/lib/session/pending-inputs.js.map +1 -0
  205. package/lib/session/session-configuration.js +1 -1
  206. package/lib/session/session-configuration.js.map +1 -1
  207. package/lib/session/session-controller.d.ts +32 -13
  208. package/lib/session/session-controller.js +444 -98
  209. package/lib/session/session-controller.js.map +1 -1
  210. package/lib/session/subagent-roster.d.ts +1 -0
  211. package/lib/session/subagent-roster.js +16 -5
  212. package/lib/session/subagent-roster.js.map +1 -1
  213. package/lib/session/subagent-tracker.d.ts +2 -0
  214. package/lib/session/subagent-tracker.js +18 -0
  215. package/lib/session/subagent-tracker.js.map +1 -1
  216. package/lib/session/tui-settings.d.ts +9 -5
  217. package/lib/session/tui-settings.js +3 -1
  218. package/lib/session/tui-settings.js.map +1 -1
  219. package/lib/session/workflow-projection.d.ts +2 -1
  220. package/lib/session/workflow-projection.js +34 -4
  221. package/lib/session/workflow-projection.js.map +1 -1
  222. package/lib/views/autocomplete.d.ts +10 -7
  223. package/lib/views/autocomplete.js +44 -37
  224. package/lib/views/autocomplete.js.map +1 -1
  225. package/lib/views/context-overview.d.ts +4 -0
  226. package/lib/views/context-overview.js +43 -0
  227. package/lib/views/context-overview.js.map +1 -0
  228. package/lib/views/copy-targets.d.ts +6 -2
  229. package/lib/views/copy-targets.js +19 -14
  230. package/lib/views/copy-targets.js.map +1 -1
  231. package/lib/views/document-reader.d.ts +10 -1
  232. package/lib/views/document-reader.js +59 -5
  233. package/lib/views/document-reader.js.map +1 -1
  234. package/lib/views/event-views.js +29 -11
  235. package/lib/views/event-views.js.map +1 -1
  236. package/lib/views/file-actions.js +21 -0
  237. package/lib/views/file-actions.js.map +1 -1
  238. package/lib/views/file-browser.d.ts +98 -0
  239. package/lib/views/file-browser.js +120 -0
  240. package/lib/views/file-browser.js.map +1 -0
  241. package/lib/views/history-search.js +4 -4
  242. package/lib/views/history-search.js.map +1 -1
  243. package/lib/views/hotkey-format.d.ts +3 -2
  244. package/lib/views/hotkey-format.js +4 -3
  245. package/lib/views/hotkey-format.js.map +1 -1
  246. package/lib/views/hotkeys.js +10 -12
  247. package/lib/views/hotkeys.js.map +1 -1
  248. package/lib/views/list-view.js +16 -11
  249. package/lib/views/list-view.js.map +1 -1
  250. package/lib/views/prompt-selector.d.ts +23 -1
  251. package/lib/views/prompt-selector.js +123 -60
  252. package/lib/views/prompt-selector.js.map +1 -1
  253. package/lib/views/settings-list.d.ts +6 -1
  254. package/lib/views/settings-list.js +69 -46
  255. package/lib/views/settings-list.js.map +1 -1
  256. package/lib/views/tool-actions.d.ts +16 -0
  257. package/lib/views/tool-actions.js +29 -0
  258. package/lib/views/tool-actions.js.map +1 -0
  259. package/lib/views/trajectory-timeline.d.ts +5 -6
  260. package/lib/views/trajectory-timeline.js +25 -15
  261. package/lib/views/trajectory-timeline.js.map +1 -1
  262. package/lib/views/trajectory.d.ts +23 -2
  263. package/lib/views/trajectory.js +404 -186
  264. package/lib/views/trajectory.js.map +1 -1
  265. package/lib/views/transcript-render.d.ts +39 -15
  266. package/lib/views/transcript-render.js +406 -208
  267. package/lib/views/transcript-render.js.map +1 -1
  268. package/lib/views/transcript-types.d.ts +3 -2
  269. package/lib/views/transcript-types.js.map +1 -1
  270. package/lib/views/workflow.d.ts +16 -0
  271. package/lib/views/workflow.js +42 -0
  272. package/lib/views/workflow.js.map +1 -0
  273. package/package.json +61 -58
  274. package/lib/chrome/welcome-tips.d.ts +0 -23
  275. package/lib/chrome/welcome-tips.js +0 -24
  276. package/lib/chrome/welcome-tips.js.map +0 -1
  277. package/lib/session/steering.d.ts +0 -3
  278. package/lib/session/steering.js +0 -9
  279. package/lib/session/steering.js.map +0 -1
@@ -0,0 +1,202 @@
1
+ import { resolveUiLanguage, uiText } from "../locale/index.js";
2
+ import { APP_VERSION } from "../session/package-metadata.js";
3
+ import { openExternal } from "./open-external.js";
4
+ export function accountClientMetadata(ctx) {
5
+ return {
6
+ version: APP_VERSION,
7
+ locale: resolveUiLanguage(ctx.tui.prefs().uiLanguage),
8
+ timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60,
9
+ };
10
+ }
11
+ function accountCallbackOrigin(ctx) {
12
+ const server = ctx.get('webServer');
13
+ if (server === undefined || typeof server.port !== 'number' || server.port === 0)
14
+ return undefined;
15
+ return `${server.protocol}//${server.host}:${server.port}`;
16
+ }
17
+ function accountFailure(attempt) {
18
+ if (attempt?.phase === 'expired')
19
+ return 'The DeepSeek sign-in expired. Run /login to try again.';
20
+ if (attempt?.phase === 'failed')
21
+ return `DeepSeek sign-in failed${attempt.errorCode === undefined ? '' : ` (${attempt.errorCode})`}. Run /login to try again.`;
22
+ if (attempt?.phase === 'cancelled')
23
+ return 'DeepSeek sign-in was cancelled.';
24
+ return undefined;
25
+ }
26
+ async function waitForAccount(invocation, account, id, timeoutMs) {
27
+ const deadline = Date.now() + timeoutMs;
28
+ while (Date.now() < deadline) {
29
+ if (invocation.signal.aborted) {
30
+ await account.cancelSignIn(id).catch(() => undefined);
31
+ return { kind: 'success' };
32
+ }
33
+ const state = await account.getState().catch(() => undefined);
34
+ if (state === undefined) {
35
+ await new Promise(resolve => setTimeout(resolve, 400));
36
+ continue;
37
+ }
38
+ if (state.attempt?.id !== id)
39
+ return { kind: 'success' };
40
+ if (state.status === 'credential-stored' && state.attempt.phase === 'succeeded') {
41
+ return { kind: 'success', text: 'Signed in to the DeepSeek account.' };
42
+ }
43
+ const failure = accountFailure(state?.attempt);
44
+ if (failure !== undefined)
45
+ return { kind: 'error', text: failure };
46
+ await new Promise(resolve => setTimeout(resolve, 400));
47
+ }
48
+ await account.cancelSignIn(id).catch(() => undefined);
49
+ return { kind: 'error', text: 'DeepSeek sign-in timed out before the browser completed. Run /login to try again.' };
50
+ }
51
+ export async function loginDeepSeekAccount(ctx, invocation, config = {}) {
52
+ const account = ctx.get('deepseekAccount');
53
+ if (account === undefined)
54
+ return { kind: 'error', text: 'DeepSeek account integration is not mounted in this build.' };
55
+ let state;
56
+ try {
57
+ state = await account.getState();
58
+ }
59
+ catch {
60
+ return { kind: 'error', text: 'Could not read the shared DeepSeek account state.' };
61
+ }
62
+ if (invocation.signal.aborted || state.status === 'credential-stored')
63
+ return { kind: 'success' };
64
+ const server = ctx.get('webServer');
65
+ if (server === undefined || ctx.tui.interactive === false) {
66
+ return {
67
+ kind: 'error',
68
+ text: 'The loopback sign-in host is unavailable. Start omdsh with its normal terminal host, or sign in through DSH Web/Desktop and rerun /login.',
69
+ };
70
+ }
71
+ const origin = accountCallbackOrigin(ctx);
72
+ if (origin === undefined)
73
+ return { kind: 'error', text: 'The loopback sign-in host did not expose a port.' };
74
+ let initial;
75
+ try {
76
+ initial = await account.startSignIn(accountClientMetadata(ctx), origin, 'web');
77
+ }
78
+ catch {
79
+ return { kind: 'error', text: 'Could not start DeepSeek sign-in.' };
80
+ }
81
+ const attempt = initial.attempt;
82
+ if (invocation.signal.aborted) {
83
+ if (attempt)
84
+ await account.cancelSignIn(attempt.id).catch(() => undefined);
85
+ return { kind: 'success' };
86
+ }
87
+ if (initial.status === 'credential-stored')
88
+ return { kind: 'success', text: 'Signed in to the DeepSeek account.' };
89
+ if (attempt === null)
90
+ return { kind: 'error', text: 'Could not start DeepSeek sign-in.' };
91
+ const failure = accountFailure(attempt);
92
+ if (failure !== undefined)
93
+ return { kind: 'error', text: failure };
94
+ let url = attempt?.authorizeUrl;
95
+ for (let i = 0; i < 40 && url === undefined; i += 1) {
96
+ if (invocation.signal.aborted)
97
+ break;
98
+ await new Promise(resolve => setTimeout(resolve, 100));
99
+ const next = await account.getState().catch(() => undefined);
100
+ if (next !== undefined && next.attempt?.id !== attempt.id)
101
+ return { kind: 'success' };
102
+ if (next?.status === 'credential-stored')
103
+ return { kind: 'success', text: 'Signed in to the DeepSeek account.' };
104
+ const nextFailure = accountFailure(next?.attempt);
105
+ if (nextFailure !== undefined)
106
+ return { kind: 'error', text: nextFailure };
107
+ url = next?.attempt?.authorizeUrl;
108
+ }
109
+ if (url === undefined || invocation.signal.aborted) {
110
+ await account.cancelSignIn(attempt.id).catch(() => undefined);
111
+ if (invocation.signal.aborted)
112
+ return { kind: 'success' };
113
+ return { kind: 'error', text: 'DeepSeek did not return a browser URL for this sign-in attempt.' };
114
+ }
115
+ if (config.openBrowser !== false)
116
+ openExternal(url);
117
+ const browser = new AbortController();
118
+ const browserSignal = AbortSignal.any([invocation.signal, browser.signal]);
119
+ let completed;
120
+ void (async () => {
121
+ try {
122
+ for await (const next of account.watch(browserSignal)) {
123
+ if (browserSignal.aborted)
124
+ break;
125
+ if (next.attempt?.id !== attempt.id || next.status === 'credential-stored' || accountFailure(next.attempt)) {
126
+ completed = next;
127
+ browser.abort();
128
+ break;
129
+ }
130
+ }
131
+ }
132
+ catch { /* Manual confirmation still works if the subscription fails. */ }
133
+ })();
134
+ let answer;
135
+ try {
136
+ answer = await ctx.tui.prompt({ localize: true,
137
+ title: 'DeepSeek account',
138
+ question: 'Complete sign-in in your browser, then return here.',
139
+ detail: `${url}\n\n${uiText(resolveUiLanguage(ctx.tui.prefs().uiLanguage), 'This terminal is listening on {origin}/oauth/callback until the attempt ends.', { origin })}`,
140
+ options: [
141
+ { label: 'I completed sign-in', value: 'done' },
142
+ { label: 'Cancel', value: 'cancel', description: 'Withdraw this sign-in attempt.' },
143
+ ],
144
+ initialValue: 'done',
145
+ allowCustom: false,
146
+ notify: false,
147
+ signal: browserSignal,
148
+ });
149
+ }
150
+ finally {
151
+ browser.abort();
152
+ }
153
+ if (completed && !invocation.signal.aborted) {
154
+ if (completed.status === 'credential-stored')
155
+ return { kind: 'success', text: 'Signed in to the DeepSeek account.' };
156
+ const failure = accountFailure(completed.attempt);
157
+ return failure === undefined ? { kind: 'success' } : { kind: 'error', text: failure };
158
+ }
159
+ if (answer !== 'done' || invocation.signal.aborted) {
160
+ await account.cancelSignIn(attempt.id).catch(() => undefined);
161
+ return { kind: 'success', text: 'DeepSeek sign-in cancelled.' };
162
+ }
163
+ return waitForAccount(invocation, account, attempt.id, 120_000);
164
+ }
165
+ export async function logoutDeepSeekAccount(ctx, invocation) {
166
+ const account = ctx.get('deepseekAccount');
167
+ if (account === undefined)
168
+ return { kind: 'error', text: 'DeepSeek account integration is not mounted in this build.' };
169
+ let state;
170
+ try {
171
+ state = await account.getState();
172
+ }
173
+ catch {
174
+ return { kind: 'error', text: 'Could not read the shared DeepSeek account state.' };
175
+ }
176
+ if (state.status !== 'credential-stored') {
177
+ return { kind: 'success', text: 'No DeepSeek account grant is stored.' };
178
+ }
179
+ const answer = await ctx.tui.prompt({ localize: true,
180
+ title: 'Logout from DeepSeek account',
181
+ question: 'Sign out of the shared DeepSeek account?',
182
+ detail: 'Removes the local grant and revokes it in the background. The browser session is not signed out.',
183
+ options: [
184
+ { label: 'Cancel', value: 'cancel', description: 'Keep the account grant.' },
185
+ { label: 'Sign out', value: 'logout', description: 'Remove the local grant and revoke it in the background.' },
186
+ ],
187
+ initialValue: 'cancel',
188
+ allowCustom: false,
189
+ notify: false,
190
+ signal: invocation.signal,
191
+ });
192
+ if (answer !== 'logout' || invocation.signal.aborted)
193
+ return { kind: 'success' };
194
+ try {
195
+ await account.signOut(accountClientMetadata(ctx));
196
+ }
197
+ catch {
198
+ return { kind: 'error', text: 'Could not sign out of the DeepSeek account. Try again from DSH Web/Desktop.' };
199
+ }
200
+ return { kind: 'success', text: 'Signed out of the DeepSeek account. The local grant was removed; remote revocation continues in the background.' };
201
+ }
202
+ //# sourceMappingURL=auth-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-account.js","sourceRoot":"","sources":["../../src/commands/auth-account.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQjD,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,iBAAiB,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