pantheon-opencode 1.6.0 → 1.6.2-beta.1
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/AGENTS.global.md +11 -11
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +45 -0
- package/README.md +122 -6
- package/README.pt-BR.md +14 -9
- package/bin/pantheon-init.mjs +255 -39
- package/package.json +8 -6
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +1 -1
- package/scripts/doctor.mjs +231 -46
- package/scripts/install/agents-md.mjs +2 -1
- package/scripts/install/config-migration.mjs +344 -393
- package/scripts/install/config-paths.mjs +15 -0
- package/scripts/install/interactive.mjs +30 -9
- package/scripts/install/interrupt.mjs +78 -0
- package/scripts/install/mcp-permissions.mjs +164 -0
- package/scripts/install/opencode-state.mjs +91 -0
- package/scripts/install/opencode-version.mjs +31 -13
- package/scripts/install/opencode-wildcard.mjs +106 -0
- package/scripts/install/opencode.mjs +508 -108
- package/scripts/install/plan-artifact.mjs +12 -1
- package/scripts/install/plugin.mjs +17 -1
- package/scripts/install/run-record.mjs +115 -0
- package/scripts/install/strings.mjs +35 -6
- package/scripts/install/v2-capabilities.mjs +204 -0
- package/scripts/package-evidence.mjs +1 -0
- package/scripts/release-gates.mjs +7 -2
- package/scripts/sandbox-env.sh +174 -0
- package/scripts/setup-v2-config.mjs +1703 -0
- package/scripts/setup.mjs +415 -0
- package/scripts/sync-tui.mjs +9 -1
- package/scripts/test-opencode-v2-sandbox.sh +438 -151
- package/scripts/update-skills-lock.mjs +30 -0
- package/skills-lock.json +10 -10
- package/src/agents/aphrodite.md +5 -2
- package/src/agents/apollo.md +5 -0
- package/src/agents/athena.md +6 -1
- package/src/agents/demeter.md +5 -1
- package/src/agents/gaia.md +4 -0
- package/src/agents/hephaestus.md +6 -1
- package/src/agents/hermes.md +6 -3
- package/src/agents/iris.md +5 -1
- package/src/agents/mnemosyne.md +20 -50
- package/src/agents/nyx.md +5 -1
- package/src/agents/prometheus.md +4 -0
- package/src/agents/talos.md +4 -0
- package/src/agents/themis.md +4 -0
- package/src/agents/zeus.md +9 -3
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +3 -3
- package/src/instructions/test-economy.instructions.md +6 -6
- package/src/mcp/pantheon_vision.py +37 -36
- package/src/mcp/requirements-mcp.txt +1 -1
- package/src/mcp/requirements-vision.txt +1 -1
- package/src/pantheon/cost-command.ts +127 -40
- package/src/pantheon/delegation-enforce.ts +160 -23
- package/src/pantheon/guard-path.ts +162 -0
- package/src/pantheon/v2-bounded-read.ts +15 -1
- package/src/pantheon/v2-bridge.ts +27 -0
- package/src/pantheon/v2-shell-hooks.ts +260 -0
- package/src/pantheon/v2-unsupported.mjs +32 -4
- package/src/pantheon/v2-vision.ts +34 -29
- package/src/pantheon/vision.ts +49 -11
- package/src/plugin-v2.ts +413 -60
- package/src/plugin.ts +22 -2
- package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
- package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-adapters.js +1142 -0
- package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
- package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
- package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
- package/src/plugins/tui/dist/quota-cli.js +184 -0
- package/src/plugins/tui/dist/quota-cli.js.map +1 -0
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +390 -0
- package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +1 -0
- package/src/plugins/tui/dist/server-v2.d.ts +14 -0
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
- package/src/plugins/tui/dist/server-v2.js +673 -0
- package/src/plugins/tui/dist/server-v2.js.map +1 -0
- package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
- package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +2492 -529
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/index-v2.ts +3 -6
- package/src/plugins/tui/package-lock.json +11 -11
- package/src/plugins/tui/package.json +6 -4
- package/src/plugins/tui/src/context-gauge.ts +59 -0
- package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
- package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
- package/src/plugins/tui/src/index-v2.tsx +199 -240
- package/src/plugins/tui/src/model-usage-limits.ts +4 -0
- package/src/plugins/tui/src/quota-adapters.ts +1598 -0
- package/src/plugins/tui/src/quota-cli.ts +237 -0
- package/src/plugins/tui/src/quota-rpc.ts +209 -0
- package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
- package/src/plugins/tui/src/quota-v2.tsx +986 -0
- package/src/plugins/tui/src/server-v2.ts +841 -0
- package/src/plugins/tui/src/sidebar-width.ts +129 -0
- package/src/plugins/tui/tsconfig.typecheck.json +1 -1
- package/src/plugins/tui/tsdown.config.ts +8 -1
- package/src/routing.yml +72 -13
- package/src/skills/README.md +4 -0
- package/src/skills/agent-coordination/SKILL.md +0 -3
- package/src/skills/artifact-management/SKILL.md +0 -3
- package/src/skills/auto-continue/SKILL.md +0 -3
- package/src/skills/code-review-checklist/SKILL.md +0 -3
- package/src/skills/context-compression/SKILL.md +0 -3
- package/src/skills/memory-bank/SKILL.md +6 -28
- package/src/skills/session-goal/SKILL.md +0 -3
- package/src/skills/simplify/SKILL.md +5 -4
- package/src/skills/tdd-with-agents/SKILL.md +0 -3
- package/src/skills/visual-review-pipeline/SKILL.md +0 -1
- package/src/pantheon/memory-context.ts +0 -1017
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { Rpc } from "@opencode/plugin/promise/index";
|
|
2
|
+
//#region src/quota-rpc.ts
|
|
3
|
+
/** Full provider matrix approved for the V2 quota surface. */
|
|
4
|
+
const QUOTA_PROVIDER_IDS = [
|
|
5
|
+
"anthropic",
|
|
6
|
+
"chutes",
|
|
7
|
+
"cursor",
|
|
8
|
+
"github-copilot",
|
|
9
|
+
"google-agy",
|
|
10
|
+
"kilo-gateway",
|
|
11
|
+
"nanogpt",
|
|
12
|
+
"ollama-cloud",
|
|
13
|
+
"openai",
|
|
14
|
+
"opencode-go",
|
|
15
|
+
"opencode-zen",
|
|
16
|
+
"openrouter",
|
|
17
|
+
"synthetic",
|
|
18
|
+
"xai-supergrok",
|
|
19
|
+
"gemini-cli",
|
|
20
|
+
"alibaba-coding-plan",
|
|
21
|
+
"alibaba-token-plan",
|
|
22
|
+
"deepseek",
|
|
23
|
+
"kimi-code-global",
|
|
24
|
+
"kimi-code-cn",
|
|
25
|
+
"minimax-plan-global",
|
|
26
|
+
"minimax-plan-cn",
|
|
27
|
+
"xiaomi-mimo",
|
|
28
|
+
"zai-coding-plan",
|
|
29
|
+
"zhipu-coding-plan"
|
|
30
|
+
];
|
|
31
|
+
const providerStatusSchema = {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {
|
|
34
|
+
provider: {
|
|
35
|
+
type: "string",
|
|
36
|
+
enum: QUOTA_PROVIDER_IDS
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
type: "string",
|
|
40
|
+
minLength: 1,
|
|
41
|
+
maxLength: 48
|
|
42
|
+
},
|
|
43
|
+
scope: {
|
|
44
|
+
type: "string",
|
|
45
|
+
enum: [
|
|
46
|
+
"account",
|
|
47
|
+
"selected_key",
|
|
48
|
+
"team",
|
|
49
|
+
"session"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
authentication: {
|
|
53
|
+
type: "string",
|
|
54
|
+
enum: [
|
|
55
|
+
"connected",
|
|
56
|
+
"not_connected",
|
|
57
|
+
"unavailable"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
state: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: [
|
|
63
|
+
"available",
|
|
64
|
+
"needs_setup",
|
|
65
|
+
"unavailable"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
reason: {
|
|
69
|
+
type: "string",
|
|
70
|
+
enum: [
|
|
71
|
+
"none",
|
|
72
|
+
"not_connected",
|
|
73
|
+
"unsupported",
|
|
74
|
+
"private_endpoint",
|
|
75
|
+
"eligibility_unverified",
|
|
76
|
+
"runtime_accounting_unavailable",
|
|
77
|
+
"cli_identity_unavailable",
|
|
78
|
+
"unsupported_credential_method",
|
|
79
|
+
"provider_error",
|
|
80
|
+
"not_subscribed",
|
|
81
|
+
"rate_limited",
|
|
82
|
+
"unauthorized",
|
|
83
|
+
"forbidden",
|
|
84
|
+
"timeout",
|
|
85
|
+
"network_error",
|
|
86
|
+
"invalid_response"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
route_kind: {
|
|
90
|
+
type: "string",
|
|
91
|
+
enum: [
|
|
92
|
+
"api_key",
|
|
93
|
+
"console_oauth",
|
|
94
|
+
"none",
|
|
95
|
+
"unsupported"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
retry_after_ms: {
|
|
99
|
+
type: "integer",
|
|
100
|
+
minimum: 0,
|
|
101
|
+
maximum: 36e5
|
|
102
|
+
},
|
|
103
|
+
metrics: {
|
|
104
|
+
type: "array",
|
|
105
|
+
items: { oneOf: [
|
|
106
|
+
{
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
kind: { const: "provider_quota" },
|
|
110
|
+
used: {
|
|
111
|
+
type: "number",
|
|
112
|
+
minimum: 0
|
|
113
|
+
},
|
|
114
|
+
remaining: {
|
|
115
|
+
type: "number",
|
|
116
|
+
minimum: 0
|
|
117
|
+
},
|
|
118
|
+
unit: {
|
|
119
|
+
type: "string",
|
|
120
|
+
minLength: 1,
|
|
121
|
+
maxLength: 16
|
|
122
|
+
},
|
|
123
|
+
label: {
|
|
124
|
+
type: "string",
|
|
125
|
+
minLength: 1,
|
|
126
|
+
maxLength: 48
|
|
127
|
+
},
|
|
128
|
+
period: {
|
|
129
|
+
type: "string",
|
|
130
|
+
maxLength: 32
|
|
131
|
+
},
|
|
132
|
+
resetsAt: {
|
|
133
|
+
type: "number",
|
|
134
|
+
minimum: 0,
|
|
135
|
+
maximum: 864e13
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
required: [
|
|
139
|
+
"kind",
|
|
140
|
+
"used",
|
|
141
|
+
"remaining",
|
|
142
|
+
"unit",
|
|
143
|
+
"label"
|
|
144
|
+
],
|
|
145
|
+
additionalProperties: false
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
kind: { const: "balance" },
|
|
151
|
+
amount: {
|
|
152
|
+
type: "number",
|
|
153
|
+
minimum: 0
|
|
154
|
+
},
|
|
155
|
+
currency: {
|
|
156
|
+
type: "string",
|
|
157
|
+
enum: ["USD", "CNY"]
|
|
158
|
+
},
|
|
159
|
+
label: {
|
|
160
|
+
type: "string",
|
|
161
|
+
minLength: 1,
|
|
162
|
+
maxLength: 48
|
|
163
|
+
},
|
|
164
|
+
status: {
|
|
165
|
+
type: "string",
|
|
166
|
+
enum: [
|
|
167
|
+
"available",
|
|
168
|
+
"unavailable",
|
|
169
|
+
"active",
|
|
170
|
+
"inactive"
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
required: [
|
|
175
|
+
"kind",
|
|
176
|
+
"amount",
|
|
177
|
+
"currency",
|
|
178
|
+
"label"
|
|
179
|
+
],
|
|
180
|
+
additionalProperties: false
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: "object",
|
|
184
|
+
properties: {
|
|
185
|
+
kind: { const: "estimate" },
|
|
186
|
+
amount: {
|
|
187
|
+
type: "number",
|
|
188
|
+
minimum: 0
|
|
189
|
+
},
|
|
190
|
+
unit: {
|
|
191
|
+
type: "string",
|
|
192
|
+
minLength: 1,
|
|
193
|
+
maxLength: 16
|
|
194
|
+
},
|
|
195
|
+
label: {
|
|
196
|
+
type: "string",
|
|
197
|
+
minLength: 1,
|
|
198
|
+
maxLength: 48
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
required: [
|
|
202
|
+
"kind",
|
|
203
|
+
"amount",
|
|
204
|
+
"unit",
|
|
205
|
+
"label"
|
|
206
|
+
],
|
|
207
|
+
additionalProperties: false
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: "object",
|
|
211
|
+
properties: {
|
|
212
|
+
kind: { const: "key_usage" },
|
|
213
|
+
amount: {
|
|
214
|
+
type: "number",
|
|
215
|
+
minimum: 0
|
|
216
|
+
},
|
|
217
|
+
currency: {
|
|
218
|
+
type: "string",
|
|
219
|
+
enum: ["USD", "CNY"]
|
|
220
|
+
},
|
|
221
|
+
label: {
|
|
222
|
+
type: "string",
|
|
223
|
+
minLength: 1,
|
|
224
|
+
maxLength: 48
|
|
225
|
+
},
|
|
226
|
+
period: {
|
|
227
|
+
type: "string",
|
|
228
|
+
maxLength: 32
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
required: [
|
|
232
|
+
"kind",
|
|
233
|
+
"amount",
|
|
234
|
+
"currency",
|
|
235
|
+
"label"
|
|
236
|
+
],
|
|
237
|
+
additionalProperties: false
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
type: "object",
|
|
241
|
+
properties: {
|
|
242
|
+
kind: { const: "session_usage" },
|
|
243
|
+
amount: {
|
|
244
|
+
type: "number",
|
|
245
|
+
minimum: 0
|
|
246
|
+
},
|
|
247
|
+
unit: {
|
|
248
|
+
type: "string",
|
|
249
|
+
minLength: 1,
|
|
250
|
+
maxLength: 16
|
|
251
|
+
},
|
|
252
|
+
label: {
|
|
253
|
+
type: "string",
|
|
254
|
+
minLength: 1,
|
|
255
|
+
maxLength: 48
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
required: [
|
|
259
|
+
"kind",
|
|
260
|
+
"amount",
|
|
261
|
+
"unit",
|
|
262
|
+
"label"
|
|
263
|
+
],
|
|
264
|
+
additionalProperties: false
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
type: "object",
|
|
268
|
+
properties: {
|
|
269
|
+
kind: { const: "provider_status" },
|
|
270
|
+
status: {
|
|
271
|
+
type: "string",
|
|
272
|
+
enum: [
|
|
273
|
+
"available",
|
|
274
|
+
"unavailable",
|
|
275
|
+
"active",
|
|
276
|
+
"inactive"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
label: {
|
|
280
|
+
type: "string",
|
|
281
|
+
minLength: 1,
|
|
282
|
+
maxLength: 48
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
required: [
|
|
286
|
+
"kind",
|
|
287
|
+
"status",
|
|
288
|
+
"label"
|
|
289
|
+
],
|
|
290
|
+
additionalProperties: false
|
|
291
|
+
}
|
|
292
|
+
] },
|
|
293
|
+
maxItems: 16
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
required: [
|
|
297
|
+
"provider",
|
|
298
|
+
"label",
|
|
299
|
+
"scope",
|
|
300
|
+
"authentication",
|
|
301
|
+
"state",
|
|
302
|
+
"reason",
|
|
303
|
+
"metrics"
|
|
304
|
+
],
|
|
305
|
+
additionalProperties: false
|
|
306
|
+
};
|
|
307
|
+
/** Shared definition keeps the TUI RPC client aligned with the server contract. */
|
|
308
|
+
const quotaRpc = Rpc.define({
|
|
309
|
+
id: "pantheon.quota",
|
|
310
|
+
methods: {
|
|
311
|
+
go_key_diagnostic: {
|
|
312
|
+
input: {
|
|
313
|
+
type: "object",
|
|
314
|
+
properties: {},
|
|
315
|
+
additionalProperties: false
|
|
316
|
+
},
|
|
317
|
+
output: {
|
|
318
|
+
type: "object",
|
|
319
|
+
properties: {
|
|
320
|
+
category: {
|
|
321
|
+
type: "string",
|
|
322
|
+
enum: [
|
|
323
|
+
"not_run",
|
|
324
|
+
"already_used",
|
|
325
|
+
"success",
|
|
326
|
+
"unauthorized",
|
|
327
|
+
"redirect",
|
|
328
|
+
"http_error",
|
|
329
|
+
"timeout",
|
|
330
|
+
"network_error"
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
status: {
|
|
334
|
+
type: "integer",
|
|
335
|
+
minimum: 100,
|
|
336
|
+
maximum: 599
|
|
337
|
+
},
|
|
338
|
+
content_type: {
|
|
339
|
+
type: "string",
|
|
340
|
+
enum: [
|
|
341
|
+
"application/json",
|
|
342
|
+
"text/plain",
|
|
343
|
+
"text/html",
|
|
344
|
+
"other",
|
|
345
|
+
"missing"
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
error_structure: {
|
|
349
|
+
type: "string",
|
|
350
|
+
enum: [
|
|
351
|
+
"present",
|
|
352
|
+
"absent",
|
|
353
|
+
"unavailable"
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
required: ["category"],
|
|
358
|
+
additionalProperties: false
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
status: {
|
|
362
|
+
input: {
|
|
363
|
+
type: "object",
|
|
364
|
+
properties: {},
|
|
365
|
+
additionalProperties: false
|
|
366
|
+
},
|
|
367
|
+
output: {
|
|
368
|
+
type: "object",
|
|
369
|
+
properties: {
|
|
370
|
+
providers: {
|
|
371
|
+
type: "array",
|
|
372
|
+
items: providerStatusSchema
|
|
373
|
+
},
|
|
374
|
+
credential_resolution_failed: { const: true }
|
|
375
|
+
},
|
|
376
|
+
required: ["providers"],
|
|
377
|
+
additionalProperties: false
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
events: { credentials_changed: { schema: {
|
|
382
|
+
type: "object",
|
|
383
|
+
properties: {},
|
|
384
|
+
additionalProperties: false
|
|
385
|
+
} } }
|
|
386
|
+
});
|
|
387
|
+
//#endregion
|
|
388
|
+
export { quotaRpc as n, QUOTA_PROVIDER_IDS as t };
|
|
389
|
+
|
|
390
|
+
//# sourceMappingURL=quota-rpc-UL2HuFRJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-rpc-UL2HuFRJ.js","names":[],"sources":["../src/quota-rpc.ts"],"sourcesContent":["import { Rpc } from '@opencode/plugin/promise/index'\n\n/** Full provider matrix approved for the V2 quota surface. */\nexport const QUOTA_PROVIDER_IDS = [\n 'anthropic',\n 'chutes',\n 'cursor',\n 'github-copilot',\n 'google-agy',\n 'kilo-gateway',\n 'nanogpt',\n 'ollama-cloud',\n 'openai',\n 'opencode-go',\n 'opencode-zen',\n 'openrouter',\n 'synthetic',\n 'xai-supergrok',\n 'gemini-cli',\n 'alibaba-coding-plan',\n 'alibaba-token-plan',\n 'deepseek',\n 'kimi-code-global',\n 'kimi-code-cn',\n 'minimax-plan-global',\n 'minimax-plan-cn',\n 'xiaomi-mimo',\n 'zai-coding-plan',\n 'zhipu-coding-plan',\n] as const\n\nexport type QuotaProviderId = (typeof QUOTA_PROVIDER_IDS)[number]\n\n/** Safe route labels are limited to OpenCode Go and never contain request data. */\nexport type OpenCodeGoRouteKind = 'api_key' | 'console_oauth' | 'none' | 'unsupported'\n\n/** GLM plans may report up to 16 distinct quota windows in one response. */\nexport const MAX_PROVIDER_METRICS = 16\n\nconst metricSchema = {\n oneOf: [\n {\n type: 'object',\n properties: {\n kind: { const: 'provider_quota' },\n used: { type: 'number', minimum: 0 },\n remaining: { type: 'number', minimum: 0 },\n unit: { type: 'string', minLength: 1, maxLength: 16 },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n period: { type: 'string', maxLength: 32 },\n resetsAt: { type: 'number', minimum: 0, maximum: 8_640_000_000_000_000 },\n },\n required: ['kind', 'used', 'remaining', 'unit', 'label'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n kind: { const: 'balance' },\n amount: { type: 'number', minimum: 0 },\n currency: { type: 'string', enum: ['USD', 'CNY'] },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n status: { type: 'string', enum: ['available', 'unavailable', 'active', 'inactive'] },\n },\n required: ['kind', 'amount', 'currency', 'label'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n kind: { const: 'estimate' },\n amount: { type: 'number', minimum: 0 },\n unit: { type: 'string', minLength: 1, maxLength: 16 },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n },\n required: ['kind', 'amount', 'unit', 'label'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n kind: { const: 'key_usage' },\n amount: { type: 'number', minimum: 0 },\n currency: { type: 'string', enum: ['USD', 'CNY'] },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n period: { type: 'string', maxLength: 32 },\n },\n required: ['kind', 'amount', 'currency', 'label'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n kind: { const: 'session_usage' },\n amount: { type: 'number', minimum: 0 },\n unit: { type: 'string', minLength: 1, maxLength: 16 },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n },\n required: ['kind', 'amount', 'unit', 'label'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n kind: { const: 'provider_status' },\n status: { type: 'string', enum: ['available', 'unavailable', 'active', 'inactive'] },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n },\n required: ['kind', 'status', 'label'],\n additionalProperties: false,\n },\n ],\n} as const\n\nconst providerStatusSchema = {\n type: 'object',\n properties: {\n provider: { type: 'string', enum: QUOTA_PROVIDER_IDS },\n label: { type: 'string', minLength: 1, maxLength: 48 },\n scope: { type: 'string', enum: ['account', 'selected_key', 'team', 'session'] },\n authentication: { type: 'string', enum: ['connected', 'not_connected', 'unavailable'] },\n state: { type: 'string', enum: ['available', 'needs_setup', 'unavailable'] },\n reason: {\n type: 'string',\n enum: [\n 'none',\n 'not_connected',\n 'unsupported',\n 'private_endpoint',\n 'eligibility_unverified',\n 'runtime_accounting_unavailable',\n 'cli_identity_unavailable',\n 'unsupported_credential_method',\n 'provider_error',\n 'not_subscribed',\n 'rate_limited',\n 'unauthorized',\n 'forbidden',\n 'timeout',\n 'network_error',\n 'invalid_response',\n ],\n },\n route_kind: {\n type: 'string',\n enum: ['api_key', 'console_oauth', 'none', 'unsupported'],\n },\n retry_after_ms: { type: 'integer', minimum: 0, maximum: 3_600_000 },\n metrics: { type: 'array', items: metricSchema, maxItems: MAX_PROVIDER_METRICS },\n },\n required: ['provider', 'label', 'scope', 'authentication', 'state', 'reason', 'metrics'],\n additionalProperties: false,\n} as const\n\n/** Shared definition keeps the TUI RPC client aligned with the server contract. */\nexport const quotaRpc = Rpc.define({\n id: 'pantheon.quota',\n methods: {\n go_key_diagnostic: {\n input: { type: 'object', properties: {}, additionalProperties: false },\n output: {\n type: 'object',\n properties: {\n category: {\n type: 'string',\n enum: [\n 'not_run',\n 'already_used',\n 'success',\n 'unauthorized',\n 'redirect',\n 'http_error',\n 'timeout',\n 'network_error',\n ],\n },\n status: { type: 'integer', minimum: 100, maximum: 599 },\n content_type: {\n type: 'string',\n enum: ['application/json', 'text/plain', 'text/html', 'other', 'missing'],\n },\n error_structure: {\n type: 'string',\n enum: ['present', 'absent', 'unavailable'],\n },\n },\n required: ['category'],\n additionalProperties: false,\n },\n },\n status: {\n input: { type: 'object', properties: {}, additionalProperties: false },\n output: {\n type: 'object',\n properties: {\n providers: { type: 'array', items: providerStatusSchema },\n credential_resolution_failed: { const: true },\n },\n required: ['providers'],\n additionalProperties: false,\n },\n },\n },\n events: {\n credentials_changed: {\n schema: { type: 'object', properties: {}, additionalProperties: false },\n },\n },\n})\n"],"mappings":";;;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAqFA,MAAM,uBAAuB;CAC3B,MAAM;CACN,YAAY;EACV,UAAU;GAAE,MAAM;GAAU,MAAM;EAAmB;EACrD,OAAO;GAAE,MAAM;GAAU,WAAW;GAAG,WAAW;EAAG;EACrD,OAAO;GAAE,MAAM;GAAU,MAAM;IAAC;IAAW;IAAgB;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AU;CAAS;CACvF,sBAAsB;AACxB;;AAGA,MAAa,WAAW,IAAI,OAAO;CACjC,IAAI;CACJ,SAAS;EACP,mBAAmB;GACjB,OAAO;IAAE,MAAM;IAAU,YAAY,CAAC;IAAG,sBAAsB;GAAM;GACrE,QAAQ;IACN,MAAM;IACN,YAAY;KACV,UAAU;MACR,MAAM;MACN,MAAM;OACJ;OACA;OACA;OACA;OACA;OACA;OACA;OACA;MACF;KACF;KACA,QAAQ;MAAE,MAAM;MAAW,SAAS;MAAK,SAAS;KAAI;KACtD,cAAc;MACZ,MAAM;MACN,MAAM;OAAC;OAAoB;OAAc;OAAa;OAAS;MAAS;KAC1E;KACA,iBAAiB;MACf,MAAM;MACN,MAAM;OAAC;OAAW;OAAU;MAAa;KAC3C;IACF;IACA,UAAU,CAAC,UAAU;IACrB,sBAAsB;GACxB;EACF;EACA,QAAQ;GACN,OAAO;IAAE,MAAM;IAAU,YAAY,CAAC;IAAG,sBAAsB;GAAM;GACrE,QAAQ;IACN,MAAM;IACN,YAAY;KACV,WAAW;MAAE,MAAM;MAAS,OAAO;KAAqB;KACxD,8BAA8B,EAAE,OAAO,KAAK;IAC9C;IACA,UAAU,CAAC,WAAW;IACtB,sBAAsB;GACxB;EACF;CACF;CACA,QAAQ,EACN,qBAAqB,EACnB,QAAQ;EAAE,MAAM;EAAU,YAAY,CAAC;EAAG,sBAAsB;CAAM,EACxE,EACF;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { queryAlibabaTokenPlanUsage } from "./quota-cli.js";
|
|
2
|
+
import { Context } from "@opencode/plugin/promise/plugin";
|
|
3
|
+
//#region src/server-v2.d.ts
|
|
4
|
+
export declare function createQuotaPlugin(queryCli?: typeof queryAlibabaTokenPlanUsage): {
|
|
5
|
+
id: string;
|
|
6
|
+
setup(context: Context): Promise<() => Promise<void>>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: {
|
|
9
|
+
id: string;
|
|
10
|
+
setup(context: Context): Promise<() => Promise<void>>;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { _default as default };
|
|
14
|
+
//# sourceMappingURL=server-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-v2.d.ts","names":[],"sources":["../src/server-v2.ts"],"mappings":";;;wBAmwBgB,kBACd,kBAAiB;;EAKM,MAAA,SAAA,UAAO,cAAA;;;;EAAP,MAAA,SAAA,UAAO,cAAA"}
|