@oscharko-dev/keiko-server 0.2.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 (509) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/assistant-response.d.ts +6 -0
  3. package/dist/assistant-response.d.ts.map +1 -0
  4. package/dist/assistant-response.js +12 -0
  5. package/dist/browser.d.ts +11 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +245 -0
  8. package/dist/chat-handlers.d.ts +48 -0
  9. package/dist/chat-handlers.d.ts.map +1 -0
  10. package/dist/chat-handlers.js +821 -0
  11. package/dist/chat-stream-handlers.d.ts +4 -0
  12. package/dist/chat-stream-handlers.d.ts.map +1 -0
  13. package/dist/chat-stream-handlers.js +136 -0
  14. package/dist/conversation-prompt.d.ts +8 -0
  15. package/dist/conversation-prompt.d.ts.map +1 -0
  16. package/dist/conversation-prompt.js +36 -0
  17. package/dist/conversation-validation.d.ts +26 -0
  18. package/dist/conversation-validation.d.ts.map +1 -0
  19. package/dist/conversation-validation.js +125 -0
  20. package/dist/credentialPersistence.d.ts +23 -0
  21. package/dist/credentialPersistence.d.ts.map +1 -0
  22. package/dist/credentialPersistence.js +93 -0
  23. package/dist/credentialVault.d.ts +30 -0
  24. package/dist/credentialVault.d.ts.map +1 -0
  25. package/dist/credentialVault.js +206 -0
  26. package/dist/csp.d.ts +3 -0
  27. package/dist/csp.d.ts.map +1 -0
  28. package/dist/csp.js +75 -0
  29. package/dist/deps.d.ts +78 -0
  30. package/dist/deps.d.ts.map +1 -0
  31. package/dist/deps.js +457 -0
  32. package/dist/editor/agentRoutes.d.ts +7 -0
  33. package/dist/editor/agentRoutes.d.ts.map +1 -0
  34. package/dist/editor/agentRoutes.js +197 -0
  35. package/dist/editor/assuredGateRunner.d.ts +36 -0
  36. package/dist/editor/assuredGateRunner.d.ts.map +1 -0
  37. package/dist/editor/assuredGateRunner.js +100 -0
  38. package/dist/editor/assuredPreFilter.d.ts +34 -0
  39. package/dist/editor/assuredPreFilter.d.ts.map +1 -0
  40. package/dist/editor/assuredPreFilter.js +134 -0
  41. package/dist/editor/assuredPreFilterRunner.d.ts +31 -0
  42. package/dist/editor/assuredPreFilterRunner.d.ts.map +1 -0
  43. package/dist/editor/assuredPreFilterRunner.js +312 -0
  44. package/dist/editor/builtinLanguageProviders.d.ts +6 -0
  45. package/dist/editor/builtinLanguageProviders.d.ts.map +1 -0
  46. package/dist/editor/builtinLanguageProviders.js +221 -0
  47. package/dist/editor/codingContext.d.ts +12 -0
  48. package/dist/editor/codingContext.d.ts.map +1 -0
  49. package/dist/editor/codingContext.js +121 -0
  50. package/dist/editor/codingContextEvidence.d.ts +7 -0
  51. package/dist/editor/codingContextEvidence.d.ts.map +1 -0
  52. package/dist/editor/codingContextEvidence.js +52 -0
  53. package/dist/editor/codingContextProviders.d.ts +36 -0
  54. package/dist/editor/codingContextProviders.d.ts.map +1 -0
  55. package/dist/editor/codingContextProviders.js +348 -0
  56. package/dist/editor/completionModelEvidence.d.ts +16 -0
  57. package/dist/editor/completionModelEvidence.d.ts.map +1 -0
  58. package/dist/editor/completionModelEvidence.js +50 -0
  59. package/dist/editor/completionRoutes.d.ts +37 -0
  60. package/dist/editor/completionRoutes.d.ts.map +1 -0
  61. package/dist/editor/completionRoutes.js +411 -0
  62. package/dist/editor/contextRoutes.d.ts +6 -0
  63. package/dist/editor/contextRoutes.d.ts.map +1 -0
  64. package/dist/editor/contextRoutes.js +411 -0
  65. package/dist/editor/disposableAssuredExecution.d.ts +22 -0
  66. package/dist/editor/disposableAssuredExecution.d.ts.map +1 -0
  67. package/dist/editor/disposableAssuredExecution.js +57 -0
  68. package/dist/editor/editorCompletionModel.d.ts +47 -0
  69. package/dist/editor/editorCompletionModel.d.ts.map +1 -0
  70. package/dist/editor/editorCompletionModel.js +156 -0
  71. package/dist/editor/editorInlineCompletionModel.d.ts +34 -0
  72. package/dist/editor/editorInlineCompletionModel.d.ts.map +1 -0
  73. package/dist/editor/editorInlineCompletionModel.js +112 -0
  74. package/dist/editor/editorModelTokenBudget.d.ts +46 -0
  75. package/dist/editor/editorModelTokenBudget.d.ts.map +1 -0
  76. package/dist/editor/editorModelTokenBudget.js +121 -0
  77. package/dist/editor/inlineCompletionRateLimiter.d.ts +19 -0
  78. package/dist/editor/inlineCompletionRateLimiter.d.ts.map +1 -0
  79. package/dist/editor/inlineCompletionRateLimiter.js +46 -0
  80. package/dist/editor/inlineCompletionRoutes.d.ts +26 -0
  81. package/dist/editor/inlineCompletionRoutes.d.ts.map +1 -0
  82. package/dist/editor/inlineCompletionRoutes.js +404 -0
  83. package/dist/editor/inlineCompletionTelemetryEvidence.d.ts +5 -0
  84. package/dist/editor/inlineCompletionTelemetryEvidence.d.ts.map +1 -0
  85. package/dist/editor/inlineCompletionTelemetryEvidence.js +42 -0
  86. package/dist/editor/languageCancellation.d.ts +19 -0
  87. package/dist/editor/languageCancellation.d.ts.map +1 -0
  88. package/dist/editor/languageCancellation.js +48 -0
  89. package/dist/editor/languageProvider.d.ts +39 -0
  90. package/dist/editor/languageProvider.d.ts.map +1 -0
  91. package/dist/editor/languageProvider.js +11 -0
  92. package/dist/editor/languageRoutes.d.ts +15 -0
  93. package/dist/editor/languageRoutes.d.ts.map +1 -0
  94. package/dist/editor/languageRoutes.js +106 -0
  95. package/dist/editor/languageSanitize.d.ts +8 -0
  96. package/dist/editor/languageSanitize.d.ts.map +1 -0
  97. package/dist/editor/languageSanitize.js +101 -0
  98. package/dist/editor/languageService.d.ts +36 -0
  99. package/dist/editor/languageService.d.ts.map +1 -0
  100. package/dist/editor/languageService.js +93 -0
  101. package/dist/editor/languageServiceHost.d.ts +14 -0
  102. package/dist/editor/languageServiceHost.d.ts.map +1 -0
  103. package/dist/editor/languageServiceHost.js +242 -0
  104. package/dist/editor/localKnowledgeRetrieval.d.ts +21 -0
  105. package/dist/editor/localKnowledgeRetrieval.d.ts.map +1 -0
  106. package/dist/editor/localKnowledgeRetrieval.js +44 -0
  107. package/dist/editor/patchApplyEvidence.d.ts +21 -0
  108. package/dist/editor/patchApplyEvidence.d.ts.map +1 -0
  109. package/dist/editor/patchApplyEvidence.js +87 -0
  110. package/dist/editor/patchApplyRoutes.d.ts +16 -0
  111. package/dist/editor/patchApplyRoutes.d.ts.map +1 -0
  112. package/dist/editor/patchApplyRoutes.js +307 -0
  113. package/dist/editor/postApplyVerification.d.ts +42 -0
  114. package/dist/editor/postApplyVerification.d.ts.map +1 -0
  115. package/dist/editor/postApplyVerification.js +177 -0
  116. package/dist/editor/testGenerationEvidence.d.ts +6 -0
  117. package/dist/editor/testGenerationEvidence.d.ts.map +1 -0
  118. package/dist/editor/testGenerationEvidence.js +72 -0
  119. package/dist/editor/testGenerationPatch.d.ts +10 -0
  120. package/dist/editor/testGenerationPatch.d.ts.map +1 -0
  121. package/dist/editor/testGenerationPatch.js +66 -0
  122. package/dist/editor/testGenerationRoutes.d.ts +21 -0
  123. package/dist/editor/testGenerationRoutes.d.ts.map +1 -0
  124. package/dist/editor/testGenerationRoutes.js +254 -0
  125. package/dist/editor/testGenerationRunner.d.ts +23 -0
  126. package/dist/editor/testGenerationRunner.d.ts.map +1 -0
  127. package/dist/editor/testGenerationRunner.js +120 -0
  128. package/dist/editor/textOffsets.d.ts +6 -0
  129. package/dist/editor/textOffsets.d.ts.map +1 -0
  130. package/dist/editor/textOffsets.js +82 -0
  131. package/dist/editor/typescriptLanguageProvider.d.ts +3 -0
  132. package/dist/editor/typescriptLanguageProvider.d.ts.map +1 -0
  133. package/dist/editor/typescriptLanguageProvider.js +217 -0
  134. package/dist/evidence.d.ts +28 -0
  135. package/dist/evidence.d.ts.map +1 -0
  136. package/dist/evidence.js +145 -0
  137. package/dist/files-deny.d.ts +3 -0
  138. package/dist/files-deny.d.ts.map +1 -0
  139. package/dist/files-deny.js +12 -0
  140. package/dist/files.d.ts +97 -0
  141. package/dist/files.d.ts.map +1 -0
  142. package/dist/files.js +733 -0
  143. package/dist/gateway-setup.d.ts +10 -0
  144. package/dist/gateway-setup.d.ts.map +1 -0
  145. package/dist/gateway-setup.js +896 -0
  146. package/dist/governed-workflow.d.ts +17 -0
  147. package/dist/governed-workflow.d.ts.map +1 -0
  148. package/dist/governed-workflow.js +147 -0
  149. package/dist/grounded-answer.d.ts +12 -0
  150. package/dist/grounded-answer.d.ts.map +1 -0
  151. package/dist/grounded-answer.js +69 -0
  152. package/dist/grounded-context-index.d.ts +25 -0
  153. package/dist/grounded-context-index.d.ts.map +1 -0
  154. package/dist/grounded-context-index.js +169 -0
  155. package/dist/grounded-document-evidence.d.ts +28 -0
  156. package/dist/grounded-document-evidence.d.ts.map +1 -0
  157. package/dist/grounded-document-evidence.js +430 -0
  158. package/dist/grounded-handoff.d.ts +4 -0
  159. package/dist/grounded-handoff.d.ts.map +1 -0
  160. package/dist/grounded-handoff.js +445 -0
  161. package/dist/grounded-orchestrator.d.ts +43 -0
  162. package/dist/grounded-orchestrator.d.ts.map +1 -0
  163. package/dist/grounded-orchestrator.js +1445 -0
  164. package/dist/grounded-prompt.d.ts +2 -0
  165. package/dist/grounded-prompt.d.ts.map +1 -0
  166. package/dist/grounded-prompt.js +17 -0
  167. package/dist/grounded-qa-hybrid.d.ts +36 -0
  168. package/dist/grounded-qa-hybrid.d.ts.map +1 -0
  169. package/dist/grounded-qa-hybrid.js +762 -0
  170. package/dist/grounded-qa-multi-source.d.ts +38 -0
  171. package/dist/grounded-qa-multi-source.d.ts.map +1 -0
  172. package/dist/grounded-qa-multi-source.js +461 -0
  173. package/dist/grounded-qa.d.ts +45 -0
  174. package/dist/grounded-qa.d.ts.map +1 -0
  175. package/dist/grounded-qa.js +877 -0
  176. package/dist/grounded-rerank.d.ts +26 -0
  177. package/dist/grounded-rerank.d.ts.map +1 -0
  178. package/dist/grounded-rerank.js +72 -0
  179. package/dist/grounded-turn-registry.d.ts +23 -0
  180. package/dist/grounded-turn-registry.d.ts.map +1 -0
  181. package/dist/grounded-turn-registry.js +102 -0
  182. package/dist/headers.d.ts +3 -0
  183. package/dist/headers.d.ts.map +1 -0
  184. package/dist/headers.js +22 -0
  185. package/dist/host-check.d.ts +3 -0
  186. package/dist/host-check.d.ts.map +1 -0
  187. package/dist/host-check.js +58 -0
  188. package/dist/index.d.ts +26 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +33 -0
  191. package/dist/load-csp.d.ts +3 -0
  192. package/dist/load-csp.d.ts.map +1 -0
  193. package/dist/load-csp.js +100 -0
  194. package/dist/local-knowledge-grounded-qa.d.ts +42 -0
  195. package/dist/local-knowledge-grounded-qa.d.ts.map +1 -0
  196. package/dist/local-knowledge-grounded-qa.js +678 -0
  197. package/dist/local-knowledge-handlers.d.ts +24 -0
  198. package/dist/local-knowledge-handlers.d.ts.map +1 -0
  199. package/dist/local-knowledge-handlers.js +1285 -0
  200. package/dist/local-knowledge-indexing-registry.d.ts +13 -0
  201. package/dist/local-knowledge-indexing-registry.d.ts.map +1 -0
  202. package/dist/local-knowledge-indexing-registry.js +53 -0
  203. package/dist/localKnowledgeKeyProvider.d.ts +11 -0
  204. package/dist/localKnowledgeKeyProvider.d.ts.map +1 -0
  205. package/dist/localKnowledgeKeyProvider.js +48 -0
  206. package/dist/memory-audit-event-builders.d.ts +21 -0
  207. package/dist/memory-audit-event-builders.d.ts.map +1 -0
  208. package/dist/memory-audit-event-builders.js +187 -0
  209. package/dist/memory-audit-handler.d.ts +23 -0
  210. package/dist/memory-audit-handler.d.ts.map +1 -0
  211. package/dist/memory-audit-handler.js +191 -0
  212. package/dist/memory-capture-policy.d.ts +10 -0
  213. package/dist/memory-capture-policy.d.ts.map +1 -0
  214. package/dist/memory-capture-policy.js +44 -0
  215. package/dist/memory-consolidation-handlers.d.ts +6 -0
  216. package/dist/memory-consolidation-handlers.d.ts.map +1 -0
  217. package/dist/memory-consolidation-handlers.js +491 -0
  218. package/dist/memory-consolidation-registry.d.ts +47 -0
  219. package/dist/memory-consolidation-registry.d.ts.map +1 -0
  220. package/dist/memory-consolidation-registry.js +106 -0
  221. package/dist/memory-conv-handlers.d.ts +8 -0
  222. package/dist/memory-conv-handlers.d.ts.map +1 -0
  223. package/dist/memory-conv-handlers.js +369 -0
  224. package/dist/memory-conversation-context.d.ts +13 -0
  225. package/dist/memory-conversation-context.d.ts.map +1 -0
  226. package/dist/memory-conversation-context.js +22 -0
  227. package/dist/memory-diagnostics.d.ts +29 -0
  228. package/dist/memory-diagnostics.d.ts.map +1 -0
  229. package/dist/memory-diagnostics.js +122 -0
  230. package/dist/memory-embedding.d.ts +21 -0
  231. package/dist/memory-embedding.d.ts.map +1 -0
  232. package/dist/memory-embedding.js +264 -0
  233. package/dist/memory-handlers.d.ts +19 -0
  234. package/dist/memory-handlers.d.ts.map +1 -0
  235. package/dist/memory-handlers.js +1204 -0
  236. package/dist/memory-maintenance-handlers.d.ts +35 -0
  237. package/dist/memory-maintenance-handlers.d.ts.map +1 -0
  238. package/dist/memory-maintenance-handlers.js +219 -0
  239. package/dist/memory-record-builders.d.ts +4 -0
  240. package/dist/memory-record-builders.d.ts.map +1 -0
  241. package/dist/memory-record-builders.js +19 -0
  242. package/dist/memory-retention.d.ts +31 -0
  243. package/dist/memory-retention.d.ts.map +1 -0
  244. package/dist/memory-retention.js +151 -0
  245. package/dist/memory-retrieval-signals.d.ts +12 -0
  246. package/dist/memory-retrieval-signals.d.ts.map +1 -0
  247. package/dist/memory-retrieval-signals.js +100 -0
  248. package/dist/memory-salience.d.ts +12 -0
  249. package/dist/memory-salience.d.ts.map +1 -0
  250. package/dist/memory-salience.js +154 -0
  251. package/dist/memory-scope-sanitizer.d.ts +6 -0
  252. package/dist/memory-scope-sanitizer.d.ts.map +1 -0
  253. package/dist/memory-scope-sanitizer.js +106 -0
  254. package/dist/memory-target-resolver.d.ts +4 -0
  255. package/dist/memory-target-resolver.d.ts.map +1 -0
  256. package/dist/memory-target-resolver.js +73 -0
  257. package/dist/memory-workflow-port.d.ts +14 -0
  258. package/dist/memory-workflow-port.d.ts.map +1 -0
  259. package/dist/memory-workflow-port.js +186 -0
  260. package/dist/private-json.d.ts +3 -0
  261. package/dist/private-json.d.ts.map +1 -0
  262. package/dist/private-json.js +62 -0
  263. package/dist/promptEnhancer/index.d.ts +3 -0
  264. package/dist/promptEnhancer/index.d.ts.map +1 -0
  265. package/dist/promptEnhancer/index.js +5 -0
  266. package/dist/promptEnhancer/orchestrate.d.ts +2 -0
  267. package/dist/promptEnhancer/orchestrate.d.ts.map +1 -0
  268. package/dist/promptEnhancer/orchestrate.js +5 -0
  269. package/dist/promptEnhancer/routes.d.ts +9 -0
  270. package/dist/promptEnhancer/routes.d.ts.map +1 -0
  271. package/dist/promptEnhancer/routes.js +205 -0
  272. package/dist/qualityIntelligence/capsuleAdapter.d.ts +27 -0
  273. package/dist/qualityIntelligence/capsuleAdapter.d.ts.map +1 -0
  274. package/dist/qualityIntelligence/capsuleAdapter.js +57 -0
  275. package/dist/qualityIntelligence/connectorAuthorization.d.ts +22 -0
  276. package/dist/qualityIntelligence/connectorAuthorization.d.ts.map +1 -0
  277. package/dist/qualityIntelligence/connectorAuthorization.js +35 -0
  278. package/dist/qualityIntelligence/connectorErrors.d.ts +16 -0
  279. package/dist/qualityIntelligence/connectorErrors.d.ts.map +1 -0
  280. package/dist/qualityIntelligence/connectorErrors.js +56 -0
  281. package/dist/qualityIntelligence/connectorRoutes.d.ts +7 -0
  282. package/dist/qualityIntelligence/connectorRoutes.d.ts.map +1 -0
  283. package/dist/qualityIntelligence/connectorRoutes.js +167 -0
  284. package/dist/qualityIntelligence/editRoutes.d.ts +5 -0
  285. package/dist/qualityIntelligence/editRoutes.d.ts.map +1 -0
  286. package/dist/qualityIntelligence/editRoutes.js +293 -0
  287. package/dist/qualityIntelligence/exportAssembly.d.ts +22 -0
  288. package/dist/qualityIntelligence/exportAssembly.d.ts.map +1 -0
  289. package/dist/qualityIntelligence/exportAssembly.js +352 -0
  290. package/dist/qualityIntelligence/exportRoutes.d.ts +5 -0
  291. package/dist/qualityIntelligence/exportRoutes.d.ts.map +1 -0
  292. package/dist/qualityIntelligence/exportRoutes.js +320 -0
  293. package/dist/qualityIntelligence/figma/figmaConcurrency.d.ts +8 -0
  294. package/dist/qualityIntelligence/figma/figmaConcurrency.d.ts.map +1 -0
  295. package/dist/qualityIntelligence/figma/figmaConcurrency.js +34 -0
  296. package/dist/qualityIntelligence/figma/figmaConnector.d.ts +65 -0
  297. package/dist/qualityIntelligence/figma/figmaConnector.d.ts.map +1 -0
  298. package/dist/qualityIntelligence/figma/figmaConnector.js +184 -0
  299. package/dist/qualityIntelligence/figma/figmaConnectorAudit.d.ts +52 -0
  300. package/dist/qualityIntelligence/figma/figmaConnectorAudit.d.ts.map +1 -0
  301. package/dist/qualityIntelligence/figma/figmaConnectorAudit.js +63 -0
  302. package/dist/qualityIntelligence/figma/figmaConnectorErrors.d.ts +31 -0
  303. package/dist/qualityIntelligence/figma/figmaConnectorErrors.d.ts.map +1 -0
  304. package/dist/qualityIntelligence/figma/figmaConnectorErrors.js +220 -0
  305. package/dist/qualityIntelligence/figma/figmaConnectorMetrics.d.ts +44 -0
  306. package/dist/qualityIntelligence/figma/figmaConnectorMetrics.d.ts.map +1 -0
  307. package/dist/qualityIntelligence/figma/figmaConnectorMetrics.js +49 -0
  308. package/dist/qualityIntelligence/figma/figmaConsent.d.ts +39 -0
  309. package/dist/qualityIntelligence/figma/figmaConsent.d.ts.map +1 -0
  310. package/dist/qualityIntelligence/figma/figmaConsent.js +62 -0
  311. package/dist/qualityIntelligence/figma/figmaHttpPort.d.ts +28 -0
  312. package/dist/qualityIntelligence/figma/figmaHttpPort.d.ts.map +1 -0
  313. package/dist/qualityIntelligence/figma/figmaHttpPort.js +70 -0
  314. package/dist/qualityIntelligence/figma/figmaObservedActions.d.ts +49 -0
  315. package/dist/qualityIntelligence/figma/figmaObservedActions.d.ts.map +1 -0
  316. package/dist/qualityIntelligence/figma/figmaObservedActions.js +89 -0
  317. package/dist/qualityIntelligence/figma/figmaReadiness.d.ts +32 -0
  318. package/dist/qualityIntelligence/figma/figmaReadiness.d.ts.map +1 -0
  319. package/dist/qualityIntelligence/figma/figmaReadiness.js +67 -0
  320. package/dist/qualityIntelligence/figma/figmaRenderPort.d.ts +29 -0
  321. package/dist/qualityIntelligence/figma/figmaRenderPort.d.ts.map +1 -0
  322. package/dist/qualityIntelligence/figma/figmaRenderPort.js +93 -0
  323. package/dist/qualityIntelligence/figma/figmaResnapshot.d.ts +28 -0
  324. package/dist/qualityIntelligence/figma/figmaResnapshot.d.ts.map +1 -0
  325. package/dist/qualityIntelligence/figma/figmaResnapshot.js +38 -0
  326. package/dist/qualityIntelligence/figma/figmaRetry.d.ts +31 -0
  327. package/dist/qualityIntelligence/figma/figmaRetry.d.ts.map +1 -0
  328. package/dist/qualityIntelligence/figma/figmaRetry.js +62 -0
  329. package/dist/qualityIntelligence/figma/figmaScopeRef.d.ts +9 -0
  330. package/dist/qualityIntelligence/figma/figmaScopeRef.d.ts.map +1 -0
  331. package/dist/qualityIntelligence/figma/figmaScopeRef.js +18 -0
  332. package/dist/qualityIntelligence/figma/figmaScopedPagination.d.ts +86 -0
  333. package/dist/qualityIntelligence/figma/figmaScopedPagination.d.ts.map +1 -0
  334. package/dist/qualityIntelligence/figma/figmaScopedPagination.js +308 -0
  335. package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.d.ts +31 -0
  336. package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.d.ts.map +1 -0
  337. package/dist/qualityIntelligence/figma/figmaSnapshotBuilder.js +314 -0
  338. package/dist/qualityIntelligence/figma/figmaSnapshotHash.d.ts +18 -0
  339. package/dist/qualityIntelligence/figma/figmaSnapshotHash.d.ts.map +1 -0
  340. package/dist/qualityIntelligence/figma/figmaSnapshotHash.js +63 -0
  341. package/dist/qualityIntelligence/figma/figmaSnapshotTypes.d.ts +65 -0
  342. package/dist/qualityIntelligence/figma/figmaSnapshotTypes.d.ts.map +1 -0
  343. package/dist/qualityIntelligence/figma/figmaSnapshotTypes.js +13 -0
  344. package/dist/qualityIntelligence/figma/figmaTokenSource.d.ts +9 -0
  345. package/dist/qualityIntelligence/figma/figmaTokenSource.d.ts.map +1 -0
  346. package/dist/qualityIntelligence/figma/figmaTokenSource.js +61 -0
  347. package/dist/qualityIntelligence/figma/figmaTokenStore.d.ts +19 -0
  348. package/dist/qualityIntelligence/figma/figmaTokenStore.d.ts.map +1 -0
  349. package/dist/qualityIntelligence/figma/figmaTokenStore.js +156 -0
  350. package/dist/qualityIntelligence/figma/figmaUrl.d.ts +6 -0
  351. package/dist/qualityIntelligence/figma/figmaUrl.d.ts.map +1 -0
  352. package/dist/qualityIntelligence/figma/figmaUrl.js +36 -0
  353. package/dist/qualityIntelligence/figma/index.d.ts +20 -0
  354. package/dist/qualityIntelligence/figma/index.d.ts.map +1 -0
  355. package/dist/qualityIntelligence/figma/index.js +26 -0
  356. package/dist/qualityIntelligence/figmaCodegenRoutes.d.ts +28 -0
  357. package/dist/qualityIntelligence/figmaCodegenRoutes.d.ts.map +1 -0
  358. package/dist/qualityIntelligence/figmaCodegenRoutes.js +165 -0
  359. package/dist/qualityIntelligence/figmaSnapshotAdapter.d.ts +55 -0
  360. package/dist/qualityIntelligence/figmaSnapshotAdapter.d.ts.map +1 -0
  361. package/dist/qualityIntelligence/figmaSnapshotAdapter.js +219 -0
  362. package/dist/qualityIntelligence/figmaSnapshotOrchestration.d.ts +64 -0
  363. package/dist/qualityIntelligence/figmaSnapshotOrchestration.d.ts.map +1 -0
  364. package/dist/qualityIntelligence/figmaSnapshotOrchestration.js +203 -0
  365. package/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts +112 -0
  366. package/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts.map +1 -0
  367. package/dist/qualityIntelligence/figmaSnapshotRoutes.js +1063 -0
  368. package/dist/qualityIntelligence/figmaSnapshotScreenIds.d.ts +19 -0
  369. package/dist/qualityIntelligence/figmaSnapshotScreenIds.d.ts.map +1 -0
  370. package/dist/qualityIntelligence/figmaSnapshotScreenIds.js +75 -0
  371. package/dist/qualityIntelligence/generationPort.d.ts +15 -0
  372. package/dist/qualityIntelligence/generationPort.d.ts.map +1 -0
  373. package/dist/qualityIntelligence/generationPort.js +185 -0
  374. package/dist/qualityIntelligence/handoffErrors.d.ts +9 -0
  375. package/dist/qualityIntelligence/handoffErrors.d.ts.map +1 -0
  376. package/dist/qualityIntelligence/handoffErrors.js +21 -0
  377. package/dist/qualityIntelligence/handoffRoutes.d.ts +15 -0
  378. package/dist/qualityIntelligence/handoffRoutes.d.ts.map +1 -0
  379. package/dist/qualityIntelligence/handoffRoutes.js +341 -0
  380. package/dist/qualityIntelligence/index.d.ts +17 -0
  381. package/dist/qualityIntelligence/index.d.ts.map +1 -0
  382. package/dist/qualityIntelligence/index.js +36 -0
  383. package/dist/qualityIntelligence/judgePort.d.ts +30 -0
  384. package/dist/qualityIntelligence/judgePort.d.ts.map +1 -0
  385. package/dist/qualityIntelligence/judgePort.js +326 -0
  386. package/dist/qualityIntelligence/modelSelection.d.ts +58 -0
  387. package/dist/qualityIntelligence/modelSelection.d.ts.map +1 -0
  388. package/dist/qualityIntelligence/modelSelection.js +148 -0
  389. package/dist/qualityIntelligence/reCheckRoutes.d.ts +6 -0
  390. package/dist/qualityIntelligence/reCheckRoutes.d.ts.map +1 -0
  391. package/dist/qualityIntelligence/reCheckRoutes.js +1157 -0
  392. package/dist/qualityIntelligence/retentionEnforcement.d.ts +13 -0
  393. package/dist/qualityIntelligence/retentionEnforcement.d.ts.map +1 -0
  394. package/dist/qualityIntelligence/retentionEnforcement.js +47 -0
  395. package/dist/qualityIntelligence/retentionRoutes.d.ts +8 -0
  396. package/dist/qualityIntelligence/retentionRoutes.d.ts.map +1 -0
  397. package/dist/qualityIntelligence/retentionRoutes.js +74 -0
  398. package/dist/qualityIntelligence/reviewRoutes.d.ts +5 -0
  399. package/dist/qualityIntelligence/reviewRoutes.d.ts.map +1 -0
  400. package/dist/qualityIntelligence/reviewRoutes.js +145 -0
  401. package/dist/qualityIntelligence/reviewStore.d.ts +75 -0
  402. package/dist/qualityIntelligence/reviewStore.d.ts.map +1 -0
  403. package/dist/qualityIntelligence/reviewStore.js +170 -0
  404. package/dist/qualityIntelligence/runExecution.d.ts +36 -0
  405. package/dist/qualityIntelligence/runExecution.d.ts.map +1 -0
  406. package/dist/qualityIntelligence/runExecution.js +180 -0
  407. package/dist/qualityIntelligence/runIngestion.d.ts +70 -0
  408. package/dist/qualityIntelligence/runIngestion.d.ts.map +1 -0
  409. package/dist/qualityIntelligence/runIngestion.js +1235 -0
  410. package/dist/qualityIntelligence/runRegistry.d.ts +31 -0
  411. package/dist/qualityIntelligence/runRegistry.d.ts.map +1 -0
  412. package/dist/qualityIntelligence/runRegistry.js +66 -0
  413. package/dist/qualityIntelligence/runRoutes.d.ts +16 -0
  414. package/dist/qualityIntelligence/runRoutes.d.ts.map +1 -0
  415. package/dist/qualityIntelligence/runRoutes.js +357 -0
  416. package/dist/qualityIntelligence/traceabilityRoutes.d.ts +5 -0
  417. package/dist/qualityIntelligence/traceabilityRoutes.d.ts.map +1 -0
  418. package/dist/qualityIntelligence/traceabilityRoutes.js +173 -0
  419. package/dist/qualityIntelligence/uiRoutes.d.ts +7 -0
  420. package/dist/qualityIntelligence/uiRoutes.d.ts.map +1 -0
  421. package/dist/qualityIntelligence/uiRoutes.js +336 -0
  422. package/dist/read-handlers.d.ts +9 -0
  423. package/dist/read-handlers.d.ts.map +1 -0
  424. package/dist/read-handlers.js +265 -0
  425. package/dist/relationship-handlers.d.ts +191 -0
  426. package/dist/relationship-handlers.d.ts.map +1 -0
  427. package/dist/relationship-handlers.js +0 -0
  428. package/dist/routes.d.ts +37 -0
  429. package/dist/routes.d.ts.map +1 -0
  430. package/dist/routes.js +507 -0
  431. package/dist/run-engine.d.ts +25 -0
  432. package/dist/run-engine.d.ts.map +1 -0
  433. package/dist/run-engine.js +385 -0
  434. package/dist/run-handlers.d.ts +9 -0
  435. package/dist/run-handlers.d.ts.map +1 -0
  436. package/dist/run-handlers.js +465 -0
  437. package/dist/run-request.d.ts +17 -0
  438. package/dist/run-request.d.ts.map +1 -0
  439. package/dist/run-request.js +219 -0
  440. package/dist/runs.d.ts +47 -0
  441. package/dist/runs.d.ts.map +1 -0
  442. package/dist/runs.js +100 -0
  443. package/dist/server.d.ts +13 -0
  444. package/dist/server.d.ts.map +1 -0
  445. package/dist/server.js +152 -0
  446. package/dist/sink.d.ts +28 -0
  447. package/dist/sink.d.ts.map +1 -0
  448. package/dist/sink.js +80 -0
  449. package/dist/sse-write.d.ts +9 -0
  450. package/dist/sse-write.d.ts.map +1 -0
  451. package/dist/sse-write.js +26 -0
  452. package/dist/sse.d.ts +8 -0
  453. package/dist/sse.d.ts.map +1 -0
  454. package/dist/sse.js +27 -0
  455. package/dist/static.d.ts +5 -0
  456. package/dist/static.d.ts.map +1 -0
  457. package/dist/static.js +76 -0
  458. package/dist/store/chats.d.ts +17 -0
  459. package/dist/store/chats.d.ts.map +1 -0
  460. package/dist/store/chats.js +624 -0
  461. package/dist/store/db.d.ts +11 -0
  462. package/dist/store/db.d.ts.map +1 -0
  463. package/dist/store/db.js +203 -0
  464. package/dist/store/errors.d.ts +13 -0
  465. package/dist/store/errors.d.ts.map +1 -0
  466. package/dist/store/errors.js +30 -0
  467. package/dist/store/index.d.ts +7 -0
  468. package/dist/store/index.d.ts.map +1 -0
  469. package/dist/store/index.js +6 -0
  470. package/dist/store/messages.d.ts +8 -0
  471. package/dist/store/messages.d.ts.map +1 -0
  472. package/dist/store/messages.js +149 -0
  473. package/dist/store/paths.d.ts +5 -0
  474. package/dist/store/paths.d.ts.map +1 -0
  475. package/dist/store/paths.js +84 -0
  476. package/dist/store/projects.d.ts +8 -0
  477. package/dist/store/projects.d.ts.map +1 -0
  478. package/dist/store/projects.js +59 -0
  479. package/dist/store/relationship-audit.d.ts +42 -0
  480. package/dist/store/relationship-audit.d.ts.map +1 -0
  481. package/dist/store/relationship-audit.js +155 -0
  482. package/dist/store/relationships.d.ts +191 -0
  483. package/dist/store/relationships.d.ts.map +1 -0
  484. package/dist/store/relationships.js +724 -0
  485. package/dist/store/schema.d.ts +4 -0
  486. package/dist/store/schema.d.ts.map +1 -0
  487. package/dist/store/schema.js +220 -0
  488. package/dist/store/types.d.ts +29 -0
  489. package/dist/store/types.d.ts.map +1 -0
  490. package/dist/store/types.js +8 -0
  491. package/dist/store/validation.d.ts +7 -0
  492. package/dist/store/validation.d.ts.map +1 -0
  493. package/dist/store/validation.js +117 -0
  494. package/dist/store-handlers.d.ts +17 -0
  495. package/dist/store-handlers.d.ts.map +1 -0
  496. package/dist/store-handlers.js +872 -0
  497. package/dist/terminal-errors.d.ts +22 -0
  498. package/dist/terminal-errors.d.ts.map +1 -0
  499. package/dist/terminal-errors.js +45 -0
  500. package/dist/terminal-evidence.d.ts +21 -0
  501. package/dist/terminal-evidence.d.ts.map +1 -0
  502. package/dist/terminal-evidence.js +65 -0
  503. package/dist/terminal-routes.d.ts +10 -0
  504. package/dist/terminal-routes.d.ts.map +1 -0
  505. package/dist/terminal-routes.js +219 -0
  506. package/dist/terminal.d.ts +68 -0
  507. package/dist/terminal.d.ts.map +1 -0
  508. package/dist/terminal.js +855 -0
  509. package/package.json +52 -0
@@ -0,0 +1,13 @@
1
+ export declare class LocalKnowledgeIndexingRegistry {
2
+ private readonly runsByCapsule;
3
+ private readonly runsByJobId;
4
+ start(capsuleId: string): AbortController;
5
+ attachJobId(capsuleId: string, jobId: string): void;
6
+ cancel(capsuleId: string): boolean;
7
+ isActiveCapsule(capsuleId: string): boolean;
8
+ isActiveJob(jobId: string): boolean;
9
+ complete(capsuleId: string): void;
10
+ reset(): void;
11
+ }
12
+ export declare const localKnowledgeIndexingRegistry: LocalKnowledgeIndexingRegistry;
13
+ //# sourceMappingURL=local-knowledge-indexing-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-knowledge-indexing-registry.d.ts","sourceRoot":"","sources":["../src/local-knowledge-indexing-registry.ts"],"names":[],"mappings":"AAMA,qBAAa,8BAA8B;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsD;IACpF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsD;IAElF,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe;IAOzC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAYnD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IASlC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAInC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAWjC,KAAK,IAAI,IAAI;CAOd;AAED,eAAO,MAAM,8BAA8B,gCAAuC,CAAC"}
@@ -0,0 +1,53 @@
1
+ export class LocalKnowledgeIndexingRegistry {
2
+ runsByCapsule = new Map();
3
+ runsByJobId = new Map();
4
+ start(capsuleId) {
5
+ this.complete(capsuleId);
6
+ const controller = new AbortController();
7
+ this.runsByCapsule.set(capsuleId, { capsuleId, controller });
8
+ return controller;
9
+ }
10
+ attachJobId(capsuleId, jobId) {
11
+ const run = this.runsByCapsule.get(capsuleId);
12
+ if (run === undefined) {
13
+ return;
14
+ }
15
+ if (run.jobId !== undefined) {
16
+ this.runsByJobId.delete(run.jobId);
17
+ }
18
+ run.jobId = jobId;
19
+ this.runsByJobId.set(jobId, run);
20
+ }
21
+ cancel(capsuleId) {
22
+ const run = this.runsByCapsule.get(capsuleId);
23
+ if (run === undefined) {
24
+ return false;
25
+ }
26
+ run.controller.abort();
27
+ return true;
28
+ }
29
+ isActiveCapsule(capsuleId) {
30
+ return this.runsByCapsule.has(capsuleId);
31
+ }
32
+ isActiveJob(jobId) {
33
+ return this.runsByJobId.has(jobId);
34
+ }
35
+ complete(capsuleId) {
36
+ const run = this.runsByCapsule.get(capsuleId);
37
+ if (run === undefined) {
38
+ return;
39
+ }
40
+ if (run.jobId !== undefined) {
41
+ this.runsByJobId.delete(run.jobId);
42
+ }
43
+ this.runsByCapsule.delete(capsuleId);
44
+ }
45
+ reset() {
46
+ for (const run of this.runsByCapsule.values()) {
47
+ run.controller.abort();
48
+ }
49
+ this.runsByCapsule.clear();
50
+ this.runsByJobId.clear();
51
+ }
52
+ }
53
+ export const localKnowledgeIndexingRegistry = new LocalKnowledgeIndexingRegistry();
@@ -0,0 +1,11 @@
1
+ import { type LocalVaultKeychainAccess } from "@oscharko-dev/keiko-security/secret-vault";
2
+ import type { KnowledgeStoreKeyProvider, KnowledgeStoreProtectionOptions } from "@oscharko-dev/keiko-local-knowledge";
3
+ import type { EnvSource } from "@oscharko-dev/keiko-model-gateway";
4
+ export declare const LOCAL_KNOWLEDGE_KEY_PROVIDER_ID = "local-knowledge-content-vault";
5
+ export interface CreateLocalKnowledgeKeyProviderOptions {
6
+ readonly env: EnvSource;
7
+ readonly keychainAccess?: LocalVaultKeychainAccess | undefined;
8
+ }
9
+ export declare function createLocalKnowledgeKeyProvider(options: CreateLocalKnowledgeKeyProviderOptions): KnowledgeStoreKeyProvider;
10
+ export declare function localKnowledgeProtectionOptions(keyProvider: KnowledgeStoreKeyProvider | undefined): KnowledgeStoreProtectionOptions | undefined;
11
+ //# sourceMappingURL=localKnowledgeKeyProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localKnowledgeKeyProvider.d.ts","sourceRoot":"","sources":["../src/localKnowledgeKeyProvider.ts"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EACV,yBAAyB,EAEzB,+BAA+B,EAChC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAMnE,eAAO,MAAM,+BAA+B,kCAAkC,CAAC;AAE/E,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IAGxB,QAAQ,CAAC,cAAc,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAChE;AAKD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,sCAAsC,GAC9C,yBAAyB,CAe3B;AAKD,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,yBAAyB,GAAG,SAAS,GACjD,+BAA+B,GAAG,SAAS,CAG7C"}
@@ -0,0 +1,48 @@
1
+ // Local Knowledge store-key policy (Issue #1322, Epic #1319; ADR-0047 D2).
2
+ //
3
+ // The local, dependency-light glue between the generalized AES-256-GCM key-resolution seam
4
+ // (@oscharko-dev/keiko-security/secret-vault) and the Local Knowledge capsule store. It owns the
5
+ // env -> macOS Keychain -> 0600-keyfile key namespace that protects extracted text and vector
6
+ // content at rest, and adapts it to the store's `KnowledgeStoreKeyProvider` contract.
7
+ //
8
+ // The namespace is DISTINCT from the credential vault (Issue #1320) and the memory vault
9
+ // (ADR-0035): a separate env var, keychain service, and keyfile name. Key separation — not the
10
+ // shared AAD — is what prevents a ciphertext sealed for one store from opening with another's key.
11
+ //
12
+ // The keyfile, when that weakest tier is used, is co-located with the capsule store it protects
13
+ // (`dirname(capsules.db)`), so a copied or synced state directory carries only separately-keyed
14
+ // ciphertext. The store directory is created and hardened to 0700 by the store before the key is
15
+ // resolved; resolveLocalVaultKey additionally hardens it and writes the keyfile at 0600.
16
+ import { dirname } from "node:path";
17
+ import { resolveLocalVaultKey, } from "@oscharko-dev/keiko-security/secret-vault";
18
+ const LOCAL_KNOWLEDGE_KEY_ENV = "KEIKO_LOCAL_KNOWLEDGE_KEY";
19
+ const LOCAL_KNOWLEDGE_KEYCHAIN_SERVICE = "keiko-local-knowledge-vault";
20
+ const LOCAL_KNOWLEDGE_KEYFILE = "local-knowledge-vault.key";
21
+ export const LOCAL_KNOWLEDGE_KEY_PROVIDER_ID = "local-knowledge-content-vault";
22
+ // Builds the key provider keiko-server injects into openKnowledgeStore so production capsule stores
23
+ // open encrypted. The key is resolved per store-open from the store's own directory, so different
24
+ // namespaces resolve independent keyfiles while sharing the env/keychain tiers.
25
+ export function createLocalKnowledgeKeyProvider(options) {
26
+ return {
27
+ providerId: LOCAL_KNOWLEDGE_KEY_PROVIDER_ID,
28
+ resolveKey: (context) => {
29
+ const { key } = resolveLocalVaultKey({
30
+ env: options.env,
31
+ vaultDir: dirname(context.dbPath),
32
+ envVarName: LOCAL_KNOWLEDGE_KEY_ENV,
33
+ keychainService: LOCAL_KNOWLEDGE_KEYCHAIN_SERVICE,
34
+ keyfileName: LOCAL_KNOWLEDGE_KEYFILE,
35
+ ...(options.keychainAccess !== undefined ? { keychainAccess: options.keychainAccess } : {}),
36
+ });
37
+ return key;
38
+ },
39
+ };
40
+ }
41
+ // Builds the store protection options for a store-open call. Returns undefined when no key provider is
42
+ // configured (legacy/manual deps) so the store opens plaintext, exactly as before. Keeps the three
43
+ // keiko-server store-open sites consistent without each re-deriving the protection shape.
44
+ export function localKnowledgeProtectionOptions(keyProvider) {
45
+ if (keyProvider === undefined)
46
+ return undefined;
47
+ return { mode: "encrypted-key-provider", keyProvider };
48
+ }
@@ -0,0 +1,21 @@
1
+ import type { MemoryAuditEvent, MemoryAuditInitiatorSurface, MemoryId, MemoryRecord, MemoryScope, MemoryStatus } from "@oscharko-dev/keiko-contracts";
2
+ import type { MemoryTombstone } from "@oscharko-dev/keiko-memory-vault";
3
+ export declare const VAULT_DERIVED_SURFACE: MemoryAuditInitiatorSurface;
4
+ export interface BuildContext {
5
+ readonly occurredAt: number;
6
+ readonly newEventId: () => string;
7
+ readonly redactString: (input: string) => string;
8
+ }
9
+ export declare function safeSummary(input: string, redactString: (s: string) => string): string;
10
+ export type SingleRecordKind = "memory:accepted" | "memory:rejected" | "memory:archived" | "memory:pinned" | "memory:unpinned" | "memory:updated";
11
+ export interface UpdateClassification {
12
+ readonly kind: SingleRecordKind;
13
+ readonly label: string;
14
+ }
15
+ export declare function classifyUpdate(previousStatus: MemoryStatus | undefined, previousPinned: boolean | undefined, record: MemoryRecord): UpdateClassification;
16
+ export declare function buildProposedEvent(record: MemoryRecord, ctx: BuildContext): MemoryAuditEvent;
17
+ export declare function buildInsertedEvent(record: MemoryRecord, ctx: BuildContext): MemoryAuditEvent | undefined;
18
+ export declare function buildUpdatedEvent(record: MemoryRecord, previousStatus: MemoryStatus | undefined, previousPinned: boolean | undefined, ctx: BuildContext): MemoryAuditEvent;
19
+ export declare function buildTombstonedEvent(tombstone: MemoryTombstone, ctx: BuildContext): MemoryAuditEvent;
20
+ export declare function buildDeletedEvent(memoryId: MemoryId, scope: MemoryScope, ctx: BuildContext): MemoryAuditEvent;
21
+ //# sourceMappingURL=memory-audit-event-builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-audit-event-builders.d.ts","sourceRoot":"","sources":["../src/memory-audit-event-builders.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAMxE,eAAO,MAAM,qBAAqB,EAAE,2BAAsC,CAAC;AAI3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD;AAMD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAMtF;AAOD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,gBAAgB,CAAC;AAErB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAsCD,wBAAgB,cAAc,CAC5B,cAAc,EAAE,YAAY,GAAG,SAAS,EACxC,cAAc,EAAE,OAAO,GAAG,SAAS,EACnC,MAAM,EAAE,YAAY,GACnB,oBAAoB,CAWtB;AAuCD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,GAAG,gBAAgB,CAW5F;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,YAAY,GAChB,gBAAgB,GAAG,SAAS,CA8B9B;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,YAAY,GAAG,SAAS,EACxC,cAAc,EAAE,OAAO,GAAG,SAAS,EACnC,GAAG,EAAE,YAAY,GAChB,gBAAgB,CAIlB;AA2CD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,eAAe,EAC1B,GAAG,EAAE,YAAY,GAChB,gBAAgB,CAelB;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,YAAY,GAChB,gBAAgB,CAYlB"}
@@ -0,0 +1,187 @@
1
+ // Pure helpers for the memory audit handler (#214). Split from memory-audit-handler.ts to
2
+ // keep each file under the 400-LOC budget. No IO, no clock reads, no randomness — every
3
+ // effect is injected via `BuildContext`. The handler in `memory-audit-handler.ts` owns
4
+ // the impure surface (persistence, clock, id generation).
5
+ import { MEMORY_AUDIT_EVENT_SUMMARY_MAX_CHARS } from "@oscharko-dev/keiko-contracts";
6
+ // ─── Constants ────────────────────────────────────────────────────────────────
7
+ // Default initiator for vault-derived events. Retrieval/workflow direct emissions use
8
+ // their own surface ("memory-center" / "conversation-center" / "workflow").
9
+ export const VAULT_DERIVED_SURFACE = "system";
10
+ // ─── Summary boundary ─────────────────────────────────────────────────────────
11
+ // Truncates and redacts the summary at the audit boundary. Bound mirrors the
12
+ // MEMORY_AUDIT_EVENT_SUMMARY_MAX_CHARS contract constant.
13
+ export function safeSummary(input, redactString) {
14
+ const redacted = redactString(input);
15
+ if (redacted.length <= MEMORY_AUDIT_EVENT_SUMMARY_MAX_CHARS) {
16
+ return redacted;
17
+ }
18
+ return redacted.slice(0, MEMORY_AUDIT_EVENT_SUMMARY_MAX_CHARS);
19
+ }
20
+ function classifyStatusTransition(previous, next) {
21
+ if (previous === next) {
22
+ return undefined;
23
+ }
24
+ if (next === "accepted") {
25
+ return { kind: "memory:accepted", label: "status -> accepted" };
26
+ }
27
+ if (next === "rejected") {
28
+ return { kind: "memory:rejected", label: "status -> rejected" };
29
+ }
30
+ if (next === "archived") {
31
+ return { kind: "memory:archived", label: "status -> archived" };
32
+ }
33
+ // A vault-bridge `memory:updated` with new status="superseded" doesn't know the
34
+ // supersedor's id; the supersession envelope requires both old + new. Direct emitters
35
+ // (consolidation #208) that know both ids should call `recordMemoryAudit` with kind
36
+ // "memory:superseded" explicitly. From the bridge we fall through to a plain
37
+ // `memory:updated` so the audit trail still records the state change.
38
+ return undefined;
39
+ }
40
+ function classifyPinTransition(previousPinned, nextPinned) {
41
+ if (previousPinned === nextPinned) {
42
+ return undefined;
43
+ }
44
+ return nextPinned
45
+ ? { kind: "memory:pinned", label: "pinned -> true" }
46
+ : { kind: "memory:unpinned", label: "pinned -> false" };
47
+ }
48
+ export function classifyUpdate(previousStatus, previousPinned, record) {
49
+ const statusClass = classifyStatusTransition(previousStatus, record.status);
50
+ if (statusClass !== undefined) {
51
+ return statusClass;
52
+ }
53
+ const pinClass = classifyPinTransition(previousPinned, record.pinned);
54
+ if (pinClass !== undefined) {
55
+ return pinClass;
56
+ }
57
+ // No status / pin transition detected: this is a plain content/metadata update.
58
+ return { kind: "memory:updated", label: "metadata updated" };
59
+ }
60
+ // ─── Event builders ───────────────────────────────────────────────────────────
61
+ function buildSingleRecordEvent(kind, record, summary, ctx) {
62
+ const envelope = {
63
+ schemaVersion: "1",
64
+ eventId: ctx.newEventId(),
65
+ occurredAt: ctx.occurredAt,
66
+ initiatorSurface: VAULT_DERIVED_SURFACE,
67
+ summary,
68
+ memoryId: record.id,
69
+ scope: record.scope,
70
+ };
71
+ switch (kind) {
72
+ case "memory:accepted":
73
+ return { ...envelope, kind: "memory:accepted" };
74
+ case "memory:rejected":
75
+ return { ...envelope, kind: "memory:rejected" };
76
+ case "memory:archived":
77
+ return { ...envelope, kind: "memory:archived" };
78
+ case "memory:pinned":
79
+ return { ...envelope, kind: "memory:pinned" };
80
+ case "memory:unpinned":
81
+ return { ...envelope, kind: "memory:unpinned" };
82
+ case "memory:updated":
83
+ return { ...envelope, kind: "memory:updated" };
84
+ default: {
85
+ const never = kind;
86
+ return never;
87
+ }
88
+ }
89
+ }
90
+ export function buildProposedEvent(record, ctx) {
91
+ return {
92
+ schemaVersion: "1",
93
+ kind: "memory:proposed",
94
+ eventId: ctx.newEventId(),
95
+ occurredAt: ctx.occurredAt,
96
+ initiatorSurface: VAULT_DERIVED_SURFACE,
97
+ summary: safeSummary(`memory ${record.id} proposed (type=${record.type})`, ctx.redactString),
98
+ memoryId: record.id,
99
+ scope: record.scope,
100
+ };
101
+ }
102
+ export function buildInsertedEvent(record, ctx) {
103
+ // The vault emits `memory:inserted` for any new record, but capture (#207) typically
104
+ // inserts at status="proposed". Acceptance flows insert at status="accepted" only when
105
+ // the bypass-review path is taken (rare). We map the initial status to the closest
106
+ // semantic kind; any inserted-at-terminal status (rejected/forgotten/etc.) is dropped
107
+ // because the audit trail for those flows runs through the operation that produced
108
+ // them, not through the vault insert.
109
+ switch (record.status) {
110
+ case "proposed":
111
+ return buildProposedEvent(record, ctx);
112
+ case "accepted":
113
+ return buildSingleRecordEvent("memory:accepted", record, safeSummary(`memory ${record.id} inserted as accepted (type=${record.type})`, ctx.redactString), ctx);
114
+ case "rejected":
115
+ case "superseded":
116
+ case "archived":
117
+ case "forgotten":
118
+ case "conflicted":
119
+ case "expired":
120
+ return undefined;
121
+ default:
122
+ return undefined;
123
+ }
124
+ }
125
+ export function buildUpdatedEvent(record, previousStatus, previousPinned, ctx) {
126
+ const cls = classifyUpdate(previousStatus, previousPinned, record);
127
+ const summary = safeSummary(`memory ${record.id} ${cls.label}`, ctx.redactString);
128
+ return buildSingleRecordEvent(cls.kind, record, summary, ctx);
129
+ }
130
+ // Reconstructs the scope object from the tombstone's flat scope-kind + scope-coordinate
131
+ // pair. The vault flattens the discriminated union on persist; the audit boundary
132
+ // requires the structured shape. The coordinate string IS already the realpath of the
133
+ // branded ID (memory-vault writes them this way), so we re-cast at the audit boundary.
134
+ function scopeFromTombstone(tombstone) {
135
+ switch (tombstone.scopeKind) {
136
+ case "user":
137
+ return {
138
+ kind: "user",
139
+ userId: tombstone.scopeCoordinate,
140
+ };
141
+ case "workspace":
142
+ return {
143
+ kind: "workspace",
144
+ workspaceId: tombstone.scopeCoordinate,
145
+ };
146
+ case "project":
147
+ return {
148
+ kind: "project",
149
+ projectId: tombstone.scopeCoordinate,
150
+ };
151
+ case "workflow":
152
+ return {
153
+ kind: "workflow",
154
+ workflowDefinitionId: tombstone.scopeCoordinate,
155
+ };
156
+ case "global":
157
+ return { kind: "global" };
158
+ default:
159
+ return { kind: "global" };
160
+ }
161
+ }
162
+ export function buildTombstonedEvent(tombstone, ctx) {
163
+ return {
164
+ schemaVersion: "1",
165
+ kind: "memory:forgotten",
166
+ eventId: ctx.newEventId(),
167
+ occurredAt: ctx.occurredAt,
168
+ initiatorSurface: VAULT_DERIVED_SURFACE,
169
+ summary: safeSummary(`memory ${tombstone.memoryId} forgotten (surface=${tombstone.forgetterSurface})`, ctx.redactString),
170
+ memoryId: tombstone.memoryId,
171
+ scope: scopeFromTombstone(tombstone),
172
+ tombstoned: true,
173
+ };
174
+ }
175
+ export function buildDeletedEvent(memoryId, scope, ctx) {
176
+ return {
177
+ schemaVersion: "1",
178
+ kind: "memory:forgotten",
179
+ eventId: ctx.newEventId(),
180
+ occurredAt: ctx.occurredAt,
181
+ initiatorSurface: VAULT_DERIVED_SURFACE,
182
+ summary: safeSummary(`memory ${memoryId} deleted without tombstone`, ctx.redactString),
183
+ memoryId,
184
+ scope,
185
+ tombstoned: false,
186
+ };
187
+ }
@@ -0,0 +1,23 @@
1
+ import type { MemoryAuditEvent } from "@oscharko-dev/keiko-contracts";
2
+ import type { EvidenceStore } from "@oscharko-dev/keiko-evidence";
3
+ import type { MemoryEvent } from "@oscharko-dev/keiko-memory-vault";
4
+ export interface MemoryAuditHandlerOptions {
5
+ readonly evidenceStore: EvidenceStore;
6
+ readonly redactString: (input: string) => string;
7
+ readonly now?: () => number;
8
+ readonly newEventId?: () => string;
9
+ readonly onPersistError?: (error: unknown) => void;
10
+ }
11
+ export type MemoryAuditHandler = (event: MemoryEvent) => void;
12
+ export declare function auditRunIdFor(nowMs: number): string;
13
+ export declare function createMemoryAuditHandler(options: MemoryAuditHandlerOptions): MemoryAuditHandler;
14
+ export interface RecordMemoryAuditOptions {
15
+ readonly evidenceStore: EvidenceStore;
16
+ readonly now?: () => number;
17
+ readonly redactString?: (input: string) => string;
18
+ readonly onPersistError?: (error: unknown) => void;
19
+ }
20
+ export declare function recordMemoryAudit(options: RecordMemoryAuditOptions, event: MemoryAuditEvent): void;
21
+ export declare function recordMemoryAudits(options: RecordMemoryAuditOptions, events: readonly MemoryAuditEvent[]): void;
22
+ export declare function createNoopMemoryAuditHandler(): MemoryAuditHandler;
23
+ //# sourceMappingURL=memory-audit-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-audit-handler.d.ts","sourceRoot":"","sources":["../src/memory-audit-handler.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAYpE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAEjD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAE5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;IAEnC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAW9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AAgDD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CA+B/F;AAgED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,gBAAgB,GACtB,IAAI,CAEN;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,wBAAwB,EACjC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,IAAI,CA4BN;AAMD,wBAAgB,4BAA4B,IAAI,kBAAkB,CAEjE"}
@@ -0,0 +1,191 @@
1
+ // Memory audit handler (Epic #204, Issue #214).
2
+ //
3
+ // Bridges the vault's structural `MemoryEvent` (memory:inserted / memory:updated /
4
+ // memory:deleted / memory:tombstoned / edge:* / embedding:upserted) into the SEMANTIC
5
+ // `MemoryAuditEvent` surface defined in @oscharko-dev/keiko-contracts. The handler:
6
+ //
7
+ // 1. Maps each structural event to one or more semantic kinds by reading the new
8
+ // record's status, pinned flag, and comparing against an in-memory
9
+ // `previousStatus: Map<MemoryId, MemoryStatus>` for transition derivation.
10
+ // 2. Builds a redacted summary string (via the BFF redactString closure).
11
+ // 3. Appends the audit event to a date-bucketed JSON manifest in the existing
12
+ // keiko-evidence ledger (runId = `memory-audit-YYYY-MM-DD`).
13
+ //
14
+ // Persistence shape: ONE manifest per UTC date. Stores that expose `EvidenceStore.update()`
15
+ // serialize the read-append-write step so concurrent audit appenders do not drop events.
16
+ // Custom stores without that optional method still work through get+put, but the built-in
17
+ // Node and in-memory stores use the safer update path.
18
+ //
19
+ // Failure mode: persistence errors are caught and logged to console.error; the handler
20
+ // never throws. An audit-persistence failure must NEVER break the user's memory mutation.
21
+ // Corrupt audit manifests are never reset or overwritten; append attempts fail closed and
22
+ // preserve the existing artifact for operator investigation.
23
+ //
24
+ // Known limitation: the `previousStatus` map is in-memory only. After a server restart the
25
+ // first `memory:updated` for any record lacks transition context and is classified as a
26
+ // plain `memory:updated` (not promoted to `memory:accepted` / `memory:archived` / etc.).
27
+ // The downstream record is captured fully — only the kind classification is degraded.
28
+ //
29
+ // Edge and embedding events are NOT bridged (out of audit scope per the audit invariant
30
+ // in @oscharko-dev/keiko-contracts/memory: audit records carry no body or payload, and
31
+ // edges + embeddings encode structural derivations the body-level audit already covers
32
+ // via the related record mutations).
33
+ //
34
+ // Retrieval/workflow-specific kinds are NOT vault-derived. The `recordMemoryAudit()`
35
+ // helper exported below is the single emission point for those direct audit signals.
36
+ import { randomUUID } from "node:crypto";
37
+ import { buildDeletedEvent, buildInsertedEvent, buildTombstonedEvent, buildUpdatedEvent, } from "./memory-audit-event-builders.js";
38
+ import { sanitizeAuditEvent } from "./memory-scope-sanitizer.js";
39
+ // ─── Constants ────────────────────────────────────────────────────────────────
40
+ const RUNID_PREFIX = "memory-audit-";
41
+ // ─── Pure helpers ─────────────────────────────────────────────────────────────
42
+ // UTC date-bucket key. Stable across timezones; the audit ledger is local-only so a single
43
+ // UTC bucket is unambiguous. Always 10 chars (`YYYY-MM-DD`), which combined with the
44
+ // 13-char prefix yields a 23-char runId well under MAX_RUN_ID_LENGTH (256).
45
+ export function auditRunIdFor(nowMs) {
46
+ const iso = new Date(nowMs).toISOString();
47
+ // ISO format is `YYYY-MM-DDTHH:mm:ss.sssZ`; slice [0,10] is the date.
48
+ return `${RUNID_PREFIX}${iso.slice(0, 10)}`;
49
+ }
50
+ // ─── Persistence ──────────────────────────────────────────────────────────────
51
+ // Appends audit events to the date-bucketed manifest. The built-in evidence stores expose an
52
+ // atomic update path; fallback stores still get parse-safe get+put behavior. Batch callers should
53
+ // pass every event for one operation at once so the daily JSON manifest is parsed and rewritten once.
54
+ function appendAuditEvents(store, runId, events) {
55
+ if (events.length === 0) {
56
+ return;
57
+ }
58
+ const append = (existingJson) => JSON.stringify([...parseExistingEvents(existingJson), ...events]);
59
+ if (store.update !== undefined) {
60
+ store.update(runId, append);
61
+ return;
62
+ }
63
+ store.put(runId, append(store.get(runId)));
64
+ }
65
+ function parseExistingEvents(json) {
66
+ if (json === undefined) {
67
+ return [];
68
+ }
69
+ try {
70
+ const parsed = JSON.parse(json);
71
+ if (!Array.isArray(parsed)) {
72
+ throw new Error("memory audit manifest has unexpected shape");
73
+ }
74
+ return parsed;
75
+ }
76
+ catch (error) {
77
+ throw new Error(`memory audit manifest is corrupt; refusing to overwrite existing audit evidence: ${error instanceof Error ? error.message : "unknown"}`, { cause: error });
78
+ }
79
+ }
80
+ // ─── Public factory ───────────────────────────────────────────────────────────
81
+ export function createMemoryAuditHandler(options) {
82
+ const now = options.now ?? (() => Date.now());
83
+ const newEventId = options.newEventId ?? (() => randomUUID());
84
+ const onPersistError = options.onPersistError ??
85
+ ((error) => {
86
+ // eslint-disable-next-line no-console
87
+ console.error("memory-audit-handler: persistence failed", error);
88
+ });
89
+ const previousStatus = new Map();
90
+ const previousPinned = new Map();
91
+ return (event) => {
92
+ const ctx = {
93
+ occurredAt: now(),
94
+ newEventId,
95
+ redactString: options.redactString,
96
+ };
97
+ const auditEvent = mapVaultEvent(event, previousStatus, previousPinned, ctx);
98
+ updateStateCache(event, previousStatus, previousPinned);
99
+ if (auditEvent === undefined) {
100
+ return;
101
+ }
102
+ try {
103
+ appendAuditEvents(options.evidenceStore, auditRunIdFor(auditEvent.occurredAt), [
104
+ sanitizeAuditEvent(auditEvent, options.redactString),
105
+ ]);
106
+ }
107
+ catch (error) {
108
+ onPersistError(error);
109
+ }
110
+ };
111
+ }
112
+ function mapVaultEvent(event, previousStatus, previousPinned, ctx) {
113
+ switch (event.kind) {
114
+ case "memory:inserted":
115
+ return buildInsertedEvent(event.record, ctx);
116
+ case "memory:updated":
117
+ return buildUpdatedEvent(event.record, previousStatus.get(event.record.id), previousPinned.get(event.record.id), ctx);
118
+ case "memory:tombstoned":
119
+ return buildTombstonedEvent(event.tombstone, ctx);
120
+ case "memory:deleted":
121
+ if (event.tombstoned) {
122
+ return undefined;
123
+ }
124
+ return buildDeletedEvent(event.memoryId, event.scope, ctx);
125
+ case "edge:inserted":
126
+ case "edge:deleted":
127
+ case "embedding:upserted":
128
+ // Edge and embedding events are out of audit scope.
129
+ return undefined;
130
+ default:
131
+ return undefined;
132
+ }
133
+ }
134
+ function updateStateCache(event, previousStatus, previousPinned) {
135
+ switch (event.kind) {
136
+ case "memory:inserted":
137
+ case "memory:updated":
138
+ previousStatus.set(event.record.id, event.record.status);
139
+ previousPinned.set(event.record.id, event.record.pinned);
140
+ return;
141
+ case "memory:deleted":
142
+ previousStatus.delete(event.memoryId);
143
+ previousPinned.delete(event.memoryId);
144
+ return;
145
+ case "memory:tombstoned":
146
+ previousStatus.delete(event.tombstone.memoryId);
147
+ previousPinned.delete(event.tombstone.memoryId);
148
+ return;
149
+ default:
150
+ return;
151
+ }
152
+ }
153
+ export function recordMemoryAudit(options, event) {
154
+ recordMemoryAudits(options, [event]);
155
+ }
156
+ export function recordMemoryAudits(options, events) {
157
+ if (events.length === 0) {
158
+ return;
159
+ }
160
+ const redactString = options.redactString ?? ((input) => input);
161
+ const onPersistError = options.onPersistError ??
162
+ ((error) => {
163
+ // eslint-disable-next-line no-console
164
+ console.error("memory-audit-handler: direct emission failed", error);
165
+ });
166
+ const eventsByRunId = new Map();
167
+ for (const event of events) {
168
+ const runId = auditRunIdFor(event.occurredAt);
169
+ const bucket = eventsByRunId.get(runId);
170
+ if (bucket === undefined) {
171
+ eventsByRunId.set(runId, [sanitizeAuditEvent(event, redactString)]);
172
+ }
173
+ else {
174
+ bucket.push(sanitizeAuditEvent(event, redactString));
175
+ }
176
+ }
177
+ for (const [runId, bucket] of eventsByRunId) {
178
+ try {
179
+ appendAuditEvents(options.evidenceStore, runId, bucket);
180
+ }
181
+ catch (error) {
182
+ onPersistError(error);
183
+ }
184
+ }
185
+ }
186
+ // ─── No-op handler ────────────────────────────────────────────────────────────
187
+ // Used when no evidence store is configured (legacy tests, tooling). Keeps the
188
+ // `onMemoryEvent` port wired so the vault doesn't have to special-case undefined.
189
+ export function createNoopMemoryAuditHandler() {
190
+ return () => undefined;
191
+ }
@@ -0,0 +1,10 @@
1
+ import type { CaptureOutcome, CapturePolicyOptions, RejectionReason } from "@oscharko-dev/keiko-memory-capture";
2
+ import type { UiHandlerDeps } from "./deps.js";
3
+ export declare const SENSITIVE_MEMORY_REJECTION_REASON: RejectionReason;
4
+ export declare function memoryCaptureCustomerMatchers(deps: UiHandlerDeps): readonly RegExp[];
5
+ export declare function memoryCapturePolicyForDeps(deps: UiHandlerDeps, base?: CapturePolicyOptions): CapturePolicyOptions;
6
+ export declare function isPersistableMemoryCandidate(outcome: CaptureOutcome): outcome is Extract<CaptureOutcome, {
7
+ readonly kind: "candidate";
8
+ }>;
9
+ export declare function enforcePersistableMemoryOutcome(outcome: CaptureOutcome): CaptureOutcome;
10
+ //# sourceMappingURL=memory-capture-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture-policy.d.ts","sourceRoot":"","sources":["../src/memory-capture-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,eAAO,MAAM,iCAAiC,EAAE,eACV,CAAC;AAcvC,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,MAAM,EAAE,CAapF;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,aAAa,EACnB,IAAI,GAAE,oBAAyB,GAC9B,oBAAoB,CAMtB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,cAAc,GACtB,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAMpE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAKvF"}
@@ -0,0 +1,44 @@
1
+ import { currentRedactionSecrets } from "./deps.js";
2
+ export const SENSITIVE_MEMORY_REJECTION_REASON = "sensitive-memory-requires-approval";
3
+ function escapeRegExp(value) {
4
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5
+ }
6
+ function exactMatcherFor(value) {
7
+ const trimmed = value.trim();
8
+ if (trimmed.length === 0) {
9
+ return null;
10
+ }
11
+ return new RegExp(escapeRegExp(trimmed));
12
+ }
13
+ export function memoryCaptureCustomerMatchers(deps) {
14
+ const literals = new Set([
15
+ ...(deps.redactionSecrets ?? []),
16
+ ...currentRedactionSecrets(deps),
17
+ ]);
18
+ const matchers = [];
19
+ for (const literal of literals) {
20
+ const matcher = exactMatcherFor(literal);
21
+ if (matcher !== null) {
22
+ matchers.push(matcher);
23
+ }
24
+ }
25
+ return matchers;
26
+ }
27
+ export function memoryCapturePolicyForDeps(deps, base = {}) {
28
+ const matchers = [
29
+ ...(base.customerIdentifierMatchers ?? []),
30
+ ...memoryCaptureCustomerMatchers(deps),
31
+ ];
32
+ return matchers.length === 0 ? base : { ...base, customerIdentifierMatchers: matchers };
33
+ }
34
+ export function isPersistableMemoryCandidate(outcome) {
35
+ return (outcome.kind === "candidate" &&
36
+ !outcome.requiresApproval &&
37
+ outcome.proposal.provenance.sensitivity === "public");
38
+ }
39
+ export function enforcePersistableMemoryOutcome(outcome) {
40
+ if (outcome.kind !== "candidate" || isPersistableMemoryCandidate(outcome)) {
41
+ return outcome;
42
+ }
43
+ return { kind: "rejected", reason: SENSITIVE_MEMORY_REJECTION_REASON };
44
+ }
@@ -0,0 +1,6 @@
1
+ import type { UiHandlerDeps } from "./deps.js";
2
+ import type { RouteContext, RouteResult } from "./routes.js";
3
+ export declare function handleCreateConsolidationJob(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
4
+ export declare function handleGetConsolidationJob(ctx: RouteContext, deps: UiHandlerDeps): RouteResult;
5
+ export declare function handleCancelConsolidationJob(ctx: RouteContext, deps: UiHandlerDeps): RouteResult;
6
+ //# sourceMappingURL=memory-consolidation-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-consolidation-handlers.d.ts","sourceRoot":"","sources":["../src/memory-consolidation-handlers.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAigB7D,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,WAAW,CAAC,CA0BtB;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CAe7F;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CAoBhG"}