@deepseek-harness-tui/dsh-tui 0.19.0 → 0.20.1

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 (224) hide show
  1. package/README.md +67 -57
  2. package/bin/dsh-tui.js +26 -8
  3. package/cordis.patch.yml +5 -3
  4. package/cordis.yml +3 -2
  5. package/guide/dsh-tui-guide/claude-backend.en.md +6 -5
  6. package/guide/dsh-tui-guide/claude-backend.md +5 -5
  7. package/guide/dsh-tui-guide/configuration.en.md +1 -1
  8. package/guide/dsh-tui-guide/configuration.md +1 -1
  9. package/guide/dsh-tui-guide/getting-started.en.md +2 -2
  10. package/guide/dsh-tui-guide/getting-started.md +2 -2
  11. package/guide/dsh-tui-guide/migrate.en.md +5 -0
  12. package/guide/dsh-tui-guide/migrate.md +4 -0
  13. package/guide/dsh-tui-guide/plugins.en.md +17 -1
  14. package/guide/dsh-tui-guide/plugins.md +12 -1
  15. package/guide/dsh-tui-guide/user-guide.en.md +7 -2
  16. package/guide/dsh-tui-guide/user-guide.md +7 -2
  17. package/lib/settings.json +24 -8
  18. package/lib/types/adapter/kernel/host-facade.d.ts +3 -1
  19. package/lib/types/adapter/kernel/host-facade.d.ts.map +1 -1
  20. package/lib/types/adapter/kernel/host-facade.js +6 -0
  21. package/lib/types/adapter/kernel/runtime.d.ts.map +1 -1
  22. package/lib/types/adapter/kernel/runtime.js +5 -0
  23. package/lib/types/adapter/kernel/slices/extensions.d.ts +1 -0
  24. package/lib/types/adapter/kernel/slices/extensions.d.ts.map +1 -1
  25. package/lib/types/adapter/kernel/slices/extensions.js +6 -1
  26. package/lib/types/adapter/kernel/slices/index.d.ts +1 -1
  27. package/lib/types/adapter/kernel/slices/index.d.ts.map +1 -1
  28. package/lib/types/adapter/kernel/slices/index.js +3 -2
  29. package/lib/types/adapter/ports/channel-catalog.d.ts +19 -0
  30. package/lib/types/adapter/ports/channel-catalog.d.ts.map +1 -1
  31. package/lib/types/adapter/ports/channel-view.d.ts +39 -3
  32. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  33. package/lib/types/adapter/ports/extensions.d.ts +9 -0
  34. package/lib/types/adapter/ports/extensions.d.ts.map +1 -1
  35. package/lib/types/adapter/ports/index.d.ts +1 -1
  36. package/lib/types/adapter/ports/index.d.ts.map +1 -1
  37. package/lib/types/adapter/upstream/extensions-driver.d.ts +4 -1
  38. package/lib/types/adapter/upstream/extensions-driver.d.ts.map +1 -1
  39. package/lib/types/adapter/upstream/extensions-driver.js +111 -1
  40. package/lib/types/adapter/upstream/index.d.ts +1 -1
  41. package/lib/types/adapter/upstream/index.d.ts.map +1 -1
  42. package/lib/types/adapter/upstream/index.js +1 -1
  43. package/lib/types/agent/events.d.ts +3 -1
  44. package/lib/types/agent/events.d.ts.map +1 -1
  45. package/lib/types/api.d.ts +1 -1
  46. package/lib/types/api.d.ts.map +1 -1
  47. package/lib/types/backends/claude/backend.d.ts.map +1 -1
  48. package/lib/types/backends/claude/backend.js +7 -2
  49. package/lib/types/backends/claude/tools.d.ts.map +1 -1
  50. package/lib/types/backends/claude/tools.js +8 -3
  51. package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
  52. package/lib/types/backends/codex/translate/presentation.js +5 -2
  53. package/lib/types/channel/interaction.d.ts.map +1 -1
  54. package/lib/types/channel/interaction.js +1 -0
  55. package/lib/types/channel/permissions.d.ts +15 -0
  56. package/lib/types/channel/permissions.d.ts.map +1 -1
  57. package/lib/types/channel/permissions.js +28 -0
  58. package/lib/types/channel/projection.d.ts.map +1 -1
  59. package/lib/types/channel/projection.js +11 -1
  60. package/lib/types/channel/questions.d.ts +26 -0
  61. package/lib/types/channel/questions.d.ts.map +1 -1
  62. package/lib/types/channel/questions.js +43 -0
  63. package/lib/types/commands.js +1 -1
  64. package/lib/types/components/FileSuggestions.d.ts +2 -2
  65. package/lib/types/components/FileSuggestions.d.ts.map +1 -1
  66. package/lib/types/components/FileSuggestions.js +25 -5
  67. package/lib/types/components/MessageList.d.ts.map +1 -1
  68. package/lib/types/components/MessageList.js +3 -3
  69. package/lib/types/components/PromptInput.d.ts +7 -1
  70. package/lib/types/components/PromptInput.d.ts.map +1 -1
  71. package/lib/types/components/PromptInput.js +81 -23
  72. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  73. package/lib/types/components/SplitDiffView.js +3 -2
  74. package/lib/types/components/StarPrompt.d.ts +5 -3
  75. package/lib/types/components/StarPrompt.d.ts.map +1 -1
  76. package/lib/types/components/StarPrompt.js +56 -6
  77. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  78. package/lib/types/components/SubagentCard.js +1 -1
  79. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  80. package/lib/types/components/SubagentDashboard.js +3 -2
  81. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  82. package/lib/types/components/SubagentDetailScene.js +1 -1
  83. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  84. package/lib/types/components/messages/AssistantToolUseMessage.js +121 -23
  85. package/lib/types/components/teamRoster.d.ts +6 -3
  86. package/lib/types/components/teamRoster.d.ts.map +1 -1
  87. package/lib/types/dsh-adapter/approvals.d.ts +19 -0
  88. package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
  89. package/lib/types/dsh-adapter/approvals.js +17 -1
  90. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  91. package/lib/types/dsh-adapter/backend/translate.js +15 -3
  92. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  93. package/lib/types/dsh-adapter/channel/extensions.js +7 -4
  94. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  95. package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
  96. package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
  97. package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
  98. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  99. package/lib/types/dsh-adapter/channel/settings-host.js +179 -33
  100. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
  101. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  102. package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
  103. package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
  104. package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
  105. package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
  106. package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
  107. package/lib/types/dsh-adapter/childStderr.d.ts +1 -1
  108. package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
  109. package/lib/types/dsh-adapter/childStderr.js +5 -0
  110. package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
  111. package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
  112. package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
  113. package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
  114. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  115. package/lib/types/dsh-adapter/compat/messages.js +2 -2
  116. package/lib/types/dsh-adapter/contract.d.ts +12 -5
  117. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/contract.js +15 -4
  119. package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
  120. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
  122. package/lib/types/dsh-adapter/extensions.d.ts +3 -2
  123. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/extensions.js +5 -2
  125. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  126. package/lib/types/dsh-adapter/host-contract.js +2 -2
  127. package/lib/types/dsh-adapter/host-dsh.d.ts +6 -0
  128. package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
  129. package/lib/types/dsh-adapter/host-dsh.js +29 -0
  130. package/lib/types/dsh-adapter/index.d.ts +9 -1
  131. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/index.js +5 -0
  133. package/lib/types/dsh-adapter/mention-providers.d.ts +91 -0
  134. package/lib/types/dsh-adapter/mention-providers.d.ts.map +1 -0
  135. package/lib/types/dsh-adapter/mention-providers.js +214 -0
  136. package/lib/types/dsh-adapter/migrate/entry.d.ts +2 -0
  137. package/lib/types/dsh-adapter/migrate/entry.d.ts.map +1 -0
  138. package/lib/types/dsh-adapter/migrate/entry.js +46 -0
  139. package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
  140. package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
  141. package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
  142. package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
  143. package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
  144. package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
  145. package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
  146. package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
  147. package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
  148. package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
  149. package/lib/types/dsh-adapter/oauth/index.js +44 -0
  150. package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/oauth/service.js +5 -6
  152. package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
  153. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/plugin-manage.js +3 -2
  155. package/lib/types/dsh-adapter/plugin.d.ts +237 -6
  156. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/plugin.js +611 -23
  158. package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
  159. package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
  160. package/lib/types/dsh-adapter/session-projection-store.js +30 -23
  161. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/sessionTree.js +4 -1
  163. package/lib/types/dsh-adapter/subagents.d.ts +1 -0
  164. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  165. package/lib/types/dsh-adapter/subagents.js +10 -2
  166. package/lib/types/dsh-adapter/team-mode.d.ts +29 -17
  167. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  168. package/lib/types/dsh-adapter/team-mode.js +138 -17
  169. package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
  170. package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
  171. package/lib/types/dsh-adapter/team-roster.js +206 -39
  172. package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
  173. package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
  174. package/lib/types/dsh-adapter/team-tools.js +81 -26
  175. package/lib/types/extensions.d.ts +2 -0
  176. package/lib/types/extensions.d.ts.map +1 -1
  177. package/lib/types/extensions.js +4 -1
  178. package/lib/types/i18n.d.ts +71 -11
  179. package/lib/types/i18n.d.ts.map +1 -1
  180. package/lib/types/i18n.js +32 -9
  181. package/lib/types/ink/dom.d.ts.map +1 -1
  182. package/lib/types/ink/dom.js +13 -3
  183. package/lib/types/ink/flush-tick.d.ts +6 -0
  184. package/lib/types/ink/flush-tick.d.ts.map +1 -1
  185. package/lib/types/ink/flush-tick.js +31 -0
  186. package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
  187. package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
  188. package/lib/types/ink/hooks/use-terminal-title.js +23 -3
  189. package/lib/types/ink/ink.js +2 -2
  190. package/lib/types/ink/jumpback-state.d.ts +33 -0
  191. package/lib/types/ink/jumpback-state.d.ts.map +1 -0
  192. package/lib/types/ink/jumpback-state.js +51 -0
  193. package/lib/types/ink/jumpback.d.ts +78 -0
  194. package/lib/types/ink/jumpback.d.ts.map +1 -0
  195. package/lib/types/ink/jumpback.js +515 -0
  196. package/lib/types/ink/log-update.js +37 -14
  197. package/lib/types/ink/notify-helper/activate.cs +836 -0
  198. package/lib/types/ink/notify-helper/compile.d.ts +30 -0
  199. package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
  200. package/lib/types/ink/notify-helper/compile.js +235 -0
  201. package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
  202. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
  203. package/lib/types/ink/terminal-notification-windows.js +14 -21
  204. package/lib/types/ink/terminal-notification.d.ts +31 -2
  205. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  206. package/lib/types/ink/terminal-notification.js +51 -0
  207. package/lib/types/ink/terminal.d.ts +2 -1
  208. package/lib/types/ink/terminal.d.ts.map +1 -1
  209. package/lib/types/ink/terminal.js +9 -4
  210. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  211. package/lib/types/screens/AgentTranscriptScene.js +1 -1
  212. package/lib/types/screens/Chat.d.ts +8 -4
  213. package/lib/types/screens/Chat.d.ts.map +1 -1
  214. package/lib/types/screens/Chat.js +40 -11
  215. package/lib/types/settings/definitions.d.ts +12 -0
  216. package/lib/types/settings/definitions.d.ts.map +1 -1
  217. package/lib/types/settings/definitions.js +15 -7
  218. package/lib/types/utils/fileSuggestions.d.ts +14 -3
  219. package/lib/types/utils/fileSuggestions.d.ts.map +1 -1
  220. package/lib/types/utils/fileSuggestions.js +33 -0
  221. package/package.json +117 -112
  222. package/presets/liangshen/agent.cordis.yml +4 -0
  223. package/tui-profile/feed/README.md +1 -1
  224. package/tui-profile/feed/first-party.json +1 -1
@@ -0,0 +1,250 @@
1
+ import { deepSeekClientMetadata } from './deepseek.js';
2
+ export function accountNotificationsOf(account) {
3
+ const value = account;
4
+ return typeof value?.getNotifications === 'function'
5
+ && typeof value.getNotificationContent === 'function'
6
+ && typeof value.reportNotificationEvent === 'function' ? value : undefined;
7
+ }
8
+ const expired = (notice) => notice.displayUntil !== null
9
+ && Date.parse(notice.displayUntil) <= Date.now();
10
+ // Preserve the existing coupon presentation only for explicit complete data.
11
+ // These optional business fields are not inferred from localized server copy.
12
+ function couponFields(data) {
13
+ if (data === null || typeof data !== 'object' || Array.isArray(data))
14
+ return {};
15
+ const value = data;
16
+ const expiresAt = value.expiresAt ?? value.expires_at;
17
+ return value.campaign === 'dsh_login_bonus' && typeof value.amount === 'string'
18
+ && (value.currency === 'CNY' || value.currency === 'USD') && typeof expiresAt === 'string'
19
+ && (Number.isNaN(Date.parse(expiresAt)) || Date.parse(expiresAt) > Date.now())
20
+ ? { amount: value.amount, currency: value.currency, expiresAt } : {};
21
+ }
22
+ const noticeOf = (content) => ({
23
+ kind: 'account-notification', orderId: content.id, title: content.title,
24
+ body: content.body, displayUntil: content.displayUntil, actions: content.actions,
25
+ ...couponFields(content.data),
26
+ });
27
+ /** Account-owned cards: reads never acknowledge; only the presented card reports display. */
28
+ export class AccountNotificationStore {
29
+ changed;
30
+ diagnose;
31
+ account;
32
+ generation = 0;
33
+ pollEpoch = 0;
34
+ localeGeneration = 0;
35
+ timer;
36
+ expiryTimer;
37
+ intervalMs = 600_000;
38
+ cards = [];
39
+ displayed = new Set();
40
+ pendingDismissals = new Map();
41
+ localeRefresh;
42
+ constructor(changed, diagnose = () => { }) {
43
+ this.changed = changed;
44
+ this.diagnose = diagnose;
45
+ }
46
+ getSnapshot() { return this.cards[0] ?? null; }
47
+ begin(account) {
48
+ if (this.account === account)
49
+ return;
50
+ this.clear();
51
+ this.account = account;
52
+ void this.poll(this.generation);
53
+ }
54
+ /** Explicit refresh uses the same generation fence and server-paced poll. */
55
+ async refresh(account) {
56
+ if (this.account !== account) {
57
+ this.clear();
58
+ this.account = account;
59
+ }
60
+ else {
61
+ this.generation++;
62
+ if (this.timer !== undefined)
63
+ clearTimeout(this.timer);
64
+ this.timer = undefined;
65
+ }
66
+ await this.poll(this.generation);
67
+ }
68
+ clear() {
69
+ this.generation++;
70
+ this.localeGeneration++;
71
+ if (this.timer !== undefined)
72
+ clearTimeout(this.timer);
73
+ if (this.expiryTimer !== undefined)
74
+ clearTimeout(this.expiryTimer);
75
+ this.timer = undefined;
76
+ this.expiryTimer = undefined;
77
+ this.account = undefined;
78
+ this.intervalMs = 600_000;
79
+ this.displayed.clear();
80
+ this.pendingDismissals.clear();
81
+ this.localeRefresh = undefined;
82
+ this.publish([]);
83
+ }
84
+ /** A language change refreshes content without consuming it or changing card order. */
85
+ localeChanged() {
86
+ // An explicit language change always fetches again: a rapid second switch
87
+ // must not reuse copy fetched for the previous language.
88
+ return this.startLocaleRefresh();
89
+ }
90
+ /** A poll finished with copy from before a language change: reuse an
91
+ * in-flight refresh instead of invalidating its successful request. */
92
+ staleLocaleRefresh() {
93
+ return this.localeRefresh ?? this.startLocaleRefresh();
94
+ }
95
+ startLocaleRefresh() {
96
+ const run = this.refreshLocale();
97
+ this.localeRefresh = run;
98
+ const settle = () => { if (this.localeRefresh === run)
99
+ this.localeRefresh = undefined; };
100
+ void run.then(settle, settle);
101
+ return run;
102
+ }
103
+ async refreshLocale() {
104
+ const account = this.account;
105
+ if (account === undefined)
106
+ return;
107
+ const generation = this.generation;
108
+ const localeGeneration = ++this.localeGeneration;
109
+ const updates = await Promise.allSettled(this.cards.map(card => account.getNotificationContent(card.orderId, deepSeekClientMetadata())));
110
+ if (generation !== this.generation || localeGeneration !== this.localeGeneration)
111
+ return;
112
+ if (updates.some(update => update.status === 'rejected'))
113
+ this.diagnose('content');
114
+ const byId = new Map(updates.flatMap(update => update.status === 'fulfilled' && update.value !== null
115
+ ? [[update.value.id, noticeOf(update.value)]] : []));
116
+ this.publish(this.cards.map(card => {
117
+ const content = byId.get(card.orderId);
118
+ // Like the public controller, content refresh changes localized copy
119
+ // only. The list owns deadlines and optional business metadata.
120
+ return content === undefined ? card : { ...card, title: content.title, body: content.body, actions: content.actions };
121
+ }).filter(card => !expired(card)));
122
+ }
123
+ shown(id) {
124
+ this.dropExpired();
125
+ if (this.cards[0]?.orderId !== id || this.displayed.has(id))
126
+ return;
127
+ this.displayed.add(id);
128
+ void this.report(id, 'displayed');
129
+ }
130
+ dismiss(id) {
131
+ this.dropExpired();
132
+ if (this.cards[0]?.orderId !== id)
133
+ return;
134
+ // A poll issued before this dismissal must not publish its stale reply:
135
+ // the closed card would reappear and report `displayed` again. Expiry and
136
+ // account cleanup fence polls through `generation`; a dismissal keeps the
137
+ // same account lifetime, so it needs its own fence.
138
+ this.pollEpoch++;
139
+ // Until the server processes the dismissal it may keep offering the id;
140
+ // suppress that id so a fast poll cannot reopen the closed card. Fence
141
+ // cleanup to this report: an older report that finishes after a newer
142
+ // dismissal of the same id must not clear the newer fence.
143
+ const token = Symbol(id);
144
+ this.pendingDismissals.set(id, token);
145
+ void this.report(id, 'dismissed').finally(() => {
146
+ if (this.pendingDismissals.get(id) === token)
147
+ this.pendingDismissals.delete(id);
148
+ });
149
+ this.publish(this.cards.slice(1));
150
+ }
151
+ report(id, event) {
152
+ // Server acceptance controls consumption; a failed report never fabricates success.
153
+ return this.account?.reportNotificationEvent(id, event, deepSeekClientMetadata())
154
+ .catch(() => { this.diagnose('report'); return false; }) ?? Promise.resolve(false);
155
+ }
156
+ dropExpired() { this.publish(this.cards.filter(card => !expired(card))); }
157
+ publish(cards) {
158
+ // Preserve React external-store snapshot identity for unchanged server copies.
159
+ const previous = new Map(this.cards.map(card => [card.orderId, card]));
160
+ cards = cards.map(card => {
161
+ const old = previous.get(card.orderId);
162
+ return old !== undefined && JSON.stringify(old) === JSON.stringify(card) ? old : card;
163
+ });
164
+ if (cards.length === this.cards.length && cards.every((card, index) => card === this.cards[index]))
165
+ return;
166
+ const ids = new Set(cards.map(card => card.orderId));
167
+ for (const id of this.displayed)
168
+ if (!ids.has(id))
169
+ this.displayed.delete(id);
170
+ this.cards = cards;
171
+ this.scheduleExpiry();
172
+ this.changed();
173
+ }
174
+ scheduleExpiry() {
175
+ if (this.expiryTimer !== undefined)
176
+ clearTimeout(this.expiryTimer);
177
+ this.expiryTimer = undefined;
178
+ const deadlines = this.cards.flatMap(card => {
179
+ const at = card.displayUntil === null ? NaN : Date.parse(card.displayUntil);
180
+ return Number.isFinite(at) ? [at] : [];
181
+ });
182
+ if (deadlines.length > 0) {
183
+ this.expiryTimer = setTimeout(() => {
184
+ this.expiryTimer = undefined;
185
+ this.dropExpired();
186
+ // A capped timer can wake before the deadline while polling is pending.
187
+ this.scheduleExpiry();
188
+ }, Math.min(2_147_483_647, Math.max(1, Math.min(...deadlines) - Date.now())));
189
+ this.expiryTimer.unref?.();
190
+ }
191
+ }
192
+ async poll(generation) {
193
+ const account = this.account;
194
+ if (account === undefined || generation !== this.generation)
195
+ return;
196
+ const localeGeneration = this.localeGeneration;
197
+ const epoch = this.pollEpoch;
198
+ try {
199
+ const batch = await account.getNotifications(deepSeekClientMetadata());
200
+ if (generation !== this.generation)
201
+ return;
202
+ if (batch !== null) {
203
+ // The server owns the cadence even when a dismissal retires the card
204
+ // content below; honour a changed interval before the epoch gate.
205
+ const requestedDelay = batch.nextPollAfterSeconds * 1000;
206
+ if (Number.isFinite(requestedDelay) && requestedDelay > 0)
207
+ this.intervalMs = Math.min(requestedDelay, 2_147_483_647);
208
+ // A dismissal during the read retires this reply; keep polling on the
209
+ // server-provided interval instead of resurrecting the closed card.
210
+ if (epoch === this.pollEpoch) {
211
+ const current = new Map(this.cards.map(card => [card.orderId, card]));
212
+ const offered = batch.notifications.map(content => {
213
+ const card = noticeOf(content);
214
+ const translated = current.get(card.orderId);
215
+ // An in-flight poll carries its original locale. Keep newer copy even
216
+ // if the follow-up content refresh fails; server expiry remains current.
217
+ return localeGeneration !== this.localeGeneration && translated !== undefined
218
+ ? { ...card, title: translated.title, body: translated.body, actions: translated.actions }
219
+ : card;
220
+ }).filter(card => !this.pendingDismissals.has(card.orderId));
221
+ const candidates = offered.filter(card => !expired(card));
222
+ const foreground = this.cards[0];
223
+ // The backend may consume on displayed. Keep the already-presented card
224
+ // until explicit dismissal or expiry, not until the next polling reply.
225
+ // A same-ID response can explicitly shorten its deadline. Only an
226
+ // omitted card keeps its old metadata; an expired offer must retire it.
227
+ const refreshed = foreground === undefined ? undefined
228
+ : offered.find(card => card.orderId === foreground.orderId) ?? foreground;
229
+ const retained = refreshed !== undefined && this.displayed.has(refreshed.orderId) && !expired(refreshed)
230
+ ? refreshed : undefined;
231
+ this.publish(retained === undefined ? candidates : [retained, ...candidates.filter(card => card.orderId !== retained.orderId)]);
232
+ // Never make the next poll wait for localized copy: a pending
233
+ // content request must not stall notification delivery.
234
+ if (localeGeneration !== this.localeGeneration)
235
+ void this.staleLocaleRefresh();
236
+ }
237
+ }
238
+ }
239
+ catch {
240
+ if (generation === this.generation)
241
+ this.diagnose('read');
242
+ // Keep visible content; retry only at the server-provided interval.
243
+ }
244
+ if (generation !== this.generation)
245
+ return;
246
+ this.dropExpired();
247
+ this.timer = setTimeout(() => { void this.poll(generation); }, this.intervalMs);
248
+ this.timer.unref?.();
249
+ }
250
+ }
@@ -1,12 +1,27 @@
1
- import type { DeepSeekAccount, AccountBonusOrderId, AccountUserId } from '@deepseek-ai/dsh-deepseek-account';
1
+ import type { AccountClientMetadata, AccountUserId } from '@deepseek-ai/dsh-deepseek-account';
2
+ import { type AccountNotificationNotice, type AccountNotifications } from './account-notifications.js';
2
3
  export interface WhaleCouponNotice {
3
- readonly accountId: AccountUserId;
4
- readonly orderId: AccountBonusOrderId;
4
+ readonly kind?: undefined;
5
+ readonly accountId?: AccountUserId;
6
+ readonly orderId: string;
5
7
  readonly amount: string;
6
8
  readonly currency: 'CNY' | 'USD';
7
9
  readonly expiresAt: string;
8
10
  }
9
- type BonusAccount = Pick<DeepSeekAccount, 'getUnnotifiedBonuses' | 'ackBonusNotified'>;
11
+ /** The pre-0.2.2-rc.2 bonus API; newer hosts expose a different notification protocol. */
12
+ export interface LegacyBonusAccount {
13
+ getUnnotifiedBonuses(client: AccountClientMetadata): Promise<{
14
+ readonly accountId: AccountUserId;
15
+ readonly bonuses: readonly {
16
+ readonly orderId: string;
17
+ readonly campaign?: unknown;
18
+ readonly amount?: unknown;
19
+ readonly currency?: unknown;
20
+ readonly expiresAt: string;
21
+ }[];
22
+ } | null>;
23
+ ackBonusNotified(accountId: AccountUserId, orderId: string, client: AccountClientMetadata): Promise<boolean>;
24
+ }
10
25
  /** TUI-only presentation of a Platform-confirmed login grant. */
11
26
  export declare class WhaleCouponStore {
12
27
  private readonly listeners;
@@ -14,14 +29,24 @@ export declare class WhaleCouponStore {
14
29
  private notice;
15
30
  private account;
16
31
  private generation;
32
+ private notificationOwner;
33
+ private readonly notifications;
34
+ constructor(diagnose?: (operation: 'read' | 'content' | 'report') => void);
17
35
  readonly subscribe: (listener: () => void) => (() => void);
18
- readonly getSnapshot: () => WhaleCouponNotice | null;
19
- refresh(account: BonusAccount): Promise<void>;
36
+ readonly getSnapshot: () => WhaleCouponNotice | AccountNotificationNotice | null;
37
+ /** New hosts provide server-authored cards instead of structured login bonuses. */
38
+ refreshNotifications(account: AccountNotifications): void;
39
+ /** An obsolete injected plugin must not clear or publish for its successor. */
40
+ claimNotificationOwner(): {
41
+ current: () => boolean;
42
+ dispose: () => void;
43
+ };
44
+ notificationLocaleChanged(): Promise<void>;
45
+ refresh(value: unknown): Promise<void>;
20
46
  /** Called only after the modal has painted; a read alone never acknowledges. */
21
- shown(orderId: AccountBonusOrderId): void;
22
- dismiss(orderId: AccountBonusOrderId): void;
47
+ shown(orderId: string, expected?: WhaleCouponNotice | AccountNotificationNotice): void;
48
+ dismiss(orderId: string, expected?: WhaleCouponNotice | AccountNotificationNotice): void;
23
49
  clear(): void;
24
50
  private emit;
25
51
  }
26
- export {};
27
52
  //# sourceMappingURL=bonus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bonus.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/bonus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,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;gBAE5C,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,KAAK,IAAI;IAIzE,QAAQ,CAAC,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAGxD;IAED,QAAQ,CAAC,WAAW,QAAO,iBAAiB,GAAG,yBAAyB,GAAG,IAAI,CAAmD;IAElI,mFAAmF;IACnF,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAEzD,+EAA+E;IAC/E,sBAAsB,IAAI;QAAE,OAAO,EAAE,MAAM,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE;IAQzE,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5C,gFAAgF;IAChF,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,yBAAyB,GAAG,IAAI;IActF,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,yBAAyB,GAAG,IAAI;IAcxF,KAAK,IAAI,IAAI;IASb,OAAO,CAAC,IAAI;CACb"}
@@ -1,4 +1,5 @@
1
1
  import { deepSeekClientMetadata } from './deepseek.js';
2
+ import { accountNotificationsOf, AccountNotificationStore } from './account-notifications.js';
2
3
  /** TUI-only presentation of a Platform-confirmed login grant. */
3
4
  export class WhaleCouponStore {
4
5
  listeners = new Set();
@@ -6,12 +7,39 @@ export class WhaleCouponStore {
6
7
  notice = null;
7
8
  account;
8
9
  generation = 0;
10
+ notificationOwner;
11
+ notifications;
12
+ constructor(diagnose) {
13
+ this.notifications = new AccountNotificationStore(() => this.emit(), diagnose);
14
+ }
9
15
  subscribe = (listener) => {
10
16
  this.listeners.add(listener);
11
17
  return () => { this.listeners.delete(listener); };
12
18
  };
13
- getSnapshot = () => this.notice;
14
- async refresh(account) {
19
+ getSnapshot = () => this.notice ?? this.notifications.getSnapshot();
20
+ /** New hosts provide server-authored cards instead of structured login bonuses. */
21
+ refreshNotifications(account) { this.notifications.begin(account); }
22
+ /** An obsolete injected plugin must not clear or publish for its successor. */
23
+ claimNotificationOwner() {
24
+ const owner = {};
25
+ this.notificationOwner = owner;
26
+ this.clear();
27
+ const current = () => this.notificationOwner === owner;
28
+ return { current, dispose: () => { if (current()) {
29
+ this.notificationOwner = undefined;
30
+ this.clear();
31
+ } } };
32
+ }
33
+ notificationLocaleChanged() { return this.notifications.localeChanged(); }
34
+ async refresh(value) {
35
+ const notifications = accountNotificationsOf(value);
36
+ if (notifications !== undefined) {
37
+ await this.notifications.refresh(notifications);
38
+ return;
39
+ }
40
+ const account = value;
41
+ if (typeof account?.getUnnotifiedBonuses !== 'function' || typeof account.ackBonusNotified !== 'function')
42
+ return;
15
43
  const generation = ++this.generation;
16
44
  if (this.listeners.size === 0)
17
45
  return;
@@ -27,7 +55,8 @@ export class WhaleCouponStore {
27
55
  const granted = batch.bonuses.find(bonus => bonus.campaign === 'dsh_login_bonus'
28
56
  && !this.seen.has(`${batch.accountId}:${bonus.orderId}`)
29
57
  && (Number.isNaN(Date.parse(bonus.expiresAt)) || Date.parse(bonus.expiresAt) > Date.now()));
30
- if (granted === undefined)
58
+ if (granted === undefined || typeof granted.amount !== 'string'
59
+ || (granted.currency !== 'CNY' && granted.currency !== 'USD'))
31
60
  return;
32
61
  this.account = account;
33
62
  this.notice = {
@@ -37,7 +66,13 @@ export class WhaleCouponStore {
37
66
  this.emit();
38
67
  }
39
68
  /** Called only after the modal has painted; a read alone never acknowledges. */
40
- shown(orderId) {
69
+ shown(orderId, expected) {
70
+ if (expected !== undefined && expected !== this.getSnapshot())
71
+ return;
72
+ if (this.notifications.getSnapshot()?.orderId === orderId) {
73
+ this.notifications.shown(orderId);
74
+ return;
75
+ }
41
76
  const notice = this.notice;
42
77
  if (notice?.orderId !== orderId || this.account === undefined)
43
78
  return;
@@ -47,7 +82,13 @@ export class WhaleCouponStore {
47
82
  this.seen.add(key);
48
83
  void this.account.ackBonusNotified(notice.accountId, orderId, deepSeekClientMetadata()).catch(() => false);
49
84
  }
50
- dismiss(orderId) {
85
+ dismiss(orderId, expected) {
86
+ if (expected !== undefined && expected !== this.getSnapshot())
87
+ return;
88
+ if (this.notifications.getSnapshot()?.orderId === orderId) {
89
+ this.notifications.dismiss(orderId);
90
+ return;
91
+ }
51
92
  if (this.notice?.orderId !== orderId)
52
93
  return;
53
94
  this.shown(orderId);
@@ -59,6 +100,7 @@ export class WhaleCouponStore {
59
100
  }
60
101
  clear() {
61
102
  this.generation++;
103
+ this.notifications.clear();
62
104
  this.notice = null;
63
105
  this.account = undefined;
64
106
  this.seen.clear();
@@ -8,11 +8,15 @@
8
8
  * panel. It never reads or writes the account grant.
9
9
  */
10
10
  import type { Context } from '@deepseek-ai/cordis';
11
- import type { AccountClientMetadata, DeepSeekAccount } from '@deepseek-ai/dsh-deepseek-account';
11
+ import type { AccountClientMetadata, AccountUpdate, AccountView, DeepSeekAccount } from '@deepseek-ai/dsh-deepseek-account';
12
12
  import { type AskFn, type QuestionBridgeHelpers } from './interaction.js';
13
13
  export declare const DEEPSEEK_ACCOUNT_PROVIDER = "deepseek-account";
14
+ /** One account-stream item: 0.2.2-rc.2 wraps the state, older hosts yield it directly. */
15
+ type AccountWatchItem = AccountView | AccountUpdate;
14
16
  /** Only the account operations this interaction surface consumes. */
15
- export type DeepSeekAccountAuth = Pick<DeepSeekAccount, 'getState' | 'startSignIn' | 'cancelSignIn' | 'signOut' | 'watch'> & Partial<Pick<DeepSeekAccount, 'getUnnotifiedBonuses' | 'ackBonusNotified'>>;
17
+ export type DeepSeekAccountAuth = Pick<DeepSeekAccount, 'getState' | 'startSignIn' | 'cancelSignIn' | 'signOut'> & Partial<Pick<DeepSeekAccount, 'getNotifications' | 'getNotificationContent' | 'reportNotificationEvent'>> & {
18
+ watch(signal: AbortSignal): AsyncIterable<AccountWatchItem>;
19
+ };
16
20
  /** Resolve late: the account provider is absent on older DSH hosts. */
17
21
  export declare function deepSeekAccountFrom(ctx: Context): DeepSeekAccountAuth | undefined;
18
22
  /** The Host webServer may be shared, supplied by the TUI row, or mounted as a fallback. */
@@ -36,4 +40,5 @@ export declare function deepSeekClientMetadata(): AccountClientMetadata;
36
40
  * cancellation. The question panel is always retired before returning.
37
41
  */
38
42
  export declare function loginDeepSeekAccount(account: DeepSeekAccountAuth, callbackOrigin: string, ask: AskFn, signal?: AbortSignal, helpers?: QuestionBridgeHelpers): Promise<void>;
43
+ export {};
39
44
  //# sourceMappingURL=deepseek.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepseek.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/deepseek.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAe,eAAe,EAAmB,MAAM,mCAAmC,CAAA;AAG7H,OAAO,EAAkB,KAAK,KAAK,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAEzF,eAAO,MAAM,yBAAyB,qBAAqB,CAAA;AAE3D,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,GACtH,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,sBAAsB,GAAG,kBAAkB,CAAC,CAAC,CAAA;AAE/E,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CAEjF;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAO3D;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,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AAmB,GAAG,SAAS,CAEjF;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAO3D;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,GAAG;IAClE,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB,CA0DA;AAWD,wFAAwF;AACxF,wBAAgB,sBAAsB,IAAI,qBAAqB,CAM9D;AAWD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,mBAAmB,EAC5B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,KAAK,EACV,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CA0Df"}
@@ -109,6 +109,10 @@ export function deepSeekClientMetadata() {
109
109
  timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60,
110
110
  };
111
111
  }
112
+ /** Read the state from either stream shape (rc.2 wraps it in an AccountUpdate). */
113
+ function accountState(item) {
114
+ return 'state' in item ? item.state : item;
115
+ }
112
116
  function succeeded(state, id) {
113
117
  return state.attempt?.id === id && state.attempt.phase === 'succeeded' && state.status === 'credential-stored';
114
118
  }
@@ -141,7 +145,8 @@ export async function loginDeepSeekAccount(account, callbackOrigin, ask, signal,
141
145
  runAbort.signal.throwIfAborted();
142
146
  let shownUrl;
143
147
  try {
144
- for await (const state of account.watch(runAbort.signal)) {
148
+ for await (const item of account.watch(runAbort.signal)) {
149
+ const state = accountState(item);
145
150
  const attempt = state.attempt;
146
151
  if (attempt?.id !== id)
147
152
  throw new Error('DeepSeek sign-in attempt was replaced');
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ED,sDAAsD;AACtD,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAyJxD"}
@@ -38,6 +38,8 @@
38
38
  *
39
39
  * @module @deepseek-harness-tui/dsh-tui/oauth
40
40
  */
41
+ import { accountNotificationsOf } from './account-notifications.js';
42
+ import { subscribeLang } from '../../i18n.js';
41
43
  import { existsSync } from 'node:fs';
42
44
  import { homedir } from 'node:os';
43
45
  import { join } from 'node:path';
@@ -177,6 +179,48 @@ export function apply(ctx, config) {
177
179
  },
178
180
  });
179
181
  service.api = api;
182
+ // Optional runtime binding: old hosts retain login-triggered bonus reads.
183
+ // Credential replacement retires pending notifications before the next read.
184
+ ctx.inject(['deepseekAccount'], ((accountCtx) => {
185
+ const account = deepSeekAccountFrom(accountCtx);
186
+ const notifications = accountNotificationsOf(account);
187
+ if (account === undefined || notifications === undefined)
188
+ return;
189
+ const owner = service.coupons.claimNotificationOwner();
190
+ const cancellation = new AbortController();
191
+ const offLocale = subscribeLang(() => { if (owner.current())
192
+ void service.coupons.notificationLocaleChanged(); });
193
+ accountCtx.effect(() => () => {
194
+ cancellation.abort();
195
+ offLocale();
196
+ owner.dispose();
197
+ }, 'dsh-auth account notifications');
198
+ void (async () => {
199
+ try {
200
+ for await (const update of account.watch(cancellation.signal)) {
201
+ if (cancellation.signal.aborted || !owner.current())
202
+ return;
203
+ const wrapped = 'state' in update;
204
+ const state = wrapped ? update.state : update;
205
+ if (wrapped && update.type === 'credentials-changed')
206
+ service.coupons.clear();
207
+ if (state.status === 'credential-stored')
208
+ service.coupons.refreshNotifications(notifications);
209
+ else
210
+ service.coupons.clear();
211
+ }
212
+ }
213
+ catch {
214
+ if (!cancellation.signal.aborted && owner.current()) {
215
+ accountCtx.logger.warn('dsh-auth: account notification state stream stopped');
216
+ }
217
+ }
218
+ finally {
219
+ if (!cancellation.signal.aborted && owner.current())
220
+ service.coupons.clear();
221
+ }
222
+ })();
223
+ }));
180
224
  ctx.effect(function* () {
181
225
  // LIFO disposal: release command registration, drain started logins, then
182
226
  // close a fallback callback listener only this module mounted.
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAsB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAErE,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7D,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAgB7C,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;IAClB,gEAAgE;IAChE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,gFAAgF;IAChF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B;AAED,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,SAAS,IAAI,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAA;IACpD;;;;;OAKG;IACH,KAAK,CAA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AK,EAAE,cAAc,CAAA;IACrB,sFAAsF;IACtF,UAAU,EAAE,MAAM,KAAK,GAAG,SAAS,CAAA;IACnC,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,MAAM,mBAAmB,GAAG,SAAS,CAAA;IAC9D,8EAA8E;IAC9E,qBAAqB,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC3B;AAoBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,CAgJjE"}
@@ -30,9 +30,10 @@ function mountedProvider(profile) {
30
30
  /** Cordis service holder; `api` is set by the plugin's apply. */
31
31
  export class DshAuthService extends Service {
32
32
  api;
33
- coupons = new WhaleCouponStore();
33
+ coupons;
34
34
  constructor(ctx) {
35
35
  super(ctx, 'dshAuth');
36
+ this.coupons = new WhaleCouponStore(operation => ctx.logger.warn(`dsh-auth: account notification ${operation} failed`));
36
37
  }
37
38
  }
38
39
  /** Select a provider interactively among `candidates`. */
@@ -174,11 +175,9 @@ export function createDshAuthApi(deps) {
174
175
  }
175
176
  await loginDeepSeekAccount(account, callbackOrigin, ask, runSignal);
176
177
  deps.coupons?.clear();
177
- const getUnnotifiedBonuses = account.getUnnotifiedBonuses?.bind(account);
178
- const ackBonusNotified = account.ackBonusNotified?.bind(account);
179
- if (getUnnotifiedBonuses !== undefined && ackBonusNotified !== undefined) {
180
- void deps.coupons?.refresh({ getUnnotifiedBonuses, ackBonusNotified });
181
- }
178
+ // One build serves both account APIs: the store probes the live
179
+ // service for notifications (0.2.2-rc.2) or the legacy bonus surface.
180
+ void deps.coupons?.refresh(account);
182
181
  return { provider: target, oauthLabel: 'DeepSeek', expiresAt: undefined };
183
182
  })()).finally(() => { inflight.delete(target); });
184
183
  return run;
@@ -62,10 +62,12 @@ export type PluginManageQuestion =
62
62
  readonly kind: 'host-row';
63
63
  }
64
64
  /**
65
- * `disable` of the Agent Teams bundle while teammates run, are being
66
- * created, or may be running unseen (`unseen`, from a teammate session):
67
- * the team service stops them as it unloads, so the person decides with
68
- * that in view.
65
+ * `disable` of the **legacy** Agent Teams bundle (`0.2.2-rc.1` and earlier)
66
+ * while teammates run, are being created, or may be running unseen
67
+ * (`unseen`, from a teammate session): that team service stops them as it
68
+ * unloads, so the person decides with that in view. A selection host
69
+ * (`0.2.2-rc.2`+) never lists this retired bundle and switches Team per
70
+ * session with `/team off` instead, where running subagents keep running.
69
71
  */
70
72
  | {
71
73
  readonly kind: 'team-active';
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-manage.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugin-manage.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAA4B,aAAa,EAAc,MAAM,uCAAuC,CAAA;AAChH,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAK/E,OAAO,EAAoE,KAAK,SAAS,EAA0B,MAAM,iBAAiB,CAAA;AAC1I,OAAO,EAAkF,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAG7I,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAK7E,mCAAmC;AACnC,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AAElD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACA,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,sEAAsE;IACtE,QAAQ,CAAC,IAAI,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;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,MAAM,iBAAiB,CAAC,GAAG,SAAS,CAAA;CACnE;AAED,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,KAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAClC,uDAAuD;IACvD,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACpC;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAAA;CAChB;AAyGD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAsXzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAO,GAC1D,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,SAAS,CAuBxE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAiB,GAAG,kBAAkB,GAAG,SAAS,CAGtH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAiB,GAC1B,uBAAuB,GAAG,SAAS,CAwCrC"}
@@ -252,8 +252,9 @@ export function createPluginManageFlow(options) {
252
252
  * - **`disable`** asks only about a row the host layer owns — the one whose
253
253
  * removal takes this application's own services down with it. A bundle and a
254
254
  * third-party row are reversible and run no new code, so the guard's
255
- * `allowed` is the whole answer — except the Agent Teams bundle while
256
- * teammates are active, whose running turns lose their team tools.
255
+ * `allowed` is the whole answer — except the legacy Agent Teams bundle
256
+ * while teammates are active (bundle hosts only; a selection host retired
257
+ * that bundle and uses `/team off`, which keeps subagents running).
257
258
  */
258
259
  async function ask(hostRowIds) {
259
260
  const resolved = target;