@jini-ai/core 0.7.3-next.1 → 0.7.3-next.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 (558) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +68 -0
  3. package/dist/admin-runtime/admin-http.d.ts +43 -0
  4. package/dist/admin-runtime/admin-http.js +11 -0
  5. package/dist/admin-runtime/index.d.ts +1 -0
  6. package/dist/config/env-schema.d.ts +31 -0
  7. package/dist/config/env-schema.js +29 -0
  8. package/dist/contracts/agents/definition.d.ts +9 -1
  9. package/dist/contracts/agents/index.d.ts +1 -0
  10. package/dist/contracts/agents/inventory.d.ts +29 -0
  11. package/dist/contracts/agents/inventory.js +8 -0
  12. package/dist/contracts/agents/provider-ports.d.ts +117 -0
  13. package/dist/contracts/agents/provider-ports.js +2 -0
  14. package/dist/contracts/agents/proxy-provider-kit.d.ts +122 -0
  15. package/dist/contracts/agents/proxy-provider-kit.js +119 -0
  16. package/dist/contracts/agents/proxy-provider.d.ts +34 -0
  17. package/dist/contracts/agents/proxy-provider.js +2 -0
  18. package/dist/contracts/blob-gc.d.ts +69 -0
  19. package/dist/contracts/blob-gc.js +13 -0
  20. package/dist/contracts/credentials.d.ts +5 -19
  21. package/dist/contracts/desktop-zoom.d.ts +7 -0
  22. package/dist/contracts/desktop-zoom.js +6 -0
  23. package/dist/contracts/events/change-set.d.ts +12 -3
  24. package/dist/contracts/events/command.d.ts +11 -5
  25. package/dist/contracts/events/ports.d.ts +38 -0
  26. package/dist/contracts/events/ports.js +8 -1
  27. package/dist/contracts/events.d.ts +2 -1
  28. package/dist/contracts/events.js +1 -1
  29. package/dist/contracts/execution.d.ts +541 -0
  30. package/dist/contracts/execution.js +2 -0
  31. package/dist/contracts/find-in-page.d.ts +12 -0
  32. package/dist/contracts/find-in-page.js +7 -0
  33. package/dist/contracts/headless/chart-providers.d.ts +12 -0
  34. package/dist/contracts/headless/chart-providers.js +2 -0
  35. package/dist/contracts/headless/chat-attachment.d.ts +21 -0
  36. package/dist/contracts/headless/chat-attachment.js +9 -0
  37. package/dist/contracts/headless/contracts.d.ts +179 -0
  38. package/dist/contracts/headless/contracts.js +2 -0
  39. package/dist/contracts/headless/form-delivery-status.d.ts +35 -0
  40. package/dist/contracts/headless/form-delivery-status.js +2 -0
  41. package/dist/contracts/headless/member-login.d.ts +3 -0
  42. package/dist/contracts/headless/member-login.js +3 -0
  43. package/dist/contracts/headless/operator-locale.d.ts +17 -0
  44. package/dist/contracts/headless/operator-locale.js +2 -0
  45. package/dist/contracts/headless/plugin-export-catalog.d.ts +21 -0
  46. package/dist/contracts/headless/plugin-export-catalog.js +2 -0
  47. package/dist/contracts/headless/plugin-host.d.ts +128 -0
  48. package/dist/contracts/headless/plugin-host.js +2 -0
  49. package/dist/contracts/headless/plugin-install-source.d.ts +82 -0
  50. package/dist/contracts/headless/plugin-install-source.js +12 -0
  51. package/dist/contracts/headless/site-cookie-consent.d.ts +41 -0
  52. package/dist/contracts/headless/site-cookie-consent.js +2 -0
  53. package/dist/contracts/hosted-mcp/admissions.d.ts +125 -0
  54. package/dist/contracts/hosted-mcp/admissions.js +3 -0
  55. package/dist/contracts/hosted-mcp/record.d.ts +7 -2
  56. package/dist/contracts/hosted-mcp.d.ts +1 -0
  57. package/dist/contracts/mail.d.ts +28 -2
  58. package/dist/contracts/mail.js +3 -0
  59. package/dist/contracts/observability.d.ts +15 -0
  60. package/dist/contracts/observability.js +1 -0
  61. package/dist/contracts/run-attempt.d.ts +14 -0
  62. package/dist/contracts/run-attempt.js +7 -0
  63. package/dist/contracts/server/api-error.js +1 -0
  64. package/dist/contracts/server/client-facing-error.d.ts +25 -0
  65. package/dist/contracts/server/client-facing-error.js +21 -0
  66. package/dist/contracts/server/deferred-body.d.ts +65 -0
  67. package/dist/contracts/server/deferred-body.js +2 -0
  68. package/dist/contracts/server/failure-copy.d.ts +19 -0
  69. package/dist/contracts/server/failure-copy.js +26 -0
  70. package/dist/contracts/server/json-route.d.ts +52 -26
  71. package/dist/contracts/server/json-route.js +128 -32
  72. package/dist/contracts/server/request-body.d.ts +12 -0
  73. package/dist/contracts/server/request-body.js +7 -3
  74. package/dist/contracts/server/route-reply.d.ts +32 -0
  75. package/dist/contracts/server/route-reply.js +26 -0
  76. package/dist/contracts/server.d.ts +4 -0
  77. package/dist/contracts/server.js +4 -0
  78. package/dist/contracts/site/admin-sites.d.ts +134 -0
  79. package/dist/contracts/site/admin-sites.js +7 -0
  80. package/dist/contracts/site/admin-surfaces-connections.d.ts +128 -0
  81. package/dist/contracts/site/admin-surfaces-connections.js +2 -0
  82. package/dist/contracts/site/agent-plugins-admin-surfaces.d.ts +218 -0
  83. package/dist/contracts/site/agent-plugins-admin-surfaces.js +2 -0
  84. package/dist/contracts/site/agent-plugins-connect.d.ts +25 -0
  85. package/dist/contracts/site/agent-plugins-connect.js +2 -0
  86. package/dist/contracts/site/agent-plugins-lifecycle.d.ts +151 -0
  87. package/dist/contracts/site/agent-plugins-lifecycle.js +2 -0
  88. package/dist/contracts/site/agent-plugins-manifest.d.ts +41 -0
  89. package/dist/contracts/site/agent-plugins-manifest.js +11 -0
  90. package/dist/contracts/site/agent-runtime.d.ts +110 -0
  91. package/dist/contracts/site/agent-runtime.js +2 -0
  92. package/dist/contracts/site/agentic-core.d.ts +44 -0
  93. package/dist/contracts/site/agentic-core.js +9 -0
  94. package/dist/contracts/site/agentic-dom.d.ts +27 -0
  95. package/dist/contracts/site/agentic-dom.js +2 -0
  96. package/dist/contracts/site/agentic.d.ts +37 -0
  97. package/dist/contracts/site/agentic.js +8 -0
  98. package/dist/contracts/site/analytics.d.ts +81 -0
  99. package/dist/contracts/site/analytics.js +2 -0
  100. package/dist/contracts/site/api-ai-assistant-api-types.d.ts +182 -0
  101. package/dist/contracts/site/api-ai-assistant-api-types.js +2 -0
  102. package/dist/contracts/site/api-connections-hosted-mcp.d.ts +176 -0
  103. package/dist/contracts/site/api-connections-hosted-mcp.js +2 -0
  104. package/dist/contracts/site/api-security-api-types.d.ts +177 -0
  105. package/dist/contracts/site/api-security-api-types.js +2 -0
  106. package/dist/contracts/site/approval-i18n.d.ts +32 -0
  107. package/dist/contracts/site/approval-i18n.js +156 -0
  108. package/dist/contracts/site/asset-transfer-tool-ports.d.ts +54 -0
  109. package/dist/contracts/site/asset-transfer-tool-ports.js +2 -0
  110. package/dist/contracts/site/assistant-host-ports.d.ts +23 -0
  111. package/dist/contracts/site/assistant-host-ports.js +2 -0
  112. package/dist/contracts/site/assistant-mcp-services.d.ts +26 -0
  113. package/dist/contracts/site/assistant-mcp-services.js +8 -0
  114. package/dist/contracts/site/assistant-tool-contributions.d.ts +45 -0
  115. package/dist/contracts/site/assistant-tool-contributions.js +2 -0
  116. package/dist/contracts/site/chat-core.d.ts +93 -0
  117. package/dist/contracts/site/chat-core.js +13 -0
  118. package/dist/contracts/site/client-directives.d.ts +21 -0
  119. package/dist/contracts/site/client-directives.js +8 -0
  120. package/dist/contracts/site/cms-admin-media.d.ts +61 -0
  121. package/dist/contracts/site/cms-admin-media.js +7 -0
  122. package/dist/contracts/site/cms-agent-plugins.d.ts +114 -0
  123. package/dist/contracts/site/cms-agent-plugins.js +17 -0
  124. package/dist/contracts/site/cms-assistant.d.ts +74 -0
  125. package/dist/contracts/site/cms-assistant.js +17 -0
  126. package/dist/contracts/site/cms-core.d.ts +17 -0
  127. package/dist/contracts/site/cms-core.js +12 -0
  128. package/dist/contracts/site/cms-external-mcp.d.ts +206 -0
  129. package/dist/contracts/site/cms-external-mcp.js +13 -0
  130. package/dist/contracts/site/cms-forms.d.ts +192 -0
  131. package/dist/contracts/site/cms-forms.js +15 -0
  132. package/dist/contracts/site/cms-integrations.d.ts +47 -0
  133. package/dist/contracts/site/cms-integrations.js +8 -0
  134. package/dist/contracts/site/cms-mail.d.ts +39 -0
  135. package/dist/contracts/site/cms-mail.js +12 -0
  136. package/dist/contracts/site/cms-media.d.ts +449 -0
  137. package/dist/contracts/site/cms-media.js +3 -0
  138. package/dist/contracts/site/cms-menus.d.ts +109 -0
  139. package/dist/contracts/site/cms-menus.js +13 -0
  140. package/dist/contracts/site/cms-plugins.d.ts +81 -0
  141. package/dist/contracts/site/cms-plugins.js +13 -0
  142. package/dist/contracts/site/cms-publish-content.d.ts +129 -0
  143. package/dist/contracts/site/cms-publish-content.js +13 -0
  144. package/dist/contracts/site/cms-recovery.d.ts +37 -0
  145. package/dist/contracts/site/cms-recovery.js +13 -0
  146. package/dist/contracts/site/cms-seo.d.ts +124 -0
  147. package/dist/contracts/site/cms-seo.js +17 -0
  148. package/dist/contracts/site/cms-settings.d.ts +47 -0
  149. package/dist/contracts/site/cms-settings.js +15 -0
  150. package/dist/contracts/site/cms-sites.d.ts +24 -0
  151. package/dist/contracts/site/cms-sites.js +12 -0
  152. package/dist/contracts/site/cms-system-deploy.d.ts +37 -0
  153. package/dist/contracts/site/cms-system-deploy.js +9 -0
  154. package/dist/contracts/site/cms-trash.d.ts +235 -0
  155. package/dist/contracts/site/cms-trash.js +10 -0
  156. package/dist/contracts/site/cms-workspace.d.ts +14 -0
  157. package/dist/contracts/site/cms-workspace.js +7 -0
  158. package/dist/contracts/site/comments-providers.d.ts +187 -0
  159. package/dist/contracts/site/comments-providers.js +2 -0
  160. package/dist/contracts/site/commerce.d.ts +35 -0
  161. package/dist/contracts/site/commerce.js +12 -0
  162. package/dist/contracts/site/composition-provider-config-source.d.ts +46 -0
  163. package/dist/contracts/site/composition-provider-config-source.js +2 -0
  164. package/dist/contracts/site/content-editor-ports.d.ts +239 -0
  165. package/dist/contracts/site/content-editor-ports.js +2 -0
  166. package/dist/contracts/site/contracts-resources.d.ts +21 -0
  167. package/dist/contracts/site/contracts-resources.js +7 -0
  168. package/dist/contracts/site/cookie-consent-react.d.ts +44 -0
  169. package/dist/contracts/site/cookie-consent-react.js +8 -0
  170. package/dist/contracts/site/cookie-consent.d.ts +100 -0
  171. package/dist/contracts/site/cookie-consent.js +9 -0
  172. package/dist/contracts/site/core-commands.d.ts +66 -0
  173. package/dist/contracts/site/core-commands.js +15 -0
  174. package/dist/contracts/site/core-consent-refusal.d.ts +7 -0
  175. package/dist/contracts/site/core-consent-refusal.js +2 -0
  176. package/dist/contracts/site/core-custom-credential-categories.d.ts +14 -0
  177. package/dist/contracts/site/core-custom-credential-categories.js +7 -0
  178. package/dist/contracts/site/core-public-page-security-headers.d.ts +13 -0
  179. package/dist/contracts/site/core-public-page-security-headers.js +3 -0
  180. package/dist/contracts/site/core-run-events.d.ts +49 -0
  181. package/dist/contracts/site/core-run-events.js +11 -0
  182. package/dist/contracts/site/core-runtime-mode.d.ts +9 -0
  183. package/dist/contracts/site/core-runtime-mode.js +2 -0
  184. package/dist/contracts/site/core-theme-slots.d.ts +31 -0
  185. package/dist/contracts/site/core-theme-slots.js +3 -0
  186. package/dist/contracts/site/credential-project-half.d.ts +18 -0
  187. package/dist/contracts/site/credential-project-half.js +2 -0
  188. package/dist/contracts/site/custom-credential-publish-compatibility.d.ts +11 -0
  189. package/dist/contracts/site/custom-credential-publish-compatibility.js +2 -0
  190. package/dist/contracts/site/daemon-core-rpc.d.ts +114 -0
  191. package/dist/contracts/site/daemon-core-rpc.js +2 -0
  192. package/dist/contracts/site/daemon-http.d.ts +197 -0
  193. package/dist/contracts/site/daemon-http.js +11 -0
  194. package/dist/contracts/site/daemon-surface-exchanges.d.ts +46 -0
  195. package/dist/contracts/site/daemon-surface-exchanges.js +2 -0
  196. package/dist/contracts/site/daemon-tool-audit.d.ts +43 -0
  197. package/dist/contracts/site/daemon-tool-audit.js +9 -0
  198. package/dist/contracts/site/daemon-tool-recovery.d.ts +36 -0
  199. package/dist/contracts/site/daemon-tool-recovery.js +9 -0
  200. package/dist/contracts/site/daemon.d.ts +45 -0
  201. package/dist/contracts/site/daemon.js +2 -0
  202. package/dist/contracts/site/database-introspection.d.ts +46 -0
  203. package/dist/contracts/site/database-introspection.js +2 -0
  204. package/dist/contracts/site/db-data-modules.d.ts +61 -0
  205. package/dist/contracts/site/db-data-modules.js +6 -0
  206. package/dist/contracts/site/deployment-admin.d.ts +74 -0
  207. package/dist/contracts/site/deployment-admin.js +2 -0
  208. package/dist/contracts/site/dev-supervisor-dev-restart.d.ts +26 -0
  209. package/dist/contracts/site/dev-supervisor-dev-restart.js +10 -0
  210. package/dist/contracts/site/devops-deploy.d.ts +77 -0
  211. package/dist/contracts/site/devops-deploy.js +9 -0
  212. package/dist/contracts/site/diagnostics-domain-dns.d.ts +10 -0
  213. package/dist/contracts/site/diagnostics-domain-dns.js +7 -0
  214. package/dist/contracts/site/diagnostics-observability.d.ts +66 -0
  215. package/dist/contracts/site/diagnostics-observability.js +2 -0
  216. package/dist/contracts/site/events-outbox.d.ts +56 -0
  217. package/dist/contracts/site/events-outbox.js +10 -0
  218. package/dist/contracts/site/export-run.d.ts +54 -0
  219. package/dist/contracts/site/export-run.js +9 -0
  220. package/dist/contracts/site/external-mcp-tool-ports.d.ts +28 -0
  221. package/dist/contracts/site/external-mcp-tool-ports.js +2 -0
  222. package/dist/contracts/site/fs-durable-json.d.ts +22 -0
  223. package/dist/contracts/site/fs-durable-json.js +7 -0
  224. package/dist/contracts/site/gated-mutations/watermark.d.ts +44 -0
  225. package/dist/contracts/site/gated-mutations/watermark.js +37 -0
  226. package/dist/contracts/site/gated-mutations-ports.d.ts +45 -0
  227. package/dist/contracts/site/gated-mutations-ports.js +6 -0
  228. package/dist/contracts/site/gated-results.d.ts +17 -0
  229. package/dist/contracts/site/gated-results.js +8 -0
  230. package/dist/contracts/site/headless-assistant-permanent-deletes-policy.d.ts +16 -0
  231. package/dist/contracts/site/headless-assistant-permanent-deletes-policy.js +8 -0
  232. package/dist/contracts/site/hooks-sites-port-hooks.d.ts +151 -0
  233. package/dist/contracts/site/hooks-sites-port-hooks.js +7 -0
  234. package/dist/contracts/site/host-node.d.ts +213 -0
  235. package/dist/contracts/site/host-node.js +2 -0
  236. package/dist/contracts/site/html-region-ports.d.ts +103 -0
  237. package/dist/contracts/site/html-region-ports.js +2 -0
  238. package/dist/contracts/site/http-kit-rate-limit.d.ts +21 -0
  239. package/dist/contracts/site/http-kit-rate-limit.js +8 -0
  240. package/dist/contracts/site/http-kit-settings.d.ts +12 -0
  241. package/dist/contracts/site/http-kit-settings.js +8 -0
  242. package/dist/contracts/site/human-confirm.d.ts +42 -0
  243. package/dist/contracts/site/human-confirm.js +2 -0
  244. package/dist/contracts/site/installed-skill.d.ts +16 -0
  245. package/dist/contracts/site/installed-skill.js +2 -0
  246. package/dist/contracts/site/integrations-api-connections.d.ts +19 -0
  247. package/dist/contracts/site/integrations-api-connections.js +7 -0
  248. package/dist/contracts/site/integrations-credentialed-http.d.ts +16 -0
  249. package/dist/contracts/site/integrations-credentialed-http.js +8 -0
  250. package/dist/contracts/site/legacy-owner-store.d.ts +15 -0
  251. package/dist/contracts/site/legacy-owner-store.js +5 -0
  252. package/dist/contracts/site/lifecycle-boot-lifecycle.d.ts +27 -0
  253. package/dist/contracts/site/lifecycle-boot-lifecycle.js +10 -0
  254. package/dist/contracts/site/lifecycle-host-tools.d.ts +64 -0
  255. package/dist/contracts/site/lifecycle-host-tools.js +2 -0
  256. package/dist/contracts/site/media-provider-contribution.d.ts +118 -0
  257. package/dist/contracts/site/media-provider-contribution.js +3 -0
  258. package/dist/contracts/site/media-providers-catalog.d.ts +42 -0
  259. package/dist/contracts/site/media-providers-catalog.js +7 -0
  260. package/dist/contracts/site/media-tool-ports.d.ts +166 -0
  261. package/dist/contracts/site/media-tool-ports.js +2 -0
  262. package/dist/contracts/site/media-upload-limits.d.ts +6 -0
  263. package/dist/contracts/site/media-upload-limits.js +7 -0
  264. package/dist/contracts/site/nav.d.ts +46 -0
  265. package/dist/contracts/site/nav.js +10 -0
  266. package/dist/contracts/site/oauth-callback-page.d.ts +47 -0
  267. package/dist/contracts/site/oauth-callback-page.js +31 -0
  268. package/dist/contracts/site/packaging-electron.d.ts +20 -0
  269. package/dist/contracts/site/packaging-electron.js +7 -0
  270. package/dist/contracts/site/page-html-store.d.ts +138 -0
  271. package/dist/contracts/site/page-html-store.js +2 -0
  272. package/dist/contracts/site/platform-mail.d.ts +221 -0
  273. package/dist/contracts/site/platform-mail.js +2 -0
  274. package/dist/contracts/site/platform-process.d.ts +23 -0
  275. package/dist/contracts/site/platform-process.js +7 -0
  276. package/dist/contracts/site/platform-server-logs.d.ts +51 -0
  277. package/dist/contracts/site/platform-server-logs.js +15 -0
  278. package/dist/contracts/site/platform-site-dir.d.ts +58 -0
  279. package/dist/contracts/site/platform-site-dir.js +7 -0
  280. package/dist/contracts/site/plugin-directory.d.ts +29 -0
  281. package/dist/contracts/site/plugin-directory.js +2 -0
  282. package/dist/contracts/site/plugins-host.d.ts +92 -0
  283. package/dist/contracts/site/plugins-host.js +2 -0
  284. package/dist/contracts/site/post-author.d.ts +8 -0
  285. package/dist/contracts/site/post-author.js +5 -0
  286. package/dist/contracts/site/post-kind.d.ts +10 -0
  287. package/dist/contracts/site/post-kind.js +2 -0
  288. package/dist/contracts/site/post-revision-lock.d.ts +17 -0
  289. package/dist/contracts/site/post-revision-lock.js +16 -0
  290. package/dist/contracts/site/project-key-attachments.d.ts +78 -0
  291. package/dist/contracts/site/project-key-attachments.js +2 -0
  292. package/dist/contracts/site/protocol-mcp-ui.d.ts +37 -0
  293. package/dist/contracts/site/protocol-mcp-ui.js +12 -0
  294. package/dist/contracts/site/public-origin.d.ts +9 -0
  295. package/dist/contracts/site/public-origin.js +22 -0
  296. package/dist/contracts/site/publish-ports.d.ts +42 -0
  297. package/dist/contracts/site/publish-ports.js +31 -0
  298. package/dist/contracts/site/recovery-operation-lock.d.ts +27 -0
  299. package/dist/contracts/site/recovery-operation-lock.js +11 -0
  300. package/dist/contracts/site/recovery-reconcile-interrupted-migration.d.ts +16 -0
  301. package/dist/contracts/site/recovery-reconcile-interrupted-migration.js +12 -0
  302. package/dist/contracts/site/request-facts.d.ts +28 -0
  303. package/dist/contracts/site/request-facts.js +28 -0
  304. package/dist/contracts/site/routines.d.ts +64 -0
  305. package/dist/contracts/site/routines.js +2 -0
  306. package/dist/contracts/site/sandbox-node-worker.d.ts +15 -0
  307. package/dist/contracts/site/sandbox-node-worker.js +9 -0
  308. package/dist/contracts/site/search.d.ts +181 -0
  309. package/dist/contracts/site/search.js +2 -0
  310. package/dist/contracts/site/secrets-credential-sets.d.ts +117 -0
  311. package/dist/contracts/site/secrets-credential-sets.js +2 -0
  312. package/dist/contracts/site/secrets-credential-token.d.ts +11 -0
  313. package/dist/contracts/site/secrets-credential-token.js +7 -0
  314. package/dist/contracts/site/seo-content-analysis.d.ts +18 -0
  315. package/dist/contracts/site/seo-content-analysis.js +7 -0
  316. package/dist/contracts/site/site-assistant-visitor-tools-management.d.ts +85 -0
  317. package/dist/contracts/site/site-assistant-visitor-tools-management.js +8 -0
  318. package/dist/contracts/site/site-import-history.d.ts +67 -0
  319. package/dist/contracts/site/site-import-history.js +2 -0
  320. package/dist/contracts/site/site-key.d.ts +133 -0
  321. package/dist/contracts/site/site-key.js +9 -0
  322. package/dist/contracts/site/site-serving-gate.d.ts +13 -0
  323. package/dist/contracts/site/site-serving-gate.js +22 -0
  324. package/dist/contracts/site/skill-install.d.ts +17 -0
  325. package/dist/contracts/site/skill-install.js +2 -0
  326. package/dist/contracts/site/skills-install.d.ts +21 -0
  327. package/dist/contracts/site/skills-install.js +7 -0
  328. package/dist/contracts/site/soft-delete.d.ts +13 -0
  329. package/dist/contracts/site/soft-delete.js +13 -0
  330. package/dist/contracts/site/source-control-credentials.d.ts +197 -0
  331. package/dist/contracts/site/source-control-credentials.js +2 -0
  332. package/dist/contracts/site/strict-base64.d.ts +30 -0
  333. package/dist/contracts/site/strict-base64.js +33 -0
  334. package/dist/contracts/site/tool-metadata-approval-policy.d.ts +13 -0
  335. package/dist/contracts/site/tool-metadata-approval-policy.js +2 -0
  336. package/dist/contracts/site/ui-sections.d.ts +27 -0
  337. package/dist/contracts/site/ui-sections.js +13 -0
  338. package/dist/contracts/site/user-management-react.d.ts +276 -0
  339. package/dist/contracts/site/user-management-react.js +9 -0
  340. package/dist/contracts/site/user-management-server.d.ts +104 -0
  341. package/dist/contracts/site/user-management-server.js +2 -0
  342. package/dist/contracts/site/user-management.d.ts +379 -0
  343. package/dist/contracts/site/user-management.js +2 -0
  344. package/dist/contracts/site/vault-context.d.ts +15 -0
  345. package/dist/contracts/site/vault-context.js +6 -0
  346. package/dist/contracts/site/vendor-credentials.d.ts +37 -0
  347. package/dist/contracts/site/vendor-credentials.js +2 -0
  348. package/dist/contracts/site/web-evidence-capture-budget.d.ts +16 -0
  349. package/dist/contracts/site/web-evidence-capture-budget.js +7 -0
  350. package/dist/contracts/site/web-evidence-playwright.d.ts +38 -0
  351. package/dist/contracts/site/web-evidence-playwright.js +9 -0
  352. package/dist/contracts/site/web-screenshot.d.ts +58 -0
  353. package/dist/contracts/site/web-screenshot.js +7 -0
  354. package/dist/contracts/site/widgets-html.d.ts +40 -0
  355. package/dist/contracts/site/widgets-html.js +7 -0
  356. package/dist/contracts/speech-transcription.d.ts +27 -0
  357. package/dist/contracts/speech-transcription.js +8 -0
  358. package/dist/contracts/standing-draft.d.ts +38 -0
  359. package/dist/contracts/standing-draft.js +2 -0
  360. package/dist/contracts/storage/cleanup-preview.d.ts +23 -0
  361. package/dist/contracts/storage/cleanup-preview.js +2 -0
  362. package/dist/contracts/storage/rows.d.ts +6 -2
  363. package/dist/contracts/storage/rows.js +3 -3
  364. package/dist/contracts/storage/sqlite-compaction.d.ts +108 -0
  365. package/dist/contracts/storage/sqlite-compaction.js +7 -0
  366. package/dist/contracts/storage.d.ts +2 -0
  367. package/dist/contracts/tool-result-block.d.ts +21 -0
  368. package/dist/contracts/tool-result-block.js +8 -0
  369. package/dist/errors/catalog.js +2 -2
  370. package/dist/errors/reporter.d.ts +81 -13
  371. package/dist/errors/reporter.js +220 -32
  372. package/dist/errors/route-refusal.d.ts +29 -0
  373. package/dist/errors/route-refusal.js +25 -0
  374. package/dist/errors/testing.d.ts +6 -7
  375. package/dist/errors/testing.js +7 -4
  376. package/dist/extension-capability-vocabulary.d.ts +29 -0
  377. package/dist/extension-capability-vocabulary.js +31 -0
  378. package/dist/gated-mutations/gateway.d.ts +2 -0
  379. package/dist/gated-mutations/gateway.js +4 -1
  380. package/dist/index.d.ts +2 -1
  381. package/dist/index.js +1 -0
  382. package/dist/keyset-cursor.d.ts +25 -0
  383. package/dist/keyset-cursor.js +20 -0
  384. package/dist/native-approval-memory.d.ts +22 -0
  385. package/dist/native-approval-memory.js +32 -0
  386. package/dist/net/public-dns-vocabulary.d.ts +17 -0
  387. package/dist/net/public-dns-vocabulary.js +14 -0
  388. package/dist/object-store.d.ts +7 -0
  389. package/dist/object-store.js +1 -0
  390. package/dist/operator-locale.d.ts +29 -0
  391. package/dist/operator-locale.js +27 -0
  392. package/dist/optimistic-concurrency.d.ts +23 -0
  393. package/dist/origin-validation.d.ts +7 -0
  394. package/dist/origin-validation.js +8 -1
  395. package/dist/primitives/creator-kind.d.ts +27 -0
  396. package/dist/primitives/creator-kind.js +20 -0
  397. package/dist/primitives/index.d.ts +2 -0
  398. package/dist/primitives/index.js +2 -0
  399. package/dist/primitives/lazy-proxy.d.ts +5 -0
  400. package/dist/primitives/lazy-proxy.js +17 -0
  401. package/dist/redaction-collectors.js +60 -39
  402. package/dist/redaction-exact-secrets.js +4 -4
  403. package/dist/redaction-labels.d.ts +3 -1
  404. package/dist/redaction-labels.js +3 -3
  405. package/dist/redaction-patterns.d.ts +3 -1
  406. package/dist/redaction-patterns.js +1 -1
  407. package/dist/redaction-spans.d.ts +5 -1
  408. package/dist/redaction-spans.js +2 -2
  409. package/dist/registration-kit.d.ts +12 -0
  410. package/dist/registration-kit.js +14 -0
  411. package/dist/scheduled-publish.d.ts +57 -0
  412. package/dist/scheduled-publish.js +33 -0
  413. package/dist/settings/ensure-definitions.d.ts +8 -0
  414. package/dist/settings/guarded-reads.d.ts +58 -0
  415. package/dist/settings/guarded-reads.js +48 -0
  416. package/dist/settings/index.d.ts +3 -2
  417. package/dist/settings/index.js +1 -0
  418. package/dist/settings/settings.d.ts +8 -0
  419. package/dist/settings/write-definition-rename.js +2 -2
  420. package/dist/settings/write-definition-retype.js +4 -4
  421. package/dist/settings/write-definition-status.js +4 -4
  422. package/dist/settings/write-service.d.ts +14 -6
  423. package/dist/settings/write-service.js +2 -2
  424. package/dist/surface-exchanges.d.ts +32 -1
  425. package/dist/text/descriptor-i18n.d.ts +4 -1
  426. package/dist/text/descriptor-i18n.js +4 -1
  427. package/dist/text/index.d.ts +3 -0
  428. package/dist/text/index.js +2 -0
  429. package/dist/text/merge-locale-overlays.d.ts +25 -0
  430. package/dist/text/merge-locale-overlays.js +23 -0
  431. package/dist/text/upload-limit-message.d.ts +19 -0
  432. package/dist/text/upload-limit-message.js +29 -0
  433. package/dist/tool-access-change.d.ts +12 -0
  434. package/dist/tool-access-change.js +6 -0
  435. package/dist/tool-metadata/agent-pause.d.ts +21 -0
  436. package/dist/tool-metadata/agent-pause.js +9 -0
  437. package/dist/tool-metadata/agent-plugins.d.ts +72 -0
  438. package/dist/tool-metadata/agent-plugins.js +54 -0
  439. package/dist/tool-metadata/analytics.d.ts +14 -0
  440. package/dist/tool-metadata/analytics.js +17 -0
  441. package/dist/tool-metadata/change-sets.d.ts +24 -0
  442. package/dist/tool-metadata/change-sets.js +19 -0
  443. package/dist/tool-metadata/comments.d.ts +105 -0
  444. package/dist/tool-metadata/comments.js +106 -0
  445. package/dist/tool-metadata/commerce.d.ts +30 -0
  446. package/dist/tool-metadata/commerce.js +11 -0
  447. package/dist/tool-metadata/consent.d.ts +57 -0
  448. package/dist/tool-metadata/consent.js +16 -0
  449. package/dist/tool-metadata/content-duplication.d.ts +13 -0
  450. package/dist/tool-metadata/content-duplication.js +14 -0
  451. package/dist/tool-metadata/content-types.d.ts +74 -0
  452. package/dist/tool-metadata/content-types.js +96 -0
  453. package/dist/tool-metadata/custom-credentials.d.ts +117 -0
  454. package/dist/tool-metadata/custom-credentials.js +105 -0
  455. package/dist/tool-metadata/database-transfer.d.ts +48 -0
  456. package/dist/tool-metadata/database-transfer.js +32 -0
  457. package/dist/tool-metadata/database.d.ts +90 -0
  458. package/dist/tool-metadata/database.js +111 -0
  459. package/dist/tool-metadata/deploy-ops.d.ts +99 -0
  460. package/dist/tool-metadata/deploy-ops.js +96 -0
  461. package/dist/tool-metadata/deployments.d.ts +101 -0
  462. package/dist/tool-metadata/deployments.js +81 -0
  463. package/dist/tool-metadata/domain-dns.d.ts +84 -0
  464. package/dist/tool-metadata/domain-dns.js +99 -0
  465. package/dist/tool-metadata/email-templates.d.ts +54 -0
  466. package/dist/tool-metadata/email-templates.js +41 -0
  467. package/dist/tool-metadata/entries.d.ts +54 -0
  468. package/dist/tool-metadata/entries.js +70 -0
  469. package/dist/tool-metadata/external-mcp.d.ts +86 -0
  470. package/dist/tool-metadata/external-mcp.js +80 -0
  471. package/dist/tool-metadata/files-copy.d.ts +14 -0
  472. package/dist/tool-metadata/files-copy.js +18 -0
  473. package/dist/tool-metadata/forms.d.ts +94 -0
  474. package/dist/tool-metadata/forms.js +117 -0
  475. package/dist/tool-metadata/frontend-control.d.ts +118 -0
  476. package/dist/tool-metadata/frontend-control.js +78 -0
  477. package/dist/tool-metadata/fs-files.d.ts +36 -0
  478. package/dist/tool-metadata/fs-files.js +46 -0
  479. package/dist/tool-metadata/identity.d.ts +184 -0
  480. package/dist/tool-metadata/identity.js +226 -0
  481. package/dist/tool-metadata/image-transform.d.ts +14 -0
  482. package/dist/tool-metadata/image-transform.js +18 -0
  483. package/dist/tool-metadata/mail-status.d.ts +132 -0
  484. package/dist/tool-metadata/mail-status.js +104 -0
  485. package/dist/tool-metadata/media-generation.d.ts +24 -0
  486. package/dist/tool-metadata/media-generation.js +29 -0
  487. package/dist/tool-metadata/media-import.d.ts +34 -0
  488. package/dist/tool-metadata/media-import.js +40 -0
  489. package/dist/tool-metadata/media-video-conversion.d.ts +19 -0
  490. package/dist/tool-metadata/media-video-conversion.js +20 -0
  491. package/dist/tool-metadata/media.d.ts +106 -0
  492. package/dist/tool-metadata/media.js +103 -0
  493. package/dist/tool-metadata/members.d.ts +71 -0
  494. package/dist/tool-metadata/members.js +69 -0
  495. package/dist/tool-metadata/navigation.d.ts +54 -0
  496. package/dist/tool-metadata/navigation.js +71 -0
  497. package/dist/tool-metadata/newsletter.d.ts +190 -0
  498. package/dist/tool-metadata/newsletter.js +246 -0
  499. package/dist/tool-metadata/observability.d.ts +13 -0
  500. package/dist/tool-metadata/observability.js +8 -0
  501. package/dist/tool-metadata/pages.d.ts +47 -0
  502. package/dist/tool-metadata/pages.js +67 -0
  503. package/dist/tool-metadata/permanent-delete.d.ts +139 -0
  504. package/dist/tool-metadata/permanent-delete.js +121 -0
  505. package/dist/tool-metadata/plugin-runtime.d.ts +144 -0
  506. package/dist/tool-metadata/plugin-runtime.js +88 -0
  507. package/dist/tool-metadata/post.d.ts +87 -0
  508. package/dist/tool-metadata/post.js +117 -0
  509. package/dist/tool-metadata/recovery.d.ts +65 -0
  510. package/dist/tool-metadata/recovery.js +78 -0
  511. package/dist/tool-metadata/redirects.d.ts +73 -0
  512. package/dist/tool-metadata/redirects.js +93 -0
  513. package/dist/tool-metadata/routines.d.ts +61 -0
  514. package/dist/tool-metadata/routines.js +40 -0
  515. package/dist/tool-metadata/search.d.ts +49 -0
  516. package/dist/tool-metadata/search.js +33 -0
  517. package/dist/tool-metadata/seo.d.ts +64 -0
  518. package/dist/tool-metadata/seo.js +83 -0
  519. package/dist/tool-metadata/server-logs.d.ts +14 -0
  520. package/dist/tool-metadata/server-logs.js +11 -0
  521. package/dist/tool-metadata/settings.d.ts +90 -0
  522. package/dist/tool-metadata/settings.js +117 -0
  523. package/dist/tool-metadata/site-backup.d.ts +84 -0
  524. package/dist/tool-metadata/site-backup.js +30 -0
  525. package/dist/tool-metadata/site-evidence.d.ts +13 -0
  526. package/dist/tool-metadata/site-evidence.js +10 -0
  527. package/dist/tool-metadata/site-guide.d.ts +18 -0
  528. package/dist/tool-metadata/site-guide.js +15 -0
  529. package/dist/tool-metadata/site-inspection.d.ts +44 -0
  530. package/dist/tool-metadata/site-inspection.js +53 -0
  531. package/dist/tool-metadata/site-update.d.ts +30 -0
  532. package/dist/tool-metadata/site-update.js +22 -0
  533. package/dist/tool-metadata/sites.d.ts +52 -0
  534. package/dist/tool-metadata/sites.js +55 -0
  535. package/dist/tool-metadata/skills.d.ts +13 -0
  536. package/dist/tool-metadata/skills.js +10 -0
  537. package/dist/tool-metadata/source-control.d.ts +26 -0
  538. package/dist/tool-metadata/source-control.js +23 -0
  539. package/dist/tool-metadata/trash.d.ts +32 -0
  540. package/dist/tool-metadata/trash.js +27 -0
  541. package/dist/tool-metadata/visitor-tools.d.ts +49 -0
  542. package/dist/tool-metadata/visitor-tools.js +12 -0
  543. package/dist/tool-metadata/web-screenshot.d.ts +14 -0
  544. package/dist/tool-metadata/web-screenshot.js +23 -0
  545. package/dist/tool-metadata/web.d.ts +14 -0
  546. package/dist/tool-metadata/web.js +21 -0
  547. package/dist/tool-metadata/webhooks.d.ts +65 -0
  548. package/dist/tool-metadata/webhooks.js +77 -0
  549. package/dist/tool-metadata/widgets.d.ts +124 -0
  550. package/dist/tool-metadata/widgets.js +161 -0
  551. package/dist/tool-metadata/workspace.d.ts +43 -0
  552. package/dist/tool-metadata/workspace.js +49 -0
  553. package/dist/tool-read-cards.d.ts +88 -0
  554. package/dist/tool-read-cards.js +158 -0
  555. package/dist/tool-registry.d.ts +25 -0
  556. package/package.json +1382 -6
  557. package/plugin-directory.d.ts +2 -2
  558. package/plugin-directory.js +16 -10
@@ -1,27 +1,10 @@
1
+ import { runOperation } from '../../errors/reporter.js';
1
2
  import { statusForError } from './api-error.js';
2
3
  import { guardSameOrigin } from './origin.js';
3
4
  import { readQuery } from './query.js';
4
5
  import { readJsonBody } from './request-body.js';
5
- /**
6
- * Thrown by a route's `handle` — or by anything it calls, at any depth — to bypass the SEC-005
7
- * redaction below with an error the throwing code has already decided is safe for the caller
8
- * to see. Prefer returning `err(...)` from `handle` when the failure is anticipated at that point;
9
- * this class is for the same kind of failure discovered a level deeper, inside an awaited call
10
- * `handle` did not wrap in its own `try`.
11
- *
12
- * Not a way to defeat SEC-005: the only way to reach the branch that reads this class is for code to
13
- * construct one itself, naming the exact error — code and message — it is choosing to disclose.
14
- * Any thrown value that is not this class (including a plain `Error` with an actionable-looking
15
- * message) still redacts; nothing here widens what a route can leak by accident.
16
- */
17
- export class ClientFacingError extends Error {
18
- apiError;
19
- constructor({ apiError }, _optional = {}) {
20
- super(apiError.message);
21
- this.name = 'ClientFacingError';
22
- this.apiError = apiError;
23
- }
24
- }
6
+ import { ClientFacingError } from './client-facing-error.js';
7
+ import { httpFallbackCopy, internalErrorMessage } from './failure-copy.js';
25
8
  /**
26
9
  * Combines required route fields and optional settings into a fresh spec while pinning its generic
27
10
  * parameters at the definition site so callers do not have to repeat them. Optional settings take
@@ -46,26 +29,131 @@ export function jsonResponse({ status, body }, { headers = {} } = {}) {
46
29
  return new Response(text, { status, headers: { 'content-type': 'application/json; charset=utf-8', 'content-length': String(new TextEncoder().encode(text).byteLength), ...headers } });
47
30
  }
48
31
  const errorAnswer = ({ error }) => jsonResponse({ status: statusForError({ error }), body: { error } });
32
+ /** The non-standard "client closed request" sentinel: a bodyless answer nobody will read. */
33
+ const CLIENT_CLOSED_STATUS = 499;
34
+ const COMPLETED = { outcome: 'completed', failed: false };
35
+ const REFUSED = { outcome: 'refused', failed: false };
36
+ const FAILED = { outcome: 'failed', failed: true };
37
+ const CANCELLED = { outcome: 'cancelled', failed: false };
38
+ /** Stamps the answer's status on the verdict, so the operation ends with `http.status_code`. */
39
+ function tag({ response, verdict }) {
40
+ return { response, verdict: { ...verdict, attributes: { ...verdict.attributes, 'http.status_code': response.status } } };
41
+ }
42
+ /**
43
+ * A returned `INTERNAL_ERROR` was produced inside the route by its reporter-backed
44
+ * `reportInternalError` (or `reporter.describe`), which already wrote the one record and tracker
45
+ * report: the producer owns that report, so this only classifies it `failed` and never records it
46
+ * again. Every other returned code is a refusal the caller caused or was told about.
47
+ */
48
+ function verdictFor({ apiError }) {
49
+ return apiError.code === 'INTERNAL_ERROR' ? FAILED : REFUSED;
50
+ }
51
+ const errorTagged = ({ error }) => tag({ response: errorAnswer({ error }), verdict: verdictFor({ apiError: error }) });
49
52
  /**
50
53
  * Builds the one `ServerRoute` for `spec`. The route's parse and handle functions operate on
51
54
  * `RouteInputContext` and `Deps`, so they are unit testable without a server. A host context is
52
55
  * required only for routes that opt into the same-origin guard or that can throw unanticipated errors.
53
56
  */
54
57
  export function jsonRoute({ spec, deps, reportInternalError }, { host } = {}) {
58
+ const answer = answerJsonRoute({ host });
55
59
  return {
56
60
  method: spec.method.toUpperCase(),
57
61
  path: spec.path,
58
- handler: ({ request, params, locals = {} }) => answerJsonRoute({ spec, deps, reportInternalError, request, params: { ...params }, locals }, { host }),
62
+ handler: ({ request, params, locals = {} }) => answer({ spec, deps, reportInternalError, request, params: { ...params }, locals }),
59
63
  };
60
64
  }
61
- async function answerJsonRoute(call, { host }) {
65
+ /** Picks the route's mode once, at creation: reporter mode when the host passed `errors`, else legacy. */
66
+ function answerJsonRoute({ host }) {
67
+ const errors = host?.errors;
68
+ return errors ? call => reporterAnswer(call, { host, errors }) : call => legacyAnswer(call, { host });
69
+ }
70
+ async function legacyAnswer(call, { host }) {
62
71
  try {
63
- return await routeAnswer(call, { host });
72
+ return (await routeAnswerTagged(call, { host })).response;
64
73
  }
65
74
  catch (error) {
66
75
  return exceptionAnswer({ call, error }, { host });
67
76
  }
68
77
  }
78
+ /**
79
+ * Reporter mode: the request is one `http.route` operation. `runOperation` settles the work, ends
80
+ * the operation once and only then hands back the answer, so the operation always ends before the
81
+ * response is returned. A thrown failure is described by the reporter, which owns its one record and
82
+ * tracker report; `onInternalError` is never called in this mode.
83
+ */
84
+ async function reporterAnswer(call, { host, errors }) {
85
+ const method = call.spec.method.toUpperCase();
86
+ const run = await runOperation({
87
+ deps: errors, operation: 'http.route', scope: 'http', step: `Handle ${method} ${call.spec.path}`, fallback: httpFallbackCopy({ method }),
88
+ // The registered pattern (`/runs/:id`), never `request.url`: a URL carries ids, query strings and
89
+ // tokens, which would leak into telemetry and give every request its own unbounded group.
90
+ attributes: { 'http.method': method, 'http.route': call.spec.path },
91
+ work: () => tracedAnswer(call, { host, errors }),
92
+ classify: tagged => tagged.verdict,
93
+ settle: error => disconnectVerdict({ request: call.request, error }),
94
+ }, { audience: 'anonymous' });
95
+ if (run.ok)
96
+ return run.value.response;
97
+ if ('cancelled' in run)
98
+ return new Response(null, { status: CLIENT_CLOSED_STATUS });
99
+ return failureResponse({ failure: run.failure });
100
+ }
101
+ async function tracedAnswer(call, { host, errors }) {
102
+ try {
103
+ return await routeAnswerTagged(call, { host });
104
+ }
105
+ catch (error) {
106
+ const onError = call.spec.ports?.onError;
107
+ // No host policy: the throw reaches `runOperation`, whose reporter classifies it (a
108
+ // ClientFacingError or catalog refusal, else one incident).
109
+ if (!onError)
110
+ throw error;
111
+ return hostPolicyAnswer({ call, error, onError }, { errors });
112
+ }
113
+ }
114
+ /**
115
+ * An explicit host error port answers BEFORE the reporter classifies anything, exactly as in legacy
116
+ * mode (it also wins over ClientFacingError): the host owns that answer, so the reporter records
117
+ * nothing for it and the verdict comes from the status it chose. If the policy itself throws, that
118
+ * policy failure is recorded as its own incident and the ORIGINAL error is rethrown, so the reply
119
+ * carries the original's ID rather than the policy's.
120
+ */
121
+ async function hostPolicyAnswer({ call, error, onError }, { errors }) {
122
+ let response;
123
+ try {
124
+ response = await onError({ error, request: call.request });
125
+ }
126
+ catch (policyError) {
127
+ recordPolicyFailure({ reporter: errors.reporter, policyError });
128
+ throw error;
129
+ }
130
+ return tag({ response, verdict: response.status >= 500 ? FAILED : REFUSED });
131
+ }
132
+ function recordPolicyFailure({ reporter, policyError }) {
133
+ // The reporter promises never to throw; this guard keeps a broken one from replacing the
134
+ // original failure, whose ID the caller must still be given.
135
+ try {
136
+ reporter.record({ error: policyError, step: 'Answer with host error policy', operation: 'http.route' });
137
+ }
138
+ catch { /* the original failure is still described and answered below */ }
139
+ }
140
+ /**
141
+ * Cancellation only when the client is gone AND the throw is the abort itself. The adapter aborts
142
+ * `request.signal` on the response's close, so an abort-like throw after that is the handler
143
+ * stopping because nobody is listening: nothing to report and nothing to write. Any other throw
144
+ * after a disconnect is still a real failure and is recorded.
145
+ */
146
+ function disconnectVerdict({ request, error }) {
147
+ const { signal } = request;
148
+ if (!signal.aborted)
149
+ return undefined;
150
+ const abortLike = error === signal.reason || (typeof error === 'object' && error !== null && error.name === 'AbortError');
151
+ return abortLike ? { ...CANCELLED, attributes: { 'http.status_code': CLIENT_CLOSED_STATUS } } : undefined;
152
+ }
153
+ /** The reporter's answer: a refusal's own status and safe words (no ID), or an incident's 500 with the original incident ID as `requestId`. */
154
+ function failureResponse({ failure }) {
155
+ return jsonResponse({ status: failure.status, body: { error: failure.error } });
156
+ }
69
157
  async function readRawInput({ spec, request, params }) {
70
158
  const query = readQuery({ request });
71
159
  if (request.method === 'GET' || request.method === 'HEAD')
@@ -94,30 +182,35 @@ function originRefusal({ spec, request }, { host }) {
94
182
  // The route chooses where authorization occurs: reads may authorize before validation,
95
183
  // while writes must reject an inconsistent tenant target before asking for a permission.
96
184
  function makeAuthorize({ spec, deps, context }) {
97
- return async ({ permission, entityType }) => {
185
+ // A by-id route's scope (`entityId`) reaches the host port; an id-free call reaches it with the
186
+ // required arguments alone, exactly as before scopes existed.
187
+ return async ({ permission, entityType }, scope) => {
98
188
  if (!spec.ports?.authorize)
99
189
  throw new Error('JSON route authorizer is required');
100
- await spec.ports.authorize({ context, deps, permission, entityType });
190
+ const required = { context, deps, permission, ...(entityType === undefined ? {} : { entityType }) };
191
+ await (scope ? spec.ports.authorize(required, scope) : spec.ports.authorize(required));
101
192
  };
102
193
  }
103
194
  function authenticate({ call, raw }) {
104
195
  const { spec, deps, request, locals } = call;
105
196
  return spec.ports?.authenticate ? spec.ports.authenticate({ raw, request, locals, deps }) : undefined;
106
197
  }
107
- async function routeAnswer(call, { host }) {
198
+ /** Raw read → workspace → origin → authenticate → parse → handle → final answer, each exit tagged with its verdict. */
199
+ async function routeAnswerTagged(call, { host }) {
108
200
  const { spec, deps, request } = call;
109
201
  const raw = await readRawInput(call);
202
+ // Includes the 413 and 415 refusals of `readJsonBody`: refused, never reported.
110
203
  if (!raw.ok)
111
- return errorAnswer({ error: raw.error });
204
+ return errorTagged({ error: raw.error });
112
205
  if (spec.ports?.workspace)
113
206
  await spec.ports.workspace({ raw: raw.value, deps });
114
207
  const refused = originRefusal(call, { host });
115
208
  if (refused)
116
- return refused;
209
+ return tag({ response: refused, verdict: REFUSED });
117
210
  const context = await authenticate({ call, raw: raw.value });
118
211
  const parsed = spec.parse(raw.value);
119
212
  if (!parsed.ok)
120
- return errorAnswer({ error: parsed.error });
213
+ return errorTagged({ error: parsed.error });
121
214
  const authorize = makeAuthorize({ spec, deps, context });
122
215
  const result = await spec.handle({ input: parsed.value, deps, context, authorize }, { signal: request.signal });
123
216
  return finalAnswer({ spec, result, request });
@@ -128,9 +221,12 @@ function finalAnswer({ spec, result, request }) {
128
221
  // answer: serializing one now is wasted work and would turn a benign disconnect into a false
129
222
  // internal error if the socket rejects the write.
130
223
  if (request.signal.aborted)
131
- return new Response(null, { status: 499 });
132
- return result.ok ? jsonResponse({ status: spec.successStatus ?? 200, body: result.value }) : errorAnswer({ error: result.error });
224
+ return tag({ response: new Response(null, { status: CLIENT_CLOSED_STATUS }), verdict: CANCELLED });
225
+ if (!result.ok)
226
+ return errorTagged({ error: result.error });
227
+ return tag({ response: jsonResponse({ status: spec.successStatus ?? 200, body: result.value }), verdict: COMPLETED });
133
228
  }
229
+ /** Legacy mode only (no `errors`): the route's own SEC-005 sink owns the record. */
134
230
  async function exceptionAnswer({ call, error }, { host }) {
135
231
  const { spec, request } = call;
136
232
  // An explicit host error port owns exception classification and the answer, including its
@@ -148,7 +244,7 @@ async function exceptionAnswer({ call, error }, { host }) {
148
244
  const apiError = call.reportInternalError({
149
245
  report: { method: spec.method, path: spec.path, error },
150
246
  logSource: `${spec.method.toUpperCase()} ${spec.path}`,
151
- message: 'The server could not finish this request. Check whether your change was saved, then copy the request ID and report this problem.',
247
+ message: internalErrorMessage({ method: spec.method }),
152
248
  }, { onInternalError: host?.onInternalError });
153
249
  return errorAnswer({ error: apiError });
154
250
  }
@@ -1,6 +1,18 @@
1
+ /**
2
+ * @file Bounded request-body reading for the `Server` contract: raw bytes and JSON, with the
3
+ * size ceiling and content-encoding refusal every host shares.
4
+ */
5
+ import type { ServerApiError } from './api-error.js';
1
6
  import { type Result } from './result.js';
2
7
  /** Express's `express.json()` default ceiling, kept so moving a route off Express changes no limit. */
3
8
  export declare const DEFAULT_JSON_BODY_MAX_BYTES: number;
9
+ /**
10
+ * The 413 refusal for a body over `maxBytes`, in plain words. Exported so a host that enforces a
11
+ * route's ceiling on a body its own framework already parsed answers with the same wording.
12
+ */
13
+ export declare function payloadTooLargeError({ maxBytes }: {
14
+ readonly maxBytes: number;
15
+ }, _optional?: Record<string, never>): ServerApiError;
4
16
  /**
5
17
  * Reads the whole body as bytes, refusing (413, `PAYLOAD_TOO_LARGE`) as soon as it passes
6
18
  * `maxBytes` — a declared `content-length` above the limit is refused before reading anything.
@@ -1,7 +1,11 @@
1
1
  import { err, ok } from './result.js';
2
2
  /** Express's `express.json()` default ceiling, kept so moving a route off Express changes no limit. */
3
3
  export const DEFAULT_JSON_BODY_MAX_BYTES = 100 * 1024;
4
- function tooLarge(maxBytes) {
4
+ /**
5
+ * The 413 refusal for a body over `maxBytes`, in plain words. Exported so a host that enforces a
6
+ * route's ceiling on a body its own framework already parsed answers with the same wording.
7
+ */
8
+ export function payloadTooLargeError({ maxBytes }, _optional = {}) {
5
9
  return ({ code: 'PAYLOAD_TOO_LARGE', message: `The request body is larger than the ${maxBytes} bytes this address accepts. Send less data.` });
6
10
  }
7
11
  /**
@@ -20,7 +24,7 @@ export async function readBodyBytes({ request }, { maxBytes = DEFAULT_JSON_BODY_
20
24
  return err({ error: { code: 'UNSUPPORTED_MEDIA_TYPE', message: 'This address does not accept compressed request bodies. Send the body uncompressed (no Content-Encoding).' } });
21
25
  const declared = Number(request.headers.get('content-length') ?? '0');
22
26
  if (declared > maxBytes)
23
- return err({ error: tooLarge(maxBytes) });
27
+ return err({ error: payloadTooLargeError({ maxBytes }) });
24
28
  if (!request.body)
25
29
  return ok({ value: new Uint8Array(0) });
26
30
  return collectBody({ body: request.body, maxBytes });
@@ -37,7 +41,7 @@ async function collectBody({ body, maxBytes }) {
37
41
  if (total > maxBytes) {
38
42
  // Stop pulling from the socket at once: an oversized upload must not be buffered to the end.
39
43
  await reader.cancel();
40
- return err({ error: tooLarge(maxBytes) });
44
+ return err({ error: payloadTooLargeError({ maxBytes }) });
41
45
  }
42
46
  chunks.push(value);
43
47
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file The reply envelope a JSON route's handler returns when the answer needs more than a JSON
3
+ * body at the spec's `successStatus`: its own status (429), response headers (`Retry-After`, `ETag`),
4
+ * or no body at all (a bare 204/304). Any other handler value keeps the ordinary JSON answer, so a
5
+ * route opts in per answer by returning `routeReply(...)` instead of a plain value.
6
+ */
7
+ declare const ROUTE_REPLY: unique symbol;
8
+ /** A handler's explicit answer: status, optional headers, and a JSON body or none (`body` absent). */
9
+ export interface RouteReply<Body = unknown> {
10
+ readonly [ROUTE_REPLY]: true;
11
+ readonly status: number;
12
+ readonly body?: Body;
13
+ readonly headers?: Readonly<Record<string, string>>;
14
+ }
15
+ /**
16
+ * Builds a frozen, branded reply. Omit `body` for an empty answer: the adapter then writes a bare
17
+ * `send()` (no content type, no `null`), which is what a 204 or 304 must be.
18
+ * @complexity O(1).
19
+ */
20
+ export declare function routeReply<Body = never>({ status, body, headers }: {
21
+ readonly status: number;
22
+ readonly body?: Body;
23
+ readonly headers?: Readonly<Record<string, string>>;
24
+ }, _optional?: Record<string, never>): RouteReply<Body>;
25
+ /** True only for a value built by `routeReply`; a plain object shaped like one stays an ordinary value. */
26
+ export declare function isRouteReply(input: {
27
+ value: unknown;
28
+ }, _optional?: Record<string, never>): input is {
29
+ value: RouteReply;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=route-reply.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @file The reply envelope a JSON route's handler returns when the answer needs more than a JSON
3
+ * body at the spec's `successStatus`: its own status (429), response headers (`Retry-After`, `ETag`),
4
+ * or no body at all (a bare 204/304). Any other handler value keeps the ordinary JSON answer, so a
5
+ * route opts in per answer by returning `routeReply(...)` instead of a plain value.
6
+ */
7
+ // `Symbol.for`, not `Symbol()`: a host can load two copies of this module (a linked dist next to an
8
+ // installed one), and a per-copy symbol would make one copy's reply look like an ordinary value to the other.
9
+ const ROUTE_REPLY = Symbol.for('@jini-ai/core/contracts/server/route-reply');
10
+ /**
11
+ * Builds a frozen, branded reply. Omit `body` for an empty answer: the adapter then writes a bare
12
+ * `send()` (no content type, no `null`), which is what a 204 or 304 must be.
13
+ * @complexity O(1).
14
+ */
15
+ export function routeReply({ status, body, headers }, _optional = {}) {
16
+ const reply = { status, ...(body === undefined ? {} : { body }), ...(headers === undefined ? {} : { headers }) };
17
+ // The brand is a non-enumerable symbol: it never reaches a JSON serialization or a structural `toEqual`.
18
+ Object.defineProperty(reply, ROUTE_REPLY, { value: true });
19
+ return Object.freeze(reply);
20
+ }
21
+ /** True only for a value built by `routeReply`; a plain object shaped like one stays an ordinary value. */
22
+ export function isRouteReply(input, _optional = {}) {
23
+ const { value } = input;
24
+ return typeof value === 'object' && value !== null && value[ROUTE_REPLY] === true;
25
+ }
26
+ //# sourceMappingURL=route-reply.js.map
@@ -123,6 +123,10 @@ export * from './server/middleware.js';
123
123
  export * from './server/query.js';
124
124
  export * from './server/request-body.js';
125
125
  export * from './server/json-route.js';
126
+ export * from './server/client-facing-error.js';
127
+ export * from './server/failure-copy.js';
128
+ export * from './server/deferred-body.js';
129
+ export * from './server/route-reply.js';
126
130
  export * from './server/sse.js';
127
131
  export * from './server/rate-limit.js';
128
132
  //# sourceMappingURL=server.d.ts.map
@@ -24,6 +24,10 @@ export * from './server/middleware.js';
24
24
  export * from './server/query.js';
25
25
  export * from './server/request-body.js';
26
26
  export * from './server/json-route.js';
27
+ export * from './server/client-facing-error.js';
28
+ export * from './server/failure-copy.js';
29
+ export * from './server/deferred-body.js';
30
+ export * from './server/route-reply.js';
27
31
  export * from './server/sse.js';
28
32
  export * from './server/rate-limit.js';
29
33
  //# sourceMappingURL=server.js.map
@@ -0,0 +1,134 @@
1
+ /**
2
+ * @file The admin Sites wire DTOs: the listing snapshot (`GET .../system/sites`), the machine-local
3
+ * sites config, and the create/activate/token-plugin bodies. One owner, shared by the host's sites
4
+ * routes and the admin client that reads them back, so neither side keeps a second copy. Types only.
5
+ */
6
+ /** One row of the admin Sites screen — mirrors the host's site-registry list entry. Only
7
+ * directories carrying a valid `.site-meta.json` commit marker appear; see
8
+ * {@link AdminSiteBinding.listed} for why that matters. */
9
+ export interface AdminSiteListEntry {
10
+ /** Folder name under `sites/` — the id every write in this feature takes. */
11
+ name: string;
12
+ dir: string;
13
+ /** `config.json.name`; may differ from the folder name. */
14
+ displayName: string;
15
+ createdAt: string;
16
+ /** True when this row is the site the SERVER PROCESS is bound to right now — never a pending
17
+ * choice. A newly-activated site stays `false` here until the operator restarts. */
18
+ active: boolean;
19
+ running?: {
20
+ pid: number;
21
+ port: number;
22
+ app: string;
23
+ scheme: "http" | "https";
24
+ };
25
+ }
26
+ /** What the running server is actually serving — mirrors the host's site-registry binding, plus
27
+ * the route's own `listed`. Kept separate from the list because they can disagree, which is the
28
+ * whole reason this field exists. */
29
+ export interface AdminSiteBinding {
30
+ dir: string;
31
+ name: string;
32
+ /** The host's site-directory environment override is set, which OUTRANKS the site-name line
33
+ * Activate writes — so an activate would be ignored on the next boot. The screen must say so
34
+ * rather than offer a dead button. */
35
+ dirOverridden: boolean;
36
+ /** Whether `dir` appears in `sites[]` at all. `false` for a site created before the
37
+ * `.site-meta.json` marker existed (the host repo's own dev site folder), which is how the list
38
+ * can come back EMPTY on a server that is plainly serving something. */
39
+ listed: boolean;
40
+ }
41
+ /** Mirrors the host's `GET .../system/sites` local-site state. */
42
+ export interface AdminLocalSiteState {
43
+ name: string;
44
+ status: "starting" | "running" | "stopped" | "crashed";
45
+ pid: number | null;
46
+ port: number | null;
47
+ daemonPort: number | null;
48
+ adminUrl: string | null;
49
+ app?: string;
50
+ external?: boolean;
51
+ }
52
+ export interface AdminTrashedSite {
53
+ id: string;
54
+ name: string;
55
+ displayName: string;
56
+ }
57
+ export type AdminLocalSiteAction = "start" | "stop" | "stop-serving" | "trash" | "restore" | "delete" | "switch";
58
+ /** Machine-local config, shared with desktop. Runtime env overrides are displayed explicitly. */
59
+ export interface SitesUserConfig {
60
+ sitesHome: string;
61
+ siteRoots: string[];
62
+ databases: "inSite" | "appData";
63
+ configPath: string;
64
+ appData: string;
65
+ overrides: {
66
+ sitesHome: boolean;
67
+ siteRoots: boolean;
68
+ };
69
+ warning: {
70
+ provider: string;
71
+ message: string;
72
+ localHome: string;
73
+ } | null;
74
+ }
75
+ export type SitesUserConfigPatch = Partial<Pick<SitesUserConfig, "sitesHome" | "siteRoots" | "databases">>;
76
+ export interface AdminSitesSnapshot {
77
+ sitesHome?: string;
78
+ localManagementEnabled?: boolean;
79
+ canSwitchNow?: boolean;
80
+ /** Stopping the serving site hands its address to `target`, the most recently started site still
81
+ * running; `null` means nothing can take over. `available` is false on a host that cannot restart. */
82
+ stopServing?: {
83
+ available: boolean;
84
+ target: string | null;
85
+ chatRunning: boolean;
86
+ };
87
+ localSites?: AdminLocalSiteState[];
88
+ trash?: AdminTrashedSite[];
89
+ /** The deployment's site-switcher capability flag — Create/Activate 403 when off. */
90
+ switchingEnabled: boolean;
91
+ sites: AdminSiteListEntry[];
92
+ /** Card preview version tokens (`{ [site name]: capture mtime }`), only for sites with a capture.
93
+ * Absent from an older server; see the host's site preview address helper. */
94
+ previewVersions?: Record<string, number>;
95
+ currentSite: AdminSiteBinding;
96
+ /** The site name a previous Activate persisted to `.env`, pending a restart — `null` when none. */
97
+ persistedSiteName: string | null;
98
+ /** The admin password a new site gets when the create form's password is left blank. Sent only
99
+ * when switching is enabled; absent from an older server. Never written in this bundle. */
100
+ starterAdminPassword?: string;
101
+ }
102
+ /** The `201` body of `POST .../system/sites`. */
103
+ export interface AdminCreatedSite {
104
+ name: string;
105
+ dir: string;
106
+ siteId: string;
107
+ }
108
+ /** What happened to the create request's `agentPluginTokens`: `saved` = sealed into the new site,
109
+ * connected on its first start; `failed` = the site exists but the tokens were not kept. */
110
+ export interface AdminCreatedSiteAgentPluginTokens {
111
+ status: "none" | "saved" | "failed";
112
+ pluginIds: string[];
113
+ }
114
+ /** One installed Agent Plugin the create form can connect with a pasted access token
115
+ * (`GET .../system/sites/token-sign-in-plugins`). */
116
+ export interface AdminTokenSignInPlugin {
117
+ pluginId: string;
118
+ displayName: string;
119
+ /** The plugin's own page for creating a token. */
120
+ helpUrl: string;
121
+ }
122
+ /** The `200` body of `POST .../system/sites/:name/activate`. Nothing was killed, signalled, or
123
+ * re-exec'd — `restartInstructions` is the server's own prose for what the human must now do, and
124
+ * the screen renders it verbatim rather than hardcoding a second copy. */
125
+ export interface AdminSiteActivation {
126
+ ok: boolean;
127
+ /** Warm switch destination; navigate to this site's own origin. */
128
+ url?: string;
129
+ restarting?: boolean;
130
+ activeSiteName: string;
131
+ restartRequired: boolean;
132
+ restartInstructions: string;
133
+ }
134
+ //# sourceMappingURL=admin-sites.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @file The admin Sites wire DTOs: the listing snapshot (`GET .../system/sites`), the machine-local
3
+ * sites config, and the create/activate/token-plugin bodies. One owner, shared by the host's sites
4
+ * routes and the admin client that reads them back, so neither side keeps a second copy. Types only.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=admin-sites.js.map
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @file Agent Plugin admin-surface connections contracts. Types only; this module owns the
3
+ * declarations that `@jini-ai/agent-plugins/admin-surfaces/connections` (`ports.ts`,
4
+ * `connections.ts`) and `@jini-ai/agent-plugins/admin-surfaces` (`callback-field-inbox.ts`) used to
5
+ * declare. That package imports them from here and keeps its runtime values.
6
+ */
7
+ import type { AdminSurfaceAuthorizationStart, AdminSurfaceConnectionState, AdminSurfaceRevocationOutcome, AdminSurfaceSignInAttempt } from './agent-plugins-admin-surfaces.js';
8
+ /** One callback-field deposit's key: the same workspace, plugin, connection and attempt id must take it. */
9
+ export interface AdminSurfaceCallbackFieldKey {
10
+ readonly workspaceId: string;
11
+ readonly pluginId: string;
12
+ readonly connectionId: string;
13
+ readonly attemptId: string;
14
+ }
15
+ /** The loaded connection stays opaque beyond the fields this domain actually reads. */
16
+ export interface AdminSurfaceDeclaredConnection {
17
+ readonly pluginId: string;
18
+ readonly descriptor: {
19
+ readonly connectionId: string;
20
+ };
21
+ readonly scopeSets: readonly string[];
22
+ }
23
+ export interface AdminSurfaceConnectionAccount {
24
+ readonly accountId: string;
25
+ readonly displayName: string;
26
+ }
27
+ export interface AdminSurfaceStagedAccount {
28
+ readonly expiresAt: string;
29
+ readonly account: AdminSurfaceConnectionAccount;
30
+ }
31
+ export interface AdminSurfaceStatusView {
32
+ readonly status: AdminSurfaceConnectionState;
33
+ readonly account: AdminSurfaceConnectionAccount | null;
34
+ readonly grantedScopes: readonly string[];
35
+ readonly pendingSwitch: AdminSurfaceConnectionAccount | null;
36
+ }
37
+ export interface AdminSurfaceConnectionRecord extends Omit<AdminSurfaceStatusView, 'pendingSwitch'> {
38
+ readonly staged: AdminSurfaceStagedAccount | null;
39
+ }
40
+ export interface AdminSurfaceAccountAction {
41
+ readonly connectionRef: string;
42
+ readonly workspaceId: string;
43
+ readonly actorId: string;
44
+ }
45
+ export interface AdminSurfaceDisconnected extends AdminSurfaceStatusView {
46
+ readonly remoteRevocation: AdminSurfaceRevocationOutcome;
47
+ }
48
+ export interface AdminSurfaceSignInStart<Connection extends AdminSurfaceDeclaredConnection> {
49
+ readonly connection: Connection;
50
+ readonly actorId: string;
51
+ readonly intent: 'connect' | 'switch-account';
52
+ readonly scopeSetIds: readonly string[];
53
+ readonly destination?: 'site' | 'shared' | undefined;
54
+ }
55
+ export interface AdminSurfaceSignInStarted extends AdminSurfaceAuthorizationStart {
56
+ readonly completion?: Promise<{
57
+ readonly callbackFields: Readonly<Record<string, string>>;
58
+ } | null>;
59
+ }
60
+ export interface AdminSurfaceCallbackInbox {
61
+ deposit(required: AdminSurfaceCallbackFieldKey & {
62
+ readonly fields: Readonly<Record<string, string>>;
63
+ }): void;
64
+ take(required: AdminSurfaceCallbackFieldKey): Readonly<Record<string, string>> | null;
65
+ }
66
+ /** @agent-note Fulfill from the one API connection host your tools and callback route already share. A second
67
+ * host loses callbacks. `pinnedTokenOptions` must read the same frozen accounts as the tool registrar. */
68
+ export interface AdminSurfaceConnectionsHost<Connection extends AdminSurfaceDeclaredConnection = AdminSurfaceDeclaredConnection> {
69
+ readonly workspaceId: string;
70
+ nowMs(): number;
71
+ connectionKey(required: {
72
+ workspaceId: string;
73
+ pluginId: string;
74
+ connectionId: string;
75
+ }): string;
76
+ listConnections(required: {
77
+ pluginId: string;
78
+ }): Promise<readonly Connection[]>;
79
+ requestedScopes(required: {
80
+ connection: Connection;
81
+ scopeSetIds: readonly string[];
82
+ }): Promise<readonly string[]>;
83
+ readRecord(required: {
84
+ key: string;
85
+ }): Promise<AdminSurfaceConnectionRecord | null>;
86
+ getAccessToken(required: {
87
+ workspaceId: string;
88
+ pluginId: string;
89
+ connectionRef: string;
90
+ }, optional?: {
91
+ expectedAccountId?: string;
92
+ }): Promise<string>;
93
+ startSignIn(required: AdminSurfaceSignInStart<Connection>, optional?: {
94
+ startParams?: Readonly<Record<string, string>>;
95
+ }): Promise<AdminSurfaceSignInStarted>;
96
+ service(required: {
97
+ connection: Connection;
98
+ }): {
99
+ confirmSwitchAccount(required: AdminSurfaceAccountAction): Promise<AdminSurfaceStatusView>;
100
+ cancelSwitchAccount(required: Omit<AdminSurfaceAccountAction, 'actorId'>): Promise<AdminSurfaceStatusView>;
101
+ disconnect(required: Omit<AdminSurfaceAccountAction, 'actorId'>): Promise<AdminSurfaceDisconnected>;
102
+ };
103
+ readonly attempts: {
104
+ get(ref: string): AdminSurfaceSignInAttempt | undefined;
105
+ set(ref: string, attempt: AdminSurfaceSignInAttempt): void;
106
+ delete(ref: string): void;
107
+ };
108
+ readonly callbackInbox: AdminSurfaceCallbackInbox;
109
+ readonly sharedOAuth?: {
110
+ hasBinding(connection: Connection): Promise<boolean>;
111
+ getStatus(connection: Connection): Promise<Omit<AdminSurfaceStatusView, 'pendingSwitch'> | null>;
112
+ stopUsing(connection: Connection): Promise<void>;
113
+ };
114
+ notAvailable(): Error;
115
+ pinnedTokenOptions?(required: {
116
+ signal?: AbortSignal | undefined;
117
+ connectionRef: string;
118
+ }): {
119
+ expectedAccountId?: string;
120
+ };
121
+ }
122
+ /** A sign-in authorization URL the connections port issued, reported to the host's `onSignInIssued`
123
+ * so the admin route lets the host page (not the sandboxed frame) open exactly these URLs. */
124
+ export interface IssuedSignIn extends AdminSurfaceAuthorizationStart {
125
+ readonly pluginId: string;
126
+ readonly connectionId: string;
127
+ }
128
+ //# sourceMappingURL=admin-surfaces-connections.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=admin-surfaces-connections.js.map