@opengeni/contracts 3.1.0-canary.2 → 3.1.2

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 (429) hide show
  1. package/dist/agent-authored-durable-text.d.ts +9 -9
  2. package/dist/agent-config.d.ts +971 -0
  3. package/dist/agent-instruction-changes.d.ts +0 -2
  4. package/dist/allowance-refusal.d.ts +9 -0
  5. package/dist/allowance-refusal.js +50 -0
  6. package/dist/allowance-refusal.js.map +1 -0
  7. package/dist/analytics-consent-report.d.ts +19 -0
  8. package/dist/analytics-consent-report.js +10 -0
  9. package/dist/analytics-consent-report.js.map +1 -0
  10. package/dist/api-key-presets.d.ts +19 -0
  11. package/dist/artifact-catalog.d.ts +188 -0
  12. package/dist/artifacts.d.ts +86 -0
  13. package/dist/atlassian-native-retirement.d.ts +16 -0
  14. package/dist/atlassian-native-retirement.js +30 -0
  15. package/dist/atlassian-native-retirement.js.map +1 -0
  16. package/dist/atlassian.d.ts +1 -0
  17. package/dist/atlassian.js +34 -19
  18. package/dist/browser-storage.d.ts +5 -0
  19. package/dist/browser-storage.js +9 -0
  20. package/dist/browser-storage.js.map +1 -0
  21. package/dist/bundled-skills.d.ts +24 -1
  22. package/dist/canonical-human-identities.js +2 -1
  23. package/dist/chunk-2ZIHHL72.js +153 -0
  24. package/dist/chunk-2ZIHHL72.js.map +1 -0
  25. package/dist/{chunk-5LYFSZ7O.js → chunk-352X6ENP.js} +31 -31
  26. package/dist/chunk-4JGHSSB7.js +11 -0
  27. package/dist/chunk-4JGHSSB7.js.map +1 -0
  28. package/dist/chunk-4QO6GJUX.js +85 -0
  29. package/dist/chunk-4QO6GJUX.js.map +1 -0
  30. package/dist/chunk-4VDMHLLL.js +49 -0
  31. package/dist/chunk-4VDMHLLL.js.map +1 -0
  32. package/dist/chunk-56SNIMDO.js +9 -0
  33. package/dist/chunk-56SNIMDO.js.map +1 -0
  34. package/dist/chunk-6C2HKFTU.js +207 -0
  35. package/dist/chunk-6C2HKFTU.js.map +1 -0
  36. package/dist/chunk-6IXO76Z6.js +72 -0
  37. package/dist/chunk-6IXO76Z6.js.map +1 -0
  38. package/dist/chunk-7272KVWZ.js +60 -0
  39. package/dist/chunk-7272KVWZ.js.map +1 -0
  40. package/dist/{chunk-7ABONTXE.js → chunk-E3GGUBHS.js} +49 -5
  41. package/dist/chunk-E3GGUBHS.js.map +1 -0
  42. package/dist/chunk-EFZYKUE2.js +767 -0
  43. package/dist/chunk-EFZYKUE2.js.map +1 -0
  44. package/dist/chunk-EKWNTOG3.js +154 -0
  45. package/dist/chunk-EKWNTOG3.js.map +1 -0
  46. package/dist/chunk-HABQ7ADB.js +234 -0
  47. package/dist/chunk-HABQ7ADB.js.map +1 -0
  48. package/dist/chunk-HRRU4QPI.js +91 -0
  49. package/dist/chunk-HRRU4QPI.js.map +1 -0
  50. package/dist/{chunk-3SIZGL3O.js → chunk-IK36LXKC.js} +18 -2
  51. package/dist/chunk-IK36LXKC.js.map +1 -0
  52. package/dist/{chunk-TXTQIYCV.js → chunk-ILJ72KPO.js} +56 -3
  53. package/dist/chunk-ILJ72KPO.js.map +1 -0
  54. package/dist/chunk-J4HQ3UKY.js +93 -0
  55. package/dist/chunk-J4HQ3UKY.js.map +1 -0
  56. package/dist/chunk-KHHZTBP7.js +11 -0
  57. package/dist/chunk-KHHZTBP7.js.map +1 -0
  58. package/dist/{chunk-WYBDERIY.js → chunk-LZ2LAHIX.js} +47 -41
  59. package/dist/chunk-LZ2LAHIX.js.map +1 -0
  60. package/dist/chunk-NDZHPTCL.js +400 -0
  61. package/dist/chunk-NDZHPTCL.js.map +1 -0
  62. package/dist/chunk-OF6OKOBF.js +54793 -0
  63. package/dist/chunk-OF6OKOBF.js.map +1 -0
  64. package/dist/chunk-OL23ARTF.js +94 -0
  65. package/dist/chunk-OL23ARTF.js.map +1 -0
  66. package/dist/chunk-PUIUXIOL.js +189 -0
  67. package/dist/chunk-PUIUXIOL.js.map +1 -0
  68. package/dist/{chunk-Y3KNXVTD.js → chunk-RMWXDZEO.js} +128 -21
  69. package/dist/chunk-RMWXDZEO.js.map +1 -0
  70. package/dist/{chunk-MRWYRAS5.js → chunk-SHO4YO4B.js} +27 -35
  71. package/dist/chunk-SHO4YO4B.js.map +1 -0
  72. package/dist/chunk-SWRN2DJ3.js +153 -0
  73. package/dist/chunk-SWRN2DJ3.js.map +1 -0
  74. package/dist/chunk-TCXCRBPF.js +267 -0
  75. package/dist/chunk-TCXCRBPF.js.map +1 -0
  76. package/dist/chunk-TLU3UEMD.js +324 -0
  77. package/dist/chunk-TLU3UEMD.js.map +1 -0
  78. package/dist/chunk-TSWWZMUS.js +186 -0
  79. package/dist/chunk-TSWWZMUS.js.map +1 -0
  80. package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
  81. package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
  82. package/dist/chunk-XDLAGX66.js +127 -0
  83. package/dist/chunk-XDLAGX66.js.map +1 -0
  84. package/dist/chunk-YKZ4WU4P.js +33 -0
  85. package/dist/chunk-YKZ4WU4P.js.map +1 -0
  86. package/dist/{chunk-O5LEQHDM.js → chunk-Z7WEVGCL.js} +3 -3
  87. package/dist/{chunk-YBW5JSA3.js → chunk-ZDCRWCGZ.js} +119 -101
  88. package/dist/chunk-ZDCRWCGZ.js.map +1 -0
  89. package/dist/claude-provider-account-authority.d.ts +18 -0
  90. package/dist/claude-subscription-oauth.d.ts +42 -0
  91. package/dist/claude-subscription-usage.d.ts +159 -0
  92. package/dist/client-error-report.d.ts +158 -0
  93. package/dist/client-error-report.js +164 -0
  94. package/dist/client-error-report.js.map +1 -0
  95. package/dist/code-search.d.ts +52 -0
  96. package/dist/code-search.js +40 -0
  97. package/dist/code-search.js.map +1 -0
  98. package/dist/codex-provider-account-authority.js +20 -12
  99. package/dist/codex-provider-account-authority.js.map +1 -1
  100. package/dist/company-profile.d.ts +144 -6
  101. package/dist/connect.d.ts +37 -0
  102. package/dist/connect.js +216 -159
  103. package/dist/connect.js.map +1 -1
  104. package/dist/connection-account-label.d.ts +2 -0
  105. package/dist/connection-account-label.js +35 -0
  106. package/dist/connection-account-label.js.map +1 -0
  107. package/dist/connection-authority.d.ts +9 -317
  108. package/dist/connection-authority.js +37 -42
  109. package/dist/connector-attachments.js +2 -1
  110. package/dist/connector-destinations.js +2 -1
  111. package/dist/connector-tool-permissions.d.ts +137 -0
  112. package/dist/cua-desktop-tools.d.ts +17 -0
  113. package/dist/define-schema.d.ts +8 -0
  114. package/dist/direct-model-provider.d.ts +36 -0
  115. package/dist/editable-artifact-codec-registry.js +5 -5
  116. package/dist/editable-artifact-committed-transaction.js +3 -2
  117. package/dist/editable-artifact-live.js +5 -5
  118. package/dist/editable-artifact-serialized-commit.js +6 -6
  119. package/dist/editable-artifact-versions.d.ts +7 -1
  120. package/dist/editable-artifact-versions.js +1 -1
  121. package/dist/editable-artifacts.js +62 -56
  122. package/dist/event-preview.d.ts +22 -0
  123. package/dist/external-identities.d.ts +138 -0
  124. package/dist/external-identities.js +9 -4
  125. package/dist/first-party-tool-authorization.d.ts +815 -0
  126. package/dist/github-repository-contracts.js +60 -43
  127. package/dist/github-repository-contracts.js.map +1 -1
  128. package/dist/google-drive.d.ts +2 -1
  129. package/dist/google-drive.js +305 -238
  130. package/dist/google-drive.js.map +1 -1
  131. package/dist/host-mcp-bindings.d.ts +5 -0
  132. package/dist/host-mcp-bindings.js +233 -170
  133. package/dist/host-mcp-bindings.js.map +1 -1
  134. package/dist/image-generation.d.ts +1 -0
  135. package/dist/index.d.ts +16761 -5946
  136. package/dist/index.js +1973 -260
  137. package/dist/insights-usage.d.ts +877 -0
  138. package/dist/insights-usage.js +559 -0
  139. package/dist/insights-usage.js.map +1 -0
  140. package/dist/interaction.d.ts +1176 -829
  141. package/dist/knowledge-entries.d.ts +81 -2
  142. package/dist/knowledge-preparation.d.ts +239 -0
  143. package/dist/managed-auth-session-sets.d.ts +7 -0
  144. package/dist/managed-auth-session-sets.js +198 -132
  145. package/dist/managed-auth-session-sets.js.map +1 -1
  146. package/dist/managed-sign-in-methods.d.ts +56 -0
  147. package/dist/managed-sign-in-methods.js +64 -0
  148. package/dist/managed-sign-in-methods.js.map +1 -0
  149. package/dist/mcp-catalog-limits.d.ts +2 -0
  150. package/dist/mcp-oauth.d.ts +2 -2
  151. package/dist/mcp-structured-content.d.ts +25 -0
  152. package/dist/modal-native-proof-v2.d.ts +587 -0
  153. package/dist/modal-native-proof-v2.js +38 -0
  154. package/dist/modal-native-proof-v2.js.map +1 -0
  155. package/dist/model-account-choice.d.ts +235 -0
  156. package/dist/model-account-settings.d.ts +422 -0
  157. package/dist/model-availability.d.ts +15 -0
  158. package/dist/model-connection-access.d.ts +13 -0
  159. package/dist/model-context-inspector.d.ts +98 -0
  160. package/dist/model-display.d.ts +43 -0
  161. package/dist/model-display.js +17 -0
  162. package/dist/model-display.js.map +1 -0
  163. package/dist/model-picker-order.d.ts +3 -1
  164. package/dist/model-picker-order.js +3 -0
  165. package/dist/model-picker-order.js.map +1 -1
  166. package/dist/organization-access.d.ts +412 -0
  167. package/dist/organization-access.js +39 -0
  168. package/dist/organization-access.js.map +1 -0
  169. package/dist/organization-integration-policy.d.ts +27 -0
  170. package/dist/organization-membership-lifecycle.d.ts +38 -0
  171. package/dist/organization-model-usage.d.ts +146 -0
  172. package/dist/organization-model-usage.js +78 -0
  173. package/dist/organization-model-usage.js.map +1 -0
  174. package/dist/organization-recovery.js +2 -1
  175. package/dist/organization-usage.d.ts +138 -0
  176. package/dist/permissions.d.ts +18 -0
  177. package/dist/personal-github.d.ts +1 -0
  178. package/dist/personal-github.js +199 -144
  179. package/dist/personal-github.js.map +1 -1
  180. package/dist/prepared-mcp-setup.d.ts +54 -0
  181. package/dist/prepared-mcp-setup.js +12 -0
  182. package/dist/prepared-mcp-setup.js.map +1 -0
  183. package/dist/product-analytics.d.ts +116 -0
  184. package/dist/product-lifecycle-facts.d.ts +73 -0
  185. package/dist/remember.d.ts +98 -6
  186. package/dist/retained-output.d.ts +8 -0
  187. package/dist/sandbox-file-artifacts.d.ts +1 -0
  188. package/dist/sandbox-provider-command.d.ts +91 -1
  189. package/dist/sandbox-recovery.d.ts +146 -0
  190. package/dist/secret-generator.d.ts +44 -0
  191. package/dist/secret-references.d.ts +90 -0
  192. package/dist/secret-resolution.d.ts +111 -0
  193. package/dist/secret-totp.d.ts +41 -0
  194. package/dist/session-final-reply.d.ts +6 -0
  195. package/dist/session-final-reply.js +9 -0
  196. package/dist/session-final-reply.js.map +1 -0
  197. package/dist/session-goal-reports.d.ts +21 -0
  198. package/dist/session-history-import.d.ts +1272 -0
  199. package/dist/session-list-entries.d.ts +4 -0
  200. package/dist/session-list-entries.js +56 -0
  201. package/dist/session-list-entries.js.map +1 -0
  202. package/dist/session-mcp-projections.d.ts +6 -0
  203. package/dist/session-mcp-tool-permissions.d.ts +62 -0
  204. package/dist/session-message-search.d.ts +68 -0
  205. package/dist/session-target.d.ts +18 -0
  206. package/dist/session-titles.d.ts +8 -0
  207. package/dist/session-titles.js +5 -1
  208. package/dist/session-usage-limit-refusal.d.ts +34 -0
  209. package/dist/session-usage-limit-refusal.js +15 -0
  210. package/dist/session-usage-limit-refusal.js.map +1 -0
  211. package/dist/session-usage-limits.d.ts +127 -0
  212. package/dist/session-usage-limits.js +41 -0
  213. package/dist/session-usage-limits.js.map +1 -0
  214. package/dist/signup-attribution.d.ts +39 -0
  215. package/dist/site-data.d.ts +286 -0
  216. package/dist/site-operations.d.ts +39 -0
  217. package/dist/site-publishing.d.ts +778 -0
  218. package/dist/site-session-http.d.ts +89 -4
  219. package/dist/site-session-http.js +25 -1
  220. package/dist/site-sql.d.ts +421 -0
  221. package/dist/skill-catalog-context.d.ts +7 -0
  222. package/dist/skill-files.d.ts +1 -1
  223. package/dist/skill-use.d.ts +61 -0
  224. package/dist/skills.d.ts +15 -0
  225. package/dist/slack-bot-scopes.d.ts +17 -12
  226. package/dist/slack-bot-scopes.js +10 -3
  227. package/dist/slack-rest-mcp.d.ts +36 -0
  228. package/dist/slack-rest-mcp.js +25 -0
  229. package/dist/slack-rest-mcp.js.map +1 -0
  230. package/dist/spreadsheet-artifact-commands.d.ts +14 -1
  231. package/dist/spreadsheet-artifact-commands.js +8 -2
  232. package/dist/spreadsheet-artifact-query.d.ts +13 -6
  233. package/dist/spreadsheet-artifact-query.js +3 -3
  234. package/dist/subscription-account-actions.d.ts +64 -0
  235. package/dist/subscription-account-pools.d.ts +292 -0
  236. package/dist/subscription-personal-authority-v2.d.ts +28 -0
  237. package/dist/subscription-personal-authority-v2.js +12 -0
  238. package/dist/subscription-personal-authority-v2.js.map +1 -0
  239. package/dist/tool-action-review.d.ts +132 -0
  240. package/dist/tool-catalog.d.ts +408 -0
  241. package/dist/tool-policy.d.ts +5 -0
  242. package/dist/tool-review-presentation.d.ts +12 -0
  243. package/dist/tool-review-presentation.js +17 -0
  244. package/dist/tool-review-presentation.js.map +1 -0
  245. package/dist/transcription-recordings.d.ts +21 -0
  246. package/dist/turn-serving-policy.d.ts +221 -0
  247. package/dist/usage-allowances.d.ts +314 -0
  248. package/dist/usage-allowances.js +52 -0
  249. package/dist/usage-allowances.js.map +1 -0
  250. package/dist/vaults.d.ts +1286 -0
  251. package/dist/video-generation.d.ts +3 -0
  252. package/dist/video-generation.js +2 -1
  253. package/dist/workspace-integration-wire.d.ts +36 -0
  254. package/dist/workspace-integration-wire.js +23 -0
  255. package/dist/workspace-integration-wire.js.map +1 -0
  256. package/dist/workspace-integrations.d.ts +1028 -0
  257. package/dist/xai-provider-account-authority.js +2 -1
  258. package/package.json +93 -5
  259. package/src/agent-authored-durable-text.ts +14 -11
  260. package/src/agent-config.ts +1698 -0
  261. package/src/agent-instruction-changes.ts +91 -74
  262. package/src/agent-learning.ts +94 -67
  263. package/src/agent-topology.ts +57 -52
  264. package/src/allowance-refusal.ts +81 -0
  265. package/src/analytics-consent-report.ts +20 -0
  266. package/src/api-key-presets.ts +28 -0
  267. package/src/artifact-catalog.ts +82 -0
  268. package/src/artifacts.ts +299 -227
  269. package/src/atlassian-native-retirement.ts +33 -0
  270. package/src/atlassian.ts +135 -108
  271. package/src/browser-storage.ts +10 -0
  272. package/src/bundled-skills.ts +60 -17
  273. package/src/canonical-human-identities.ts +60 -58
  274. package/src/claude-provider-account-authority.ts +12 -0
  275. package/src/claude-subscription-oauth.ts +73 -0
  276. package/src/claude-subscription-usage.ts +68 -0
  277. package/src/client-error-report.ts +343 -0
  278. package/src/code-search.ts +105 -0
  279. package/src/codex-provider-account-authority.ts +21 -16
  280. package/src/company-brain-governed-writes.ts +255 -233
  281. package/src/company-brain.ts +164 -153
  282. package/src/company-profile.ts +365 -292
  283. package/src/connect.ts +212 -173
  284. package/src/connection-account-label.ts +46 -0
  285. package/src/connection-authority.ts +183 -364
  286. package/src/connector-attachments.ts +137 -122
  287. package/src/connector-destinations.ts +46 -42
  288. package/src/connector-tool-permissions.ts +117 -0
  289. package/src/cua-desktop-tools.gen.json +6512 -0
  290. package/src/cua-desktop-tools.linux.gen.json +6600 -0
  291. package/src/cua-desktop-tools.ts +36 -0
  292. package/src/cua-desktop-tools.windows.gen.json +6353 -0
  293. package/src/define-schema.ts +10 -0
  294. package/src/direct-model-provider.ts +108 -0
  295. package/src/editable-artifact-committed-transaction.ts +17 -0
  296. package/src/editable-artifact-versions.ts +7 -1
  297. package/src/event-preview.ts +53 -3
  298. package/src/external-identities.ts +249 -176
  299. package/src/feedback.ts +43 -30
  300. package/src/first-party-tool-authorization.ts +356 -0
  301. package/src/github-repository-contracts.ts +78 -64
  302. package/src/google-drive.ts +285 -234
  303. package/src/governed-learning-activation.ts +152 -131
  304. package/src/governed-learning-evaluator.ts +140 -133
  305. package/src/host-mcp-bindings.ts +252 -198
  306. package/src/image-generation.ts +104 -95
  307. package/src/index.ts +13235 -8687
  308. package/src/insights-usage.ts +727 -0
  309. package/src/interaction.ts +3070 -2326
  310. package/src/knowledge-entries.ts +361 -276
  311. package/src/knowledge-preparation.ts +57 -0
  312. package/src/knowledge.ts +246 -213
  313. package/src/managed-auth-session-sets.ts +220 -144
  314. package/src/managed-sign-in-methods.ts +52 -0
  315. package/src/mcp-catalog-limits.ts +2 -0
  316. package/src/mcp-oauth.ts +43 -34
  317. package/src/mcp-receipts.ts +192 -192
  318. package/src/mcp-structured-content.ts +81 -0
  319. package/src/memory-slack-delivery.ts +171 -142
  320. package/src/modal-native-proof-v2.ts +429 -0
  321. package/src/model-account-choice.ts +177 -0
  322. package/src/model-account-settings.ts +210 -0
  323. package/src/model-availability.ts +22 -0
  324. package/src/model-connection-access.ts +61 -14
  325. package/src/model-context-inspector.ts +133 -99
  326. package/src/model-display.ts +221 -0
  327. package/src/model-picker-order.ts +12 -1
  328. package/src/organization-access.ts +217 -0
  329. package/src/organization-integration-policy.ts +63 -0
  330. package/src/organization-membership-lifecycle.ts +528 -382
  331. package/src/organization-model-usage.ts +81 -0
  332. package/src/organization-recovery.ts +147 -135
  333. package/src/organization-usage.ts +94 -0
  334. package/src/permissions.ts +88 -52
  335. package/src/personal-github.ts +210 -171
  336. package/src/preference-registry.ts +314 -258
  337. package/src/prepared-mcp-setup.ts +189 -0
  338. package/src/product-analytics.ts +261 -0
  339. package/src/product-lifecycle-facts.ts +122 -0
  340. package/src/remember.ts +181 -167
  341. package/src/retained-output.ts +194 -165
  342. package/src/sandbox-file-artifacts.ts +60 -47
  343. package/src/sandbox-provider-command.ts +88 -20
  344. package/src/sandbox-recovery.ts +129 -0
  345. package/src/scoped-knowledge.ts +61 -43
  346. package/src/secret-generator.ts +155 -0
  347. package/src/secret-references.ts +414 -0
  348. package/src/secret-resolution.ts +274 -0
  349. package/src/secret-totp.ts +188 -0
  350. package/src/session-final-reply.ts +16 -0
  351. package/src/session-goal-reports.ts +64 -0
  352. package/src/session-history-import.ts +177 -0
  353. package/src/session-list-entries.ts +96 -0
  354. package/src/session-mcp-projections.ts +11 -0
  355. package/src/session-mcp-tool-permissions.ts +108 -0
  356. package/src/session-message-search.ts +61 -0
  357. package/src/session-target.ts +57 -0
  358. package/src/session-titles.ts +80 -10
  359. package/src/session-topology-primitives.ts +19 -12
  360. package/src/session-usage-limit-refusal.ts +101 -0
  361. package/src/session-usage-limits.ts +171 -0
  362. package/src/signup-attribution.ts +86 -0
  363. package/src/site-data.ts +339 -0
  364. package/src/site-operations.ts +154 -0
  365. package/src/site-publishing.ts +876 -0
  366. package/src/site-session-http.ts +294 -16
  367. package/src/site-sql.ts +1123 -0
  368. package/src/skill-catalog-context.ts +50 -0
  369. package/src/skill-files.ts +3 -3
  370. package/src/skill-use.ts +80 -0
  371. package/src/skills.ts +82 -54
  372. package/src/slack-bot-scopes.ts +31 -39
  373. package/src/slack-rest-mcp.ts +222 -0
  374. package/src/slack-task-policy.ts +96 -73
  375. package/src/spreadsheet-artifact-commands.ts +73 -2
  376. package/src/spreadsheet-artifact-query.ts +187 -39
  377. package/src/subscription-account-actions.ts +84 -0
  378. package/src/subscription-account-pools.ts +53 -0
  379. package/src/subscription-personal-authority-v2.ts +66 -0
  380. package/src/task-notes.ts +55 -51
  381. package/src/tool-action-review.ts +258 -0
  382. package/src/tool-catalog.ts +609 -372
  383. package/src/tool-policy.ts +82 -0
  384. package/src/tool-result-spill.ts +12 -9
  385. package/src/tool-review-presentation.ts +385 -0
  386. package/src/transcription-recordings.ts +145 -131
  387. package/src/turn-serving-policy.ts +166 -0
  388. package/src/usage-allowances.ts +248 -0
  389. package/src/vaults.ts +850 -0
  390. package/src/video-generation.ts +385 -360
  391. package/src/work-claims.ts +173 -149
  392. package/src/workspace-instruction-policies.ts +349 -276
  393. package/src/workspace-integration-wire.ts +101 -0
  394. package/src/workspace-integrations.ts +724 -0
  395. package/src/workspace-learning-administration.ts +57 -44
  396. package/src/workspace-learning-policy.ts +127 -96
  397. package/src/workspace-state.ts +250 -220
  398. package/src/xai-provider-account-authority.ts +22 -17
  399. package/dist/chunk-2AC63F4S.js +0 -171
  400. package/dist/chunk-2AC63F4S.js.map +0 -1
  401. package/dist/chunk-3SIZGL3O.js.map +0 -1
  402. package/dist/chunk-7ABONTXE.js.map +0 -1
  403. package/dist/chunk-BCS7WHCK.js +0 -139
  404. package/dist/chunk-BCS7WHCK.js.map +0 -1
  405. package/dist/chunk-GRG7PHWQ.js +0 -25
  406. package/dist/chunk-GRG7PHWQ.js.map +0 -1
  407. package/dist/chunk-JUFK3T4Q.js +0 -80
  408. package/dist/chunk-JUFK3T4Q.js.map +0 -1
  409. package/dist/chunk-M5ZGRVIQ.js +0 -719
  410. package/dist/chunk-M5ZGRVIQ.js.map +0 -1
  411. package/dist/chunk-MRWYRAS5.js.map +0 -1
  412. package/dist/chunk-OVFORMPW.js +0 -348
  413. package/dist/chunk-OVFORMPW.js.map +0 -1
  414. package/dist/chunk-P3HLDT77.js +0 -59
  415. package/dist/chunk-P3HLDT77.js.map +0 -1
  416. package/dist/chunk-QQUJ6NPW.js +0 -23093
  417. package/dist/chunk-QQUJ6NPW.js.map +0 -1
  418. package/dist/chunk-TXTQIYCV.js.map +0 -1
  419. package/dist/chunk-WYBDERIY.js.map +0 -1
  420. package/dist/chunk-Y3KNXVTD.js.map +0 -1
  421. package/dist/chunk-YBW5JSA3.js.map +0 -1
  422. package/dist/chunk-YRXAWWCU.js +0 -45
  423. package/dist/chunk-YRXAWWCU.js.map +0 -1
  424. package/dist/host-mcp-resolvers.d.ts +0 -32
  425. package/dist/host-mcp-resolvers.js +0 -34
  426. package/dist/host-mcp-resolvers.js.map +0 -1
  427. package/src/host-mcp-resolvers.ts +0 -50
  428. /package/dist/{chunk-5LYFSZ7O.js.map → chunk-352X6ENP.js.map} +0 -0
  429. /package/dist/{chunk-O5LEQHDM.js.map → chunk-Z7WEVGCL.js.map} +0 -0
@@ -0,0 +1,876 @@
1
+ import { defineSchema } from "./define-schema";
2
+ import { z } from "zod";
3
+
4
+ /**
5
+ * Published Sites: a workspace Site served on its own hostname under a
6
+ * configurable Sites domain (production `opengeni.site`, staging a separate
7
+ * domain). Shared by the API, the Site gateway Worker, the console and the
8
+ * SDK. See docs/design/published-sites-2026-10-14.md.
9
+ *
10
+ * Nothing here names a concrete domain: every domain is configuration.
11
+ */
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // Hostnames
15
+ // ---------------------------------------------------------------------------
16
+
17
+ export const SITE_HOSTNAME_LABEL_MIN = 3;
18
+ export const SITE_HOSTNAME_LABEL_MAX = 63;
19
+ /** A released hostname stays reserved to its workspace for at least this long. */
20
+ export const SITE_HOSTNAME_RELEASE_HOLD_DAYS = 30;
21
+
22
+ /** Labels no Site may take: platform, mail, auth and infrastructure names. */
23
+ export const SITE_RESERVED_HOSTNAME_LABELS: readonly string[] = Object.freeze([
24
+ "www",
25
+ "api",
26
+ "app",
27
+ "admin",
28
+ "auth",
29
+ "login",
30
+ "logout",
31
+ "account",
32
+ "accounts",
33
+ "mail",
34
+ "email",
35
+ "smtp",
36
+ "imap",
37
+ "pop",
38
+ "mx",
39
+ "ns",
40
+ "ns1",
41
+ "ns2",
42
+ "dns",
43
+ "status",
44
+ "docs",
45
+ "help",
46
+ "support",
47
+ "abuse",
48
+ "security",
49
+ "postmaster",
50
+ "hostmaster",
51
+ "webmaster",
52
+ "noreply",
53
+ "no-reply",
54
+ "cdn",
55
+ "static",
56
+ "assets",
57
+ "media",
58
+ "og",
59
+ "opengeni",
60
+ "cloudgeni",
61
+ "gateway",
62
+ "edge",
63
+ "internal",
64
+ "staging",
65
+ "preview",
66
+ "dev",
67
+ "test",
68
+ "billing",
69
+ "dashboard",
70
+ "console",
71
+ "root",
72
+ "system",
73
+ "autoconfig",
74
+ "autodiscover",
75
+ "wpad",
76
+ "localhost",
77
+ ]);
78
+
79
+ /**
80
+ * Words that make a hostname look like a credential, payment or brand page.
81
+ * A label containing any of them is refused (substring match on the label
82
+ * with hyphens removed), whoever asks.
83
+ */
84
+ export const SITE_BLOCKED_HOSTNAME_WORDS: readonly string[] = Object.freeze([
85
+ "secure",
86
+ "verify",
87
+ "verification",
88
+ "wallet",
89
+ "signin",
90
+ "login",
91
+ "logon",
92
+ "password",
93
+ "passwd",
94
+ "credential",
95
+ "recovery",
96
+ "unlock",
97
+ "refund",
98
+ "banking",
99
+ "paypal",
100
+ "stripe",
101
+ "venmo",
102
+ "coinbase",
103
+ "binance",
104
+ "metamask",
105
+ "trezor",
106
+ "seedphrase",
107
+ "google",
108
+ "gmail",
109
+ "microsoft",
110
+ "office365",
111
+ "outlook",
112
+ "azure",
113
+ "apple",
114
+ "icloud",
115
+ "amazon",
116
+ "facebook",
117
+ "instagram",
118
+ "whatsapp",
119
+ "netflix",
120
+ "linkedin",
121
+ "github",
122
+ "dropbox",
123
+ "docusign",
124
+ "okta",
125
+ "opengeni",
126
+ "cloudgeni",
127
+ ]);
128
+
129
+ export type SiteHostnameLabelProblem =
130
+ | "length"
131
+ | "characters"
132
+ | "hyphen"
133
+ | "punycode"
134
+ | "reserved"
135
+ | "blocked";
136
+
137
+ export const SITE_HOSTNAME_PROBLEM_MESSAGES: Readonly<Record<SiteHostnameLabelProblem, string>> =
138
+ Object.freeze({
139
+ length: `Use ${SITE_HOSTNAME_LABEL_MIN} to ${SITE_HOSTNAME_LABEL_MAX} characters.`,
140
+ characters: "Use lowercase letters, digits and hyphens only.",
141
+ hyphen: "Start and end with a letter or digit.",
142
+ punycode: "Names with -- in the third and fourth place are not allowed.",
143
+ reserved: "This name is reserved.",
144
+ blocked: "This name is not allowed.",
145
+ });
146
+
147
+ /**
148
+ * Validate one DNS label for a Site hostname. Pure and environment-neutral:
149
+ * the API, the gateway and the console all call it. Availability (global
150
+ * uniqueness and the release hold) is decided only by the API.
151
+ */
152
+ export function siteHostnameLabelProblem(label: string): SiteHostnameLabelProblem | null {
153
+ if (label.length < SITE_HOSTNAME_LABEL_MIN || label.length > SITE_HOSTNAME_LABEL_MAX)
154
+ return "length";
155
+ if (!/^[a-z0-9-]+$/u.test(label)) return "characters";
156
+ if (label.startsWith("-") || label.endsWith("-")) return "hyphen";
157
+ // IDNA reserves "--" in positions 3-4 (xn--, and future ACE prefixes).
158
+ if (label.slice(2, 4) === "--") return "punycode";
159
+ if (SITE_RESERVED_HOSTNAME_LABELS.includes(label)) return "reserved";
160
+ const flat = label.replaceAll("-", "");
161
+ if (SITE_BLOCKED_HOSTNAME_WORDS.some((word) => flat.includes(word))) return "blocked";
162
+ return null;
163
+ }
164
+
165
+ export const SiteHostnameLabel = /* @__PURE__ */ defineSchema(() =>
166
+ z
167
+ .string()
168
+ .superRefine((label, ctx) => {
169
+ const problem = siteHostnameLabelProblem(label);
170
+ if (problem)
171
+ ctx.addIssue({ code: "custom", message: SITE_HOSTNAME_PROBLEM_MESSAGES[problem] });
172
+ })
173
+ .describe(
174
+ "One DNS label: 3-63 lowercase letters, digits or hyphens, not starting or ending with a hyphen. The Site is served at <label>.<sites domain>.",
175
+ ),
176
+ );
177
+ export type SiteHostnameLabel = z.infer<typeof SiteHostnameLabel>;
178
+
179
+ /**
180
+ * Suggest a default label from a Site title: a slug plus a random
181
+ * four-character suffix (`team-dashboard-4k9x`), always valid by
182
+ * construction. `suffix` must be 4 chars of [a-z0-9]; callers supply it so
183
+ * this stays pure.
184
+ */
185
+ export function suggestSiteHostnameLabel(title: string, suffix: string): string {
186
+ if (!/^[a-z0-9]{4}$/u.test(suffix)) throw new Error("suffix must be 4 chars of [a-z0-9]");
187
+ const base = title
188
+ .normalize("NFKD")
189
+ .toLowerCase()
190
+ .replace(/[^a-z0-9]+/gu, "-")
191
+ .replace(/^-+|-+$/gu, "")
192
+ .slice(0, SITE_HOSTNAME_LABEL_MAX - 5)
193
+ .replace(/-+$/u, "");
194
+ const label = `${base || "site"}-${suffix}`;
195
+ return siteHostnameLabelProblem(label) ? `site-${suffix}` : label;
196
+ }
197
+
198
+ /** Normalize a configured Sites domain (`opengeni.site`); throws when it is not a hostname. */
199
+ export function normalizeSitesDomain(domain: string): string {
200
+ const normalized = domain.trim().toLowerCase().replace(/\.$/u, "");
201
+ if (
202
+ !/^(?=.{3,200}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/u.test(
203
+ normalized,
204
+ )
205
+ )
206
+ throw new Error("Invalid Sites domain");
207
+ return normalized;
208
+ }
209
+
210
+ /** `<label>.<domain>` for a valid label and configured domain. */
211
+ export function siteHostname(label: string, sitesDomain: string): string {
212
+ return `${label}.${normalizeSitesDomain(sitesDomain)}`;
213
+ }
214
+
215
+ /**
216
+ * The label of a flat one-level Site hostname under the Sites domain, or null
217
+ * for the apex, deeper names, other domains and invalid labels. A port and a
218
+ * trailing dot are ignored.
219
+ */
220
+ export function parseSiteHostname(host: string, sitesDomain: string): string | null {
221
+ const domain = normalizeSitesDomain(sitesDomain);
222
+ const name = host.trim().toLowerCase().replace(/:\d+$/u, "").replace(/\.$/u, "");
223
+ if (!name.endsWith(`.${domain}`)) return null;
224
+ const label = name.slice(0, -(domain.length + 1));
225
+ if (!label || label.includes(".")) return null;
226
+ return siteHostnameLabelProblem(label) === null ? label : null;
227
+ }
228
+
229
+ // ---------------------------------------------------------------------------
230
+ // Publication
231
+ // ---------------------------------------------------------------------------
232
+
233
+ /**
234
+ * Who may open a published Site.
235
+ * - members: signed-in members of the Site's workspace.
236
+ * - invited: members plus people invited by email (they sign in to OpenGeni).
237
+ * - public: anyone; anonymous visitors use a guest principal. On deployments
238
+ * configured login-only (staging), public means any signed-in Opengeni user.
239
+ */
240
+ export const SiteAccessMode = /* @__PURE__ */ defineSchema(() =>
241
+ z.enum(["members", "invited", "public"]),
242
+ );
243
+ export type SiteAccessMode = z.infer<typeof SiteAccessMode>;
244
+
245
+ /**
246
+ * active: served. unpublished: the owner turned publishing off (the hostname
247
+ * stays held). suspended: taken down by the owner, a workspace admin or a
248
+ * platform moderator; the gateway serves a takedown page.
249
+ */
250
+ export const SitePublicationStatus = /* @__PURE__ */ defineSchema(() =>
251
+ z.enum(["active", "unpublished", "suspended"]),
252
+ );
253
+ export type SitePublicationStatus = z.infer<typeof SitePublicationStatus>;
254
+
255
+ export const SiteLimitProfileKind = /* @__PURE__ */ defineSchema(() =>
256
+ z
257
+ .enum(["standard", "free", "credits", "unlimited", "custom"])
258
+ .describe(
259
+ "Limits for people outside the workspace (workspace members are never limited by Site limits). standard: platform defaults ($10 per Site per month, no per-person limit). free: accepted alias of standard, stored and returned as standard. credits: the standard limits and guest guards multiplied. unlimited: no spend limits (flood brakes still apply). custom: explicit values over the standard defaults. Any kind may carry overrides, which adjust that kind's limits.",
260
+ ),
261
+ );
262
+ export type SiteLimitProfileKind = z.infer<typeof SiteLimitProfileKind>;
263
+
264
+ const NullableLimit = (description: string) =>
265
+ z.number().int().nonnegative().nullable().describe(`${description} null means no limit.`);
266
+
267
+ /**
268
+ * Effective limits for a published Site. Money is in micro-USD
269
+ * (1_000_000 = $1). They apply to people outside the workspace only
270
+ * (invited people and public visitors, signed in or anonymous); workspace
271
+ * members are never limited by them and use the workspace's normal session
272
+ * limits, on any Site. Cloudflare cannot cap spend, so the edge applies only
273
+ * flood brakes; Opengeni enforces these values.
274
+ */
275
+ export const SiteLimits = /* @__PURE__ */ defineSchema(() =>
276
+ z.object({
277
+ requestsPerMinutePerVisitor: NullableLimit(
278
+ "Site runtime requests per viewer per minute (flood brake; members too).",
279
+ ),
280
+ guestWritesPerMinute: NullableLimit("Data writes per guest visitor per minute."),
281
+ agentsEnabled: z
282
+ .boolean()
283
+ .describe(
284
+ "People outside the workspace may use the Site's embedded agent. Members always may when the agent is on.",
285
+ ),
286
+ guestAgentsEnabled: z
287
+ .boolean()
288
+ .describe("Anonymous guests may use the embedded agent too (public Sites)."),
289
+ conversationsPerVisitorPerDay: NullableLimit(
290
+ "Bot guard for anonymous guests: new conversations per visitor per UTC day.",
291
+ ),
292
+ conversationsPerSitePerDay: NullableLimit(
293
+ "Bot guard for anonymous guests: new conversations per Site per UTC day.",
294
+ ),
295
+ turnsPerConversation: NullableLimit(
296
+ "Bot guard for anonymous guests: messages in one conversation.",
297
+ ),
298
+ agentMicrosPerConversation: NullableLimit(
299
+ "Bot guard for anonymous guests: spend per conversation, micro-USD.",
300
+ ),
301
+ agentMicrosPerVisitorPerDay: NullableLimit(
302
+ "Optional per-person limit: spend per person or visitor outside the workspace per UTC day, micro-USD.",
303
+ ),
304
+ agentMicrosPerVisitorPerMonth: NullableLimit(
305
+ "Optional per-person limit: spend per person or visitor outside the workspace per UTC month, micro-USD.",
306
+ ).default(null),
307
+ agentMicrosPerSitePerDay: NullableLimit(
308
+ "The Site limit as a daily amount: spend of everyone outside the workspace together per UTC day, micro-USD.",
309
+ ).default(null),
310
+ agentMicrosPerSitePerMonth: NullableLimit(
311
+ "The Site limit: spend of everyone outside the workspace together per UTC month, micro-USD.",
312
+ ),
313
+ agentModels: z
314
+ .array(z.string().min(1).max(200))
315
+ .max(20)
316
+ .nullable()
317
+ .describe("Models embedded agents may use; null allows the workspace defaults."),
318
+ }),
319
+ );
320
+ export type SiteLimits = z.infer<typeof SiteLimits>;
321
+
322
+ /**
323
+ * The standard limits: $10 per Site per month for everyone outside the
324
+ * workspace together, no per-person limit, and internal bot guards for
325
+ * anonymous guests (conversation and message counts are not shown to Site
326
+ * owners). Deployments override them through settings.
327
+ */
328
+ export const DEFAULT_SITE_LIMITS: Readonly<SiteLimits> = Object.freeze({
329
+ requestsPerMinutePerVisitor: 120,
330
+ guestWritesPerMinute: 30,
331
+ agentsEnabled: true,
332
+ guestAgentsEnabled: true,
333
+ conversationsPerVisitorPerDay: 20,
334
+ conversationsPerSitePerDay: 500,
335
+ turnsPerConversation: 50,
336
+ agentMicrosPerConversation: 1_000_000,
337
+ agentMicrosPerVisitorPerDay: null,
338
+ agentMicrosPerVisitorPerMonth: null,
339
+ agentMicrosPerSitePerDay: null,
340
+ agentMicrosPerSitePerMonth: 10_000_000,
341
+ agentModels: null,
342
+ });
343
+
344
+ /** @deprecated The former `free` profile; now the standard limits (DEFAULT_SITE_LIMITS). */
345
+ export const DEFAULT_FREE_SITE_LIMITS: Readonly<SiteLimits> = DEFAULT_SITE_LIMITS;
346
+
347
+ /** Hard caps that still apply under every profile, unlimited included. */
348
+ export const UNLIMITED_SITE_FLOOD_BRAKES = Object.freeze({
349
+ requestsPerMinutePerVisitor: 600,
350
+ conversationsPerSitePerDay: 10_000,
351
+ agentMicrosPerConversation: 5_000_000,
352
+ });
353
+
354
+ export const SiteLimitProfile = /* @__PURE__ */ defineSchema(() =>
355
+ z.object({
356
+ kind: SiteLimitProfileKind,
357
+ /**
358
+ * Explicit values over the kind's limits (custom: over the standard
359
+ * defaults). Missing fields keep the kind's values.
360
+ */
361
+ overrides: SiteLimits.partial().nullable().default(null),
362
+ }),
363
+ );
364
+ export type SiteLimitProfile = z.infer<typeof SiteLimitProfile>;
365
+
366
+ export const SiteEmbeddedAgent = /* @__PURE__ */ defineSchema(() =>
367
+ z.object({
368
+ enabled: z.boolean(),
369
+ /** Model for new conversations; must be allowed by the effective limits. */
370
+ model: z.string().min(1).max(200).nullable().default(null),
371
+ /** Extra instructions for the Site's agent, appended to the platform's. */
372
+ instructions: z.string().max(8000).nullable().default(null),
373
+ /**
374
+ * Workspace MCP connections (server ids) the agent may use for workspace
375
+ * members, further limited to what each member may do. null or empty: no
376
+ * workspace tools. People outside the workspace never get them. Setting a
377
+ * non-empty list needs a workspace admin.
378
+ */
379
+ tools: z.array(z.string().min(1).max(300)).max(100).nullable().default(null),
380
+ /**
381
+ * Retired; always false. People outside the workspace (invited people and
382
+ * public visitors) never get workspace tools: only the Site's own data
383
+ * (Site Data, Site SQL and its named queries) and the page. Accepted and
384
+ * ignored on input for compatibility.
385
+ */
386
+ guestTools: z.boolean().default(false),
387
+ }),
388
+ );
389
+ export type SiteEmbeddedAgent = z.infer<typeof SiteEmbeddedAgent>;
390
+
391
+ /** Changes to the embedded agent; omitted fields keep their current value. */
392
+ export const SiteEmbeddedAgentChanges = /* @__PURE__ */ defineSchema(() =>
393
+ z.object({
394
+ enabled: z.boolean().optional(),
395
+ model: z.string().min(1).max(200).nullable().optional(),
396
+ instructions: z.string().max(8000).nullable().optional(),
397
+ tools: z.array(z.string().min(1).max(300)).max(100).nullable().optional(),
398
+ /** Retired: accepted and ignored (people outside the workspace never get workspace tools). */
399
+ guestTools: z.boolean().optional(),
400
+ }),
401
+ );
402
+ export type SiteEmbeddedAgentChanges = z.infer<typeof SiteEmbeddedAgentChanges>;
403
+
404
+ /** A safe one-click fix for a readiness warning (applied through the ordinary APIs). */
405
+ export const SitePublishWarningFix = /* @__PURE__ */ defineSchema(() =>
406
+ z.discriminatedUnion("kind", [
407
+ z.object({
408
+ kind: z.literal("site_data_guest_access"),
409
+ collection: z.string().min(1).max(64),
410
+ guestAccess: z.enum(["read", "append", "own"]),
411
+ }),
412
+ z.object({
413
+ kind: z.literal("site_sql_query_audience"),
414
+ query: z.string().min(1).max(64),
415
+ audience: z.enum(["everyone", "signed_in"]),
416
+ }),
417
+ ]),
418
+ );
419
+ export type SitePublishWarningFix = z.infer<typeof SitePublishWarningFix>;
420
+
421
+ export const SITE_PUBLISH_WARNING_CODES = [
422
+ "workspace_tools_members_only",
423
+ "agent_tools_members_only",
424
+ "site_data_guest_read",
425
+ "site_data_guest_write",
426
+ "site_data_members_write",
427
+ "site_sql_query_signed_in",
428
+ "site_sql_query_managers",
429
+ /** No longer reported (the fallback shows as outsideAgentModel); kept for compatibility. */
430
+ "agent_model_outside_fallback",
431
+ "agent_model_outside_unavailable",
432
+ /** The page was too large to read, so what it uses was not checked. */
433
+ "page_not_checked",
434
+ ] as const;
435
+
436
+ /**
437
+ * Something the published version uses that its audience may not do. Found
438
+ * by a conservative static reading of the page source and the Site's
439
+ * declared tools, collections and queries (docs/published-sites.md).
440
+ */
441
+ export const SitePublishWarning = /* @__PURE__ */ defineSchema(() =>
442
+ z.object({
443
+ code: z.enum(SITE_PUBLISH_WARNING_CODES),
444
+ /** Plain language: what won't work and for whom. */
445
+ message: z.string().max(500),
446
+ /** What to change. */
447
+ suggestion: z.string().max(500),
448
+ /** A safe one-click fix, when one exists. */
449
+ fix: SitePublishWarningFix.nullable().default(null),
450
+ }),
451
+ );
452
+ export type SitePublishWarning = z.infer<typeof SitePublishWarning>;
453
+
454
+ export const SitePublication = /* @__PURE__ */ defineSchema(() =>
455
+ z.object({
456
+ siteId: z.string().uuid(),
457
+ workspaceId: z.string().uuid(),
458
+ label: z.string(),
459
+ hostname: z.string(),
460
+ url: z.string().url(),
461
+ access: SiteAccessMode,
462
+ status: SitePublicationStatus,
463
+ /** True when search engines are asked not to index (always on staging). */
464
+ noindex: z.boolean(),
465
+ agent: SiteEmbeddedAgent,
466
+ limitProfile: SiteLimitProfile,
467
+ /**
468
+ * Limits for people outside the workspace after workspace and platform
469
+ * defaults are applied. Workspace members are never limited by them.
470
+ */
471
+ effectiveLimits: SiteLimits,
472
+ invitedEmails: z.array(z.string().email()).max(500),
473
+ moderation: z.object({
474
+ openReports: z.number().int().nonnegative(),
475
+ suspendedAt: z.string().nullable(),
476
+ suspendedBy: z.enum(["owner", "admin", "platform"]).nullable(),
477
+ suspendedReason: z.string().max(2000).nullable(),
478
+ }),
479
+ usage: z.object({
480
+ /** Spend of people outside the workspace this UTC month (members never count). */
481
+ agentMicrosThisMonth: z.number().int().nonnegative(),
482
+ /** The same, this UTC day. */
483
+ agentMicrosToday: z.number().int().nonnegative().default(0),
484
+ conversationsToday: z.number().int().nonnegative(),
485
+ }),
486
+ /**
487
+ * What won't work for the audience (invited or public Sites): the
488
+ * readiness check of the current version. Never blocks publishing.
489
+ */
490
+ warnings: z.array(SitePublishWarning).max(50).default([]),
491
+ /**
492
+ * The model people outside the workspace use when the agent's model is a
493
+ * subscription model (they never use subscriptions); null when they use
494
+ * the agent's model or no credit-billed model exists (then they are refused).
495
+ */
496
+ outsideAgentModel: z.string().nullable().default(null),
497
+ createdAt: z.string(),
498
+ updatedAt: z.string(),
499
+ }),
500
+ );
501
+ export type SitePublication = z.infer<typeof SitePublication>;
502
+
503
+ /** PUT /v1/workspaces/:ws/published-artifacts/:siteId/publication */
504
+ export const UpsertSitePublicationRequest = /* @__PURE__ */ defineSchema(() =>
505
+ z.object({
506
+ label: SiteHostnameLabel.optional().describe("Omit to keep the current or a suggested label."),
507
+ access: SiteAccessMode.optional(),
508
+ status: z.enum(["active", "unpublished"]).optional(),
509
+ noindex: z.boolean().optional(),
510
+ agent: SiteEmbeddedAgentChanges.optional(),
511
+ limitProfile: SiteLimitProfile.optional(),
512
+ invitedEmails: z.array(z.string().email()).max(500).optional(),
513
+ }),
514
+ );
515
+ export type UpsertSitePublicationRequest = z.infer<typeof UpsertSitePublicationRequest>;
516
+
517
+ export const SiteHostnameAvailabilityProblem = /* @__PURE__ */ defineSchema(() =>
518
+ z.enum(["length", "characters", "hyphen", "punycode", "reserved", "blocked", "taken", "held"]),
519
+ );
520
+ export type SiteHostnameAvailabilityProblem = z.infer<typeof SiteHostnameAvailabilityProblem>;
521
+
522
+ /** GET /v1/workspaces/:ws/site-hostnames/:label */
523
+ export const SiteHostnameAvailability = /* @__PURE__ */ defineSchema(() =>
524
+ z.object({
525
+ label: z.string(),
526
+ hostname: z.string().nullable(),
527
+ available: z.boolean(),
528
+ problem: SiteHostnameAvailabilityProblem.nullable(),
529
+ message: z.string().nullable(),
530
+ }),
531
+ );
532
+ export type SiteHostnameAvailability = z.infer<typeof SiteHostnameAvailability>;
533
+
534
+ /** POST .../publication/takedown (owner, workspace admin) and the platform admin route. */
535
+ export const SiteTakedownRequest = /* @__PURE__ */ defineSchema(() =>
536
+ z.object({ reason: z.string().trim().min(1).max(2000) }),
537
+ );
538
+ export type SiteTakedownRequest = z.infer<typeof SiteTakedownRequest>;
539
+
540
+ export const SiteAbuseCategory = /* @__PURE__ */ defineSchema(() =>
541
+ z.enum(["phishing", "malware", "spam", "illegal", "harassment", "copyright", "other"]),
542
+ );
543
+ export type SiteAbuseCategory = z.infer<typeof SiteAbuseCategory>;
544
+
545
+ /** POST /_og/report on a Site host, forwarded to /v1/site-runtime/site/reports. */
546
+ export const SiteAbuseReportRequest = /* @__PURE__ */ defineSchema(() =>
547
+ z.object({
548
+ category: SiteAbuseCategory,
549
+ message: z.string().trim().max(4000).default(""),
550
+ contactEmail: z.string().email().max(320).nullable().default(null),
551
+ }),
552
+ );
553
+ export type SiteAbuseReportRequest = z.infer<typeof SiteAbuseReportRequest>;
554
+
555
+ export const SiteAbuseReport = /* @__PURE__ */ defineSchema(() =>
556
+ z.object({
557
+ id: z.string().uuid(),
558
+ siteId: z.string().uuid(),
559
+ hostname: z.string(),
560
+ category: SiteAbuseCategory,
561
+ message: z.string(),
562
+ contactEmail: z.string().nullable(),
563
+ status: z.enum(["open", "dismissed", "actioned"]),
564
+ createdAt: z.string(),
565
+ }),
566
+ );
567
+ export type SiteAbuseReport = z.infer<typeof SiteAbuseReport>;
568
+
569
+ // ---------------------------------------------------------------------------
570
+ // Viewers
571
+ // ---------------------------------------------------------------------------
572
+
573
+ /**
574
+ * The viewer as a Site sees it (`site.viewer`). Guests have no name or
575
+ * email. `id` is stable per Site and is the Site Data owner principal
576
+ * (`user:<subject>` or `guest:<visitor>`); it is not an Opengeni subject id
577
+ * usable anywhere else.
578
+ */
579
+ export const SiteViewer = /* @__PURE__ */ defineSchema(() =>
580
+ z.object({
581
+ kind: z.enum(["member", "invited", "user", "guest"]),
582
+ id: z.string().min(1).max(300),
583
+ name: z.string().nullable(),
584
+ email: z.string().nullable(),
585
+ signedIn: z.boolean(),
586
+ }),
587
+ );
588
+ export type SiteViewer = z.infer<typeof SiteViewer>;
589
+
590
+ /** The roles an owner may preview their published Site as ("View as visitor"). */
591
+ export const SiteViewAs = /* @__PURE__ */ defineSchema(() => z.enum(["invited", "public"]));
592
+ export type SiteViewAs = z.infer<typeof SiteViewAs>;
593
+
594
+ /** The query parameter that starts (`invited`, `public`) or ends (`off`) a preview. */
595
+ export const SITE_VIEW_AS_QUERY = "og_view_as";
596
+
597
+ /**
598
+ * What this viewer may do, cheaply, so a page can hide features instead of
599
+ * failing. Anything refused at call time still answers with the error
600
+ * `not_available_for_viewer`.
601
+ */
602
+ export const SiteViewerCapabilities = /* @__PURE__ */ defineSchema(() =>
603
+ z.object({
604
+ /** The viewer may talk to the Site's embedded agent. */
605
+ agent: z.boolean(),
606
+ /** The page may use its declared workspace tools as this member, independently of the agent. */
607
+ workspaceTools: z.boolean(),
608
+ /** Site Data rules that apply: the collection's access mode, or its guest access. */
609
+ siteData: z.enum(["viewer", "guest"]),
610
+ /** Named Site SQL query audiences this viewer may call. */
611
+ sqlQueryAudiences: z.array(z.enum(["everyone", "signed_in"])),
612
+ /** Set while the owner previews the Site as another role. */
613
+ viewAs: SiteViewAs.nullable(),
614
+ }),
615
+ );
616
+ export type SiteViewerCapabilities = z.infer<typeof SiteViewerCapabilities>;
617
+
618
+ /** The error code (`error.details.code`) when the viewer may not do something on a Site. */
619
+ export const SITE_NOT_AVAILABLE_FOR_VIEWER_ERROR_CODE = "not_available_for_viewer";
620
+
621
+ /** GET /_og/api/site/config (gateway shell and `site.viewer`). */
622
+ export const SiteRuntimeConfig = /* @__PURE__ */ defineSchema(() =>
623
+ z.object({
624
+ siteId: z.string().uuid(),
625
+ title: z.string(),
626
+ hostname: z.string(),
627
+ versionId: z.string().uuid(),
628
+ access: SiteAccessMode,
629
+ viewer: SiteViewer,
630
+ capabilities: SiteViewerCapabilities,
631
+ agent: z.object({ enabled: z.boolean(), model: z.string().nullable() }),
632
+ siteData: z.boolean(),
633
+ noindex: z.boolean(),
634
+ abuseEmail: z.string().email().nullable(),
635
+ }),
636
+ );
637
+ export type SiteRuntimeConfig = z.infer<typeof SiteRuntimeConfig>;
638
+
639
+ // ---------------------------------------------------------------------------
640
+ // Viewer sign-in (app <-> gateway)
641
+ // ---------------------------------------------------------------------------
642
+
643
+ /**
644
+ * POST /v1/site-auth/authorize, called by the console page
645
+ * `/site-auth/authorize` with the signed-in user's ordinary credentials.
646
+ * Returns a one-time code bound to the host, PKCE challenge and redirect.
647
+ */
648
+ export const SiteAuthAuthorizeRequest = /* @__PURE__ */ defineSchema(() =>
649
+ z.object({
650
+ host: z.string().min(1).max(253),
651
+ state: z.string().min(16).max(256),
652
+ codeChallenge: z.string().regex(/^[A-Za-z0-9_-]{43}$/u),
653
+ codeChallengeMethod: z.literal("S256"),
654
+ redirectUri: z.string().url(),
655
+ }),
656
+ );
657
+ export type SiteAuthAuthorizeRequest = z.infer<typeof SiteAuthAuthorizeRequest>;
658
+
659
+ export const SiteAuthAuthorizeResponse = /* @__PURE__ */ defineSchema(() =>
660
+ z.object({
661
+ redirectTo: z.string().url().describe("redirectUri with code and state appended."),
662
+ site: z.object({ title: z.string(), hostname: z.string() }),
663
+ }),
664
+ );
665
+ export type SiteAuthAuthorizeResponse = z.infer<typeof SiteAuthAuthorizeResponse>;
666
+
667
+ /** POST /v1/site-runtime/auth/exchange (gateway only, signed). */
668
+ export const SiteAuthExchangeRequest = /* @__PURE__ */ defineSchema(() =>
669
+ z.object({
670
+ code: z.string().min(16).max(256),
671
+ codeVerifier: z.string().min(43).max(128),
672
+ redirectUri: z.string().url(),
673
+ }),
674
+ );
675
+ export type SiteAuthExchangeRequest = z.infer<typeof SiteAuthExchangeRequest>;
676
+
677
+ export const SiteAuthExchangeResponse = /* @__PURE__ */ defineSchema(() =>
678
+ z.object({
679
+ /** Opaque; valid only for site-runtime on this one Site host. The API keeps only its hash. */
680
+ sessionToken: z.string().min(32),
681
+ expiresAt: z.string(),
682
+ viewer: SiteViewer,
683
+ }),
684
+ );
685
+ export type SiteAuthExchangeResponse = z.infer<typeof SiteAuthExchangeResponse>;
686
+
687
+ // ---------------------------------------------------------------------------
688
+ // Gateway <-> API
689
+ // ---------------------------------------------------------------------------
690
+
691
+ export const SITE_SESSION_COOKIE = "__Host-og_session";
692
+ export const SITE_VISITOR_COOKIE = "__Host-og_v";
693
+ export const SITE_LOGIN_COOKIE = "__Host-og_login";
694
+
695
+ /** Paths the gateway owns on every Site host. */
696
+ export const SITE_GATEWAY_PREFIX = "/_og";
697
+ export const SITE_GATEWAY_API_PREFIX = "/_og/api";
698
+ export const SITE_GATEWAY_VERSION_PREFIX = "/_og/v";
699
+ export const SITE_GATEWAY_LOGIN_PATH = "/_og/auth/login";
700
+ export const SITE_GATEWAY_CALLBACK_PATH = "/_og/auth/callback";
701
+ export const SITE_GATEWAY_LOGOUT_PATH = "/_og/auth/logout";
702
+ export const SITE_GATEWAY_REPORT_PATH = "/_og/report";
703
+
704
+ /** The API prefix the gateway forwards `/_og/api/*` to. */
705
+ export const SITE_RUNTIME_API_PREFIX = "/v1/site-runtime";
706
+
707
+ export const SITE_GATEWAY_TIMESTAMP_HEADER = "x-opengeni-gateway-timestamp";
708
+ export const SITE_GATEWAY_SIGNATURE_HEADER = "x-opengeni-gateway-signature";
709
+ export const SITE_GATEWAY_HOST_HEADER = "x-opengeni-site-host";
710
+ export const SITE_GATEWAY_SESSION_HEADER = "x-opengeni-site-session";
711
+ export const SITE_GATEWAY_VISITOR_HEADER = "x-opengeni-site-visitor";
712
+ export const SITE_GATEWAY_CLIENT_IP_HEADER = "x-opengeni-site-client-ip";
713
+ export const SITE_GATEWAY_HUMAN_HEADER = "x-opengeni-site-human";
714
+ /**
715
+ * Required on every signed request: lowercase hex SHA-256 of the exact body
716
+ * bytes (of the empty string when there is no body), the same value the
717
+ * gateway signs as `bodySha256`. The API verifies the signature from the
718
+ * headers before it reads the body, then checks the body against this hash.
719
+ */
720
+ export const SITE_GATEWAY_BODY_SHA256_HEADER = "x-opengeni-site-body-sha256";
721
+ /** Reject signed requests whose timestamp differs from the API clock by more. */
722
+ export const SITE_GATEWAY_MAX_SKEW_SECONDS = 30;
723
+ export const SITE_GATEWAY_SIGNATURE_VERSION = "v1";
724
+
725
+ export type SiteGatewaySignedFields = {
726
+ method: string;
727
+ /** Path and query exactly as sent to the API, starting with /v1/site-runtime. */
728
+ pathWithQuery: string;
729
+ /** Unix seconds. */
730
+ timestamp: number;
731
+ /** Lowercase hex SHA-256 of the exact request body bytes (of "" when empty). */
732
+ bodySha256: string;
733
+ host: string;
734
+ /** Raw site-session token, or "" when the viewer is not signed in. */
735
+ session: string;
736
+ /** Gateway-minted visitor id, or "". */
737
+ visitor: string;
738
+ clientIp: string;
739
+ /** "1" when the gateway verified a bot challenge for this visitor, else "". */
740
+ human: string;
741
+ };
742
+
743
+ /**
744
+ * The exact string both sides HMAC-SHA256 with the shared gateway secret.
745
+ * The header carries `v1=<base64url signature>`; during secret rotation the
746
+ * API accepts the current or the previous secret.
747
+ */
748
+ export function siteGatewayCanonicalString(fields: SiteGatewaySignedFields): string {
749
+ return [
750
+ "OGSG1",
751
+ fields.method.toUpperCase(),
752
+ fields.host.toLowerCase(),
753
+ fields.pathWithQuery,
754
+ String(fields.timestamp),
755
+ fields.bodySha256,
756
+ fields.session,
757
+ fields.visitor,
758
+ fields.clientIp,
759
+ fields.human,
760
+ ].join("\n");
761
+ }
762
+
763
+ /**
764
+ * The rebuildable host-map record the gateway reads from KV (`host:<hostname>`)
765
+ * and, on a miss, from GET /v1/site-runtime/host. Postgres is the source of truth.
766
+ */
767
+ export const SiteHostMapRecord = /* @__PURE__ */ defineSchema(() =>
768
+ z.object({
769
+ v: z.literal(1),
770
+ hostname: z.string(),
771
+ siteId: z.string().uuid(),
772
+ status: SitePublicationStatus,
773
+ access: SiteAccessMode,
774
+ /** The version served at `/`; immutable HTML at /_og/v/<versionId>. */
775
+ versionId: z.string().uuid().nullable(),
776
+ title: z.string(),
777
+ noindex: z.boolean(),
778
+ /** Monotonic per hostname; a writer never replaces a newer generation. */
779
+ generation: z.number().int().nonnegative(),
780
+ updatedAt: z.string(),
781
+ }),
782
+ );
783
+ export type SiteHostMapRecord = z.infer<typeof SiteHostMapRecord>;
784
+
785
+ export function siteHostMapKey(hostname: string): string {
786
+ return `host:${hostname.toLowerCase()}`;
787
+ }
788
+
789
+ // ---------------------------------------------------------------------------
790
+ // Platform usage (Site infrastructure, metered apart from model spend)
791
+ // ---------------------------------------------------------------------------
792
+
793
+ /**
794
+ * usage_only: meter, never charge (the default). shadow: compute what
795
+ * credits mode would charge, without charging. credits: charge organization
796
+ * credits for usage above the workspace's monthly allowance.
797
+ */
798
+ export const SitePlatformBillingMode = /* @__PURE__ */ defineSchema(() =>
799
+ z.enum(["usage_only", "shadow", "credits"]),
800
+ );
801
+ export type SitePlatformBillingMode = z.infer<typeof SitePlatformBillingMode>;
802
+
803
+ /** Gateway requests, Site SQL rows read and written, and Site SQL plus Site Data storage. */
804
+ export const SitePlatformMeter = /* @__PURE__ */ defineSchema(() =>
805
+ z.enum(["requests", "sql_rows_read", "sql_rows_written", "storage_bytes"]),
806
+ );
807
+ export type SitePlatformMeter = z.infer<typeof SitePlatformMeter>;
808
+
809
+ export const SitePlatformMeterUsage = /* @__PURE__ */ defineSchema(() =>
810
+ z.object({
811
+ meter: SitePlatformMeter,
812
+ /** This UTC month (storage: the current level). */
813
+ used: z.number().int().nonnegative(),
814
+ /** The highest storage level this month (equals `used` for other meters). */
815
+ peak: z.number().int().nonnegative(),
816
+ /** Included every month before credits are charged (only shadow and credits modes charge). */
817
+ allowance: z.number().int().nonnegative(),
818
+ /** Price in micro-USD per `priceUnit` units (storage: per GB-month, GB = 10^9 bytes). */
819
+ priceMicros: z.number().int().nonnegative(),
820
+ priceUnit: z.number().int().positive(),
821
+ /** Estimated cost of all usage this month, micro-USD, before the allowance. */
822
+ estimatedMicros: z.number().int().nonnegative(),
823
+ }),
824
+ );
825
+ export type SitePlatformMeterUsage = z.infer<typeof SitePlatformMeterUsage>;
826
+
827
+ /** The Opengeni-wide brake on Site platform usage (see docs/published-sites.md). */
828
+ export const SitePlatformBrakeState = /* @__PURE__ */ defineSchema(() =>
829
+ z.object({
830
+ engaged: z.boolean(),
831
+ engagedAt: z.string().nullable(),
832
+ }),
833
+ );
834
+ export type SitePlatformBrakeState = z.infer<typeof SitePlatformBrakeState>;
835
+
836
+ /** GET /v1/workspaces/:ws/site-platform-usage */
837
+ export const SitePlatformUsage = /* @__PURE__ */ defineSchema(() =>
838
+ z.object({
839
+ workspaceId: z.string().uuid(),
840
+ /** First day of the UTC month, YYYY-MM-DD. */
841
+ periodStart: z.string(),
842
+ billingMode: SitePlatformBillingMode,
843
+ meters: z.array(SitePlatformMeterUsage),
844
+ /** Estimated cost of this month's usage, micro-USD, before the allowance. */
845
+ estimatedMicros: z.number().int().nonnegative(),
846
+ /** Credits charged this month (credits mode). */
847
+ chargedMicros: z.number().int().nonnegative(),
848
+ /** What credits mode would have charged this month (shadow mode). */
849
+ shadowMicros: z.number().int().nonnegative(),
850
+ brake: SitePlatformBrakeState,
851
+ }),
852
+ );
853
+ export type SitePlatformUsage = z.infer<typeof SitePlatformUsage>;
854
+
855
+ /** details.code of the 503 every brake refusal carries. */
856
+ export const SITE_PLATFORM_BRAKE_ERROR_CODE = "site_platform_brake_engaged" as const;
857
+ /** details.code of the 402 a workspace past its allowance without credits gets (credits mode). */
858
+ export const SITE_PLATFORM_QUOTA_ERROR_CODE = "site_platform_quota_exhausted" as const;
859
+
860
+ export * from "./site-operations";
861
+
862
+ // ---------------------------------------------------------------------------
863
+ // Bridge additions (protocol v2, additive)
864
+ // ---------------------------------------------------------------------------
865
+
866
+ /**
867
+ * Additional MessagePort bridge request methods, served by both hosts:
868
+ * - `viewer`: returns SiteViewer (console: the signed-in member).
869
+ * - `auth.signIn`: asks the host to sign the viewer in. The gateway shell
870
+ * navigates the top window to /_og/auth/login; the console resolves
871
+ * immediately because its viewer is already signed in. Returns
872
+ * `{ started: boolean }`.
873
+ * The ready message advertises them with `viewer: 1`.
874
+ */
875
+ export const SITE_BRIDGE_VIEWER_METHOD = "viewer" as const;
876
+ export const SITE_BRIDGE_SIGN_IN_METHOD = "auth.signIn" as const;