@goondocks/myco 0.5.0 → 0.6.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +4 -0
- package/dist/{chunk-JJL6AMDA.js → chunk-24DOZEUJ.js} +255 -6
- package/dist/chunk-24DOZEUJ.js.map +1 -0
- package/dist/{chunk-ZWUFTOG3.js → chunk-2GSX3BK2.js} +4 -4
- package/dist/{chunk-FIRMTYFH.js → chunk-2YBUL3IL.js} +4 -37
- package/dist/chunk-2YBUL3IL.js.map +1 -0
- package/dist/{chunk-HL2S5QZG.js → chunk-2ZBB3MQT.js} +319 -40
- package/dist/chunk-2ZBB3MQT.js.map +1 -0
- package/dist/{chunk-HJG7Z6SJ.js → chunk-3EM23DMD.js} +2 -2
- package/dist/{chunk-XQXXF6MU.js → chunk-4RMSHZE4.js} +12 -1
- package/dist/{chunk-XQXXF6MU.js.map → chunk-4RMSHZE4.js.map} +1 -1
- package/dist/{chunk-T7OC6GH5.js → chunk-5FNZ7AMX.js} +2 -2
- package/dist/{chunk-X6TKHO22.js → chunk-5QWZT4AB.js} +2 -2
- package/dist/{chunk-B6WVNDA5.js → chunk-6BSDCZ5Q.js} +8 -2
- package/dist/{chunk-B6WVNDA5.js.map → chunk-6BSDCZ5Q.js.map} +1 -1
- package/dist/{chunk-R6LQT3U7.js → chunk-B5UZSHQV.js} +8 -12
- package/dist/{chunk-R6LQT3U7.js.map → chunk-B5UZSHQV.js.map} +1 -1
- package/dist/{chunk-7KQB22DP.js → chunk-E7OBRBCQ.js} +2 -2
- package/dist/{chunk-RCV2I4AI.js → chunk-GDYYJTTT.js} +5 -3
- package/dist/{chunk-RCV2I4AI.js.map → chunk-GDYYJTTT.js.map} +1 -1
- package/dist/{chunk-MIU3DKLN.js → chunk-GNR3QAER.js} +2 -2
- package/dist/{chunk-BMJX2IDQ.js → chunk-H7PRCVGQ.js} +2 -2
- package/dist/{chunk-6LTNFMXO.js → chunk-KC7ENQTN.js} +2 -2
- package/dist/chunk-KUMVJIJW.js +117 -0
- package/dist/chunk-KUMVJIJW.js.map +1 -0
- package/dist/{chunk-ND4VK6C7.js → chunk-L25U7PIG.js} +2 -2
- package/dist/{chunk-6UJWI4IW.js → chunk-MQSYSQ6T.js} +7 -5
- package/dist/{chunk-6UJWI4IW.js.map → chunk-MQSYSQ6T.js.map} +1 -1
- package/dist/{chunk-TBRZAJ7W.js → chunk-P3WO3N3I.js} +11 -3
- package/dist/chunk-P3WO3N3I.js.map +1 -0
- package/dist/{chunk-JI6M2L2W.js → chunk-QGJ2ZIUZ.js} +7 -4
- package/dist/chunk-QGJ2ZIUZ.js.map +1 -0
- package/dist/{chunk-5EZ7QF6J.js → chunk-QLUE3BUL.js} +66 -1
- package/dist/chunk-QLUE3BUL.js.map +1 -0
- package/dist/{chunk-AK6GNLPV.js → chunk-TWSTAVLO.js} +17 -1
- package/dist/{chunk-AK6GNLPV.js.map → chunk-TWSTAVLO.js.map} +1 -1
- package/dist/{chunk-FIA5NTRH.js → chunk-UVGAVYWZ.js} +11 -13
- package/dist/chunk-UVGAVYWZ.js.map +1 -0
- package/dist/{chunk-UKWO26VI.js → chunk-YTANWAGE.js} +2 -2
- package/dist/chunk-ZMYNRTTD.js +64 -0
- package/dist/chunk-ZMYNRTTD.js.map +1 -0
- package/dist/{cli-BLYNNKGJ.js → cli-K7SUTP7A.js} +22 -22
- package/dist/{client-5GB4WVXE.js → client-YJMNTITQ.js} +5 -5
- package/dist/{config-5FGLQGCW.js → config-G5GGT5A6.js} +3 -3
- package/dist/curate-6T5NKVXK.js +80 -0
- package/dist/curate-6T5NKVXK.js.map +1 -0
- package/dist/{detect-providers-BIHYFK5M.js → detect-providers-S3M5TAMW.js} +3 -3
- package/dist/{digest-7NKYXM6G.js → digest-O35VHYFP.js} +31 -40
- package/dist/digest-O35VHYFP.js.map +1 -0
- package/dist/{init-HPQ77WWF.js → init-TFLSATB3.js} +9 -11
- package/dist/init-TFLSATB3.js.map +1 -0
- package/dist/{logs-BSTBZHDR.js → logs-IENORIYR.js} +3 -3
- package/dist/{main-NFQ4II75.js → main-JEUQS3BY.js} +1218 -294
- package/dist/main-JEUQS3BY.js.map +1 -0
- package/dist/rebuild-7SH5GSNX.js +66 -0
- package/dist/rebuild-7SH5GSNX.js.map +1 -0
- package/dist/{reprocess-ZL4HKTSC.js → reprocess-Q4YH2ZBK.js} +20 -22
- package/dist/{reprocess-ZL4HKTSC.js.map → reprocess-Q4YH2ZBK.js.map} +1 -1
- package/dist/{restart-FYW662DR.js → restart-NLJLB52D.js} +7 -6
- package/dist/{restart-FYW662DR.js.map → restart-NLJLB52D.js.map} +1 -1
- package/dist/{search-E5JQMTXV.js → search-2BVRF54H.js} +10 -10
- package/dist/{server-TV3D35HZ.js → server-4AMZNP4F.js} +51 -97
- package/dist/{server-TV3D35HZ.js.map → server-4AMZNP4F.js.map} +1 -1
- package/dist/{session-QF6MILAC.js → session-F326AWCH.js} +2 -2
- package/dist/{session-start-5MFEOVQ5.js → session-start-AZAF3DTE.js} +10 -10
- package/dist/setup-digest-YLZZGSSR.js +15 -0
- package/dist/setup-llm-JOXBSLXC.js +15 -0
- package/dist/src/cli.js +4 -4
- package/dist/src/daemon/main.js +4 -4
- package/dist/src/hooks/post-tool-use.js +5 -5
- package/dist/src/hooks/session-end.js +5 -5
- package/dist/src/hooks/session-start.js +4 -4
- package/dist/src/hooks/stop.js +7 -7
- package/dist/src/hooks/user-prompt-submit.js +5 -5
- package/dist/src/mcp/server.js +4 -4
- package/dist/src/prompts/consolidation.md +46 -0
- package/dist/src/templates/portal.md +5 -0
- package/dist/stats-MKDIZFIQ.js +58 -0
- package/dist/stats-MKDIZFIQ.js.map +1 -0
- package/dist/templates-XPRBOWCE.js +38 -0
- package/dist/templates-XPRBOWCE.js.map +1 -0
- package/dist/ui/assets/index-D37IoDXS.css +1 -0
- package/dist/ui/assets/index-DA61Ial2.js +289 -0
- package/dist/ui/favicon.svg +11 -0
- package/dist/ui/fonts/GeistMono-LICENSE.txt +92 -0
- package/dist/ui/fonts/GeistMono-Variable.woff2 +0 -0
- package/dist/ui/index.html +14 -0
- package/dist/{verify-RACBFT2P.js → verify-7DW7LAND.js} +6 -6
- package/dist/{version-HJTVNPOO.js → version-RQLD7VBP.js} +4 -4
- package/package.json +3 -2
- package/skills/myco/SKILL.md +20 -1
- package/skills/myco/references/cli-usage.md +48 -0
- package/skills/myco/references/wisdom.md +11 -1
- package/dist/chunk-2AMAOSRF.js +0 -105
- package/dist/chunk-2AMAOSRF.js.map +0 -1
- package/dist/chunk-5EZ7QF6J.js.map +0 -1
- package/dist/chunk-FIA5NTRH.js.map +0 -1
- package/dist/chunk-FIRMTYFH.js.map +0 -1
- package/dist/chunk-HL2S5QZG.js.map +0 -1
- package/dist/chunk-IURC35BF.js +0 -49
- package/dist/chunk-IURC35BF.js.map +0 -1
- package/dist/chunk-JI6M2L2W.js.map +0 -1
- package/dist/chunk-JJL6AMDA.js.map +0 -1
- package/dist/chunk-KYL67SKZ.js +0 -150
- package/dist/chunk-KYL67SKZ.js.map +0 -1
- package/dist/chunk-TBRZAJ7W.js.map +0 -1
- package/dist/curate-S4HOYWXA.js +0 -231
- package/dist/curate-S4HOYWXA.js.map +0 -1
- package/dist/digest-7NKYXM6G.js.map +0 -1
- package/dist/init-HPQ77WWF.js.map +0 -1
- package/dist/main-NFQ4II75.js.map +0 -1
- package/dist/rebuild-KQ6G2GZM.js +0 -86
- package/dist/rebuild-KQ6G2GZM.js.map +0 -1
- package/dist/setup-digest-DZAFIBEF.js +0 -15
- package/dist/setup-llm-4BZM33YT.js +0 -15
- package/dist/stats-ZIIJ2GB3.js +0 -77
- package/dist/stats-ZIIJ2GB3.js.map +0 -1
- /package/dist/{chunk-ZWUFTOG3.js.map → chunk-2GSX3BK2.js.map} +0 -0
- /package/dist/{chunk-HJG7Z6SJ.js.map → chunk-3EM23DMD.js.map} +0 -0
- /package/dist/{chunk-T7OC6GH5.js.map → chunk-5FNZ7AMX.js.map} +0 -0
- /package/dist/{chunk-X6TKHO22.js.map → chunk-5QWZT4AB.js.map} +0 -0
- /package/dist/{chunk-7KQB22DP.js.map → chunk-E7OBRBCQ.js.map} +0 -0
- /package/dist/{chunk-MIU3DKLN.js.map → chunk-GNR3QAER.js.map} +0 -0
- /package/dist/{chunk-BMJX2IDQ.js.map → chunk-H7PRCVGQ.js.map} +0 -0
- /package/dist/{chunk-6LTNFMXO.js.map → chunk-KC7ENQTN.js.map} +0 -0
- /package/dist/{chunk-ND4VK6C7.js.map → chunk-L25U7PIG.js.map} +0 -0
- /package/dist/{chunk-UKWO26VI.js.map → chunk-YTANWAGE.js.map} +0 -0
- /package/dist/{cli-BLYNNKGJ.js.map → cli-K7SUTP7A.js.map} +0 -0
- /package/dist/{client-5GB4WVXE.js.map → client-YJMNTITQ.js.map} +0 -0
- /package/dist/{config-5FGLQGCW.js.map → config-G5GGT5A6.js.map} +0 -0
- /package/dist/{detect-providers-BIHYFK5M.js.map → detect-providers-S3M5TAMW.js.map} +0 -0
- /package/dist/{logs-BSTBZHDR.js.map → logs-IENORIYR.js.map} +0 -0
- /package/dist/{search-E5JQMTXV.js.map → search-2BVRF54H.js.map} +0 -0
- /package/dist/{session-QF6MILAC.js.map → session-F326AWCH.js.map} +0 -0
- /package/dist/{session-start-5MFEOVQ5.js.map → session-start-AZAF3DTE.js.map} +0 -0
- /package/dist/{setup-digest-DZAFIBEF.js.map → setup-digest-YLZZGSSR.js.map} +0 -0
- /package/dist/{setup-llm-4BZM33YT.js.map → setup-llm-JOXBSLXC.js.map} +0 -0
- /package/dist/{verify-RACBFT2P.js.map → verify-7DW7LAND.js.map} +0 -0
- /package/dist/{version-HJTVNPOO.js.map → version-RQLD7VBP.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_dist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MQSYSQ6T.js";
|
|
5
5
|
import {
|
|
6
6
|
__toESM
|
|
7
7
|
} from "./chunk-PZUWP5VK.js";
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
sessionFm,
|
|
35
35
|
sporeFm
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-GNR3QAER.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
LEVEL_ORDER
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QLUE3BUL.js";
|
|
5
5
|
|
|
6
6
|
// src/logs/reader.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -88,4 +88,4 @@ export {
|
|
|
88
88
|
queryLogs,
|
|
89
89
|
matchesFilter
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-H7PRCVGQ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_dist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MQSYSQ6T.js";
|
|
5
5
|
import {
|
|
6
6
|
__toESM
|
|
7
7
|
} from "./chunk-PZUWP5VK.js";
|
|
@@ -433,4 +433,4 @@ export {
|
|
|
433
433
|
extractSection,
|
|
434
434
|
VaultWriter
|
|
435
435
|
};
|
|
436
|
-
//# sourceMappingURL=chunk-
|
|
436
|
+
//# sourceMappingURL=chunk-KC7ENQTN.js.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
VaultWriter
|
|
4
|
+
} from "./chunk-KC7ENQTN.js";
|
|
5
|
+
import {
|
|
6
|
+
supersedeSpore
|
|
7
|
+
} from "./chunk-UVGAVYWZ.js";
|
|
8
|
+
import {
|
|
9
|
+
indexNote
|
|
10
|
+
} from "./chunk-24DOZEUJ.js";
|
|
11
|
+
import {
|
|
12
|
+
generateEmbedding
|
|
13
|
+
} from "./chunk-RGVBGTD6.js";
|
|
14
|
+
import {
|
|
15
|
+
stripFrontmatter
|
|
16
|
+
} from "./chunk-GNR3QAER.js";
|
|
17
|
+
import {
|
|
18
|
+
DIGEST_TIERS,
|
|
19
|
+
EMBEDDING_INPUT_LIMIT
|
|
20
|
+
} from "./chunk-6BSDCZ5Q.js";
|
|
21
|
+
|
|
22
|
+
// src/mcp/tools/context.ts
|
|
23
|
+
import fs from "fs";
|
|
24
|
+
import path from "path";
|
|
25
|
+
var DEFAULT_CONTEXT_TIER = 3e3;
|
|
26
|
+
function tryReadExtract(filePath, tier, fallback) {
|
|
27
|
+
let raw;
|
|
28
|
+
try {
|
|
29
|
+
raw = fs.readFileSync(filePath, "utf-8");
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const { body, frontmatter } = stripFrontmatter(raw);
|
|
34
|
+
const generated = frontmatter.generated;
|
|
35
|
+
return {
|
|
36
|
+
content: body,
|
|
37
|
+
tier,
|
|
38
|
+
fallback,
|
|
39
|
+
generated
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function handleMycoContext(vaultDir, input) {
|
|
43
|
+
const requestedTier = input.tier ?? DEFAULT_CONTEXT_TIER;
|
|
44
|
+
const digestDir = path.join(vaultDir, "digest");
|
|
45
|
+
const exact = tryReadExtract(path.join(digestDir, `extract-${requestedTier}.md`), requestedTier, false);
|
|
46
|
+
if (exact) return exact;
|
|
47
|
+
const candidates = [...DIGEST_TIERS].sort((a, b) => Math.abs(a - requestedTier) - Math.abs(b - requestedTier));
|
|
48
|
+
for (const tier of candidates) {
|
|
49
|
+
const result = tryReadExtract(path.join(digestDir, `extract-${tier}.md`), tier, true);
|
|
50
|
+
if (result) return result;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
content: "Digest context is not yet available. The first digest cycle has not completed.",
|
|
54
|
+
tier: requestedTier,
|
|
55
|
+
fallback: false
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/vault/consolidation.ts
|
|
60
|
+
import { randomBytes } from "crypto";
|
|
61
|
+
async function consolidateSpores(input, deps) {
|
|
62
|
+
const { vaultDir, index, vectorIndex, embeddingProvider } = deps;
|
|
63
|
+
const writer = new VaultWriter(vaultDir);
|
|
64
|
+
const wisdomId = `${input.observationType}-wisdom-${randomBytes(4).toString("hex")}`;
|
|
65
|
+
const sourceLinks = input.sourceSporeIds.map((id) => `- [[${id}]]`).join("\n");
|
|
66
|
+
const sourcesSection = input.sourceSporeIds.length > 0 ? `
|
|
67
|
+
|
|
68
|
+
## Sources
|
|
69
|
+
|
|
70
|
+
Consolidated from:
|
|
71
|
+
${sourceLinks}` : "";
|
|
72
|
+
const fullContent = `${input.consolidatedContent}${sourcesSection}`;
|
|
73
|
+
const wisdomPath = writer.writeSpore({
|
|
74
|
+
id: wisdomId,
|
|
75
|
+
observation_type: input.observationType,
|
|
76
|
+
tags: [...input.tags ?? [], "wisdom", "consolidated"],
|
|
77
|
+
content: fullContent
|
|
78
|
+
});
|
|
79
|
+
writer.updateNoteFrontmatter(wisdomPath, {
|
|
80
|
+
consolidated_from: input.sourceSporeIds
|
|
81
|
+
}, true);
|
|
82
|
+
const sourceNotes = index.queryByIds(input.sourceSporeIds);
|
|
83
|
+
const sourceNoteMap = new Map(sourceNotes.map((n) => [n.id, n]));
|
|
84
|
+
let sourcesArchived = 0;
|
|
85
|
+
for (const sourceId of input.sourceSporeIds) {
|
|
86
|
+
const note = sourceNoteMap.get(sourceId);
|
|
87
|
+
if (!note) continue;
|
|
88
|
+
const superseded = supersedeSpore(sourceId, wisdomId, note.path, {
|
|
89
|
+
index,
|
|
90
|
+
vectorIndex,
|
|
91
|
+
vaultDir
|
|
92
|
+
});
|
|
93
|
+
if (superseded) sourcesArchived++;
|
|
94
|
+
}
|
|
95
|
+
indexNote(index, vaultDir, wisdomPath);
|
|
96
|
+
if (vectorIndex && embeddingProvider) {
|
|
97
|
+
generateEmbedding(embeddingProvider, fullContent.slice(0, EMBEDDING_INPUT_LIMIT)).then(
|
|
98
|
+
(emb) => vectorIndex.upsert(wisdomId, emb.embedding, {
|
|
99
|
+
type: "spore",
|
|
100
|
+
observation_type: input.observationType,
|
|
101
|
+
importance: "high"
|
|
102
|
+
})
|
|
103
|
+
).catch(() => {
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
wisdom_id: wisdomId,
|
|
108
|
+
wisdom_path: wisdomPath,
|
|
109
|
+
sources_archived: sourcesArchived
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
consolidateSpores,
|
|
115
|
+
handleMycoContext
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=chunk-KUMVJIJW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/tools/context.ts","../src/vault/consolidation.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { stripFrontmatter } from '../../vault/frontmatter.js';\nimport { DIGEST_TIERS } from '../../constants.js';\n\n/** Default tier when none is requested. */\nconst DEFAULT_CONTEXT_TIER = 3000;\n\ninterface ContextInput {\n tier?: number;\n}\n\nexport interface ContextResult {\n content: string;\n tier: number;\n fallback: boolean;\n generated?: string;\n}\n\n/**\n * Try to read a digest extract file. Returns null if the file doesn't exist.\n * Strips YAML frontmatter and extracts the generated timestamp.\n */\nfunction tryReadExtract(filePath: string, tier: number, fallback: boolean): ContextResult | null {\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, 'utf-8');\n } catch {\n return null;\n }\n\n const { body, frontmatter } = stripFrontmatter(raw);\n const generated = frontmatter.generated as string | undefined;\n\n return {\n content: body,\n tier,\n fallback,\n generated,\n };\n}\n\nexport function handleMycoContext(vaultDir: string, input: ContextInput): ContextResult {\n const requestedTier = input.tier ?? DEFAULT_CONTEXT_TIER;\n const digestDir = path.join(vaultDir, 'digest');\n\n // Try exact tier first\n const exact = tryReadExtract(path.join(digestDir, `extract-${requestedTier}.md`), requestedTier, false);\n if (exact) return exact;\n\n // Fall back to nearest available tier\n const candidates = [...DIGEST_TIERS]\n .sort((a, b) => Math.abs(a - requestedTier) - Math.abs(b - requestedTier));\n\n for (const tier of candidates) {\n const result = tryReadExtract(path.join(digestDir, `extract-${tier}.md`), tier, true);\n if (result) return result;\n }\n\n return {\n content: 'Digest context is not yet available. The first digest cycle has not completed.',\n tier: requestedTier,\n fallback: false,\n };\n}\n","/**\n * Shared consolidation core — creates a wisdom note from a set of source spores\n * and marks each source as superseded.\n *\n * Used by both the MCP tool (`myco_consolidate`) and the daemon's automatic\n * consolidation pass so the logic lives in exactly one place.\n */\n\nimport { VaultWriter } from './writer.js';\nimport { supersedeSpore } from './curation.js';\nimport { indexNote } from '../index/rebuild.js';\nimport type { MycoIndex } from '../index/sqlite.js';\nimport type { VectorIndex } from '../index/vectors.js';\nimport type { EmbeddingProvider } from '../intelligence/llm.js';\nimport { generateEmbedding } from '../intelligence/embeddings.js';\nimport { EMBEDDING_INPUT_LIMIT } from '../constants.js';\nimport { randomBytes } from 'node:crypto';\n\nexport interface ConsolidateInput {\n sourceSporeIds: string[];\n consolidatedContent: string;\n observationType: string;\n tags?: string[];\n}\n\nexport interface ConsolidateResult {\n wisdom_id: string;\n wisdom_path: string;\n sources_archived: number;\n}\n\nexport interface ConsolidateDeps {\n vaultDir: string;\n index: MycoIndex;\n vectorIndex: VectorIndex | null;\n embeddingProvider: EmbeddingProvider | null;\n}\n\n/**\n * Create a consolidated wisdom note from a list of source spore IDs, then\n * mark each source spore as superseded.\n *\n * - The wisdom note is written via VaultWriter.writeSpore() with 'wisdom' and\n * 'consolidated' tags appended.\n * - `consolidated_from` is added to the wisdom note's frontmatter.\n * - Each source spore is updated atomically via `supersedeSpore` (frontmatter\n * update + notice append + re-index + vector deletion).\n * - The wisdom note is indexed and, if deps are available, embedded with\n * importance 'high' (fire-and-forget).\n *\n * Source spores missing from the index are silently skipped.\n */\nexport async function consolidateSpores(\n input: ConsolidateInput,\n deps: ConsolidateDeps,\n): Promise<ConsolidateResult> {\n const { vaultDir, index, vectorIndex, embeddingProvider } = deps;\n const writer = new VaultWriter(vaultDir);\n\n const wisdomId = `${input.observationType}-wisdom-${randomBytes(4).toString('hex')}`;\n\n // Build content with a ## Sources section containing Obsidian wikilinks\n const sourceLinks = input.sourceSporeIds.map((id) => `- [[${id}]]`).join('\\n');\n const sourcesSection = input.sourceSporeIds.length > 0\n ? `\\n\\n## Sources\\n\\nConsolidated from:\\n${sourceLinks}`\n : '';\n const fullContent = `${input.consolidatedContent}${sourcesSection}`;\n\n // Write the wisdom spore note\n const wisdomPath = writer.writeSpore({\n id: wisdomId,\n observation_type: input.observationType,\n tags: [...(input.tags ?? []), 'wisdom', 'consolidated'],\n content: fullContent,\n });\n\n // Add consolidated_from to the wisdom note's frontmatter\n writer.updateNoteFrontmatter(wisdomPath, {\n consolidated_from: input.sourceSporeIds,\n }, true);\n\n // Supersede each source spore (atomic frontmatter update + notice + re-index + vector delete)\n const sourceNotes = index.queryByIds(input.sourceSporeIds);\n const sourceNoteMap = new Map(sourceNotes.map((n) => [n.id, n]));\n let sourcesArchived = 0;\n for (const sourceId of input.sourceSporeIds) {\n const note = sourceNoteMap.get(sourceId);\n if (!note) continue;\n\n const superseded = supersedeSpore(sourceId, wisdomId, note.path, {\n index,\n vectorIndex,\n vaultDir,\n });\n\n if (superseded) sourcesArchived++;\n }\n\n // Index the new wisdom note\n indexNote(index, vaultDir, wisdomPath);\n\n // Embed the wisdom note (fire-and-forget — embedding failure is non-fatal)\n if (vectorIndex && embeddingProvider) {\n generateEmbedding(embeddingProvider, fullContent.slice(0, EMBEDDING_INPUT_LIMIT))\n .then((emb) =>\n vectorIndex.upsert(wisdomId, emb.embedding, {\n type: 'spore',\n observation_type: input.observationType,\n importance: 'high',\n }),\n )\n .catch(() => { /* embedding failure is non-fatal */ });\n }\n\n return {\n wisdom_id: wisdomId,\n wisdom_path: wisdomPath,\n sources_archived: sourcesArchived,\n };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
STDIN_TIMEOUT_MS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6BSDCZ5Q.js";
|
|
5
5
|
|
|
6
6
|
// src/hooks/read-stdin.ts
|
|
7
7
|
function readStdin() {
|
|
@@ -18,4 +18,4 @@ function readStdin() {
|
|
|
18
18
|
export {
|
|
19
19
|
readStdin
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-L25U7PIG.js.map
|
|
@@ -21064,14 +21064,14 @@ config(en_default());
|
|
|
21064
21064
|
|
|
21065
21065
|
// src/config/schema.ts
|
|
21066
21066
|
var LlmProviderSchema = external_exports.object({
|
|
21067
|
-
provider: external_exports.enum(["ollama", "lm-studio", "anthropic"]).default("ollama"),
|
|
21067
|
+
provider: external_exports.enum(["ollama", "lm-studio", "anthropic", "openai-compatible"]).default("ollama"),
|
|
21068
21068
|
model: external_exports.string().default("qwen3.5"),
|
|
21069
21069
|
base_url: external_exports.string().url().optional(),
|
|
21070
21070
|
context_window: external_exports.number().int().positive().default(8192),
|
|
21071
21071
|
max_tokens: external_exports.number().int().positive().default(1024)
|
|
21072
21072
|
});
|
|
21073
21073
|
var EmbeddingProviderSchema = external_exports.object({
|
|
21074
|
-
provider: external_exports.enum(["ollama", "lm-studio"]).default("ollama"),
|
|
21074
|
+
provider: external_exports.enum(["ollama", "lm-studio", "openai-compatible"]).default("ollama"),
|
|
21075
21075
|
model: external_exports.string().default("bge-m3"),
|
|
21076
21076
|
base_url: external_exports.string().url().optional()
|
|
21077
21077
|
});
|
|
@@ -21080,6 +21080,7 @@ var IntelligenceSchema = external_exports.object({
|
|
|
21080
21080
|
embedding: EmbeddingProviderSchema.default(() => EmbeddingProviderSchema.parse({}))
|
|
21081
21081
|
});
|
|
21082
21082
|
var DaemonSchema = external_exports.object({
|
|
21083
|
+
port: external_exports.number().int().min(1024).max(65535).nullable().default(null),
|
|
21083
21084
|
log_level: external_exports.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
21084
21085
|
grace_period: external_exports.number().int().positive().default(30),
|
|
21085
21086
|
max_log_size: external_exports.number().int().positive().default(5242880)
|
|
@@ -21117,7 +21118,7 @@ var TeamSchema = external_exports.object({
|
|
|
21117
21118
|
sync: external_exports.enum(["git", "obsidian-sync", "manual"]).default("git")
|
|
21118
21119
|
});
|
|
21119
21120
|
var DigestIntelligenceSchema = external_exports.object({
|
|
21120
|
-
provider: external_exports.enum(["ollama", "lm-studio", "anthropic"]).nullable().default(null),
|
|
21121
|
+
provider: external_exports.enum(["ollama", "lm-studio", "anthropic", "openai-compatible"]).nullable().default(null),
|
|
21121
21122
|
model: external_exports.string().nullable().default(null),
|
|
21122
21123
|
base_url: external_exports.string().nullable().default(null),
|
|
21123
21124
|
context_window: external_exports.number().int().positive().default(32768),
|
|
@@ -21140,7 +21141,8 @@ var DigestSchema = external_exports.object({
|
|
|
21140
21141
|
inject_tier: external_exports.number().int().positive().nullable().default(3e3),
|
|
21141
21142
|
intelligence: DigestIntelligenceSchema.default(() => DigestIntelligenceSchema.parse({})),
|
|
21142
21143
|
metabolism: DigestMetabolismSchema.default(() => DigestMetabolismSchema.parse({})),
|
|
21143
|
-
substrate: DigestSubstrateSchema.default(() => DigestSubstrateSchema.parse({}))
|
|
21144
|
+
substrate: DigestSubstrateSchema.default(() => DigestSubstrateSchema.parse({})),
|
|
21145
|
+
consolidation: external_exports.boolean().default(false)
|
|
21144
21146
|
});
|
|
21145
21147
|
var MycoConfigSchema = external_exports.object({
|
|
21146
21148
|
version: external_exports.literal(2),
|
|
@@ -21178,4 +21180,4 @@ export {
|
|
|
21178
21180
|
external_exports,
|
|
21179
21181
|
MycoConfigSchema
|
|
21180
21182
|
};
|
|
21181
|
-
//# sourceMappingURL=chunk-
|
|
21183
|
+
//# sourceMappingURL=chunk-MQSYSQ6T.js.map
|