@oscharko-dev/keiko 0.3.14 → 0.3.15

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 (231) hide show
  1. package/dist/ui/csp-hashes.json +6 -6
  2. package/dist/ui/static/404.html +1 -1
  3. package/dist/ui/static/__next.__PAGE__.txt +1 -1
  4. package/dist/ui/static/__next._full.txt +1 -1
  5. package/dist/ui/static/__next._head.txt +1 -1
  6. package/dist/ui/static/__next._index.txt +1 -1
  7. package/dist/ui/static/__next._tree.txt +1 -1
  8. package/dist/ui/static/_not-found/__next._full.txt +1 -1
  9. package/dist/ui/static/_not-found/__next._head.txt +1 -1
  10. package/dist/ui/static/_not-found/__next._index.txt +1 -1
  11. package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +1 -1
  12. package/dist/ui/static/_not-found/__next._not-found.txt +1 -1
  13. package/dist/ui/static/_not-found/__next._tree.txt +1 -1
  14. package/dist/ui/static/_not-found.html +1 -1
  15. package/dist/ui/static/_not-found.txt +1 -1
  16. package/dist/ui/static/atlassian-connectors/__next._full.txt +1 -1
  17. package/dist/ui/static/atlassian-connectors/__next._head.txt +1 -1
  18. package/dist/ui/static/atlassian-connectors/__next._index.txt +1 -1
  19. package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
  20. package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +1 -1
  21. package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.txt +1 -1
  22. package/dist/ui/static/atlassian-connectors.html +1 -1
  23. package/dist/ui/static/atlassian-connectors.txt +1 -1
  24. package/dist/ui/static/index.html +1 -1
  25. package/dist/ui/static/index.txt +1 -1
  26. package/dist/ui/static/launch/__next._full.txt +1 -1
  27. package/dist/ui/static/launch/__next._head.txt +1 -1
  28. package/dist/ui/static/launch/__next._index.txt +1 -1
  29. package/dist/ui/static/launch/__next._tree.txt +1 -1
  30. package/dist/ui/static/launch/__next.launch.__PAGE__.txt +1 -1
  31. package/dist/ui/static/launch/__next.launch.txt +1 -1
  32. package/dist/ui/static/launch.html +1 -1
  33. package/dist/ui/static/launch.txt +1 -1
  34. package/dist/ui/static/local-knowledge/__next._full.txt +1 -1
  35. package/dist/ui/static/local-knowledge/__next._head.txt +1 -1
  36. package/dist/ui/static/local-knowledge/__next._index.txt +1 -1
  37. package/dist/ui/static/local-knowledge/__next._tree.txt +1 -1
  38. package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +1 -1
  39. package/dist/ui/static/local-knowledge/__next.local-knowledge.txt +1 -1
  40. package/dist/ui/static/local-knowledge/capsule/__next._full.txt +1 -1
  41. package/dist/ui/static/local-knowledge/capsule/__next._head.txt +1 -1
  42. package/dist/ui/static/local-knowledge/capsule/__next._index.txt +1 -1
  43. package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
  44. package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +1 -1
  45. package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.txt +1 -1
  46. package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.txt +1 -1
  47. package/dist/ui/static/local-knowledge/capsule.html +1 -1
  48. package/dist/ui/static/local-knowledge/capsule.txt +1 -1
  49. package/dist/ui/static/local-knowledge.html +1 -1
  50. package/dist/ui/static/local-knowledge.txt +1 -1
  51. package/node_modules/@oscharko-dev/keiko-cli/dist/ui.d.ts.map +1 -1
  52. package/node_modules/@oscharko-dev/keiko-cli/dist/ui.js +25 -6
  53. package/node_modules/@oscharko-dev/keiko-cli/package.json +13 -13
  54. package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
  55. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.d.ts +2 -2
  56. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.js +2 -2
  57. package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
  58. package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
  59. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
  60. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
  61. package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
  62. package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
  63. package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
  64. package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
  65. package/node_modules/@oscharko-dev/keiko-harness/package.json +6 -6
  66. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/connector-pod.d.ts +2 -0
  67. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/connector-pod.d.ts.map +1 -1
  68. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/connector-pod.js +1 -0
  69. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/index.d.ts +1 -0
  70. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/index.d.ts.map +1 -1
  71. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/index.js +3 -0
  72. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-batcher.d.ts +1 -0
  73. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-batcher.d.ts.map +1 -1
  74. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-batcher.js +341 -62
  75. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator.d.ts.map +1 -1
  76. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator.js +586 -132
  77. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/types.d.ts +9 -0
  78. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/types.d.ts.map +1 -1
  79. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.d.ts +20 -0
  80. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.d.ts.map +1 -0
  81. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.js +154 -0
  82. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod-refresh.d.ts +2 -0
  83. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod-refresh.d.ts.map +1 -1
  84. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod-refresh.js +1 -0
  85. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod.d.ts +2 -0
  86. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod.d.ts.map +1 -1
  87. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/manual-pod.js +1 -0
  88. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/repository-pod.d.ts +2 -0
  89. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/repository-pod.d.ts.map +1 -1
  90. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/repository-pod.js +1 -0
  91. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store.d.ts +2 -0
  92. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store.d.ts.map +1 -1
  93. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store.js +43 -1
  94. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
  95. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
  96. package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +5 -5
  97. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
  98. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
  99. package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
  100. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
  101. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
  102. package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
  103. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
  104. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
  105. package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
  106. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
  107. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
  108. package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
  109. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
  110. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
  111. package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
  112. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts +15 -2
  113. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts.map +1 -1
  114. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.js +147 -15
  115. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/http.d.ts +3 -0
  116. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/http.d.ts.map +1 -1
  117. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/http.js +188 -23
  118. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts +27 -0
  119. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts.map +1 -0
  120. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.js +180 -0
  121. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.d.ts +5 -0
  122. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.d.ts.map +1 -1
  123. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.js +286 -68
  124. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts +18 -5
  125. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts.map +1 -1
  126. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.js +141 -26
  127. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
  128. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
  129. package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +3 -3
  130. package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
  131. package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
  132. package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
  133. package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
  134. package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
  135. package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
  136. package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/syncService.d.ts.map +1 -1
  137. package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/syncService.js +4 -0
  138. package/node_modules/@oscharko-dev/keiko-server/dist/bounded-request-body.d.ts +1 -1
  139. package/node_modules/@oscharko-dev/keiko-server/dist/bounded-request-body.d.ts.map +1 -1
  140. package/node_modules/@oscharko-dev/keiko-server/dist/bounded-request-body.js +51 -3
  141. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts.map +1 -1
  142. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.js +77 -3
  143. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-instance-cache.d.ts.map +1 -1
  144. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-instance-cache.js +71 -11
  145. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts.map +1 -1
  146. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.js +9 -1
  147. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-qa.js +1 -1
  148. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-rerank-facade.d.ts.map +1 -1
  149. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-rerank-facade.js +37 -0
  150. package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts +1 -0
  151. package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts.map +1 -1
  152. package/node_modules/@oscharko-dev/keiko-server/dist/index.js +7 -0
  153. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-handlers.d.ts.map +1 -1
  154. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-handlers.js +158 -36
  155. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-remediation-store.d.ts.map +1 -1
  156. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-remediation-store.js +9 -1
  157. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-remediation.d.ts.map +1 -1
  158. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-remediation.js +10 -5
  159. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-store-open.d.ts.map +1 -1
  160. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-store-open.js +8 -2
  161. package/node_modules/@oscharko-dev/keiko-server/dist/manual/manual-pod-service.d.ts.map +1 -1
  162. package/node_modules/@oscharko-dev/keiko-server/dist/manual/manual-pod-service.js +3 -0
  163. package/node_modules/@oscharko-dev/keiko-server/dist/memory-embedding.d.ts.map +1 -1
  164. package/node_modules/@oscharko-dev/keiko-server/dist/memory-embedding.js +135 -36
  165. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.d.ts +3 -0
  166. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.d.ts.map +1 -0
  167. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.js +9 -0
  168. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-level.d.ts +13 -0
  169. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-level.d.ts.map +1 -0
  170. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-level.js +57 -0
  171. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-redaction.d.ts +20 -0
  172. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-redaction.d.ts.map +1 -0
  173. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-redaction.js +499 -0
  174. package/node_modules/@oscharko-dev/keiko-server/dist/observability/route-template.d.ts +4 -0
  175. package/node_modules/@oscharko-dev/keiko-server/dist/observability/route-template.d.ts.map +1 -0
  176. package/node_modules/@oscharko-dev/keiko-server/dist/observability/route-template.js +340 -0
  177. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts +49 -0
  178. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts.map +1 -0
  179. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.js +449 -0
  180. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.d.ts +36 -0
  181. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.d.ts.map +1 -0
  182. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.js +190 -0
  183. package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts +11 -0
  184. package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts.map +1 -0
  185. package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.js +48 -0
  186. package/node_modules/@oscharko-dev/keiko-server/dist/server.d.ts +2 -0
  187. package/node_modules/@oscharko-dev/keiko-server/dist/server.d.ts.map +1 -1
  188. package/node_modules/@oscharko-dev/keiko-server/dist/server.js +22 -4
  189. package/node_modules/@oscharko-dev/keiko-server/dist/store-handlers.d.ts.map +1 -1
  190. package/node_modules/@oscharko-dev/keiko-server/dist/store-handlers.js +7 -2
  191. package/node_modules/@oscharko-dev/keiko-server/package.json +21 -21
  192. package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
  193. package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
  194. package/node_modules/@oscharko-dev/keiko-tools/package.json +5 -5
  195. package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
  196. package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
  197. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
  198. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
  199. package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
  200. package/package.json +25 -25
  201. package/release-impact.catalog.json +55 -0
  202. package/vendor/{oscharko-dev-keiko-cli-0.3.14.tgz → oscharko-dev-keiko-cli-0.3.15.tgz} +0 -0
  203. package/vendor/{oscharko-dev-keiko-connectors-0.3.14.tgz → oscharko-dev-keiko-connectors-0.3.15.tgz} +0 -0
  204. package/vendor/{oscharko-dev-keiko-contracts-0.3.14.tgz → oscharko-dev-keiko-contracts-0.3.15.tgz} +0 -0
  205. package/vendor/{oscharko-dev-keiko-evaluations-0.3.14.tgz → oscharko-dev-keiko-evaluations-0.3.15.tgz} +0 -0
  206. package/vendor/{oscharko-dev-keiko-evidence-0.3.14.tgz → oscharko-dev-keiko-evidence-0.3.15.tgz} +0 -0
  207. package/vendor/{oscharko-dev-keiko-git-0.3.14.tgz → oscharko-dev-keiko-git-0.3.15.tgz} +0 -0
  208. package/vendor/{oscharko-dev-keiko-harness-0.3.14.tgz → oscharko-dev-keiko-harness-0.3.15.tgz} +0 -0
  209. package/vendor/oscharko-dev-keiko-local-knowledge-0.3.15.tgz +0 -0
  210. package/vendor/{oscharko-dev-keiko-memory-capture-0.3.14.tgz → oscharko-dev-keiko-memory-capture-0.3.15.tgz} +0 -0
  211. package/vendor/{oscharko-dev-keiko-memory-consolidation-0.3.14.tgz → oscharko-dev-keiko-memory-consolidation-0.3.15.tgz} +0 -0
  212. package/vendor/{oscharko-dev-keiko-memory-governance-0.3.14.tgz → oscharko-dev-keiko-memory-governance-0.3.15.tgz} +0 -0
  213. package/vendor/{oscharko-dev-keiko-memory-retrieval-0.3.14.tgz → oscharko-dev-keiko-memory-retrieval-0.3.15.tgz} +0 -0
  214. package/vendor/{oscharko-dev-keiko-memory-vault-0.3.14.tgz → oscharko-dev-keiko-memory-vault-0.3.15.tgz} +0 -0
  215. package/vendor/oscharko-dev-keiko-model-gateway-0.3.15.tgz +0 -0
  216. package/vendor/{oscharko-dev-keiko-quality-intelligence-0.3.14.tgz → oscharko-dev-keiko-quality-intelligence-0.3.15.tgz} +0 -0
  217. package/vendor/{oscharko-dev-keiko-sandbox-0.3.14.tgz → oscharko-dev-keiko-sandbox-0.3.15.tgz} +0 -0
  218. package/vendor/oscharko-dev-keiko-sdk-0.3.15.tgz +0 -0
  219. package/vendor/{oscharko-dev-keiko-security-0.3.14.tgz → oscharko-dev-keiko-security-0.3.15.tgz} +0 -0
  220. package/vendor/oscharko-dev-keiko-server-0.3.15.tgz +0 -0
  221. package/vendor/{oscharko-dev-keiko-tools-0.3.14.tgz → oscharko-dev-keiko-tools-0.3.15.tgz} +0 -0
  222. package/vendor/{oscharko-dev-keiko-verification-0.3.14.tgz → oscharko-dev-keiko-verification-0.3.15.tgz} +0 -0
  223. package/vendor/{oscharko-dev-keiko-workflows-0.3.14.tgz → oscharko-dev-keiko-workflows-0.3.15.tgz} +0 -0
  224. package/vendor/{oscharko-dev-keiko-workspace-0.3.14.tgz → oscharko-dev-keiko-workspace-0.3.15.tgz} +0 -0
  225. package/vendor/oscharko-dev-keiko-local-knowledge-0.3.14.tgz +0 -0
  226. package/vendor/oscharko-dev-keiko-model-gateway-0.3.14.tgz +0 -0
  227. package/vendor/oscharko-dev-keiko-sdk-0.3.14.tgz +0 -0
  228. package/vendor/oscharko-dev-keiko-server-0.3.14.tgz +0 -0
  229. /package/dist/ui/static/_next/static/{y54UtqSyUZo4acoo_2Vb4 → 4j3JDaPBERRu_ZIgeR1VQ}/_buildManifest.js +0 -0
  230. /package/dist/ui/static/_next/static/{y54UtqSyUZo4acoo_2Vb4 → 4j3JDaPBERRu_ZIgeR1VQ}/_clientMiddlewareManifest.js +0 -0
  231. /package/dist/ui/static/_next/static/{y54UtqSyUZo4acoo_2Vb4 → 4j3JDaPBERRu_ZIgeR1VQ}/_ssgManifest.js +0 -0
@@ -2,6 +2,7 @@
2
2
  // loop, and a per-(model,endpoint) circuit breaker. All time-dependent behaviour
3
3
  // flows through the injectable Clock so tests are deterministic and instant.
4
4
  import { CancelledError, CircuitOpenError, GatewayError, RateLimitError, } from "@oscharko-dev/keiko-security/errors/gateway";
5
+ import { logErrorKind, logLevelEnabled, logTimer, nullModelGatewayLogSink, resolveLogSink, } from "./observability.js";
5
6
  const MAX_BACKOFF_MS = 30_000;
6
7
  export const systemClock = {
7
8
  now: () => Date.now(),
@@ -88,17 +89,39 @@ async function sleepWithCancellation(clock, delayMs, signal) {
88
89
  }
89
90
  assertNotAborted(signal);
90
91
  }
91
- export async function executeWithRetry(operation, config, clock, signal, random = Math.random) {
92
+ function retryEvent(context, level, op, durationMs, error, extra) {
93
+ return {
94
+ level,
95
+ category: "gateway",
96
+ op,
97
+ correlationId: context.correlationId,
98
+ durationMs,
99
+ errorKind: error === undefined ? undefined : logErrorKind(error),
100
+ extra: { modelId: context.modelId, ...extra },
101
+ };
102
+ }
103
+ // The budget ran out BEFORE an attempt was made. Preserves the original throw exactly (the last
104
+ // provider error when there is one, a CancelledError otherwise) and only adds the line that says
105
+ // which of the two happened — the difference between "the provider kept failing" and "the caller's
106
+ // deadline was already spent" is invisible from the thrown error alone.
107
+ function budgetExhaustedError(lastError, sink, context, attempt, durationMs) {
108
+ const error = lastError ?? new CancelledError("request timeout budget exhausted before provider call");
109
+ sink.write(retryEvent(context, "warn", "gateway.retry.budget-exhausted", durationMs, error, {
110
+ attempt,
111
+ hadPriorFailure: lastError !== undefined,
112
+ }));
113
+ return error;
114
+ }
115
+ export async function executeWithRetry(operation, config, clock, signal, random = Math.random, logContext = {}) {
116
+ const sink = resolveLogSink(logContext.sink);
117
+ const elapsed = logTimer();
92
118
  let lastError;
93
119
  const start = clock.now();
94
120
  for (let attempt = 1; attempt <= config.maxRetries + 1; attempt += 1) {
95
121
  assertNotAborted(signal);
96
122
  const attemptBudget = remainingBudgetMs(start, config.timeoutMs, clock);
97
123
  if (attemptBudget <= 0) {
98
- if (lastError) {
99
- throw lastError;
100
- }
101
- throw new CancelledError("request timeout budget exhausted before provider call");
124
+ throw budgetExhaustedError(lastError, sink, logContext, attempt, elapsed());
102
125
  }
103
126
  try {
104
127
  return await operation(Number.isFinite(attemptBudget) ? Math.max(1, Math.floor(attemptBudget)) : undefined);
@@ -107,8 +130,17 @@ export async function executeWithRetry(operation, config, clock, signal, random
107
130
  lastError = asError(error);
108
131
  const sleepMs = boundedRetrySleepMs(lastError, attempt, config, clock, start, random);
109
132
  if (sleepMs === null) {
133
+ sink.write(retryEvent(logContext, "warn", "gateway.retry.exhausted", elapsed(), lastError, {
134
+ attempt,
135
+ maxRetries: config.maxRetries,
136
+ }));
110
137
  throw lastError;
111
138
  }
139
+ sink.write(retryEvent(logContext, "warn", "gateway.retry.scheduled", elapsed(), lastError, {
140
+ attempt,
141
+ maxRetries: config.maxRetries,
142
+ delayMs: sleepMs,
143
+ }));
112
144
  await sleepWithCancellation(clock, sleepMs, signal);
113
145
  }
114
146
  }
@@ -118,60 +150,127 @@ export class CircuitBreaker {
118
150
  modelId;
119
151
  config;
120
152
  clock;
153
+ log;
121
154
  state = "closed";
122
155
  consecutiveFailures = 0;
123
156
  openedAt = null;
124
157
  probesRemaining = 0;
125
158
  // Tracks how many half-open probe slots are currently in-flight.
126
159
  probesInFlight = 0;
127
- constructor(modelId, config, clock) {
160
+ // Calls refused since the last state change. See `noteRejection` — this is both the rate limiter
161
+ // and the number the transition lines report, so the volume survives the demotion.
162
+ rejectedSinceTransition = 0;
163
+ constructor(modelId, config, clock, log = nullModelGatewayLogSink) {
128
164
  this.modelId = modelId;
129
165
  this.config = config;
130
166
  this.clock = clock;
167
+ this.log = log;
168
+ }
169
+ // Every state transition and every fail-closed rejection is a line. A breaker that opens and
170
+ // stays open is otherwise indistinguishable, from the outside, from a provider that has simply
171
+ // gone quiet: the caller sees CircuitOpenError either way and no attempt ever reaches the wire.
172
+ //
173
+ // `correlationId` is the CALL that provoked the line, when there is one. A breaker is shared by
174
+ // every caller of a model, so a refusal line without it says "some request was refused" — which,
175
+ // with N requests in flight against one endpoint, does not tell an operator which of them is the
176
+ // one that never came back. The state transitions reached from a completed call
177
+ // (`open`/`closed`) are facts about the MODEL rather than about one request, and carry the id of
178
+ // the call that tipped them purely as the attribution of the trigger.
179
+ emit(level, op, extra, correlationId) {
180
+ this.log.write({
181
+ level,
182
+ category: "gateway",
183
+ op,
184
+ correlationId,
185
+ extra: { modelId: this.modelId, ...extra },
186
+ });
187
+ }
188
+ // A refused call is the highest-volume, lowest-information event this class produces: while the
189
+ // breaker is open EVERY caller is refused, so a busy model under a provider outage turns one
190
+ // fact — "the breaker for model X is open" — into thousands of identical `warn` lines, drowning
191
+ // the transitions that actually carry news and pushing the lines before the outage out of the
192
+ // retention window. That is worse than saying nothing: the log is loudest exactly when it is
193
+ // least informative.
194
+ //
195
+ // So the FIRST refusal after each transition is reported at `warn` — an operator reading at the
196
+ // default threshold still learns, once, that calls are being refused and why — and every
197
+ // subsequent one is demoted to `debug` and counted. The count rides the next transition line
198
+ // (`rejectedSinceTransition`), so nothing is lost: the volume is still reported, once, as a
199
+ // number instead of as thousands of lines. The `logLevelEnabled` guard means a demoted refusal
200
+ // costs a predicate call and an increment, not an allocation, when nobody is reading `debug`.
201
+ noteRejection(state, reason, correlationId) {
202
+ this.rejectedSinceTransition += 1;
203
+ const first = this.rejectedSinceTransition === 1;
204
+ if (!first && !logLevelEnabled(this.log, "debug"))
205
+ return;
206
+ this.emit(first ? "warn" : "debug", "gateway.circuit.rejected", {
207
+ state,
208
+ reason,
209
+ probesInFlight: this.probesInFlight,
210
+ rejectedSinceTransition: this.rejectedSinceTransition,
211
+ }, correlationId);
212
+ }
213
+ // Returns the refusal count accumulated since the last transition and resets it, so every
214
+ // transition line carries the volume of the window it is ending.
215
+ takeRejectedCount() {
216
+ const rejected = this.rejectedSinceTransition;
217
+ this.rejectedSinceTransition = 0;
218
+ return rejected;
131
219
  }
132
220
  // Called before forwarding a request. Throws CircuitOpenError when the breaker is
133
221
  // open and the cooldown has not elapsed; otherwise lets the call through (entering
134
222
  // half-open as a side effect when cooldown has passed).
135
223
  // In half-open, at most config.halfOpenProbes concurrent probes are admitted; excess
136
224
  // callers receive CircuitOpenError until a probe slot is freed by recordSuccess/Failure.
137
- assertAllowed() {
225
+ assertAllowed(correlationId) {
138
226
  if (this.state === "open") {
139
- if (this.openedAt !== null && this.clock.now() - this.openedAt >= this.config.cooldownMs) {
140
- this.state = "half-open";
141
- this.probesRemaining = this.config.halfOpenProbes;
142
- this.probesInFlight = 0;
143
- }
144
- else {
145
- throw new CircuitOpenError(`circuit open for model '${this.modelId}'`);
146
- }
227
+ this.enterHalfOpenOrReject(correlationId);
147
228
  }
148
229
  if (this.state === "half-open") {
149
- if (this.probesInFlight >= this.config.halfOpenProbes) {
150
- throw new CircuitOpenError(`circuit half-open for model '${this.modelId}'`);
151
- }
152
- this.probesInFlight += 1;
230
+ this.admitProbeOrReject(correlationId);
153
231
  }
154
232
  }
155
- recordSuccess() {
233
+ enterHalfOpenOrReject(correlationId) {
234
+ if (this.openedAt !== null && this.clock.now() - this.openedAt >= this.config.cooldownMs) {
235
+ this.state = "half-open";
236
+ this.probesRemaining = this.config.halfOpenProbes;
237
+ this.probesInFlight = 0;
238
+ this.emit("info", "gateway.circuit.half-open", {
239
+ probes: this.config.halfOpenProbes,
240
+ rejectedWhileOpen: this.takeRejectedCount(),
241
+ }, correlationId);
242
+ return;
243
+ }
244
+ this.noteRejection("open", "cooldown", correlationId);
245
+ throw new CircuitOpenError(`circuit open for model '${this.modelId}'`);
246
+ }
247
+ admitProbeOrReject(correlationId) {
248
+ if (this.probesInFlight >= this.config.halfOpenProbes) {
249
+ this.noteRejection("half-open", "probe-saturated", correlationId);
250
+ throw new CircuitOpenError(`circuit half-open for model '${this.modelId}'`);
251
+ }
252
+ this.probesInFlight += 1;
253
+ }
254
+ recordSuccess(correlationId) {
156
255
  if (this.state === "half-open") {
157
256
  this.probesInFlight = Math.max(0, this.probesInFlight - 1);
158
257
  this.probesRemaining -= 1;
159
258
  if (this.probesRemaining <= 0) {
160
- this.close();
259
+ this.close(correlationId);
161
260
  }
162
261
  return;
163
262
  }
164
263
  this.consecutiveFailures = 0;
165
264
  }
166
- recordFailure() {
265
+ recordFailure(correlationId) {
167
266
  if (this.state === "half-open") {
168
267
  this.probesInFlight = Math.max(0, this.probesInFlight - 1);
169
- this.open();
268
+ this.open(correlationId);
170
269
  return;
171
270
  }
172
271
  this.consecutiveFailures += 1;
173
272
  if (this.consecutiveFailures >= this.config.failureThreshold) {
174
- this.open();
273
+ this.open(correlationId);
175
274
  }
176
275
  }
177
276
  status(modelId) {
@@ -182,17 +281,33 @@ export class CircuitBreaker {
182
281
  openedAt: this.openedAt,
183
282
  };
184
283
  }
185
- open() {
284
+ // The transitions are the news, and they are rare — one per outage, not one per call. `opened`
285
+ // stays `warn` because it is the moment the model stopped serving traffic; `half-open` and
286
+ // `closed` are recoveries and stay `info`, where a recovery belongs. Each one carries the
287
+ // refusals its window absorbed, which is the number the demoted per-call lines no longer report.
288
+ open(correlationId) {
289
+ const previousState = this.state;
186
290
  this.state = "open";
187
291
  this.openedAt = this.clock.now();
188
292
  this.probesRemaining = 0;
189
293
  this.probesInFlight = 0;
294
+ this.emit("warn", "gateway.circuit.opened", {
295
+ previousState,
296
+ consecutiveFailures: this.consecutiveFailures,
297
+ cooldownMs: this.config.cooldownMs,
298
+ rejectedSincePreviousTransition: this.takeRejectedCount(),
299
+ }, correlationId);
190
300
  }
191
- close() {
301
+ close(correlationId) {
302
+ const previousState = this.state;
192
303
  this.state = "closed";
193
304
  this.consecutiveFailures = 0;
194
305
  this.openedAt = null;
195
306
  this.probesRemaining = 0;
196
307
  this.probesInFlight = 0;
308
+ this.emit("info", "gateway.circuit.closed", {
309
+ previousState,
310
+ rejectedSincePreviousTransition: this.takeRejectedCount(),
311
+ }, correlationId);
197
312
  }
198
313
  }
@@ -1,2 +1,2 @@
1
- export declare const KEIKO_MODEL_GATEWAY_VERSION: "0.3.14";
1
+ export declare const KEIKO_MODEL_GATEWAY_VERSION: "0.3.15";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Package version constant. Pinned at the workspace package's package.json version. Promoted to
2
2
  // a `const` string-literal type so downstream tests/assertions stay byte-exact.
3
- export const KEIKO_MODEL_GATEWAY_VERSION = "0.3.14";
3
+ export const KEIKO_MODEL_GATEWAY_VERSION = "0.3.15";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscharko-dev/keiko-model-gateway",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Internal workspace package: Keiko model gateway — provider abstraction, OpenAI-compatible adapter, capability registry, routing, resilience, TLS handling. Not published independently.",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "private": true,
31
31
  "peerDependencies": {
32
- "@oscharko-dev/keiko-contracts": "0.3.14",
33
- "@oscharko-dev/keiko-security": "0.3.14"
32
+ "@oscharko-dev/keiko-contracts": "0.3.15",
33
+ "@oscharko-dev/keiko-security": "0.3.15"
34
34
  }
35
35
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscharko-dev/keiko-quality-intelligence",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Internal workspace package: pure-domain Keiko Quality Intelligence test-design logic. Not published independently.",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "private": true,
23
23
  "peerDependencies": {
24
- "@oscharko-dev/keiko-contracts": "0.3.14",
25
- "@oscharko-dev/keiko-security": "0.3.14"
24
+ "@oscharko-dev/keiko-contracts": "0.3.15",
25
+ "@oscharko-dev/keiko-security": "0.3.15"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscharko-dev/keiko-sandbox",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Internal sandbox package: the reusable OS/container egress-isolation strategy (ADR-0043). Pure backend-wrapper builders + selection + attestation, with a thin availability probe. Spawning stays in keiko-tools; this package only decides how a `network: \"none\"` command is wrapped so an outbound connection from the child fails. Not published independently.",
@@ -21,6 +21,6 @@
21
21
  },
22
22
  "private": true,
23
23
  "peerDependencies": {
24
- "@oscharko-dev/keiko-contracts": "0.3.14"
24
+ "@oscharko-dev/keiko-contracts": "0.3.15"
25
25
  }
26
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscharko-dev/keiko-sdk",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Internal SDK package: public agent, workflow, verification, workspace, evidence, and evaluation surface that the root product facade re-exports (Issue #426, ADR-0019). Not published independently.",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "private": true,
23
23
  "peerDependencies": {
24
- "@oscharko-dev/keiko-contracts": "0.3.14",
25
- "@oscharko-dev/keiko-evaluations": "0.3.14",
26
- "@oscharko-dev/keiko-evidence": "0.3.14",
27
- "@oscharko-dev/keiko-harness": "0.3.14",
28
- "@oscharko-dev/keiko-model-gateway": "0.3.14",
29
- "@oscharko-dev/keiko-verification": "0.3.14",
30
- "@oscharko-dev/keiko-workflows": "0.3.14",
31
- "@oscharko-dev/keiko-workspace": "0.3.14"
24
+ "@oscharko-dev/keiko-contracts": "0.3.15",
25
+ "@oscharko-dev/keiko-evaluations": "0.3.15",
26
+ "@oscharko-dev/keiko-evidence": "0.3.15",
27
+ "@oscharko-dev/keiko-harness": "0.3.15",
28
+ "@oscharko-dev/keiko-model-gateway": "0.3.15",
29
+ "@oscharko-dev/keiko-verification": "0.3.15",
30
+ "@oscharko-dev/keiko-workflows": "0.3.15",
31
+ "@oscharko-dev/keiko-workspace": "0.3.15"
32
32
  }
33
33
  }
@@ -1,2 +1,2 @@
1
- export declare const KEIKO_SECURITY_VERSION: "0.3.14";
1
+ export declare const KEIKO_SECURITY_VERSION: "0.3.15";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Version anchor for @oscharko-dev/keiko-security. Pinned to the package's package.json version.
2
2
  // Lets consumers assert which security primitive contract they linked against (ADR-0019 leaf-package
3
3
  // pattern, mirroring @oscharko-dev/keiko-contracts).
4
- export const KEIKO_SECURITY_VERSION = "0.3.14";
4
+ export const KEIKO_SECURITY_VERSION = "0.3.15";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscharko-dev/keiko-security",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Internal workspace package: shared Keiko security primitives (redaction, safe error shaping, secret collection, content hashing, trust-boundary helpers). Not published independently.",
@@ -85,6 +85,6 @@
85
85
  },
86
86
  "private": true,
87
87
  "peerDependencies": {
88
- "@oscharko-dev/keiko-contracts": "0.3.14"
88
+ "@oscharko-dev/keiko-contracts": "0.3.15"
89
89
  }
90
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"syncService.d.ts","sourceRoot":"","sources":["../../src/atlassian/syncService.ts"],"names":[],"mappings":"AAyBA,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAK3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAKL,KAAK,mCAAmC,EAExC,KAAK,oCAAoC,EACzC,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAG/B,KAAK,qBAAqB,EAE1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AAcvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAchD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D;AAGD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,kBAAkB,GAAG,iBAAiB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AG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;CACxC;AAkfD,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,uBAAuB,EAC9B,YAAY,EAAE,qBAAqB,GAClC,OAAO,CAAC,wBAAwB,CAAC,CAkCnC"}
@@ -27,6 +27,7 @@ import { ATLASSIAN_CONNECTOR_AUTH_REF_PREFIX, ATLASSIAN_CONNECTOR_HUMAN_INITIATI
27
27
  import { applyConnectorSyncRun, createConnectorPodShell, createDefaultParserRegistry, getCapsule, readConnectorItemFingerprints, recordUnappliedConnectorSyncRun, requireConnectorSourceMetadata, } from "@oscharko-dev/keiko-local-knowledge";
28
28
  import { emitServerDiagnostic, serverDiagnosticFromError } from "../diagnostics-log.js";
29
29
  import { openKnowledgeStoreForDeps } from "../local-knowledge-store-open.js";
30
+ import { processServerLogSink } from "../process-log-sink.js";
30
31
  import { configuredProviderForCapsule, localKnowledgeEmbeddingAdapterForProvider, resolveNewCapsuleEmbeddingIdentity, } from "../local-knowledge-handlers.js";
31
32
  const ACTIVITY_RING_LIMIT = 200;
32
33
  // The connector identity a pod is keyed by: derived from the credential's opaque authRef so it is
@@ -309,6 +310,9 @@ async function applyCompletedOutcome(context, store, outcome) {
309
310
  parserRegistry: createDefaultParserRegistry(),
310
311
  embeddingAdapter: localKnowledgeEmbeddingAdapterForProvider(context.deps, provider),
311
312
  signal: context.job.controller.signal,
313
+ // Connector pods index through the same orchestrator as folder pods; without this sink a
314
+ // connector sync is silent even though the folder lane writes a full spine.
315
+ logSink: processServerLogSink(),
312
316
  now: context.now,
313
317
  }, {
314
318
  runId: context.job.jobId,
@@ -5,5 +5,5 @@ export declare class RequestBodyTooLargeError extends Error {
5
5
  export declare class RequestBodyCancelledError extends Error {
6
6
  constructor();
7
7
  }
8
- export declare function readBoundedRequestBody(req: IncomingMessage, maxBytes: number, signal?: AbortSignal): Promise<string>;
8
+ export declare function readBoundedRequestBody(req: IncomingMessage, maxBytes: number, signal?: AbortSignal, correlationId?: string): Promise<string>;
9
9
  //# sourceMappingURL=bounded-request-body.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-request-body.d.ts","sourceRoot":"","sources":["../src/bounded-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,cAGC;CACF;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,cAGC;CACF;AA+GD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,CAIjB"}
1
+ {"version":3,"file":"bounded-request-body.d.ts","sourceRoot":"","sources":["../src/bounded-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,cAGC;CACF;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,cAGC;CACF;AA6KD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,EAIpB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAIjB"}
@@ -1,3 +1,4 @@
1
+ import { errorKindOf, getServerLogger } from "./observability/index.js";
1
2
  export class RequestBodyTooLargeError extends Error {
2
3
  constructor() {
3
4
  super("request body too large");
@@ -39,22 +40,56 @@ function retainTerminalErrorSink(req) {
39
40
  function requestAlreadyTerminated(req) {
40
41
  return req.readableAborted || req.destroyed || req.closed;
41
42
  }
43
+ function logBodyRejected(correlationId, fields) {
44
+ getServerLogger().warn({
45
+ category: "http",
46
+ op: "http.request.body.rejected",
47
+ ...(correlationId === undefined ? {} : { correlationId }),
48
+ errorKind: "RequestBodyTooLargeError",
49
+ extra: { ...fields, reason: "limit-exceeded" },
50
+ });
51
+ }
52
+ function logBodyCancelled(correlationId, fields) {
53
+ // A client that disconnects mid-upload is routine, not a fault: it stays at debug so a busy
54
+ // server does not fill the log with it, while still being available when a stall is investigated.
55
+ getServerLogger().debug(() => ({
56
+ category: "http",
57
+ op: "http.request.body.cancelled",
58
+ ...(correlationId === undefined ? {} : { correlationId }),
59
+ errorKind: "RequestBodyCancelledError",
60
+ extra: { ...fields },
61
+ }));
62
+ }
63
+ function logBodyFailed(correlationId, fields, error) {
64
+ getServerLogger().warn({
65
+ category: "http",
66
+ op: "http.request.body.failed",
67
+ ...(correlationId === undefined ? {} : { correlationId }),
68
+ errorKind: errorKindOf(error),
69
+ extra: { ...fields },
70
+ });
71
+ }
42
72
  class BoundedRequestBodyReader {
43
73
  req;
44
74
  maxBytes;
45
75
  signal;
76
+ correlationId;
46
77
  resolve;
47
78
  reject;
48
79
  chunks = [];
49
80
  total = 0;
50
81
  settled = false;
51
- constructor(req, maxBytes, signal, resolve, reject) {
82
+ constructor(req, maxBytes, signal, correlationId, resolve, reject) {
52
83
  this.req = req;
53
84
  this.maxBytes = maxBytes;
54
85
  this.signal = signal;
86
+ this.correlationId = correlationId;
55
87
  this.resolve = resolve;
56
88
  this.reject = reject;
57
89
  }
90
+ get outcomeFields() {
91
+ return { maxBytes: this.maxBytes, receivedBytes: this.total };
92
+ }
58
93
  start() {
59
94
  this.signal?.addEventListener("abort", this.onCancellation, { once: true });
60
95
  attachRequestBodyListeners(this.req, {
@@ -91,6 +126,11 @@ class BoundedRequestBodyReader {
91
126
  const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
92
127
  this.total += buffer.length;
93
128
  if (this.total > this.maxBytes) {
129
+ // Fail closed on the size boundary. The line is emitted before `rejectOnce` clears the
130
+ // accumulated chunks so `receivedBytes` still reports what was actually observed, and only
131
+ // when this call is the one that settles the read — a late queued event must not log twice.
132
+ if (!this.settled)
133
+ logBodyRejected(this.correlationId, this.outcomeFields);
94
134
  this.rejectOnce(new RequestBodyTooLargeError(), true, true);
95
135
  return;
96
136
  }
@@ -104,14 +144,22 @@ class BoundedRequestBodyReader {
104
144
  this.resolve(Buffer.concat(this.chunks).toString("utf8"));
105
145
  };
106
146
  onCancellation = () => {
147
+ if (!this.settled)
148
+ logBodyCancelled(this.correlationId, this.outcomeFields);
107
149
  this.rejectOnce(new RequestBodyCancelledError(), true, true);
108
150
  };
109
151
  onRequestError = (error) => {
152
+ if (!this.settled)
153
+ logBodyFailed(this.correlationId, this.outcomeFields, error);
110
154
  this.rejectOnce(error, false, true);
111
155
  };
112
156
  }
113
- export function readBoundedRequestBody(req, maxBytes, signal) {
157
+ export function readBoundedRequestBody(req, maxBytes, signal,
158
+ // RB-6 continuity: when the caller already holds the request-scoped correlation id, the
159
+ // fail-closed rejection below is traceable to the same request as the 4xx the caller returns.
160
+ // Optional because most callers read the body from a helper that never received the RouteContext.
161
+ correlationId) {
114
162
  return new Promise((resolve, reject) => {
115
- new BoundedRequestBodyReader(req, maxBytes, signal, resolve, reject).start();
163
+ new BoundedRequestBodyReader(req, maxBytes, signal, correlationId, resolve, reject).start();
116
164
  });
117
165
  }
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics-log.d.ts","sourceRoot":"","sources":["../src/diagnostics-log.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB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gB,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACpF,CAOA;AAiCD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAW5D;AAsFD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,oBAAoB,GAAG,SAAS,EACtC,MAAM,EAAE,sBAAsB,GAC7B,IAAI,CAMN;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,oBAAoB,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,IAAI,CAUN;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,oBAAoB,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,GACb,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAEnC;AAID,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAEvD,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B,GAAG,sBAAsB,CAoBzB"}
@@ -1,3 +1,4 @@
1
+ import { createFileServerLogSink } from "./observability/server-log.js";
1
2
  // Server-side operator diagnostics sink (RB-6 / GEN-OBS-DIAGNOSTICS-901/602/603, STATUS-403).
2
3
  //
3
4
  // Before this module the top-level route-error catch, the buffered-send rethrow, and the streamed
@@ -7,15 +8,88 @@
7
8
  // correlation-keyed operator record. It never surfaces raw content to the browser; the response body
8
9
  // stays opaque and the record is emitted only to the server's own diagnostic channel.
9
10
  import { randomUUID } from "node:crypto";
10
- // The default sink writes one structured JSON line to stderr. It is intentionally the only place in
11
- // the server request path that logs, so operators get a diagnosable trail without the browser ever
12
- // seeing raw content. Tests inject a capturing sink instead (via UiHandlerDeps.diagnostics).
11
+ // The default sink writes one structured JSON line to stderr AND — when the server is running
12
+ // under the CLI (KEIKO_STATE_DIR is set) — appends the same record to `<stateDir>/logs/server.log`.
13
+ // The two-track design is deliberate: unit tests that capture the sink via UiHandlerDeps.diagnostics
14
+ // keep observing stderr, while the shipped server writes a file the operator can read directly.
13
15
  export const defaultServerDiagnosticSink = {
14
16
  record(record) {
15
17
  // eslint-disable-next-line no-console
16
18
  console.error(`[keiko-server:diagnostic] ${JSON.stringify(record)}`);
19
+ appendDiagnosticToActivityLog(record);
17
20
  },
18
21
  };
22
+ // Omits an absent value rather than writing it as `null`; see the projection contract below.
23
+ function addBoundedField(fields, name, value) {
24
+ if (value !== undefined)
25
+ fields[name] = value;
26
+ }
27
+ // A diagnostic record is a CALLER-SUPPLIED object, so handing it to the activity log whole
28
+ // (`extra: { record }`) made every field of it — including every field added to the type later —
29
+ // a log field by default, and made the log's value guards the only thing standing between a
30
+ // future producer and a leaked value. The record is PROJECTED onto the fields an operator reads
31
+ // instead: counts, codes, hashes and labels, each named here in code. Anything not on this list
32
+ // never reaches the file, whatever a producer puts on the record.
33
+ //
34
+ // `message` is deliberately absent — it is a code-declared summary the line does not need, and it
35
+ // is the one field on the record shaped like prose. `timestamp` is absent because the line already
36
+ // carries `ts`; `correlationId`, `operation` and `errorClass` ride on the envelope.
37
+ function diagnosticActivityLogFields(record) {
38
+ const fields = { source: record.source };
39
+ addBoundedField(fields, "code", record.code);
40
+ addBoundedField(fields, "gatewayRequestId", record.gatewayRequestId);
41
+ addBoundedField(fields, "occurrenceCount", record.occurrenceCount);
42
+ addBoundedField(fields, "frameBytes", record.frameBytes);
43
+ addBoundedField(fields, "retainedModelCount", record.retainedModelCount);
44
+ addBoundedField(fields, "unsupportedModelCount", record.unsupportedModelCount);
45
+ addBoundedField(fields, "unverifiedEmbeddingModelCount", record.unverifiedEmbeddingModelCount);
46
+ addBoundedField(fields, "droppedEmbeddingModelCount", record.droppedEmbeddingModelCount);
47
+ if (record.unsupportedReasons !== undefined) {
48
+ fields.unsupportedReasons = [...record.unsupportedReasons];
49
+ }
50
+ if (record.partialUsage !== undefined) {
51
+ fields.promptTokens = record.partialUsage.promptTokens;
52
+ fields.completionTokens = record.partialUsage.completionTokens;
53
+ }
54
+ return fields;
55
+ }
56
+ let activityLogTarget = null;
57
+ function buildActivityLogTarget(stateDir) {
58
+ if (stateDir === "") {
59
+ return {
60
+ stateDir,
61
+ write: () => {
62
+ // No state directory: writes stay stderr-only.
63
+ },
64
+ };
65
+ }
66
+ const sink = createFileServerLogSink(stateDir);
67
+ return {
68
+ stateDir,
69
+ write: (record) => {
70
+ // Every record that reaches this sink is a FAILURE record — it carries an errorClass and a
71
+ // failure summary. Without an explicit level the line defaults to `info`, so
72
+ // `KEIKO_LOG_LEVEL=warn` would drop exactly the evidence an operator raised the threshold to
73
+ // isolate. `error` also matches what the server logger stamps on `category: "diagnostic"`
74
+ // lines, so both diagnostic paths land on the file at the same level.
75
+ sink.write({
76
+ level: "error",
77
+ category: "diagnostic",
78
+ op: record.operation,
79
+ correlationId: record.correlationId,
80
+ errorKind: record.errorClass,
81
+ extra: diagnosticActivityLogFields(record),
82
+ });
83
+ },
84
+ };
85
+ }
86
+ function appendDiagnosticToActivityLog(record) {
87
+ const stateDir = process.env.KEIKO_STATE_DIR ?? "";
88
+ if (activityLogTarget?.stateDir !== stateDir) {
89
+ activityLogTarget = buildActivityLogTarget(stateDir);
90
+ }
91
+ activityLogTarget.write(record);
92
+ }
19
93
  export const DEFAULT_SERVER_DIAGNOSTIC_SUMMARY = "server-operation-failed";
20
94
  // Compatibility summaries are accepted only by exact match. Existing producers may still supply
21
95
  // the historical `redact` callback, but it receives only DEFAULT_SERVER_DIAGNOSTIC_SUMMARY; it is
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-instance-cache.d.ts","sourceRoot":"","sources":["../src/gateway-instance-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,WAAW,0BAA0B;IACzC,OAAO,IAAI,aAAa,GAAG,SAAS,CAAC;IACrC,UAAU,IAAI,MAAM,CAAC;CACtB;AAoDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAE/D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,GAAG,SAAS,CAE/F;AAED,4FAA4F;AAC5F,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}
1
+ {"version":3,"file":"gateway-instance-cache.d.ts","sourceRoot":"","sources":["../src/gateway-instance-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAehF,MAAM,WAAW,0BAA0B;IACzC,OAAO,IAAI,aAAa,GAAG,SAAS,CAAC;IACrC,UAAU,IAAI,MAAM,CAAC;CACtB;AAoHD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAE/D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,GAAG,SAAS,CAE/F;AAED,4FAA4F;AAC5F,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}