dsh-ollama-usage 0.1.2 → 0.1.3
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/lib/index.js +15 -15
- package/package.json +5 -18
package/lib/index.js
CHANGED
|
@@ -370,22 +370,22 @@ async function handleBridgeRequest(req, res) {
|
|
|
370
370
|
* ------------------------------------------------------------------ */
|
|
371
371
|
|
|
372
372
|
export default {
|
|
373
|
-
inject
|
|
373
|
+
// webServer 必须经 inject 声明:宿主 webServer 服务只能经 cordis inject 拿到,
|
|
374
|
+
// 启动时序上 ctx.get('webServer') 可能拿到 undefined(提供方 fiber 尚未激活),
|
|
375
|
+
// 导致 RPC 路由注册被跳过(参照 dsh-yolo-mode bridge-entry 头注与
|
|
376
|
+
// dsh-client-connection 的 inject: ['webServer'])。声明后 Cordis 会等
|
|
377
|
+
// webServer 可用再调用 apply,路由注册不再依赖启动顺序。
|
|
378
|
+
inject: ['timer', 'webServer'],
|
|
374
379
|
apply(ctx) {
|
|
375
|
-
// 1) RPC
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
)
|
|
385
|
-
console.log('[ollama-usage] RPC 路由已注册: ' + RPC_CHANNEL)
|
|
386
|
-
} catch (e) {
|
|
387
|
-
console.error('[ollama-usage] 路由注册失败: ' + String((e && e.message) || e))
|
|
388
|
-
}
|
|
380
|
+
// 1) RPC 路由注册:webServer 已由 inject 保证可用
|
|
381
|
+
try {
|
|
382
|
+
ctx.effect(
|
|
383
|
+
() => ctx.webServer.register({ kind: 'prefix', path: RPC_CHANNEL, handler: handleBridgeRequest }),
|
|
384
|
+
'ollama-usage: rpc bridge',
|
|
385
|
+
)
|
|
386
|
+
console.log('[ollama-usage] RPC 路由已注册: ' + RPC_CHANNEL)
|
|
387
|
+
} catch (e) {
|
|
388
|
+
console.error('[ollama-usage] 路由注册失败: ' + String((e && e.message) || e))
|
|
389
389
|
}
|
|
390
390
|
// 2) 自动刷新:失败不影响插件启动
|
|
391
391
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ollama-usage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "DeepSeek Harness 插件:可视化 Ollama Cloud 账号用量余量(每 5 小时会话用量 + 周用量),支持侧边栏双横条、设置页面板、API Key 与用量快照持久化、自动刷新与登录引导。Ollama Pro usage & remaining-quota visualization for DeepSeek Harness: 5-hour session + weekly quota bars in the sidebar footer, a full settings panel, persisted API key and usage snapshots, auto-refresh and login guidance.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,26 +19,15 @@
|
|
|
19
19
|
},
|
|
20
20
|
"client": {
|
|
21
21
|
"platform": "web",
|
|
22
|
-
"inject": [
|
|
23
|
-
"slots",
|
|
24
|
-
"connection",
|
|
25
|
-
"timer"
|
|
26
|
-
]
|
|
22
|
+
"inject": ["slots", "connection", "timer"]
|
|
27
23
|
}
|
|
28
24
|
},
|
|
29
25
|
"dshhub": {
|
|
30
26
|
"schemaVersion": 1,
|
|
31
27
|
"displayName": "dsh-ollama-usage",
|
|
32
28
|
"summary": "Ollama Cloud 用量余量可视化:会话(5h)/周用量双横条 + 设置页完整面板,Key 与快照持久化,自动刷新,登录引导。",
|
|
33
|
-
"categories": [
|
|
34
|
-
|
|
35
|
-
"Web UI",
|
|
36
|
-
"观测"
|
|
37
|
-
],
|
|
38
|
-
"surfaces": [
|
|
39
|
-
"host",
|
|
40
|
-
"web"
|
|
41
|
-
],
|
|
29
|
+
"categories": ["用量", "Web UI", "观测"],
|
|
30
|
+
"surfaces": ["host", "web"],
|
|
42
31
|
"capabilities": {
|
|
43
32
|
"provides": []
|
|
44
33
|
},
|
|
@@ -47,9 +36,7 @@
|
|
|
47
36
|
"node": ">=20"
|
|
48
37
|
},
|
|
49
38
|
"permissions": {
|
|
50
|
-
"network": [
|
|
51
|
-
"https://ollama.com"
|
|
52
|
-
]
|
|
39
|
+
"network": ["https://ollama.com"]
|
|
53
40
|
}
|
|
54
41
|
},
|
|
55
42
|
"files": [
|