@goondocks/myco 0.6.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/.claude-plugin/marketplace.json +2 -3
  2. package/.claude-plugin/plugin.json +3 -3
  3. package/CONTRIBUTING.md +37 -30
  4. package/README.md +64 -28
  5. package/bin/myco-run +2 -0
  6. package/dist/agent-run-EFICNTAU.js +34 -0
  7. package/dist/agent-run-EFICNTAU.js.map +1 -0
  8. package/dist/agent-tasks-RXJ7Z5NG.js +180 -0
  9. package/dist/agent-tasks-RXJ7Z5NG.js.map +1 -0
  10. package/dist/chunk-2T7RPVPP.js +116 -0
  11. package/dist/chunk-2T7RPVPP.js.map +1 -0
  12. package/dist/chunk-3K5WGSJ4.js +165 -0
  13. package/dist/chunk-3K5WGSJ4.js.map +1 -0
  14. package/dist/chunk-46PWOKSI.js +26 -0
  15. package/dist/chunk-46PWOKSI.js.map +1 -0
  16. package/dist/chunk-4LPQ26CK.js +277 -0
  17. package/dist/chunk-4LPQ26CK.js.map +1 -0
  18. package/dist/chunk-5PEUFJ6U.js +92 -0
  19. package/dist/chunk-5PEUFJ6U.js.map +1 -0
  20. package/dist/chunk-5VZ52A4T.js +136 -0
  21. package/dist/chunk-5VZ52A4T.js.map +1 -0
  22. package/dist/chunk-BUSP3OJB.js +103 -0
  23. package/dist/chunk-BUSP3OJB.js.map +1 -0
  24. package/dist/chunk-D7TYRPRM.js +7312 -0
  25. package/dist/chunk-D7TYRPRM.js.map +1 -0
  26. package/dist/chunk-DCXRSSBP.js +22 -0
  27. package/dist/chunk-DCXRSSBP.js.map +1 -0
  28. package/dist/chunk-E4VLWIJC.js +2 -0
  29. package/dist/chunk-FFAYUQ5N.js +39 -0
  30. package/dist/chunk-FFAYUQ5N.js.map +1 -0
  31. package/dist/chunk-IB76KGBY.js +2 -0
  32. package/dist/chunk-JMJJEQ3P.js +486 -0
  33. package/dist/chunk-JMJJEQ3P.js.map +1 -0
  34. package/dist/{chunk-N33KUCFP.js → chunk-JTYZRPX5.js} +1 -9
  35. package/dist/chunk-JTYZRPX5.js.map +1 -0
  36. package/dist/{chunk-NLUE6CYG.js → chunk-JYOOJCPQ.js} +33 -17
  37. package/dist/chunk-JYOOJCPQ.js.map +1 -0
  38. package/dist/{chunk-Z74SDEKE.js → chunk-KB4DGYIY.js} +91 -9
  39. package/dist/chunk-KB4DGYIY.js.map +1 -0
  40. package/dist/{chunk-ERG2IEWX.js → chunk-KH64DHOY.js} +3 -7413
  41. package/dist/chunk-KH64DHOY.js.map +1 -0
  42. package/dist/chunk-KV4OC4H3.js +498 -0
  43. package/dist/chunk-KV4OC4H3.js.map +1 -0
  44. package/dist/chunk-KYLDNM7H.js +66 -0
  45. package/dist/chunk-KYLDNM7H.js.map +1 -0
  46. package/dist/chunk-LPUQPDC2.js +19 -0
  47. package/dist/chunk-LPUQPDC2.js.map +1 -0
  48. package/dist/chunk-M5XWW7UI.js +97 -0
  49. package/dist/chunk-M5XWW7UI.js.map +1 -0
  50. package/dist/chunk-MHSCMET3.js +275 -0
  51. package/dist/chunk-MHSCMET3.js.map +1 -0
  52. package/dist/chunk-MYX5NCRH.js +45 -0
  53. package/dist/chunk-MYX5NCRH.js.map +1 -0
  54. package/dist/chunk-OXZSXYAT.js +877 -0
  55. package/dist/chunk-OXZSXYAT.js.map +1 -0
  56. package/dist/chunk-PB6TOLRQ.js +35 -0
  57. package/dist/chunk-PB6TOLRQ.js.map +1 -0
  58. package/dist/chunk-PT5IC642.js +162 -0
  59. package/dist/chunk-PT5IC642.js.map +1 -0
  60. package/dist/chunk-QIK2XSDQ.js +187 -0
  61. package/dist/chunk-QIK2XSDQ.js.map +1 -0
  62. package/dist/chunk-RJ6ZQKG5.js +26 -0
  63. package/dist/chunk-RJ6ZQKG5.js.map +1 -0
  64. package/dist/{chunk-YIQLYIHW.js → chunk-TRUJLI6K.js} +29 -43
  65. package/dist/chunk-TRUJLI6K.js.map +1 -0
  66. package/dist/chunk-U3IBO3O3.js +41 -0
  67. package/dist/chunk-U3IBO3O3.js.map +1 -0
  68. package/dist/{chunk-7WHF2OIZ.js → chunk-UBZPD4HN.js} +25 -7
  69. package/dist/chunk-UBZPD4HN.js.map +1 -0
  70. package/dist/{chunk-HIN3UVOG.js → chunk-V7XG6V6C.js} +20 -11
  71. package/dist/chunk-V7XG6V6C.js.map +1 -0
  72. package/dist/chunk-WGTCA2NU.js +84 -0
  73. package/dist/chunk-WGTCA2NU.js.map +1 -0
  74. package/dist/{chunk-O6PERU7U.js → chunk-XNOCTDHF.js} +2 -2
  75. package/dist/chunk-YDN4OM33.js +80 -0
  76. package/dist/chunk-YDN4OM33.js.map +1 -0
  77. package/dist/cli-ODLFRIYS.js +128 -0
  78. package/dist/cli-ODLFRIYS.js.map +1 -0
  79. package/dist/client-EYOTW3JU.js +19 -0
  80. package/dist/client-MXRNQ5FI.js +13 -0
  81. package/dist/{config-IBS6KOLQ.js → config-UR5BSGVX.js} +21 -34
  82. package/dist/config-UR5BSGVX.js.map +1 -0
  83. package/dist/detect-H5OPI7GD.js +17 -0
  84. package/dist/detect-H5OPI7GD.js.map +1 -0
  85. package/dist/detect-providers-Q42OD4OS.js +26 -0
  86. package/dist/detect-providers-Q42OD4OS.js.map +1 -0
  87. package/dist/doctor-JLKTXDEH.js +258 -0
  88. package/dist/doctor-JLKTXDEH.js.map +1 -0
  89. package/dist/executor-ONSDHPGX.js +1441 -0
  90. package/dist/executor-ONSDHPGX.js.map +1 -0
  91. package/dist/init-6GWY345B.js +198 -0
  92. package/dist/init-6GWY345B.js.map +1 -0
  93. package/dist/init-wizard-UONLDYLI.js +294 -0
  94. package/dist/init-wizard-UONLDYLI.js.map +1 -0
  95. package/dist/llm-BV3QNVRD.js +17 -0
  96. package/dist/llm-BV3QNVRD.js.map +1 -0
  97. package/dist/loader-SH67XD54.js +28 -0
  98. package/dist/loader-SH67XD54.js.map +1 -0
  99. package/dist/loader-XVXKZZDH.js +18 -0
  100. package/dist/loader-XVXKZZDH.js.map +1 -0
  101. package/dist/{chunk-H7PRCVGQ.js → logs-QZVYF6FP.js} +74 -5
  102. package/dist/logs-QZVYF6FP.js.map +1 -0
  103. package/dist/main-BMCL7CPO.js +4393 -0
  104. package/dist/main-BMCL7CPO.js.map +1 -0
  105. package/dist/openai-embeddings-C265WRNK.js +14 -0
  106. package/dist/openai-embeddings-C265WRNK.js.map +1 -0
  107. package/dist/openrouter-U6VFCRX2.js +14 -0
  108. package/dist/openrouter-U6VFCRX2.js.map +1 -0
  109. package/dist/post-compact-OWFSOITU.js +26 -0
  110. package/dist/post-compact-OWFSOITU.js.map +1 -0
  111. package/dist/post-tool-use-DOUM7CGQ.js +56 -0
  112. package/dist/post-tool-use-DOUM7CGQ.js.map +1 -0
  113. package/dist/post-tool-use-failure-SG3C7PE6.js +28 -0
  114. package/dist/post-tool-use-failure-SG3C7PE6.js.map +1 -0
  115. package/dist/pre-compact-3J33CHXQ.js +25 -0
  116. package/dist/pre-compact-3J33CHXQ.js.map +1 -0
  117. package/dist/provider-check-3WBPZADE.js +12 -0
  118. package/dist/provider-check-3WBPZADE.js.map +1 -0
  119. package/dist/registry-J4XTWARS.js +25 -0
  120. package/dist/registry-J4XTWARS.js.map +1 -0
  121. package/dist/resolution-events-TFEQPVKS.js +12 -0
  122. package/dist/resolution-events-TFEQPVKS.js.map +1 -0
  123. package/dist/resolve-3FEUV462.js +9 -0
  124. package/dist/resolve-3FEUV462.js.map +1 -0
  125. package/dist/{restart-XCMILOL5.js → restart-2VM33WOB.js} +10 -6
  126. package/dist/{restart-XCMILOL5.js.map → restart-2VM33WOB.js.map} +1 -1
  127. package/dist/search-ZGQR5MDE.js +91 -0
  128. package/dist/search-ZGQR5MDE.js.map +1 -0
  129. package/dist/{server-6UDN35QN.js → server-6KMBJCHZ.js} +308 -517
  130. package/dist/server-6KMBJCHZ.js.map +1 -0
  131. package/dist/session-Z2FXDDG6.js +68 -0
  132. package/dist/session-Z2FXDDG6.js.map +1 -0
  133. package/dist/session-end-FLVX32LE.js +38 -0
  134. package/dist/session-end-FLVX32LE.js.map +1 -0
  135. package/dist/session-start-UCLK7PXE.js +169 -0
  136. package/dist/session-start-UCLK7PXE.js.map +1 -0
  137. package/dist/setup-digest-4KDSXAIV.js +15 -0
  138. package/dist/setup-digest-4KDSXAIV.js.map +1 -0
  139. package/dist/setup-llm-GKMCHURK.js +81 -0
  140. package/dist/setup-llm-GKMCHURK.js.map +1 -0
  141. package/dist/src/agent/definitions/agent.yaml +35 -0
  142. package/dist/src/agent/definitions/tasks/digest-only.yaml +84 -0
  143. package/dist/src/agent/definitions/tasks/extract-only.yaml +87 -0
  144. package/dist/src/agent/definitions/tasks/full-intelligence.yaml +472 -0
  145. package/dist/src/agent/definitions/tasks/graph-maintenance.yaml +92 -0
  146. package/dist/src/agent/definitions/tasks/review-session.yaml +132 -0
  147. package/dist/src/agent/definitions/tasks/supersession-sweep.yaml +86 -0
  148. package/dist/src/agent/definitions/tasks/title-summary.yaml +88 -0
  149. package/dist/src/agent/prompts/agent.md +121 -0
  150. package/dist/src/agent/prompts/orchestrator.md +91 -0
  151. package/dist/src/cli.js +1 -8
  152. package/dist/src/cli.js.map +1 -1
  153. package/dist/src/daemon/main.js +1 -8
  154. package/dist/src/daemon/main.js.map +1 -1
  155. package/dist/src/hooks/post-tool-use.js +3 -50
  156. package/dist/src/hooks/post-tool-use.js.map +1 -1
  157. package/dist/src/hooks/session-end.js +3 -32
  158. package/dist/src/hooks/session-end.js.map +1 -1
  159. package/dist/src/hooks/session-start.js +2 -8
  160. package/dist/src/hooks/session-start.js.map +1 -1
  161. package/dist/src/hooks/stop.js +3 -42
  162. package/dist/src/hooks/stop.js.map +1 -1
  163. package/dist/src/hooks/user-prompt-submit.js +3 -53
  164. package/dist/src/hooks/user-prompt-submit.js.map +1 -1
  165. package/dist/src/mcp/server.js +1 -8
  166. package/dist/src/mcp/server.js.map +1 -1
  167. package/dist/src/prompts/digest-system.md +1 -1
  168. package/dist/src/symbionts/manifests/claude-code.yaml +16 -0
  169. package/dist/src/symbionts/manifests/cursor.yaml +14 -0
  170. package/dist/stats-IUJPZSVZ.js +94 -0
  171. package/dist/stats-IUJPZSVZ.js.map +1 -0
  172. package/dist/stop-XRQLLXST.js +42 -0
  173. package/dist/stop-XRQLLXST.js.map +1 -0
  174. package/dist/stop-failure-2CAJJKRG.js +26 -0
  175. package/dist/stop-failure-2CAJJKRG.js.map +1 -0
  176. package/dist/subagent-start-MWWQTZMQ.js +26 -0
  177. package/dist/subagent-start-MWWQTZMQ.js.map +1 -0
  178. package/dist/subagent-stop-PJXYGRXB.js +28 -0
  179. package/dist/subagent-stop-PJXYGRXB.js.map +1 -0
  180. package/dist/task-completed-4LFRJVGI.js +27 -0
  181. package/dist/task-completed-4LFRJVGI.js.map +1 -0
  182. package/dist/ui/assets/index-DZrElonz.js +744 -0
  183. package/dist/ui/assets/index-TkeiYbZB.css +1 -0
  184. package/dist/ui/favicon.svg +7 -7
  185. package/dist/ui/fonts/Inter-Variable.woff2 +0 -0
  186. package/dist/ui/fonts/JetBrainsMono-Variable.woff2 +0 -0
  187. package/dist/ui/fonts/Newsreader-Italic-Variable.woff2 +0 -0
  188. package/dist/ui/fonts/Newsreader-Variable.woff2 +0 -0
  189. package/dist/ui/index.html +2 -2
  190. package/dist/user-prompt-submit-KSM3AR6P.js +59 -0
  191. package/dist/user-prompt-submit-KSM3AR6P.js.map +1 -0
  192. package/dist/{verify-TOWQHPBX.js → verify-UDAYVX37.js} +17 -22
  193. package/dist/verify-UDAYVX37.js.map +1 -0
  194. package/dist/{version-36RVCQA6.js → version-KLBN4HZT.js} +3 -4
  195. package/dist/version-KLBN4HZT.js.map +1 -0
  196. package/hooks/hooks.json +82 -5
  197. package/package.json +6 -3
  198. package/skills/myco/SKILL.md +10 -10
  199. package/skills/myco/references/cli-usage.md +15 -13
  200. package/skills/myco/references/vault-status.md +3 -3
  201. package/skills/myco/references/wisdom.md +4 -4
  202. package/skills/myco-curate/SKILL.md +86 -0
  203. package/dist/chunk-2ZIBCEYO.js +0 -113
  204. package/dist/chunk-2ZIBCEYO.js.map +0 -1
  205. package/dist/chunk-4RMSHZE4.js +0 -107
  206. package/dist/chunk-4RMSHZE4.js.map +0 -1
  207. package/dist/chunk-4XVKZ3WA.js +0 -1078
  208. package/dist/chunk-4XVKZ3WA.js.map +0 -1
  209. package/dist/chunk-6FQISQNA.js +0 -61
  210. package/dist/chunk-6FQISQNA.js.map +0 -1
  211. package/dist/chunk-7WHF2OIZ.js.map +0 -1
  212. package/dist/chunk-ERG2IEWX.js.map +0 -1
  213. package/dist/chunk-FPRXMJLT.js +0 -56
  214. package/dist/chunk-FPRXMJLT.js.map +0 -1
  215. package/dist/chunk-GENQ5QGP.js +0 -37
  216. package/dist/chunk-GENQ5QGP.js.map +0 -1
  217. package/dist/chunk-H7PRCVGQ.js.map +0 -1
  218. package/dist/chunk-HIN3UVOG.js.map +0 -1
  219. package/dist/chunk-HYVT345Y.js +0 -159
  220. package/dist/chunk-HYVT345Y.js.map +0 -1
  221. package/dist/chunk-J4D4CROB.js +0 -143
  222. package/dist/chunk-J4D4CROB.js.map +0 -1
  223. package/dist/chunk-MDLSAFPP.js +0 -99
  224. package/dist/chunk-MDLSAFPP.js.map +0 -1
  225. package/dist/chunk-N33KUCFP.js.map +0 -1
  226. package/dist/chunk-NL6WQO56.js +0 -65
  227. package/dist/chunk-NL6WQO56.js.map +0 -1
  228. package/dist/chunk-NLUE6CYG.js.map +0 -1
  229. package/dist/chunk-P723N2LP.js +0 -147
  230. package/dist/chunk-P723N2LP.js.map +0 -1
  231. package/dist/chunk-QLUE3BUL.js +0 -161
  232. package/dist/chunk-QLUE3BUL.js.map +0 -1
  233. package/dist/chunk-QN4W3JUA.js +0 -43
  234. package/dist/chunk-QN4W3JUA.js.map +0 -1
  235. package/dist/chunk-RGVBGTD6.js +0 -21
  236. package/dist/chunk-RGVBGTD6.js.map +0 -1
  237. package/dist/chunk-TWSTAVLO.js +0 -132
  238. package/dist/chunk-TWSTAVLO.js.map +0 -1
  239. package/dist/chunk-UP4P4OAA.js +0 -4423
  240. package/dist/chunk-UP4P4OAA.js.map +0 -1
  241. package/dist/chunk-YIQLYIHW.js.map +0 -1
  242. package/dist/chunk-YTFXA4RX.js +0 -86
  243. package/dist/chunk-YTFXA4RX.js.map +0 -1
  244. package/dist/chunk-Z74SDEKE.js.map +0 -1
  245. package/dist/cli-IHILSS6N.js +0 -97
  246. package/dist/cli-IHILSS6N.js.map +0 -1
  247. package/dist/client-AGFNR2S4.js +0 -12
  248. package/dist/config-IBS6KOLQ.js.map +0 -1
  249. package/dist/curate-3D4GHKJH.js +0 -78
  250. package/dist/curate-3D4GHKJH.js.map +0 -1
  251. package/dist/detect-providers-XEP4QA3R.js +0 -35
  252. package/dist/detect-providers-XEP4QA3R.js.map +0 -1
  253. package/dist/digest-7HLJXL77.js +0 -85
  254. package/dist/digest-7HLJXL77.js.map +0 -1
  255. package/dist/init-ARQ53JOR.js +0 -109
  256. package/dist/init-ARQ53JOR.js.map +0 -1
  257. package/dist/logs-IENORIYR.js +0 -84
  258. package/dist/logs-IENORIYR.js.map +0 -1
  259. package/dist/main-6AGPIMH2.js +0 -5715
  260. package/dist/main-6AGPIMH2.js.map +0 -1
  261. package/dist/rebuild-Q2ACEB6F.js +0 -64
  262. package/dist/rebuild-Q2ACEB6F.js.map +0 -1
  263. package/dist/reprocess-CDEFGQOV.js +0 -79
  264. package/dist/reprocess-CDEFGQOV.js.map +0 -1
  265. package/dist/search-7W25SKCB.js +0 -120
  266. package/dist/search-7W25SKCB.js.map +0 -1
  267. package/dist/server-6UDN35QN.js.map +0 -1
  268. package/dist/session-F326AWCH.js +0 -44
  269. package/dist/session-F326AWCH.js.map +0 -1
  270. package/dist/session-start-K6IGAC7H.js +0 -192
  271. package/dist/session-start-K6IGAC7H.js.map +0 -1
  272. package/dist/setup-digest-X5PN27F4.js +0 -15
  273. package/dist/setup-llm-S5OHQJXK.js +0 -15
  274. package/dist/src/prompts/classification.md +0 -43
  275. package/dist/stats-TTSDXGJV.js +0 -58
  276. package/dist/stats-TTSDXGJV.js.map +0 -1
  277. package/dist/templates-XPRBOWCE.js +0 -38
  278. package/dist/templates-XPRBOWCE.js.map +0 -1
  279. package/dist/ui/assets/index-08wKT7wS.css +0 -1
  280. package/dist/ui/assets/index-CMSMi4Jb.js +0 -369
  281. package/dist/verify-TOWQHPBX.js.map +0 -1
  282. package/skills/setup/SKILL.md +0 -174
  283. package/skills/setup/references/model-recommendations.md +0 -83
  284. /package/dist/{client-AGFNR2S4.js.map → chunk-E4VLWIJC.js.map} +0 -0
  285. /package/dist/{setup-digest-X5PN27F4.js.map → chunk-IB76KGBY.js.map} +0 -0
  286. /package/dist/{chunk-O6PERU7U.js.map → chunk-XNOCTDHF.js.map} +0 -0
  287. /package/dist/{setup-llm-S5OHQJXK.js.map → client-EYOTW3JU.js.map} +0 -0
  288. /package/dist/{version-36RVCQA6.js.map → client-MXRNQ5FI.js.map} +0 -0
@@ -1,45 +1,6 @@
1
1
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
2
- import {
3
- queryLogs
4
- } from "./chunk-H7PRCVGQ.js";
5
- import {
6
- consolidateSpores,
7
- handleMycoContext
8
- } from "./chunk-2ZIBCEYO.js";
9
- import "./chunk-QLUE3BUL.js";
10
- import {
11
- VectorIndex
12
- } from "./chunk-4RMSHZE4.js";
13
- import {
14
- OBSERVATION_TYPES,
15
- PLAN_STATUSES,
16
- VaultWriter,
17
- checkSupersession,
18
- indexNote
19
- } from "./chunk-UP4P4OAA.js";
20
- import {
21
- generateEmbedding
22
- } from "./chunk-RGVBGTD6.js";
23
- import {
24
- createEmbeddingProvider,
25
- createLlmProvider
26
- } from "./chunk-NLUE6CYG.js";
27
- import {
28
- planFm,
29
- sessionFm,
30
- sporeFm
31
- } from "./chunk-GENQ5QGP.js";
32
- import {
33
- initFts,
34
- searchFts
35
- } from "./chunk-6FQISQNA.js";
36
- import {
37
- MycoIndex
38
- } from "./chunk-TWSTAVLO.js";
39
- import "./chunk-7WHF2OIZ.js";
40
- import {
41
- loadConfig
42
- } from "./chunk-HYVT345Y.js";
2
+ import "./chunk-IB76KGBY.js";
3
+ import "./chunk-E4VLWIJC.js";
43
4
  import {
44
5
  _enum,
45
6
  _null,
@@ -47,6 +8,7 @@ import {
47
8
  boolean,
48
9
  custom,
49
10
  discriminatedUnion,
11
+ external_exports,
50
12
  intersection,
51
13
  iso_exports,
52
14
  literal,
@@ -60,26 +22,23 @@ import {
60
22
  string,
61
23
  union,
62
24
  unknown
63
- } from "./chunk-ERG2IEWX.js";
25
+ } from "./chunk-KH64DHOY.js";
64
26
  import {
65
- resolveSessionFromBuffer
66
- } from "./chunk-HIN3UVOG.js";
27
+ DaemonClient
28
+ } from "./chunk-TRUJLI6K.js";
29
+ import {
30
+ DAEMON_CLIENT_TIMEOUT_MS,
31
+ MCP_SEARCH_DEFAULT_LIMIT,
32
+ MCP_SESSIONS_DEFAULT_LIMIT
33
+ } from "./chunk-5VZ52A4T.js";
34
+ import "./chunk-WGTCA2NU.js";
67
35
  import {
68
36
  getPluginVersion
69
- } from "./chunk-QN4W3JUA.js";
37
+ } from "./chunk-PB6TOLRQ.js";
38
+ import "./chunk-LPUQPDC2.js";
70
39
  import {
71
40
  resolveVaultDir
72
- } from "./chunk-N33KUCFP.js";
73
- import "./chunk-Z74SDEKE.js";
74
- import {
75
- CONTENT_SNIPPET_CHARS,
76
- EMBEDDING_INPUT_LIMIT,
77
- MCP_LOGS_DEFAULT_LIMIT,
78
- MCP_SEARCH_DEFAULT_LIMIT,
79
- MCP_SESSIONS_DEFAULT_LIMIT,
80
- RECALL_SUMMARY_PREVIEW_CHARS,
81
- SESSION_SUMMARY_PREVIEW_CHARS
82
- } from "./chunk-J4D4CROB.js";
41
+ } from "./chunk-JTYZRPX5.js";
83
42
  import {
84
43
  __commonJS,
85
44
  __toESM
@@ -3278,8 +3237,8 @@ var require_utils = __commonJS({
3278
3237
  }
3279
3238
  return ind;
3280
3239
  }
3281
- function removeDotSegments(path5) {
3282
- let input = path5;
3240
+ function removeDotSegments(path2) {
3241
+ let input = path2;
3283
3242
  const output = [];
3284
3243
  let nextSlash = -1;
3285
3244
  let len = 0;
@@ -3478,8 +3437,8 @@ var require_schemes = __commonJS({
3478
3437
  wsComponent.secure = void 0;
3479
3438
  }
3480
3439
  if (wsComponent.resourceName) {
3481
- const [path5, query] = wsComponent.resourceName.split("?");
3482
- wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
3440
+ const [path2, query] = wsComponent.resourceName.split("?");
3441
+ wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
3483
3442
  wsComponent.query = query;
3484
3443
  wsComponent.resourceName = void 0;
3485
3444
  }
@@ -6841,12 +6800,12 @@ var require_dist = __commonJS({
6841
6800
  throw new Error(`Unknown format "${name}"`);
6842
6801
  return f;
6843
6802
  };
6844
- function addFormats(ajv, list, fs3, exportName) {
6803
+ function addFormats(ajv, list, fs2, exportName) {
6845
6804
  var _a;
6846
6805
  var _b;
6847
6806
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
6848
6807
  for (const f of list)
6849
- ajv.addFormat(f, fs3[f]);
6808
+ ajv.addFormat(f, fs2[f]);
6850
6809
  }
6851
6810
  module.exports = exports = formatsPlugin;
6852
6811
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -7213,8 +7172,8 @@ function getErrorMap() {
7213
7172
 
7214
7173
  // node_modules/zod/v3/helpers/parseUtil.js
7215
7174
  var makeIssue = (params) => {
7216
- const { data, path: path5, errorMaps, issueData } = params;
7217
- const fullPath = [...path5, ...issueData.path || []];
7175
+ const { data, path: path2, errorMaps, issueData } = params;
7176
+ const fullPath = [...path2, ...issueData.path || []];
7218
7177
  const fullIssue = {
7219
7178
  ...issueData,
7220
7179
  path: fullPath
@@ -7329,11 +7288,11 @@ var errorUtil;
7329
7288
 
7330
7289
  // node_modules/zod/v3/types.js
7331
7290
  var ParseInputLazyPath = class {
7332
- constructor(parent, value, path5, key) {
7291
+ constructor(parent, value, path2, key) {
7333
7292
  this._cachedPath = [];
7334
7293
  this.parent = parent;
7335
7294
  this.data = value;
7336
- this._path = path5;
7295
+ this._path = path2;
7337
7296
  this._key = key;
7338
7297
  }
7339
7298
  get path() {
@@ -14065,379 +14024,238 @@ var StdioServerTransport = class {
14065
14024
  };
14066
14025
 
14067
14026
  // src/mcp/server.ts
14068
- import fs2 from "fs";
14069
- import path4 from "path";
14027
+ import fs from "fs";
14028
+ import path from "path";
14029
+
14030
+ // src/mcp/tools/shared.ts
14031
+ function buildEndpoint(base, params) {
14032
+ const qs = new URLSearchParams();
14033
+ for (const [key, val] of Object.entries(params)) {
14034
+ if (val !== void 0) qs.set(key, String(val));
14035
+ }
14036
+ const str = qs.toString();
14037
+ return str ? `${base}?${str}` : base;
14038
+ }
14070
14039
 
14071
14040
  // src/mcp/tools/search.ts
14072
- async function handleMycoSearch(index, input, vectorIndex, backend) {
14073
- const type = input.type === "all" ? void 0 : input.type;
14074
- const limit = input.limit ?? 10;
14075
- if (vectorIndex && backend) {
14076
- try {
14077
- const emb = await generateEmbedding(backend, input.query);
14078
- const results = vectorIndex.search(emb.embedding, {
14079
- limit,
14080
- type
14081
- });
14082
- if (results.length > 0) {
14083
- const noteMap = new Map(
14084
- index.queryByIds(results.map((r) => r.id)).map((n) => [n.id, n])
14085
- );
14086
- return results.map((r) => {
14087
- const note = noteMap.get(r.id);
14088
- return {
14089
- note_path: note?.path ?? r.id,
14090
- type: r.metadata.type || note?.type || "unknown",
14091
- title: note?.title ?? r.id,
14092
- snippet: note?.content?.slice(0, CONTENT_SNIPPET_CHARS) ?? "",
14093
- score: r.similarity,
14094
- frontmatter: note?.frontmatter ?? {}
14095
- };
14096
- }).filter((r) => r.snippet).filter((r) => {
14097
- const status = r.frontmatter.status;
14098
- return status !== "superseded" && status !== "archived";
14099
- });
14100
- }
14101
- } catch {
14102
- }
14103
- }
14104
- const ftsResults = searchFts(index, input.query, { type, limit });
14105
- return ftsResults.map((r) => {
14106
- const note = index.getNoteByPath(r.path);
14107
- return {
14108
- note_path: r.path,
14109
- type: r.type,
14110
- title: r.title,
14111
- snippet: r.snippet,
14112
- score: Math.abs(r.rank),
14113
- frontmatter: note?.frontmatter ?? {}
14114
- };
14115
- }).filter((r) => {
14116
- const status = r.frontmatter.status;
14117
- return status !== "superseded" && status !== "archived";
14041
+ async function handleMycoSearch(input, client) {
14042
+ const limit = input.limit ?? MCP_SEARCH_DEFAULT_LIMIT;
14043
+ const endpoint = buildEndpoint("/api/search", {
14044
+ q: input.query,
14045
+ limit,
14046
+ type: input.type
14118
14047
  });
14048
+ const result = await client.get(endpoint);
14049
+ if (!result.ok || !result.data?.results) return [];
14050
+ return result.data.results;
14119
14051
  }
14120
14052
 
14121
14053
  // src/mcp/tools/recall.ts
14122
- async function handleMycoRecall(index, input) {
14123
- const allPlans = index.query({ type: "plan" });
14124
- const activePlans = allPlans.filter((p) => {
14125
- const status = planFm(p).status;
14126
- return status === "active" || status === "in_progress";
14127
- });
14128
- let sessions = index.query({ type: "session", limit: 10 });
14129
- if (input.branch) {
14130
- sessions = sessions.filter((s) => sessionFm(s).branch === input.branch);
14131
- }
14132
- const spores = index.query({ type: "spore", limit: 5 }).filter((m) => sporeFm(m).status !== "superseded" && sporeFm(m).status !== "archived");
14133
- return {
14134
- active_plans: activePlans.map((p) => ({
14135
- id: p.id,
14136
- title: p.title,
14137
- status: planFm(p).status ?? "active"
14138
- })),
14139
- recent_sessions: sessions.slice(0, 5).map((s) => ({
14140
- id: s.id,
14141
- title: s.title,
14142
- summary: s.content.slice(0, RECALL_SUMMARY_PREVIEW_CHARS)
14143
- })),
14144
- relevant_spores: spores.map((m) => ({
14145
- id: m.id,
14146
- title: m.title,
14147
- type: sporeFm(m).observation_type ?? "discovery"
14148
- })),
14149
- team_activity: []
14150
- };
14054
+ async function handleMycoRecall(input, client) {
14055
+ const id = input.note_id;
14056
+ const [sessionResult, sporeResult] = await Promise.all([
14057
+ client.get(`/api/sessions/${encodeURIComponent(id)}`),
14058
+ client.get(`/api/spores/${encodeURIComponent(id)}`)
14059
+ ]);
14060
+ if (sessionResult.ok && sessionResult.data) {
14061
+ return { type: "session", ...sessionResult.data };
14062
+ }
14063
+ if (sporeResult.ok && sporeResult.data) {
14064
+ return { type: "spore", ...sporeResult.data };
14065
+ }
14066
+ return { error: `Note not found: ${id}` };
14151
14067
  }
14152
14068
 
14153
14069
  // src/mcp/tools/remember.ts
14154
- import { randomBytes } from "crypto";
14155
- import path from "path";
14156
- async function handleMycoRemember(vaultDir, index, input) {
14157
- const writer = new VaultWriter(vaultDir);
14158
- const id = `${input.type}-${randomBytes(4).toString("hex")}`;
14159
- const session = input.session ?? resolveSessionFromBuffer(path.join(vaultDir, "buffer"));
14160
- const notePath = writer.writeSpore({
14161
- id,
14162
- observation_type: input.type,
14163
- session,
14164
- plan: input.related_plan ?? void 0,
14165
- tags: input.tags,
14166
- content: input.content
14070
+ async function handleMycoRemember(input, client) {
14071
+ const result = await client.post("/api/mcp/remember", {
14072
+ content: input.content,
14073
+ type: input.type,
14074
+ tags: input.tags
14167
14075
  });
14168
- indexNote(index, vaultDir, notePath);
14169
- return { note_path: notePath, id, session };
14170
- }
14171
-
14172
- // src/mcp/tools/plans.ts
14173
- async function handleMycoPlans(index, input) {
14174
- if (input.id) {
14175
- return getPlanDetail(index, input.id);
14176
- }
14177
- const allPlans = index.query({ type: "plan" });
14178
- let plans = allPlans;
14179
- if (input.status && input.status !== "all") {
14180
- plans = allPlans.filter((p) => planFm(p).status === input.status);
14181
- }
14182
- return plans.map((p) => {
14183
- const f = planFm(p);
14076
+ if (!result.ok || !result.data) {
14184
14077
  return {
14185
- id: p.id,
14186
- title: p.title,
14187
- status: f.status ?? "active",
14188
- progress: extractProgress(p.content),
14189
- tags: f.tags ?? []
14078
+ id: "",
14079
+ observation_type: input.type ?? "discovery",
14080
+ status: "error",
14081
+ created_at: 0
14190
14082
  };
14191
- });
14083
+ }
14084
+ return result.data;
14192
14085
  }
14193
- function getPlanDetail(index, planId) {
14194
- const plans = index.query({ type: "plan", id: planId });
14195
- if (plans.length === 0) {
14196
- throw new Error(`Plan not found: ${planId}`);
14197
- }
14198
- const plan = plans[0];
14199
- const f = planFm(plan);
14200
- const allSessions = index.query({ type: "session", limit: 100 });
14201
- const linkedSessions = allSessions.filter((s) => {
14202
- const sf = sessionFm(s);
14203
- const planRef = sf.plan;
14204
- const plansArr = sf.plans;
14205
- return planRef === `[[${planId}]]` || planRef === planId || plansArr?.includes(planId) || plansArr?.includes(`[[${planId}]]`);
14086
+
14087
+ // src/mcp/tools/plans.ts
14088
+ async function handleMycoPlans(input, client) {
14089
+ const endpoint = buildEndpoint("/api/mcp/plans", {
14090
+ status: input.status,
14091
+ limit: input.limit
14206
14092
  });
14207
- return {
14208
- id: plan.id,
14209
- title: plan.title,
14210
- status: f.status ?? "active",
14211
- progress: extractProgress(plan.content),
14212
- tags: f.tags ?? [],
14213
- content: plan.content,
14214
- sessions: linkedSessions.map((s) => {
14215
- const sf = sessionFm(s);
14216
- return {
14217
- id: s.id,
14218
- title: s.title,
14219
- started: sf.started ?? s.created
14220
- };
14221
- })
14222
- };
14223
- }
14224
- function extractProgress(content) {
14225
- const checked = (content.match(/- \[x\]/gi) ?? []).length;
14226
- const unchecked = (content.match(/- \[ \]/g) ?? []).length;
14227
- const total = checked + unchecked;
14228
- if (total === 0) return "N/A";
14229
- return `${checked}/${total}`;
14093
+ const result = await client.get(endpoint);
14094
+ if (!result.ok || !result.data?.plans) return [];
14095
+ return result.data.plans;
14230
14096
  }
14231
14097
 
14232
14098
  // src/mcp/tools/sessions.ts
14233
- async function handleMycoSessions(index, input) {
14234
- const frontmatter = {};
14235
- if (input.branch) frontmatter.branch = input.branch;
14236
- if (input.user) frontmatter.user = input.user;
14237
- let sessions = index.query({
14238
- type: "session",
14239
- since: input.since,
14240
- limit: input.limit ?? 20,
14241
- frontmatter
14242
- });
14243
- if (input.plan) {
14244
- sessions = sessions.filter((s) => {
14245
- const planRef = sessionFm(s).plan;
14246
- return planRef === `[[${input.plan}]]` || planRef === input.plan;
14247
- });
14248
- }
14249
- return sessions.map((s) => {
14250
- const f = sessionFm(s);
14251
- return {
14252
- id: s.id,
14253
- summary: s.content.slice(0, SESSION_SUMMARY_PREVIEW_CHARS),
14254
- user: f.user ?? "",
14255
- agent: f.agent ?? "",
14256
- started: f.started ?? s.created,
14257
- parent: f.parent ?? null,
14258
- plan: f.plan ?? null,
14259
- tags: f.tags ?? []
14260
- };
14099
+ async function handleMycoSessions(input, client) {
14100
+ const endpoint = buildEndpoint("/api/mcp/sessions", {
14101
+ limit: input.limit,
14102
+ status: input.status
14261
14103
  });
14104
+ const result = await client.get(endpoint);
14105
+ if (!result.ok || !result.data?.sessions) return [];
14106
+ return result.data.sessions;
14262
14107
  }
14263
14108
 
14264
14109
  // src/mcp/tools/team.ts
14265
- async function handleMycoTeam(index, input, currentUser) {
14266
- const sessions = index.query({
14267
- type: "session",
14268
- since: input.since,
14269
- limit: 50
14270
- });
14271
- const filtered = sessions.filter((s) => {
14272
- const f = sessionFm(s);
14273
- if (!f.user || f.user === currentUser) return false;
14274
- if (input.plan) {
14275
- const planRef = f.plan;
14276
- if (planRef !== `[[${input.plan}]]` && planRef !== input.plan) return false;
14277
- }
14278
- return true;
14279
- });
14280
- return filtered.map((s) => {
14281
- const f = sessionFm(s);
14282
- return {
14283
- user: f.user ?? "",
14284
- session_id: s.id,
14285
- summary: s.content.slice(0, RECALL_SUMMARY_PREVIEW_CHARS),
14286
- files_changed: [],
14287
- decisions: []
14288
- };
14289
- });
14110
+ async function handleMycoTeam(_input, client) {
14111
+ const result = await client.get("/api/mcp/team");
14112
+ if (!result.ok || !result.data?.members) return [];
14113
+ return result.data.members;
14290
14114
  }
14291
14115
 
14292
14116
  // src/mcp/tools/graph.ts
14293
- var WIKILINK_RE = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g;
14294
- function extractWikilinks(content) {
14295
- const links = [];
14296
- let match;
14297
- while ((match = WIKILINK_RE.exec(content)) !== null) {
14298
- links.push(match[1]);
14299
- }
14300
- return links;
14301
- }
14302
- function findNoteById(index, noteId) {
14303
- const results = index.query({ id: noteId, limit: 1 });
14304
- return results[0] ?? null;
14305
- }
14306
- async function handleMycoGraph(index, input) {
14307
- const direction = input.direction ?? "both";
14308
- const depth = Math.min(input.depth ?? 1, 3);
14309
- const visited = /* @__PURE__ */ new Set();
14310
- const allLinks = [];
14311
- function traverse(noteId, currentDepth) {
14312
- if (currentDepth > depth || visited.has(noteId)) return;
14313
- visited.add(noteId);
14314
- const note = findNoteById(index, noteId);
14315
- if (direction === "outgoing" || direction === "both") {
14316
- if (note) {
14317
- const targets = extractWikilinks(note.content);
14318
- for (const target of targets) {
14319
- const targetNote = findNoteById(index, target);
14320
- allLinks.push({
14321
- source: noteId,
14322
- target,
14323
- source_type: note.type,
14324
- target_type: targetNote?.type ?? "unknown",
14325
- source_title: note.title,
14326
- target_title: targetNote?.title ?? target
14327
- });
14328
- if (currentDepth < depth) traverse(target, currentDepth + 1);
14329
- }
14330
- }
14331
- }
14332
- if (direction === "incoming" || direction === "both") {
14333
- const allNotes = index.query({ limit: 500 });
14334
- for (const n of allNotes) {
14335
- if (n.id === noteId) continue;
14336
- const links = extractWikilinks(n.content);
14337
- if (links.includes(noteId)) {
14338
- allLinks.push({
14339
- source: n.id,
14340
- target: noteId,
14341
- source_type: n.type,
14342
- target_type: note?.type ?? "unknown",
14343
- source_title: n.title,
14344
- target_title: note?.title ?? noteId
14345
- });
14346
- if (currentDepth < depth) traverse(n.id, currentDepth + 1);
14347
- }
14348
- }
14349
- }
14350
- }
14351
- traverse(input.note_id, 1);
14352
- const seen = /* @__PURE__ */ new Set();
14353
- const unique = allLinks.filter((link) => {
14354
- const key = `${link.source}->${link.target}`;
14355
- if (seen.has(key)) return false;
14356
- seen.add(key);
14357
- return true;
14117
+ async function handleMycoGraph(input, client) {
14118
+ const endpoint = buildEndpoint(`/api/graph/${encodeURIComponent(input.note_id)}`, {
14119
+ direction: input.direction,
14120
+ depth: input.depth
14358
14121
  });
14359
- return { note_id: input.note_id, links: unique };
14360
- }
14361
- async function handleMycoOrphans(index) {
14362
- const allNotes = index.query({ limit: 1e3 });
14363
- const hasOutgoing = /* @__PURE__ */ new Set();
14364
- const isLinkedTo = /* @__PURE__ */ new Set();
14365
- for (const note of allNotes) {
14366
- const links = extractWikilinks(note.content);
14367
- if (links.length > 0) hasOutgoing.add(note.id);
14368
- for (const target of links) {
14369
- isLinkedTo.add(target);
14370
- }
14371
- const fm = note.frontmatter;
14372
- if (fm.session && typeof fm.session === "string") {
14373
- isLinkedTo.add(fm.session);
14374
- }
14375
- if (fm.plan && typeof fm.plan === "string") {
14376
- isLinkedTo.add(fm.plan);
14377
- }
14378
- }
14379
- const orphans = allNotes.filter(
14380
- (note) => !hasOutgoing.has(note.id) && !isLinkedTo.has(note.id)
14381
- ).map((note) => ({
14382
- id: note.id,
14383
- type: note.type,
14384
- title: note.title,
14385
- path: note.path
14386
- }));
14387
- return { orphans };
14388
- }
14389
-
14390
- // src/mcp/tools/logs.ts
14391
- import path2 from "path";
14392
- async function handleMycoLogs(vaultDir, input) {
14393
- const logDir = path2.join(vaultDir, "logs");
14394
- return queryLogs(logDir, input);
14122
+ const result = await client.get(endpoint);
14123
+ if (!result.ok || !result.data) {
14124
+ return { note_id: input.note_id, edges: [], entities: [] };
14125
+ }
14126
+ const data = result.data;
14127
+ return {
14128
+ note_id: input.note_id,
14129
+ edges: data.edges ?? [],
14130
+ entities: data.nodes ?? []
14131
+ };
14395
14132
  }
14396
14133
 
14397
14134
  // src/mcp/tools/supersede.ts
14398
- import fs from "fs";
14399
- import path3 from "path";
14400
- async function handleMycoSupersede(vaultDir, index, input) {
14401
- const writer = new VaultWriter(vaultDir);
14402
- const oldNotes = index.queryByIds([input.old_spore_id]);
14403
- if (oldNotes.length === 0) {
14404
- return { old_spore: input.old_spore_id, new_spore: input.new_spore_id, status: "not_found" };
14405
- }
14406
- const oldNote = oldNotes[0];
14407
- writer.updateNoteFrontmatter(oldNote.path, {
14408
- status: "superseded",
14409
- superseded_by: input.new_spore_id
14410
- }, true);
14411
- const fullPath = path3.join(vaultDir, oldNote.path);
14412
- const content = fs.readFileSync(fullPath, "utf-8");
14413
- if (!content.includes("Superseded by::")) {
14414
- const notice = `
14415
-
14416
- > [!warning] Superseded
14417
- > This observation has been superseded.
14418
-
14419
- Superseded by:: [[${input.new_spore_id}]]`;
14420
- const reasonLine = input.reason ? `
14421
- Reason:: ${input.reason}` : "";
14422
- fs.writeFileSync(fullPath, content.trimEnd() + notice + reasonLine + "\n", "utf-8");
14135
+ async function handleMycoSupersede(input, client) {
14136
+ const result = await client.post("/api/mcp/supersede", {
14137
+ old_spore_id: input.old_spore_id,
14138
+ new_spore_id: input.new_spore_id,
14139
+ reason: input.reason
14140
+ });
14141
+ if (!result.ok || !result.data) {
14142
+ throw new Error(`Failed to supersede spore: daemon request failed`);
14423
14143
  }
14424
- indexNote(index, vaultDir, oldNote.path);
14425
- return { old_spore: input.old_spore_id, new_spore: input.new_spore_id, status: "superseded" };
14144
+ return result.data;
14426
14145
  }
14427
14146
 
14428
14147
  // src/mcp/tools/consolidate.ts
14429
- async function handleMycoConsolidate(vaultDir, index, input, vectorIndex = null, embeddingProvider = null) {
14430
- return consolidateSpores(
14431
- {
14432
- sourceSporeIds: input.source_spore_ids,
14433
- consolidatedContent: input.consolidated_content,
14434
- observationType: input.observation_type,
14435
- tags: input.tags
14436
- },
14437
- { vaultDir, index, vectorIndex, embeddingProvider }
14438
- );
14148
+ async function handleMycoConsolidate(_input) {
14149
+ return {
14150
+ status: "unavailable",
14151
+ message: "Consolidation requires intelligence configuration (Phase 2). Use myco_supersede to manually mark outdated spores."
14152
+ };
14439
14153
  }
14440
14154
 
14155
+ // src/mcp/tools/context.ts
14156
+ var DEFAULT_CONTEXT_TIER = 5e3;
14157
+ var NO_DIGEST_MESSAGE = "Digest context is not yet available. The first digest cycle has not completed.";
14158
+ async function handleMycoContext(input, client) {
14159
+ const requestedTier = input.tier ?? DEFAULT_CONTEXT_TIER;
14160
+ const result = await client.get("/api/digest");
14161
+ if (!result.ok || !result.data?.tiers) {
14162
+ return {
14163
+ content: NO_DIGEST_MESSAGE,
14164
+ tier: requestedTier,
14165
+ fallback: false
14166
+ };
14167
+ }
14168
+ const tiers = result.data.tiers;
14169
+ const exact = tiers.find((t) => t.tier === requestedTier);
14170
+ if (exact) {
14171
+ return {
14172
+ content: exact.content,
14173
+ tier: exact.tier,
14174
+ fallback: false,
14175
+ generated_at: exact.generated_at
14176
+ };
14177
+ }
14178
+ if (tiers.length > 0) {
14179
+ const sorted = [...tiers].sort(
14180
+ (a, b) => Math.abs(a.tier - requestedTier) - Math.abs(b.tier - requestedTier)
14181
+ );
14182
+ const nearest = sorted[0];
14183
+ return {
14184
+ content: nearest.content,
14185
+ tier: nearest.tier,
14186
+ fallback: true,
14187
+ generated_at: nearest.generated_at
14188
+ };
14189
+ }
14190
+ return {
14191
+ content: NO_DIGEST_MESSAGE,
14192
+ tier: requestedTier,
14193
+ fallback: false
14194
+ };
14195
+ }
14196
+
14197
+ // src/vault/types.ts
14198
+ var SessionFrontmatterSchema = external_exports.object({
14199
+ type: external_exports.literal("session"),
14200
+ id: external_exports.string(),
14201
+ agent: external_exports.string(),
14202
+ user: external_exports.string(),
14203
+ started: external_exports.string(),
14204
+ ended: external_exports.string().optional(),
14205
+ parent: external_exports.string().optional(),
14206
+ parent_reason: external_exports.string().optional(),
14207
+ plan: external_exports.string().optional(),
14208
+ // backward compat read path
14209
+ plans: external_exports.array(external_exports.string()).optional(),
14210
+ // new: multiple plans
14211
+ branch: external_exports.string().optional(),
14212
+ tags: external_exports.array(external_exports.string()).default([]),
14213
+ tools_used: external_exports.number().int().optional(),
14214
+ files_changed: external_exports.number().int().optional()
14215
+ });
14216
+ var PLAN_STATUSES = ["active", "in_progress", "completed", "abandoned"];
14217
+ var PlanFrontmatterSchema = external_exports.object({
14218
+ type: external_exports.literal("plan"),
14219
+ id: external_exports.string(),
14220
+ status: external_exports.enum(PLAN_STATUSES).default("active"),
14221
+ created: external_exports.string(),
14222
+ author: external_exports.string().optional(),
14223
+ tags: external_exports.array(external_exports.string()).default([])
14224
+ });
14225
+ var OBSERVATION_TYPES = ["gotcha", "bug_fix", "decision", "discovery", "trade_off", "cross-cutting"];
14226
+ var SPORE_STATUSES = ["active", "superseded", "archived"];
14227
+ var SporeFrontmatterSchema = external_exports.object({
14228
+ type: external_exports.literal("spore"),
14229
+ id: external_exports.string(),
14230
+ observation_type: external_exports.string(),
14231
+ status: external_exports.enum(SPORE_STATUSES).default("active"),
14232
+ session: external_exports.string().optional(),
14233
+ plan: external_exports.string().optional(),
14234
+ superseded_by: external_exports.string().optional(),
14235
+ consolidated_from: external_exports.array(external_exports.string()).optional(),
14236
+ created: external_exports.string(),
14237
+ tags: external_exports.array(external_exports.string()).default([])
14238
+ });
14239
+ var ARTIFACT_TYPES = ["spec", "plan", "rfc", "doc", "other"];
14240
+ var ArtifactFrontmatterSchema = external_exports.object({
14241
+ type: external_exports.literal("artifact"),
14242
+ id: external_exports.string(),
14243
+ artifact_type: external_exports.enum(ARTIFACT_TYPES).default("other"),
14244
+ source_path: external_exports.string(),
14245
+ title: external_exports.string(),
14246
+ last_captured_by: external_exports.string(),
14247
+ created: external_exports.string(),
14248
+ updated: external_exports.string(),
14249
+ tags: external_exports.array(external_exports.string()).default([])
14250
+ });
14251
+ var TeamMemberFrontmatterSchema = external_exports.object({
14252
+ type: external_exports.literal("team-member"),
14253
+ user: external_exports.string(),
14254
+ joined: external_exports.string(),
14255
+ role: external_exports.string().optional(),
14256
+ tags: external_exports.array(external_exports.string()).default([])
14257
+ });
14258
+
14441
14259
  // src/mcp/tool-definitions.ts
14442
14260
  var PLAN_STATUS_FILTER = [...PLAN_STATUSES, "all"];
14443
14261
  var TOOL_SEARCH = "myco_search";
@@ -14447,8 +14265,6 @@ var TOOL_PLANS = "myco_plans";
14447
14265
  var TOOL_SESSIONS = "myco_sessions";
14448
14266
  var TOOL_TEAM = "myco_team";
14449
14267
  var TOOL_GRAPH = "myco_graph";
14450
- var TOOL_ORPHANS = "myco_orphans";
14451
- var TOOL_LOGS = "myco_logs";
14452
14268
  var TOOL_SUPERSEDE = "myco_supersede";
14453
14269
  var TOOL_CONSOLIDATE = "myco_consolidate";
14454
14270
  var TOOL_CONTEXT = "myco_context";
@@ -14471,13 +14287,13 @@ var TOOL_DEFINITIONS = [
14471
14287
  },
14472
14288
  {
14473
14289
  name: TOOL_RECALL,
14474
- description: "Get context relevant to your current work \u2014 spores, sessions, and plans related to the branch and files you are working on. Use at the start of a task or when you need background on a component.",
14290
+ description: "Look up a specific vault note by ID \u2014 returns the full content of a session, spore, or plan. Use when you have a note ID from search results or graph traversal and need the complete details.",
14475
14291
  inputSchema: {
14476
14292
  type: "object",
14477
14293
  properties: {
14478
- branch: { type: "string", description: PROP_BRANCH },
14479
- files: { type: "array", items: { type: "string" }, description: "File paths you are working on \u2014 finds spores tagged with these files" }
14480
- }
14294
+ note_id: { type: "string", description: 'Note ID to look up (e.g., "session-abc123", "decision-xyz789", "plan-feature-x")' }
14295
+ },
14296
+ required: ["note_id"]
14481
14297
  }
14482
14298
  },
14483
14299
  {
@@ -14534,7 +14350,7 @@ var TOOL_DEFINITIONS = [
14534
14350
  },
14535
14351
  {
14536
14352
  name: TOOL_GRAPH,
14537
- description: "Traverse connections between vault notes via wikilinks \u2014 explore how sessions, spores, and plans relate to each other.",
14353
+ description: "Traverse connections between records via graph edges \u2014 explore how sessions, spores, and plans relate to each other.",
14538
14354
  inputSchema: {
14539
14355
  type: "object",
14540
14356
  properties: {
@@ -14545,28 +14361,6 @@ var TOOL_DEFINITIONS = [
14545
14361
  required: ["note_id"]
14546
14362
  }
14547
14363
  },
14548
- {
14549
- name: TOOL_ORPHANS,
14550
- description: "Find vault notes with no connections \u2014 potentially stale or unlinked knowledge that may need review or cleanup.",
14551
- inputSchema: {
14552
- type: "object",
14553
- properties: {}
14554
- }
14555
- },
14556
- {
14557
- name: TOOL_LOGS,
14558
- description: "View daemon logs for debugging when sessions are not being captured, observations are missing, or embeddings fail. Filter by level, component, or time range.",
14559
- inputSchema: {
14560
- type: "object",
14561
- properties: {
14562
- limit: { type: "number", description: `Max entries to return (default: ${MCP_LOGS_DEFAULT_LIMIT})` },
14563
- level: { type: "string", enum: ["debug", "info", "warn", "error"], description: "Minimum log level filter" },
14564
- component: { type: "string", description: "Component filter: daemon, processor, hooks, lifecycle, embeddings, mcp, lineage, watcher" },
14565
- since: { type: "string", description: PROP_SINCE },
14566
- until: { type: "string", description: "ISO timestamp \u2014 entries before this time" }
14567
- }
14568
- }
14569
- },
14570
14364
  {
14571
14365
  name: TOOL_SUPERSEDE,
14572
14366
  description: "Mark a spore as outdated and replaced by a newer one. Use when a decision was reversed, a gotcha was fixed, a discovery was wrong, or the codebase changed and an observation no longer applies. The old spore is preserved but marked superseded.",
@@ -14596,14 +14390,14 @@ var TOOL_DEFINITIONS = [
14596
14390
  },
14597
14391
  {
14598
14392
  name: TOOL_CONTEXT,
14599
- description: "Retrieve Myco's synthesized understanding of this project. Returns a pre-computed context extract at the requested token tier. Available tiers: 1500 (executive briefing), 3000 (team standup), 5000 (deep onboarding), 10000 (institutional knowledge). This is a rich, always-current synthesis of project history, decisions, patterns, and active work \u2014 not a search result.",
14393
+ description: "Retrieve Myco's synthesized understanding of this project. Returns a pre-computed context extract at the requested token tier. Available tiers: 1500 (executive briefing), 5000 (deep onboarding), 10000 (institutional knowledge). This is a rich, always-current synthesis of project history, decisions, patterns, and active work \u2014 not a search result.",
14600
14394
  inputSchema: {
14601
14395
  type: "object",
14602
14396
  properties: {
14603
14397
  tier: {
14604
14398
  type: "number",
14605
- enum: [1500, 3e3, 5e3, 7500, 1e4],
14606
- description: "Token budget tier. Larger tiers include more detail. Default: 3000."
14399
+ enum: [1500, 5e3, 1e4],
14400
+ description: "Token budget tier. Larger tiers include more detail. Default: 5000."
14607
14401
  }
14608
14402
  }
14609
14403
  }
@@ -14611,89 +14405,107 @@ var TOOL_DEFINITIONS = [
14611
14405
  ];
14612
14406
 
14613
14407
  // src/mcp/server.ts
14614
- function createMycoServer(config2) {
14408
+ function createMycoServer(vaultDir, client) {
14615
14409
  const server = new Server(
14616
14410
  { name: "myco", version: getPluginVersion() },
14617
14411
  { capabilities: { tools: {} } }
14618
14412
  );
14619
- const dbPath = path4.join(config2.vaultDir, "index.db");
14620
- let index = null;
14621
- function getIndex() {
14622
- if (!index) {
14623
- index = new MycoIndex(dbPath);
14624
- initFts(index);
14625
- }
14626
- return index;
14627
- }
14628
- function embedNote(noteId, text, metadata) {
14629
- if (!config2.embeddingProvider || !config2.vectorIndex || !text) return;
14630
- generateEmbedding(config2.embeddingProvider, text.slice(0, EMBEDDING_INPUT_LIMIT)).then((emb) => config2.vectorIndex.upsert(noteId, emb.embedding, metadata)).catch(() => {
14631
- });
14632
- }
14633
14413
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
14634
14414
  tools: TOOL_DEFINITIONS
14635
14415
  }));
14636
14416
  function logActivity(tool, detail) {
14637
- const logDir = path4.join(config2.vaultDir, "logs");
14417
+ const logDir = path.join(vaultDir, "logs");
14638
14418
  try {
14639
- fs2.mkdirSync(logDir, { recursive: true });
14419
+ fs.mkdirSync(logDir, { recursive: true });
14640
14420
  const entry = JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), component: "mcp", level: "info", tool, ...detail }) + "\n";
14641
- fs2.appendFileSync(path4.join(logDir, "mcp.jsonl"), entry);
14421
+ fs.appendFileSync(path.join(logDir, "mcp.jsonl"), entry);
14642
14422
  } catch {
14643
14423
  }
14424
+ postToDaemon("info", "mcp", `Tool call: ${tool}`, { tool, ...detail });
14425
+ }
14426
+ let cachedDaemonPort = null;
14427
+ function postToDaemon(level, component, message, data) {
14428
+ try {
14429
+ if (cachedDaemonPort === null) {
14430
+ const daemonJsonPath = path.join(vaultDir, "daemon.json");
14431
+ const raw = fs.readFileSync(daemonJsonPath, "utf-8");
14432
+ cachedDaemonPort = JSON.parse(raw).port;
14433
+ }
14434
+ fetch(`http://127.0.0.1:${cachedDaemonPort}/api/log`, {
14435
+ method: "POST",
14436
+ headers: { "Content-Type": "application/json" },
14437
+ body: JSON.stringify({ level, component, message, data }),
14438
+ signal: AbortSignal.timeout(DAEMON_CLIENT_TIMEOUT_MS)
14439
+ }).catch(() => {
14440
+ cachedDaemonPort = null;
14441
+ });
14442
+ } catch {
14443
+ cachedDaemonPort = null;
14444
+ }
14644
14445
  }
14645
14446
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
14646
14447
  const { name, arguments: args = {} } = request.params;
14647
- const idx = getIndex();
14648
14448
  const input = args;
14449
+ const start = Date.now();
14649
14450
  switch (name) {
14650
- case TOOL_SEARCH:
14651
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoSearch(idx, input, config2.vectorIndex, config2.embeddingProvider)) }] };
14652
- case TOOL_RECALL:
14653
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoRecall(idx, input)) }] };
14451
+ case TOOL_SEARCH: {
14452
+ const searchInput = input;
14453
+ const result = await handleMycoSearch(searchInput, client);
14454
+ logActivity(TOOL_SEARCH, { query: searchInput.query, matches: result.length, duration_ms: Date.now() - start });
14455
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14456
+ }
14457
+ case TOOL_RECALL: {
14458
+ const recallInput = input;
14459
+ const result = await handleMycoRecall(recallInput, client);
14460
+ logActivity(TOOL_RECALL, { note_id: recallInput.note_id, duration_ms: Date.now() - start });
14461
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14462
+ }
14654
14463
  case TOOL_REMEMBER: {
14655
- const result = await handleMycoRemember(config2.vaultDir, idx, input);
14656
- embedNote(result.id, String(input.content), { type: "spore", observation_type: String(input.type ?? ""), importance: "high" });
14657
- if (config2.vectorIndex && config2.embeddingProvider && config2.llmProvider) {
14658
- checkSupersession(result.id, {
14659
- index: idx,
14660
- vectorIndex: config2.vectorIndex,
14661
- embeddingProvider: config2.embeddingProvider,
14662
- llmProvider: config2.llmProvider,
14663
- vaultDir: config2.vaultDir
14664
- }).catch(() => {
14665
- });
14666
- }
14667
- logActivity(TOOL_REMEMBER, { id: result.id, observation_type: input.type, path: result.note_path });
14464
+ const rememberInput = input;
14465
+ const result = await handleMycoRemember(rememberInput, client);
14466
+ logActivity(TOOL_REMEMBER, { id: result.id, observation_type: result.observation_type, duration_ms: Date.now() - start });
14467
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14468
+ }
14469
+ case TOOL_PLANS: {
14470
+ const plansInput = input;
14471
+ const result = await handleMycoPlans(plansInput, client);
14472
+ logActivity(TOOL_PLANS, { count: result.length, duration_ms: Date.now() - start });
14473
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14474
+ }
14475
+ case TOOL_SESSIONS: {
14476
+ const sessionsInput = input;
14477
+ const result = await handleMycoSessions(sessionsInput, client);
14478
+ logActivity(TOOL_SESSIONS, { count: result.length, duration_ms: Date.now() - start });
14479
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14480
+ }
14481
+ case TOOL_TEAM: {
14482
+ const teamInput = input;
14483
+ const result = await handleMycoTeam(teamInput, client);
14484
+ logActivity(TOOL_TEAM, { count: result.length, duration_ms: Date.now() - start });
14485
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
14486
+ }
14487
+ case TOOL_GRAPH: {
14488
+ const graphInput = input;
14489
+ const result = await handleMycoGraph(graphInput, client);
14490
+ logActivity(TOOL_GRAPH, { note_id: graphInput.note_id, duration_ms: Date.now() - start });
14668
14491
  return { content: [{ type: "text", text: JSON.stringify(result) }] };
14669
14492
  }
14670
- case TOOL_PLANS:
14671
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoPlans(idx, input)) }] };
14672
- case TOOL_SESSIONS:
14673
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoSessions(idx, input)) }] };
14674
- case TOOL_TEAM:
14675
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoTeam(idx, input, config2.teamUser)) }] };
14676
- case TOOL_GRAPH:
14677
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoGraph(idx, input)) }] };
14678
- case TOOL_ORPHANS:
14679
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoOrphans(idx)) }] };
14680
- case TOOL_LOGS:
14681
- return { content: [{ type: "text", text: JSON.stringify(await handleMycoLogs(config2.vaultDir, input)) }] };
14682
14493
  case TOOL_SUPERSEDE: {
14683
- const result = await handleMycoSupersede(config2.vaultDir, idx, input);
14684
- if (result.status === "superseded" && config2.vectorIndex) {
14685
- config2.vectorIndex.delete(result.old_spore);
14686
- }
14687
- logActivity(TOOL_SUPERSEDE, { old: result.old_spore, new: result.new_spore, status: result.status });
14494
+ const supersedeInput = input;
14495
+ const result = await handleMycoSupersede(supersedeInput, client);
14496
+ logActivity(TOOL_SUPERSEDE, { old: result.old_spore, new: result.new_spore, status: result.status, duration_ms: Date.now() - start });
14688
14497
  return { content: [{ type: "text", text: JSON.stringify(result) }] };
14689
14498
  }
14690
14499
  case TOOL_CONSOLIDATE: {
14691
- const result = await handleMycoConsolidate(config2.vaultDir, idx, input, config2.vectorIndex ?? null, config2.embeddingProvider ?? null);
14692
- logActivity(TOOL_CONSOLIDATE, { wisdom_id: result.wisdom_id, sources: input.source_spore_ids, archived: result.sources_archived });
14500
+ const consolidateInput = input;
14501
+ const result = await handleMycoConsolidate(consolidateInput);
14502
+ logActivity(TOOL_CONSOLIDATE, { status: result.status, duration_ms: Date.now() - start });
14693
14503
  return { content: [{ type: "text", text: JSON.stringify(result) }] };
14694
14504
  }
14695
14505
  case TOOL_CONTEXT: {
14696
- const result = handleMycoContext(config2.vaultDir, args);
14506
+ const contextInput = input;
14507
+ const result = await handleMycoContext(contextInput, client);
14508
+ logActivity(TOOL_CONTEXT, { tier: contextInput.tier, duration_ms: Date.now() - start });
14697
14509
  return { content: [{ type: "text", text: result.content }] };
14698
14510
  }
14699
14511
  default:
@@ -14713,33 +14525,12 @@ function createMycoServer(config2) {
14713
14525
  }
14714
14526
  async function main() {
14715
14527
  const vaultDir = resolveVaultDir();
14716
- const config2 = fs2.existsSync(path4.join(vaultDir, "myco.yaml")) ? loadConfig(vaultDir) : void 0;
14717
- let embeddingProvider;
14718
- let vectorIndex;
14719
- let llmProvider;
14720
- if (config2) {
14721
- try {
14722
- embeddingProvider = createEmbeddingProvider(config2.intelligence.embedding);
14723
- const testEmbed = await embeddingProvider.embed("test");
14724
- vectorIndex = new VectorIndex(path4.join(vaultDir, "vectors.db"), testEmbed.dimensions);
14725
- } catch {
14726
- }
14727
- try {
14728
- llmProvider = createLlmProvider(config2.intelligence.llm);
14729
- } catch {
14730
- }
14731
- }
14732
- const server = createMycoServer({
14733
- vaultDir,
14734
- teamUser: config2?.team?.user,
14735
- embeddingProvider,
14736
- vectorIndex,
14737
- llmProvider
14738
- });
14528
+ const client = new DaemonClient(vaultDir);
14529
+ const server = createMycoServer(vaultDir, client);
14739
14530
  await server.start();
14740
14531
  }
14741
14532
  export {
14742
14533
  createMycoServer,
14743
14534
  main
14744
14535
  };
14745
- //# sourceMappingURL=server-6UDN35QN.js.map
14536
+ //# sourceMappingURL=server-6KMBJCHZ.js.map