@dsh-mobile/mobile-remote 3.3.0 → 3.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/FAQ.md +2 -2
- package/LICENSE +0 -0
- package/README.md +13 -8
- package/docs/PRIVACY-POLICY.en.md +26 -18
- package/docs/PRIVACY-POLICY.md +26 -18
- package/docs/SUPPORT.md +1 -1
- package/docs/TERMS-OF-SERVICE.en.md +5 -3
- package/docs/TERMS-OF-SERVICE.md +5 -3
- package/docs/USER-GUIDE.zh-CN.md +7 -6
- package/lib/account-usage-query.js +60 -60
- package/lib/account-usage.js +10 -10
- package/lib/api-helpers.js +114 -110
- package/lib/assistant-prefs.js +119 -76
- package/lib/auto-config.js +65 -65
- package/lib/backup.js +159 -123
- package/lib/break-reminder.js +45 -45
- package/lib/client.js +336 -138
- package/lib/config.js +234 -218
- package/lib/git-read-bundled-provider.js +27 -7
- package/lib/git-read-service.js +5 -5
- package/lib/host-compat.js +84 -84
- package/lib/http-util.js +17 -17
- package/lib/index.js +1670 -1511
- package/lib/memory/context.js +45 -40
- package/lib/memory/decay.js +93 -93
- package/lib/memory/extract.js +77 -77
- package/lib/memory/routes.js +33 -33
- package/lib/memory/store.js +239 -192
- package/lib/notify-copy.js +93 -93
- package/lib/permission-guide.js +86 -86
- package/lib/persona-cards.js +73 -61
- package/lib/phone-action-args.js +175 -0
- package/lib/phone-actions.js +227 -0
- package/lib/phone-announce.js +58 -0
- package/lib/proactive-material.js +42 -42
- package/lib/proactive.js +122 -119
- package/lib/protected-paths.js +205 -45
- package/lib/protocol.js +62 -23
- package/lib/push.js +29 -29
- package/lib/rate-limit.js +16 -16
- package/lib/relay/connector.js +334 -81
- package/lib/relay/crypto.js +15 -15
- package/lib/relay/devices.js +64 -32
- package/lib/relay/fingerprint.js +34 -34
- package/lib/relay/identity.js +26 -26
- package/lib/relay/mux.js +60 -46
- package/lib/relay/noise.js +40 -40
- package/lib/relay/on-demand.js +36 -31
- package/lib/relay/p2p.js +239 -0
- package/lib/relay/pairing.js +54 -15
- package/lib/relay/phone.js +63 -39
- package/lib/relay/serve.js +21 -21
- package/lib/relay/signal.js +69 -0
- package/lib/relay/ws-server.js +245 -0
- package/lib/reminders.js +15 -15
- package/lib/rpc-adapter.js +43 -43
- package/lib/session-list.js +31 -31
- package/lib/session-rotation.js +95 -95
- package/lib/session-title-cache.js +35 -35
- package/lib/session-title-refresh.js +51 -51
- package/lib/timeline.js +140 -140
- package/lib/turn-outline.js +104 -104
- package/package.json +11 -18
package/docs/USER-GUIDE.zh-CN.md
CHANGED
|
@@ -154,7 +154,7 @@ graph LR
|
|
|
154
154
|
|
|
155
155
|
## 4. 外出访问(虚拟组网 / 隧道)
|
|
156
156
|
|
|
157
|
-
> 共同前提:家里电脑保持开机、dsh 运行。本节是**免费、自己配置**的做法:原理是"虚拟局域网"——电脑和手机加入同一个虚拟网,手机无论在家 WiFi 还是户外流量都能直达电脑。不想装组网软件、愿意订阅时,用 [§5](#relay) 的加密中继(零配置,插件 3.2.6
|
|
157
|
+
> 共同前提:家里电脑保持开机、dsh 运行。本节是**免费、自己配置**的做法:原理是"虚拟局域网"——电脑和手机加入同一个虚拟网,手机无论在家 WiFi 还是户外流量都能直达电脑。不想装组网软件、愿意订阅时,用 [§5](#relay) 的加密中继(零配置,插件 3.2.6 起默认允许使用,配对手机后才连)。**禁止把 3080 端口直接映射/穿透到公网裸奔**。
|
|
158
158
|
|
|
159
159
|
### 4.1 方案一:蒲公英组网(已实测 ✅,免费版 3 个成员)
|
|
160
160
|
|
|
@@ -210,11 +210,11 @@ graph LR
|
|
|
210
210
|
|
|
211
211
|
## 5. 公开网络:加密中继
|
|
212
212
|
|
|
213
|
-
> **状态:公开中继已部署(`wss://dsh.claud.ing`,2026-11-16 上线);插件 3.2.6
|
|
213
|
+
> **状态:公开中继已部署(`wss://dsh.claud.ing`,2026-11-16 上线);插件 3.2.6 起默认允许使用,电脑按需才连(见下)。**
|
|
214
214
|
>
|
|
215
|
-
> **默认行为:**
|
|
215
|
+
> **默认行为:** 装好插件后桌面设置页就有「远程访问」,插件默认**允许**使用 `wss://dsh.claud.ing`;但**电脑只在配对过手机之后才去连中继**(或在你刚生成配对码、5 分钟内等手机来扫的时候)。装了插件却从没配对过手机的电脑,不会连我们的服务器;撤销最后一台手机、配对码过期没人用,连接也会断开。**局域网直连的地址与口令完全不变**,两种连接可以并存。完全不想用中继时设 `relay.enabled: false`。
|
|
216
216
|
>
|
|
217
|
-
>
|
|
217
|
+
> 公开网络是**订阅能力**:手机侧连接中继必须带账号签发的短期票据,未订阅会被拒绝;局域网直连不受影响,也不需要账号。同一份订阅还包含「导入自己写的人格卡」(三张内置人格卡始终免费)。
|
|
218
218
|
|
|
219
219
|
### 5.1 它解决什么
|
|
220
220
|
|
|
@@ -233,7 +233,7 @@ graph LR
|
|
|
233
233
|
|
|
234
234
|
> 中继地址必须是 `wss://`(加密)。App 与插件都会拒绝 `ws://`(仅本机测试用的回环地址除外)。
|
|
235
235
|
|
|
236
|
-
**2. 在电脑上确认**——3.2.6
|
|
236
|
+
**2. 在电脑上确认**——3.2.6 起随包补丁默认允许使用中继并指向公共中继(电脑只在配对过手机或有待用配对码时才去连);要改地址、加备份或关闭,在 profile 的 `cordis.patch.yml` 里覆盖同名条目:
|
|
237
237
|
|
|
238
238
|
```yaml
|
|
239
239
|
relay:
|
|
@@ -266,7 +266,7 @@ relay:
|
|
|
266
266
|
|
|
267
267
|
| 手机上的提示 | 通常是 |
|
|
268
268
|
|---|---|
|
|
269
|
-
| 找不到电脑 | 电脑没开机、DSH
|
|
269
|
+
| 找不到电脑 | 电脑没开机、DSH 没运行、这台电脑还没配对过手机(要先在桌面「远程访问」生成配对码并扫码一次)、被显式设置成 `relay.enabled: false`,或电脑到中继的连接断了(看电脑端面板状态) |
|
|
270
270
|
| 配对码无效、已过期或已被使用 | 配对码 5 分钟过期或已被用过;重新生成 |
|
|
271
271
|
| 电脑不认这台手机 | 这台手机已被撤销;重新配对 |
|
|
272
272
|
| 连不上中继服务器 | 手机网络问题,或中继宕机;配了多个中继时会自动换下一个 |
|
|
@@ -427,6 +427,7 @@ mkcert 192.168.1.100 172.16.x.x # 给电脑的局域网/组网 IP 签证书
|
|
|
427
427
|
**审批/回答**:agent 思考途中需要你拍板时,对话页弹出卡片——按选项选择(可多选),或输入你自己的答案后「提交」;工具需要更高权限时弹出「权限请求」,选「允许一次 / 拒绝」。与电脑端同一个待办,任一端回答后两端同时消失;也可点卡片右上角 ✕ 取消(agent 按取消继续)。agent 只是等待你普通回复时(状态点橙色),直接输入消息即可。
|
|
428
428
|
**新建会话**:首页「+ 新建会话」→ 选模式(标准/PTC/极简/创造)→ 可选工作目录(跨盘浏览、可新建文件夹)→ 创建。
|
|
429
429
|
**修改默认配置**:设置 → 默认 Agent 预设 / 默认权限预设 → 选择(作用于之后新建的会话,与 PC 端同一写入通道)。
|
|
430
|
+
**人格卡**:设置 → 助手 → 人格卡。默认是「无(默认)」:不向模型添加任何人格文字,不额外花 token;选了工作狂 / 生活助理 / 游戏玩家或自己导入的卡,模型才会看到那张卡的原文。随时可以选回「无(默认)」。
|
|
430
431
|
**深色模式**:设置 → 深色模式:跟随系统 / 深色 / 浅色。
|
|
431
432
|
**换主题**:设置 → 外观 → 主题,多套任选,每套都含明暗两套配色,跟随「深色模式」切换。
|
|
432
433
|
**换图标**:设置 → 外观 → App 图标,8 款任选。切换后若桌面没变,回桌面刷新一次即可。升级后**桌面上的旧快捷方式可能失效一次**,删掉从抽屉重拖一个即可。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
5
|
import { credentialRef } from "@deepseek-ai/dsh-credentials";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { homedir } from "node:os";
|
|
@@ -11,7 +11,7 @@ import { normalizeCodexUsage, normalizeDeepSeekBalance, normalizeOpenCodeUsage }
|
|
|
11
11
|
import { safeFailureReason } from "./api-helpers.js";
|
|
12
12
|
import { readSettingsSection, readSettingsSectionStrict } from "./host-compat.js";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
const pluginVersion = (() => {
|
|
16
16
|
try {
|
|
17
17
|
return createRequire(import.meta.url)("../package.json").version ?? "unknown";
|
|
@@ -20,7 +20,7 @@ const pluginVersion = (() => {
|
|
|
20
20
|
}
|
|
21
21
|
})();
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
function accountClientMetadata(client = {}) {
|
|
25
25
|
return {
|
|
26
26
|
version: typeof client.version === "string" && client.version !== "" ? client.version : pluginVersion,
|
|
@@ -31,7 +31,7 @@ function accountClientMetadata(client = {}) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
function deepSeekAccountService(ctx) {
|
|
36
36
|
try {
|
|
37
37
|
const service = ctx?.get?.("deepseekAccount");
|
|
@@ -41,10 +41,10 @@ function deepSeekAccountService(ctx) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
const DEFAULT_DEEPSEEK_TOP_UP = "https://platform.deepseek.com/top_up";
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
export function deriveKeyRef(provider) {
|
|
49
49
|
return `${String(provider).toUpperCase().replace(/[^A-Z0-9]+/g, "_")}_API_KEY`;
|
|
50
50
|
}
|
|
@@ -55,7 +55,7 @@ async function resolveCredentialValue(ctx, ref) {
|
|
|
55
55
|
const credentials = ctx.get("credentials");
|
|
56
56
|
if (credentials?.resolve) value = (await credentials.resolve(credentialRef(ref)))?.value;
|
|
57
57
|
} catch {
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
}
|
|
60
60
|
if ((!value || typeof value !== "string") && typeof process.env[ref] === "string") value = process.env[ref];
|
|
61
61
|
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
@@ -76,7 +76,7 @@ async function resolveOpenCodeCredential(ctx, profileRef) {
|
|
|
76
76
|
: undefined;
|
|
77
77
|
if (record?.kind === "api-key" && typeof record.key === "string" && record.key.trim() !== "") return record.key;
|
|
78
78
|
} catch {
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
}
|
|
81
81
|
for (const ref of ["OPENCODE_GO_API_KEY", "OPENCODE_API_KEY"]) {
|
|
82
82
|
const fallback = await resolveCredentialValue(ctx, ref);
|
|
@@ -101,19 +101,19 @@ async function loadCodexConnect() {
|
|
|
101
101
|
const entry = profileRequire.resolve("dsh-codex-connect");
|
|
102
102
|
return await import(pathToFileURL(entry).href);
|
|
103
103
|
} catch {
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
throw bareError;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
117
|
export async function queryDeepSeekAccountBalance(ctx, client = {}) {
|
|
118
118
|
const service = deepSeekAccountService(ctx);
|
|
119
119
|
if (!service) return { status: "unavailable" };
|
|
@@ -122,10 +122,10 @@ export async function queryDeepSeekAccountBalance(ctx, client = {}) {
|
|
|
122
122
|
try {
|
|
123
123
|
const state = await service.getState?.();
|
|
124
124
|
links = state?.links;
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
if (state && state.status !== "credential-stored") return { status: "signed-out", links };
|
|
127
127
|
} catch {
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
}
|
|
130
130
|
let balance;
|
|
131
131
|
try {
|
|
@@ -140,7 +140,7 @@ export async function queryDeepSeekAccountBalance(ctx, client = {}) {
|
|
|
140
140
|
const result = await service.getProfile?.(metadata);
|
|
141
141
|
if (result?.status === "ready") profile = result.value;
|
|
142
142
|
} catch {
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
146
146
|
status: "ready",
|
|
@@ -151,7 +151,7 @@ export async function queryDeepSeekAccountBalance(ctx, client = {}) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
function preferredWallet(wallets) {
|
|
156
156
|
return wallets.find((wallet) => wallet?.currency === "CNY") ?? wallets[0];
|
|
157
157
|
}
|
|
@@ -183,7 +183,7 @@ async function queryDeepSeekUsage(ctx, client = {}) {
|
|
|
183
183
|
}
|
|
184
184
|
const key = await resolveCredentialValue(ctx, "DEEPSEEK_API_KEY");
|
|
185
185
|
if (!key) {
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
if (account.status === "failed") {
|
|
188
188
|
return { configured: true, failed: true, failedId: "deepseek", failedReason: account.failedReason };
|
|
189
189
|
}
|
|
@@ -215,16 +215,16 @@ async function queryDeepSeekUsage(ctx, client = {}) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
228
|
export function codexProxyUrl(ctx, mod) {
|
|
229
229
|
const namespace = mod.OPENAI_CODEX_SETTINGS_NAMESPACE ?? "llm-openai-codex";
|
|
230
230
|
let settingsSvc;
|
|
@@ -233,16 +233,16 @@ export function codexProxyUrl(ctx, mod) {
|
|
|
233
233
|
} catch {
|
|
234
234
|
settingsSvc = undefined;
|
|
235
235
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
246
|
const read = readSettingsSectionStrict(settingsSvc, namespace);
|
|
247
247
|
if (!read.ok) return { enabled: true, url: undefined, unreadable: true, reason: read.reason };
|
|
248
248
|
const settings = read.value ?? {};
|
|
@@ -251,7 +251,7 @@ export function codexProxyUrl(ctx, mod) {
|
|
|
251
251
|
? mod.resolveOpenAICodexSettings(settings)
|
|
252
252
|
: settings;
|
|
253
253
|
const enabled = resolved?.enableProxy === true || settings?.enableProxy === true;
|
|
254
|
-
|
|
254
|
+
|
|
255
255
|
if (!enabled) return { enabled: false, url: undefined };
|
|
256
256
|
const url = typeof mod.resolveOpenAICodexProxyUrl === "function"
|
|
257
257
|
? mod.resolveOpenAICodexProxyUrl(resolved)
|
|
@@ -277,16 +277,16 @@ async function queryCodexUsage(ctx) {
|
|
|
277
277
|
let proxyManager;
|
|
278
278
|
try {
|
|
279
279
|
store = new mod.OpenAICodexCredentialStore();
|
|
280
|
-
|
|
280
|
+
|
|
281
281
|
captured = typeof store.captureActiveAccount === "function" ? await store.captureActiveAccount() : store;
|
|
282
282
|
if (!captured) return { configured: false };
|
|
283
283
|
const status = await mod.openAICodexAuthStatus(captured);
|
|
284
284
|
if (status?.authenticated !== true) return { configured: false };
|
|
285
285
|
const proxy = codexProxyUrl(ctx, mod);
|
|
286
286
|
if (proxy.enabled && (!proxy.url || typeof mod.OpenAICodexProxyManager !== "function")) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
290
|
return {
|
|
291
291
|
configured: true, failed: true, failedId: "codex",
|
|
292
292
|
failedReason: proxy.unreadable
|
|
@@ -302,7 +302,7 @@ async function queryCodexUsage(ctx) {
|
|
|
302
302
|
const accounts = typeof captured.accounts === "function" ? await captured.accounts() : [];
|
|
303
303
|
active = Array.isArray(accounts) ? accounts.find((account) => account?.active === true) : undefined;
|
|
304
304
|
} catch {
|
|
305
|
-
|
|
305
|
+
|
|
306
306
|
}
|
|
307
307
|
return {
|
|
308
308
|
configured: true,
|
|
@@ -320,14 +320,14 @@ async function queryCodexUsage(ctx) {
|
|
|
320
320
|
},
|
|
321
321
|
};
|
|
322
322
|
} catch (err) {
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
|
|
324
|
+
|
|
325
325
|
return { configured: true, failed: true, failedId: "codex", failedReason: safeFailureReason(err) };
|
|
326
326
|
} finally {
|
|
327
327
|
try {
|
|
328
328
|
await proxyManager?.dispose?.();
|
|
329
329
|
} catch {
|
|
330
|
-
|
|
330
|
+
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
}
|
|
@@ -335,9 +335,9 @@ async function queryCodexUsage(ctx) {
|
|
|
335
335
|
async function queryOpenCodeUsage(ctx) {
|
|
336
336
|
let profile;
|
|
337
337
|
try {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
341
|
const settingsSvc = ctx?.get?.("settings");
|
|
342
342
|
const section = readSettingsSection(settingsSvc, "llm-pi-ai");
|
|
343
343
|
profile = section?.providers?.["opencode-go"];
|
|
@@ -346,7 +346,7 @@ async function queryOpenCodeUsage(ctx) {
|
|
|
346
346
|
}
|
|
347
347
|
const key = await resolveOpenCodeCredential(ctx, profile?.apiKeyEnv);
|
|
348
348
|
if (!key) return { configured: false };
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
const url = "https://opencode.ai/zen/go/v1/usage";
|
|
351
351
|
try {
|
|
352
352
|
const response = await fetch(url, {
|
|
@@ -378,9 +378,9 @@ export async function queryAccountUsage(ctx, client = {}) {
|
|
|
378
378
|
sources,
|
|
379
379
|
availableCount: sources.length,
|
|
380
380
|
failedCount: failures.length,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
384
|
...(failures.length > 0 ? {
|
|
385
385
|
failures: failures.map((result) => ({
|
|
386
386
|
id: result.failedId ?? "unknown",
|
package/lib/account-usage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// 用量与额度领域归一化:保持无运行时依赖,便于服务端单测与其它宿主复用。
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
4
|
export function usageWindowLabel(seconds) {
|
|
5
5
|
const value = Number(seconds);
|
|
6
6
|
if (!Number.isFinite(value) || value <= 0) return null;
|
|
@@ -37,7 +37,7 @@ function isoFromDate(value) {
|
|
|
37
37
|
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
export function normalizeDeepSeekBalance(data) {
|
|
42
42
|
const infos = data && typeof data === 'object' && !Array.isArray(data) ? data.balance_infos : undefined;
|
|
43
43
|
const validInfos = Array.isArray(infos) ? infos.filter((item) => item && typeof item === 'object' && !Array.isArray(item)) : [];
|
|
@@ -51,10 +51,10 @@ export function normalizeDeepSeekBalance(data) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
58
|
export function normalizeCodexUsage(usage) {
|
|
59
59
|
if (!usage || typeof usage !== 'object' || Array.isArray(usage)) throw new Error('invalid codex usage');
|
|
60
60
|
if (usage.rateLimits !== undefined && !Array.isArray(usage.rateLimits)) throw new Error('invalid codex rate limits');
|
|
@@ -107,7 +107,7 @@ export function normalizeCodexUsage(usage) {
|
|
|
107
107
|
} else if (finiteNumber(credits.balance) !== undefined) {
|
|
108
108
|
codexCredits = { unlimited: false, balance: String(credits.balance) };
|
|
109
109
|
} else {
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
codexCredits = { unlimited: false };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ export function normalizeCodexUsage(usage) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
export function normalizeOpenCodeUsage(payload) {
|
|
124
124
|
const usage = payload && typeof payload === 'object' && !Array.isArray(payload) ? (payload.usage ?? payload) : undefined;
|
|
125
125
|
if (!usage || typeof usage !== 'object' || Array.isArray(usage)) throw new Error('invalid opencode usage');
|
|
@@ -131,7 +131,7 @@ export function normalizeOpenCodeUsage(payload) {
|
|
|
131
131
|
if (status !== undefined && status !== null && status !== 'ok' && status !== 'rate-limited') continue;
|
|
132
132
|
const usedPercent = clampPercent(detail.percent);
|
|
133
133
|
if (usedPercent === undefined) continue;
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
const resetAt = usedPercent === 0 ? undefined : isoFromDate(detail.resetsAt);
|
|
136
136
|
windows.push({
|
|
137
137
|
window: label,
|