@jmtrin/opencode-kevin 0.7.0 → 0.9.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 (70) hide show
  1. package/README.md +254 -12
  2. package/dist/migrations/009_v08_team.sql +100 -0
  3. package/dist/migrations/010_v09_native.sql +78 -0
  4. package/dist/plugin/ArtifactWriter.d.ts +28 -0
  5. package/dist/plugin/ArtifactWriter.js +35 -2
  6. package/dist/plugin/ArtifactWriter.js.map +1 -1
  7. package/dist/plugin/ContextInjector.d.ts +9 -0
  8. package/dist/plugin/ContextInjector.js +14 -3
  9. package/dist/plugin/ContextInjector.js.map +1 -1
  10. package/dist/plugin/Curator.d.ts +22 -2
  11. package/dist/plugin/Curator.js +56 -14
  12. package/dist/plugin/Curator.js.map +1 -1
  13. package/dist/plugin/HookLiveness.d.ts +81 -0
  14. package/dist/plugin/HookLiveness.js +324 -0
  15. package/dist/plugin/HookLiveness.js.map +1 -0
  16. package/dist/plugin/InjectionLedger.d.ts +6 -0
  17. package/dist/plugin/InjectionLedger.js +6 -0
  18. package/dist/plugin/InjectionLedger.js.map +1 -1
  19. package/dist/plugin/Materializer.d.ts +29 -5
  20. package/dist/plugin/Materializer.js +48 -16
  21. package/dist/plugin/Materializer.js.map +1 -1
  22. package/dist/plugin/MemoryService.d.ts +34 -5
  23. package/dist/plugin/MemoryService.js +215 -7
  24. package/dist/plugin/MemoryService.js.map +1 -1
  25. package/dist/plugin/Migrate.d.ts +1 -0
  26. package/dist/plugin/Migrate.js +74 -3
  27. package/dist/plugin/Migrate.js.map +1 -1
  28. package/dist/plugin/RepoIdentity.d.ts +124 -0
  29. package/dist/plugin/RepoIdentity.js +301 -0
  30. package/dist/plugin/RepoIdentity.js.map +1 -0
  31. package/dist/plugin/Retrospective.js +18 -0
  32. package/dist/plugin/Retrospective.js.map +1 -1
  33. package/dist/plugin/SharedLayer.d.ts +159 -0
  34. package/dist/plugin/SharedLayer.js +463 -0
  35. package/dist/plugin/SharedLayer.js.map +1 -0
  36. package/dist/plugin/host.d.ts +70 -0
  37. package/dist/plugin/host.js +251 -0
  38. package/dist/plugin/host.js.map +1 -0
  39. package/dist/plugin/index.d.ts +30 -1
  40. package/dist/plugin/index.js +582 -12
  41. package/dist/plugin/index.js.map +1 -1
  42. package/dist/plugin/kevin_approve.js +7 -4
  43. package/dist/plugin/kevin_approve.js.map +1 -1
  44. package/dist/plugin/kevin_audit.d.ts +48 -1
  45. package/dist/plugin/kevin_audit.js +179 -3
  46. package/dist/plugin/kevin_audit.js.map +1 -1
  47. package/dist/plugin/kevin_doctor.d.ts +57 -0
  48. package/dist/plugin/kevin_doctor.js +168 -0
  49. package/dist/plugin/kevin_doctor.js.map +1 -0
  50. package/dist/plugin/kevin_native.d.ts +29 -0
  51. package/dist/plugin/kevin_native.js +80 -0
  52. package/dist/plugin/kevin_native.js.map +1 -0
  53. package/dist/plugin/metrics.d.ts +1 -1
  54. package/dist/plugin/metrics.js +9 -0
  55. package/dist/plugin/metrics.js.map +1 -1
  56. package/dist/plugin/native.d.ts +92 -0
  57. package/dist/plugin/native.js +191 -0
  58. package/dist/plugin/native.js.map +1 -0
  59. package/dist/plugin/okf-export.d.ts +2 -2
  60. package/dist/plugin/okf-export.js +15 -7
  61. package/dist/plugin/okf-export.js.map +1 -1
  62. package/dist/plugin/okf.d.ts +107 -0
  63. package/dist/plugin/okf.js +304 -0
  64. package/dist/plugin/okf.js.map +1 -0
  65. package/dist/plugin/replay-types.d.ts +29 -287
  66. package/dist/plugin/replay-types.js +145 -53
  67. package/dist/plugin/replay-types.js.map +1 -1
  68. package/migrations/009_v08_team.sql +100 -0
  69. package/migrations/010_v09_native.sql +78 -0
  70. package/package.json +2 -3
@@ -0,0 +1,168 @@
1
+ import { existsSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { reduceVerdict, } from "./HookLiveness.js";
4
+ import { HOOK_NAMES } from "./Migrate.js";
5
+ /** Dead first, then unknown, then live — the failure is the first thing
6
+ * on screen. Ties break on the canonical hook name. */
7
+ const STATE_ORDER = {
8
+ dead: 0,
9
+ unknown: 1,
10
+ live: 2,
11
+ };
12
+ /** The hooks block is pure SQL over the persisted hook_liveness table:
13
+ * the dead flag is materialized at expect() time (K9-010) so flush() can
14
+ * persist dead_since even when report() never runs — this block reads
15
+ * that persisted state, independent of any live HookLiveness object. */
16
+ function hooksBlock(store) {
17
+ let rows = [];
18
+ try {
19
+ rows = store
20
+ .prepare("SELECT hook, experimental, fire_count, expected_count, dead_since FROM hook_liveness")
21
+ .all();
22
+ }
23
+ catch {
24
+ return { hooks: [], partial: true };
25
+ }
26
+ // Only hooks the plugin knows about are reported; a foreign row (from
27
+ // a future release) is skipped, mirroring HookLiveness.loadFromDb.
28
+ const reports = rows
29
+ .filter((row) => HOOK_NAMES.includes(row.hook))
30
+ .map((row) => ({
31
+ hook: row.hook,
32
+ experimental: row.experimental === 1,
33
+ state: row.fire_count > 0
34
+ ? "live"
35
+ : row.dead_since !== null
36
+ ? "dead"
37
+ : "unknown",
38
+ firstSeenAt: null,
39
+ lastSeenAt: null,
40
+ fireCount: row.fire_count,
41
+ expectedCount: row.expected_count,
42
+ deadSince: row.dead_since,
43
+ }));
44
+ reports.sort((a, b) => STATE_ORDER[a.state] - STATE_ORDER[b.state] ||
45
+ a.hook.localeCompare(b.hook));
46
+ const hooks = reports.map((r) => ({
47
+ hook: r.hook,
48
+ experimental: r.experimental,
49
+ state: r.state,
50
+ fire_count: r.fireCount,
51
+ expected_count: r.expectedCount,
52
+ ...(r.deadSince !== null ? { since: r.deadSince } : {}),
53
+ }));
54
+ return { hooks, partial: false };
55
+ }
56
+ /**
57
+ * Count resolved zod copies under `cwd`'s dependency tree. The expected
58
+ * value after K9-005 is 1; a second copy is exactly the regression this
59
+ * field exists to catch. On any walk failure the count is `null` and the
60
+ * note says so — never a guess.
61
+ */
62
+ export function countZodCopies(cwd) {
63
+ try {
64
+ if (!existsSync(cwd)) {
65
+ return { copies: null, note: "zod resolution walk failed" };
66
+ }
67
+ const seen = new Set();
68
+ const stack = [cwd];
69
+ let copies = 0;
70
+ // Bounded walk: node_modules is normally shallow; nested copies
71
+ // (node_modules/<pkg>/node_modules/zod) sit within a few levels.
72
+ for (let depth = 0; stack.length > 0 && depth < 8; depth += 1) {
73
+ const next = [];
74
+ for (const dir of stack) {
75
+ const nm = join(dir, "node_modules");
76
+ if (!existsSync(nm))
77
+ continue;
78
+ let entries;
79
+ try {
80
+ entries = readdirSync(nm, { withFileTypes: true });
81
+ }
82
+ catch {
83
+ continue;
84
+ }
85
+ for (const entry of entries) {
86
+ if (!entry.isDirectory())
87
+ continue;
88
+ if (entry.name === "zod") {
89
+ const pkg = join(nm, "zod", "package.json");
90
+ if (existsSync(pkg) && !seen.has(pkg)) {
91
+ seen.add(pkg);
92
+ copies += 1;
93
+ }
94
+ }
95
+ else if (entry.name !== ".bin" && entry.name !== ".cache") {
96
+ next.push(join(nm, entry.name));
97
+ }
98
+ }
99
+ }
100
+ stack.length = 0;
101
+ stack.push(...next);
102
+ }
103
+ return { copies };
104
+ }
105
+ catch {
106
+ return { copies: null, note: "zod resolution walk failed" };
107
+ }
108
+ }
109
+ function lastRegistration(store, surface) {
110
+ try {
111
+ const row = store
112
+ .prepare("SELECT surface, registered, verified FROM native_registrations WHERE surface = ? ORDER BY attached_at DESC, id DESC LIMIT 1")
113
+ .get(surface);
114
+ if (!row)
115
+ return { registered: false, verified: false };
116
+ return { registered: row.registered === 1, verified: row.verified === 1 };
117
+ }
118
+ catch {
119
+ return { registered: false, verified: false };
120
+ }
121
+ }
122
+ export function buildDoctor(store, host, settings, options = {}) {
123
+ // The host block comes from the frozen probe result captured at
124
+ // construction — kevin_doctor never re-probes (K9-004: probe once,
125
+ // freeze, reuse).
126
+ const hooks = hooksBlock(store);
127
+ const verdict = reduceVerdict(hooks.hooks.map((h) => ({
128
+ hook: h.hook,
129
+ experimental: h.experimental,
130
+ state: h.state,
131
+ firstSeenAt: null,
132
+ lastSeenAt: null,
133
+ fireCount: h.fire_count,
134
+ expectedCount: h.expected_count,
135
+ deadSince: h.since ?? null,
136
+ })));
137
+ const zod = countZodCopies(options.zodRoot ?? process.cwd());
138
+ const enabled = settings.getSetting("native_registration_enabled", "0") === "1";
139
+ return {
140
+ host: {
141
+ plugin_version: host.pluginVersion,
142
+ flavour: host.flavour,
143
+ shell_available: host.hasShell,
144
+ v2: { skill: host.v2.skill, reference: host.v2.reference },
145
+ },
146
+ hooks: hooks.hooks,
147
+ dependencies: {
148
+ declared: ["@opencode-ai/plugin"],
149
+ zod_copies: zod.copies,
150
+ ...(zod.note !== undefined ? { note: zod.note } : {}),
151
+ },
152
+ native: {
153
+ enabled,
154
+ registered: {
155
+ skill: lastRegistration(store, "skill").registered,
156
+ reference: lastRegistration(store, "reference").registered,
157
+ },
158
+ verified: {
159
+ skill: lastRegistration(store, "skill").verified,
160
+ reference: lastRegistration(store, "reference").verified,
161
+ },
162
+ },
163
+ verdict: verdict.verdict,
164
+ reason: verdict.reason,
165
+ partial: hooks.partial,
166
+ };
167
+ }
168
+ //# sourceMappingURL=kevin_doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kevin_doctor.js","sourceRoot":"","sources":["../../plugin/kevin_doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAGN,aAAa,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmD1C;uDACuD;AACvD,MAAM,WAAW,GAAwC;IACxD,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;CACP,CAAC;AAUF;;;wEAGwE;AACxE,SAAS,UAAU,CAAC,KAAY;IAC/B,IAAI,IAAI,GAAkB,EAAE,CAAC;IAC7B,IAAI,CAAC;QACJ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IAAI,CAAC,EAAE,CAAC,SAAS,EAAE;SAC1D;QACD,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,YAAY,EAAE;YACb,QAAQ,EAAE,CAAC,qBAAqB,CAAC;YACjC,UAAU,EAAE,GAAG,CAAC,MAAM;YACtB,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrD;QACD,MAAM,EAAE;YACP,OAAO;YACP,UAAU,EAAE;gBACX,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,UAAU;gBAClD,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,UAAU;aAC1D;YACD,QAAQ,EAAE;gBACT,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ;gBAChD,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,QAAQ;aACxD;SACD;QACD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;KACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Store } from "./Store.js";
2
+ import type { HostSurface } from "./host.js";
3
+ import type { SettingsReader } from "./native.js";
4
+ export type NativeAction = "show" | "enable" | "disable";
5
+ export interface NativeRegistrationRow {
6
+ readonly surface: "skill" | "reference";
7
+ readonly registered: boolean;
8
+ readonly verified: boolean;
9
+ readonly attached_at: string | null;
10
+ }
11
+ export interface NativeReport {
12
+ readonly action: NativeAction;
13
+ /** The setting value: '1' or '0' as stored (TEXT). */
14
+ readonly value: "1" | "0";
15
+ /** Whether registration would be effective on THIS host (v2 subpath present). */
16
+ readonly effective: boolean;
17
+ /** Present when `effective` is false: why the intent is inert. */
18
+ readonly reason?: string;
19
+ /** The latest persisted outcome per surface (show only). */
20
+ readonly registrations?: NativeRegistrationRow[];
21
+ /** The restart note (enable/disable only). */
22
+ readonly note?: string;
23
+ }
24
+ export interface NativeDeps {
25
+ readonly host: HostSurface;
26
+ readonly store: Store;
27
+ readonly settings: SettingsReader;
28
+ }
29
+ export declare function handleNative(action: NativeAction, deps: NativeDeps): NativeReport;
@@ -0,0 +1,80 @@
1
+ // v0.9.0 (K9-019 / plan §5.5, D9-12) — `kevin_native`: inspect and toggle
2
+ // `native_registration_enabled`.
3
+ //
4
+ // Pure in the sense that matters: `show` reads only; `enable`/`disable`
5
+ // write `kevin_settings` and nothing else. Neither action re-attaches —
6
+ // the probe is frozen for the process lifetime (D9-12) — and the response
7
+ // says so explicitly, naming a restart as the requirement. `enable` on a
8
+ // host without the v2 subpath succeeds and reports the registration as
9
+ // inert: the setting is a statement of intent that becomes effective when
10
+ // the host catches up, and refusing would make it untestable on the
11
+ // majority of installations.
12
+ //
13
+ // The stored value is TEXT `'1'` or `'0'` — never a boolean, never
14
+ // `'true'` (kevin_settings.value is TEXT; compare with `=== "1"`).
15
+ function lastRows(store) {
16
+ try {
17
+ return store
18
+ .prepare(`SELECT surface, registered, verified, attached_at
19
+ FROM native_registrations
20
+ ORDER BY attached_at DESC, id DESC
21
+ LIMIT 20`)
22
+ .all()
23
+ .map((row) => {
24
+ const r = row;
25
+ return {
26
+ surface: r.surface,
27
+ registered: r.registered === 1,
28
+ verified: r.verified === 1,
29
+ attached_at: r.attached_at,
30
+ };
31
+ });
32
+ }
33
+ catch {
34
+ // pre-010 database: the table does not exist yet — no rows to
35
+ // report, and that is the truth.
36
+ return [];
37
+ }
38
+ }
39
+ /** v0.9.0 (K9-019 / plan §5.5, D9-12) — the pure decision: the probe is
40
+ * frozen for the process lifetime, so "effective" is derived from the
41
+ * resolved host surface, never from a fresh probe call. */
42
+ function effectiveOn(host) {
43
+ return host.v2.skill || host.v2.reference;
44
+ }
45
+ export function handleNative(action, deps) {
46
+ const current = deps.settings.getSetting("native_registration_enabled", "0");
47
+ const value = current === "1" ? "1" : "0";
48
+ if (action === "show") {
49
+ const report = {
50
+ action,
51
+ value,
52
+ effective: effectiveOn(deps.host),
53
+ registrations: lastRows(deps.store),
54
+ ...(effectiveOn(deps.host)
55
+ ? {}
56
+ : {
57
+ reason: "v2 subpath absent from the resolved host package — registration would be inert",
58
+ }),
59
+ };
60
+ return report;
61
+ }
62
+ const next = action === "enable" ? "1" : "0";
63
+ deps.store
64
+ .prepare(`INSERT INTO kevin_settings (key, value) VALUES (?, ?)
65
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value`)
66
+ .run("native_registration_enabled", next);
67
+ const report = {
68
+ action,
69
+ value: next,
70
+ effective: effectiveOn(deps.host),
71
+ note: "the probe is frozen for the process lifetime — restart the host for the change to take effect",
72
+ ...(effectiveOn(deps.host)
73
+ ? {}
74
+ : {
75
+ reason: "v2 subpath absent from the resolved host package — registration would be inert",
76
+ }),
77
+ };
78
+ return report;
79
+ }
80
+ //# sourceMappingURL=kevin_native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kevin_native.js","sourceRoot":"","sources":["../../plugin/kevin_native.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iCAAiC;AACjC,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,oEAAoE;AACpE,6BAA6B;AAC7B,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AAmCnE,SAAS,QAAQ,CAAC,KAAY;IAC7B,IAAI,CAAC;QACJ,OAAO,KAAK;aACV,OAAO,CACP;;;cAGU,CACV;aACA,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,MAAM,CAAC,GAAG,GAKT,CAAC;YACF,OAAO;gBACN,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,UAAU,EAAE,CAAC,CAAC,UAAU,KAAK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;QAC5B,MAAM;QACN,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,+FAA+F;QACrG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;YACzB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACA,MAAM,EACL,gFAAgF;aACjF,CAAC;KACJ,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -6,7 +6,7 @@ import type { Store } from "./Store.js";
6
6
  * underlying table is empty (e.g., before 003 is applied, on a fresh
7
7
  * :memory: test DB, or after a manual wipe).
8
8
  */
9
- export declare const METRIC_KEYS: readonly ["tokens_injected_pre_prompt", "tokens_injected_compacting", "reflections_throttled", "duplicate_suppressions", "tool_calls_deduped", "patterns_mined", "patterns_causal", "causal_links", "memories_superseded", "injections_total", "injections_effective", "injections_ineffective", "patterns_promoted_new", "injections_inconclusive", "injections_blocked_seen", "injections_blocked_weak", "injections_blocked_recurrence", "injections_blocked_stale", "injections_blocked_ignored", "feedback_positive_total", "feedback_negative_total", "memories_archived", "proposals_created", "proposals_approved", "proposals_rejected", "artifact_writes_total", "artifact_writes_noop", "injections_blocked_confidence", "repo_facts_scanned", "memories_contradicted", "conventions_mined", "conflicts_detected", "error_lessons_suppressed"];
9
+ export declare const METRIC_KEYS: readonly ["tokens_injected_pre_prompt", "tokens_injected_compacting", "reflections_throttled", "duplicate_suppressions", "tool_calls_deduped", "patterns_mined", "patterns_causal", "causal_links", "memories_superseded", "injections_total", "injections_effective", "injections_ineffective", "patterns_promoted_new", "injections_inconclusive", "injections_blocked_seen", "injections_blocked_weak", "injections_blocked_recurrence", "injections_blocked_stale", "injections_blocked_ignored", "feedback_positive_total", "feedback_negative_total", "memories_archived", "proposals_created", "proposals_approved", "proposals_rejected", "artifact_writes_total", "artifact_writes_noop", "injections_blocked_confidence", "repo_facts_scanned", "memories_contradicted", "conventions_mined", "conflicts_detected", "error_lessons_suppressed", "shared_entries_total", "shared_entries_imported", "shared_entries_exported", "okf_merge_folds", "rekey_events", "injections_from_shared"];
10
10
  export type MetricKey = (typeof METRIC_KEYS)[number];
11
11
  /**
12
12
  * Cheap token estimate used when bumping the `tokens_injected_*` counters.
@@ -48,6 +48,15 @@ export const METRIC_KEYS = [
48
48
  "conventions_mined",
49
49
  "conflicts_detected",
50
50
  "error_lessons_suppressed",
51
+ // v0.8.0 (K8-003 / plan §8.3) — order matches migration 009's seed block.
52
+ // These are the Team counters. shared_entries_total is re-derived from
53
+ // the table by the 009 post-apply hook, never trusted from increments.
54
+ "shared_entries_total",
55
+ "shared_entries_imported",
56
+ "shared_entries_exported",
57
+ "okf_merge_folds",
58
+ "rekey_events",
59
+ "injections_from_shared",
51
60
  ];
52
61
  const DEFAULT_FLUSH_MS = 1000;
53
62
  function zeroCache() {
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../plugin/metrics.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,4BAA4B;IAC5B,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;IAClB,sBAAsB;IACtB,wBAAwB;IACxB,uBAAuB;IACvB,0EAA0E;IAC1E,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,+BAA+B;IAC/B,0BAA0B;IAC1B,4BAA4B;IAC5B,yBAAyB;IACzB,yBAAyB;IACzB,mBAAmB;IACnB,0EAA0E;IAC1E,mEAAmE;IACnE,iEAAiE;IACjE,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,sBAAsB;IACtB,+BAA+B;IAC/B,0EAA0E;IAC1E,wEAAwE;IACxE,wEAAwE;IACxE,qEAAqE;IACrE,2DAA2D;IAC3D,oBAAoB;IACpB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AAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK;QACJ,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAEO,aAAa;QACpB,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI;YAAE,OAAO;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,KAAK,EAAE,CAAC;QACd,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjB,kEAAkE;QAClE,MAAM,CAAC,GAAG,IAAI,CAAC,UAEd,CAAC;QACF,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IACb,CAAC;IAEO,UAAU;QACjB,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC9B,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACxB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,92 @@
1
+ import { type Materializer } from "./Materializer.js";
2
+ import type { Store } from "./Store.js";
3
+ import type { HostSurface } from "./host.js";
4
+ /** The surface `attachNative()` returned. `verified` is filled by the
5
+ * read-back checks (K9-014/015) once the host ran `setup()`. */
6
+ export interface NativeRegistration {
7
+ registered: {
8
+ skill: boolean;
9
+ reference: boolean;
10
+ };
11
+ verified: {
12
+ skill: boolean;
13
+ reference: boolean;
14
+ };
15
+ notes: string[];
16
+ }
17
+ /** Minimal settings reader — matches MemoryService.getSetting(key, fallback). */
18
+ export interface SettingsReader {
19
+ getSetting(key: string, fallback?: string): string | null;
20
+ }
21
+ export interface NativeDeps {
22
+ materializer: Materializer;
23
+ settings: SettingsReader;
24
+ /**
25
+ * v0.9.0 (K9-014 / plan §5.4) — reports the outcome of each surface
26
+ * registration once the host ran `setup()`. `registered` reflects
27
+ * whether the transform completed; `verified` whether the read-back
28
+ * (`draft.list()`) contained the provided source. The host's own
29
+ * `setup()` runs asynchronously, so this callback may fire after
30
+ * `attachNative()` resolved.
31
+ */
32
+ onVerified?: (surface: "skill" | "reference", registered: boolean, verified: boolean) => void;
33
+ /**
34
+ * v0.9.0 (K9-017 / plan §6.2) — the persistence sink. When present,
35
+ * every surface outcome is appended to `native_registrations` and the
36
+ * two live counters are bumped. Attach time is construction, not a
37
+ * hot path, so a direct write is correct here and the
38
+ * `metrics.flush()` cadence does not apply.
39
+ */
40
+ store?: Store;
41
+ }
42
+ /** The only place in the repository allowed to name the v2 subpath. */
43
+ export declare const V2_SPECIFIER = "@opencode-ai/plugin/v2/promise";
44
+ /**
45
+ * Duck-typed mirror of the host's v2 PluginContext. The host's own
46
+ * compile-time types (dist/v2/promise/context.d.ts) are not importable
47
+ * here — a static type import would name the specifier outside a dynamic
48
+ * `import()` and break the containment scan.
49
+ */
50
+ export interface KevinNativeContext {
51
+ readonly skill: {
52
+ transform(hook: (draft: unknown) => Promise<void> | void): Promise<void> | void;
53
+ };
54
+ readonly reference: {
55
+ transform(hook: (draft: unknown) => Promise<void> | void): Promise<void> | void;
56
+ };
57
+ }
58
+ /**
59
+ * Duck-typed mirror of the v2 `Plugin` contract
60
+ * (dist/v2/promise/plugin.d.ts). `define()` is the identity function —
61
+ * 54 bytes, `return plugin` — so adopting it is neither a framework nor
62
+ * a commitment (D9-02); the object literal below already satisfies the
63
+ * contract.
64
+ */
65
+ export interface KevinNativePlugin {
66
+ readonly id: string;
67
+ readonly setup: (context: KevinNativeContext) => Promise<void> | void;
68
+ }
69
+ /** The skill body Kevin registers through `skill.transform`. */
70
+ export declare function kevinSkillSource(materializer: Materializer): string;
71
+ /**
72
+ * Build the v2 plugin. Registration replaces emission (D9-10): when the
73
+ * host runs `setup()`, the skill/reference surfaces are registered
74
+ * natively and the Materializer's `*_emission_enabled` file path is
75
+ * skipped for those surfaces (guard in K9-016).
76
+ */
77
+ export declare function buildNativePlugin(deps: NativeDeps): KevinNativePlugin;
78
+ export interface AttachOptions {
79
+ /** Injectable v2 loader for tests; defaults to the real dynamic import. */
80
+ importV2?: () => Promise<unknown>;
81
+ /** Collects notes for the caller when the result is null. */
82
+ notes?: string[];
83
+ }
84
+ /**
85
+ * Attach the native surface when the host exposes it AND the user asked
86
+ * for it. Returns `null` — cleanly, with a `note` — whenever the host
87
+ * lacks the subpath or `native_registration_enabled` is not `'1'`; that
88
+ * is the default on every existing installation, so the default
89
+ * behaviour of this release is byte-identical to v0.8.0. Never throws
90
+ * (D9-12): every failure path is a `null` plus a `note`.
91
+ */
92
+ export declare function attachNative(host: HostSurface, deps: NativeDeps, options?: AttachOptions): Promise<NativeRegistration | null>;
@@ -0,0 +1,191 @@
1
+ import { SKILL_TOPIC } from "./Materializer.js";
2
+ import { uuidv7 } from "./uuid.js";
3
+ /** The only place in the repository allowed to name the v2 subpath. */
4
+ export const V2_SPECIFIER = "@opencode-ai/plugin/v2/promise";
5
+ /** The skill body Kevin registers through `skill.transform`. */
6
+ export function kevinSkillSource(materializer) {
7
+ return materializer.skillBody();
8
+ }
9
+ /**
10
+ * Build the v2 plugin. Registration replaces emission (D9-10): when the
11
+ * host runs `setup()`, the skill/reference surfaces are registered
12
+ * natively and the Materializer's `*_emission_enabled` file path is
13
+ * skipped for those surfaces (guard in K9-016).
14
+ */
15
+ export function buildNativePlugin(deps) {
16
+ return {
17
+ id: "opencode-kevin",
18
+ setup: async (ctx) => {
19
+ try {
20
+ await ctx.skill.transform(async (draft) => {
21
+ const source = kevinSkillSource(deps.materializer);
22
+ // The draft is a mutable builder valid only for the
23
+ // duration of this callback; it never escapes (D9-10
24
+ // property 3). K9-014's source scan asserts that.
25
+ const draftApi = draft;
26
+ if (typeof draftApi.source !== "function") {
27
+ deps.onVerified?.("skill", false, false);
28
+ return;
29
+ }
30
+ draftApi.source(source);
31
+ // v0.9.0 (K9-014 / plan §5.4 property 2) — verification is a
32
+ // read-back: the registered source must show up in the
33
+ // draft's own list(). An unverified registration is a note
34
+ // (and a metric in K9-017), never a throw.
35
+ const verified = typeof draftApi.list === "function" &&
36
+ draftApi.list().some((entry) => entry === source);
37
+ deps.onVerified?.("skill", true, verified);
38
+ });
39
+ }
40
+ catch {
41
+ // A rejecting transform still reports, never throws (K9-014).
42
+ deps.onVerified?.("skill", false, false);
43
+ }
44
+ try {
45
+ await ctx.reference.transform(async (draft) => {
46
+ // v0.9.0 (K9-015 / plan §5.4, D6-14) — one add() per
47
+ // materialized ref target (topic !== SKILL_TOPIC), named
48
+ // `@kevin/<topic>`. Topics follow the v0.6.0 rule
49
+ // `<type>-<dominant token>`; dominantToken already
50
+ // excludes hex-like tokens, so a fingerprint prefix can
51
+ // never become a reference name. Sources use the v2
52
+ // `{ type: "local", path }` shape (read from the
53
+ // resolved SDK's ReferenceLocalSource, duck-typed).
54
+ const draftApi = draft;
55
+ if (typeof draftApi.add !== "function") {
56
+ deps.onVerified?.("reference", false, false);
57
+ return;
58
+ }
59
+ const added = [];
60
+ for (const target of deps.materializer.bundleTargets()) {
61
+ if (target.topic === SKILL_TOPIC)
62
+ continue;
63
+ const name = `@kevin/${target.topic}`;
64
+ draftApi.add(name, {
65
+ type: "local",
66
+ path: target.path,
67
+ });
68
+ added.push(name);
69
+ }
70
+ // Verification is the same read-back as K9-014: every
71
+ // name we added must show up in the draft's own list().
72
+ const listed = typeof draftApi.list === "function" ? draftApi.list() : [];
73
+ const listedNames = new Set(listed.map((entry) => {
74
+ const tuple = entry;
75
+ return tuple[0];
76
+ }));
77
+ const verified = added.every((name) => listedNames.has(name));
78
+ deps.onVerified?.("reference", true, verified);
79
+ });
80
+ }
81
+ catch {
82
+ deps.onVerified?.("reference", false, false);
83
+ }
84
+ },
85
+ };
86
+ }
87
+ /**
88
+ * Attach the native surface when the host exposes it AND the user asked
89
+ * for it. Returns `null` — cleanly, with a `note` — whenever the host
90
+ * lacks the subpath or `native_registration_enabled` is not `'1'`; that
91
+ * is the default on every existing installation, so the default
92
+ * behaviour of this release is byte-identical to v0.8.0. Never throws
93
+ * (D9-12): every failure path is a `null` plus a `note`.
94
+ */
95
+ export async function attachNative(host, deps, options = {}) {
96
+ const notes = options.notes ?? [];
97
+ const enabled = deps.settings.getSetting("native_registration_enabled", "0") === "1";
98
+ if (!enabled)
99
+ return null;
100
+ if (!host.v2.skill && !host.v2.reference) {
101
+ notes.push("v2 subpath absent from the resolved host package — native registration skipped");
102
+ return null;
103
+ }
104
+ let mod;
105
+ try {
106
+ mod = await (options.importV2 ?? (() => import(/* @vite-ignore */ V2_SPECIFIER)))();
107
+ }
108
+ catch {
109
+ notes.push("v2 subpath import rejected — native registration skipped");
110
+ return null;
111
+ }
112
+ const record = mod;
113
+ const define = typeof record.define === "function"
114
+ ? record.define
115
+ : null;
116
+ if (define === null) {
117
+ notes.push("v2 module exposes no define() — native registration skipped");
118
+ return null;
119
+ }
120
+ // `define()` is the identity function (D9-02): passing the built
121
+ // plugin through it validates the contract without adding a framework.
122
+ // v0.9.0 (K9-014 / plan §5.4 property 2) — the collector for the
123
+ // read-back results: `verified` is filled by the host running setup()
124
+ // (draft.list()), reported back through onVerified. The setup callback
125
+ // may fire after this function resolved; the caller keeps the returned
126
+ // registration as the final word.
127
+ const registered = { skill: host.v2.skill, reference: host.v2.reference };
128
+ const verified = { skill: false, reference: false };
129
+ const plugin = buildNativePlugin({
130
+ ...deps,
131
+ onVerified: (surface, didRegister, isVerified) => {
132
+ if (!didRegister)
133
+ registered[surface] = false;
134
+ verified[surface] = isVerified;
135
+ if (!isVerified) {
136
+ notes.push(`${surface} read-back does not contain the provided source — unverified registration`);
137
+ }
138
+ // v0.9.0 (K9-017 / plan §6.2) — append the outcome row at attach
139
+ // time (construction, not a hot path; a direct write is correct,
140
+ // the flush cadence does not apply). Only surfaces the host
141
+ // actually exposes are persisted: a surface the host cannot
142
+ // serve is not an outcome to record.
143
+ if (deps.store && host.v2[surface]) {
144
+ const note = !isVerified
145
+ ? `${surface} read-back does not contain the provided source — unverified registration`
146
+ : null;
147
+ persistRegistration(deps.store, surface, didRegister, isVerified, note);
148
+ }
149
+ },
150
+ });
151
+ define(plugin);
152
+ return {
153
+ registered,
154
+ verified,
155
+ notes,
156
+ };
157
+ }
158
+ /**
159
+ * v0.9.0 (K9-017 / plan §6.2) — one `native_registrations` row per
160
+ * surface per attach attempt, plus the two live counters. The counters
161
+ * live OUTSIDE the frozen `METRIC_KEYS` ladder (K7-004) but persist to
162
+ * the same `kevin_metrics` table, following the v0.6.0 `incrRegistered`
163
+ * precedent (K6-018/019): written immediately, never debounced. The
164
+ * `surface` CHECK lives in the schema (migration 010), so a bad surface
165
+ * fails loudly at the constraint rather than being coerced — the closed
166
+ * enumeration is deliberate (plan §6.2).
167
+ */
168
+ function persistRegistration(store, surface, registered, verified, note) {
169
+ store
170
+ .prepare(`INSERT INTO native_registrations (id, surface, registered, verified, note)
171
+ VALUES (?, ?, ?, ?, ?)`)
172
+ .run(uuidv7(), surface, registered ? 1 : 0, verified ? 1 : 0, note);
173
+ if (verified) {
174
+ bumpNativeCounter(store, "native_registrations_total");
175
+ }
176
+ else if (registered) {
177
+ // "Registered but unverified": the host accepted the call and did
178
+ // not honour it — the interesting state (K9-017).
179
+ bumpNativeCounter(store, "native_registration_failures");
180
+ }
181
+ }
182
+ function bumpNativeCounter(store, key) {
183
+ store
184
+ .prepare(`INSERT INTO kevin_metrics (key, value, updated_at)
185
+ VALUES (?, 1, datetime('now'))
186
+ ON CONFLICT(key) DO UPDATE SET
187
+ value = value + excluded.value,
188
+ updated_at = datetime('now')`)
189
+ .run(key);
190
+ }
191
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../../plugin/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAanE,OAAO,EAAE,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C,CAAC,IAAI,CAAC;gBACR,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YACzE,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,CAAC;IAEf,OAAO;QACN,UAAU;QACV,QAAQ;QACR,KAAK;KACL,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAC3B,KAAY,EACZ,OAA8B,EAC9B,UAAmB,EACnB,QAAiB,EACjB,IAAmB;IAEnB,KAAK;SACH,OAAO,CACP;2BACwB,CACxB;SACA,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrE,IAAI,QAAQ,EAAE,CAAC;QACd,iBAAiB,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;IACxD,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACvB,kEAAkE;QAClE,kDAAkD;QAClD,iBAAiB,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;IAC1D,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAY,EAAE,GAAW;IACnD,KAAK;SACH,OAAO,CACP;;;;mCAIgC,CAChC;SACA,GAAG,CAAC,GAAG,CAAC,CAAC;AACZ,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { Store } from "./Store.js";
2
- export declare function exportOkf(store: Store): string;
3
- export declare function exportMarkdown(store: Store): string;
2
+ export declare function exportOkf(store: Store, projectId?: string | null): string;
3
+ export declare function exportMarkdown(store: Store, projectId?: string | null): string;