dsh-codearts 0.5.2 → 1.0.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/lib/bin.mjs +9 -21
- package/lib/client/index.d.cts +25 -6
- package/lib/client/index.js +817 -387
- package/lib/index.d.mts +32 -23
- package/lib/index.mjs +305 -122
- package/lib/{usage-B4vQb1sP.mjs → usage-BEoMNRwo.mjs} +227 -45
- package/package.json +1 -1
package/lib/bin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { A as isBenefitModel, N as codeartsAccountsPath, j as CodeArtsAccountStore, n as codeartsUsagePath, r as discoverModels, t as CodeArtsUsageTracker, u as fetchCallerIdentity } from "./usage-BEoMNRwo.mjs";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
//#region src/version.ts
|
|
5
|
-
const CODEARTS_VERSION = "0.
|
|
5
|
+
const CODEARTS_VERSION = "1.0.0";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/bin.ts
|
|
8
8
|
/**
|
|
@@ -38,7 +38,7 @@ const CODEARTS_VERSION = "0.5.2";
|
|
|
38
38
|
* @module dsh-codearts/bin
|
|
39
39
|
*/
|
|
40
40
|
/** Bumped when a `--json` document changes shape (5: identity backfill). */
|
|
41
|
-
const JSON_SCHEMA_VERSION =
|
|
41
|
+
const JSON_SCHEMA_VERSION = 6;
|
|
42
42
|
/**
|
|
43
43
|
* 一句话描述一个账号,供人类可读输出用。
|
|
44
44
|
*
|
|
@@ -70,11 +70,7 @@ async function status(jsonOutput) {
|
|
|
70
70
|
version: CODEARTS_VERSION,
|
|
71
71
|
signedIn: accounts.length > 0,
|
|
72
72
|
signable: accounts.some((account) => account.signable),
|
|
73
|
-
accounts
|
|
74
|
-
models: FALLBACK_CODEARTS_MODELS.map((m) => ({
|
|
75
|
-
id: m.id,
|
|
76
|
-
name: m.name
|
|
77
|
-
}))
|
|
73
|
+
accounts
|
|
78
74
|
};
|
|
79
75
|
if (cred !== void 0) {
|
|
80
76
|
if (cred.label !== void 0) out.label = cred.label;
|
|
@@ -91,15 +87,14 @@ async function status(jsonOutput) {
|
|
|
91
87
|
for (const account of accounts) process.stdout.write(` - ${describeAccount(account)}\n`);
|
|
92
88
|
if (!out.signable) process.stdout.write("warning: no account carries AK/SK, so requests cannot be signed and chats will be rejected\n");
|
|
93
89
|
} else process.stdout.write("not signed in (no account stored; sign in from the CodeArts settings card)\n");
|
|
94
|
-
process.stdout.write(`models
|
|
95
|
-
for (const m of out.models) process.stdout.write(` - ${m.id} ${m.name}\n`);
|
|
90
|
+
process.stdout.write("models: CLI 不缓存目录,跑 `dsh-codearts models` 现问上游\n");
|
|
96
91
|
return out.signedIn ? 0 : 1;
|
|
97
92
|
}
|
|
98
93
|
/**
|
|
99
94
|
* 动态发现当前可用模型(三路:内置 / 限时福利 / agent-center)。
|
|
100
95
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
96
|
+
* 这是排查「模型选择器里没有某个模型」的第一手段:它打印的是上游真实返回。
|
|
97
|
+
* 未登录时就是没有目录,直接说明原因 —— 不打印手维护的种子清单冒充上游结果。
|
|
103
98
|
*/
|
|
104
99
|
async function models(jsonOutput) {
|
|
105
100
|
if ((await store().list()).length === 0) {
|
|
@@ -108,16 +103,9 @@ async function models(jsonOutput) {
|
|
|
108
103
|
version: CODEARTS_VERSION,
|
|
109
104
|
discovered: false,
|
|
110
105
|
reason: "not signed in",
|
|
111
|
-
models:
|
|
112
|
-
id: m.id,
|
|
113
|
-
name: m.name,
|
|
114
|
-
benefit: isBenefitModel(m.id)
|
|
115
|
-
}))
|
|
106
|
+
models: []
|
|
116
107
|
}, null, 2) + "\n");
|
|
117
|
-
else
|
|
118
|
-
process.stdout.write("not signed in — showing the built-in seed catalog\n");
|
|
119
|
-
for (const m of FALLBACK_CODEARTS_MODELS) process.stdout.write(` - ${m.id} ${m.name}${isBenefitModel(m.id) ? " [benefit]" : ""}\n`);
|
|
120
|
-
}
|
|
108
|
+
else process.stdout.write("not signed in — 没有目录可展示(不会用种子清单冒充上游返回)\n");
|
|
121
109
|
return 1;
|
|
122
110
|
}
|
|
123
111
|
const outcome = await discoverModels(store());
|
package/lib/client/index.d.cts
CHANGED
|
@@ -2,6 +2,10 @@ import { Context } from "@deepseek-ai/cordis";
|
|
|
2
2
|
//#region src/client/locales.d.ts
|
|
3
3
|
interface CodeArtsSettingsKey {
|
|
4
4
|
tabLabel: string;
|
|
5
|
+
tabsLabel: string;
|
|
6
|
+
tabAccounts: string;
|
|
7
|
+
tabModels: string;
|
|
8
|
+
tabUsage: string;
|
|
5
9
|
cardTitle: string;
|
|
6
10
|
statusSignedIn: string;
|
|
7
11
|
statusSignedOut: string;
|
|
@@ -19,10 +23,9 @@ interface CodeArtsSettingsKey {
|
|
|
19
23
|
saveToken: string;
|
|
20
24
|
expiredHint: string;
|
|
21
25
|
accountsTitle: string;
|
|
22
|
-
accountsShow: string;
|
|
23
|
-
accountsHide: string;
|
|
24
26
|
accountRemove: string;
|
|
25
27
|
addAccount: string;
|
|
28
|
+
pasteTokenAdd: string;
|
|
26
29
|
accountsRotateHint: string;
|
|
27
30
|
accountNeedsSignIn: string;
|
|
28
31
|
accountNoKey: string;
|
|
@@ -34,7 +37,14 @@ interface CodeArtsSettingsKey {
|
|
|
34
37
|
optionalModelsAllHint: string;
|
|
35
38
|
selectedCount: string;
|
|
36
39
|
selectAll: string;
|
|
37
|
-
|
|
40
|
+
benefit: string;
|
|
41
|
+
benefitBlocked: string;
|
|
42
|
+
benefitBlockedHint: string;
|
|
43
|
+
refreshModels: string;
|
|
44
|
+
refreshing: string;
|
|
45
|
+
refreshed: string;
|
|
46
|
+
refreshStale: string;
|
|
47
|
+
refreshFailed: string;
|
|
38
48
|
saveModels: string;
|
|
39
49
|
saving: string;
|
|
40
50
|
saved: string;
|
|
@@ -46,7 +56,11 @@ interface CodeArtsSettingsKey {
|
|
|
46
56
|
modelsLoading: string;
|
|
47
57
|
usageTitle: string;
|
|
48
58
|
usageToday: string;
|
|
59
|
+
usageTodayTotal: string;
|
|
60
|
+
usageLast30: string;
|
|
61
|
+
usageByAccount: string;
|
|
49
62
|
usageRequests: string;
|
|
63
|
+
usageRequestCount: string;
|
|
50
64
|
usageTokens: string;
|
|
51
65
|
usageAllTime: string;
|
|
52
66
|
usageByModel: string;
|
|
@@ -57,19 +71,24 @@ interface CodeArtsSettingsKey {
|
|
|
57
71
|
usageStateDisabled: string;
|
|
58
72
|
usageNoQuota: string;
|
|
59
73
|
usageEmpty: string;
|
|
60
|
-
|
|
61
|
-
creditsRemaining: string;
|
|
74
|
+
creditsUnit: string;
|
|
62
75
|
creditsUsed: string;
|
|
63
|
-
|
|
76
|
+
creditsUsedOfTotal: string;
|
|
77
|
+
creditsTotal: string;
|
|
78
|
+
creditsExpiringShort: string;
|
|
79
|
+
creditsUpdated: string;
|
|
64
80
|
creditsReset: string;
|
|
81
|
+
creditsDetailLink: string;
|
|
65
82
|
creditsTokensToday: string;
|
|
66
83
|
creditsTokensBalance: string;
|
|
67
84
|
creditsUnavailable: string;
|
|
85
|
+
creditsNeedSignIn: string;
|
|
68
86
|
creditsDock: string;
|
|
69
87
|
creditsDockTitle: string;
|
|
70
88
|
claimButton: string;
|
|
71
89
|
claimButtonDone: string;
|
|
72
90
|
claimPending: string;
|
|
91
|
+
claimAll: string;
|
|
73
92
|
claimHint: string;
|
|
74
93
|
claimDone: string;
|
|
75
94
|
claimAlready: string;
|