@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,191 @@
1
+ import { z } from "zod";
2
+
3
+ const sha256 = z.string().regex(/^[0-9a-f]{64}$/);
4
+ const boundedActor = z.string().trim().min(1).max(1_024);
5
+
6
+ export const GovernedLearningActivationDestination = z.enum(["instruction_policy", "preference"]);
7
+ export const GovernedLearningActivationAuthorityKind = z.enum(["automatic", "human_confirmed"]);
8
+ export type GovernedLearningActivationAuthorityKind = z.infer<
9
+ typeof GovernedLearningActivationAuthorityKind
10
+ >;
11
+ export type GovernedLearningActivationDestination = z.infer<
12
+ typeof GovernedLearningActivationDestination
13
+ >;
14
+
15
+ export const GovernedLearningActivationCaller = z
16
+ .object({
17
+ workspaceId: z.string().uuid(),
18
+ subjectId: boundedActor,
19
+ })
20
+ .strict();
21
+ export type GovernedLearningActivationCaller = z.infer<typeof GovernedLearningActivationCaller>;
22
+
23
+ export const ActivateGovernedLearningDecisionRequest = z
24
+ .object({
25
+ operationId: z.string().uuid(),
26
+ decisionReceiptId: z.string().uuid(),
27
+ })
28
+ .strict();
29
+ export type ActivateGovernedLearningDecisionRequest = z.infer<
30
+ typeof ActivateGovernedLearningDecisionRequest
31
+ >;
32
+
33
+ export const UndoGovernedLearningActivationRequest = z
34
+ .object({
35
+ operationId: z.string().uuid(),
36
+ activationReceiptId: z.string().uuid(),
37
+ })
38
+ .strict();
39
+ export type UndoGovernedLearningActivationRequest = z.infer<
40
+ typeof UndoGovernedLearningActivationRequest
41
+ >;
42
+
43
+ const destinationBoundary = {
44
+ destination: GovernedLearningActivationDestination,
45
+ destinationProposalId: z.string().uuid(),
46
+ destinationRevisionId: z.string().uuid(),
47
+ destinationOldRevisionId: z.string().uuid().nullable(),
48
+ destinationOldContentHash: sha256.nullable(),
49
+ destinationOldVersion: z.number().int().nonnegative(),
50
+ destinationNewContentHash: sha256,
51
+ destinationNewVersion: z.number().int().positive(),
52
+ destinationEventId: z.string().uuid(),
53
+ };
54
+
55
+ /**
56
+ * Immutable content-free proof that one final automatic evaluator receipt was
57
+ * revalidated and applied through the destination-owned lifecycle.
58
+ */
59
+ export const GovernedLearningActivationReceipt = z
60
+ .object({
61
+ id: z.string().uuid(),
62
+ operationId: z.string().uuid(),
63
+ inputHash: sha256,
64
+ accountId: z.string().uuid(),
65
+ workspaceId: z.string().uuid(),
66
+ decisionReceiptId: z.string().uuid(),
67
+ initiatingHumanSubjectId: boundedActor,
68
+ serviceActorSubjectId: boundedActor,
69
+ policyRevisionId: z.string().uuid(),
70
+ policyHash: sha256,
71
+ policyActivationVersion: z.number().int().positive(),
72
+ sourceKind: z.enum(["scoped-knowledge-evidence", "task-note"]),
73
+ sourceId: z.string().uuid(),
74
+ sourceAuthorityHash: sha256,
75
+ proposalId: z.string().uuid(),
76
+ claimId: z.string().uuid(),
77
+ evidenceId: z.string().uuid(),
78
+ knowledgePreviousReviewId: z.string().uuid(),
79
+ knowledgePreviousReviewRevision: z.number().int().positive(),
80
+ knowledgeApprovalReviewId: z.string().uuid(),
81
+ knowledgeApprovalReviewRevision: z.number().int().positive(),
82
+ knowledgeApprovalInputHash: sha256,
83
+ ...destinationBoundary,
84
+ outcome: z.literal("activated"),
85
+ effectiveAt: z.string().datetime(),
86
+ /**
87
+ * `automatic`: a final eligible evaluator receipt under an automatic policy.
88
+ * `human_confirmed`: the exact initiating human answered the bound
89
+ * `remember:<proposalId>` structured human-input question with `save`.
90
+ */
91
+ authorityKind: GovernedLearningActivationAuthorityKind,
92
+ humanInputRequestId: z.string().uuid().nullable(),
93
+ rollback: z
94
+ .object({
95
+ supported: z.literal(true),
96
+ mechanism: z.literal("exact_head_and_latest_review"),
97
+ })
98
+ .strict(),
99
+ createdAt: z.string().datetime(),
100
+ })
101
+ .strict();
102
+ export type GovernedLearningActivationReceipt = z.infer<typeof GovernedLearningActivationReceipt>;
103
+
104
+ export const ActivateHumanConfirmedLearningDecisionRequest = z
105
+ .object({
106
+ operationId: z.string().uuid(),
107
+ decisionReceiptId: z.string().uuid(),
108
+ humanInputRequestId: z.string().uuid(),
109
+ })
110
+ .strict();
111
+ export type ActivateHumanConfirmedLearningDecisionRequest = z.infer<
112
+ typeof ActivateHumanConfirmedLearningDecisionRequest
113
+ >;
114
+
115
+ /** Append-only compensation proof. Undo never deletes prior evidence. */
116
+ export const GovernedLearningActivationUndoReceipt = z
117
+ .object({
118
+ id: z.string().uuid(),
119
+ operationId: z.string().uuid(),
120
+ inputHash: sha256,
121
+ accountId: z.string().uuid(),
122
+ workspaceId: z.string().uuid(),
123
+ activationReceiptId: z.string().uuid(),
124
+ initiatingHumanSubjectId: boundedActor,
125
+ serviceActorSubjectId: boundedActor,
126
+ destination: GovernedLearningActivationDestination,
127
+ knowledgeApprovalReviewId: z.string().uuid(),
128
+ knowledgeRevocationReviewId: z.string().uuid(),
129
+ knowledgeRevocationReviewRevision: z.number().int().positive(),
130
+ knowledgeRevocationInputHash: sha256,
131
+ destinationActivatedRevisionId: z.string().uuid(),
132
+ destinationRestoredRevisionId: z.string().uuid().nullable(),
133
+ destinationActivatedContentHash: sha256,
134
+ destinationRestoredContentHash: sha256.nullable(),
135
+ destinationOldVersion: z.number().int().positive(),
136
+ destinationNewVersion: z.number().int().positive(),
137
+ destinationEventId: z.string().uuid(),
138
+ outcome: z.literal("undone"),
139
+ superseded: z.literal(false),
140
+ effectiveAt: z.string().datetime(),
141
+ createdAt: z.string().datetime(),
142
+ })
143
+ .strict();
144
+ export type GovernedLearningActivationUndoReceipt = z.infer<
145
+ typeof GovernedLearningActivationUndoReceipt
146
+ >;
147
+
148
+ /**
149
+ * Immutable content-free proof that the exact initiating human confirmed a
150
+ * user-directed Knowledge claim (`remember` with lane `knowledge`) through the
151
+ * bound structured human-input question, after which the claim's latest
152
+ * `proposed` review was superseded by an `approved` service review.
153
+ */
154
+ export const RememberKnowledgeConfirmationReceipt = z
155
+ .object({
156
+ id: z.string().uuid(),
157
+ operationId: z.string().uuid(),
158
+ inputHash: sha256,
159
+ accountId: z.string().uuid(),
160
+ workspaceId: z.string().uuid(),
161
+ sessionId: z.string().uuid(),
162
+ turnId: z.string().uuid(),
163
+ executionGeneration: z.number().int().positive(),
164
+ initiatingHumanSubjectId: boundedActor,
165
+ serviceActorSubjectId: boundedActor,
166
+ claimId: z.string().uuid(),
167
+ evidenceId: z.string().uuid(),
168
+ taskNoteId: z.string().uuid(),
169
+ taskNoteTextHash: sha256,
170
+ humanInputRequestId: z.string().uuid(),
171
+ previousReviewId: z.string().uuid(),
172
+ previousReviewRevision: z.number().int().positive(),
173
+ approvalReviewId: z.string().uuid(),
174
+ approvalReviewRevision: z.number().int().positive(),
175
+ createdAt: z.string().datetime(),
176
+ })
177
+ .strict();
178
+ export type RememberKnowledgeConfirmationReceipt = z.infer<
179
+ typeof RememberKnowledgeConfirmationReceipt
180
+ >;
181
+
182
+ export const ConfirmRememberKnowledgeClaimRequest = z
183
+ .object({
184
+ operationId: z.string().uuid(),
185
+ claimId: z.string().uuid(),
186
+ humanInputRequestId: z.string().uuid(),
187
+ })
188
+ .strict();
189
+ export type ConfirmRememberKnowledgeClaimRequest = z.infer<
190
+ typeof ConfirmRememberKnowledgeClaimRequest
191
+ >;
@@ -0,0 +1,176 @@
1
+ import { z } from "zod";
2
+ import { WorkspaceLearningMode } from "./workspace-learning-policy";
3
+
4
+ /**
5
+ * Automatic is intentionally conservative in the first evaluator tranche.
6
+ * This constant is platform-owned rather than caller-selectable so an agent or
7
+ * connector cannot lower the admission floor inside one request.
8
+ */
9
+ export const GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS = 8_500;
10
+ export const GOVERNED_LEARNING_MAX_CONFLICT_COUNT = 1_000;
11
+
12
+ export const GovernedLearningDecisionOutcome = z.enum([
13
+ "off",
14
+ "suggest",
15
+ "automatic",
16
+ "confidence",
17
+ "conflict",
18
+ "stale",
19
+ "revoked",
20
+ ]);
21
+ export type GovernedLearningDecisionOutcome = z.infer<typeof GovernedLearningDecisionOutcome>;
22
+
23
+ /** Stable order used by TypeScript, SQL constraints, and public receipts. */
24
+ export const GOVERNED_LEARNING_REASON_ORDER = [
25
+ "policy_off",
26
+ "evidence_revoked",
27
+ "proposal_stale",
28
+ "evidence_conflict",
29
+ "confidence_below_floor",
30
+ "policy_suggest",
31
+ "policy_automatic",
32
+ ] as const;
33
+
34
+ export const GovernedLearningDecisionReason = z.enum(GOVERNED_LEARNING_REASON_ORDER);
35
+ export type GovernedLearningDecisionReason = z.infer<typeof GovernedLearningDecisionReason>;
36
+
37
+ export const GovernedLearningDecisionFacts = z
38
+ .object({
39
+ effectiveMode: WorkspaceLearningMode,
40
+ confidenceBps: z.number().int().min(0).max(10_000),
41
+ conflictCount: z.number().int().min(0).max(GOVERNED_LEARNING_MAX_CONFLICT_COUNT),
42
+ stale: z.boolean(),
43
+ revoked: z.boolean(),
44
+ })
45
+ .strict();
46
+ export type GovernedLearningDecisionFacts = z.infer<typeof GovernedLearningDecisionFacts>;
47
+
48
+ export const GovernedLearningDecision = z
49
+ .object({
50
+ outcome: GovernedLearningDecisionOutcome,
51
+ reasons: z
52
+ .array(GovernedLearningDecisionReason)
53
+ .min(1)
54
+ .max(GOVERNED_LEARNING_REASON_ORDER.length),
55
+ automaticEligible: z.boolean(),
56
+ confidenceFloorBps: z.literal(GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS),
57
+ })
58
+ .strict()
59
+ .superRefine((decision, context) => {
60
+ if (decision.automaticEligible !== (decision.outcome === "automatic")) {
61
+ context.addIssue({
62
+ code: "custom",
63
+ path: ["automaticEligible"],
64
+ message: "automatic eligibility must exactly match the automatic outcome",
65
+ });
66
+ }
67
+ const indexes = decision.reasons.map((reason) =>
68
+ GOVERNED_LEARNING_REASON_ORDER.indexOf(reason),
69
+ );
70
+ if (indexes.some((value, index) => index > 0 && value <= indexes[index - 1]!)) {
71
+ context.addIssue({
72
+ code: "custom",
73
+ path: ["reasons"],
74
+ message: "governed-learning reasons must be unique and in canonical order",
75
+ });
76
+ }
77
+ });
78
+ export type GovernedLearningDecision = z.infer<typeof GovernedLearningDecision>;
79
+
80
+ export const GovernedLearningEvaluationAttempt = z
81
+ .object({
82
+ workspaceId: z.string().uuid(),
83
+ subjectId: z.string().trim().min(1).max(1_024),
84
+ sessionId: z.string().uuid(),
85
+ turnId: z.string().uuid(),
86
+ attemptId: z.string().uuid(),
87
+ executionGeneration: z.number().int().positive(),
88
+ })
89
+ .strict();
90
+ export type GovernedLearningEvaluationAttempt = z.infer<typeof GovernedLearningEvaluationAttempt>;
91
+
92
+ export const EvaluateGovernedLearningProposalRequest = z
93
+ .object({
94
+ operationId: z.string().uuid(),
95
+ policySnapshotId: z.string().uuid(),
96
+ proposalId: z.string().uuid(),
97
+ claimId: z.string().uuid(),
98
+ evidenceId: z.string().uuid(),
99
+ })
100
+ .strict();
101
+ export type EvaluateGovernedLearningProposalRequest = z.infer<
102
+ typeof EvaluateGovernedLearningProposalRequest
103
+ >;
104
+
105
+ const sha256 = z.string().regex(/^[0-9a-f]{64}$/);
106
+
107
+ /**
108
+ * Content-free immutable evidence. Hashes and bounded enums identify exactly
109
+ * what was evaluated without copying proposal, fact, citation, or note text.
110
+ */
111
+ export const GovernedLearningDecisionReceipt = z
112
+ .object({
113
+ id: z.string().uuid(),
114
+ operationId: z.string().uuid(),
115
+ inputHash: sha256,
116
+ accountId: z.string().uuid(),
117
+ workspaceId: z.string().uuid(),
118
+ sessionId: z.string().uuid(),
119
+ turnId: z.string().uuid(),
120
+ attemptId: z.string().uuid(),
121
+ executionGeneration: z.number().int().positive(),
122
+ initiatingHumanSubjectId: z.string().min(1).max(1_024),
123
+ policySnapshotId: z.string().uuid(),
124
+ policySnapshotHash: sha256,
125
+ policyRevisionId: z.string().uuid().nullable(),
126
+ policyActivationVersion: z.number().int().nonnegative(),
127
+ sourceKind: z.enum(["scoped-knowledge-evidence", "task-note"]),
128
+ sourceId: z.string().uuid(),
129
+ proposalId: z.string().uuid(),
130
+ proposalInputHash: sha256,
131
+ proposalContentHash: sha256,
132
+ claimId: z.string().uuid(),
133
+ claimInputHash: sha256,
134
+ evidenceId: z.string().uuid(),
135
+ evidenceInputHash: sha256,
136
+ evidenceContentHash: sha256,
137
+ evidenceAuthorityHash: sha256,
138
+ reviewRevision: z.number().int().positive(),
139
+ reviewState: z.enum(["proposed", "approved", "rejected", "revoked"]),
140
+ effectiveMode: WorkspaceLearningMode,
141
+ confidenceBps: z.number().int().min(0).max(10_000),
142
+ conflictCount: z.number().int().min(0).max(GOVERNED_LEARNING_MAX_CONFLICT_COUNT),
143
+ outcome: GovernedLearningDecisionOutcome,
144
+ reasons: z
145
+ .array(GovernedLearningDecisionReason)
146
+ .min(1)
147
+ .max(GOVERNED_LEARNING_REASON_ORDER.length),
148
+ automaticEligible: z.boolean(),
149
+ confidenceFloorBps: z.literal(GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS),
150
+ createdAt: z.string().datetime(),
151
+ })
152
+ .strict()
153
+ .superRefine((receipt, context) => {
154
+ const decision = GovernedLearningDecision.safeParse({
155
+ outcome: receipt.outcome,
156
+ reasons: receipt.reasons,
157
+ automaticEligible: receipt.automaticEligible,
158
+ confidenceFloorBps: receipt.confidenceFloorBps,
159
+ });
160
+ if (!decision.success) {
161
+ for (const issue of decision.error.issues) {
162
+ context.addIssue({ ...issue, path: issue.path });
163
+ }
164
+ }
165
+ if (
166
+ receipt.sourceKind === "scoped-knowledge-evidence" &&
167
+ receipt.sourceId !== receipt.evidenceId
168
+ ) {
169
+ context.addIssue({
170
+ code: "custom",
171
+ path: ["sourceId"],
172
+ message: "scoped-Knowledge evaluation must use its exact evidence id as the source id",
173
+ });
174
+ }
175
+ });
176
+ export type GovernedLearningDecisionReceipt = z.infer<typeof GovernedLearningDecisionReceipt>;
@@ -0,0 +1,298 @@
1
+ import { z } from "zod";
2
+ export { HostMcpCreateSelections, type HostMcpCreateSelection } from "./index";
3
+ import {
4
+ McpServerConnectionRef,
5
+ SessionTenancyVisibility,
6
+ ManagedUserResourceGrantMode,
7
+ stableJson,
8
+ } from "./index";
9
+ import { ConnectionUseAuthoritySnapshot } from "./connection-authority";
10
+ import { ExternalIdentity } from "./external-identities";
11
+ export const HostMcpOwnerSubject = z.union([
12
+ ExternalIdentity.shape.subjectId,
13
+ z
14
+ .string()
15
+ .max(4096)
16
+ .regex(/^user:[^\r\n\u0000]+$/),
17
+ ]);
18
+
19
+ /** Credential-free, immutable destination and host connection selection. */
20
+ export const HostMcpBindingDefinition = z
21
+ .object({
22
+ serverId: z.string().min(1).max(256),
23
+ destinationUrl: z
24
+ .string()
25
+ .url()
26
+ .max(4096)
27
+ .refine((value) => {
28
+ const url = new URL(value);
29
+ return url.protocol === "https:" && !url.username && !url.password && !url.hash;
30
+ }, "Host binding requires an HTTPS destination without userinfo or fragment")
31
+ .transform((value) => new URL(value).toString()),
32
+ connectionRef: McpServerConnectionRef,
33
+ })
34
+ .strict()
35
+ .superRefine((value, context) => {
36
+ if (value.connectionRef.hostBinding)
37
+ context.addIssue({
38
+ code: "custom",
39
+ path: ["connectionRef", "hostBinding"],
40
+ message: "A binding definition cannot reference another binding",
41
+ });
42
+ if (value.connectionRef.authoritySource !== "host" || !value.connectionRef.connectionId)
43
+ context.addIssue({
44
+ code: "custom",
45
+ path: ["connectionRef"],
46
+ message: "Explicit host connection authority is required",
47
+ });
48
+ if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536)
49
+ context.addIssue({ code: "custom", message: "Host binding definition exceeds 64 KiB" });
50
+ });
51
+ export type HostMcpBindingDefinition = z.infer<typeof HostMcpBindingDefinition>;
52
+
53
+ /** Configuration ceiling, never execution authority. The complete destination
54
+ * and provider/scope/resource selection stay exact; only the account identifier
55
+ * is chosen by a captured owner grant in explicit accepted-turn mode. */
56
+ export type HostMcpBindingSelection = {
57
+ serverId: string;
58
+ destinationUrl: string;
59
+ connectionRef: McpServerConnectionRef;
60
+ };
61
+
62
+ export function hostMcpBindingMatchesSelection(
63
+ binding: { id: string; generation: number; definition: HostMcpBindingDefinition },
64
+ selection: HostMcpBindingSelection,
65
+ ): boolean {
66
+ const parsed = McpServerConnectionRef.safeParse(selection.connectionRef);
67
+ if (!parsed.success || !parsed.data.hostBinding) return false;
68
+ const { hostBinding, ...configuredRef } = parsed.data;
69
+ const definition = HostMcpBindingDefinition.safeParse(binding.definition);
70
+ if (!definition.success) return false;
71
+ let destinationUrl: string;
72
+ try {
73
+ destinationUrl = new URL(selection.destinationUrl).toString();
74
+ } catch {
75
+ return false;
76
+ }
77
+ if (
78
+ selection.serverId !== definition.data.serverId ||
79
+ destinationUrl !== definition.data.destinationUrl
80
+ )
81
+ return false;
82
+ if ("selection" in hostBinding) {
83
+ const { connectionId: _connectionId, ...selectedRef } = definition.data.connectionRef;
84
+ return stableJson(configuredRef) === stableJson(selectedRef);
85
+ }
86
+ return (
87
+ binding.id === hostBinding.bindingId &&
88
+ binding.generation === hostBinding.generation &&
89
+ stableJson(configuredRef) === stableJson(definition.data.connectionRef)
90
+ );
91
+ }
92
+
93
+ export const HostMcpBinding = z
94
+ .object({
95
+ id: z.string().uuid(),
96
+ accountId: z.string().uuid(),
97
+ workspaceId: z.string().uuid(),
98
+ ownerSubjectId: HostMcpOwnerSubject,
99
+ authorizationRevision: z.number().int().positive().safe(),
100
+ generation: z.number().int().positive().safe(),
101
+ status: z.enum(["active", "revoked"]),
102
+ definition: HostMcpBindingDefinition,
103
+ createdAt: z.string().datetime({ offset: true }),
104
+ revokedAt: z.string().datetime({ offset: true }).nullable(),
105
+ })
106
+ .strict();
107
+ export type HostMcpBinding = z.infer<typeof HostMcpBinding>;
108
+
109
+ export const CreateHostMcpBindingRequest = z
110
+ .object({
111
+ operationId: z.string().uuid(),
112
+ definition: HostMcpBindingDefinition,
113
+ })
114
+ .strict();
115
+ export type CreateHostMcpBindingRequest = z.infer<typeof CreateHostMcpBindingRequest>;
116
+
117
+ const HostMcpGrantRequest = z
118
+ .object({
119
+ scope: z.literal("user"),
120
+ mode: ManagedUserResourceGrantMode,
121
+ context: SessionTenancyVisibility,
122
+ sessionId: z.string().uuid().nullable().optional(),
123
+ expectedAuthorityEpoch: z.number().int().positive().nullable().optional(),
124
+ workspaceSharedAcknowledged: z.boolean().default(false),
125
+ })
126
+ .strict()
127
+ .superRefine((value, context) => {
128
+ if (value.context === "workspace_shared" && !value.workspaceSharedAcknowledged) {
129
+ context.addIssue({
130
+ code: "custom",
131
+ path: ["workspaceSharedAcknowledged"],
132
+ message: "workspace_shared requires durable shared-output acknowledgement",
133
+ });
134
+ }
135
+ if (value.mode === "always" && (value.sessionId || value.expectedAuthorityEpoch)) {
136
+ context.addIssue({ code: "custom", path: ["sessionId"], message: "always is unbound" });
137
+ }
138
+ if (value.mode === "session" && (!value.sessionId || !value.expectedAuthorityEpoch)) {
139
+ context.addIssue({
140
+ code: "custom",
141
+ path: ["sessionId"],
142
+ message: "session requires a target session and expectedAuthorityEpoch",
143
+ });
144
+ }
145
+ });
146
+
147
+ /** Internal owner-authorized issuance; never itself proves caller identity. */
148
+ const HostMcpDelegationGrant = HostMcpGrantRequest.superRefine((value, context) => {
149
+ if (
150
+ Boolean(value.sessionId) !== (value.expectedAuthorityEpoch != null) ||
151
+ (value.expectedAuthorityEpoch != null && !Number.isSafeInteger(value.expectedAuthorityEpoch))
152
+ ) {
153
+ context.addIssue({
154
+ code: "custom",
155
+ message: "Host session grants require a matching safe authority epoch",
156
+ });
157
+ }
158
+ });
159
+ export const IssueHostMcpDelegationRequest = z
160
+ .object({
161
+ operationId: z.string().uuid(),
162
+ bindingId: z.string().uuid(),
163
+ expectedBindingGeneration: z.number().int().positive().safe(),
164
+ grant: HostMcpDelegationGrant,
165
+ })
166
+ .strict();
167
+ export type IssueHostMcpDelegationRequest = z.infer<typeof IssueHostMcpDelegationRequest>;
168
+
169
+ export const HostMcpDelegation = z
170
+ .object({
171
+ id: z.string().uuid(),
172
+ accountId: z.string().uuid(),
173
+ workspaceId: z.string().uuid(),
174
+ ownerSubjectId: HostMcpOwnerSubject,
175
+ ownerAuthorizationRevision: z.number().int().positive().safe(),
176
+ bindingId: z.string().uuid(),
177
+ bindingGeneration: z.number().int().positive().safe(),
178
+ grant: HostMcpDelegationGrant,
179
+ generation: z.number().int().positive().safe(),
180
+ status: z.enum(["active", "revoked"]),
181
+ createdAt: z.string().datetime({ offset: true }),
182
+ revokedAt: z.string().datetime({ offset: true }).nullable(),
183
+ })
184
+ .strict();
185
+ export type HostMcpDelegation = z.infer<typeof HostMcpDelegation>;
186
+
187
+ /** Internal admission evidence, not a caller-supplied permission or credential.
188
+ * Persistence must construct this from live authenticated authority and freeze
189
+ * it with accepted work. Runtime use must independently revalidate that work,
190
+ * membership, binding and delegation. No API key is retained as execution rights.
191
+ */
192
+ export const HostMcpAcceptedAuthority = z
193
+ .object({
194
+ version: z.literal(1),
195
+ accountId: z.string().uuid(),
196
+ workspaceId: z.string().uuid(),
197
+ targetSessionId: z.string().uuid(),
198
+ targetSessionVisibility: SessionTenancyVisibility,
199
+ targetSessionAuthorityEpoch: z.number().int().positive().safe(),
200
+ acceptedWork: ConnectionUseAuthoritySnapshot.shape.acceptedWork,
201
+ bindingId: z.string().uuid(),
202
+ bindingGeneration: z.number().int().positive().safe(),
203
+ definition: HostMcpBindingDefinition,
204
+ ownerSubjectId: HostMcpOwnerSubject,
205
+ ownerOrganizationMembershipId: z.string().uuid(),
206
+ ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),
207
+ delegationId: z.string().uuid(),
208
+ delegationGeneration: z.number().int().positive().safe(),
209
+ scheduledOrigin: z
210
+ .object({
211
+ taskId: z.string().uuid(),
212
+ taskAuthorityRevision: z.number().int().positive().safe(),
213
+ runId: z.string().uuid(),
214
+ })
215
+ .strict()
216
+ .optional(),
217
+ source: z.discriminatedUnion("kind", [
218
+ z.object({ kind: z.literal("direct") }).strict(),
219
+ z.object({ kind: z.literal("scheduled_task") }).strict(),
220
+ z
221
+ .object({
222
+ kind: z.literal("child_turn"),
223
+ sessionId: z.string().uuid(),
224
+ turnId: z.string().uuid(),
225
+ })
226
+ .strict(),
227
+ z
228
+ .object({
229
+ kind: z.literal("inherited_turn"),
230
+ sessionId: z.string().uuid(),
231
+ turnId: z.string().uuid(),
232
+ })
233
+ .strict(),
234
+ ]),
235
+ })
236
+ .strict()
237
+ .superRefine((value, context) => {
238
+ if (
239
+ (value.source.kind === "direct" && value.scheduledOrigin) ||
240
+ (value.source.kind === "scheduled_task" &&
241
+ (!value.scheduledOrigin ||
242
+ value.acceptedWork.kind !== "scheduled_task" ||
243
+ value.scheduledOrigin.taskId !== value.acceptedWork.taskId ||
244
+ value.scheduledOrigin.runId !== value.acceptedWork.runId ||
245
+ value.scheduledOrigin.taskAuthorityRevision !== value.acceptedWork.taskAuthorityRevision))
246
+ )
247
+ context.addIssue({
248
+ code: "custom",
249
+ message: "Scheduled host authority must retain its exact run origin",
250
+ });
251
+ if (
252
+ value.acceptedWork.kind === "turn" &&
253
+ value.source.kind === "inherited_turn" &&
254
+ value.acceptedWork.turnId === value.source.turnId
255
+ ) {
256
+ context.addIssue({
257
+ code: "custom",
258
+ path: ["source"],
259
+ message: "Accepted work cannot inherit from itself",
260
+ });
261
+ }
262
+ if (
263
+ value.acceptedWork.kind === "scheduled_task" &&
264
+ !Number.isSafeInteger(value.acceptedWork.taskAuthorityRevision)
265
+ ) {
266
+ context.addIssue({
267
+ code: "custom",
268
+ path: ["acceptedWork"],
269
+ message: "Task authority revision must be a safe integer",
270
+ });
271
+ }
272
+ if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 65_536) {
273
+ context.addIssue({ code: "custom", message: "Host accepted authority exceeds 64 KiB" });
274
+ }
275
+ });
276
+ export type HostMcpAcceptedAuthority = z.infer<typeof HostMcpAcceptedAuthority>;
277
+
278
+ /** Credential-free selection frozen on one immutable scheduled-task revision. */
279
+ export const HostMcpTaskAuthority = z
280
+ .object({
281
+ version: z.literal(1),
282
+ accountId: z.string().uuid(),
283
+ workspaceId: z.string().uuid(),
284
+ taskId: z.string().uuid(),
285
+ taskAuthorityRevision: z.number().int().positive().safe(),
286
+ taskExecutionDigest: z.string().regex(/^[0-9a-f]{64}$/),
287
+ ownerSubjectId: HostMcpOwnerSubject,
288
+ ownerOrganizationMembershipId: z.string().uuid(),
289
+ ownerMembershipAuthorizationRevision: z.number().int().positive().safe(),
290
+ bindingId: z.string().uuid(),
291
+ bindingGeneration: z.number().int().positive().safe(),
292
+ delegationId: z.string().uuid(),
293
+ delegationGeneration: z.number().int().positive().safe(),
294
+ definition: HostMcpBindingDefinition,
295
+ context: SessionTenancyVisibility,
296
+ })
297
+ .strict();
298
+ export type HostMcpTaskAuthority = z.infer<typeof HostMcpTaskAuthority>;
@@ -16,7 +16,10 @@ const WorkspaceImagePathSchema = z
16
16
  // without sending unsupported regex syntax to model providers.
17
17
  .refine((path) => path.split("/").every((segment) => segment !== "." && segment !== ".."), {
18
18
  message: "Sandbox image paths cannot contain dot segments",
19
- });
19
+ })
20
+ .describe(
21
+ "Absolute /workspace path to a PNG, JPEG, or WebP image. Convert SVG or other formats before using them as image-generation references.",
22
+ );
20
23
 
21
24
  /** One ordered, workspace-owned input used to guide or edit an image. */
22
25
  export const ImageGenerationReferenceSchema = z.discriminatedUnion("kind", [
@@ -49,7 +52,10 @@ export const GenerateImageToolInput = z
49
52
  .array(ImageGenerationReferenceSchema)
50
53
  .max(IMAGE_GENERATION_MAX_REFERENCES)
51
54
  .optional()
52
- .default([]),
55
+ .default([])
56
+ .describe(
57
+ "Ordered image references. Every sandbox path, File, or artifact must resolve to PNG, JPEG, or WebP bytes.",
58
+ ),
53
59
  })
54
60
  .strict();
55
61
  export type GenerateImageToolInput = z.infer<typeof GenerateImageToolInput>;