@virzz/dsh-plugin-deepseek-balance 1.0.0 → 1.0.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 (2) hide show
  1. package/README.md +90 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -35,35 +35,115 @@ Design notes:
35
35
  - **Two cadences.** The child collects every 60s; the row re-reads the host's cached
36
36
  snapshot every 15s, so no polling happens from the browser.
37
37
 
38
- ## Install
38
+ ## Install into DSH
39
39
 
40
- Published to npmjs on every release:
40
+ A DSH plugin is a package plus a row. The package has to be resolvable **from the profile
41
+ that mounts it**, and the row has to name it — the browser half only reaches the page as part
42
+ of that profile's client roster, which is composed at boot.
43
+
44
+ ### 1. Add the package to the profile
45
+
46
+ ```sh
47
+ dsh plugin --profile web add @virzz/dsh-plugin-deepseek-balance
48
+ ```
49
+
50
+ `dsh plugin` forwards everything after `--profile <name>` to pnpm **in the profile
51
+ directory**, so this is an ordinary `pnpm add` in `$DSH_HOME/profiles/web` — which is exactly
52
+ the `node_modules` tree the loader resolves row names from.
53
+
54
+ To leave the shipped `web` profile untouched, derive your own from it and install there:
41
55
 
42
56
  ```sh
43
- npm install @virzz/dsh-plugin-deepseek-balance
57
+ dsh --profile balance --from-default-profile web
58
+ dsh plugin --profile balance add @virzz/dsh-plugin-deepseek-balance
44
59
  ```
45
60
 
46
- Also mirrored to the GitHub npm registry:
61
+ The package is published to npmjs and to GitHub Packages. The command above resolves from
62
+ npmjs by default; to install from GitHub Packages, point the scope at it first:
47
63
 
48
64
  ```sh
49
65
  npm config set @virzz:registry https://npm.pkg.github.com
50
- npm install @virzz/dsh-plugin-deepseek-balance
51
66
  ```
52
67
 
53
- To mount it in a DSH profile, the package must also be resolvable from that profile and named
54
- by a row. With pnpm available that is `dsh plugin --profile web add <spec>`; without pnpm a
55
- link plus one patch row is equivalent:
68
+ <details>
69
+ <summary>Without pnpm</summary>
70
+
71
+ `dsh plugin add` does two things; both can be done by hand — put the package where the
72
+ profile can resolve it, and name it in the profile's own patch layer.
56
73
 
57
74
  ```sh
58
- ln -s /path/to/dsh-plugin-deepseek-balance ~/.dsh/profiles/web/node_modules/@virzz/dsh-plugin-deepseek-balance
75
+ mkdir -p ~/.dsh/profiles/web/node_modules/@virzz
76
+ ln -s /path/to/dsh-plugin-deepseek-balance \
77
+ ~/.dsh/profiles/web/node_modules/@virzz/dsh-plugin-deepseek-balance
59
78
  ```
60
79
 
61
80
  ```yaml
62
- # ~/.dsh/profiles/web/cordis.patch.yml
81
+ # ~/.dsh/profiles/web/cordis.patch.yml — applied after every bundle layer
63
82
  - insert:
64
83
  - id: deepseek-balance
65
84
  name: '@virzz/dsh-plugin-deepseek-balance'
66
85
  ```
86
+ </details>
87
+
88
+ ### 2. Provide the DeepSeek API key
89
+
90
+ The host half re-resolves the credential reference `DEEPSEEK_API_KEY` on every collector
91
+ start. Either of these works:
92
+
93
+ - **Settings → Models**, on the DeepSeek provider card — stored in `$DSH_HOME/.credentials.yaml`; or
94
+ - export it where DSH boots: `export DEEPSEEK_API_KEY=sk-...`
95
+
96
+ Nothing else needs it. The key never reaches the browser and never appears on a command
97
+ line: the collector receives it in its environment, and the read route exposes balance
98
+ figures only.
99
+
100
+ ### 3. Boot
101
+
102
+ ```sh
103
+ dsh --profile web # or: dsh web
104
+ ```
105
+
106
+ The row appears in the sidebar footer, directly above **Settings**:
107
+
108
+ ```
109
+ ◆ Cordis Plugin 0 running
110
+ ▤ DeepSeek 余额 $1058.69 · ¥-0.01
111
+ ⚙ 设置
112
+ ```
113
+
114
+ Hover it for the per-currency breakdown (total, granted, topped up) and the collection time;
115
+ click it to re-read the host's cache immediately.
116
+
117
+ ### 4. Verify without opening the UI
118
+
119
+ ```sh
120
+ dsh --profile web --dump-config | grep -A2 deepseek-balance # is the row composed?
121
+ curl -s http://127.0.0.1:8021/deepseek-balance # does the host half answer?
122
+ ```
123
+
124
+ The launcher prints its URL on boot; adjust the port if yours differs. A healthy answer:
125
+
126
+ ```json
127
+ {"ok":true,"available":true,"balances":[{"currency":"USD","total":"1058.69","granted":"0.00","toppedUp":"1058.69"}],"fetchedAt":1789030816379}
128
+ ```
129
+
130
+ ### Troubleshooting
131
+
132
+ | Symptom | What to check |
133
+ | --- | --- |
134
+ | Row reads `未配置密钥` | `DEEPSEEK_API_KEY` is not resolvable — set it in Settings → Models, or in the environment that boots DSH |
135
+ | Row reads `不可用` | Hover it: the tooltip carries the exact cause (`http-401`, `request-failed`, `poller-exited`, …) |
136
+ | Row reads `不可用`, tooltip says `subprocess 服务不可用` | The row activated before the subprocess service. It declares that as a hard dependency *and* retries every 5s, so it clears itself |
137
+ | No row at all | The client roster is composed at boot — restart the profile. `--dump-config` above shows whether the row is composed at all |
138
+ | Row only visible when the sidebar is expanded | Expected: in the 56px rail it collapses to a 36px circle showing the primary currency symbol |
139
+
140
+ ### Uninstall
141
+
142
+ ```sh
143
+ dsh plugin --profile web remove @virzz/dsh-plugin-deepseek-balance
144
+ ```
145
+
146
+ Or delete the row from `cordis.patch.yml` plus the `node_modules` entry, then restart.
67
147
 
68
148
  `dsh.client` in `package.json` puts `lib/client.js` into the browser roster that
69
149
  `@deepseek-ai/dsh-client-modules` composes into `window.__DSH_BOOT__`. The module id inside
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virzz/dsh-plugin-deepseek-balance",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "DeepSeek official account balance as a DSH sidebar status row, collected by one resident node process",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",