@opengeni/contracts 0.44.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/dist/agent-authored-durable-text.d.ts +70 -0
  2. package/dist/agent-config.d.ts +869 -0
  3. package/dist/agent-instruction-changes.d.ts +110 -0
  4. package/dist/agent-learning.d.ts +243 -0
  5. package/dist/agent-topology.d.ts +292 -0
  6. package/dist/allowance-refusal.d.ts +9 -0
  7. package/dist/allowance-refusal.js +50 -0
  8. package/dist/allowance-refusal.js.map +1 -0
  9. package/dist/analytics-consent-report.d.ts +19 -0
  10. package/dist/analytics-consent-report.js +10 -0
  11. package/dist/analytics-consent-report.js.map +1 -0
  12. package/dist/api-key-presets.d.ts +19 -0
  13. package/dist/artifact-catalog.d.ts +161 -0
  14. package/dist/artifacts.d.ts +135 -11
  15. package/dist/atlassian-native-retirement.d.ts +16 -0
  16. package/dist/atlassian-native-retirement.js +30 -0
  17. package/dist/atlassian-native-retirement.js.map +1 -0
  18. package/dist/atlassian.d.ts +2 -0
  19. package/dist/atlassian.js +27 -11
  20. package/dist/browser-storage.d.ts +5 -0
  21. package/dist/browser-storage.js +9 -0
  22. package/dist/browser-storage.js.map +1 -0
  23. package/dist/bundled-skills.d.ts +40 -0
  24. package/dist/canonical-human-identities.d.ts +157 -0
  25. package/dist/canonical-human-identities.js +23 -0
  26. package/dist/canonical-human-identities.js.map +1 -0
  27. package/dist/chunk-2ACYHZFB.js +292 -0
  28. package/dist/chunk-2ACYHZFB.js.map +1 -0
  29. package/dist/chunk-2VORLN2R.js +353 -0
  30. package/dist/chunk-2VORLN2R.js.map +1 -0
  31. package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
  32. package/dist/chunk-3SIZGL3O.js.map +1 -0
  33. package/dist/chunk-46KLD2UH.js +186 -0
  34. package/dist/chunk-46KLD2UH.js.map +1 -0
  35. package/dist/chunk-4JGHSSB7.js +11 -0
  36. package/dist/chunk-4JGHSSB7.js.map +1 -0
  37. package/dist/{chunk-52SGB2QO.js → chunk-5IXYF6XN.js} +50 -10
  38. package/dist/chunk-5IXYF6XN.js.map +1 -0
  39. package/dist/chunk-BCS7WHCK.js +139 -0
  40. package/dist/chunk-BCS7WHCK.js.map +1 -0
  41. package/dist/chunk-EK7NDGFR.js +128 -0
  42. package/dist/chunk-EK7NDGFR.js.map +1 -0
  43. package/dist/{chunk-5UDNP7AO.js → chunk-FZ6BXQHL.js} +78 -38
  44. package/dist/chunk-FZ6BXQHL.js.map +1 -0
  45. package/dist/chunk-GRG7PHWQ.js +25 -0
  46. package/dist/chunk-GRG7PHWQ.js.map +1 -0
  47. package/dist/chunk-JUFK3T4Q.js +80 -0
  48. package/dist/chunk-JUFK3T4Q.js.map +1 -0
  49. package/dist/chunk-KHHZTBP7.js +11 -0
  50. package/dist/chunk-KHHZTBP7.js.map +1 -0
  51. package/dist/chunk-KR2V42UZ.js +187 -0
  52. package/dist/chunk-KR2V42UZ.js.map +1 -0
  53. package/dist/chunk-MZLBPKFE.js +168 -0
  54. package/dist/chunk-MZLBPKFE.js.map +1 -0
  55. package/dist/{chunk-H5BVCZKF.js → chunk-NRMCVHAU.js} +6 -5
  56. package/dist/chunk-NRMCVHAU.js.map +1 -0
  57. package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
  58. package/dist/chunk-NVJMJWLL.js.map +1 -0
  59. package/dist/chunk-O77VSFYZ.js +70 -0
  60. package/dist/chunk-O77VSFYZ.js.map +1 -0
  61. package/dist/chunk-PX3VCKAU.js +29 -0
  62. package/dist/chunk-PX3VCKAU.js.map +1 -0
  63. package/dist/chunk-QR5D2IQC.js +61 -0
  64. package/dist/chunk-QR5D2IQC.js.map +1 -0
  65. package/dist/chunk-RJ76DRPO.js +117 -0
  66. package/dist/chunk-RJ76DRPO.js.map +1 -0
  67. package/dist/chunk-RKX3NQYS.js +28 -0
  68. package/dist/chunk-RKX3NQYS.js.map +1 -0
  69. package/dist/{chunk-FJBG5E4O.js → chunk-SIOU2K4U.js} +45 -22
  70. package/dist/chunk-SIOU2K4U.js.map +1 -0
  71. package/dist/chunk-TSCDAGET.js +75 -0
  72. package/dist/chunk-TSCDAGET.js.map +1 -0
  73. package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
  74. package/dist/chunk-TXTQIYCV.js.map +1 -0
  75. package/dist/chunk-X7ETVO4P.js +26544 -0
  76. package/dist/chunk-X7ETVO4P.js.map +1 -0
  77. package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
  78. package/dist/chunk-YBW5JSA3.js +251 -0
  79. package/dist/chunk-YBW5JSA3.js.map +1 -0
  80. package/dist/chunk-YRXAWWCU.js +45 -0
  81. package/dist/chunk-YRXAWWCU.js.map +1 -0
  82. package/dist/claude-provider-account-authority.d.ts +18 -0
  83. package/dist/claude-subscription-oauth.d.ts +42 -0
  84. package/dist/claude-subscription-usage.d.ts +159 -0
  85. package/dist/client-error-report.d.ts +109 -0
  86. package/dist/client-error-report.js +87 -0
  87. package/dist/client-error-report.js.map +1 -0
  88. package/dist/code-search.d.ts +52 -0
  89. package/dist/code-search.js +40 -0
  90. package/dist/code-search.js.map +1 -0
  91. package/dist/codex-provider-account-authority.d.ts +23 -0
  92. package/dist/codex-provider-account-authority.js +23 -0
  93. package/dist/codex-provider-account-authority.js.map +1 -0
  94. package/dist/company-brain-governed-writes.d.ts +475 -0
  95. package/dist/company-brain.d.ts +336 -0
  96. package/dist/company-profile.d.ts +566 -0
  97. package/dist/connect.d.ts +325 -0
  98. package/dist/connect.js +191 -0
  99. package/dist/connect.js.map +1 -0
  100. package/dist/connection-account-label.d.ts +2 -0
  101. package/dist/connection-account-label.js +35 -0
  102. package/dist/connection-account-label.js.map +1 -0
  103. package/dist/connection-authority.d.ts +193 -0
  104. package/dist/connection-authority.js +50 -0
  105. package/dist/connection-authority.js.map +1 -0
  106. package/dist/connector-attachments.d.ts +95 -0
  107. package/dist/connector-attachments.js +51 -0
  108. package/dist/connector-attachments.js.map +1 -0
  109. package/dist/connector-tool-permissions.d.ts +73 -0
  110. package/dist/direct-model-provider.d.ts +36 -0
  111. package/dist/editable-artifact-codec-registry.d.ts +16 -7
  112. package/dist/editable-artifact-codec-registry.js +19 -9
  113. package/dist/editable-artifact-committed-transaction.d.ts +2 -2
  114. package/dist/editable-artifact-committed-transaction.js +2 -2
  115. package/dist/editable-artifact-live.d.ts +11 -12
  116. package/dist/editable-artifact-live.js +110 -45
  117. package/dist/editable-artifact-live.js.map +1 -1
  118. package/dist/editable-artifact-serialized-commit.d.ts +2 -1
  119. package/dist/editable-artifact-serialized-commit.js +8 -7
  120. package/dist/editable-artifact-versions.d.ts +20 -5
  121. package/dist/editable-artifact-versions.js +23 -5
  122. package/dist/editable-artifacts.d.ts +2 -0
  123. package/dist/editable-artifacts.js +48 -36
  124. package/dist/external-identities.d.ts +784 -0
  125. package/dist/external-identities.js +44 -0
  126. package/dist/external-identities.js.map +1 -0
  127. package/dist/feedback.d.ts +51 -0
  128. package/dist/github-repository-contracts.d.ts +36 -0
  129. package/dist/github-repository-contracts.js +59 -0
  130. package/dist/github-repository-contracts.js.map +1 -0
  131. package/dist/github-repository.d.ts +14 -0
  132. package/dist/github-repository.js +36 -0
  133. package/dist/github-repository.js.map +1 -0
  134. package/dist/google-drive.d.ts +90 -1
  135. package/dist/google-drive.js +91 -15
  136. package/dist/google-drive.js.map +1 -1
  137. package/dist/governed-learning-activation.d.ts +154 -0
  138. package/dist/governed-learning-evaluator.d.ts +152 -0
  139. package/dist/host-mcp-bindings.d.ts +326 -0
  140. package/dist/host-mcp-bindings.js +252 -0
  141. package/dist/host-mcp-bindings.js.map +1 -0
  142. package/dist/image-generation.d.ts +1 -0
  143. package/dist/index.d.ts +27574 -5374
  144. package/dist/index.js +2531 -177
  145. package/dist/insights-usage.d.ts +877 -0
  146. package/dist/insights-usage.js +509 -0
  147. package/dist/insights-usage.js.map +1 -0
  148. package/dist/interaction.d.ts +1752 -13
  149. package/dist/knowledge-entries.d.ts +982 -0
  150. package/dist/knowledge-preparation.d.ts +237 -0
  151. package/dist/knowledge.d.ts +740 -0
  152. package/dist/managed-auth-session-sets.d.ts +241 -0
  153. package/dist/managed-auth-session-sets.js +191 -0
  154. package/dist/managed-auth-session-sets.js.map +1 -0
  155. package/dist/managed-sign-in-methods.d.ts +56 -0
  156. package/dist/managed-sign-in-methods.js +46 -0
  157. package/dist/managed-sign-in-methods.js.map +1 -0
  158. package/dist/mcp-catalog-limits.d.ts +2 -0
  159. package/dist/mcp-endpoint.d.ts +7 -0
  160. package/dist/mcp-endpoint.js +9 -0
  161. package/dist/mcp-endpoint.js.map +1 -0
  162. package/dist/mcp-oauth.d.ts +71 -0
  163. package/dist/modal-native-proof-v2.d.ts +587 -0
  164. package/dist/modal-native-proof-v2.js +37 -0
  165. package/dist/modal-native-proof-v2.js.map +1 -0
  166. package/dist/model-availability.d.ts +15 -0
  167. package/dist/model-connection-access.d.ts +24 -0
  168. package/dist/model-context-inspector.d.ts +329 -0
  169. package/dist/model-display.d.ts +38 -0
  170. package/dist/model-display.js +134 -0
  171. package/dist/model-display.js.map +1 -0
  172. package/dist/model-picker-order.d.ts +25 -0
  173. package/dist/model-picker-order.js +42 -0
  174. package/dist/model-picker-order.js.map +1 -0
  175. package/dist/organization-access.d.ts +231 -0
  176. package/dist/organization-access.js +34 -0
  177. package/dist/organization-access.js.map +1 -0
  178. package/dist/organization-integration-policy.d.ts +27 -0
  179. package/dist/organization-membership-lifecycle.d.ts +1022 -0
  180. package/dist/organization-model-usage.d.ts +146 -0
  181. package/dist/organization-model-usage.js +67 -0
  182. package/dist/organization-model-usage.js.map +1 -0
  183. package/dist/organization-recovery.d.ts +337 -0
  184. package/dist/organization-recovery.js +37 -0
  185. package/dist/organization-recovery.js.map +1 -0
  186. package/dist/organization-usage.d.ts +138 -0
  187. package/dist/permissions.d.ts +54 -0
  188. package/dist/personal-github.d.ts +320 -0
  189. package/dist/personal-github.js +222 -0
  190. package/dist/personal-github.js.map +1 -0
  191. package/dist/plugin-discovery.d.ts +35 -0
  192. package/dist/plugin-discovery.js +7 -0
  193. package/dist/plugin-discovery.js.map +1 -0
  194. package/dist/preference-registry.d.ts +44 -1
  195. package/dist/product-analytics.d.ts +113 -0
  196. package/dist/product-lifecycle-facts.d.ts +73 -0
  197. package/dist/remember.d.ts +350 -0
  198. package/dist/retained-output.d.ts +8 -0
  199. package/dist/sandbox-file-artifacts.d.ts +57 -0
  200. package/dist/sandbox-provider-command.d.ts +113 -0
  201. package/dist/sandbox-recovery.d.ts +146 -0
  202. package/dist/sandbox-snapshots.d.ts +39 -0
  203. package/dist/session-final-reply.d.ts +6 -0
  204. package/dist/session-final-reply.js +9 -0
  205. package/dist/session-final-reply.js.map +1 -0
  206. package/dist/session-goal-reports.d.ts +21 -0
  207. package/dist/session-history-import.d.ts +947 -0
  208. package/dist/session-list-entries.d.ts +4 -0
  209. package/dist/session-list-entries.js +51 -0
  210. package/dist/session-list-entries.js.map +1 -0
  211. package/dist/session-mcp-projections.d.ts +215 -0
  212. package/dist/session-message-search.d.ts +68 -0
  213. package/dist/session-titles.d.ts +68 -0
  214. package/dist/session-titles.js +25 -0
  215. package/dist/session-titles.js.map +1 -0
  216. package/dist/session-topology-primitives.d.ts +22 -0
  217. package/dist/signup-attribution.d.ts +39 -0
  218. package/dist/site-request-headers.test.d.ts +1 -0
  219. package/dist/site-session-http.d.ts +11 -0
  220. package/dist/site-session-http.js +11 -0
  221. package/dist/site-session-http.js.map +1 -0
  222. package/dist/skill-catalog-context.d.ts +7 -0
  223. package/dist/skill-files.d.ts +12 -0
  224. package/dist/skill-metadata.d.ts +9 -0
  225. package/dist/skill-use.d.ts +61 -0
  226. package/dist/skills.d.ts +185 -0
  227. package/dist/slack-bot-scopes.d.ts +46 -21
  228. package/dist/slack-bot-scopes.js +14 -3
  229. package/dist/slack-rest-mcp.d.ts +31 -0
  230. package/dist/slack-rest-mcp.js +19 -0
  231. package/dist/slack-rest-mcp.js.map +1 -0
  232. package/dist/slack-task-policy.d.ts +294 -0
  233. package/dist/spreadsheet-artifact-commands.d.ts +2 -3
  234. package/dist/spreadsheet-artifact-commands.js +4 -2
  235. package/dist/spreadsheet-artifact-query.js +3 -2
  236. package/dist/subscription-account-pools.d.ts +292 -0
  237. package/dist/task-notes.d.ts +169 -0
  238. package/dist/tool-catalog.d.ts +286 -0
  239. package/dist/tool-result-spill.d.ts +16 -0
  240. package/dist/usage-allowances.d.ts +285 -0
  241. package/dist/usage-allowances.js +49 -0
  242. package/dist/usage-allowances.js.map +1 -0
  243. package/dist/video-generation.d.ts +51 -0
  244. package/dist/video-generation.js +9 -1
  245. package/dist/work-claims.d.ts +411 -0
  246. package/dist/workspace-instruction-policies.d.ts +94 -0
  247. package/dist/workspace-integration-wire.d.ts +36 -0
  248. package/dist/workspace-integration-wire.js +23 -0
  249. package/dist/workspace-integration-wire.js.map +1 -0
  250. package/dist/workspace-integrations.d.ts +948 -0
  251. package/dist/workspace-learning-administration.d.ts +289 -0
  252. package/dist/workspace-learning-policy.d.ts +1 -1
  253. package/dist/workspace-state.d.ts +85 -416
  254. package/dist/xai-provider-account-authority.d.ts +26 -0
  255. package/dist/xai-provider-account-authority.js +9 -0
  256. package/dist/xai-provider-account-authority.js.map +1 -0
  257. package/package.json +146 -1
  258. package/src/agent-authored-durable-text.ts +116 -0
  259. package/src/agent-config.ts +1527 -0
  260. package/src/agent-instruction-changes.ts +98 -0
  261. package/src/agent-learning.ts +161 -0
  262. package/src/agent-topology.ts +69 -0
  263. package/src/allowance-refusal.ts +81 -0
  264. package/src/analytics-consent-report.ts +20 -0
  265. package/src/api-key-presets.ts +25 -0
  266. package/src/artifact-catalog.ts +60 -0
  267. package/src/artifacts.ts +146 -18
  268. package/src/atlassian-native-retirement.ts +33 -0
  269. package/src/browser-storage.ts +10 -0
  270. package/src/bundled-skills.ts +73 -0
  271. package/src/canonical-human-identities.ts +93 -0
  272. package/src/claude-provider-account-authority.ts +12 -0
  273. package/src/claude-subscription-oauth.ts +62 -0
  274. package/src/claude-subscription-usage.ts +59 -0
  275. package/src/client-error-report.ts +184 -0
  276. package/src/code-search.ts +105 -0
  277. package/src/codex-provider-account-authority.ts +37 -0
  278. package/src/company-brain-governed-writes.ts +356 -0
  279. package/src/company-brain.ts +201 -0
  280. package/src/company-profile.ts +167 -1
  281. package/src/connect.ts +202 -0
  282. package/src/connection-account-label.ts +46 -0
  283. package/src/connection-authority.ts +213 -0
  284. package/src/connector-attachments.ts +327 -0
  285. package/src/connector-tool-permissions.ts +60 -0
  286. package/src/direct-model-provider.ts +98 -0
  287. package/src/editable-artifact-codec-registry.ts +55 -17
  288. package/src/editable-artifact-committed-transaction.ts +44 -31
  289. package/src/editable-artifact-live.ts +123 -57
  290. package/src/editable-artifact-serialized-commit.ts +2 -1
  291. package/src/editable-artifact-versions.ts +26 -5
  292. package/src/editable-artifacts.ts +2 -0
  293. package/src/external-identities.ts +285 -0
  294. package/src/feedback.ts +39 -0
  295. package/src/github-repository-contracts.ts +85 -0
  296. package/src/github-repository.ts +59 -0
  297. package/src/google-drive.ts +76 -4
  298. package/src/governed-learning-activation.ts +191 -0
  299. package/src/governed-learning-evaluator.ts +176 -0
  300. package/src/host-mcp-bindings.ts +298 -0
  301. package/src/image-generation.ts +8 -2
  302. package/src/index.ts +8019 -1799
  303. package/src/insights-usage.ts +679 -0
  304. package/src/interaction.ts +1102 -6
  305. package/src/knowledge-entries.ts +375 -0
  306. package/src/knowledge-preparation.ts +50 -0
  307. package/src/knowledge.ts +335 -0
  308. package/src/managed-auth-session-sets.ts +253 -0
  309. package/src/managed-sign-in-methods.ts +37 -0
  310. package/src/mcp-catalog-limits.ts +2 -0
  311. package/src/mcp-endpoint.ts +30 -0
  312. package/src/mcp-oauth.ts +66 -0
  313. package/src/modal-native-proof-v2.ts +398 -0
  314. package/src/model-availability.ts +22 -0
  315. package/src/model-connection-access.ts +17 -0
  316. package/src/model-context-inspector.ts +139 -0
  317. package/src/model-display.ts +195 -0
  318. package/src/model-picker-order.ts +97 -0
  319. package/src/organization-access.ts +176 -0
  320. package/src/organization-integration-policy.ts +54 -0
  321. package/src/organization-membership-lifecycle.ts +559 -0
  322. package/src/organization-model-usage.ts +72 -0
  323. package/src/organization-recovery.ts +186 -0
  324. package/src/organization-usage.ts +79 -0
  325. package/src/permissions.ts +58 -0
  326. package/src/personal-github.ts +267 -0
  327. package/src/plugin-discovery.ts +33 -0
  328. package/src/preference-registry.ts +20 -1
  329. package/src/product-analytics.ts +253 -0
  330. package/src/product-lifecycle-facts.ts +121 -0
  331. package/src/remember.ts +243 -0
  332. package/src/retained-output.ts +20 -3
  333. package/src/sandbox-file-artifacts.ts +73 -0
  334. package/src/sandbox-provider-command.ts +82 -0
  335. package/src/sandbox-recovery.ts +116 -0
  336. package/src/sandbox-snapshots.ts +142 -0
  337. package/src/session-final-reply.ts +16 -0
  338. package/src/session-goal-reports.ts +55 -0
  339. package/src/session-history-import.ts +159 -0
  340. package/src/session-list-entries.ts +91 -0
  341. package/src/session-mcp-projections.ts +273 -0
  342. package/src/session-message-search.ts +54 -0
  343. package/src/session-titles.ts +467 -0
  344. package/src/session-topology-primitives.ts +21 -0
  345. package/src/signup-attribution.ts +81 -0
  346. package/src/site-request-headers.test.ts +28 -0
  347. package/src/site-session-http.ts +63 -0
  348. package/src/skill-catalog-context.ts +50 -0
  349. package/src/skill-files.ts +52 -0
  350. package/src/skill-metadata.ts +40 -0
  351. package/src/skill-use.ts +77 -0
  352. package/src/skills.ts +136 -0
  353. package/src/slack-bot-scopes.ts +106 -42
  354. package/src/slack-rest-mcp.ts +194 -0
  355. package/src/slack-task-policy.ts +215 -0
  356. package/src/spreadsheet-artifact-commands.ts +12 -13
  357. package/src/subscription-account-pools.ts +44 -0
  358. package/src/task-notes.ts +105 -0
  359. package/src/tool-catalog.ts +155 -0
  360. package/src/tool-result-spill.ts +35 -0
  361. package/src/usage-allowances.ts +187 -0
  362. package/src/video-generation.ts +43 -6
  363. package/src/work-claims.ts +266 -0
  364. package/src/workspace-instruction-policies.ts +31 -0
  365. package/src/workspace-integration-wire.ts +99 -0
  366. package/src/workspace-integrations.ts +640 -0
  367. package/src/workspace-learning-administration.ts +88 -0
  368. package/src/workspace-learning-policy.ts +4 -3
  369. package/src/workspace-state.ts +16 -126
  370. package/src/xai-provider-account-authority.ts +38 -0
  371. package/dist/chunk-52SGB2QO.js.map +0 -1
  372. package/dist/chunk-5UDNP7AO.js.map +0 -1
  373. package/dist/chunk-BVGIYW7D.js +0 -11
  374. package/dist/chunk-BVGIYW7D.js.map +0 -1
  375. package/dist/chunk-FJBG5E4O.js.map +0 -1
  376. package/dist/chunk-H5BVCZKF.js.map +0 -1
  377. package/dist/chunk-LSB7GRLG.js.map +0 -1
  378. package/dist/chunk-TZ6YEYN4.js.map +0 -1
  379. package/dist/chunk-VA22KRHS.js +0 -15177
  380. package/dist/chunk-VA22KRHS.js.map +0 -1
  381. package/dist/chunk-Y3MLSLB4.js.map +0 -1
  382. /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
package/src/artifacts.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { z } from "zod";
2
+ import { ToolGatewayIdentity } from "./tool-catalog";
2
3
 
3
- export const WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES = 512 * 1024;
4
+ export const WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES = 5_000_000_000;
5
+ export const WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES = 5_000_000_000;
6
+ export const WORKSPACE_ARTIFACT_SOURCE_MAX_FILES = Number.MAX_SAFE_INTEGER;
7
+ export const WORKSPACE_ARTIFACT_REQUESTED_TOOLS_MAX = 128;
4
8
  export const WORKSPACE_ARTIFACT_TITLE_MAX_CHARS = 120;
5
9
  export const WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS = 2_000;
6
10
  export const WORKSPACE_ARTIFACT_LIST_MAX = 100;
@@ -21,6 +25,84 @@ export type WorkspaceArtifactSlug = z.infer<typeof WorkspaceArtifactSlug>;
21
25
  export const WorkspaceArtifactStatus = z.enum(["active", "archived"]);
22
26
  export type WorkspaceArtifactStatus = z.infer<typeof WorkspaceArtifactStatus>;
23
27
 
28
+ export const WorkspaceArtifactSourcePath = z
29
+ .string()
30
+ .min(1)
31
+ .max(256)
32
+ .regex(/^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/u)
33
+ .refine(
34
+ (value) =>
35
+ !value
36
+ .split("/")
37
+ .some((segment) => segment === "." || segment === ".." || segment.length === 0),
38
+ { message: "artifact source paths must be relative and traversal-free" },
39
+ );
40
+ export type WorkspaceArtifactSourcePath = z.infer<typeof WorkspaceArtifactSourcePath>;
41
+
42
+ export const WorkspaceArtifactSourceFile = z
43
+ .object({
44
+ path: WorkspaceArtifactSourcePath,
45
+ content: z.string(),
46
+ })
47
+ .strict();
48
+ export type WorkspaceArtifactSourceFile = z.infer<typeof WorkspaceArtifactSourceFile>;
49
+
50
+ /** Retained editable source; the published runtime remains one exact HTML document. */
51
+ export const WorkspaceArtifactSourceBundle = z
52
+ .object({
53
+ entrypoint: WorkspaceArtifactSourcePath,
54
+ files: z.array(WorkspaceArtifactSourceFile).min(1).max(WORKSPACE_ARTIFACT_SOURCE_MAX_FILES),
55
+ })
56
+ .strict()
57
+ .superRefine((value, context) => {
58
+ const paths = new Set<string>();
59
+ for (const [index, file] of value.files.entries()) {
60
+ if (paths.has(file.path)) {
61
+ context.addIssue({
62
+ code: "custom",
63
+ path: ["files", index, "path"],
64
+ message: "artifact source file paths must be unique",
65
+ });
66
+ }
67
+ paths.add(file.path);
68
+ }
69
+ if (!paths.has(value.entrypoint)) {
70
+ context.addIssue({
71
+ code: "custom",
72
+ path: ["entrypoint"],
73
+ message: "artifact source entrypoint must name one retained file",
74
+ });
75
+ }
76
+ if (
77
+ encoder.encode(JSON.stringify(value)).byteLength > WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES
78
+ ) {
79
+ context.addIssue({
80
+ code: "custom",
81
+ message: `artifact source exceeds ${WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES} UTF-8 bytes`,
82
+ });
83
+ }
84
+ });
85
+ export type WorkspaceArtifactSourceBundle = z.infer<typeof WorkspaceArtifactSourceBundle>;
86
+
87
+ export const WorkspaceArtifactRequestedTools = z
88
+ .array(ToolGatewayIdentity)
89
+ .max(WORKSPACE_ARTIFACT_REQUESTED_TOOLS_MAX)
90
+ .superRefine((tools, context) => {
91
+ const seen = new Set<string>();
92
+ for (const [index, identity] of tools.entries()) {
93
+ const key = `${identity.serverId}\u0000${identity.toolName}`;
94
+ if (seen.has(key)) {
95
+ context.addIssue({
96
+ code: "custom",
97
+ path: [index],
98
+ message: "requested artifact tools must be unique",
99
+ });
100
+ }
101
+ seen.add(key);
102
+ }
103
+ });
104
+ export type WorkspaceArtifactRequestedTools = z.infer<typeof WorkspaceArtifactRequestedTools>;
105
+
24
106
  export const WorkspaceArtifactVersion = z.object({
25
107
  id: z.string().uuid(),
26
108
  accountId: z.string().uuid(),
@@ -28,8 +110,16 @@ export const WorkspaceArtifactVersion = z.object({
28
110
  artifactId: z.string().uuid(),
29
111
  revision: z.number().int().positive(),
30
112
  contentType: z.literal("text/html"),
31
- contentSha256: sha256,
113
+ contentSha256: sha256.nullable(),
32
114
  sizeBytes: z.number().int().positive().max(WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES),
115
+ sourceSha256: sha256.nullable(),
116
+ sourceSizeBytes: z
117
+ .number()
118
+ .int()
119
+ .positive()
120
+ .max(WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES)
121
+ .nullable(),
122
+ requestedTools: WorkspaceArtifactRequestedTools,
33
123
  sourceSessionId: z.string().uuid().nullable(),
34
124
  sourceTurnId: z.string().uuid().nullable(),
35
125
  sourceAttemptId: z.string().uuid().nullable(),
@@ -54,7 +144,12 @@ export const WorkspaceArtifact = z.object({
54
144
  });
55
145
  export type WorkspaceArtifact = z.infer<typeof WorkspaceArtifact>;
56
146
 
57
- export const WorkspaceArtifactEventType = z.enum(["published", "rolled_back"]);
147
+ export const WorkspaceArtifactEventType = z.enum([
148
+ "published",
149
+ "rolled_back",
150
+ "archived",
151
+ "restored",
152
+ ]);
58
153
  export type WorkspaceArtifactEventType = z.infer<typeof WorkspaceArtifactEventType>;
59
154
 
60
155
  export const WorkspaceArtifactEvent = z.object({
@@ -83,6 +178,9 @@ export const WorkspaceArtifactListQuery = z.object({
83
178
  .max(WORKSPACE_ARTIFACT_LIST_MAX)
84
179
  .default(WORKSPACE_ARTIFACT_LIST_DEFAULT),
85
180
  cursor: z.string().min(1).max(WORKSPACE_ARTIFACT_CURSOR_MAX_CHARS).optional(),
181
+ status: WorkspaceArtifactStatus.optional(),
182
+ /** Sites created or published by this session, including older versions. */
183
+ sourceSessionId: z.string().uuid().optional(),
86
184
  });
87
185
  export type WorkspaceArtifactListQuery = z.infer<typeof WorkspaceArtifactListQuery>;
88
186
 
@@ -115,22 +213,42 @@ export const WorkspaceArtifactHtml = z
115
213
  }
116
214
  });
117
215
 
118
- export const CreateWorkspaceArtifactRequest = z.object({
119
- slug: WorkspaceArtifactSlug.optional(),
120
- title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS),
121
- description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
122
- html: WorkspaceArtifactHtml,
123
- idempotencyKey: z.string().trim().min(1).max(200),
124
- });
216
+ export const CreateWorkspaceArtifactRequest = z
217
+ .object({
218
+ slug: WorkspaceArtifactSlug.optional(),
219
+ title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS),
220
+ description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
221
+ html: WorkspaceArtifactHtml.optional(),
222
+ uploadId: z.string().uuid().optional(),
223
+ source: WorkspaceArtifactSourceBundle.optional(),
224
+ requestedTools: WorkspaceArtifactRequestedTools.optional(),
225
+ idempotencyKey: z.string().trim().min(1).max(200),
226
+ })
227
+ .refine((value) => (value.html !== undefined) !== (value.uploadId !== undefined), {
228
+ message: "Provide either html or uploadId",
229
+ })
230
+ .refine((value) => !value.uploadId || value.source === undefined, {
231
+ message: "Upload source using the prepared source URL",
232
+ });
125
233
  export type CreateWorkspaceArtifactRequest = z.infer<typeof CreateWorkspaceArtifactRequest>;
126
234
 
127
- export const PublishWorkspaceArtifactVersionRequest = z.object({
128
- title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS).optional(),
129
- description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
130
- html: WorkspaceArtifactHtml,
131
- expectedCurrentVersionId: z.string().uuid(),
132
- idempotencyKey: z.string().trim().min(1).max(200),
133
- });
235
+ export const PublishWorkspaceArtifactVersionRequest = z
236
+ .object({
237
+ title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS).optional(),
238
+ description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
239
+ html: WorkspaceArtifactHtml.optional(),
240
+ uploadId: z.string().uuid().optional(),
241
+ source: WorkspaceArtifactSourceBundle.optional(),
242
+ requestedTools: WorkspaceArtifactRequestedTools.optional(),
243
+ expectedCurrentVersionId: z.string().uuid(),
244
+ idempotencyKey: z.string().trim().min(1).max(200),
245
+ })
246
+ .refine((value) => (value.html !== undefined) !== (value.uploadId !== undefined), {
247
+ message: "Provide either html or uploadId",
248
+ })
249
+ .refine((value) => !value.uploadId || value.source === undefined, {
250
+ message: "Upload source using the prepared source URL",
251
+ });
134
252
  export type PublishWorkspaceArtifactVersionRequest = z.infer<
135
253
  typeof PublishWorkspaceArtifactVersionRequest
136
254
  >;
@@ -143,6 +261,14 @@ export const RollbackWorkspaceArtifactRequest = z.object({
143
261
  });
144
262
  export type RollbackWorkspaceArtifactRequest = z.infer<typeof RollbackWorkspaceArtifactRequest>;
145
263
 
264
+ export const SetWorkspaceArtifactStatusRequest = z.object({
265
+ status: WorkspaceArtifactStatus,
266
+ expectedCurrentVersionId: z.string().uuid(),
267
+ reason: z.string().trim().min(1).max(4096),
268
+ idempotencyKey: z.string().trim().min(1).max(200),
269
+ });
270
+ export type SetWorkspaceArtifactStatusRequest = z.infer<typeof SetWorkspaceArtifactStatusRequest>;
271
+
146
272
  export const WorkspaceArtifactMutationResponse = z.object({
147
273
  artifact: WorkspaceArtifact,
148
274
  version: WorkspaceArtifactVersion,
@@ -155,8 +281,10 @@ export const WorkspaceArtifactContentResponse = z.object({
155
281
  artifactId: z.string().uuid(),
156
282
  versionId: z.string().uuid(),
157
283
  contentType: z.literal("text/html"),
158
- contentSha256: sha256,
284
+ contentSha256: sha256.nullable(),
159
285
  html: WorkspaceArtifactHtml,
286
+ source: WorkspaceArtifactSourceBundle,
287
+ requestedTools: WorkspaceArtifactRequestedTools,
160
288
  });
161
289
  export type WorkspaceArtifactContentResponse = z.infer<typeof WorkspaceArtifactContentResponse>;
162
290
 
@@ -0,0 +1,33 @@
1
+ /** The former API/Knowledge-sync adapter is historical; hosted Atlassian MCP remains supported. */
2
+ export const ATLASSIAN_NATIVE_RETIRED_REASON = "atlassian_native_retired" as const;
3
+ export const ATLASSIAN_NATIVE_RETIRED_MESSAGE =
4
+ "Jira and Confluence knowledge sync has been retired. Connect Atlassian agent tools to use its hosted MCP server.";
5
+ export const RETIRED_NATIVE_ATLASSIAN_TOOL_NAMES = [
6
+ "atlassian_sources_list",
7
+ "atlassian_search",
8
+ "atlassian_get",
9
+ ] as const;
10
+
11
+ export function isRetiredNativeAtlassianTool(name: string): boolean {
12
+ return (RETIRED_NATIVE_ATLASSIAN_TOOL_NAMES as readonly string[]).includes(name);
13
+ }
14
+
15
+ /** Match the native source identity, never the hosted MCP provider or a display name. */
16
+ export function isRetiredNativeAtlassianSource(source: unknown): boolean {
17
+ if (!source || typeof source !== "object") return false;
18
+ const connection = (source as { connection?: unknown }).connection;
19
+ if (!connection || typeof connection !== "object") return false;
20
+ const provider = (connection as { providerDomain?: unknown }).providerDomain;
21
+ return typeof provider === "string" && provider.toLowerCase() === "api.atlassian.com";
22
+ }
23
+
24
+ /** Includes frozen historical source actions without changing their stored bytes. */
25
+ export function isRetiredNativeAtlassianTask(task: {
26
+ agentConfig?: { knowledgeSource?: unknown } | null;
27
+ action?: { kind?: unknown } | null;
28
+ }): boolean {
29
+ return (
30
+ isRetiredNativeAtlassianSource(task.agentConfig?.knowledgeSource) ||
31
+ (task.action?.kind === "knowledge_source_sync" && isRetiredNativeAtlassianSource(task.action))
32
+ );
33
+ }
@@ -0,0 +1,10 @@
1
+ /** Persisted discriminator; null identity alone never implies ephemeral storage. */
2
+ export const EPHEMERAL_CHROMIUM_DRIVER_ID = "opengeni.cdp.ephemeral-context.v1" as const;
3
+
4
+ export function browserSessionStorageMode(session: {
5
+ driverId: string;
6
+ }): "private_profile" | "ephemeral_context" {
7
+ return session.driverId === EPHEMERAL_CHROMIUM_DRIVER_ID
8
+ ? "ephemeral_context"
9
+ : "private_profile";
10
+ }
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+
3
+ export const BundledSkillId = z.enum([
4
+ "builtin:opengeni-help",
5
+ "builtin:opengeni-client",
6
+ "builtin:opengeni-visualize",
7
+ "builtin:document-parsing",
8
+ "builtin:opengeni-skills",
9
+ "builtin:opengeni-projects",
10
+ "builtin:opengeni-schedules",
11
+ "builtin:opengeni-documents",
12
+ "builtin:opengeni-spreadsheets",
13
+ "builtin:opengeni-presentations",
14
+ "builtin:opengeni-sites",
15
+ "builtin:opengeni-video-generation",
16
+ ]);
17
+ export type BundledSkillId = z.infer<typeof BundledSkillId>;
18
+ export const BundledSkillSelection = z
19
+ .array(BundledSkillId)
20
+ .max(BundledSkillId.options.length)
21
+ .refine((ids) => new Set(ids).size === ids.length, "bundled Skill ids must be unique")
22
+ .transform((ids) => [...ids].sort());
23
+
24
+ /** Undefined is defaults/inheritance; an explicit empty list disables bundles. */
25
+ export function resolveBundledSkillSelection(
26
+ requested: readonly BundledSkillId[] | undefined,
27
+ parent: readonly BundledSkillId[] | undefined,
28
+ ): BundledSkillId[] | undefined {
29
+ const selected = requested === undefined ? parent : requested;
30
+ if (parent !== undefined && selected?.some((id) => !parent.includes(id)))
31
+ throw new Error("A child cannot widen its parent's bundled Skill selection");
32
+ return selected === undefined ? undefined : BundledSkillSelection.parse(selected);
33
+ }
34
+
35
+ // Immutable session configuration, following the existing create-identity
36
+ // metadata convention. Callers cannot set this through arbitrary metadata.
37
+ const BUNDLED_SKILL_SELECTION_KEY = "_opengeni_bundled_skill_ids_v1";
38
+ export function withBundledSkillSelectionMetadata(
39
+ metadata: Record<string, unknown>,
40
+ ids: readonly BundledSkillId[] | undefined,
41
+ ): Record<string, unknown> {
42
+ const next = { ...metadata };
43
+ delete next[BUNDLED_SKILL_SELECTION_KEY];
44
+ if (ids !== undefined) next[BUNDLED_SKILL_SELECTION_KEY] = BundledSkillSelection.parse(ids);
45
+ return next;
46
+ }
47
+ /**
48
+ * Stored-data read. Ids are permanent, but a row written by a newer (or
49
+ * rolled-back-from) release can hold an id this build lacks. Such ids are
50
+ * dropped rather than failing the session read; dropping only narrows the
51
+ * stored selection and never turns it back into defaults. Input stays strict,
52
+ * and a value that is not a list of id strings still fails.
53
+ */
54
+ const StoredBundledSkillSelection = z.array(z.string());
55
+ const knownBundledSkillIds: ReadonlySet<string> = new Set(BundledSkillId.options);
56
+ /**
57
+ * Exact stored selection for keyed create replay identity. Unlike the
58
+ * tolerant read, it keeps ids this build does not know: a retry must match
59
+ * what was stored, not the narrowed projection of it.
60
+ */
61
+ export function storedBundledSkillSelectionIdentity(metadata: Record<string, unknown>): unknown {
62
+ return metadata[BUNDLED_SKILL_SELECTION_KEY];
63
+ }
64
+ export function bundledSkillSelectionFromMetadata(
65
+ metadata: Record<string, unknown>,
66
+ ): BundledSkillId[] | undefined {
67
+ const value = metadata[BUNDLED_SKILL_SELECTION_KEY];
68
+ if (value === undefined) return undefined;
69
+ const known = StoredBundledSkillSelection.parse(value).filter((id): id is BundledSkillId =>
70
+ knownBundledSkillIds.has(id),
71
+ );
72
+ return [...new Set(known)].sort();
73
+ }
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+
3
+ export const CanonicalHumanIdentityStatus = z.enum([
4
+ "active",
5
+ "recovery_required",
6
+ "disputed",
7
+ "disabled",
8
+ ]);
9
+ export type CanonicalHumanIdentityStatus = z.infer<typeof CanonicalHumanIdentityStatus>;
10
+
11
+ export const CanonicalHumanLoginBindingStatus = z.enum([
12
+ "active",
13
+ "recovery_pending",
14
+ "stale",
15
+ "disputed",
16
+ "revoked",
17
+ ]);
18
+ export type CanonicalHumanLoginBindingStatus = z.infer<typeof CanonicalHumanLoginBindingStatus>;
19
+
20
+ export const CanonicalHumanRecoveryState = z.enum([
21
+ "ready",
22
+ "recovery_required",
23
+ "lost_factor",
24
+ "disputed",
25
+ "disabled",
26
+ ]);
27
+ export type CanonicalHumanRecoveryState = z.infer<typeof CanonicalHumanRecoveryState>;
28
+
29
+ export const CanonicalHumanLoginBinding = z.object({
30
+ id: z.string().uuid(),
31
+ providerId: z.string().min(1).max(128),
32
+ providerAccountId: z.string().min(1).max(1024),
33
+ status: CanonicalHumanLoginBindingStatus,
34
+ revision: z.number().int().positive(),
35
+ verifiedAt: z.string().datetime(),
36
+ lastVerifiedAt: z.string().datetime(),
37
+ revokedAt: z.string().datetime().nullable(),
38
+ createdAt: z.string().datetime(),
39
+ updatedAt: z.string().datetime(),
40
+ });
41
+ export type CanonicalHumanLoginBinding = z.infer<typeof CanonicalHumanLoginBinding>;
42
+
43
+ export const CanonicalHumanIdentityProjection = z.object({
44
+ activeIdentity: z.object({
45
+ id: z.string().uuid(),
46
+ displayName: z.string().min(1).max(256),
47
+ status: CanonicalHumanIdentityStatus,
48
+ identityRevision: z.number().int().positive(),
49
+ authRevision: z.number().int().positive(),
50
+ activeLoginBindingId: z.string().uuid().nullable(),
51
+ recoveryState: CanonicalHumanRecoveryState,
52
+ createdAt: z.string().datetime(),
53
+ updatedAt: z.string().datetime(),
54
+ }),
55
+ loginBindings: z.array(CanonicalHumanLoginBinding).max(64),
56
+ });
57
+ export type CanonicalHumanIdentityProjection = z.infer<typeof CanonicalHumanIdentityProjection>;
58
+
59
+ const OperationFields = {
60
+ operationId: z.string().uuid().optional(),
61
+ expectedIdentityRevision: z.number().int().positive(),
62
+ reason: z.string().trim().min(1).max(512),
63
+ } as const;
64
+
65
+ export const LinkCanonicalHumanLoginBindingRequest = z.object({
66
+ ...OperationFields,
67
+ providerId: z.string().trim().min(1).max(128),
68
+ providerAccountId: z.string().trim().min(1).max(1024),
69
+ });
70
+ export type LinkCanonicalHumanLoginBindingRequest = z.infer<
71
+ typeof LinkCanonicalHumanLoginBindingRequest
72
+ >;
73
+
74
+ export const CanonicalHumanBindingOperationRequest = z.object({
75
+ ...OperationFields,
76
+ });
77
+ export type CanonicalHumanBindingOperationRequest = z.infer<
78
+ typeof CanonicalHumanBindingOperationRequest
79
+ >;
80
+
81
+ export const CanonicalHumanIdentityMutationOutcome = z.enum(["applied", "lost_factor", "disputed"]);
82
+ export type CanonicalHumanIdentityMutationOutcome = z.infer<
83
+ typeof CanonicalHumanIdentityMutationOutcome
84
+ >;
85
+
86
+ export const CanonicalHumanIdentityMutationResponse = z.object({
87
+ outcome: CanonicalHumanIdentityMutationOutcome,
88
+ operationId: z.string().uuid(),
89
+ identity: CanonicalHumanIdentityProjection,
90
+ });
91
+ export type CanonicalHumanIdentityMutationResponse = z.infer<
92
+ typeof CanonicalHumanIdentityMutationResponse
93
+ >;
@@ -0,0 +1,12 @@
1
+ import { XaiProviderAccountAuthoritySnapshotV1 } from "./xai-provider-account-authority";
2
+ import type { z } from "zod";
3
+
4
+ /** Same opaque pool selection shape; Claude's live authority is revalidated separately. */
5
+ export const ClaudeProviderAccountAuthoritySnapshotV1 = XaiProviderAccountAuthoritySnapshotV1;
6
+ export type ClaudeProviderAccountAuthoritySnapshotV1 = z.infer<
7
+ typeof ClaudeProviderAccountAuthoritySnapshotV1
8
+ >;
9
+ export const WORKSPACE_CLAUDE_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1 = {
10
+ version: 1,
11
+ scope: "workspace",
12
+ } as const satisfies ClaudeProviderAccountAuthoritySnapshotV1;
@@ -0,0 +1,62 @@
1
+ import { z } from "zod";
2
+
3
+ export const ClaudeSubscriptionSetupTokenRequest = z
4
+ .object({
5
+ token: z.string().trim().min(1).max(16384),
6
+ scope: z.enum(["workspace", "user"]).default("workspace"),
7
+ label: z.string().trim().max(200).nullable().optional(),
8
+ reconnectAccountId: z.string().uuid().optional(),
9
+ expectedCredentialVersion: z.number().int().positive().optional(),
10
+ })
11
+ .strict()
12
+ .refine(
13
+ (request) =>
14
+ Boolean(request.reconnectAccountId) === (request.expectedCredentialVersion !== undefined),
15
+ { message: "Replacing a setup token requires its account and credential version." },
16
+ );
17
+ export type ClaudeSubscriptionSetupTokenRequest = z.infer<
18
+ typeof ClaudeSubscriptionSetupTokenRequest
19
+ >;
20
+
21
+ export const ClaudeSubscriptionOAuthStartRequest = z
22
+ .object({
23
+ scope: z.enum(["workspace", "user"]).default("workspace"),
24
+ reconnectAccountId: z.string().uuid().optional(),
25
+ })
26
+ .strict();
27
+ export type ClaudeSubscriptionOAuthStartRequest = z.infer<
28
+ typeof ClaudeSubscriptionOAuthStartRequest
29
+ >;
30
+
31
+ export const ClaudeSubscriptionOAuthStartResponse = z
32
+ .object({
33
+ attemptId: z.string().uuid(),
34
+ authorizationUrl: z.string().url(),
35
+ expiresAt: z.string().datetime(),
36
+ })
37
+ .strict();
38
+ export type ClaudeSubscriptionOAuthStartResponse = z.infer<
39
+ typeof ClaudeSubscriptionOAuthStartResponse
40
+ >;
41
+
42
+ export const ClaudeSubscriptionOAuthCompleteRequest = z
43
+ .object({
44
+ attemptId: z.string().uuid(),
45
+ code: z.string().trim().min(1).max(4096),
46
+ })
47
+ .strict();
48
+ export type ClaudeSubscriptionOAuthCompleteRequest = z.infer<
49
+ typeof ClaudeSubscriptionOAuthCompleteRequest
50
+ >;
51
+
52
+ export const ClaudeSubscriptionOAuthCompleteResponse = z
53
+ .object({
54
+ connected: z.literal(true),
55
+ accountId: z.string().uuid(),
56
+ scope: z.enum(["organization", "workspace", "user"]),
57
+ credentialVersion: z.number().int().positive(),
58
+ })
59
+ .strict();
60
+ export type ClaudeSubscriptionOAuthCompleteResponse = z.infer<
61
+ typeof ClaudeSubscriptionOAuthCompleteResponse
62
+ >;
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+
3
+ export const ClaudeUsageWindowId = z.enum([
4
+ "five_hour",
5
+ "seven_day",
6
+ "seven_day_opus",
7
+ "seven_day_sonnet",
8
+ "seven_day_overage_included",
9
+ "overage",
10
+ ]);
11
+ export const ClaudeUsageWindow = z
12
+ .object({
13
+ id: ClaudeUsageWindowId,
14
+ usedPercent: z.number().finite().nonnegative().nullable(),
15
+ resetsAt: z.string().datetime().nullable(),
16
+ status: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
17
+ observedAt: z.string().datetime(),
18
+ source: z.enum(["response_headers", "provider"]).optional(),
19
+ })
20
+ .strict();
21
+ export type ClaudeUsageWindow = z.infer<typeof ClaudeUsageWindow>;
22
+
23
+ /** One response's dispatch authority; never combine statuses from different responses. */
24
+ export const ClaudeUsageRequestStatus = z
25
+ .object({
26
+ status: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
27
+ resetsAt: z.string().datetime().nullable(),
28
+ representativeClaim: ClaudeUsageWindowId.nullable(),
29
+ overageStatus: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
30
+ overageResetsAt: z.string().datetime().nullable(),
31
+ upstreamModelId: z.string().min(1).max(256).nullable(),
32
+ observedAt: z.string().datetime(),
33
+ source: z.enum(["response_headers", "provider"]).optional(),
34
+ })
35
+ .strict();
36
+ export type ClaudeUsageRequestStatus = z.infer<typeof ClaudeUsageRequestStatus>;
37
+
38
+ /** Provider observations, never an estimate based on OpenGeni token counts. */
39
+ export const ClaudeSubscriptionUsage = z
40
+ .object({
41
+ connected: z.boolean(),
42
+ credentialVersion: z.number().int().positive().nullable(),
43
+ windows: z.array(ClaudeUsageWindow).max(6),
44
+ observedAt: z.string().datetime().nullable(),
45
+ source: z.enum(["response_headers", "provider"]).nullable(),
46
+ refreshStatus: z.enum([
47
+ "not_checked",
48
+ "available",
49
+ "scope_required",
50
+ "unavailable",
51
+ "reconnect",
52
+ ]),
53
+ refreshCheckedAt: z.string().datetime().nullable(),
54
+ requestStatus: ClaudeUsageRequestStatus.nullable().optional(),
55
+ // Model-scoped dispatch evidence; allowances retain an ordering watermark.
56
+ requestRestrictions: z.array(ClaudeUsageRequestStatus).max(64).optional(),
57
+ })
58
+ .strict();
59
+ export type ClaudeSubscriptionUsage = z.infer<typeof ClaudeSubscriptionUsage>;