@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,106 @@
1
+ // BFF routes for the deterministic language service (Issue #1198, ADR-0042 D4). `POST
2
+ // /api/editor/language` runs one governed, model-free operation (diagnostics, completion, hover, or
3
+ // symbols) over an in-editor overlay; `GET /api/editor/language/capabilities` advertises the
4
+ // registered providers so the editor can feature-detect. Workspace-root containment reuses the same
5
+ // realpath + deny-list resolution as the files routes (`resolveRoot`), and the overlay path is
6
+ // proven contained before any analysis runs. The success payload is redacted (D9) and the body is
7
+ // already length-capped and control-character-stripped by the orchestrator.
8
+ import { isAbsolute, resolve } from "node:path";
9
+ import { DEFAULT_LANGUAGE_SERVICE_LIMITS, parseLanguageServiceRequest, } from "@oscharko-dev/keiko-contracts";
10
+ import { containedRealPathInfo } from "@oscharko-dev/keiko-workspace";
11
+ import { nodeWorkspaceFs } from "@oscharko-dev/keiko-workspace/internal/fs";
12
+ import { errorBody } from "../routes.js";
13
+ import { FilesError, readJsonObject, resolveRoot, runFilesHandler } from "../files.js";
14
+ import { DENIED_MESSAGE, pathIsDenied } from "../files-deny.js";
15
+ import { describeLanguageCapabilities, runLanguageOperation } from "./languageService.js";
16
+ // The overlay buffer may be up to the document-size cap; allow 64 KiB of JSON envelope on top.
17
+ const MAX_LANGUAGE_BODY_BYTES = DEFAULT_LANGUAGE_SERVICE_LIMITS.maxDocumentBytes + 64 * 1024;
18
+ // Exported for reuse by the completion route (#1199), which maps the same deterministic
19
+ // language-service error codes to HTTP status.
20
+ export const STATUS_BY_CODE = {
21
+ INVALID_REQUEST: 400,
22
+ UNSUPPORTED_LANGUAGE: 422,
23
+ UNSUPPORTED_OPERATION: 422,
24
+ DOCUMENT_TOO_LARGE: 413,
25
+ DENIED: 403,
26
+ TIMED_OUT: 503,
27
+ CANCELLED: 499,
28
+ };
29
+ function denied() {
30
+ return new FilesError(403, "DENIED", DENIED_MESSAGE);
31
+ }
32
+ function isRouteResult(value) {
33
+ return typeof value === "object" && value !== null && "status" in value && "body" in value;
34
+ }
35
+ // Resolves the overlay's absolute path and proves it is contained in the workspace root. An absolute
36
+ // or escaping path, a symlink that escapes, or a denied segment (.git/.ssh/credentials) is rejected
37
+ // before any file is read. Exported for reuse by the completion route (#1199).
38
+ export function resolveOverlayPath(realRoot, relativePath) {
39
+ if (isAbsolute(relativePath) || pathIsDenied(relativePath)) {
40
+ throw denied();
41
+ }
42
+ const overlayAbsolute = resolve(realRoot, relativePath);
43
+ try {
44
+ containedRealPathInfo(nodeWorkspaceFs, realRoot, overlayAbsolute);
45
+ }
46
+ catch {
47
+ throw denied();
48
+ }
49
+ return overlayAbsolute;
50
+ }
51
+ // Exported for reuse by the completion route (#1199): aborts in-flight analysis when the client
52
+ // disconnects.
53
+ export function clientAbortSignal(ctx) {
54
+ const controller = new AbortController();
55
+ ctx.req.on("close", () => {
56
+ controller.abort();
57
+ });
58
+ if (typeof ctx.res.on === "function") {
59
+ ctx.res.on("close", () => {
60
+ if (!ctx.res.writableEnded) {
61
+ controller.abort();
62
+ }
63
+ });
64
+ }
65
+ return controller.signal;
66
+ }
67
+ function successBody(outcome) {
68
+ return { operation: outcome.kind, result: outcome.result };
69
+ }
70
+ function outcomeToResult(outcome, deps) {
71
+ if (outcome.kind === "error") {
72
+ return { status: STATUS_BY_CODE[outcome.code], body: errorBody(outcome.code, outcome.message) };
73
+ }
74
+ const body = successBody(outcome);
75
+ // Formatting edits are applied to the user's buffer, not displayed. Redacting the success envelope
76
+ // would mutate secret-shaped string literals in valid format edits; the formatter result was
77
+ // already capped by `sanitizeFormatting`, and the route never logs it.
78
+ return { status: 200, body: outcome.kind === "formatting" ? body : deps.redactor(body) };
79
+ }
80
+ export async function handleEditorLanguage(ctx, deps, options = {}) {
81
+ const body = await readJsonObject(ctx.req, MAX_LANGUAGE_BODY_BYTES);
82
+ if (isRouteResult(body)) {
83
+ return body;
84
+ }
85
+ const parsed = parseLanguageServiceRequest(body);
86
+ if (!parsed.ok) {
87
+ return { status: 400, body: errorBody("INVALID_REQUEST", parsed.errors.join("; ")) };
88
+ }
89
+ const request = parsed.value;
90
+ return runFilesHandler(async () => {
91
+ const root = await resolveRoot(deps.store, request.root, deps.redactor);
92
+ const overlayAbsolutePath = resolveOverlayPath(root.realRoot, request.document.path);
93
+ const outcome = runLanguageOperation(request, {
94
+ fs: nodeWorkspaceFs,
95
+ realRoot: root.realRoot,
96
+ overlayAbsolutePath,
97
+ signal: clientAbortSignal(ctx),
98
+ limits: options.limits,
99
+ now: options.now,
100
+ });
101
+ return outcomeToResult(outcome, deps);
102
+ });
103
+ }
104
+ export function handleEditorLanguageCapabilities() {
105
+ return { status: 200, body: describeLanguageCapabilities() };
106
+ }
@@ -0,0 +1,8 @@
1
+ import type { LanguageCompletionResult, LanguageDiagnosticsResult, LanguageFormattingResult, LanguageHoverResult, LanguageServiceLimits, LanguageSymbolResult } from "@oscharko-dev/keiko-contracts";
2
+ import type { LanguageDiagnosticsRaw, LanguageFormattingRaw, LanguageSymbolsRaw } from "./languageProvider.js";
3
+ export declare function sanitizeDiagnostics(raw: LanguageDiagnosticsRaw, limits: LanguageServiceLimits): LanguageDiagnosticsResult;
4
+ export declare function sanitizeCompletion(result: LanguageCompletionResult, limits: LanguageServiceLimits): LanguageCompletionResult;
5
+ export declare function sanitizeHover(result: LanguageHoverResult, limits: LanguageServiceLimits): LanguageHoverResult;
6
+ export declare function sanitizeSymbols(raw: LanguageSymbolsRaw, limits: LanguageServiceLimits): LanguageSymbolResult;
7
+ export declare function sanitizeFormatting(raw: LanguageFormattingRaw, limits: LanguageServiceLimits): LanguageFormattingResult;
8
+ //# sourceMappingURL=languageSanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languageSanitize.d.ts","sourceRoot":"","sources":["../../src/editor/languageSanitize.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,wBAAwB,EAExB,yBAAyB,EAEzB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAoB/B,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,sBAAsB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,yBAAyB,CAM3B;AAsBD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,qBAAqB,GAC5B,wBAAwB,CAO1B;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,mBAAmB,CAMrB;AAiBD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,qBAAqB,GAC5B,oBAAoB,CAMtB;AAQD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,qBAAqB,EAC1B,MAAM,EAAE,qBAAqB,GAC5B,wBAAwB,CAmB1B"}
@@ -0,0 +1,101 @@
1
+ // Browser-display sanitisation for language-service results (Issue #1198 AC: "results are capped and
2
+ // sanitized for browser display"). Every string that crosses to the browser is stripped of bidi,
3
+ // zero-width, and control characters (reusing the contracts text-safety primitive) and clipped to
4
+ // the per-field length cap, so a hostile or pathological buffer cannot smuggle terminal escapes,
5
+ // direction overrides, or unbounded payloads into the editor. Redaction of secret-shaped strings is
6
+ // applied separately by the BFF live-payload redactor.
7
+ import { stripUnsafeFormatChars } from "@oscharko-dev/keiko-contracts/text-safety";
8
+ function clip(value, max) {
9
+ const safe = stripUnsafeFormatChars(value);
10
+ return safe.length > max ? safe.slice(0, max) : safe;
11
+ }
12
+ function sanitizeDiagnostic(diagnostic, limits) {
13
+ return {
14
+ range: diagnostic.range,
15
+ severity: diagnostic.severity,
16
+ message: clip(diagnostic.message, limits.maxMessageChars),
17
+ source: clip(diagnostic.source, limits.maxLabelChars),
18
+ ...(diagnostic.code !== undefined ? { code: clip(diagnostic.code, limits.maxLabelChars) } : {}),
19
+ };
20
+ }
21
+ export function sanitizeDiagnostics(raw, limits) {
22
+ const capped = raw.diagnostics.slice(0, limits.maxDiagnostics);
23
+ return {
24
+ diagnostics: capped.map((diagnostic) => sanitizeDiagnostic(diagnostic, limits)),
25
+ truncated: raw.truncated || raw.diagnostics.length > capped.length,
26
+ };
27
+ }
28
+ function sanitizeCompletionItem(item, limits) {
29
+ return {
30
+ label: clip(item.label, limits.maxLabelChars),
31
+ kind: item.kind,
32
+ ...(item.detail !== undefined ? { detail: clip(item.detail, limits.maxDetailChars) } : {}),
33
+ ...(item.documentation !== undefined
34
+ ? { documentation: clip(item.documentation, limits.maxDocumentationChars) }
35
+ : {}),
36
+ // insertText can carry a full snippet (for example an auto-import edit), so it uses the more
37
+ // permissive detail cap rather than the short label cap.
38
+ ...(item.insertText !== undefined
39
+ ? { insertText: clip(item.insertText, limits.maxDetailChars) }
40
+ : {}),
41
+ ...(item.sortText !== undefined ? { sortText: clip(item.sortText, limits.maxLabelChars) } : {}),
42
+ };
43
+ }
44
+ export function sanitizeCompletion(result, limits) {
45
+ const capped = result.items.slice(0, limits.maxCompletionItems);
46
+ return {
47
+ items: capped.map((item) => sanitizeCompletionItem(item, limits)),
48
+ isIncomplete: result.isIncomplete,
49
+ truncated: result.truncated || result.items.length > capped.length,
50
+ };
51
+ }
52
+ export function sanitizeHover(result, limits) {
53
+ const contents = result.contents === null ? null : clip(result.contents, limits.maxHoverChars);
54
+ return {
55
+ contents,
56
+ ...(result.range !== undefined ? { range: result.range } : {}),
57
+ };
58
+ }
59
+ function sanitizeSymbol(symbol, limits) {
60
+ return {
61
+ name: clip(symbol.name, limits.maxLabelChars),
62
+ kind: symbol.kind,
63
+ range: symbol.range,
64
+ ...(symbol.detail !== undefined ? { detail: clip(symbol.detail, limits.maxDetailChars) } : {}),
65
+ ...(symbol.containerName !== undefined
66
+ ? { containerName: clip(symbol.containerName, limits.maxLabelChars) }
67
+ : {}),
68
+ };
69
+ }
70
+ export function sanitizeSymbols(raw, limits) {
71
+ const capped = raw.symbols.slice(0, limits.maxSymbols);
72
+ return {
73
+ symbols: capped.map((symbol) => sanitizeSymbol(symbol, limits)),
74
+ truncated: raw.truncated || raw.symbols.length > capped.length,
75
+ };
76
+ }
77
+ // Formatting edits are APPLIED to the buffer, not rendered, so — unlike the display surfaces above —
78
+ // their `newText` is left byte-faithful: stripping format characters would silently mutate the
79
+ // user's own code (for example characters inside a string literal) when they format. The bounds are
80
+ // the edit-count cap plus defensive per-edit and aggregate byte ceilings (the document-size
81
+ // envelope); over-budget edits are dropped rather than clipped, since clipping a reformat edit would
82
+ // corrupt the buffer, and the edits are non-overlapping so dropping one leaves the rest valid.
83
+ export function sanitizeFormatting(raw, limits) {
84
+ const capped = raw.edits.slice(0, limits.maxFormattingEdits);
85
+ // Measure UTF-8 bytes so the per-edit ceiling matches the `maxDocumentBytes` byte budget rather
86
+ // than UTF-16 code units (which would under-count multi-byte content).
87
+ const withinLength = [];
88
+ let totalBytes = 0;
89
+ for (const edit of capped) {
90
+ const byteLength = Buffer.byteLength(edit.newText, "utf8");
91
+ if (byteLength > limits.maxDocumentBytes || totalBytes + byteLength > limits.maxDocumentBytes) {
92
+ continue;
93
+ }
94
+ withinLength.push(edit);
95
+ totalBytes += byteLength;
96
+ }
97
+ return {
98
+ edits: withinLength,
99
+ truncated: raw.truncated || raw.edits.length > capped.length || withinLength.length < capped.length,
100
+ };
101
+ }
@@ -0,0 +1,36 @@
1
+ import { type LanguageCompletionResult, type LanguageDiagnosticsResult, type LanguageFormattingResult, type LanguageHoverResult, type LanguageServiceCapabilities, type LanguageServiceErrorCode, type LanguageServiceLimits, type LanguageServiceRequest, type LanguageSymbolResult } from "@oscharko-dev/keiko-contracts";
2
+ import type { WorkspaceFs } from "@oscharko-dev/keiko-workspace";
3
+ import { type LanguageProviderRegistry } from "./languageProvider.js";
4
+ export declare function languageServiceRegistry(): LanguageProviderRegistry;
5
+ export declare function describeLanguageCapabilities(registry?: LanguageProviderRegistry): LanguageServiceCapabilities;
6
+ export type LanguageServiceOutcome = {
7
+ readonly kind: "diagnostics";
8
+ readonly result: LanguageDiagnosticsResult;
9
+ } | {
10
+ readonly kind: "completion";
11
+ readonly result: LanguageCompletionResult;
12
+ } | {
13
+ readonly kind: "hover";
14
+ readonly result: LanguageHoverResult;
15
+ } | {
16
+ readonly kind: "symbols";
17
+ readonly result: LanguageSymbolResult;
18
+ } | {
19
+ readonly kind: "formatting";
20
+ readonly result: LanguageFormattingResult;
21
+ } | {
22
+ readonly kind: "error";
23
+ readonly code: LanguageServiceErrorCode;
24
+ readonly message: string;
25
+ };
26
+ export interface RunLanguageOperationOptions {
27
+ readonly fs: WorkspaceFs;
28
+ readonly realRoot: string;
29
+ readonly overlayAbsolutePath: string;
30
+ readonly limits?: LanguageServiceLimits | undefined;
31
+ readonly signal?: AbortSignal | undefined;
32
+ readonly now?: (() => number) | undefined;
33
+ readonly registry?: LanguageProviderRegistry | undefined;
34
+ }
35
+ export declare function runLanguageOperation(request: LanguageServiceRequest, options: RunLanguageOperationOptions): LanguageServiceOutcome;
36
+ //# sourceMappingURL=languageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languageService.d.ts","sourceRoot":"","sources":["../../src/editor/languageService.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAE1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAsB/B,wBAAgB,uBAAuB,IAAI,wBAAwB,CAElE;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,GAAE,wBAA0C,GACnD,2BAA2B,CAK7B;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,GAC5E;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAElG,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IAEzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAC1D;AAsCD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,2BAA2B,GACnC,sBAAsB,CAsCxB"}
@@ -0,0 +1,93 @@
1
+ // The deterministic language-service orchestrator (Issue #1198, ADR-0042 D4). It is the single
2
+ // governed, model-free entry point: it resolves the request's language to a provider, enforces the
3
+ // document-size and wall-clock bounds, runs the requested operation under a deadline/abort
4
+ // cancellation token, and sanitises every result for browser display. It never calls a model and
5
+ // never routes through the Model Gateway. Provider registration is the only thing that changes to
6
+ // add a language (#1213), so this orchestrator stays language-agnostic.
7
+ import { DEFAULT_LANGUAGE_SERVICE_LIMITS, LANGUAGE_SERVICE_SCHEMA_VERSION, } from "@oscharko-dev/keiko-contracts";
8
+ import { createDeadlineCancellation, isCancellation } from "./languageCancellation.js";
9
+ import { createLanguageProviderRegistry, } from "./languageProvider.js";
10
+ import { createTypescriptLanguageProvider } from "./typescriptLanguageProvider.js";
11
+ import { createBuiltinTextLanguageProvider, createJsonLanguageProvider, unavailableExternalLspDescriptors, } from "./builtinLanguageProviders.js";
12
+ import { sanitizeCompletion, sanitizeDiagnostics, sanitizeFormatting, sanitizeHover, sanitizeSymbols, } from "./languageSanitize.js";
13
+ // Providers are stateless and deterministic, so a single shared instance is safe. External LSP
14
+ // descriptors are advertised as unavailable until a workspace-contained executable is configured.
15
+ const defaultRegistry = createLanguageProviderRegistry([createTypescriptLanguageProvider(), createJsonLanguageProvider(), createBuiltinTextLanguageProvider()], unavailableExternalLspDescriptors());
16
+ export function languageServiceRegistry() {
17
+ return defaultRegistry;
18
+ }
19
+ export function describeLanguageCapabilities(registry = defaultRegistry) {
20
+ return {
21
+ schemaVersion: LANGUAGE_SERVICE_SCHEMA_VERSION,
22
+ providers: registry.describe(),
23
+ };
24
+ }
25
+ function errorOutcome(code, message) {
26
+ return { kind: "error", code, message };
27
+ }
28
+ function runOperation(request, provider, ctx, limits) {
29
+ switch (request.operation) {
30
+ case "diagnostics":
31
+ return {
32
+ kind: "diagnostics",
33
+ result: sanitizeDiagnostics(provider.getDiagnostics(ctx), limits),
34
+ };
35
+ case "completion":
36
+ return {
37
+ kind: "completion",
38
+ result: sanitizeCompletion(provider.getCompletions(ctx, request.position), limits),
39
+ };
40
+ case "hover":
41
+ return {
42
+ kind: "hover",
43
+ result: sanitizeHover(provider.getHover(ctx, request.position), limits),
44
+ };
45
+ case "symbols":
46
+ return { kind: "symbols", result: sanitizeSymbols(provider.getSymbols(ctx), limits) };
47
+ case "formatting":
48
+ return {
49
+ kind: "formatting",
50
+ result: sanitizeFormatting(provider.getFormatting(ctx, request.options), limits),
51
+ };
52
+ }
53
+ }
54
+ export function runLanguageOperation(request, options) {
55
+ const limits = options.limits ?? DEFAULT_LANGUAGE_SERVICE_LIMITS;
56
+ const registry = options.registry ?? defaultRegistry;
57
+ if (Buffer.byteLength(request.document.text, "utf8") > limits.maxDocumentBytes) {
58
+ return errorOutcome("DOCUMENT_TOO_LARGE", "The document exceeds the analysis size limit.");
59
+ }
60
+ const provider = registry.resolve(request.document.languageId);
61
+ if (provider === undefined) {
62
+ return errorOutcome("UNSUPPORTED_LANGUAGE", "No deterministic provider serves this language.");
63
+ }
64
+ if (!provider.descriptor.operations.includes(request.operation)) {
65
+ return errorOutcome("UNSUPPORTED_OPERATION", "The provider does not serve this operation.");
66
+ }
67
+ const cancellation = createDeadlineCancellation({
68
+ signal: options.signal,
69
+ deadlineMs: limits.deadlineMs,
70
+ now: options.now,
71
+ });
72
+ const ctx = {
73
+ fs: options.fs,
74
+ root: options.realRoot,
75
+ overlayPath: options.overlayAbsolutePath,
76
+ overlayText: request.document.text,
77
+ languageId: request.document.languageId,
78
+ limits,
79
+ cancellation,
80
+ };
81
+ try {
82
+ cancellation.throwIfCancellationRequested();
83
+ return runOperation(request, provider, ctx, limits);
84
+ }
85
+ catch (error) {
86
+ if (isCancellation(error)) {
87
+ return cancellation.reason() === "timeout"
88
+ ? errorOutcome("TIMED_OUT", "Analysis exceeded the time budget.")
89
+ : errorOutcome("CANCELLED", "The request was cancelled.");
90
+ }
91
+ throw error;
92
+ }
93
+ }
@@ -0,0 +1,14 @@
1
+ import { type LanguageServiceLimits } from "@oscharko-dev/keiko-contracts";
2
+ import type { WorkspaceFs } from "@oscharko-dev/keiko-workspace";
3
+ import ts from "typescript";
4
+ export interface ContainedHostOptions {
5
+ readonly fs: WorkspaceFs;
6
+ readonly realRoot: string;
7
+ readonly overlayPath: string;
8
+ readonly overlayText: string;
9
+ readonly languageId: string;
10
+ readonly cancellation: ts.HostCancellationToken;
11
+ readonly limits?: LanguageServiceLimits | undefined;
12
+ }
13
+ export declare function createContainedLanguageServiceHost(options: ContainedHostOptions): ts.LanguageServiceHost;
14
+ //# sourceMappingURL=languageServiceHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languageServiceHost.d.ts","sourceRoot":"","sources":["../../src/editor/languageServiceHost.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CACrD;AAgPD,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,oBAAoB,GAC5B,EAAE,CAAC,mBAAmB,CAiDxB"}
@@ -0,0 +1,242 @@
1
+ // A workspace-contained TypeScript LanguageServiceHost (Issue #1198, ADR-0042 D4). Every file the
2
+ // language service reads is forced through one of three gates: (1) the in-memory overlay buffer for
3
+ // the document under analysis, (2) the TypeScript compiler's own default-library directory (its
4
+ // runtime lib.*.d.ts, which is not workspace content), or (3) the audited WorkspaceFs port behind a
5
+ // realpath containment check, so the language service can never read a path outside the registered
6
+ // workspace root — including via a symlink. tsconfig discovery resolves the nearest config inside
7
+ // the root and follows `extends` through the same gate; it never enumerates the whole project.
8
+ import { Buffer } from "node:buffer";
9
+ import { dirname, resolve } from "node:path";
10
+ import { DEFAULT_LANGUAGE_SERVICE_LIMITS, } from "@oscharko-dev/keiko-contracts";
11
+ import { containedRealPathInfo } from "@oscharko-dev/keiko-workspace";
12
+ import ts from "typescript";
13
+ import { pathIsDenied } from "../files-deny.js";
14
+ function normalizeSlashes(value) {
15
+ return value.replace(/\\/g, "/");
16
+ }
17
+ // True when `fileName` is the TypeScript compiler's own default-library directory or a file inside
18
+ // it. The path is resolved first so a `..`-bearing path (for example `<libDir>/../../etc/passwd`)
19
+ // can never masquerade as a lib path via a raw prefix match and bypass workspace containment.
20
+ function isWithinLibDir(libDir, fileName) {
21
+ const normalized = normalizeSlashes(resolve(fileName));
22
+ return normalized === libDir || normalized.startsWith(`${libDir}/`);
23
+ }
24
+ const CASE_SENSITIVE = ts.sys.useCaseSensitiveFileNames;
25
+ function defaultCompilerOptions() {
26
+ return {
27
+ allowJs: true,
28
+ checkJs: false,
29
+ jsx: ts.JsxEmit.ReactJSX,
30
+ target: ts.ScriptTarget.ES2022,
31
+ module: ts.ModuleKind.ESNext,
32
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
33
+ lib: ["lib.es2022.full.d.ts"],
34
+ allowNonTsExtensions: true,
35
+ allowImportingTsExtensions: true,
36
+ noEmit: true,
37
+ skipLibCheck: true,
38
+ skipDefaultLibCheck: true,
39
+ strict: false,
40
+ };
41
+ }
42
+ function throwIfLanguageServiceCancelled(cancellation) {
43
+ if (!cancellation.isCancellationRequested())
44
+ return;
45
+ // TypeScript catches this exact class while cancelling language-service work.
46
+ // eslint-disable-next-line @typescript-eslint/only-throw-error
47
+ throw new ts.OperationCanceledException();
48
+ }
49
+ function cacheContainedReal(state, key, value) {
50
+ state.containedRealCache.set(key, value);
51
+ return value;
52
+ }
53
+ function resolveContainedReal(state, fileName) {
54
+ throwIfLanguageServiceCancelled(state.cancellation);
55
+ const key = normalizeSlashes(resolve(fileName));
56
+ if (state.containedRealCache.has(key)) {
57
+ return state.containedRealCache.get(key);
58
+ }
59
+ if (state.workspacePathProbes >= state.limits.maxWorkspaceReadFiles) {
60
+ return cacheContainedReal(state, key, undefined);
61
+ }
62
+ state.workspacePathProbes += 1;
63
+ try {
64
+ const info = containedRealPathInfo(state.fs, state.realRoot, fileName);
65
+ return cacheContainedReal(state, key, pathIsDenied(info.realRelative) ? undefined : info.path);
66
+ }
67
+ catch {
68
+ return cacheContainedReal(state, key, undefined);
69
+ }
70
+ }
71
+ function workspaceReadAllowedByStat(state, stat) {
72
+ return (stat.isFile &&
73
+ stat.size <= state.limits.maxWorkspaceReadFileBytes &&
74
+ state.workspaceReadFiles < state.limits.maxWorkspaceReadFiles &&
75
+ state.workspaceReadBytes + stat.size <= state.limits.maxWorkspaceReadBytes);
76
+ }
77
+ function readBoundedWorkspaceFile(state, real) {
78
+ const cached = state.workspaceReadCache.get(real);
79
+ if (cached !== undefined)
80
+ return cached;
81
+ throwIfLanguageServiceCancelled(state.cancellation);
82
+ let stat;
83
+ try {
84
+ stat = state.fs.stat(real);
85
+ }
86
+ catch {
87
+ return undefined;
88
+ }
89
+ if (!workspaceReadAllowedByStat(state, stat))
90
+ return undefined;
91
+ let content;
92
+ try {
93
+ content = state.fs.readFileUtf8(real);
94
+ }
95
+ catch {
96
+ return undefined;
97
+ }
98
+ const bytes = Buffer.byteLength(content, "utf8");
99
+ if (bytes > state.limits.maxWorkspaceReadFileBytes)
100
+ return undefined;
101
+ if (state.workspaceReadBytes + bytes > state.limits.maxWorkspaceReadBytes)
102
+ return undefined;
103
+ state.workspaceReadFiles += 1;
104
+ state.workspaceReadBytes += bytes;
105
+ state.workspaceReadCache.set(real, content);
106
+ return content;
107
+ }
108
+ // Builds a containment-aware reader closure set shared by the config parser and the host. A path is
109
+ // readable only if it is the overlay, a compiler lib file, or contained inside the workspace root.
110
+ function createContainedReaders(fs, realRoot, overlayPath, overlayText, libDir, cancellation, limits) {
111
+ const overlay = normalizeSlashes(overlayPath);
112
+ const isLibPath = (fileName) => isWithinLibDir(libDir, fileName);
113
+ const state = {
114
+ fs,
115
+ realRoot,
116
+ libDir,
117
+ cancellation,
118
+ limits,
119
+ containedRealCache: new Map(),
120
+ workspaceReadCache: new Map(),
121
+ workspacePathProbes: 0,
122
+ workspaceReadBytes: 0,
123
+ workspaceReadFiles: 0,
124
+ };
125
+ const containedReal = (fileName) => resolveContainedReal(state, fileName);
126
+ const readFile = (fileName) => {
127
+ throwIfLanguageServiceCancelled(cancellation);
128
+ if (normalizeSlashes(fileName) === overlay)
129
+ return overlayText;
130
+ if (isLibPath(fileName)) {
131
+ try {
132
+ return fs.readFileUtf8(fileName);
133
+ }
134
+ catch {
135
+ return undefined;
136
+ }
137
+ }
138
+ const real = containedReal(fileName);
139
+ if (real === undefined)
140
+ return undefined;
141
+ return readBoundedWorkspaceFile(state, real);
142
+ };
143
+ const fileExists = (fileName) => {
144
+ throwIfLanguageServiceCancelled(cancellation);
145
+ if (normalizeSlashes(fileName) === overlay)
146
+ return true;
147
+ if (isLibPath(fileName))
148
+ return fs.exists(fileName);
149
+ const real = containedReal(fileName);
150
+ return real !== undefined && fs.exists(real);
151
+ };
152
+ return { readFile, fileExists, containedReal };
153
+ }
154
+ // Resolves the compiler options for the overlay: the nearest tsconfig inside the root (following
155
+ // `extends` through the contained reader, never enumerating files) merged over safe defaults.
156
+ function resolveCompilerOptions(fs, realRoot, overlayPath, readers) {
157
+ const defaults = defaultCompilerOptions();
158
+ const configPath = ts.findConfigFile(dirname(overlayPath), readers.fileExists, "tsconfig.json");
159
+ if (configPath === undefined || readers.containedReal(configPath) === undefined) {
160
+ return defaults;
161
+ }
162
+ const configFile = ts.readConfigFile(configPath, (path) => readers.readFile(path));
163
+ if (configFile.error !== undefined || typeof configFile.config !== "object") {
164
+ return defaults;
165
+ }
166
+ const parseHost = {
167
+ useCaseSensitiveFileNames: CASE_SENSITIVE,
168
+ // Only the options matter for single-document analysis; never enumerate the project.
169
+ readDirectory: () => [],
170
+ fileExists: readers.fileExists,
171
+ readFile: readers.readFile,
172
+ };
173
+ const parsed = ts.parseJsonConfigFileContent(configFile.config, parseHost, dirname(configPath));
174
+ return {
175
+ ...defaults,
176
+ ...parsed.options,
177
+ allowJs: true,
178
+ allowNonTsExtensions: true,
179
+ noEmit: true,
180
+ };
181
+ }
182
+ function containedDirectoryExists(fs, readers, libDir, directory) {
183
+ if (isWithinLibDir(libDir, directory))
184
+ return fs.exists(directory);
185
+ const real = readers.containedReal(directory);
186
+ return real !== undefined && fs.exists(real);
187
+ }
188
+ function containedDirectories(fs, readers, libDir, limits, directory) {
189
+ // The compiler's own lib directory enumerates directly; everything else goes through the
190
+ // realpath containment gate, mirroring containedDirectoryExists so the two never diverge.
191
+ const real = isWithinLibDir(libDir, directory) ? directory : readers.containedReal(directory);
192
+ if (real === undefined)
193
+ return [];
194
+ try {
195
+ return fs
196
+ .readDir(real)
197
+ .filter((entry) => entry.isDirectory)
198
+ .slice(0, limits.maxWorkspaceReadFiles)
199
+ .map((entry) => resolve(real, entry.name));
200
+ }
201
+ catch {
202
+ return [];
203
+ }
204
+ }
205
+ export function createContainedLanguageServiceHost(options) {
206
+ const { fs, realRoot, overlayPath, overlayText, cancellation } = options;
207
+ const limits = options.limits ?? DEFAULT_LANGUAGE_SERVICE_LIMITS;
208
+ const libDir = normalizeSlashes(dirname(ts.getDefaultLibFilePath(defaultCompilerOptions())));
209
+ const readers = createContainedReaders(fs, realRoot, overlayPath, overlayText, libDir, cancellation, limits);
210
+ const compilerOptions = resolveCompilerOptions(fs, realRoot, overlayPath, readers);
211
+ const overlay = normalizeSlashes(overlayPath);
212
+ return {
213
+ getCompilationSettings: () => compilerOptions,
214
+ getScriptFileNames: () => [overlayPath],
215
+ getScriptVersion: (fileName) => normalizeSlashes(fileName) === overlay ? "overlay" : "0",
216
+ getScriptSnapshot: (fileName) => {
217
+ const content = readers.readFile(fileName);
218
+ return content === undefined ? undefined : ts.ScriptSnapshot.fromString(content);
219
+ },
220
+ getCurrentDirectory: () => realRoot,
221
+ getDefaultLibFileName: (compilerOpts) => ts.getDefaultLibFilePath(compilerOpts),
222
+ fileExists: readers.fileExists,
223
+ readFile: readers.readFile,
224
+ directoryExists: (directory) => containedDirectoryExists(fs, readers, libDir, directory),
225
+ getDirectories: (directory) => containedDirectories(fs, readers, libDir, limits, directory),
226
+ realpath: (path) => {
227
+ // Only resolve symlinks for the compiler lib dir or paths proven contained; never realpath an
228
+ // out-of-root path (it would confirm existence of files outside the workspace).
229
+ if (isWithinLibDir(libDir, path)) {
230
+ try {
231
+ return fs.realPath(path);
232
+ }
233
+ catch {
234
+ return path;
235
+ }
236
+ }
237
+ return readers.containedReal(path) ?? path;
238
+ },
239
+ getCancellationToken: () => cancellation,
240
+ useCaseSensitiveFileNames: () => CASE_SENSITIVE,
241
+ };
242
+ }
@@ -0,0 +1,21 @@
1
+ import type { RetrievalReference } from "@oscharko-dev/keiko-contracts";
2
+ import type { ChatLocalKnowledgeScope } from "@oscharko-dev/keiko-contracts/bff-wire";
3
+ import type { KnowledgeStore } from "@oscharko-dev/keiko-local-knowledge";
4
+ import type { UiHandlerDeps } from "../deps.js";
5
+ import type { RouteResult } from "../routes.js";
6
+ export type EditorLocalKnowledgeOutcome = {
7
+ readonly kind: "ok";
8
+ readonly references: readonly RetrievalReference[];
9
+ readonly noEvidence: boolean;
10
+ readonly reason: string | undefined;
11
+ } | {
12
+ readonly kind: "conflict";
13
+ readonly routeResult: RouteResult;
14
+ } | {
15
+ readonly kind: "not-ready";
16
+ readonly reason: string;
17
+ readonly message: string;
18
+ };
19
+ export declare function buildLocalKnowledgeScope(capsuleId: string | undefined, capsuleSetId: string | undefined): ChatLocalKnowledgeScope | undefined;
20
+ export declare function retrieveEditorLocalKnowledge(deps: UiHandlerDeps, store: KnowledgeStore, scope: ChatLocalKnowledgeScope, queryText: string, signal: AbortSignal): Promise<EditorLocalKnowledgeOutcome>;
21
+ //# sourceMappingURL=localKnowledgeRetrieval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localKnowledgeRetrieval.d.ts","sourceRoot":"","sources":["../../src/editor/localKnowledgeRetrieval.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAOhD,MAAM,MAAM,2BAA2B,GACnC;IACE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAItF,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,uBAAuB,GAAG,SAAS,CAQrC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,uBAAuB,EAC9B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,2BAA2B,CAAC,CA2BtC"}