@duke-dsh-plugins/dsh-token-stats 1.5.0 → 1.5.2
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/client.js +11 -5
- package/package.json +3 -2
- package/typert.host.js +19 -0
package/client.js
CHANGED
|
@@ -140,9 +140,12 @@ window.__ModuleLoader__.load({
|
|
|
140
140
|
// client assembly mounts only the five official namespaces, so a plugin
|
|
141
141
|
// must mount its own. Mirrors the invocation in typert.host.js (id,
|
|
142
142
|
// service/namespace/method). zod is not requirable in the browser module
|
|
143
|
-
// loader, so codecs use passthrough schemas
|
|
144
|
-
//
|
|
143
|
+
// loader, so codecs use passthrough schemas. 0.1.7's client-side typert
|
|
144
|
+
// remote store REJECTS strict codecs without a create() factory (same
|
|
145
|
+
// contract as typert-loader — v1.5.1 shipped without these and every
|
|
146
|
+
// $mount failed with "has no create() factory", dead Remote namespace).
|
|
145
147
|
const passthrough = () => ({ parse: (v) => v });
|
|
148
|
+
const createPassthrough = () => passthrough();
|
|
146
149
|
const CLIENT_REMOTE = {
|
|
147
150
|
package: "dsh-token-stats",
|
|
148
151
|
descriptors: [
|
|
@@ -157,6 +160,7 @@ window.__ModuleLoader__.load({
|
|
|
157
160
|
mode: "strict",
|
|
158
161
|
typeSymbol: "dsh-token-stats#TokenStatsResult",
|
|
159
162
|
schema: passthrough(),
|
|
163
|
+
create: createPassthrough,
|
|
160
164
|
},
|
|
161
165
|
},
|
|
162
166
|
{
|
|
@@ -170,19 +174,20 @@ window.__ModuleLoader__.load({
|
|
|
170
174
|
name: "provider",
|
|
171
175
|
wire: "provider",
|
|
172
176
|
source: "json",
|
|
173
|
-
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getQuota:provider", schema: passthrough() },
|
|
177
|
+
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getQuota:provider", schema: passthrough(), create: createPassthrough },
|
|
174
178
|
},
|
|
175
179
|
{
|
|
176
180
|
name: "force",
|
|
177
181
|
wire: "force",
|
|
178
182
|
source: "json",
|
|
179
|
-
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getQuota:force", schema: passthrough() },
|
|
183
|
+
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getQuota:force", schema: passthrough(), create: createPassthrough },
|
|
180
184
|
},
|
|
181
185
|
],
|
|
182
186
|
result: {
|
|
183
187
|
mode: "strict",
|
|
184
188
|
typeSymbol: "dsh-token-stats#TokenStatsQuotaResult",
|
|
185
189
|
schema: passthrough(),
|
|
190
|
+
create: createPassthrough,
|
|
186
191
|
},
|
|
187
192
|
},
|
|
188
193
|
{
|
|
@@ -196,13 +201,14 @@ window.__ModuleLoader__.load({
|
|
|
196
201
|
name: "force",
|
|
197
202
|
wire: "force",
|
|
198
203
|
source: "json",
|
|
199
|
-
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getAllQuotas:force", schema: passthrough() },
|
|
204
|
+
codec: { mode: "strict", typeSymbol: "dsh-token-stats#tokenStats/getAllQuotas:force", schema: passthrough(), create: createPassthrough },
|
|
200
205
|
},
|
|
201
206
|
],
|
|
202
207
|
result: {
|
|
203
208
|
mode: "strict",
|
|
204
209
|
typeSymbol: "dsh-token-stats#TokenStatsAllQuotasResult",
|
|
205
210
|
schema: passthrough(),
|
|
211
|
+
create: createPassthrough,
|
|
206
212
|
},
|
|
207
213
|
},
|
|
208
214
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duke-dsh-plugins/dsh-token-stats",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Token usage statistics for DeepSeek Harness (7/30-day per-model charts + yearly heatmap) plus an inline coding-plan balance/quota readout in the composer (minimax/deepseek/kimi/openrouter/zhipu).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"check": "node --check index.js && node --check client.js && node --check typert.host.js",
|
|
50
50
|
"smoke": "node scripts/smoke-store.mjs",
|
|
51
51
|
"smoke:quota": "node scripts/smoke-quota.mjs",
|
|
52
|
-
"smoke:robust": "node scripts/smoke-robust-host.mjs && node scripts/smoke-robust-client.mjs"
|
|
52
|
+
"smoke:robust": "node scripts/smoke-robust-host.mjs && node scripts/smoke-robust-client.mjs",
|
|
53
|
+
"smoke:typert": "node scripts/smoke-typert.mjs"
|
|
53
54
|
}
|
|
54
55
|
}
|
package/typert.host.js
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
|
|
15
|
+
// typert-loader's requireStrictCodec rejects strict codecs without a create()
|
|
16
|
+
// factory (v1.5.0 shipped without these, so the loader never registered this
|
|
17
|
+
// manifest and every tokenStats Remote call failed). Every codec below is
|
|
18
|
+
// paired with its factory; run `npm run smoke:typert` after changes.
|
|
19
|
+
const createStringSchema = () => z.string();
|
|
20
|
+
const createBooleanSchema = () => z.boolean();
|
|
21
|
+
|
|
15
22
|
// ---- shared shapes ---------------------------------------------------------
|
|
16
23
|
|
|
17
24
|
const modelDaySchema = z
|
|
@@ -80,6 +87,8 @@ const tokenStatsResultSchema = z.union([
|
|
|
80
87
|
.readonly(),
|
|
81
88
|
]);
|
|
82
89
|
|
|
90
|
+
const createTokenStatsResult = () => tokenStatsResultSchema;
|
|
91
|
+
|
|
83
92
|
// ---- quota / balance (套餐余额) ---------------------------------------------
|
|
84
93
|
|
|
85
94
|
const quotaDisplaySchema = z
|
|
@@ -132,6 +141,8 @@ const tokenStatsQuotaResultSchema = z.union([
|
|
|
132
141
|
.readonly(),
|
|
133
142
|
]);
|
|
134
143
|
|
|
144
|
+
const createTokenStatsQuotaResult = () => tokenStatsQuotaResultSchema;
|
|
145
|
+
|
|
135
146
|
const allQuotasValueSchema = z
|
|
136
147
|
.object({
|
|
137
148
|
quotas: z.record(z.string(), quotaValueSchema).readonly(),
|
|
@@ -158,6 +169,8 @@ const tokenStatsAllQuotasResultSchema = z.union([
|
|
|
158
169
|
.readonly(),
|
|
159
170
|
]);
|
|
160
171
|
|
|
172
|
+
const createTokenStatsAllQuotasResult = () => tokenStatsAllQuotasResultSchema;
|
|
173
|
+
|
|
161
174
|
export const TYPERT = {
|
|
162
175
|
package: "@duke-dsh-plugins/dsh-token-stats",
|
|
163
176
|
face: "host",
|
|
@@ -174,6 +187,7 @@ export const TYPERT = {
|
|
|
174
187
|
mode: "strict",
|
|
175
188
|
typeSymbol: "dsh-token-stats#TokenStatsResult",
|
|
176
189
|
schema: tokenStatsResultSchema,
|
|
190
|
+
create: createTokenStatsResult,
|
|
177
191
|
},
|
|
178
192
|
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
179
193
|
},
|
|
@@ -192,6 +206,7 @@ export const TYPERT = {
|
|
|
192
206
|
mode: "strict",
|
|
193
207
|
typeSymbol: "dsh-token-stats#tokenStats/getQuota:provider",
|
|
194
208
|
schema: z.string(),
|
|
209
|
+
create: createStringSchema,
|
|
195
210
|
},
|
|
196
211
|
},
|
|
197
212
|
{
|
|
@@ -202,6 +217,7 @@ export const TYPERT = {
|
|
|
202
217
|
mode: "strict",
|
|
203
218
|
typeSymbol: "dsh-token-stats#tokenStats/getQuota:force",
|
|
204
219
|
schema: z.boolean(),
|
|
220
|
+
create: createBooleanSchema,
|
|
205
221
|
},
|
|
206
222
|
},
|
|
207
223
|
],
|
|
@@ -209,6 +225,7 @@ export const TYPERT = {
|
|
|
209
225
|
mode: "strict",
|
|
210
226
|
typeSymbol: "dsh-token-stats#TokenStatsQuotaResult",
|
|
211
227
|
schema: tokenStatsQuotaResultSchema,
|
|
228
|
+
create: createTokenStatsQuotaResult,
|
|
212
229
|
},
|
|
213
230
|
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
214
231
|
},
|
|
@@ -227,6 +244,7 @@ export const TYPERT = {
|
|
|
227
244
|
mode: "strict",
|
|
228
245
|
typeSymbol: "dsh-token-stats#tokenStats/getAllQuotas:force",
|
|
229
246
|
schema: z.boolean(),
|
|
247
|
+
create: createBooleanSchema,
|
|
230
248
|
},
|
|
231
249
|
},
|
|
232
250
|
],
|
|
@@ -234,6 +252,7 @@ export const TYPERT = {
|
|
|
234
252
|
mode: "strict",
|
|
235
253
|
typeSymbol: "dsh-token-stats#TokenStatsAllQuotasResult",
|
|
236
254
|
schema: tokenStatsAllQuotasResultSchema,
|
|
255
|
+
create: createTokenStatsAllQuotasResult,
|
|
237
256
|
},
|
|
238
257
|
sourceLocation: { file: "index.js", line: 1, column: 1 },
|
|
239
258
|
},
|