@jmtrin/opencode-kevin 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,13 @@ export interface KevinPluginOptions {
17
17
  * v0.4.0 (K4-021) — settings surfaced by `kevin_config` (plan §8.8).
18
18
  * Unknown keys are rejected on `set` unless `strict: false`.
19
19
  */
20
- 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", "perf_enabled", "perf_ring_capacity", "perf_flush_on_idle", "contract_report_enabled", "tui_snapshots_enabled", "mcp_write_enabled", "mcp_approve_enabled", "mcp_repo_override", "skills_canonical_dir", "skills_mirror_claude", "skills_mirror_cursor", "import_host_memory"];
20
+ 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", "perf_enabled", "perf_ring_capacity", "perf_flush_on_idle", "contract_report_enabled", "tui_snapshots_enabled", "mcp_write_enabled", "mcp_approve_enabled", "mcp_repo_override", "skills_canonical_dir", "skills_mirror_claude", "skills_mirror_cursor", "sources_enabled", "source_claude_memory", "source_codex_memories", "source_opencode_native", "okf_write_version"];
21
+ export declare const REMOVED_SETTINGS: {
22
+ readonly import_host_memory: {
23
+ readonly since: "2.0.0";
24
+ readonly replacement: "sources_enabled + source_claude_memory/source_codex_memories";
25
+ };
26
+ };
21
27
  export declare const ERROR_LESSON_MODE_VALUES: readonly ["all", "triage_only"];
22
28
  /** Plugin release version — single source is @jmtrin/kevin-core (B-003 drift fix). */
23
29
  export { KEVIN_VERSION };
@@ -133,8 +133,20 @@ export const KEVIN_CONFIG_KEYS = [
133
133
  "skills_canonical_dir",
134
134
  "skills_mirror_claude",
135
135
  "skills_mirror_cursor",
136
- "import_host_memory",
136
+ // v2.0.0 (K16-013 / plan §4.4) — Commonwealth settings (retirement of import_host_memory handled via removals)
137
+ "sources_enabled",
138
+ "source_claude_memory",
139
+ "source_codex_memories",
140
+ "source_opencode_native",
141
+ "okf_write_version",
137
142
  ];
143
+ // v2.0.0 (K16-004 / plan §5.1) — removed settings contract
144
+ export const REMOVED_SETTINGS = {
145
+ import_host_memory: {
146
+ since: "2.0.0",
147
+ replacement: "sources_enabled + source_claude_memory/source_codex_memories",
148
+ },
149
+ };
138
150
  // v1.1.0 (K11-007 / D11-08) — no new settings in 1.1.0; thresholds are constants (D11-03)
139
151
  // v0.7.0 (K7-003 / plan §5.6, D7-12) — the explicit VALUE domain for
140
152
  // `error_lesson_mode`. The setting is TEXT and must be compared with
@@ -324,12 +336,12 @@ export const KevinPlugin = async (input, options) => {
324
336
  // pre-003 DB without kevin_settings — nothing to seed
325
337
  }
326
338
  // v1.5.0 (K15-001) — Diaspora settings: ensure defaults on existing DBs.
339
+ // v2.0.0: import_host_memory retired — seeded via 014 translation then deleted; no longer seeded here.
327
340
  try {
328
341
  const ins = store.prepare("INSERT OR IGNORE INTO kevin_settings (key, value) VALUES (?, ?)");
329
342
  ins.run("skills_canonical_dir", ".agents/skills");
330
343
  ins.run("skills_mirror_claude", "0");
331
344
  ins.run("skills_mirror_cursor", "0");
332
- ins.run("import_host_memory", "0");
333
345
  }
334
346
  catch {
335
347
  // pre-003 DB without kevin_settings — nothing to seed
@@ -1395,7 +1407,7 @@ export const KevinPlugin = async (input, options) => {
1395
1407
  },
1396
1408
  }),
1397
1409
  kevin_import: tool({
1398
- description: "Importa un bundle markdown de conocimiento (v0.3.0) o MIF / host memories (v1.5.0). Para host, requiere import_host_memory='1' (gate).",
1410
+ description: "Importa un bundle markdown de conocimiento (v0.3.0) o MIF / host memories (v2.0.0 retira import_host_memory; requiere sources_enabled=1 + source_claude_memory/codex-memories=1).",
1399
1411
  args: {
1400
1412
  bundle: tool.schema.string().optional(),
1401
1413
  format: tool.schema.enum(["okf", "markdown", "mif"]).optional().describe("okf | markdown | mif (mif requiere bundle JSON)"),
@@ -1407,7 +1419,7 @@ export const KevinPlugin = async (input, options) => {
1407
1419
  const { importHostMemories } = await import("@jmtrin/kevin-core");
1408
1420
  const report = importHostMemories({ store, memoryService, metrics: metrics, env: kevinEnv, source: src });
1409
1421
  if (report.error === "disabled") {
1410
- return { title: "Import no realizado (gate deshabilitado)", output: JSON.stringify({ error: "disabled", hint: "Ejecuta kevin_config set import_host_memory 1 para habilitar" }) };
1422
+ return { title: "Import no realizado (gate deshabilitado)", output: JSON.stringify({ error: "disabled", hint: report.hint }) };
1411
1423
  }
1412
1424
  return { title: "Import completado", output: JSON.stringify(report) };
1413
1425
  }
@@ -1449,6 +1461,56 @@ export const KevinPlugin = async (input, options) => {
1449
1461
  };
1450
1462
  },
1451
1463
  }),
1464
+ kevin_sources: tool({
1465
+ description: "Fuentes de memoria (v2.0.0): lista estado de cada MemorySource (enabled, precedence, last_sync). Solo lectura.",
1466
+ args: {
1467
+ action: tool.schema.enum(["list"]).default("list").describe("list"),
1468
+ },
1469
+ async execute(_args) {
1470
+ const settings = {};
1471
+ try {
1472
+ const rows = store
1473
+ .prepare("SELECT key, value FROM kevin_settings WHERE key LIKE 'source%' OR key='sources_enabled' OR key='okf_write_version'")
1474
+ .all();
1475
+ for (const r of rows)
1476
+ settings[r.key] = r.value;
1477
+ }
1478
+ catch { }
1479
+ let sources = [];
1480
+ try {
1481
+ sources = store
1482
+ .prepare("SELECT name, enabled, precedence FROM memory_sources ORDER BY precedence")
1483
+ .all();
1484
+ }
1485
+ catch {
1486
+ sources = [
1487
+ { name: "opencode-plugin", enabled: 1, precedence: 10 },
1488
+ {
1489
+ name: "claude-memory",
1490
+ enabled: Number(settings["source_claude_memory"] === "1" ? 1 : 0),
1491
+ precedence: 20,
1492
+ },
1493
+ {
1494
+ name: "codex-memories",
1495
+ enabled: Number(settings["source_codex_memories"] === "1" ? 1 : 0),
1496
+ precedence: 30,
1497
+ },
1498
+ {
1499
+ name: "opencode-native",
1500
+ enabled: Number(settings["source_opencode_native"] === "1" ? 1 : 0),
1501
+ precedence: 40,
1502
+ },
1503
+ ];
1504
+ }
1505
+ return {
1506
+ title: "Fuentes de memoria",
1507
+ output: JSON.stringify({
1508
+ sources_enabled: settings["sources_enabled"] ?? "1",
1509
+ sources,
1510
+ }),
1511
+ };
1512
+ },
1513
+ }),
1452
1514
  kevin_config: tool({
1453
1515
  description: "Lee o modifica settings de Kevin sin SQL (v0.4.0). list: todas las settings de kevin_settings. set: upsert de una key conocida (rechaza keys desconocidas salvo strict:false).",
1454
1516
  args: {
@@ -1489,6 +1551,19 @@ export const KevinPlugin = async (input, options) => {
1489
1551
  }),
1490
1552
  };
1491
1553
  }
1554
+ // v2.0.0 (K16-004) — removed keys return structured removed_in_2.0.0 before unknown_key
1555
+ if (args.key in REMOVED_SETTINGS) {
1556
+ const meta = REMOVED_SETTINGS[args.key];
1557
+ return {
1558
+ title: "kevin_config",
1559
+ output: JSON.stringify({
1560
+ error: "removed_in_2.0.0",
1561
+ key: args.key,
1562
+ replacement: meta.replacement,
1563
+ since: meta.since,
1564
+ }),
1565
+ };
1566
+ }
1492
1567
  const known = KEVIN_CONFIG_KEYS.includes(args.key);
1493
1568
  if (!known && args.strict !== false) {
1494
1569
  return {
package/package.json CHANGED
@@ -1,58 +1,50 @@
1
1
  {
2
- "name": "@jmtrin/opencode-kevin",
3
- "version": "1.5.0",
4
- "description": "Kevin — Observa y aprende: capa de aprendizaje para OpenCode",
5
- "type": "module",
6
- "main": "dist/plugin/index.js",
7
- "types": "dist/plugin/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/plugin/index.d.ts",
11
- "import": "./dist/plugin/index.js"
12
- },
13
- "./tui": {
14
- "types": "@jmtrin/opencode-kevin-tui/dist/index.d.ts",
15
- "import": "@jmtrin/opencode-kevin-tui/dist/index.js"
16
- }
17
- },
18
- "files": [
19
- "dist/plugin"
20
- ],
21
- "scripts": {
22
- "build": "tsc -p tsconfig.json",
23
- "prepublishOnly": "npm run build",
24
- "typecheck": "tsc --noEmit"
25
- },
26
- "dependencies": {
27
- "@opencode-ai/plugin": "^1.18.16",
28
- "@jmtrin/kevin-core": "1.5.0",
29
- "@jmtrin/opencode-kevin-tui": "1.5.0"
30
- },
31
- "optionalDependencies": {
32
- "better-sqlite3": "^12.11.0"
33
- },
34
- "engines": {
35
- "node": ">=22.5.0",
36
- "opencode": "^1.18.0"
37
- },
38
- "repository": {
39
- "type": "git",
40
- "url": "https://github.com/jmtrin/opencode-kevin.git"
41
- },
42
- "homepage": "https://github.com/jmtrin/opencode-kevin#readme",
43
- "bugs": {
44
- "url": "https://github.com/jmtrin/opencode-kevin/issues"
45
- },
46
- "keywords": [
47
- "opencode",
48
- "plugin",
49
- "memory",
50
- "learning",
51
- "ai"
52
- ],
53
- "author": "jmtrin",
54
- "publishConfig": {
55
- "access": "public"
56
- },
57
- "license": "MIT"
2
+ "name": "@jmtrin/opencode-kevin",
3
+ "version": "2.0.0",
4
+ "description": "Kevin — Observa y aprende: capa de aprendizaje para OpenCode",
5
+ "type": "module",
6
+ "main": "dist/plugin/index.js",
7
+ "types": "dist/plugin/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/plugin/index.d.ts",
11
+ "import": "./dist/plugin/index.js"
12
+ },
13
+ "./tui": {
14
+ "types": "@jmtrin/opencode-kevin-tui/dist/index.d.ts",
15
+ "import": "@jmtrin/opencode-kevin-tui/dist/index.js"
16
+ }
17
+ },
18
+ "files": ["dist/plugin"],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "prepublishOnly": "npm run build",
22
+ "typecheck": "tsc --noEmit"
23
+ },
24
+ "dependencies": {
25
+ "@opencode-ai/plugin": "^1.18.16",
26
+ "@jmtrin/kevin-core": "2.0.0",
27
+ "@jmtrin/opencode-kevin-tui": "2.0.0"
28
+ },
29
+ "optionalDependencies": {
30
+ "better-sqlite3": "^12.11.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=22.5.0",
34
+ "opencode": "^1.18.0"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/jmtrin/opencode-kevin.git"
39
+ },
40
+ "homepage": "https://github.com/jmtrin/opencode-kevin#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/jmtrin/opencode-kevin/issues"
43
+ },
44
+ "keywords": ["opencode", "plugin", "memory", "learning", "ai"],
45
+ "author": "jmtrin",
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "license": "MIT"
58
50
  }