@jxgame2020/dsh-token-quota 0.1.0
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 +965 -0
- package/lib/index.js +387 -0
- package/lib/invariant.js +25 -0
- package/lib/types/client/TokenQuotaPanel.d.ts +28 -0
- package/lib/types/client/TokenQuotaPanel.js +147 -0
- package/lib/types/client/index.d.ts +36 -0
- package/lib/types/client/index.js +232 -0
- package/lib/types/client/locales.d.ts +97 -0
- package/lib/types/client/locales.js +95 -0
- package/lib/types/client/store.d.ts +89 -0
- package/lib/types/client/store.js +92 -0
- package/lib/types/index.d.ts +99 -0
- package/lib/types/index.js +410 -0
- package/lib/types/invariant.d.ts +17 -0
- package/lib/types/invariant.js +24 -0
- package/lib/types/types.d.ts +125 -0
- package/lib/types/types.js +29 -0
- package/package.json +153 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared wire/type vocabulary for the daily token-quota plugin.
|
|
3
|
+
*
|
|
4
|
+
* The Host half owns the durable per-model daily counter and the enforcement
|
|
5
|
+
* gate; the browser half renders a floating panel from the snapshot it pulls
|
|
6
|
+
* over a plugin-owned HTTP route, and writes per-model limits and panel
|
|
7
|
+
* preferences through the settings document. This module is the one meeting
|
|
8
|
+
* point of the two planes: it carries strings and shapes only, never a
|
|
9
|
+
* runtime import from the other half.
|
|
10
|
+
*
|
|
11
|
+
* @module @jxgame2020/dsh-token-quota/types
|
|
12
|
+
*/
|
|
13
|
+
/** Settings namespace owning the per-model daily limits document. */
|
|
14
|
+
export const TOKEN_QUOTA_NAMESPACE = 'token-quota';
|
|
15
|
+
/** Stable machine code thrown from `agent/request` when a model is over its daily cap. */
|
|
16
|
+
export const TOKEN_QUOTA_EXCEEDED_CODE = 'TOKEN_QUOTA_EXCEEDED';
|
|
17
|
+
/**
|
|
18
|
+
* What to do once a monitored, quota-capped model reaches its daily cap.
|
|
19
|
+
* Selected in the panel's settings dialog; the panel acts on it (b/c/d auto
|
|
20
|
+
* switch, a stops and prompts).
|
|
21
|
+
*/
|
|
22
|
+
export const TOKEN_QUOTA_FULL_ACTIONS = ['stop', 'switchQuota', 'switchAll', 'switchPriority'];
|
|
23
|
+
/** Default reset: machine-local midnight (offset = host timezone, 00:00). */
|
|
24
|
+
export const TOKEN_QUOTA_DEFAULT_RESET = { offsetHours: 0, hour: 0, minute: 0 };
|
|
25
|
+
/** Build the stable per-model key shared by the counter, settings, and snapshot. */
|
|
26
|
+
export function tokenQuotaKey(provider, model) {
|
|
27
|
+
return `${provider}/${model}`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jxgame2020/dsh-token-quota",
|
|
3
|
+
"description": "Daily per-model token quota accounting, enforcement, and a floating quota panel for the DeepSeek Harness — a fully self-contained plugin (no core-Harness wiring, no generated RPC contract)",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"types": "lib/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/types/index.d.ts",
|
|
14
|
+
"default": "./lib/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./invariant": {
|
|
17
|
+
"types": "./lib/types/invariant.d.ts",
|
|
18
|
+
"default": "./lib/invariant.js"
|
|
19
|
+
},
|
|
20
|
+
"./types": {
|
|
21
|
+
"types": "./lib/types/types.d.ts",
|
|
22
|
+
"default": "./lib/types/types.js"
|
|
23
|
+
},
|
|
24
|
+
"./client": {
|
|
25
|
+
"types": "./lib/types/client/index.d.ts",
|
|
26
|
+
"default": "./lib/client.js"
|
|
27
|
+
},
|
|
28
|
+
"./src/*": "./src/*",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"dsh": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@deepseek-ai/dsh-client-locale",
|
|
35
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
38
|
+
"@deepseek-ai/dsh-api-remotes"
|
|
39
|
+
],
|
|
40
|
+
"platform": "web"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"bundle": "tsdown",
|
|
45
|
+
"watch": "tsdown --watch"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"lib/index.js",
|
|
49
|
+
"lib/invariant.js",
|
|
50
|
+
"lib/client.js",
|
|
51
|
+
"lib/types/**/*.js",
|
|
52
|
+
"lib/types/**/*.d.ts"
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"dependencies": {},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@deepseek-ai/cordis": "*",
|
|
58
|
+
"@deepseek-ai/dsh-agent": "*",
|
|
59
|
+
"@deepseek-ai/dsh-api-remotes": "*",
|
|
60
|
+
"@deepseek-ai/dsh-client-connection": "*",
|
|
61
|
+
"@deepseek-ai/dsh-client-locale": "*",
|
|
62
|
+
"@deepseek-ai/dsh-client-runtime": "*",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-layout": "*",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-settings": "*",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-slots": "*",
|
|
66
|
+
"@deepseek-ai/dsh-invariants": "*",
|
|
67
|
+
"@deepseek-ai/dsh-llm": "*",
|
|
68
|
+
"@deepseek-ai/dsh-session": "*",
|
|
69
|
+
"@deepseek-ai/dsh-settings": "*",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"@deepseek-ai/dsh-host-apiproxy": "*",
|
|
72
|
+
"@deepseek-ai/dsh-attachment": "*",
|
|
73
|
+
"@deepseek-ai/dsh-brand": "*",
|
|
74
|
+
"@deepseek-ai/dsh-jobs": "*",
|
|
75
|
+
"@deepseek-ai/dsh-session-projection": "*",
|
|
76
|
+
"@deepseek-ai/dsh-tools": "*",
|
|
77
|
+
"@deepseek-ai/dsh-user-approval": "*",
|
|
78
|
+
"@deepseek-ai/dsh-user-questions": "*",
|
|
79
|
+
"@deepseek-ai/dsh-workspace": "*",
|
|
80
|
+
"@deepseek-ai/schemastery": "0.1.0-rc.7"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@deepseek-ai/cordis": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@deepseek-ai/dsh-agent": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@deepseek-ai/dsh-api-remotes": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@deepseek-ai/dsh-client-connection": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@deepseek-ai/dsh-client-locale": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@deepseek-ai/dsh-client-runtime": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@deepseek-ai/dsh-client-ui-layout": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"@deepseek-ai/dsh-client-ui-settings": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"@deepseek-ai/dsh-invariants": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@deepseek-ai/dsh-llm": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"@deepseek-ai/dsh-session": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
119
|
+
"@deepseek-ai/dsh-settings": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
122
|
+
"@deepseek-ai/dsh-host-apiproxy": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"@deepseek-ai/dsh-attachment": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"@deepseek-ai/dsh-brand": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"@deepseek-ai/dsh-jobs": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"@deepseek-ai/dsh-session-projection": {
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"@deepseek-ai/dsh-tools": {
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"@deepseek-ai/dsh-user-approval": {
|
|
141
|
+
"optional": true
|
|
142
|
+
},
|
|
143
|
+
"@deepseek-ai/dsh-user-questions": {
|
|
144
|
+
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"@deepseek-ai/dsh-workspace": {
|
|
147
|
+
"optional": true
|
|
148
|
+
},
|
|
149
|
+
"@deepseek-ai/schemastery": {
|
|
150
|
+
"optional": true
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|