pantheon-opencode 1.6.2-beta.8 → 1.6.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +121 -3
  2. package/README.md +34 -60
  3. package/README.pt-BR.md +10 -12
  4. package/bin/pantheon-init.mjs +30 -32
  5. package/package.json +3 -3
  6. package/plugin.json +1 -1
  7. package/pyproject.toml +1 -1
  8. package/scripts/decision-router.mjs +41 -56
  9. package/scripts/install/decision-router-config.mjs +67 -1
  10. package/scripts/install/npx-cache-sweep.mjs +103 -0
  11. package/scripts/install/opencode.mjs +7 -7
  12. package/scripts/install/plugin.mjs +4 -3
  13. package/scripts/install/strings.mjs +4 -0
  14. package/scripts/release-gates.mjs +6 -82
  15. package/scripts/sync-tui.mjs +3 -3
  16. package/src/agents/aphrodite.md +1 -1
  17. package/src/agents/apollo.md +1 -0
  18. package/src/agents/athena.md +1 -0
  19. package/src/agents/demeter.md +1 -1
  20. package/src/agents/gaia.md +1 -0
  21. package/src/agents/hephaestus.md +1 -1
  22. package/src/agents/hermes.md +1 -1
  23. package/src/agents/iris.md +1 -1
  24. package/src/agents/mnemosyne.md +1 -0
  25. package/src/agents/nyx.md +1 -1
  26. package/src/agents/prometheus.md +1 -1
  27. package/src/agents/talos.md +1 -1
  28. package/src/agents/themis.md +1 -1
  29. package/src/agents/zeus.md +5 -2
  30. package/src/pantheon/jev-decision-tool.ts +366 -114
  31. package/src/pantheon/jev-decisions.ts +11 -13
  32. package/src/pantheon/jev-escalation.ts +639 -0
  33. package/src/pantheon/jev-quality-score.ts +432 -0
  34. package/src/pantheon/jev-risk-gate.ts +479 -0
  35. package/src/pantheon/local-decision-prompt.ts +12 -18
  36. package/src/pantheon/v2-decision-telemetry.ts +14 -4
  37. package/src/pantheon/v2-native-decisions.ts +1 -1
  38. package/src/plugin-v2.ts +201 -24
  39. package/src/plugins/tui/dist/server-v2.d.ts +19 -11
  40. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
  41. package/src/plugins/tui/dist/server-v2.js +19 -789
  42. package/src/plugins/tui/dist/server-v2.js.map +1 -1
  43. package/src/plugins/tui/dist/tui-v2.d.ts +12 -331
  44. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  45. package/src/plugins/tui/dist/tui-v2.js +257 -5370
  46. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  47. package/src/plugins/tui/dist/tui.js +1 -1
  48. package/src/plugins/tui/package-lock.json +2 -2
  49. package/src/plugins/tui/package.json +1 -1
  50. package/src/plugins/tui/src/index-v2.tsx +213 -86
  51. package/src/plugins/tui/src/server-v2.ts +18 -982
  52. package/src/plugins/tui/tsconfig.typecheck.json +1 -6
  53. package/src/plugins/tui/tsdown.config.ts +1 -11
  54. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js +0 -749
  55. package/src/plugins/tui/dist/cost-data-CCZUs1aJ.js.map +0 -1
  56. package/src/plugins/tui/dist/quota-adapters.d.ts +0 -89
  57. package/src/plugins/tui/dist/quota-adapters.d.ts.map +0 -1
  58. package/src/plugins/tui/dist/quota-adapters.js +0 -1142
  59. package/src/plugins/tui/dist/quota-adapters.js.map +0 -1
  60. package/src/plugins/tui/dist/quota-cli.d.ts +0 -17
  61. package/src/plugins/tui/dist/quota-cli.d.ts.map +0 -1
  62. package/src/plugins/tui/dist/quota-cli.js +0 -184
  63. package/src/plugins/tui/dist/quota-cli.js.map +0 -1
  64. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js +0 -684
  65. package/src/plugins/tui/dist/quota-rpc-DMmXBhBe.js.map +0 -1
  66. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js +0 -118
  67. package/src/plugins/tui/dist/usage-history-contract-nt1rnBPE.js.map +0 -1
  68. package/src/plugins/tui/dist/usage-history-worker.js +0 -25
  69. package/src/plugins/tui/dist/usage-history-worker.js.map +0 -1
  70. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +0 -100
  71. package/src/plugins/tui/src/go-key-diagnostic.ts +0 -125
  72. package/src/plugins/tui/src/quota-adapters.ts +0 -1598
  73. package/src/plugins/tui/src/quota-cli.ts +0 -237
  74. package/src/plugins/tui/src/quota-rpc.ts +0 -373
  75. package/src/plugins/tui/src/quota-v2-model.ts +0 -1032
  76. package/src/plugins/tui/src/quota-v2.tsx +0 -1238
  77. package/src/plugins/tui/src/usage-history-contract.ts +0 -217
  78. package/src/plugins/tui/src/usage-history-validation.ts +0 -104
  79. package/src/plugins/tui/src/usage-history-view.tsx +0 -236
  80. package/src/plugins/tui/src/usage-history-worker.ts +0 -25
  81. package/src/plugins/tui/src/usage-view-model.ts +0 -272
@@ -1,684 +0,0 @@
1
- import { n as USAGE_HISTORY_PERIODS } from "./usage-history-contract-nt1rnBPE.js";
2
- import { Rpc } from "@opencode/plugin/promise/index";
3
- //#region src/quota-rpc.ts
4
- /** Full provider matrix approved for the V2 quota surface. */
5
- const QUOTA_PROVIDER_IDS = [
6
- "anthropic",
7
- "chutes",
8
- "cursor",
9
- "github-copilot",
10
- "google-agy",
11
- "kilo-gateway",
12
- "nanogpt",
13
- "ollama-cloud",
14
- "openai",
15
- "opencode-go",
16
- "opencode-zen",
17
- "openrouter",
18
- "synthetic",
19
- "xai-supergrok",
20
- "gemini-cli",
21
- "alibaba-coding-plan",
22
- "alibaba-token-plan",
23
- "deepseek",
24
- "kimi-code-global",
25
- "kimi-code-cn",
26
- "minimax-plan-global",
27
- "minimax-plan-cn",
28
- "xiaomi-mimo",
29
- "zai-coding-plan",
30
- "zhipu-coding-plan"
31
- ];
32
- const providerStatusSchema = {
33
- type: "object",
34
- properties: {
35
- provider: {
36
- type: "string",
37
- enum: QUOTA_PROVIDER_IDS
38
- },
39
- label: {
40
- type: "string",
41
- minLength: 1,
42
- maxLength: 48
43
- },
44
- scope: {
45
- type: "string",
46
- enum: [
47
- "account",
48
- "selected_key",
49
- "team",
50
- "session"
51
- ]
52
- },
53
- authentication: {
54
- type: "string",
55
- enum: [
56
- "connected",
57
- "not_connected",
58
- "unavailable"
59
- ]
60
- },
61
- state: {
62
- type: "string",
63
- enum: [
64
- "available",
65
- "needs_setup",
66
- "unavailable"
67
- ]
68
- },
69
- reason: {
70
- type: "string",
71
- enum: [
72
- "none",
73
- "not_connected",
74
- "unsupported",
75
- "private_endpoint",
76
- "eligibility_unverified",
77
- "runtime_accounting_unavailable",
78
- "cli_identity_unavailable",
79
- "unsupported_credential_method",
80
- "provider_error",
81
- "not_subscribed",
82
- "rate_limited",
83
- "unauthorized",
84
- "forbidden",
85
- "timeout",
86
- "network_error",
87
- "invalid_response"
88
- ]
89
- },
90
- route_kind: {
91
- type: "string",
92
- enum: [
93
- "api_key",
94
- "console_oauth",
95
- "none",
96
- "unsupported"
97
- ]
98
- },
99
- retry_after_ms: {
100
- type: "integer",
101
- minimum: 0,
102
- maximum: 36e5
103
- },
104
- metrics: {
105
- type: "array",
106
- items: { oneOf: [
107
- {
108
- type: "object",
109
- properties: {
110
- kind: { const: "provider_quota" },
111
- used: {
112
- type: "number",
113
- minimum: 0
114
- },
115
- remaining: {
116
- type: "number",
117
- minimum: 0
118
- },
119
- unit: {
120
- type: "string",
121
- minLength: 1,
122
- maxLength: 16
123
- },
124
- label: {
125
- type: "string",
126
- minLength: 1,
127
- maxLength: 48
128
- },
129
- period: {
130
- type: "string",
131
- maxLength: 32
132
- },
133
- resetsAt: {
134
- type: "number",
135
- minimum: 0,
136
- maximum: 864e13
137
- }
138
- },
139
- required: [
140
- "kind",
141
- "used",
142
- "remaining",
143
- "unit",
144
- "label"
145
- ],
146
- additionalProperties: false
147
- },
148
- {
149
- type: "object",
150
- properties: {
151
- kind: { const: "balance" },
152
- amount: {
153
- type: "number",
154
- minimum: 0
155
- },
156
- currency: {
157
- type: "string",
158
- enum: ["USD", "CNY"]
159
- },
160
- label: {
161
- type: "string",
162
- minLength: 1,
163
- maxLength: 48
164
- },
165
- status: {
166
- type: "string",
167
- enum: [
168
- "available",
169
- "unavailable",
170
- "active",
171
- "inactive"
172
- ]
173
- }
174
- },
175
- required: [
176
- "kind",
177
- "amount",
178
- "currency",
179
- "label"
180
- ],
181
- additionalProperties: false
182
- },
183
- {
184
- type: "object",
185
- properties: {
186
- kind: { const: "estimate" },
187
- amount: {
188
- type: "number",
189
- minimum: 0
190
- },
191
- unit: {
192
- type: "string",
193
- minLength: 1,
194
- maxLength: 16
195
- },
196
- label: {
197
- type: "string",
198
- minLength: 1,
199
- maxLength: 48
200
- }
201
- },
202
- required: [
203
- "kind",
204
- "amount",
205
- "unit",
206
- "label"
207
- ],
208
- additionalProperties: false
209
- },
210
- {
211
- type: "object",
212
- properties: {
213
- kind: { const: "key_usage" },
214
- amount: {
215
- type: "number",
216
- minimum: 0
217
- },
218
- currency: {
219
- type: "string",
220
- enum: ["USD", "CNY"]
221
- },
222
- label: {
223
- type: "string",
224
- minLength: 1,
225
- maxLength: 48
226
- },
227
- period: {
228
- type: "string",
229
- maxLength: 32
230
- }
231
- },
232
- required: [
233
- "kind",
234
- "amount",
235
- "currency",
236
- "label"
237
- ],
238
- additionalProperties: false
239
- },
240
- {
241
- type: "object",
242
- properties: {
243
- kind: { const: "session_usage" },
244
- amount: {
245
- type: "number",
246
- minimum: 0
247
- },
248
- unit: {
249
- type: "string",
250
- minLength: 1,
251
- maxLength: 16
252
- },
253
- label: {
254
- type: "string",
255
- minLength: 1,
256
- maxLength: 48
257
- }
258
- },
259
- required: [
260
- "kind",
261
- "amount",
262
- "unit",
263
- "label"
264
- ],
265
- additionalProperties: false
266
- },
267
- {
268
- type: "object",
269
- properties: {
270
- kind: { const: "provider_status" },
271
- status: {
272
- type: "string",
273
- enum: [
274
- "available",
275
- "unavailable",
276
- "active",
277
- "inactive"
278
- ]
279
- },
280
- label: {
281
- type: "string",
282
- minLength: 1,
283
- maxLength: 48
284
- }
285
- },
286
- required: [
287
- "kind",
288
- "status",
289
- "label"
290
- ],
291
- additionalProperties: false
292
- }
293
- ] },
294
- maxItems: 16
295
- }
296
- },
297
- required: [
298
- "provider",
299
- "label",
300
- "scope",
301
- "authentication",
302
- "state",
303
- "reason",
304
- "metrics"
305
- ],
306
- additionalProperties: false
307
- };
308
- const usageHistoryTotalsSchema = {
309
- type: "object",
310
- properties: {
311
- input: {
312
- type: "integer",
313
- minimum: 0,
314
- maximum: Number.MAX_SAFE_INTEGER
315
- },
316
- output: {
317
- type: "integer",
318
- minimum: 0,
319
- maximum: Number.MAX_SAFE_INTEGER
320
- },
321
- cacheRead: {
322
- type: "integer",
323
- minimum: 0,
324
- maximum: Number.MAX_SAFE_INTEGER
325
- },
326
- cacheWrite: {
327
- type: "integer",
328
- minimum: 0,
329
- maximum: Number.MAX_SAFE_INTEGER
330
- },
331
- total: {
332
- type: "integer",
333
- minimum: 0,
334
- maximum: Number.MAX_SAFE_INTEGER
335
- }
336
- },
337
- required: [
338
- "input",
339
- "output",
340
- "cacheRead",
341
- "cacheWrite",
342
- "total"
343
- ],
344
- additionalProperties: false
345
- };
346
- const usageHistoryBucketSchema = {
347
- type: "object",
348
- properties: {
349
- date: {
350
- type: "string",
351
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
352
- },
353
- input: {
354
- type: "integer",
355
- minimum: 0,
356
- maximum: Number.MAX_SAFE_INTEGER
357
- },
358
- output: {
359
- type: "integer",
360
- minimum: 0,
361
- maximum: Number.MAX_SAFE_INTEGER
362
- },
363
- cacheRead: {
364
- type: "integer",
365
- minimum: 0,
366
- maximum: Number.MAX_SAFE_INTEGER
367
- },
368
- cacheWrite: {
369
- type: "integer",
370
- minimum: 0,
371
- maximum: Number.MAX_SAFE_INTEGER
372
- },
373
- total: {
374
- type: "integer",
375
- minimum: 0,
376
- maximum: Number.MAX_SAFE_INTEGER
377
- },
378
- estimatedUsd: {
379
- type: "number",
380
- minimum: 0
381
- },
382
- pricingComplete: { type: "boolean" }
383
- },
384
- required: [
385
- "date",
386
- "input",
387
- "output",
388
- "cacheRead",
389
- "cacheWrite",
390
- "total",
391
- "pricingComplete"
392
- ],
393
- additionalProperties: false
394
- };
395
- const usageHistoryAvailableSchema = {
396
- type: "object",
397
- properties: {
398
- status: {
399
- type: "string",
400
- enum: ["available", "partial"]
401
- },
402
- period: {
403
- type: "string",
404
- enum: USAGE_HISTORY_PERIODS
405
- },
406
- coverageStart: {
407
- type: ["string", "null"],
408
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
409
- },
410
- partial: { type: "boolean" },
411
- truncated: { type: "boolean" },
412
- rows: {
413
- type: "integer",
414
- minimum: 0,
415
- maximum: Number.MAX_SAFE_INTEGER
416
- },
417
- buckets: {
418
- type: "array",
419
- items: usageHistoryBucketSchema,
420
- maxItems: 366
421
- },
422
- totals: usageHistoryTotalsSchema,
423
- models: {
424
- type: "array",
425
- maxItems: 64,
426
- items: {
427
- type: "object",
428
- properties: {
429
- providerID: {
430
- type: "string",
431
- minLength: 1,
432
- maxLength: 128
433
- },
434
- modelID: {
435
- type: "string",
436
- minLength: 1,
437
- maxLength: 128
438
- },
439
- totals: usageHistoryTotalsSchema,
440
- estimatedUsd: {
441
- type: "number",
442
- minimum: 0
443
- },
444
- pricingComplete: { type: "boolean" }
445
- },
446
- required: [
447
- "providerID",
448
- "modelID",
449
- "totals",
450
- "pricingComplete"
451
- ],
452
- additionalProperties: false
453
- }
454
- },
455
- pricing: {
456
- type: "object",
457
- properties: {
458
- status: {
459
- type: "string",
460
- enum: [
461
- "empty",
462
- "unavailable",
463
- "partial",
464
- "complete"
465
- ]
466
- },
467
- complete: { type: "boolean" },
468
- billed: { const: false },
469
- estimatedUsd: {
470
- type: "number",
471
- minimum: 0
472
- },
473
- unpricedModels: {
474
- type: "integer",
475
- minimum: 0,
476
- maximum: Number.MAX_SAFE_INTEGER
477
- }
478
- },
479
- required: [
480
- "status",
481
- "complete",
482
- "billed",
483
- "unpricedModels"
484
- ],
485
- additionalProperties: false
486
- }
487
- },
488
- required: [
489
- "status",
490
- "period",
491
- "coverageStart",
492
- "partial",
493
- "truncated",
494
- "rows",
495
- "buckets",
496
- "totals",
497
- "models",
498
- "pricing"
499
- ],
500
- additionalProperties: false
501
- };
502
- /** Shared definition keeps the TUI RPC client aligned with the server contract. */
503
- const quotaRpc = Rpc.define({
504
- id: "pantheon.quota",
505
- methods: {
506
- go_key_diagnostic: {
507
- input: {
508
- type: "object",
509
- properties: {},
510
- additionalProperties: false
511
- },
512
- output: {
513
- type: "object",
514
- properties: {
515
- category: {
516
- type: "string",
517
- enum: [
518
- "not_run",
519
- "already_used",
520
- "success",
521
- "unauthorized",
522
- "redirect",
523
- "http_error",
524
- "timeout",
525
- "network_error"
526
- ]
527
- },
528
- status: {
529
- type: "integer",
530
- minimum: 100,
531
- maximum: 599
532
- },
533
- content_type: {
534
- type: "string",
535
- enum: [
536
- "application/json",
537
- "text/plain",
538
- "text/html",
539
- "other",
540
- "missing"
541
- ]
542
- },
543
- error_structure: {
544
- type: "string",
545
- enum: [
546
- "present",
547
- "absent",
548
- "unavailable"
549
- ]
550
- }
551
- },
552
- required: ["category"],
553
- additionalProperties: false
554
- }
555
- },
556
- status: {
557
- input: {
558
- type: "object",
559
- properties: {},
560
- additionalProperties: false
561
- },
562
- output: {
563
- type: "object",
564
- properties: {
565
- providers: {
566
- type: "array",
567
- items: providerStatusSchema
568
- },
569
- credential_resolution_failed: { const: true }
570
- },
571
- required: ["providers"],
572
- additionalProperties: false
573
- }
574
- },
575
- usage_history: {
576
- input: {
577
- type: "object",
578
- properties: { period: {
579
- type: "string",
580
- enum: USAGE_HISTORY_PERIODS
581
- } },
582
- required: ["period"],
583
- additionalProperties: false
584
- },
585
- output: { oneOf: [usageHistoryAvailableSchema, {
586
- type: "object",
587
- properties: {
588
- status: { const: "unavailable" },
589
- reason: {
590
- type: "string",
591
- enum: [
592
- "invalid_period",
593
- "history_unavailable",
594
- "history_timeout"
595
- ]
596
- }
597
- },
598
- required: ["status", "reason"],
599
- additionalProperties: false
600
- }] }
601
- },
602
- active_context_cost: {
603
- input: {
604
- type: "object",
605
- properties: {
606
- providerID: {
607
- type: ["string", "null"],
608
- minLength: 1,
609
- maxLength: 128
610
- },
611
- modelID: {
612
- type: ["string", "null"],
613
- minLength: 1,
614
- maxLength: 128
615
- },
616
- contextTokens: { type: ["number", "null"] }
617
- },
618
- required: [
619
- "providerID",
620
- "modelID",
621
- "contextTokens"
622
- ],
623
- additionalProperties: false
624
- },
625
- output: { oneOf: [{
626
- type: "object",
627
- properties: {
628
- status: { const: "estimated" },
629
- estimatedUsd: {
630
- type: "number",
631
- minimum: 0
632
- },
633
- billed: { const: false },
634
- basis: { const: "pre-cache-context-tokens-times-input-price" },
635
- cacheDiscountApplied: { const: false }
636
- },
637
- required: [
638
- "status",
639
- "estimatedUsd",
640
- "billed",
641
- "basis",
642
- "cacheDiscountApplied"
643
- ],
644
- additionalProperties: false
645
- }, {
646
- type: "object",
647
- properties: {
648
- status: { const: "unavailable" },
649
- billed: { const: false },
650
- basis: { const: "pre-cache-context-tokens-times-input-price" },
651
- cacheDiscountApplied: { const: false },
652
- reason: {
653
- type: "string",
654
- enum: [
655
- "invalid-context-token-count",
656
- "missing-model-identity",
657
- "no-pricing",
658
- "unknown-model",
659
- "ambiguous-model",
660
- "missing-cache-price"
661
- ]
662
- }
663
- },
664
- required: [
665
- "status",
666
- "billed",
667
- "basis",
668
- "cacheDiscountApplied",
669
- "reason"
670
- ],
671
- additionalProperties: false
672
- }] }
673
- }
674
- },
675
- events: { credentials_changed: { schema: {
676
- type: "object",
677
- properties: {},
678
- additionalProperties: false
679
- } } }
680
- });
681
- //#endregion
682
- export { quotaRpc as n, QUOTA_PROVIDER_IDS as t };
683
-
684
- //# sourceMappingURL=quota-rpc-DMmXBhBe.js.map