@jmtrin/opencode-kevin 1.5.0 → 2.1.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", "source_deletion_sync"];
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,21 @@ 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",
142
+ "source_deletion_sync",
137
143
  ];
144
+ // v2.0.0 (K16-004 / plan §5.1) — removed settings contract
145
+ export const REMOVED_SETTINGS = {
146
+ import_host_memory: {
147
+ since: "2.0.0",
148
+ replacement: "sources_enabled + source_claude_memory/source_codex_memories",
149
+ },
150
+ };
138
151
  // v1.1.0 (K11-007 / D11-08) — no new settings in 1.1.0; thresholds are constants (D11-03)
139
152
  // v0.7.0 (K7-003 / plan §5.6, D7-12) — the explicit VALUE domain for
140
153
  // `error_lesson_mode`. The setting is TEXT and must be compared with
@@ -324,12 +337,12 @@ export const KevinPlugin = async (input, options) => {
324
337
  // pre-003 DB without kevin_settings — nothing to seed
325
338
  }
326
339
  // v1.5.0 (K15-001) — Diaspora settings: ensure defaults on existing DBs.
340
+ // v2.0.0: import_host_memory retired — seeded via 014 translation then deleted; no longer seeded here.
327
341
  try {
328
342
  const ins = store.prepare("INSERT OR IGNORE INTO kevin_settings (key, value) VALUES (?, ?)");
329
343
  ins.run("skills_canonical_dir", ".agents/skills");
330
344
  ins.run("skills_mirror_claude", "0");
331
345
  ins.run("skills_mirror_cursor", "0");
332
- ins.run("import_host_memory", "0");
333
346
  }
334
347
  catch {
335
348
  // pre-003 DB without kevin_settings — nothing to seed
@@ -1395,7 +1408,7 @@ export const KevinPlugin = async (input, options) => {
1395
1408
  },
1396
1409
  }),
1397
1410
  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).",
1411
+ 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
1412
  args: {
1400
1413
  bundle: tool.schema.string().optional(),
1401
1414
  format: tool.schema.enum(["okf", "markdown", "mif"]).optional().describe("okf | markdown | mif (mif requiere bundle JSON)"),
@@ -1407,7 +1420,7 @@ export const KevinPlugin = async (input, options) => {
1407
1420
  const { importHostMemories } = await import("@jmtrin/kevin-core");
1408
1421
  const report = importHostMemories({ store, memoryService, metrics: metrics, env: kevinEnv, source: src });
1409
1422
  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" }) };
1423
+ return { title: "Import no realizado (gate deshabilitado)", output: JSON.stringify({ error: "disabled", hint: report.hint }) };
1411
1424
  }
1412
1425
  return { title: "Import completado", output: JSON.stringify(report) };
1413
1426
  }
@@ -1449,6 +1462,56 @@ export const KevinPlugin = async (input, options) => {
1449
1462
  };
1450
1463
  },
1451
1464
  }),
1465
+ kevin_sources: tool({
1466
+ description: "Fuentes de memoria (v2.0.0): lista estado de cada MemorySource (enabled, precedence, last_sync). Solo lectura.",
1467
+ args: {
1468
+ action: tool.schema.enum(["list"]).default("list").describe("list"),
1469
+ },
1470
+ async execute(_args) {
1471
+ const settings = {};
1472
+ try {
1473
+ const rows = store
1474
+ .prepare("SELECT key, value FROM kevin_settings WHERE key LIKE 'source%' OR key='sources_enabled' OR key='okf_write_version'")
1475
+ .all();
1476
+ for (const r of rows)
1477
+ settings[r.key] = r.value;
1478
+ }
1479
+ catch { }
1480
+ let sources = [];
1481
+ try {
1482
+ sources = store
1483
+ .prepare("SELECT name, enabled, precedence FROM memory_sources ORDER BY precedence")
1484
+ .all();
1485
+ }
1486
+ catch {
1487
+ sources = [
1488
+ { name: "opencode-plugin", enabled: 1, precedence: 10 },
1489
+ {
1490
+ name: "claude-memory",
1491
+ enabled: Number(settings["source_claude_memory"] === "1" ? 1 : 0),
1492
+ precedence: 20,
1493
+ },
1494
+ {
1495
+ name: "codex-memories",
1496
+ enabled: Number(settings["source_codex_memories"] === "1" ? 1 : 0),
1497
+ precedence: 30,
1498
+ },
1499
+ {
1500
+ name: "opencode-native",
1501
+ enabled: Number(settings["source_opencode_native"] === "1" ? 1 : 0),
1502
+ precedence: 40,
1503
+ },
1504
+ ];
1505
+ }
1506
+ return {
1507
+ title: "Fuentes de memoria",
1508
+ output: JSON.stringify({
1509
+ sources_enabled: settings["sources_enabled"] ?? "1",
1510
+ sources,
1511
+ }),
1512
+ };
1513
+ },
1514
+ }),
1452
1515
  kevin_config: tool({
1453
1516
  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
1517
  args: {
@@ -1489,6 +1552,19 @@ export const KevinPlugin = async (input, options) => {
1489
1552
  }),
1490
1553
  };
1491
1554
  }
1555
+ // v2.0.0 (K16-004) — removed keys return structured removed_in_2.0.0 before unknown_key
1556
+ if (args.key in REMOVED_SETTINGS) {
1557
+ const meta = REMOVED_SETTINGS[args.key];
1558
+ return {
1559
+ title: "kevin_config",
1560
+ output: JSON.stringify({
1561
+ error: "removed_in_2.0.0",
1562
+ key: args.key,
1563
+ replacement: meta.replacement,
1564
+ since: meta.since,
1565
+ }),
1566
+ };
1567
+ }
1492
1568
  const known = KEVIN_CONFIG_KEYS.includes(args.key);
1493
1569
  if (!known && args.strict !== false) {
1494
1570
  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.1.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.1.0",
27
+ "@jmtrin/opencode-kevin-tui": "2.1.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
  }