@pinkbanana/dsh-balance 0.3.2 → 0.4.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.
package/README.md CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  [简体中文](./README.md) | [English](./README_EN.md)
4
4
 
5
- DeepSeek Harness 设置插件,用于查询 API 余额和当前可用模型。API Key 仅由本机 Host 使用,不会发送到浏览器。
5
+ DeepSeek Harness 插件,用于查询 API 余额和当前可用模型。API Key 仅由本机 Host 使用,不会发送到浏览器。
6
6
 
7
- ![DeepSeek 余额插件界面](./docs/dsh-balance-settings.jpg)
7
+ ![DeepSeek 余额设置面板](./docs/dsh-balance-settings-v040.png)
8
8
 
9
- ![DeepSeek 模型插件界面](./docs/dsh-models-settings.jpg)
9
+ ![聊天框下方的 DeepSeek 余额](./docs/dsh-balance-composer-v040.png)
10
10
 
11
11
  ## 功能
12
12
 
13
13
  - 查看总余额、充值余额和赠送余额
14
+ - 在聊天框下方持续显示余额摘要
14
15
  - 查看当前 API Key 可用的模型
15
16
  - 缓存查询结果并支持手动刷新
16
17
  - 原生支持简体中文和英文,并跟随 Harness 系统语言切换
@@ -23,7 +24,7 @@ dsh plugin --profile web add @pinkbanana/dsh-balance
23
24
  dsh --profile web
24
25
  ```
25
26
 
26
- 打开 <http://127.0.0.1:3080/>,进入“设置 → 插件 → DeepSeek 余额 / DeepSeek 模型”。API Key 可在“设置 → 模型”中保存,或通过 `DEEPSEEK_API_KEY` 环境变量提供。
27
+ 打开 <http://127.0.0.1:3080/>,进入“设置 → DeepSeek 余额”。该入口位于“Agent 预设”下方,余额摘要也会显示在已有会话的聊天框下方。API Key 可在“设置 → 模型”中保存,或通过 `DEEPSEEK_API_KEY` 环境变量提供。
27
28
 
28
29
  ## 开发
29
30
 
package/README_EN.md CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  [简体中文](./README.md) | [English](./README_EN.md)
4
4
 
5
- A DeepSeek Harness Settings plugin for checking API balances and available models. The API key is used only by the local Host and is never sent to the browser.
5
+ A DeepSeek Harness plugin for checking API balances and available models. The API key is used only by the local Host and is never sent to the browser.
6
6
 
7
- ![DeepSeek balance settings](./docs/dsh-balance-settings.jpg)
7
+ ![DeepSeek balance settings panel](./docs/dsh-balance-settings-v040.png)
8
8
 
9
- ![DeepSeek models settings](./docs/dsh-models-settings.jpg)
9
+ ![DeepSeek balance below the chat composer](./docs/dsh-balance-composer-v040.png)
10
10
 
11
11
  ## Features
12
12
 
13
13
  - View total, topped-up, and granted balances
14
+ - Keep a compact balance summary below the chat composer
14
15
  - View models available to the current API key
15
16
  - Cache query results with manual refresh support
16
17
  - Native Simplified Chinese and English that follows the Harness system language
@@ -23,7 +24,7 @@ dsh plugin --profile web add @pinkbanana/dsh-balance
23
24
  dsh --profile web
24
25
  ```
25
26
 
26
- Open <http://127.0.0.1:3080/> and go to Settings → Plugins → DeepSeek Balance / DeepSeek Models. Save the API key in Settings → Models or provide it through the `DEEPSEEK_API_KEY` environment variable.
27
+ Open <http://127.0.0.1:3080/> and go to Settings → DeepSeek Balance. The panel sits directly below Agent presets, and the balance summary also appears below the composer in existing sessions. Save the API key in Settings → Models or provide it through the `DEEPSEEK_API_KEY` environment variable.
27
28
 
28
29
  ## Development
29
30
 
package/lib/client.js CHANGED
@@ -12,13 +12,89 @@ window.__ModuleLoader__.load({
12
12
  /** The same-origin endpoint that proxies DeepSeek's `/models` API. */
13
13
  const MODELS_ROUTE = "/dsh-balance/api/models";
14
14
  //#endregion
15
+ //#region src/client/format.ts
16
+ function displayAmount(value, currency, locale) {
17
+ const amount = Number(value);
18
+ if (!Number.isFinite(amount)) return `${value} ${currency}`;
19
+ try {
20
+ return new Intl.NumberFormat(locale, {
21
+ style: "currency",
22
+ currency,
23
+ minimumFractionDigits: 2,
24
+ maximumFractionDigits: 8
25
+ }).format(amount);
26
+ } catch {
27
+ return `${value} ${currency}`;
28
+ }
29
+ }
30
+ //#endregion
31
+ //#region src/client/BalanceDock.tsx
32
+ const REFRESH_INTERVAL_MS = 6e4;
33
+ /** Compact ambient balance readout below the active-session composer card. */
34
+ function BalanceDock({ loadBalance, t }) {
35
+ const [result, setResult] = (0, react.useState)();
36
+ (0, react.useEffect)(() => {
37
+ let controller;
38
+ const load = () => {
39
+ controller?.abort();
40
+ controller = new AbortController();
41
+ const signal = controller.signal;
42
+ loadBalance(false, signal).then((value) => {
43
+ if (!signal.aborted) setResult(value);
44
+ }).catch(() => {
45
+ if (!signal.aborted) setResult({
46
+ ok: false,
47
+ code: "UPSTREAM_UNAVAILABLE",
48
+ message: ""
49
+ });
50
+ });
51
+ };
52
+ load();
53
+ const timer = window.setInterval(load, REFRESH_INTERVAL_MS);
54
+ return () => {
55
+ window.clearInterval(timer);
56
+ controller?.abort();
57
+ };
58
+ }, [loadBalance]);
59
+ const summary = (0, react.useMemo)(() => {
60
+ if (result === void 0) return t("dock.loading");
61
+ if (!result.ok) return t("dock.unavailable");
62
+ if (result.balanceInfos.length === 0) return t("dock.empty");
63
+ return result.balanceInfos.map((info) => `${info.currency} ${displayAmount(info.totalBalance, info.currency, t("locale.tag"))}`).join(" · ");
64
+ }, [result, t]);
65
+ const state = result === void 0 ? "loading" : result.ok && result.isAvailable ? "available" : result.ok ? "empty" : "error";
66
+ const accessibleState = result?.ok === true ? t(result.isAvailable ? "balance.available" : "balance.unavailable") : void 0;
67
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
68
+ className: "dsh-balance-dock",
69
+ role: "status",
70
+ "aria-live": "polite",
71
+ "aria-label": `${t("dock.label")}: ${summary}${accessibleState === void 0 ? "" : `. ${accessibleState}`}`,
72
+ children: [
73
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
74
+ className: "dsh-balance-dock-dot",
75
+ "data-state": state,
76
+ "aria-hidden": "true"
77
+ }),
78
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("dock.label") }),
79
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
80
+ className: "dsh-balance-dock-separator",
81
+ "aria-hidden": "true",
82
+ children: "|"
83
+ }),
84
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
85
+ className: "dsh-balance-dock-value",
86
+ children: summary
87
+ })
88
+ ]
89
+ });
90
+ }
91
+ //#endregion
15
92
  //#region src/client/locales.ts
16
93
  const LOCALE_NS = "dsh-balance";
17
94
  /** Simplified Chinese dictionary and source of truth for the namespace key set. */
18
95
  const zh = {
19
96
  "locale.tag": "zh-CN",
20
- "tab.balance": "DeepSeek 余额",
21
- "tab.models": "DeepSeek 模型",
97
+ "nav.balance": "DeepSeek 余额",
22
98
  "action.loading": "查询中…",
23
99
  "balance.title": "DeepSeek API 余额",
24
100
  "balance.copy": "余额由本机 Host 使用已保存的 API 密钥查询,密钥不会发送到浏览器。",
@@ -29,6 +105,10 @@ window.__ModuleLoader__.load({
29
105
  "balance.empty": "DeepSeek 未返回任何币种余额。",
30
106
  "balance.toppedUp": "充值余额",
31
107
  "balance.granted": "赠送余额",
108
+ "dock.label": "DeepSeek 余额",
109
+ "dock.loading": "查询中…",
110
+ "dock.unavailable": "暂时无法获取",
111
+ "dock.empty": "暂无余额信息",
32
112
  "models.title": "DeepSeek 可用模型",
33
113
  "models.copy": "从 DeepSeek 官方 /models 接口读取当前 API Key 可访问的模型。",
34
114
  "models.refresh": "刷新模型",
@@ -51,8 +131,7 @@ window.__ModuleLoader__.load({
51
131
  /** English dictionary, checked complete against the Chinese key set. */
52
132
  const en = {
53
133
  "locale.tag": "en-US",
54
- "tab.balance": "DeepSeek Balance",
55
- "tab.models": "DeepSeek Models",
134
+ "nav.balance": "DeepSeek Balance",
56
135
  "action.loading": "Loading…",
57
136
  "balance.title": "DeepSeek API Balance",
58
137
  "balance.copy": "The local Host queries your balance with the saved API key. The key is never sent to the browser.",
@@ -63,6 +142,10 @@ window.__ModuleLoader__.load({
63
142
  "balance.empty": "DeepSeek returned no currency balances.",
64
143
  "balance.toppedUp": "Topped-up balance",
65
144
  "balance.granted": "Granted balance",
145
+ "dock.label": "DeepSeek Balance",
146
+ "dock.loading": "Loading…",
147
+ "dock.unavailable": "Temporarily unavailable",
148
+ "dock.empty": "No balance information",
66
149
  "models.title": "Available DeepSeek Models",
67
150
  "models.copy": "Lists the models available to the current API key using the official DeepSeek /models endpoint.",
68
151
  "models.refresh": "Refresh models",
@@ -87,20 +170,6 @@ window.__ModuleLoader__.load({
87
170
  }
88
171
  //#endregion
89
172
  //#region src/client/BalanceTab.tsx
90
- function displayAmount(value, currency, locale) {
91
- const amount = Number(value);
92
- if (!Number.isFinite(amount)) return `${value} ${currency}`;
93
- try {
94
- return new Intl.NumberFormat(locale, {
95
- style: "currency",
96
- currency,
97
- minimumFractionDigits: 2,
98
- maximumFractionDigits: 8
99
- }).format(amount);
100
- } catch {
101
- return `${value} ${currency}`;
102
- }
103
- }
104
173
  function BalanceCard({ info, t }) {
105
174
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
106
175
  className: "dsh-balance-card",
@@ -128,7 +197,7 @@ window.__ModuleLoader__.load({
128
197
  ]
129
198
  });
130
199
  }
131
- function BalanceTab({ loadBalance, t }) {
200
+ function BalanceSection({ loadBalance, t }) {
132
201
  const [result, setResult] = (0, react.useState)();
133
202
  const [loading, setLoading] = (0, react.useState)(true);
134
203
  const load = (0, react.useCallback)(async (forceRefresh, signal) => {
@@ -158,7 +227,7 @@ window.__ModuleLoader__.load({
158
227
  load(true, controller.signal);
159
228
  };
160
229
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
161
- className: "dsh-balance-tab",
230
+ className: "dsh-balance-section",
162
231
  "aria-labelledby": "dsh-balance-title",
163
232
  children: [
164
233
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -229,7 +298,7 @@ window.__ModuleLoader__.load({
229
298
  })]
230
299
  });
231
300
  }
232
- function ModelsTab({ loadModels, t }) {
301
+ function ModelsSection({ loadModels, t }) {
233
302
  const [result, setResult] = (0, react.useState)();
234
303
  const [loading, setLoading] = (0, react.useState)(true);
235
304
  const load = (0, react.useCallback)(async (forceRefresh, signal) => {
@@ -259,7 +328,7 @@ window.__ModuleLoader__.load({
259
328
  load(true, controller.signal);
260
329
  };
261
330
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
262
- className: "dsh-models-tab",
331
+ className: "dsh-models-section",
263
332
  "aria-labelledby": "dsh-models-title",
264
333
  children: [
265
334
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -316,30 +385,63 @@ window.__ModuleLoader__.load({
316
385
  });
317
386
  }
318
387
  //#endregion
388
+ //#region src/client/DeepSeekPanel.tsx
389
+ /** Standalone DeepSeek settings page, placed immediately after Agent presets. */
390
+ function DeepSeekPanel({ loadBalance, loadModels, t }) {
391
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
392
+ className: "dsh-deepseek-panel",
393
+ children: [
394
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalanceSection, {
395
+ loadBalance,
396
+ t
397
+ }),
398
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
399
+ className: "dsh-deepseek-divider",
400
+ "aria-hidden": "true"
401
+ }),
402
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelsSection, {
403
+ loadModels,
404
+ t
405
+ })
406
+ ]
407
+ });
408
+ }
409
+ //#endregion
319
410
  //#region src/client/styles.ts
320
411
  const balanceStyles = `
321
- .dsh-balance-tab {
412
+ .dsh-deepseek-panel {
322
413
  display: flex;
323
414
  flex-direction: column;
324
- gap: 14px;
325
- max-width: 760px;
415
+ gap: 28px;
416
+ max-width: 720px;
326
417
  color: var(--dsw-alias-label-primary);
327
418
  }
419
+ .dsh-balance-section,
420
+ .dsh-models-section {
421
+ display: flex;
422
+ flex-direction: column;
423
+ gap: 14px;
424
+ }
425
+ .dsh-deepseek-divider {
426
+ height: 1px;
427
+ background: var(--dsw-alias-border-l2);
428
+ }
328
429
  .dsh-balance-summary {
329
430
  display: flex;
330
431
  align-items: center;
331
432
  justify-content: space-between;
332
433
  gap: 16px;
333
434
  }
334
- .dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; }
435
+ .dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; line-height: 24px; }
335
436
  .dsh-balance-copy { margin: 4px 0 0; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }
336
437
  .dsh-balance-refresh {
337
438
  flex: none;
338
439
  appearance: none;
339
440
  border: 1px solid var(--dsw-alias-border-l2);
340
- border-radius: 8px;
341
- padding: 6px 13px;
342
- background: var(--dsw-alias-bg-layer-3);
441
+ border-radius: 16px;
442
+ min-height: 32px;
443
+ padding: 0 14px;
444
+ background: transparent;
343
445
  color: var(--dsw-alias-label-primary);
344
446
  font: inherit;
345
447
  font-size: 13px;
@@ -377,13 +479,6 @@ window.__ModuleLoader__.load({
377
479
  .dsh-balance-breakdown dt { color: var(--dsw-alias-label-tertiary); }
378
480
  .dsh-balance-breakdown dd { margin: 0; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
379
481
  .dsh-balance-meta { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; }
380
- .dsh-models-tab {
381
- display: flex;
382
- flex-direction: column;
383
- gap: 14px;
384
- max-width: 760px;
385
- color: var(--dsw-alias-label-primary);
386
- }
387
482
  .dsh-model-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }
388
483
  .dsh-model-count .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }
389
484
  .dsh-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
@@ -404,6 +499,46 @@ window.__ModuleLoader__.load({
404
499
  overflow-wrap: anywhere;
405
500
  }
406
501
  .dsh-model-owner { color: var(--dsw-alias-label-tertiary); font-size: 12px; }
502
+ .dsh-balance-dock {
503
+ box-sizing: border-box;
504
+ display: block;
505
+ width: 100%;
506
+ max-width: var(--dsh-chat-content-width);
507
+ margin: 0 auto;
508
+ padding: 4px calc(var(--dsh-composer-side-clearance) + 16px) 0;
509
+ color: var(--dsw-alias-label-tertiary);
510
+ font-size: 12px;
511
+ line-height: 20px;
512
+ text-align: center;
513
+ white-space: nowrap;
514
+ overflow: hidden;
515
+ text-overflow: ellipsis;
516
+ }
517
+ .dsh-balance-dock-dot {
518
+ display: inline-block;
519
+ width: 6px;
520
+ height: 6px;
521
+ margin-right: 6px;
522
+ border-radius: 999px;
523
+ background: var(--dsw-alias-label-dimmed);
524
+ vertical-align: 1px;
525
+ }
526
+ .dsh-balance-dock-dot[data-state='available'] { background: var(--dsw-alias-state-success-primary); }
527
+ .dsh-balance-dock-dot[data-state='empty'],
528
+ .dsh-balance-dock-dot[data-state='error'] { background: var(--dsw-alias-state-error-primary); }
529
+ .dsh-balance-dock-separator {
530
+ margin: 0 10px;
531
+ color: var(--dsw-alias-separator-primary);
532
+ }
533
+ .dsh-balance-dock-value {
534
+ color: var(--dsw-alias-label-secondary);
535
+ font-variant-numeric: tabular-nums;
536
+ }
537
+ @media (max-width: 640px) {
538
+ .dsh-balance-summary { align-items: flex-start; }
539
+ .dsh-balance-grid,
540
+ .dsh-model-grid { grid-template-columns: 1fr; }
541
+ }
407
542
  `;
408
543
  //#endregion
409
544
  //#region src/client/index.tsx
@@ -428,7 +563,7 @@ window.__ModuleLoader__.load({
428
563
  if (typeof value !== "object" || value === null || !("ok" in value) || typeof value.ok !== "boolean") throw new Error("模型插件收到了无法识别的 Host 响应");
429
564
  return value;
430
565
  }
431
- /** Register one feature-owned page inside the existing Plugins settings section. */
566
+ /** Register a standalone Settings page and an ambient composer balance readout. */
432
567
  function apply(ctx) {
433
568
  ctx.effect(() => ctx.locale.register(LOCALE_NS, {
434
569
  zh,
@@ -445,22 +580,24 @@ window.__ModuleLoader__.load({
445
580
  style.remove();
446
581
  };
447
582
  }, "dsh-balance: styles");
448
- ctx.slots.inject("settings.plugins.tab", () => ctx.slots.register({
449
- name: "settings.plugins.tab",
583
+ ctx.slots.inject("settings.section", () => ctx.slots.register({
584
+ name: "settings.section",
450
585
  id: "deepseek-balance",
451
- order: 20,
452
- label: () => t("tab.balance"),
453
- locale: LOCALE_NS,
454
- inject: () => ({ loadBalance })
455
- }, BalanceTab));
456
- ctx.slots.inject("settings.plugins.tab", () => ctx.slots.register({
457
- name: "settings.plugins.tab",
458
- id: "deepseek-models",
459
586
  order: 21,
460
- label: () => t("tab.models"),
587
+ label: () => t("nav.balance"),
588
+ locale: LOCALE_NS,
589
+ inject: () => ({
590
+ loadBalance,
591
+ loadModels
592
+ })
593
+ }, DeepSeekPanel));
594
+ ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
595
+ name: "conversation.composer.dock",
596
+ id: "deepseek-balance",
597
+ order: 10,
461
598
  locale: LOCALE_NS,
462
- inject: () => ({ loadModels })
463
- }, ModelsTab));
599
+ inject: () => ({ loadBalance })
600
+ }, BalanceDock));
464
601
  }
465
602
  //#endregion
466
603
  exports.apply = apply;
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["useState","useCallback","useState","useCallback"],"sources":["../src/types.ts","../src/client/locales.ts","../src/client/BalanceTab.tsx","../src/client/ModelsTab.tsx","../src/client/styles.ts","../src/client/index.tsx"],"sourcesContent":["/** The same-origin endpoint exposed by the plugin's Host half. */\nexport const BALANCE_ROUTE = '/dsh-balance/api/balance'\n\n/** The same-origin endpoint that proxies DeepSeek's `/models` API. */\nexport const MODELS_ROUTE = '/dsh-balance/api/models'\n\n/** One currency row returned by DeepSeek's `/user/balance` API. */\nexport interface BalanceInfo {\n currency: string\n totalBalance: string\n grantedBalance: string\n toppedUpBalance: string\n}\n\n/** A successful, browser-safe balance response. */\nexport interface BalanceSuccess {\n ok: true\n isAvailable: boolean\n balanceInfos: BalanceInfo[]\n fetchedAt: string\n source: 'live' | 'cache'\n}\n\nexport type DeepSeekApiErrorCode =\n | 'FORBIDDEN'\n | 'INVALID_API_KEY'\n | 'INVALID_RESPONSE'\n | 'METHOD_NOT_ALLOWED'\n | 'MISSING_API_KEY'\n | 'RATE_LIMITED'\n | 'UPSTREAM_ERROR'\n | 'UPSTREAM_TIMEOUT'\n | 'UPSTREAM_UNAVAILABLE'\n\n/** @deprecated Prefer the feature-neutral `DeepSeekApiErrorCode`. */\nexport type BalanceErrorCode = DeepSeekApiErrorCode\n\n/** A failed, browser-safe response. It intentionally contains no upstream body or credential. */\nexport interface BalanceFailure {\n ok: false\n code: DeepSeekApiErrorCode\n message: string\n}\n\nexport type BalanceApiResponse = BalanceSuccess | BalanceFailure\n\n/** One model returned by DeepSeek's `/models` API. */\nexport interface ModelInfo {\n id: string\n ownedBy: string\n}\n\n/** A successful, browser-safe model-list response. */\nexport interface ModelsSuccess {\n ok: true\n models: ModelInfo[]\n fetchedAt: string\n source: 'live' | 'cache'\n}\n\nexport type ModelsFailure = BalanceFailure\nexport type ModelsApiResponse = ModelsSuccess | ModelsFailure\n","import type { LocaleDictOf } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { DeepSeekApiErrorCode } from '../types.ts'\n\nexport const LOCALE_NS = 'dsh-balance'\n\n/** Simplified Chinese dictionary and source of truth for the namespace key set. */\nexport const zh = {\n 'locale.tag': 'zh-CN',\n 'tab.balance': 'DeepSeek 余额',\n 'tab.models': 'DeepSeek 模型',\n 'action.loading': '查询中…',\n 'balance.title': 'DeepSeek API 余额',\n 'balance.copy': '余额由本机 Host 使用已保存的 API 密钥查询,密钥不会发送到浏览器。',\n 'balance.refresh': '刷新余额',\n 'balance.loading': '正在查询 DeepSeek 账户余额…',\n 'balance.available': '当前账户有可用余额',\n 'balance.unavailable': '当前账户没有可用余额',\n 'balance.empty': 'DeepSeek 未返回任何币种余额。',\n 'balance.toppedUp': '充值余额',\n 'balance.granted': '赠送余额',\n 'models.title': 'DeepSeek 可用模型',\n 'models.copy': '从 DeepSeek 官方 /models 接口读取当前 API Key 可访问的模型。',\n 'models.refresh': '刷新模型',\n 'models.loading': '正在查询 DeepSeek 模型列表…',\n 'models.count': '当前可用 {count} 个模型',\n 'models.empty': 'DeepSeek 未返回任何可用模型。',\n 'models.owner': '由 {owner} 提供',\n 'meta.updated': '更新于 {time}',\n 'meta.cached': ' · 缓存',\n 'error.FORBIDDEN': '此查询仅允许从本机访问',\n 'error.INVALID_API_KEY': 'DeepSeek API 密钥无效或没有查询权限',\n 'error.INVALID_RESPONSE': 'DeepSeek 返回了无法识别的响应',\n 'error.METHOD_NOT_ALLOWED': '请求方法不受支持',\n 'error.MISSING_API_KEY': '未配置 DeepSeek API 密钥,请先在“模型”设置中保存',\n 'error.RATE_LIMITED': 'DeepSeek API 请求过于频繁,请稍后重试',\n 'error.UPSTREAM_ERROR': 'DeepSeek API 返回了错误',\n 'error.UPSTREAM_TIMEOUT': '查询 DeepSeek API 超时',\n 'error.UPSTREAM_UNAVAILABLE': '无法连接到 DeepSeek API',\n} as const\n\nexport type DshBalanceLocaleKey = keyof typeof zh\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Balance and model-list settings copy owned by this plugin. */\n 'dsh-balance': DshBalanceLocaleKey\n }\n}\n\n/** English dictionary, checked complete against the Chinese key set. */\nexport const en: LocaleDictOf<typeof LOCALE_NS> = {\n 'locale.tag': 'en-US',\n 'tab.balance': 'DeepSeek Balance',\n 'tab.models': 'DeepSeek Models',\n 'action.loading': 'Loading…',\n 'balance.title': 'DeepSeek API Balance',\n 'balance.copy': 'The local Host queries your balance with the saved API key. The key is never sent to the browser.',\n 'balance.refresh': 'Refresh balance',\n 'balance.loading': 'Loading your DeepSeek API balance…',\n 'balance.available': 'This account has available balance',\n 'balance.unavailable': 'This account has no available balance',\n 'balance.empty': 'DeepSeek returned no currency balances.',\n 'balance.toppedUp': 'Topped-up balance',\n 'balance.granted': 'Granted balance',\n 'models.title': 'Available DeepSeek Models',\n 'models.copy': 'Lists the models available to the current API key using the official DeepSeek /models endpoint.',\n 'models.refresh': 'Refresh models',\n 'models.loading': 'Loading the DeepSeek model list…',\n 'models.count': '{count} models available',\n 'models.empty': 'DeepSeek returned no available models.',\n 'models.owner': 'Provided by {owner}',\n 'meta.updated': 'Updated {time}',\n 'meta.cached': ' · Cached',\n 'error.FORBIDDEN': 'This query is available only from the local machine',\n 'error.INVALID_API_KEY': 'The DeepSeek API key is invalid or lacks permission',\n 'error.INVALID_RESPONSE': 'DeepSeek returned an unrecognized response',\n 'error.METHOD_NOT_ALLOWED': 'This request method is not supported',\n 'error.MISSING_API_KEY': 'No DeepSeek API key is configured. Save one in Models settings first.',\n 'error.RATE_LIMITED': 'Too many DeepSeek API requests. Try again later.',\n 'error.UPSTREAM_ERROR': 'The DeepSeek API returned an error',\n 'error.UPSTREAM_TIMEOUT': 'The DeepSeek API request timed out',\n 'error.UPSTREAM_UNAVAILABLE': 'Could not connect to the DeepSeek API',\n}\n\nexport function errorLocaleKey(code: DeepSeekApiErrorCode): DshBalanceLocaleKey {\n return `error.${code}`\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { BalanceApiResponse, BalanceInfo } from '../types.ts'\nimport { errorLocaleKey } from './locales.ts'\nimport type { LOCALE_NS } from './locales.ts'\n\nexport interface BalanceTabInjected {\n loadBalance: (forceRefresh: boolean, signal: AbortSignal) => Promise<BalanceApiResponse>\n}\n\nexport type BalanceTabProps = PropsRuntime<'settings.plugins.tab'> & InjectFace<BalanceTabInjected> & PropsLocale<typeof LOCALE_NS>\n\nfunction displayAmount(value: string, currency: string, locale: string): string {\n const amount = Number(value)\n if (!Number.isFinite(amount)) return `${value} ${currency}`\n try {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 8,\n }).format(amount)\n } catch {\n return `${value} ${currency}`\n }\n}\n\nfunction BalanceCard({ info, t }: { info: BalanceInfo; t: BalanceTabProps['t'] }) {\n return (\n <article className=\"dsh-balance-card\">\n <div className=\"dsh-balance-card-head\">\n <span className=\"dsh-balance-currency\">{info.currency}</span>\n </div>\n <p className=\"dsh-balance-total\">{displayAmount(info.totalBalance, info.currency, t('locale.tag'))}</p>\n <dl className=\"dsh-balance-breakdown\">\n <dt>{t('balance.toppedUp')}</dt>\n <dd>{displayAmount(info.toppedUpBalance, info.currency, t('locale.tag'))}</dd>\n <dt>{t('balance.granted')}</dt>\n <dd>{displayAmount(info.grantedBalance, info.currency, t('locale.tag'))}</dd>\n </dl>\n </article>\n )\n}\n\nexport function BalanceTab({ loadBalance, t }: BalanceTabProps) {\n const [result, setResult] = useState<BalanceApiResponse>()\n const [loading, setLoading] = useState(true)\n\n const load = useCallback(async (forceRefresh: boolean, signal: AbortSignal) => {\n setLoading(true)\n try {\n setResult(await loadBalance(forceRefresh, signal))\n } catch (error) {\n if (signal.aborted) return\n setResult({\n ok: false,\n code: 'UPSTREAM_UNAVAILABLE',\n message: error instanceof Error ? error.message : '',\n })\n } finally {\n if (!signal.aborted) setLoading(false)\n }\n }, [loadBalance])\n\n useEffect(() => {\n const controller = new AbortController()\n void load(false, controller.signal)\n return () => { controller.abort() }\n }, [load])\n\n const refresh = () => {\n const controller = new AbortController()\n void load(true, controller.signal)\n }\n\n return (\n <section className=\"dsh-balance-tab\" aria-labelledby=\"dsh-balance-title\">\n <div className=\"dsh-balance-summary\">\n <div>\n <h2 id=\"dsh-balance-title\" className=\"dsh-balance-heading\">{t('balance.title')}</h2>\n <p className=\"dsh-balance-copy\">{t('balance.copy')}</p>\n </div>\n <button className=\"dsh-balance-refresh\" type=\"button\" disabled={loading} onClick={refresh}>\n {loading ? t('action.loading') : t('balance.refresh')}\n </button>\n </div>\n\n {loading && result === undefined ? <p className=\"dsh-balance-status\" role=\"status\">{t('balance.loading')}</p> : null}\n {result?.ok === false ? <p className=\"dsh-balance-error\" role=\"alert\">{t(errorLocaleKey(result.code))}</p> : null}\n {result?.ok === true ? (\n <>\n <div className=\"dsh-balance-availability\" data-available={String(result.isAvailable)}>\n <span className=\"dsh-balance-dot\" aria-hidden=\"true\" />\n <span>{t(result.isAvailable ? 'balance.available' : 'balance.unavailable')}</span>\n </div>\n {result.balanceInfos.length > 0\n ? <div className=\"dsh-balance-grid\">{result.balanceInfos.map(info => <BalanceCard key={info.currency} info={info} t={t} />)}</div>\n : <p className=\"dsh-balance-status\">{t('balance.empty')}</p>}\n <p className=\"dsh-balance-meta\">\n {t('meta.updated', { time: new Date(result.fetchedAt).toLocaleString(t('locale.tag')) })}{result.source === 'cache' ? t('meta.cached') : ''}\n </p>\n </>\n ) : null}\n </section>\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ModelInfo, ModelsApiResponse } from '../types.ts'\nimport { errorLocaleKey } from './locales.ts'\nimport type { LOCALE_NS } from './locales.ts'\n\nexport interface ModelsTabInjected {\n loadModels: (forceRefresh: boolean, signal: AbortSignal) => Promise<ModelsApiResponse>\n}\n\nexport type ModelsTabProps = PropsRuntime<'settings.plugins.tab'> & InjectFace<ModelsTabInjected> & PropsLocale<typeof LOCALE_NS>\n\nfunction ModelCard({ model, t }: { model: ModelInfo; t: ModelsTabProps['t'] }) {\n return (\n <article className=\"dsh-model-card\">\n <code className=\"dsh-model-id\">{model.id}</code>\n <span className=\"dsh-model-owner\">{t('models.owner', { owner: model.ownedBy })}</span>\n </article>\n )\n}\n\nexport function ModelsTab({ loadModels, t }: ModelsTabProps) {\n const [result, setResult] = useState<ModelsApiResponse>()\n const [loading, setLoading] = useState(true)\n\n const load = useCallback(async (forceRefresh: boolean, signal: AbortSignal) => {\n setLoading(true)\n try {\n setResult(await loadModels(forceRefresh, signal))\n } catch (error) {\n if (signal.aborted) return\n setResult({\n ok: false,\n code: 'UPSTREAM_UNAVAILABLE',\n message: error instanceof Error ? error.message : '',\n })\n } finally {\n if (!signal.aborted) setLoading(false)\n }\n }, [loadModels])\n\n useEffect(() => {\n const controller = new AbortController()\n void load(false, controller.signal)\n return () => { controller.abort() }\n }, [load])\n\n const refresh = () => {\n const controller = new AbortController()\n void load(true, controller.signal)\n }\n\n return (\n <section className=\"dsh-models-tab\" aria-labelledby=\"dsh-models-title\">\n <div className=\"dsh-balance-summary\">\n <div>\n <h2 id=\"dsh-models-title\" className=\"dsh-balance-heading\">{t('models.title')}</h2>\n <p className=\"dsh-balance-copy\">{t('models.copy')}</p>\n </div>\n <button className=\"dsh-balance-refresh\" type=\"button\" disabled={loading} onClick={refresh}>\n {loading ? t('action.loading') : t('models.refresh')}\n </button>\n </div>\n\n {loading && result === undefined ? <p className=\"dsh-balance-status\" role=\"status\">{t('models.loading')}</p> : null}\n {result?.ok === false ? <p className=\"dsh-balance-error\" role=\"alert\">{t(errorLocaleKey(result.code))}</p> : null}\n {result?.ok === true ? (\n <>\n <div className=\"dsh-model-count\">\n <span className=\"dsh-balance-dot\" aria-hidden=\"true\" />\n <span>{t('models.count', { count: result.models.length })}</span>\n </div>\n {result.models.length > 0\n ? <div className=\"dsh-model-grid\">{result.models.map(model => <ModelCard key={model.id} model={model} t={t} />)}</div>\n : <p className=\"dsh-balance-status\">{t('models.empty')}</p>}\n <p className=\"dsh-balance-meta\">\n {t('meta.updated', { time: new Date(result.fetchedAt).toLocaleString(t('locale.tag')) })}{result.source === 'cache' ? t('meta.cached') : ''}\n </p>\n </>\n ) : null}\n </section>\n )\n}\n","export const balanceStyles = `\n.dsh-balance-tab {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-balance-summary {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n}\n.dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; }\n.dsh-balance-copy { margin: 4px 0 0; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }\n.dsh-balance-refresh {\n flex: none;\n appearance: none;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 6px 13px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.dsh-balance-refresh:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dsh-balance-refresh:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dsh-balance-refresh:disabled { cursor: default; opacity: .55; }\n.dsh-balance-status,\n.dsh-balance-error {\n margin: 0;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 18px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 1.6;\n}\n.dsh-balance-error { color: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-balance-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability[data-available='true'] .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }\n.dsh-balance-card {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-balance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-balance-currency { color: var(--dsw-alias-label-tertiary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }\n.dsh-balance-total { margin: 12px 0 16px; font-size: 28px; font-weight: 650; line-height: 1.15; }\n.dsh-balance-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 12px; }\n.dsh-balance-breakdown dt { color: var(--dsw-alias-label-tertiary); }\n.dsh-balance-breakdown dd { margin: 0; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dsh-balance-meta { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-models-tab {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-model-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-model-count .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }\n.dsh-model-card {\n display: flex;\n flex-direction: column;\n gap: 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-model-id {\n color: var(--dsw-alias-label-primary);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 15px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.dsh-model-owner { color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n`\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { BalanceApiResponse, ModelsApiResponse } from '../types.ts'\nimport { BALANCE_ROUTE, MODELS_ROUTE } from '../types.ts'\nimport { BalanceTab } from './BalanceTab.tsx'\nimport type { BalanceTabInjected } from './BalanceTab.tsx'\nimport { ModelsTab } from './ModelsTab.tsx'\nimport type { ModelsTabInjected } from './ModelsTab.tsx'\nimport { en, LOCALE_NS, zh } from './locales.ts'\nimport { balanceStyles } from './styles.ts'\n\nexport type { BalanceTabInjected, BalanceTabProps } from './BalanceTab.tsx'\nexport type { ModelsTabInjected, ModelsTabProps } from './ModelsTab.tsx'\n\nexport const inject = ['slots', 'locale']\n\nasync function loadBalance(forceRefresh: boolean, signal: AbortSignal): Promise<BalanceApiResponse> {\n const url = forceRefresh ? `${BALANCE_ROUTE}?refresh=1` : BALANCE_ROUTE\n const response = await fetch(url, {\n method: 'GET',\n headers: { accept: 'application/json' },\n cache: 'no-store',\n signal,\n })\n const value: unknown = await response.json()\n if (typeof value !== 'object' || value === null || !('ok' in value) || typeof value.ok !== 'boolean') {\n throw new Error('余额插件收到了无法识别的 Host 响应')\n }\n return value as BalanceApiResponse\n}\n\nasync function loadModels(forceRefresh: boolean, signal: AbortSignal): Promise<ModelsApiResponse> {\n const url = forceRefresh ? `${MODELS_ROUTE}?refresh=1` : MODELS_ROUTE\n const response = await fetch(url, {\n method: 'GET',\n headers: { accept: 'application/json' },\n cache: 'no-store',\n signal,\n })\n const value: unknown = await response.json()\n if (typeof value !== 'object' || value === null || !('ok' in value) || typeof value.ok !== 'boolean') {\n throw new Error('模型插件收到了无法识别的 Host 响应')\n }\n return value as ModelsApiResponse\n}\n\n/** Register one feature-owned page inside the existing Plugins settings section. */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(\n () => ctx.locale.register(LOCALE_NS, { zh, en }),\n 'dsh-balance: dictionaries',\n )\n const t = ctx.locale.bind(LOCALE_NS)\n\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-balance'\n style.dataset.pluginCss = 'dsh-balance/styles'\n style.textContent = balanceStyles\n document.head.append(style)\n return () => { style.remove() }\n }, 'dsh-balance: styles')\n\n ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({\n name: 'settings.plugins.tab',\n id: 'deepseek-balance',\n order: 20,\n label: () => t('tab.balance'),\n locale: LOCALE_NS,\n inject: (): BalanceTabInjected => ({ loadBalance }),\n }, BalanceTab))\n ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({\n name: 'settings.plugins.tab',\n id: 'deepseek-models',\n order: 21,\n label: () => t('tab.models'),\n locale: LOCALE_NS,\n inject: (): ModelsTabInjected => ({ loadModels }),\n }, ModelsTab))\n}\n"],"mappings":";;;;;;;;;;EACA,MAAa,gBAAgB;;EAG7B,MAAa,eAAe;;;ECD5B,MAAa,YAAY;;EAGzB,MAAa,KAAK;GAChB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M,IAAI,IAAI,OAAO,KAAK,SAAS;GAEnC,IAAI,aAAa;IACf,MAAM,QAAQ,SAAS,cAAc,OAAO;IAC5C,MAAM,QAAQ,SAAS;IACvB,MAAM,QAAQ,YAAY;IAC1B,MAAM,cAAc;IACpB,SAAS,KAAK,OAAO,KAAK;IAC1B,aAAa;KAAE,MAAM,OAAO;IAAE;GAChC,GAAG,qBAAqB;GAExB,IAAI,MAAM,OAAO,8BAA8B,IAAI,MAAM,SAAS;IAChE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,aAAa,EAAE,aAAa;IAC5B,QAAQ;IACR,eAAmC,EAAE,YAAY;GACnD,GAAG,UAAU,CAAC;GACd,IAAI,MAAM,OAAO,8BAA8B,IAAI,MAAM,SAAS;IAChE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,aAAa,EAAE,YAAY;IAC3B,QAAQ;IACR,eAAkC,EAAE,WAAW;GACjD,GAAG,SAAS,CAAC;EACf"}
1
+ {"version":3,"file":"client.js","names":["useState","useMemo","useState","useCallback","useState","useCallback"],"sources":["../src/types.ts","../src/client/format.ts","../src/client/BalanceDock.tsx","../src/client/locales.ts","../src/client/BalanceTab.tsx","../src/client/ModelsTab.tsx","../src/client/DeepSeekPanel.tsx","../src/client/styles.ts","../src/client/index.tsx"],"sourcesContent":["/** The same-origin endpoint exposed by the plugin's Host half. */\nexport const BALANCE_ROUTE = '/dsh-balance/api/balance'\n\n/** The same-origin endpoint that proxies DeepSeek's `/models` API. */\nexport const MODELS_ROUTE = '/dsh-balance/api/models'\n\n/** One currency row returned by DeepSeek's `/user/balance` API. */\nexport interface BalanceInfo {\n currency: string\n totalBalance: string\n grantedBalance: string\n toppedUpBalance: string\n}\n\n/** A successful, browser-safe balance response. */\nexport interface BalanceSuccess {\n ok: true\n isAvailable: boolean\n balanceInfos: BalanceInfo[]\n fetchedAt: string\n source: 'live' | 'cache'\n}\n\nexport type DeepSeekApiErrorCode =\n | 'FORBIDDEN'\n | 'INVALID_API_KEY'\n | 'INVALID_RESPONSE'\n | 'METHOD_NOT_ALLOWED'\n | 'MISSING_API_KEY'\n | 'RATE_LIMITED'\n | 'UPSTREAM_ERROR'\n | 'UPSTREAM_TIMEOUT'\n | 'UPSTREAM_UNAVAILABLE'\n\n/** @deprecated Prefer the feature-neutral `DeepSeekApiErrorCode`. */\nexport type BalanceErrorCode = DeepSeekApiErrorCode\n\n/** A failed, browser-safe response. It intentionally contains no upstream body or credential. */\nexport interface BalanceFailure {\n ok: false\n code: DeepSeekApiErrorCode\n message: string\n}\n\nexport type BalanceApiResponse = BalanceSuccess | BalanceFailure\n\n/** One model returned by DeepSeek's `/models` API. */\nexport interface ModelInfo {\n id: string\n ownedBy: string\n}\n\n/** A successful, browser-safe model-list response. */\nexport interface ModelsSuccess {\n ok: true\n models: ModelInfo[]\n fetchedAt: string\n source: 'live' | 'cache'\n}\n\nexport type ModelsFailure = BalanceFailure\nexport type ModelsApiResponse = ModelsSuccess | ModelsFailure\n","export function displayAmount(value: string, currency: string, locale: string): string {\n const amount = Number(value)\n if (!Number.isFinite(amount)) return `${value} ${currency}`\n\n try {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 8,\n }).format(amount)\n } catch {\n return `${value} ${currency}`\n }\n}\n","import { useEffect, useMemo, useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { BalanceApiResponse } from '../types.ts'\nimport { displayAmount } from './format.ts'\nimport type { LOCALE_NS } from './locales.ts'\n\nconst REFRESH_INTERVAL_MS = 60_000\n\nexport interface BalanceDockInjected {\n loadBalance: (forceRefresh: boolean, signal: AbortSignal) => Promise<BalanceApiResponse>\n}\n\nexport type BalanceDockProps = PropsRuntime<'conversation.composer.dock'>\n & InjectFace<BalanceDockInjected>\n & PropsLocale<typeof LOCALE_NS>\n\n/** Compact ambient balance readout below the active-session composer card. */\nexport function BalanceDock({ loadBalance, t }: BalanceDockProps) {\n const [result, setResult] = useState<BalanceApiResponse>()\n\n useEffect(() => {\n let controller: AbortController | undefined\n\n const load = () => {\n controller?.abort()\n controller = new AbortController()\n const signal = controller.signal\n void loadBalance(false, signal).then((value) => {\n if (!signal.aborted) setResult(value)\n }).catch(() => {\n if (!signal.aborted) {\n setResult({ ok: false, code: 'UPSTREAM_UNAVAILABLE', message: '' })\n }\n })\n }\n\n load()\n const timer = window.setInterval(load, REFRESH_INTERVAL_MS)\n return () => {\n window.clearInterval(timer)\n controller?.abort()\n }\n }, [loadBalance])\n\n const summary = useMemo(() => {\n if (result === undefined) return t('dock.loading')\n if (!result.ok) return t('dock.unavailable')\n if (result.balanceInfos.length === 0) return t('dock.empty')\n return result.balanceInfos\n .map(info => `${info.currency} ${displayAmount(info.totalBalance, info.currency, t('locale.tag'))}`)\n .join(' · ')\n }, [result, t])\n\n const state = result === undefined\n ? 'loading'\n : result.ok && result.isAvailable\n ? 'available'\n : result.ok\n ? 'empty'\n : 'error'\n\n const accessibleState = result?.ok === true\n ? t(result.isAvailable ? 'balance.available' : 'balance.unavailable')\n : undefined\n\n return (\n <div\n className=\"dsh-balance-dock\"\n role=\"status\"\n aria-live=\"polite\"\n aria-label={`${t('dock.label')}: ${summary}${accessibleState === undefined ? '' : `. ${accessibleState}`}`}\n >\n <span className=\"dsh-balance-dock-dot\" data-state={state} aria-hidden=\"true\" />\n <span>{t('dock.label')}</span>\n <span className=\"dsh-balance-dock-separator\" aria-hidden=\"true\">|</span>\n <span className=\"dsh-balance-dock-value\">{summary}</span>\n </div>\n )\n}\n","import type { LocaleDictOf } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { DeepSeekApiErrorCode } from '../types.ts'\n\nexport const LOCALE_NS = 'dsh-balance'\n\n/** Simplified Chinese dictionary and source of truth for the namespace key set. */\nexport const zh = {\n 'locale.tag': 'zh-CN',\n 'nav.balance': 'DeepSeek 余额',\n 'action.loading': '查询中…',\n 'balance.title': 'DeepSeek API 余额',\n 'balance.copy': '余额由本机 Host 使用已保存的 API 密钥查询,密钥不会发送到浏览器。',\n 'balance.refresh': '刷新余额',\n 'balance.loading': '正在查询 DeepSeek 账户余额…',\n 'balance.available': '当前账户有可用余额',\n 'balance.unavailable': '当前账户没有可用余额',\n 'balance.empty': 'DeepSeek 未返回任何币种余额。',\n 'balance.toppedUp': '充值余额',\n 'balance.granted': '赠送余额',\n 'dock.label': 'DeepSeek 余额',\n 'dock.loading': '查询中…',\n 'dock.unavailable': '暂时无法获取',\n 'dock.empty': '暂无余额信息',\n 'models.title': 'DeepSeek 可用模型',\n 'models.copy': '从 DeepSeek 官方 /models 接口读取当前 API Key 可访问的模型。',\n 'models.refresh': '刷新模型',\n 'models.loading': '正在查询 DeepSeek 模型列表…',\n 'models.count': '当前可用 {count} 个模型',\n 'models.empty': 'DeepSeek 未返回任何可用模型。',\n 'models.owner': '由 {owner} 提供',\n 'meta.updated': '更新于 {time}',\n 'meta.cached': ' · 缓存',\n 'error.FORBIDDEN': '此查询仅允许从本机访问',\n 'error.INVALID_API_KEY': 'DeepSeek API 密钥无效或没有查询权限',\n 'error.INVALID_RESPONSE': 'DeepSeek 返回了无法识别的响应',\n 'error.METHOD_NOT_ALLOWED': '请求方法不受支持',\n 'error.MISSING_API_KEY': '未配置 DeepSeek API 密钥,请先在“模型”设置中保存',\n 'error.RATE_LIMITED': 'DeepSeek API 请求过于频繁,请稍后重试',\n 'error.UPSTREAM_ERROR': 'DeepSeek API 返回了错误',\n 'error.UPSTREAM_TIMEOUT': '查询 DeepSeek API 超时',\n 'error.UPSTREAM_UNAVAILABLE': '无法连接到 DeepSeek API',\n} as const\n\nexport type DshBalanceLocaleKey = keyof typeof zh\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Balance and model-list settings copy owned by this plugin. */\n 'dsh-balance': DshBalanceLocaleKey\n }\n}\n\n/** English dictionary, checked complete against the Chinese key set. */\nexport const en: LocaleDictOf<typeof LOCALE_NS> = {\n 'locale.tag': 'en-US',\n 'nav.balance': 'DeepSeek Balance',\n 'action.loading': 'Loading…',\n 'balance.title': 'DeepSeek API Balance',\n 'balance.copy': 'The local Host queries your balance with the saved API key. The key is never sent to the browser.',\n 'balance.refresh': 'Refresh balance',\n 'balance.loading': 'Loading your DeepSeek API balance…',\n 'balance.available': 'This account has available balance',\n 'balance.unavailable': 'This account has no available balance',\n 'balance.empty': 'DeepSeek returned no currency balances.',\n 'balance.toppedUp': 'Topped-up balance',\n 'balance.granted': 'Granted balance',\n 'dock.label': 'DeepSeek Balance',\n 'dock.loading': 'Loading…',\n 'dock.unavailable': 'Temporarily unavailable',\n 'dock.empty': 'No balance information',\n 'models.title': 'Available DeepSeek Models',\n 'models.copy': 'Lists the models available to the current API key using the official DeepSeek /models endpoint.',\n 'models.refresh': 'Refresh models',\n 'models.loading': 'Loading the DeepSeek model list…',\n 'models.count': '{count} models available',\n 'models.empty': 'DeepSeek returned no available models.',\n 'models.owner': 'Provided by {owner}',\n 'meta.updated': 'Updated {time}',\n 'meta.cached': ' · Cached',\n 'error.FORBIDDEN': 'This query is available only from the local machine',\n 'error.INVALID_API_KEY': 'The DeepSeek API key is invalid or lacks permission',\n 'error.INVALID_RESPONSE': 'DeepSeek returned an unrecognized response',\n 'error.METHOD_NOT_ALLOWED': 'This request method is not supported',\n 'error.MISSING_API_KEY': 'No DeepSeek API key is configured. Save one in Models settings first.',\n 'error.RATE_LIMITED': 'Too many DeepSeek API requests. Try again later.',\n 'error.UPSTREAM_ERROR': 'The DeepSeek API returned an error',\n 'error.UPSTREAM_TIMEOUT': 'The DeepSeek API request timed out',\n 'error.UPSTREAM_UNAVAILABLE': 'Could not connect to the DeepSeek API',\n}\n\nexport function errorLocaleKey(code: DeepSeekApiErrorCode): DshBalanceLocaleKey {\n return `error.${code}`\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { BalanceApiResponse, BalanceInfo } from '../types.ts'\nimport { displayAmount } from './format.ts'\nimport { errorLocaleKey } from './locales.ts'\nimport type { LOCALE_NS } from './locales.ts'\n\nexport interface BalanceTabInjected {\n loadBalance: (forceRefresh: boolean, signal: AbortSignal) => Promise<BalanceApiResponse>\n}\n\nexport type BalanceTabProps = BalanceTabInjected & PropsLocale<typeof LOCALE_NS>\n\nfunction BalanceCard({ info, t }: { info: BalanceInfo; t: BalanceTabProps['t'] }) {\n return (\n <article className=\"dsh-balance-card\">\n <div className=\"dsh-balance-card-head\">\n <span className=\"dsh-balance-currency\">{info.currency}</span>\n </div>\n <p className=\"dsh-balance-total\">{displayAmount(info.totalBalance, info.currency, t('locale.tag'))}</p>\n <dl className=\"dsh-balance-breakdown\">\n <dt>{t('balance.toppedUp')}</dt>\n <dd>{displayAmount(info.toppedUpBalance, info.currency, t('locale.tag'))}</dd>\n <dt>{t('balance.granted')}</dt>\n <dd>{displayAmount(info.grantedBalance, info.currency, t('locale.tag'))}</dd>\n </dl>\n </article>\n )\n}\n\nexport function BalanceSection({ loadBalance, t }: BalanceTabProps) {\n const [result, setResult] = useState<BalanceApiResponse>()\n const [loading, setLoading] = useState(true)\n\n const load = useCallback(async (forceRefresh: boolean, signal: AbortSignal) => {\n setLoading(true)\n try {\n setResult(await loadBalance(forceRefresh, signal))\n } catch (error) {\n if (signal.aborted) return\n setResult({\n ok: false,\n code: 'UPSTREAM_UNAVAILABLE',\n message: error instanceof Error ? error.message : '',\n })\n } finally {\n if (!signal.aborted) setLoading(false)\n }\n }, [loadBalance])\n\n useEffect(() => {\n const controller = new AbortController()\n void load(false, controller.signal)\n return () => { controller.abort() }\n }, [load])\n\n const refresh = () => {\n const controller = new AbortController()\n void load(true, controller.signal)\n }\n\n return (\n <section className=\"dsh-balance-section\" aria-labelledby=\"dsh-balance-title\">\n <div className=\"dsh-balance-summary\">\n <div>\n <h2 id=\"dsh-balance-title\" className=\"dsh-balance-heading\">{t('balance.title')}</h2>\n <p className=\"dsh-balance-copy\">{t('balance.copy')}</p>\n </div>\n <button className=\"dsh-balance-refresh\" type=\"button\" disabled={loading} onClick={refresh}>\n {loading ? t('action.loading') : t('balance.refresh')}\n </button>\n </div>\n\n {loading && result === undefined ? <p className=\"dsh-balance-status\" role=\"status\">{t('balance.loading')}</p> : null}\n {result?.ok === false ? <p className=\"dsh-balance-error\" role=\"alert\">{t(errorLocaleKey(result.code))}</p> : null}\n {result?.ok === true ? (\n <>\n <div className=\"dsh-balance-availability\" data-available={String(result.isAvailable)}>\n <span className=\"dsh-balance-dot\" aria-hidden=\"true\" />\n <span>{t(result.isAvailable ? 'balance.available' : 'balance.unavailable')}</span>\n </div>\n {result.balanceInfos.length > 0\n ? <div className=\"dsh-balance-grid\">{result.balanceInfos.map(info => <BalanceCard key={info.currency} info={info} t={t} />)}</div>\n : <p className=\"dsh-balance-status\">{t('balance.empty')}</p>}\n <p className=\"dsh-balance-meta\">\n {t('meta.updated', { time: new Date(result.fetchedAt).toLocaleString(t('locale.tag')) })}{result.source === 'cache' ? t('meta.cached') : ''}\n </p>\n </>\n ) : null}\n </section>\n )\n}\n\n/** @deprecated The balance view is no longer rendered as a Plugins tab. */\nexport const BalanceTab = BalanceSection\n","import { useCallback, useEffect, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ModelInfo, ModelsApiResponse } from '../types.ts'\nimport { errorLocaleKey } from './locales.ts'\nimport type { LOCALE_NS } from './locales.ts'\n\nexport interface ModelsTabInjected {\n loadModels: (forceRefresh: boolean, signal: AbortSignal) => Promise<ModelsApiResponse>\n}\n\nexport type ModelsTabProps = ModelsTabInjected & PropsLocale<typeof LOCALE_NS>\n\nfunction ModelCard({ model, t }: { model: ModelInfo; t: ModelsTabProps['t'] }) {\n return (\n <article className=\"dsh-model-card\">\n <code className=\"dsh-model-id\">{model.id}</code>\n <span className=\"dsh-model-owner\">{t('models.owner', { owner: model.ownedBy })}</span>\n </article>\n )\n}\n\nexport function ModelsSection({ loadModels, t }: ModelsTabProps) {\n const [result, setResult] = useState<ModelsApiResponse>()\n const [loading, setLoading] = useState(true)\n\n const load = useCallback(async (forceRefresh: boolean, signal: AbortSignal) => {\n setLoading(true)\n try {\n setResult(await loadModels(forceRefresh, signal))\n } catch (error) {\n if (signal.aborted) return\n setResult({\n ok: false,\n code: 'UPSTREAM_UNAVAILABLE',\n message: error instanceof Error ? error.message : '',\n })\n } finally {\n if (!signal.aborted) setLoading(false)\n }\n }, [loadModels])\n\n useEffect(() => {\n const controller = new AbortController()\n void load(false, controller.signal)\n return () => { controller.abort() }\n }, [load])\n\n const refresh = () => {\n const controller = new AbortController()\n void load(true, controller.signal)\n }\n\n return (\n <section className=\"dsh-models-section\" aria-labelledby=\"dsh-models-title\">\n <div className=\"dsh-balance-summary\">\n <div>\n <h2 id=\"dsh-models-title\" className=\"dsh-balance-heading\">{t('models.title')}</h2>\n <p className=\"dsh-balance-copy\">{t('models.copy')}</p>\n </div>\n <button className=\"dsh-balance-refresh\" type=\"button\" disabled={loading} onClick={refresh}>\n {loading ? t('action.loading') : t('models.refresh')}\n </button>\n </div>\n\n {loading && result === undefined ? <p className=\"dsh-balance-status\" role=\"status\">{t('models.loading')}</p> : null}\n {result?.ok === false ? <p className=\"dsh-balance-error\" role=\"alert\">{t(errorLocaleKey(result.code))}</p> : null}\n {result?.ok === true ? (\n <>\n <div className=\"dsh-model-count\">\n <span className=\"dsh-balance-dot\" aria-hidden=\"true\" />\n <span>{t('models.count', { count: result.models.length })}</span>\n </div>\n {result.models.length > 0\n ? <div className=\"dsh-model-grid\">{result.models.map(model => <ModelCard key={model.id} model={model} t={t} />)}</div>\n : <p className=\"dsh-balance-status\">{t('models.empty')}</p>}\n <p className=\"dsh-balance-meta\">\n {t('meta.updated', { time: new Date(result.fetchedAt).toLocaleString(t('locale.tag')) })}{result.source === 'cache' ? t('meta.cached') : ''}\n </p>\n </>\n ) : null}\n </section>\n )\n}\n\n/** @deprecated The model view is now part of the standalone DeepSeek settings panel. */\nexport const ModelsTab = ModelsSection\n","import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { BalanceSection } from './BalanceTab.tsx'\nimport type { BalanceTabInjected } from './BalanceTab.tsx'\nimport type { LOCALE_NS } from './locales.ts'\nimport { ModelsSection } from './ModelsTab.tsx'\nimport type { ModelsTabInjected } from './ModelsTab.tsx'\n\nexport interface DeepSeekPanelInjected extends BalanceTabInjected, ModelsTabInjected {}\n\nexport type DeepSeekPanelProps = PropsRuntime<'settings.section'>\n & InjectFace<DeepSeekPanelInjected>\n & PropsLocale<typeof LOCALE_NS>\n\n/** Standalone DeepSeek settings page, placed immediately after Agent presets. */\nexport function DeepSeekPanel({ loadBalance, loadModels, t }: DeepSeekPanelProps) {\n return (\n <div className=\"dsh-deepseek-panel\">\n <BalanceSection loadBalance={loadBalance} t={t} />\n <div className=\"dsh-deepseek-divider\" aria-hidden=\"true\" />\n <ModelsSection loadModels={loadModels} t={t} />\n </div>\n )\n}\n","export const balanceStyles = `\n.dsh-deepseek-panel {\n display: flex;\n flex-direction: column;\n gap: 28px;\n max-width: 720px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-balance-section,\n.dsh-models-section {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n.dsh-deepseek-divider {\n height: 1px;\n background: var(--dsw-alias-border-l2);\n}\n.dsh-balance-summary {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n}\n.dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; line-height: 24px; }\n.dsh-balance-copy { margin: 4px 0 0; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }\n.dsh-balance-refresh {\n flex: none;\n appearance: none;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 16px;\n min-height: 32px;\n padding: 0 14px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.dsh-balance-refresh:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dsh-balance-refresh:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dsh-balance-refresh:disabled { cursor: default; opacity: .55; }\n.dsh-balance-status,\n.dsh-balance-error {\n margin: 0;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 18px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 1.6;\n}\n.dsh-balance-error { color: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-balance-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability[data-available='true'] .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }\n.dsh-balance-card {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-balance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-balance-currency { color: var(--dsw-alias-label-tertiary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }\n.dsh-balance-total { margin: 12px 0 16px; font-size: 28px; font-weight: 650; line-height: 1.15; }\n.dsh-balance-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 12px; }\n.dsh-balance-breakdown dt { color: var(--dsw-alias-label-tertiary); }\n.dsh-balance-breakdown dd { margin: 0; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dsh-balance-meta { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-model-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-model-count .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }\n.dsh-model-card {\n display: flex;\n flex-direction: column;\n gap: 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-model-id {\n color: var(--dsw-alias-label-primary);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 15px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.dsh-model-owner { color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-balance-dock {\n box-sizing: border-box;\n display: block;\n width: 100%;\n max-width: var(--dsh-chat-content-width);\n margin: 0 auto;\n padding: 4px calc(var(--dsh-composer-side-clearance) + 16px) 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.dsh-balance-dock-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n margin-right: 6px;\n border-radius: 999px;\n background: var(--dsw-alias-label-dimmed);\n vertical-align: 1px;\n}\n.dsh-balance-dock-dot[data-state='available'] { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-dock-dot[data-state='empty'],\n.dsh-balance-dock-dot[data-state='error'] { background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-dock-separator {\n margin: 0 10px;\n color: var(--dsw-alias-separator-primary);\n}\n.dsh-balance-dock-value {\n color: var(--dsw-alias-label-secondary);\n font-variant-numeric: tabular-nums;\n}\n@media (max-width: 640px) {\n .dsh-balance-summary { align-items: flex-start; }\n .dsh-balance-grid,\n .dsh-model-grid { grid-template-columns: 1fr; }\n}\n`\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { BalanceApiResponse, ModelsApiResponse } from '../types.ts'\nimport { BALANCE_ROUTE, MODELS_ROUTE } from '../types.ts'\nimport { BalanceDock } from './BalanceDock.tsx'\nimport type { BalanceDockInjected } from './BalanceDock.tsx'\nimport { DeepSeekPanel } from './DeepSeekPanel.tsx'\nimport type { DeepSeekPanelInjected } from './DeepSeekPanel.tsx'\nimport { en, LOCALE_NS, zh } from './locales.ts'\nimport { balanceStyles } from './styles.ts'\n\nexport type { BalanceTabInjected, BalanceTabProps } from './BalanceTab.tsx'\nexport type { BalanceDockInjected, BalanceDockProps } from './BalanceDock.tsx'\nexport type { DeepSeekPanelInjected, DeepSeekPanelProps } from './DeepSeekPanel.tsx'\nexport type { ModelsTabInjected, ModelsTabProps } from './ModelsTab.tsx'\n\nexport const inject = ['slots', 'locale']\n\nasync function loadBalance(forceRefresh: boolean, signal: AbortSignal): Promise<BalanceApiResponse> {\n const url = forceRefresh ? `${BALANCE_ROUTE}?refresh=1` : BALANCE_ROUTE\n const response = await fetch(url, {\n method: 'GET',\n headers: { accept: 'application/json' },\n cache: 'no-store',\n signal,\n })\n const value: unknown = await response.json()\n if (typeof value !== 'object' || value === null || !('ok' in value) || typeof value.ok !== 'boolean') {\n throw new Error('余额插件收到了无法识别的 Host 响应')\n }\n return value as BalanceApiResponse\n}\n\nasync function loadModels(forceRefresh: boolean, signal: AbortSignal): Promise<ModelsApiResponse> {\n const url = forceRefresh ? `${MODELS_ROUTE}?refresh=1` : MODELS_ROUTE\n const response = await fetch(url, {\n method: 'GET',\n headers: { accept: 'application/json' },\n cache: 'no-store',\n signal,\n })\n const value: unknown = await response.json()\n if (typeof value !== 'object' || value === null || !('ok' in value) || typeof value.ok !== 'boolean') {\n throw new Error('模型插件收到了无法识别的 Host 响应')\n }\n return value as ModelsApiResponse\n}\n\n/** Register a standalone Settings page and an ambient composer balance readout. */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(\n () => ctx.locale.register(LOCALE_NS, { zh, en }),\n 'dsh-balance: dictionaries',\n )\n const t = ctx.locale.bind(LOCALE_NS)\n\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-balance'\n style.dataset.pluginCss = 'dsh-balance/styles'\n style.textContent = balanceStyles\n document.head.append(style)\n return () => { style.remove() }\n }, 'dsh-balance: styles')\n\n ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'deepseek-balance',\n order: 21,\n label: () => t('nav.balance'),\n locale: LOCALE_NS,\n inject: (): DeepSeekPanelInjected => ({ loadBalance, loadModels }),\n }, DeepSeekPanel))\n\n ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({\n name: 'conversation.composer.dock',\n id: 'deepseek-balance',\n order: 10,\n locale: LOCALE_NS,\n inject: (): BalanceDockInjected => ({ loadBalance }),\n }, BalanceDock))\n}\n"],"mappings":";;;;;;;;;;EACA,MAAa,gBAAgB;;EAG7B,MAAa,eAAe;;;ECJ5B,SAAgB,cAAc,OAAe,UAAkB,QAAwB;GACrF,MAAM,SAAS,OAAO,KAAK;GAC3B,IAAI,CAAC,OAAO,SAAS,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG;GAEjD,IAAI;IACF,OAAO,IAAI,KAAK,aAAa,QAAQ;KACnC,OAAO;KACP;KACA,uBAAuB;KACvB,uBAAuB;IACzB,CAAC,CAAC,CAAC,OAAO,MAAM;GAClB,QAAQ;IACN,OAAO,GAAG,MAAM,GAAG;GACrB;EACF;;;ECRA,MAAM,sBAAsB;;EAW5B,SAAgB,YAAY,EAAE,aAAa,KAAuB;GAChE,MAAM,CAAC,QAAQ,cAAA,GAAaA,MAAAA,SAAAA,CAA6B;GAEzD,CAAA,GAAA,MAAA,UAAA,OAAgB;IACd,IAAI;IAEJ,MAAM,aAAa;KACjB,YAAY,MAAM;KAClB,aAAa,IAAI,gBAAgB;KACjC,MAAM,SAAS,WAAW;KAC1B,YAAiB,OAAO,MAAM,CAAC,CAAC,MAAM,UAAU;MAC9C,IAAI,CAAC,OAAO,SAAS,UAAU,KAAK;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GAAG,aAAa,cAAc,cACvB;IAChC,QAAQ;IACR,SAAS,EAAE,QAAQ,mBAAmB;IACtC,OAAO;IACP;GACF,CAAC,EAAA,CACqC,KAAK;GAC3C,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,QAAQ,UAAU,OAAO,MAAM,OAAO,WACzF,MAAM,IAAI,MAAM,sBAAsB;GAExC,OAAO;EACT;;EAGA,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aACI,IAAI,OAAO,SAAS,WAAW;IAAE;IAAI;GAAG,CAAC,GAC/C,2BACF;GACA,MAAM,IAAI,IAAI,OAAO,KAAK,SAAS;GAEnC,IAAI,aAAa;IACf,MAAM,QAAQ,SAAS,cAAc,OAAO;IAC5C,MAAM,QAAQ,SAAS;IACvB,MAAM,QAAQ,YAAY;IAC1B,MAAM,cAAc;IACpB,SAAS,KAAK,OAAO,KAAK;IAC1B,aAAa;KAAE,MAAM,OAAO;IAAE;GAChC,GAAG,qBAAqB;GAExB,IAAI,MAAM,OAAO,0BAA0B,IAAI,MAAM,SAAS;IAC5D,MAAM;IACN,IAAI;IACJ,OAAO;IACP,aAAa,EAAE,aAAa;IAC5B,QAAQ;IACR,eAAsC;KAAE;KAAa;IAAW;GAClE,GAAG,aAAa,CAAC;GAEjB,IAAI,MAAM,OAAO,oCAAoC,IAAI,MAAM,SAAS;IACtE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,eAAoC,EAAE,YAAY;GACpD,GAAG,WAAW,CAAC;EACjB"}
@@ -0,0 +1,9 @@
1
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { BalanceApiResponse } from '../types.ts';
3
+ import type { LOCALE_NS } from './locales.ts';
4
+ export interface BalanceDockInjected {
5
+ loadBalance: (forceRefresh: boolean, signal: AbortSignal) => Promise<BalanceApiResponse>;
6
+ }
7
+ export type BalanceDockProps = PropsRuntime<'conversation.composer.dock'> & InjectFace<BalanceDockInjected> & PropsLocale<typeof LOCALE_NS>;
8
+ /** Compact ambient balance readout below the active-session composer card. */
9
+ export declare function BalanceDock({ loadBalance, t }: BalanceDockProps): import("react").JSX.Element;
@@ -1,8 +1,10 @@
1
- import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
1
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
2
2
  import type { BalanceApiResponse } from '../types.ts';
3
3
  import type { LOCALE_NS } from './locales.ts';
4
4
  export interface BalanceTabInjected {
5
5
  loadBalance: (forceRefresh: boolean, signal: AbortSignal) => Promise<BalanceApiResponse>;
6
6
  }
7
- export type BalanceTabProps = PropsRuntime<'settings.plugins.tab'> & InjectFace<BalanceTabInjected> & PropsLocale<typeof LOCALE_NS>;
8
- export declare function BalanceTab({ loadBalance, t }: BalanceTabProps): import("react").JSX.Element;
7
+ export type BalanceTabProps = BalanceTabInjected & PropsLocale<typeof LOCALE_NS>;
8
+ export declare function BalanceSection({ loadBalance, t }: BalanceTabProps): import("react").JSX.Element;
9
+ /** @deprecated The balance view is no longer rendered as a Plugins tab. */
10
+ export declare const BalanceTab: typeof BalanceSection;
@@ -0,0 +1,9 @@
1
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { BalanceTabInjected } from './BalanceTab.tsx';
3
+ import type { LOCALE_NS } from './locales.ts';
4
+ import type { ModelsTabInjected } from './ModelsTab.tsx';
5
+ export interface DeepSeekPanelInjected extends BalanceTabInjected, ModelsTabInjected {
6
+ }
7
+ export type DeepSeekPanelProps = PropsRuntime<'settings.section'> & InjectFace<DeepSeekPanelInjected> & PropsLocale<typeof LOCALE_NS>;
8
+ /** Standalone DeepSeek settings page, placed immediately after Agent presets. */
9
+ export declare function DeepSeekPanel({ loadBalance, loadModels, t }: DeepSeekPanelProps): import("react").JSX.Element;
@@ -1,8 +1,10 @@
1
- import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
1
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
2
2
  import type { ModelsApiResponse } from '../types.ts';
3
3
  import type { LOCALE_NS } from './locales.ts';
4
4
  export interface ModelsTabInjected {
5
5
  loadModels: (forceRefresh: boolean, signal: AbortSignal) => Promise<ModelsApiResponse>;
6
6
  }
7
- export type ModelsTabProps = PropsRuntime<'settings.plugins.tab'> & InjectFace<ModelsTabInjected> & PropsLocale<typeof LOCALE_NS>;
8
- export declare function ModelsTab({ loadModels, t }: ModelsTabProps): import("react").JSX.Element;
7
+ export type ModelsTabProps = ModelsTabInjected & PropsLocale<typeof LOCALE_NS>;
8
+ export declare function ModelsSection({ loadModels, t }: ModelsTabProps): import("react").JSX.Element;
9
+ /** @deprecated The model view is now part of the standalone DeepSeek settings panel. */
10
+ export declare const ModelsTab: typeof ModelsSection;
@@ -0,0 +1 @@
1
+ export declare function displayAmount(value: string, currency: string, locale: string): string;
@@ -1,6 +1,8 @@
1
1
  import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
2
2
  export type { BalanceTabInjected, BalanceTabProps } from './BalanceTab.tsx';
3
+ export type { BalanceDockInjected, BalanceDockProps } from './BalanceDock.tsx';
4
+ export type { DeepSeekPanelInjected, DeepSeekPanelProps } from './DeepSeekPanel.tsx';
3
5
  export type { ModelsTabInjected, ModelsTabProps } from './ModelsTab.tsx';
4
6
  export declare const inject: string[];
5
- /** Register one feature-owned page inside the existing Plugins settings section. */
7
+ /** Register a standalone Settings page and an ambient composer balance readout. */
6
8
  export declare function apply(ctx: ClientContext): void;
@@ -4,8 +4,7 @@ export declare const LOCALE_NS = "dsh-balance";
4
4
  /** Simplified Chinese dictionary and source of truth for the namespace key set. */
5
5
  export declare const zh: {
6
6
  readonly 'locale.tag': "zh-CN";
7
- readonly 'tab.balance': "DeepSeek 余额";
8
- readonly 'tab.models': "DeepSeek 模型";
7
+ readonly 'nav.balance': "DeepSeek 余额";
9
8
  readonly 'action.loading': "查询中…";
10
9
  readonly 'balance.title': "DeepSeek API 余额";
11
10
  readonly 'balance.copy': "余额由本机 Host 使用已保存的 API 密钥查询,密钥不会发送到浏览器。";
@@ -16,6 +15,10 @@ export declare const zh: {
16
15
  readonly 'balance.empty': "DeepSeek 未返回任何币种余额。";
17
16
  readonly 'balance.toppedUp': "充值余额";
18
17
  readonly 'balance.granted': "赠送余额";
18
+ readonly 'dock.label': "DeepSeek 余额";
19
+ readonly 'dock.loading': "查询中…";
20
+ readonly 'dock.unavailable': "暂时无法获取";
21
+ readonly 'dock.empty': "暂无余额信息";
19
22
  readonly 'models.title': "DeepSeek 可用模型";
20
23
  readonly 'models.copy': "从 DeepSeek 官方 /models 接口读取当前 API Key 可访问的模型。";
21
24
  readonly 'models.refresh': "刷新模型";
@@ -1 +1 @@
1
- export declare const balanceStyles = "\n.dsh-balance-tab {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-balance-summary {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n}\n.dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; }\n.dsh-balance-copy { margin: 4px 0 0; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }\n.dsh-balance-refresh {\n flex: none;\n appearance: none;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 6px 13px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.dsh-balance-refresh:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dsh-balance-refresh:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dsh-balance-refresh:disabled { cursor: default; opacity: .55; }\n.dsh-balance-status,\n.dsh-balance-error {\n margin: 0;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 18px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 1.6;\n}\n.dsh-balance-error { color: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-balance-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability[data-available='true'] .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }\n.dsh-balance-card {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-balance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-balance-currency { color: var(--dsw-alias-label-tertiary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }\n.dsh-balance-total { margin: 12px 0 16px; font-size: 28px; font-weight: 650; line-height: 1.15; }\n.dsh-balance-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 12px; }\n.dsh-balance-breakdown dt { color: var(--dsw-alias-label-tertiary); }\n.dsh-balance-breakdown dd { margin: 0; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dsh-balance-meta { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-models-tab {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-model-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-model-count .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }\n.dsh-model-card {\n display: flex;\n flex-direction: column;\n gap: 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-model-id {\n color: var(--dsw-alias-label-primary);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 15px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.dsh-model-owner { color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n";
1
+ export declare const balanceStyles = "\n.dsh-deepseek-panel {\n display: flex;\n flex-direction: column;\n gap: 28px;\n max-width: 720px;\n color: var(--dsw-alias-label-primary);\n}\n.dsh-balance-section,\n.dsh-models-section {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n.dsh-deepseek-divider {\n height: 1px;\n background: var(--dsw-alias-border-l2);\n}\n.dsh-balance-summary {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n}\n.dsh-balance-heading { margin: 0; font-size: 18px; font-weight: 600; line-height: 24px; }\n.dsh-balance-copy { margin: 4px 0 0; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }\n.dsh-balance-refresh {\n flex: none;\n appearance: none;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 16px;\n min-height: 32px;\n padding: 0 14px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.dsh-balance-refresh:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dsh-balance-refresh:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }\n.dsh-balance-refresh:disabled { cursor: default; opacity: .55; }\n.dsh-balance-status,\n.dsh-balance-error {\n margin: 0;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 18px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n line-height: 1.6;\n}\n.dsh-balance-error { color: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-balance-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-availability[data-available='true'] .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }\n.dsh-balance-card {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-balance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-balance-currency { color: var(--dsw-alias-label-tertiary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }\n.dsh-balance-total { margin: 12px 0 16px; font-size: 28px; font-weight: 650; line-height: 1.15; }\n.dsh-balance-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 12px; }\n.dsh-balance-breakdown dt { color: var(--dsw-alias-label-tertiary); }\n.dsh-balance-breakdown dd { margin: 0; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }\n.dsh-balance-meta { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-model-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }\n.dsh-model-count .dsh-balance-dot { background: var(--dsw-alias-state-success-primary); }\n.dsh-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }\n.dsh-model-card {\n display: flex;\n flex-direction: column;\n gap: 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 16px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dsh-model-id {\n color: var(--dsw-alias-label-primary);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 15px;\n font-weight: 600;\n overflow-wrap: anywhere;\n}\n.dsh-model-owner { color: var(--dsw-alias-label-tertiary); font-size: 12px; }\n.dsh-balance-dock {\n box-sizing: border-box;\n display: block;\n width: 100%;\n max-width: var(--dsh-chat-content-width);\n margin: 0 auto;\n padding: 4px calc(var(--dsh-composer-side-clearance) + 16px) 0;\n color: var(--dsw-alias-label-tertiary);\n font-size: 12px;\n line-height: 20px;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.dsh-balance-dock-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n margin-right: 6px;\n border-radius: 999px;\n background: var(--dsw-alias-label-dimmed);\n vertical-align: 1px;\n}\n.dsh-balance-dock-dot[data-state='available'] { background: var(--dsw-alias-state-success-primary); }\n.dsh-balance-dock-dot[data-state='empty'],\n.dsh-balance-dock-dot[data-state='error'] { background: var(--dsw-alias-state-error-primary); }\n.dsh-balance-dock-separator {\n margin: 0 10px;\n color: var(--dsw-alias-separator-primary);\n}\n.dsh-balance-dock-value {\n color: var(--dsw-alias-label-secondary);\n font-variant-numeric: tabular-nums;\n}\n@media (max-width: 640px) {\n .dsh-balance-summary { align-items: flex-start; }\n .dsh-balance-grid,\n .dsh-model-grid { grid-template-columns: 1fr; }\n}\n";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pinkbanana/dsh-balance",
3
- "version": "0.3.2",
4
- "description": "DeepSeek Harness plugin that shows API balances and available models in Settings",
3
+ "version": "0.4.0",
4
+ "description": "DeepSeek Harness plugin that shows API balances and models in Settings, with balance below the chat composer",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/crazywoola/dsh-balance.git"
@@ -38,7 +38,7 @@
38
38
  "lib/client.js",
39
39
  "lib/client.js.map",
40
40
  "lib/types/**/*.d.ts",
41
- "docs/*.jpg",
41
+ "docs/*.png",
42
42
  "cordis.patch.yml",
43
43
  "LICENSE",
44
44
  "README.md",
@@ -52,14 +52,26 @@
52
52
  "platform": "web",
53
53
  "inject": [
54
54
  "@deepseek-ai/dsh-client-locale",
55
- "@deepseek-ai/dsh-client-ui-settings",
56
- "@deepseek-ai/dsh-client-ui-settings-plugins"
55
+ "@deepseek-ai/dsh-client-ui-conversation",
56
+ "@deepseek-ai/dsh-client-ui-settings"
57
57
  ]
58
58
  }
59
59
  },
60
+ "scripts": {
61
+ "build": "rimraf lib && tsc -p tsconfig.build.json && tsdown && node scripts/verify-client-bundle.mjs",
62
+ "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build",
63
+ "dev": "tsdown --watch",
64
+ "lint": "eslint .",
65
+ "pack:plugin": "pnpm pack",
66
+ "prepare": "pnpm run build",
67
+ "test": "vitest run",
68
+ "test:watch": "vitest",
69
+ "typecheck": "tsc --noEmit"
70
+ },
60
71
  "engines": {
61
72
  "node": ">=20"
62
73
  },
74
+ "packageManager": "pnpm@11.21.0",
63
75
  "publishConfig": {
64
76
  "access": "public"
65
77
  },
@@ -68,8 +80,8 @@
68
80
  "@deepseek-ai/cordis": "^4.0.1",
69
81
  "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
70
82
  "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
83
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
71
84
  "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6",
72
- "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.0-rc.6",
73
85
  "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
74
86
  "@deepseek-ai/dsh-credentials": "^0.1.0-rc.6",
75
87
  "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
@@ -82,8 +94,8 @@
82
94
  "@deepseek-ai/cordis": "^4.0.1",
83
95
  "@deepseek-ai/dsh-client-locale": "0.1.0-rc.6",
84
96
  "@deepseek-ai/dsh-client-runtime": "0.1.0-rc.6",
97
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.0-rc.6",
85
98
  "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.6",
86
- "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.0-rc.6",
87
99
  "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.6",
88
100
  "@deepseek-ai/dsh-credentials": "0.1.0-rc.6",
89
101
  "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.6",
@@ -98,15 +110,5 @@
98
110
  "typescript": "^5.9.3",
99
111
  "typescript-eslint": "^8.48.0",
100
112
  "vitest": "^4.0.15"
101
- },
102
- "scripts": {
103
- "build": "rimraf lib && tsc -p tsconfig.build.json && tsdown && node scripts/verify-client-bundle.mjs",
104
- "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build",
105
- "dev": "tsdown --watch",
106
- "lint": "eslint .",
107
- "pack:plugin": "pnpm pack",
108
- "test": "vitest run",
109
- "test:watch": "vitest",
110
- "typecheck": "tsc --noEmit"
111
113
  }
112
- }
114
+ }
Binary file
Binary file