@mc1global/opencode-jarvis 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +171 -0
  3. package/dist/application/context-memory/dtos.d.ts +100 -0
  4. package/dist/application/context-memory/dtos.d.ts.map +1 -0
  5. package/dist/application/context-memory/dtos.js +11 -0
  6. package/dist/application/context-memory/dtos.js.map +1 -0
  7. package/dist/application/context-memory/note-use-cases.d.ts +22 -0
  8. package/dist/application/context-memory/note-use-cases.d.ts.map +1 -0
  9. package/dist/application/context-memory/note-use-cases.js +76 -0
  10. package/dist/application/context-memory/note-use-cases.js.map +1 -0
  11. package/dist/application/context-memory/session-use-cases.d.ts +23 -0
  12. package/dist/application/context-memory/session-use-cases.d.ts.map +1 -0
  13. package/dist/application/context-memory/session-use-cases.js +63 -0
  14. package/dist/application/context-memory/session-use-cases.js.map +1 -0
  15. package/dist/application/context-memory/todo-use-cases.d.ts +25 -0
  16. package/dist/application/context-memory/todo-use-cases.d.ts.map +1 -0
  17. package/dist/application/context-memory/todo-use-cases.js +100 -0
  18. package/dist/application/context-memory/todo-use-cases.js.map +1 -0
  19. package/dist/application/domain-map/dtos.d.ts +58 -0
  20. package/dist/application/domain-map/dtos.d.ts.map +1 -0
  21. package/dist/application/domain-map/dtos.js +11 -0
  22. package/dist/application/domain-map/dtos.js.map +1 -0
  23. package/dist/application/domain-map/use-cases.d.ts +64 -0
  24. package/dist/application/domain-map/use-cases.d.ts.map +1 -0
  25. package/dist/application/domain-map/use-cases.js +217 -0
  26. package/dist/application/domain-map/use-cases.js.map +1 -0
  27. package/dist/application/environment/dtos.d.ts +74 -0
  28. package/dist/application/environment/dtos.d.ts.map +1 -0
  29. package/dist/application/environment/dtos.js +10 -0
  30. package/dist/application/environment/dtos.js.map +1 -0
  31. package/dist/application/environment/use-cases.d.ts +29 -0
  32. package/dist/application/environment/use-cases.d.ts.map +1 -0
  33. package/dist/application/environment/use-cases.js +232 -0
  34. package/dist/application/environment/use-cases.js.map +1 -0
  35. package/dist/application/governance/validation-use-cases.d.ts +45 -0
  36. package/dist/application/governance/validation-use-cases.d.ts.map +1 -0
  37. package/dist/application/governance/validation-use-cases.js +51 -0
  38. package/dist/application/governance/validation-use-cases.js.map +1 -0
  39. package/dist/application/kanban/board-use-cases.d.ts +45 -0
  40. package/dist/application/kanban/board-use-cases.d.ts.map +1 -0
  41. package/dist/application/kanban/board-use-cases.js +124 -0
  42. package/dist/application/kanban/board-use-cases.js.map +1 -0
  43. package/dist/application/kanban/card-use-cases.d.ts +32 -0
  44. package/dist/application/kanban/card-use-cases.d.ts.map +1 -0
  45. package/dist/application/kanban/card-use-cases.js +204 -0
  46. package/dist/application/kanban/card-use-cases.js.map +1 -0
  47. package/dist/application/kanban/dtos.d.ts +165 -0
  48. package/dist/application/kanban/dtos.d.ts.map +1 -0
  49. package/dist/application/kanban/dtos.js +11 -0
  50. package/dist/application/kanban/dtos.js.map +1 -0
  51. package/dist/application/kanban/sprint-use-cases.d.ts +34 -0
  52. package/dist/application/kanban/sprint-use-cases.d.ts.map +1 -0
  53. package/dist/application/kanban/sprint-use-cases.js +243 -0
  54. package/dist/application/kanban/sprint-use-cases.js.map +1 -0
  55. package/dist/application/rag/dtos.d.ts +113 -0
  56. package/dist/application/rag/dtos.d.ts.map +1 -0
  57. package/dist/application/rag/dtos.js +11 -0
  58. package/dist/application/rag/dtos.js.map +1 -0
  59. package/dist/application/rag/oracle-use-cases.d.ts +30 -0
  60. package/dist/application/rag/oracle-use-cases.d.ts.map +1 -0
  61. package/dist/application/rag/oracle-use-cases.js +91 -0
  62. package/dist/application/rag/oracle-use-cases.js.map +1 -0
  63. package/dist/application/rag/use-cases.d.ts +34 -0
  64. package/dist/application/rag/use-cases.d.ts.map +1 -0
  65. package/dist/application/rag/use-cases.js +234 -0
  66. package/dist/application/rag/use-cases.js.map +1 -0
  67. package/dist/application/token-metrics/dtos.d.ts +126 -0
  68. package/dist/application/token-metrics/dtos.d.ts.map +1 -0
  69. package/dist/application/token-metrics/dtos.js +11 -0
  70. package/dist/application/token-metrics/dtos.js.map +1 -0
  71. package/dist/application/token-metrics/tracking-use-cases.d.ts +33 -0
  72. package/dist/application/token-metrics/tracking-use-cases.d.ts.map +1 -0
  73. package/dist/application/token-metrics/tracking-use-cases.js +220 -0
  74. package/dist/application/token-metrics/tracking-use-cases.js.map +1 -0
  75. package/dist/application/vault/dtos.d.ts +91 -0
  76. package/dist/application/vault/dtos.d.ts.map +1 -0
  77. package/dist/application/vault/dtos.js +11 -0
  78. package/dist/application/vault/dtos.js.map +1 -0
  79. package/dist/application/vault/use-cases.d.ts +30 -0
  80. package/dist/application/vault/use-cases.d.ts.map +1 -0
  81. package/dist/application/vault/use-cases.js +307 -0
  82. package/dist/application/vault/use-cases.js.map +1 -0
  83. package/dist/application/vault/vault-manager.d.ts +47 -0
  84. package/dist/application/vault/vault-manager.d.ts.map +1 -0
  85. package/dist/application/vault/vault-manager.js +272 -0
  86. package/dist/application/vault/vault-manager.js.map +1 -0
  87. package/dist/application/workspace-registry/dtos.d.ts +91 -0
  88. package/dist/application/workspace-registry/dtos.d.ts.map +1 -0
  89. package/dist/application/workspace-registry/dtos.js +11 -0
  90. package/dist/application/workspace-registry/dtos.js.map +1 -0
  91. package/dist/application/workspace-registry/use-cases.d.ts +29 -0
  92. package/dist/application/workspace-registry/use-cases.d.ts.map +1 -0
  93. package/dist/application/workspace-registry/use-cases.js +249 -0
  94. package/dist/application/workspace-registry/use-cases.js.map +1 -0
  95. package/dist/domain/context-memory/entities.d.ts +123 -0
  96. package/dist/domain/context-memory/entities.d.ts.map +1 -0
  97. package/dist/domain/context-memory/entities.js +229 -0
  98. package/dist/domain/context-memory/entities.js.map +1 -0
  99. package/dist/domain/context-memory/repositories.d.ts +46 -0
  100. package/dist/domain/context-memory/repositories.d.ts.map +1 -0
  101. package/dist/domain/context-memory/repositories.js +2 -0
  102. package/dist/domain/context-memory/repositories.js.map +1 -0
  103. package/dist/domain/context-memory/services.d.ts +62 -0
  104. package/dist/domain/context-memory/services.d.ts.map +1 -0
  105. package/dist/domain/context-memory/services.js +162 -0
  106. package/dist/domain/context-memory/services.js.map +1 -0
  107. package/dist/domain/context-memory/value-objects.d.ts +65 -0
  108. package/dist/domain/context-memory/value-objects.d.ts.map +1 -0
  109. package/dist/domain/context-memory/value-objects.js +105 -0
  110. package/dist/domain/context-memory/value-objects.js.map +1 -0
  111. package/dist/domain/domain-map/repositories.d.ts +126 -0
  112. package/dist/domain/domain-map/repositories.d.ts.map +1 -0
  113. package/dist/domain/domain-map/repositories.js +2 -0
  114. package/dist/domain/domain-map/repositories.js.map +1 -0
  115. package/dist/domain/domain-map/services.d.ts +108 -0
  116. package/dist/domain/domain-map/services.d.ts.map +1 -0
  117. package/dist/domain/domain-map/services.js +335 -0
  118. package/dist/domain/domain-map/services.js.map +1 -0
  119. package/dist/domain/domain-map/value-objects.d.ts +186 -0
  120. package/dist/domain/domain-map/value-objects.d.ts.map +1 -0
  121. package/dist/domain/domain-map/value-objects.js +215 -0
  122. package/dist/domain/domain-map/value-objects.js.map +1 -0
  123. package/dist/domain/environment/entities.d.ts +93 -0
  124. package/dist/domain/environment/entities.d.ts.map +1 -0
  125. package/dist/domain/environment/entities.js +207 -0
  126. package/dist/domain/environment/entities.js.map +1 -0
  127. package/dist/domain/environment/renderers.d.ts +30 -0
  128. package/dist/domain/environment/renderers.d.ts.map +1 -0
  129. package/dist/domain/environment/renderers.js +139 -0
  130. package/dist/domain/environment/renderers.js.map +1 -0
  131. package/dist/domain/environment/repositories.d.ts +73 -0
  132. package/dist/domain/environment/repositories.d.ts.map +1 -0
  133. package/dist/domain/environment/repositories.js +16 -0
  134. package/dist/domain/environment/repositories.js.map +1 -0
  135. package/dist/domain/environment/services.d.ts +62 -0
  136. package/dist/domain/environment/services.d.ts.map +1 -0
  137. package/dist/domain/environment/services.js +282 -0
  138. package/dist/domain/environment/services.js.map +1 -0
  139. package/dist/domain/environment/value-objects.d.ts +127 -0
  140. package/dist/domain/environment/value-objects.d.ts.map +1 -0
  141. package/dist/domain/environment/value-objects.js +179 -0
  142. package/dist/domain/environment/value-objects.js.map +1 -0
  143. package/dist/domain/governance/policies.d.ts +42 -0
  144. package/dist/domain/governance/policies.d.ts.map +1 -0
  145. package/dist/domain/governance/policies.js +304 -0
  146. package/dist/domain/governance/policies.js.map +1 -0
  147. package/dist/domain/governance/services.d.ts +38 -0
  148. package/dist/domain/governance/services.d.ts.map +1 -0
  149. package/dist/domain/governance/services.js +42 -0
  150. package/dist/domain/governance/services.js.map +1 -0
  151. package/dist/domain/kanban/entities.d.ts +105 -0
  152. package/dist/domain/kanban/entities.d.ts.map +1 -0
  153. package/dist/domain/kanban/entities.js +211 -0
  154. package/dist/domain/kanban/entities.js.map +1 -0
  155. package/dist/domain/kanban/grooming.d.ts +40 -0
  156. package/dist/domain/kanban/grooming.d.ts.map +1 -0
  157. package/dist/domain/kanban/grooming.js +50 -0
  158. package/dist/domain/kanban/grooming.js.map +1 -0
  159. package/dist/domain/kanban/repositories.d.ts +41 -0
  160. package/dist/domain/kanban/repositories.d.ts.map +1 -0
  161. package/dist/domain/kanban/repositories.js +2 -0
  162. package/dist/domain/kanban/repositories.js.map +1 -0
  163. package/dist/domain/kanban/services.d.ts +49 -0
  164. package/dist/domain/kanban/services.d.ts.map +1 -0
  165. package/dist/domain/kanban/services.js +154 -0
  166. package/dist/domain/kanban/services.js.map +1 -0
  167. package/dist/domain/kanban/sprint.d.ts +103 -0
  168. package/dist/domain/kanban/sprint.d.ts.map +1 -0
  169. package/dist/domain/kanban/sprint.js +192 -0
  170. package/dist/domain/kanban/sprint.js.map +1 -0
  171. package/dist/domain/kanban/value-objects.d.ts +91 -0
  172. package/dist/domain/kanban/value-objects.d.ts.map +1 -0
  173. package/dist/domain/kanban/value-objects.js +167 -0
  174. package/dist/domain/kanban/value-objects.js.map +1 -0
  175. package/dist/domain/rag/repositories.d.ts +152 -0
  176. package/dist/domain/rag/repositories.d.ts.map +1 -0
  177. package/dist/domain/rag/repositories.js +2 -0
  178. package/dist/domain/rag/repositories.js.map +1 -0
  179. package/dist/domain/rag/services.d.ts +57 -0
  180. package/dist/domain/rag/services.d.ts.map +1 -0
  181. package/dist/domain/rag/services.js +224 -0
  182. package/dist/domain/rag/services.js.map +1 -0
  183. package/dist/domain/rag/value-objects.d.ts +118 -0
  184. package/dist/domain/rag/value-objects.d.ts.map +1 -0
  185. package/dist/domain/rag/value-objects.js +114 -0
  186. package/dist/domain/rag/value-objects.js.map +1 -0
  187. package/dist/domain/shared/value-objects.d.ts +56 -0
  188. package/dist/domain/shared/value-objects.d.ts.map +1 -0
  189. package/dist/domain/shared/value-objects.js +89 -0
  190. package/dist/domain/shared/value-objects.js.map +1 -0
  191. package/dist/domain/token-metrics/entities.d.ts +90 -0
  192. package/dist/domain/token-metrics/entities.d.ts.map +1 -0
  193. package/dist/domain/token-metrics/entities.js +115 -0
  194. package/dist/domain/token-metrics/entities.js.map +1 -0
  195. package/dist/domain/token-metrics/repositories.d.ts +93 -0
  196. package/dist/domain/token-metrics/repositories.d.ts.map +1 -0
  197. package/dist/domain/token-metrics/repositories.js +2 -0
  198. package/dist/domain/token-metrics/repositories.js.map +1 -0
  199. package/dist/domain/token-metrics/value-objects.d.ts +81 -0
  200. package/dist/domain/token-metrics/value-objects.d.ts.map +1 -0
  201. package/dist/domain/token-metrics/value-objects.js +144 -0
  202. package/dist/domain/token-metrics/value-objects.js.map +1 -0
  203. package/dist/domain/vault/canvas.d.ts +70 -0
  204. package/dist/domain/vault/canvas.d.ts.map +1 -0
  205. package/dist/domain/vault/canvas.js +70 -0
  206. package/dist/domain/vault/canvas.js.map +1 -0
  207. package/dist/domain/vault/document.d.ts +71 -0
  208. package/dist/domain/vault/document.d.ts.map +1 -0
  209. package/dist/domain/vault/document.js +244 -0
  210. package/dist/domain/vault/document.js.map +1 -0
  211. package/dist/domain/vault/repositories.d.ts +35 -0
  212. package/dist/domain/vault/repositories.d.ts.map +1 -0
  213. package/dist/domain/vault/repositories.js +2 -0
  214. package/dist/domain/vault/repositories.js.map +1 -0
  215. package/dist/domain/vault/section.d.ts +33 -0
  216. package/dist/domain/vault/section.d.ts.map +1 -0
  217. package/dist/domain/vault/section.js +39 -0
  218. package/dist/domain/vault/section.js.map +1 -0
  219. package/dist/domain/vault/services.d.ts +48 -0
  220. package/dist/domain/vault/services.d.ts.map +1 -0
  221. package/dist/domain/vault/services.js +249 -0
  222. package/dist/domain/vault/services.js.map +1 -0
  223. package/dist/domain/vault/table.d.ts +58 -0
  224. package/dist/domain/vault/table.d.ts.map +1 -0
  225. package/dist/domain/vault/table.js +204 -0
  226. package/dist/domain/vault/table.js.map +1 -0
  227. package/dist/domain/vault/timeline.d.ts +53 -0
  228. package/dist/domain/vault/timeline.d.ts.map +1 -0
  229. package/dist/domain/vault/timeline.js +214 -0
  230. package/dist/domain/vault/timeline.js.map +1 -0
  231. package/dist/domain/vault/value-objects.d.ts +45 -0
  232. package/dist/domain/vault/value-objects.d.ts.map +1 -0
  233. package/dist/domain/vault/value-objects.js +89 -0
  234. package/dist/domain/vault/value-objects.js.map +1 -0
  235. package/dist/domain/workspace-registry/entities.d.ts +57 -0
  236. package/dist/domain/workspace-registry/entities.d.ts.map +1 -0
  237. package/dist/domain/workspace-registry/entities.js +148 -0
  238. package/dist/domain/workspace-registry/entities.js.map +1 -0
  239. package/dist/domain/workspace-registry/repositories.d.ts +57 -0
  240. package/dist/domain/workspace-registry/repositories.d.ts.map +1 -0
  241. package/dist/domain/workspace-registry/repositories.js +12 -0
  242. package/dist/domain/workspace-registry/repositories.js.map +1 -0
  243. package/dist/domain/workspace-registry/services.d.ts +56 -0
  244. package/dist/domain/workspace-registry/services.d.ts.map +1 -0
  245. package/dist/domain/workspace-registry/services.js +283 -0
  246. package/dist/domain/workspace-registry/services.js.map +1 -0
  247. package/dist/domain/workspace-registry/value-objects.d.ts +113 -0
  248. package/dist/domain/workspace-registry/value-objects.d.ts.map +1 -0
  249. package/dist/domain/workspace-registry/value-objects.js +235 -0
  250. package/dist/domain/workspace-registry/value-objects.js.map +1 -0
  251. package/dist/hooks/context-compacting.d.ts +35 -0
  252. package/dist/hooks/context-compacting.d.ts.map +1 -0
  253. package/dist/hooks/context-compacting.js +48 -0
  254. package/dist/hooks/context-compacting.js.map +1 -0
  255. package/dist/hooks/event-handlers.d.ts +39 -0
  256. package/dist/hooks/event-handlers.d.ts.map +1 -0
  257. package/dist/hooks/event-handlers.js +75 -0
  258. package/dist/hooks/event-handlers.js.map +1 -0
  259. package/dist/hooks/guardrails.d.ts +33 -0
  260. package/dist/hooks/guardrails.d.ts.map +1 -0
  261. package/dist/hooks/guardrails.js +22 -0
  262. package/dist/hooks/guardrails.js.map +1 -0
  263. package/dist/hooks/shell-env.d.ts +28 -0
  264. package/dist/hooks/shell-env.d.ts.map +1 -0
  265. package/dist/hooks/shell-env.js +17 -0
  266. package/dist/hooks/shell-env.js.map +1 -0
  267. package/dist/index.d.ts +16 -0
  268. package/dist/index.d.ts.map +1 -0
  269. package/dist/index.js +349 -0
  270. package/dist/index.js.map +1 -0
  271. package/dist/infrastructure/context-memory/note-repository.d.ts +26 -0
  272. package/dist/infrastructure/context-memory/note-repository.d.ts.map +1 -0
  273. package/dist/infrastructure/context-memory/note-repository.js +87 -0
  274. package/dist/infrastructure/context-memory/note-repository.js.map +1 -0
  275. package/dist/infrastructure/context-memory/search-repository.d.ts +20 -0
  276. package/dist/infrastructure/context-memory/search-repository.d.ts.map +1 -0
  277. package/dist/infrastructure/context-memory/search-repository.js +44 -0
  278. package/dist/infrastructure/context-memory/search-repository.js.map +1 -0
  279. package/dist/infrastructure/context-memory/session-repository.d.ts +26 -0
  280. package/dist/infrastructure/context-memory/session-repository.d.ts.map +1 -0
  281. package/dist/infrastructure/context-memory/session-repository.js +79 -0
  282. package/dist/infrastructure/context-memory/session-repository.js.map +1 -0
  283. package/dist/infrastructure/context-memory/todo-repository.d.ts +26 -0
  284. package/dist/infrastructure/context-memory/todo-repository.d.ts.map +1 -0
  285. package/dist/infrastructure/context-memory/todo-repository.js +105 -0
  286. package/dist/infrastructure/context-memory/todo-repository.js.map +1 -0
  287. package/dist/infrastructure/database/sqlite-adapter.d.ts +60 -0
  288. package/dist/infrastructure/database/sqlite-adapter.d.ts.map +1 -0
  289. package/dist/infrastructure/database/sqlite-adapter.js +93 -0
  290. package/dist/infrastructure/database/sqlite-adapter.js.map +1 -0
  291. package/dist/infrastructure/domain-map/llm-analyzer.d.ts +60 -0
  292. package/dist/infrastructure/domain-map/llm-analyzer.d.ts.map +1 -0
  293. package/dist/infrastructure/domain-map/llm-analyzer.js +249 -0
  294. package/dist/infrastructure/domain-map/llm-analyzer.js.map +1 -0
  295. package/dist/infrastructure/domain-map/lsp-adapter.d.ts +61 -0
  296. package/dist/infrastructure/domain-map/lsp-adapter.d.ts.map +1 -0
  297. package/dist/infrastructure/domain-map/lsp-adapter.js +210 -0
  298. package/dist/infrastructure/domain-map/lsp-adapter.js.map +1 -0
  299. package/dist/infrastructure/domain-map/lsp-configs.d.ts +53 -0
  300. package/dist/infrastructure/domain-map/lsp-configs.d.ts.map +1 -0
  301. package/dist/infrastructure/domain-map/lsp-configs.js +274 -0
  302. package/dist/infrastructure/domain-map/lsp-configs.js.map +1 -0
  303. package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts +132 -0
  304. package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts.map +1 -0
  305. package/dist/infrastructure/domain-map/lsp-json-rpc.js +320 -0
  306. package/dist/infrastructure/domain-map/lsp-json-rpc.js.map +1 -0
  307. package/dist/infrastructure/domain-map/project-scanner.d.ts +43 -0
  308. package/dist/infrastructure/domain-map/project-scanner.d.ts.map +1 -0
  309. package/dist/infrastructure/domain-map/project-scanner.js +193 -0
  310. package/dist/infrastructure/domain-map/project-scanner.js.map +1 -0
  311. package/dist/infrastructure/environment/environment-repository.d.ts +33 -0
  312. package/dist/infrastructure/environment/environment-repository.d.ts.map +1 -0
  313. package/dist/infrastructure/environment/environment-repository.js +161 -0
  314. package/dist/infrastructure/environment/environment-repository.js.map +1 -0
  315. package/dist/infrastructure/environment/scanner-adapter.d.ts +23 -0
  316. package/dist/infrastructure/environment/scanner-adapter.d.ts.map +1 -0
  317. package/dist/infrastructure/environment/scanner-adapter.js +102 -0
  318. package/dist/infrastructure/environment/scanner-adapter.js.map +1 -0
  319. package/dist/infrastructure/kanban/card-repository.d.ts +41 -0
  320. package/dist/infrastructure/kanban/card-repository.d.ts.map +1 -0
  321. package/dist/infrastructure/kanban/card-repository.js +185 -0
  322. package/dist/infrastructure/kanban/card-repository.js.map +1 -0
  323. package/dist/infrastructure/kanban/sprint-repository.d.ts +40 -0
  324. package/dist/infrastructure/kanban/sprint-repository.d.ts.map +1 -0
  325. package/dist/infrastructure/kanban/sprint-repository.js +186 -0
  326. package/dist/infrastructure/kanban/sprint-repository.js.map +1 -0
  327. package/dist/infrastructure/rag/file-discovery.d.ts +19 -0
  328. package/dist/infrastructure/rag/file-discovery.d.ts.map +1 -0
  329. package/dist/infrastructure/rag/file-discovery.js +201 -0
  330. package/dist/infrastructure/rag/file-discovery.js.map +1 -0
  331. package/dist/infrastructure/rag/ollama-embeddings.d.ts +18 -0
  332. package/dist/infrastructure/rag/ollama-embeddings.d.ts.map +1 -0
  333. package/dist/infrastructure/rag/ollama-embeddings.js +54 -0
  334. package/dist/infrastructure/rag/ollama-embeddings.js.map +1 -0
  335. package/dist/infrastructure/rag/text-splitter.d.ts +19 -0
  336. package/dist/infrastructure/rag/text-splitter.d.ts.map +1 -0
  337. package/dist/infrastructure/rag/text-splitter.js +38 -0
  338. package/dist/infrastructure/rag/text-splitter.js.map +1 -0
  339. package/dist/infrastructure/rag/vectra-adapter.d.ts +38 -0
  340. package/dist/infrastructure/rag/vectra-adapter.d.ts.map +1 -0
  341. package/dist/infrastructure/rag/vectra-adapter.js +275 -0
  342. package/dist/infrastructure/rag/vectra-adapter.js.map +1 -0
  343. package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts +29 -0
  344. package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts.map +1 -0
  345. package/dist/infrastructure/token-metrics/token-metrics-repository.js +254 -0
  346. package/dist/infrastructure/token-metrics/token-metrics-repository.js.map +1 -0
  347. package/dist/infrastructure/vault/markdown-parser.d.ts +35 -0
  348. package/dist/infrastructure/vault/markdown-parser.d.ts.map +1 -0
  349. package/dist/infrastructure/vault/markdown-parser.js +145 -0
  350. package/dist/infrastructure/vault/markdown-parser.js.map +1 -0
  351. package/dist/infrastructure/vault/vault-fs-adapter.d.ts +17 -0
  352. package/dist/infrastructure/vault/vault-fs-adapter.d.ts.map +1 -0
  353. package/dist/infrastructure/vault/vault-fs-adapter.js +105 -0
  354. package/dist/infrastructure/vault/vault-fs-adapter.js.map +1 -0
  355. package/dist/infrastructure/workspace-registry/dependency-repository.d.ts +27 -0
  356. package/dist/infrastructure/workspace-registry/dependency-repository.d.ts.map +1 -0
  357. package/dist/infrastructure/workspace-registry/dependency-repository.js +89 -0
  358. package/dist/infrastructure/workspace-registry/dependency-repository.js.map +1 -0
  359. package/dist/infrastructure/workspace-registry/workspace-repository.d.ts +28 -0
  360. package/dist/infrastructure/workspace-registry/workspace-repository.d.ts.map +1 -0
  361. package/dist/infrastructure/workspace-registry/workspace-repository.js +108 -0
  362. package/dist/infrastructure/workspace-registry/workspace-repository.js.map +1 -0
  363. package/dist/tools/agent-tools.d.ts +14 -0
  364. package/dist/tools/agent-tools.d.ts.map +1 -0
  365. package/dist/tools/agent-tools.js +238 -0
  366. package/dist/tools/agent-tools.js.map +1 -0
  367. package/dist/tools/context-memory-tools.d.ts +16 -0
  368. package/dist/tools/context-memory-tools.d.ts.map +1 -0
  369. package/dist/tools/context-memory-tools.js +242 -0
  370. package/dist/tools/context-memory-tools.js.map +1 -0
  371. package/dist/tools/data-tools.d.ts +3 -0
  372. package/dist/tools/data-tools.d.ts.map +1 -0
  373. package/dist/tools/data-tools.js +383 -0
  374. package/dist/tools/data-tools.js.map +1 -0
  375. package/dist/tools/domain-map-tools.d.ts +41 -0
  376. package/dist/tools/domain-map-tools.d.ts.map +1 -0
  377. package/dist/tools/domain-map-tools.js +134 -0
  378. package/dist/tools/domain-map-tools.js.map +1 -0
  379. package/dist/tools/environment-tools.d.ts +85 -0
  380. package/dist/tools/environment-tools.d.ts.map +1 -0
  381. package/dist/tools/environment-tools.js +223 -0
  382. package/dist/tools/environment-tools.js.map +1 -0
  383. package/dist/tools/governance-tools.d.ts +7 -0
  384. package/dist/tools/governance-tools.d.ts.map +1 -0
  385. package/dist/tools/governance-tools.js +73 -0
  386. package/dist/tools/governance-tools.js.map +1 -0
  387. package/dist/tools/kanban-board-tools.d.ts +11 -0
  388. package/dist/tools/kanban-board-tools.d.ts.map +1 -0
  389. package/dist/tools/kanban-board-tools.js +354 -0
  390. package/dist/tools/kanban-board-tools.js.map +1 -0
  391. package/dist/tools/kanban-card-tools.d.ts +11 -0
  392. package/dist/tools/kanban-card-tools.d.ts.map +1 -0
  393. package/dist/tools/kanban-card-tools.js +407 -0
  394. package/dist/tools/kanban-card-tools.js.map +1 -0
  395. package/dist/tools/rag-tools.d.ts +10 -0
  396. package/dist/tools/rag-tools.d.ts.map +1 -0
  397. package/dist/tools/rag-tools.js +279 -0
  398. package/dist/tools/rag-tools.js.map +1 -0
  399. package/dist/tools/token-metrics-tools.d.ts +98 -0
  400. package/dist/tools/token-metrics-tools.d.ts.map +1 -0
  401. package/dist/tools/token-metrics-tools.js +287 -0
  402. package/dist/tools/token-metrics-tools.js.map +1 -0
  403. package/dist/tools/vault-manage-tool.d.ts +7 -0
  404. package/dist/tools/vault-manage-tool.d.ts.map +1 -0
  405. package/dist/tools/vault-manage-tool.js +193 -0
  406. package/dist/tools/vault-manage-tool.js.map +1 -0
  407. package/dist/tools/vault-tools.d.ts +7 -0
  408. package/dist/tools/vault-tools.d.ts.map +1 -0
  409. package/dist/tools/vault-tools.js +348 -0
  410. package/dist/tools/vault-tools.js.map +1 -0
  411. package/dist/tools/workspace-registry-tools.d.ts +93 -0
  412. package/dist/tools/workspace-registry-tools.d.ts.map +1 -0
  413. package/dist/tools/workspace-registry-tools.js +217 -0
  414. package/dist/tools/workspace-registry-tools.js.map +1 -0
  415. package/package.json +59 -0
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Token Metrics Repository Interfaces
3
+ *
4
+ * Port definitions for token usage persistence and querying.
5
+ * Implementations live in the infrastructure layer.
6
+ *
7
+ * DDD: Repository interfaces (ports) in domain layer
8
+ * SOLID: ISP - focused interface for token metrics only
9
+ * SOLID: DIP - domain defines the contract, infra implements
10
+ */
11
+ import type { WorkspaceId } from "../shared/value-objects.js";
12
+ import type { TokenUsage } from "./entities.js";
13
+ import type { OperationType, TokenUsageId } from "./value-objects.js";
14
+ /** Aggregated metrics for a single agent. */
15
+ export interface AgentMetrics {
16
+ readonly agent: string;
17
+ readonly totalInputTokens: number;
18
+ readonly totalOutputTokens: number;
19
+ readonly totalTokens: number;
20
+ readonly totalCostUsd: number;
21
+ readonly recordCount: number;
22
+ readonly dominantOperation: OperationType;
23
+ }
24
+ /** Aggregated metrics for a single card. */
25
+ export interface CardMetrics {
26
+ readonly cardId: string;
27
+ readonly totalInputTokens: number;
28
+ readonly totalOutputTokens: number;
29
+ readonly totalTokens: number;
30
+ readonly totalCostUsd: number;
31
+ readonly recordCount: number;
32
+ readonly agentCount: number;
33
+ }
34
+ /** Aggregated metrics for a single sprint. */
35
+ export interface SprintMetrics {
36
+ readonly sprintId: string;
37
+ readonly totalInputTokens: number;
38
+ readonly totalOutputTokens: number;
39
+ readonly totalTokens: number;
40
+ readonly totalCostUsd: number;
41
+ readonly recordCount: number;
42
+ readonly cardCount: number;
43
+ readonly agentCount: number;
44
+ }
45
+ /** Workspace-wide summary metrics. */
46
+ export interface WorkspaceSummary {
47
+ readonly totalInputTokens: number;
48
+ readonly totalOutputTokens: number;
49
+ readonly totalTokens: number;
50
+ readonly totalCostUsd: number;
51
+ readonly recordCount: number;
52
+ readonly byOperation: ReadonlyArray<{
53
+ readonly operation: OperationType;
54
+ readonly totalTokens: number;
55
+ readonly totalCostUsd: number;
56
+ readonly count: number;
57
+ }>;
58
+ readonly topAgents: ReadonlyArray<{
59
+ readonly agent: string;
60
+ readonly totalTokens: number;
61
+ readonly totalCostUsd: number;
62
+ }>;
63
+ }
64
+ export interface TokenUsageFilter {
65
+ readonly agent?: string;
66
+ readonly cardId?: string;
67
+ readonly sprintId?: string;
68
+ readonly operation?: OperationType;
69
+ readonly sessionId?: string;
70
+ readonly limit?: number;
71
+ }
72
+ /**
73
+ * Repository for persisting and querying token usage records.
74
+ */
75
+ export interface TokenMetricsRepository {
76
+ /** Save a new token usage record. */
77
+ save(usage: TokenUsage): Promise<void>;
78
+ /** Get a single record by ID. */
79
+ findById(id: TokenUsageId): Promise<TokenUsage | undefined>;
80
+ /** List records with optional filters, ordered by creation (newest first). */
81
+ findByWorkspace(workspace: WorkspaceId, filter?: TokenUsageFilter): Promise<readonly TokenUsage[]>;
82
+ /** Get the next available sequence number for ID generation. */
83
+ nextSequence(workspace: WorkspaceId): Promise<number>;
84
+ /** Aggregated metrics by agent for a workspace. */
85
+ getMetricsByAgent(workspace: WorkspaceId, agent?: string): Promise<readonly AgentMetrics[]>;
86
+ /** Aggregated metrics by card for a workspace. */
87
+ getMetricsByCard(workspace: WorkspaceId, cardId?: string): Promise<readonly CardMetrics[]>;
88
+ /** Aggregated metrics by sprint for a workspace. */
89
+ getMetricsBySprint(workspace: WorkspaceId, sprintId?: string): Promise<readonly SprintMetrics[]>;
90
+ /** Workspace-wide summary. */
91
+ getWorkspaceSummary(workspace: WorkspaceId): Promise<WorkspaceSummary>;
92
+ }
93
+ //# sourceMappingURL=repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.d.ts","sourceRoot":"","sources":["../../../src/domain/token-metrics/repositories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KA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;IACjC,QAAQ,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAE5D,8EAA8E;IAC9E,eAAe,CACb,SAAS,EAAE,WAAW,EACtB,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;IAElC,gEAAgE;IAChE,YAAY,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtD,mDAAmD;IACnD,iBAAiB,CACf,SAAS,EAAE,WAAW,EACtB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAAC;IAEpC,kDAAkD;IAClD,gBAAgB,CACd,SAAS,EAAE,WAAW,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;IAEnC,oDAAoD;IACpD,kBAAkB,CAChB,SAAS,EAAE,WAAW,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC;IAErC,8BAA8B;IAC9B,mBAAmB,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACxE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repositories.js","sourceRoot":"","sources":["../../../src/domain/token-metrics/repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Token Metrics Value Objects
3
+ *
4
+ * Identity types, enums, and cost calculation for the token-metrics
5
+ * bounded context. All are immutable, compared by value.
6
+ *
7
+ * Core concept: in an AI-agent workforce, the unit of productive
8
+ * capacity is token budget and cost-per-token — analogous to
9
+ * hours/day and cost/hour for human developers.
10
+ *
11
+ * DDD: Value Objects - no identity lifecycle, equality by value
12
+ * SOLID: SRP - each type handles one concern
13
+ */
14
+ import { EntityId } from "../shared/value-objects.js";
15
+ /**
16
+ * Token usage record identifier. Format: TU-{NNN}
17
+ */
18
+ export declare class TokenUsageId extends EntityId {
19
+ private constructor();
20
+ static create(sequence: number): TokenUsageId;
21
+ static from(value: string): TokenUsageId;
22
+ get sequence(): number;
23
+ }
24
+ /**
25
+ * Type of operation that consumed tokens.
26
+ * Maps to the kind of work an agent performed.
27
+ */
28
+ export declare enum OperationType {
29
+ Implementation = "implementation",
30
+ Review = "review",
31
+ Fix = "fix",
32
+ Planning = "planning",
33
+ Grooming = "grooming",
34
+ Other = "other"
35
+ }
36
+ /** Check if an operation is productive (creates deliverable output). */
37
+ export declare function isProductiveOperation(op: OperationType): boolean;
38
+ /** Check if an operation is quality-related. */
39
+ export declare function isQualityOperation(op: OperationType): boolean;
40
+ /** Check if an operation is planning-related. */
41
+ export declare function isPlanningOperation(op: OperationType): boolean;
42
+ /** Parse string to OperationType, returns Other for unknown values. */
43
+ export declare function parseOperationType(value: string): OperationType;
44
+ /**
45
+ * Cost tier for grouping models by pricing bracket.
46
+ * Used for capacity planning and budget forecasting.
47
+ */
48
+ export declare enum CostTier {
49
+ /** Free local models (Ollama) */
50
+ Free = "free",
51
+ /** Low-cost API models (Haiku, GPT-3.5) */
52
+ Low = "low",
53
+ /** Standard API models (Sonnet, GPT-4-turbo) */
54
+ Standard = "standard",
55
+ /** Premium API models (Opus, GPT-4) */
56
+ Premium = "premium"
57
+ }
58
+ /**
59
+ * Pricing per 1 million tokens for a model.
60
+ * Input and output tokens are priced differently.
61
+ */
62
+ export interface ModelPricing {
63
+ readonly inputPerMillion: number;
64
+ readonly outputPerMillion: number;
65
+ readonly costTier: CostTier;
66
+ }
67
+ /**
68
+ * Known model pricing table.
69
+ * Prices in USD per 1M tokens. Updated as of 2026-02.
70
+ */
71
+ export declare const MODEL_PRICING: Readonly<Record<string, ModelPricing>>;
72
+ /**
73
+ * Calculate cost in USD for a given token count and model.
74
+ * Pure function — no side effects.
75
+ */
76
+ export declare function calculateCost(inputTokens: number, outputTokens: number, model: string): number;
77
+ /**
78
+ * Get the cost tier for a model.
79
+ */
80
+ export declare function getModelCostTier(model: string): CostTier;
81
+ //# sourceMappingURL=value-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-objects.d.ts","sourceRoot":"","sources":["../../../src/domain/token-metrics/value-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD;;GAEG;AACH,qBAAa,YAAa,SAAQ,QAAQ;IACxC,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAO7C,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIxC,IAAI,QAAQ,IAAI,MAAM,CAGrB;CACF;AAID;;;GAGG;AACH,oBAAY,aAAa;IACvB,cAAc,mBAAmB;IACjC,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAEhE;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAE7D;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAI9D;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAI/D;AAID;;;GAGG;AACH,oBAAY,QAAQ;IAClB,iCAAiC;IACjC,IAAI,SAAS;IACb,2CAA2C;IAC3C,GAAG,QAAQ;IACX,gDAAgD;IAChD,QAAQ,aAAa;IACrB,uCAAuC;IACvC,OAAO,YAAY;CACpB;AAID;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAoChE,CAAC;AAKF;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAExD"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Token Metrics Value Objects
3
+ *
4
+ * Identity types, enums, and cost calculation for the token-metrics
5
+ * bounded context. All are immutable, compared by value.
6
+ *
7
+ * Core concept: in an AI-agent workforce, the unit of productive
8
+ * capacity is token budget and cost-per-token — analogous to
9
+ * hours/day and cost/hour for human developers.
10
+ *
11
+ * DDD: Value Objects - no identity lifecycle, equality by value
12
+ * SOLID: SRP - each type handles one concern
13
+ */
14
+ import { EntityId } from "../shared/value-objects.js";
15
+ // ── Token Usage Identity ──────────────────────────────────────────────
16
+ /**
17
+ * Token usage record identifier. Format: TU-{NNN}
18
+ */
19
+ export class TokenUsageId extends EntityId {
20
+ constructor(value) {
21
+ super(value);
22
+ }
23
+ static create(sequence) {
24
+ if (!Number.isInteger(sequence) || sequence <= 0) {
25
+ throw new Error("TokenUsageId: sequence must be a positive integer");
26
+ }
27
+ return new TokenUsageId(`TU-${String(sequence).padStart(3, "0")}`);
28
+ }
29
+ static from(value) {
30
+ return new TokenUsageId(value);
31
+ }
32
+ get sequence() {
33
+ const parts = this.value.split("-");
34
+ return Number(parts[1] ?? 0);
35
+ }
36
+ }
37
+ // ── Operation Type ────────────────────────────────────────────────────
38
+ /**
39
+ * Type of operation that consumed tokens.
40
+ * Maps to the kind of work an agent performed.
41
+ */
42
+ export var OperationType;
43
+ (function (OperationType) {
44
+ OperationType["Implementation"] = "implementation";
45
+ OperationType["Review"] = "review";
46
+ OperationType["Fix"] = "fix";
47
+ OperationType["Planning"] = "planning";
48
+ OperationType["Grooming"] = "grooming";
49
+ OperationType["Other"] = "other";
50
+ })(OperationType || (OperationType = {}));
51
+ /** Check if an operation is productive (creates deliverable output). */
52
+ export function isProductiveOperation(op) {
53
+ return op === OperationType.Implementation || op === OperationType.Fix;
54
+ }
55
+ /** Check if an operation is quality-related. */
56
+ export function isQualityOperation(op) {
57
+ return op === OperationType.Review;
58
+ }
59
+ /** Check if an operation is planning-related. */
60
+ export function isPlanningOperation(op) {
61
+ return (op === OperationType.Planning || op === OperationType.Grooming);
62
+ }
63
+ /** Parse string to OperationType, returns Other for unknown values. */
64
+ export function parseOperationType(value) {
65
+ const normalized = value.toLowerCase();
66
+ const found = Object.values(OperationType).find((v) => v === normalized);
67
+ return found ?? OperationType.Other;
68
+ }
69
+ // ── Cost Tier ─────────────────────────────────────────────────────────
70
+ /**
71
+ * Cost tier for grouping models by pricing bracket.
72
+ * Used for capacity planning and budget forecasting.
73
+ */
74
+ export var CostTier;
75
+ (function (CostTier) {
76
+ /** Free local models (Ollama) */
77
+ CostTier["Free"] = "free";
78
+ /** Low-cost API models (Haiku, GPT-3.5) */
79
+ CostTier["Low"] = "low";
80
+ /** Standard API models (Sonnet, GPT-4-turbo) */
81
+ CostTier["Standard"] = "standard";
82
+ /** Premium API models (Opus, GPT-4) */
83
+ CostTier["Premium"] = "premium";
84
+ })(CostTier || (CostTier = {}));
85
+ /**
86
+ * Known model pricing table.
87
+ * Prices in USD per 1M tokens. Updated as of 2026-02.
88
+ */
89
+ export const MODEL_PRICING = {
90
+ "claude-sonnet": {
91
+ inputPerMillion: 3,
92
+ outputPerMillion: 15,
93
+ costTier: CostTier.Standard,
94
+ },
95
+ "claude-opus": {
96
+ inputPerMillion: 15,
97
+ outputPerMillion: 75,
98
+ costTier: CostTier.Premium,
99
+ },
100
+ "claude-haiku": {
101
+ inputPerMillion: 0.25,
102
+ outputPerMillion: 1.25,
103
+ costTier: CostTier.Low,
104
+ },
105
+ "gpt-4": {
106
+ inputPerMillion: 30,
107
+ outputPerMillion: 60,
108
+ costTier: CostTier.Premium,
109
+ },
110
+ "gpt-4-turbo": {
111
+ inputPerMillion: 10,
112
+ outputPerMillion: 30,
113
+ costTier: CostTier.Standard,
114
+ },
115
+ ollama: {
116
+ inputPerMillion: 0,
117
+ outputPerMillion: 0,
118
+ costTier: CostTier.Free,
119
+ },
120
+ local: {
121
+ inputPerMillion: 0,
122
+ outputPerMillion: 0,
123
+ costTier: CostTier.Free,
124
+ },
125
+ };
126
+ /** Default pricing used when model is unknown. Assumes Sonnet-class. */
127
+ const DEFAULT_PRICING = MODEL_PRICING["claude-sonnet"];
128
+ /**
129
+ * Calculate cost in USD for a given token count and model.
130
+ * Pure function — no side effects.
131
+ */
132
+ export function calculateCost(inputTokens, outputTokens, model) {
133
+ const pricing = MODEL_PRICING[model] ?? DEFAULT_PRICING;
134
+ const inputCost = (inputTokens / 1_000_000) * pricing.inputPerMillion;
135
+ const outputCost = (outputTokens / 1_000_000) * pricing.outputPerMillion;
136
+ return Math.round((inputCost + outputCost) * 1_000_000) / 1_000_000;
137
+ }
138
+ /**
139
+ * Get the cost tier for a model.
140
+ */
141
+ export function getModelCostTier(model) {
142
+ return (MODEL_PRICING[model] ?? DEFAULT_PRICING).costTier;
143
+ }
144
+ //# sourceMappingURL=value-objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-objects.js","sourceRoot":"","sources":["../../../src/domain/token-metrics/value-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,yEAAyE;AAEzE;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAoB,KAAa;QAC/B,KAA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,QAAQ;KAC5B;IACD,MAAM,EAAE;QACN,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,QAAQ,CAAC,IAAI;KACxB;IACD,KAAK,EAAE;QACL,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,QAAQ,CAAC,IAAI;KACxB;CACF,CAAC;AAEF,wEAAwE;AACxE,MAAM,eAAe,GAAiB,aAAa,CAAC,eAAe,CAAE,CAAC;AAEtE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAmB,EACnB,YAAoB,EACpB,KAAa;IAEb,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC;IACxD,MAAM,SAAS,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IACtE,MAAM,UAAU,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IACzE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Vault Canvas Value Objects and Entity
3
+ *
4
+ * Models the Obsidian .canvas file format (JSON Canvas spec 1.0).
5
+ * Supports text, file, link, and group node types plus directional edges.
6
+ * CanvasDocument is the aggregate root for canvas operations.
7
+ *
8
+ * DDD: Entity (CanvasDocument) with Value Objects (nodes, edges)
9
+ * SOLID: SRP - canvas structure only
10
+ */
11
+ export type CanvasNodeType = "text" | "file" | "link" | "group";
12
+ export type CanvasEdgeSide = "top" | "right" | "bottom" | "left";
13
+ export type CanvasEdgeEnd = "none" | "arrow";
14
+ export interface CanvasNode {
15
+ readonly id: string;
16
+ readonly type: CanvasNodeType;
17
+ readonly x: number;
18
+ readonly y: number;
19
+ readonly width: number;
20
+ readonly height: number;
21
+ readonly color?: string;
22
+ readonly text?: string;
23
+ readonly file?: string;
24
+ readonly subpath?: string;
25
+ readonly url?: string;
26
+ readonly label?: string;
27
+ readonly background?: string;
28
+ readonly backgroundStyle?: "cover" | "ratio" | "repeat";
29
+ }
30
+ export interface CanvasEdge {
31
+ readonly id: string;
32
+ readonly fromNode: string;
33
+ readonly toNode: string;
34
+ readonly fromSide?: CanvasEdgeSide;
35
+ readonly toSide?: CanvasEdgeSide;
36
+ readonly fromEnd?: CanvasEdgeEnd;
37
+ readonly toEnd?: CanvasEdgeEnd;
38
+ readonly color?: string;
39
+ readonly label?: string;
40
+ }
41
+ /**
42
+ * Aggregate root for .canvas files.
43
+ * Immutable — mutators return new CanvasDocument instances.
44
+ */
45
+ export declare class CanvasDocument {
46
+ readonly nodes: readonly CanvasNode[];
47
+ readonly edges: readonly CanvasEdge[];
48
+ private constructor();
49
+ /** Parse from JSON string. */
50
+ static fromJSON(json: string): CanvasDocument;
51
+ /** Create from node and edge arrays. */
52
+ static create(nodes: readonly CanvasNode[], edges: readonly CanvasEdge[]): CanvasDocument;
53
+ /** Serialize to formatted JSON string. */
54
+ toJSON(): string;
55
+ /** Find a node by ID. */
56
+ findNode(id: string): CanvasNode | null;
57
+ /** Find all edges originating from a node. */
58
+ findEdgesFrom(nodeId: string): readonly CanvasEdge[];
59
+ /** Find all edges pointing to a node. */
60
+ findEdgesTo(nodeId: string): readonly CanvasEdge[];
61
+ /** Return a new document with an added or replaced node. */
62
+ withNode(node: CanvasNode): CanvasDocument;
63
+ /** Return a new document with an added or replaced edge. */
64
+ withEdge(edge: CanvasEdge): CanvasDocument;
65
+ /** Return a new document with a node removed (also removes connected edges). */
66
+ withoutNode(id: string): CanvasDocument;
67
+ /** Return a new document with an edge removed. */
68
+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"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Vault Canvas Value Objects and Entity
3
+ *
4
+ * Models the Obsidian .canvas file format (JSON Canvas spec 1.0).
5
+ * Supports text, file, link, and group node types plus directional edges.
6
+ * CanvasDocument is the aggregate root for canvas operations.
7
+ *
8
+ * DDD: Entity (CanvasDocument) with Value Objects (nodes, edges)
9
+ * SOLID: SRP - canvas structure only
10
+ */
11
+ // ── CanvasDocument ────────────────────────────────────────────────────
12
+ /**
13
+ * Aggregate root for .canvas files.
14
+ * Immutable — mutators return new CanvasDocument instances.
15
+ */
16
+ export class CanvasDocument {
17
+ nodes;
18
+ edges;
19
+ constructor(nodes, edges) {
20
+ this.nodes = nodes;
21
+ this.edges = edges;
22
+ }
23
+ /** Parse from JSON string. */
24
+ static fromJSON(json) {
25
+ const parsed = JSON.parse(json);
26
+ return new CanvasDocument(parsed.nodes ?? [], parsed.edges ?? []);
27
+ }
28
+ /** Create from node and edge arrays. */
29
+ static create(nodes, edges) {
30
+ return new CanvasDocument(nodes, edges);
31
+ }
32
+ /** Serialize to formatted JSON string. */
33
+ toJSON() {
34
+ return JSON.stringify({ nodes: this.nodes, edges: this.edges }, null, 2);
35
+ }
36
+ /** Find a node by ID. */
37
+ findNode(id) {
38
+ return this.nodes.find((n) => n.id === id) ?? null;
39
+ }
40
+ /** Find all edges originating from a node. */
41
+ findEdgesFrom(nodeId) {
42
+ return this.edges.filter((e) => e.fromNode === nodeId);
43
+ }
44
+ /** Find all edges pointing to a node. */
45
+ findEdgesTo(nodeId) {
46
+ return this.edges.filter((e) => e.toNode === nodeId);
47
+ }
48
+ /** Return a new document with an added or replaced node. */
49
+ withNode(node) {
50
+ const filtered = this.nodes.filter((n) => n.id !== node.id);
51
+ return new CanvasDocument([...filtered, node], this.edges);
52
+ }
53
+ /** Return a new document with an added or replaced edge. */
54
+ withEdge(edge) {
55
+ const filtered = this.edges.filter((e) => e.id !== edge.id);
56
+ return new CanvasDocument(this.nodes, [...filtered, edge]);
57
+ }
58
+ /** Return a new document with a node removed (also removes connected edges). */
59
+ withoutNode(id) {
60
+ const nodes = this.nodes.filter((n) => n.id !== id);
61
+ const edges = this.edges.filter((e) => e.fromNode !== id && e.toNode !== id);
62
+ return new CanvasDocument(nodes, edges);
63
+ }
64
+ /** Return a new document with an edge removed. */
65
+ withoutEdge(id) {
66
+ const edges = this.edges.filter((e) => e.id !== id);
67
+ return new CanvasDocument(this.nodes, edges);
68
+ }
69
+ }
70
+ //# sourceMappingURL=canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.js","sourceRoot":"","sources":["../../../src/domain/vault/canvas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA6CH,yEAAyE;AAEzE;;;GAGG;AACH,MAAM,OAAO,cAAc;IAChB,KAAK,CAAwB;IAC7B,KAAK,CAAwB;IAEtC,YACE,KAA4B,EAC5B,KAA4B;QAE5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,8BAA8B;IAC9B,MAAM,CAAC,QAAQ,CAAC,IAAY;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAG7B,CAAC;QACF,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,wCAAwC;IACxC,MAAM,CAAC,MAAM,CACX,KAA4B,EAC5B,KAA4B;QAE5B,OAAO,IAAI,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,0CAA0C;IAC1C,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CACnB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EACxC,IAAI,EACJ,CAAC,CACF,CAAC;IACJ,CAAC;IAED,yBAAyB;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AAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAC5C,CAAC;QACF,OAAO,IAAI,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,kDAAkD;IAClD,WAAW,CAAC,EAAU;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Vault MarkdownDocument Entity
3
+ *
4
+ * Aggregate root for markdown document operations within the vault.
5
+ * Owns frontmatter, section tree, and raw content. Provides query
6
+ * methods for sections, tables, checkboxes, wikilinks, and mutation
7
+ * methods that return new content strings (immutable pattern).
8
+ *
9
+ * DDD: Entity / Aggregate Root - the document is the consistency boundary
10
+ * SOLID: SRP - document structure and content manipulation
11
+ * SOLID: OCP - new query/mutation methods extend without modifying existing
12
+ */
13
+ import { VaultPath } from "./value-objects.js";
14
+ import type { HeadingLevel } from "./value-objects.js";
15
+ import { Section } from "./section.js";
16
+ import { MarkdownTable } from "./table.js";
17
+ import type { Checkbox, Wikilink } from "./table.js";
18
+ export interface MarkdownDocumentProps {
19
+ readonly path: VaultPath;
20
+ readonly frontmatter: Record<string, unknown>;
21
+ readonly rawFrontmatter: string;
22
+ readonly sections: readonly Section[];
23
+ readonly rawContent: string;
24
+ }
25
+ export declare class MarkdownDocument {
26
+ readonly path: VaultPath;
27
+ readonly frontmatter: Record<string, unknown>;
28
+ readonly rawFrontmatter: string;
29
+ readonly sections: readonly Section[];
30
+ readonly rawContent: string;
31
+ private constructor();
32
+ /** Reconstitute from parsed components. */
33
+ static reconstitute(props: MarkdownDocumentProps): MarkdownDocument;
34
+ /** Document title from frontmatter, first H1, or filename. */
35
+ get title(): string;
36
+ /** Tags from frontmatter (normalized to string array). */
37
+ get tags(): readonly string[];
38
+ /** Status from frontmatter. */
39
+ get status(): string | undefined;
40
+ /** Created date from frontmatter. */
41
+ get created(): string | undefined;
42
+ /** Updated date from frontmatter. */
43
+ get updated(): string | undefined;
44
+ /** Find a section by heading text (case-insensitive). */
45
+ getSection(heading: string): Section | null;
46
+ /**
47
+ * Find a section by heading path (e.g., "Quality Gates > Sub-gate A").
48
+ * The first segment is searched recursively through the entire tree.
49
+ * Subsequent segments are searched within the found section's subsections.
50
+ */
51
+ getSectionByPath(headingPath: string): Section | null;
52
+ /** Extract all checkboxes from the document body. */
53
+ getCheckboxes(): readonly Checkbox[];
54
+ /** Extract all wikilinks from the document. */
55
+ getWikilinks(): readonly Wikilink[];
56
+ /** Extract all tables from the document body. */
57
+ getTables(): readonly MarkdownTable[];
58
+ /**
59
+ * Return new document content with replaced frontmatter.
60
+ * Receives pre-serialized YAML string (without --- delimiters).
61
+ */
62
+ withFrontmatter(serializedYaml: string): string;
63
+ /**
64
+ * Return new document content with a section's content replaced or appended.
65
+ * Finds the section by heading text (case-insensitive).
66
+ */
67
+ withSectionContent(heading: string, content: string, mode: "replace" | "append"): string;
68
+ }
69
+ export { VaultPath, Section, MarkdownTable };
70
+ export type { Checkbox, Wikilink, HeadingLevel };
71
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/domain/vault/document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAsC,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CA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