@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.
- package/README.md +254 -12
- package/dist/migrations/009_v08_team.sql +100 -0
- package/dist/migrations/010_v09_native.sql +78 -0
- package/dist/plugin/ArtifactWriter.d.ts +28 -0
- package/dist/plugin/ArtifactWriter.js +35 -2
- package/dist/plugin/ArtifactWriter.js.map +1 -1
- package/dist/plugin/ContextInjector.d.ts +9 -0
- package/dist/plugin/ContextInjector.js +14 -3
- package/dist/plugin/ContextInjector.js.map +1 -1
- package/dist/plugin/Curator.d.ts +22 -2
- package/dist/plugin/Curator.js +56 -14
- package/dist/plugin/Curator.js.map +1 -1
- package/dist/plugin/HookLiveness.d.ts +81 -0
- package/dist/plugin/HookLiveness.js +324 -0
- package/dist/plugin/HookLiveness.js.map +1 -0
- package/dist/plugin/InjectionLedger.d.ts +6 -0
- package/dist/plugin/InjectionLedger.js +6 -0
- package/dist/plugin/InjectionLedger.js.map +1 -1
- package/dist/plugin/Materializer.d.ts +29 -5
- package/dist/plugin/Materializer.js +48 -16
- package/dist/plugin/Materializer.js.map +1 -1
- package/dist/plugin/MemoryService.d.ts +34 -5
- package/dist/plugin/MemoryService.js +215 -7
- package/dist/plugin/MemoryService.js.map +1 -1
- package/dist/plugin/Migrate.d.ts +1 -0
- package/dist/plugin/Migrate.js +74 -3
- package/dist/plugin/Migrate.js.map +1 -1
- package/dist/plugin/RepoIdentity.d.ts +124 -0
- package/dist/plugin/RepoIdentity.js +301 -0
- package/dist/plugin/RepoIdentity.js.map +1 -0
- package/dist/plugin/Retrospective.js +18 -0
- package/dist/plugin/Retrospective.js.map +1 -1
- package/dist/plugin/SharedLayer.d.ts +159 -0
- package/dist/plugin/SharedLayer.js +463 -0
- package/dist/plugin/SharedLayer.js.map +1 -0
- package/dist/plugin/host.d.ts +70 -0
- package/dist/plugin/host.js +251 -0
- package/dist/plugin/host.js.map +1 -0
- package/dist/plugin/index.d.ts +30 -1
- package/dist/plugin/index.js +582 -12
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/kevin_approve.js +7 -4
- package/dist/plugin/kevin_approve.js.map +1 -1
- package/dist/plugin/kevin_audit.d.ts +48 -1
- package/dist/plugin/kevin_audit.js +179 -3
- package/dist/plugin/kevin_audit.js.map +1 -1
- package/dist/plugin/kevin_doctor.d.ts +57 -0
- package/dist/plugin/kevin_doctor.js +168 -0
- package/dist/plugin/kevin_doctor.js.map +1 -0
- package/dist/plugin/kevin_native.d.ts +29 -0
- package/dist/plugin/kevin_native.js +80 -0
- package/dist/plugin/kevin_native.js.map +1 -0
- package/dist/plugin/metrics.d.ts +1 -1
- package/dist/plugin/metrics.js +9 -0
- package/dist/plugin/metrics.js.map +1 -1
- package/dist/plugin/native.d.ts +92 -0
- package/dist/plugin/native.js +191 -0
- package/dist/plugin/native.js.map +1 -0
- package/dist/plugin/okf-export.d.ts +2 -2
- package/dist/plugin/okf-export.js +15 -7
- package/dist/plugin/okf-export.js.map +1 -1
- package/dist/plugin/okf.d.ts +107 -0
- package/dist/plugin/okf.js +304 -0
- package/dist/plugin/okf.js.map +1 -0
- package/dist/plugin/replay-types.d.ts +29 -287
- package/dist/plugin/replay-types.js +145 -53
- package/dist/plugin/replay-types.js.map +1 -1
- package/migrations/009_v08_team.sql +100 -0
- package/migrations/010_v09_native.sql +78 -0
- package/package.json +2 -3
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K9-004 — v0.9.0 native — host probe (plan §5.1, D9-12).
|
|
3
|
+
*
|
|
4
|
+
* Kevin stops assuming the host and asks it instead. `probeHost()` inspects the
|
|
5
|
+
* plugin input and the resolved `@opencode-ai/plugin` package and answers four
|
|
6
|
+
* questions once per process: what plugin version is actually installed, which
|
|
7
|
+
* v1+v2 surface exists, what project context the host already knows, and
|
|
8
|
+
* whether a shell was handed over.
|
|
9
|
+
*
|
|
10
|
+
* Contract (plan §5.1 / §4 traps 24-26):
|
|
11
|
+
* - Never throws: every read is guarded, every failure appends to `notes` and
|
|
12
|
+
* yields a conservative `false`. A throw during construction takes down the
|
|
13
|
+
* host's plugin load — strictly worse than any missing feature.
|
|
14
|
+
* - Duck-typed: only `typeof` and `in` checks, never `instanceof`, never a cast
|
|
15
|
+
* to a host class.
|
|
16
|
+
* - The v2 probe is a dynamic `await import()` of the v2/promise subpath inside
|
|
17
|
+
* a try. Rejection is the answer (a pre-v2 package). When it resolves we record
|
|
18
|
+
* which domains are actually exposed rather than assuming both — the promise
|
|
19
|
+
* subpath exports `define` at runtime and its `skill`/`reference` domains are
|
|
20
|
+
* compile-time types, so domain availability is verified against the resolved
|
|
21
|
+
* package's own declaration files.
|
|
22
|
+
* - Runs once: the result is cached and frozen. A capability that appears
|
|
23
|
+
* mid-session is indistinguishable from a bug (D9-12).
|
|
24
|
+
* - `pluginVersion` comes from the resolved package's `package.json` — never
|
|
25
|
+
* from the declared range, which plan §3.4 showed to be untrustworthy.
|
|
26
|
+
* - The v2 subpath string itself lives in native.ts (K9-013 containment): this
|
|
27
|
+
* module only ever names it through the imported symbol.
|
|
28
|
+
*/
|
|
29
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
30
|
+
import { createRequire } from "node:module";
|
|
31
|
+
import { dirname, join } from "node:path";
|
|
32
|
+
import { fileURLToPath } from "node:url";
|
|
33
|
+
// v0.9.0 (K9-013 / plan §5.4, D9-11) — the only file allowed to name the v2
|
|
34
|
+
// subpath is plugin/native.ts; this module uses the exported symbol.
|
|
35
|
+
import { V2_SPECIFIER } from "./native.js";
|
|
36
|
+
let cachedSurface = null;
|
|
37
|
+
/**
|
|
38
|
+
* v0.9.0 (K9-004 / plan §5.1, D9-12)
|
|
39
|
+
* `importV2` is a test seam; production callers omit it and the real
|
|
40
|
+
* `await import()` runs inside the try.
|
|
41
|
+
*/
|
|
42
|
+
export async function probeHost(input, options) {
|
|
43
|
+
if (cachedSurface !== null) {
|
|
44
|
+
return cachedSurface;
|
|
45
|
+
}
|
|
46
|
+
const notes = [];
|
|
47
|
+
const project = readProject(input, notes);
|
|
48
|
+
const hasShell = readShell(input, notes);
|
|
49
|
+
const v2 = await probeV2(notes, options?.importV2);
|
|
50
|
+
const pluginVersion = readPluginVersion(notes);
|
|
51
|
+
const surface = Object.freeze({
|
|
52
|
+
pluginVersion,
|
|
53
|
+
flavour: v2 === null ? "v1-only" : "v1+v2",
|
|
54
|
+
project: Object.freeze(project),
|
|
55
|
+
hasShell,
|
|
56
|
+
v2: Object.freeze({
|
|
57
|
+
skill: v2?.skill ?? false,
|
|
58
|
+
reference: v2?.reference ?? false,
|
|
59
|
+
}),
|
|
60
|
+
notes: Object.freeze(notes),
|
|
61
|
+
});
|
|
62
|
+
cachedSurface = surface;
|
|
63
|
+
return surface;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* v0.9.0 (K9-004) — test hook. probeHost caches its result (probe once, freeze,
|
|
67
|
+
* restart to re-probe); tests reset between cases.
|
|
68
|
+
*/
|
|
69
|
+
export function resetHostProbeCache() {
|
|
70
|
+
cachedSurface = null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* v0.9.0 (K9-004 / plan §5.1) — one stable paragraph: version, flavour and the
|
|
74
|
+
* domain flags. No paths, no identifiers; safe to paste into an issue report.
|
|
75
|
+
*/
|
|
76
|
+
export function summarize(s) {
|
|
77
|
+
const version = s.pluginVersion ?? "unknown";
|
|
78
|
+
const shell = s.hasShell ? "yes" : "no";
|
|
79
|
+
const skill = s.v2.skill ? "yes" : "no";
|
|
80
|
+
const reference = s.v2.reference ? "yes" : "no";
|
|
81
|
+
return `host plugin ${version}, flavour ${s.flavour}, shell ${shell}, v2 skill ${skill}, v2 reference ${reference}`;
|
|
82
|
+
}
|
|
83
|
+
function readProject(input, notes) {
|
|
84
|
+
let id = null;
|
|
85
|
+
let worktree = null;
|
|
86
|
+
let directory = null;
|
|
87
|
+
if (typeof input === "object" && input !== null) {
|
|
88
|
+
const record = input;
|
|
89
|
+
const project = record.project;
|
|
90
|
+
if (typeof project === "object" && project !== null) {
|
|
91
|
+
const p = project;
|
|
92
|
+
id = typeof p.id === "string" ? p.id : null;
|
|
93
|
+
worktree = typeof p.worktree === "string" ? p.worktree : null;
|
|
94
|
+
directory =
|
|
95
|
+
typeof p.directory === "string" ? p.directory : null;
|
|
96
|
+
}
|
|
97
|
+
// PluginInput also carries top-level worktree/directory; fall back to
|
|
98
|
+
// them when the project object does not.
|
|
99
|
+
if (worktree === null && typeof record.worktree === "string") {
|
|
100
|
+
worktree = record.worktree;
|
|
101
|
+
}
|
|
102
|
+
if (directory === null && typeof record.directory === "string") {
|
|
103
|
+
directory = record.directory;
|
|
104
|
+
}
|
|
105
|
+
if (id === null && worktree === null && directory === null) {
|
|
106
|
+
notes.push("no project context on the plugin input (D9-12)");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
notes.push("plugin input is not an object — host fields unavailable (D9-12)");
|
|
111
|
+
}
|
|
112
|
+
return { id, worktree, directory };
|
|
113
|
+
}
|
|
114
|
+
function readShell(input, notes) {
|
|
115
|
+
if (typeof input !== "object" || input === null) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const shell = input.$;
|
|
119
|
+
const present = (typeof shell === "object" && shell !== null) ||
|
|
120
|
+
typeof shell === "function";
|
|
121
|
+
if (!present) {
|
|
122
|
+
notes.push("no shell ($) handed over — zero process-launching stays a decision (D9-12)");
|
|
123
|
+
}
|
|
124
|
+
return present;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* v0.9.0 (K9-004 / plan §5.1, D9-11/D9-12)
|
|
128
|
+
* Returns null when the v2 surface is absent; otherwise the domain flags
|
|
129
|
+
* verified against the resolved package's own declaration files.
|
|
130
|
+
*/
|
|
131
|
+
async function probeV2(notes, importV2) {
|
|
132
|
+
let mod;
|
|
133
|
+
try {
|
|
134
|
+
mod = importV2
|
|
135
|
+
? await importV2()
|
|
136
|
+
: await import(/* @vite-ignore */ V2_SPECIFIER);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
notes.push(`${V2_SPECIFIER} import rejected — this host package predates the v2 subpath (D9-11)`);
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
if (typeof mod !== "object" || mod === null) {
|
|
143
|
+
notes.push("v2/promise resolved to a non-object module — treated as v1-only (D9-12)");
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
if (typeof mod.define !== "function") {
|
|
147
|
+
notes.push("v2/promise resolved but exposes no define — treated as v1-only (D9-12)");
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const root = resolvePluginRoot(notes);
|
|
151
|
+
if (root === null) {
|
|
152
|
+
notes.push("v2/promise resolved but the package root is unreachable — v2 domains unverified (D9-12)");
|
|
153
|
+
return { skill: false, reference: false };
|
|
154
|
+
}
|
|
155
|
+
// The promise subpath ships skill/reference as declaration files; record
|
|
156
|
+
// what is actually there rather than assuming both (plan §5.1).
|
|
157
|
+
return {
|
|
158
|
+
skill: existsSync(join(root, "dist", "v2", "promise", "skill.d.ts")),
|
|
159
|
+
reference: existsSync(join(root, "dist", "v2", "promise", "reference.d.ts")),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function readPluginVersion(notes) {
|
|
163
|
+
const root = resolvePluginRoot(notes);
|
|
164
|
+
if (root === null) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
169
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
170
|
+
return pkg.version;
|
|
171
|
+
}
|
|
172
|
+
notes.push("resolved plugin package.json declares no version (K9-004)");
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
notes.push("resolved plugin package.json unreadable (K9-004)");
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* v0.9.0 (K9-004 / plan §5.1) — the installed package's directory, found by
|
|
182
|
+
* the most reliable strategy that works in this runtime. Never throws.
|
|
183
|
+
*/
|
|
184
|
+
function resolvePluginRoot(notes) {
|
|
185
|
+
// 1. import.meta.resolve: the true resolved copy (Node >= 20.6, Bun).
|
|
186
|
+
const resolveMeta = import.meta.resolve;
|
|
187
|
+
if (typeof resolveMeta === "function") {
|
|
188
|
+
try {
|
|
189
|
+
const url = resolveMeta("@opencode-ai/plugin");
|
|
190
|
+
const root = packageRootOf(url, notes);
|
|
191
|
+
if (root !== null) {
|
|
192
|
+
return root;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// unsupported in this runtime — next strategy
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// 2. createRequire: hosts that ship a "require" condition (this package
|
|
200
|
+
// exports only "import", so this is a forward-compat strategy).
|
|
201
|
+
try {
|
|
202
|
+
const resolve = createRequire(import.meta.url).resolve(`${V2_SPECIFIER}/index.js`);
|
|
203
|
+
const root = packageRootOf(resolve, notes);
|
|
204
|
+
if (root !== null) {
|
|
205
|
+
return root;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// not resolvable via require — next strategy
|
|
210
|
+
}
|
|
211
|
+
// 3. Walk up from cwd looking for a node_modules copy (works in the repo
|
|
212
|
+
// and in typical host layouts; best effort, guarded).
|
|
213
|
+
let dir = process.cwd();
|
|
214
|
+
for (let depth = 0; depth < 10; depth += 1) {
|
|
215
|
+
const candidate = join(dir, "node_modules", "@opencode-ai", "plugin");
|
|
216
|
+
if (existsSync(join(candidate, "package.json"))) {
|
|
217
|
+
return candidate;
|
|
218
|
+
}
|
|
219
|
+
const parent = dirname(dir);
|
|
220
|
+
if (parent === dir) {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
dir = parent;
|
|
224
|
+
}
|
|
225
|
+
notes.push("resolved plugin package root not reachable (K9-004)");
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
/** Accepts a file URL or a plain path to a file inside the package. */
|
|
229
|
+
function packageRootOf(file, notes) {
|
|
230
|
+
try {
|
|
231
|
+
const path = file.startsWith("file:")
|
|
232
|
+
? fileURLToPath(file)
|
|
233
|
+
: file.replace(/\\/g, "/");
|
|
234
|
+
// dist/index.js → dist → root; dist/v2/promise/index.js → three levels.
|
|
235
|
+
const candidates = [
|
|
236
|
+
dirname(path),
|
|
237
|
+
dirname(dirname(path)),
|
|
238
|
+
dirname(dirname(dirname(path))),
|
|
239
|
+
];
|
|
240
|
+
for (const candidate of candidates) {
|
|
241
|
+
if (existsSync(join(candidate, "package.json"))) {
|
|
242
|
+
return candidate;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
notes.push("could not map the resolved plugin file to its package root (K9-004)");
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../plugin/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA6BzC,4EAA4E;AAC5E,qEAAqE;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,IAAI,aAAa,GAAuB,IAAI,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC9B,KAAc,EACd,OAA+C;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IAAI,CAAC;AACb,CAAC"}
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
|
+
import { Store } from "./Store.js";
|
|
2
3
|
export interface KevinPluginOptions {
|
|
3
4
|
dbPath?: string;
|
|
4
5
|
migrationsDir?: string;
|
|
@@ -15,7 +16,35 @@ export interface KevinPluginOptions {
|
|
|
15
16
|
* v0.4.0 (K4-021) — settings surfaced by `kevin_config` (plan §8.8).
|
|
16
17
|
* Unknown keys are rejected on `set` unless `strict: false`.
|
|
17
18
|
*/
|
|
18
|
-
export declare const KEVIN_CONFIG_KEYS: readonly ["quality_gate_enabled", "lesson_snippet_injection", "patternminer_enabled", "cross_project_enabled", "llm_reflection_enabled", "tool_calls_dedup_enabled", "deterministic_retrieval", "pre_prompt_budget_tokens", "archive_after_days", "curation_enabled", "agents_md_path", "skill_emission_enabled", "reference_emission_enabled", "injection_confidence_floor", "repo_truth_enabled", "convention_mining_enabled", "conflict_detection_enabled", "error_lesson_mode"];
|
|
19
|
+
export declare const KEVIN_CONFIG_KEYS: readonly ["quality_gate_enabled", "lesson_snippet_injection", "patternminer_enabled", "cross_project_enabled", "llm_reflection_enabled", "tool_calls_dedup_enabled", "deterministic_retrieval", "pre_prompt_budget_tokens", "archive_after_days", "curation_enabled", "agents_md_path", "skill_emission_enabled", "reference_emission_enabled", "injection_confidence_floor", "repo_truth_enabled", "convention_mining_enabled", "conflict_detection_enabled", "error_lesson_mode", "shared_layer_enabled", "okf_path", "share_requires_approval", "author_identity_mode", "shared_confidence_floor", "hook_liveness_enabled", "native_registration_enabled", "host_probe_history_enabled", "dead_hook_report_threshold"];
|
|
19
20
|
export declare const ERROR_LESSON_MODE_VALUES: readonly ["all", "triage_only"];
|
|
21
|
+
/** Plugin release version — stamped into generated files (K8-021/027). */
|
|
22
|
+
export declare const KEVIN_VERSION = "0.9.0";
|
|
23
|
+
export interface RekeyCounts {
|
|
24
|
+
memories: number;
|
|
25
|
+
shared_entries: number;
|
|
26
|
+
okf_imports: number;
|
|
27
|
+
}
|
|
28
|
+
export interface RekeyResult {
|
|
29
|
+
action: "rekey";
|
|
30
|
+
ok: boolean;
|
|
31
|
+
reason?: string;
|
|
32
|
+
/** Present on a dry run (no `confirm`): nothing was mutated. */
|
|
33
|
+
dry_run?: boolean;
|
|
34
|
+
/** The resolved id the corpus would move to. */
|
|
35
|
+
to_repo_id?: string;
|
|
36
|
+
/** Per source repo_id, the rows that would move (from-value → counts). */
|
|
37
|
+
from?: Record<string, RekeyCounts>;
|
|
38
|
+
/** Total rows that would move, per table. */
|
|
39
|
+
rows?: RekeyCounts;
|
|
40
|
+
/** A monorepo collision was detected (refused unless `force`). */
|
|
41
|
+
collision?: boolean;
|
|
42
|
+
/** Present on a successful confirmed run. */
|
|
43
|
+
rekeyed?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function performRekey(store: Store, toRepoId: string, opts: {
|
|
46
|
+
confirm: boolean;
|
|
47
|
+
force?: boolean;
|
|
48
|
+
}): RekeyResult;
|
|
20
49
|
export declare const KevinPlugin: Plugin;
|
|
21
50
|
export default KevinPlugin;
|