@lingda-ai/dsh-plugin-quota 0.0.0-stage → 0.1.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/rates.js ADDED
@@ -0,0 +1,172 @@
1
+ /**
2
+ * 费率:与账本同源,四档计价,未知即未知。
3
+ *
4
+ * 为什么把价表抄一份而不是依赖 @lingda-ai/dsh-plugin-ledger:
5
+ * 1. 市场收录要求"自包含单包、可安装",跨包强依赖会让"只装黑匣子"失败;
6
+ * 2. 但口径必须一致——两个插件对同一会话报出两个数,是信任级事故。
7
+ * 所以:**数字抄自账本内置价表(同一官方页面、同一抓取日)**,并优先读账本写的
8
+ * `~/.dsh/ledger/pricing.json`(文件契约,不是代码依赖)。用户改价只有一处。
9
+ *
10
+ * 单位:本文件内部一律"元 / token"。用户写的 pricing.json 是"元 / 百万 tokens"。
11
+ * 表里没有的模型 → unknown(no-rate),显示"—",绝不用 0 或均值冒充。
12
+ */
13
+ import { readFileSync } from 'node:fs'
14
+ import { homedir } from 'node:os'
15
+ import { join } from 'node:path'
16
+
17
+ const M = 1e-6
18
+
19
+ /** 与账本 lib/pricing-table.js 同源同值(官方页面 2026-11-19)。 */
20
+ const FLASH = Object.freeze({ input: 1 * M, output: 2 * M, cacheRead: 0.02 * M, cacheWrite: 0 })
21
+ const PRO = Object.freeze({ input: 3 * M, output: 6 * M, cacheRead: 0.025 * M, cacheWrite: 0 })
22
+
23
+ export const BUILTIN_RATES = Object.freeze({
24
+ 'deepseek-v4-flash': FLASH,
25
+ 'deepseek-v4-pro': PRO,
26
+ 'deepseek-chat': FLASH,
27
+ 'deepseek-reasoner': FLASH,
28
+ 'deepseek-flash': FLASH,
29
+ 'deepseek-pro': PRO,
30
+ })
31
+
32
+ export const BUILTIN_AS_OF = '2026-11-19'
33
+ export const BUILTIN_SOURCE = 'https://api-docs.deepseek.com/zh-cn/quick_start/pricing'
34
+
35
+ const REQUIRED = ['input', 'output', 'cacheRead', 'cacheWrite']
36
+
37
+ export function defaultPricingPath() {
38
+ return join(homedir(), '.dsh', 'ledger', 'pricing.json')
39
+ }
40
+
41
+ /** 归一化 usage:缺字段与 0 是两件事,用 complete 表达。 */
42
+ export function normalizeUsage(raw) {
43
+ if (raw === null || typeof raw !== 'object') return null
44
+ const num = (value) => (Number.isFinite(value) ? Number(value) : null)
45
+ const usage = {
46
+ inputTokens: num(raw.inputTokens) ?? 0,
47
+ outputTokens: num(raw.outputTokens) ?? 0,
48
+ cacheReadTokens: num(raw.cacheReadTokens) ?? 0,
49
+ cacheWriteTokens: num(raw.cacheWriteTokens) ?? 0,
50
+ }
51
+ // 至少有一个真实数字,且没有脏值(字符串、NaN):两种情况才算完整。
52
+ // 注意这里用的是 **usage 字段名**,不是费率字段名——两套名字混用会让 complete 永远 false。
53
+ const FIELDS = ['inputTokens', 'outputTokens', 'cacheReadTokens', 'cacheWriteTokens']
54
+ const present = FIELDS.some((field) => Number.isFinite(raw[field]))
55
+ const clean = FIELDS.every(
56
+ (field) => raw[field] === undefined || raw[field] === null || Number.isFinite(raw[field]),
57
+ )
58
+ usage.complete = present && clean
59
+ return usage
60
+ }
61
+
62
+ /**
63
+ * 读账本写的费率覆盖文件。整条生效或整条拒绝:缺一档就不认这个模型,
64
+ * 因为"旧价补新价"算出来的数既不是旧价也不是新价。
65
+ */
66
+ export function parsePricingFile(text) {
67
+ let doc
68
+ try {
69
+ doc = JSON.parse(text)
70
+ } catch {
71
+ return { kind: 'invalid', reason: 'json-error', rates: {}, rejected: [] }
72
+ }
73
+ if (doc === null || typeof doc !== 'object' || Array.isArray(doc)) {
74
+ return { kind: 'invalid', reason: 'not-object', rates: {}, rejected: [] }
75
+ }
76
+ const table = doc.models !== null && typeof doc.models === 'object' && !Array.isArray(doc.models) ? doc.models : doc
77
+ const rates = {}
78
+ const rejected = []
79
+ for (const [model, value] of Object.entries(table)) {
80
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
81
+ rejected.push({ model, reason: 'not-object' })
82
+ continue
83
+ }
84
+ const missing = REQUIRED.filter((field) => !Number.isFinite(value[field]))
85
+ if (missing.length > 0) {
86
+ rejected.push({ model, reason: 'fields-missing', missing })
87
+ continue
88
+ }
89
+ rates[model] = {
90
+ input: value.input * M,
91
+ output: value.output * M,
92
+ cacheRead: value.cacheRead * M,
93
+ cacheWrite: value.cacheWrite * M,
94
+ }
95
+ }
96
+ return {
97
+ kind: 'ok',
98
+ rates,
99
+ rejected,
100
+ asOf: typeof doc.asOf === 'string' ? doc.asOf : null,
101
+ source: typeof doc.source === 'string' ? doc.source : null,
102
+ currency: typeof doc.currency === 'string' ? doc.currency : null,
103
+ }
104
+ }
105
+
106
+ /**
107
+ * @param {{pricingPath?: string|null, readFile?: (p:string)=>string}} [options]
108
+ */
109
+ export function loadRates(options = {}) {
110
+ const path = options.pricingPath === undefined ? defaultPricingPath() : options.pricingPath
111
+ const readFile = options.readFile ?? ((p) => readFileSync(p, 'utf8'))
112
+
113
+ let rates = { ...BUILTIN_RATES }
114
+ let meta = { kind: 'builtin', asOf: BUILTIN_AS_OF, source: BUILTIN_SOURCE, currency: 'CNY', rejected: [], error: null }
115
+
116
+ if (typeof path === 'string' && path.length > 0) {
117
+ try {
118
+ const parsed = parsePricingFile(readFile(path))
119
+ if (parsed.kind === 'ok' && Object.keys(parsed.rates).length > 0) {
120
+ rates = { ...rates, ...parsed.rates }
121
+ meta = {
122
+ kind: 'file',
123
+ asOf: parsed.asOf,
124
+ source: parsed.source ?? `file:${path}`,
125
+ currency: parsed.currency ?? 'CNY',
126
+ rejected: parsed.rejected,
127
+ error: null,
128
+ }
129
+ } else if (parsed.kind === 'invalid') {
130
+ meta = { ...meta, error: parsed.reason, rejected: parsed.rejected ?? [] }
131
+ }
132
+ } catch (error) {
133
+ const code = error && error.code ? String(error.code) : 'read-failed'
134
+ // 文件不存在是常态(用户没改过价),不算错误
135
+ if (code !== 'ENOENT') meta = { ...meta, error: code }
136
+ }
137
+ }
138
+
139
+ function rateFor(provider, model) {
140
+ if (typeof model !== 'string' || model.length === 0) return null
141
+ if (provider && rates[`${provider}/${model}`]) return rates[`${provider}/${model}`]
142
+ return rates[model] ?? (provider ? rates[`${provider}/*`] ?? null : null)
143
+ }
144
+
145
+ /** @returns {{kind:'known',amount:number,currency:string,parts:object}|{kind:'unknown',reason:string}} */
146
+ function costOf(usage, route) {
147
+ if (!usage) return { kind: 'unknown', reason: 'no-usage' }
148
+ if (!usage.complete) return { kind: 'unknown', reason: 'usage-incomplete' }
149
+ const rate = rateFor(route?.provider ?? null, route?.model ?? null)
150
+ if (!rate) return { kind: 'unknown', reason: 'no-rate' }
151
+ const parts = {
152
+ input: usage.inputTokens * rate.input,
153
+ output: usage.outputTokens * rate.output,
154
+ cacheRead: usage.cacheReadTokens * rate.cacheRead,
155
+ cacheWrite: usage.cacheWriteTokens * rate.cacheWrite,
156
+ }
157
+ const amount = parts.input + parts.output + parts.cacheRead + parts.cacheWrite
158
+ return { kind: 'known', amount, parts, currency: meta.currency ?? 'CNY' }
159
+ }
160
+
161
+ /** 缓存省下的钱:命中部分若按未缓存输入价计,会多花多少。费率未知时为 null。 */
162
+ function savedOf(usage, route) {
163
+ if (!usage || !usage.complete) return null
164
+ const rate = rateFor(route?.provider ?? null, route?.model ?? null)
165
+ if (!rate) return null
166
+ const delta = rate.input - rate.cacheRead
167
+ if (!Number.isFinite(delta) || delta <= 0) return null
168
+ return usage.cacheReadTokens * delta
169
+ }
170
+
171
+ return { costOf, savedOf, meta, rateFor }
172
+ }
package/lib/redact.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * 脱敏与文件名规范化。
3
+ *
4
+ * 黑匣子的隐私底线比流水更硬:**内容零拷贝**。
5
+ * - 不存 prompt / completion / 工具参数 / 工具返回;
6
+ * - 错误只留错误码,不留 message(message 里常带路径与代码片段);
7
+ * - 绝对路径不入账,只留最后一级目录名;
8
+ * - 会话标题会落盘(它本来就是用户可见的元数据),但要截断并擦掉密钥。
9
+ *
10
+ * 这些函数是纯函数,便于单测直接断言"脏东西进不去"。
11
+ */
12
+ import { createHash } from 'node:crypto'
13
+
14
+ const SECRET_PATTERNS = [
15
+ /\bsk-[A-Za-z0-9_-]{8,}\b/g,
16
+ /\bBearer\s+[A-Za-z0-9._-]{8,}\b/gi,
17
+ /\b(api[_-]?key|token|secret|password)\s*[:=]\s*[^\s,;]{6,}/gi,
18
+ /\bnpm_[A-Za-z0-9]{10,}\b/g,
19
+ /\bgh[pousr]_[A-Za-z0-9]{10,}\b/g,
20
+ ]
21
+
22
+ /** 绝对路径(POSIX 与 Windows 两种),整体替换成 [path]。 */
23
+ const ABS_PATH = /(?:^|[\s"'(])((?:[A-Za-z]:)?(?:[\\/](?:[^\\/\s"']+)){2,})/g
24
+
25
+ export function redactText(value, maxLength = 120) {
26
+ if (typeof value !== 'string') return ''
27
+ let text = value
28
+ for (const pattern of SECRET_PATTERNS) text = text.replace(pattern, '[redacted]')
29
+ text = text.replace(ABS_PATH, ' [path]')
30
+ text = text.replace(/\s+/g, ' ').trim()
31
+ return text.length > maxLength ? `${text.slice(0, maxLength)}…` : text
32
+ }
33
+
34
+ /** 错误码白名单化:只放行短标识符,其余一律归为 error。 */
35
+ export function safeCode(value) {
36
+ if (typeof value !== 'string') return null
37
+ const code = value.trim()
38
+ if (code.length === 0 || code.length > 40) return null
39
+ return /^[A-Za-z0-9_.:-]+$/.test(code) ? code : null
40
+ }
41
+
42
+ /** 目录名(不含绝对路径),用于区分工作区而不泄露路径。 */
43
+ export function baseName(path) {
44
+ if (typeof path !== 'string' || path.length === 0) return null
45
+ const parts = path.split(/[\\/]+/).filter(Boolean)
46
+ const last = parts.length > 0 ? parts[parts.length - 1] : null
47
+ return last === null ? null : redactText(last, 48)
48
+ }
49
+
50
+ export function shortHash(value) {
51
+ return createHash('sha1').update(String(value)).digest('hex').slice(0, 6)
52
+ }
53
+
54
+ /** 文件名安全化:只允许 [A-Za-z0-9._-],其余替换成 _,并限制长度。 */
55
+ export function safeFileName(id) {
56
+ const raw = typeof id === 'string' ? id : String(id ?? '')
57
+ return raw.replace(/[^A-Za-z0-9._-]/g, '_').slice(0, 120) || 'unknown'
58
+ }
package/lib/route.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * 只读 HTTP 面:面板要什么就给什么,一次一个 JSON。
3
+ *
4
+ * 约定(与黑匣子一致,用户已经习惯):
5
+ * - 查询键:state / policy / sessions
6
+ * - 业务失败一律 200 + {ok:false, error},不用 4xx 让前端猜
7
+ * - 不提供任何写操作:预算策略是文件,改文件比调接口更可审计
8
+ */
9
+ export const API_PREFIX = '/dsh-quota/api'
10
+
11
+ export function createApi({ book, policyLoader }) {
12
+ return {
13
+ state() {
14
+ const loaded = policyLoader()
15
+ return {
16
+ ok: true,
17
+ policy: loaded.policy,
18
+ policyWarnings: loaded.warnings,
19
+ policyPath: loaded.path,
20
+ policyExists: loaded.exists,
21
+ ...book.snapshot(loaded.policy),
22
+ }
23
+ },
24
+ policy() {
25
+ const loaded = policyLoader()
26
+ return { ok: true, policy: loaded.policy, warnings: loaded.warnings, path: loaded.path, exists: loaded.exists }
27
+ },
28
+ sessions() {
29
+ const snapshot = book.snapshot(policyLoader().policy)
30
+ return { ok: true, sessions: snapshot.sessions, total: snapshot.total, limit: snapshot.limit }
31
+ },
32
+ }
33
+ }
34
+
35
+ export function handleRequest(api, req, res) {
36
+ const send = (status, body) => {
37
+ const text = JSON.stringify(body)
38
+ res.writeHead(status, {
39
+ 'content-type': 'application/json; charset=utf-8',
40
+ 'cache-control': 'no-store',
41
+ 'content-length': Buffer.byteLength(text),
42
+ })
43
+ res.end(text)
44
+ }
45
+
46
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
47
+ send(200, { ok: false, error: '只提供只读查询' })
48
+ return
49
+ }
50
+
51
+ let url
52
+ try {
53
+ url = new URL(req.url ?? '/', 'http://localhost')
54
+ } catch {
55
+ send(200, { ok: false, error: '请求地址不合法' })
56
+ return
57
+ }
58
+
59
+ const has = (key) => url.searchParams.has(key)
60
+ try {
61
+ if (has('state')) send(200, api.state())
62
+ else if (has('policy')) send(200, api.policy())
63
+ else if (has('sessions')) send(200, api.sessions())
64
+ else send(200, { ok: false, error: '未知查询:用 state / policy / sessions' })
65
+ } catch (error) {
66
+ send(200, { ok: false, error: error instanceof Error ? error.message : String(error) })
67
+ }
68
+ }
package/lib/tool.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * quota_query:让 Agent 在动手之前先问一句"我还有多少额度"。
3
+ *
4
+ * 为什么值得做一个工具而不是只做面板:
5
+ * 面板要人去看;而"这笔活预计很贵,要不要先降级"是 Agent 该自己判断的事。
6
+ * 工具返回的是**事实 + 建议**,不是命令——它决定怎么做,我们只把数和线摆出来。
7
+ *
8
+ * 契约与账本的 ledger_query 一致:{name, description, parameters, output, execute}。
9
+ */
10
+
11
+ function money(amount, currency) {
12
+ if (!Number.isFinite(amount)) return '未设置'
13
+ return `${amount.toFixed(4)} ${currency}`
14
+ }
15
+
16
+ export function createQuotaTool({ snapshot, policyOf }) {
17
+ return {
18
+ name: 'quota_query',
19
+ description:
20
+ '查询本轮预算周期的额度使用情况:已花多少、还剩多少、按当前速度预计周期结束会到多少、'
21
+ + '以及到线时插件会做什么(通知或降级)。预算未配置时明确说明"未设置",不给出估算。',
22
+ parameters: {
23
+ type: 'object',
24
+ additionalProperties: false,
25
+ properties: {},
26
+ required: [],
27
+ },
28
+ output: {
29
+ schema: { type: 'string' },
30
+ render(_args, value) {
31
+ return [{ type: 'text', text: String(value) }]
32
+ },
33
+ },
34
+ async execute() {
35
+ const state = snapshot()
36
+ const policy = policyOf()
37
+ const lines = []
38
+ const periodLabel = state.period.kind === 'day' ? '今日' : state.period.kind === 'week' ? '本周' : '本月'
39
+
40
+ lines.push(`${periodLabel}(${state.period.key})`)
41
+ if (state.limit === null) {
42
+ lines.push(`预算:未设置——当前不做任何限制。已花 ${money(state.total.amount, state.currency)},${state.total.calls} 次调用。`)
43
+ lines.push('若要启用:在 ~/.dsh/ops/quota/policy.json 写 {"budget":{"period":"month","amount":20}}。')
44
+ } else {
45
+ const used = money(state.total.amount, state.currency)
46
+ const limit = money(state.limit, state.currency)
47
+ const pct = state.ratio === null ? '—' : `${(state.ratio * 100).toFixed(1)}%`
48
+ lines.push(`已用 ${used} / ${limit}(${pct}),剩余 ${money(state.remaining, state.currency)}`)
49
+ lines.push(`调用 ${state.total.calls} 次;缓存已省 ${money(state.saved.amount, state.currency)}`)
50
+ if (state.forecast) {
51
+ lines.push(`按当前速度预计周期结束 ${money(state.forecast.projected, state.currency)}(日均 ${money(state.forecast.dailyRate, state.currency)},剩 ${state.forecast.daysLeft} 天)`)
52
+ if (state.forecast.projected > state.limit) lines.push('注意:按这个速度会用超。')
53
+ }
54
+ const atLimit = policy.action?.atLimit === 'downgrade'
55
+ ? `降级到 ${policy.action.downgradeModel ?? '低阶模型'}`
56
+ : '只通知不拦截'
57
+ lines.push(`到线动作:${atLimit}(阈值 ${Math.round((policy.thresholds.warn ?? 0.8) * 100)}% 时提醒)`)
58
+ }
59
+
60
+ if (state.total.unknown > 0) {
61
+ lines.push(`其中 ${state.total.unknown} 次调用费率未知,未计入合计——真实花费可能更高。`)
62
+ }
63
+ if (state.sessions.length > 0) {
64
+ const top = state.sessions[0]
65
+ lines.push(`本周期最贵的会话:${top.sid.slice(0, 18)} ${money(top.amount, state.currency)}(${top.calls} 次)`)
66
+ }
67
+ return lines.join('\n')
68
+ },
69
+ }
70
+ }
package/lib/usage.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * 从宿主事件里抽取"这一次调用花了多少"。
3
+ *
4
+ * 只做一件事:session/event → { amount, currency, model, turn, step } | null。
5
+ * 不投影工具、不记时间轴——那是黑匣子的事。航油只关心钱。
6
+ */
7
+ import { normalizeUsage } from './rates.js'
8
+
9
+ const MODEL_EVENTS = new Set(['assistant/message'])
10
+
11
+ function payloadOf(event) {
12
+ const data = event?.data
13
+ if (data !== null && typeof data === 'object' && !Array.isArray(data)) return data
14
+ return event
15
+ }
16
+
17
+ function toInt(value) {
18
+ const n = Number(value)
19
+ return Number.isFinite(n) && n >= 0 ? Math.floor(n) : null
20
+ }
21
+
22
+ function round6(value) {
23
+ return Math.round(value * 1e6) / 1e6
24
+ }
25
+
26
+ /**
27
+ * @param {object} event - 宿主事件(形状 {type,seq,time,data} 或扁平)
28
+ * @param {ReturnType<import('./rates.js').loadRates>} rates
29
+ * @returns {{amount:number|null, currency:string, model:string|null, turn:number|null, step:number|null,
30
+ * reason:string|null, tokens:object, saved:number|null} | null}
31
+ */
32
+ export function spendOf(event, rates) {
33
+ const type = event?.type
34
+ if (!MODEL_EVENTS.has(type)) return null
35
+
36
+ const payload = payloadOf(event)
37
+ const normalized = normalizeUsage(payload?.usage ?? payload?.message?.usage)
38
+ // 无 usage 的尝试不算钱:宁可少记一笔,也不能把一个估计值写进预算
39
+ if (normalized === null || normalized.complete !== true) return null
40
+
41
+ const source = payload?.message?.source
42
+ const route = {
43
+ provider: source?.provider ?? payload?.provider ?? null,
44
+ model: source?.model ?? payload?.model ?? null,
45
+ }
46
+ const cost = rates.costOf(normalized, route)
47
+
48
+ return {
49
+ // 事件时间:去重键要用它。同一次调用被重复投递时时间相同;
50
+ // 而"同一轮同一步"的两个不同请求(宿主 tracer 里确实出现过)时间不同——
51
+ // 只按 (会话,轮,步) 去重会把真实消耗吞掉,这是真机验证抓到的 bug。
52
+ at: Number.isFinite(event?.time) ? Number(event.time) : null,
53
+ amount: cost.kind === 'known' ? round6(cost.amount) : null,
54
+ currency: cost.currency ?? 'CNY',
55
+ model: route.model,
56
+ turn: toInt(payload?.turn ?? event?.turn),
57
+ step: toInt(payload?.step ?? event?.step),
58
+ reason: cost.kind === 'known' ? null : cost.reason,
59
+ tokens: {
60
+ input: normalized.inputTokens,
61
+ cacheRead: normalized.cacheReadTokens,
62
+ cacheWrite: normalized.cacheWriteTokens,
63
+ output: normalized.outputTokens,
64
+ },
65
+ saved: cost.kind === 'known' ? round6(rates.savedOf(normalized, route) ?? 0) : null,
66
+ }
67
+ }
68
+
69
+ /** 幂等键:同一 (会话, 轮, 步) 的重复上报只算一次。 */
70
+ export function spendIdOf(sid, spend) {
71
+ return [sid ?? '', spend?.turn ?? '', spend?.step ?? ''].join('|')
72
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Fuel",
4
+ "description": "Budget and breaker: a per-day/week/month allowance, live spend and projection, model downgrade at the limit instead of a dead session."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "航油",
4
+ "description": "预算与熔断:按日/周/月设一个额度,实时看已用与预测,到线自动降级模型而不是打断会话。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@lingda-ai/dsh-plugin-quota",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "description": "航油:DSH 预算与熔断。按日/周/月给一个额度,实时显示已用与预测,到线自动降级模型而不是打断会话。只记金额与次数,不记对话内容。",
5
+ "keywords": [
6
+ "dsh",
7
+ "dsh-plugin",
8
+ "deepseek-harness",
9
+ "budget",
10
+ "quota",
11
+ "cost-control",
12
+ "rate-limit",
13
+ "observability"
14
+ ],
15
+ "license": "Apache-2.0",
16
+ "author": "LingDaAi",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/lingda-ai/dsh-plugin-quota.git"
20
+ },
21
+ "homepage": "https://gitee.com/linzhengtong/dsh-plugin-quota#readme",
22
+ "bugs": {
23
+ "url": "https://gitee.com/linzhengtong/dsh-plugin-quota/issues"
24
+ },
25
+ "type": "module",
26
+ "main": "index.js",
27
+ "exports": {
28
+ ".": "./index.js",
29
+ "./client": "./lib/client.js",
30
+ "./locale/*.json": "./locale/*.json",
31
+ "./icon": "./icon.svg",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "index.js",
36
+ "lib",
37
+ "cordis.patch.yml",
38
+ "locale/*.json",
39
+ "icon.svg",
40
+ "README.md",
41
+ "docs/*.md"
42
+ ],
43
+ "engines": {
44
+ "node": ">=22.6"
45
+ },
46
+ "dsh": {
47
+ "bundle": {
48
+ "patch": "./cordis.patch.yml"
49
+ },
50
+ "client": {
51
+ "platform": "web",
52
+ "inject": [
53
+ "@deepseek-ai/dsh-client-ui-sidebar-right"
54
+ ]
55
+ },
56
+ "catalog": {
57
+ "category": "other",
58
+ "summary": {
59
+ "en": "Fuel gives your agents a budget per day, week or month: live spend, a projection for the period, and a breaker that downgrades the model at the limit instead of killing the session. Amounts and counts only — never conversation content.",
60
+ "zh": "航油:给 Agent 一个按日/周/月的预算。实时已用、按速度预测周期末、到线自动降级模型而不是打断会话。只记金额与次数,不记内容。"
61
+ },
62
+ "capabilities": [
63
+ "session",
64
+ "local-endpoint",
65
+ "cost-budget",
66
+ "model-routing",
67
+ "dsh-client-ui-sidebar-right"
68
+ ]
69
+ }
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "scripts": {
75
+ "test": "node --test test/*.test.mjs",
76
+ "check": "node scripts/check-listing.mjs",
77
+ "verify": "node scripts/verify-real-host.mjs"
78
+ }
79
+ }