@duke-dsh-plugins/dsh-token-stats 1.5.0 → 1.5.1

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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/typert.host.js +19 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duke-dsh-plugins/dsh-token-stats",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
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
  },