@opengeni/contracts 0.50.0 → 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 (369) 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 +26 -12
  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/chunk-2ACYHZFB.js +292 -0
  25. package/dist/chunk-2ACYHZFB.js.map +1 -0
  26. package/dist/chunk-2VORLN2R.js +353 -0
  27. package/dist/chunk-2VORLN2R.js.map +1 -0
  28. package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
  29. package/dist/chunk-3SIZGL3O.js.map +1 -0
  30. package/dist/chunk-46KLD2UH.js +186 -0
  31. package/dist/chunk-46KLD2UH.js.map +1 -0
  32. package/dist/chunk-4JGHSSB7.js +11 -0
  33. package/dist/chunk-4JGHSSB7.js.map +1 -0
  34. package/dist/{chunk-M5ZGRVIQ.js → chunk-5IXYF6XN.js} +14 -5
  35. package/dist/chunk-5IXYF6XN.js.map +1 -0
  36. package/dist/chunk-BCS7WHCK.js +139 -0
  37. package/dist/chunk-BCS7WHCK.js.map +1 -0
  38. package/dist/chunk-EK7NDGFR.js +128 -0
  39. package/dist/chunk-EK7NDGFR.js.map +1 -0
  40. package/dist/{chunk-5UDNP7AO.js → chunk-FZ6BXQHL.js} +78 -38
  41. package/dist/chunk-FZ6BXQHL.js.map +1 -0
  42. package/dist/{chunk-CM6BMECR.js → chunk-GRG7PHWQ.js} +2 -1
  43. package/dist/chunk-GRG7PHWQ.js.map +1 -0
  44. package/dist/chunk-KHHZTBP7.js +11 -0
  45. package/dist/chunk-KHHZTBP7.js.map +1 -0
  46. package/dist/chunk-KR2V42UZ.js +187 -0
  47. package/dist/chunk-KR2V42UZ.js.map +1 -0
  48. package/dist/chunk-MZLBPKFE.js +168 -0
  49. package/dist/chunk-MZLBPKFE.js.map +1 -0
  50. package/dist/{chunk-LW7OH6CS.js → chunk-NRMCVHAU.js} +6 -5
  51. package/dist/chunk-NRMCVHAU.js.map +1 -0
  52. package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
  53. package/dist/chunk-NVJMJWLL.js.map +1 -0
  54. package/dist/chunk-O77VSFYZ.js +70 -0
  55. package/dist/chunk-O77VSFYZ.js.map +1 -0
  56. package/dist/chunk-PX3VCKAU.js +29 -0
  57. package/dist/chunk-PX3VCKAU.js.map +1 -0
  58. package/dist/chunk-QR5D2IQC.js +61 -0
  59. package/dist/chunk-QR5D2IQC.js.map +1 -0
  60. package/dist/chunk-RJ76DRPO.js +117 -0
  61. package/dist/chunk-RJ76DRPO.js.map +1 -0
  62. package/dist/chunk-RKX3NQYS.js +28 -0
  63. package/dist/chunk-RKX3NQYS.js.map +1 -0
  64. package/dist/{chunk-JBCIY7QD.js → chunk-SIOU2K4U.js} +45 -22
  65. package/dist/chunk-SIOU2K4U.js.map +1 -0
  66. package/dist/chunk-TSCDAGET.js +75 -0
  67. package/dist/chunk-TSCDAGET.js.map +1 -0
  68. package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
  69. package/dist/chunk-TXTQIYCV.js.map +1 -0
  70. package/dist/chunk-X7ETVO4P.js +26544 -0
  71. package/dist/chunk-X7ETVO4P.js.map +1 -0
  72. package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
  73. package/dist/chunk-YBW5JSA3.js +251 -0
  74. package/dist/chunk-YBW5JSA3.js.map +1 -0
  75. package/dist/chunk-YRXAWWCU.js +45 -0
  76. package/dist/chunk-YRXAWWCU.js.map +1 -0
  77. package/dist/claude-provider-account-authority.d.ts +18 -0
  78. package/dist/claude-subscription-oauth.d.ts +42 -0
  79. package/dist/claude-subscription-usage.d.ts +159 -0
  80. package/dist/client-error-report.d.ts +109 -0
  81. package/dist/client-error-report.js +87 -0
  82. package/dist/client-error-report.js.map +1 -0
  83. package/dist/code-search.d.ts +52 -0
  84. package/dist/code-search.js +40 -0
  85. package/dist/code-search.js.map +1 -0
  86. package/dist/company-brain-governed-writes.d.ts +475 -0
  87. package/dist/company-brain.d.ts +336 -0
  88. package/dist/company-profile.d.ts +566 -0
  89. package/dist/connect.d.ts +325 -0
  90. package/dist/connect.js +191 -0
  91. package/dist/connect.js.map +1 -0
  92. package/dist/connection-account-label.d.ts +2 -0
  93. package/dist/connection-account-label.js +35 -0
  94. package/dist/connection-account-label.js.map +1 -0
  95. package/dist/connection-authority.d.ts +193 -0
  96. package/dist/connection-authority.js +50 -0
  97. package/dist/connection-authority.js.map +1 -0
  98. package/dist/connector-attachments.d.ts +95 -0
  99. package/dist/connector-attachments.js +51 -0
  100. package/dist/connector-attachments.js.map +1 -0
  101. package/dist/connector-tool-permissions.d.ts +73 -0
  102. package/dist/direct-model-provider.d.ts +36 -0
  103. package/dist/editable-artifact-codec-registry.d.ts +16 -7
  104. package/dist/editable-artifact-codec-registry.js +18 -8
  105. package/dist/editable-artifact-committed-transaction.d.ts +2 -2
  106. package/dist/editable-artifact-committed-transaction.js +2 -2
  107. package/dist/editable-artifact-live.d.ts +11 -12
  108. package/dist/editable-artifact-live.js +110 -45
  109. package/dist/editable-artifact-live.js.map +1 -1
  110. package/dist/editable-artifact-serialized-commit.d.ts +2 -1
  111. package/dist/editable-artifact-serialized-commit.js +8 -7
  112. package/dist/editable-artifact-versions.d.ts +20 -5
  113. package/dist/editable-artifact-versions.js +23 -5
  114. package/dist/editable-artifacts.d.ts +2 -0
  115. package/dist/editable-artifacts.js +47 -35
  116. package/dist/external-identities.d.ts +784 -0
  117. package/dist/external-identities.js +44 -0
  118. package/dist/external-identities.js.map +1 -0
  119. package/dist/feedback.d.ts +51 -0
  120. package/dist/github-repository-contracts.d.ts +36 -0
  121. package/dist/github-repository-contracts.js +59 -0
  122. package/dist/github-repository-contracts.js.map +1 -0
  123. package/dist/github-repository.d.ts +14 -0
  124. package/dist/github-repository.js +36 -0
  125. package/dist/github-repository.js.map +1 -0
  126. package/dist/google-drive.d.ts +90 -1
  127. package/dist/google-drive.js +90 -16
  128. package/dist/google-drive.js.map +1 -1
  129. package/dist/governed-learning-activation.d.ts +154 -0
  130. package/dist/governed-learning-evaluator.d.ts +152 -0
  131. package/dist/host-mcp-bindings.d.ts +326 -0
  132. package/dist/host-mcp-bindings.js +252 -0
  133. package/dist/host-mcp-bindings.js.map +1 -0
  134. package/dist/image-generation.d.ts +1 -0
  135. package/dist/index.d.ts +32396 -11386
  136. package/dist/index.js +2198 -164
  137. package/dist/insights-usage.d.ts +877 -0
  138. package/dist/insights-usage.js +509 -0
  139. package/dist/insights-usage.js.map +1 -0
  140. package/dist/interaction.d.ts +344 -0
  141. package/dist/knowledge-entries.d.ts +982 -0
  142. package/dist/knowledge-preparation.d.ts +237 -0
  143. package/dist/knowledge.d.ts +197 -0
  144. package/dist/managed-auth-session-sets.d.ts +241 -0
  145. package/dist/managed-auth-session-sets.js +191 -0
  146. package/dist/managed-auth-session-sets.js.map +1 -0
  147. package/dist/managed-sign-in-methods.d.ts +56 -0
  148. package/dist/managed-sign-in-methods.js +46 -0
  149. package/dist/managed-sign-in-methods.js.map +1 -0
  150. package/dist/mcp-catalog-limits.d.ts +2 -0
  151. package/dist/mcp-endpoint.d.ts +7 -0
  152. package/dist/mcp-endpoint.js +9 -0
  153. package/dist/mcp-endpoint.js.map +1 -0
  154. package/dist/mcp-oauth.d.ts +71 -0
  155. package/dist/modal-native-proof-v2.d.ts +587 -0
  156. package/dist/modal-native-proof-v2.js +37 -0
  157. package/dist/modal-native-proof-v2.js.map +1 -0
  158. package/dist/model-availability.d.ts +15 -0
  159. package/dist/model-connection-access.d.ts +24 -0
  160. package/dist/model-context-inspector.d.ts +329 -0
  161. package/dist/model-display.d.ts +38 -0
  162. package/dist/model-display.js +134 -0
  163. package/dist/model-display.js.map +1 -0
  164. package/dist/model-picker-order.d.ts +25 -0
  165. package/dist/model-picker-order.js +42 -0
  166. package/dist/model-picker-order.js.map +1 -0
  167. package/dist/organization-access.d.ts +231 -0
  168. package/dist/organization-access.js +34 -0
  169. package/dist/organization-access.js.map +1 -0
  170. package/dist/organization-integration-policy.d.ts +27 -0
  171. package/dist/organization-membership-lifecycle.d.ts +1022 -0
  172. package/dist/organization-model-usage.d.ts +146 -0
  173. package/dist/organization-model-usage.js +67 -0
  174. package/dist/organization-model-usage.js.map +1 -0
  175. package/dist/organization-recovery.d.ts +337 -0
  176. package/dist/organization-recovery.js +37 -0
  177. package/dist/organization-recovery.js.map +1 -0
  178. package/dist/organization-usage.d.ts +138 -0
  179. package/dist/permissions.d.ts +54 -0
  180. package/dist/personal-github.d.ts +320 -0
  181. package/dist/personal-github.js +222 -0
  182. package/dist/personal-github.js.map +1 -0
  183. package/dist/plugin-discovery.d.ts +35 -0
  184. package/dist/plugin-discovery.js +7 -0
  185. package/dist/plugin-discovery.js.map +1 -0
  186. package/dist/preference-registry.d.ts +44 -1
  187. package/dist/product-analytics.d.ts +113 -0
  188. package/dist/product-lifecycle-facts.d.ts +73 -0
  189. package/dist/remember.d.ts +350 -0
  190. package/dist/retained-output.d.ts +8 -0
  191. package/dist/sandbox-file-artifacts.d.ts +57 -0
  192. package/dist/sandbox-provider-command.d.ts +113 -0
  193. package/dist/sandbox-recovery.d.ts +146 -0
  194. package/dist/sandbox-snapshots.d.ts +39 -0
  195. package/dist/session-final-reply.d.ts +6 -0
  196. package/dist/session-final-reply.js +9 -0
  197. package/dist/session-final-reply.js.map +1 -0
  198. package/dist/session-goal-reports.d.ts +21 -0
  199. package/dist/session-history-import.d.ts +947 -0
  200. package/dist/session-list-entries.d.ts +4 -0
  201. package/dist/session-list-entries.js +51 -0
  202. package/dist/session-list-entries.js.map +1 -0
  203. package/dist/session-mcp-projections.d.ts +215 -0
  204. package/dist/session-message-search.d.ts +68 -0
  205. package/dist/session-titles.d.ts +68 -0
  206. package/dist/session-titles.js +25 -0
  207. package/dist/session-titles.js.map +1 -0
  208. package/dist/session-topology-primitives.d.ts +22 -0
  209. package/dist/signup-attribution.d.ts +39 -0
  210. package/dist/site-request-headers.test.d.ts +1 -0
  211. package/dist/site-session-http.d.ts +11 -0
  212. package/dist/site-session-http.js +11 -0
  213. package/dist/site-session-http.js.map +1 -0
  214. package/dist/skill-catalog-context.d.ts +7 -0
  215. package/dist/skill-files.d.ts +12 -0
  216. package/dist/skill-metadata.d.ts +9 -0
  217. package/dist/skill-use.d.ts +61 -0
  218. package/dist/skills.d.ts +185 -0
  219. package/dist/slack-bot-scopes.d.ts +46 -21
  220. package/dist/slack-bot-scopes.js +14 -3
  221. package/dist/slack-rest-mcp.d.ts +31 -0
  222. package/dist/slack-rest-mcp.js +19 -0
  223. package/dist/slack-rest-mcp.js.map +1 -0
  224. package/dist/spreadsheet-artifact-commands.d.ts +2 -3
  225. package/dist/spreadsheet-artifact-commands.js +4 -2
  226. package/dist/spreadsheet-artifact-query.js +3 -2
  227. package/dist/subscription-account-pools.d.ts +292 -0
  228. package/dist/task-notes.d.ts +42 -1
  229. package/dist/tool-catalog.d.ts +286 -0
  230. package/dist/tool-result-spill.d.ts +16 -0
  231. package/dist/usage-allowances.d.ts +285 -0
  232. package/dist/usage-allowances.js +49 -0
  233. package/dist/usage-allowances.js.map +1 -0
  234. package/dist/video-generation.d.ts +3 -0
  235. package/dist/video-generation.js +1 -1
  236. package/dist/work-claims.d.ts +411 -0
  237. package/dist/workspace-instruction-policies.d.ts +94 -0
  238. package/dist/workspace-integration-wire.d.ts +36 -0
  239. package/dist/workspace-integration-wire.js +23 -0
  240. package/dist/workspace-integration-wire.js.map +1 -0
  241. package/dist/workspace-integrations.d.ts +948 -0
  242. package/dist/workspace-learning-administration.d.ts +289 -0
  243. package/dist/workspace-learning-policy.d.ts +1 -1
  244. package/dist/workspace-state.d.ts +85 -416
  245. package/dist/xai-provider-account-authority.d.ts +3 -0
  246. package/dist/xai-provider-account-authority.js +1 -1
  247. package/package.json +134 -1
  248. package/src/agent-authored-durable-text.ts +116 -0
  249. package/src/agent-config.ts +1527 -0
  250. package/src/agent-instruction-changes.ts +98 -0
  251. package/src/agent-learning.ts +161 -0
  252. package/src/agent-topology.ts +69 -0
  253. package/src/allowance-refusal.ts +81 -0
  254. package/src/analytics-consent-report.ts +20 -0
  255. package/src/api-key-presets.ts +25 -0
  256. package/src/artifact-catalog.ts +60 -0
  257. package/src/artifacts.ts +146 -18
  258. package/src/atlassian-native-retirement.ts +33 -0
  259. package/src/browser-storage.ts +10 -0
  260. package/src/bundled-skills.ts +73 -0
  261. package/src/claude-provider-account-authority.ts +12 -0
  262. package/src/claude-subscription-oauth.ts +62 -0
  263. package/src/claude-subscription-usage.ts +59 -0
  264. package/src/client-error-report.ts +184 -0
  265. package/src/code-search.ts +105 -0
  266. package/src/company-brain-governed-writes.ts +356 -0
  267. package/src/company-brain.ts +201 -0
  268. package/src/company-profile.ts +167 -1
  269. package/src/connect.ts +202 -0
  270. package/src/connection-account-label.ts +46 -0
  271. package/src/connection-authority.ts +213 -0
  272. package/src/connector-attachments.ts +327 -0
  273. package/src/connector-tool-permissions.ts +60 -0
  274. package/src/direct-model-provider.ts +98 -0
  275. package/src/editable-artifact-codec-registry.ts +55 -17
  276. package/src/editable-artifact-committed-transaction.ts +44 -31
  277. package/src/editable-artifact-live.ts +123 -57
  278. package/src/editable-artifact-serialized-commit.ts +2 -1
  279. package/src/editable-artifact-versions.ts +26 -5
  280. package/src/editable-artifacts.ts +2 -0
  281. package/src/external-identities.ts +285 -0
  282. package/src/feedback.ts +39 -0
  283. package/src/github-repository-contracts.ts +85 -0
  284. package/src/github-repository.ts +59 -0
  285. package/src/google-drive.ts +76 -4
  286. package/src/governed-learning-activation.ts +191 -0
  287. package/src/governed-learning-evaluator.ts +176 -0
  288. package/src/host-mcp-bindings.ts +298 -0
  289. package/src/image-generation.ts +8 -2
  290. package/src/index.ts +7093 -1466
  291. package/src/insights-usage.ts +679 -0
  292. package/src/interaction.ts +220 -5
  293. package/src/knowledge-entries.ts +375 -0
  294. package/src/knowledge-preparation.ts +50 -0
  295. package/src/knowledge.ts +134 -6
  296. package/src/managed-auth-session-sets.ts +253 -0
  297. package/src/managed-sign-in-methods.ts +37 -0
  298. package/src/mcp-catalog-limits.ts +2 -0
  299. package/src/mcp-endpoint.ts +30 -0
  300. package/src/mcp-oauth.ts +66 -0
  301. package/src/modal-native-proof-v2.ts +398 -0
  302. package/src/model-availability.ts +22 -0
  303. package/src/model-connection-access.ts +17 -0
  304. package/src/model-context-inspector.ts +139 -0
  305. package/src/model-display.ts +195 -0
  306. package/src/model-picker-order.ts +97 -0
  307. package/src/organization-access.ts +176 -0
  308. package/src/organization-integration-policy.ts +54 -0
  309. package/src/organization-membership-lifecycle.ts +559 -0
  310. package/src/organization-model-usage.ts +72 -0
  311. package/src/organization-recovery.ts +186 -0
  312. package/src/organization-usage.ts +79 -0
  313. package/src/permissions.ts +58 -0
  314. package/src/personal-github.ts +267 -0
  315. package/src/plugin-discovery.ts +33 -0
  316. package/src/preference-registry.ts +20 -1
  317. package/src/product-analytics.ts +253 -0
  318. package/src/product-lifecycle-facts.ts +121 -0
  319. package/src/remember.ts +243 -0
  320. package/src/retained-output.ts +20 -3
  321. package/src/sandbox-file-artifacts.ts +73 -0
  322. package/src/sandbox-provider-command.ts +82 -0
  323. package/src/sandbox-recovery.ts +116 -0
  324. package/src/sandbox-snapshots.ts +142 -0
  325. package/src/session-final-reply.ts +16 -0
  326. package/src/session-goal-reports.ts +55 -0
  327. package/src/session-history-import.ts +159 -0
  328. package/src/session-list-entries.ts +91 -0
  329. package/src/session-mcp-projections.ts +273 -0
  330. package/src/session-message-search.ts +54 -0
  331. package/src/session-titles.ts +467 -0
  332. package/src/session-topology-primitives.ts +21 -0
  333. package/src/signup-attribution.ts +81 -0
  334. package/src/site-request-headers.test.ts +28 -0
  335. package/src/site-session-http.ts +63 -0
  336. package/src/skill-catalog-context.ts +50 -0
  337. package/src/skill-files.ts +52 -0
  338. package/src/skill-metadata.ts +40 -0
  339. package/src/skill-use.ts +77 -0
  340. package/src/skills.ts +136 -0
  341. package/src/slack-bot-scopes.ts +106 -42
  342. package/src/slack-rest-mcp.ts +194 -0
  343. package/src/spreadsheet-artifact-commands.ts +12 -13
  344. package/src/subscription-account-pools.ts +44 -0
  345. package/src/task-notes.ts +14 -1
  346. package/src/tool-catalog.ts +155 -0
  347. package/src/tool-result-spill.ts +35 -0
  348. package/src/usage-allowances.ts +187 -0
  349. package/src/work-claims.ts +266 -0
  350. package/src/workspace-instruction-policies.ts +31 -0
  351. package/src/workspace-integration-wire.ts +99 -0
  352. package/src/workspace-integrations.ts +640 -0
  353. package/src/workspace-learning-administration.ts +88 -0
  354. package/src/workspace-learning-policy.ts +4 -3
  355. package/src/workspace-state.ts +16 -126
  356. package/src/xai-provider-account-authority.ts +1 -0
  357. package/dist/chunk-5UDNP7AO.js.map +0 -1
  358. package/dist/chunk-BVGIYW7D.js +0 -11
  359. package/dist/chunk-BVGIYW7D.js.map +0 -1
  360. package/dist/chunk-CM6BMECR.js.map +0 -1
  361. package/dist/chunk-JBCIY7QD.js.map +0 -1
  362. package/dist/chunk-LSB7GRLG.js.map +0 -1
  363. package/dist/chunk-LW7OH6CS.js.map +0 -1
  364. package/dist/chunk-M5ZGRVIQ.js.map +0 -1
  365. package/dist/chunk-Q6A7XT2N.js +0 -16734
  366. package/dist/chunk-Q6A7XT2N.js.map +0 -1
  367. package/dist/chunk-TZ6YEYN4.js.map +0 -1
  368. package/dist/chunk-Y3MLSLB4.js.map +0 -1
  369. /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
@@ -0,0 +1,285 @@
1
+ import { z } from "zod";
2
+ import { Permission } from "./permissions";
3
+
4
+ // External identifiers are opaque, case-sensitive strings. In particular a
5
+ // native-looking identifier is still host data, never a native subject claim.
6
+ // Bound bytes, not just JS code units: these values share a PostgreSQL B-tree
7
+ // index entry. Never normalize/truncate an identifier to make it fit, and reject
8
+ // text that the driver would replace or PostgreSQL cannot represent.
9
+ const encoder = new TextEncoder();
10
+ function opaqueText(maxBytes: number) {
11
+ return z
12
+ .string()
13
+ .min(1)
14
+ .max(maxBytes)
15
+ .refine(
16
+ (value) =>
17
+ !value.includes("\0") &&
18
+ !/[\uD800-\uDFFF]/u.test(value) &&
19
+ encoder.encode(value).byteLength <= maxBytes,
20
+ {
21
+ message: `Identifier must be valid PostgreSQL Unicode text of at most ${maxBytes} UTF-8 bytes`,
22
+ },
23
+ );
24
+ }
25
+ const externalId = opaqueText(1024);
26
+ const source = opaqueText(200);
27
+ const externalSubject = z
28
+ .string()
29
+ .regex(/^external_user:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$(?![\s\S])/);
30
+ const nativeSubject = z
31
+ .string()
32
+ .min(1)
33
+ .max(1024)
34
+ .regex(/^user:[^\r\n]+$(?![\s\S])/);
35
+ export const ExternalIdentityReference = z
36
+ .object({
37
+ externalId,
38
+ source: source.default("default"),
39
+ })
40
+ .strict();
41
+ export type ExternalIdentityReference = z.infer<typeof ExternalIdentityReference>;
42
+
43
+ export const AddExternalWorkspaceMemberRequest = z
44
+ .object({
45
+ identity: ExternalIdentityReference,
46
+ permissions: z.array(Permission).min(1).max(Permission.options.length),
47
+ /** Opt-in durable operation identity; unkeyed legacy requests are not cancellable. */
48
+ operationId: z.string().uuid().optional(),
49
+ })
50
+ .strict();
51
+ export type AddExternalWorkspaceMemberRequest = z.infer<typeof AddExternalWorkspaceMemberRequest>;
52
+
53
+ /** Content-free service lookup, including identities which can no longer act. */
54
+ export const ExternalIdentityLookup = z.discriminatedUnion("found", [
55
+ z.object({ found: z.literal(false) }).strict(),
56
+ z
57
+ .object({
58
+ found: z.literal(true),
59
+ subjectId: externalSubject,
60
+ organizationMembershipId: z.string().uuid(),
61
+ identityStatus: z.enum(["active", "disabled", "revoked"]),
62
+ identityAuthorizationRevision: z.number().int().positive().safe(),
63
+ membershipStatus: z.enum(["provisioning", "active", "suspended", "revoked"]),
64
+ membershipAuthorizationRevision: z.number().int().positive().safe(),
65
+ })
66
+ .strict(),
67
+ ]);
68
+ export type ExternalIdentityLookup = z.infer<typeof ExternalIdentityLookup>;
69
+
70
+ /** Terminal withdrawal of this external member's workspace access, also fencing
71
+ * an exact earlier onboarding operation whether or not it has reached the API. */
72
+ export const CancelExternalWorkspaceMemberGrantRequest = z
73
+ .object({
74
+ operationId: z.string().uuid(),
75
+ cancelGrantOperationId: z.string().uuid(),
76
+ })
77
+ .strict()
78
+ .refine((value) => value.operationId !== value.cancelGrantOperationId, {
79
+ message: "Revocation and grant must use different operation identities",
80
+ });
81
+ export type CancelExternalWorkspaceMemberGrantRequest = z.infer<
82
+ typeof CancelExternalWorkspaceMemberGrantRequest
83
+ >;
84
+ export const CancelExternalWorkspaceMemberGrantResponse = z
85
+ .object({
86
+ removed: z.boolean(),
87
+ replay: z.boolean(),
88
+ fencedGrantOperationId: z.string().uuid(),
89
+ })
90
+ .strict();
91
+ export type CancelExternalWorkspaceMemberGrantResponse = z.infer<
92
+ typeof CancelExternalWorkspaceMemberGrantResponse
93
+ >;
94
+
95
+ /** Replace an existing external member's permissions in one shared workspace.
96
+ * Keyed and idempotent like a grant; narrowing forces live authority to
97
+ * re-check but never cancels or tears down work. */
98
+ export const UpdateExternalWorkspaceMemberRequest = z
99
+ .object({
100
+ permissions: z.array(Permission).min(1).max(Permission.options.length),
101
+ operationId: z.string().uuid(),
102
+ })
103
+ .strict();
104
+ export type UpdateExternalWorkspaceMemberRequest = z.infer<
105
+ typeof UpdateExternalWorkspaceMemberRequest
106
+ >;
107
+ export const UpdateExternalWorkspaceMemberResponse = z
108
+ .object({
109
+ subjectId: z.string(),
110
+ organizationMembershipId: z.string().uuid(),
111
+ permissions: z.array(Permission),
112
+ /** True when a previously held permission was removed. */
113
+ narrowed: z.boolean(),
114
+ replay: z.boolean(),
115
+ })
116
+ .strict();
117
+ export type UpdateExternalWorkspaceMemberResponse = z.infer<
118
+ typeof UpdateExternalWorkspaceMemberResponse
119
+ >;
120
+
121
+ /** Uses the organization membership ID returned by lazy identity admission.
122
+ * Reactivation restores admission only, not revoked work or workspace grants. */
123
+ export const UpdateExternalIdentityMembershipRequest = z
124
+ .object({
125
+ kind: z.enum(["suspend", "reactivate", "offboard"]),
126
+ expectedAuthorizationRevision: z.number().int().positive().safe(),
127
+ operationId: z.string().uuid(),
128
+ reason: z.string().max(512).optional(),
129
+ })
130
+ .strict();
131
+ export type UpdateExternalIdentityMembershipRequest = z.infer<
132
+ typeof UpdateExternalIdentityMembershipRequest
133
+ >;
134
+
135
+ export const ExternalActorSelection = z.discriminatedUnion("mode", [
136
+ z.object({ mode: z.literal("external"), identity: ExternalIdentityReference }).strict(),
137
+ z
138
+ .object({
139
+ mode: z.literal("linked_native"),
140
+ identity: ExternalIdentityReference,
141
+ linkId: z.string().uuid(),
142
+ expectedLinkRevision: z.number().int().positive().safe(),
143
+ })
144
+ .strict(),
145
+ ]);
146
+ export type ExternalActorSelection = z.infer<typeof ExternalActorSelection>;
147
+
148
+ export const ExternalIdentity = z
149
+ .object({
150
+ id: z.string().uuid(),
151
+ accountId: z.string().uuid(),
152
+ source,
153
+ externalId,
154
+ subjectId: externalSubject,
155
+ organizationMembershipId: z.string().uuid(),
156
+ personalWorkspaceId: z.string().uuid(),
157
+ status: z.enum(["active", "disabled", "revoked"]),
158
+ authorizationRevision: z.number().int().positive().safe(),
159
+ })
160
+ .strict();
161
+ export type ExternalIdentity = z.infer<typeof ExternalIdentity>;
162
+
163
+ // Audit attribution, not authentication. Only the canonical access resolver
164
+ // may establish provenance; accepting this JSON from a browser proves nothing.
165
+ export const ExternalActorAttribution = z
166
+ .object({
167
+ accountId: z.string().uuid(),
168
+ authenticatingApiKeyId: z.string().uuid(),
169
+ externalIdentityId: z.string().uuid(),
170
+ externalSubjectId: externalSubject,
171
+ externalAuthorizationRevision: z.number().int().positive().safe(),
172
+ effectiveSubjectId: z.string().min(1).max(1024),
173
+ actingMode: z.enum(["external", "linked_native"]),
174
+ linkId: z.string().uuid().optional(),
175
+ linkRevision: z.number().int().positive().safe().optional(),
176
+ })
177
+ .strict()
178
+ .superRefine((value, context) => {
179
+ if (value.actingMode === "external") {
180
+ if (
181
+ value.effectiveSubjectId !== value.externalSubjectId ||
182
+ value.linkId !== undefined ||
183
+ value.linkRevision !== undefined
184
+ ) {
185
+ context.addIssue({
186
+ code: "custom",
187
+ message: "External mode cannot delegate native identity",
188
+ });
189
+ }
190
+ } else if (
191
+ !value.linkId ||
192
+ !value.linkRevision ||
193
+ !nativeSubject.safeParse(value.effectiveSubjectId).success
194
+ ) {
195
+ context.addIssue({
196
+ code: "custom",
197
+ message: "Linked mode requires exact native delegation provenance",
198
+ });
199
+ }
200
+ });
201
+ export type ExternalActorAttribution = z.infer<typeof ExternalActorAttribution>;
202
+
203
+ /** Server-signed/encrypted continuation data, never sufficient live authority. */
204
+ export const ExternalActorContinuation = z
205
+ .object({
206
+ identity: ExternalIdentityReference,
207
+ actor: ExternalActorAttribution,
208
+ })
209
+ .strict();
210
+ export type ExternalActorContinuation = z.infer<typeof ExternalActorContinuation>;
211
+
212
+ export const ExternalIdentityLink = z
213
+ .object({
214
+ id: z.string().uuid(),
215
+ accountId: z.string().uuid(),
216
+ externalIdentityId: z.string().uuid(),
217
+ externalIdentity: ExternalIdentityReference.optional(),
218
+ nativeSubjectId: nativeSubject.nullable(),
219
+ status: z.enum(["pending", "active", "revoked", "expired"]),
220
+ revision: z.number().int().positive().safe(),
221
+ permissions: z.array(Permission).max(Permission.options.length),
222
+ expiresAt: z.string().datetime({ offset: true }).nullable(),
223
+ })
224
+ .strict()
225
+ .refine(
226
+ (value) => value.status !== "active" || value.nativeSubjectId !== null,
227
+ "An active link requires a confirmed native identity",
228
+ );
229
+ export type ExternalIdentityLink = z.infer<typeof ExternalIdentityLink>;
230
+
231
+ export const ExternalIdentityLinkPage = z
232
+ .object({
233
+ links: z.array(ExternalIdentityLink).max(50),
234
+ nextCursor: z.string().uuid().nullable(),
235
+ })
236
+ .strict();
237
+ export type ExternalIdentityLinkPage = z.infer<typeof ExternalIdentityLinkPage>;
238
+
239
+ /** A native confirmation may narrow this request, never broaden it. The
240
+ * challenge is delivered once to the host and is not an authentication token. */
241
+ export const BeginExternalIdentityLinkRequest = z
242
+ .object({
243
+ permissions: z.array(Permission).min(1).max(Permission.options.length),
244
+ expiresAt: z.string().datetime({ offset: true }).nullable().default(null),
245
+ })
246
+ .strict();
247
+ export type BeginExternalIdentityLinkRequest = z.input<typeof BeginExternalIdentityLinkRequest>;
248
+ export const ConfirmExternalIdentityLinkRequest = z
249
+ .object({
250
+ challenge: z.string().regex(/^[A-Za-z0-9_-]{43}$/),
251
+ expectedRevision: z.number().int().positive().safe(),
252
+ permissions: z.array(Permission).min(1).max(Permission.options.length),
253
+ })
254
+ .strict();
255
+ export type ConfirmExternalIdentityLinkRequest = z.infer<typeof ConfirmExternalIdentityLinkRequest>;
256
+ export const BeginExternalIdentityLinkResponse = z
257
+ .object({
258
+ link: ExternalIdentityLink,
259
+ challenge: z.string().regex(/^[A-Za-z0-9_-]{43}$/),
260
+ confirmBefore: z.string().datetime({ offset: true }),
261
+ })
262
+ .strict();
263
+ export type BeginExternalIdentityLinkResponse = z.infer<typeof BeginExternalIdentityLinkResponse>;
264
+ export const ExternalIdentityLinkPreview = z
265
+ .object({
266
+ link: ExternalIdentityLink,
267
+ externalIdentity: ExternalIdentityReference,
268
+ nativeSubjectId: nativeSubject,
269
+ organizationId: z.string().uuid(),
270
+ })
271
+ .strict();
272
+ export type ExternalIdentityLinkPreview = z.infer<typeof ExternalIdentityLinkPreview>;
273
+
274
+ /** Immutable accepted-work restriction, not a browser credential. Original key
275
+ * identity remains audit-only; durable use validates the live link and members. */
276
+ export const ExternalLinkWorkSnapshot = z
277
+ .object({
278
+ identity: ExternalIdentityReference,
279
+ actor: ExternalActorAttribution.refine((value) => value.actingMode === "linked_native"),
280
+ permissions: z.array(Permission).max(Permission.options.length),
281
+ /** Absent on historical snapshots, whose legacy semantics are preserved. */
282
+ permissionMode: z.enum(["legacy", "explicit"]).optional(),
283
+ })
284
+ .strict();
285
+ export type ExternalLinkWorkSnapshot = z.infer<typeof ExternalLinkWorkSnapshot>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+
3
+ export const FeedbackSentiment = z.enum(["positive", "negative"]);
4
+ export type FeedbackSentiment = z.infer<typeof FeedbackSentiment>;
5
+
6
+ /** A new key means a new submission; retry the same payload with the same key. */
7
+ export const CreateFeedbackRequest = z
8
+ .object({
9
+ idempotencyKey: z.string().uuid(),
10
+ sessionId: z.string().uuid().optional(),
11
+ turnId: z.string().uuid().optional(),
12
+ sentiment: FeedbackSentiment.optional(),
13
+ comment: z.string().max(4000).optional(),
14
+ })
15
+ .strict()
16
+ .superRefine((value, ctx) => {
17
+ if (value.turnId && !value.sessionId)
18
+ ctx.addIssue({ code: "custom", path: ["turnId"], message: "turnId requires sessionId" });
19
+ if (value.sentiment && !value.sessionId)
20
+ ctx.addIssue({ code: "custom", path: ["sentiment"], message: "Ratings require a session" });
21
+ if (!value.sentiment && !value.comment?.trim())
22
+ ctx.addIssue({ code: "custom", path: ["comment"], message: "Provide a rating or a comment" });
23
+ });
24
+ export type CreateFeedbackRequest = z.infer<typeof CreateFeedbackRequest>;
25
+
26
+ export const Feedback = z.object({
27
+ id: z.string().uuid(),
28
+ workspaceId: z.string().uuid(),
29
+ subjectId: z.string(),
30
+ principalKind: z.string().nullable(),
31
+ sessionId: z.string().uuid().nullable(),
32
+ turnId: z.string().uuid().nullable(),
33
+ sentiment: FeedbackSentiment.nullable(),
34
+ comment: z.string().nullable(),
35
+ createdAt: z.string().datetime(),
36
+ });
37
+ export type Feedback = z.infer<typeof Feedback>;
38
+ export const FeedbackSubmissionResponse = z.object({ feedback: Feedback, replayed: z.boolean() });
39
+ export type FeedbackSubmissionResponse = z.infer<typeof FeedbackSubmissionResponse>;
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+
3
+ export const VerifyPublicGitHubRepositoryRefRequest = z
4
+ .object({
5
+ url: z.string().min(1).max(2048),
6
+ ref: z
7
+ .string()
8
+ .trim()
9
+ .min(1)
10
+ .max(1024)
11
+ .refine((value) => !/[\u0000-\u001f\u007f]/u.test(value), "ref contains control characters"),
12
+ })
13
+ .strict();
14
+ export type VerifyPublicGitHubRepositoryRefRequest = z.infer<
15
+ typeof VerifyPublicGitHubRepositoryRefRequest
16
+ >;
17
+
18
+ export const VerifyPublicGitHubRepositoryRefResponse = z
19
+ .object({
20
+ owner: z.string().min(1).max(39),
21
+ name: z.string().min(1).max(100),
22
+ fullName: z.string().min(3).max(140),
23
+ canonicalUrl: z.string().url(),
24
+ cloneUrl: z.string().url(),
25
+ defaultBranch: z.string().min(1).max(1024),
26
+ ref: z.string().min(1).max(1024),
27
+ commitSha: z.string().regex(/^[0-9a-f]{40}$/u),
28
+ })
29
+ .strict();
30
+ export type VerifyPublicGitHubRepositoryRefResponse = z.infer<
31
+ typeof VerifyPublicGitHubRepositoryRefResponse
32
+ >;
33
+
34
+ export const GITHUB_REPOSITORY_BRANCH_PAGE_MAX = 100 as const;
35
+
36
+ export const ListGitHubRepositoryBranchesQuery = z
37
+ .object({
38
+ cursor: z.coerce.number().int().positive().max(10_000).default(1),
39
+ limit: z.coerce
40
+ .number()
41
+ .int()
42
+ .min(1)
43
+ .max(GITHUB_REPOSITORY_BRANCH_PAGE_MAX)
44
+ .default(GITHUB_REPOSITORY_BRANCH_PAGE_MAX),
45
+ })
46
+ .strict();
47
+ export type ListGitHubRepositoryBranchesQuery = z.infer<typeof ListGitHubRepositoryBranchesQuery>;
48
+
49
+ export const GitHubRepositoryBranch = z
50
+ .object({
51
+ name: z.string().min(1).max(1024),
52
+ isDefault: z.boolean(),
53
+ })
54
+ .strict();
55
+ export type GitHubRepositoryBranch = z.infer<typeof GitHubRepositoryBranch>;
56
+
57
+ export const GitHubRepositoryBranchesResponse = z
58
+ .object({
59
+ branches: z.array(GitHubRepositoryBranch).max(GITHUB_REPOSITORY_BRANCH_PAGE_MAX),
60
+ nextCursor: z.number().int().positive().max(10_000).nullable(),
61
+ })
62
+ .strict()
63
+ .superRefine((response, context) => {
64
+ const names = new Set<string>();
65
+ let defaultCount = 0;
66
+ response.branches.forEach((branch, index) => {
67
+ if (names.has(branch.name)) {
68
+ context.addIssue({
69
+ code: "custom",
70
+ path: ["branches", index, "name"],
71
+ message: "branch names must be unique",
72
+ });
73
+ }
74
+ names.add(branch.name);
75
+ if (branch.isDefault) defaultCount += 1;
76
+ });
77
+ if (defaultCount > 1) {
78
+ context.addIssue({
79
+ code: "custom",
80
+ path: ["branches"],
81
+ message: "at most one branch may be marked as default",
82
+ });
83
+ }
84
+ });
85
+ export type GitHubRepositoryBranchesResponse = z.infer<typeof GitHubRepositoryBranchesResponse>;
@@ -0,0 +1,59 @@
1
+ export type CanonicalGitHubRepository = {
2
+ owner: string;
3
+ name: string;
4
+ fullName: string;
5
+ canonicalUrl: string;
6
+ cloneUrl: string;
7
+ };
8
+
9
+ /**
10
+ * Parse only a canonical public github.com repository URL. This deliberately
11
+ * rejects aliases, credentials, ports, query/fragment state, encoded paths,
12
+ * and repository subpaths so callers cannot accidentally verify one target
13
+ * and attach another.
14
+ */
15
+ export function parseCanonicalGitHubRepositoryUrl(value: string): CanonicalGitHubRepository {
16
+ if (!value.startsWith("https://github.com/")) {
17
+ throw new Error("GitHub repository URL must use the exact https://github.com host.");
18
+ }
19
+ let url: URL;
20
+ try {
21
+ url = new URL(value);
22
+ } catch {
23
+ throw new TypeError("GitHub repository URL is invalid.");
24
+ }
25
+ if (
26
+ url.protocol !== "https:" ||
27
+ url.hostname !== "github.com" ||
28
+ url.host !== "github.com" ||
29
+ url.username ||
30
+ url.password ||
31
+ url.search ||
32
+ url.hash ||
33
+ url.pathname.includes("%")
34
+ ) {
35
+ throw new TypeError("Use a canonical https://github.com/owner/repository URL.");
36
+ }
37
+ const match = /^\/([^/]+)\/([^/]+?)\/?$/u.exec(url.pathname);
38
+ if (!match) {
39
+ throw new TypeError("GitHub repository URL must contain exactly owner/repository.");
40
+ }
41
+ const owner = match[1]!;
42
+ const name = match[2]!.replace(/\.git$/iu, "");
43
+ if (
44
+ !/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u.test(owner) ||
45
+ !/^[A-Za-z0-9_.-]{1,100}$/u.test(name) ||
46
+ name === "." ||
47
+ name === ".."
48
+ ) {
49
+ throw new TypeError("GitHub repository owner or name is invalid.");
50
+ }
51
+ const fullName = `${owner}/${name}`;
52
+ return {
53
+ owner,
54
+ name,
55
+ fullName,
56
+ canonicalUrl: `https://github.com/${fullName}`,
57
+ cloneUrl: `https://github.com/${fullName}.git`,
58
+ };
59
+ }
@@ -17,9 +17,13 @@ export const GOOGLE_DRIVE_READONLY_SCOPE =
17
17
  export const GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata" as const;
18
18
  export const GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive read-only source sync" as const;
19
19
  export const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = "Google Drive metadata browser" as const;
20
+ export const GOOGLE_DRIVE_PUBLICATION_SERVER_ID = "google-drive-publishing" as const;
21
+ export const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = "google_drive_publish_file" as const;
22
+ export const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = "create" as const;
20
23
 
21
24
  export const GoogleDriveOAuthCapability = z.enum([
22
25
  "picker_file_read",
26
+ "publish_file",
23
27
  "source_metadata_discovery",
24
28
  "source_content_read",
25
29
  "recursive_source_sync",
@@ -27,7 +31,7 @@ export const GoogleDriveOAuthCapability = z.enum([
27
31
  export type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;
28
32
 
29
33
  export type GoogleDriveOAuthScopeDecision = {
30
- accessMode: "metadata_readonly" | "readonly" | null;
34
+ accessMode: "file_only" | "metadata_readonly" | "readonly" | null;
31
35
  capabilities: GoogleDriveOAuthCapability[];
32
36
  };
33
37
 
@@ -43,11 +47,13 @@ export function googleDriveOAuthScopeDecision(
43
47
  const granted = new Set(grantedScopes);
44
48
  const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);
45
49
  const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);
50
+ const hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
46
51
  const hasSourceMetadataDiscovery =
47
52
  hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);
48
- const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
53
+ const hasPickerFileRead = hasSourceContentRead || hasFileWrite;
49
54
  const capabilities: GoogleDriveOAuthCapability[] = [];
50
55
  if (hasPickerFileRead) capabilities.push("picker_file_read");
56
+ if (hasFileWrite) capabilities.push("publish_file");
51
57
  if (hasSourceMetadataDiscovery) capabilities.push("source_metadata_discovery");
52
58
  if (hasSourceContentRead) {
53
59
  capabilities.push("source_content_read", "recursive_source_sync");
@@ -57,7 +63,9 @@ export function googleDriveOAuthScopeDecision(
57
63
  ? "readonly"
58
64
  : hasSourceMetadataDiscovery
59
65
  ? "metadata_readonly"
60
- : null,
66
+ : hasFileWrite
67
+ ? "file_only"
68
+ : null,
61
69
  capabilities,
62
70
  };
63
71
  }
@@ -148,6 +156,26 @@ export const GoogleDriveSelectedSource = z.object({
148
156
  });
149
157
  export type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;
150
158
 
159
+ export const GoogleDriveOutputDestination = z
160
+ .object({
161
+ folderId: z.string().min(1).max(256),
162
+ folderName: z.string().min(1).max(1024),
163
+ driveId: z.string().min(1).max(256).nullable(),
164
+ location: z.enum(["my_drive", "shared_drive"]),
165
+ selectedAt: z.string().datetime({ offset: true }),
166
+ })
167
+ .strict()
168
+ .superRefine((value, context) => {
169
+ if ((value.location === "my_drive") !== (value.driveId === null)) {
170
+ context.addIssue({
171
+ code: "custom",
172
+ path: ["driveId"],
173
+ message: "Google Drive destination location does not match its drive identity",
174
+ });
175
+ }
176
+ });
177
+ export type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;
178
+
151
179
  export const GoogleDriveConnectionMetadata = z
152
180
  .object({
153
181
  credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),
@@ -159,8 +187,9 @@ export const GoogleDriveConnectionMetadata = z
159
187
  googleEmail: z.string().email().max(320),
160
188
  googleDisplayName: z.string().min(1).max(512).nullable(),
161
189
  verifiedAt: z.string().datetime({ offset: true }),
162
- accessMode: z.enum(["metadata_readonly", "readonly"]),
190
+ accessMode: z.enum(["file_only", "metadata_readonly", "readonly"]),
163
191
  lifecycle: GoogleDriveConnectionLifecycle.optional(),
192
+ outputDestination: GoogleDriveOutputDestination.optional(),
164
193
  documentDestination: ConnectorDocumentDestination.optional(),
165
194
  selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
166
195
  /** @deprecated Read `selectedSources`; retained while existing connections migrate. */
@@ -171,6 +200,7 @@ export type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnection
171
200
 
172
201
  export const GoogleDriveOAuthStartRequest = z.object({
173
202
  connectionId: z.string().uuid().optional(),
203
+ capability: z.enum(["source_read", "publish"]).default("source_read"),
174
204
  });
175
205
  export type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;
176
206
 
@@ -192,6 +222,48 @@ export const GoogleDriveDisconnectRequest = z.object({
192
222
  });
193
223
  export type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;
194
224
 
225
+ export const GoogleDrivePublicationExportFile = z
226
+ .object({
227
+ fileId: z.string().uuid(),
228
+ filename: z.string().trim().min(1).max(512),
229
+ contentType: z.string().trim().min(1).max(256),
230
+ sizeBytes: z.number().int().positive(),
231
+ sha256: z.string().regex(/^[0-9a-f]{64}$/u),
232
+ artifactId: z.string().regex(/^[0-9a-f]{32}$/u),
233
+ versionId: z.string().regex(/^[0-9a-f]{32}$/u),
234
+ materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),
235
+ sourceHeadSequence: z.number().int().nonnegative(),
236
+ sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u),
237
+ })
238
+ .strict();
239
+ export type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;
240
+
241
+ export const GoogleDrivePublicationToolInput = z
242
+ .object({
243
+ title: z.string().trim().min(1).max(512),
244
+ modality: z.enum(["document", "spreadsheet", "presentation"]),
245
+ file: GoogleDrivePublicationExportFile,
246
+ idempotencyKey: z.string().trim().min(1).max(200),
247
+ })
248
+ .strict();
249
+ export type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;
250
+
251
+ export const GoogleDrivePublicationReceipt = z
252
+ .object({
253
+ connectionId: z.string().uuid(),
254
+ providerFileId: z.string().min(1).max(256),
255
+ webViewLink: z.string().url(),
256
+ mimeType: z.enum([
257
+ "application/vnd.google-apps.document",
258
+ "application/vnd.google-apps.spreadsheet",
259
+ "application/vnd.google-apps.presentation",
260
+ ]),
261
+ destination: GoogleDriveOutputDestination,
262
+ replayed: z.boolean(),
263
+ })
264
+ .strict();
265
+ export type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;
266
+
195
267
  export const GoogleDriveBrowseItem = z.object({
196
268
  id: z.string().min(1).max(256),
197
269
  name: z.string().min(1).max(1024),