@goondocks/myco 0.3.7 → 0.4.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 (121) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +9 -4
  4. package/commands/init.md +63 -39
  5. package/commands/setup-llm.md +69 -44
  6. package/commands/status.md +28 -10
  7. package/dist/{chunk-YFG2O5HR.js → chunk-2GJFTIWX.js} +2 -2
  8. package/dist/chunk-4FCFRJIQ.js +147 -0
  9. package/dist/chunk-4FCFRJIQ.js.map +1 -0
  10. package/dist/{chunk-PA3VMINE.js → chunk-AK6GNLPV.js} +6 -1
  11. package/dist/chunk-AK6GNLPV.js.map +1 -0
  12. package/dist/{chunk-JKOALBZC.js → chunk-BNIYWCST.js} +2 -2
  13. package/dist/{chunk-ISCT2SI6.js → chunk-G6ZMTQMJ.js} +7357 -60
  14. package/dist/chunk-G6ZMTQMJ.js.map +1 -0
  15. package/dist/{chunk-7WNE22W7.js → chunk-IVS5MYBL.js} +3 -3
  16. package/dist/{chunk-7WNE22W7.js.map → chunk-IVS5MYBL.js.map} +1 -1
  17. package/dist/{chunk-7VPJK56U.js → chunk-JBD5KP5G.js} +31 -16
  18. package/dist/chunk-JBD5KP5G.js.map +1 -0
  19. package/dist/chunk-NUA7UTIY.js +37 -0
  20. package/dist/chunk-NUA7UTIY.js.map +1 -0
  21. package/dist/{chunk-NYAWCMRZ.js → chunk-OUFSLZTX.js} +4 -4
  22. package/dist/chunk-P7RNAYU7.js +242 -0
  23. package/dist/chunk-P7RNAYU7.js.map +1 -0
  24. package/dist/chunk-QQ36XEJP.js +38 -0
  25. package/dist/chunk-QQ36XEJP.js.map +1 -0
  26. package/dist/chunk-RDXTQ436.js +49 -0
  27. package/dist/chunk-RDXTQ436.js.map +1 -0
  28. package/dist/{chunk-AWF3M57N.js → chunk-S7EIHYE7.js} +8 -8
  29. package/dist/{chunk-AWF3M57N.js.map → chunk-S7EIHYE7.js.map} +1 -1
  30. package/dist/{chunk-QWU7QLZI.js → chunk-TZDDXRHG.js} +10 -10
  31. package/dist/chunk-TZDDXRHG.js.map +1 -0
  32. package/dist/chunk-VYV5IFD6.js +99 -0
  33. package/dist/chunk-VYV5IFD6.js.map +1 -0
  34. package/dist/{chunk-LR7RQCOB.js → chunk-XCPQHC4X.js} +2 -2
  35. package/dist/{chunk-CCIV47S4.js → chunk-XHWIIU5D.js} +8 -9
  36. package/dist/chunk-XHWIIU5D.js.map +1 -0
  37. package/dist/{chunk-FFQNE6CT.js → chunk-YZO22BBI.js} +45 -31
  38. package/dist/chunk-YZO22BBI.js.map +1 -0
  39. package/dist/{chunk-ZBNT6E22.js → chunk-ZCBL5HER.js} +2 -2
  40. package/dist/{cli-3WQSDSW6.js → cli-ZN6VBA7V.js} +23 -17
  41. package/dist/cli-ZN6VBA7V.js.map +1 -0
  42. package/dist/{client-5T4M42UQ.js → client-5SUO2UYH.js} +5 -5
  43. package/dist/{config-MD4XMLUS.js → config-4GGMWGAF.js} +4 -4
  44. package/dist/{detect-providers-LNOLBICR.js → detect-providers-5FU3BN5Q.js} +3 -3
  45. package/dist/{init-RALMQKOQ.js → init-7UXGDOFS.js} +51 -60
  46. package/dist/init-7UXGDOFS.js.map +1 -0
  47. package/dist/{main-S3WSUF5T.js → main-6UPAIDGS.js} +648 -228
  48. package/dist/main-6UPAIDGS.js.map +1 -0
  49. package/dist/{rebuild-JW6BCHHZ.js → rebuild-QDSYYCS7.js} +10 -10
  50. package/dist/rebuild-QDSYYCS7.js.map +1 -0
  51. package/dist/{reprocess-SNXFNKBN.js → reprocess-ZNUQCIS3.js} +18 -18
  52. package/dist/reprocess-ZNUQCIS3.js.map +1 -0
  53. package/dist/{restart-YE2IGOYT.js → restart-5UY2KV54.js} +6 -6
  54. package/dist/{search-2HMG3ON7.js → search-2VEN3XIG.js} +9 -9
  55. package/dist/{server-JM3TM7D2.js → server-OR5B4B7K.js} +77 -54
  56. package/dist/{server-JM3TM7D2.js.map → server-OR5B4B7K.js.map} +1 -1
  57. package/dist/{session-5GI2YU6R.js → session-QF6MILAC.js} +2 -2
  58. package/dist/{session-start-2UEEEO52.js → session-start-TUITIUMB.js} +29 -28
  59. package/dist/session-start-TUITIUMB.js.map +1 -0
  60. package/dist/setup-digest-ETCZAUIU.js +15 -0
  61. package/dist/setup-llm-DWEJE3JE.js +15 -0
  62. package/dist/setup-llm-DWEJE3JE.js.map +1 -0
  63. package/dist/src/cli.js +4 -4
  64. package/dist/src/daemon/main.js +4 -4
  65. package/dist/src/hooks/post-tool-use.js +5 -5
  66. package/dist/src/hooks/session-end.js +5 -5
  67. package/dist/src/hooks/session-start.js +4 -4
  68. package/dist/src/hooks/stop.js +7 -7
  69. package/dist/src/hooks/user-prompt-submit.js +5 -5
  70. package/dist/src/hooks/user-prompt-submit.js.map +1 -1
  71. package/dist/src/mcp/server.js +4 -4
  72. package/dist/src/prompts/classification.md +1 -0
  73. package/dist/src/prompts/digest-10000.md +74 -0
  74. package/dist/src/prompts/digest-1500.md +25 -0
  75. package/dist/src/prompts/digest-3000.md +32 -0
  76. package/dist/src/prompts/digest-5000.md +43 -0
  77. package/dist/src/prompts/digest-system.md +32 -0
  78. package/dist/src/prompts/extraction.md +11 -10
  79. package/dist/src/prompts/summary.md +11 -1
  80. package/dist/src/prompts/title.md +1 -1
  81. package/dist/{stats-IOWXG576.js → stats-IVIXIKTS.js} +12 -12
  82. package/dist/stats-IVIXIKTS.js.map +1 -0
  83. package/dist/{verify-7MWOV72E.js → verify-4H6CEE5T.js} +6 -6
  84. package/dist/{version-S7MHLD5P.js → version-5B2TWXQJ.js} +4 -4
  85. package/dist/version-5B2TWXQJ.js.map +1 -0
  86. package/package.json +1 -1
  87. package/skills/myco/SKILL.md +20 -20
  88. package/skills/myco/references/wisdom.md +14 -14
  89. package/skills/rules/SKILL.md +4 -4
  90. package/dist/chunk-7VPJK56U.js.map +0 -1
  91. package/dist/chunk-BA23DROX.js +0 -160
  92. package/dist/chunk-BA23DROX.js.map +0 -1
  93. package/dist/chunk-CCIV47S4.js.map +0 -1
  94. package/dist/chunk-EF4JVH24.js +0 -7299
  95. package/dist/chunk-EF4JVH24.js.map +0 -1
  96. package/dist/chunk-FFQNE6CT.js.map +0 -1
  97. package/dist/chunk-ISCT2SI6.js.map +0 -1
  98. package/dist/chunk-PA3VMINE.js.map +0 -1
  99. package/dist/chunk-QWU7QLZI.js.map +0 -1
  100. package/dist/chunk-YMYJ7FNH.js +0 -19
  101. package/dist/chunk-YMYJ7FNH.js.map +0 -1
  102. package/dist/cli-3WQSDSW6.js.map +0 -1
  103. package/dist/init-RALMQKOQ.js.map +0 -1
  104. package/dist/main-S3WSUF5T.js.map +0 -1
  105. package/dist/rebuild-JW6BCHHZ.js.map +0 -1
  106. package/dist/reprocess-SNXFNKBN.js.map +0 -1
  107. package/dist/session-start-2UEEEO52.js.map +0 -1
  108. package/dist/stats-IOWXG576.js.map +0 -1
  109. /package/dist/{chunk-YFG2O5HR.js.map → chunk-2GJFTIWX.js.map} +0 -0
  110. /package/dist/{chunk-JKOALBZC.js.map → chunk-BNIYWCST.js.map} +0 -0
  111. /package/dist/{chunk-NYAWCMRZ.js.map → chunk-OUFSLZTX.js.map} +0 -0
  112. /package/dist/{chunk-LR7RQCOB.js.map → chunk-XCPQHC4X.js.map} +0 -0
  113. /package/dist/{chunk-ZBNT6E22.js.map → chunk-ZCBL5HER.js.map} +0 -0
  114. /package/dist/{client-5T4M42UQ.js.map → client-5SUO2UYH.js.map} +0 -0
  115. /package/dist/{config-MD4XMLUS.js.map → config-4GGMWGAF.js.map} +0 -0
  116. /package/dist/{detect-providers-LNOLBICR.js.map → detect-providers-5FU3BN5Q.js.map} +0 -0
  117. /package/dist/{restart-YE2IGOYT.js.map → restart-5UY2KV54.js.map} +0 -0
  118. /package/dist/{search-2HMG3ON7.js.map → search-2VEN3XIG.js.map} +0 -0
  119. /package/dist/{session-5GI2YU6R.js.map → session-QF6MILAC.js.map} +0 -0
  120. /package/dist/{version-S7MHLD5P.js.map → setup-digest-ETCZAUIU.js.map} +0 -0
  121. /package/dist/{verify-7MWOV72E.js.map → verify-4H6CEE5T.js.map} +0 -0
@@ -1,4 +1,5 @@
1
1
  You are analyzing a coding session buffer for session "{{sessionId}}".
2
+ You have a budget of ~{{maxTokens}} tokens for your response. Use it generously — richer, more detailed observations are more valuable than brief ones.
2
3
 
3
4
  ## Events ({{eventCount}} total)
4
5
  {{toolSummary}}
@@ -11,7 +12,7 @@ Analyze these events and produce a JSON response with exactly this structure:
11
12
  {
12
13
  "type": "gotcha|bug_fix|decision|discovery|trade_off",
13
14
  "title": "Short descriptive title",
14
- "content": "Detailed explanation of the observation.",
15
+ "content": "Detailed explanation of the observation. Be thorough — include the context, the specifics, and why this matters. A teammate reading this should fully understand the issue without needing to look at the code.",
15
16
  "tags": ["relevant", "tags"]
16
17
  }
17
18
  ]
@@ -20,9 +21,9 @@ Analyze these events and produce a JSON response with exactly this structure:
20
21
  ## Type-Specific Fields
21
22
  Include these additional fields when appropriate for the observation type:
22
23
 
23
- - **bug_fix**: add "root_cause" (what caused the bug) and "fix" (what resolved it)
24
- - **decision**: add "rationale" (why this choice) and "alternatives_rejected" (what was considered and why not)
25
- - **trade_off**: add "gained" (what was achieved) and "sacrificed" (what was given up)
24
+ - **bug_fix**: add "root_cause" (what caused the bug — be specific) and "fix" (what resolved it — include the approach, not just the file name)
25
+ - **decision**: add "rationale" (why this choice was made — include constraints and context) and "alternatives_rejected" (what was considered and why it was ruled out)
26
+ - **trade_off**: add "gained" (what was achieved) and "sacrificed" (what was given up, and why the tradeoff was acceptable)
26
27
 
27
28
  These fields are optional — only include them when the session provides clear evidence.
28
29
 
@@ -33,13 +34,13 @@ Only include observations that meet ALL criteria:
33
34
  - Not specific to this session's transient state
34
35
 
35
36
  Types:
36
- - "gotcha": A non-obvious problem, pitfall, or workaround
37
- - "bug_fix": Root cause of a bug and what fixed it
38
- - "decision": An architectural or technical choice, with rationale and rejected alternatives
39
- - "discovery": A significant learning about the codebase, tooling, or domain
40
- - "trade_off": What was sacrificed and why
37
+ - "gotcha": A non-obvious problem, pitfall, or workaround — include the symptom, the root cause, and the fix or workaround
38
+ - "bug_fix": Root cause of a bug and what fixed it — include enough detail that someone could recognize the same bug
39
+ - "decision": An architectural or technical choice — explain the reasoning, constraints, and what was rejected
40
+ - "discovery": A significant learning about the codebase, tooling, or domain — explain what was surprising or non-obvious
41
+ - "trade_off": What was sacrificed and why — include both sides of the tradeoff and what tipped the balance
41
42
 
42
43
  Routine activity (file reads, searches, test runs, navigation) goes in the summary only.
43
- Target 0-5 observations. Err on fewer, higher-quality observations.
44
+ Target 0-5 observations. Err on fewer, higher-quality observations with rich detail over many thin ones.
44
45
 
45
46
  Respond with valid JSON only, no markdown fences.
@@ -1,9 +1,19 @@
1
1
  You are summarizing a coding session for user "{{user}}" (session "{{sessionId}}").
2
+ You have a budget of ~{{maxTokens}} tokens. Use the full budget to produce a rich, detailed narrative.
2
3
 
3
4
  ## Session Content
4
5
  {{content}}
5
6
 
6
7
  ## Task
7
- Write a concise narrative summary of this session (3-6 sentences). Describe what was accomplished, key decisions made, and any problems encountered. Focus on outcomes rather than individual tool calls.
8
+ Write a detailed narrative summary of this session. This summary will be used by the digest engine to synthesize project understanding, so richness and accuracy matter more than brevity.
9
+
10
+ Cover:
11
+ - **What was accomplished** — features built, bugs fixed, refactors completed
12
+ - **Key decisions made** — what was chosen and why, including alternatives that were rejected
13
+ - **Problems encountered** — what went wrong, how it was debugged, what the root cause was
14
+ - **Discoveries and learnings** — anything surprising or non-obvious that was learned
15
+ - **Current state** — where things stand at the end of the session, what's next
16
+
17
+ Focus on outcomes and reasoning rather than individual tool calls. Include enough context that someone reading this summary months later would understand what happened and why.
8
18
 
9
19
  Respond with plain text only, no JSON or markdown fences.
@@ -1,4 +1,4 @@
1
- Given this session summary, produce a short, descriptive title (5-10 words) suitable for a vault note heading.
1
+ Given this session summary, produce a short, descriptive title (5-10 words) that captures the primary accomplishment or focus of the session.
2
2
 
3
3
  Summary:
4
4
  {{summary}}
@@ -2,16 +2,16 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
2
2
  import {
3
3
  VectorIndex
4
4
  } from "./chunk-XQXXF6MU.js";
5
+ import {
6
+ MycoIndex
7
+ } from "./chunk-AK6GNLPV.js";
5
8
  import {
6
9
  isProcessAlive
7
- } from "./chunk-CCIV47S4.js";
10
+ } from "./chunk-XHWIIU5D.js";
8
11
  import "./chunk-SAKJMNSR.js";
9
- import {
10
- MycoIndex
11
- } from "./chunk-PA3VMINE.js";
12
- import "./chunk-BA23DROX.js";
13
- import "./chunk-JKOALBZC.js";
14
- import "./chunk-7VPJK56U.js";
12
+ import "./chunk-P7RNAYU7.js";
13
+ import "./chunk-BNIYWCST.js";
14
+ import "./chunk-JBD5KP5G.js";
15
15
  import "./chunk-PZUWP5VK.js";
16
16
 
17
17
  // src/cli/stats.ts
@@ -20,22 +20,22 @@ import path from "path";
20
20
  function run(_args, vaultDir) {
21
21
  const index = new MycoIndex(path.join(vaultDir, "index.db"));
22
22
  const sessions = index.query({ type: "session" });
23
- const memories = index.query({ type: "memory" });
23
+ const spores = index.query({ type: "spore" });
24
24
  const plans = index.query({ type: "plan" });
25
25
  console.log("=== Myco Vault ===");
26
26
  console.log(`Path: ${vaultDir}`);
27
27
  console.log();
28
28
  console.log("--- Index ---");
29
29
  console.log(`Sessions: ${sessions.length}`);
30
- console.log(`Memories: ${memories.length}`);
30
+ console.log(`Spores: ${spores.length}`);
31
31
  console.log(`Plans: ${plans.length}`);
32
32
  const types = {};
33
- for (const m of memories) {
33
+ for (const m of spores) {
34
34
  const t = m.frontmatter?.observation_type || "unknown";
35
35
  types[t] = (types[t] || 0) + 1;
36
36
  }
37
37
  if (Object.keys(types).length > 0) {
38
- console.log("\n--- Memories by Type ---");
38
+ console.log("\n--- Spores by Type ---");
39
39
  for (const [t, c] of Object.entries(types).sort((a, b) => b[1] - a[1])) {
40
40
  console.log(` ${t}: ${c}`);
41
41
  }
@@ -74,4 +74,4 @@ Vectors: error \u2014 ${e.message}`);
74
74
  export {
75
75
  run
76
76
  };
77
- //# sourceMappingURL=stats-IOWXG576.js.map
77
+ //# sourceMappingURL=stats-IVIXIKTS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/stats.ts"],"sourcesContent":["import { MycoIndex } from '../index/sqlite.js';\nimport { VectorIndex } from '../index/vectors.js';\nimport { isProcessAlive } from './shared.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nexport function run(_args: string[], vaultDir: string): void {\n const index = new MycoIndex(path.join(vaultDir, 'index.db'));\n\n const sessions = index.query({ type: 'session' });\n const spores = index.query({ type: 'spore' });\n const plans = index.query({ type: 'plan' });\n\n console.log('=== Myco Vault ===');\n console.log(`Path: ${vaultDir}`);\n console.log();\n console.log('--- Index ---');\n console.log(`Sessions: ${sessions.length}`);\n console.log(`Spores: ${spores.length}`);\n console.log(`Plans: ${plans.length}`);\n\n // Spore breakdown by type\n const types: Record<string, number> = {};\n for (const m of spores) {\n const t = (m.frontmatter as Record<string, unknown>)?.observation_type as string || 'unknown';\n types[t] = (types[t] || 0) + 1;\n }\n if (Object.keys(types).length > 0) {\n console.log('\\n--- Spores by Type ---');\n for (const [t, c] of Object.entries(types).sort((a, b) => b[1] - a[1])) {\n console.log(` ${t}: ${c}`);\n }\n }\n\n // Vector index — need dimensions to open; read from daemon config or probe\n const vecDb = path.join(vaultDir, 'vectors.db');\n if (fs.existsSync(vecDb)) {\n try {\n // Use a common dimension; VectorIndex only needs it for CREATE IF NOT EXISTS\n const vec = new VectorIndex(vecDb, 1024);\n console.log(`\\n--- Vectors ---`);\n console.log(`Embeddings: ${vec.count()}`);\n vec.close();\n } catch (e) {\n console.log(`\\nVectors: error — ${(e as Error).message}`);\n }\n } else {\n console.log('\\nVectors: not initialized');\n }\n\n // Daemon\n const daemonPath = path.join(vaultDir, 'daemon.json');\n if (fs.existsSync(daemonPath)) {\n try {\n const daemon = JSON.parse(fs.readFileSync(daemonPath, 'utf-8'));\n const alive = isProcessAlive(daemon.pid);\n console.log(`\\n--- Daemon ---`);\n console.log(`PID: ${daemon.pid} (${alive ? 'running' : 'dead'})`);\n console.log(`Port: ${daemon.port}`);\n console.log(`Started: ${daemon.started}`);\n console.log(`Sessions: ${(daemon.sessions || []).length}`);\n } catch { /* ignore */ }\n }\n\n index.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEV,SAAS,IAAI,OAAiB,UAAwB;AAC3D,QAAM,QAAQ,IAAI,UAAU,KAAK,KAAK,UAAU,UAAU,CAAC;AAE3D,QAAM,WAAW,MAAM,MAAM,EAAE,MAAM,UAAU,CAAC;AAChD,QAAM,SAAS,MAAM,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5C,QAAM,QAAQ,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,UAAQ,IAAI,oBAAoB;AAChC,UAAQ,IAAI,SAAS,QAAQ,EAAE;AAC/B,UAAQ,IAAI;AACZ,UAAQ,IAAI,eAAe;AAC3B,UAAQ,IAAI,cAAc,SAAS,MAAM,EAAE;AAC3C,UAAQ,IAAI,cAAc,OAAO,MAAM,EAAE;AACzC,UAAQ,IAAI,cAAc,MAAM,MAAM,EAAE;AAGxC,QAAM,QAAgC,CAAC;AACvC,aAAW,KAAK,QAAQ;AACtB,UAAM,IAAK,EAAE,aAAyC,oBAA8B;AACpF,UAAM,CAAC,KAAK,MAAM,CAAC,KAAK,KAAK;AAAA,EAC/B;AACA,MAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAQ,IAAI,0BAA0B;AACtC,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG;AACtE,cAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;AAAA,IAC5B;AAAA,EACF;AAGA,QAAM,QAAQ,KAAK,KAAK,UAAU,YAAY;AAC9C,MAAI,GAAG,WAAW,KAAK,GAAG;AACxB,QAAI;AAEF,YAAM,MAAM,IAAI,YAAY,OAAO,IAAI;AACvC,cAAQ,IAAI;AAAA,gBAAmB;AAC/B,cAAQ,IAAI,eAAe,IAAI,MAAM,CAAC,EAAE;AACxC,UAAI,MAAM;AAAA,IACZ,SAAS,GAAG;AACV,cAAQ,IAAI;AAAA,wBAAuB,EAAY,OAAO,EAAE;AAAA,IAC1D;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,4BAA4B;AAAA,EAC1C;AAGA,QAAM,aAAa,KAAK,KAAK,UAAU,aAAa;AACpD,MAAI,GAAG,WAAW,UAAU,GAAG;AAC7B,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,GAAG,aAAa,YAAY,OAAO,CAAC;AAC9D,YAAM,QAAQ,eAAe,OAAO,GAAG;AACvC,cAAQ,IAAI;AAAA,eAAkB;AAC9B,cAAQ,IAAI,aAAa,OAAO,GAAG,KAAK,QAAQ,YAAY,MAAM,GAAG;AACrE,cAAQ,IAAI,aAAa,OAAO,IAAI,EAAE;AACtC,cAAQ,IAAI,aAAa,OAAO,OAAO,EAAE;AACzC,cAAQ,IAAI,cAAc,OAAO,YAAY,CAAC,GAAG,MAAM,EAAE;AAAA,IAC3D,QAAQ;AAAA,IAAe;AAAA,EACzB;AAEA,QAAM,MAAM;AACd;","names":[]}
@@ -2,13 +2,13 @@ import { createRequire as __cr } from 'node:module'; const require = __cr(import
2
2
  import {
3
3
  createEmbeddingProvider,
4
4
  createLlmProvider
5
- } from "./chunk-7WNE22W7.js";
6
- import "./chunk-BA23DROX.js";
5
+ } from "./chunk-IVS5MYBL.js";
6
+ import "./chunk-P7RNAYU7.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-ISCT2SI6.js";
10
- import "./chunk-EF4JVH24.js";
11
- import "./chunk-7VPJK56U.js";
9
+ } from "./chunk-QQ36XEJP.js";
10
+ import "./chunk-G6ZMTQMJ.js";
11
+ import "./chunk-JBD5KP5G.js";
12
12
  import "./chunk-PZUWP5VK.js";
13
13
 
14
14
  // src/cli/verify.ts
@@ -47,4 +47,4 @@ async function run(_args, vaultDir) {
47
47
  export {
48
48
  run
49
49
  };
50
- //# sourceMappingURL=verify-7MWOV72E.js.map
50
+ //# sourceMappingURL=verify-4H6CEE5T.js.map
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
2
2
  import {
3
3
  getPluginVersion
4
- } from "./chunk-YFG2O5HR.js";
5
- import "./chunk-JKOALBZC.js";
6
- import "./chunk-7VPJK56U.js";
4
+ } from "./chunk-2GJFTIWX.js";
5
+ import "./chunk-BNIYWCST.js";
6
+ import "./chunk-JBD5KP5G.js";
7
7
  import "./chunk-PZUWP5VK.js";
8
8
  export {
9
9
  getPluginVersion
10
10
  };
11
- //# sourceMappingURL=version-S7MHLD5P.js.map
11
+ //# sourceMappingURL=version-5B2TWXQJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goondocks/myco",
3
- "version": "0.3.7",
3
+ "version": "0.4.0",
4
4
  "description": "Collective agent intelligence — Claude Code plugin",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: myco
3
- description: Use when making design decisions, debugging non-obvious issues, encountering gotchas, wondering why code is structured a certain way, or when you need context about prior work on the same feature or component. Myco captures the reasoning, trade-offs, and lessons behind the codebase — things the code itself doesn't show. Also use when the user mentions vault, memories, sessions, team knowledge, institutional memory, or prior decisions.
3
+ description: Use when making design decisions, debugging non-obvious issues, encountering gotchas, wondering why code is structured a certain way, or when you need context about prior work on the same feature or component. Myco captures the reasoning, trade-offs, and lessons behind the codebase — things the code itself doesn't show. Also use when the user mentions vault, spores, sessions, team knowledge, institutional memory, or prior decisions.
4
4
  ---
5
5
 
6
6
  # Myco — Collective Agent Intelligence
@@ -13,7 +13,7 @@ Use Myco tools proactively in these situations — don't wait to be asked:
13
13
 
14
14
  - **Before making a design decision** — search for prior reasoning on the same component. Someone may have already evaluated the approach you're considering, or documented why an alternative was rejected.
15
15
  - **When debugging a non-obvious issue** — search for the error message, component name, or symptom. A prior session may have hit the same problem and documented the root cause.
16
- - **When wondering why code is structured a certain way** — decisions and trade-offs behind the architecture are captured as memories.
16
+ - **When wondering why code is structured a certain way** — decisions and trade-offs behind the architecture are captured as spores.
17
17
  - **When continuing work on a feature** — check session history and plan progress for context on what's been done and what's pending.
18
18
  - **After discovering a gotcha, making a key decision, or fixing a tricky bug** — save it so future sessions benefit from the knowledge.
19
19
  - **When starting work on a branch** — context is injected automatically at session start, but you can call `myco_recall` for deeper context on specific files.
@@ -37,17 +37,17 @@ If the vault isn't configured, run `/myco-init` to set up. To change LLM provide
37
37
 
38
38
  ### myco_search — Find knowledge across the vault
39
39
 
40
- Combined semantic + full-text search across sessions, plans, and memories.
40
+ Combined semantic + full-text search across sessions, plans, and spores.
41
41
 
42
42
  ```json
43
- { "query": "why did we choose JWT over session cookies", "type": "memory", "limit": 5 }
43
+ { "query": "why did we choose JWT over session cookies", "type": "spore", "limit": 5 }
44
44
  ```
45
45
 
46
- **When to use**: searching for prior decisions, debugging context, or understanding rationale. The `type` filter narrows results — use `"memory"` for decisions/gotchas, `"session"` for session history, `"plan"` for plans, or omit for all.
46
+ **When to use**: searching for prior decisions, debugging context, or understanding rationale. The `type` filter narrows results — use `"spore"` for decisions/gotchas, `"session"` for session history, `"plan"` for plans, or omit for all.
47
47
 
48
48
  **Example**: before choosing an authentication approach, search for prior decisions:
49
49
  ```json
50
- { "query": "authentication approach JWT session", "type": "memory" }
50
+ { "query": "authentication approach JWT session", "type": "spore" }
51
51
  ```
52
52
 
53
53
  ### myco_recall — Get context for current work
@@ -106,13 +106,13 @@ Filter by `plan`, `branch`, `user`, or `since` (ISO timestamp). Useful for under
106
106
 
107
107
  ### myco_graph — Traverse vault connections
108
108
 
109
- Follow wikilink connections between notes — find related sessions, memories, and plans.
109
+ Follow wikilink connections between notes — find related sessions, spores, and plans.
110
110
 
111
111
  ```json
112
112
  { "note_id": "session-abc123", "direction": "both", "depth": 2 }
113
113
  ```
114
114
 
115
- **When to use**: exploring how a decision connects to sessions and other memories, or understanding the lineage of a feature's development across multiple sessions.
115
+ **When to use**: exploring how a decision connects to sessions and other spores, or understanding the lineage of a feature's development across multiple sessions.
116
116
 
117
117
  ### myco_orphans — Find disconnected notes
118
118
 
@@ -140,47 +140,47 @@ View daemon logs for debugging when sessions aren't being captured, observations
140
140
 
141
141
  Components: `daemon`, `processor`, `hooks`, `lifecycle`, `embeddings`, `lineage`, `watcher`.
142
142
 
143
- ### myco_supersede — Mark a memory as replaced
143
+ ### myco_supersede — Mark a spore as replaced
144
144
 
145
- When a newer observation makes an older one obsolete, supersede it. The old memory stays in the vault (data is never deleted) but is marked `status: superseded`.
145
+ When a newer observation makes an older one obsolete, supersede it. The old spore stays in the vault (data is never deleted) but is marked `status: superseded`.
146
146
 
147
147
  ```json
148
- { "old_memory_id": "decision-abc123", "new_memory_id": "decision-def456", "reason": "Migrated from bcrypt to argon2" }
148
+ { "old_spore_id": "decision-abc123", "new_spore_id": "decision-def456", "reason": "Migrated from bcrypt to argon2" }
149
149
  ```
150
150
 
151
151
  **When to use**: a decision was reversed, a gotcha was fixed, a discovery turned out to be wrong, or the codebase changed and an observation no longer applies.
152
152
 
153
- ### myco_consolidate — Merge memories into wisdom
153
+ ### myco_consolidate — Merge spores into wisdom
154
154
 
155
- When multiple memories describe aspects of the same insight, consolidate them into a single comprehensive note. Source memories are marked superseded with links to the new wisdom note.
155
+ When multiple spores describe aspects of the same insight, consolidate them into a single comprehensive note. Source spores are marked superseded with links to the new wisdom note.
156
156
 
157
157
  ```json
158
158
  {
159
- "source_memory_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
159
+ "source_spore_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
160
160
  "consolidated_content": "# SQLite Operational Gotchas\n\n1. WAL mode requires shared memory...\n2. Single writer lock...\n3. FTS5 tokenization...",
161
161
  "observation_type": "gotcha",
162
162
  "tags": ["sqlite", "infrastructure"]
163
163
  }
164
164
  ```
165
165
 
166
- **When to use**: 3+ memories share a root cause, describe the same pattern from different angles, or would be more useful as a single comprehensive reference.
166
+ **When to use**: 3+ spores share a root cause, describe the same pattern from different angles, or would be more useful as a single comprehensive reference.
167
167
 
168
168
  For detailed patterns on when and how to consolidate, read `references/wisdom.md`.
169
169
 
170
170
  ## Wisdom — Keeping the Vault Clean
171
171
 
172
- Memories are injected into every prompt via the `UserPromptSubmit` hook. Each injected memory includes its ID (e.g., `[decision-abc123]`). When you see an injected memory that contradicts what you just did or know to be outdated, **supersede it immediately** — don't wait to be asked. This is how the vault stays accurate.
172
+ Spores are injected into every prompt via the `UserPromptSubmit` hook. Each injected spore includes its ID (e.g., `[decision-abc123]`). When you see an injected spore that contradicts what you just did or know to be outdated, **supersede it immediately** — don't wait to be asked. This is how the vault stays accurate.
173
173
 
174
174
  **Proactive superseding during normal work:**
175
175
 
176
- - You just changed how the stop hook works → an injected memory says it works the old way → `myco_supersede` with the old ID and a new `myco_remember` capturing the current behavior
177
- - You see two injected memories that say conflicting things → supersede the older one
176
+ - You just changed how the stop hook works → an injected spore says it works the old way → `myco_supersede` with the old ID and a new `myco_remember` capturing the current behavior
177
+ - You see two injected spores that say conflicting things → supersede the older one
178
178
  - An injected gotcha references code that was refactored → supersede it
179
179
 
180
180
  **Other signals to act on:**
181
181
 
182
182
  - **Recurring gotchas**: the same problem keeps being recorded → `myco_consolidate` into one definitive note
183
- - **Overlapping content**: a `myco_remember` would duplicate an existing memory → `myco_supersede` with updated content instead
183
+ - **Overlapping content**: a `myco_remember` would duplicate an existing spore → `myco_supersede` with updated content instead
184
184
  - **Stale decisions**: a decision references a deleted component or reversed approach → supersede it
185
185
 
186
186
  The vault should get sharper over time, not just bigger. Every session should leave the vault more accurate than it found it.
@@ -223,7 +223,7 @@ If observations were lost due to a bug, or if you want to re-extract observation
223
223
  node <plugin-root>/dist/src/cli.js reprocess
224
224
  ```
225
225
 
226
- This re-reads all session transcripts, re-extracts observations, and re-indexes everything. Existing memories are preserved — new observations are additive.
226
+ This re-reads all session transcripts, re-extracts observations, and re-indexes everything. Existing spores are preserved — new observations are additive.
227
227
 
228
228
  Options:
229
229
  - `--session <id>` — reprocess a single session (partial ID match)
@@ -1,10 +1,10 @@
1
1
  # Wisdom Consolidation Patterns
2
2
 
3
- When you notice patterns in vault memories — recurring themes, conflicting advice, outdated observations — use these tools to keep the vault clean and its knowledge sharp.
3
+ When you notice patterns in vault spores — recurring themes, conflicting advice, outdated observations — use these tools to keep the vault clean and its knowledge sharp.
4
4
 
5
5
  ## Supersede
6
6
 
7
- Use `myco_supersede` when a newer memory replaces an older one.
7
+ Use `myco_supersede` when a newer spore replaces an older one.
8
8
 
9
9
  **Signals:**
10
10
  - A decision was reversed in a later session
@@ -13,28 +13,28 @@ Use `myco_supersede` when a newer memory replaces an older one.
13
13
  - The codebase changed and an observation no longer applies
14
14
 
15
15
  **Example flow:**
16
- 1. You find memory `decision-abc123` saying "we chose bcrypt for password hashing"
17
- 2. A newer memory `decision-def456` says "migrated from bcrypt to argon2 for better side-channel resistance"
16
+ 1. You find spore `decision-abc123` saying "we chose bcrypt for password hashing"
17
+ 2. A newer spore `decision-def456` says "migrated from bcrypt to argon2 for better side-channel resistance"
18
18
  3. Supersede the old one:
19
19
  ```json
20
20
  {
21
- "old_memory_id": "decision-abc123",
22
- "new_memory_id": "decision-def456",
21
+ "old_spore_id": "decision-abc123",
22
+ "new_spore_id": "decision-def456",
23
23
  "reason": "Auth migrated from bcrypt to argon2"
24
24
  }
25
25
  ```
26
26
 
27
- The old memory stays in the vault (data is never deleted) but its frontmatter is marked `status: superseded` with a link to the replacement. Search results deprioritize superseded memories.
27
+ The old spore stays in the vault (data is never deleted) but its frontmatter is marked `status: superseded` with a link to the replacement. Search results deprioritize superseded spores.
28
28
 
29
29
  ## Consolidate
30
30
 
31
- Use `myco_consolidate` when multiple memories describe aspects of the same insight and would be more useful as a single comprehensive note.
31
+ Use `myco_consolidate` when multiple spores describe aspects of the same insight and would be more useful as a single comprehensive note.
32
32
 
33
33
  **Signals:**
34
34
  - Three gotchas about the same subsystem that share a root cause
35
35
  - Multiple discoveries about the same library that, together, form a complete picture
36
36
  - A bug fix and a gotcha that describe the same issue from different angles
37
- - Several trade-off memories about the same architectural decision
37
+ - Several trade-off spores about the same architectural decision
38
38
 
39
39
  **Example flow:**
40
40
  1. You find three related gotchas:
@@ -44,18 +44,18 @@ Use `myco_consolidate` when multiple memories describe aspects of the same insig
44
44
  2. Consolidate them into a wisdom note:
45
45
  ```json
46
46
  {
47
- "source_memory_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
47
+ "source_spore_ids": ["gotcha-aaa111", "gotcha-bbb222", "gotcha-ccc333"],
48
48
  "consolidated_content": "# SQLite Operational Gotchas\n\nThree key constraints when using SQLite in production:\n\n1. **WAL mode + Docker**: WAL requires shared memory (mmap). Containers with `--tmpfs` or read-only root filesystems break this. Mount the database directory as a named volume.\n\n2. **Concurrent write access**: SQLite serializes all writes through a single writer lock. Multiple processes writing concurrently will get SQLITE_BUSY. Use a single long-lived process (the daemon) for all writes.\n\n3. **FTS5 tokenization**: The default tokenizer splits on non-alphanumeric characters, so CamelCase identifiers like `getUserById` are indexed as one token. Use the `unicode61` tokenizer with `tokenchars` to handle this.",
49
49
  "observation_type": "gotcha",
50
50
  "tags": ["sqlite", "infrastructure"]
51
51
  }
52
52
  ```
53
53
 
54
- The source memories are marked `status: superseded` with links to the wisdom note. The wisdom note has `consolidated_from` in its frontmatter linking back to its sources.
54
+ The source spores are marked `status: superseded` with links to the wisdom note. The wisdom note has `consolidated_from` in its frontmatter linking back to its sources.
55
55
 
56
56
  ## When NOT to act
57
57
 
58
- - **Don't consolidate unrelated memories** that happen to share tags — they should remain separate observations
59
- - **Don't supersede a memory just because it's old** — age alone isn't a reason; the content must be outdated or replaced
60
- - **Don't force consolidation for fewer than 3 sources** — two related memories are fine as separate notes; consolidation adds value when there's a pattern across 3+
58
+ - **Don't consolidate unrelated spores** that happen to share tags — they should remain separate observations
59
+ - **Don't supersede a spore just because it's old** — age alone isn't a reason; the content must be outdated or replaced
60
+ - **Don't force consolidation for fewer than 3 sources** — two related spores are fine as separate notes; consolidation adds value when there's a pattern across 3+
61
61
  - **Don't consolidate across observation types** unless they truly describe the same insight from different angles (e.g., a bug_fix and a gotcha about the same issue is fine)
@@ -27,7 +27,7 @@ Rules files contain **project invariants** — things every agent must follow ev
27
27
  | Belongs in Rules File | Does NOT Belong |
28
28
  |----------------------|-----------------|
29
29
  | Hard constraints: "All API routes go through `src/routes/`" | Situational context (use Myco context injection) |
30
- | Golden paths: step-by-step standard procedures | Decision rationale (use Myco memory) |
30
+ | Golden paths: step-by-step standard procedures | Decision rationale (use Myco spore) |
31
31
  | Quality gates: specific commands that must pass | Code documentation (that's the codebase) |
32
32
  | Non-goals: what the project is NOT | Anything starting with "try to" or "when possible" |
33
33
 
@@ -166,15 +166,15 @@ Good rule: "better-sqlite3 MUST be installed with native bindings, not WASM. The
166
166
  1. Myco surfaces a pattern: "Your team has hit 3 gotchas about X. Should this become a rule?"
167
167
  2. If the developer approves:
168
168
  - Craft the rule from the observation
169
- - The rule states the **what** — the observation (in Myco memory) stores the **why**
169
+ - The rule states the **what** — the observation (in Myco spore) stores the **why**
170
170
  - Place it in the correct file and section
171
171
  3. If the developer dismisses: the observation stays as context, not a rule
172
172
 
173
- ### What stays as memory, NOT a rule
173
+ ### What stays as a spore, NOT a rule
174
174
 
175
175
  Reject promotion for:
176
176
  - One-off gotchas unlikely to recur (< 3 occurrences)
177
- - Decision rationale (the rule states what; memory stores why)
177
+ - Decision rationale (the rule states what; spore stores why)
178
178
  - Branch-specific or time-limited knowledge
179
179
  - Anything that would only matter during a specific initiative
180
180
 
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Shared constants for the Myco codebase.\n * Per CLAUDE.md: \"No Magic Literals — Numeric and string constants\n * MUST NOT appear inline in logic.\"\n */\n\n// --- Token estimation ---\n/** Approximate characters per token for the chars/4 heuristic. */\nexport const CHARS_PER_TOKEN = 4;\n\n// --- Embedding ---\n/** Max characters of text sent to the embedding model. */\nexport const EMBEDDING_INPUT_LIMIT = 8000;\n\n// --- Truncation limits (display/preview) ---\n/** Max chars for a user prompt preview in event summaries. */\nexport const PROMPT_PREVIEW_CHARS = 300;\n/** Max chars for an AI response preview in event summaries. */\nexport const AI_RESPONSE_PREVIEW_CHARS = 500;\n/** Max chars for a command string preview. */\nexport const COMMAND_PREVIEW_CHARS = 80;\n/** Max chars for a content snippet in search results. */\nexport const CONTENT_SNIPPET_CHARS = 120;\n/** Max chars for a tool output preview in hooks. */\nexport const TOOL_OUTPUT_PREVIEW_CHARS = 200;\n/** Max chars for a session summary preview in MCP tools. */\nexport const SESSION_SUMMARY_PREVIEW_CHARS = 300;\n/** Max chars for a recall summary preview. */\nexport const RECALL_SUMMARY_PREVIEW_CHARS = 200;\n\n// --- Context injection layer budgets (chars, not tokens — used with .slice()) ---\nexport const CONTEXT_PLAN_PREVIEW_CHARS = 100;\nexport const CONTEXT_SESSION_PREVIEW_CHARS = 80;\nexport const CONTEXT_MEMORY_PREVIEW_CHARS = 80;\n\n// --- Processor maxTokens budgets ---\n/** Response token budget for observation extraction. */\nexport const EXTRACTION_MAX_TOKENS = 2048;\n/** Response token budget for session summary. */\nexport const SUMMARY_MAX_TOKENS = 512;\n/** Response token budget for session title generation. */\nexport const TITLE_MAX_TOKENS = 32;\n/** Response token budget for artifact classification. */\nexport const CLASSIFICATION_MAX_TOKENS = 1024;\n\n// --- Timeouts ---\n/** Daemon client HTTP request timeout (ms). */\nexport const DAEMON_CLIENT_TIMEOUT_MS = 2000;\n/** Health check timeout (ms) — fail fast if daemon isn't responding. */\nexport const DAEMON_HEALTH_CHECK_TIMEOUT_MS = 500;\n/** LLM request timeout (ms). All LLM calls are background daemon work — no need to be aggressive. */\nexport const LLM_REQUEST_TIMEOUT_MS = 180_000;\n/** Embedding request timeout (ms). Embeddings run in background batch processing — generous timeout. */\nexport const EMBEDDING_REQUEST_TIMEOUT_MS = 60_000;\n/** Stdin read timeout for hooks (ms). */\nexport const STDIN_TIMEOUT_MS = 100;\n/** Chokidar write stability threshold (ms). */\nexport const FILE_WATCH_STABILITY_MS = 1000;\n/** Provider detection timeout for detect-providers CLI command (ms). */\nexport const PROVIDER_DETECT_TIMEOUT_MS = 3000;\n\n// --- Buffer cleanup ---\n/** Max age for stale buffer files before cleanup (ms). */\nexport const STALE_BUFFER_MAX_AGE_MS = 24 * 60 * 60 * 1000;\n\n// --- Retry backoff ---\n/** Retry delays for daemon health check (ms). */\nexport const DAEMON_HEALTH_RETRY_DELAYS = [100, 200, 400, 800, 1500];\n\n// --- Slug limits ---\n/** Max length for slugified artifact IDs. */\nexport const MAX_SLUG_LENGTH = 100;\n\n// --- Content preview for classification prompt ---\n/** Max chars of file content per candidate in classification prompt. */\nexport const CANDIDATE_CONTENT_PREVIEW = 2000;\n\n// --- Transcript mining ---\n/** Minimum content length to consider a transcript entry meaningful. */\nexport const MIN_TRANSCRIPT_CONTENT_LENGTH = 10;\n\n// --- Query limits ---\n/** Max recent sessions to check for lineage heuristics. */\nexport const LINEAGE_RECENT_SESSIONS_LIMIT = 5;\n/** Max related memories to query for session notes. */\nexport const RELATED_MEMORIES_LIMIT = 50;\n\n// --- Context injection ---\n/** Max active plans to inject at session start. */\nexport const SESSION_CONTEXT_MAX_PLANS = 3;\n/** Max memories to inject per prompt. */\nexport const PROMPT_CONTEXT_MAX_MEMORIES = 3;\n/** Minimum similarity score for prompt context injection (0-1). */\nexport const PROMPT_CONTEXT_MIN_SIMILARITY = 0.3;\n/** Max token budget for session-start context injection. */\nexport const SESSION_CONTEXT_MAX_TOKENS = 500;\n/** Max token budget for per-prompt context injection. */\nexport const PROMPT_CONTEXT_MAX_TOKENS = 300;\n/** Minimum prompt length to trigger context search. */\nexport const PROMPT_CONTEXT_MIN_LENGTH = 10;\n\n// --- MCP tool defaults ---\n/** Default result limit for myco_search. */\nexport const MCP_SEARCH_DEFAULT_LIMIT = 10;\n/** Default result limit for myco_sessions. */\nexport const MCP_SESSIONS_DEFAULT_LIMIT = 20;\n/** Default result limit for myco_logs. */\nexport const MCP_LOGS_DEFAULT_LIMIT = 50;\n"],"mappings":";;;AAQO,IAAM,kBAAkB;AAIxB,IAAM,wBAAwB;AAI9B,IAAM,uBAAuB;AAE7B,IAAM,4BAA4B;AAElC,IAAM,wBAAwB;AAE9B,IAAM,wBAAwB;AAE9B,IAAM,4BAA4B;AAElC,IAAM,gCAAgC;AAEtC,IAAM,+BAA+B;AAGrC,IAAM,6BAA6B;AACnC,IAAM,gCAAgC;AACtC,IAAM,+BAA+B;AAIrC,IAAM,wBAAwB;AAE9B,IAAM,qBAAqB;AAE3B,IAAM,mBAAmB;AAEzB,IAAM,4BAA4B;AAIlC,IAAM,2BAA2B;AAEjC,IAAM,iCAAiC;AAEvC,IAAM,yBAAyB;AAE/B,IAAM,+BAA+B;AAErC,IAAM,mBAAmB;AAEzB,IAAM,0BAA0B;AAEhC,IAAM,6BAA6B;AAInC,IAAM,0BAA0B,KAAK,KAAK,KAAK;AAI/C,IAAM,6BAA6B,CAAC,KAAK,KAAK,KAAK,KAAK,IAAI;AAI5D,IAAM,kBAAkB;AAIxB,IAAM,4BAA4B;AAQlC,IAAM,gCAAgC;AAEtC,IAAM,yBAAyB;AAI/B,IAAM,4BAA4B;AAElC,IAAM,8BAA8B;AAEpC,IAAM,gCAAgC;AAMtC,IAAM,4BAA4B;AAIlC,IAAM,2BAA2B;AAEjC,IAAM,6BAA6B;AAEnC,IAAM,yBAAyB;","names":[]}
@@ -1,160 +0,0 @@
1
- import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
2
- import {
3
- CHARS_PER_TOKEN,
4
- DAEMON_CLIENT_TIMEOUT_MS,
5
- EMBEDDING_REQUEST_TIMEOUT_MS,
6
- LLM_REQUEST_TIMEOUT_MS
7
- } from "./chunk-7VPJK56U.js";
8
-
9
- // src/intelligence/ollama.ts
10
- var OllamaBackend = class _OllamaBackend {
11
- static DEFAULT_BASE_URL = "http://localhost:11434";
12
- name = "ollama";
13
- baseUrl;
14
- model;
15
- contextWindow;
16
- defaultMaxTokens;
17
- constructor(config) {
18
- this.baseUrl = config?.base_url ?? _OllamaBackend.DEFAULT_BASE_URL;
19
- this.model = config?.model ?? config?.summary_model ?? "llama3.2";
20
- this.contextWindow = config?.context_window ?? 8192;
21
- this.defaultMaxTokens = config?.max_tokens ?? 1024;
22
- }
23
- async summarize(prompt, opts) {
24
- const maxTokens = opts?.maxTokens ?? this.defaultMaxTokens;
25
- const promptTokens = Math.ceil(prompt.length / CHARS_PER_TOKEN);
26
- const numCtx = Math.max(promptTokens + maxTokens, this.contextWindow);
27
- const response = await fetch(`${this.baseUrl}/api/generate`, {
28
- method: "POST",
29
- headers: { "Content-Type": "application/json" },
30
- body: JSON.stringify({
31
- model: this.model,
32
- prompt,
33
- stream: false,
34
- options: { num_ctx: numCtx }
35
- }),
36
- signal: AbortSignal.timeout(LLM_REQUEST_TIMEOUT_MS)
37
- });
38
- if (!response.ok) {
39
- throw new Error(`Ollama summarize failed: ${response.status} ${response.statusText}`);
40
- }
41
- const data = await response.json();
42
- return { text: data.response, model: data.model };
43
- }
44
- async embed(text) {
45
- const response = await fetch(`${this.baseUrl}/api/embed`, {
46
- method: "POST",
47
- headers: { "Content-Type": "application/json" },
48
- body: JSON.stringify({
49
- model: this.model,
50
- input: text
51
- }),
52
- signal: AbortSignal.timeout(EMBEDDING_REQUEST_TIMEOUT_MS)
53
- });
54
- if (!response.ok) {
55
- throw new Error(`Ollama embed failed: ${response.status} ${response.statusText}`);
56
- }
57
- const data = await response.json();
58
- const embedding = data.embeddings[0];
59
- return { embedding, model: data.model, dimensions: embedding.length };
60
- }
61
- async isAvailable() {
62
- try {
63
- const response = await fetch(`${this.baseUrl}/api/tags`, {
64
- signal: AbortSignal.timeout(DAEMON_CLIENT_TIMEOUT_MS)
65
- });
66
- return response.ok;
67
- } catch {
68
- return false;
69
- }
70
- }
71
- /** List available models on this Ollama instance. */
72
- async listModels(timeoutMs) {
73
- try {
74
- const response = await fetch(`${this.baseUrl}/api/tags`, {
75
- signal: AbortSignal.timeout(timeoutMs ?? DAEMON_CLIENT_TIMEOUT_MS)
76
- });
77
- const data = await response.json();
78
- return data.models.map((m) => m.name);
79
- } catch {
80
- return [];
81
- }
82
- }
83
- };
84
-
85
- // src/intelligence/lm-studio.ts
86
- var LmStudioBackend = class _LmStudioBackend {
87
- static DEFAULT_BASE_URL = "http://localhost:1234";
88
- name = "lm-studio";
89
- baseUrl;
90
- model;
91
- defaultMaxTokens;
92
- constructor(config) {
93
- this.baseUrl = config?.base_url ?? _LmStudioBackend.DEFAULT_BASE_URL;
94
- this.model = config?.model ?? config?.summary_model ?? "llama3.2";
95
- this.defaultMaxTokens = config?.max_tokens ?? 1024;
96
- }
97
- async summarize(prompt, opts) {
98
- const maxTokens = opts?.maxTokens ?? this.defaultMaxTokens;
99
- const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {
100
- method: "POST",
101
- headers: { "Content-Type": "application/json" },
102
- body: JSON.stringify({
103
- model: this.model,
104
- messages: [{ role: "user", content: prompt }],
105
- max_tokens: maxTokens
106
- }),
107
- signal: AbortSignal.timeout(LLM_REQUEST_TIMEOUT_MS)
108
- });
109
- if (!response.ok) {
110
- throw new Error(`LM Studio summarize failed: ${response.status}`);
111
- }
112
- const data = await response.json();
113
- return { text: data.choices[0].message.content, model: data.model };
114
- }
115
- async embed(text) {
116
- const response = await fetch(`${this.baseUrl}/v1/embeddings`, {
117
- method: "POST",
118
- headers: { "Content-Type": "application/json" },
119
- body: JSON.stringify({
120
- model: this.model,
121
- input: text
122
- }),
123
- signal: AbortSignal.timeout(EMBEDDING_REQUEST_TIMEOUT_MS)
124
- });
125
- if (!response.ok) {
126
- throw new Error(`LM Studio embed failed: ${response.status}`);
127
- }
128
- const data = await response.json();
129
- const embedding = data.data[0].embedding;
130
- return { embedding, model: data.model, dimensions: embedding.length };
131
- }
132
- async isAvailable() {
133
- try {
134
- const response = await fetch(`${this.baseUrl}/v1/models`, {
135
- signal: AbortSignal.timeout(DAEMON_CLIENT_TIMEOUT_MS)
136
- });
137
- return response.ok;
138
- } catch {
139
- return false;
140
- }
141
- }
142
- /** List available models on this LM Studio instance. */
143
- async listModels(timeoutMs) {
144
- try {
145
- const response = await fetch(`${this.baseUrl}/v1/models`, {
146
- signal: AbortSignal.timeout(timeoutMs ?? DAEMON_CLIENT_TIMEOUT_MS)
147
- });
148
- const data = await response.json();
149
- return data.data.map((m) => m.id);
150
- } catch {
151
- return [];
152
- }
153
- }
154
- };
155
-
156
- export {
157
- OllamaBackend,
158
- LmStudioBackend
159
- };
160
- //# sourceMappingURL=chunk-BA23DROX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/intelligence/ollama.ts","../src/intelligence/lm-studio.ts"],"sourcesContent":["import type { LlmProvider, EmbeddingProvider, LlmResponse, EmbeddingResponse, LlmRequestOptions } from './llm.js';\nimport { CHARS_PER_TOKEN, LLM_REQUEST_TIMEOUT_MS, EMBEDDING_REQUEST_TIMEOUT_MS, DAEMON_CLIENT_TIMEOUT_MS } from '../constants.js';\n\ninterface OllamaConfig {\n model?: string;\n base_url?: string;\n context_window?: number;\n max_tokens?: number;\n // Legacy fields (ignored, kept for backward compat during migration)\n embedding_model?: string;\n summary_model?: string;\n}\n\nexport class OllamaBackend implements LlmProvider, EmbeddingProvider {\n static readonly DEFAULT_BASE_URL = 'http://localhost:11434';\n readonly name = 'ollama';\n private baseUrl: string;\n private model: string;\n private contextWindow: number;\n private defaultMaxTokens: number;\n\n constructor(config?: OllamaConfig) {\n this.baseUrl = config?.base_url ?? OllamaBackend.DEFAULT_BASE_URL;\n this.model = config?.model ?? config?.summary_model ?? 'llama3.2';\n this.contextWindow = config?.context_window ?? 8192;\n this.defaultMaxTokens = config?.max_tokens ?? 1024;\n }\n\n async summarize(prompt: string, opts?: LlmRequestOptions): Promise<LlmResponse> {\n const maxTokens = opts?.maxTokens ?? this.defaultMaxTokens;\n const promptTokens = Math.ceil(prompt.length / CHARS_PER_TOKEN);\n const numCtx = Math.max(promptTokens + maxTokens, this.contextWindow);\n\n const response = await fetch(`${this.baseUrl}/api/generate`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n model: this.model,\n prompt,\n stream: false,\n options: { num_ctx: numCtx },\n }),\n signal: AbortSignal.timeout(LLM_REQUEST_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n throw new Error(`Ollama summarize failed: ${response.status} ${response.statusText}`);\n }\n\n const data = await response.json() as { response: string; model: string };\n return { text: data.response, model: data.model };\n }\n\n async embed(text: string): Promise<EmbeddingResponse> {\n const response = await fetch(`${this.baseUrl}/api/embed`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n model: this.model,\n input: text,\n }),\n signal: AbortSignal.timeout(EMBEDDING_REQUEST_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n throw new Error(`Ollama embed failed: ${response.status} ${response.statusText}`);\n }\n\n const data = await response.json() as { embeddings: number[][]; model: string };\n const embedding = data.embeddings[0];\n return { embedding, model: data.model, dimensions: embedding.length };\n }\n\n async isAvailable(): Promise<boolean> {\n try {\n const response = await fetch(`${this.baseUrl}/api/tags`, {\n signal: AbortSignal.timeout(DAEMON_CLIENT_TIMEOUT_MS),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n\n /** List available models on this Ollama instance. */\n async listModels(timeoutMs?: number): Promise<string[]> {\n try {\n const response = await fetch(`${this.baseUrl}/api/tags`, {\n signal: AbortSignal.timeout(timeoutMs ?? DAEMON_CLIENT_TIMEOUT_MS),\n });\n const data = await response.json() as { models: Array<{ name: string }> };\n return data.models.map((m) => m.name);\n } catch {\n return [];\n }\n }\n}\n","import type { LlmProvider, EmbeddingProvider, LlmResponse, EmbeddingResponse, LlmRequestOptions } from './llm.js';\nimport { LLM_REQUEST_TIMEOUT_MS, EMBEDDING_REQUEST_TIMEOUT_MS, DAEMON_CLIENT_TIMEOUT_MS } from '../constants.js';\n\ninterface LmStudioConfig {\n model?: string;\n base_url?: string;\n max_tokens?: number;\n // Legacy fields\n embedding_model?: string;\n summary_model?: string;\n}\n\nexport class LmStudioBackend implements LlmProvider, EmbeddingProvider {\n static readonly DEFAULT_BASE_URL = 'http://localhost:1234';\n readonly name = 'lm-studio';\n private baseUrl: string;\n private model: string;\n private defaultMaxTokens: number;\n\n constructor(config?: LmStudioConfig) {\n this.baseUrl = config?.base_url ?? LmStudioBackend.DEFAULT_BASE_URL;\n this.model = config?.model ?? config?.summary_model ?? 'llama3.2';\n this.defaultMaxTokens = config?.max_tokens ?? 1024;\n }\n\n async summarize(prompt: string, opts?: LlmRequestOptions): Promise<LlmResponse> {\n const maxTokens = opts?.maxTokens ?? this.defaultMaxTokens;\n\n const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n model: this.model,\n messages: [{ role: 'user', content: prompt }],\n max_tokens: maxTokens,\n }),\n signal: AbortSignal.timeout(LLM_REQUEST_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n throw new Error(`LM Studio summarize failed: ${response.status}`);\n }\n\n const data = await response.json() as {\n choices: Array<{ message: { content: string } }>;\n model: string;\n };\n return { text: data.choices[0].message.content, model: data.model };\n }\n\n async embed(text: string): Promise<EmbeddingResponse> {\n const response = await fetch(`${this.baseUrl}/v1/embeddings`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n model: this.model,\n input: text,\n }),\n signal: AbortSignal.timeout(EMBEDDING_REQUEST_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n throw new Error(`LM Studio embed failed: ${response.status}`);\n }\n\n const data = await response.json() as {\n data: Array<{ embedding: number[] }>;\n model: string;\n };\n const embedding = data.data[0].embedding;\n return { embedding, model: data.model, dimensions: embedding.length };\n }\n\n async isAvailable(): Promise<boolean> {\n try {\n const response = await fetch(`${this.baseUrl}/v1/models`, {\n signal: AbortSignal.timeout(DAEMON_CLIENT_TIMEOUT_MS),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n\n /** List available models on this LM Studio instance. */\n async listModels(timeoutMs?: number): Promise<string[]> {\n try {\n const response = await fetch(`${this.baseUrl}/v1/models`, {\n signal: AbortSignal.timeout(timeoutMs ?? DAEMON_CLIENT_TIMEOUT_MS),\n });\n const data = await response.json() as { data: Array<{ id: string }> };\n return data.data.map((m) => m.id);\n } catch {\n return [];\n }\n }\n}\n"],"mappings":"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","names":[]}