@rayadesu/dsh-llm-billing 0.2.0 → 0.2.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/lib/index.js +9 -6
- package/lib/typert.host.js +4 -4
- package/lib/typert.remote-client.d.ts +0 -1
- package/lib/typert.remote-client.js +4 -4
- package/package.json +20 -17
package/lib/index.js
CHANGED
|
@@ -45,8 +45,10 @@ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializ
|
|
|
45
45
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
46
46
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
47
47
|
if (_ = accept(result.init)) initializers.unshift(_);
|
|
48
|
-
} else if (_ = accept(result))
|
|
49
|
-
|
|
48
|
+
} else if (_ = accept(result)) {
|
|
49
|
+
if (kind === "field") initializers.unshift(_);
|
|
50
|
+
else descriptor[key] = _;
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
52
54
|
done = true;
|
|
@@ -311,18 +313,18 @@ function resolveBilling(config) {
|
|
|
311
313
|
}
|
|
312
314
|
/** The Beijing (Asia/Shanghai, UTC+8, no DST) hour of a timestamp. */
|
|
313
315
|
function beijingHour(now) {
|
|
314
|
-
return new Date(now.getTime() +
|
|
316
|
+
return new Date(now.getTime() + 288e5).getUTCHours();
|
|
315
317
|
}
|
|
316
318
|
/**
|
|
317
319
|
* The Beijing (Asia/Shanghai, UTC+8, no DST) weekday of a timestamp, as
|
|
318
320
|
* `getUTCDay()`: `0` is Sunday, `6` is Saturday.
|
|
319
321
|
*/
|
|
320
322
|
function beijingWeekday(now) {
|
|
321
|
-
return new Date(now.getTime() +
|
|
323
|
+
return new Date(now.getTime() + 288e5).getUTCDay();
|
|
322
324
|
}
|
|
323
325
|
/** The Beijing (Asia/Shanghai, UTC+8, no DST) calendar-day key of a timestamp. */
|
|
324
326
|
function beijingDayKey(now) {
|
|
325
|
-
return new Date(now.getTime() +
|
|
327
|
+
return new Date(now.getTime() + 288e5).toISOString().slice(0, 10);
|
|
326
328
|
}
|
|
327
329
|
/**
|
|
328
330
|
* Whether a timestamp falls inside any peak-hour window (Beijing time,
|
|
@@ -746,7 +748,8 @@ var TodaySpendScanner = class {
|
|
|
746
748
|
logger.warn(`llm-billing: projection cold read for session ${id} failed: ${String(error)}`);
|
|
747
749
|
}
|
|
748
750
|
if (value === void 0) try {
|
|
749
|
-
|
|
751
|
+
const inspection = await persistenceService.inspect(id);
|
|
752
|
+
value = foldBillingUnit(unit, inspection.events);
|
|
750
753
|
} catch (error) {
|
|
751
754
|
logger.warn(`llm-billing: skipping unreadable session ${id}: ${String(error)}`);
|
|
752
755
|
}
|
package/lib/typert.host.js
CHANGED
|
@@ -64,7 +64,7 @@ export const TYPERT = {
|
|
|
64
64
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekBalance',
|
|
65
65
|
schema: _rayadesu_dsh_llm_billing_billing_getBalance_result$schema,
|
|
66
66
|
},
|
|
67
|
-
sourceLocation: {"file":"packages/llm
|
|
67
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":143,"column":3},
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
id: '@rayadesu/dsh-llm-billing#billing/getSessionSpend',
|
|
@@ -79,7 +79,7 @@ export const TYPERT = {
|
|
|
79
79
|
source: 'json',
|
|
80
80
|
codec: {
|
|
81
81
|
mode: 'strict',
|
|
82
|
-
typeSymbol: '@
|
|
82
|
+
typeSymbol: '@rayadesu/dsh-llm-billing#billing/getSessionSpend:sessionId',
|
|
83
83
|
schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema,
|
|
84
84
|
},
|
|
85
85
|
},
|
|
@@ -89,7 +89,7 @@ export const TYPERT = {
|
|
|
89
89
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionSpend',
|
|
90
90
|
schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema,
|
|
91
91
|
},
|
|
92
|
-
sourceLocation: {"file":"packages/llm
|
|
92
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":154,"column":3},
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
id: '@rayadesu/dsh-llm-billing#billing/getTodaySpend',
|
|
@@ -115,7 +115,7 @@ export const TYPERT = {
|
|
|
115
115
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySpend',
|
|
116
116
|
schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema,
|
|
117
117
|
},
|
|
118
|
-
sourceLocation: {"file":"packages/llm
|
|
118
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":167,"column":3},
|
|
119
119
|
},
|
|
120
120
|
],
|
|
121
121
|
model: {
|
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
RemoteResult,
|
|
4
4
|
TypertRemoteContribution,
|
|
5
5
|
} from '@deepseek-ai/dsh-typert-protocol'
|
|
6
|
-
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
7
6
|
import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySpend } from '@rayadesu/dsh-llm-billing/types'
|
|
8
7
|
|
|
9
8
|
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
@@ -61,7 +61,7 @@ export const TYPERT_REMOTE = {
|
|
|
61
61
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekBalance',
|
|
62
62
|
schema: _rayadesu_dsh_llm_billing_billing_getBalance_result$schema,
|
|
63
63
|
},
|
|
64
|
-
sourceLocation: {"file":"packages/llm
|
|
64
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":143,"column":3},
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
id: '@rayadesu/dsh-llm-billing#billing/getSessionSpend',
|
|
@@ -76,7 +76,7 @@ export const TYPERT_REMOTE = {
|
|
|
76
76
|
source: 'json',
|
|
77
77
|
codec: {
|
|
78
78
|
mode: 'strict',
|
|
79
|
-
typeSymbol: '@
|
|
79
|
+
typeSymbol: '@rayadesu/dsh-llm-billing#billing/getSessionSpend:sessionId',
|
|
80
80
|
schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema,
|
|
81
81
|
},
|
|
82
82
|
},
|
|
@@ -86,7 +86,7 @@ export const TYPERT_REMOTE = {
|
|
|
86
86
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekSessionSpend',
|
|
87
87
|
schema: _rayadesu_dsh_llm_billing_billing_getSessionSpend_result$schema,
|
|
88
88
|
},
|
|
89
|
-
sourceLocation: {"file":"packages/llm
|
|
89
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":154,"column":3},
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
id: '@rayadesu/dsh-llm-billing#billing/getTodaySpend',
|
|
@@ -112,7 +112,7 @@ export const TYPERT_REMOTE = {
|
|
|
112
112
|
typeSymbol: '@rayadesu/dsh-llm-billing/types#DeepSeekTodaySpend',
|
|
113
113
|
schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema,
|
|
114
114
|
},
|
|
115
|
-
sourceLocation: {"file":"packages/llm
|
|
115
|
+
sourceLocation: {"file":"packages/llm-billing/src/balance.ts","line":167,"column":3},
|
|
116
116
|
},
|
|
117
117
|
],
|
|
118
118
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayadesu/dsh-llm-billing",
|
|
3
3
|
"description": "Standalone DeepSeek account-balance and session-spend provider exposed through the billing Remote",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -47,16 +47,19 @@
|
|
|
47
47
|
"lib/typert.remote-client.js",
|
|
48
48
|
"lib/typert.remote-client.d.ts"
|
|
49
49
|
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"prepublishOnly": "node ../../scripts/verify-packages.mjs"
|
|
52
|
+
},
|
|
50
53
|
"license": "MIT",
|
|
51
54
|
"peerDependencies": {
|
|
52
|
-
"@deepseek-ai/dsh-credentials": "^0.1.
|
|
53
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.
|
|
54
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
55
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
56
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
57
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.
|
|
58
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.
|
|
59
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.
|
|
55
|
+
"@deepseek-ai/dsh-credentials": "^0.1.1-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.1-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
59
|
+
"@deepseek-ai/dsh-session": "^0.1.1-rc.2",
|
|
60
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
|
|
61
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.1-rc.2",
|
|
60
63
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
61
64
|
},
|
|
62
65
|
"dependencies": {
|
|
@@ -64,14 +67,14 @@
|
|
|
64
67
|
"zod": "^4.4.3"
|
|
65
68
|
},
|
|
66
69
|
"devDependencies": {
|
|
67
|
-
"@deepseek-ai/dsh-credentials": "^0.1.
|
|
68
|
-
"@deepseek-ai/dsh-launch-environment": "^0.1.
|
|
69
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
70
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
71
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
72
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.
|
|
73
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.
|
|
74
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.
|
|
70
|
+
"@deepseek-ai/dsh-credentials": "^0.1.1-rc.2",
|
|
71
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.1-rc.2",
|
|
72
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
73
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
74
|
+
"@deepseek-ai/dsh-session": "^0.1.1-rc.2",
|
|
75
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
|
|
76
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
|
|
77
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.1-rc.2",
|
|
75
78
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
76
79
|
}
|
|
77
80
|
}
|