@herjarsa/omo-meta-governor 0.19.7 → 0.21.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/README.md CHANGED
@@ -158,6 +158,33 @@ Enabled when `meta_governor.enabled: true` in config.
158
158
  | `respectDoneSignal` | `true` | Stop injecting after terminal signal + Oracle verified |
159
159
  | `phaseAwareDoneSignal` | `false` | **v0.15.0**: when `true`, only `<promise>PLAN-COMPLETE</promise>` latches intervention. DONE/PHASE-N-COMPLETE are per-phase hints. Recommended for multi-phase plans. |
160
160
 
161
+ ## Skill Priming (v0.20.0)
162
+
163
+ Proactive skill-selection nudge: the plugin injects **one** synthetic user message at session
164
+ start (or once implementation work begins) prompting the agent to select precise skills for the
165
+ task via the **AAS skill catalog** (`aas search_skills` / `get_skill` / `compose_stack`) and/or
166
+ the task-appropriate **superpowers** skill — before writing code. Minimal context cost: the
167
+ directive forbids enumerating the full catalog.
168
+
169
+ ```jsonc
170
+ {
171
+ "meta_governor": {
172
+ "enabled": true,
173
+ "skillPriming": {
174
+ "enabled": true,
175
+ "trigger": "sessionStart", // or "firstImplement" (default)
176
+ "router": "both" // "aas", "superpowers", or "both"
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ | Field | Default | Description |
183
+ |-------|---------|-------------|
184
+ | `enabled` | `false` | Master switch for the skill-priming nudge |
185
+ | `trigger` | `"firstImplement"` | `"sessionStart"`: first transform call of the session. `"firstImplement"`: once a write/edit-like tool is observed |
186
+ | `router` | `"both"` | Which system(s) the directive references: `"aas"`, `"superpowers"`, `"both"` |
187
+
161
188
  ### Multi-phase plans (v0.15.0)
162
189
 
163
190
  For work plans with multiple phases (e.g. Sisyphus/Prometheus work plans),
@@ -554,100 +581,169 @@ No user action required. The fix to `loadOrchestratorConfig` means **users who w
554
581
 
555
582
  This release closes the final round of gaps found by a thorough function-by-function audit. The plugin now correctly projects **all** user configuration, handles **all** circular reference cases, and fails safely on **all** missing-input scenarios.
556
583
 
557
-
558
- ## v0.19.4 — Dual-shape default export: opencode 1.18.x loader compat (patch)
559
-
560
- v0.19.3 shipped a function-only default export hoping to fix the opencode
561
- serve factory-not-invoked bug. Empirical verification (reading
562
- `~/.config/opencode/meta-governor.log`) showed it didn''t help: opencode
563
- 1.18.16 npm-package plugins still loaded the module without ever calling
564
- the factory under `opencode serve`.
565
-
566
- ### The fix
567
-
568
- `src/index.ts` now exports an object that is **both** a Plugin function
569
- **and** a PluginModule:
570
-
571
- ```ts
572
- const _plugin = createMetaGovernorPlugin()
573
- _plugin.id = "omo-meta-governor"
574
- _plugin.server = _plugin
575
- export default _plugin
576
- ```
577
-
578
- Bundled as `var u4=IN(); u4.id="omo-meta-governor"; u4.server=u4; export{...JX=u4...}`.
579
- Whichever path opencode picks (`default(input, options)` or
580
- `default.server(input, options)`), the same callable fires and the hooks
581
- register.
582
-
583
- ### Verification
584
-
585
- After restart of OpenChamber, log shows:
586
- - factory_invoked events (was 0 with v0.19.3)
587
- - config_loaded events (was 0 with v0.19.3)
588
- - intervention / violations / persist calls firing normally
589
-
590
- ### Test & build status
591
-
592
- - 4/4 new tests in `src/index.test.ts` lock down the dual-shape contract.
593
- - `bun run typecheck` clean.
594
- - `bun build.ts` clean (0.35 MB dist).
595
- - `npm publish` to registry OK.
596
-
597
- ### Migration
598
-
599
- No user action required. If you previously set
600
- `intervention.persistToSession: false` in your config, that toggle is
601
- still respected.
602
-
603
- ---
604
-
605
- ## v0.19.3 — opencode serve factory invocation + persistSessionMessage wiring
606
-
607
- This release closes the persistSessionMessage wiring arc (memory #999) and
608
- loads config from three sources automatically (CLI > project > user).
609
- The `index.ts` `export default` change was incomplete (see v0.19.4 for
610
- the proper dual-shape fix that resolves opencode serve invocation).
611
-
612
- ### Highlights
613
-
614
- - **index.ts**: switched `export default` to call `createMetaGovernorPlugin()`
615
- directly (function path), abandoning the `PluginModule` wrapper. Was the
616
- wrong shape — see v0.19.4 for the actual fix.
617
- - **plugin.ts**: factory now calls `loadMetaGovernorConfig({ projectDir })` so
618
- config from `.opencode/omo-meta-governor.jsonc` and
619
- `~/.config/opencode/omo-meta-governor.jsonc` flows in automatically.
620
- - **session-bridge.ts**: `persistSessionMessage()` — fire-and-forget
621
- `session.prompt()` helper that records intervention text as a REAL session
622
- message (visible in TUI and session DB).
623
- - **types.ts + config.ts + orchestrator.ts**: `persistToSession` defaults to
624
- true on `InterventionConfig`. Helps users running OpenChamber actually
625
- SEE interventions in their TUI.
626
- - **tests**: 16 `createMetaGovernorPlugin()` calls in plugin/v172/v173-gap-d
627
- tests now pass `graphSync: { enabled: false, autoInstall: false }`
628
- because user config enables `autoInstall` by default (memory #989).
629
-
630
- ### Test & build status
631
-
632
- - ~437/437 tests pass (per-file, `graphsink-fix.ts` skipped per known Bun
633
- Windows integer-overflow crash).
634
- - `bun run typecheck` clean.
635
- - `bun build.ts` clean (0.35 MB dist).
636
- - `npm publish` to registry OK.
637
-
638
- ### Migration
639
-
640
- No user action required.
641
-
642
- ---
643
-
644
- ## v0.19.0–v0.19.2 — Internal persistSessionMessage wiring arc (memory #999)
645
-
646
- Three iterations on the persistSessionMessage wiring arc. Each iteration
647
- added call sites and tightened the test coverage, but the fix was lost in
648
- stashes and merges until v0.19.3 finally shipped a working version of
649
- the helper. See v0.19.3 for the user-facing release notes; v0.19.4
650
- supersedes with the correct dual-shape export.
584
+
585
+ ## v0.19.4 — Dual-shape default export: opencode 1.18.x loader compat (patch)
586
+
587
+ v0.19.3 shipped a function-only default export hoping to fix the opencode
588
+ serve factory-not-invoked bug. Empirical verification (reading
589
+ `~/.config/opencode/meta-governor.log`) showed it didn''t help: opencode
590
+ 1.18.16 npm-package plugins still loaded the module without ever calling
591
+ the factory under `opencode serve`.
592
+
593
+ ### The fix
594
+
595
+ `src/index.ts` now exports an object that is **both** a Plugin function
596
+ **and** a PluginModule:
597
+
598
+ ```ts
599
+ const _plugin = createMetaGovernorPlugin()
600
+ _plugin.id = "omo-meta-governor"
601
+ _plugin.server = _plugin
602
+ export default _plugin
603
+ ```
604
+
605
+ Bundled as `var u4=IN(); u4.id="omo-meta-governor"; u4.server=u4; export{...JX=u4...}`.
606
+ Whichever path opencode picks (`default(input, options)` or
607
+ `default.server(input, options)`), the same callable fires and the hooks
608
+ register.
609
+
610
+ ### Verification
611
+
612
+ After restart of OpenChamber, log shows:
613
+ - factory_invoked events (was 0 with v0.19.3)
614
+ - config_loaded events (was 0 with v0.19.3)
615
+ - intervention / violations / persist calls firing normally
616
+
617
+ ### Test & build status
618
+
619
+ - 4/4 new tests in `src/index.test.ts` lock down the dual-shape contract.
620
+ - `bun run typecheck` clean.
621
+ - `bun build.ts` clean (0.35 MB dist).
622
+ - `npm publish` to registry OK.
623
+
624
+ ### Migration
625
+
626
+ No user action required. If you previously set
627
+ `intervention.persistToSession: false` in your config, that toggle is
628
+ still respected.
629
+
630
+ ---
631
+
632
+ ## v0.19.7 — Fix npm-published package.json: restore `import` condition in `exports` (patch)
633
+
634
+ v0.19.6 shipped a single callable default export with the dual-shape contract (memory #1126) but the published tarball's `package.json` had the `exports` map regenerated to contain only the `types` condition — no `import`/`default`/`require` runtime condition. Under opencode 1.18.16's plugin loader, that caused the npm-package plugin to load the module (module scope ran, `MetaGovernor plugin loaded` logged) but **never invoke the factory** (`factory_invoked` was 0). v0.19.4 had empirically verified the dual-shape fix for `opencode serve`; v0.19.6 on `opencode run` with the same dual-shape bundle in the npm cache was silently broken for the same reason.
635
+
636
+ ### The bug
637
+
638
+ `package.json` in the v0.19.6 tarball (read from the installed package in `~/.cache/opencode/packages/@herjarsa/omo-meta-governor@latest/...`):
639
+
640
+ ```json
641
+ "exports": {
642
+ ".": { "types": "./dist/index.d.ts" },
643
+ "./lib": { "types": "./dist/lib.d.ts" }
644
+ }
645
+ ```
646
+
647
+ vs. the repo's source `package.json` (correct, with `import` condition for runtime resolution):
648
+
649
+ ```json
650
+ "exports": {
651
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
652
+ "./lib": { "types": "./dist/lib.d.ts", "import": "./dist/lib.js" }
653
+ }
654
+ ```
655
+
656
+ The published manifest lost the `import` condition (and `peerDependencies: {"@opencode-ai/plugin": ">=1.0.0"}`, `publishConfig`, `repository.url`, `devDependencies.typescript`, `files` README entry, `scripts.test`). When opencode's plugin installer resolves the entry via `exports`, only `"types"` is offered — no runtime condition matches → the loader imports the bundle by `main` fallback but the export contract that uk() (`opencode.util.createPlugin`) inspects isn't satisfied, so the plugin is loaded but never invoked.
657
+
658
+ ### How the bug was reproduced
659
+
660
+ Cheap-shape probes (`@herjarsa/omg-shape-probe2` … `probe7`) with byte-identical Bun-bundles from `dist/index.js` were published to npm and tested under `opencode run` with XDG-isolated config. All probes with `exports."."` containing `"import"` or `"default"` invoked the factory. The probe replicating the exact published shape (types-only exports) failed to invoke. Bundle SHA-256 identical between probes and the real published package:
661
+ ```
662
+ E737C676FCC74B6CBA771616058BC5620C1F0364089B1B8626246E96FF02ED69
663
+ ```
664
+
665
+ ### The fix
666
+
667
+ No source/bundle changes — the bundle was correct all along. The malformed published `package.json` was restored from the repo (`git show HEAD:package.json` has the canonical full exports map with `import`) and only the version was bumped to `0.19.7`. Rebuild with `bun build.ts` (bakes version into the bundle), published, verified.
668
+
669
+ ### Verification
670
+
671
+ XDG-isolated opencode run (`opencode run` with custom config pointing at `@herjarsa/omo-meta-governor@latest`):
672
+
673
+ - v0.19.6 (cache populated): log shows `MetaGovernor plugin loaded` only — **no `factory_invoked`**, intervention never runs.
674
+ - v0.19.7 (cache cleared, reinstalled): log shows full chain:
675
+ ```
676
+ [meta-governor] MetaGovernor plugin loaded
677
+ [meta-governor] factory_invoked
678
+ [meta-governor] SessionBridge: OpenCode client hydrated — session.prompt() available
679
+ [meta-governor] config_loaded
680
+ ```
681
+
682
+ Updated `~/.cache/opencode/packages/@herjarsa/omo-meta-governor@latest/node_modules/@herjarsa/omo-meta-governor/package.json` now reads `exports."."` = `{ types: "./dist/index.d.ts", import: "./dist/index.js" }` and `peerDependencies` = `{ "@opencode-ai/plugin": ">=1.0.0" }`.
683
+
684
+ ### Test & build status
685
+
686
+ - `bun run typecheck` clean.
687
+ - `bun build.ts` clean (0.34 MB dist, version 0.19.7 baked in).
688
+ - `npm publish` to registry OK.
689
+ - Empirical harness verification: factory_invoked + config_logged restored.
690
+
691
+ ### Migration
692
+
693
+ No user action required. If you were running v0.19.6 and the plugin appeared silent (no interventions, no metrics), delete your opencode cache:
694
+ ```bash
695
+ rm -rf ~/.cache/opencode/packages/@herjarsa/omo-meta-governor@latest
696
+ ```
697
+ Then restart opencode — it will reinstall v0.19.7 from the registry and the pipeline will fire normally.
698
+
699
+ ---
700
+
701
+ ## v0.19.3 — opencode serve factory invocation + persistSessionMessage wiring
702
+
703
+ This release closes the persistSessionMessage wiring arc (memory #999) and
704
+ loads config from three sources automatically (CLI > project > user).
705
+ The `index.ts` `export default` change was incomplete (see v0.19.4 for
706
+ the proper dual-shape fix that resolves opencode serve invocation).
707
+
708
+ ### Highlights
709
+
710
+ - **index.ts**: switched `export default` to call `createMetaGovernorPlugin()`
711
+ directly (function path), abandoning the `PluginModule` wrapper. Was the
712
+ wrong shape — see v0.19.4 for the actual fix.
713
+ - **plugin.ts**: factory now calls `loadMetaGovernorConfig({ projectDir })` so
714
+ config from `.opencode/omo-meta-governor.jsonc` and
715
+ `~/.config/opencode/omo-meta-governor.jsonc` flows in automatically.
716
+ - **session-bridge.ts**: `persistSessionMessage()` — fire-and-forget
717
+ `session.prompt()` helper that records intervention text as a REAL session
718
+ message (visible in TUI and session DB).
719
+ - **types.ts + config.ts + orchestrator.ts**: `persistToSession` defaults to
720
+ true on `InterventionConfig`. Helps users running OpenChamber actually
721
+ SEE interventions in their TUI.
722
+ - **tests**: 16 `createMetaGovernorPlugin()` calls in plugin/v172/v173-gap-d
723
+ tests now pass `graphSync: { enabled: false, autoInstall: false }`
724
+ because user config enables `autoInstall` by default (memory #989).
725
+
726
+ ### Test & build status
727
+
728
+ - ~437/437 tests pass (per-file, `graphsink-fix.ts` skipped per known Bun
729
+ Windows integer-overflow crash).
730
+ - `bun run typecheck` clean.
731
+ - `bun build.ts` clean (0.35 MB dist).
732
+ - `npm publish` to registry OK.
733
+
734
+ ### Migration
735
+
736
+ No user action required.
737
+
738
+ ---
739
+
740
+ ## v0.19.0–v0.19.2 — Internal persistSessionMessage wiring arc (memory #999)
741
+
742
+ Three iterations on the persistSessionMessage wiring arc. Each iteration
743
+ added call sites and tightened the test coverage, but the fix was lost in
744
+ stashes and merges until v0.19.3 finally shipped a working version of
745
+ the helper. See v0.19.3 for the user-facing release notes; v0.19.4
746
+ supersedes with the correct dual-shape export.
651
747
  ## Auto-upgrade (v0.12.0)
652
748
 
653
749
  On plugin load, queries npm/pip registries to check whether newer versions
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ModelOverrideConfig, OrchestratorConfig } from "./types";
1
+ import type { ModelOverrideConfig, OrchestratorConfig, PostWaveConfig, SkillPrimingRouter, SkillPrimingTrigger } from "./types";
2
2
  import type { ConfigFileSources } from "./config-file";
3
3
  /**
4
4
  * MetaGovernor config schema exposed to users.
@@ -85,6 +85,14 @@ export interface MetaGovernorPluginConfig {
85
85
  autoInstall?: boolean;
86
86
  installTimeoutMs?: number;
87
87
  };
88
+ /** Skill priming config (v0.20.0): proactive skill-selection nudge. */
89
+ skillPriming?: {
90
+ enabled?: boolean;
91
+ trigger?: SkillPrimingTrigger;
92
+ router?: SkillPrimingRouter;
93
+ };
94
+ /** Post-wave workflow gate (v0.21.0): landing directives after Oracle-approved waves. */
95
+ postWave?: PostWaveConfig;
88
96
  }
89
97
  /**
90
98
  * Project the full MetaGovernorPluginConfig into OrchestratorConfig.
@@ -14,6 +14,7 @@
14
14
  * - Never throws — all errors are silently caught and logged
15
15
  * - Tracks session init once per project via an in-memory Set
16
16
  */
17
+ import { execSync } from "node:child_process";
17
18
  export interface GraphSyncConfig {
18
19
  /** Enable auto-initialization. Default: true */
19
20
  enabled: boolean;
@@ -35,6 +36,10 @@ export interface GraphSyncConfig {
35
36
  autoUpgrade?: boolean;
36
37
  /** v0.12.0: Min ms between registry queries for version check. Default 24h. */
37
38
  upgradeCheckTtlMs?: number;
39
+ /** v0.21.0: test-only DI seam — replaces execSync so availability probes
40
+ * never spawn real npx/pip/graphify in hermetic tests (CI Windows: the
41
+ * npx download + 4 fallbacks exceeded the 30s test timeout). */
42
+ runner?: typeof execSync;
38
43
  }
39
44
  export type InstallCode = "codegraph-installed" | "codegraph-install-failed" | "codegraph-install-skipped" | "graphify-installed" | "graphify-install-failed" | "graphify-install-skipped";
40
45
  /**
@@ -73,6 +78,36 @@ export interface ToolAvailability {
73
78
  /** Whether graphify-out/ directory already exists in the project */
74
79
  graphifyIndexExists: boolean;
75
80
  }
81
+ /**
82
+ * Check which graph tools are available and whether indexes already exist.
83
+ */
84
+ /**
85
+ * Check which graph tools are available and whether indexes already exist.
86
+ *
87
+ * Index existence requires the marker file, not just the directory:
88
+ * - codegraph: `.codegraph/codegraph.db`
89
+ * - graphify: `graphify-out/graph.json`
90
+ * An empty dir created by a failed init must NOT count as initialized.
91
+ */
92
+ export declare function checkToolAvailability(projectDir: string, runner?: typeof execSync): Promise<ToolAvailability>;
93
+ /**
94
+ * Initialize codegraph in the project. Returns true only when the init
95
+ * command exited successfully (no throw). Does NOT pre-create the dir —
96
+ * a failed init must not leave an empty dir that later counts as
97
+ * "already exists".
98
+ */
99
+ export declare function initCodegraph(projectDir: string, timeoutMs?: number, runner?: typeof execSync): Promise<boolean>;
100
+ /**
101
+ * Initialize graphify in the project. Returns true only when one of the
102
+ * candidate commands exited successfully.
103
+ *
104
+ * v0.21.0 candidate order: `graphify` binary first (the real CLI installed
105
+ * by the pip package `graphifyy` on Windows), then `python -m graphify`
106
+ * (real interpreter — `python3` may be a WindowsApps stub), then
107
+ * `python3 -m graphify`. The `graphifyy` binary is NOT attempted — it does
108
+ * not exist; the package's binary is named `graphify`.
109
+ */
110
+ export declare function initGraphify(projectDir: string, timeoutMs?: number, runner?: typeof execSync): Promise<boolean>;
76
111
  /**
77
112
  * Stop all active watch processes for a project.
78
113
  */
@@ -89,7 +124,7 @@ export interface GraphSyncResult {
89
124
  /** Whether this project was already initialized this session */
90
125
  alreadyInitialized: boolean;
91
126
  }
92
- export type GraphSyncCode = "codegraph-initialized" | "codegraph-already-exists" | "codegraph-unavailable" | "codegraph-install-failed" | "codegraph-install-skipped" | "graphify-initialized" | "graphify-already-exists" | "graphify-unavailable" | "graphify-install-failed" | "graphify-install-skipped" | "watch-started-codegraph" | "watch-started-graphify" | "disabled" | "error" | "graphify-hook-installed" | "codegraph-upgraded" | "graphify-upgraded" | "upgrade-check-skipped";
127
+ export type GraphSyncCode = "codegraph-initialized" | "codegraph-init-failed" | "codegraph-already-exists" | "codegraph-unavailable" | "codegraph-install-failed" | "codegraph-install-skipped" | "graphify-initialized" | "graphify-init-failed" | "graphify-already-exists" | "graphify-unavailable" | "graphify-install-failed" | "graphify-install-skipped" | "watch-started-codegraph" | "watch-started-graphify" | "disabled" | "error" | "graphify-hook-installed" | "codegraph-upgraded" | "graphify-upgraded" | "upgrade-check-skipped";
93
128
  /**
94
129
  * Run the graphSync pipeline. Best-effort, never throws.
95
130
  */
@@ -110,7 +145,7 @@ export declare function isGitCommitCommand(command: string | undefined | null):
110
145
  *
111
146
  * Best-effort: never throws, returns a structured result instead.
112
147
  */
113
- export declare function triggerReindex(projectDir: string): Promise<GraphSyncResult>;
148
+ export declare function triggerReindex(projectDir: string, runner?: typeof execSync): Promise<GraphSyncResult>;
114
149
  /**
115
150
  * v0.11.0: Check whether the project's `.git/hooks/post-commit` is the
116
151
  * graphify-managed one. Reads the file and looks for the `graphify-hook-start`
@@ -128,7 +163,7 @@ export declare function isGraphifyHookInstalled(projectDir: string): Promise<boo
128
163
  *
129
164
  * Best-effort: never throws, returns a structured result.
130
165
  */
131
- export declare function triggerCodegraphSync(projectDir: string): Promise<GraphSyncResult>;
166
+ export declare function triggerCodegraphSync(projectDir: string, runner?: typeof execSync): Promise<GraphSyncResult>;
132
167
  import type { LogLevel } from "./file-logger";
133
168
  export declare function logToFile(level: LogLevel, msg: string): Promise<void>;
134
169
  /**