@osovv/vv-opencode 1.6.0 → 2.0.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +24 -4
  3. package/dist/commands/preset.js +1 -1
  4. package/dist/commands/preset.js.map +1 -1
  5. package/dist/index.d.ts +7 -11
  6. package/dist/index.js +53 -20
  7. package/dist/index.js.map +1 -1
  8. package/dist/plugins/analytics/index.d.ts +2 -0
  9. package/dist/plugins/analytics/index.js +13 -2
  10. package/dist/plugins/analytics/index.js.map +1 -1
  11. package/dist/plugins/analytics/v2.d.ts +21 -0
  12. package/dist/plugins/analytics/v2.js +133 -0
  13. package/dist/plugins/analytics/v2.js.map +1 -0
  14. package/dist/plugins/guardian/index.d.ts +46 -0
  15. package/dist/plugins/guardian/index.js +21 -6
  16. package/dist/plugins/guardian/index.js.map +1 -1
  17. package/dist/plugins/guardian/v2.d.ts +13 -0
  18. package/dist/plugins/guardian/v2.js +161 -0
  19. package/dist/plugins/guardian/v2.js.map +1 -0
  20. package/dist/plugins/hashline-edit/index.d.ts +33 -1
  21. package/dist/plugins/hashline-edit/index.js +38 -14
  22. package/dist/plugins/hashline-edit/index.js.map +1 -1
  23. package/dist/plugins/hashline-edit/schemas.d.ts +7 -7
  24. package/dist/plugins/hashline-edit/v2.d.ts +12 -0
  25. package/dist/plugins/hashline-edit/v2.js +145 -0
  26. package/dist/plugins/hashline-edit/v2.js.map +1 -0
  27. package/dist/plugins/model-roles/index.d.ts +2 -0
  28. package/dist/plugins/model-roles/index.js +13 -2
  29. package/dist/plugins/model-roles/index.js.map +1 -1
  30. package/dist/plugins/model-roles/v2.d.ts +24 -0
  31. package/dist/plugins/model-roles/v2.js +274 -0
  32. package/dist/plugins/model-roles/v2.js.map +1 -0
  33. package/dist/plugins/peak-hours/index.d.ts +2 -0
  34. package/dist/plugins/peak-hours/index.js +13 -2
  35. package/dist/plugins/peak-hours/index.js.map +1 -1
  36. package/dist/plugins/peak-hours/v2.d.ts +12 -0
  37. package/dist/plugins/peak-hours/v2.js +95 -0
  38. package/dist/plugins/peak-hours/v2.js.map +1 -0
  39. package/dist/plugins/secrets-redaction/index.d.ts +7 -0
  40. package/dist/plugins/secrets-redaction/index.js +17 -4
  41. package/dist/plugins/secrets-redaction/index.js.map +1 -1
  42. package/dist/plugins/secrets-redaction/v2.d.ts +14 -0
  43. package/dist/plugins/secrets-redaction/v2.js +100 -0
  44. package/dist/plugins/secrets-redaction/v2.js.map +1 -0
  45. package/dist/plugins/spec-guard/index.d.ts +2 -0
  46. package/dist/plugins/spec-guard/index.js +13 -2
  47. package/dist/plugins/spec-guard/index.js.map +1 -1
  48. package/dist/plugins/spec-guard/v2.d.ts +12 -0
  49. package/dist/plugins/spec-guard/v2.js +139 -0
  50. package/dist/plugins/spec-guard/v2.js.map +1 -0
  51. package/dist/plugins/system-context-injection/agent-contexts.d.ts +5 -0
  52. package/dist/plugins/system-context-injection/agent-contexts.js +164 -0
  53. package/dist/plugins/system-context-injection/agent-contexts.js.map +1 -0
  54. package/dist/plugins/system-context-injection/index.d.ts +2 -0
  55. package/dist/plugins/system-context-injection/index.js +19 -144
  56. package/dist/plugins/system-context-injection/index.js.map +1 -1
  57. package/dist/plugins/system-context-injection/v2.d.ts +13 -0
  58. package/dist/plugins/system-context-injection/v2.js +60 -0
  59. package/dist/plugins/system-context-injection/v2.js.map +1 -0
  60. package/dist/plugins/tool-history-compaction/index.d.ts +2 -0
  61. package/dist/plugins/tool-history-compaction/index.js +13 -2
  62. package/dist/plugins/tool-history-compaction/index.js.map +1 -1
  63. package/dist/plugins/tool-history-compaction/v2.d.ts +11 -0
  64. package/dist/plugins/tool-history-compaction/v2.js +56 -0
  65. package/dist/plugins/tool-history-compaction/v2.js.map +1 -0
  66. package/dist/plugins/v2-runtime/config-watcher.d.ts +26 -0
  67. package/dist/plugins/v2-runtime/config-watcher.js +111 -0
  68. package/dist/plugins/v2-runtime/config-watcher.js.map +1 -0
  69. package/dist/plugins/v2-runtime/index.d.ts +50 -0
  70. package/dist/plugins/v2-runtime/index.js +114 -0
  71. package/dist/plugins/v2-runtime/index.js.map +1 -0
  72. package/dist/plugins/v2-runtime/location-config.d.ts +51 -0
  73. package/dist/plugins/v2-runtime/location-config.js +91 -0
  74. package/dist/plugins/v2-runtime/location-config.js.map +1 -0
  75. package/dist/plugins/v2-runtime/setup.d.ts +48 -0
  76. package/dist/plugins/v2-runtime/setup.js +174 -0
  77. package/dist/plugins/v2-runtime/setup.js.map +1 -0
  78. package/dist/plugins/web-tools/index.d.ts +2 -0
  79. package/dist/plugins/web-tools/index.js +13 -2
  80. package/dist/plugins/web-tools/index.js.map +1 -1
  81. package/dist/plugins/web-tools/v2.d.ts +11 -0
  82. package/dist/plugins/web-tools/v2.js +99 -0
  83. package/dist/plugins/web-tools/v2.js.map +1 -0
  84. package/dist/plugins/workflow/index.d.ts +2 -0
  85. package/dist/plugins/workflow/index.js +13 -2
  86. package/dist/plugins/workflow/index.js.map +1 -1
  87. package/dist/plugins/workflow/results.d.ts +16 -16
  88. package/dist/plugins/workflow/v2.d.ts +58 -0
  89. package/dist/plugins/workflow/v2.js +181 -0
  90. package/dist/plugins/workflow/v2.js.map +1 -0
  91. package/dist/tui.d.ts +1 -0
  92. package/dist/tui.js +41 -6
  93. package/dist/tui.js.map +1 -1
  94. package/package.json +13 -5
  95. package/schemas/vvoc/v3.json +1 -1
  96. package/server.js +7 -0
  97. package/templates/agents/vv-controller.md +17 -0
  98. package/templates/agents/vv-implementer.md +4 -0
  99. package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
  100. package/tui.js +7 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ ## 2.0.0 (2026-09-26)
2
+
3
+ ### Summary
4
+
5
+ Version 2.0.0 makes the package dual-runtime, so the same pinned install now loads under both OpenCode v1 (via the object server() entrypoint, floor raised to 1.18.29) and OpenCode v2 (via Plugin.define setup, floor 2.0.18), and vvoc install and sync work unchanged on either major line. All eleven server plugins — including Guardian, Hashline Edit, Model Roles, Workflow, Secrets Redaction, Web Tools, Tool-History Compaction, Analytics, Peak Hours, Spec Guard, and System Context Injection — were ported onto the v2 domain APIs, with configuration now resolved per session location so one shared server can host projects with different toggles, role maps, and policies. On v2, changes to vvoc.json apply through replayable transforms and a config watcher without restarting OpenCode, and each session pins its role-resolved model on the first prompt so long-running sessions stay anchored to their starting preset while new sessions pick up a switched one, verified end to end against a real sandboxed v2 server via the new bun run e2e:v2 harness. The TUI module gained a v2 entrypoint registering the /context command, README documents the dual-runtime support matrix and behaviors, and the failure semantics of existing plugins were preserved, with workflow continuation degrading fail-closed under the v2 prompt shape.
6
+
7
+ * feat(analytics): port event collection to OpenCode v2 event stream (T-003 1/5) ([6b368fe](https://github.com/osovv/vv-opencode/commit/6b368fe))
8
+ * feat(e2e): repeatable sandboxed v2 harness; TUI dual entry (T-007/T-009) ([0126f13](https://github.com/osovv/vv-opencode/commit/0126f13))
9
+ * feat(grace): approve C-OPENCODE-V2-MIGRATION spec and plan ([2ce153a](https://github.com/osovv/vv-opencode/commit/2ce153a))
10
+ * feat(grace): synchronize graph, verification, requirements, and harness tests (T-010) ([6cc061b](https://github.com/osovv/vv-opencode/commit/6cc061b))
11
+ * feat(guardian): port permission review to v2 events via client shim (T-003) ([9feadfa](https://github.com/osovv/vv-opencode/commit/9feadfa))
12
+ * feat(hashline-edit): port per-model edit routing to v2 (T-004) ([51227ec](https://github.com/osovv/vv-opencode/commit/51227ec))
13
+ * feat(model-roles): per-session prompt model application with preset anchoring (T-006 E2E) ([e44e6ba](https://github.com/osovv/vv-opencode/commit/e44e6ba))
14
+ * feat(model-roles): v2 transforms with restart-free preset switching (T-006) ([a68da72](https://github.com/osovv/vv-opencode/commit/a68da72))
15
+ * feat(plugins): dual-runtime entrypoints for OpenCode v1 and v2 (T-001) ([72f3100](https://github.com/osovv/vv-opencode/commit/72f3100))
16
+ * feat(plugins): port peak-hours and web-tools to v2 (T-003/T-004) ([0b98419](https://github.com/osovv/vv-opencode/commit/0b98419))
17
+ * feat(plugins): port tool-history-compaction, spec-guard, secrets-redaction to v2 (T-003/T-004) ([2c2496a](https://github.com/osovv/vv-opencode/commit/2c2496a))
18
+ * feat(system-context-injection): port guidance injection to v2 session context hook (T-004 1/4) ([7b5ec94](https://github.com/osovv/vv-opencode/commit/7b5ec94))
19
+ * feat(v2-runtime): add server/tui package shims and raw-config agent role references ([8183077](https://github.com/osovv/vv-opencode/commit/8183077))
20
+ * feat(v2-runtime): per-location config resolver and debounced watcher (T-002) ([dee353b](https://github.com/osovv/vv-opencode/commit/dee353b))
21
+ * feat(workflow): bridge full enforcement surface onto v2 domains (T-005) ([ecf5763](https://github.com/osovv/vv-opencode/commit/ecf5763))
22
+ * docs(readme): document dual-runtime v2 support matrix and behaviors (T-008) ([9104eb2](https://github.com/osovv/vv-opencode/commit/9104eb2))
23
+ * fix(grace): complete v2-runtime module maps ([a8044c3](https://github.com/osovv/vv-opencode/commit/a8044c3))
24
+ * fix(grace): synchronize module maps with dual entrypoint exports ([acd7024](https://github.com/osovv/vv-opencode/commit/acd7024))
25
+
26
+ ## 1.7.0 (2026-09-25)
27
+
28
+ ### Summary
29
+
30
+ Version 1.7.0 refines the correctness and evidence discipline carried by vvoc-managed agent prompts and the universal guidance injected into primary sessions. Agents now keep an evidence-supported conclusion settled until a concrete trigger reopens it — contradictory evidence, a specific counterexample, a changed requirement, or changed relevant inputs — rather than flipping on vague doubt or unsupported pressure, and they surface false premises and investigate the actual mechanism instead of silently substituting a different goal or adding an unnecessary dependency. Test results are treated as evidence against the request and established contracts rather than as the authoritative specification, so a failing test that contradicts the agreed contract is reported rather than triggering automatic rewrites of code or tests, and conflicting or mutually exclusive reviewer findings are routed back to the controller instead of quietly redefining requirements. This matters because it keeps agent work anchored to the task contract and observed evidence, reduces churn and unrequested changes, and makes disagreements and unmet checks visible to users. In addition, the release tooling now defaults release changelog summary generation to the deepseek/deepseek-flash model, restoring reliable release summaries after the previous default began returning server errors.
31
+
32
+ * feat(prompts): refine evidence-based revision discipline ([4534b81](https://github.com/osovv/vv-opencode/commit/4534b81))
33
+ * fix(release): default release summary model to deepseek/deepseek-flash ([995656e](https://github.com/osovv/vv-opencode/commit/995656e))
34
+
1
35
  ## 1.6.0 (2026-09-24)
2
36
 
3
37
  ### Summary
package/README.md CHANGED
@@ -74,7 +74,27 @@ vvoc install
74
74
  - writes the canonical `vvoc.json` config;
75
75
  - sets `vv-controller` as your default OpenCode agent, with the spec, planning, review, reflection, and handoff skills auto-triggered by request type.
76
76
 
77
- The TUI integration requires OpenCode `1.18.2` or newer; `vvoc status` and `vvoc doctor` report the installed host version and fail compatibility checks for older releases.
77
+ The TUI integration requires OpenCode `1.18.2` or newer on the v1 line and OpenCode `2.0.18` or newer on the v2 line; `vvoc status` and `vvoc doctor` report the installed host version and fail compatibility checks for older releases.
78
+
79
+ ### OpenCode v2 support
80
+
81
+ Since 2.0.0 the package is dual-runtime and supports both OpenCode 1 and OpenCode 2: the same pinned package loads under OpenCode v1 (`>= 1.18.29`, through the object `server()` entrypoint) and OpenCode v2 (`>= 2.0.18`, through `Plugin.define` `setup()`). Installing either major line with `vvoc install` / `vvoc sync` works unchanged: v2 reads the same `plugin` array fields and the same `.opencode/` layout.
82
+
83
+ What changes on the v2 runtime:
84
+
85
+ - **One server, many sessions.** v2 runs one background server with thin clients; vvoc plugins resolve their configuration per session location instead of one startup snapshot, so a single server can host projects with different toggles, role maps, and policies.
86
+ - **Restart-free presets.** Changing roles or presets in `vvoc.json` takes effect through replayable transforms and a config watcher — no OpenCode restart. Each session pins its role-resolved model on its first prompt, so a long autonomous session stays anchored to its starting preset while new sessions pick up the switched one (verified end to end against a real v2 server by `bun run e2e:v2`).
87
+ - **Role references survive config normalization.** v2 strips `vv-role:` model strings from config-defined agents; the model-roles plugin reads them from the raw project config and applies them per session.
88
+ - **Same-name tool registration replaces built-ins.** `web_search` / `web_fetch` override the v2 built-ins while enabled and restore them when disabled.
89
+ - **The workflow delegated continuation prompt degrades fail-closed** under the v2 prompt shape: unrecognized or unavailable continuation paths reject the attempt and never accept a report.
90
+
91
+ The full v2 `/context` TUI inspector ships in a follow-up release; the v2 TUI entry registers the `/context` command with a status dialog while the complete v1 inspector keeps running on the v1 runtime.
92
+
93
+ End-to-end verification against a sandboxed, real OpenCode v2 server (isolated binary, disposable XDG homes, PID-exact lifecycle):
94
+
95
+ ```bash
96
+ bun run e2e:v2
97
+ ```
78
98
 
79
99
  **Want to try it without touching your global setup?** Scope everything to one project:
80
100
 
@@ -169,7 +189,7 @@ grep '<COMPONENT-' .vvoc/specs/*/*.xml # component map across spec and plan
169
189
  | **ModelRolesPlugin** | Semantic model roles (`vv-role:smart`, `vv-role:fast`, …) instead of hardcoded model IDs in agents, subagents, and commands — resolved per machine or project at startup. |
170
190
  | **GuardianPlugin** | Keeps long or AFK runs moving by auto-approving routine low-risk permission requests; anything risky stays in OpenCode's normal manual approval flow. |
171
191
  | **HashlineEditPlugin** | Routes each model to exactly one native edit tool (host `edit` for GLM/Qwen/Kimi, host `apply_patch` for GPT, `str_replace_editor` for DeepSeek, `hashline_edit` for unmatched models) and hides the other edit tools per session. |
172
- | **SystemContextInjectionPlugin** | Injects universal guidance — including correctness obligations for behavior changes — plus the work policy selected by the orchestration profile into vv-controller at startup, and registers skill discovery; subagents stay unpolluted. |
192
+ | **SystemContextInjectionPlugin** | Injects universal guidance — including correctness obligations and evidence discipline for behavior changes — plus the work policy selected by the orchestration profile into vv-controller at startup, and registers skill discovery; subagents stay unpolluted. |
173
193
  | **SecretsRedactionPlugin** | Redacts tokens, keys, emails, and other sensitive values before messages reach the model, restoring them only where local execution needs the originals. |
174
194
  | **WebToolsPlugin** | Two provider-neutral tools — `web_search` and `web_fetch` — over Exa, Brave, Z.AI, native retrieval, or Spider, with permission checks and normalized output. |
175
195
  | **ToolHistoryCompactionPlugin** | Shrinks the context replayed to the model by compacting old tool outputs non-destructively, without touching on-disk history. |
@@ -192,7 +212,7 @@ All prompt files are scaffolded by `vvoc install` / `vvoc sync`:
192
212
  | `investigator` | Finds the root cause first when behavior is unclear or a failure needs diagnosis |
193
213
  | `guardian` | Supports GuardianPlugin by reviewing permission requests and auto-approving only routine low-risk ones |
194
214
 
195
- Managed prompts and the universal guidance injected into primary sessions carry explicit correctness obligations. For behavior changes, agents derive the material properties that must be preserved from the request and established contracts, separate write scope from impact and verification scope, investigate directly affected consumers, challenge a material assumption with a diagnostic counterexample, and choose verification at the level the risk arises. Controllers tie completion claims to observed evidence rather than status markers; reviewers distinguish no discovered defect from sufficient support for a material claim and can fail a change for a material verification gap. These obligations are prompt-level guidance only: `vvoc install` / `vvoc sync` deliver the current wording, changes take effect after an OpenCode restart like all vvoc config changes, and the bundled contract tests check instruction delivery and wording — they do not evaluate or guarantee how a real model behaves.
215
+ Managed prompts and the universal guidance injected into primary sessions carry explicit correctness obligations. For behavior changes, agents derive the material properties that must be preserved from the request and established contracts, separate write scope from impact and verification scope, investigate directly affected consumers, challenge a material assumption with a diagnostic counterexample, and choose verification at the level the risk arises. Controllers tie completion claims to observed evidence rather than status markers; reviewers distinguish no discovered defect from sufficient support for a material claim and can fail a change for a material verification gap. Agents also keep evidence-supported conclusions settled until a concrete trigger — contradictory evidence, a specific counterexample, a changed requirement, or changed inputs — reopens them; they surface false premises instead of silently satisfying them, distinguish unsupported pressure from concrete evidence, and interpret test results as evidence against the request and contracts rather than as the specification. These obligations are prompt-level guidance only: `vvoc install` / `vvoc sync` deliver the current wording, changes take effect after an OpenCode restart like all vvoc config changes, and the bundled contract tests check instruction delivery and wording — they do not evaluate or guarantee how a real model behaves.
196
216
 
197
217
  ### Managed skills
198
218
 
@@ -285,7 +305,7 @@ OpenCode keeps server/runtime plugins and native TUI plugins in separate configu
285
305
 
286
306
  `vvoc install`, `vvoc init`, and `vvoc sync` conservatively add the pinned base package specifier (for example `@osovv/vv-opencode@X.Y.Z`) to `tui.json(c)`; sync also migrates the broken legacy `@osovv/vv-opencode/tui` form and older managed pins. Existing comments, unrelated settings, unrelated plugin entries, and `[specifier, options]` tuples are preserved; malformed plugin entries fail without rewrite.
287
307
 
288
- Runtime plugins load the effective `vvoc.json` once during OpenCode startup and share one immutable config snapshot for the lifetime of the process. There is no live reload: restart OpenCode after changing `vvoc.json` or `tui.json(c)`.
308
+ On the v1 runtime, plugins load the effective `vvoc.json` once during OpenCode startup and share one immutable config snapshot for the lifetime of the process; restart OpenCode after changing `vvoc.json` or `tui.json(c)`. On the v2 runtime, plugin configuration resolves per session location and role or preset changes apply through config watching without a restart (see [OpenCode v2 support](#opencode-v2-support)).
289
309
 
290
310
  ### Strict schema, loud failures
291
311
 
@@ -186,7 +186,7 @@ async function runPresetCommand(args) {
186
186
  console.log(`Target: ${applied.path}`);
187
187
  if (applied.changes.some((change) => change.action === "updated") ||
188
188
  applied.orchestration.action === "updated") {
189
- console.log("Restart OpenCode to apply the changed roles or orchestration profile.");
189
+ console.log("On OpenCode v1, restart OpenCode to apply the changed roles or orchestration profile. On OpenCode v2, the config watcher applies them without a restart; running sessions stay anchored to their starting preset.");
190
190
  }
191
191
  }
192
192
  async function readConfiguredPresets(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"preset.js","sourceRoot":"","sources":["../../src/commands/preset.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,iBAAiB;AACjB,wBAAwB;AACxB,uHAAuH;AACvH,+HAA+H;AAC/H,gKAAgK;AAChK,kFAAkF;AAClF,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,6CAA6C;AAC7C,oFAAoF;AACpF,6EAA6E;AAC7E,mEAAmE;AACnE,yGAAyG;AACzG,oGAAoG;AACpG,wGAAwG;AACxG,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,kGAAkG;AAClG,qBAAqB;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE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AAED,SAAS,eAAe,CAAC,MAAc,EAAE,OAAe;IACtD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CACb,GAAG,OAAO,uBAAuB,MAAM,qDAAqD,CAC7F,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,6BAA6B,CAAC,KAAc,EAAE,OAAe;IACpE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,+BAA+B,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;AACzE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- export { GuardianPlugin } from "./plugins/guardian/index.js";
2
- export { HashlineEditPlugin } from "./plugins/hashline-edit/index.js";
3
- export { ModelRolesPlugin } from "./plugins/model-roles/index.js";
4
- export { SystemContextInjectionPlugin } from "./plugins/system-context-injection/index.js";
5
- export { WorkflowPlugin } from "./plugins/workflow/index.js";
6
- export { SecretsRedactionPlugin } from "./plugins/secrets-redaction.js";
7
- export { WebToolsPlugin } from "./plugins/web-tools/index.js";
8
- export { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/index.js";
9
- export { AnalyticsPlugin } from "./plugins/analytics/index.js";
10
- export { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
11
- export { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
1
+ /**
2
+ * v1 plugin factories in the historical named-export load order from the
3
+ * pre-migration root module, so hook trigger order stays deterministic.
4
+ */
5
+ export declare const V1_PLUGIN_ORDER: import("@opencode-ai/plugin").Plugin[];
6
+ declare const _default: import("./plugins/v2-runtime/index.js").DualPlugin;
7
+ export default _default;
package/dist/index.js CHANGED
@@ -1,30 +1,63 @@
1
1
  // FILE: src/index.ts
2
- // VERSION: 1.0.0
2
+ // VERSION: 2.0.0
3
3
  // START_MODULE_CONTRACT
4
- // PURPOSE: Re-export the public vv-opencode plugin entrypoints from the package root.
5
- // SCOPE: Package-root exports for GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, and SpecGuardPlugin.
6
- // DEPENDS: [src/plugins/guardian/index.ts, src/plugins/hashline-edit/index.ts, src/plugins/model-roles/index.ts, src/plugins/system-context-injection/index.ts, src/plugins/workflow/index.ts, src/plugins/secrets-redaction.ts, src/plugins/web-tools/index.ts, src/plugins/tool-history-compaction/index.ts, src/plugins/analytics/index.ts, src/plugins/peak-hours/index.ts, src/plugins/spec-guard/index.ts]
7
- // LINKS: [M-PLUGIN-GUARDIAN, M-PLUGIN-HASHLINE-EDIT, M-PLUGIN-MODEL-ROLES, M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-PLUGIN-WORKFLOW, M-PLUGIN-SECRETS-REDACTION, M-PLUGIN-WEB-TOOLS, M-PLUGIN-TOOL-HISTORY-COMPACTION, M-PLUGIN-ANALYTICS, M-PLUGIN-PEAK-HOURS, M-PLUGIN-SPEC-GUARD]
8
- // ROLE: BARREL
9
- // MAP_MODE: SUMMARY
4
+ // PURPOSE: Publish the dual-runtime vv-opencode package entrypoint that loads under OpenCode v1 (>= 1.18.29 via server()) and OpenCode v2 (>= 2.0.18 via setup()).
5
+ // SCOPE: Package-root default export aggregating the eleven vvoc server plugins for the v1 runtime and delegating to the v2 runtime adapter for the v2 runtime; no named plugin exports remain at the root so neither runtime can double-register.
6
+ // DEPENDS: [src/plugins/v2-runtime/index.ts, src/plugins/guardian/index.ts, src/plugins/hashline-edit/index.ts, src/plugins/model-roles/index.ts, src/plugins/system-context-injection/index.ts, src/plugins/workflow/index.ts, src/plugins/secrets-redaction/index.ts, src/plugins/web-tools/index.ts, src/plugins/tool-history-compaction/index.ts, src/plugins/analytics/index.ts, src/plugins/peak-hours/index.ts, src/plugins/spec-guard/index.ts]
7
+ // LINKS: [M-PLUGIN-V2-RUNTIME, M-PLUGIN-GUARDIAN, M-PLUGIN-HASHLINE-EDIT, M-PLUGIN-MODEL-ROLES, M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-PLUGIN-WORKFLOW, M-PLUGIN-SECRETS-REDACTION, M-PLUGIN-WEB-TOOLS, M-PLUGIN-TOOL-HISTORY-COMPACTION, M-PLUGIN-ANALYTICS, M-PLUGIN-PEAK-HOURS, M-PLUGIN-SPEC-GUARD]
8
+ // ROLE: RUNTIME
9
+ // MAP_MODE: EXPORTS
10
10
  // END_MODULE_CONTRACT
11
11
  //
12
12
  // START_MODULE_MAP
13
- // GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, SpecGuardPlugin - Public plugin exports available from @osovv/vv-opencode.
13
+ // default - Dual-runtime vvoc plugin entrypoint: v2 setup() through the v2 runtime adapter, v1 server() aggregating all server plugins.
14
+ // V1_PLUGIN_ORDER - Registration order of the v1 plugin factories, preserving the pre-migration named-export load order.
14
15
  // END_MODULE_MAP
15
16
  //
16
17
  // START_CHANGE_SUMMARY
17
- // LAST_CHANGE: [C-SPEC-IDENTITY-LINT - Added SpecGuardPlugin to the package-root exports.]
18
+ // LAST_CHANGE: [C-OPENCODE-V2-MIGRATION - Replaced the eleven named root plugin exports with one dual-runtime default export; per-plugin factories remain available through their ./plugins/* subpath dual entrypoints.]
18
19
  // END_CHANGE_SUMMARY
19
- export { GuardianPlugin } from "./plugins/guardian/index.js";
20
- export { HashlineEditPlugin } from "./plugins/hashline-edit/index.js";
21
- export { ModelRolesPlugin } from "./plugins/model-roles/index.js";
22
- export { SystemContextInjectionPlugin } from "./plugins/system-context-injection/index.js";
23
- export { WorkflowPlugin } from "./plugins/workflow/index.js";
24
- export { SecretsRedactionPlugin } from "./plugins/secrets-redaction.js";
25
- export { WebToolsPlugin } from "./plugins/web-tools/index.js";
26
- export { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/index.js";
27
- export { AnalyticsPlugin } from "./plugins/analytics/index.js";
28
- export { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
29
- export { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
20
+ import { aggregateV1Plugins, defineDualPlugin } from "./plugins/v2-runtime/index.js";
21
+ import { GuardianPlugin } from "./plugins/guardian/index.js";
22
+ import { HashlineEditPlugin } from "./plugins/hashline-edit/index.js";
23
+ import { ModelRolesPlugin } from "./plugins/model-roles/index.js";
24
+ import { SystemContextInjectionPlugin } from "./plugins/system-context-injection/index.js";
25
+ import { WorkflowPlugin } from "./plugins/workflow/index.js";
26
+ import { SecretsRedactionPlugin } from "./plugins/secrets-redaction/index.js";
27
+ import { WebToolsPlugin } from "./plugins/web-tools/index.js";
28
+ import { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/index.js";
29
+ import { AnalyticsPlugin } from "./plugins/analytics/index.js";
30
+ import { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
31
+ import { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
32
+ import { setupV2Plugins } from "./plugins/v2-runtime/setup.js";
33
+ // START_BLOCK_V1_PLUGIN_ORDER
34
+ /**
35
+ * v1 plugin factories in the historical named-export load order from the
36
+ * pre-migration root module, so hook trigger order stays deterministic.
37
+ */
38
+ export const V1_PLUGIN_ORDER = [
39
+ GuardianPlugin,
40
+ HashlineEditPlugin,
41
+ ModelRolesPlugin,
42
+ SystemContextInjectionPlugin,
43
+ WorkflowPlugin,
44
+ SecretsRedactionPlugin,
45
+ WebToolsPlugin,
46
+ ToolHistoryCompactionPlugin,
47
+ AnalyticsPlugin,
48
+ PeakHoursPlugin,
49
+ SpecGuardPlugin,
50
+ ];
51
+ // END_BLOCK_V1_PLUGIN_ORDER
52
+ // START_BLOCK_DUAL_ROOT_ENTRY
53
+ export default defineDualPlugin({
54
+ id: "vvoc",
55
+ async v1(input, options) {
56
+ return aggregateV1Plugins(V1_PLUGIN_ORDER, input, options, (error, index) => {
57
+ console.error(`[vvoc][v1-runtime] plugin ${V1_PLUGIN_ORDER[index]?.name ?? `#${index}`} failed to load: ${String(error)}`);
58
+ });
59
+ },
60
+ v2: setupV2Plugins,
61
+ });
62
+ // END_BLOCK_DUAL_ROOT_ENTRY
30
63
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,iBAAiB;AACjB,wBAAwB;AACxB,wFAAwF;AACxF,oQAAoQ;AACpQ,mZAAmZ;AACnZ,mRAAmR;AACnR,iBAAiB;AACjB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,0RAA0R;AAC1R,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,6FAA6F;AAC7F,qBAAqB;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;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B,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,8BAA8B;AAC9B;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,4BAA4B;IAC5B,cAAc;IACd,sBAAsB;IACtB,cAAc;IACd,2BAA2B;IAC3B,eAAe;IACf,eAAe;IACf,eAAe;CAChB,CAAC;AACF,4BAA4B;AAE5B,8BAA8B;AAC9B,eAAe,gBAAgB,CAAC;IAC9B,EAAE,EAAE,MAAM;IACV,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO;QACrB,OAAO,kBAAkB,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC1E,OAAO,CAAC,KAAK,CACX,6BAA6B,eAAe,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,IAAI,KAAK,EAAE,oBAAoB,MAAM,CAAC,KAAK,CAAC,EAAE,CAC5G,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,EAAE,EAAE,cAAc;CACnB,CAAC,CAAC;AACH,4BAA4B"}
@@ -16,3 +16,5 @@ export type AnalyticsPluginDependencies = {
16
16
  */
17
17
  export declare function createAnalyticsPlugin(dependencies?: Partial<AnalyticsPluginDependencies>): Plugin;
18
18
  export declare const AnalyticsPlugin: Plugin;
19
+ declare const _default: import("../v2-runtime/index.js").DualPlugin;
20
+ export default _default;
@@ -3,7 +3,7 @@
3
3
  // START_MODULE_CONTRACT
4
4
  // PURPOSE: Collect per-step token usage telemetry and session metadata into the analytics store with vvoc and OpenCode version attribution.
5
5
  // SCOPE: Plugin toggle gating, assistant message attribution tracking, session version tracking, step-finish usage records, session records, and fail-soft event handling.
6
- // DEPENDS: [@opencode-ai/plugin, src/lib/config-layers.ts, src/lib/package.ts, src/lib/plugin-toggle-config.ts, src/lib/analytics/store.ts, src/lib/analytics/types.ts]
6
+ // DEPENDS: [@opencode-ai/plugin, src/lib/config-layers.ts, src/lib/package.ts, src/lib/plugin-toggle-config.ts, src/lib/analytics/store.ts, src/lib/analytics/types.ts, src/plugins/v2-runtime/index.ts]
7
7
  // LINKS: [M-PLUGIN-ANALYTICS, M-ANALYTICS-STORE, M-ANALYTICS-TYPES, M-PLUGIN-TOGGLE-CONFIG]
8
8
  // ROLE: RUNTIME
9
9
  // MAP_MODE: EXPORTS
@@ -13,10 +13,11 @@
13
13
  // AnalyticsPluginDependencies - Injectable enablement and append dependencies for focused tests.
14
14
  // createAnalyticsPlugin - Builds an OpenCode server plugin with injectable dependencies.
15
15
  // AnalyticsPlugin - Default production analytics server plugin.
16
+ // default - Dual subpath entrypoint: v2 setup() seam plus v1 server() delegating to the named factory.
16
17
  // END_MODULE_MAP
17
18
  //
18
19
  // START_CHANGE_SUMMARY
19
- // LAST_CHANGE: [2026-08-19-cache-hit-rate-analytics - Added step-finish telemetry collection with session-derived OpenCode version attribution.]
20
+ // LAST_CHANGE: [C-OPENCODE-V2-MIGRATION T-001 - Added the dual subpath entrypoint so the plugin loads under OpenCode v1 via server() and v2 via setup(). Prior: 2026-08-19-cache-hit-rate-analytics - Added step-finish telemetry collection with session-derived OpenCode version attribution.]
20
21
  // END_CHANGE_SUMMARY
21
22
  import { loadVvocConfig } from "../../lib/config-layers.js";
22
23
  import { getPackageVersionSync } from "../../lib/package.js";
@@ -148,4 +149,14 @@ function toCount(value) {
148
149
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
149
150
  }
150
151
  // END_BLOCK_EVENT_HANDLERS
152
+ // START_BLOCK_DUAL_SUBPATH_ENTRY
153
+ import { defineDualPlugin } from "../v2-runtime/index.js";
154
+ import { createV2Adapter } from "../v2-runtime/setup.js";
155
+ import { setupAnalyticsV2 } from "./v2.js";
156
+ export default defineDualPlugin({
157
+ id: "vvoc.analytics",
158
+ v1: AnalyticsPlugin,
159
+ v2: (ctx) => setupAnalyticsV2(createV2Adapter(ctx)),
160
+ });
161
+ // END_BLOCK_DUAL_SUBPATH_ENTRY
151
162
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/analytics/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,iBAAiB;AACjB,wBAAwB;AACxB,8IAA8I;AAC9I,6KAA6K;AAC7K,0KAA0K;AAC1K,8FAA8F;AAC9F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,mGAAmG;AACnG,2FAA2F;AAC3F,kEAAkE;AAClE,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,mJAAmJ;AACnJ,qBAAqB;AAIrB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAcrE,MAAM,oBAAoB,GAAgC;IACxD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QAC3B,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACtD,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;CAClD,CAAC;AAEF,sCAAsC;AACtC;;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wB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAe,gBAAgB,CAAC;IAC9B,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;CACpD,CAAC,CAAC;AACH,+BAA+B"}
@@ -0,0 +1,21 @@
1
+ import type { Plugin as V2Plugin } from "@opencode/plugin";
2
+ import type { V2AdapterContext } from "../v2-runtime/setup.js";
3
+ import type { AnalyticsRecord } from "../../lib/analytics/types.js";
4
+ export type AnalyticsV2Dependencies = {
5
+ append: (record: AnalyticsRecord) => Promise<void>;
6
+ vvocVersion: string;
7
+ };
8
+ /**
9
+ * Register the analytics handlers on the v2 event stream.
10
+ *
11
+ * Mapping from the v1 event contract: the v1 message.part.updated
12
+ * step-finish record becomes the v2 session.step.ended record, session records
13
+ * keep coming from session.created, and agent attribution is tracked from
14
+ * session.agent.selected events. Provider and model attribution are empty
15
+ * strings in this port because the v2 usage events do not carry them; the
16
+ * store schema tolerates the gap exactly like the v1 fallback did.
17
+ *
18
+ * Enablement is resolved per event through the event's location directory so
19
+ * one shared server can host projects with analytics enabled and disabled.
20
+ */
21
+ export declare function setupAnalyticsV2(adapter: V2AdapterContext, dependencies?: Partial<AnalyticsV2Dependencies>): Promise<V2Plugin.Cleanup | void>;
@@ -0,0 +1,133 @@
1
+ // FILE: src/plugins/analytics/v2.ts
2
+ // VERSION: 1.0.0
3
+ // START_MODULE_CONTRACT
4
+ // PURPOSE: Register the analytics plugin on the OpenCode v2 runtime event stream with per-location enablement.
5
+ // SCOPE: v2 setup only: subscribe to session.step.ended for per-step usage records, session.created for session records, and session.agent.selected for best-effort agent attribution, resolving the analytics toggle from each event's location directory and staying fail-soft on every handler error.
6
+ // DEPENDS: [@opencode/plugin, src/lib/analytics/store.ts, src/lib/analytics/types.ts, src/lib/package.ts, src/plugins/v2-runtime/setup.ts]
7
+ // LINKS: [M-PLUGIN-ANALYTICS, V-M-PLUGIN-ANALYTICS, M-PLUGIN-V2-RUNTIME]
8
+ // ROLE: RUNTIME
9
+ // MAP_MODE: EXPORTS
10
+ // END_MODULE_CONTRACT
11
+ //
12
+ // START_MODULE_MAP
13
+ // setupAnalyticsV2 - Register the analytics event stream handlers for one OpenCode v2 plugin context.
14
+ // AnalyticsV2Dependencies - Injectable append, version, and enablement dependencies for focused tests.
15
+ // END_MODULE_MAP
16
+ //
17
+ // START_CHANGE_SUMMARY
18
+ // LAST_CHANGE: [C-OPENCODE-V2-MIGRATION T-003 - Ported analytics onto the v2 event stream with per-location gating.]
19
+ // END_CHANGE_SUMMARY
20
+ import { appendAnalyticsRecord } from "../../lib/analytics/store.js";
21
+ import { getPackageVersionSync } from "../../lib/package.js";
22
+ import { isVvocPluginEnabled } from "../../lib/plugin-toggle-config.js";
23
+ const DEFAULT_DEPENDENCIES = {
24
+ append: (record) => appendAnalyticsRecord(record),
25
+ vvocVersion: getPackageVersionSync(),
26
+ };
27
+ // END_BLOCK_ANALYTICS_V2_DEPENDENCIES
28
+ // START_BLOCK_SETUP_ANALYTICS_V2
29
+ /**
30
+ * Register the analytics handlers on the v2 event stream.
31
+ *
32
+ * Mapping from the v1 event contract: the v1 message.part.updated
33
+ * step-finish record becomes the v2 session.step.ended record, session records
34
+ * keep coming from session.created, and agent attribution is tracked from
35
+ * session.agent.selected events. Provider and model attribution are empty
36
+ * strings in this port because the v2 usage events do not carry them; the
37
+ * store schema tolerates the gap exactly like the v1 fallback did.
38
+ *
39
+ * Enablement is resolved per event through the event's location directory so
40
+ * one shared server can host projects with analytics enabled and disabled.
41
+ */
42
+ export async function setupAnalyticsV2(adapter, dependencies = {}) {
43
+ const deps = { ...DEFAULT_DEPENDENCIES, ...dependencies };
44
+ const opencodeVersion = String(adapter.ctx.app?.version ?? "unknown");
45
+ const sessionAgents = new Map();
46
+ let loggedFailure = false;
47
+ const failSoft = async (operation) => {
48
+ try {
49
+ await operation();
50
+ }
51
+ catch (error) {
52
+ if (!loggedFailure) {
53
+ loggedFailure = true;
54
+ const message = error instanceof Error ? error.message : String(error);
55
+ console.error(`[vvoc analytics] collection error: ${message}`);
56
+ }
57
+ }
58
+ };
59
+ const controller = new AbortController();
60
+ void (async () => {
61
+ try {
62
+ for await (const event of adapter.ctx.event.subscribe({ signal: controller.signal })) {
63
+ await failSoft(async () => {
64
+ const typed = event;
65
+ const directory = typed.location?.directory;
66
+ if (!directory)
67
+ return;
68
+ if (typed.type === "session.agent.selected") {
69
+ const sessionID = typed.data?.sessionID;
70
+ const agent = typed.data?.agent;
71
+ if (typeof sessionID === "string" && typeof agent === "string") {
72
+ sessionAgents.set(sessionID, agent);
73
+ }
74
+ return;
75
+ }
76
+ const snapshot = await adapter.resolver.forDirectory(directory);
77
+ if (!snapshot || !isVvocPluginEnabled(snapshot.config, "analytics"))
78
+ return;
79
+ if (typed.type === "session.created") {
80
+ const sessionID = typed.data?.sessionID ?? typed.data?.id;
81
+ if (typeof sessionID !== "string")
82
+ return;
83
+ await deps.append({
84
+ kind: "session",
85
+ ts: new Date().toISOString(),
86
+ sessionID,
87
+ projectID: directory,
88
+ title: "",
89
+ });
90
+ return;
91
+ }
92
+ if (typed.type === "session.step.ended") {
93
+ const data = typed.data;
94
+ if (!data || typeof data.sessionID !== "string")
95
+ return;
96
+ const toCount = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
97
+ const record = {
98
+ kind: "usage",
99
+ ts: new Date().toISOString(),
100
+ projectID: directory,
101
+ projectDirectory: directory,
102
+ sessionID: data.sessionID,
103
+ messageID: typeof data.assistantMessageID === "string" ? data.assistantMessageID : "",
104
+ partID: "",
105
+ providerID: "",
106
+ modelID: "",
107
+ agent: sessionAgents.get(data.sessionID) ?? "",
108
+ tokens: {
109
+ input: toCount(data.tokens?.input),
110
+ output: toCount(data.tokens?.output),
111
+ reasoning: toCount(data.tokens?.reasoning),
112
+ cacheRead: toCount(data.tokens?.cache?.read),
113
+ cacheWrite: toCount(data.tokens?.cache?.write),
114
+ },
115
+ cost: typeof data.cost === "number" && Number.isFinite(data.cost) ? data.cost : 0,
116
+ vvocVersion: deps.vvocVersion,
117
+ opencodeVersion,
118
+ };
119
+ await deps.append(record);
120
+ }
121
+ });
122
+ }
123
+ }
124
+ catch (error) {
125
+ // A non-iterable or failing event stream must never surface as an
126
+ // unhandled rejection inside the host process.
127
+ console.error(`[vvoc analytics] event stream failed: ${String(error)}`);
128
+ }
129
+ })();
130
+ return () => controller.abort();
131
+ }
132
+ // END_BLOCK_SETUP_ANALYTICS_V2
133
+ //# sourceMappingURL=v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.js","sourceRoot":"","sources":["../../../src/plugins/analytics/v2.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,iBAAiB;AACjB,wBAAwB;AACxB,iHAAiH;AACjH,2SAA2S;AAC3S,6IAA6I;AAC7I,2EAA2E;AAC3E,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,wGAAwG;AACxG,yGAAyG;AACzG,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,uHAAuH;AACvH,qBAAqB;AAIrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAQxE,MAAM,oBAAoB,GAA4B;IACpD,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;IACjD,WAAW,EAAE,qBAAqB,EAAE;CACrC,CAAC;AACF,sCAAsC;AAEtC,iCAAiC;AACjC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAyB,EACzB,eAAiD,EAAE;IAEnD,MAAM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,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kEAAkE;YAClE,+CAA+C;YAC/C,OAAO,CAAC,KAAK,CAAC,yCAAyC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC;AACD,+BAA+B"}
@@ -1,2 +1,48 @@
1
1
  import { type Plugin } from "@opencode-ai/plugin";
2
+ import { type VvocConfigSnapshot } from "../../lib/config-layers.js";
3
+ export declare const GUARDIAN_AGENT = "guardian";
4
+ export declare const GUARDIAN_DISABLED_ENV = "OPENCODE_GUARDIAN_DISABLED";
5
+ type PermissionAskedEvent = {
6
+ id: string;
7
+ sessionID: string;
8
+ permission?: string;
9
+ patterns?: string[];
10
+ metadata?: Record<string, unknown>;
11
+ always?: string[];
12
+ tool?: {
13
+ messageID: string;
14
+ callID: string;
15
+ };
16
+ };
17
+ type ToolIntent = {
18
+ sessionID: string;
19
+ tool: string;
20
+ callID: string;
21
+ args: unknown;
22
+ time: number;
23
+ };
24
+ type CommandIntent = {
25
+ sessionID: string;
26
+ command: string;
27
+ arguments: string;
28
+ time: number;
29
+ };
30
+ type ActiveReview = {
31
+ cancelled: boolean;
32
+ internalReply: boolean;
33
+ cancel?: () => void;
34
+ cancellationNoticeShown: boolean;
35
+ };
36
+ type GuardianRuntimeConfig = {
37
+ model?: string;
38
+ timeoutMs: number;
39
+ approvalRiskThreshold: number;
40
+ reviewToastDurationMs: number;
41
+ sources: string[];
42
+ warnings: string[];
43
+ };
44
+ export declare function resolveGuardianRuntimeConfig(loaded: VvocConfigSnapshot): GuardianRuntimeConfig;
45
+ export declare function reviewPermissionRequest(client: Parameters<Plugin>[0]["client"], serverUrl: URL, directory: string, guardianPrompt: string, guardianConfig: GuardianRuntimeConfig, permissionEvent: PermissionAskedEvent, toolIntentsByCallID: Map<string, ToolIntent>, latestCommandIntentBySessionID: Map<string, CommandIntent>, activeReviews: Map<string, ActiveReview>, activeReview: ActiveReview): Promise<void>;
2
46
  export declare const GuardianPlugin: Plugin;
47
+ declare const _default: import("../v2-runtime/index.js").DualPlugin;
48
+ export default _default;