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.
Files changed (115) hide show
  1. package/AGENTS.global.md +11 -11
  2. package/AGENTS.md +2 -2
  3. package/CHANGELOG.md +45 -0
  4. package/README.md +122 -6
  5. package/README.pt-BR.md +14 -9
  6. package/bin/pantheon-init.mjs +255 -39
  7. package/package.json +8 -6
  8. package/plugin.json +1 -1
  9. package/pyproject.toml +1 -1
  10. package/scripts/build-agents-md.mjs +1 -1
  11. package/scripts/doctor.mjs +231 -46
  12. package/scripts/install/agents-md.mjs +2 -1
  13. package/scripts/install/config-migration.mjs +344 -393
  14. package/scripts/install/config-paths.mjs +15 -0
  15. package/scripts/install/interactive.mjs +30 -9
  16. package/scripts/install/interrupt.mjs +78 -0
  17. package/scripts/install/mcp-permissions.mjs +164 -0
  18. package/scripts/install/opencode-state.mjs +91 -0
  19. package/scripts/install/opencode-version.mjs +31 -13
  20. package/scripts/install/opencode-wildcard.mjs +106 -0
  21. package/scripts/install/opencode.mjs +508 -108
  22. package/scripts/install/plan-artifact.mjs +12 -1
  23. package/scripts/install/plugin.mjs +17 -1
  24. package/scripts/install/run-record.mjs +115 -0
  25. package/scripts/install/strings.mjs +35 -6
  26. package/scripts/install/v2-capabilities.mjs +204 -0
  27. package/scripts/package-evidence.mjs +1 -0
  28. package/scripts/release-gates.mjs +7 -2
  29. package/scripts/sandbox-env.sh +174 -0
  30. package/scripts/setup-v2-config.mjs +1703 -0
  31. package/scripts/setup.mjs +415 -0
  32. package/scripts/sync-tui.mjs +9 -1
  33. package/scripts/test-opencode-v2-sandbox.sh +438 -151
  34. package/scripts/update-skills-lock.mjs +30 -0
  35. package/skills-lock.json +10 -10
  36. package/src/agents/aphrodite.md +5 -2
  37. package/src/agents/apollo.md +5 -0
  38. package/src/agents/athena.md +6 -1
  39. package/src/agents/demeter.md +5 -1
  40. package/src/agents/gaia.md +4 -0
  41. package/src/agents/hephaestus.md +6 -1
  42. package/src/agents/hermes.md +6 -3
  43. package/src/agents/iris.md +5 -1
  44. package/src/agents/mnemosyne.md +20 -50
  45. package/src/agents/nyx.md +5 -1
  46. package/src/agents/prometheus.md +4 -0
  47. package/src/agents/talos.md +4 -0
  48. package/src/agents/themis.md +4 -0
  49. package/src/agents/zeus.md +9 -3
  50. package/src/instructions/agent-return-format.instructions.md +1 -1
  51. package/src/instructions/memory-protocol.instructions.md +3 -3
  52. package/src/instructions/test-economy.instructions.md +6 -6
  53. package/src/mcp/pantheon_vision.py +37 -36
  54. package/src/mcp/requirements-mcp.txt +1 -1
  55. package/src/mcp/requirements-vision.txt +1 -1
  56. package/src/pantheon/cost-command.ts +127 -40
  57. package/src/pantheon/delegation-enforce.ts +160 -23
  58. package/src/pantheon/guard-path.ts +162 -0
  59. package/src/pantheon/v2-bounded-read.ts +15 -1
  60. package/src/pantheon/v2-bridge.ts +27 -0
  61. package/src/pantheon/v2-shell-hooks.ts +260 -0
  62. package/src/pantheon/v2-unsupported.mjs +32 -4
  63. package/src/pantheon/v2-vision.ts +34 -29
  64. package/src/pantheon/vision.ts +49 -11
  65. package/src/plugin-v2.ts +413 -60
  66. package/src/plugin.ts +22 -2
  67. package/src/plugins/tui/dist/quota-adapters.d.ts +89 -0
  68. package/src/plugins/tui/dist/quota-adapters.d.ts.map +1 -0
  69. package/src/plugins/tui/dist/quota-adapters.js +1142 -0
  70. package/src/plugins/tui/dist/quota-adapters.js.map +1 -0
  71. package/src/plugins/tui/dist/quota-cli.d.ts +17 -0
  72. package/src/plugins/tui/dist/quota-cli.d.ts.map +1 -0
  73. package/src/plugins/tui/dist/quota-cli.js +184 -0
  74. package/src/plugins/tui/dist/quota-cli.js.map +1 -0
  75. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js +390 -0
  76. package/src/plugins/tui/dist/quota-rpc-UL2HuFRJ.js.map +1 -0
  77. package/src/plugins/tui/dist/server-v2.d.ts +14 -0
  78. package/src/plugins/tui/dist/server-v2.d.ts.map +1 -0
  79. package/src/plugins/tui/dist/server-v2.js +673 -0
  80. package/src/plugins/tui/dist/server-v2.js.map +1 -0
  81. package/src/plugins/tui/dist/tui-v2.d.ts +247 -52
  82. package/src/plugins/tui/dist/tui-v2.d.ts.map +1 -1
  83. package/src/plugins/tui/dist/tui-v2.js +2492 -529
  84. package/src/plugins/tui/dist/tui-v2.js.map +1 -1
  85. package/src/plugins/tui/dist/tui.js +1 -1
  86. package/src/plugins/tui/index-v2.ts +3 -6
  87. package/src/plugins/tui/package-lock.json +11 -11
  88. package/src/plugins/tui/package.json +6 -4
  89. package/src/plugins/tui/src/context-gauge.ts +59 -0
  90. package/src/plugins/tui/src/go-key-diagnostic-ui.ts +100 -0
  91. package/src/plugins/tui/src/go-key-diagnostic.ts +125 -0
  92. package/src/plugins/tui/src/index-v2.tsx +199 -240
  93. package/src/plugins/tui/src/model-usage-limits.ts +4 -0
  94. package/src/plugins/tui/src/quota-adapters.ts +1598 -0
  95. package/src/plugins/tui/src/quota-cli.ts +237 -0
  96. package/src/plugins/tui/src/quota-rpc.ts +209 -0
  97. package/src/plugins/tui/src/quota-v2-model.ts +1032 -0
  98. package/src/plugins/tui/src/quota-v2.tsx +986 -0
  99. package/src/plugins/tui/src/server-v2.ts +841 -0
  100. package/src/plugins/tui/src/sidebar-width.ts +129 -0
  101. package/src/plugins/tui/tsconfig.typecheck.json +1 -1
  102. package/src/plugins/tui/tsdown.config.ts +8 -1
  103. package/src/routing.yml +72 -13
  104. package/src/skills/README.md +4 -0
  105. package/src/skills/agent-coordination/SKILL.md +0 -3
  106. package/src/skills/artifact-management/SKILL.md +0 -3
  107. package/src/skills/auto-continue/SKILL.md +0 -3
  108. package/src/skills/code-review-checklist/SKILL.md +0 -3
  109. package/src/skills/context-compression/SKILL.md +0 -3
  110. package/src/skills/memory-bank/SKILL.md +6 -28
  111. package/src/skills/session-goal/SKILL.md +0 -3
  112. package/src/skills/simplify/SKILL.md +5 -4
  113. package/src/skills/tdd-with-agents/SKILL.md +0 -3
  114. package/src/skills/visual-review-pipeline/SKILL.md +0 -1
  115. package/src/pantheon/memory-context.ts +0 -1017
package/src/plugin.ts CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  zeusReadGuard,
19
19
  } from './pantheon/delegation-enforce.ts'
20
20
  import { GOAL_LOOP_DEFAULTS, GoalLoop, GoalStore } from './pantheon/goal-loop.ts'
21
+ import { createGuardPathResolver } from './pantheon/guard-path.ts'
21
22
  import { createReadEnhancer } from './pantheon/hashline/read-enhancer.ts'
22
23
  import { createHashlineEditTool } from './pantheon/hashline/tool.ts'
23
24
  import { createIdleDispatcher } from './pantheon/idle-continuation.ts'
@@ -37,6 +38,7 @@ import {
37
38
  import { TodoPreserver } from './pantheon/todo-preserve.ts'
38
39
  import { handleToolCeilingEvent, type ToolCeilingResult } from './pantheon/tool-ceiling.ts'
39
40
  import { checkTuiVersionStaleness } from './pantheon/tui-version-check.ts'
41
+ import { createV2Bridge, registerV2Bridge } from './pantheon/v2-bridge.ts'
40
42
  import { activePresetCandidates, createVisionHandler } from './pantheon/vision.ts'
41
43
 
42
44
  // ─── Background Job Board Singleton ────────────────────────────────────
@@ -279,6 +281,14 @@ const plugin: Plugin = async (input: PluginInput) => {
279
281
  // Runtime TUI version staleness check — warns if the copied TUI plugin
280
282
  // is older than the installed package. Runs once, fail-open, no auto-sync.
281
283
  checkTuiVersionStaleness((msg) => log.warn(msg))
284
+ // Symlink resolution for the Zeus read guard (#272). The guard predicate is
285
+ // pure and synchronous, so the filesystem work happens here instead: one
286
+ // resolver per plugin instance, rooted at the project directory the host
287
+ // reported. `docs/link → ../src` must not read `src/` just because the
288
+ // string path looks harmless.
289
+ const resolveGuardPath = createGuardPathResolver(
290
+ input.directory || input.worktree || process.cwd(),
291
+ )
282
292
  const vision = createVisionHandler(input)
283
293
  // Wave 1 (PR #46): TODO continuation enforcer for root sessions. The event
284
294
  // hook routes `session.idle` events here; an active goal owns the idle
@@ -316,6 +326,14 @@ const plugin: Plugin = async (input: PluginInput) => {
316
326
  const goalTools = goalLoop.tools()
317
327
  const idleDispatcher = createIdleDispatcher({ goalLoop, todoEnforcer })
318
328
 
329
+ // Cross-generation bridge (issue #265 review): publish THESE singletons so a
330
+ // V2 plugin loaded in the same process reuses this enforcer instead of
331
+ // building a second one. Two enforcers would answer one `session.idle` twice
332
+ // — V1's dispatcher below and V2's `onSessionIdle` would each inject a
333
+ // continuation prompt. Registration is a no-op on a V1-only install: nothing
334
+ // in this process reads the registry unless a V2 entry resolves it.
335
+ registerV2Bridge(createV2Bridge({ board, todoEnforcer }))
336
+
319
337
  // Wave 2 (PR #46): hashline — tag-anchored edits. The read enhancer
320
338
  // (tool.execute.after) augments `read` output with per-line sha256 tags
321
339
  // (`12#XJ|content`); hashline_edit anchors edits to those refs. Additive —
@@ -478,8 +496,10 @@ const plugin: Plugin = async (input: PluginInput) => {
478
496
  // read-only enforcement guard (denies mutating tools in read-only
479
497
  // sessions), then release-134 Phase 3 rewrites the first
480
498
  // post-compaction `todowrite` with the captured todo snapshot. All are
481
- // no-ops for non-matching sessions/tools.
482
- zeusReadGuard(input.tool, output?.args, sessionAgents.get(input.sessionID))
499
+ // no-ops for non-matching sessions/tools. The read guard also checks the
500
+ // SYMLINK-RESOLVED form of every target path (#272), so a link into a
501
+ // denied root cannot pass on its string spelling.
502
+ zeusReadGuard(input.tool, output?.args, sessionAgents.get(input.sessionID), resolveGuardPath)
483
503
  await enforcementGuard(input, output)
484
504
  await commandNormalizer(input, output)
485
505
  await todoPreserver.beforeTodoWrite(input, output)
@@ -0,0 +1,89 @@
1
+ import { queryAlibabaTokenPlanUsage } from "./quota-cli.js";
2
+ //#region src/quota-rpc.d.ts
3
+ /** Full provider matrix approved for the V2 quota surface. */
4
+ declare const QUOTA_PROVIDER_IDS: readonly ['anthropic', 'chutes', 'cursor', 'github-copilot', 'google-agy', 'kilo-gateway', 'nanogpt', 'ollama-cloud', 'openai', 'opencode-go', 'opencode-zen', 'openrouter', 'synthetic', 'xai-supergrok', 'gemini-cli', 'alibaba-coding-plan', 'alibaba-token-plan', 'deepseek', 'kimi-code-global', 'kimi-code-cn', 'minimax-plan-global', 'minimax-plan-cn', 'xiaomi-mimo', 'zai-coding-plan', 'zhipu-coding-plan'];
5
+ type QuotaProviderId = (typeof QUOTA_PROVIDER_IDS)[number];
6
+ //#endregion
7
+ //#region src/quota-adapters.d.ts
8
+ export declare const OPENAI_CODEX_OAUTH_METHOD_IDS: readonly ['chatgpt-browser', 'chatgpt-headless'];
9
+ type OpenAICodexOAuthMethodID = (typeof OPENAI_CODEX_OAUTH_METHOD_IDS)[number];
10
+ export declare function isOpenAICodexOAuthMethod(value: unknown): value is OpenAICodexOAuthMethodID;
11
+ export declare const OPENCODE_CONSOLE_OAUTH_METHOD_IDS: readonly ['device'];
12
+ type OpenCodeConsoleOAuthMethodID = (typeof OPENCODE_CONSOLE_OAUTH_METHOD_IDS)[number];
13
+ export declare function isOpenCodeConsoleOAuthMethod(value: unknown): value is OpenCodeConsoleOAuthMethodID;
14
+ type OAuthMethodID = OpenAICodexOAuthMethodID | OpenCodeConsoleOAuthMethodID;
15
+ export type QuotaAdapterContext = {
16
+ readonly projectId?: string;
17
+ readonly accountId?: string;
18
+ readonly orgId?: string;
19
+ readonly methodID?: OAuthMethodID;
20
+ };
21
+ export type QuotaAudience = 'us_personal' | 'us_business' | 'china_personal' | 'china_business';
22
+ export type QuotaMetric = {
23
+ kind: 'provider_quota';
24
+ used: number;
25
+ remaining: number;
26
+ unit: string;
27
+ label: string;
28
+ period?: string;
29
+ resetsAt?: number;
30
+ } | {
31
+ kind: 'balance';
32
+ amount: number;
33
+ currency: 'USD' | 'CNY';
34
+ label: string;
35
+ status?: 'available' | 'unavailable' | 'active' | 'inactive';
36
+ } | {
37
+ kind: 'estimate';
38
+ amount: number;
39
+ unit: string;
40
+ label: string;
41
+ } | {
42
+ kind: 'provider_status';
43
+ status: 'available' | 'unavailable' | 'active' | 'inactive';
44
+ label: string;
45
+ } | {
46
+ kind: 'key_usage';
47
+ amount: number;
48
+ currency: 'USD' | 'CNY';
49
+ label: string;
50
+ period?: string;
51
+ } | {
52
+ kind: 'session_usage';
53
+ amount: number;
54
+ unit: string;
55
+ label: string;
56
+ };
57
+ export type AdapterFailureReason = 'provider_error' | 'not_subscribed' | 'rate_limited' | 'unauthorized' | 'forbidden' | 'timeout' | 'network_error' | 'invalid_response' | 'cli_identity_unavailable' | 'eligibility_unverified';
58
+ export type AdapterFailure = {
59
+ readonly reason: AdapterFailureReason;
60
+ readonly retryAfterMs?: number;
61
+ };
62
+ type ProviderDefinition = {
63
+ readonly label: string;
64
+ readonly integrationID: string;
65
+ readonly fallbackIntegrationIDs?: readonly string[];
66
+ readonly audiences: readonly QuotaAudience[];
67
+ readonly scope: 'account' | 'selected_key' | 'team' | 'session';
68
+ readonly methods: readonly ('key' | 'oauth' | 'cli')[];
69
+ readonly source?: 'integration' | 'local-cli';
70
+ readonly adapter?: 'anthropic' | 'chutes' | 'copilot' | 'deepseek' | 'google-agy' | 'alibaba-token-plan-cli' | 'kilo-gateway' | 'kimi-global' | 'kimi-cn' | 'minimax-global' | 'minimax-cn' | 'nanogpt' | 'ollama-cloud' | 'openai' | 'openrouter' | 'opencode-go' | 'opencode-zen' | 'synthetic' | 'xai-supergrok' | 'zai' | 'zhipu';
71
+ readonly blockedReason?: 'unsupported' | 'private_endpoint' | 'eligibility_unverified' | 'runtime_accounting_unavailable' | 'cli_identity_unavailable';
72
+ };
73
+ /**
74
+ * Closed provider/integration/method allowlist. Only rows with a reviewed
75
+ * adapter may make a network request; remaining rows are explicitly blocked.
76
+ * Audience lists describe the approved matrix and do not claim that account
77
+ * type was inferred from credentials.
78
+ */
79
+ export declare const QUOTA_PROVIDER_CATALOG: Record<QuotaProviderId, ProviderDefinition>;
80
+ export type AdapterResult = {
81
+ readonly state: 'available';
82
+ readonly metrics: QuotaMetric[];
83
+ readonly routeKind?: 'api_key' | 'console_oauth';
84
+ } | (AdapterFailure & {
85
+ readonly routeKind?: 'api_key' | 'console_oauth';
86
+ });
87
+ export declare function runQuotaAdapter(provider: QuotaProviderId, secret: string | undefined, shutdownSignal: AbortSignal, queryCli?: typeof queryAlibabaTokenPlanUsage, adapterContext?: QuotaAdapterContext, fallbackSecret?: string): Promise<AdapterResult>;
88
+ //#endregion
89
+ //# sourceMappingURL=quota-adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-adapters.d.ts","names":[],"sources":["../src/quota-rpc.ts","../src/quota-adapters.ts"],"mappings":";;;cAGa;KA4BD,0BAA0B;;;qBC1BzB;KACR,mCAAmC;wBAExB,yBAAyB,iBAAiB,SAAS;qBAQtD;KACR,uCAAuC;wBAE5B,6BACd,iBACC,SAAS;KAOP,gBAAgB,2BAA2B;YAEpC;WACD;WACA;WACA;WACA,WAAW;;YAGV;YACA;EAEN;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EAAkB;EAAgB;EAAc;;EAEhD;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EAAuB;EAAgB;EAAc;;YAE/C;YAWA;WACD,QAAQ;WACR;;KAGN;WACM;WACA;WACA;WACA,oBAAoB;WACpB;WACA;WACA;WACA;WAsBA;;;;;;;;qBAsBE,wBAAwB,OAAO,iBAAiB;YAqNjD;WAEG;WACA,SAAS;WACT;KAEV;WAA4B;;wBA2/BX,gBACpB,UAAU,iBACV,4BACA,gBAAgB,aAChB,kBAAiB,4BACjB,iBAAgB,qBAChB,0BACC,QAAQ"}