kontexta 5.2.0 → 6.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 (310) hide show
  1. package/bundle/standalone/CHANGELOG.md +52 -0
  2. package/bundle/standalone/apps/web/.next/BUILD_ID +1 -1
  3. package/bundle/standalone/apps/web/.next/app-build-manifest.json +42 -42
  4. package/bundle/standalone/apps/web/.next/app-path-routes-manifest.json +10 -10
  5. package/bundle/standalone/apps/web/.next/build-manifest.json +2 -2
  6. package/bundle/standalone/apps/web/.next/prerender-manifest.json +16 -16
  7. package/bundle/standalone/apps/web/.next/required-server-files.json +1 -0
  8. package/bundle/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/bundle/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/bundle/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  11. package/bundle/standalone/apps/web/.next/server/app/_not-found.rsc +1 -1
  12. package/bundle/standalone/apps/web/.next/server/app/api/about/route.js.nft.json +1 -1
  13. package/bundle/standalone/apps/web/.next/server/app/api/about/route_client-reference-manifest.js +1 -1
  14. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/hooks/route.js.nft.json +1 -1
  15. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/hooks/route_client-reference-manifest.js +1 -1
  16. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/mcp/route.js.nft.json +1 -1
  17. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/mcp/route_client-reference-manifest.js +1 -1
  18. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/route.js.nft.json +1 -1
  19. package/bundle/standalone/apps/web/.next/server/app/api/agents/[id]/route_client-reference-manifest.js +1 -1
  20. package/bundle/standalone/apps/web/.next/server/app/api/agents/route.js.nft.json +1 -1
  21. package/bundle/standalone/apps/web/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  22. package/bundle/standalone/apps/web/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  23. package/bundle/standalone/apps/web/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  24. package/bundle/standalone/apps/web/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  25. package/bundle/standalone/apps/web/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  26. package/bundle/standalone/apps/web/.next/server/app/api/auth/setup/route.js.nft.json +1 -1
  27. package/bundle/standalone/apps/web/.next/server/app/api/auth/setup/route_client-reference-manifest.js +1 -1
  28. package/bundle/standalone/apps/web/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  29. package/bundle/standalone/apps/web/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  30. package/bundle/standalone/apps/web/.next/server/app/api/auth/token/route.js.nft.json +1 -1
  31. package/bundle/standalone/apps/web/.next/server/app/api/auth/token/route_client-reference-manifest.js +1 -1
  32. package/bundle/standalone/apps/web/.next/server/app/api/calendar/conflicts/route.js.nft.json +1 -1
  33. package/bundle/standalone/apps/web/.next/server/app/api/calendar/conflicts/route_client-reference-manifest.js +1 -1
  34. package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/[id]/route.js.nft.json +1 -1
  35. package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/[id]/route_client-reference-manifest.js +1 -1
  36. package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/route.js.nft.json +1 -1
  37. package/bundle/standalone/apps/web/.next/server/app/api/calendar/entities/route_client-reference-manifest.js +1 -1
  38. package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/[id]/route.js.nft.json +1 -1
  39. package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/[id]/route_client-reference-manifest.js +1 -1
  40. package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/route.js.nft.json +1 -1
  41. package/bundle/standalone/apps/web/.next/server/app/api/calendar/events/route_client-reference-manifest.js +1 -1
  42. package/bundle/standalone/apps/web/.next/server/app/api/calendar/ics/route.js.nft.json +1 -1
  43. package/bundle/standalone/apps/web/.next/server/app/api/calendar/ics/route_client-reference-manifest.js +1 -1
  44. package/bundle/standalone/apps/web/.next/server/app/api/calendar/links/route.js.nft.json +1 -1
  45. package/bundle/standalone/apps/web/.next/server/app/api/calendar/links/route_client-reference-manifest.js +1 -1
  46. package/bundle/standalone/apps/web/.next/server/app/api/calendar/settings/route.js.nft.json +1 -1
  47. package/bundle/standalone/apps/web/.next/server/app/api/calendar/settings/route_client-reference-manifest.js +1 -1
  48. package/bundle/standalone/apps/web/.next/server/app/api/clip/route.js.nft.json +1 -1
  49. package/bundle/standalone/apps/web/.next/server/app/api/clip/route_client-reference-manifest.js +1 -1
  50. package/bundle/standalone/apps/web/.next/server/app/api/docker-config/route.js.nft.json +1 -1
  51. package/bundle/standalone/apps/web/.next/server/app/api/docker-config/route_client-reference-manifest.js +1 -1
  52. package/bundle/standalone/apps/web/.next/server/app/api/export/zip/route.js.nft.json +1 -1
  53. package/bundle/standalone/apps/web/.next/server/app/api/export/zip/route_client-reference-manifest.js +1 -1
  54. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/backlinks/route.js.nft.json +1 -1
  55. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/backlinks/route_client-reference-manifest.js +1 -1
  56. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/download/route.js.nft.json +1 -1
  57. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/download/route_client-reference-manifest.js +1 -1
  58. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-html/route.js.nft.json +1 -1
  59. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-html/route_client-reference-manifest.js +1 -1
  60. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-pdf/route.js.nft.json +1 -1
  61. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/export-pdf/route_client-reference-manifest.js +1 -1
  62. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/restore/route.js.nft.json +1 -1
  63. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/restore/route_client-reference-manifest.js +1 -1
  64. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/route.js.nft.json +1 -1
  65. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/history/route_client-reference-manifest.js +1 -1
  66. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/move/route.js.nft.json +1 -1
  67. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/move/route_client-reference-manifest.js +1 -1
  68. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/route.js.nft.json +1 -1
  69. package/bundle/standalone/apps/web/.next/server/app/api/files/[id]/route_client-reference-manifest.js +1 -1
  70. package/bundle/standalone/apps/web/.next/server/app/api/files/route.js.nft.json +1 -1
  71. package/bundle/standalone/apps/web/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  72. package/bundle/standalone/apps/web/.next/server/app/api/files/upload/route.js.nft.json +1 -1
  73. package/bundle/standalone/apps/web/.next/server/app/api/files/upload/route_client-reference-manifest.js +1 -1
  74. package/bundle/standalone/apps/web/.next/server/app/api/folders/route.js +1 -1
  75. package/bundle/standalone/apps/web/.next/server/app/api/folders/route.js.nft.json +1 -1
  76. package/bundle/standalone/apps/web/.next/server/app/api/folders/route_client-reference-manifest.js +1 -1
  77. package/bundle/standalone/apps/web/.next/server/app/api/git/remote/route.js.nft.json +1 -1
  78. package/bundle/standalone/apps/web/.next/server/app/api/git/remote/route_client-reference-manifest.js +1 -1
  79. package/bundle/standalone/apps/web/.next/server/app/api/git/sync-all/route.js.nft.json +1 -1
  80. package/bundle/standalone/apps/web/.next/server/app/api/git/sync-all/route_client-reference-manifest.js +1 -1
  81. package/bundle/standalone/apps/web/.next/server/app/api/hands/test-pattern/route.js.nft.json +1 -1
  82. package/bundle/standalone/apps/web/.next/server/app/api/hands/test-pattern/route_client-reference-manifest.js +1 -1
  83. package/bundle/standalone/apps/web/.next/server/app/api/hands/validate/route.js.nft.json +1 -1
  84. package/bundle/standalone/apps/web/.next/server/app/api/hands/validate/route_client-reference-manifest.js +1 -1
  85. package/bundle/standalone/apps/web/.next/server/app/api/health/route.js.nft.json +1 -1
  86. package/bundle/standalone/apps/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  87. package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route.js +1 -1
  88. package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route.js.nft.json +1 -1
  89. package/bundle/standalone/apps/web/.next/server/app/api/install-snippets/route_client-reference-manifest.js +1 -1
  90. package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route.js +1 -1
  91. package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route.js.nft.json +1 -1
  92. package/bundle/standalone/apps/web/.next/server/app/api/mcp-tools/route_client-reference-manifest.js +1 -1
  93. package/bundle/standalone/apps/web/.next/server/app/api/profile/route.js.nft.json +1 -1
  94. package/bundle/standalone/apps/web/.next/server/app/api/profile/route_client-reference-manifest.js +1 -1
  95. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/hands-config/route.js.nft.json +1 -1
  96. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/hands-config/route_client-reference-manifest.js +1 -1
  97. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-config/route.js.nft.json +1 -1
  98. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-config/route_client-reference-manifest.js +1 -1
  99. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-status/route.js.nft.json +1 -1
  100. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/journal-status/route_client-reference-manifest.js +1 -1
  101. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/onboard/route.js.nft.json +1 -1
  102. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/onboard/route_client-reference-manifest.js +1 -1
  103. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/refresh/route.js.nft.json +1 -1
  104. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/refresh/route_client-reference-manifest.js +1 -1
  105. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  106. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
  107. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/sync/route.js.nft.json +1 -1
  108. package/bundle/standalone/apps/web/.next/server/app/api/projects/[id]/sync/route_client-reference-manifest.js +1 -1
  109. package/bundle/standalone/apps/web/.next/server/app/api/projects/onboard/route.js.nft.json +1 -1
  110. package/bundle/standalone/apps/web/.next/server/app/api/projects/onboard/route_client-reference-manifest.js +1 -1
  111. package/bundle/standalone/apps/web/.next/server/app/api/projects/route.js.nft.json +1 -1
  112. package/bundle/standalone/apps/web/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  113. package/bundle/standalone/apps/web/.next/server/app/api/publish/html/route.js.nft.json +1 -1
  114. package/bundle/standalone/apps/web/.next/server/app/api/publish/html/route_client-reference-manifest.js +1 -1
  115. package/bundle/standalone/apps/web/.next/server/app/api/publish/route.js.nft.json +1 -1
  116. package/bundle/standalone/apps/web/.next/server/app/api/publish/route_client-reference-manifest.js +1 -1
  117. package/bundle/standalone/apps/web/.next/server/app/api/refresh/route.js.nft.json +1 -1
  118. package/bundle/standalone/apps/web/.next/server/app/api/refresh/route_client-reference-manifest.js +1 -1
  119. package/bundle/standalone/apps/web/.next/server/app/api/reindex/route.js.nft.json +1 -1
  120. package/bundle/standalone/apps/web/.next/server/app/api/reindex/route_client-reference-manifest.js +1 -1
  121. package/bundle/standalone/apps/web/.next/server/app/api/reports/resources/[name]/route.js.nft.json +1 -1
  122. package/bundle/standalone/apps/web/.next/server/app/api/reports/resources/[name]/route_client-reference-manifest.js +1 -1
  123. package/bundle/standalone/apps/web/.next/server/app/api/search/route.js.nft.json +1 -1
  124. package/bundle/standalone/apps/web/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  125. package/bundle/standalone/apps/web/.next/server/app/api/tags/route.js.nft.json +1 -1
  126. package/bundle/standalone/apps/web/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  127. package/bundle/standalone/apps/web/.next/server/app/api/version-check/route.js.nft.json +1 -1
  128. package/bundle/standalone/apps/web/.next/server/app/api/version-check/route_client-reference-manifest.js +1 -1
  129. package/bundle/standalone/apps/web/.next/server/app/api/welcome/route.js.nft.json +1 -1
  130. package/bundle/standalone/apps/web/.next/server/app/api/welcome/route_client-reference-manifest.js +1 -1
  131. package/bundle/standalone/apps/web/.next/server/app/api/ws-config/route.js.nft.json +1 -1
  132. package/bundle/standalone/apps/web/.next/server/app/api/ws-config/route_client-reference-manifest.js +1 -1
  133. package/bundle/standalone/apps/web/.next/server/app/apple-icon.png/route.js.nft.json +1 -1
  134. package/bundle/standalone/apps/web/.next/server/app/calendar/page.js.nft.json +1 -1
  135. package/bundle/standalone/apps/web/.next/server/app/calendar/page_client-reference-manifest.js +1 -1
  136. package/bundle/standalone/apps/web/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  137. package/bundle/standalone/apps/web/.next/server/app/icon.png/route.js.nft.json +1 -1
  138. package/bundle/standalone/apps/web/.next/server/app/login/page.js.nft.json +1 -1
  139. package/bundle/standalone/apps/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
  140. package/bundle/standalone/apps/web/.next/server/app/page.js +4 -4
  141. package/bundle/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
  142. package/bundle/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  143. package/bundle/standalone/apps/web/.next/server/app/preview/motifs/page.js.nft.json +1 -1
  144. package/bundle/standalone/apps/web/.next/server/app/preview/motifs/page_client-reference-manifest.js +1 -1
  145. package/bundle/standalone/apps/web/.next/server/app/preview/motifs.html +2 -2
  146. package/bundle/standalone/apps/web/.next/server/app/preview/motifs.rsc +1 -1
  147. package/bundle/standalone/apps/web/.next/server/app-paths-manifest.json +10 -10
  148. package/bundle/standalone/apps/web/.next/server/pages/404.html +1 -1
  149. package/bundle/standalone/apps/web/.next/server/pages/500.html +1 -1
  150. package/bundle/standalone/apps/web/.next/server/pages/_app.js.nft.json +1 -1
  151. package/bundle/standalone/apps/web/.next/server/pages/_document.js.nft.json +1 -1
  152. package/bundle/standalone/apps/web/.next/server/pages/_error.js.nft.json +1 -1
  153. package/bundle/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
  154. package/bundle/standalone/apps/web/.next/static/chunks/app/page-86e385abedf10ccd.js +1 -0
  155. package/bundle/standalone/apps/web/package.json +6 -5
  156. package/bundle/standalone/apps/web/server.js +1 -1
  157. package/bundle/standalone/apps/web/src/lib/mcp-tools.json +103 -95
  158. package/bundle/standalone/node_modules/kontexta-mcp/dist/agent-rules/rules-block.md +28 -185
  159. package/bundle/standalone/node_modules/kontexta-mcp/dist/agent-rules/rules-reference.md +207 -0
  160. package/bundle/standalone/node_modules/kontexta-mcp/dist/calendar-tools.js +12 -12
  161. package/bundle/standalone/node_modules/kontexta-mcp/dist/hands/formatter.js +1 -1
  162. package/bundle/standalone/node_modules/kontexta-mcp/dist/hands/schema-doc.js +1 -1
  163. package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js +196 -68
  164. package/bundle/standalone/node_modules/kontexta-mcp/dist/index.js.map +1 -1
  165. package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-capture.js +3 -3
  166. package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-commit-upgrades-tool.js +1 -1
  167. package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-housekeep-tool.js +1 -1
  168. package/bundle/standalone/node_modules/kontexta-mcp/dist/journal-tools.js +2 -2
  169. package/bundle/standalone/node_modules/kontexta-mcp/dist/repo-write-guard.js +1 -1
  170. package/bundle/standalone/node_modules/kontexta-mcp/package.json +4 -2
  171. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.d.ts +5 -0
  172. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.d.ts.map +1 -1
  173. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.js +84 -25
  174. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/index.js.map +1 -1
  175. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/rules-block.md +28 -185
  176. package/bundle/standalone/node_modules/kxta-core/dist/agent-rules/rules-reference.md +207 -0
  177. package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.d.ts +25 -1
  178. package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.d.ts.map +1 -1
  179. package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.js +159 -32
  180. package/bundle/standalone/node_modules/kxta-core/dist/bundle/index.js.map +1 -1
  181. package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.d.ts +71 -0
  182. package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.d.ts.map +1 -0
  183. package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.js +192 -0
  184. package/bundle/standalone/node_modules/kxta-core/dist/decision/engine.js.map +1 -0
  185. package/bundle/standalone/node_modules/kxta-core/dist/decision/index.d.ts +9 -0
  186. package/bundle/standalone/node_modules/kxta-core/dist/decision/index.d.ts.map +1 -0
  187. package/bundle/standalone/node_modules/kxta-core/dist/decision/index.js +10 -0
  188. package/bundle/standalone/node_modules/kxta-core/dist/decision/index.js.map +1 -0
  189. package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.d.ts +20 -0
  190. package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.d.ts.map +1 -0
  191. package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.js +124 -0
  192. package/bundle/standalone/node_modules/kxta-core/dist/decision/intent-router.js.map +1 -0
  193. package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.d.ts +20 -0
  194. package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.d.ts.map +1 -0
  195. package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.js +28 -0
  196. package/bundle/standalone/node_modules/kxta-core/dist/decision/pruning.js.map +1 -0
  197. package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.d.ts +30 -0
  198. package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.d.ts.map +1 -0
  199. package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.js +57 -0
  200. package/bundle/standalone/node_modules/kxta-core/dist/decision/sufficiency.js.map +1 -0
  201. package/bundle/standalone/node_modules/kxta-core/dist/decision/types.d.ts +42 -0
  202. package/bundle/standalone/node_modules/kxta-core/dist/decision/types.d.ts.map +1 -0
  203. package/bundle/standalone/node_modules/kxta-core/dist/decision/types.js +7 -0
  204. package/bundle/standalone/node_modules/kxta-core/dist/decision/types.js.map +1 -0
  205. package/bundle/standalone/node_modules/kxta-core/dist/files/index.d.ts +3 -1
  206. package/bundle/standalone/node_modules/kxta-core/dist/files/index.d.ts.map +1 -1
  207. package/bundle/standalone/node_modules/kxta-core/dist/files/index.js +10 -1
  208. package/bundle/standalone/node_modules/kxta-core/dist/files/index.js.map +1 -1
  209. package/bundle/standalone/node_modules/kxta-core/dist/hooks/alerts.js +2 -2
  210. package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts +4 -1
  211. package/bundle/standalone/node_modules/kxta-core/dist/index.d.ts.map +1 -1
  212. package/bundle/standalone/node_modules/kxta-core/dist/index.js +4 -1
  213. package/bundle/standalone/node_modules/kxta-core/dist/index.js.map +1 -1
  214. package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.d.ts +3 -0
  215. package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.d.ts.map +1 -0
  216. package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.js +27 -0
  217. package/bundle/standalone/node_modules/kxta-core/dist/inference/bundled.js.map +1 -0
  218. package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.d.ts +41 -0
  219. package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.d.ts.map +1 -0
  220. package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.js +140 -0
  221. package/bundle/standalone/node_modules/kxta-core/dist/inference/cache-manager.js.map +1 -0
  222. package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.d.ts +7 -0
  223. package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.d.ts.map +1 -0
  224. package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.js +39 -0
  225. package/bundle/standalone/node_modules/kxta-core/dist/inference/embeddings.js.map +1 -0
  226. package/bundle/standalone/node_modules/kxta-core/dist/inference/index.d.ts +16 -0
  227. package/bundle/standalone/node_modules/kxta-core/dist/inference/index.d.ts.map +1 -0
  228. package/bundle/standalone/node_modules/kxta-core/dist/inference/index.js +17 -0
  229. package/bundle/standalone/node_modules/kxta-core/dist/inference/index.js.map +1 -0
  230. package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.d.ts +132 -0
  231. package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.d.ts.map +1 -0
  232. package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.js +312 -0
  233. package/bundle/standalone/node_modules/kxta-core/dist/inference/runtime.js.map +1 -0
  234. package/bundle/standalone/node_modules/kxta-core/dist/inference/types.d.ts +55 -0
  235. package/bundle/standalone/node_modules/kxta-core/dist/inference/types.d.ts.map +1 -0
  236. package/bundle/standalone/node_modules/kxta-core/dist/inference/types.js +6 -0
  237. package/bundle/standalone/node_modules/kxta-core/dist/inference/types.js.map +1 -0
  238. package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.d.ts +6 -0
  239. package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.d.ts.map +1 -1
  240. package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.js +50 -7
  241. package/bundle/standalone/node_modules/kxta-core/dist/journal/distill.js.map +1 -1
  242. package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.d.ts +12 -0
  243. package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.d.ts.map +1 -0
  244. package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.js +190 -0
  245. package/bundle/standalone/node_modules/kxta-core/dist/journal/event-triage.js.map +1 -0
  246. package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.d.ts +2 -0
  247. package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.d.ts.map +1 -1
  248. package/bundle/standalone/node_modules/kxta-core/dist/journal/high-water.js.map +1 -1
  249. package/bundle/standalone/node_modules/kxta-core/dist/journal/index.d.ts +5 -0
  250. package/bundle/standalone/node_modules/kxta-core/dist/journal/index.d.ts.map +1 -1
  251. package/bundle/standalone/node_modules/kxta-core/dist/journal/index.js +3 -0
  252. package/bundle/standalone/node_modules/kxta-core/dist/journal/index.js.map +1 -1
  253. package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.d.ts +10 -0
  254. package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.d.ts.map +1 -0
  255. package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.js +22 -0
  256. package/bundle/standalone/node_modules/kxta-core/dist/journal/intelligence-config.js.map +1 -0
  257. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/refactor.js +2 -2
  258. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/refactor.js.map +1 -1
  259. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.d.ts.map +1 -1
  260. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.js +5 -0
  261. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tagging-pass.js.map +1 -1
  262. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.d.ts.map +1 -1
  263. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.js +30 -5
  264. package/bundle/standalone/node_modules/kxta-core/dist/journal/patterns/tool-classes.js.map +1 -1
  265. package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.d.ts +21 -0
  266. package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.d.ts.map +1 -0
  267. package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.js +90 -0
  268. package/bundle/standalone/node_modules/kxta-core/dist/journal/pivot.js.map +1 -0
  269. package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.d.ts +2 -0
  270. package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.d.ts.map +1 -1
  271. package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.js +17 -5
  272. package/bundle/standalone/node_modules/kxta-core/dist/journal/renderer.js.map +1 -1
  273. package/bundle/standalone/node_modules/kxta-core/dist/journal/strict-mode.js +2 -2
  274. package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.d.ts +17 -0
  275. package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.d.ts.map +1 -1
  276. package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.js +77 -9
  277. package/bundle/standalone/node_modules/kxta-core/dist/journal/topic-detector.js.map +1 -1
  278. package/bundle/standalone/node_modules/kxta-core/dist/journal/types.d.ts +1 -0
  279. package/bundle/standalone/node_modules/kxta-core/dist/journal/types.d.ts.map +1 -1
  280. package/bundle/standalone/node_modules/kxta-core/dist/mcp-install/tools.generated.js +58 -58
  281. package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.d.ts.map +1 -1
  282. package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.js +10 -1
  283. package/bundle/standalone/node_modules/kxta-core/dist/metadata/index.js.map +1 -1
  284. package/bundle/standalone/node_modules/kxta-core/dist/project-map/index.js +1 -1
  285. package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.d.ts +29 -0
  286. package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.d.ts.map +1 -0
  287. package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.js +68 -0
  288. package/bundle/standalone/node_modules/kxta-core/dist/rerank/arbitrator.js.map +1 -0
  289. package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.d.ts +57 -0
  290. package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.d.ts.map +1 -0
  291. package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.js +199 -0
  292. package/bundle/standalone/node_modules/kxta-core/dist/rerank/engine.js.map +1 -0
  293. package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.d.ts +7 -0
  294. package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.d.ts.map +1 -0
  295. package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.js +8 -0
  296. package/bundle/standalone/node_modules/kxta-core/dist/rerank/index.js.map +1 -0
  297. package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.d.ts +50 -0
  298. package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.d.ts.map +1 -0
  299. package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.js +2 -0
  300. package/bundle/standalone/node_modules/kxta-core/dist/rerank/types.js.map +1 -0
  301. package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts +5 -0
  302. package/bundle/standalone/node_modules/kxta-core/dist/types.d.ts.map +1 -1
  303. package/bundle/standalone/node_modules/kxta-core/dist/util/paths.js +1 -1
  304. package/bundle/standalone/node_modules/kxta-core/package.json +4 -2
  305. package/bundle/standalone/node_modules/kxta-publish/package.json +3 -3
  306. package/bundle/standalone/package.json +3 -2
  307. package/package.json +5 -3
  308. package/bundle/standalone/apps/web/.next/static/chunks/app/page-df34c386b7c150bb.js +0 -1
  309. /package/bundle/standalone/apps/web/.next/static/{yyj-uK2RH8Rffeq9wVzjU → 0ZL7PJwYf_7ZTTXE_AM0S}/_buildManifest.js +0 -0
  310. /package/bundle/standalone/apps/web/.next/static/{yyj-uK2RH8Rffeq9wVzjU → 0ZL7PJwYf_7ZTTXE_AM0S}/_ssgManifest.js +0 -0
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Inference Runtime — singleton manager for ONNX model lifecycles.
3
+ *
4
+ * Responsibilities:
5
+ * 1. Initialize @huggingface/transformers environment variables
6
+ * 2. Select execution device (auto-detect CPU vs GPU)
7
+ * 3. Lazy-load models on first inference call
8
+ * 4. Handle graceful teardown via beforeExit hooks
9
+ */
10
+ import type { ModelRuntimeConfig, ModelSessionStatus, ExecutionDevice } from "./types.js";
11
+ /**
12
+ * Runtime state for a single loaded model.
13
+ */
14
+ export interface ModelSession {
15
+ config: ModelRuntimeConfig;
16
+ device: string;
17
+ /** Cache directory the model was resolved from. */
18
+ cacheDir: string;
19
+ loadedAt: number;
20
+ memoryRssBytes: number;
21
+ /** Lazy-loaded model instance (ONNX runtime object, tokenizer/model pair, or transformers pipeline). */
22
+ instance: unknown;
23
+ }
24
+ /**
25
+ * Set (or clear) the configured execution device.
26
+ */
27
+ export declare function setInferenceDevice(device: ExecutionDevice | null): void;
28
+ /**
29
+ * Get the configured execution device, if any.
30
+ */
31
+ export declare function getInferenceDevice(): ExecutionDevice | null;
32
+ declare class InferenceRuntime {
33
+ private static _instance;
34
+ private _sessions;
35
+ private _initialized;
36
+ private _teardownRegistered;
37
+ /**
38
+ * Get the singleton instance.
39
+ */
40
+ static get instance(): InferenceRuntime;
41
+ private constructor();
42
+ /**
43
+ * Initialize the inference runtime.
44
+ * Sets up transformers environment variables and device selection.
45
+ */
46
+ initialize(): void;
47
+ /**
48
+ * Detect the best available execution device.
49
+ * Returns the configured device (from `system1.device`) when set, otherwise
50
+ * defaults to "cpu" — GPU detection can be added later.
51
+ */
52
+ detectDevice(): ExecutionDevice;
53
+ /**
54
+ * Resolve the final device for a model config.
55
+ * Merges user-specified device with auto-detection.
56
+ */
57
+ resolveDevice(config: ModelRuntimeConfig): string;
58
+ /**
59
+ * Get or lazily load a model session.
60
+ *
61
+ * @param config - Model configuration
62
+ * @returns The loaded model session
63
+ */
64
+ getModelSession(config: ModelRuntimeConfig): Promise<ModelSession>;
65
+ /**
66
+ * Load a specific model instance based on config.
67
+ * Handles different model types (cross-encoder, classifier, etc.).
68
+ */
69
+ private loadModel;
70
+ /**
71
+ * Get the current RSS memory usage of this Node.js process.
72
+ */
73
+ private getProcessMemoryRss;
74
+ /**
75
+ * Get the status of a loaded model.
76
+ */
77
+ getModelStatus(modelId: string): ModelSessionStatus | null;
78
+ /**
79
+ * Check if a specific model is loaded and available.
80
+ */
81
+ isModelLoaded(modelId: string): boolean;
82
+ /**
83
+ * Get all loaded model statuses.
84
+ */
85
+ getAllModelStatuses(): ModelSessionStatus[];
86
+ /**
87
+ * Get the number of currently loaded models.
88
+ */
89
+ get loadedCount(): number;
90
+ /**
91
+ * Shutdown and clean up all model sessions.
92
+ */
93
+ shutdown(): void;
94
+ /**
95
+ * Clear a specific model from cache (force reload next time).
96
+ */
97
+ clearModelCache(modelId: string): void;
98
+ /**
99
+ * Clear all model sessions (useful for testing or hot-reload).
100
+ */
101
+ clearAllSessions(): void;
102
+ }
103
+ /**
104
+ * Export singleton instance for use throughout the codebase.
105
+ */
106
+ export declare const inferenceRuntime: InferenceRuntime;
107
+ /**
108
+ * Convenience function to get a model session.
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const session = await getModel("Xenova/ms-marco-MiniLM-L-6-v2");
113
+ * if (session.instance) {
114
+ * // Use the model
115
+ * }
116
+ * ```
117
+ */
118
+ export declare function getModel(config: ModelRuntimeConfig): Promise<ModelSession>;
119
+ /**
120
+ * Check if a model is loaded.
121
+ */
122
+ export declare function isLoaded(modelId: string): boolean;
123
+ /**
124
+ * Get model status.
125
+ */
126
+ export declare function getStatus(modelId: string): ModelSessionStatus | null;
127
+ /**
128
+ * Get all model statuses.
129
+ */
130
+ export declare function getAllStatuses(): ModelSessionStatus[];
131
+ export {};
132
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/inference/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI1F;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,E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OAEG;IACH,gBAAgB,IAAI,IAAI;CAGzB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,kBAA4B,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAEhF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAEpE;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,kBAAkB,EAAE,CAErD"}
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Inference Runtime — singleton manager for ONNX model lifecycles.
3
+ *
4
+ * Responsibilities:
5
+ * 1. Initialize @huggingface/transformers environment variables
6
+ * 2. Select execution device (auto-detect CPU vs GPU)
7
+ * 3. Lazy-load models on first inference call
8
+ * 4. Handle graceful teardown via beforeExit hooks
9
+ */
10
+ import { getModelCacheDir, invalidateModelCache } from "./cache-manager.js";
11
+ import { resolveBundledModelsDir } from "./bundled.js";
12
+ /**
13
+ * Default timeout for inference operations (milliseconds).
14
+ */
15
+ const DEFAULT_TIMEOUT_MS = 300;
16
+ /**
17
+ * Default device when user specifies "auto".
18
+ */
19
+ const DEFAULT_AUTO_DEVICE = "cpu";
20
+ /**
21
+ * Configured execution device (from `system1.device` in kontexta.json).
22
+ * When set to a concrete device it is used directly; "auto" falls through to
23
+ * detection.
24
+ */
25
+ let _configuredDevice = null;
26
+ /**
27
+ * Set (or clear) the configured execution device.
28
+ */
29
+ export function setInferenceDevice(device) {
30
+ _configuredDevice = device && device !== "auto" ? device : null;
31
+ }
32
+ /**
33
+ * Get the configured execution device, if any.
34
+ */
35
+ export function getInferenceDevice() {
36
+ return _configuredDevice;
37
+ }
38
+ class InferenceRuntime {
39
+ static _instance = null;
40
+ _sessions = new Map();
41
+ _initialized = false;
42
+ _teardownRegistered = false;
43
+ /**
44
+ * Get the singleton instance.
45
+ */
46
+ static get instance() {
47
+ if (!InferenceRuntime._instance) {
48
+ InferenceRuntime._instance = new InferenceRuntime();
49
+ }
50
+ return InferenceRuntime._instance;
51
+ }
52
+ constructor() {
53
+ // Initialize transformers environment on first access
54
+ if (!this._initialized) {
55
+ this.initialize();
56
+ }
57
+ }
58
+ /**
59
+ * Initialize the inference runtime.
60
+ * Sets up transformers environment variables and device selection.
61
+ */
62
+ initialize() {
63
+ if (this._initialized)
64
+ return;
65
+ // Configure @huggingface/transformers to use our cache directory
66
+ const cacheDir = getModelCacheDir();
67
+ // These environment variables control the HF transformers library behavior
68
+ if (!process.env.HF_HOME) {
69
+ process.env.HF_HOME = cacheDir;
70
+ }
71
+ if (!process.env.TRANSFORMERS_CACHE) {
72
+ process.env.TRANSFORMERS_CACHE = cacheDir;
73
+ }
74
+ if (!process.env.HUGGINGFACE_HUB_CACHE) {
75
+ process.env.HUGGINGFACE_HUB_CACHE = cacheDir;
76
+ }
77
+ // Disable remote model downloads telemetry
78
+ process.env.HF_HUB_DISABLE_TELEMETRY = "1";
79
+ this._initialized = true;
80
+ // Register teardown hook if not already done
81
+ if (!this._teardownRegistered) {
82
+ this._teardownRegistered = true;
83
+ process.on("beforeExit", () => this.shutdown());
84
+ }
85
+ }
86
+ /**
87
+ * Detect the best available execution device.
88
+ * Returns the configured device (from `system1.device`) when set, otherwise
89
+ * defaults to "cpu" — GPU detection can be added later.
90
+ */
91
+ detectDevice() {
92
+ return _configuredDevice ?? DEFAULT_AUTO_DEVICE;
93
+ }
94
+ /**
95
+ * Resolve the final device for a model config.
96
+ * Merges user-specified device with auto-detection.
97
+ */
98
+ resolveDevice(config) {
99
+ const device = config.device ?? "auto";
100
+ if (device === "auto") {
101
+ return this.detectDevice();
102
+ }
103
+ return device;
104
+ }
105
+ /**
106
+ * Get or lazily load a model session.
107
+ *
108
+ * @param config - Model configuration
109
+ * @returns The loaded model session
110
+ */
111
+ async getModelSession(config) {
112
+ // Return cached session if available
113
+ const existing = this._sessions.get(config.modelId);
114
+ if (existing)
115
+ return existing;
116
+ const device = this.resolveDevice(config);
117
+ const cacheDir = config.cacheDir ?? getModelCacheDir();
118
+ const startTime = Date.now();
119
+ const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
120
+ try {
121
+ const modelInstance = await this.loadModel(config, device);
122
+ const loadDuration = Date.now() - startTime;
123
+ const memoryRss = this.getProcessMemoryRss();
124
+ const session = {
125
+ config,
126
+ device,
127
+ cacheDir,
128
+ loadedAt: startTime,
129
+ memoryRssBytes: memoryRss,
130
+ instance: modelInstance,
131
+ };
132
+ this._sessions.set(config.modelId, session);
133
+ return session;
134
+ }
135
+ catch (error) {
136
+ // If model fails to load (missing, corrupt, etc.), do NOT throw.
137
+ // Return a null session to signal the caller to fall back to heuristics.
138
+ console.warn(`[InferenceRuntime] Failed to load model ${config.modelId}: ${error instanceof Error ? error.message : String(error)}`);
139
+ const failedSession = {
140
+ config,
141
+ device,
142
+ cacheDir,
143
+ loadedAt: startTime,
144
+ memoryRssBytes: 0,
145
+ instance: null,
146
+ };
147
+ this._sessions.set(config.modelId, failedSession);
148
+ return failedSession;
149
+ }
150
+ }
151
+ /**
152
+ * Load a specific model instance based on config.
153
+ * Handles different model types (cross-encoder, classifier, etc.).
154
+ */
155
+ async loadModel(config, device) {
156
+ const { AutoTokenizer, AutoModelForSequenceClassification, pipeline, env } = await import("@huggingface/transformers");
157
+ env.cacheDir = config.cacheDir ?? getModelCacheDir();
158
+ env.allowLocalModels = true;
159
+ const bundled = resolveBundledModelsDir(config.modelId);
160
+ if (bundled) {
161
+ env.localModelPath = bundled;
162
+ env.allowRemoteModels = false;
163
+ }
164
+ else {
165
+ env.allowRemoteModels = true;
166
+ }
167
+ // Set device preference for transformers
168
+ if (device === "cpu" && env.backends?.onnx?.wasm) {
169
+ env.backends.onnx.wasm.numThreads = 1; // Avoid CPU starvation
170
+ }
171
+ // Sequence classification / cross-encoder model
172
+ if (config.modelId.includes("ms-marco") ||
173
+ config.modelId.includes("rerank") ||
174
+ config.subfolder === "cross-encoder") {
175
+ const tokenizer = await AutoTokenizer.from_pretrained(config.modelId);
176
+ const model = await AutoModelForSequenceClassification.from_pretrained(config.modelId);
177
+ return { tokenizer, model, type: "cross-encoder" };
178
+ }
179
+ // Default pipeline fallback
180
+ const modelInstance = await pipeline("feature-extraction", config.modelId, {
181
+ progress_callback: () => { },
182
+ ...(config.dtype ? { dtype: config.dtype } : {}),
183
+ });
184
+ return modelInstance;
185
+ }
186
+ /**
187
+ * Get the current RSS memory usage of this Node.js process.
188
+ */
189
+ getProcessMemoryRss() {
190
+ try {
191
+ if (process.memoryUsage) {
192
+ return process.memoryUsage().rss;
193
+ }
194
+ }
195
+ catch {
196
+ // Fallback if memoryUsage is unavailable (unlikely in Node.js)
197
+ }
198
+ return 0;
199
+ }
200
+ /**
201
+ * Get the status of a loaded model.
202
+ */
203
+ getModelStatus(modelId) {
204
+ const session = this._sessions.get(modelId);
205
+ if (!session)
206
+ return null;
207
+ return {
208
+ modelId,
209
+ loaded: session.instance !== null,
210
+ device: session.device,
211
+ memoryRssBytes: session.memoryRssBytes,
212
+ loadDurationMs: Date.now() - session.loadedAt,
213
+ cacheDir: session.cacheDir,
214
+ };
215
+ }
216
+ /**
217
+ * Check if a specific model is loaded and available.
218
+ */
219
+ isModelLoaded(modelId) {
220
+ const session = this._sessions.get(modelId);
221
+ return session !== undefined && session.instance !== null && session.instance !== undefined;
222
+ }
223
+ /**
224
+ * Get all loaded model statuses.
225
+ */
226
+ getAllModelStatuses() {
227
+ const statuses = [];
228
+ for (const [modelId] of this._sessions) {
229
+ const status = this.getModelStatus(modelId);
230
+ if (status)
231
+ statuses.push(status);
232
+ }
233
+ return statuses;
234
+ }
235
+ /**
236
+ * Get the number of currently loaded models.
237
+ */
238
+ get loadedCount() {
239
+ return this._sessions.size;
240
+ }
241
+ /**
242
+ * Shutdown and clean up all model sessions.
243
+ */
244
+ shutdown() {
245
+ for (const [modelId, session] of this._sessions) {
246
+ try {
247
+ // Attempt to dispose model resources
248
+ if (session.instance && typeof session.instance === "object" && "dispose" in session.instance) {
249
+ const disposeFn = session.instance.dispose;
250
+ if (typeof disposeFn === "function") {
251
+ disposeFn();
252
+ }
253
+ }
254
+ }
255
+ catch {
256
+ // Best-effort cleanup — don't throw during shutdown
257
+ }
258
+ }
259
+ this._sessions.clear();
260
+ this._initialized = false;
261
+ }
262
+ /**
263
+ * Clear a specific model from cache (force reload next time).
264
+ */
265
+ clearModelCache(modelId) {
266
+ this._sessions.delete(modelId);
267
+ invalidateModelCache(modelId);
268
+ }
269
+ /**
270
+ * Clear all model sessions (useful for testing or hot-reload).
271
+ */
272
+ clearAllSessions() {
273
+ this.shutdown();
274
+ }
275
+ }
276
+ /**
277
+ * Export singleton instance for use throughout the codebase.
278
+ */
279
+ export const inferenceRuntime = InferenceRuntime.instance;
280
+ /**
281
+ * Convenience function to get a model session.
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * const session = await getModel("Xenova/ms-marco-MiniLM-L-6-v2");
286
+ * if (session.instance) {
287
+ * // Use the model
288
+ * }
289
+ * ```
290
+ */
291
+ export async function getModel(config) {
292
+ return InferenceRuntime.instance.getModelSession(config);
293
+ }
294
+ /**
295
+ * Check if a model is loaded.
296
+ */
297
+ export function isLoaded(modelId) {
298
+ return InferenceRuntime.instance.isModelLoaded(modelId);
299
+ }
300
+ /**
301
+ * Get model status.
302
+ */
303
+ export function getStatus(modelId) {
304
+ return InferenceRuntime.instance.getModelStatus(modelId);
305
+ }
306
+ /**
307
+ * Get all model statuses.
308
+ */
309
+ export function getAllStatuses() {
310
+ return InferenceRuntime.instance.getAllModelStatuses();
311
+ }
312
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/inference/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,g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AAM,gBAAgB,GAAG,gBAAgB,CAAC,QAAQ,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAA0B;IACvD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,gBAAgB,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Type definitions for the System 1 local inference substrate.
3
+ * Supports cross-encoder reranking (Tier 1) and multi-head decision models (Tier 2).
4
+ */
5
+ /** Execution target for ONNX model inference. */
6
+ export type ExecutionDevice = "cpu" | "gpu" | "auto" | "wasm";
7
+ /**
8
+ * Configuration for loading a single ONNX model from HuggingFace.
9
+ */
10
+ export interface ModelRuntimeConfig {
11
+ /** HuggingFace model identifier, e.g. "Xenova/ms-marco-MiniLM-L-6-v2". */
12
+ modelId: string;
13
+ /** Optional subfolder within the repo (rarely needed). */
14
+ subfolder?: string;
15
+ /** Target execution device. Default: "auto". */
16
+ device?: ExecutionDevice;
17
+ /** ONNX weight precision for feature-extraction models; "q8" loads onnx/model_quantized.onnx. Default: the repo's full-precision model.onnx. */
18
+ dtype?: "fp32" | "q8";
19
+ /** Hard timeout in ms for a single inference call. Default: 300. */
20
+ timeoutMs?: number;
21
+ /**
22
+ * Optional cache directory override. Falls back to global cache manager
23
+ * resolution when omitted.
24
+ */
25
+ cacheDir?: string;
26
+ }
27
+ /**
28
+ * Status snapshot of a loaded model session.
29
+ */
30
+ export interface ModelSessionStatus {
31
+ modelId: string;
32
+ loaded: boolean;
33
+ device: string;
34
+ memoryRssBytes: number;
35
+ loadDurationMs: number;
36
+ /** Directory where the model's ONNX weights are cached. */
37
+ cacheDir?: string;
38
+ }
39
+ /**
40
+ * Tier classification for model usage.
41
+ * Tier 1: Fast pairwise reranker (cross-encoder).
42
+ * Tier 2: Multi-head decision engine (classifier).
43
+ */
44
+ export type ModelTier = "tier1-reranker" | "tier2-decision";
45
+ /**
46
+ * Registry entry mapping a logical model name to its runtime config and tier.
47
+ */
48
+ export interface ModelRegistryEntry {
49
+ name: string;
50
+ config: ModelRuntimeConfig;
51
+ tier: ModelTier;
52
+ /** Whether this model is required for core functionality. Default: false. */
53
+ required?: boolean;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/inference/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,gJAAgJ;IAChJ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Type definitions for the System 1 local inference substrate.
3
+ * Supports cross-encoder reranking (Tier 1) and multi-head decision models (Tier 2).
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/inference/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,5 +1,7 @@
1
1
  import type { DistillResult } from "./types.js";
2
2
  import type { ExtraPatternDef } from "./patterns/extra-loader.js";
3
+ import { type JournalIntelligence } from "./intelligence-config.js";
4
+ import type { EmbedFn } from "../inference/embeddings.js";
3
5
  export interface DistillJournalOpts {
4
6
  projectSlug: string;
5
7
  projectId: number;
@@ -16,6 +18,10 @@ export interface DistillJournalOpts {
16
18
  since: string;
17
19
  until: string;
18
20
  };
21
+ /** Overrides journal.distillation.decision_engine from kontexta.json. */
22
+ intelligence?: JournalIntelligence;
23
+ /** Embedding function for topic-pivot detection; tests inject a fake. */
24
+ embed?: EmbedFn;
19
25
  }
20
26
  export declare function distillJournal(opts: DistillJournalOpts): Promise<DistillResult>;
21
27
  //# sourceMappingURL=distill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"distill.d.ts","sourceRoot":"","sources":["../../src/journal/distill.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,aAAa,EAAsB,MAAM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