@rayadesu/dsh-llm-billing 0.3.7 → 0.3.9

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.
@@ -1,6 +1,7 @@
1
1
  /* Generated by @deepseek-ai/dsh-typert-generator from FaceModel — do not edit. */
2
2
  import { z } from 'zod'
3
3
 
4
+ const _rayadesu_dsh_llm_billing_billing_getBalance_parameter_0$schema = z.union([z.undefined(), z.literal(false), z.literal(true)])
4
5
  const _rayadesu_dsh_llm_billing_billing_getBalance_result$schema = z.object({
5
6
  'isAvailable': z.boolean(),
6
7
  'lines': z.array(z.object({
@@ -27,6 +28,13 @@ const _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema = z.object
27
28
  'outputCost': z.number(),
28
29
  })),
29
30
  })
31
+ const _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_parameter_0$schema = z.intersection(z.string(), z.unknown())
32
+ const _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_result$schema = z.object({
33
+ 'turns': z.array(z.object({
34
+ 'messageId': z.string(),
35
+ 'total': z.number(),
36
+ })),
37
+ })
30
38
  const _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_parameter_0$schema = z.union([z.undefined(), z.literal(false), z.literal(true)])
31
39
  const _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_result$schema = z.object({
32
40
  'sessions': z.array(z.object({
@@ -71,13 +79,24 @@ export const TYPERT = {
71
79
  method: 'getBalance',
72
80
  invocation: { kind: 'direct' },
73
81
  parameters: [
82
+ {
83
+ name: 'force',
84
+ wire: 'force',
85
+ source: 'json',
86
+ acceptsUndefined: true,
87
+ codec: {
88
+ mode: 'strict',
89
+ typeSymbol: '@rayadesu/dsh-llm-billing#billing/getBalance:force',
90
+ schema: _rayadesu_dsh_llm_billing_billing_getBalance_parameter_0$schema,
91
+ },
92
+ },
74
93
  ],
75
94
  result: {
76
95
  mode: 'strict',
77
96
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekBalance',
78
97
  schema: _rayadesu_dsh_llm_billing_billing_getBalance_result$schema,
79
98
  },
80
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":154,"column":3},
99
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":165,"column":3},
81
100
  },
82
101
  {
83
102
  id: '@rayadesu/dsh-llm-billing#billing/getSessionSpend',
@@ -102,7 +121,32 @@ export const TYPERT = {
102
121
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionSpend',
103
122
  schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema,
104
123
  },
105
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":165,"column":3},
124
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":176,"column":3},
125
+ },
126
+ {
127
+ id: '@rayadesu/dsh-llm-billing#billing/getSessionTurnSpends',
128
+ service: 'billing',
129
+ namespace: 'billing',
130
+ method: 'getSessionTurnSpends',
131
+ invocation: { kind: 'direct' },
132
+ parameters: [
133
+ {
134
+ name: 'sessionId',
135
+ wire: 'sessionId',
136
+ source: 'json',
137
+ codec: {
138
+ mode: 'strict',
139
+ typeSymbol: '@rayadesu/dsh-llm-billing#billing/getSessionTurnSpends:sessionId',
140
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_parameter_0$schema,
141
+ },
142
+ },
143
+ ],
144
+ result: {
145
+ mode: 'strict',
146
+ typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionTurnSpends',
147
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_result$schema,
148
+ },
149
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":227,"column":3},
106
150
  },
107
151
  {
108
152
  id: '@rayadesu/dsh-llm-billing#billing/getTodaySessionsSpend',
@@ -128,7 +172,7 @@ export const TYPERT = {
128
172
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySessionsSpend',
129
173
  schema: _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_result$schema,
130
174
  },
131
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":192,"column":3},
175
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":202,"column":3},
132
176
  },
133
177
  {
134
178
  id: '@rayadesu/dsh-llm-billing#billing/getTodaySpend',
@@ -154,7 +198,7 @@ export const TYPERT = {
154
198
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySpend',
155
199
  schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema,
156
200
  },
157
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":178,"column":3},
201
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":189,"column":3},
158
202
  },
159
203
  {
160
204
  id: '@rayadesu/dsh-llm-billing#billing/getTurnSpend',
@@ -189,7 +233,7 @@ export const TYPERT = {
189
233
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTurnSpend',
190
234
  schema: _rayadesu_dsh_llm_billing_billing_getTurnSpend_result$schema,
191
235
  },
192
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":205,"column":3},
236
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":215,"column":3},
193
237
  },
194
238
  ],
195
239
  model: {
@@ -3,19 +3,21 @@ import type {
3
3
  RemoteResult,
4
4
  TypertRemoteContribution,
5
5
  } from '@deepseek-ai/dsh-typert-protocol'
6
- import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySessionsSpend, DeepSeekTodaySpend, DeepSeekTurnSpend } from '@rayadesu/dsh-llm-billing/types'
6
+ import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekSessionTurnSpends, DeepSeekTodaySessionsSpend, DeepSeekTodaySpend, DeepSeekTurnSpend } from '@rayadesu/dsh-llm-billing/types'
7
7
 
8
8
  declare module '@deepseek-ai/dsh-typert-protocol' {
9
9
  interface TypertRemoteNamespace$62696c6c696e67 {
10
- getBalance: () => Promise<RemoteResult<DeepSeekBalance>>
10
+ getBalance: (force?: boolean) => Promise<RemoteResult<DeepSeekBalance>>
11
11
  getSessionSpend: (sessionId: SessionId) => Promise<RemoteResult<DeepSeekSessionSpend>>
12
+ getSessionTurnSpends: (sessionId: SessionId) => Promise<RemoteResult<DeepSeekSessionTurnSpends>>
12
13
  getTodaySessionsSpend: (force?: boolean) => Promise<RemoteResult<DeepSeekTodaySessionsSpend>>
13
14
  getTodaySpend: (force?: boolean) => Promise<RemoteResult<DeepSeekTodaySpend>>
14
15
  getTurnSpend: (sessionId: SessionId, messageId: string) => Promise<RemoteResult<DeepSeekTurnSpend>>
15
16
  }
16
17
  interface TypertRemoteMap {
17
- 'billing/getBalance': () => Promise<RemoteResult<DeepSeekBalance>>
18
+ 'billing/getBalance': (force?: boolean) => Promise<RemoteResult<DeepSeekBalance>>
18
19
  'billing/getSessionSpend': (sessionId: SessionId) => Promise<RemoteResult<DeepSeekSessionSpend>>
20
+ 'billing/getSessionTurnSpends': (sessionId: SessionId) => Promise<RemoteResult<DeepSeekSessionTurnSpends>>
19
21
  'billing/getTodaySessionsSpend': (force?: boolean) => Promise<RemoteResult<DeepSeekTodaySessionsSpend>>
20
22
  'billing/getTodaySpend': (force?: boolean) => Promise<RemoteResult<DeepSeekTodaySpend>>
21
23
  'billing/getTurnSpend': (sessionId: SessionId, messageId: string) => Promise<RemoteResult<DeepSeekTurnSpend>>
@@ -1,6 +1,7 @@
1
1
  /* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
2
2
  import { z } from 'zod'
3
3
 
4
+ const _rayadesu_dsh_llm_billing_billing_getBalance_parameter_0$schema = z.union([z.undefined(), z.literal(false), z.literal(true)])
4
5
  const _rayadesu_dsh_llm_billing_billing_getBalance_result$schema = z.object({
5
6
  'isAvailable': z.boolean(),
6
7
  'lines': z.array(z.object({
@@ -27,6 +28,13 @@ const _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema = z.object
27
28
  'outputCost': z.number(),
28
29
  })),
29
30
  })
31
+ const _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_parameter_0$schema = z.intersection(z.string(), z.unknown())
32
+ const _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_result$schema = z.object({
33
+ 'turns': z.array(z.object({
34
+ 'messageId': z.string(),
35
+ 'total': z.number(),
36
+ })),
37
+ })
30
38
  const _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_parameter_0$schema = z.union([z.undefined(), z.literal(false), z.literal(true)])
31
39
  const _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_result$schema = z.object({
32
40
  'sessions': z.array(z.object({
@@ -68,13 +76,24 @@ export const TYPERT_REMOTE = {
68
76
  method: 'getBalance',
69
77
  invocation: { kind: 'direct' },
70
78
  parameters: [
79
+ {
80
+ name: 'force',
81
+ wire: 'force',
82
+ source: 'json',
83
+ acceptsUndefined: true,
84
+ codec: {
85
+ mode: 'strict',
86
+ typeSymbol: '@rayadesu/dsh-llm-billing#billing/getBalance:force',
87
+ schema: _rayadesu_dsh_llm_billing_billing_getBalance_parameter_0$schema,
88
+ },
89
+ },
71
90
  ],
72
91
  result: {
73
92
  mode: 'strict',
74
93
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekBalance',
75
94
  schema: _rayadesu_dsh_llm_billing_billing_getBalance_result$schema,
76
95
  },
77
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":154,"column":3},
96
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":165,"column":3},
78
97
  },
79
98
  {
80
99
  id: '@rayadesu/dsh-llm-billing#billing/getSessionSpend',
@@ -99,7 +118,32 @@ export const TYPERT_REMOTE = {
99
118
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionSpend',
100
119
  schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema,
101
120
  },
102
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":165,"column":3},
121
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":176,"column":3},
122
+ },
123
+ {
124
+ id: '@rayadesu/dsh-llm-billing#billing/getSessionTurnSpends',
125
+ service: 'billing',
126
+ namespace: 'billing',
127
+ method: 'getSessionTurnSpends',
128
+ invocation: { kind: 'direct' },
129
+ parameters: [
130
+ {
131
+ name: 'sessionId',
132
+ wire: 'sessionId',
133
+ source: 'json',
134
+ codec: {
135
+ mode: 'strict',
136
+ typeSymbol: '@rayadesu/dsh-llm-billing#billing/getSessionTurnSpends:sessionId',
137
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_parameter_0$schema,
138
+ },
139
+ },
140
+ ],
141
+ result: {
142
+ mode: 'strict',
143
+ typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionTurnSpends',
144
+ schema: _rayadesu_dsh_llm_billing_billing_getSessionTurnSpends_result$schema,
145
+ },
146
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":227,"column":3},
103
147
  },
104
148
  {
105
149
  id: '@rayadesu/dsh-llm-billing#billing/getTodaySessionsSpend',
@@ -125,7 +169,7 @@ export const TYPERT_REMOTE = {
125
169
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySessionsSpend',
126
170
  schema: _rayadesu_dsh_llm_billing_billing_getTodaySessionsSpend_result$schema,
127
171
  },
128
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":192,"column":3},
172
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":202,"column":3},
129
173
  },
130
174
  {
131
175
  id: '@rayadesu/dsh-llm-billing#billing/getTodaySpend',
@@ -151,7 +195,7 @@ export const TYPERT_REMOTE = {
151
195
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySpend',
152
196
  schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema,
153
197
  },
154
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":178,"column":3},
198
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":189,"column":3},
155
199
  },
156
200
  {
157
201
  id: '@rayadesu/dsh-llm-billing#billing/getTurnSpend',
@@ -186,7 +230,7 @@ export const TYPERT_REMOTE = {
186
230
  typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTurnSpend',
187
231
  schema: _rayadesu_dsh_llm_billing_billing_getTurnSpend_result$schema,
188
232
  },
189
- sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":205,"column":3},
233
+ sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":215,"column":3},
190
234
  },
191
235
  ],
192
236
  }
@@ -9,7 +9,7 @@
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
10
  import type { SessionId } from '@deepseek-ai/dsh-session';
11
11
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
12
- import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySessionsSpend, DeepSeekTodaySpend, DeepSeekTurnSpend } from './types.ts';
12
+ import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekSessionTurnSpends, DeepSeekTodaySessionsSpend, DeepSeekTodaySpend, DeepSeekTurnSpend } from './types.ts';
13
13
  /**
14
14
  * Parse and validate the DeepSeek balance response at the wire boundary.
15
15
  * @param body - decoded JSON response body.
@@ -28,8 +28,11 @@ export declare function parseDeepSeekBalance(body: unknown): DeepSeekBalance;
28
28
  export declare function fetchDeepSeekBalance(baseURL: string, apiKey: string, signal?: AbortSignal): Promise<DeepSeekBalance>;
29
29
  /** Thunks the plugin binds to its own resolution and history access. */
30
30
  export interface DeepSeekBalanceGatewayOptions {
31
- /** Fetch one balance snapshot through the plugin's resolved facts. */
32
- fetchBalance: () => Promise<DeepSeekBalance>;
31
+ /**
32
+ * Fetch one balance snapshot through the plugin's resolved facts.
33
+ * `force` bypasses the host-side TTL (the manual refresh path).
34
+ */
35
+ fetchBalance: (force?: boolean) => Promise<DeepSeekBalance>;
33
36
  /** Compute one session's billed spend through the plugin's resolved facts. */
34
37
  fetchSessionSpend: (sessionId: SessionId) => Promise<DeepSeekSessionSpend>;
35
38
  /**
@@ -49,6 +52,11 @@ export interface DeepSeekBalanceGatewayOptions {
49
52
  * facts, identified by its closing assistant message id.
50
53
  */
51
54
  fetchTurnSpend: (sessionId: SessionId, messageId: string) => Promise<DeepSeekTurnSpend>;
55
+ /**
56
+ * Compute every completed Turn's billed spend in one session through the
57
+ * plugin's resolved facts, in one pass over the log.
58
+ */
59
+ fetchTurnSpends: (sessionId: SessionId) => Promise<DeepSeekSessionTurnSpends>;
52
60
  }
53
61
  /**
54
62
  * Remote-only service exposing the DeepSeek account balance and session spend.
@@ -65,20 +73,23 @@ export declare class DeepSeekBalanceGateway extends TypertRemoteService {
65
73
  */
66
74
  constructor(ctx: Context, options: DeepSeekBalanceGatewayOptions);
67
75
  /**
68
- * Read the current DeepSeek account balance.
76
+ * Read the current DeepSeek account balance. A snapshot younger than the
77
+ * host-side TTL is reused, so several badge mounts share one provider call;
78
+ * `force` bypasses the TTL for the manual refresh.
79
+ * @param force - bypass the host-side TTL; omitted means a cached read.
69
80
  * @returns the validated balance snapshot.
70
81
  */
71
- getBalance(): Promise<DeepSeekBalance>;
82
+ getBalance(force?: boolean): Promise<DeepSeekBalance>;
72
83
  /**
73
- * Read one session's billed spend, priced per event by its Beijing-time
74
- * peak/off-peak hour and weekday (weekends are always off-peak).
84
+ * Read one session's billed spend (same per-event pricing as
85
+ * {@link priceEvent}).
75
86
  * @param sessionId - the session whose spend to compute.
76
87
  * @returns the session's total cost plus one row per priced model.
77
88
  */
78
89
  getSessionSpend(sessionId: SessionId): Promise<DeepSeekSessionSpend>;
79
90
  /**
80
- * Read today's billed spend across every session, priced per event by its
81
- * Beijing-time calendar day, hour, and weekday (weekends are always off-peak).
91
+ * Read today's billed spend across every session: the same per-event
92
+ * pricing as {@link priceEvent}, restricted to the queried Beijing day.
82
93
  * @param force - bypass the host-side 60s cache (manual refresh); omitted
83
94
  * means a cached read. Remote parameters cannot carry default values, so
84
95
  * the thunk receives `undefined` for an omitted argument.
@@ -86,24 +97,31 @@ export declare class DeepSeekBalanceGateway extends TypertRemoteService {
86
97
  */
87
98
  getTodaySpend(force?: boolean): Promise<DeepSeekTodaySpend>;
88
99
  /**
89
- * Read today's billed spend per session, priced per event by its
90
- * Beijing-time calendar day, hour, and weekday (weekends are always
91
- * off-peak). Rows carry the session's durable title and sort by cost
92
- * descending; sessions with no priced usage on the day are omitted.
100
+ * Read today's billed spend per session, restricted to the queried Beijing
101
+ * day. Rows carry the session's durable title and sort by cost descending;
102
+ * sessions with no priced usage on the day are omitted.
93
103
  * @param force - bypass the host-side 60s cache (manual refresh); omitted
94
104
  * means a cached read.
95
105
  * @returns today's per-session rows, highest first.
96
106
  */
97
107
  getTodaySessionsSpend(force?: boolean): Promise<DeepSeekTodaySessionsSpend>;
98
108
  /**
99
- * Read one completed Turn's billed spend, priced per event by its
100
- * Beijing-time hour and weekday (weekends are always off-peak).
109
+ * Read one completed Turn's billed spend (same per-event pricing as
110
+ * {@link priceEvent}).
101
111
  * @param sessionId - the session owning the Turn.
102
112
  * @param messageId - the closing assistant message's durable id, which
103
113
  * locates the Turn in the session log.
104
114
  * @returns the Turn's total cost in CNY.
105
115
  */
106
116
  getTurnSpend(sessionId: SessionId, messageId: string): Promise<DeepSeekTurnSpend>;
117
+ /**
118
+ * Read every completed Turn's billed spend in one session (same per-event
119
+ * pricing as {@link priceEvent}). One call replaces the per-message
120
+ * `getTurnSpend` fan-out for a rendered transcript.
121
+ * @param sessionId - the session whose Turn costs to compute.
122
+ * @returns one row per assistant message inside a completed Turn, in log order.
123
+ */
124
+ getSessionTurnSpends(sessionId: SessionId): Promise<DeepSeekSessionTurnSpends>;
107
125
  }
108
126
  export default DeepSeekBalanceGateway;
109
127
  //# sourceMappingURL=balance.d.ts.map
@@ -138,6 +138,7 @@ let DeepSeekBalanceGateway = (() => {
138
138
  let _getTodaySpend_decorators;
139
139
  let _getTodaySessionsSpend_decorators;
140
140
  let _getTurnSpend_decorators;
141
+ let _getSessionTurnSpends_decorators;
141
142
  return class DeepSeekBalanceGateway extends _classSuper {
142
143
  static {
143
144
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
@@ -146,11 +147,13 @@ let DeepSeekBalanceGateway = (() => {
146
147
  _getTodaySpend_decorators = [Remote('getTodaySpend')];
147
148
  _getTodaySessionsSpend_decorators = [Remote('getTodaySessionsSpend')];
148
149
  _getTurnSpend_decorators = [Remote('getTurnSpend')];
150
+ _getSessionTurnSpends_decorators = [Remote('getSessionTurnSpends')];
149
151
  __esDecorate(this, null, _getBalance_decorators, { kind: "method", name: "getBalance", static: false, private: false, access: { has: obj => "getBalance" in obj, get: obj => obj.getBalance }, metadata: _metadata }, null, _instanceExtraInitializers);
150
152
  __esDecorate(this, null, _getSessionSpend_decorators, { kind: "method", name: "getSessionSpend", static: false, private: false, access: { has: obj => "getSessionSpend" in obj, get: obj => obj.getSessionSpend }, metadata: _metadata }, null, _instanceExtraInitializers);
151
153
  __esDecorate(this, null, _getTodaySpend_decorators, { kind: "method", name: "getTodaySpend", static: false, private: false, access: { has: obj => "getTodaySpend" in obj, get: obj => obj.getTodaySpend }, metadata: _metadata }, null, _instanceExtraInitializers);
152
154
  __esDecorate(this, null, _getTodaySessionsSpend_decorators, { kind: "method", name: "getTodaySessionsSpend", static: false, private: false, access: { has: obj => "getTodaySessionsSpend" in obj, get: obj => obj.getTodaySessionsSpend }, metadata: _metadata }, null, _instanceExtraInitializers);
153
155
  __esDecorate(this, null, _getTurnSpend_decorators, { kind: "method", name: "getTurnSpend", static: false, private: false, access: { has: obj => "getTurnSpend" in obj, get: obj => obj.getTurnSpend }, metadata: _metadata }, null, _instanceExtraInitializers);
156
+ __esDecorate(this, null, _getSessionTurnSpends_decorators, { kind: "method", name: "getSessionTurnSpends", static: false, private: false, access: { has: obj => "getSessionTurnSpends" in obj, get: obj => obj.getSessionTurnSpends }, metadata: _metadata }, null, _instanceExtraInitializers);
154
157
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
155
158
  }
156
159
  options = __runInitializers(this, _instanceExtraInitializers);
@@ -164,15 +167,18 @@ let DeepSeekBalanceGateway = (() => {
164
167
  this.options = options;
165
168
  }
166
169
  /**
167
- * Read the current DeepSeek account balance.
170
+ * Read the current DeepSeek account balance. A snapshot younger than the
171
+ * host-side TTL is reused, so several badge mounts share one provider call;
172
+ * `force` bypasses the TTL for the manual refresh.
173
+ * @param force - bypass the host-side TTL; omitted means a cached read.
168
174
  * @returns the validated balance snapshot.
169
175
  */
170
- getBalance() {
171
- return this.options.fetchBalance();
176
+ getBalance(force) {
177
+ return this.options.fetchBalance(force ?? false);
172
178
  }
173
179
  /**
174
- * Read one session's billed spend, priced per event by its Beijing-time
175
- * peak/off-peak hour and weekday (weekends are always off-peak).
180
+ * Read one session's billed spend (same per-event pricing as
181
+ * {@link priceEvent}).
176
182
  * @param sessionId - the session whose spend to compute.
177
183
  * @returns the session's total cost plus one row per priced model.
178
184
  */
@@ -180,8 +186,8 @@ let DeepSeekBalanceGateway = (() => {
180
186
  return this.options.fetchSessionSpend(sessionId);
181
187
  }
182
188
  /**
183
- * Read today's billed spend across every session, priced per event by its
184
- * Beijing-time calendar day, hour, and weekday (weekends are always off-peak).
189
+ * Read today's billed spend across every session: the same per-event
190
+ * pricing as {@link priceEvent}, restricted to the queried Beijing day.
185
191
  * @param force - bypass the host-side 60s cache (manual refresh); omitted
186
192
  * means a cached read. Remote parameters cannot carry default values, so
187
193
  * the thunk receives `undefined` for an omitted argument.
@@ -191,10 +197,9 @@ let DeepSeekBalanceGateway = (() => {
191
197
  return this.options.fetchTodaySpend(force ?? false);
192
198
  }
193
199
  /**
194
- * Read today's billed spend per session, priced per event by its
195
- * Beijing-time calendar day, hour, and weekday (weekends are always
196
- * off-peak). Rows carry the session's durable title and sort by cost
197
- * descending; sessions with no priced usage on the day are omitted.
200
+ * Read today's billed spend per session, restricted to the queried Beijing
201
+ * day. Rows carry the session's durable title and sort by cost descending;
202
+ * sessions with no priced usage on the day are omitted.
198
203
  * @param force - bypass the host-side 60s cache (manual refresh); omitted
199
204
  * means a cached read.
200
205
  * @returns today's per-session rows, highest first.
@@ -203,8 +208,8 @@ let DeepSeekBalanceGateway = (() => {
203
208
  return this.options.fetchTodaySessionsSpend(force ?? false);
204
209
  }
205
210
  /**
206
- * Read one completed Turn's billed spend, priced per event by its
207
- * Beijing-time hour and weekday (weekends are always off-peak).
211
+ * Read one completed Turn's billed spend (same per-event pricing as
212
+ * {@link priceEvent}).
208
213
  * @param sessionId - the session owning the Turn.
209
214
  * @param messageId - the closing assistant message's durable id, which
210
215
  * locates the Turn in the session log.
@@ -213,6 +218,16 @@ let DeepSeekBalanceGateway = (() => {
213
218
  getTurnSpend(sessionId, messageId) {
214
219
  return this.options.fetchTurnSpend(sessionId, messageId);
215
220
  }
221
+ /**
222
+ * Read every completed Turn's billed spend in one session (same per-event
223
+ * pricing as {@link priceEvent}). One call replaces the per-message
224
+ * `getTurnSpend` fan-out for a rendered transcript.
225
+ * @param sessionId - the session whose Turn costs to compute.
226
+ * @returns one row per assistant message inside a completed Turn, in log order.
227
+ */
228
+ getSessionTurnSpends(sessionId) {
229
+ return this.options.fetchTurnSpends(sessionId);
230
+ }
216
231
  };
217
232
  })();
218
233
  export { DeepSeekBalanceGateway };