@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,341 @@
1
+ // Quality Intelligence Conversation Center → workflow handoff route (Epic #270, Issue #281).
2
+ //
3
+ // Single additive HTTP handler:
4
+ // * POST /api/quality-intelligence/handoff
5
+ //
6
+ // Hard constraints:
7
+ // * The Conversation Center is the existing chat surface — QI integration is via WORKFLOW
8
+ // HANDOFF only, never a parallel chat/agent/memory channel.
9
+ // * The request body IS a `QualityIntelligenceConversationCenterHandoff` envelope. The envelope
10
+ // carries ONLY refs (chat-message id, run id, source-envelope ids) — never chat content,
11
+ // never an excerpt, never a body. Unknown top-level keys are REJECTED so a misbehaving
12
+ // client cannot smuggle content through the seam.
13
+ // * The route resolves `requestedByChatMessageId` against the existing chat-store seam
14
+ // (`UiStore`). If recognised, the handoff is persisted as a single system message on the
15
+ // owning chat (taskType=`qi-handoff`); the message content is a fixed, non-echoing
16
+ // descriptor — the envelope itself stays out of the message body.
17
+ // * If the chat-message ref is unknown → `404 QI_HANDOFF_UNKNOWN_CHAT_MESSAGE`.
18
+ // * No provider SDK imports. No new runtime dependency. A "design-tests" handoff additionally
19
+ // starts a model-routed QI run in the BACKGROUND from the chat's connected folder (through the
20
+ // Keiko Model Gateway + Harness, like any QI run) and links the run id back to the chat — this
21
+ // is the governed workflow handoff (Issue #281), not a parallel chat/agent/model channel.
22
+ // * Test Intelligence reference (TI) is acknowledged only by plain phrase; this file MUST
23
+ // NOT contain any reference to the prior external TI-namespace packages — enforced by
24
+ // `independenceGuard.test.ts` and the repo-wide `npm run check:qi-supply-chain` gate.
25
+ //
26
+ // Group export `QI_HANDOFF_ROUTE_GROUP` keeps the route registration mechanically merge-safe
27
+ // with sibling QI epic work (e.g. #280) — the dispatcher in `routes.ts` only needs to spread
28
+ // the group.
29
+ import { randomUUID } from "node:crypto";
30
+ import { QualityIntelligence } from "@oscharko-dev/keiko-contracts";
31
+ import { qiHandoffErrorBody, } from "./handoffErrors.js";
32
+ import { containsForbiddenSecretShape } from "./connectorErrors.js";
33
+ import { executeQiRun } from "./runExecution.js";
34
+ import { qiRunRegistry } from "./runRegistry.js";
35
+ // ─── Body reading ──────────────────────────────────────────────────────────────
36
+ const MAX_BODY_BYTES = 64 * 1024;
37
+ class BodyTooLargeError extends Error {
38
+ constructor() {
39
+ super("Handoff body exceeds the route cap");
40
+ this.name = "BodyTooLargeError";
41
+ }
42
+ }
43
+ const readBody = (req) => new Promise((resolve, reject) => {
44
+ const chunks = [];
45
+ let total = 0;
46
+ let capped = false;
47
+ req.on("data", (chunk) => {
48
+ total += chunk.length;
49
+ if (total > MAX_BODY_BYTES) {
50
+ if (!capped) {
51
+ capped = true;
52
+ chunks.length = 0;
53
+ reject(new BodyTooLargeError());
54
+ req.resume();
55
+ }
56
+ return;
57
+ }
58
+ chunks.push(chunk);
59
+ });
60
+ req.on("end", () => {
61
+ if (!capped)
62
+ resolve(Buffer.concat(chunks).toString("utf8"));
63
+ });
64
+ req.on("error", reject);
65
+ });
66
+ const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
67
+ // ─── Envelope validation (envelope-only invariant) ─────────────────────────────
68
+ // The envelope's permitted top-level keys. Anything else MUST be rejected so a leaky
69
+ // client cannot smuggle chat content, bodies, excerpts, or unstructured payloads
70
+ // through this seam.
71
+ const ALLOWED_ENVELOPE_KEYS = new Set([
72
+ "id",
73
+ "requestedByChatMessageId",
74
+ "runId",
75
+ "promptedAction",
76
+ "payloadRef",
77
+ ]);
78
+ // `payloadRef` carries strictly envelope-id refs and nothing else. The branded
79
+ // `sourceEnvelopeIds` array is the only permitted member.
80
+ const ALLOWED_PAYLOAD_REF_KEYS = new Set(["sourceEnvelopeIds"]);
81
+ const errResult = (status, code) => ({
82
+ status,
83
+ body: qiHandoffErrorBody(code),
84
+ });
85
+ const scanForbiddenStrings = (value) => {
86
+ if (typeof value === "string")
87
+ return containsForbiddenSecretShape(value);
88
+ if (Array.isArray(value))
89
+ return value.some(scanForbiddenStrings);
90
+ if (isPlainObject(value)) {
91
+ for (const v of Object.values(value)) {
92
+ if (scanForbiddenStrings(v))
93
+ return true;
94
+ }
95
+ return false;
96
+ }
97
+ return false;
98
+ };
99
+ const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
100
+ const isAllowedAction = (value) => {
101
+ if (typeof value !== "string")
102
+ return false;
103
+ for (const action of QualityIntelligence.QUALITY_INTELLIGENCE_HANDOFF_PROMPTED_ACTIONS) {
104
+ if (action === value)
105
+ return true;
106
+ }
107
+ return false;
108
+ };
109
+ const fail = (code = "QI_HANDOFF_BAD_REQUEST") => ({
110
+ kind: "err",
111
+ result: errResult(400, code),
112
+ });
113
+ const hasOnlyAllowedKeys = (obj, allowed) => {
114
+ for (const key of Object.keys(obj)) {
115
+ if (!allowed.has(key))
116
+ return false;
117
+ }
118
+ return true;
119
+ };
120
+ const parseSourceEnvelopeIds = (raw) => {
121
+ if (!Array.isArray(raw))
122
+ return undefined;
123
+ const ids = [];
124
+ for (const candidate of raw) {
125
+ if (typeof candidate !== "string")
126
+ return undefined;
127
+ try {
128
+ ids.push(QualityIntelligence.asQualityIntelligenceSourceEnvelopeId(candidate));
129
+ }
130
+ catch {
131
+ return undefined;
132
+ }
133
+ }
134
+ return ids;
135
+ };
136
+ const parseOptionalRunId = (raw) => {
137
+ if (raw === undefined)
138
+ return { ok: true, value: undefined };
139
+ if (typeof raw !== "string")
140
+ return { ok: false };
141
+ try {
142
+ return { ok: true, value: QualityIntelligence.asQualityIntelligenceRunId(raw) };
143
+ }
144
+ catch {
145
+ return { ok: false };
146
+ }
147
+ };
148
+ const validatePayloadRef = (raw) => {
149
+ if (!isPlainObject(raw))
150
+ return undefined;
151
+ if (!hasOnlyAllowedKeys(raw, ALLOWED_PAYLOAD_REF_KEYS))
152
+ return undefined;
153
+ return parseSourceEnvelopeIds(raw.sourceEnvelopeIds);
154
+ };
155
+ const validateEnvelope = (parsed) => {
156
+ if (!isPlainObject(parsed))
157
+ return fail();
158
+ if (!hasOnlyAllowedKeys(parsed, ALLOWED_ENVELOPE_KEYS))
159
+ return fail();
160
+ if (!isNonEmptyString(parsed.id))
161
+ return fail();
162
+ if (!isNonEmptyString(parsed.requestedByChatMessageId))
163
+ return fail();
164
+ if (!isAllowedAction(parsed.promptedAction))
165
+ return fail();
166
+ const sourceEnvelopeIds = validatePayloadRef(parsed.payloadRef);
167
+ if (sourceEnvelopeIds === undefined)
168
+ return fail();
169
+ const runIdResult = parseOptionalRunId(parsed.runId);
170
+ if (!runIdResult.ok)
171
+ return fail();
172
+ // Defence-in-depth: scrub every string value for credential-shaped substrings.
173
+ if (scanForbiddenStrings(parsed))
174
+ return fail("QI_HANDOFF_FORBIDDEN_PAYLOAD");
175
+ const envelope = {
176
+ id: parsed.id,
177
+ requestedByChatMessageId: parsed.requestedByChatMessageId,
178
+ promptedAction: parsed.promptedAction,
179
+ payloadRef: { sourceEnvelopeIds },
180
+ ...(runIdResult.value !== undefined ? { runId: runIdResult.value } : {}),
181
+ };
182
+ return { kind: "ok", envelope };
183
+ };
184
+ // Single indexed lookup — replaces O(P×C×M) triple scan on every handoff POST.
185
+ const findChatMessage = (deps, messageId) => {
186
+ const message = deps.store.findMessageById(messageId);
187
+ if (message === undefined)
188
+ return undefined;
189
+ return { chatId: message.chatId, message };
190
+ };
191
+ // ─── Persisted handoff record ──────────────────────────────────────────────────
192
+ //
193
+ // We persist the handoff as a single system message on the owning chat. The message
194
+ // content is a fixed, non-echoing descriptor — the envelope itself is NOT serialised
195
+ // into the message body. This preserves the envelope-only invariant on the persisted
196
+ // row and keeps the chat surface free of secret-shaped content.
197
+ const HANDOFF_TASK_TYPE = "qi-handoff";
198
+ const HANDOFF_CONTENT_BY_ACTION = {
199
+ "design-tests": "Quality Intelligence: design-tests handoff requested.",
200
+ "validate-tests": "Quality Intelligence: validate-tests handoff requested.",
201
+ "review-coverage": "Quality Intelligence: review-coverage handoff requested.",
202
+ "request-export": "Quality Intelligence: request-export handoff requested.",
203
+ };
204
+ const buildHandoffMessage = (resolved, envelope, now, linkedRunId) => ({
205
+ chatId: resolved.chatId,
206
+ role: "system",
207
+ content: HANDOFF_CONTENT_BY_ACTION[envelope.promptedAction],
208
+ timestamp: now(),
209
+ runId: linkedRunId,
210
+ workflowId: undefined,
211
+ workflowStatus: undefined,
212
+ shortResult: undefined,
213
+ taskType: HANDOFF_TASK_TYPE,
214
+ });
215
+ // For a "design-tests" handoff, start a model-routed QI run in the BACKGROUND from the chat's
216
+ // connected workspace context. Fire-and-forget: the run registers with the in-flight registry (so it
217
+ // surfaces in the run list) and persists to evidence on completion; the handoff returns the run id
218
+ // immediately so the Conversation Center can link + poll it. The run goes through the Keiko Model
219
+ // Gateway + Harness like any QI run — this is the governed workflow handoff (Issue #281), not a
220
+ // parallel chat/agent/model path.
221
+ //
222
+ // Multi-source (Epic #532/#729): a chat may connect more than one folder. The run ingests EVERY
223
+ // connected workspace root so the QI run covers the full context the user connected — not just the
224
+ // first folder. `executeQiRun` already applies the per-run source cap, deny-list guard, and byte
225
+ // budget over the source list.
226
+ //
227
+ // `envelope.payloadRef.sourceEnvelopeIds` are reserved for a future capability that narrows the run
228
+ // to a user-selected SUBSET of the connected context; until that resolver exists the run faithfully
229
+ // ingests the chat's whole connected workspace context, so an empty (or any) id list is honoured by
230
+ // using the connected scopes.
231
+ const startHandoffRun = (deps, roots) => {
232
+ const runId = `qi-run-${randomUUID()}`;
233
+ const registeredAt = new Date().toISOString();
234
+ const controller = qiRunRegistry.register(runId, registeredAt);
235
+ const totals = { candidates: 0, findings: 0, exports: 0 };
236
+ void executeQiRun({
237
+ request: {
238
+ sources: roots.map((path) => ({
239
+ kind: "workspace",
240
+ label: "Conversation Center",
241
+ path,
242
+ })),
243
+ },
244
+ runId,
245
+ deps,
246
+ registeredAt,
247
+ signal: controller.signal,
248
+ onAccepted: () => undefined,
249
+ onEvent: (event) => {
250
+ if (event.payload.kind === "candidate:proposed")
251
+ totals.candidates += 1;
252
+ if (event.payload.kind === "finding:recorded")
253
+ totals.findings += 1;
254
+ qiRunRegistry.updateTotals(runId, totals);
255
+ },
256
+ })
257
+ .then((summary) => {
258
+ qiRunRegistry.complete(runId, summary.status);
259
+ })
260
+ .catch(() => {
261
+ qiRunRegistry.complete(runId, "failed");
262
+ });
263
+ return runId;
264
+ };
265
+ // Collect the distinct, non-empty absolute roots of a chat's connected workspace context. Prefers
266
+ // the canonical multi-source `connectedScopes` list (Epic #532); falls back to the legacy singular
267
+ // `connectedScope` for older chats. Non-folder scopes (no `root`) are skipped — the handoff run
268
+ // ingests workspace folders only. Order-preserving exact-string de-duplication.
269
+ const collectConnectedRoots = (chat) => {
270
+ const scopes = chat?.connectedScopes ?? (chat?.connectedScope !== undefined ? [chat.connectedScope] : []);
271
+ const roots = [];
272
+ for (const scope of scopes) {
273
+ const root = scope.root;
274
+ if (typeof root === "string" && root.length > 0 && !roots.includes(root)) {
275
+ roots.push(root);
276
+ }
277
+ }
278
+ return roots;
279
+ };
280
+ // Resolve the run id linked to a handoff: a "design-tests" handoff over a chat with a connected
281
+ // workspace context starts a background run; otherwise it falls back to any run id the envelope
282
+ // already carried.
283
+ const resolveHandoffRunId = (deps, envelope, chatId) => {
284
+ if (envelope.promptedAction !== "design-tests")
285
+ return envelope.runId;
286
+ const chat = deps.store.findChatById(chatId);
287
+ const roots = collectConnectedRoots(chat);
288
+ if (roots.length > 0)
289
+ return startHandoffRun(deps, roots);
290
+ return envelope.runId;
291
+ };
292
+ export const createHandleQiHandoff = (options = {}) => {
293
+ const now = options.now ?? (() => Date.now());
294
+ return async (ctx, deps) => {
295
+ let raw;
296
+ try {
297
+ raw = await readBody(ctx.req);
298
+ }
299
+ catch (e) {
300
+ if (e instanceof BodyTooLargeError) {
301
+ return errResult(413, "QI_HANDOFF_PAYLOAD_TOO_LARGE");
302
+ }
303
+ return errResult(400, "QI_HANDOFF_BAD_REQUEST");
304
+ }
305
+ let parsed;
306
+ try {
307
+ parsed = JSON.parse(raw);
308
+ }
309
+ catch {
310
+ return errResult(400, "QI_HANDOFF_BAD_REQUEST");
311
+ }
312
+ const validation = validateEnvelope(parsed);
313
+ if (validation.kind === "err")
314
+ return validation.result;
315
+ const { envelope } = validation;
316
+ const resolved = findChatMessage(deps, envelope.requestedByChatMessageId);
317
+ if (resolved === undefined) {
318
+ return errResult(404, "QI_HANDOFF_UNKNOWN_CHAT_MESSAGE");
319
+ }
320
+ const linkedRunId = resolveHandoffRunId(deps, envelope, resolved.chatId);
321
+ const persisted = deps.store.createMessage(buildHandoffMessage(resolved, envelope, now, linkedRunId));
322
+ const body = {
323
+ handoffId: envelope.id,
324
+ chatId: resolved.chatId,
325
+ persistedMessageId: persisted.id,
326
+ ...(linkedRunId !== undefined ? { runId: linkedRunId } : {}),
327
+ };
328
+ return { status: 200, body };
329
+ };
330
+ };
331
+ export const handleQiHandoff = createHandleQiHandoff();
332
+ // Mechanically-mergeable route group. Sibling QI epic work (e.g. #280) registers its
333
+ // own group separately; the dispatcher in `routes.ts` spreads each group into the
334
+ // route table, so the merge surface here is a single array literal.
335
+ export const QI_HANDOFF_ROUTE_GROUP = [
336
+ {
337
+ method: "POST",
338
+ pattern: "/api/quality-intelligence/handoff",
339
+ handler: handleQiHandoff,
340
+ },
341
+ ];
@@ -0,0 +1,17 @@
1
+ export { isFigmaConnectorAuthorized, isJiraConnectorAuthorized, summariseQiConnectorCapabilities, type QiConnectorCapabilities, type QiConnectorConfig, } from "./connectorAuthorization.js";
2
+ export { payloadContainsForbiddenSecretShape, qiConnectorErrorBody, type QiConnectorErrorBody, type QiConnectorErrorCode, } from "./connectorErrors.js";
3
+ export { handleQiCapabilities, handleQiDryRunFigma, handleQiDryRunJira, handleQiSourceSelect, } from "./connectorRoutes.js";
4
+ export { handleListQiRuns, handleGetQiRun } from "./uiRoutes.js";
5
+ export { QI_HANDOFF_ROUTE_GROUP, createHandleQiHandoff, handleQiHandoff, type QiHandoffRouteOptions, type QiHandoffSuccessBody, } from "./handoffRoutes.js";
6
+ export { qiHandoffErrorBody, type QiHandoffErrorBody, type QiHandoffErrorCode, } from "./handoffErrors.js";
7
+ export { QI_RUN_EXECUTION_ROUTE_GROUP, handleStartQiRun, handleCancelQiRun } from "./runRoutes.js";
8
+ export { qiRunRegistry, QiRunRegistry } from "./runRegistry.js";
9
+ export { executeQiRun, QiIngestionError, QiGenerationError } from "./runExecution.js";
10
+ export { applyReviewDecision, appendEditAudit, loadRunReviewState, runReviewStateOf, candidateReviewStateOf, type QiReviewAction, type QiAuditAction, type QiReviewStateArtifact, } from "./reviewStore.js";
11
+ export { QI_REVIEW_ROUTE_GROUP, handleQiReview } from "./reviewRoutes.js";
12
+ export { QI_EXPORT_ROUTE_GROUP, handleQiExport } from "./exportRoutes.js";
13
+ export { QI_EDIT_ROUTE_GROUP, handleQiEditCandidate } from "./editRoutes.js";
14
+ export { QI_RETENTION_ROUTE_GROUP, handleQiDeleteRun } from "./retentionRoutes.js";
15
+ export { QI_TRACEABILITY_ROUTE_GROUP, handleQiTraceabilityExport } from "./traceabilityRoutes.js";
16
+ export { QI_RECHECK_ROUTE_GROUP, handleQiReCheck, handleQiRegenerateStale, } from "./reCheckRoutes.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mCAAmC,EACnC,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,uBAAuB,GACxB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,36 @@
1
+ // Public barrel for the keiko-server Quality Intelligence connector route group
2
+ // (Epic #270, Issue #278).
3
+ //
4
+ // Re-exports the additive connector route handlers, the authorisation predicates,
5
+ // and the safe-error helpers so the server route registrar can mount them as one
6
+ // cohesive group. The route group is DISABLED BY DEFAULT — every connector
7
+ // authorisation predicate returns `false` unless explicit config flips it.
8
+ //
9
+ // Nothing in this barrel performs IO or imports a provider SDK; the runtime
10
+ // behaviour lives in the existing keiko-server route plumbing.
11
+ export { isFigmaConnectorAuthorized, isJiraConnectorAuthorized, summariseQiConnectorCapabilities, } from "./connectorAuthorization.js";
12
+ export { payloadContainsForbiddenSecretShape, qiConnectorErrorBody, } from "./connectorErrors.js";
13
+ export { handleQiCapabilities, handleQiDryRunFigma, handleQiDryRunJira, handleQiSourceSelect, } from "./connectorRoutes.js";
14
+ // Issue #280 — read-only UI routes for the Quality Intelligence panel.
15
+ export { handleListQiRuns, handleGetQiRun } from "./uiRoutes.js";
16
+ // Issue #281 — Conversation Center → QI workflow handoff route group.
17
+ export { QI_HANDOFF_ROUTE_GROUP, createHandleQiHandoff, handleQiHandoff, } from "./handoffRoutes.js";
18
+ export { qiHandoffErrorBody, } from "./handoffErrors.js";
19
+ // Issue #273/#280 — QI run execution (start + cancel) route group + in-flight registry.
20
+ export { QI_RUN_EXECUTION_ROUTE_GROUP, handleStartQiRun, handleCancelQiRun } from "./runRoutes.js";
21
+ export { qiRunRegistry, QiRunRegistry } from "./runRegistry.js";
22
+ export { executeQiRun, QiIngestionError, QiGenerationError } from "./runExecution.js";
23
+ // Issue #282 — review-state companion store (read + mutation seams).
24
+ export { applyReviewDecision, appendEditAudit, loadRunReviewState, runReviewStateOf, candidateReviewStateOf, } from "./reviewStore.js";
25
+ // Issue #282 — review-action route group.
26
+ export { QI_REVIEW_ROUTE_GROUP, handleQiReview } from "./reviewRoutes.js";
27
+ // Issue #283 — export route group (local serialise + TMS dry-run preview).
28
+ export { QI_EXPORT_ROUTE_GROUP, handleQiExport } from "./exportRoutes.js";
29
+ // Issue #726 (Epic #712) — inline-edit route group.
30
+ export { QI_EDIT_ROUTE_GROUP, handleQiEditCandidate } from "./editRoutes.js";
31
+ // Issue #282 follow-up — run-deletion control route group (DELETE /runs/:id, ADR-0023 D8).
32
+ export { QI_RETENTION_ROUTE_GROUP, handleQiDeleteRun } from "./retentionRoutes.js";
33
+ // Issue #740 (Epic #734) — requirement↔test traceability matrix export route group.
34
+ export { QI_TRACEABILITY_ROUTE_GROUP, handleQiTraceabilityExport } from "./traceabilityRoutes.js";
35
+ // Issue #743 (Epic #735) — drift re-check + targeted regeneration route group.
36
+ export { QI_RECHECK_ROUTE_GROUP, handleQiReCheck, handleQiRegenerateStale, } from "./reCheckRoutes.js";
@@ -0,0 +1,30 @@
1
+ import { type ChatMessage } from "@oscharko-dev/keiko-model-gateway";
2
+ import type { TestQualityJudgeVerdict } from "@oscharko-dev/keiko-contracts";
3
+ import type { UiHandlerDeps } from "../deps.js";
4
+ export declare class QiJudgeError extends Error {
5
+ readonly code: string;
6
+ constructor(code: string, message: string);
7
+ }
8
+ interface JudgeSourceContext {
9
+ readonly atomId: string;
10
+ readonly text: string;
11
+ }
12
+ interface JudgePromptInput {
13
+ readonly candidateText: string;
14
+ readonly sourceContext: readonly JudgeSourceContext[];
15
+ }
16
+ export declare function scrubCandidateText(text: string): string;
17
+ export declare function buildJudgePrompt(candidateText: string, sourceContext?: readonly JudgeSourceContext[]): readonly ChatMessage[];
18
+ export declare function parseJudgeVerdict(rawText: string): TestQualityJudgeVerdict;
19
+ export interface QiJudgePort {
20
+ readonly judge: (input: JudgePromptInput, signal?: AbortSignal) => Promise<TestQualityJudgeVerdict & {
21
+ readonly gatewayCallCount: number;
22
+ }>;
23
+ }
24
+ /**
25
+ * Build a judge port bound to one model id. Applies the qi:judge-logic capability gate
26
+ * (chat model with text capability). Gateway-only; no direct provider calls.
27
+ */
28
+ export declare function createQiJudgePort(deps: UiHandlerDeps, modelId: string): QiJudgePort;
29
+ export {};
30
+ //# sourceMappingURL=judgePort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judgePort.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/judgePort.ts"],"names":[],"mappings":"AAUA,OAAO,EAKL,KAAK,WAAW,EAGjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,KAAK,EAEV,uBAAuB,EAExB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBACjB,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAQD,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACvD;AAgCD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASvD;AAyBD,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,EACrB,aAAa,GAAE,SAAS,kBAAkB,EAAO,GAChD,SAAS,WAAW,EAAE,CAsBxB;AAmKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAW1E;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,CACd,KAAK,EAAE,gBAAgB,EACvB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,uBAAuB,GAAG;QAAE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAqDnF"}