@noodleseed/one 0.126.0 → 0.127.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 (209) hide show
  1. package/dist/commands/knowledge.d.ts.map +1 -1
  2. package/dist/commands/knowledge.js +27 -9
  3. package/dist/commands/knowledge.js.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +1 -1
  9. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
  10. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
  11. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
  12. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  13. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +4 -0
  14. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  15. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.d.ts.map +1 -1
  16. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +4 -2
  17. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
  18. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -1
  19. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +2 -0
  20. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
  21. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  22. package/node_modules/@noodle-borg/authoring/dist/index.d.ts +1 -1
  23. package/node_modules/@noodle-borg/authoring/dist/index.d.ts.map +1 -1
  24. package/node_modules/@noodle-borg/authoring/dist/index.js +1 -1
  25. package/node_modules/@noodle-borg/authoring/dist/index.js.map +1 -1
  26. package/node_modules/@noodle-borg/authoring/dist/knowledge.d.ts +66 -2
  27. package/node_modules/@noodle-borg/authoring/dist/knowledge.d.ts.map +1 -1
  28. package/node_modules/@noodle-borg/authoring/dist/knowledge.js +54 -2
  29. package/node_modules/@noodle-borg/authoring/dist/knowledge.js.map +1 -1
  30. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-hosted-observability.d.ts.map +1 -1
  31. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-hosted-observability.js +17 -1
  32. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-hosted-observability.js.map +1 -1
  33. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +58 -0
  34. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  35. package/node_modules/@noodle-borg/knowledge/dist/algolia-index.d.ts +30 -0
  36. package/node_modules/@noodle-borg/knowledge/dist/algolia-index.d.ts.map +1 -0
  37. package/node_modules/@noodle-borg/knowledge/dist/algolia-index.js +141 -0
  38. package/node_modules/@noodle-borg/knowledge/dist/algolia-index.js.map +1 -0
  39. package/node_modules/@noodle-borg/knowledge/dist/compile.d.ts +4 -0
  40. package/node_modules/@noodle-borg/knowledge/dist/compile.d.ts.map +1 -1
  41. package/node_modules/@noodle-borg/knowledge/dist/compile.js +3 -0
  42. package/node_modules/@noodle-borg/knowledge/dist/compile.js.map +1 -1
  43. package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.d.ts +2 -15
  44. package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.d.ts.map +1 -1
  45. package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.js +0 -59
  46. package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.js.map +1 -1
  47. package/node_modules/@noodle-borg/knowledge/dist/index.d.ts +2 -0
  48. package/node_modules/@noodle-borg/knowledge/dist/index.d.ts.map +1 -1
  49. package/node_modules/@noodle-borg/knowledge/dist/index.js +2 -0
  50. package/node_modules/@noodle-borg/knowledge/dist/index.js.map +1 -1
  51. package/node_modules/@noodle-borg/knowledge/dist/limits.d.ts +6 -0
  52. package/node_modules/@noodle-borg/knowledge/dist/limits.d.ts.map +1 -1
  53. package/node_modules/@noodle-borg/knowledge/dist/limits.js +6 -0
  54. package/node_modules/@noodle-borg/knowledge/dist/limits.js.map +1 -1
  55. package/node_modules/@noodle-borg/knowledge/dist/manifest-schema.d.ts +58 -0
  56. package/node_modules/@noodle-borg/knowledge/dist/manifest-schema.d.ts.map +1 -1
  57. package/node_modules/@noodle-borg/knowledge/dist/manifest-schema.js +28 -0
  58. package/node_modules/@noodle-borg/knowledge/dist/manifest-schema.js.map +1 -1
  59. package/node_modules/@noodle-borg/knowledge/dist/meilisearch-index.d.ts +33 -0
  60. package/node_modules/@noodle-borg/knowledge/dist/meilisearch-index.d.ts.map +1 -0
  61. package/node_modules/@noodle-borg/knowledge/dist/meilisearch-index.js +153 -0
  62. package/node_modules/@noodle-borg/knowledge/dist/meilisearch-index.js.map +1 -0
  63. package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.d.ts +1 -0
  64. package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.d.ts.map +1 -1
  65. package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.js +3 -0
  66. package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.js.map +1 -1
  67. package/node_modules/@noodle-borg/knowledge/dist/provider-index-shared.d.ts +19 -0
  68. package/node_modules/@noodle-borg/knowledge/dist/provider-index-shared.d.ts.map +1 -0
  69. package/node_modules/@noodle-borg/knowledge/dist/provider-index-shared.js +47 -0
  70. package/node_modules/@noodle-borg/knowledge/dist/provider-index-shared.js.map +1 -0
  71. package/node_modules/@noodle-borg/knowledge/dist/revision-store.d.ts +7 -0
  72. package/node_modules/@noodle-borg/knowledge/dist/revision-store.d.ts.map +1 -1
  73. package/node_modules/@noodle-borg/knowledge/dist/revision-store.js +4 -0
  74. package/node_modules/@noodle-borg/knowledge/dist/revision-store.js.map +1 -1
  75. package/node_modules/@noodle-borg/knowledge-crawl/dist/bounds.d.ts +3 -0
  76. package/node_modules/@noodle-borg/knowledge-crawl/dist/bounds.d.ts.map +1 -0
  77. package/node_modules/@noodle-borg/knowledge-crawl/dist/bounds.js +30 -0
  78. package/node_modules/@noodle-borg/knowledge-crawl/dist/bounds.js.map +1 -0
  79. package/node_modules/@noodle-borg/knowledge-crawl/dist/firecrawl.d.ts +13 -0
  80. package/node_modules/@noodle-borg/knowledge-crawl/dist/firecrawl.d.ts.map +1 -0
  81. package/node_modules/@noodle-borg/knowledge-crawl/dist/firecrawl.js +90 -0
  82. package/node_modules/@noodle-borg/knowledge-crawl/dist/firecrawl.js.map +1 -0
  83. package/node_modules/@noodle-borg/knowledge-crawl/dist/first-party.d.ts +11 -0
  84. package/node_modules/@noodle-borg/knowledge-crawl/dist/first-party.d.ts.map +1 -0
  85. package/node_modules/@noodle-borg/knowledge-crawl/dist/first-party.js +108 -0
  86. package/node_modules/@noodle-borg/knowledge-crawl/dist/first-party.js.map +1 -0
  87. package/node_modules/@noodle-borg/knowledge-crawl/dist/html-text.d.ts +19 -0
  88. package/node_modules/@noodle-borg/knowledge-crawl/dist/html-text.d.ts.map +1 -0
  89. package/node_modules/@noodle-borg/knowledge-crawl/dist/html-text.js +62 -0
  90. package/node_modules/@noodle-borg/knowledge-crawl/dist/html-text.js.map +1 -0
  91. package/node_modules/@noodle-borg/knowledge-crawl/dist/index.d.ts +5 -0
  92. package/node_modules/@noodle-borg/knowledge-crawl/dist/index.d.ts.map +1 -0
  93. package/node_modules/@noodle-borg/knowledge-crawl/dist/index.js +4 -0
  94. package/node_modules/@noodle-borg/knowledge-crawl/dist/index.js.map +1 -0
  95. package/node_modules/@noodle-borg/knowledge-crawl/dist/origin.d.ts +3 -0
  96. package/node_modules/@noodle-borg/knowledge-crawl/dist/origin.d.ts.map +1 -0
  97. package/node_modules/@noodle-borg/knowledge-crawl/dist/origin.js +30 -0
  98. package/node_modules/@noodle-borg/knowledge-crawl/dist/origin.js.map +1 -0
  99. package/node_modules/@noodle-borg/knowledge-crawl/dist/ports.d.ts +28 -0
  100. package/node_modules/@noodle-borg/knowledge-crawl/dist/ports.d.ts.map +1 -0
  101. package/node_modules/@noodle-borg/knowledge-crawl/dist/ports.js +8 -0
  102. package/node_modules/@noodle-borg/knowledge-crawl/dist/ports.js.map +1 -0
  103. package/node_modules/@noodle-borg/knowledge-crawl/dist/robots.d.ts +12 -0
  104. package/node_modules/@noodle-borg/knowledge-crawl/dist/robots.d.ts.map +1 -0
  105. package/node_modules/@noodle-borg/knowledge-crawl/dist/robots.js +64 -0
  106. package/node_modules/@noodle-borg/knowledge-crawl/dist/robots.js.map +1 -0
  107. package/node_modules/@noodle-borg/knowledge-crawl/dist/sitemap.d.ts +3 -0
  108. package/node_modules/@noodle-borg/knowledge-crawl/dist/sitemap.d.ts.map +1 -0
  109. package/node_modules/@noodle-borg/knowledge-crawl/dist/sitemap.js +11 -0
  110. package/node_modules/@noodle-borg/knowledge-crawl/dist/sitemap.js.map +1 -0
  111. package/node_modules/@noodle-borg/knowledge-crawl/dist/tavily.d.ts +11 -0
  112. package/node_modules/@noodle-borg/knowledge-crawl/dist/tavily.d.ts.map +1 -0
  113. package/node_modules/@noodle-borg/knowledge-crawl/dist/tavily.js +53 -0
  114. package/node_modules/@noodle-borg/knowledge-crawl/dist/tavily.js.map +1 -0
  115. package/node_modules/@noodle-borg/knowledge-crawl/package.json +32 -0
  116. package/node_modules/@noodle-borg/knowledge-operations/dist/crawl-lifecycle.d.ts +71 -0
  117. package/node_modules/@noodle-borg/knowledge-operations/dist/crawl-lifecycle.d.ts.map +1 -0
  118. package/node_modules/@noodle-borg/knowledge-operations/dist/crawl-lifecycle.js +138 -0
  119. package/node_modules/@noodle-borg/knowledge-operations/dist/crawl-lifecycle.js.map +1 -0
  120. package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.d.ts.map +1 -1
  121. package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.js +11 -3
  122. package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.js.map +1 -1
  123. package/node_modules/@noodle-borg/knowledge-operations/dist/executor.d.ts +7 -13
  124. package/node_modules/@noodle-borg/knowledge-operations/dist/executor.d.ts.map +1 -1
  125. package/node_modules/@noodle-borg/knowledge-operations/dist/executor.js +16 -27
  126. package/node_modules/@noodle-borg/knowledge-operations/dist/executor.js.map +1 -1
  127. package/node_modules/@noodle-borg/knowledge-operations/dist/index.d.ts +2 -2
  128. package/node_modules/@noodle-borg/knowledge-operations/dist/index.d.ts.map +1 -1
  129. package/node_modules/@noodle-borg/knowledge-operations/dist/index.js +2 -2
  130. package/node_modules/@noodle-borg/knowledge-operations/dist/index.js.map +1 -1
  131. package/node_modules/@noodle-borg/knowledge-operations/dist/paths.d.ts +4 -0
  132. package/node_modules/@noodle-borg/knowledge-operations/dist/paths.d.ts.map +1 -1
  133. package/node_modules/@noodle-borg/knowledge-operations/dist/paths.js +6 -0
  134. package/node_modules/@noodle-borg/knowledge-operations/dist/paths.js.map +1 -1
  135. package/node_modules/@noodle-borg/knowledge-operations/dist/postgres-crawl-state.d.ts +12 -0
  136. package/node_modules/@noodle-borg/knowledge-operations/dist/postgres-crawl-state.d.ts.map +1 -0
  137. package/node_modules/@noodle-borg/knowledge-operations/dist/postgres-crawl-state.js +58 -0
  138. package/node_modules/@noodle-borg/knowledge-operations/dist/postgres-crawl-state.js.map +1 -0
  139. package/node_modules/@noodle-borg/knowledge-operations/dist/publication.d.ts +14 -1
  140. package/node_modules/@noodle-borg/knowledge-operations/dist/publication.d.ts.map +1 -1
  141. package/node_modules/@noodle-borg/knowledge-operations/dist/publication.js +84 -42
  142. package/node_modules/@noodle-borg/knowledge-operations/dist/publication.js.map +1 -1
  143. package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.d.ts +18 -11
  144. package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.d.ts.map +1 -1
  145. package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.js +149 -26
  146. package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.js.map +1 -1
  147. package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.d.ts +13 -4
  148. package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.d.ts.map +1 -1
  149. package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.js +28 -0
  150. package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.js.map +1 -1
  151. package/node_modules/@noodle-borg/knowledge-operations/package.json +1 -0
  152. package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +3 -0
  153. package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts.map +1 -1
  154. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  155. package/node_modules/@noodle-borg/protocol/dist/v2/server.d.ts +1 -1
  156. package/node_modules/@noodle-borg/protocol/dist/v2/server.d.ts.map +1 -1
  157. package/node_modules/@noodle-borg/protocol/dist/v2/server.js +26 -4
  158. package/node_modules/@noodle-borg/protocol/dist/v2/server.js.map +1 -1
  159. package/node_modules/@noodle-borg/protocol/dist/v2/skills.d.ts +30 -0
  160. package/node_modules/@noodle-borg/protocol/dist/v2/skills.d.ts.map +1 -0
  161. package/node_modules/@noodle-borg/protocol/dist/v2/skills.js +126 -0
  162. package/node_modules/@noodle-borg/protocol/dist/v2/skills.js.map +1 -0
  163. package/node_modules/@noodle-borg/protocol/package.json +3 -1
  164. package/node_modules/@noodle-borg/service/dist/assistant-bindings.d.ts.map +1 -1
  165. package/node_modules/@noodle-borg/service/dist/assistant-bindings.js +29 -1
  166. package/node_modules/@noodle-borg/service/dist/assistant-bindings.js.map +1 -1
  167. package/node_modules/@noodle-borg/service/dist/knowledge-wiring.d.ts +8 -0
  168. package/node_modules/@noodle-borg/service/dist/knowledge-wiring.d.ts.map +1 -0
  169. package/node_modules/@noodle-borg/service/dist/knowledge-wiring.js +10 -0
  170. package/node_modules/@noodle-borg/service/dist/knowledge-wiring.js.map +1 -0
  171. package/node_modules/@noodle-borg/service/dist/registry-targets.d.ts.map +1 -1
  172. package/node_modules/@noodle-borg/service/dist/registry-targets.js +10 -2
  173. package/node_modules/@noodle-borg/service/dist/registry-targets.js.map +1 -1
  174. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  175. package/node_modules/@noodle-borg/service/dist/service.js +3 -3
  176. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  177. package/node_modules/@noodle-borg/service/package.json +1 -1
  178. package/node_modules/@noodle-borg/transport-http/dist/admission-context.js +5 -1
  179. package/node_modules/@noodle-borg/transport-http/dist/admission-context.js.map +1 -1
  180. package/node_modules/@noodle-borg/transport-http/dist/request-capture.d.ts.map +1 -1
  181. package/node_modules/@noodle-borg/transport-http/dist/request-capture.js +4 -1
  182. package/node_modules/@noodle-borg/transport-http/dist/request-capture.js.map +1 -1
  183. package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts +41 -0
  184. package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts.map +1 -1
  185. package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.js +14 -0
  186. package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.js.map +1 -1
  187. package/node_modules/@noodleseed/assistant/dist/{chunk-MZNENVFY.js → chunk-RFETV5KQ.js} +158 -6
  188. package/node_modules/@noodleseed/assistant/dist/chunk-RFETV5KQ.js.map +1 -0
  189. package/node_modules/@noodleseed/assistant/dist/{chunk-RIKRQFKS.js → chunk-S373FCAI.js} +2 -1
  190. package/node_modules/@noodleseed/assistant/dist/client.js +1 -1
  191. package/node_modules/@noodleseed/assistant/dist/embed.global.js +57 -57
  192. package/node_modules/@noodleseed/assistant/dist/index.cjs +268 -117
  193. package/node_modules/@noodleseed/assistant/dist/index.cjs.map +1 -1
  194. package/node_modules/@noodleseed/assistant/dist/index.js +2 -2
  195. package/node_modules/@noodleseed/assistant/dist/react/client.js +1 -1
  196. package/node_modules/@noodleseed/assistant/dist/react.cjs +268 -117
  197. package/node_modules/@noodleseed/assistant/dist/react.cjs.map +1 -1
  198. package/node_modules/@noodleseed/assistant/dist/react.js +2 -2
  199. package/package.json +3 -2
  200. package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.d.ts +0 -15
  201. package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.d.ts.map +0 -1
  202. package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.js +0 -50
  203. package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.js.map +0 -1
  204. package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.d.ts +0 -34
  205. package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.d.ts.map +0 -1
  206. package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.js +0 -79
  207. package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.js.map +0 -1
  208. package/node_modules/@noodleseed/assistant/dist/chunk-MZNENVFY.js.map +0 -1
  209. /package/node_modules/@noodleseed/assistant/dist/{chunk-RIKRQFKS.js.map → chunk-S373FCAI.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE,CAClB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,KACR,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7D,mFAAmF;IACnF,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/E;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CA2BT"}
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE,CAClB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,KACR,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7D,mFAAmF;IACnF,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/E;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAqCT"}
@@ -1,16 +1,21 @@
1
1
  import { sendJson } from './http.js';
2
2
  import { parseKnowledgePath } from './paths.js';
3
3
  import { handleKnowledgeDocumentUpload, handleKnowledgePreflight, } from './routes.js';
4
- import { handleKnowledgeList, handleKnowledgeStatus } from './status-routes.js';
4
+ import { handleKnowledgeList, handleKnowledgeRefresh, handleKnowledgeStatus, } from './status-routes.js';
5
5
  export function dispatchKnowledgeRequest(req, res, url, deps) {
6
6
  const ref = parseKnowledgePath(url.pathname);
7
7
  if (ref === undefined)
8
8
  return false;
9
- const method = ref.kind === 'preflight' ? 'POST' : ref.kind === 'document' ? 'PUT' : 'GET';
9
+ const method = ref.kind === 'preflight' || ref.kind === 'refresh'
10
+ ? 'POST'
11
+ : ref.kind === 'document'
12
+ ? 'PUT'
13
+ : 'GET';
10
14
  if (method !== req.method)
11
15
  return false;
12
16
  const statusDeps = deps.routeDeps.status;
13
- if ((ref.kind === 'list' || ref.kind === 'status') && statusDeps === undefined) {
17
+ if ((ref.kind === 'list' || ref.kind === 'status' || ref.kind === 'refresh') &&
18
+ statusDeps === undefined) {
14
19
  return false;
15
20
  }
16
21
  deps.applySecurityHeaders(res);
@@ -32,6 +37,9 @@ export function dispatchKnowledgeRequest(req, res, url, deps) {
32
37
  else if (statusDeps !== undefined && ref.kind === 'status') {
33
38
  await handleKnowledgeStatus(req, res, ref.tenant, ref.component, statusDeps);
34
39
  }
40
+ else if (statusDeps !== undefined && ref.kind === 'refresh') {
41
+ await handleKnowledgeRefresh(req, res, ref.tenant, ref.component, statusDeps);
42
+ }
35
43
  })().catch(() => {
36
44
  if (!res.headersSent)
37
45
  sendJson(res, 500, { error: 'internal error' });
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GAEzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAehF,MAAM,UAAU,wBAAwB,CACtC,GAAoB,EACpB,GAAmB,EACnB,GAAQ,EACR,IAA2B;IAE3B,MAAM,GAAG,GAAG,kBAAkB,CAAC,G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AK,MAAM,EAAE,CAAC;YAC3D,MAAM,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC9D,CAAC;aAAM,IAAI,UAAU,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7D,MAAM,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/E,CAAC;aAAM,IAAI,UAAU,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9D,MAAM,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAChF,CAAC;IACH,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,GAAG,CAAC,WAAW;YAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,11 +1,12 @@
1
1
  /**
2
- * Runtime `search_<name>` execution (ADR 0202 as amended): feature gate → bundled BM25 for
3
- * documents → budget-gated managed site search → deterministic RRF fusion with the exact
4
- * origin/path policy postfilter. Budget exhaustion on a mixed component is a typed error —
5
- * blocked, never silently degraded to document-only. Document-only components never touch
6
- * the budget (file search is bundled and costs nothing).
2
+ * Runtime `search_<name>` execution (ADR 0202 amendment 2026-08-18): feature gate → bundled
3
+ * BM25 for documents → bundled BM25 over the crawled site corpus → deterministic RRF fusion with
4
+ * the exact origin/path policy postfilter. Every query is in-process and free; the crawl-page
5
+ * budget is enforced at crawl time (`crawl-lifecycle.ts`), not here. Before a component's first
6
+ * completed crawl the site corpus is honestly empty, with the crawl state as the operator
7
+ * signal.
7
8
  */
8
- import { type SearchBudgetCeilings, type SearchBudgetStore, type SearchHit, type SiteSearch } from '@noodle-borg/knowledge';
9
+ import { type SearchHit } from '@noodle-borg/knowledge';
9
10
  import type { KnowledgeDeployHooks } from './publication.js';
10
11
  import { type KnowledgeTenantRef } from './routes.js';
11
12
  /** The component facts the executor needs; a structural subset of the compiled component. */
@@ -28,13 +29,6 @@ export interface KnowledgeSearchExecutor {
28
29
  export interface KnowledgeSearchExecutorDeps {
29
30
  readonly hooks: KnowledgeDeployHooks;
30
31
  readonly knowledgeEnabled: (tenant: KnowledgeTenantRef) => Promise<boolean>;
31
- /** Site-search spend control; absent means site search is unavailable (documents still serve). */
32
- readonly budget?: {
33
- readonly store: SearchBudgetStore;
34
- readonly ceilings: (tenant: KnowledgeTenantRef) => Promise<SearchBudgetCeilings>;
35
- };
36
- /** Managed live-site adapter bound per tenant; absent until the managed project is configured. */
37
- readonly siteSearchFor?: (tenant: KnowledgeTenantRef) => SiteSearch;
38
32
  }
39
33
  export declare function createKnowledgeSearchExecutor(deps: KnowledgeSearchExecutorDeps): KnowledgeSearchExecutor;
40
34
  //# sourceMappingURL=executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAQL,KAAK,oBAAoB,EAEzB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MA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AC7D,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC7F;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,4FAA4F;IAC5F,MAAM,CACJ,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,wBAAwB,EACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7E;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,2BAA2B,GAChC,uBAAuB,CAgDzB"}
@@ -1,11 +1,13 @@
1
1
  /**
2
- * Runtime `search_<name>` execution (ADR 0202 as amended): feature gate → bundled BM25 for
3
- * documents → budget-gated managed site search → deterministic RRF fusion with the exact
4
- * origin/path policy postfilter. Budget exhaustion on a mixed component is a typed error —
5
- * blocked, never silently degraded to document-only. Document-only components never touch
6
- * the budget (file search is bundled and costs nothing).
2
+ * Runtime `search_<name>` execution (ADR 0202 amendment 2026-08-18): feature gate → bundled
3
+ * BM25 for documents → bundled BM25 over the crawled site corpus → deterministic RRF fusion with
4
+ * the exact origin/path policy postfilter. Every query is in-process and free; the crawl-page
5
+ * budget is enforced at crawl time (`crawl-lifecycle.ts`), not here. Before a component's first
6
+ * completed crawl the site corpus is honestly empty, with the crawl state as the operator
7
+ * signal.
7
8
  */
8
- import { DEFAULT_RESULT_LIMIT, fuseHits, KnowledgeError, MAX_QUERY_CHARS, MAX_RESULT_LIMIT, MIN_QUERY_CHARS, MIN_RESULT_LIMIT, SearchBudgetExhaustedError, } from '@noodle-borg/knowledge';
9
+ import { DEFAULT_RESULT_LIMIT, fuseHits, KnowledgeError, MAX_QUERY_CHARS, MAX_RESULT_LIMIT, MIN_QUERY_CHARS, MIN_RESULT_LIMIT, } from '@noodle-borg/knowledge';
10
+ import { searchSiteCorpus } from './crawl-lifecycle.js';
9
11
  import { knowledgeEnableCommand } from './routes.js';
10
12
  export function createKnowledgeSearchExecutor(deps) {
11
13
  return {
@@ -25,27 +27,14 @@ export function createKnowledgeSearchExecutor(deps) {
25
27
  });
26
28
  let sites = [];
27
29
  if (component.sites.length > 0) {
28
- // Blocked, never degraded the same contract as budget exhaustion. A sites-declared
29
- // component with no managed adapter or no budget metering is a wiring defect; answering
30
- // from documents alone would silently misrepresent the declared surface.
31
- const siteSearch = deps.siteSearchFor?.(tenant);
32
- if (siteSearch === undefined) {
33
- throw new KnowledgeError('provider', 'live-site search is unavailable: the managed knowledge project is not configured for this service; provision it or remove site() from the component');
34
- }
35
- if (deps.budget === undefined) {
36
- throw new KnowledgeError('provider', 'live-site search refused: no search budget store is configured to meter provider calls');
37
- }
38
- const ceilings = await deps.budget.ceilings(tenant);
39
- // One unit per provider request: the loop below makes one search per declared site.
40
- const decision = await deps.budget.store.consume({ org: tenant.org, app: tenant.app }, component.sites.length, ceilings);
41
- if (!decision.granted)
42
- throw new SearchBudgetExhaustedError(decision.state);
43
- const collected = [];
44
- for (const policy of component.sites) {
45
- const hits = await siteSearch.search({ origin: policy.origin, include: [...policy.include] }, { audience: 'public', revision: 'live' }, { query: request.query, limit });
46
- collected.push(...hits);
47
- }
48
- sites = collected;
30
+ // The crawled corpus serves in-process from the site revision (ADR 0202 amendment
31
+ // 2026-08-18): no provider call, no per-query spend crawl time owns the metering.
32
+ // Before the first completed crawl the corpus is legitimately empty; the crawl state in
33
+ // `knowledge status` is the honest signal, not a refusal.
34
+ sites = await searchSiteCorpus(deps.hooks, tenant, component.name, {
35
+ query: request.query,
36
+ limit,
37
+ });
49
38
  }
50
39
  return fuseHits(documents, sites, {
51
40
  limit,
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAEhB,0BAA0B,GAI3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA2B,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAmC9E,MAAM,UAAU,6BAA6B,CAC3C,IAAiC;IAEjC,OAAO;QACL,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAElD,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO;YACrC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,cAAc,CACtB,SAAS,EACT,uDAAuD,sBAAsB,CAAC,MAAM,CAAC,EAAE,CACxF,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;gBACrF,MAAM,IAAI,cAAc,CACtB,SAAS,EACT,yBAAyB,eAAe,QAAQ,eAAe,aAAa,CAC7E,CAAC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I,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,kFAAkF;gBAClF,oFAAoF;gBACpF,wFAAwF;gBACxF,0DAA0D;gBAC1D,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE;oBACjE,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;YAED,OAAO,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE;gBAChC,KAAK;gBACL,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;iBAC7B,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -3,12 +3,12 @@
3
3
  * behind its thin dispatch; the CLI never imports this package.
4
4
  */
5
5
  export { type StringSecretBox, secretBoxDocumentCodec } from './codec.js';
6
+ export { type CrawlableComponent, type CrawlStateStore, type CrawlStatus, InMemoryCrawlStateStore, runComponentCrawl, runDueCrawls, type SiteCrawlState, siteCorpusName, } from './crawl-lifecycle.js';
6
7
  export { dispatchKnowledgeRequest, type KnowledgeDispatchDeps } from './dispatch.js';
7
8
  export { createKnowledgeSearchExecutor, type KnowledgeSearchComponent, type KnowledgeSearchExecutor, type KnowledgeSearchExecutorDeps, type KnowledgeSearchRequest, } from './executor.js';
8
- export { impersonatedTokenProvider, metadataServiceTokenProvider, } from './google-identity.js';
9
9
  export { readBody, sendJson } from './http.js';
10
- export { type ManagedGoogleKnowledge, managedGoogleFromEnv, managedSiteProvisioned, managedSiteSearchFor, } from './managed-google.js';
11
10
  export { type KnowledgeRouteRef, parseKnowledgePath } from './paths.js';
11
+ export { PostgresCrawlStateStore } from './postgres-crawl-state.js';
12
12
  export { createKnowledgeDeployHooks, type KnowledgeDeployFailure, type KnowledgeDeployHooks, KnowledgePublicationError, type KnowledgePublicationPlan, withKnowledgePublication, } from './publication.js';
13
13
  export { handleKnowledgeDocumentUpload, handleKnowledgePreflight, type KnowledgeRouteDeps, type KnowledgeTenantRef, knowledgeEnableCommand, knowledgeTenantKey, } from './routes.js';
14
14
  export { type BoundKnowledgeSearchPort, bindKnowledgeSearchPort, type KnowledgeSearchPortFactory, knowledgeSearchPortFactory, } from './search-port.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,6BAA6B,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAA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C1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,wBAAwB,EAC7B,uBAAuB,EACvB,KAAK,0BAA0B,EAC/B,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,6BAA6B,EAC7B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC"}
@@ -3,12 +3,12 @@
3
3
  * behind its thin dispatch; the CLI never imports this package.
4
4
  */
5
5
  export { secretBoxDocumentCodec } from './codec.js';
6
+ export { InMemoryCrawlStateStore, runComponentCrawl, runDueCrawls, siteCorpusName, } from './crawl-lifecycle.js';
6
7
  export { dispatchKnowledgeRequest } from './dispatch.js';
7
8
  export { createKnowledgeSearchExecutor, } from './executor.js';
8
- export { impersonatedTokenProvider, metadataServiceTokenProvider, } from './google-identity.js';
9
9
  export { readBody, sendJson } from './http.js';
10
- export { managedGoogleFromEnv, managedSiteProvisioned, managedSiteSearchFor, } from './managed-google.js';
11
10
  export { parseKnowledgePath } from './paths.js';
11
+ export { PostgresCrawlStateStore } from './postgres-crawl-state.js';
12
12
  export { createKnowledgeDeployHooks, KnowledgePublicationError, withKnowledgePublication, } from './publication.js';
13
13
  export { handleKnowledgeDocumentUpload, handleKnowledgePreflight, knowledgeEnableCommand, knowledgeTenantKey, } from './routes.js';
14
14
  export { bindKnowledgeSearchPort, knowledgeSearchPortFactory, } from './search-port.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAwB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAA8B,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,6BAA6B,GAK9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA0B,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,0BAA0B,EAG1B,yBAAyB,EAEzB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EAGxB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,uBAAuB,EAEvB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EAEtB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAE7B,6BAA6B,EAC7B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAwB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAIL,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EAEZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAA8B,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,6BAA6B,GAK9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAA0B,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,0BAA0B,EAG1B,yBAAyB,EAEzB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EAGxB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,uBAAuB,EAEvB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EAEtB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAE7B,6BAA6B,EAC7B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC"}
@@ -16,6 +16,10 @@ export type KnowledgeRouteRef = {
16
16
  readonly kind: 'status';
17
17
  readonly tenant: KnowledgeTenantRef;
18
18
  readonly component: string;
19
+ } | {
20
+ readonly kind: 'refresh';
21
+ readonly tenant: KnowledgeTenantRef;
22
+ readonly component: string;
19
23
  };
20
24
  export declare function parseKnowledgePath(pathname: string): KnowledgeRouteRef | undefined;
21
25
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"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EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AASlG,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CA6ClF"}
@@ -2,6 +2,7 @@ const PREFLIGHT = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge
2
2
  const DOCUMENT = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/documents\/([^/]+)$/;
3
3
  const LIST = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge$/;
4
4
  const STATUS = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/([^/]+)\/status$/;
5
+ const REFRESH = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/([^/]+)\/refresh$/;
5
6
  export function parseKnowledgePath(pathname) {
6
7
  const preflight = PREFLIGHT.exec(pathname);
7
8
  if (preflight !== null) {
@@ -18,6 +19,11 @@ export function parseKnowledgePath(pathname) {
18
19
  const [, org, app, env, component] = status;
19
20
  return { kind: 'status', tenant: { org, app, env }, component };
20
21
  }
22
+ const refresh = REFRESH.exec(pathname);
23
+ if (refresh !== null) {
24
+ const [, org, app, env, component] = refresh;
25
+ return { kind: 'refresh', tenant: { org, app, env }, component };
26
+ }
21
27
  const document = DOCUMENT.exec(pathname);
22
28
  if (document !== null) {
23
29
  const [, org, app, env, sha256] = document;
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts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,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,MAMpC,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC;IAClE,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,OAMpC,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,QAMjC,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Durable crawl-state parity implementation (`knowledge_site_crawls`). */
2
+ import type { Pool } from 'pg';
3
+ import type { CrawlStateStore, SiteCrawlState } from './crawl-lifecycle.js';
4
+ import type { KnowledgeTenantRef } from './routes.js';
5
+ export declare class PostgresCrawlStateStore implements CrawlStateStore {
6
+ #private;
7
+ constructor(pool: Pool);
8
+ ensureSchema(): Promise<void>;
9
+ get(tenant: KnowledgeTenantRef, componentName: string): Promise<SiteCrawlState | undefined>;
10
+ put(tenant: KnowledgeTenantRef, componentName: string, state: SiteCrawlState): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=postgres-crawl-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-crawl-state.d.ts","sourceRoot":"","sources":["../src/postgres-crawl-state.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAe,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,uBAAwB,YAAW,eAAe;;gBAGjD,IAAI,EAAE,IAAI;IAIhB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB7B,GAAG,CACP,MAAM,EAAE,kBAAkB,EAC1B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAuBhC,GAAG,CACP,MAAM,EAAE,kBAAkB,EAC1B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,IAAI,CAAC;CAwBjB"}
@@ -0,0 +1,58 @@
1
+ export class PostgresCrawlStateStore {
2
+ #pool;
3
+ constructor(pool) {
4
+ this.#pool = pool;
5
+ }
6
+ async ensureSchema() {
7
+ await this.#pool.query(`
8
+ CREATE TABLE IF NOT EXISTS knowledge_site_crawls (
9
+ org TEXT NOT NULL,
10
+ app TEXT NOT NULL,
11
+ env TEXT NOT NULL,
12
+ component TEXT NOT NULL,
13
+ status TEXT NOT NULL,
14
+ last_completed_at BIGINT,
15
+ last_error TEXT,
16
+ pages_indexed INTEGER NOT NULL DEFAULT 0,
17
+ next_refresh_at BIGINT,
18
+ PRIMARY KEY (org, app, env, component)
19
+ )
20
+ `);
21
+ }
22
+ async get(tenant, componentName) {
23
+ const result = await this.#pool.query(`SELECT status, last_completed_at, last_error, pages_indexed, next_refresh_at
24
+ FROM knowledge_site_crawls WHERE org = $1 AND app = $2 AND env = $3 AND component = $4`, [tenant.org, tenant.app, tenant.env, componentName]);
25
+ const row = result.rows[0];
26
+ if (row === undefined)
27
+ return undefined;
28
+ return {
29
+ status: row.status,
30
+ pagesIndexed: row.pages_indexed,
31
+ ...(row.last_completed_at === null ? {} : { lastCompletedAt: Number(row.last_completed_at) }),
32
+ ...(row.last_error === null ? {} : { lastError: row.last_error }),
33
+ ...(row.next_refresh_at === null ? {} : { nextRefreshAt: Number(row.next_refresh_at) }),
34
+ };
35
+ }
36
+ async put(tenant, componentName, state) {
37
+ await this.#pool.query(`INSERT INTO knowledge_site_crawls
38
+ (org, app, env, component, status, last_completed_at, last_error, pages_indexed, next_refresh_at)
39
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
40
+ ON CONFLICT (org, app, env, component) DO UPDATE SET
41
+ status = EXCLUDED.status,
42
+ last_completed_at = EXCLUDED.last_completed_at,
43
+ last_error = EXCLUDED.last_error,
44
+ pages_indexed = EXCLUDED.pages_indexed,
45
+ next_refresh_at = EXCLUDED.next_refresh_at`, [
46
+ tenant.org,
47
+ tenant.app,
48
+ tenant.env,
49
+ componentName,
50
+ state.status,
51
+ state.lastCompletedAt ?? null,
52
+ state.lastError ?? null,
53
+ state.pagesIndexed,
54
+ state.nextRefreshAt ?? null,
55
+ ]);
56
+ }
57
+ }
58
+ //# sourceMappingURL=postgres-crawl-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-crawl-state.js","sourceRoot":"","sources":["../src/postgres-crawl-state.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,uBAAuB;IACzB,KAAK,CAAO;IAErB,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED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G;YACV,aAAa;YACb,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,eAAe,IAAI,IAAI;YAC7B,KAAK,CAAC,SAAS,IAAI,IAAI;YACvB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,aAAa,IAAI,IAAI;SAC5B,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -4,7 +4,7 @@
4
4
  * query → activate + pin, paired with the caller's artifact persistence. Any failure retains
5
5
  * the previous artifact + revision pair; retry is idempotent by content hash.
6
6
  */
7
- import { type CompiledKnowledgeComponent, type KnowledgeScope, type SearchHit, type SearchRequest } from '@noodle-borg/knowledge';
7
+ import { type CompiledKnowledgeComponent, type KnowledgeIndex, type KnowledgeScope, type SearchHit, type SearchRequest, type StagedDocument } from '@noodle-borg/knowledge';
8
8
  import { type KnowledgeTenantRef } from './routes.js';
9
9
  import type { KnowledgeServiceStores } from './service-wiring.js';
10
10
  export interface KnowledgeDeployFailure {
@@ -41,6 +41,12 @@ export interface KnowledgeDeployHooks {
41
41
  rollback(deploymentId: string): Promise<void>;
42
42
  /** Search the active document revision, rebuilding the bundled index when stale. */
43
43
  searchDocuments(scope: KnowledgeScope, componentName: string, request: SearchRequest): Promise<readonly SearchHit[]>;
44
+ /**
45
+ * Publish a refresh-lifecycle corpus (the crawled `<name>#site` namespace): stage + durable
46
+ * text + activate, latest-wins, never deployment-pinned — the displaced revision is unpinned
47
+ * so GC can reclaim it. Serialized per corpus by the publication lease.
48
+ */
49
+ publishSiteCorpus(scope: KnowledgeScope, corpusName: string, documents: readonly StagedDocument[]): Promise<void>;
44
50
  /** Throttled GC: expired staging entries and unreferenced revisions. */
45
51
  sweep(): Promise<void>;
46
52
  }
@@ -48,6 +54,13 @@ export declare function createKnowledgeDeployHooks(stores: KnowledgeServiceStore
48
54
  readonly knowledgeEnabled: (tenant: KnowledgeTenantRef) => Promise<boolean>;
49
55
  /** Managed site datastore existence; when bound, a site() deploy fails before activation. */
50
56
  readonly siteProvisioned?: (tenant: KnowledgeTenantRef) => Promise<boolean>;
57
+ /**
58
+ * BYO index selection (ADR 0202 amendment): resolve a component (or its `<name>#site`
59
+ * corpus) to its declared provider index. The declaration is passed where the caller holds
60
+ * the compiled component (publish/activate); lookup paths pass only the name. Returning
61
+ * undefined selects the managed bundled index.
62
+ */
63
+ readonly indexFor?: (scope: KnowledgeScope, componentName: string, declaration: CompiledKnowledgeComponent['index'] | undefined) => Promise<KnowledgeIndex | undefined>;
51
64
  readonly now?: () => Date;
52
65
  }): KnowledgeDeployHooks;
53
66
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../src/publication.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,0BAA0B,EAI/B,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,aAAa,CAAC;AAClG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,oFAAoF;AACpF,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC;gBAEvC,MAAM,EAAE,SAAS,sBAAsB,EAAE;CAKtD;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CA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Q,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,6FAA6F;IAC7F,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,0BAA0B,CAAC,OAAO,CAAC,GAAG,SAAS,KACzD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,GACA,oBAAoB,CAiRtB;AAMD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,MAAM,EAAE,kBAAkB,EAC1B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,SAAS,0BAA0B,EAAE,GAAG,SAAS,EAC7D,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,CAAC,CAAC,CAgBZ"}
@@ -20,7 +20,8 @@ const ACTIVE_REVISION_TTL_MS = 5_000;
20
20
  /** Deploy-piggybacked GC cadence (the archive-sweeper pattern). */
21
21
  const SWEEP_INTERVAL_MS = 10 * 60 * 1000;
22
22
  export function createKnowledgeDeployHooks(stores, options) {
23
- const index = new Bm25KnowledgeIndex();
23
+ const bundled = new Bm25KnowledgeIndex();
24
+ const selectIndex = async (scope, componentName, declaration) => (await options.indexFor?.(scope, componentName, declaration)) ?? bundled;
24
25
  const codec = stores.codec ?? identityDocumentTextCodec;
25
26
  const now = options.now ?? (() => new Date());
26
27
  const activeChecks = new Map();
@@ -63,8 +64,13 @@ export function createKnowledgeDeployHooks(stores, options) {
63
64
  }
64
65
  return documents;
65
66
  }
66
- /** Make sure the in-process index holds and activates the given revision. */
67
- async function rebuildIndex(scope, componentName, revisionId) {
67
+ /**
68
+ * Make sure the selected index holds and activates the given revision. For the bundled
69
+ * per-instance BM25 this is the restart/peer-activation rebuild; for a BYO remote index the
70
+ * active check usually matches and this is a no-op (stage is content-hash idempotent, so a
71
+ * mismatch self-heals from durable text).
72
+ */
73
+ async function rebuildIndex(index, scope, componentName, revisionId) {
68
74
  const current = await index.activeRevision(scope, componentName);
69
75
  if (current?.revisionId === revisionId)
70
76
  return;
@@ -93,9 +99,8 @@ export function createKnowledgeDeployHooks(stores, options) {
93
99
  throw new KnowledgePublicationError(withSites.map((component) => ({
94
100
  code: 'knowledge_site_not_provisioned',
95
101
  path: `knowledge.${component.name}`,
96
- message: `the managed site datastore for this tenant does not exist yet; an operator must ` +
97
- `run scripts/knowledge-gcp-provision.mjs --tenant ${tenant.org}/${tenant.app}/${tenant.env}, ` +
98
- `then check noodle knowledge status ${component.name}`,
102
+ message: `the site tier is not ready for this tenant; check ` +
103
+ `noodle knowledge status ${component.name} for the crawler configuration state`,
99
104
  })));
100
105
  }
101
106
  }
@@ -104,41 +109,50 @@ export function createKnowledgeDeployHooks(stores, options) {
104
109
  for (const component of withDocuments) {
105
110
  const scope = { org: tenant.org, app: tenant.app, env: tenant.env };
106
111
  const lease = await stores.revisionStore.acquireLease(scope, component.name, deploymentId);
107
- // Metadata-inclusive identity: a retitled/moved document is a new revision even with
108
- // identical bytes reuse keys on everything a citation shows.
109
- const contentHash = revisionContentHash(component.documents);
110
- const previous = await stores.revisionStore.active(scope, component.name);
111
- const reused = await stores.revisionStore.findByContentHash(scope, component.name, contentHash);
112
- const documents = await resolveDocuments(tenant, component, reused?.revisionId);
113
- const staged = await index.stage(scope, component.name, documents);
114
- const revision = reused ?? staged;
115
- await stores.revisionStore.stage({
116
- scope,
117
- componentName: component.name,
118
- contentHash,
119
- revision,
120
- });
121
- const verified = await index.verify(staged.revisionId, {
122
- audience: 'public',
123
- revision: staged.revisionId,
124
- });
125
- if (!verified) {
126
- throw new KnowledgePublicationError([
127
- {
128
- code: 'knowledge_verification_failed',
129
- path: `knowledge.${component.name}`,
130
- message: `knowledge component ${component.name} failed its positive filtered verification query`,
131
- },
132
- ]);
112
+ // From acquisition to planned.push the lease is held but not yet visible to
113
+ // finish(); release it on any failure or a retry deploy blocks on the leaked lease.
114
+ try {
115
+ // Metadata-inclusive identity: a retitled/moved document is a new revision even
116
+ // with identical bytes reuse keys on everything a citation shows.
117
+ const contentHash = revisionContentHash(component.documents);
118
+ const previous = await stores.revisionStore.active(scope, component.name);
119
+ const reused = await stores.revisionStore.findByContentHash(scope, component.name, contentHash);
120
+ const documents = await resolveDocuments(tenant, component, reused?.revisionId);
121
+ const index = await selectIndex(scope, component.name, component.index);
122
+ const staged = await index.stage(scope, component.name, documents);
123
+ const revision = reused ?? staged;
124
+ await stores.revisionStore.stage({
125
+ scope,
126
+ componentName: component.name,
127
+ contentHash,
128
+ revision,
129
+ });
130
+ const verified = await index.verify(staged.revisionId, {
131
+ audience: 'public',
132
+ revision: staged.revisionId,
133
+ });
134
+ if (!verified) {
135
+ throw new KnowledgePublicationError([
136
+ {
137
+ code: 'knowledge_verification_failed',
138
+ path: `knowledge.${component.name}`,
139
+ message: `knowledge component ${component.name} failed its positive filtered verification query`,
140
+ },
141
+ ]);
142
+ }
143
+ await stores.revisionStore.stageDocuments(revision.revisionId, documents);
144
+ planned.push({
145
+ component,
146
+ scope,
147
+ revisionId: revision.revisionId,
148
+ ...(previous !== undefined ? { previousRevisionId: previous.revisionId } : {}),
149
+ lease,
150
+ });
151
+ }
152
+ catch (error) {
153
+ await stores.revisionStore.releaseLease(lease).catch(() => undefined);
154
+ throw error;
133
155
  }
134
- await stores.revisionStore.stageDocuments(revision.revisionId, documents);
135
- planned.push({
136
- component,
137
- scope,
138
- revisionId: revision.revisionId,
139
- ...(previous !== undefined ? { previousRevisionId: previous.revisionId } : {}),
140
- lease,
141
- });
142
156
  }
143
157
  }
144
158
  catch (error) {
@@ -150,7 +164,7 @@ export function createKnowledgeDeployHooks(stores, options) {
150
164
  async activate(plan, deploymentId) {
151
165
  for (const planned of plan.components) {
152
166
  await stores.revisionStore.activate(planned.scope, planned.component.name, planned.revisionId, deploymentId);
153
- await rebuildIndex(planned.scope, planned.component.name, planned.revisionId);
167
+ await rebuildIndex(await selectIndex(planned.scope, planned.component.name, planned.component.index), planned.scope, planned.component.name, planned.revisionId);
154
168
  activeChecks.delete(knowledgeScopeCacheKey(planned.scope, planned.component.name));
155
169
  }
156
170
  },
@@ -175,6 +189,33 @@ export function createKnowledgeDeployHooks(stores, options) {
175
189
  activeChecks.delete(knowledgeScopeCacheKey(revision.scope, revision.componentName));
176
190
  }
177
191
  },
192
+ async publishSiteCorpus(scope, corpusName, documents) {
193
+ const lease = await stores.revisionStore.acquireLease(scope, corpusName, `crawl-${now().getTime()}`);
194
+ try {
195
+ const previous = await stores.revisionStore.active(scope, corpusName);
196
+ const index = await selectIndex(scope, corpusName);
197
+ const staged = await index.stage(scope, corpusName, documents);
198
+ await stores.revisionStore.stage({
199
+ scope,
200
+ componentName: corpusName,
201
+ contentHash: revisionContentHash(documents.map((document) => document.descriptor)),
202
+ revision: staged,
203
+ });
204
+ await stores.revisionStore.stageDocuments(staged.revisionId, documents);
205
+ // One synthetic pin id per corpus: activate pins the new revision to it, and the
206
+ // displaced revision is unpinned so a retired crawl can reach GC.
207
+ const pinId = `site-crawl:${knowledgeScopeCacheKey(scope, corpusName)}`;
208
+ await stores.revisionStore.activate(scope, corpusName, staged.revisionId, pinId);
209
+ if (previous !== undefined && previous.revisionId !== staged.revisionId) {
210
+ await stores.revisionStore.unpin(previous.revisionId, pinId);
211
+ }
212
+ await rebuildIndex(index, scope, corpusName, staged.revisionId);
213
+ activeChecks.delete(knowledgeScopeCacheKey(scope, corpusName));
214
+ }
215
+ finally {
216
+ await stores.revisionStore.releaseLease(lease);
217
+ }
218
+ },
178
219
  async searchDocuments(scope, componentName, request) {
179
220
  const cacheKey = knowledgeScopeCacheKey(scope, componentName);
180
221
  const cached = activeChecks.get(cacheKey);
@@ -188,7 +229,8 @@ export function createKnowledgeDeployHooks(stores, options) {
188
229
  }
189
230
  if (revisionId === undefined)
190
231
  return [];
191
- await rebuildIndex(scope, componentName, revisionId);
232
+ const index = await selectIndex(scope, componentName);
233
+ await rebuildIndex(index, scope, componentName, revisionId);
192
234
  return index.search(scope, componentName, request);
193
235
  },
194
236
  async sweep() {