@rayadesu/dsh-client-ui-billing 0.2.1 → 0.2.3

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/client.js CHANGED
@@ -4,10 +4,10 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react_jsx_runtime = require("react/jsx-runtime");
7
8
  let react = require("react");
8
9
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
- let react_jsx_runtime = require("react/jsx-runtime");
10
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
10
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
11
11
  var _a$1;
12
12
  function $constructor(name, initializer, params) {
13
13
  function init(inst, def) {
@@ -66,7 +66,7 @@ window.__ModuleLoader__.load({
66
66
  return globalConfig;
67
67
  }
68
68
  //#endregion
69
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
69
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
70
70
  function getEnumValues(entries) {
71
71
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
72
72
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -82,7 +82,6 @@ window.__ModuleLoader__.load({
82
82
  Object.defineProperty(this, "value", { value });
83
83
  return value;
84
84
  }
85
- throw new Error("cached value already set");
86
85
  } };
87
86
  }
88
87
  function nullish(input) {
@@ -128,7 +127,10 @@ window.__ModuleLoader__.load({
128
127
  }
129
128
  function mergeDefs(...defs) {
130
129
  const mergedDescriptors = {};
131
- for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
130
+ for (const def of defs) {
131
+ const descriptors = Object.getOwnPropertyDescriptors(def);
132
+ Object.assign(mergedDescriptors, descriptors);
133
+ }
132
134
  return Object.defineProperties({}, mergedDescriptors);
133
135
  }
134
136
  function esc(str) {
@@ -378,7 +380,7 @@ window.__ModuleLoader__.load({
378
380
  return { ...iss };
379
381
  }
380
382
  //#endregion
381
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
383
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
382
384
  const initializer$1 = (inst, def) => {
383
385
  inst.name = "$ZodError";
384
386
  Object.defineProperty(inst, "_zod", {
@@ -438,7 +440,7 @@ window.__ModuleLoader__.load({
438
440
  return fieldErrors;
439
441
  }
440
442
  //#endregion
441
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
443
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
442
444
  const _parse = (_Err) => (schema, value, _ctx, _params) => {
443
445
  const ctx = _ctx ? {
444
446
  ..._ctx,
@@ -552,7 +554,7 @@ window.__ModuleLoader__.load({
552
554
  return _safeParseAsync(_Err)(schema, value, _ctx);
553
555
  };
554
556
  //#endregion
555
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
557
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
556
558
  /**
557
559
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
558
560
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -613,10 +615,11 @@ window.__ModuleLoader__.load({
613
615
  const integer = /^-?\d+$/;
614
616
  const number$1 = /^-?\d+(?:\.\d+)?$/;
615
617
  const boolean$1 = /^(?:true|false)$/i;
618
+ const _undefined$2 = /^undefined$/i;
616
619
  const lowercase = /^[^A-Z]*$/;
617
620
  const uppercase = /^[^a-z]*$/;
618
621
  //#endregion
619
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
622
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
620
623
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
621
624
  var _a;
622
625
  inst._zod ?? (inst._zod = {});
@@ -634,8 +637,10 @@ window.__ModuleLoader__.load({
634
637
  inst._zod.onattach.push((inst) => {
635
638
  const bag = inst._zod.bag;
636
639
  const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
637
- if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
638
- else bag.exclusiveMaximum = def.value;
640
+ if (def.value < curr) {
641
+ if (def.inclusive) bag.maximum = def.value;
642
+ else bag.exclusiveMaximum = def.value;
643
+ }
639
644
  });
640
645
  inst._zod.check = (payload) => {
641
646
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
@@ -656,8 +661,10 @@ window.__ModuleLoader__.load({
656
661
  inst._zod.onattach.push((inst) => {
657
662
  const bag = inst._zod.bag;
658
663
  const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
659
- if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
660
- else bag.exclusiveMinimum = def.value;
664
+ if (def.value > curr) {
665
+ if (def.inclusive) bag.minimum = def.value;
666
+ else bag.exclusiveMinimum = def.value;
667
+ }
661
668
  });
662
669
  inst._zod.check = (payload) => {
663
670
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
@@ -974,7 +981,7 @@ window.__ModuleLoader__.load({
974
981
  };
975
982
  });
976
983
  //#endregion
977
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
984
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
978
985
  var Doc = class {
979
986
  constructor(args = []) {
980
987
  this.content = [];
@@ -1005,14 +1012,14 @@ window.__ModuleLoader__.load({
1005
1012
  }
1006
1013
  };
1007
1014
  //#endregion
1008
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1015
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1009
1016
  const version = {
1010
1017
  major: 4,
1011
1018
  minor: 4,
1012
1019
  patch: 3
1013
1020
  };
1014
1021
  //#endregion
1015
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1022
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1016
1023
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1017
1024
  var _a;
1018
1025
  inst ?? (inst = {});
@@ -1425,6 +1432,22 @@ window.__ModuleLoader__.load({
1425
1432
  return payload;
1426
1433
  };
1427
1434
  });
1435
+ const $ZodUndefined = /*@__PURE__*/ $constructor("$ZodUndefined", (inst, def) => {
1436
+ $ZodType.init(inst, def);
1437
+ inst._zod.pattern = _undefined$2;
1438
+ inst._zod.values = /* @__PURE__ */ new Set([void 0]);
1439
+ inst._zod.parse = (payload, _ctx) => {
1440
+ const input = payload.value;
1441
+ if (typeof input === "undefined") return payload;
1442
+ payload.issues.push({
1443
+ expected: "undefined",
1444
+ code: "invalid_type",
1445
+ input,
1446
+ inst
1447
+ });
1448
+ return payload;
1449
+ };
1450
+ });
1428
1451
  const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
1429
1452
  $ZodType.init(inst, def);
1430
1453
  inst._zod.parse = (payload) => payload;
@@ -1886,6 +1909,24 @@ window.__ModuleLoader__.load({
1886
1909
  return payload;
1887
1910
  };
1888
1911
  });
1912
+ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1913
+ $ZodType.init(inst, def);
1914
+ if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1915
+ const values = new Set(def.values);
1916
+ inst._zod.values = values;
1917
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1918
+ inst._zod.parse = (payload, _ctx) => {
1919
+ const input = payload.value;
1920
+ if (values.has(input)) return payload;
1921
+ payload.issues.push({
1922
+ code: "invalid_value",
1923
+ values: def.values,
1924
+ input,
1925
+ inst
1926
+ });
1927
+ return payload;
1928
+ };
1929
+ });
1889
1930
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1890
1931
  $ZodType.init(inst, def);
1891
1932
  inst._zod.optin = "optional";
@@ -1915,7 +1956,7 @@ window.__ModuleLoader__.load({
1915
1956
  inst._zod.optin = "optional";
1916
1957
  inst._zod.optout = "optional";
1917
1958
  defineLazy(inst._zod, "values", () => {
1918
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
1959
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1919
1960
  });
1920
1961
  defineLazy(inst._zod, "pattern", () => {
1921
1962
  const pattern = def.innerType._zod.pattern;
@@ -1949,7 +1990,7 @@ window.__ModuleLoader__.load({
1949
1990
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1950
1991
  });
1951
1992
  defineLazy(inst._zod, "values", () => {
1952
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
1993
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1953
1994
  });
1954
1995
  inst._zod.parse = (payload, ctx) => {
1955
1996
  if (payload.value === null) return payload;
@@ -2115,7 +2156,7 @@ window.__ModuleLoader__.load({
2115
2156
  }
2116
2157
  }
2117
2158
  //#endregion
2118
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
2159
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
2119
2160
  var _a;
2120
2161
  var $ZodRegistry = class {
2121
2162
  constructor() {
@@ -2162,7 +2203,7 @@ window.__ModuleLoader__.load({
2162
2203
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2163
2204
  const globalRegistry = globalThis.__zod_globalRegistry;
2164
2205
  //#endregion
2165
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
2206
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
2166
2207
  // @__NO_SIDE_EFFECTS__
2167
2208
  function _string(Class, params) {
2168
2209
  return new Class({
@@ -2464,6 +2505,13 @@ window.__ModuleLoader__.load({
2464
2505
  });
2465
2506
  }
2466
2507
  // @__NO_SIDE_EFFECTS__
2508
+ function _undefined$1(Class, params) {
2509
+ return new Class({
2510
+ type: "undefined",
2511
+ ...normalizeParams(params)
2512
+ });
2513
+ }
2514
+ // @__NO_SIDE_EFFECTS__
2467
2515
  function _unknown(Class) {
2468
2516
  return new Class({ type: "unknown" });
2469
2517
  }
@@ -2667,7 +2715,7 @@ window.__ModuleLoader__.load({
2667
2715
  return ch;
2668
2716
  }
2669
2717
  //#endregion
2670
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
2718
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
2671
2719
  function initializeContext(params) {
2672
2720
  let target = params?.target ?? "draft-2020-12";
2673
2721
  if (target === "draft-4") target = "draft-04";
@@ -2883,8 +2931,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2883
2931
  defs[seen.defId] = seen.def;
2884
2932
  }
2885
2933
  }
2886
- if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2887
- else result.definitions = defs;
2934
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) {
2935
+ if (ctx.target === "draft-2020-12") result.$defs = defs;
2936
+ else result.definitions = defs;
2937
+ }
2888
2938
  try {
2889
2939
  const finalized = JSON.parse(JSON.stringify(result));
2890
2940
  Object.defineProperty(finalized, "~standard", {
@@ -2960,7 +3010,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2960
3010
  return finalize(ctx, schema);
2961
3011
  };
2962
3012
  //#endregion
2963
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
3013
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
2964
3014
  const formatMap = {
2965
3015
  guid: "uuid",
2966
3016
  url: "uri",
@@ -2997,21 +3047,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2997
3047
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
2998
3048
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
2999
3049
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
3000
- if (exMin) if (legacy) {
3001
- json.minimum = exclusiveMinimum;
3002
- json.exclusiveMinimum = true;
3003
- } else json.exclusiveMinimum = exclusiveMinimum;
3004
- else if (typeof minimum === "number") json.minimum = minimum;
3005
- if (exMax) if (legacy) {
3006
- json.maximum = exclusiveMaximum;
3007
- json.exclusiveMaximum = true;
3008
- } else json.exclusiveMaximum = exclusiveMaximum;
3009
- else if (typeof maximum === "number") json.maximum = maximum;
3050
+ if (exMin) {
3051
+ if (legacy) {
3052
+ json.minimum = exclusiveMinimum;
3053
+ json.exclusiveMinimum = true;
3054
+ } else json.exclusiveMinimum = exclusiveMinimum;
3055
+ } else if (typeof minimum === "number") json.minimum = minimum;
3056
+ if (exMax) {
3057
+ if (legacy) {
3058
+ json.maximum = exclusiveMaximum;
3059
+ json.exclusiveMaximum = true;
3060
+ } else json.exclusiveMaximum = exclusiveMaximum;
3061
+ } else if (typeof maximum === "number") json.maximum = maximum;
3010
3062
  if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3011
3063
  };
3012
3064
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3013
3065
  json.type = "boolean";
3014
3066
  };
3067
+ const undefinedProcessor = (_schema, ctx, _json, _params) => {
3068
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
3069
+ };
3015
3070
  const neverProcessor = (_schema, _ctx, json, _params) => {
3016
3071
  json.not = {};
3017
3072
  };
@@ -3022,6 +3077,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3022
3077
  if (values.every((v) => typeof v === "string")) json.type = "string";
3023
3078
  json.enum = values;
3024
3079
  };
3080
+ const literalProcessor = (schema, ctx, json, _params) => {
3081
+ const def = schema._zod.def;
3082
+ const vals = [];
3083
+ for (const val of def.values) if (val === void 0) {
3084
+ if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3085
+ } else if (typeof val === "bigint") {
3086
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3087
+ else vals.push(Number(val));
3088
+ } else vals.push(val);
3089
+ if (vals.length === 0) {} else if (vals.length === 1) {
3090
+ const val = vals[0];
3091
+ json.type = val === null ? "null" : typeof val;
3092
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
3093
+ else json.const = val;
3094
+ } else {
3095
+ if (vals.every((v) => typeof v === "number")) json.type = "number";
3096
+ if (vals.every((v) => typeof v === "string")) json.type = "string";
3097
+ if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
3098
+ if (vals.every((v) => v === null)) json.type = "null";
3099
+ json.enum = vals;
3100
+ }
3101
+ };
3025
3102
  const customProcessor = (_schema, ctx, _json, _params) => {
3026
3103
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3027
3104
  };
@@ -3168,7 +3245,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3168
3245
  seen.ref = def.innerType;
3169
3246
  };
3170
3247
  //#endregion
3171
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3248
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3172
3249
  const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3173
3250
  $ZodISODateTime.init(inst, def);
3174
3251
  ZodStringFormat.init(inst, def);
@@ -3198,7 +3275,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3198
3275
  return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3199
3276
  }
3200
3277
  //#endregion
3201
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3278
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3202
3279
  const initializer = (inst, issues) => {
3203
3280
  $ZodError.init(inst, issues);
3204
3281
  inst.name = "ZodError";
@@ -3220,7 +3297,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3220
3297
  };
3221
3298
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
3222
3299
  //#endregion
3223
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
3300
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
3224
3301
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3225
3302
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3226
3303
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3234,7 +3311,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3234
3311
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3235
3312
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3236
3313
  //#endregion
3237
- //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3314
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3238
3315
  const _installedGroups = /* @__PURE__ */ new WeakMap();
3239
3316
  function _installLazyMethods(inst, group, methods) {
3240
3317
  const proto = Object.getPrototypeOf(inst);
@@ -3648,6 +3725,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3648
3725
  function boolean(params) {
3649
3726
  return /* @__PURE__ */ _boolean(ZodBoolean, params);
3650
3727
  }
3728
+ const ZodUndefined = /*@__PURE__*/ $constructor("ZodUndefined", (inst, def) => {
3729
+ $ZodUndefined.init(inst, def);
3730
+ ZodType.init(inst, def);
3731
+ inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
3732
+ });
3733
+ function _undefined(params) {
3734
+ return /* @__PURE__ */ _undefined$1(ZodUndefined, params);
3735
+ }
3651
3736
  const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
3652
3737
  $ZodUnknown.init(inst, def);
3653
3738
  ZodType.init(inst, def);
@@ -3755,11 +3840,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3755
3840
  });
3756
3841
  });
3757
3842
  function object(shape, params) {
3758
- return new ZodObject({
3843
+ const def = {
3759
3844
  type: "object",
3760
3845
  shape: shape ?? {},
3761
3846
  ...normalizeParams(params)
3762
- });
3847
+ };
3848
+ return new ZodObject(def);
3763
3849
  }
3764
3850
  const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
3765
3851
  $ZodUnion.init(inst, def);
@@ -3817,9 +3903,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3817
3903
  };
3818
3904
  });
3819
3905
  function _enum(values, params) {
3906
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
3820
3907
  return new ZodEnum({
3821
3908
  type: "enum",
3822
- entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
3909
+ entries,
3910
+ ...normalizeParams(params)
3911
+ });
3912
+ }
3913
+ const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
3914
+ $ZodLiteral.init(inst, def);
3915
+ ZodType.init(inst, def);
3916
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
3917
+ inst.values = new Set(def.values);
3918
+ Object.defineProperty(inst, "value", { get() {
3919
+ if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
3920
+ return def.values[0];
3921
+ } });
3922
+ });
3923
+ function literal(value, params) {
3924
+ return new ZodLiteral({
3925
+ type: "literal",
3926
+ values: Array.isArray(value) ? value : [value],
3823
3927
  ...normalizeParams(params)
3824
3928
  });
3825
3929
  }
@@ -3989,8 +4093,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3989
4093
  return /* @__PURE__ */ _superRefine(fn, params);
3990
4094
  }
3991
4095
  //#endregion
3992
- //#region ../../llm/llm-billing/lib/typert.remote-client.js
3993
- const _deepseek_ai_dsh_llm_billing_billing_getBalance_result$schema = object({
4096
+ //#region ../llm-billing/lib/typert.remote-client.js
4097
+ const _rayadesu_dsh_llm_billing_billing_getBalance_result$schema = object({
3994
4098
  "isAvailable": boolean(),
3995
4099
  "lines": array(object({
3996
4100
  "currency": string(),
@@ -3999,8 +4103,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3999
4103
  "toppedUp": string()
4000
4104
  }))
4001
4105
  });
4002
- const _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema = intersection(string(), unknown());
4003
- const _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_result$schema = object({
4106
+ const _rayadesu_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema = intersection(string(), unknown());
4107
+ const _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema = object({
4004
4108
  "total": number(),
4005
4109
  "models": array(object({
4006
4110
  "model": string(),
@@ -4016,7 +4120,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4016
4120
  "outputCost": number()
4017
4121
  }))
4018
4122
  });
4019
- const _deepseek_ai_dsh_llm_billing_billing_getTodaySpend_result$schema = object({
4123
+ const _rayadesu_dsh_llm_billing_billing_getTodaySpend_parameter_0$schema = union([
4124
+ _undefined(),
4125
+ literal(false),
4126
+ literal(true)
4127
+ ]);
4128
+ const _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema = object({
4020
4129
  "total": number(),
4021
4130
  "models": array(object({
4022
4131
  "model": string(),
@@ -4033,10 +4142,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4033
4142
  }))
4034
4143
  });
4035
4144
  const TYPERT_REMOTE = {
4036
- package: "@deepseek-ai/dsh-llm-billing",
4145
+ package: "@rayadesu/dsh-llm-billing",
4037
4146
  descriptors: [
4038
4147
  {
4039
- id: "@deepseek-ai/dsh-llm-billing#billing/getBalance",
4148
+ id: "@rayadesu/dsh-llm-billing#billing/getBalance",
4040
4149
  service: "billing",
4041
4150
  namespace: "billing",
4042
4151
  method: "getBalance",
@@ -4044,17 +4153,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4044
4153
  parameters: [],
4045
4154
  result: {
4046
4155
  mode: "strict",
4047
- typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekBalance",
4048
- schema: _deepseek_ai_dsh_llm_billing_billing_getBalance_result$schema
4156
+ typeSymbol: "@rayadesu/dsh-llm-billing/types#DeepSeekBalance",
4157
+ schema: _rayadesu_dsh_llm_billing_billing_getBalance_result$schema
4049
4158
  },
4050
4159
  sourceLocation: {
4051
- "file": "packages/llm/llm-billing/src/balance.ts",
4052
- "line": 139,
4160
+ "file": "packages/llm-billing/src/balance.ts",
4161
+ "line": 143,
4053
4162
  "column": 3
4054
4163
  }
4055
4164
  },
4056
4165
  {
4057
- id: "@deepseek-ai/dsh-llm-billing#billing/getSessionSpend",
4166
+ id: "@rayadesu/dsh-llm-billing#billing/getSessionSpend",
4058
4167
  service: "billing",
4059
4168
  namespace: "billing",
4060
4169
  method: "getSessionSpend",
@@ -4065,44 +4174,54 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4065
4174
  source: "json",
4066
4175
  codec: {
4067
4176
  mode: "strict",
4068
- typeSymbol: "@deepseek-ai/dsh-session/types#SessionId",
4069
- schema: _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema
4177
+ typeSymbol: "@rayadesu/dsh-llm-billing#billing/getSessionSpend:sessionId",
4178
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema
4070
4179
  }
4071
4180
  }],
4072
4181
  result: {
4073
4182
  mode: "strict",
4074
- typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekSessionSpend",
4075
- schema: _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_result$schema
4183
+ typeSymbol: "@rayadesu/dsh-llm-billing/types#DeepSeekSessionSpend",
4184
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema
4076
4185
  },
4077
4186
  sourceLocation: {
4078
- "file": "packages/llm/llm-billing/src/balance.ts",
4079
- "line": 149,
4187
+ "file": "packages/llm-billing/src/balance.ts",
4188
+ "line": 154,
4080
4189
  "column": 3
4081
4190
  }
4082
4191
  },
4083
4192
  {
4084
- id: "@deepseek-ai/dsh-llm-billing#billing/getTodaySpend",
4193
+ id: "@rayadesu/dsh-llm-billing#billing/getTodaySpend",
4085
4194
  service: "billing",
4086
4195
  namespace: "billing",
4087
4196
  method: "getTodaySpend",
4088
4197
  invocation: { kind: "direct" },
4089
- parameters: [],
4198
+ parameters: [{
4199
+ name: "force",
4200
+ wire: "force",
4201
+ source: "json",
4202
+ acceptsUndefined: true,
4203
+ codec: {
4204
+ mode: "strict",
4205
+ typeSymbol: "@rayadesu/dsh-llm-billing#billing/getTodaySpend:force",
4206
+ schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_parameter_0$schema
4207
+ }
4208
+ }],
4090
4209
  result: {
4091
4210
  mode: "strict",
4092
- typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekTodaySpend",
4093
- schema: _deepseek_ai_dsh_llm_billing_billing_getTodaySpend_result$schema
4211
+ typeSymbol: "@rayadesu/dsh-llm-billing/types#DeepSeekTodaySpend",
4212
+ schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema
4094
4213
  },
4095
4214
  sourceLocation: {
4096
- "file": "packages/llm/llm-billing/src/balance.ts",
4097
- "line": 159,
4215
+ "file": "packages/llm-billing/src/balance.ts",
4216
+ "line": 167,
4098
4217
  "column": 3
4099
4218
  }
4100
4219
  }
4101
4220
  ]
4102
4221
  };
4103
4222
  //#endregion
4104
- //#region \0dsh-css:/Users/raya/Developer/deepseek-harness/packages/client/ui-billing/src/client/BalanceBadge.module.css.mjs
4105
- const css = ".EFxmGG_root{position:relative}.EFxmGG_trigger{background:var(--dsw-alias-fill-l2);min-height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;border:0;border-radius:8px;align-items:center;gap:4px;padding:4px 8px;display:inline-flex}.EFxmGG_trigger:hover,.EFxmGG_trigger:focus-visible{color:var(--dsw-alias-label-primary)}.EFxmGG_trigger svg{transition:transform .12s}.EFxmGG_chevronOpen{transform:rotate(180deg)}.EFxmGG_triggerLines{text-align:left;flex-direction:column;align-items:flex-start;gap:0;display:flex}.EFxmGG_linePrimary{font-variant-numeric:tabular-nums;font-size:12px;line-height:16px}.EFxmGG_lineSecondary{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:15px}.EFxmGG_unavailable{color:var(--dsw-alias-label-tertiary)}.EFxmGG_inlineIcon{color:var(--dsw-alias-label-tertiary);flex:none}.EFxmGG_spinning{color:var(--dsw-alias-label-tertiary);flex:none;animation:.8s linear infinite EFxmGG_spin}@keyframes EFxmGG_spin{to{transform:rotate(360deg)}}.EFxmGG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-menu);width:336px;max-width:min(360px,100vw - 32px);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;flex-direction:column;gap:2px;padding:6px;display:flex;position:absolute;top:calc(100% + 6px);right:0}.EFxmGG_amountRow{border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}.EFxmGG_amountLabel{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;line-height:18px}.EFxmGG_spendRow{border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}.EFxmGG_costRow{align-items:center;padding:2px 8px 6px;display:flex}.EFxmGG_costBreakdown{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.EFxmGG_amountActions{align-items:center;gap:2px;display:inline-flex}.EFxmGG_infoButton,.EFxmGG_refreshButton{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.EFxmGG_infoButton:hover,.EFxmGG_infoButton:focus-visible,.EFxmGG_refreshButton:hover,.EFxmGG_refreshButton:focus-visible{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-fill-l2)}.EFxmGG_modelRow{border-radius:8px;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;display:flex}.EFxmGG_modelName{color:var(--dsw-alias-label-secondary);flex:none;font-size:12px;line-height:18px}.EFxmGG_tasks{text-align:right;min-width:0;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;overflow-wrap:anywhere;font-size:12px;line-height:18px}";
4223
+ //#region \0dsh-css:C:\Users\admin\Desktop\me\code\DeepSeek-Harness-chat-billing\packages\ui-billing\src\client\BalanceBadge.module.css.mjs
4224
+ const css = "._4_Wqcq_root{position:relative}._4_Wqcq_trigger{background:var(--dsw-alias-fill-l2);min-height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;border:0;border-radius:8px;align-items:center;gap:4px;padding:4px 8px;display:inline-flex}._4_Wqcq_trigger:hover,._4_Wqcq_trigger:focus-visible{color:var(--dsw-alias-label-primary)}._4_Wqcq_trigger svg{transition:transform .12s}._4_Wqcq_chevronOpen{transform:rotate(180deg)}._4_Wqcq_triggerLines{text-align:left;flex-direction:column;align-items:flex-start;gap:0;display:flex}._4_Wqcq_linePrimary{font-variant-numeric:tabular-nums;font-size:12px;line-height:16px}._4_Wqcq_lineSecondary{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:15px}._4_Wqcq_unavailable{color:var(--dsw-alias-label-tertiary)}._4_Wqcq_inlineIcon{color:var(--dsw-alias-label-tertiary);flex:none}._4_Wqcq_spinning{color:var(--dsw-alias-label-tertiary);flex:none;animation:.8s linear infinite _4_Wqcq_spin}@keyframes _4_Wqcq_spin{to{transform:rotate(360deg)}}._4_Wqcq_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-menu);width:336px;max-width:min(360px,100vw - 32px);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;flex-direction:column;gap:2px;padding:6px;display:flex;position:absolute;top:calc(100% + 6px);right:0}._4_Wqcq_amountRow{border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_amountLabel{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;line-height:18px}._4_Wqcq_spendRow{border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_costRow{align-items:center;padding:2px 8px 6px;display:flex}._4_Wqcq_costBreakdown{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}._4_Wqcq_amountActions{align-items:center;gap:2px;display:inline-flex}._4_Wqcq_infoButton,._4_Wqcq_refreshButton{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}._4_Wqcq_infoButton:hover,._4_Wqcq_infoButton:focus-visible,._4_Wqcq_refreshButton:hover,._4_Wqcq_refreshButton:focus-visible{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-fill-l2)}._4_Wqcq_modelRow{border-radius:8px;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;display:flex}._4_Wqcq_modelName{color:var(--dsw-alias-label-secondary);flex:none;font-size:12px;line-height:18px}._4_Wqcq_tasks{text-align:right;min-width:0;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;overflow-wrap:anywhere;font-size:12px;line-height:18px}";
4106
4225
  const tagId = "@rayadesu/dsh-client-ui-billing/BalanceBadge.module.css";
4107
4226
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
4108
4227
  const tag = document.createElement("style");
@@ -4112,31 +4231,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4112
4231
  document.head.appendChild(tag);
4113
4232
  }
4114
4233
  var BalanceBadge_module_css_default = {
4115
- "amountActions": "EFxmGG_amountActions",
4116
- "amountLabel": "EFxmGG_amountLabel",
4117
- "amountRow": "EFxmGG_amountRow",
4118
- "chevronOpen": "EFxmGG_chevronOpen",
4119
- "costBreakdown": "EFxmGG_costBreakdown",
4120
- "costRow": "EFxmGG_costRow",
4121
- "infoButton": "EFxmGG_infoButton",
4122
- "inlineIcon": "EFxmGG_inlineIcon",
4123
- "linePrimary": "EFxmGG_linePrimary",
4124
- "lineSecondary": "EFxmGG_lineSecondary",
4125
- "modelName": "EFxmGG_modelName",
4126
- "modelRow": "EFxmGG_modelRow",
4127
- "panel": "EFxmGG_panel",
4128
- "refreshButton": "EFxmGG_refreshButton",
4129
- "root": "EFxmGG_root",
4130
- "spendRow": "EFxmGG_spendRow",
4131
- "spin": "EFxmGG_spin",
4132
- "spinning": "EFxmGG_spinning",
4133
- "tasks": "EFxmGG_tasks",
4134
- "trigger": "EFxmGG_trigger",
4135
- "triggerLines": "EFxmGG_triggerLines",
4136
- "unavailable": "EFxmGG_unavailable"
4234
+ "amountActions": "_4_Wqcq_amountActions",
4235
+ "amountLabel": "_4_Wqcq_amountLabel",
4236
+ "amountRow": "_4_Wqcq_amountRow",
4237
+ "chevronOpen": "_4_Wqcq_chevronOpen",
4238
+ "costBreakdown": "_4_Wqcq_costBreakdown",
4239
+ "costRow": "_4_Wqcq_costRow",
4240
+ "infoButton": "_4_Wqcq_infoButton",
4241
+ "inlineIcon": "_4_Wqcq_inlineIcon",
4242
+ "linePrimary": "_4_Wqcq_linePrimary",
4243
+ "lineSecondary": "_4_Wqcq_lineSecondary",
4244
+ "modelName": "_4_Wqcq_modelName",
4245
+ "modelRow": "_4_Wqcq_modelRow",
4246
+ "panel": "_4_Wqcq_panel",
4247
+ "refreshButton": "_4_Wqcq_refreshButton",
4248
+ "root": "_4_Wqcq_root",
4249
+ "spendRow": "_4_Wqcq_spendRow",
4250
+ "spin": "_4_Wqcq_spin",
4251
+ "spinning": "_4_Wqcq_spinning",
4252
+ "tasks": "_4_Wqcq_tasks",
4253
+ "trigger": "_4_Wqcq_trigger",
4254
+ "triggerLines": "_4_Wqcq_triggerLines",
4255
+ "unavailable": "_4_Wqcq_unavailable"
4137
4256
  };
4138
4257
  //#endregion
4139
- //#region src/client/BalanceBadge.tsx
4258
+ //#region lib/types/client/BalanceBadge.js
4140
4259
  /** Session-header billing badge: balance plus the current conversation's billed spend. */
4141
4260
  /** Currency prefix for one balance line; unknown codes render as a literal prefix. */
4142
4261
  function currencySymbol(currency) {
@@ -4158,6 +4277,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4158
4277
  return `¥${amount.toFixed(4).replace(/\.?0+$/, "")}`;
4159
4278
  }
4160
4279
  /**
4280
+ * Run one fetch line: the fetch is deferred to a microtask so the effect's
4281
+ * render commits before any state update lands; a settled value is stored
4282
+ * while `current` stays true, and a rejection keeps the previous value (a
4283
+ * no-op unless `onReject` supplies fallback handling) so a failed refetch
4284
+ * never blanks the UI.
4285
+ */
4286
+ function fetchLine(current, fetch, store, onReject) {
4287
+ return Promise.resolve().then(fetch).then((value) => {
4288
+ if (current()) store(value);
4289
+ }, (reason) => {
4290
+ if (current()) onReject?.(reason);
4291
+ });
4292
+ }
4293
+ /**
4161
4294
  * Render the billing badge in the session-header utilities row. The trigger
4162
4295
  * shows the remaining balance and this conversation's billed spend and opens
4163
4296
  * a label box with the amount, this session's spend with its cache-hit /
@@ -4186,24 +4319,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4186
4319
  const pricedRunningRef = (0, react.useRef)(running);
4187
4320
  (0, react.useEffect)(() => {
4188
4321
  let current = true;
4322
+ const isCurrent = () => current;
4189
4323
  setRefreshing(balance !== null);
4190
4324
  Promise.resolve().then(() => {
4191
- const balanceRequest = Promise.resolve().then(getBalance).then((value) => {
4192
- if (!current) return;
4325
+ const balanceRequest = fetchLine(isCurrent, getBalance, (value) => {
4193
4326
  setBalance(value);
4194
4327
  setError(null);
4195
4328
  }, (reason) => {
4196
- if (!current) return;
4197
4329
  if (balance === null) setError(reason instanceof Error ? reason.message : String(reason));
4198
4330
  });
4199
- const sessionSpendRequest = Promise.resolve().then(() => getSessionSpend(sessionId)).then((value) => {
4200
- if (!current) return;
4201
- setSpend(value);
4202
- }, () => {});
4203
- const todaySpendRequest = Promise.resolve().then(() => getTodaySpend(request > 0)).then((value) => {
4204
- if (!current) return;
4205
- setTodaySpend(value);
4206
- }, () => {});
4331
+ const sessionSpendRequest = fetchLine(isCurrent, () => getSessionSpend(sessionId), setSpend);
4332
+ const todaySpendRequest = fetchLine(isCurrent, () => getTodaySpend(request > 0), setTodaySpend);
4207
4333
  Promise.allSettled([
4208
4334
  balanceRequest,
4209
4335
  sessionSpendRequest,
@@ -4227,17 +4353,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4227
4353
  pricedRunningRef.current = running;
4228
4354
  if (running) return;
4229
4355
  let current = true;
4356
+ const isCurrent = () => current;
4230
4357
  const timer = setTimeout(() => {
4231
- Promise.resolve().then(() => {
4232
- Promise.resolve().then(() => getSessionSpend(sessionId)).then((value) => {
4233
- if (!current) return;
4234
- setSpend(value);
4235
- }, () => {});
4236
- Promise.resolve().then(() => getTodaySpend()).then((value) => {
4237
- if (!current) return;
4238
- setTodaySpend(value);
4239
- }, () => {});
4240
- });
4358
+ fetchLine(isCurrent, () => getSessionSpend(sessionId), setSpend);
4359
+ fetchLine(isCurrent, () => getTodaySpend(), setTodaySpend);
4241
4360
  }, 2e3);
4242
4361
  return () => {
4243
4362
  clearTimeout(timer);
@@ -4261,20 +4380,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4261
4380
  }, [open]);
4262
4381
  if (balance === null) {
4263
4382
  if (error === null) return null;
4264
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4383
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4265
4384
  label: error,
4266
4385
  delayMs: 500,
4267
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4386
+ children: (0, react_jsx_runtime.jsxs)("button", {
4268
4387
  type: "button",
4269
4388
  className: BalanceBadge_module_css_default.trigger,
4270
4389
  onClick: () => {
4271
4390
  setRequest((value) => value + 1);
4272
4391
  },
4273
4392
  "aria-label": t("action.refresh"),
4274
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4393
+ children: [(0, react_jsx_runtime.jsx)("span", {
4275
4394
  className: BalanceBadge_module_css_default.unavailable,
4276
4395
  children: t("state.unavailable")
4277
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: BalanceBadge_module_css_default.inlineIcon })]
4396
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: BalanceBadge_module_css_default.inlineIcon })]
4278
4397
  })
4279
4398
  });
4280
4399
  }
@@ -4284,10 +4403,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4284
4403
  const line = primaryLine(balance);
4285
4404
  const amount = line === void 0 ? "—" : `${line.symbol}${line.total}`;
4286
4405
  const spendLine = spend !== null && spend.models.length > 0 ? t("trigger.conversationSpend", { amount: formatSpend(spend.total) }) : void 0;
4287
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4406
+ return (0, react_jsx_runtime.jsxs)("div", {
4288
4407
  ref: rootRef,
4289
4408
  className: BalanceBadge_module_css_default.root,
4290
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4409
+ children: [(0, react_jsx_runtime.jsxs)("button", {
4291
4410
  type: "button",
4292
4411
  className: BalanceBadge_module_css_default.trigger,
4293
4412
  "aria-expanded": open,
@@ -4295,70 +4414,70 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4295
4414
  onClick: () => {
4296
4415
  setOpen((value) => !value);
4297
4416
  },
4298
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4417
+ children: [(0, react_jsx_runtime.jsxs)("span", {
4299
4418
  className: BalanceBadge_module_css_default.triggerLines,
4300
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4419
+ children: [(0, react_jsx_runtime.jsx)("span", {
4301
4420
  className: BalanceBadge_module_css_default.linePrimary,
4302
4421
  children: t("trigger.balance", { amount })
4303
- }), spendLine !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4422
+ }), spendLine !== void 0 && (0, react_jsx_runtime.jsx)("span", {
4304
4423
  className: BalanceBadge_module_css_default.lineSecondary,
4305
4424
  children: spendLine
4306
4425
  })]
4307
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? BalanceBadge_module_css_default.chevronOpen : void 0 })]
4308
- }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4426
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? BalanceBadge_module_css_default.chevronOpen : void 0 })]
4427
+ }), open ? (0, react_jsx_runtime.jsxs)("div", {
4309
4428
  className: BalanceBadge_module_css_default.panel,
4310
4429
  role: "dialog",
4311
4430
  "aria-label": t("panel.aria"),
4312
4431
  children: [
4313
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4432
+ (0, react_jsx_runtime.jsxs)("div", {
4314
4433
  className: BalanceBadge_module_css_default.amountRow,
4315
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4434
+ children: [(0, react_jsx_runtime.jsx)("span", {
4316
4435
  className: BalanceBadge_module_css_default.amountLabel,
4317
4436
  children: t("label.amount", { amount })
4318
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4437
+ }), (0, react_jsx_runtime.jsxs)("span", {
4319
4438
  className: BalanceBadge_module_css_default.amountActions,
4320
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4439
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4321
4440
  label: t("info.hint"),
4322
4441
  delayMs: 200,
4323
4442
  maxWidth: 340,
4324
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4443
+ children: (0, react_jsx_runtime.jsx)("button", {
4325
4444
  type: "button",
4326
4445
  className: BalanceBadge_module_css_default.infoButton,
4327
4446
  "aria-label": t("info.aria"),
4328
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14, { className: BalanceBadge_module_css_default.inlineIcon })
4447
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14, { className: BalanceBadge_module_css_default.inlineIcon })
4329
4448
  })
4330
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4449
+ }), (0, react_jsx_runtime.jsx)("button", {
4331
4450
  type: "button",
4332
4451
  className: BalanceBadge_module_css_default.refreshButton,
4333
4452
  onClick: refresh,
4334
4453
  "aria-label": t("action.refresh"),
4335
4454
  "data-refreshing": refreshing || void 0,
4336
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: refreshing ? BalanceBadge_module_css_default.spinning : BalanceBadge_module_css_default.inlineIcon })
4455
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: refreshing ? BalanceBadge_module_css_default.spinning : BalanceBadge_module_css_default.inlineIcon })
4337
4456
  })]
4338
4457
  })]
4339
4458
  }),
4340
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4459
+ (0, react_jsx_runtime.jsxs)("div", {
4341
4460
  className: BalanceBadge_module_css_default.spendRow,
4342
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4461
+ children: [(0, react_jsx_runtime.jsx)("span", {
4343
4462
  className: BalanceBadge_module_css_default.amountLabel,
4344
4463
  children: t("label.sessionSpend", { amount: spend === null ? "—" : spend.models.length === 0 ? t("stat.none") : formatSpend(spend.total) })
4345
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4464
+ }), (0, react_jsx_runtime.jsx)("span", {
4346
4465
  className: BalanceBadge_module_css_default.amountLabel,
4347
4466
  children: t("label.todaySpend", { amount: todaySpend === null ? "—" : todaySpend.models.length === 0 ? t("stat.none") : formatSpend(todaySpend.total) })
4348
4467
  })]
4349
4468
  }),
4350
- spend?.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4469
+ spend?.models.map((model) => (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
4351
4470
  className: BalanceBadge_module_css_default.modelRow,
4352
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4471
+ children: [(0, react_jsx_runtime.jsx)("span", {
4353
4472
  className: BalanceBadge_module_css_default.modelName,
4354
4473
  children: model.displayName
4355
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4474
+ }), (0, react_jsx_runtime.jsx)("span", {
4356
4475
  className: BalanceBadge_module_css_default.tasks,
4357
4476
  children: formatSpend(model.cost)
4358
4477
  })]
4359
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4478
+ }), (0, react_jsx_runtime.jsx)("div", {
4360
4479
  className: BalanceBadge_module_css_default.costRow,
4361
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4480
+ children: (0, react_jsx_runtime.jsxs)("span", {
4362
4481
  className: BalanceBadge_module_css_default.costBreakdown,
4363
4482
  children: [
4364
4483
  t("label.cost.hit", { amount: formatSpend(model.cacheHitInputCost) }),
@@ -4374,7 +4493,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4374
4493
  });
4375
4494
  }
4376
4495
  //#endregion
4377
- //#region src/client/locales.ts
4496
+ //#region lib/types/client/locales.js
4378
4497
  /** `billing` namespace dictionaries. */
4379
4498
  /** Dictionary namespace owned by this plugin. */
4380
4499
  const NS = "billing";
@@ -4415,13 +4534,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4415
4534
  "panel.aria": "DeepSeek balance details"
4416
4535
  };
4417
4536
  //#endregion
4418
- //#region src/client/index.ts
4537
+ //#region lib/types/client/index.js
4538
+ /** DeepSeek account-balance badge, browser half: one session-header utility entry. */
4419
4539
  /** Services required for locale registration, the Remote face, and the header slot. */
4420
4540
  const inject = [
4421
4541
  "slots",
4422
4542
  "locale",
4423
4543
  "remote"
4424
4544
  ];
4545
+ /** Unwrap one Remote result into its value, reporting the endpoint on failure. */
4546
+ function unwrap(endpoint, result) {
4547
+ if (!result.ok) throw new Error(`${endpoint} failed: ${result.error.code}: ${result.error.message}`);
4548
+ return result.value;
4549
+ }
4425
4550
  /**
4426
4551
  * Client plugin body: mount the `billing` Remote, register the dictionaries,
4427
4552
  * and contribute the header utility badge.
@@ -4435,29 +4560,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4435
4560
  zh,
4436
4561
  en
4437
4562
  }), "ui-billing: dictionaries");
4438
- const injected = () => ({
4439
- getBalance: async () => {
4440
- const result = await billing.getBalance();
4441
- if (!result.ok) throw new Error(`billing.getBalance failed: ${result.error.code}: ${result.error.message}`);
4442
- return result.value;
4443
- },
4444
- getSessionSpend: async (sessionId) => {
4445
- const result = await billing.getSessionSpend(sessionId);
4446
- if (!result.ok) throw new Error(`billing.getSessionSpend failed: ${result.error.code}: ${result.error.message}`);
4447
- return result.value;
4448
- },
4449
- getTodaySpend: async (force) => {
4450
- const result = await billing.getTodaySpend(force);
4451
- if (!result.ok) throw new Error(`billing.getTodaySpend failed: ${result.error.code}: ${result.error.message}`);
4452
- return result.value;
4453
- }
4454
- });
4563
+ const injected = {
4564
+ getBalance: async () => unwrap("billing.getBalance", await billing.getBalance()),
4565
+ getSessionSpend: async (sessionId) => unwrap("billing.getSessionSpend", await billing.getSessionSpend(sessionId)),
4566
+ getTodaySpend: async (force) => unwrap("billing.getTodaySpend", await billing.getTodaySpend(force))
4567
+ };
4455
4568
  ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
4456
4569
  name: "conversation.session.header.utilities",
4457
4570
  id: "billing-balance",
4458
4571
  order: 30,
4459
4572
  locale: NS,
4460
- inject: injected
4573
+ inject: () => injected
4461
4574
  }, BalanceBadge));
4462
4575
  }
4463
4576
  //#endregion
package/lib/invariant.js CHANGED
@@ -1,9 +1,9 @@
1
1
  //#region lib/types/invariant.js
2
2
  /**
3
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-billing`.
4
- * @module @deepseek-ai/dsh-client-ui-billing/invariant
3
+ * Package-owned invariant companion for `@rayadesu/dsh-client-ui-billing`.
4
+ * @module @rayadesu/dsh-client-ui-billing/invariant
5
5
  */
6
- const PACKAGE_NAME = "@deepseek-ai/dsh-client-ui-billing";
6
+ const PACKAGE_NAME = "@rayadesu/dsh-client-ui-billing";
7
7
  /** Cordis companion plugin name. */
8
8
  const name = "client-ui-billing-invariant";
9
9
  /** Service required before the companion can reserve package ownership. */
@@ -1,6 +1,6 @@
1
1
  /** Session-header billing badge: balance plus the current conversation's billed spend. */
2
- import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySpend } from '@deepseek-ai/dsh-llm-billing/types';
3
- import type { SessionId } from '@deepseek-ai/dsh-client-runtime/client';
2
+ import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySpend } from '@rayadesu/dsh-llm-billing/types';
3
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
4
4
  import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
5
5
  import { NS } from './locales.ts';
6
6
  /** Registration-side Remote face used by the header badge. */
@@ -9,8 +9,12 @@ export interface BalanceBadgeInjected {
9
9
  getBalance: () => Promise<DeepSeekBalance>;
10
10
  /** Read one session's billed spend; rejects with the Remote error message. */
11
11
  getSessionSpend: (sessionId: SessionId) => Promise<DeepSeekSessionSpend>;
12
- /** Read today's billed spend across every session; rejects with the Remote error message. */
13
- getTodaySpend: () => Promise<DeepSeekTodaySpend>;
12
+ /**
13
+ * Read today's billed spend across every session; rejects with the Remote
14
+ * error message. `force` bypasses the host-side cache — the manual refresh
15
+ * passes it, the turn-triggered recompute does not.
16
+ */
17
+ getTodaySpend: (force?: boolean) => Promise<DeepSeekTodaySpend>;
14
18
  }
15
19
  /** Full props assembled by the header utilities slot renderer. */
16
20
  export type BalanceBadgeProps = PropsRuntime<'conversation.session.header.utilities'> & InjectFace<BalanceBadgeInjected> & PropsLocale<typeof NS>;
@@ -22,12 +26,13 @@ export type BalanceBadgeProps = PropsRuntime<'conversation.session.header.utilit
22
26
  * every session, a refresh action, and a spend disclaimer. Refreshing keeps
23
27
  * the last values visible rather than blanking them.
24
28
  *
25
- * The spend follows the conversation: a new message in the current session
26
- * recomputes only the (local, network-free) session spend and today's spend
27
- * through `getSessionSpend` / `getTodaySpend`; the balance stays a
28
- * manual-refresh snapshot and is never refetched on its own.
29
+ * The spend follows the conversation: when a prompt turn settles in the
30
+ * current session, the badge recomputes only the (local, network-free)
31
+ * session spend and today's spend through `getSessionSpend` /
32
+ * `getTodaySpend`; the balance stays a manual-refresh snapshot and is never
33
+ * refetched on its own.
29
34
  * @param props - Remote face, locale, and the standard session-header runtime share.
30
- * @returns the badge, or null while the first fetch is in flight.
35
+ * @returns the badge, or null until the first balance fetch settles.
31
36
  */
32
37
  export declare function BalanceBadge({ getBalance, getSessionSpend, getTodaySpend, sessionId, useSession, t }: BalanceBadgeProps): import("react").JSX.Element | null;
33
38
  //# sourceMappingURL=BalanceBadge.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** DeepSeek account-balance badge, browser half: one session-header utility entry. */
2
- import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
2
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
3
3
  import { type BillingKey } from './locales.ts';
4
4
  export type { BalanceBadgeInjected, BalanceBadgeProps } from './BalanceBadge.tsx';
5
5
  export type { BillingKey } from './locales.ts';
@@ -15,7 +15,7 @@ export declare const zh: {
15
15
  readonly 'state.unavailable': "额度不可用";
16
16
  readonly 'action.refresh': "刷新";
17
17
  readonly 'info.aria': "花费说明";
18
- readonly 'info.hint': "仅能预估 DeepSeek 相关模型。本会话花费按每条消息的发生时刻(北京时间)所在峰谷时段单价计费:缓存命中输入、未命中输入(含缓存写入)、输出(含推理)分别计价。费用按 8 月 17 日实行的标准。";
18
+ readonly 'info.hint': "仅能预估 DeepSeek 相关模型。本会话花费按每条消息的发生时刻(北京时间)所在峰谷时段单价计费:缓存命中输入、未命中输入(含缓存写入)、输出(含推理)分别计价。费率按 8 月 17 日实行的标准,高峰时段为北京时间周一至周五 9:00–12:00、14:00–18:00,周末全天按低谷价计费。";
19
19
  readonly 'badge.aria': "DeepSeek 额度:{amount}";
20
20
  readonly 'panel.aria': "DeepSeek 额度详情";
21
21
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-billing`.
3
- * @module @deepseek-ai/dsh-client-ui-billing/invariant
2
+ * Package-owned invariant companion for `@rayadesu/dsh-client-ui-billing`.
3
+ * @module @rayadesu/dsh-client-ui-billing/invariant
4
4
  */
5
5
  import type { Context } from '@deepseek-ai/cordis';
6
6
  /** Cordis companion plugin name. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rayadesu/dsh-client-ui-billing",
3
3
  "description": "Session-header DeepSeek account-balance and conversation-spend badge over the billing Remote",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
@@ -24,16 +24,18 @@
24
24
  "dsh": {
25
25
  "client": {
26
26
  "inject": [
27
+ "@deepseek-ai/dsh-api-remotes",
27
28
  "@deepseek-ai/dsh-client-locale",
28
- "@deepseek-ai/dsh-client-runtime",
29
- "@deepseek-ai/dsh-client-ui-conversation"
29
+ "@deepseek-ai/dsh-client-ui-conversation",
30
+ "@deepseek-ai/dsh-client-ui-renderer"
30
31
  ],
31
32
  "platform": "web"
32
33
  }
33
34
  },
34
35
  "scripts": {
35
36
  "bundle": "tsdown",
36
- "watch": "tsdown --watch"
37
+ "watch": "tsdown --watch",
38
+ "prepublishOnly": "node ../../scripts/verify-packages.mjs"
37
39
  },
38
40
  "license": "MIT",
39
41
  "repository": {
@@ -45,27 +47,36 @@
45
47
  "access": "public"
46
48
  },
47
49
  "peerDependencies": {
48
- "@rayadesu/dsh-llm-billing": "^0.2.1",
49
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
50
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
51
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.8",
52
- "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.8",
53
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
54
- "@deepseek-ai/cordis": "^4.0.1"
50
+ "@rayadesu/dsh-llm-billing": "^0.2.3",
51
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
52
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
53
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.1-rc.2",
54
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
55
+ "@deepseek-ai/cordis": "^4.0.1",
56
+ "@deepseek-ai/dsh-api-remotes": "^0.1.1-rc.2",
57
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.1-rc.2",
58
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2"
55
59
  },
56
60
  "devDependencies": {
57
- "@rayadesu/dsh-llm-billing": "^0.2.1",
58
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
59
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
60
- "@deepseek-ai/dsh-client-test-runtime": "^0.1.0-rc.8",
61
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.8",
62
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.8",
63
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.8",
64
- "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.8",
65
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
61
+ "@rayadesu/dsh-llm-billing": "^0.2.3",
62
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
63
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
64
+ "@deepseek-ai/dsh-client-test-runtime": "^0.1.1-rc.2",
65
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
66
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.1-rc.2",
67
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
68
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.1-rc.2",
69
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
70
+ "@testing-library/dom": "^10.4.1",
71
+ "@testing-library/react": "^16.3.2",
66
72
  "@types/react": "~18.3.1",
67
73
  "react": "^18.2.0",
68
- "@deepseek-ai/cordis": "^4.0.1"
74
+ "react-dom": "^18.2.0",
75
+ "use-sync-external-store": "^1.2.0",
76
+ "@deepseek-ai/cordis": "^4.0.1",
77
+ "@deepseek-ai/dsh-api-remotes": "^0.1.1-rc.2",
78
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.1-rc.2",
79
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2"
69
80
  },
70
81
  "files": [
71
82
  "lib/index.js",