@vibesdotdev/docs 0.0.0-stage → 1.0.0-rc.3

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 (641) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +74 -2
  3. package/dist/cli/cli.plugin.d.ts +14 -0
  4. package/dist/cli/cli.plugin.d.ts.map +1 -0
  5. package/dist/cli/cli.plugin.js +57 -0
  6. package/dist/cli/cli.plugin.js.map +1 -0
  7. package/dist/cli/commands/docs.list.command.descriptor.d.ts +33 -0
  8. package/dist/cli/commands/docs.list.command.descriptor.d.ts.map +1 -0
  9. package/dist/cli/commands/docs.list.command.descriptor.js +34 -0
  10. package/dist/cli/commands/docs.list.command.descriptor.js.map +1 -0
  11. package/dist/cli/commands/docs.list.command.impl.d.ts +25 -0
  12. package/dist/cli/commands/docs.list.command.impl.d.ts.map +1 -0
  13. package/dist/cli/commands/docs.list.command.impl.js +87 -0
  14. package/dist/cli/commands/docs.list.command.impl.js.map +1 -0
  15. package/dist/cli/commands/docs.show.command.descriptor.d.ts +44 -0
  16. package/dist/cli/commands/docs.show.command.descriptor.d.ts.map +1 -0
  17. package/dist/cli/commands/docs.show.command.descriptor.js +48 -0
  18. package/dist/cli/commands/docs.show.command.descriptor.js.map +1 -0
  19. package/dist/cli/commands/docs.show.command.impl.d.ts +26 -0
  20. package/dist/cli/commands/docs.show.command.impl.d.ts.map +1 -0
  21. package/dist/cli/commands/docs.show.command.impl.js +82 -0
  22. package/dist/cli/commands/docs.show.command.impl.js.map +1 -0
  23. package/dist/cli/commands/generate/docs.generate.cli-command.descriptor.d.ts +4 -0
  24. package/dist/cli/commands/generate/docs.generate.cli-command.descriptor.d.ts.map +1 -0
  25. package/dist/cli/commands/generate/docs.generate.cli-command.descriptor.js +58 -0
  26. package/dist/cli/commands/generate/docs.generate.cli-command.descriptor.js.map +1 -0
  27. package/dist/cli/commands/generate/docs.generate.cli-command.impl.d.ts +24 -0
  28. package/dist/cli/commands/generate/docs.generate.cli-command.impl.d.ts.map +1 -0
  29. package/dist/cli/commands/generate/docs.generate.cli-command.impl.js +283 -0
  30. package/dist/cli/commands/generate/docs.generate.cli-command.impl.js.map +1 -0
  31. package/dist/cli/commands/man/man.cli-command.descriptor.d.ts +4 -0
  32. package/dist/cli/commands/man/man.cli-command.descriptor.d.ts.map +1 -0
  33. package/dist/cli/commands/man/man.cli-command.descriptor.js +32 -0
  34. package/dist/cli/commands/man/man.cli-command.descriptor.js.map +1 -0
  35. package/dist/cli/commands/man/man.cli-command.impl.d.ts +23 -0
  36. package/dist/cli/commands/man/man.cli-command.impl.d.ts.map +1 -0
  37. package/dist/cli/commands/man/man.cli-command.impl.js +22 -0
  38. package/dist/cli/commands/man/man.cli-command.impl.js.map +1 -0
  39. package/dist/cli/commands/open/docs.open.cli-command.descriptor.d.ts +4 -0
  40. package/dist/cli/commands/open/docs.open.cli-command.descriptor.d.ts.map +1 -0
  41. package/dist/cli/commands/open/docs.open.cli-command.descriptor.js +18 -0
  42. package/dist/cli/commands/open/docs.open.cli-command.descriptor.js.map +1 -0
  43. package/dist/cli/commands/open/docs.open.cli-command.impl.d.ts +14 -0
  44. package/dist/cli/commands/open/docs.open.cli-command.impl.d.ts.map +1 -0
  45. package/dist/cli/commands/open/docs.open.cli-command.impl.js +52 -0
  46. package/dist/cli/commands/open/docs.open.cli-command.impl.js.map +1 -0
  47. package/dist/cli/commands/search.command.descriptor.d.ts +36 -0
  48. package/dist/cli/commands/search.command.descriptor.d.ts.map +1 -0
  49. package/dist/cli/commands/search.command.descriptor.js +35 -0
  50. package/dist/cli/commands/search.command.descriptor.js.map +1 -0
  51. package/dist/cli/commands/search.command.impl.d.ts +25 -0
  52. package/dist/cli/commands/search.command.impl.d.ts.map +1 -0
  53. package/dist/cli/commands/search.command.impl.js +113 -0
  54. package/dist/cli/commands/search.command.impl.js.map +1 -0
  55. package/dist/cli/directives/card.d.ts +11 -0
  56. package/dist/cli/directives/card.d.ts.map +1 -0
  57. package/dist/cli/directives/card.js +18 -0
  58. package/dist/cli/directives/card.js.map +1 -0
  59. package/dist/cli/directives/descriptor.d.ts +11 -0
  60. package/dist/cli/directives/descriptor.d.ts.map +1 -0
  61. package/dist/cli/directives/descriptor.js +20 -0
  62. package/dist/cli/directives/descriptor.js.map +1 -0
  63. package/dist/cli/directives/endpoint.d.ts +8 -0
  64. package/dist/cli/directives/endpoint.d.ts.map +1 -0
  65. package/dist/cli/directives/endpoint.js +31 -0
  66. package/dist/cli/directives/endpoint.js.map +1 -0
  67. package/dist/cli/directives/index.d.ts +9 -0
  68. package/dist/cli/directives/index.d.ts.map +1 -0
  69. package/dist/cli/directives/index.js +37 -0
  70. package/dist/cli/directives/index.js.map +1 -0
  71. package/dist/cli/directives/install.d.ts +12 -0
  72. package/dist/cli/directives/install.d.ts.map +1 -0
  73. package/dist/cli/directives/install.js +27 -0
  74. package/dist/cli/directives/install.js.map +1 -0
  75. package/dist/cli/directives/shell.d.ts +10 -0
  76. package/dist/cli/directives/shell.d.ts.map +1 -0
  77. package/dist/cli/directives/shell.js +16 -0
  78. package/dist/cli/directives/shell.js.map +1 -0
  79. package/dist/cli/directives/usage.d.ts +9 -0
  80. package/dist/cli/directives/usage.d.ts.map +1 -0
  81. package/dist/cli/directives/usage.js +13 -0
  82. package/dist/cli/directives/usage.js.map +1 -0
  83. package/dist/cli/docs/docs.cli.docs.descriptor.d.ts +22 -0
  84. package/dist/cli/docs/docs.cli.docs.descriptor.d.ts.map +1 -0
  85. package/dist/cli/docs/docs.cli.docs.descriptor.js +92 -0
  86. package/dist/cli/docs/docs.cli.docs.descriptor.js.map +1 -0
  87. package/dist/cli/docs.cli-group.descriptor.d.ts +4 -0
  88. package/dist/cli/docs.cli-group.descriptor.d.ts.map +1 -0
  89. package/dist/cli/docs.cli-group.descriptor.js +11 -0
  90. package/dist/cli/docs.cli-group.descriptor.js.map +1 -0
  91. package/dist/client/citations.d.ts +11 -0
  92. package/dist/client/citations.d.ts.map +1 -0
  93. package/dist/client/citations.js +197 -0
  94. package/dist/client/citations.js.map +1 -0
  95. package/dist/client/docs-client.d.ts +51 -0
  96. package/dist/client/docs-client.d.ts.map +1 -0
  97. package/dist/client/docs-client.js +298 -0
  98. package/dist/client/docs-client.js.map +1 -0
  99. package/dist/client/index.d.ts +12 -0
  100. package/dist/client/index.d.ts.map +1 -0
  101. package/dist/client/index.js +13 -0
  102. package/dist/client/index.js.map +1 -0
  103. package/dist/client/types.d.ts +26 -0
  104. package/dist/client/types.d.ts.map +1 -0
  105. package/dist/client/types.js +2 -0
  106. package/dist/client/types.js.map +1 -0
  107. package/dist/config/docs.svelte.config.descriptor.d.ts +50 -0
  108. package/dist/config/docs.svelte.config.descriptor.d.ts.map +1 -0
  109. package/dist/config/docs.svelte.config.descriptor.js +46 -0
  110. package/dist/config/docs.svelte.config.descriptor.js.map +1 -0
  111. package/dist/config/documents.source-refresh.config.descriptor.d.ts +41 -0
  112. package/dist/config/documents.source-refresh.config.descriptor.d.ts.map +1 -0
  113. package/dist/config/documents.source-refresh.config.descriptor.js +39 -0
  114. package/dist/config/documents.source-refresh.config.descriptor.js.map +1 -0
  115. package/dist/directives/index.d.ts +4 -0
  116. package/dist/directives/index.d.ts.map +1 -0
  117. package/dist/directives/index.js +3 -0
  118. package/dist/directives/index.js.map +1 -0
  119. package/dist/directives/registry.d.ts +31 -0
  120. package/dist/directives/registry.d.ts.map +1 -0
  121. package/dist/directives/registry.js +65 -0
  122. package/dist/directives/registry.js.map +1 -0
  123. package/dist/directives/types.d.ts +33 -0
  124. package/dist/directives/types.d.ts.map +1 -0
  125. package/dist/directives/types.js +2 -0
  126. package/dist/directives/types.js.map +1 -0
  127. package/dist/docs/agent-voice.docs.descriptor.d.ts +30 -0
  128. package/dist/docs/agent-voice.docs.descriptor.d.ts.map +1 -0
  129. package/dist/docs/agent-voice.docs.descriptor.js +107 -0
  130. package/dist/docs/agent-voice.docs.descriptor.js.map +1 -0
  131. package/dist/docs/charts.usage.docs.descriptor.d.ts +27 -0
  132. package/dist/docs/charts.usage.docs.descriptor.d.ts.map +1 -0
  133. package/dist/docs/charts.usage.docs.descriptor.js +90 -0
  134. package/dist/docs/charts.usage.docs.descriptor.js.map +1 -0
  135. package/dist/docs/command-palette.actions.docs.descriptor.d.ts +25 -0
  136. package/dist/docs/command-palette.actions.docs.descriptor.d.ts.map +1 -0
  137. package/dist/docs/command-palette.actions.docs.descriptor.js +80 -0
  138. package/dist/docs/command-palette.actions.docs.descriptor.js.map +1 -0
  139. package/dist/docs/docs.directives.docs.descriptor.d.ts +22 -0
  140. package/dist/docs/docs.directives.docs.descriptor.d.ts.map +1 -0
  141. package/dist/docs/docs.directives.docs.descriptor.js +104 -0
  142. package/dist/docs/docs.directives.docs.descriptor.js.map +1 -0
  143. package/dist/docs/docs.topics.docs.descriptor.d.ts +22 -0
  144. package/dist/docs/docs.topics.docs.descriptor.d.ts.map +1 -0
  145. package/dist/docs/docs.topics.docs.descriptor.js +90 -0
  146. package/dist/docs/docs.topics.docs.descriptor.js.map +1 -0
  147. package/dist/docs/fleet-pairing-direct.docs.descriptor.d.ts +30 -0
  148. package/dist/docs/fleet-pairing-direct.docs.descriptor.d.ts.map +1 -0
  149. package/dist/docs/fleet-pairing-direct.docs.descriptor.js +93 -0
  150. package/dist/docs/fleet-pairing-direct.docs.descriptor.js.map +1 -0
  151. package/dist/docs/fleet-pairing-mdns.docs.descriptor.d.ts +30 -0
  152. package/dist/docs/fleet-pairing-mdns.docs.descriptor.d.ts.map +1 -0
  153. package/dist/docs/fleet-pairing-mdns.docs.descriptor.js +88 -0
  154. package/dist/docs/fleet-pairing-mdns.docs.descriptor.js.map +1 -0
  155. package/dist/docs/fleet-pairing-platform.docs.descriptor.d.ts +30 -0
  156. package/dist/docs/fleet-pairing-platform.docs.descriptor.d.ts.map +1 -0
  157. package/dist/docs/fleet-pairing-platform.docs.descriptor.js +101 -0
  158. package/dist/docs/fleet-pairing-platform.docs.descriptor.js.map +1 -0
  159. package/dist/docs/fleet-pairing.docs.descriptor.d.ts +28 -0
  160. package/dist/docs/fleet-pairing.docs.descriptor.d.ts.map +1 -0
  161. package/dist/docs/fleet-pairing.docs.descriptor.js +89 -0
  162. package/dist/docs/fleet-pairing.docs.descriptor.js.map +1 -0
  163. package/dist/docs/getting-started-cli.docs.descriptor.d.ts +4 -0
  164. package/dist/docs/getting-started-cli.docs.descriptor.d.ts.map +1 -0
  165. package/dist/docs/getting-started-cli.docs.descriptor.js +141 -0
  166. package/dist/docs/getting-started-cli.docs.descriptor.js.map +1 -0
  167. package/dist/docs/getting-started.concepts.docs.descriptor.d.ts +4 -0
  168. package/dist/docs/getting-started.concepts.docs.descriptor.d.ts.map +1 -0
  169. package/dist/docs/getting-started.concepts.docs.descriptor.js +100 -0
  170. package/dist/docs/getting-started.concepts.docs.descriptor.js.map +1 -0
  171. package/dist/docs/getting-started.docs.descriptor.d.ts +4 -0
  172. package/dist/docs/getting-started.docs.descriptor.d.ts.map +1 -0
  173. package/dist/docs/getting-started.docs.descriptor.js +63 -0
  174. package/dist/docs/getting-started.docs.descriptor.js.map +1 -0
  175. package/dist/docs/getting-started.first-query.docs.descriptor.d.ts +4 -0
  176. package/dist/docs/getting-started.first-query.docs.descriptor.d.ts.map +1 -0
  177. package/dist/docs/getting-started.first-query.docs.descriptor.js +95 -0
  178. package/dist/docs/getting-started.first-query.docs.descriptor.js.map +1 -0
  179. package/dist/docs/guided-flows.flows.docs.descriptor.d.ts +22 -0
  180. package/dist/docs/guided-flows.flows.docs.descriptor.d.ts.map +1 -0
  181. package/dist/docs/guided-flows.flows.docs.descriptor.js +114 -0
  182. package/dist/docs/guided-flows.flows.docs.descriptor.js.map +1 -0
  183. package/dist/docs/runtime-rpc-relay.docs.descriptor.d.ts +19 -0
  184. package/dist/docs/runtime-rpc-relay.docs.descriptor.d.ts.map +1 -0
  185. package/dist/docs/runtime-rpc-relay.docs.descriptor.js +140 -0
  186. package/dist/docs/runtime-rpc-relay.docs.descriptor.js.map +1 -0
  187. package/dist/docs/tutorials.ai-text-generation.docs.descriptor.d.ts +4 -0
  188. package/dist/docs/tutorials.ai-text-generation.docs.descriptor.d.ts.map +1 -0
  189. package/dist/docs/tutorials.ai-text-generation.docs.descriptor.js +115 -0
  190. package/dist/docs/tutorials.ai-text-generation.docs.descriptor.js.map +1 -0
  191. package/dist/docs/tutorials.build-an-app.docs.descriptor.d.ts +4 -0
  192. package/dist/docs/tutorials.build-an-app.docs.descriptor.d.ts.map +1 -0
  193. package/dist/docs/tutorials.build-an-app.docs.descriptor.js +172 -0
  194. package/dist/docs/tutorials.build-an-app.docs.descriptor.js.map +1 -0
  195. package/dist/docs/tutorials.crud-collection.docs.descriptor.d.ts +4 -0
  196. package/dist/docs/tutorials.crud-collection.docs.descriptor.d.ts.map +1 -0
  197. package/dist/docs/tutorials.crud-collection.docs.descriptor.js +142 -0
  198. package/dist/docs/tutorials.crud-collection.docs.descriptor.js.map +1 -0
  199. package/dist/docs/tutorials.docs.descriptor.d.ts +4 -0
  200. package/dist/docs/tutorials.docs.descriptor.d.ts.map +1 -0
  201. package/dist/docs/tutorials.docs.descriptor.js +52 -0
  202. package/dist/docs/tutorials.docs.descriptor.js.map +1 -0
  203. package/dist/docs/tutorials.runtime-plugin.docs.descriptor.d.ts +4 -0
  204. package/dist/docs/tutorials.runtime-plugin.docs.descriptor.d.ts.map +1 -0
  205. package/dist/docs/tutorials.runtime-plugin.docs.descriptor.js +121 -0
  206. package/dist/docs/tutorials.runtime-plugin.docs.descriptor.js.map +1 -0
  207. package/dist/docs.plugin.d.ts +12 -0
  208. package/dist/docs.plugin.d.ts.map +1 -0
  209. package/dist/docs.plugin.js +118 -0
  210. package/dist/docs.plugin.js.map +1 -0
  211. package/dist/documents/documents.cloud.plugin.d.ts +3 -0
  212. package/dist/documents/documents.cloud.plugin.d.ts.map +1 -0
  213. package/dist/documents/documents.cloud.plugin.js +26 -0
  214. package/dist/documents/documents.cloud.plugin.js.map +1 -0
  215. package/dist/documents/documents.consumer.plugin.d.ts +3 -0
  216. package/dist/documents/documents.consumer.plugin.d.ts.map +1 -0
  217. package/dist/documents/documents.consumer.plugin.js +26 -0
  218. package/dist/documents/documents.consumer.plugin.js.map +1 -0
  219. package/dist/documents/documents.plugin.d.ts +3 -0
  220. package/dist/documents/documents.plugin.d.ts.map +1 -0
  221. package/dist/documents/documents.plugin.js +33 -0
  222. package/dist/documents/documents.plugin.js.map +1 -0
  223. package/dist/documents/docx/client.d.ts +56 -0
  224. package/dist/documents/docx/client.d.ts.map +1 -0
  225. package/dist/documents/docx/client.js +90 -0
  226. package/dist/documents/docx/client.js.map +1 -0
  227. package/dist/documents/docx/extract.d.ts +12 -0
  228. package/dist/documents/docx/extract.d.ts.map +1 -0
  229. package/dist/documents/docx/extract.js +62 -0
  230. package/dist/documents/docx/extract.js.map +1 -0
  231. package/dist/documents/docx/generator.d.ts +49 -0
  232. package/dist/documents/docx/generator.d.ts.map +1 -0
  233. package/dist/documents/docx/generator.js +101 -0
  234. package/dist/documents/docx/generator.js.map +1 -0
  235. package/dist/documents/docx/index.d.ts +19 -0
  236. package/dist/documents/docx/index.d.ts.map +1 -0
  237. package/dist/documents/docx/index.js +16 -0
  238. package/dist/documents/docx/index.js.map +1 -0
  239. package/dist/documents/docx/kinds.d.ts +10 -0
  240. package/dist/documents/docx/kinds.d.ts.map +1 -0
  241. package/dist/documents/docx/kinds.js +11 -0
  242. package/dist/documents/docx/kinds.js.map +1 -0
  243. package/dist/documents/docx/plugin/docx.plugin.d.ts +9 -0
  244. package/dist/documents/docx/plugin/docx.plugin.d.ts.map +1 -0
  245. package/dist/documents/docx/plugin/docx.plugin.js +35 -0
  246. package/dist/documents/docx/plugin/docx.plugin.js.map +1 -0
  247. package/dist/documents/docx/schemas/generator.d.ts +10 -0
  248. package/dist/documents/docx/schemas/generator.d.ts.map +1 -0
  249. package/dist/documents/docx/schemas/generator.js +2 -0
  250. package/dist/documents/docx/schemas/generator.js.map +1 -0
  251. package/dist/documents/docx/schemas/index.d.ts +4 -0
  252. package/dist/documents/docx/schemas/index.d.ts.map +1 -0
  253. package/dist/documents/docx/schemas/index.js +2 -0
  254. package/dist/documents/docx/schemas/index.js.map +1 -0
  255. package/dist/documents/docx/schemas/runtime.d.ts +68 -0
  256. package/dist/documents/docx/schemas/runtime.d.ts.map +1 -0
  257. package/dist/documents/docx/schemas/runtime.js +30 -0
  258. package/dist/documents/docx/schemas/runtime.js.map +1 -0
  259. package/dist/documents/docx/schemas/template-registry.d.ts +21 -0
  260. package/dist/documents/docx/schemas/template-registry.d.ts.map +1 -0
  261. package/dist/documents/docx/schemas/template-registry.js +2 -0
  262. package/dist/documents/docx/schemas/template-registry.js.map +1 -0
  263. package/dist/documents/docx/templates/index.d.ts +3 -0
  264. package/dist/documents/docx/templates/index.d.ts.map +1 -0
  265. package/dist/documents/docx/templates/index.js +2 -0
  266. package/dist/documents/docx/templates/index.js.map +1 -0
  267. package/dist/documents/docx/templates/loader.d.ts +20 -0
  268. package/dist/documents/docx/templates/loader.d.ts.map +1 -0
  269. package/dist/documents/docx/templates/loader.js +36 -0
  270. package/dist/documents/docx/templates/loader.js.map +1 -0
  271. package/dist/documents/docx/templates/types.d.ts +2 -0
  272. package/dist/documents/docx/templates/types.d.ts.map +1 -0
  273. package/dist/documents/docx/templates/types.js +2 -0
  274. package/dist/documents/docx/templates/types.js.map +1 -0
  275. package/dist/documents/index.d.ts +4 -0
  276. package/dist/documents/index.d.ts.map +1 -0
  277. package/dist/documents/index.js +4 -0
  278. package/dist/documents/index.js.map +1 -0
  279. package/dist/documents/outline/parse-outline.d.ts +132 -0
  280. package/dist/documents/outline/parse-outline.d.ts.map +1 -0
  281. package/dist/documents/outline/parse-outline.js +246 -0
  282. package/dist/documents/outline/parse-outline.js.map +1 -0
  283. package/dist/documents/plugin.d.ts +3 -0
  284. package/dist/documents/plugin.d.ts.map +1 -0
  285. package/dist/documents/plugin.js +13 -0
  286. package/dist/documents/plugin.js.map +1 -0
  287. package/dist/documents/presentations/capabilities/index.d.ts +3 -0
  288. package/dist/documents/presentations/capabilities/index.d.ts.map +1 -0
  289. package/dist/documents/presentations/capabilities/index.js +3 -0
  290. package/dist/documents/presentations/capabilities/index.js.map +1 -0
  291. package/dist/documents/presentations/capabilities/presentations.directory.impl.consumer.worker.d.ts +333 -0
  292. package/dist/documents/presentations/capabilities/presentations.directory.impl.consumer.worker.d.ts.map +1 -0
  293. package/dist/documents/presentations/capabilities/presentations.directory.impl.consumer.worker.js +101 -0
  294. package/dist/documents/presentations/capabilities/presentations.directory.impl.consumer.worker.js.map +1 -0
  295. package/dist/documents/presentations/capabilities/presentations.directory.kind.d.ts +65 -0
  296. package/dist/documents/presentations/capabilities/presentations.directory.kind.d.ts.map +1 -0
  297. package/dist/documents/presentations/capabilities/presentations.directory.kind.js +152 -0
  298. package/dist/documents/presentations/capabilities/presentations.directory.kind.js.map +1 -0
  299. package/dist/documents/presentations/capabilities/presentations.surface.kind.d.ts +68 -0
  300. package/dist/documents/presentations/capabilities/presentations.surface.kind.d.ts.map +1 -0
  301. package/dist/documents/presentations/capabilities/presentations.surface.kind.js +100 -0
  302. package/dist/documents/presentations/capabilities/presentations.surface.kind.js.map +1 -0
  303. package/dist/documents/presentations/client/contracts.d.ts +20 -0
  304. package/dist/documents/presentations/client/contracts.d.ts.map +1 -0
  305. package/dist/documents/presentations/client/contracts.js +2 -0
  306. package/dist/documents/presentations/client/contracts.js.map +1 -0
  307. package/dist/documents/presentations/client/index.d.ts +5 -0
  308. package/dist/documents/presentations/client/index.d.ts.map +1 -0
  309. package/dist/documents/presentations/client/index.js +5 -0
  310. package/dist/documents/presentations/client/index.js.map +1 -0
  311. package/dist/documents/presentations/client/presentations.runtime-client.descriptor.d.ts +4 -0
  312. package/dist/documents/presentations/client/presentations.runtime-client.descriptor.d.ts.map +1 -0
  313. package/dist/documents/presentations/client/presentations.runtime-client.descriptor.js +13 -0
  314. package/dist/documents/presentations/client/presentations.runtime-client.descriptor.js.map +1 -0
  315. package/dist/documents/presentations/client/presentations.runtime-client.impl.d.ts +711 -0
  316. package/dist/documents/presentations/client/presentations.runtime-client.impl.d.ts.map +1 -0
  317. package/dist/documents/presentations/client/presentations.runtime-client.impl.js +72 -0
  318. package/dist/documents/presentations/client/presentations.runtime-client.impl.js.map +1 -0
  319. package/dist/documents/presentations/docs/presentations.docs.descriptor.d.ts +4 -0
  320. package/dist/documents/presentations/docs/presentations.docs.descriptor.d.ts.map +1 -0
  321. package/dist/documents/presentations/docs/presentations.docs.descriptor.js +54 -0
  322. package/dist/documents/presentations/docs/presentations.docs.descriptor.js.map +1 -0
  323. package/dist/documents/presentations/index.d.ts +8 -0
  324. package/dist/documents/presentations/index.d.ts.map +1 -0
  325. package/dist/documents/presentations/index.js +8 -0
  326. package/dist/documents/presentations/index.js.map +1 -0
  327. package/dist/documents/presentations/presentations.consumer.plugin.d.ts +4 -0
  328. package/dist/documents/presentations/presentations.consumer.plugin.d.ts.map +1 -0
  329. package/dist/documents/presentations/presentations.consumer.plugin.js +16 -0
  330. package/dist/documents/presentations/presentations.consumer.plugin.js.map +1 -0
  331. package/dist/documents/presentations/presentations.plugin.d.ts +3 -0
  332. package/dist/documents/presentations/presentations.plugin.d.ts.map +1 -0
  333. package/dist/documents/presentations/presentations.plugin.js +48 -0
  334. package/dist/documents/presentations/presentations.plugin.js.map +1 -0
  335. package/dist/documents/presentations/review-read-authority.d.ts +117 -0
  336. package/dist/documents/presentations/review-read-authority.d.ts.map +1 -0
  337. package/dist/documents/presentations/review-read-authority.js +74 -0
  338. package/dist/documents/presentations/review-read-authority.js.map +1 -0
  339. package/dist/documents/presentations/schemas/index.d.ts +5 -0
  340. package/dist/documents/presentations/schemas/index.d.ts.map +1 -0
  341. package/dist/documents/presentations/schemas/index.js +5 -0
  342. package/dist/documents/presentations/schemas/index.js.map +1 -0
  343. package/dist/documents/presentations/schemas/owner.d.ts +28 -0
  344. package/dist/documents/presentations/schemas/owner.d.ts.map +1 -0
  345. package/dist/documents/presentations/schemas/owner.js +18 -0
  346. package/dist/documents/presentations/schemas/owner.js.map +1 -0
  347. package/dist/documents/presentations/schemas/request.d.ts +325 -0
  348. package/dist/documents/presentations/schemas/request.d.ts.map +1 -0
  349. package/dist/documents/presentations/schemas/request.js +169 -0
  350. package/dist/documents/presentations/schemas/request.js.map +1 -0
  351. package/dist/documents/presentations/schemas/review.d.ts +154 -0
  352. package/dist/documents/presentations/schemas/review.d.ts.map +1 -0
  353. package/dist/documents/presentations/schemas/review.js +83 -0
  354. package/dist/documents/presentations/schemas/review.js.map +1 -0
  355. package/dist/documents/presentations/schemas/surface.d.ts +315 -0
  356. package/dist/documents/presentations/schemas/surface.d.ts.map +1 -0
  357. package/dist/documents/presentations/schemas/surface.js +125 -0
  358. package/dist/documents/presentations/schemas/surface.js.map +1 -0
  359. package/dist/documents/presentations/state-machine.d.ts +36 -0
  360. package/dist/documents/presentations/state-machine.d.ts.map +1 -0
  361. package/dist/documents/presentations/state-machine.js +158 -0
  362. package/dist/documents/presentations/state-machine.js.map +1 -0
  363. package/dist/documents/presentations/storage/index.d.ts +3 -0
  364. package/dist/documents/presentations/storage/index.d.ts.map +1 -0
  365. package/dist/documents/presentations/storage/index.js +3 -0
  366. package/dist/documents/presentations/storage/index.js.map +1 -0
  367. package/dist/documents/presentations/storage/owner-app.d.ts +12 -0
  368. package/dist/documents/presentations/storage/owner-app.d.ts.map +1 -0
  369. package/dist/documents/presentations/storage/owner-app.js +43 -0
  370. package/dist/documents/presentations/storage/owner-app.js.map +1 -0
  371. package/dist/documents/presentations/storage/owner-transforms.d.ts +476 -0
  372. package/dist/documents/presentations/storage/owner-transforms.d.ts.map +1 -0
  373. package/dist/documents/presentations/storage/owner-transforms.js +77 -0
  374. package/dist/documents/presentations/storage/owner-transforms.js.map +1 -0
  375. package/dist/documents/presentations/storage/records.d.ts +227 -0
  376. package/dist/documents/presentations/storage/records.d.ts.map +1 -0
  377. package/dist/documents/presentations/storage/records.js +145 -0
  378. package/dist/documents/presentations/storage/records.js.map +1 -0
  379. package/dist/documents/presentations/tools/presentations.tool.descriptor.d.ts +543 -0
  380. package/dist/documents/presentations/tools/presentations.tool.descriptor.d.ts.map +1 -0
  381. package/dist/documents/presentations/tools/presentations.tool.descriptor.js +47 -0
  382. package/dist/documents/presentations/tools/presentations.tool.descriptor.js.map +1 -0
  383. package/dist/documents/presentations/tools/presentations.tool.impl.consumer.d.ts +8 -0
  384. package/dist/documents/presentations/tools/presentations.tool.impl.consumer.d.ts.map +1 -0
  385. package/dist/documents/presentations/tools/presentations.tool.impl.consumer.js +68 -0
  386. package/dist/documents/presentations/tools/presentations.tool.impl.consumer.js.map +1 -0
  387. package/dist/documents/presentations/tools/presentations.tool.schemas.d.ts +504 -0
  388. package/dist/documents/presentations/tools/presentations.tool.schemas.d.ts.map +1 -0
  389. package/dist/documents/presentations/tools/presentations.tool.schemas.js +76 -0
  390. package/dist/documents/presentations/tools/presentations.tool.schemas.js.map +1 -0
  391. package/dist/documents/render/grid.d.ts +96 -0
  392. package/dist/documents/render/grid.d.ts.map +1 -0
  393. package/dist/documents/render/grid.js +115 -0
  394. package/dist/documents/render/grid.js.map +1 -0
  395. package/dist/documents/render/index.d.ts +2 -0
  396. package/dist/documents/render/index.d.ts.map +1 -0
  397. package/dist/documents/render/index.js +2 -0
  398. package/dist/documents/render/index.js.map +1 -0
  399. package/dist/documents/render/render.impl.cloud.d.ts +25 -0
  400. package/dist/documents/render/render.impl.cloud.d.ts.map +1 -0
  401. package/dist/documents/render/render.impl.cloud.js +245 -0
  402. package/dist/documents/render/render.impl.cloud.js.map +1 -0
  403. package/dist/documents/render/render.impl.consumer.d.ts +35 -0
  404. package/dist/documents/render/render.impl.consumer.d.ts.map +1 -0
  405. package/dist/documents/render/render.impl.consumer.js +104 -0
  406. package/dist/documents/render/render.impl.consumer.js.map +1 -0
  407. package/dist/documents/render/render.interface.d.ts +147 -0
  408. package/dist/documents/render/render.interface.d.ts.map +1 -0
  409. package/dist/documents/render/render.interface.js +90 -0
  410. package/dist/documents/render/render.interface.js.map +1 -0
  411. package/dist/documents/schemas/ai-service-binding.schema.d.ts +11 -0
  412. package/dist/documents/schemas/ai-service-binding.schema.d.ts.map +1 -0
  413. package/dist/documents/schemas/ai-service-binding.schema.js +8 -0
  414. package/dist/documents/schemas/ai-service-binding.schema.js.map +1 -0
  415. package/dist/documents/schemas/document-read.schema.d.ts +107 -0
  416. package/dist/documents/schemas/document-read.schema.d.ts.map +1 -0
  417. package/dist/documents/schemas/document-read.schema.js +124 -0
  418. package/dist/documents/schemas/document-read.schema.js.map +1 -0
  419. package/dist/documents/schemas/document-view.schema.d.ts +74 -0
  420. package/dist/documents/schemas/document-view.schema.d.ts.map +1 -0
  421. package/dist/documents/schemas/document-view.schema.js +66 -0
  422. package/dist/documents/schemas/document-view.schema.js.map +1 -0
  423. package/dist/documents/schemas/index.d.ts +3 -0
  424. package/dist/documents/schemas/index.d.ts.map +1 -0
  425. package/dist/documents/schemas/index.js +3 -0
  426. package/dist/documents/schemas/index.js.map +1 -0
  427. package/dist/documents/schemas/page-cache.schema.d.ts +29 -0
  428. package/dist/documents/schemas/page-cache.schema.d.ts.map +1 -0
  429. package/dist/documents/schemas/page-cache.schema.js +50 -0
  430. package/dist/documents/schemas/page-cache.schema.js.map +1 -0
  431. package/dist/documents/storage/index.d.ts +3 -0
  432. package/dist/documents/storage/index.d.ts.map +1 -0
  433. package/dist/documents/storage/index.js +2 -0
  434. package/dist/documents/storage/index.js.map +1 -0
  435. package/dist/documents/storage/page-cache.descriptor.d.ts +17 -0
  436. package/dist/documents/storage/page-cache.descriptor.d.ts.map +1 -0
  437. package/dist/documents/storage/page-cache.descriptor.js +45 -0
  438. package/dist/documents/storage/page-cache.descriptor.js.map +1 -0
  439. package/dist/documents/tools/descriptors.d.ts +248 -0
  440. package/dist/documents/tools/descriptors.d.ts.map +1 -0
  441. package/dist/documents/tools/descriptors.js +78 -0
  442. package/dist/documents/tools/descriptors.js.map +1 -0
  443. package/dist/documents/tools/document-read-loop-guard.d.ts +61 -0
  444. package/dist/documents/tools/document-read-loop-guard.d.ts.map +1 -0
  445. package/dist/documents/tools/document-read-loop-guard.js +314 -0
  446. package/dist/documents/tools/document-read-loop-guard.js.map +1 -0
  447. package/dist/documents/tools/document-read.impl.d.ts +77 -0
  448. package/dist/documents/tools/document-read.impl.d.ts.map +1 -0
  449. package/dist/documents/tools/document-read.impl.js +1139 -0
  450. package/dist/documents/tools/document-read.impl.js.map +1 -0
  451. package/dist/documents/tools/document-view.impl.d.ts +45 -0
  452. package/dist/documents/tools/document-view.impl.d.ts.map +1 -0
  453. package/dist/documents/tools/document-view.impl.js +168 -0
  454. package/dist/documents/tools/document-view.impl.js.map +1 -0
  455. package/dist/documents/tools/index.d.ts +3 -0
  456. package/dist/documents/tools/index.d.ts.map +1 -0
  457. package/dist/documents/tools/index.js +6 -0
  458. package/dist/documents/tools/index.js.map +1 -0
  459. package/dist/documents/tools/source-refresh.d.ts +33 -0
  460. package/dist/documents/tools/source-refresh.d.ts.map +1 -0
  461. package/dist/documents/tools/source-refresh.js +127 -0
  462. package/dist/documents/tools/source-refresh.js.map +1 -0
  463. package/dist/documents/tools/unavailable.impl.d.ts +5 -0
  464. package/dist/documents/tools/unavailable.impl.d.ts.map +1 -0
  465. package/dist/documents/tools/unavailable.impl.js +12 -0
  466. package/dist/documents/tools/unavailable.impl.js.map +1 -0
  467. package/dist/index.d.ts +19 -0
  468. package/dist/index.d.ts.map +1 -0
  469. package/dist/index.js +13 -0
  470. package/dist/index.js.map +1 -0
  471. package/dist/prompts/descriptors/vibes-platform.prompt.descriptor.d.ts +113 -0
  472. package/dist/prompts/descriptors/vibes-platform.prompt.descriptor.d.ts.map +1 -0
  473. package/dist/prompts/descriptors/vibes-platform.prompt.descriptor.js +35 -0
  474. package/dist/prompts/descriptors/vibes-platform.prompt.descriptor.js.map +1 -0
  475. package/dist/render/ansi.d.ts +86 -0
  476. package/dist/render/ansi.d.ts.map +1 -0
  477. package/dist/render/ansi.js +125 -0
  478. package/dist/render/ansi.js.map +1 -0
  479. package/dist/render/frontmatter.d.ts +21 -0
  480. package/dist/render/frontmatter.d.ts.map +1 -0
  481. package/dist/render/frontmatter.js +57 -0
  482. package/dist/render/frontmatter.js.map +1 -0
  483. package/dist/render/index.d.ts +10 -0
  484. package/dist/render/index.d.ts.map +1 -0
  485. package/dist/render/index.js +6 -0
  486. package/dist/render/index.js.map +1 -0
  487. package/dist/render/parse.d.ts +29 -0
  488. package/dist/render/parse.d.ts.map +1 -0
  489. package/dist/render/parse.js +145 -0
  490. package/dist/render/parse.js.map +1 -0
  491. package/dist/render/sections.d.ts +24 -0
  492. package/dist/render/sections.d.ts.map +1 -0
  493. package/dist/render/sections.js +76 -0
  494. package/dist/render/sections.js.map +1 -0
  495. package/dist/render/terminal.d.ts +15 -0
  496. package/dist/render/terminal.d.ts.map +1 -0
  497. package/dist/render/terminal.js +293 -0
  498. package/dist/render/terminal.js.map +1 -0
  499. package/dist/runbooks/index.d.ts +4 -0
  500. package/dist/runbooks/index.d.ts.map +1 -0
  501. package/dist/runbooks/index.js +3 -0
  502. package/dist/runbooks/index.js.map +1 -0
  503. package/dist/runbooks/runbooks.plugin.d.ts +3 -0
  504. package/dist/runbooks/runbooks.plugin.d.ts.map +1 -0
  505. package/dist/runbooks/runbooks.plugin.js +3 -0
  506. package/dist/runbooks/runbooks.plugin.js.map +1 -0
  507. package/dist/schemas/citations.schema.d.ts +21 -0
  508. package/dist/schemas/citations.schema.d.ts.map +1 -0
  509. package/dist/schemas/citations.schema.js +17 -0
  510. package/dist/schemas/citations.schema.js.map +1 -0
  511. package/dist/schemas/index.d.ts +4 -0
  512. package/dist/schemas/index.d.ts.map +1 -0
  513. package/dist/schemas/index.js +3 -0
  514. package/dist/schemas/index.js.map +1 -0
  515. package/dist/schemas/topic.schema.d.ts +179 -0
  516. package/dist/schemas/topic.schema.d.ts.map +1 -0
  517. package/dist/schemas/topic.schema.js +15 -0
  518. package/dist/schemas/topic.schema.js.map +1 -0
  519. package/dist/svelte/build/highlight.d.ts +33 -0
  520. package/dist/svelte/build/highlight.d.ts.map +1 -0
  521. package/dist/svelte/build/highlight.js +95 -0
  522. package/dist/svelte/build/topic-index.d.ts +96 -0
  523. package/dist/svelte/build/topic-index.d.ts.map +1 -0
  524. package/dist/svelte/build/topic-index.js +247 -0
  525. package/dist/svelte/context.d.ts +12 -0
  526. package/dist/svelte/context.d.ts.map +1 -0
  527. package/dist/svelte/context.js +16 -0
  528. package/dist/svelte/docs-origin.d.ts +14 -0
  529. package/dist/svelte/docs-origin.d.ts.map +1 -0
  530. package/dist/svelte/docs-origin.js +49 -0
  531. package/dist/svelte/docs-svelte.plugin.d.ts +121 -0
  532. package/dist/svelte/docs-svelte.plugin.d.ts.map +1 -0
  533. package/dist/svelte/docs-svelte.plugin.js +35 -0
  534. package/dist/svelte/documents/presentations/components/PresentationMonitor.svelte +261 -0
  535. package/dist/svelte/documents/presentations/components/PresentationMonitor.svelte.d.ts +16 -0
  536. package/dist/svelte/documents/presentations/components/PresentationMonitor.svelte.d.ts.map +1 -0
  537. package/dist/svelte/documents/presentations/index.d.ts +3 -0
  538. package/dist/svelte/documents/presentations/index.d.ts.map +1 -0
  539. package/dist/svelte/documents/presentations/index.js +2 -0
  540. package/dist/svelte/documents/presentations/monitor-state.d.ts +17 -0
  541. package/dist/svelte/documents/presentations/monitor-state.d.ts.map +1 -0
  542. package/dist/svelte/documents/presentations/monitor-state.js +38 -0
  543. package/dist/svelte/index.d.ts +20 -0
  544. package/dist/svelte/index.d.ts.map +1 -0
  545. package/dist/svelte/index.js +16 -0
  546. package/dist/svelte/loaders.d.ts +57 -0
  547. package/dist/svelte/loaders.d.ts.map +1 -0
  548. package/dist/svelte/loaders.js +74 -0
  549. package/dist/svelte/state.svelte.d.ts +366 -0
  550. package/dist/svelte/state.svelte.d.ts.map +1 -0
  551. package/dist/svelte/state.svelte.js +155 -0
  552. package/dist/svelte/styles.css +8 -0
  553. package/dist/svelte/tool-widgets/DocsToolCard.svelte +41 -0
  554. package/dist/svelte/tool-widgets/DocsToolCard.svelte.d.ts +5 -0
  555. package/dist/svelte/tool-widgets/DocsToolCard.svelte.d.ts.map +1 -0
  556. package/dist/svelte/tool-widgets/DocumentReadToolCard.svelte +28 -0
  557. package/dist/svelte/tool-widgets/DocumentReadToolCard.svelte.d.ts +8 -0
  558. package/dist/svelte/tool-widgets/DocumentReadToolCard.svelte.d.ts.map +1 -0
  559. package/dist/svelte/tool-widgets/PresentationsToolCard.svelte +25 -0
  560. package/dist/svelte/tool-widgets/PresentationsToolCard.svelte.d.ts +8 -0
  561. package/dist/svelte/tool-widgets/PresentationsToolCard.svelte.d.ts.map +1 -0
  562. package/dist/svelte/tool-widgets/RunbookToolCard.svelte +29 -0
  563. package/dist/svelte/tool-widgets/RunbookToolCard.svelte.d.ts +8 -0
  564. package/dist/svelte/tool-widgets/RunbookToolCard.svelte.d.ts.map +1 -0
  565. package/dist/svelte/tool-widgets/index.d.ts +7 -0
  566. package/dist/svelte/tool-widgets/index.d.ts.map +1 -0
  567. package/dist/svelte/tool-widgets/index.js +5 -0
  568. package/dist/svelte/tool-widgets/models.d.ts +47 -0
  569. package/dist/svelte/tool-widgets/models.d.ts.map +1 -0
  570. package/dist/svelte/tool-widgets/models.js +112 -0
  571. package/dist/svelte/ui/DocViewer.svelte +122 -0
  572. package/dist/svelte/ui/DocViewer.svelte.d.ts +17 -0
  573. package/dist/svelte/ui/DocViewer.svelte.d.ts.map +1 -0
  574. package/dist/svelte/ui/DocsLoader.svelte +37 -0
  575. package/dist/svelte/ui/DocsLoader.svelte.d.ts +21 -0
  576. package/dist/svelte/ui/DocsLoader.svelte.d.ts.map +1 -0
  577. package/dist/svelte/ui/DocsSearch.svelte +129 -0
  578. package/dist/svelte/ui/DocsSearch.svelte.d.ts +15 -0
  579. package/dist/svelte/ui/DocsSearch.svelte.d.ts.map +1 -0
  580. package/dist/svelte/ui/directives/Card.svelte +61 -0
  581. package/dist/svelte/ui/directives/Card.svelte.d.ts +8 -0
  582. package/dist/svelte/ui/directives/Card.svelte.d.ts.map +1 -0
  583. package/dist/svelte/ui/directives/Descriptor.svelte +73 -0
  584. package/dist/svelte/ui/directives/Descriptor.svelte.d.ts +8 -0
  585. package/dist/svelte/ui/directives/Descriptor.svelte.d.ts.map +1 -0
  586. package/dist/svelte/ui/directives/DirectiveDispatch.svelte +45 -0
  587. package/dist/svelte/ui/directives/DirectiveDispatch.svelte.d.ts +8 -0
  588. package/dist/svelte/ui/directives/DirectiveDispatch.svelte.d.ts.map +1 -0
  589. package/dist/svelte/ui/directives/Endpoint.svelte +68 -0
  590. package/dist/svelte/ui/directives/Endpoint.svelte.d.ts +8 -0
  591. package/dist/svelte/ui/directives/Endpoint.svelte.d.ts.map +1 -0
  592. package/dist/svelte/ui/directives/Install.svelte +112 -0
  593. package/dist/svelte/ui/directives/Install.svelte.d.ts +8 -0
  594. package/dist/svelte/ui/directives/Install.svelte.d.ts.map +1 -0
  595. package/dist/svelte/ui/directives/Shell.svelte +32 -0
  596. package/dist/svelte/ui/directives/Shell.svelte.d.ts +8 -0
  597. package/dist/svelte/ui/directives/Shell.svelte.d.ts.map +1 -0
  598. package/dist/svelte/ui/directives/Usage.svelte +14 -0
  599. package/dist/svelte/ui/directives/Usage.svelte.d.ts +8 -0
  600. package/dist/svelte/ui/directives/Usage.svelte.d.ts.map +1 -0
  601. package/dist/svelte/ui/help/HelpDialog.svelte +210 -0
  602. package/dist/svelte/ui/help/HelpDialog.svelte.d.ts +11 -0
  603. package/dist/svelte/ui/help/HelpDialog.svelte.d.ts.map +1 -0
  604. package/dist/svelte/ui/help/HelpIcon.svelte +83 -0
  605. package/dist/svelte/ui/help/HelpIcon.svelte.d.ts +16 -0
  606. package/dist/svelte/ui/help/HelpIcon.svelte.d.ts.map +1 -0
  607. package/dist/svelte/ui/markdown/CodeBlock.svelte +125 -0
  608. package/dist/svelte/ui/markdown/CodeBlock.svelte.d.ts +8 -0
  609. package/dist/svelte/ui/markdown/CodeBlock.svelte.d.ts.map +1 -0
  610. package/dist/svelte/ui/markdown/MarkdownView.svelte +319 -0
  611. package/dist/svelte/ui/markdown/MarkdownView.svelte.d.ts +9 -0
  612. package/dist/svelte/ui/markdown/MarkdownView.svelte.d.ts.map +1 -0
  613. package/dist/tools/docs.descriptor.d.ts +48 -0
  614. package/dist/tools/docs.descriptor.d.ts.map +1 -0
  615. package/dist/tools/docs.descriptor.js +23 -0
  616. package/dist/tools/docs.descriptor.js.map +1 -0
  617. package/dist/tools/docs.impl.d.ts +7 -0
  618. package/dist/tools/docs.impl.d.ts.map +1 -0
  619. package/dist/tools/docs.impl.js +67 -0
  620. package/dist/tools/docs.impl.js.map +1 -0
  621. package/dist/tools/schemas.d.ts +43 -0
  622. package/dist/tools/schemas.d.ts.map +1 -0
  623. package/dist/tools/schemas.js +30 -0
  624. package/dist/tools/schemas.js.map +1 -0
  625. package/dist/tui/docs-tui.plugin.d.ts +3 -0
  626. package/dist/tui/docs-tui.plugin.d.ts.map +1 -0
  627. package/dist/tui/docs-tui.plugin.js +18 -0
  628. package/dist/tui/docs-tui.plugin.js.map +1 -0
  629. package/dist/tui/index.d.ts +2 -0
  630. package/dist/tui/index.d.ts.map +1 -0
  631. package/dist/tui/index.js +2 -0
  632. package/dist/tui/index.js.map +1 -0
  633. package/dist/tui/tui/docs-explorer.impl.consumer.d.ts +38 -0
  634. package/dist/tui/tui/docs-explorer.impl.consumer.d.ts.map +1 -0
  635. package/dist/tui/tui/docs-explorer.impl.consumer.js +334 -0
  636. package/dist/tui/tui/docs-explorer.impl.consumer.js.map +1 -0
  637. package/dist/tui/tui/docs-explorer.tui.descriptor.d.ts +13 -0
  638. package/dist/tui/tui/docs-explorer.tui.descriptor.d.ts.map +1 -0
  639. package/dist/tui/tui/docs-explorer.tui.descriptor.js +29 -0
  640. package/dist/tui/tui/docs-explorer.tui.descriptor.js.map +1 -0
  641. package/package.json +450 -4
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Document agent-tool descriptors.
3
+ *
4
+ * Declares the `document.read` tool via `createRuntimeAsset`. The impl
5
+ * (cache-first orchestration, render delegation, vision-OCR) lives in
6
+ * `document-read.impl.ts` and is loaded lazily by the plugin.
7
+ */
8
+ import { createRuntimeAsset } from '@vibesdotdev/kernel/factory';
9
+ import { DocumentReadInputSchema, DocumentReadOutputSchema } from "../schemas/document-read.schema.js";
10
+ import { DocumentViewInputSchema, DocumentViewOutputSchema } from "../schemas/document-view.schema.js";
11
+ export const DOCUMENT_TOOL_IDS = ['document.read', 'document.view'];
12
+ export function isDocumentToolId(value) {
13
+ return DOCUMENT_TOOL_IDS.some((id) => id === value);
14
+ }
15
+ const common = {
16
+ kind: 'tools/tool',
17
+ hardware: ['consumer', 'cloud'],
18
+ purpose: ['agent', 'direct', 'worker'],
19
+ category: 'documents',
20
+ tags: ['documents', 'pdf', 'ocr', 'vision']
21
+ };
22
+ export const documentReadToolDescriptor = createRuntimeAsset({
23
+ ...common,
24
+ id: 'document.read',
25
+ name: 'Read Document',
26
+ description: 'Read one or more pages from a PDF or document file. Uses cached OCR/vision results when available; otherwise renders the page, runs vision-OCR via the drainer, and writes the result to the page cache. Optionally extracts structured data according to a JSON schema.',
27
+ // mcpDescription hard-capped at 90 by check-tool-coverage (MCP-safe limit).
28
+ // Keep the "Every call requires ref" guardrail visible to the model — the
29
+ // casework takeoff loop regressed when document.read was called with `{}`
30
+ // (descriptor.test.ts locks this rule into the model-facing string).
31
+ mcpDescription: 'Read PDF/doc pages. Every call requires ref:{url,...}. Cache-first OCR; optional schema.',
32
+ subcategory: 'read',
33
+ safety: 'read',
34
+ requiresApproval: false,
35
+ schemas: {
36
+ input: DocumentReadInputSchema,
37
+ output: DocumentReadOutputSchema
38
+ },
39
+ usageGuidance: {
40
+ when: 'Use when the user wants to read, extract, or query content from a document file (PDF, etc.).',
41
+ commonPatterns: [
42
+ 'Every call must include `ref`; never call document.read with `{}`. Reuse the full `ref` object from the source/lookup tool on every page read.',
43
+ 'Read the index/TOC page first (page 1 or pass no pages), then target only the sheets you need.',
44
+ 'Pass vocabulary hints for domain-specific terms (part numbers, trade names) to improve OCR accuracy.',
45
+ 'Pass a JSON schema in the `schema` field to get structured rows instead of raw markdown.',
46
+ 'Pass `question` for a direct answer without full structured extraction.',
47
+ 'Use `visionFocusHint` ("large drawing", "dense text", "table") to guide tiling strategy.',
48
+ 'Bump `promptVersion` to force re-OCR when the document source changes or you update extraction prompts.'
49
+ ]
50
+ }
51
+ });
52
+ export const documentViewToolDescriptor = createRuntimeAsset({
53
+ ...common,
54
+ id: 'document.view',
55
+ name: 'View Document Drawing',
56
+ description: 'Render a drawing/PDF page as an IMAGE for you to look at directly, instead of a transcription. Call with no region to see the whole sheet (downscaled, to orient); call again with region:{x,y,w,h} in 0..1 sheet fractions to zoom into a spot and read dimensions, labels, and keynotes with your own eyes. This is how you read a drawing like an estimator: scan the sheet, then lean in.',
57
+ // mcpDescription hard-capped at 90 by check-tool-coverage (MCP-safe limit).
58
+ mcpDescription: 'See a drawing page as an image. ref+page for the whole sheet; add region:{x,y,w,h} to zoom.',
59
+ subcategory: 'read',
60
+ safety: 'read',
61
+ requiresApproval: false,
62
+ schemas: {
63
+ input: DocumentViewInputSchema,
64
+ output: DocumentViewOutputSchema
65
+ },
66
+ usageGuidance: {
67
+ when: 'Use to READ a drawing/technical sheet yourself — to see it and judge what is on it (the elements, dimensions, quantities) from the actual pixels, not a transcription.',
68
+ commonPatterns: [
69
+ 'Every call needs `ref` (reuse the full ref from the source/lookup tool) and `page`.',
70
+ 'FIRST call with NO region to see the whole sheet and orient — find where the content you need lives on the sheet.',
71
+ 'THEN call again with region:{x,y,w,h} (fractions 0..1 of the sheet, top-left origin) to zoom into that area and read the dimensions and labels.',
72
+ 'Zoom into a SMALLER region (e.g. w:0.3,h:0.3) for finer detail — a tighter crop spends the whole image on less area, so small text becomes legible.',
73
+ 'You are the one reading the drawing: count distinct units, read the dimension chains, and decide what is relevant — do not defer that judgement to a transcription.'
74
+ ]
75
+ }
76
+ });
77
+ export const documentToolDescriptors = [documentReadToolDescriptor, documentViewToolDescriptor];
78
+ //# sourceMappingURL=descriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../../src/documents/tools/descriptors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEvG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAe,EAAE,eAAe,CAAU,CAAC;AAI7E,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC7C,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,MAAM,GAAG;IACd,IAAI,EAAE,YAAqB;IAC3B,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAU;IACxC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAU;IAC/C,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;IAC5D,GAAG,MAAM;IACT,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EACV,0QAA0Q;IAC3Q,4EAA4E;IAC5E,0EAA0E;IAC1E,0EAA0E;IAC1E,qEAAqE;IACrE,cAAc,EACb,0FAA0F;IAC3F,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAE;QACR,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,wBAAwB;KAChC;IACD,aAAa,EAAE;QACd,IAAI,EAAE,8FAA8F;QACpG,cAAc,EAAE;YACf,gJAAgJ;YAChJ,gGAAgG;YAChG,sGAAsG;YACtG,0FAA0F;YAC1F,yEAAyE;YACzE,0FAA0F;YAC1F,yGAAyG;SACzG;KACD;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;IAC5D,GAAG,MAAM;IACT,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACV,+XAA+X;IAChY,4EAA4E;IAC5E,cAAc,EACb,6FAA6F;IAC9F,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAE;QACR,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,wBAAwB;KAChC;IACD,aAAa,EAAE;QACd,IAAI,EAAE,wKAAwK;QAC9K,cAAc,EAAE;YACf,qFAAqF;YACrF,mHAAmH;YACnH,iJAAiJ;YACjJ,qJAAqJ;YACrJ,qKAAqK;SACrK;KACD;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,0BAA0B,EAAE,0BAA0B,CAAU,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * `document.read` loop guard — the MECHANISM, not anyone's domain.
3
+ *
4
+ * A turn that keeps re-reading queued pages, retrying dead pages, or burning its
5
+ * budget on sheet after sheet is looping, not progressing. This decides when to
6
+ * stop and hands back the copy to stop WITH.
7
+ *
8
+ * It used to live in the platform chat app under a customer's name
9
+ * (`casework-document-read-guard.ts`), which put one org's vocabulary and prose
10
+ * inside a surface every org shares. Everything here is generic; the parts that
11
+ * ARE domain — which words make a line worth quoting, and the summary sentences —
12
+ * are injected via {@link DocumentReadEvidenceVocabulary} and default to neutral.
13
+ * Callers pass plain word LISTS, never regex sources, so a preference travelling
14
+ * as JSON from an org app can never smuggle in a pattern.
15
+ */
16
+ type ToolCallLike = {
17
+ name?: unknown;
18
+ status?: unknown;
19
+ output?: unknown;
20
+ error?: unknown;
21
+ };
22
+ /**
23
+ * The domain half, supplied by the caller (an org app's declared preference).
24
+ * Everything is JSON-serializable so it can ride on staged context.
25
+ */
26
+ export interface DocumentReadEvidenceVocabulary {
27
+ /**
28
+ * Words that mark a line as naming a subject worth quoting back as evidence
29
+ * (e.g. a millwork shop: casework, cabinet, counter). Matched whole-word,
30
+ * case-insensitive, and ESCAPED — these are words, not patterns.
31
+ * Omit to fall back to detail-bearing lines alone.
32
+ */
33
+ subjectWords?: string[];
34
+ /** Sentence used when the guard stops and DID find evidence lines. */
35
+ foundSummary?: string;
36
+ /** Sentence used when no legible evidence lines were found. */
37
+ noEvidenceSummary?: string;
38
+ }
39
+ export type DocumentReadLoopGuardDecision = {
40
+ shouldStop: boolean;
41
+ reason?: 'document-read-budget' | 'repeated-processing-page' | 'repeated-error-page' | 'document-read-errors' | 'vision-executor-unavailable';
42
+ fallbackContent?: string;
43
+ documentReadCount: number;
44
+ readyPageCount: number;
45
+ processingPageCount: number;
46
+ failedReadCount: number;
47
+ };
48
+ export declare function evaluateDocumentReadLoopGuard(toolCalls: Iterable<ToolCallLike>, options?: {
49
+ currentContent?: string;
50
+ userMessage?: string;
51
+ maxEmptyDocumentReads?: number;
52
+ maxRepeatedProcessingPage?: number;
53
+ maxRepeatedProcessingPageWithContent?: number;
54
+ maxDocumentReads?: number;
55
+ maxFailedDocumentReads?: number;
56
+ maxRepeatedErrorPage?: number;
57
+ /** Domain vocabulary + copy for the stop message; neutral defaults when absent. */
58
+ vocabulary?: DocumentReadEvidenceVocabulary;
59
+ }): DocumentReadLoopGuardDecision;
60
+ export {};
61
+ //# sourceMappingURL=document-read-loop-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-read-loop-guard.d.ts","sourceRoot":"","sources":["../../../src/documents/tools/document-read-loop-guard.ts"],"names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,CAgF/B"}
@@ -0,0 +1,314 @@
1
+ import * as z from 'zod/v4';
2
+ const DEFAULT_FOUND_SUMMARY = 'I read the available pages from the requested document set.';
3
+ const DEFAULT_NO_EVIDENCE_SUMMARY = 'The completed document.read pages did not expose legible content lines yet.';
4
+ /** Whole-word, case-insensitive matcher over ESCAPED words (never a caller regex). */
5
+ function subjectMatcher(words) {
6
+ const cleaned = (words ?? []).map((w) => w.trim()).filter((w) => w.length > 0);
7
+ if (cleaned.length === 0)
8
+ return null;
9
+ const escaped = cleaned.map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
10
+ return new RegExp(`\\b(${escaped.join('|')})\\b`, 'i');
11
+ }
12
+ const PageLikeSchema = z.object({
13
+ index: z.union([z.number(), z.string()]).optional(),
14
+ text: z.string().optional(),
15
+ status: z.string().optional(),
16
+ cacheKey: z.string().optional(),
17
+ message: z.string().optional()
18
+ });
19
+ const OutputWithPagesSchema = z.object({
20
+ pages: z.array(z.unknown())
21
+ });
22
+ const OutputErrorObjSchema = z.object({
23
+ message: z.string().optional()
24
+ });
25
+ const CallOutputSchema = z.object({
26
+ error: z.union([z.string(), OutputErrorObjSchema]).optional(),
27
+ ok: z.boolean().optional(),
28
+ message: z.string().optional()
29
+ });
30
+ const DEFAULT_MAX_EMPTY_DOCUMENT_READS = 5;
31
+ const DEFAULT_MAX_REPEATED_PROCESSING_PAGE = 2;
32
+ // A read recipe may SANCTION one re-read of a queued page ("queue other key
33
+ // pages, then re-read the same page to retrieve its cached transcription"), so
34
+ // once the model is already narrating an answer, allow that sanctioned re-read
35
+ // and stop on the THIRD identical processing result — that is a poll loop.
36
+ const DEFAULT_MAX_REPEATED_PROCESSING_PAGE_WITH_CONTENT = 3;
37
+ // Total document.read budget for a single turn once content is streaming. A real
38
+ // pass reads the index + a handful of target pages; dozens of reads with narration
39
+ // in between is the live "keep re-reading and narrating progress" failure.
40
+ const DEFAULT_MAX_DOCUMENT_READS = 12;
41
+ // Distinct failed document.read calls before the turn stops re-trying.
42
+ const DEFAULT_MAX_FAILED_DOCUMENT_READS = 3;
43
+ // The same page erroring twice is already a deterministic dead end — the
44
+ // error-marker cool-off serves the SAME failure back, so a third try cannot
45
+ // succeed within the turn.
46
+ const DEFAULT_MAX_REPEATED_ERROR_PAGE = 2;
47
+ /**
48
+ * Terminal infrastructure signatures. When the OCR/vision executor is not
49
+ * registered in the serving runtime scope (ai-web `NoVisionModelError` →
50
+ * /api/internal/ocr 500), EVERY page read in the turn fails the same way —
51
+ * retrying cannot help and only produces the repeated-read loop. Stop on the
52
+ * FIRST occurrence with one deterministic blocker.
53
+ */
54
+ const TERMINAL_INFRA_PATTERN = /NoVisionModelError|Generation executor not registered|no vision model|vision model.*not (?:registered|available|configured)/i;
55
+ const VISION_UNAVAILABLE_BLOCKER = [
56
+ 'I have to stop here: the drawing-reading service is unavailable right now, so I cannot read any sheets from this set.',
57
+ 'This is a problem on our side — not with the drawing — and retrying will not help until it is fixed.',
58
+ 'The imported drawings are safe. Please try again later, or ask me to report this to the team.',
59
+ ].join(' ');
60
+ function readPages(output) {
61
+ const parsed = OutputWithPagesSchema.safeParse(output);
62
+ if (!parsed.success)
63
+ return [];
64
+ const pages = [];
65
+ for (const rawPage of parsed.data.pages) {
66
+ const page = PageLikeSchema.safeParse(rawPage);
67
+ if (page.success) {
68
+ pages.push(page.data);
69
+ }
70
+ }
71
+ return pages;
72
+ }
73
+ function pageStatus(page) {
74
+ return page.status ?? null;
75
+ }
76
+ function pageIndex(page) {
77
+ return page.index !== undefined ? String(page.index) : 'unknown';
78
+ }
79
+ function pageCacheKey(page) {
80
+ return page.cacheKey && page.cacheKey.length > 0 ? page.cacheKey : null;
81
+ }
82
+ function pageText(page) {
83
+ return page.text ?? '';
84
+ }
85
+ function pageMessage(page) {
86
+ return page.message ?? '';
87
+ }
88
+ /** Every error string a document.read call surfaces: the call-level error, an
89
+ * output error envelope, and per-page error statuses/messages. */
90
+ function readCallErrorTexts(call) {
91
+ const texts = [];
92
+ const callError = z.string().safeParse(call.error);
93
+ if (callError.success && callError.data.trim()) {
94
+ texts.push(callError.data);
95
+ }
96
+ const parsedOutput = CallOutputSchema.safeParse(call.output);
97
+ if (parsedOutput.success) {
98
+ const out = parsedOutput.data;
99
+ if (out.error) {
100
+ const strErr = z.string().safeParse(out.error);
101
+ if (strErr.success && strErr.data.trim()) {
102
+ texts.push(strErr.data);
103
+ }
104
+ else {
105
+ const objErr = OutputErrorObjSchema.safeParse(out.error);
106
+ if (objErr.success && objErr.data.message?.trim()) {
107
+ texts.push(objErr.data.message);
108
+ }
109
+ }
110
+ }
111
+ if (out.ok === false && out.message?.trim()) {
112
+ texts.push(out.message);
113
+ }
114
+ }
115
+ for (const page of readPages(call.output)) {
116
+ if (pageStatus(page) !== 'error')
117
+ continue;
118
+ const message = pageMessage(page) || pageText(page);
119
+ if (message.trim())
120
+ texts.push(message);
121
+ }
122
+ return texts;
123
+ }
124
+ function isFailedRead(call) {
125
+ if (call.status === 'failed')
126
+ return true;
127
+ return readCallErrorTexts(call).length > 0;
128
+ }
129
+ function extractMarker(userMessage) {
130
+ if (!userMessage)
131
+ return null;
132
+ return userMessage.match(/\b[A-Z]{2,}-E2E-\d{8}-\d+\b/)?.[0] ?? null;
133
+ }
134
+ function cleanEvidenceLine(line) {
135
+ return line
136
+ .replace(/^\s{0,3}(?:[-*]|\d+\.)\s+/, '')
137
+ .replace(/\*\*/g, '')
138
+ .replace(/\s+/g, ' ')
139
+ .trim();
140
+ }
141
+ function extractEvidenceBullets(pages, subjectWords) {
142
+ const bullets = [];
143
+ const seen = new Set();
144
+ const titlePattern = subjectMatcher(subjectWords);
145
+ // Detail markers are drawing-generic (dimensions, finishes, materials) — they
146
+ // describe how technical sheets are written, not what trade wrote them.
147
+ const dimensionPattern = /\b(\d+'\s*-|\d+\s*["”]|EQ\.?|TYP\.?|PLM\.?|SS\.?|O\.H\.?|finish|material|dimension)\b/i;
148
+ for (const page of pages) {
149
+ const lines = pageText(page)
150
+ .split(/\r?\n/)
151
+ .map(cleanEvidenceLine)
152
+ .filter((line) => line.length > 0 && !/^#+\s*/.test(line));
153
+ for (let i = 0; i < lines.length && bullets.length < 3; i += 1) {
154
+ const line = lines[i];
155
+ const next = lines.slice(i + 1, i + 4).find((candidate) => dimensionPattern.test(candidate));
156
+ // With a vocabulary: a line must name a subject. Without one: a line must
157
+ // carry detail — so the guard still quotes real evidence for any domain.
158
+ if (titlePattern) {
159
+ if (!titlePattern.test(line))
160
+ continue;
161
+ }
162
+ else if (!dimensionPattern.test(line)) {
163
+ continue;
164
+ }
165
+ const combined = next && next !== line ? `${line}; ${next}` : line;
166
+ const clipped = combined.length > 220 ? `${combined.slice(0, 217)}...` : combined;
167
+ const key = clipped.toLowerCase();
168
+ if (seen.has(key))
169
+ continue;
170
+ seen.add(key);
171
+ bullets.push(clipped);
172
+ }
173
+ }
174
+ return bullets;
175
+ }
176
+ function countMaxRepeats(pages) {
177
+ const counts = new Map();
178
+ for (const page of pages) {
179
+ const key = pageCacheKey(page) ?? `page:${pageIndex(page)}`;
180
+ counts.set(key, (counts.get(key) ?? 0) + 1);
181
+ }
182
+ return Math.max(0, ...counts.values());
183
+ }
184
+ function buildFallbackContent(input) {
185
+ const marker = extractMarker(input.userMessage);
186
+ const bullets = extractEvidenceBullets(input.readyPages, input.vocabulary?.subjectWords);
187
+ const processing = Array.from(new Set(input.processingPages.map(pageIndex))).join(', ');
188
+ const lines = [];
189
+ if (marker)
190
+ lines.push(marker);
191
+ lines.push(input.vocabulary?.foundSummary ?? DEFAULT_FOUND_SUMMARY);
192
+ if (bullets.length > 0) {
193
+ lines.push('');
194
+ lines.push('Evidence from completed document.read pages:');
195
+ for (const bullet of bullets)
196
+ lines.push(`- ${bullet}`);
197
+ }
198
+ else {
199
+ lines.push('');
200
+ lines.push(input.vocabulary?.noEvidenceSummary ?? DEFAULT_NO_EVIDENCE_SUMMARY);
201
+ }
202
+ if (processing) {
203
+ lines.push('');
204
+ lines.push(`Still processing: page ${processing}.`);
205
+ }
206
+ lines.push('');
207
+ lines.push(`I stopped after ${input.documentReadCount} document.read calls rather than keep re-reading queued sheets.`);
208
+ if (input.reason === 'repeated-processing-page') {
209
+ lines.push('The same queued page was returned as processing more than once.');
210
+ }
211
+ return lines.join('\n');
212
+ }
213
+ /** Short blocker for a reply the model already started streaming (appended by
214
+ * the caller) or for an error stop — states only the one deterministic stop. */
215
+ function buildShortBlocker(input) {
216
+ if (input.reason === 'repeated-processing-page') {
217
+ const processing = Array.from(new Set(input.processingPages.map(pageIndex))).join(', ');
218
+ return [
219
+ `I'm stopping here rather than keep re-checking the same sheet${processing ? ` (page ${processing})` : ''} — it is still being read in the background.`,
220
+ 'Ask me again in a moment and I will pick up from its finished text.',
221
+ ].join(' ');
222
+ }
223
+ if (input.reason === 'repeated-error-page' || input.reason === 'document-read-errors') {
224
+ return [
225
+ 'I hit repeated errors reading the drawing sheets and stopped retrying so this does not loop.',
226
+ input.lastErrorText ? `Last error: ${clipErrorText(input.lastErrorText)}.` : '',
227
+ 'Tell me if you want me to try again later, or I can continue with the parts that do not need those sheets.',
228
+ ]
229
+ .filter(Boolean)
230
+ .join(' ');
231
+ }
232
+ return [
233
+ `I'm stopping after ${input.documentReadCount} sheet reads this turn rather than keep going.`,
234
+ 'Tell me which sheets matter most and I will read just those next.',
235
+ ].join(' ');
236
+ }
237
+ function clipErrorText(text) {
238
+ const clean = text.replace(/\s+/g, ' ').trim();
239
+ return clean.length > 160 ? `${clean.slice(0, 157)}...` : clean;
240
+ }
241
+ export function evaluateDocumentReadLoopGuard(toolCalls, options = {}) {
242
+ const currentContent = options.currentContent?.trim() ?? '';
243
+ const hasContent = currentContent.length > 0;
244
+ const maxEmptyDocumentReads = options.maxEmptyDocumentReads ?? DEFAULT_MAX_EMPTY_DOCUMENT_READS;
245
+ const maxRepeatedProcessingPage = hasContent
246
+ ? (options.maxRepeatedProcessingPageWithContent ??
247
+ DEFAULT_MAX_REPEATED_PROCESSING_PAGE_WITH_CONTENT)
248
+ : (options.maxRepeatedProcessingPage ?? DEFAULT_MAX_REPEATED_PROCESSING_PAGE);
249
+ const maxDocumentReads = options.maxDocumentReads ?? DEFAULT_MAX_DOCUMENT_READS;
250
+ const maxFailedDocumentReads = options.maxFailedDocumentReads ?? DEFAULT_MAX_FAILED_DOCUMENT_READS;
251
+ const maxRepeatedErrorPage = options.maxRepeatedErrorPage ?? DEFAULT_MAX_REPEATED_ERROR_PAGE;
252
+ const documentReads = Array.from(toolCalls).filter((call) => call.name === 'document.read');
253
+ const pages = documentReads.flatMap((call) => readPages(call.output));
254
+ const readyPages = pages.filter((page) => pageStatus(page) === 'ready' && pageText(page).trim());
255
+ const processingPages = pages.filter((page) => pageStatus(page) === 'processing');
256
+ const errorPages = pages.filter((page) => pageStatus(page) === 'error');
257
+ const failedReads = documentReads.filter(isFailedRead);
258
+ const errorTexts = documentReads.flatMap(readCallErrorTexts);
259
+ const base = {
260
+ shouldStop: false,
261
+ documentReadCount: documentReads.length,
262
+ readyPageCount: readyPages.length,
263
+ processingPageCount: processingPages.length,
264
+ failedReadCount: failedReads.length,
265
+ };
266
+ if (documentReads.length === 0)
267
+ return base;
268
+ // Terminal infrastructure failure — stop on FIRST sighting, streamed content
269
+ // or not: every further read in this turn fails identically.
270
+ if (errorTexts.some((text) => TERMINAL_INFRA_PATTERN.test(text))) {
271
+ return {
272
+ ...base,
273
+ shouldStop: true,
274
+ reason: 'vision-executor-unavailable',
275
+ fallbackContent: VISION_UNAVAILABLE_BLOCKER,
276
+ };
277
+ }
278
+ const repeatedProcessing = countMaxRepeats(processingPages);
279
+ const repeatedError = countMaxRepeats(errorPages);
280
+ const reason = repeatedError >= maxRepeatedErrorPage
281
+ ? 'repeated-error-page'
282
+ : failedReads.length >= maxFailedDocumentReads
283
+ ? 'document-read-errors'
284
+ : repeatedProcessing >= maxRepeatedProcessingPage
285
+ ? 'repeated-processing-page'
286
+ : documentReads.length >= (hasContent ? maxDocumentReads : maxEmptyDocumentReads)
287
+ ? 'document-read-budget'
288
+ : undefined;
289
+ if (!reason)
290
+ return base;
291
+ const useShortBlocker = hasContent || reason === 'repeated-error-page' || reason === 'document-read-errors';
292
+ const fallbackContent = useShortBlocker
293
+ ? buildShortBlocker({
294
+ reason,
295
+ processingPages,
296
+ documentReadCount: documentReads.length,
297
+ lastErrorText: errorTexts.at(-1),
298
+ })
299
+ : buildFallbackContent({
300
+ userMessage: options.userMessage,
301
+ readyPages,
302
+ processingPages,
303
+ documentReadCount: documentReads.length,
304
+ reason,
305
+ vocabulary: options.vocabulary,
306
+ });
307
+ return {
308
+ ...base,
309
+ shouldStop: true,
310
+ reason,
311
+ fallbackContent,
312
+ };
313
+ }
314
+ //# sourceMappingURL=document-read-loop-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-read-loop-guard.js","sourceRoot":"","sources":["../../../src/documents/tools/document-read-loop-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AA2C5B,MAAM,qBAAqB,GAAG,6DAA6D,CAAC;AAC5F,MAAM,2BAA2B,GAChC,6EAA6E,CAAC;AAE/E,sFAAsF;AACtF,SAAS,cAAc,CAAC,KAA2B;IAClD,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7E,OAAO,IAAI,MAAM,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,GA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qBAAqB,CAAC;oBAChF,CAAC,CAAC,sBAAsB;oBACxB,CAAC,CAAC,SAAS,CAAC;IACjB,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,eAAe,GACpB,UAAU,IAAI,MAAM,KAAK,qBAAqB,IAAI,MAAM,KAAK,sBAAsB,CAAC;IACrF,MAAM,eAAe,GAAG,eAAe;QACtC,CAAC,CAAC,iBAAiB,CAAC;YAClB,MAAM;YACN,eAAe;YACf,iBAAiB,EAAE,aAAa,CAAC,MAAM;YACvC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAChC,CAAC;QACH,CAAC,CAAC,oBAAoB,CAAC;YACrB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,UAAU;YACV,eAAe;YACf,iBAAiB,EAAE,aAAa,CAAC,MAAM;YACvC,MAAM;YACN,UAAU,EAAE,OAAO,CAAC,UAAU;SAC9B,CAAC,CAAC;IAEL,OAAO;QACN,GAAG,IAAI;QACP,UAAU,EAAE,IAAI;QAChB,MAAM;QACN,eAAe;KACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * document.read tool implementation.
3
+ *
4
+ * Cache-first orchestration for document reading:
5
+ * 1. Build a cache key from (ref, page, renderProfile, promptVersion)
6
+ * 2. Look up in the documents.page-cache manifest
7
+ * 3. Cache hit → return stored markdown (+ cached rows when a schema read)
8
+ * 4. Cache miss → render the page PNG once via the scope-injected renderer
9
+ * → POST ai-web /api/internal/ocr (VISION OCR on the PNG) → markdown
10
+ * → when input.schema is set, ALSO POST ai-web
11
+ * /api/internal/document-extract (VISION extract on the SAME
12
+ * PNG) → rows
13
+ * → write markdown (+ rows) to the cache
14
+ *
15
+ * The rendered PNG is produced ONCE per page and fed to BOTH internal calls —
16
+ * extract is a vision read on the page image, not a re-parse of the OCR markdown.
17
+ *
18
+ * HTTP contracts (reconciled to the LIVE ai-web routes):
19
+ *
20
+ * OCR endpoint — VISION OCR on a rasterized page image:
21
+ * POST ${aiOrigin}/api/internal/ocr
22
+ * Headers: Authorization: Bearer ${VIBES_INTERNAL_SERVICE_TOKEN}
23
+ * Content-Type: application/json
24
+ * Body: { image: string (raw base64 PNG), mimeType?, category?,
25
+ * modelId?, modelName?, prompt? }
26
+ * Response: { text: string, markdown: string, metadata: Record<string, unknown> }
27
+ * (Source: apps/ai-web/src/routes/api/internal/ocr/+server.ts)
28
+ *
29
+ * Extract endpoint — schema-driven VISION extract on the SAME page image:
30
+ * POST ${aiOrigin}/api/internal/document-extract
31
+ * Headers: Authorization: Bearer ${VIBES_INTERNAL_SERVICE_TOKEN}
32
+ * Content-Type: application/json
33
+ * Body: { image: string (raw base64 PNG), mimeType?, schema (REQUIRED),
34
+ * vocabulary?: string[], rowContainerKeys?: string[], promptHint?: string, modelId?, modelName? }
35
+ * Response: { rows: unknown[], raw: string, diagnostics: Record<string, unknown> }
36
+ * (Source: apps/ai-web/src/routes/api/internal/document-extract/+server.ts)
37
+ *
38
+ * NOTE: there is no markdown-analyzer endpoint. When input.question is set WITHOUT
39
+ * input.schema, the impl returns the markdown path — the calling agent reads the
40
+ * page markdown to answer the question. A schema is required to get structured rows.
41
+ *
42
+ * A ref's `sourceRefreshUrl` is admitted against the declared destinations before
43
+ * the internal service credential goes to it (`./source-refresh.ts`).
44
+ *
45
+ * TODO(WS0): Wire VIBES_PDF_RENDER_ORIGIN for the consumer-scope renderer.
46
+ * TODO(WS0): Wire the platform CRUD endpoint /api/documents/page-cache (cloud-api adapter).
47
+ */
48
+ import type { VibesRuntime } from '@vibesdotdev/kernel/api/runtime';
49
+ import type { ToolCallContext } from '@vibesdotdev/kernel/schemas/tool-call';
50
+ import type { ToolExecutionInput, ToolImplementation } from '@vibesdotdev/tools/kinds/tool';
51
+ import type { DocumentReadOutput } from '../schemas/document-read.schema.ts';
52
+ import { type DocumentPageCacheRecord } from '../schemas/page-cache.schema.ts';
53
+ import type { DocumentRendererFactory } from '../render/render.interface.ts';
54
+ /**
55
+ * Build a stable cache key for a (ref, page, renderProfile, promptVersion)
56
+ * tuple. Used to look up and write records in the documents.page-cache manifest.
57
+ */
58
+ export declare function buildCacheKey(ref: {
59
+ providerId?: string;
60
+ path?: string;
61
+ url?: string;
62
+ documentId?: string;
63
+ }, page: number, renderProfile: string, promptVersion: string): string;
64
+ export declare function buildFoveatedPageJobId(storageCacheKey: string): Promise<string>;
65
+ export declare function isProcessingCacheRecord(record: DocumentPageCacheRecord): boolean;
66
+ export declare function isStaleProcessingCacheRecord(record: DocumentPageCacheRecord, nowMs?: number): boolean;
67
+ /** A failure marker older than the cool-off (or missing/garbled failedAt —
68
+ * legacy rows) is retryable: the read path re-renders + re-enqueues. */
69
+ export declare function isRetryableErrorCacheRecord(record: DocumentPageCacheRecord, nowMs?: number): boolean;
70
+ export declare class DocumentReadImplementation implements ToolImplementation {
71
+ /** Builds the renderer for each call's runtime (the plugin selects it by scope). */
72
+ private readonly rendererFor;
73
+ constructor(rendererFor: DocumentRendererFactory);
74
+ execute(rawInput: ToolExecutionInput, runtime: VibesRuntime, ctx: ToolCallContext): Promise<DocumentReadOutput>;
75
+ }
76
+ export declare function createDocumentReadTool(rendererFor: DocumentRendererFactory): ToolImplementation;
77
+ //# sourceMappingURL=document-read.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-read.impl.d.ts","sourceRoot":"","sources":["../../../src/documents/tools/document-read.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAOpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAU5F,OAAO,KAAK,EAEX,kBAAkB,EAElB,MAAM,oCAAoC,CAAC;AAE5C,OAA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