@eddyskywalker/dsh-chatgpt-subscription 0.8.4 → 0.9.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/CHANGELOG.md +45 -0
- package/README.md +93 -38
- package/lib/client.js +2126 -1693
- package/lib/client.js.map +1 -1
- package/lib/index.js +7597 -2781
- package/lib/types/client/claude/ClaudeComposerQuota.d.ts +33 -0
- package/lib/types/client/claude/ClaudeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/{zhipu/ZhipuSection.d.ts → claude/ClaudeSection.d.ts} +2 -2
- package/lib/types/client/claude/ClaudeSection.d.ts.map +1 -0
- package/lib/types/client/claude/locales.d.ts +444 -0
- package/lib/types/client/claude/locales.d.ts.map +1 -0
- package/lib/types/client/claude/styles.d.ts +15 -0
- package/lib/types/client/claude/styles.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/host/claude/__probe-assert.d.ts +2 -0
- package/lib/types/host/claude/__probe-assert.d.ts.map +1 -0
- package/lib/types/host/claude/account-pool.d.ts +580 -0
- package/lib/types/host/claude/account-pool.d.ts.map +1 -0
- package/lib/types/host/claude/adapter.d.ts +267 -0
- package/lib/types/host/claude/adapter.d.ts.map +1 -0
- package/lib/types/host/claude/adopt.d.ts +292 -0
- package/lib/types/host/claude/adopt.d.ts.map +1 -0
- package/lib/types/host/claude/client.d.ts +513 -0
- package/lib/types/host/claude/client.d.ts.map +1 -0
- package/lib/types/host/claude/mapper.d.ts +510 -0
- package/lib/types/host/claude/mapper.d.ts.map +1 -0
- package/lib/types/host/claude/model-catalog.d.ts +365 -0
- package/lib/types/host/claude/model-catalog.d.ts.map +1 -0
- package/lib/types/host/claude/oauth.d.ts +393 -0
- package/lib/types/host/claude/oauth.d.ts.map +1 -0
- package/lib/types/host/claude/routes.d.ts +128 -0
- package/lib/types/host/claude/routes.d.ts.map +1 -0
- package/lib/types/host/claude/token-store.d.ts +312 -0
- package/lib/types/host/claude/token-store.d.ts.map +1 -0
- package/lib/types/host/claude/types.d.ts +237 -0
- package/lib/types/host/claude/types.d.ts.map +1 -0
- package/lib/types/index.d.ts +10 -7
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/__probe-claude-import.d.ts +2 -0
- package/lib/types/shared/__probe-claude-import.d.ts.map +1 -0
- package/lib/types/shared/claude-contracts.d.ts +337 -0
- package/lib/types/shared/claude-contracts.d.ts.map +1 -0
- package/package.json +1 -1
- package/lib/types/client/zhipu/ZhipuComposerQuota.d.ts +0 -26
- package/lib/types/client/zhipu/ZhipuComposerQuota.d.ts.map +0 -1
- package/lib/types/client/zhipu/ZhipuSection.d.ts.map +0 -1
- package/lib/types/client/zhipu/locales.d.ts +0 -275
- package/lib/types/client/zhipu/locales.d.ts.map +0 -1
- package/lib/types/client/zhipu/styles.d.ts +0 -12
- package/lib/types/client/zhipu/styles.d.ts.map +0 -1
- package/lib/types/host/zhipu/account-pool.d.ts +0 -43
- package/lib/types/host/zhipu/account-pool.d.ts.map +0 -1
- package/lib/types/host/zhipu/adapter.d.ts +0 -93
- package/lib/types/host/zhipu/adapter.d.ts.map +0 -1
- package/lib/types/host/zhipu/client.d.ts +0 -153
- package/lib/types/host/zhipu/client.d.ts.map +0 -1
- package/lib/types/host/zhipu/mapper.d.ts +0 -111
- package/lib/types/host/zhipu/mapper.d.ts.map +0 -1
- package/lib/types/host/zhipu/model-catalog.d.ts +0 -73
- package/lib/types/host/zhipu/model-catalog.d.ts.map +0 -1
- package/lib/types/host/zhipu/routes.d.ts +0 -33
- package/lib/types/host/zhipu/routes.d.ts.map +0 -1
- package/lib/types/host/zhipu/token-store.d.ts +0 -112
- package/lib/types/host/zhipu/token-store.d.ts.map +0 -1
- package/lib/types/host/zhipu/types.d.ts +0 -125
- package/lib/types/host/zhipu/types.d.ts.map +0 -1
- package/lib/types/shared/zhipu-contracts.d.ts +0 -164
- package/lib/types/shared/zhipu-contracts.d.ts.map +0 -1
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
export declare const NS_ZHIPU = "dsh-zhipu";
|
|
2
|
-
export declare const zh: {
|
|
3
|
-
readonly title: "GLM(智谱 Coding Plan)";
|
|
4
|
-
readonly pageDesc: "添加智谱 / Z.ai 的 GLM Coding Plan API Key,管理可用模型、上下文窗口与额度。";
|
|
5
|
-
readonly account: "账号";
|
|
6
|
-
readonly signedIn: "已登录";
|
|
7
|
-
readonly signedOut: "未登录";
|
|
8
|
-
readonly region: "区域";
|
|
9
|
-
readonly regionIntl: "国际区 (api.z.ai)";
|
|
10
|
-
readonly regionCn: "国区 (open.bigmodel.cn)";
|
|
11
|
-
readonly keyHint: "Key 尾号";
|
|
12
|
-
readonly plan: "套餐";
|
|
13
|
-
readonly planUnknown: "—";
|
|
14
|
-
readonly renews: "续费于";
|
|
15
|
-
readonly authenticatedAt: "添加时间";
|
|
16
|
-
readonly storage: "凭据存储";
|
|
17
|
-
readonly storageNotice: "API Key 由 Host 保存于本地加密存储,不会进入浏览器。";
|
|
18
|
-
readonly signOut: "注销";
|
|
19
|
-
readonly addKeySection: "添加 API Key";
|
|
20
|
-
readonly addKeyHint: "在对应开放平台的「API Keys」页创建 Key 后粘贴到此处。它必须来自你订阅 Coding Plan 的那个平台:国区 Key 与国际区 Key 互不通用,开放平台(/api/paas/v4)的通用 Key 在订阅接口上会被拒绝。";
|
|
21
|
-
readonly keyPlaceholder: "粘贴 GLM Coding Plan API Key";
|
|
22
|
-
readonly keySave: "保存并验证";
|
|
23
|
-
readonly keySaving: "验证中...";
|
|
24
|
-
readonly keySaved: "已保存";
|
|
25
|
-
readonly connection: "连接";
|
|
26
|
-
readonly provider: "Provider";
|
|
27
|
-
readonly providerValue: "GLM(智谱 Coding Plan)· zhipu-coding-plan";
|
|
28
|
-
readonly connectionState: "连接状态";
|
|
29
|
-
readonly connected: "已连接";
|
|
30
|
-
readonly untested: "未测试";
|
|
31
|
-
readonly testConnection: "测试连接";
|
|
32
|
-
readonly testingConnection: "测试中...";
|
|
33
|
-
readonly routeOwned: "模型路由由本插件提供";
|
|
34
|
-
readonly routeConflict: "模型路由已被其他 Provider 占用:{detail}。请在 DSH 设置中移除重复的 Provider 配置后重试。";
|
|
35
|
-
readonly modelsSection: "模型";
|
|
36
|
-
readonly enableProvider: "启用此供应商";
|
|
37
|
-
readonly modelsHint: "勾选后模型才会出现在对话页的模型选择列表中;全部取消勾选或关闭上方开关可在列表中隐藏该供应商。";
|
|
38
|
-
readonly refreshCatalog: "刷新模型目录";
|
|
39
|
-
readonly refreshingCatalog: "刷新中...";
|
|
40
|
-
readonly selectAll: "全选";
|
|
41
|
-
readonly unselectAll: "全不选";
|
|
42
|
-
readonly effectiveWindow: "有效窗口";
|
|
43
|
-
readonly enhanced: "增强功能";
|
|
44
|
-
readonly defaultReasoningEffort: "默认思考深度";
|
|
45
|
-
readonly defaultReasoningEffortHint: "仅对声明了思考档位的模型生效。上游只接受 low / high / max,其余档位会收敛到最近的可用档位后发出(不支持的档位会直接报错)。";
|
|
46
|
-
readonly defaultEffortAuto: "使用 Provider 默认值";
|
|
47
|
-
readonly contextWindowSection: "模型上下文窗口";
|
|
48
|
-
readonly contextWindowHint: "默认取该模型官方声明的上下文窗口;可覆盖为自定义容量,该值用于 DSH 的压缩与溢出判断,可输入 1M、512K、200K 等容量。";
|
|
49
|
-
readonly contextWindowReset: "恢复默认";
|
|
50
|
-
readonly contextWindowResetAll: "全部恢复默认";
|
|
51
|
-
readonly contextWindowResetAllConfirm: "确定把已改过的模型上下文窗口全部恢复为默认值吗?";
|
|
52
|
-
readonly contextWindowNoneEnabled: "还没有勾选任何模型。在上方勾选后,这里会出现该模型的上下文窗口设置。";
|
|
53
|
-
readonly save: "保存";
|
|
54
|
-
readonly saved: "已保存";
|
|
55
|
-
readonly saving: "保存中...";
|
|
56
|
-
readonly quotaSection: "用量与配额";
|
|
57
|
-
readonly quotaDesc: "数据来自 GLM Coding Plan 的用量接口,页面可见时最多每 60 秒刷新一次。Coding Plan 同时受 5 小时额度与每周额度限制。";
|
|
58
|
-
readonly refreshQuota: "刷新用量";
|
|
59
|
-
readonly refreshingQuota: "刷新中...";
|
|
60
|
-
readonly quotaEmpty: "暂无配额数据,点击「刷新用量」重试。";
|
|
61
|
-
readonly quotaUnavailable: "该账号没有可用的配额数据(通常是套餐未生效,或 Key 不属于 Coding Plan)。";
|
|
62
|
-
readonly quotaError: "配额读取失败";
|
|
63
|
-
readonly updatedAt: "更新时间:{time}";
|
|
64
|
-
readonly loading: "加载中...";
|
|
65
|
-
readonly tokens: "tokens";
|
|
66
|
-
readonly left: "剩余";
|
|
67
|
-
readonly resetAt: "重置于";
|
|
68
|
-
readonly now: "即将重置";
|
|
69
|
-
readonly accountPool: string;
|
|
70
|
-
readonly addAccount: string;
|
|
71
|
-
readonly accountCount: string;
|
|
72
|
-
readonly primaryAccount: string;
|
|
73
|
-
readonly activeAccount: string;
|
|
74
|
-
readonly setPrimary: string;
|
|
75
|
-
readonly deleteAccount: string;
|
|
76
|
-
readonly cooling: string;
|
|
77
|
-
readonly cooldownLeft: string;
|
|
78
|
-
readonly clearCooldown: string;
|
|
79
|
-
readonly needsRelogin: string;
|
|
80
|
-
readonly relogin: string;
|
|
81
|
-
readonly rotationStrategy: string;
|
|
82
|
-
readonly strategySequential: string;
|
|
83
|
-
readonly strategyRoundRobin: string;
|
|
84
|
-
readonly strategySticky: string;
|
|
85
|
-
readonly noAccounts: string;
|
|
86
|
-
readonly email: string;
|
|
87
|
-
readonly expires: string;
|
|
88
|
-
readonly lastUsed: string;
|
|
89
|
-
readonly accountId: string;
|
|
90
|
-
};
|
|
91
|
-
export declare const en: Record<keyof typeof zh, string>;
|
|
92
|
-
export declare const dictionaries: {
|
|
93
|
-
zh: {
|
|
94
|
-
readonly title: "GLM(智谱 Coding Plan)";
|
|
95
|
-
readonly pageDesc: "添加智谱 / Z.ai 的 GLM Coding Plan API Key,管理可用模型、上下文窗口与额度。";
|
|
96
|
-
readonly account: "账号";
|
|
97
|
-
readonly signedIn: "已登录";
|
|
98
|
-
readonly signedOut: "未登录";
|
|
99
|
-
readonly region: "区域";
|
|
100
|
-
readonly regionIntl: "国际区 (api.z.ai)";
|
|
101
|
-
readonly regionCn: "国区 (open.bigmodel.cn)";
|
|
102
|
-
readonly keyHint: "Key 尾号";
|
|
103
|
-
readonly plan: "套餐";
|
|
104
|
-
readonly planUnknown: "—";
|
|
105
|
-
readonly renews: "续费于";
|
|
106
|
-
readonly authenticatedAt: "添加时间";
|
|
107
|
-
readonly storage: "凭据存储";
|
|
108
|
-
readonly storageNotice: "API Key 由 Host 保存于本地加密存储,不会进入浏览器。";
|
|
109
|
-
readonly signOut: "注销";
|
|
110
|
-
readonly addKeySection: "添加 API Key";
|
|
111
|
-
readonly addKeyHint: "在对应开放平台的「API Keys」页创建 Key 后粘贴到此处。它必须来自你订阅 Coding Plan 的那个平台:国区 Key 与国际区 Key 互不通用,开放平台(/api/paas/v4)的通用 Key 在订阅接口上会被拒绝。";
|
|
112
|
-
readonly keyPlaceholder: "粘贴 GLM Coding Plan API Key";
|
|
113
|
-
readonly keySave: "保存并验证";
|
|
114
|
-
readonly keySaving: "验证中...";
|
|
115
|
-
readonly keySaved: "已保存";
|
|
116
|
-
readonly connection: "连接";
|
|
117
|
-
readonly provider: "Provider";
|
|
118
|
-
readonly providerValue: "GLM(智谱 Coding Plan)· zhipu-coding-plan";
|
|
119
|
-
readonly connectionState: "连接状态";
|
|
120
|
-
readonly connected: "已连接";
|
|
121
|
-
readonly untested: "未测试";
|
|
122
|
-
readonly testConnection: "测试连接";
|
|
123
|
-
readonly testingConnection: "测试中...";
|
|
124
|
-
readonly routeOwned: "模型路由由本插件提供";
|
|
125
|
-
readonly routeConflict: "模型路由已被其他 Provider 占用:{detail}。请在 DSH 设置中移除重复的 Provider 配置后重试。";
|
|
126
|
-
readonly modelsSection: "模型";
|
|
127
|
-
readonly enableProvider: "启用此供应商";
|
|
128
|
-
readonly modelsHint: "勾选后模型才会出现在对话页的模型选择列表中;全部取消勾选或关闭上方开关可在列表中隐藏该供应商。";
|
|
129
|
-
readonly refreshCatalog: "刷新模型目录";
|
|
130
|
-
readonly refreshingCatalog: "刷新中...";
|
|
131
|
-
readonly selectAll: "全选";
|
|
132
|
-
readonly unselectAll: "全不选";
|
|
133
|
-
readonly effectiveWindow: "有效窗口";
|
|
134
|
-
readonly enhanced: "增强功能";
|
|
135
|
-
readonly defaultReasoningEffort: "默认思考深度";
|
|
136
|
-
readonly defaultReasoningEffortHint: "仅对声明了思考档位的模型生效。上游只接受 low / high / max,其余档位会收敛到最近的可用档位后发出(不支持的档位会直接报错)。";
|
|
137
|
-
readonly defaultEffortAuto: "使用 Provider 默认值";
|
|
138
|
-
readonly contextWindowSection: "模型上下文窗口";
|
|
139
|
-
readonly contextWindowHint: "默认取该模型官方声明的上下文窗口;可覆盖为自定义容量,该值用于 DSH 的压缩与溢出判断,可输入 1M、512K、200K 等容量。";
|
|
140
|
-
readonly contextWindowReset: "恢复默认";
|
|
141
|
-
readonly contextWindowResetAll: "全部恢复默认";
|
|
142
|
-
readonly contextWindowResetAllConfirm: "确定把已改过的模型上下文窗口全部恢复为默认值吗?";
|
|
143
|
-
readonly contextWindowNoneEnabled: "还没有勾选任何模型。在上方勾选后,这里会出现该模型的上下文窗口设置。";
|
|
144
|
-
readonly save: "保存";
|
|
145
|
-
readonly saved: "已保存";
|
|
146
|
-
readonly saving: "保存中...";
|
|
147
|
-
readonly quotaSection: "用量与配额";
|
|
148
|
-
readonly quotaDesc: "数据来自 GLM Coding Plan 的用量接口,页面可见时最多每 60 秒刷新一次。Coding Plan 同时受 5 小时额度与每周额度限制。";
|
|
149
|
-
readonly refreshQuota: "刷新用量";
|
|
150
|
-
readonly refreshingQuota: "刷新中...";
|
|
151
|
-
readonly quotaEmpty: "暂无配额数据,点击「刷新用量」重试。";
|
|
152
|
-
readonly quotaUnavailable: "该账号没有可用的配额数据(通常是套餐未生效,或 Key 不属于 Coding Plan)。";
|
|
153
|
-
readonly quotaError: "配额读取失败";
|
|
154
|
-
readonly updatedAt: "更新时间:{time}";
|
|
155
|
-
readonly loading: "加载中...";
|
|
156
|
-
readonly tokens: "tokens";
|
|
157
|
-
readonly left: "剩余";
|
|
158
|
-
readonly resetAt: "重置于";
|
|
159
|
-
readonly now: "即将重置";
|
|
160
|
-
readonly accountPool: string;
|
|
161
|
-
readonly addAccount: string;
|
|
162
|
-
readonly accountCount: string;
|
|
163
|
-
readonly primaryAccount: string;
|
|
164
|
-
readonly activeAccount: string;
|
|
165
|
-
readonly setPrimary: string;
|
|
166
|
-
readonly deleteAccount: string;
|
|
167
|
-
readonly cooling: string;
|
|
168
|
-
readonly cooldownLeft: string;
|
|
169
|
-
readonly clearCooldown: string;
|
|
170
|
-
readonly needsRelogin: string;
|
|
171
|
-
readonly relogin: string;
|
|
172
|
-
readonly rotationStrategy: string;
|
|
173
|
-
readonly strategySequential: string;
|
|
174
|
-
readonly strategyRoundRobin: string;
|
|
175
|
-
readonly strategySticky: string;
|
|
176
|
-
readonly noAccounts: string;
|
|
177
|
-
readonly email: string;
|
|
178
|
-
readonly expires: string;
|
|
179
|
-
readonly lastUsed: string;
|
|
180
|
-
readonly accountId: string;
|
|
181
|
-
};
|
|
182
|
-
'zh-CN': {
|
|
183
|
-
readonly title: "GLM(智谱 Coding Plan)";
|
|
184
|
-
readonly pageDesc: "添加智谱 / Z.ai 的 GLM Coding Plan API Key,管理可用模型、上下文窗口与额度。";
|
|
185
|
-
readonly account: "账号";
|
|
186
|
-
readonly signedIn: "已登录";
|
|
187
|
-
readonly signedOut: "未登录";
|
|
188
|
-
readonly region: "区域";
|
|
189
|
-
readonly regionIntl: "国际区 (api.z.ai)";
|
|
190
|
-
readonly regionCn: "国区 (open.bigmodel.cn)";
|
|
191
|
-
readonly keyHint: "Key 尾号";
|
|
192
|
-
readonly plan: "套餐";
|
|
193
|
-
readonly planUnknown: "—";
|
|
194
|
-
readonly renews: "续费于";
|
|
195
|
-
readonly authenticatedAt: "添加时间";
|
|
196
|
-
readonly storage: "凭据存储";
|
|
197
|
-
readonly storageNotice: "API Key 由 Host 保存于本地加密存储,不会进入浏览器。";
|
|
198
|
-
readonly signOut: "注销";
|
|
199
|
-
readonly addKeySection: "添加 API Key";
|
|
200
|
-
readonly addKeyHint: "在对应开放平台的「API Keys」页创建 Key 后粘贴到此处。它必须来自你订阅 Coding Plan 的那个平台:国区 Key 与国际区 Key 互不通用,开放平台(/api/paas/v4)的通用 Key 在订阅接口上会被拒绝。";
|
|
201
|
-
readonly keyPlaceholder: "粘贴 GLM Coding Plan API Key";
|
|
202
|
-
readonly keySave: "保存并验证";
|
|
203
|
-
readonly keySaving: "验证中...";
|
|
204
|
-
readonly keySaved: "已保存";
|
|
205
|
-
readonly connection: "连接";
|
|
206
|
-
readonly provider: "Provider";
|
|
207
|
-
readonly providerValue: "GLM(智谱 Coding Plan)· zhipu-coding-plan";
|
|
208
|
-
readonly connectionState: "连接状态";
|
|
209
|
-
readonly connected: "已连接";
|
|
210
|
-
readonly untested: "未测试";
|
|
211
|
-
readonly testConnection: "测试连接";
|
|
212
|
-
readonly testingConnection: "测试中...";
|
|
213
|
-
readonly routeOwned: "模型路由由本插件提供";
|
|
214
|
-
readonly routeConflict: "模型路由已被其他 Provider 占用:{detail}。请在 DSH 设置中移除重复的 Provider 配置后重试。";
|
|
215
|
-
readonly modelsSection: "模型";
|
|
216
|
-
readonly enableProvider: "启用此供应商";
|
|
217
|
-
readonly modelsHint: "勾选后模型才会出现在对话页的模型选择列表中;全部取消勾选或关闭上方开关可在列表中隐藏该供应商。";
|
|
218
|
-
readonly refreshCatalog: "刷新模型目录";
|
|
219
|
-
readonly refreshingCatalog: "刷新中...";
|
|
220
|
-
readonly selectAll: "全选";
|
|
221
|
-
readonly unselectAll: "全不选";
|
|
222
|
-
readonly effectiveWindow: "有效窗口";
|
|
223
|
-
readonly enhanced: "增强功能";
|
|
224
|
-
readonly defaultReasoningEffort: "默认思考深度";
|
|
225
|
-
readonly defaultReasoningEffortHint: "仅对声明了思考档位的模型生效。上游只接受 low / high / max,其余档位会收敛到最近的可用档位后发出(不支持的档位会直接报错)。";
|
|
226
|
-
readonly defaultEffortAuto: "使用 Provider 默认值";
|
|
227
|
-
readonly contextWindowSection: "模型上下文窗口";
|
|
228
|
-
readonly contextWindowHint: "默认取该模型官方声明的上下文窗口;可覆盖为自定义容量,该值用于 DSH 的压缩与溢出判断,可输入 1M、512K、200K 等容量。";
|
|
229
|
-
readonly contextWindowReset: "恢复默认";
|
|
230
|
-
readonly contextWindowResetAll: "全部恢复默认";
|
|
231
|
-
readonly contextWindowResetAllConfirm: "确定把已改过的模型上下文窗口全部恢复为默认值吗?";
|
|
232
|
-
readonly contextWindowNoneEnabled: "还没有勾选任何模型。在上方勾选后,这里会出现该模型的上下文窗口设置。";
|
|
233
|
-
readonly save: "保存";
|
|
234
|
-
readonly saved: "已保存";
|
|
235
|
-
readonly saving: "保存中...";
|
|
236
|
-
readonly quotaSection: "用量与配额";
|
|
237
|
-
readonly quotaDesc: "数据来自 GLM Coding Plan 的用量接口,页面可见时最多每 60 秒刷新一次。Coding Plan 同时受 5 小时额度与每周额度限制。";
|
|
238
|
-
readonly refreshQuota: "刷新用量";
|
|
239
|
-
readonly refreshingQuota: "刷新中...";
|
|
240
|
-
readonly quotaEmpty: "暂无配额数据,点击「刷新用量」重试。";
|
|
241
|
-
readonly quotaUnavailable: "该账号没有可用的配额数据(通常是套餐未生效,或 Key 不属于 Coding Plan)。";
|
|
242
|
-
readonly quotaError: "配额读取失败";
|
|
243
|
-
readonly updatedAt: "更新时间:{time}";
|
|
244
|
-
readonly loading: "加载中...";
|
|
245
|
-
readonly tokens: "tokens";
|
|
246
|
-
readonly left: "剩余";
|
|
247
|
-
readonly resetAt: "重置于";
|
|
248
|
-
readonly now: "即将重置";
|
|
249
|
-
readonly accountPool: string;
|
|
250
|
-
readonly addAccount: string;
|
|
251
|
-
readonly accountCount: string;
|
|
252
|
-
readonly primaryAccount: string;
|
|
253
|
-
readonly activeAccount: string;
|
|
254
|
-
readonly setPrimary: string;
|
|
255
|
-
readonly deleteAccount: string;
|
|
256
|
-
readonly cooling: string;
|
|
257
|
-
readonly cooldownLeft: string;
|
|
258
|
-
readonly clearCooldown: string;
|
|
259
|
-
readonly needsRelogin: string;
|
|
260
|
-
readonly relogin: string;
|
|
261
|
-
readonly rotationStrategy: string;
|
|
262
|
-
readonly strategySequential: string;
|
|
263
|
-
readonly strategyRoundRobin: string;
|
|
264
|
-
readonly strategySticky: string;
|
|
265
|
-
readonly noAccounts: string;
|
|
266
|
-
readonly email: string;
|
|
267
|
-
readonly expires: string;
|
|
268
|
-
readonly lastUsed: string;
|
|
269
|
-
readonly accountId: string;
|
|
270
|
-
};
|
|
271
|
-
en: Record<"account" | "storage" | "rotationStrategy" | "accountId" | "relogin" | "tokens" | "title" | "signedOut" | "signedIn" | "plan" | "expires" | "signOut" | "loading" | "connection" | "provider" | "connectionState" | "connected" | "untested" | "testConnection" | "enableProvider" | "selectAll" | "unselectAll" | "modelsHint" | "contextWindowReset" | "contextWindowResetAll" | "contextWindowResetAllConfirm" | "save" | "refreshQuota" | "accountPool" | "addAccount" | "accountCount" | "primaryAccount" | "activeAccount" | "setPrimary" | "deleteAccount" | "cooling" | "cooldownLeft" | "clearCooldown" | "needsRelogin" | "strategySequential" | "strategyRoundRobin" | "strategySticky" | "noAccounts" | "storageNotice" | "email" | "lastUsed" | "pageDesc" | "providerValue" | "enhanced" | "defaultReasoningEffort" | "defaultReasoningEffortHint" | "defaultEffortAuto" | "contextWindowSection" | "contextWindowHint" | "contextWindowNoneEnabled" | "saved" | "saving" | "quotaSection" | "quotaDesc" | "refreshingQuota" | "quotaEmpty" | "updatedAt" | "now" | "planUnknown" | "renews" | "authenticatedAt" | "testingConnection" | "routeOwned" | "routeConflict" | "modelsSection" | "refreshCatalog" | "refreshingCatalog" | "region" | "resetAt" | "regionIntl" | "regionCn" | "keyHint" | "addKeySection" | "addKeyHint" | "keyPlaceholder" | "keySave" | "keySaving" | "keySaved" | "effectiveWindow" | "quotaUnavailable" | "quotaError" | "left", string>;
|
|
272
|
-
'en-US': Record<"account" | "storage" | "rotationStrategy" | "accountId" | "relogin" | "tokens" | "title" | "signedOut" | "signedIn" | "plan" | "expires" | "signOut" | "loading" | "connection" | "provider" | "connectionState" | "connected" | "untested" | "testConnection" | "enableProvider" | "selectAll" | "unselectAll" | "modelsHint" | "contextWindowReset" | "contextWindowResetAll" | "contextWindowResetAllConfirm" | "save" | "refreshQuota" | "accountPool" | "addAccount" | "accountCount" | "primaryAccount" | "activeAccount" | "setPrimary" | "deleteAccount" | "cooling" | "cooldownLeft" | "clearCooldown" | "needsRelogin" | "strategySequential" | "strategyRoundRobin" | "strategySticky" | "noAccounts" | "storageNotice" | "email" | "lastUsed" | "pageDesc" | "providerValue" | "enhanced" | "defaultReasoningEffort" | "defaultReasoningEffortHint" | "defaultEffortAuto" | "contextWindowSection" | "contextWindowHint" | "contextWindowNoneEnabled" | "saved" | "saving" | "quotaSection" | "quotaDesc" | "refreshingQuota" | "quotaEmpty" | "updatedAt" | "now" | "planUnknown" | "renews" | "authenticatedAt" | "testingConnection" | "routeOwned" | "routeConflict" | "modelsSection" | "refreshCatalog" | "refreshingCatalog" | "region" | "resetAt" | "regionIntl" | "regionCn" | "keyHint" | "addKeySection" | "addKeyHint" | "keyPlaceholder" | "keySave" | "keySaving" | "keySaved" | "effectiveWindow" | "quotaUnavailable" | "quotaError" | "left", string>;
|
|
273
|
-
};
|
|
274
|
-
export type ZhipuLocaleKey = keyof typeof zh;
|
|
275
|
-
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../src/client/zhipu/locales.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,cAAc,CAAA;AAEnC,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEL,CAAA;AAEV,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CAoErC,CAAA;AAEV,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKxB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const STYLE_ID = "dsh-zhipu-settings-style";
|
|
2
|
-
/**
|
|
3
|
-
* GLM Coding Plan additions to the shared settings design system.
|
|
4
|
-
*
|
|
5
|
-
* The base control styles (`.dsha-page`, `.dsha-group`, `.dsha-models`, the
|
|
6
|
-
* account card, the meters, …) come from the stylesheets the sibling routes
|
|
7
|
-
* install, in the same order the client installs them, so this file declares
|
|
8
|
-
* only what stays unique to this card: the key-hint line and the region
|
|
9
|
-
* selector that sits beside the key input.
|
|
10
|
-
*/
|
|
11
|
-
export declare function installZhipuStyles(): void;
|
|
12
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/client/zhipu/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,6BAA6B,CAAA;AAElD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAWzC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AccountPoolCore, type PoolAccountShape, type PoolData } from '../common/account-pool.ts';
|
|
2
|
-
import type { CredentialStore } from '../token-store.ts';
|
|
3
|
-
import { FileCredentialStore, type ZhipuCredentials } from './token-store.ts';
|
|
4
|
-
import type { ZhipuAccountSummaryDto, ZhipuRegion } from '../../shared/zhipu-contracts.ts';
|
|
5
|
-
/** One pooled GLM Coding Plan key: the credential plus the facts the card renders. */
|
|
6
|
-
export interface ZhipuPoolAccount extends PoolAccountShape<ZhipuCredentials> {
|
|
7
|
-
region: ZhipuRegion;
|
|
8
|
-
keyHint?: string;
|
|
9
|
-
apiBase?: string;
|
|
10
|
-
planLabel?: string;
|
|
11
|
-
planLevel?: string;
|
|
12
|
-
}
|
|
13
|
-
export type { ZhipuAccountSummaryDto };
|
|
14
|
-
/** Encrypted pool file this line owns; the pre-pool credential file stays the mirror. */
|
|
15
|
-
export declare function zhipuPoolPath(): string;
|
|
16
|
-
/** Validate and normalize one whole pool document. */
|
|
17
|
-
export declare function parseZhipuPoolData(value: unknown): PoolData<ZhipuPoolAccount>;
|
|
18
|
-
export interface ZhipuAccountPoolOptions {
|
|
19
|
-
/** Pre-pool credential file the pool mirrors its primary account into. */
|
|
20
|
-
store?: FileCredentialStore;
|
|
21
|
-
/** Test seam; production builds the platform backend from the pool path. */
|
|
22
|
-
backend?: CredentialStore<PoolData<ZhipuPoolAccount>>;
|
|
23
|
-
/** Accounts this pool accepts; defaults to the core's limit. */
|
|
24
|
-
maxAccounts?: number;
|
|
25
|
-
/** Account the card pinned, or null for automatic selection. */
|
|
26
|
-
preferAccountId?: () => string | null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The GLM Coding Plan account pool.
|
|
30
|
-
*
|
|
31
|
-
* A Coding Plan credential is a long-lived console key with nothing to refresh,
|
|
32
|
-
* so this wrapper only supplies identity, display facts, and the mirror of the
|
|
33
|
-
* single-credential file the plugin used before the pool existed. Rotation is
|
|
34
|
-
* meaningful here for the same reason it is on the other key-based lines: a
|
|
35
|
-
* spent plan window is per-account, so another account can serve the turn.
|
|
36
|
-
*/
|
|
37
|
-
export declare class ZhipuAccountPool extends AccountPoolCore<ZhipuCredentials, ZhipuPoolAccount, ZhipuAccountSummaryDto> {
|
|
38
|
-
private readonly store;
|
|
39
|
-
constructor(options?: ZhipuAccountPoolOptions);
|
|
40
|
-
/** The pre-pool credential file this pool mirrors its primary account into. */
|
|
41
|
-
mirrorStore(): FileCredentialStore;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=account-pool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/zhipu/account-pool.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAGf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EACL,mBAAmB,EAInB,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAE1F,sFAAsF;AACtF,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,CAAC,gBAAgB,CAAC;IAC1E,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,YAAY,EAAE,sBAAsB,EAAE,CAAA;AAEtC,yFAAyF;AACzF,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AASD,sDAAsD;AACtD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CA+C7E;AAmBD,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACrD,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;CACtC;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,eAAe,CACnD,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,CACvB;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;gBAE/B,OAAO,GAAE,uBAA4B;IA6EjD,+EAA+E;IAC/E,WAAW,IAAI,mBAAmB;CAGnC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { LlmAdapter, LlmError, ReasoningEffortId, type GenerateOptions, type LlmModelInfo, type LlmProviderInfo, type LlmResolvedModelInfo, type PreparedAdapterCall, type ResolvedRetryPolicy, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
2
|
-
import { PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
-
import { FileCredentialStore, FileModelSettingsStore, type ZhipuPreferenceStore } from './token-store.ts';
|
|
4
|
-
import { type ZhipuModelEntry } from './model-catalog.ts';
|
|
5
|
-
import { type AttachmentImageReader } from './mapper.ts';
|
|
6
|
-
import type { ZhipuCredentials } from './token-store.ts';
|
|
7
|
-
import type { ZhipuAccountPool } from './account-pool.ts';
|
|
8
|
-
/**
|
|
9
|
-
* Effort this route materializes when the caller names none.
|
|
10
|
-
*
|
|
11
|
-
* Preference order: the caller's explicit level when the model accepts it,
|
|
12
|
-
* otherwise the user's configured level when the model accepts it, otherwise
|
|
13
|
-
* nothing. Nothing is a real answer on this route: the provider's own default
|
|
14
|
-
* is `max` for a model that takes an effort field, so omitting the field is not
|
|
15
|
-
* "no thinking" — it is the provider's documented default.
|
|
16
|
-
*
|
|
17
|
-
* A candidate outside the model's ladder is converged onto the nearest rung
|
|
18
|
-
* rather than sent, because an unsupported level is an error (`code 1214`), and
|
|
19
|
-
* rather than dropped, because dropping the user's explicit choice silently
|
|
20
|
-
* changes how hard the model thinks.
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveDefaultReasoningEffort(efforts: readonly string[], configuredEffort?: string | null): ReasoningEffortId | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Cooldown a 429 imposes when the service names no reset instant.
|
|
25
|
-
*
|
|
26
|
-
* The plan's allowance windows are hours long, so a shorter cooldown would
|
|
27
|
-
* rediscover the same exhausted window immediately.
|
|
28
|
-
*/
|
|
29
|
-
export declare const POOL_COOLDOWN_MS: number;
|
|
30
|
-
export interface ZhipuAdapterOptions {
|
|
31
|
-
fetchFn?: typeof fetch;
|
|
32
|
-
attachments?: AttachmentImageReader;
|
|
33
|
-
/** Live catalog loader seam; defaults to the managed `/models` call. */
|
|
34
|
-
loadCatalog?: (credentials: ZhipuCredentials) => Promise<ZhipuModelEntry[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Multi-account pool this adapter rotates through.
|
|
37
|
-
*
|
|
38
|
-
* Absent leaves the line on its single-credential path, which is what the
|
|
39
|
-
* headless tests and any caller that predates the pool use.
|
|
40
|
-
*/
|
|
41
|
-
accountPool?: ZhipuAccountPool;
|
|
42
|
-
}
|
|
43
|
-
export declare class ZhipuAdapter extends LlmAdapter {
|
|
44
|
-
private readonly store;
|
|
45
|
-
private readonly modelSettings;
|
|
46
|
-
private readonly preferences?;
|
|
47
|
-
private readonly options;
|
|
48
|
-
/** Null keeps the pre-pool single-credential path. */
|
|
49
|
-
private readonly accountPool;
|
|
50
|
-
constructor(store?: FileCredentialStore, modelSettings?: FileModelSettingsStore, preferences?: ZhipuPreferenceStore | undefined, options?: ZhipuAdapterOptions);
|
|
51
|
-
providerInfo(provider: string): LlmProviderInfo;
|
|
52
|
-
providerRetryPolicy(): ResolvedRetryPolicy;
|
|
53
|
-
imageRequestPricing(): undefined;
|
|
54
|
-
private settings;
|
|
55
|
-
/**
|
|
56
|
-
* Credential the picker and the single-credential path read.
|
|
57
|
-
*
|
|
58
|
-
* With a pool installed the store holds the mirrored primary account, so this
|
|
59
|
-
* stays the same read path either way; the pool is consulted only when a
|
|
60
|
-
* request is actually served, which is where per-account rotation matters.
|
|
61
|
-
*/
|
|
62
|
-
private credentials;
|
|
63
|
-
private catalog;
|
|
64
|
-
listModels(provider?: string): Promise<readonly LlmModelInfo[]>;
|
|
65
|
-
resolveModel(provider: string, modelId: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
|
|
66
|
-
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
|
|
67
|
-
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
68
|
-
/**
|
|
69
|
-
* Effort this request should carry, or `undefined` to send none.
|
|
70
|
-
*
|
|
71
|
-
* Order: the caller's explicit choice, then the user's configured level. Both
|
|
72
|
-
* are converged onto the model's own ladder — the provider rejects a level
|
|
73
|
-
* outside it — and a model that declares no ladder gets none, because sending
|
|
74
|
-
* an effort to a model that takes no such field is exactly the 400 this
|
|
75
|
-
* convergence exists to avoid.
|
|
76
|
-
*/
|
|
77
|
-
private effortFor;
|
|
78
|
-
private requestStream;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Map one failed HTTP response onto a DSH failure.
|
|
82
|
-
*
|
|
83
|
-
* The platform reports its own condition inside a JSON `code` while the status
|
|
84
|
-
* line stays generic, so the body is read for the cases the status alone cannot
|
|
85
|
-
* express. Several distinct conditions share one status — 429 covers a spent
|
|
86
|
-
* window, a lapsed plan, and a per-model entitlement gap — and they need
|
|
87
|
-
* different actions, which is exactly why the code decides.
|
|
88
|
-
*/
|
|
89
|
-
export declare function classifyFailure(status: number, detail: string, headers?: Headers): LlmError;
|
|
90
|
-
/** Read the platform's own numeric error code out of a response body. */
|
|
91
|
-
export declare function readErrorCode(detail: string): number | null;
|
|
92
|
-
export { PROVIDER_ID, PROVIDER_NAME };
|
|
93
|
-
//# sourceMappingURL=adapter.d.ts.map
|
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,CAAA"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import type { ZhipuAccount, ZhipuAccountQuota, ZhipuMeter, ZhipuQuotaWindow } from '../../shared/zhipu-contracts.ts';
|
|
2
|
-
import { DEFAULT_CONTEXT_WINDOW, ERROR_CODE, PROVIDER_NAME } from './types.ts';
|
|
3
|
-
import { type ZhipuCredentials } from './token-store.ts';
|
|
4
|
-
import { ZHIPU_MODELS, type ZhipuModelEntry } from './model-catalog.ts';
|
|
5
|
-
export interface ZhipuRequestOptions {
|
|
6
|
-
fetchFn?: typeof fetch;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Headers one model request carries.
|
|
11
|
-
*
|
|
12
|
-
* The chat surface uses the documented bearer form. The key never appears in a
|
|
13
|
-
* log line: only the response body and status are ever reported.
|
|
14
|
-
*/
|
|
15
|
-
export declare function zhipuHeaders(credentials: Pick<ZhipuCredentials, 'apiKey'>, extra?: Record<string, string>): Record<string, string>;
|
|
16
|
-
/**
|
|
17
|
-
* Headers the monitor/subscription surfaces carry.
|
|
18
|
-
*
|
|
19
|
-
* These two answer to the **raw** key with no `Bearer` prefix, which is the
|
|
20
|
-
* scheme the plan's own usage page uses: measured live, a request carrying the
|
|
21
|
-
* prefixed form is rejected with `code 401` where the raw form authenticates.
|
|
22
|
-
*/
|
|
23
|
-
export declare function zhipuMonitorHeaders(apiKey: string, extra?: Record<string, string>): Record<string, string>;
|
|
24
|
-
/** Public account facts for the settings card. */
|
|
25
|
-
export declare function accountFromCredentials(credentials: ZhipuCredentials): ZhipuAccount;
|
|
26
|
-
/**
|
|
27
|
-
* Read the platform's own envelope error out of a business-level refusal.
|
|
28
|
-
*
|
|
29
|
-
* These two surfaces answer HTTP 200 with `success: false` and a numeric `code`
|
|
30
|
-
* for an authentication problem, so a caller that only checks `response.ok`
|
|
31
|
-
* would treat a rejected key as a successful read. Returns null when the body
|
|
32
|
-
* is not a refusal.
|
|
33
|
-
*/
|
|
34
|
-
export declare function readEnvelopeError(payload: unknown): {
|
|
35
|
-
code: number | null;
|
|
36
|
-
message: string;
|
|
37
|
-
} | null;
|
|
38
|
-
/**
|
|
39
|
-
* Verify one key by asking the model listing for it.
|
|
40
|
-
*
|
|
41
|
-
* The listing is the cheapest authenticated read on the Coding Plan surface and
|
|
42
|
-
* is the same host the chat requests go to, so a success proves the key works
|
|
43
|
-
* on the deployment it was entered for. A key from the wrong console (a general
|
|
44
|
-
* open-platform key, or one issued by the other region) is rejected here rather
|
|
45
|
-
* than failing later inside a conversation.
|
|
46
|
-
*
|
|
47
|
-
* @returns the live catalog this read produced, so a caller that verifies does
|
|
48
|
-
* not have to fetch it again.
|
|
49
|
-
*/
|
|
50
|
-
export declare function verifyApiKey(apiKey: string, region: ZhipuCredentials['region'], options?: ZhipuRequestOptions): Promise<ZhipuModelEntry[]>;
|
|
51
|
-
/** Console the user must have created the key on, named as it appears there. */
|
|
52
|
-
export declare function consoleName(region: ZhipuCredentials['region']): string;
|
|
53
|
-
/**
|
|
54
|
-
* Parse one `/models` payload.
|
|
55
|
-
*
|
|
56
|
-
* The listing reports each model's context window. It is merged over the
|
|
57
|
-
* shipped table, which stays the authority on the reasoning ladder and on image
|
|
58
|
-
* support: the listing states a window but not a capability, so a field it
|
|
59
|
-
* omits keeps the value this table declares rather than becoming a guess.
|
|
60
|
-
*/
|
|
61
|
-
export declare function parseCatalogModels(payload: unknown, region: ZhipuCredentials['region']): ZhipuModelEntry[];
|
|
62
|
-
export declare function getCachedCatalog(): ZhipuModelEntry[];
|
|
63
|
-
export declare function clearCachedCatalog(): void;
|
|
64
|
-
/**
|
|
65
|
-
* Fetch the live catalog for one account.
|
|
66
|
-
*
|
|
67
|
-
* A failure returns an empty list and the caller falls back to the shipped
|
|
68
|
-
* table, which keeps a first run usable before sign-in.
|
|
69
|
-
*/
|
|
70
|
-
export declare function fetchCatalog(credentials: ZhipuCredentials, options?: ZhipuRequestOptions): Promise<ZhipuModelEntry[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Cached catalog with a TTL; a failed refresh keeps the previous snapshot.
|
|
73
|
-
*
|
|
74
|
-
* A snapshot read for the *other* region must never stand in: its entries
|
|
75
|
-
* declare only the region they came from, so the caller's region filter would
|
|
76
|
-
* drop every one of them and the picker would offer nothing instead of falling
|
|
77
|
-
* back to the shipped table.
|
|
78
|
-
*/
|
|
79
|
-
export declare function loadCatalog(credentials: ZhipuCredentials, options?: ZhipuRequestOptions & {
|
|
80
|
-
force?: boolean;
|
|
81
|
-
}): Promise<ZhipuModelEntry[]>;
|
|
82
|
-
/**
|
|
83
|
-
* Window length in minutes implied by one reported window.
|
|
84
|
-
*
|
|
85
|
-
* The monitor service describes a window by a unit and a number rather than by
|
|
86
|
-
* a name: `unit 3 × number 5` is the plan's 5-hour credit window and
|
|
87
|
-
* `unit 6 × number 1` is its weekly one. The exact unit vocabulary is not
|
|
88
|
-
* documented, so this maps the two combinations the plan's own usage page shows
|
|
89
|
-
* and derives minutes from anything else it does not recognise.
|
|
90
|
-
*/
|
|
91
|
-
export declare function windowMinutesOf(unit: number | undefined, number: number | undefined): number | null;
|
|
92
|
-
/** Turn one window length into the label the card shows. */
|
|
93
|
-
export declare function windowLabel(minutes: number | null, fallback: string): string;
|
|
94
|
-
/** One parsed limit entry from the monitor service. */
|
|
95
|
-
export interface ParsedQuotaLimit {
|
|
96
|
-
type: string;
|
|
97
|
-
unit: number | undefined;
|
|
98
|
-
number: number | undefined;
|
|
99
|
-
percentage: number | undefined;
|
|
100
|
-
currentValue: number | undefined;
|
|
101
|
-
total: number | undefined;
|
|
102
|
-
resetsAt: number | null;
|
|
103
|
-
usageDetails: Record<string, unknown> | undefined;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Parse the monitor payload's `limits` array.
|
|
107
|
-
*
|
|
108
|
-
* The plan's own page renders these directly. A limit is either a token/credit
|
|
109
|
-
* window (`TOKENS_LIMIT`, renamed `CREDIT_LIMIT` in newer responses) or a
|
|
110
|
-
* tool-call allowance (`TIME_LIMIT`); both shapes are read here rather than
|
|
111
|
-
* pinned to one spelling, because the service has used both names.
|
|
112
|
-
*/
|
|
113
|
-
export declare function parseQuotaLimits(payload: unknown): ParsedQuotaLimit[];
|
|
114
|
-
/** Whether a limit entry is a token/credit window under either spelling. */
|
|
115
|
-
export declare function isTokenLimit(type: string): boolean;
|
|
116
|
-
/** Whether a limit entry is a tool-call allowance. */
|
|
117
|
-
export declare function isToolLimit(type: string): boolean;
|
|
118
|
-
/** Build the window list the card renders from the parsed limits. */
|
|
119
|
-
export declare function quotaWindows(limits: readonly ParsedQuotaLimit[]): ZhipuQuotaWindow[];
|
|
120
|
-
/** Build the meter list the card renders, windows and tool allowance together. */
|
|
121
|
-
export declare function quotaMeters(windows: readonly ZhipuQuotaWindow[], limits: readonly ParsedQuotaLimit[]): ZhipuMeter[];
|
|
122
|
-
/** Plan facts the subscription route reports. */
|
|
123
|
-
export interface ZhipuPlan {
|
|
124
|
-
planName: string | null;
|
|
125
|
-
planLevel: string | null;
|
|
126
|
-
renewsAt: number | null;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Parse the plan payload.
|
|
130
|
-
*
|
|
131
|
-
* Best effort by design: the quota meters are what the card is for, so a
|
|
132
|
-
* failure here must degrade to "no plan line" rather than blank the panel. The
|
|
133
|
-
* subscription host returns the plan under `data`, and the level is reported
|
|
134
|
-
* either as a machine name or as an expiry-bearing record; both shapes are read.
|
|
135
|
-
*/
|
|
136
|
-
export declare function parsePlan(payload: unknown): ZhipuPlan;
|
|
137
|
-
export declare function getCachedQuota(): ZhipuAccountQuota | undefined;
|
|
138
|
-
export declare function clearCachedQuota(): void;
|
|
139
|
-
/**
|
|
140
|
-
* Read the account's plan allowance.
|
|
141
|
-
*
|
|
142
|
-
* Two routes answer this snapshot: the monitor route carries the windows, and
|
|
143
|
-
* the subscription route carries the plan name. They are independent, so a
|
|
144
|
-
* failure of the optional one must not blank the panel — but a failure of the
|
|
145
|
-
* monitor route is a real failure and is raised, because a snapshot with no
|
|
146
|
-
* windows would otherwise render as "nothing consumed".
|
|
147
|
-
*/
|
|
148
|
-
export declare function fetchAccountQuota(credentials: ZhipuCredentials, options?: ZhipuRequestOptions & {
|
|
149
|
-
force?: boolean;
|
|
150
|
-
}): Promise<ZhipuAccountQuota>;
|
|
151
|
-
/** The shipped table, re-exported so callers need only this module. */
|
|
152
|
-
export { ZHIPU_MODELS, DEFAULT_CONTEXT_WINDOW, PROVIDER_NAME, ERROR_CODE };
|
|
153
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/zhipu/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAGL,sBAAsB,EAEtB,UAAU,EAGV,aAAa,EAMd,MAAM,YAAY,CAAA;AACnB,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAqB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAE1F,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AA6BD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,EAC7C,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,CAAC,MAAM,EAAE,M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