@osovv/vv-opencode 2.3.2 → 2.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## <small>2.4.0 (2026-11-04)</small>
2
+
3
+ ### Summary
4
+
5
+ Version 2.4.0 closes the verified agent-facing workflow, managed-prompt sync, doctor, and reflection gaps. Managed skills and agents now describe the literal `VVOC_WORK_ITEM_ID: wi-<n>` launch header, the state-to-agent map, the standalone `work_item_open` field rule, and controller-only work-item lifecycle, so workers copy the assignment header instead of a sample id. `vvoc sync` refreshes legacy inline managed `{file:...}` system prompts, preserves and reports user-owned inline sources, and deduplicates `skills` roots by real path; `vvoc doctor` warns about stale managed prompts and skills, duplicate skill roots, and deprecated permission actions such as `apply_patch`, while missing file references remain fail-closed problems. The bundled `vv-reflect` extractor gains a streaming `--archive` mode with since/until/project/agent/skill filters, call-id deduplication, legacy `part` union, deterministic JSON/Markdown output, and a documented machine-wide workflow. README and GRACE context now point at the native `opencode/agents` discovery path and describe legacy `vvoc/agents` files as migration inputs.
6
+
7
+ ## <small>2.3.3 (2026-11-04)</small>
8
+
9
+ ### Summary
10
+
11
+ Analytics now records the OpenCode host version from the native app identity, so usage records stay correctly attributed on 2.2 hosts that no longer deliver session lifecycle events, and session titles are recovered lazily from the native session record with bounded retries while a failed read never blocks a usage record. The isolated host contract matrix was also made self-consistent on OpenCode 2.2.5 by pinning every vvoc role to the cohort model and keeping the isolated vvoc config at the host child's working directory, and a nonzero host exit now prints bounded stderr and stdout tails so matrix failures are diagnosable.
12
+
13
+ * fix(analytics): attribute host version from the native app and recover titles lazily ([39ab5ac](https://github.com/osovv/vv-opencode/commit/39ab5ac))
14
+
1
15
  ## <small>2.3.2 (2026-11-04)</small>
2
16
 
3
17
  ### Summary
package/README.md CHANGED
@@ -212,7 +212,7 @@ Two families: `vv-*` skills guide the work protocol, while `vvoc-*` skills opera
212
212
  | `vv-plan` | A spec is approved and ready to implement | A task-level implementation plan with file targets, contracts, dependencies, and acceptance criteria |
213
213
  | `vv-execute` | A plan is approved and you want it applied step by step | Ordered execution with verification, an explicit inline-or-classic mode choice, and applied spec/plan archival |
214
214
  | `vv-review` | You want findings, not fixes | A review-only workflow that reports spec/code issues and stops before implementation |
215
- | `vv-reflect` | A long development, debugging, ops, or investigation session exposed environment friction or produced reusable knowledge | Dispatches the read-only `vv-reflector` subagent over the session and its subagent tree, then applies environment improvements (documents, steering, guardrails, skills, tooling) or lessons/runbooks only after per-entry approval |
215
+ | `vv-reflect` | A long development, debugging, ops, or investigation session exposed environment friction or produced reusable knowledge | Dispatches the read-only `vv-reflector` subagent over the session and its subagent tree — or the streaming `--archive` aggregate when the question spans sessions/projects — then applies environment improvements (documents, steering, guardrails, skills, tooling) or lessons/runbooks only after per-entry approval |
216
216
  | `vv-handoff` | You are ending a session and want the visible context preserved | A redacted XML note at `.vvoc/handoff/YYYY-MM-DD-<session-slug>/handoff.xml`, written from already-visible context only |
217
217
  | `vvoc-usage-analytics` | You ask about token usage, cache hit rate, costs, or caching regressions | Read-only analysis across `vvoc analytics`, the analytics JSONL, and historical `opencode.db` data |
218
218
 
@@ -229,7 +229,7 @@ Skills are loaded by OpenCode at session start through the native `skills` strin
229
229
  | `vvoc sync` | Refresh native plugins/agents/skills registrations, prompts, skills, config |
230
230
  | `vvoc launch` | Launch OpenCode with deterministic runtime and vvoc config sources after a host-window preflight |
231
231
  | `vvoc status` | Show current installation state, including the installed OpenCode version against the supported window and combined-package registration |
232
- | `vvoc doctor` | Diagnose OpenCode version/window/runtime/vvoc setup problems (exits non-zero on issues) |
232
+ | `vvoc doctor` | Diagnose OpenCode version/window/runtime/vvoc setup problems and warn about stale managed prompts/skills, duplicate skills roots, and deprecated permission actions (exits non-zero on problems) |
233
233
  | `vvoc config validate` | Validate canonical `vvoc.json` |
234
234
  | `vvoc role list\|set\|unset` | Manage model role assignments |
235
235
  | `vvoc preset list\|show\|<name>` | Inspect or apply named presets |
@@ -265,7 +265,7 @@ Canonical project-local paths:
265
265
  ```text
266
266
  OpenCode config → ./.opencode/opencode.json(c)
267
267
  vvoc config → ./.vvoc/vvoc.json
268
- Managed agent prompts → ./.vvoc/agents/*.md
268
+ Managed agent prompts → ./.opencode/agents/*.md
269
269
  Managed skills → ./.vvoc/skills/*/SKILL.md
270
270
  Spec package directory → ./.vvoc/specs/YYYY-MM-DD-<slug>/
271
271
  Handoff notes → ./.vvoc/handoff/YYYY-MM-DD-<session-slug>/handoff.xml
@@ -279,17 +279,19 @@ Global paths:
279
279
  ```text
280
280
  OpenCode config → $XDG_CONFIG_HOME/opencode/opencode.json
281
281
  vvoc config → $XDG_CONFIG_HOME/vvoc/vvoc.json
282
- Managed agent prompts → $XDG_CONFIG_HOME/vvoc/agents/*.md
282
+ Managed agent prompts → $XDG_CONFIG_HOME/opencode/agents/*.md
283
283
  Managed skills → $XDG_CONFIG_HOME/vvoc/skills/*/SKILL.md
284
284
  Persisted data → $XDG_DATA_HOME/vvoc/
285
285
  Usage analytics → $XDG_DATA_HOME/vvoc/analytics/usage-YYYY-MM.jsonl
286
286
  ```
287
287
 
288
+ Native OpenCode 2.x discovers managed agent markdown from the `agents/` directory beside the config file, so vvoc writes `agents/*.md` there. Legacy pre-V2 `$XDG_CONFIG_HOME/vvoc/agents/*.md` files referenced by an inline `agents.<id>.system` are recognized as managed migration inputs: `vvoc sync` refreshes a managed file in place and reports user-owned inline sources without overwriting them.
289
+
288
290
  ### One pinned package in the native plugins array
289
291
 
290
292
  OpenCode 2.x keeps one native config document per process. `opencode.json(c)` is loaded by the core/server plugin runtime and activates vvoc features such as model roles, Guardian, workflow, hashline edit, redaction, and web tools. The terminal UI process takes its own settings (tabs, keybinds, TUI-only plugin entries) from the native `cli.json`, and it also loads the TUI entrypoints of the plugins carried by the server inventory. vv-opencode uses that directly: the same pinned package entry (for example `@osovv/vv-opencode@X.Y.Z`) is registered once in the native `plugins` array, the host resolves its `./server` export for the server runtime and its `./tui` export for the terminal UI, and headless/server launches never load the UI module.
291
293
 
292
- `vvoc install`, `vvoc init`, and `vvoc sync` conservatively write that single pinned base-package entry — a string, or a `{ "package": …, "options": … }` object — into the native `plugins` array; sync also migrates the broken legacy `@osovv/vv-opencode/tui` form and older managed pins. Machines upgraded from a V1 host carry a second, host-migrated vvoc entry in the client-side `cli.json` (the host moves the retired `tui.json(c)` plugin list there on first start), so the same commands mirror an existing managed `cli.json` entry to the pinned specifier — comments, client preferences, unrelated entries, and the entry's options are preserved, and nothing is created when no client pin exists. `vvoc doctor` and `vvoc status` print the TUI client pin beside the server pin and warn when the two drift apart. Existing comments, unrelated settings, unrelated plugin entries, and their `options` are preserved; malformed plugin entries fail without rewrite. Supported V1 document shapes are materialized into the native V2 shape by `vvoc sync` once the host is inside the supported window, using the official OpenCode V1-to-V2 migration guide, with a timestamped `*.vvoc-backup-<timestamp>` sibling and validate-before-write. Residual or ambiguous V1 fields are refused before any mutation, so `plugin`, `agent`, `provider`, `command`, `small_model`, and `tools` never remain in a document vvoc writes.
294
+ `vvoc install`, `vvoc init`, and `vvoc sync` conservatively write that single pinned base-package entry — a string, or a `{ "package": …, "options": … }` object — into the native `plugins` array; sync also migrates the broken legacy `@osovv/vv-opencode/tui` form and older managed pins. Machines upgraded from a V1 host carry a second, host-migrated vvoc entry in the client-side `cli.json` (the host moves the retired `tui.json(c)` plugin list there on first start), so the same commands mirror an existing managed `cli.json` entry to the pinned specifier — comments, client preferences, unrelated entries, and the entry's options are preserved, and nothing is created when no client pin exists. `vvoc doctor` and `vvoc status` print the TUI client pin beside the server pin and warn when the two drift apart. Existing comments, unrelated settings, unrelated plugin entries, and their `options` are preserved; malformed plugin entries fail without rewrite. Supported V1 document shapes are materialized into the native V2 shape by `vvoc sync` once the host is inside the supported window, using the official OpenCode V1-to-V2 migration guide, with a timestamped `*.vvoc-backup-<timestamp>` sibling and validate-before-write. Residual or ambiguous V1 fields are refused before any mutation, so `plugin`, `agent`, `provider`, `command`, `small_model`, and `tools` never remain in a document vvoc writes. A legacy inline `agents.<id>.system = {file:...}` reference to a vvoc-managed prompt is refreshed in place by `vvoc sync`; a user-owned inline system is reported with its source path and never overwritten.
293
295
 
294
296
  The native document shape vvoc validates, extends, and writes into:
295
297
 
@@ -328,7 +330,7 @@ The optional schema-v3 `web` section follows the same layer precedence and is om
328
330
 
329
331
  ### Diagnostics never mutate
330
332
 
331
- `vvoc status` and `vvoc doctor` report the installed OpenCode version, the supported window (`OpenCode supported range: >=2.0.18 <3.0.0`) and the verified host list, selected runtime/vvoc config paths, plugin registration, and validation problems without normalizing or rewriting files. `vvoc upgrade` can still finish the package installation when the follow-up `vvoc sync` fails; it then reports a partial upgrade, leaves config unchanged, and tells you to fix the invalid config before rerunning `vvoc sync`.
333
+ `vvoc status` and `vvoc doctor` report the installed OpenCode version, the supported window (`OpenCode supported range: >=2.0.18 <3.0.0`) and the verified host list, selected runtime/vvoc config paths, plugin registration, and validation problems without normalizing or rewriting files. `vvoc doctor` additionally warns when a managed agent prompt or managed skill body is stale relative to the installed package, when two `skills` entries resolve to the same real path, or when a permission rule uses a deprecated action such as `apply_patch`; those warnings do not change the exit code, while a missing `{file:...}` reference remains a problem. `vvoc upgrade` can still finish the package installation when the follow-up `vvoc sync` fails; it then reports a partial upgrade, leaves config unchanged, and tells you to fix the invalid config before rerunning `vvoc sync`.
332
334
 
333
335
  Runtime compatibility is window-bounded: install, init, sync, and launch refuse a host outside `>=2.0.18 <3.0.0` before touching config, Guardian evaluates permissions through the native `permission.evaluate` hook, hashline edit refs must use current hash/context anchors, and sync writes current managed agents without deleting old pre-rename user or command entries.
334
336
 
@@ -1,3 +1,4 @@
1
+ import { type OpenCodeRuntimeInspection } from "../lib/opencode.js";
1
2
  declare const _default: import("citty").CommandDef<{
2
3
  readonly scope: {
3
4
  readonly type: "enum";
@@ -11,3 +12,6 @@ declare const _default: import("citty").CommandDef<{
11
12
  };
12
13
  }>;
13
14
  export default _default;
15
+ export declare function runDoctor(args: Record<string, unknown>, options?: {
16
+ inspectRuntime?: () => Promise<OpenCodeRuntimeInspection>;
17
+ }): Promise<void>;
@@ -11,10 +11,11 @@
11
11
  //
12
12
  // START_MODULE_MAP
13
13
  // default - Doctor command definition for vvoc installation diagnostics.
14
+ // runDoctor - Testable doctor flow with injectable native host verification.
14
15
  // END_MODULE_MAP
15
16
  //
16
17
  // START_CHANGE_SUMMARY
17
- // LAST_CHANGE: [C-CLI-JSON-PIN-SYNC-R1 T-002 - Printed the native cli.json TUI client pin beside the server pin.]
18
+ // LAST_CHANGE: [C-WORKFLOW-PROMPT-SYNC-DOCTOR-ARCHIVE T-003 - Extracted an injectable runDoctor flow so host-warning coverage does not depend on a globally installed opencode binary.]
18
19
  // END_CHANGE_SUMMARY
19
20
  import { defineCommand } from "citty";
20
21
  import { inspectInstallationForScope } from "../lib/opencode.js";
@@ -36,59 +37,67 @@ export default defineCommand({
36
37
  },
37
38
  },
38
39
  async run({ args }) {
39
- // START_BLOCK_PRINT_DIAGNOSTIC_REPORT
40
- const scope = resolveReadScope(args.scope);
41
- const configDir = typeof args["config-dir"] === "string" ? args["config-dir"] : undefined;
42
- const inspection = await inspectInstallationForScope({ scope, cwd: process.cwd(), configDir });
43
- console.log(`Scope: ${inspection.scope}`);
44
- console.log(`OpenCode source: ${inspection.opencodeSource.kind}${inspection.opencodeSource.path ? ` ${inspection.opencodeSource.path}` : ""}`);
45
- console.log(`vvoc source: ${inspection.vvocSource.kind}${inspection.vvocSource.path ? ` ${inspection.vvocSource.path}` : ""}`);
46
- console.log(`OpenCode version: ${inspection.runtime.version ?? "unavailable"}`);
47
- console.log(`OpenCode supported range: ${inspection.runtime.supportedRange}`);
48
- console.log(`OpenCode support: ${inspection.runtime.support ?? "unknown"} (verified hosts: ${inspection.runtime.verifiedHosts?.join(", ") || "none"})`);
49
- console.log(`OpenCode supported: ${inspection.runtime.versionSupported === undefined ? "unknown" : inspection.runtime.versionSupported ? "yes" : "no"}`);
50
- console.log(`OpenCode config: ${inspection.opencode.path}`);
51
- console.log(`OpenCode config parse: ${inspection.opencode.parseError ? inspection.opencode.parseError : "ok"}`);
52
- console.log(`Configured plugins: ${inspection.opencode.plugins.length > 0 ? inspection.opencode.plugins.map((entry) => (typeof entry === "string" ? entry : entry.package)).join(", ") : "<none>"}`);
53
- console.log(`TUI package registered: ${inspection.tui.registered ? "yes" : "no"}`);
54
- console.log(`TUI capability note: ${inspection.tui.note}`);
55
- const cliPinLabel = inspection.cli.parseError !== undefined
56
- ? "unavailable (parse error)"
57
- : (inspection.cli.managedPin ?? (inspection.cli.exists ? "none" : "no cli.json"));
58
- console.log(`TUI client pin (cli.json): ${cliPinLabel}`);
59
- console.log(`vvoc config: ${inspection.vvoc.path}`);
60
- console.log(`vvoc config parse: ${inspection.vvoc.parseError ? inspection.vvoc.parseError : inspection.vvoc.exists ? "ok" : "missing"}`);
61
- console.log(`vvoc schema: ${inspection.vvoc.schema ?? "missing"}`);
62
- console.log(`vvoc version: ${inspection.vvoc.version ?? "missing"}`);
63
- console.log(`Guardian model: ${inspection.guardian.config ? (inspection.guardian.config.model ?? "default") : "unknown"}`);
64
- console.log(`Secrets Redaction config: ${inspection.secretsRedaction.config ? "present" : "unknown"}`);
65
- console.log("Roles:");
66
- if (inspection.roles.assignments.length === 0) {
67
- console.log(" <none>");
68
- }
69
- else {
70
- for (const role of inspection.roles.assignments) {
71
- console.log(` ${role.roleId}: ${role.model}`);
72
- }
40
+ await runDoctor(args);
41
+ },
42
+ });
43
+ export async function runDoctor(args, options = {}) {
44
+ // START_BLOCK_PRINT_DIAGNOSTIC_REPORT
45
+ const scope = resolveReadScope(args.scope);
46
+ const configDir = typeof args["config-dir"] === "string" ? args["config-dir"] : undefined;
47
+ const inspection = await inspectInstallationForScope({
48
+ scope,
49
+ cwd: process.cwd(),
50
+ configDir,
51
+ ...(options.inspectRuntime === undefined ? {} : { inspectRuntime: options.inspectRuntime }),
52
+ });
53
+ console.log(`Scope: ${inspection.scope}`);
54
+ console.log(`OpenCode source: ${inspection.opencodeSource.kind}${inspection.opencodeSource.path ? ` ${inspection.opencodeSource.path}` : ""}`);
55
+ console.log(`vvoc source: ${inspection.vvocSource.kind}${inspection.vvocSource.path ? ` ${inspection.vvocSource.path}` : ""}`);
56
+ console.log(`OpenCode version: ${inspection.runtime.version ?? "unavailable"}`);
57
+ console.log(`OpenCode supported range: ${inspection.runtime.supportedRange}`);
58
+ console.log(`OpenCode support: ${inspection.runtime.support ?? "unknown"} (verified hosts: ${inspection.runtime.verifiedHosts?.join(", ") || "none"})`);
59
+ console.log(`OpenCode supported: ${inspection.runtime.versionSupported === undefined ? "unknown" : inspection.runtime.versionSupported ? "yes" : "no"}`);
60
+ console.log(`OpenCode config: ${inspection.opencode.path}`);
61
+ console.log(`OpenCode config parse: ${inspection.opencode.parseError ? inspection.opencode.parseError : "ok"}`);
62
+ console.log(`Configured plugins: ${inspection.opencode.plugins.length > 0 ? inspection.opencode.plugins.map((entry) => (typeof entry === "string" ? entry : entry.package)).join(", ") : "<none>"}`);
63
+ console.log(`TUI package registered: ${inspection.tui.registered ? "yes" : "no"}`);
64
+ console.log(`TUI capability note: ${inspection.tui.note}`);
65
+ const cliPinLabel = inspection.cli.parseError !== undefined
66
+ ? "unavailable (parse error)"
67
+ : (inspection.cli.managedPin ?? (inspection.cli.exists ? "none" : "no cli.json"));
68
+ console.log(`TUI client pin (cli.json): ${cliPinLabel}`);
69
+ console.log(`vvoc config: ${inspection.vvoc.path}`);
70
+ console.log(`vvoc config parse: ${inspection.vvoc.parseError ? inspection.vvoc.parseError : inspection.vvoc.exists ? "ok" : "missing"}`);
71
+ console.log(`vvoc schema: ${inspection.vvoc.schema ?? "missing"}`);
72
+ console.log(`vvoc version: ${inspection.vvoc.version ?? "missing"}`);
73
+ console.log(`Guardian model: ${inspection.guardian.config ? (inspection.guardian.config.model ?? "default") : "unknown"}`);
74
+ console.log(`Secrets Redaction config: ${inspection.secretsRedaction.config ? "present" : "unknown"}`);
75
+ console.log("Roles:");
76
+ if (inspection.roles.assignments.length === 0) {
77
+ console.log(" <none>");
78
+ }
79
+ else {
80
+ for (const role of inspection.roles.assignments) {
81
+ console.log(` ${role.roleId}: ${role.model}`);
73
82
  }
74
- if (inspection.warnings.length > 0) {
75
- console.log("Warnings:");
76
- for (const warning of inspection.warnings) {
77
- console.log(`- ${warning}`);
78
- }
83
+ }
84
+ if (inspection.warnings.length > 0) {
85
+ console.log("Warnings:");
86
+ for (const warning of inspection.warnings) {
87
+ console.log(`- ${warning}`);
79
88
  }
80
- if (inspection.problems.length > 0) {
81
- console.error("Problems:");
82
- for (const problem of inspection.problems) {
83
- console.error(`- ${problem}`);
84
- }
85
- process.exitCode = 1;
86
- return;
89
+ }
90
+ if (inspection.problems.length > 0) {
91
+ console.error("Problems:");
92
+ for (const problem of inspection.problems) {
93
+ console.error(`- ${problem}`);
87
94
  }
88
- console.log("Doctor: ok");
89
- // END_BLOCK_PRINT_DIAGNOSTIC_REPORT
90
- },
91
- });
95
+ process.exitCode = 1;
96
+ return;
97
+ }
98
+ console.log("Doctor: ok");
99
+ // END_BLOCK_PRINT_DIAGNOSTIC_REPORT
100
+ }
92
101
  function resolveReadScope(value) {
93
102
  return value === "global" || value === "project" ? value : "effective";
94
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,iBAAiB;AACjB,wBAAwB;AACxB,yFAAyF;AACzF,4MAA4M;AAC5M,oEAAoE;AACpE,0CAA0C;AAC1C,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,2EAA2E;AAC3E,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,oHAAoH;AACpH,qBAAqB;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE,eAAe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,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,oCAAoC;AACtC,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"}
@@ -20,7 +20,7 @@
20
20
  // END_MODULE_MAP
21
21
  //
22
22
  // START_CHANGE_SUMMARY
23
- // LAST_CHANGE: [2026-08-19-usage-analytics-skill - Added the vvoc-usage-analytics tooling skill (first vvoc-* managed skill).]
23
+ // LAST_CHANGE: [C-WORKFLOW-PROMPT-SYNC-DOCTOR-ARCHIVE T-003 - Reference discovery now returns regular files only so an accidental directory in a bundled references folder cannot be read as a skill reference.]
24
24
  // END_CHANGE_SUMMARY
25
25
  import { readdir, readFile } from "node:fs/promises";
26
26
  import { join } from "node:path";
@@ -48,8 +48,8 @@ export async function loadManagedSkillReference(name, referenceFileName) {
48
48
  export async function listManagedSkillReferenceNames(name) {
49
49
  const refDirUrl = new URL(`../../templates/skills/${name}/references/`, import.meta.url);
50
50
  try {
51
- const entries = await readdir(refDirUrl);
52
- return entries;
51
+ const entries = await readdir(refDirUrl, { withFileTypes: true });
52
+ return entries.filter((entry) => entry.isFile()).map((entry) => entry.name);
53
53
  }
54
54
  catch (error) {
55
55
  if (error.code === "ENOENT") {
@@ -1 +1 @@
1
- {"version":3,"file":"managed-skills.js","sourceRoot":"","sources":["../../src/lib/managed-skills.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,iBAAiB;AACjB,wBAAwB;AACxB,qHAAqH;AACrH,iJAAiJ;AACjJ,4EAA4E;AAC5E,gCAAgC;AAChC,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,oHAAoH;AACpH,0DAA0D;AAC1D,2FAA2F;AAC3F,qFAAqF;AACrF,oFAAoF;AACpF,qFAAqF;AACrF,kHAAkH;AAClH,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,iIAAiI;AACjI,qBAAqB;AAErB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS;IACT,SAAS;IACT,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,sBAAsB;CACd,CAAC;AAIX,MAAM,UAAU,uBAAuB,CAAC,aAAqB,EAAE,IAAsB;IACnF,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC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M,cAAc,GAAG;QACrB,uBAAuB,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;QAC7E,uBAAuB,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,EAAE,IAAI,CAAC;KACpE,CAAC;IAEF,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;QAC3C,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvD,SAAS;YACX,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,oCAAoC,IAAI,qDAAqD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzH,CAAC;AACJ,CAAC"}
@@ -2,7 +2,7 @@
2
2
  // VERSION: 2.0.0
3
3
  // START_MODULE_CONTRACT
4
4
  // PURPOSE: Conservative vvoc-managed native OpenCode agent markdown, managed skills registration, and managed agent model IO.
5
- // SCOPE: Native `default_agent`/`skills` config registration, native discovered agent markdown generation with native frontmatter, managed prompt/skill file install and sync with managed-marker guards, the OpenCode skills symlink, and read/write of managed agent model overrides. Generic model/default-model/provider overrides live in model-overrides.ts.
5
+ // SCOPE: Native `default_agent`/`skills` config registration, real-path skills-root deduplication, native discovered agent markdown generation with native frontmatter, managed prompt/skill file install and sync with managed-marker guards, legacy inline `{file:...}` managed prompt reconciliation, the OpenCode skills symlink, and read/write of managed agent model overrides. Generic model/default-model/provider overrides live in model-overrides.ts.
6
6
  // DEPENDS: [jsonc-parser, node:fs/promises, node:path, src/lib/managed-agents.ts, src/lib/managed-skills.ts, src/lib/model-roles.ts, src/lib/opencode/shared-utils.ts, src/lib/opencode/paths.ts]
7
7
  // LINKS: [M-CLI-CONFIG, M-CLI-MANAGED-AGENTS, M-CLI-MANAGED-SKILLS]
8
8
  // ROLE: RUNTIME
@@ -27,11 +27,13 @@
27
27
  // END_MODULE_MAP
28
28
  //
29
29
  // START_CHANGE_SUMMARY
30
- // LAST_CHANGE: [direct fix - Pass the declaring config directory when validating inline agent overrides so a global config that uses {file:} tokens no longer fails sync.]
30
+ // LAST_CHANGE: [C-WORKFLOW-PROMPT-SYNC-DOCTOR-ARCHIVE T-002/T-004 - Reconciled legacy inline managed {file:...} prompt bodies during install/sync, reported user-owned inline sources, and deduplicated skills roots by real path while preserving first-occurrence order.]
31
31
  // END_CHANGE_SUMMARY
32
32
  import { applyEdits, format, modify } from "jsonc-parser";
33
+ import { realpathSync } from "node:fs";
33
34
  import { lstat, mkdir, readlink, symlink, unlink } from "node:fs/promises";
34
- import { dirname, join, relative, resolve } from "node:path";
35
+ import { homedir } from "node:os";
36
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
35
37
  import { MANAGED_NATIVE_AGENT_NAMES, MANAGED_OPENCODE_AGENTS, getManagedAgentPromptPath, getManagedNativeAgentFrontmatter, loadManagedAgentPromptTemplate, } from "../managed-agents.js";
36
38
  import { MANAGED_SKILL_NAMES, getManagedSkillFilePath, listManagedSkillReferenceNames, loadManagedSkillReference, loadManagedSkillTemplate, } from "../managed-skills.js";
37
39
  import { isRoleReference } from "../model-roles.js";
@@ -212,6 +214,7 @@ async function readInlineManagedAgentOverrides(paths) {
212
214
  continue;
213
215
  overrides.set(agentName, {
214
216
  definesSystem: Object.hasOwn(entry, "system"),
217
+ ...(typeof entry.system === "string" ? { system: entry.system } : {}),
215
218
  managedKeys: new Set(Object.keys(entry).filter((key) => MANAGED_AGENT_FRONTMATTER_KEYS.has(key))),
216
219
  });
217
220
  }
@@ -242,14 +245,15 @@ async function resolveInlineSystemActions(paths, inlineOverrides) {
242
245
  }
243
246
  return actions;
244
247
  }
245
- async function applyInlineSystemAction(agentPath, action) {
248
+ async function applyInlineSystemAction(agentPath, action, source) {
249
+ const reason = `inline agent registration owns the system prompt${source ? `; source is ${source}` : ""}`;
246
250
  if (action === "delete") {
247
251
  const removed = await removeTextFile(agentPath);
248
252
  return [
249
253
  {
250
254
  action: removed ? "deleted" : "kept",
251
255
  path: agentPath,
252
- reason: "inline agent registration owns the system prompt",
256
+ reason,
253
257
  },
254
258
  ];
255
259
  }
@@ -257,10 +261,51 @@ async function applyInlineSystemAction(agentPath, action) {
257
261
  {
258
262
  action: "skipped",
259
263
  path: agentPath,
260
- reason: "inline agent registration owns the system prompt",
264
+ reason,
261
265
  },
262
266
  ];
263
267
  }
268
+ const INLINE_FILE_TOKEN = /^\s*\{file:([^}]+)\}\s*$/;
269
+ /** Resolve a single `{file:...}` token against the declaring config directory. */
270
+ function resolveInlineSystemFile(system, configDir) {
271
+ if (system === undefined)
272
+ return undefined;
273
+ const match = INLINE_FILE_TOKEN.exec(system);
274
+ if (match === null)
275
+ return undefined;
276
+ const raw = match[1].trim();
277
+ if (!raw)
278
+ return undefined;
279
+ const expanded = raw.startsWith("~/") ? join(homedir(), raw.slice(2)) : raw;
280
+ return isAbsolute(expanded) ? expanded : resolve(configDir, expanded);
281
+ }
282
+ /**
283
+ * Reconciles a legacy inline `agents.<id>.system = {file:...}` reference with
284
+ * the current managed prompt template. Pre-V2 releases registered managed
285
+ * prompts this way under the vvoc config root; the native migration changed
286
+ * the registration shape but not the referenced file, so sync must refresh the
287
+ * managed file or the host keeps serving stale instructions.
288
+ */
289
+ async function syncLegacyInlineManagedPrompt(paths, agentName, override) {
290
+ const targetPath = resolveInlineSystemFile(override?.system, dirname(paths.opencodeConfigPath));
291
+ if (targetPath === undefined)
292
+ return undefined;
293
+ const generatedPath = getManagedAgentPromptPath(paths.managedAgentsDirPath, agentName);
294
+ if (resolve(targetPath) === resolve(generatedPath))
295
+ return undefined;
296
+ const expectedPath = getManagedAgentPromptPath(dirname(targetPath), agentName);
297
+ if (resolve(expectedPath) !== resolve(targetPath))
298
+ return undefined;
299
+ const currentText = await readOptionalText(targetPath);
300
+ if (currentText === undefined || !isManagedFile(currentText))
301
+ return undefined;
302
+ const nextText = await renderManagedPrompt(agentName);
303
+ if (currentText === nextText) {
304
+ return { action: "kept", path: targetPath, reason: "legacy inline managed prompt" };
305
+ }
306
+ await writeText(targetPath, nextText);
307
+ return { action: "updated", path: targetPath, reason: "legacy inline managed prompt" };
308
+ }
264
309
  export async function installManagedAgentPrompts(paths, options) {
265
310
  await assertOpencodeConfigForAssets(paths);
266
311
  const results = [];
@@ -268,12 +313,17 @@ export async function installManagedAgentPrompts(paths, options) {
268
313
  const inlineSystem = await resolveInlineSystemActions(paths, inlineOverrides);
269
314
  for (const agentName of MANAGED_NATIVE_AGENT_NAMES) {
270
315
  const agentPath = getManagedAgentPromptPath(paths.managedAgentsDirPath, agentName);
316
+ const override = inlineOverrides.get(agentName);
317
+ const legacyResult = await syncLegacyInlineManagedPrompt(paths, agentName, override);
318
+ if (legacyResult)
319
+ results.push(legacyResult);
271
320
  const systemAction = inlineSystem.get(agentName);
272
321
  if (systemAction !== undefined) {
273
- results.push(...(await applyInlineSystemAction(agentPath, systemAction)));
322
+ const source = resolveInlineSystemFile(override?.system, dirname(paths.opencodeConfigPath)) ??
323
+ override?.system;
324
+ results.push(...(await applyInlineSystemAction(agentPath, systemAction, source)));
274
325
  continue;
275
326
  }
276
- const override = inlineOverrides.get(agentName);
277
327
  const currentText = await readOptionalText(agentPath);
278
328
  if (!currentText) {
279
329
  await writeText(agentPath, await renderNativeAgentMarkdownForName(agentName, {
@@ -307,12 +357,17 @@ export async function syncManagedAgentPrompts(paths, options) {
307
357
  const inlineSystem = await resolveInlineSystemActions(paths, inlineOverrides);
308
358
  for (const agentName of MANAGED_NATIVE_AGENT_NAMES) {
309
359
  const agentPath = getManagedAgentPromptPath(paths.managedAgentsDirPath, agentName);
360
+ const override = inlineOverrides.get(agentName);
361
+ const legacyResult = await syncLegacyInlineManagedPrompt(paths, agentName, override);
362
+ if (legacyResult)
363
+ results.push(legacyResult);
310
364
  const systemAction = inlineSystem.get(agentName);
311
365
  if (systemAction !== undefined) {
312
- results.push(...(await applyInlineSystemAction(agentPath, systemAction)));
366
+ const source = resolveInlineSystemFile(override?.system, dirname(paths.opencodeConfigPath)) ??
367
+ override?.system;
368
+ results.push(...(await applyInlineSystemAction(agentPath, systemAction, source)));
313
369
  continue;
314
370
  }
315
- const override = inlineOverrides.get(agentName);
316
371
  results.push(await syncManagedPrompt(paths, agentName, options, override));
317
372
  }
318
373
  results.push(...(await syncGuardianPromptBody(paths, { force: options.force, installOnly: false })));
@@ -598,14 +653,49 @@ function getManagedSkillsPathReference(paths) {
598
653
  const skillsRef = relative(resolve(baseDir), paths.managedSkillsDirPath).replaceAll("\\", "/");
599
654
  return skillsRef.startsWith(".") ? skillsRef : `./${skillsRef}`;
600
655
  }
656
+ function canonicalSkillsPath(entry, baseDir) {
657
+ if (entry.includes("://"))
658
+ return entry;
659
+ const expanded = entry.startsWith("~/") ? join(homedir(), entry.slice(2)) : entry;
660
+ const absolute = isAbsolute(expanded) ? expanded : resolve(baseDir, expanded);
661
+ try {
662
+ return realpathSync(absolute);
663
+ }
664
+ catch {
665
+ return absolute;
666
+ }
667
+ }
601
668
  function ensureManagedSkillsPathConfigText(text, paths) {
602
669
  const document = parseObjectDocument(text, "OpenCode config");
603
670
  const currentPaths = readSkillsArray(document, "OpenCode config");
604
671
  const managedSkillsPath = getManagedSkillsPathReference(paths);
605
- if (currentPaths.includes(managedSkillsPath)) {
672
+ const baseDir = paths.scope === "project"
673
+ ? (paths.projectRoot ?? dirname(paths.opencodeConfigPath))
674
+ : dirname(paths.opencodeConfigPath);
675
+ const canonicalManaged = canonicalSkillsPath(managedSkillsPath, baseDir);
676
+ const seen = new Set();
677
+ const nextPaths = [];
678
+ let managedPresent = false;
679
+ for (const entry of currentPaths) {
680
+ const canonical = canonicalSkillsPath(entry, baseDir);
681
+ if (canonical === canonicalManaged) {
682
+ if (managedPresent)
683
+ continue;
684
+ managedPresent = true;
685
+ nextPaths.push(entry);
686
+ continue;
687
+ }
688
+ if (seen.has(canonical))
689
+ continue;
690
+ seen.add(canonical);
691
+ nextPaths.push(entry);
692
+ }
693
+ if (!managedPresent)
694
+ nextPaths.push(managedSkillsPath);
695
+ const unchanged = nextPaths.length === currentPaths.length &&
696
+ nextPaths.every((entry, index) => entry === currentPaths[index]);
697
+ if (unchanged)
606
698
  return text;
607
- }
608
- const nextPaths = [...currentPaths, managedSkillsPath];
609
699
  const nextText = applyEdits(text, modify(text, ["skills"], nextPaths, {
610
700
  formattingOptions: JSON_FORMAT,
611
701
  }));