@opengeni/contracts 5.5.0 → 5.5.2-canary.40656248492001

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 (543) hide show
  1. package/dist/agent-authored-durable-text.d.ts +9 -9
  2. package/dist/agent-config.d.ts +148 -37
  3. package/dist/api-key-presets.d.ts +19 -0
  4. package/dist/app-action-catalog-types.d.ts +32 -0
  5. package/dist/app-action-catalog.gen.d.ts +2 -0
  6. package/dist/app-actions.d.ts +91 -0
  7. package/dist/app-actions.js +10130 -0
  8. package/dist/app-actions.js.map +1 -0
  9. package/dist/app-shot.d.ts +55 -0
  10. package/dist/artifact-catalog.d.ts +33 -0
  11. package/dist/artifacts.d.ts +166 -0
  12. package/dist/atlassian-native-retirement.d.ts +16 -0
  13. package/dist/atlassian-native-retirement.js +30 -0
  14. package/dist/atlassian-native-retirement.js.map +1 -0
  15. package/dist/atlassian.js +48 -23
  16. package/dist/automation-templates.d.ts +434 -0
  17. package/dist/automation-templates.js +31 -0
  18. package/dist/automation-templates.js.map +1 -0
  19. package/dist/billing-subscriptions.d.ts +61 -0
  20. package/dist/bots.d.ts +583 -0
  21. package/dist/bundled-skills.d.ts +58 -2
  22. package/dist/canonical-human-identities.js +3 -1
  23. package/dist/child-lifecycle-notice-protocol.d.ts +45 -0
  24. package/dist/chunk-2QKIEAGY.js +396 -0
  25. package/dist/chunk-2QKIEAGY.js.map +1 -0
  26. package/dist/chunk-2WOWEWXV.js +426 -0
  27. package/dist/chunk-2WOWEWXV.js.map +1 -0
  28. package/dist/chunk-2ZIHHL72.js +153 -0
  29. package/dist/chunk-2ZIHHL72.js.map +1 -0
  30. package/dist/chunk-32U6NKQQ.js +389 -0
  31. package/dist/chunk-32U6NKQQ.js.map +1 -0
  32. package/dist/chunk-4YDDHSO2.js +799 -0
  33. package/dist/chunk-4YDDHSO2.js.map +1 -0
  34. package/dist/chunk-56SNIMDO.js +9 -0
  35. package/dist/chunk-56SNIMDO.js.map +1 -0
  36. package/dist/chunk-5RWB6QVL.js +101 -0
  37. package/dist/chunk-5RWB6QVL.js.map +1 -0
  38. package/dist/chunk-5UGUOT3L.js +243 -0
  39. package/dist/chunk-5UGUOT3L.js.map +1 -0
  40. package/dist/chunk-6LAT33BH.js +130 -0
  41. package/dist/chunk-6LAT33BH.js.map +1 -0
  42. package/dist/chunk-7272KVWZ.js +60 -0
  43. package/dist/chunk-7272KVWZ.js.map +1 -0
  44. package/dist/chunk-72QC2GTL.js +36 -0
  45. package/dist/chunk-72QC2GTL.js.map +1 -0
  46. package/dist/chunk-7EQGGZBY.js +105 -0
  47. package/dist/chunk-7EQGGZBY.js.map +1 -0
  48. package/dist/chunk-A3LXWVYU.js +382 -0
  49. package/dist/chunk-A3LXWVYU.js.map +1 -0
  50. package/dist/chunk-AQYDZUJV.js +34 -0
  51. package/dist/chunk-AQYDZUJV.js.map +1 -0
  52. package/dist/chunk-BHCEVVUP.js +93 -0
  53. package/dist/chunk-BHCEVVUP.js.map +1 -0
  54. package/dist/chunk-BMUTAZX5.js +486 -0
  55. package/dist/chunk-BMUTAZX5.js.map +1 -0
  56. package/dist/chunk-DGG6IBBK.js +150 -0
  57. package/dist/chunk-DGG6IBBK.js.map +1 -0
  58. package/dist/{chunk-YBW5JSA3.js → chunk-FBCTUMHI.js} +123 -102
  59. package/dist/chunk-FBCTUMHI.js.map +1 -0
  60. package/dist/chunk-G2KJTFIC.js +97 -0
  61. package/dist/chunk-G2KJTFIC.js.map +1 -0
  62. package/dist/chunk-G4RKARXZ.js +1167 -0
  63. package/dist/chunk-G4RKARXZ.js.map +1 -0
  64. package/dist/chunk-H6UJJIUM.js +350 -0
  65. package/dist/chunk-H6UJJIUM.js.map +1 -0
  66. package/dist/chunk-JOTHDW4H.js +18 -0
  67. package/dist/chunk-JOTHDW4H.js.map +1 -0
  68. package/dist/chunk-L4GUEP7K.js +56480 -0
  69. package/dist/chunk-L4GUEP7K.js.map +1 -0
  70. package/dist/{chunk-SIOU2K4U.js → chunk-LJH2EYGT.js} +23 -23
  71. package/dist/chunk-MTJKSIGA.js +161 -0
  72. package/dist/chunk-MTJKSIGA.js.map +1 -0
  73. package/dist/chunk-MYHMB6GZ.js +202 -0
  74. package/dist/chunk-MYHMB6GZ.js.map +1 -0
  75. package/dist/chunk-PI5VIKJY.js +660 -0
  76. package/dist/chunk-PI5VIKJY.js.map +1 -0
  77. package/dist/{chunk-RIY7GYQS.js → chunk-PTSROVDG.js} +2 -2
  78. package/dist/chunk-PUIUXIOL.js +189 -0
  79. package/dist/chunk-PUIUXIOL.js.map +1 -0
  80. package/dist/chunk-R6VXJIMB.js +19 -0
  81. package/dist/chunk-R6VXJIMB.js.map +1 -0
  82. package/dist/chunk-RLJUNVAM.js +15 -0
  83. package/dist/chunk-RLJUNVAM.js.map +1 -0
  84. package/dist/chunk-RR6APCBK.js +213 -0
  85. package/dist/chunk-RR6APCBK.js.map +1 -0
  86. package/dist/{chunk-TXTQIYCV.js → chunk-RUQ4I6DO.js} +59 -13
  87. package/dist/chunk-RUQ4I6DO.js.map +1 -0
  88. package/dist/{chunk-WYBDERIY.js → chunk-RWEEUDHD.js} +53 -42
  89. package/dist/chunk-RWEEUDHD.js.map +1 -0
  90. package/dist/chunk-S7MSQQL6.js +158 -0
  91. package/dist/chunk-S7MSQQL6.js.map +1 -0
  92. package/dist/{chunk-5Q54VCCH.js → chunk-SHO4YO4B.js} +20 -36
  93. package/dist/chunk-SHO4YO4B.js.map +1 -0
  94. package/dist/{chunk-HHZSZYYF.js → chunk-T3HSWMA5.js} +20 -4
  95. package/dist/chunk-T3HSWMA5.js.map +1 -0
  96. package/dist/{chunk-YRKRZ6OF.js → chunk-TOOJIBJC.js} +2 -2
  97. package/dist/chunk-UCUOTRS6.js +431 -0
  98. package/dist/chunk-UCUOTRS6.js.map +1 -0
  99. package/dist/chunk-UH4K7GP7.js +424 -0
  100. package/dist/chunk-UH4K7GP7.js.map +1 -0
  101. package/dist/chunk-UIZWGPHV.js +120 -0
  102. package/dist/chunk-UIZWGPHV.js.map +1 -0
  103. package/dist/chunk-VLUKBV6Y.js +1170 -0
  104. package/dist/chunk-VLUKBV6Y.js.map +1 -0
  105. package/dist/chunk-W2QQ5Y6K.js +55 -0
  106. package/dist/chunk-W2QQ5Y6K.js.map +1 -0
  107. package/dist/{chunk-Y3KNXVTD.js → chunk-W3NBPR4E.js} +131 -31
  108. package/dist/chunk-W3NBPR4E.js.map +1 -0
  109. package/dist/{chunk-NRMCVHAU.js → chunk-WMGO4HJU.js} +11 -9
  110. package/dist/chunk-WMGO4HJU.js.map +1 -0
  111. package/dist/{chunk-MYBZRDTY.js → chunk-WQI7VNN4.js} +19 -9
  112. package/dist/chunk-WQI7VNN4.js.map +1 -0
  113. package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
  114. package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
  115. package/dist/chunk-XB6GQLBH.js +76 -0
  116. package/dist/chunk-XB6GQLBH.js.map +1 -0
  117. package/dist/{chunk-D2HKF2EF.js → chunk-XP5M3IKT.js} +2 -2
  118. package/dist/{chunk-O77VSFYZ.js → chunk-ZMPU5BWE.js} +12 -2
  119. package/dist/chunk-ZMPU5BWE.js.map +1 -0
  120. package/dist/{chunk-3SIZGL3O.js → chunk-ZYVEJFNU.js} +22 -18
  121. package/dist/chunk-ZYVEJFNU.js.map +1 -0
  122. package/dist/claude-provider-account-authority.d.ts +18 -0
  123. package/dist/claude-subscription-oauth.d.ts +25 -0
  124. package/dist/claude-subscription-usage.d.ts +95 -1
  125. package/dist/client-error-report.d.ts +154 -8
  126. package/dist/client-error-report.js +157 -2
  127. package/dist/client-error-report.js.map +1 -1
  128. package/dist/code-search.d.ts +1 -1
  129. package/dist/code-search.js.map +1 -1
  130. package/dist/codex-provider-account-authority.js +23 -12
  131. package/dist/codex-provider-account-authority.js.map +1 -1
  132. package/dist/company-profile.d.ts +144 -0
  133. package/dist/connect.d.ts +38 -0
  134. package/dist/connect.js +244 -164
  135. package/dist/connect.js.map +1 -1
  136. package/dist/connection-account-label.d.ts +2 -0
  137. package/dist/connection-account-label.js +34 -0
  138. package/dist/connection-account-label.js.map +1 -0
  139. package/dist/connection-authority.js +49 -24
  140. package/dist/connector-attachments.js +3 -1
  141. package/dist/connector-destinations.js +3 -1
  142. package/dist/connector-tool-permissions.d.ts +68 -4
  143. package/dist/credential-profiles.d.ts +166 -0
  144. package/dist/cua-desktop-tools.d.ts +19 -0
  145. package/dist/define-schema.d.ts +8 -0
  146. package/dist/desktop-app.d.ts +28 -0
  147. package/dist/direct-model-provider.d.ts +38 -0
  148. package/dist/document-artifact-commands.js +2 -2
  149. package/dist/document-artifact-query.js +2 -2
  150. package/dist/editable-artifact-binary.d.ts +7 -0
  151. package/dist/editable-artifact-causal-frontier.js +2 -2
  152. package/dist/editable-artifact-codec-registry.js +7 -7
  153. package/dist/editable-artifact-committed-transaction.js +4 -2
  154. package/dist/editable-artifact-live.js +8 -8
  155. package/dist/editable-artifact-serialized-commit.js +9 -9
  156. package/dist/editable-artifact-versions.d.ts +7 -1
  157. package/dist/editable-artifact-versions.js +1 -1
  158. package/dist/editable-artifacts.js +49 -43
  159. package/dist/event-preview.d.ts +22 -0
  160. package/dist/event-triggers.d.ts +1253 -0
  161. package/dist/event-triggers.js +148 -0
  162. package/dist/event-triggers.js.map +1 -0
  163. package/dist/external-identities.d.ts +34 -0
  164. package/dist/external-identities.js +4 -2
  165. package/dist/feedback.d.ts +181 -0
  166. package/dist/file-access.d.ts +23 -0
  167. package/dist/first-party-tool-authorization.d.ts +852 -0
  168. package/dist/github-repository-contracts.js +64 -43
  169. package/dist/github-repository-contracts.js.map +1 -1
  170. package/dist/google-drive-native-retirement.d.ts +12 -0
  171. package/dist/google-drive-native-retirement.js +20 -0
  172. package/dist/google-drive-native-retirement.js.map +1 -0
  173. package/dist/google-drive.d.ts +1 -1
  174. package/dist/google-drive.js +323 -239
  175. package/dist/google-drive.js.map +1 -1
  176. package/dist/host-mcp-bindings.js +250 -198
  177. package/dist/host-mcp-bindings.js.map +1 -1
  178. package/dist/index.d.ts +29072 -20593
  179. package/dist/index.js +2432 -366
  180. package/dist/inference-residency.d.ts +22 -0
  181. package/dist/insights-usage.d.ts +948 -0
  182. package/dist/insights-usage.js +608 -0
  183. package/dist/insights-usage.js.map +1 -0
  184. package/dist/integration-capability-id.d.ts +8 -0
  185. package/dist/interaction-action-deadline.d.ts +48 -0
  186. package/dist/interaction-driver-diagnostic.d.ts +28 -0
  187. package/dist/interaction.d.ts +2126 -881
  188. package/dist/knowledge-entries.d.ts +38 -0
  189. package/dist/knowledge-preparation.d.ts +4 -0
  190. package/dist/learning-refusal.d.ts +43 -0
  191. package/dist/learning-refusal.js +49 -0
  192. package/dist/learning-refusal.js.map +1 -0
  193. package/dist/managed-auth-session-sets.d.ts +1 -0
  194. package/dist/managed-auth-session-sets.js +207 -146
  195. package/dist/managed-auth-session-sets.js.map +1 -1
  196. package/dist/managed-sign-in-methods.d.ts +96 -0
  197. package/dist/managed-sign-in-methods.js +157 -35
  198. package/dist/managed-sign-in-methods.js.map +1 -1
  199. package/dist/mcp-structured-content.d.ts +25 -0
  200. package/dist/message-time-zone.d.ts +38 -0
  201. package/dist/message-time-zone.js +19 -0
  202. package/dist/message-time-zone.js.map +1 -0
  203. package/dist/modal-native-proof-v2.d.ts +587 -0
  204. package/dist/modal-native-proof-v2.js +39 -0
  205. package/dist/modal-native-proof-v2.js.map +1 -0
  206. package/dist/model-account-choice.d.ts +237 -0
  207. package/dist/model-account-settings.d.ts +422 -0
  208. package/dist/model-availability.d.ts +15 -0
  209. package/dist/model-connection-access.d.ts +13 -0
  210. package/dist/model-context-inspector.d.ts +8 -0
  211. package/dist/model-display.d.ts +43 -0
  212. package/dist/model-display.js +17 -0
  213. package/dist/model-display.js.map +1 -0
  214. package/dist/model-picker-order.js.map +1 -1
  215. package/dist/model-residency.d.ts +304 -0
  216. package/dist/organization-access.d.ts +416 -0
  217. package/dist/organization-access.js +40 -0
  218. package/dist/organization-access.js.map +1 -0
  219. package/dist/organization-integration-policy.d.ts +18 -0
  220. package/dist/organization-membership-lifecycle.d.ts +66 -0
  221. package/dist/organization-model-usage.d.ts +146 -0
  222. package/dist/organization-model-usage.js +87 -0
  223. package/dist/organization-model-usage.js.map +1 -0
  224. package/dist/organization-recovery.js +3 -1
  225. package/dist/organization-usage.d.ts +12 -0
  226. package/dist/passkey-only-account.d.ts +14 -0
  227. package/dist/passkey-only-account.js +13 -0
  228. package/dist/passkey-only-account.js.map +1 -0
  229. package/dist/permissions.d.ts +19 -0
  230. package/dist/personal-github.js +220 -148
  231. package/dist/personal-github.js.map +1 -1
  232. package/dist/personal-integration-setup.d.ts +81 -0
  233. package/dist/personal-integration-setup.js +42 -0
  234. package/dist/personal-integration-setup.js.map +1 -0
  235. package/dist/prepared-mcp-setup.d.ts +54 -0
  236. package/dist/prepared-mcp-setup.js +13 -0
  237. package/dist/prepared-mcp-setup.js.map +1 -0
  238. package/dist/presentation-artifact-commands.js +2 -2
  239. package/dist/presentation-artifact-query.js +2 -2
  240. package/dist/primitives.d.ts +18 -0
  241. package/dist/product-analytics.d.ts +27 -10
  242. package/dist/product-lifecycle-facts.d.ts +26 -3
  243. package/dist/prompt-cache-diagnostics.d.ts +92 -0
  244. package/dist/recordings.d.ts +1371 -0
  245. package/dist/remember.d.ts +98 -2
  246. package/dist/retained-output.d.ts +4 -2
  247. package/dist/sandbox-file-artifacts.d.ts +19 -2
  248. package/dist/sandbox-provider-command.d.ts +5 -44
  249. package/dist/sandbox-recovery.d.ts +139 -8
  250. package/dist/secret-generator.d.ts +44 -0
  251. package/dist/secret-mask-strings.d.ts +32 -0
  252. package/dist/secret-references.d.ts +90 -0
  253. package/dist/secret-resolution.d.ts +143 -0
  254. package/dist/secret-shape-masking.d.ts +52 -0
  255. package/dist/secret-shape-masking.js +19 -0
  256. package/dist/secret-shape-masking.js.map +1 -0
  257. package/dist/secret-totp.d.ts +41 -0
  258. package/dist/secret-use-approval-question.d.ts +11 -0
  259. package/dist/secret-use-approval-question.js +11 -0
  260. package/dist/secret-use-approval-question.js.map +1 -0
  261. package/dist/secret-use-approvals.d.ts +106 -0
  262. package/dist/secret-value-masking.d.ts +299 -0
  263. package/dist/secret-value-masking.js +62 -0
  264. package/dist/secret-value-masking.js.map +1 -0
  265. package/dist/secret-value.d.ts +19 -0
  266. package/dist/session-history-import.d.ts +444 -8
  267. package/dist/session-history.d.ts +111 -0
  268. package/dist/session-history.js +35 -0
  269. package/dist/session-history.js.map +1 -0
  270. package/dist/session-list-entries.d.ts +8 -0
  271. package/dist/session-list-entries.js +61 -0
  272. package/dist/session-list-entries.js.map +1 -0
  273. package/dist/session-mcp-projections.d.ts +13 -1
  274. package/dist/session-mcp-tool-permissions.d.ts +62 -0
  275. package/dist/session-target.d.ts +18 -0
  276. package/dist/session-titles.d.ts +8 -0
  277. package/dist/session-titles.js +5 -1
  278. package/dist/session-usage-limit-refusal.d.ts +34 -0
  279. package/dist/session-usage-limit-refusal.js +15 -0
  280. package/dist/session-usage-limit-refusal.js.map +1 -0
  281. package/dist/session-usage-limits.d.ts +127 -0
  282. package/dist/session-usage-limits.js +43 -0
  283. package/dist/session-usage-limits.js.map +1 -0
  284. package/dist/site-data.d.ts +286 -0
  285. package/dist/site-operations.d.ts +39 -0
  286. package/dist/site-publishing.d.ts +813 -0
  287. package/dist/site-session-http.d.ts +103 -4
  288. package/dist/site-session-http.js +27 -1
  289. package/dist/site-sql.d.ts +425 -0
  290. package/dist/skills.d.ts +38 -0
  291. package/dist/slack-bot-scopes.d.ts +9 -7
  292. package/dist/slack-bot-scopes.js +6 -3
  293. package/dist/slack-rest-mcp.d.ts +36 -0
  294. package/dist/slack-rest-mcp.js +25 -0
  295. package/dist/slack-rest-mcp.js.map +1 -0
  296. package/dist/spreadsheet-artifact-commands.d.ts +14 -1
  297. package/dist/spreadsheet-artifact-commands.js +9 -2
  298. package/dist/spreadsheet-artifact-query.d.ts +13 -6
  299. package/dist/spreadsheet-artifact-query.js +4 -3
  300. package/dist/subscription-account-actions.d.ts +83 -0
  301. package/dist/subscription-account-pools.d.ts +326 -0
  302. package/dist/subscription-personal-authority-v2.d.ts +28 -0
  303. package/dist/subscription-personal-authority-v2.js +13 -0
  304. package/dist/subscription-personal-authority-v2.js.map +1 -0
  305. package/dist/subscription-plans.d.ts +38 -0
  306. package/dist/subscription-usage-pool.d.ts +89 -0
  307. package/dist/tool-action-review.d.ts +141 -0
  308. package/dist/tool-catalog.d.ts +479 -0
  309. package/dist/tool-policy.d.ts +5 -0
  310. package/dist/tool-review-presentation.d.ts +29 -0
  311. package/dist/tool-review-presentation.js +21 -0
  312. package/dist/tool-review-presentation.js.map +1 -0
  313. package/dist/turn-serving-policy.d.ts +223 -0
  314. package/dist/usage-allowances.d.ts +30 -0
  315. package/dist/usage-allowances.js +5 -1
  316. package/dist/values.d.ts +11 -0
  317. package/dist/values.js +19 -0
  318. package/dist/values.js.map +1 -0
  319. package/dist/vault-provider-wire.d.ts +907 -0
  320. package/dist/vault-provider-wire.js +74 -0
  321. package/dist/vault-provider-wire.js.map +1 -0
  322. package/dist/vaults.d.ts +2185 -0
  323. package/dist/video-generation.d.ts +75 -0
  324. package/dist/video-generation.js +8 -1
  325. package/dist/workspace-control-event.d.ts +18 -0
  326. package/dist/workspace-control-event.js +18 -0
  327. package/dist/workspace-control-event.js.map +1 -0
  328. package/dist/workspace-governance-context.d.ts +18 -0
  329. package/dist/workspace-integration-wire.d.ts +1 -1
  330. package/dist/workspace-integration-wire.js +1 -1
  331. package/dist/workspace-integrations.d.ts +212 -12
  332. package/dist/xai-provider-account-authority.js +3 -1
  333. package/package.json +121 -4
  334. package/src/agent-authored-durable-text.ts +14 -11
  335. package/src/agent-config.ts +382 -203
  336. package/src/agent-instruction-changes.ts +94 -74
  337. package/src/agent-learning.ts +94 -66
  338. package/src/agent-topology.ts +58 -52
  339. package/src/api-key-presets.ts +28 -0
  340. package/src/app-action-catalog-types.ts +32 -0
  341. package/src/app-action-catalog.gen.ts +9905 -0
  342. package/src/app-actions.ts +365 -0
  343. package/src/app-shot.ts +176 -0
  344. package/src/artifact-catalog.ts +81 -46
  345. package/src/artifacts.ts +360 -227
  346. package/src/atlassian-native-retirement.ts +33 -0
  347. package/src/atlassian.ts +136 -108
  348. package/src/automation-templates.ts +201 -0
  349. package/src/billing-subscriptions.ts +48 -0
  350. package/src/bots.ts +238 -0
  351. package/src/bundled-skills.ts +79 -22
  352. package/src/canonical-human-identities.ts +65 -62
  353. package/src/child-lifecycle-notice-protocol.gen.json +1310 -0
  354. package/src/child-lifecycle-notice-protocol.ts +224 -0
  355. package/src/claude-provider-account-authority.ts +12 -0
  356. package/src/claude-subscription-oauth.ts +61 -19
  357. package/src/claude-subscription-usage.ts +64 -35
  358. package/src/client-error-report.ts +344 -9
  359. package/src/code-search.ts +1 -1
  360. package/src/codex-provider-account-authority.ts +22 -16
  361. package/src/company-brain-governed-writes.ts +265 -244
  362. package/src/company-brain.ts +165 -154
  363. package/src/company-profile.ts +362 -297
  364. package/src/connect.ts +222 -173
  365. package/src/connection-account-label.ts +45 -0
  366. package/src/connection-authority.ts +172 -152
  367. package/src/connector-attachments.ts +139 -123
  368. package/src/connector-destinations.ts +48 -43
  369. package/src/connector-tool-permissions.ts +104 -46
  370. package/src/credential-profiles.ts +161 -0
  371. package/src/cua-desktop-tools.gen.json +6722 -0
  372. package/src/cua-desktop-tools.linux.gen.json +6798 -0
  373. package/src/cua-desktop-tools.ts +42 -0
  374. package/src/cua-desktop-tools.windows.gen.json +6739 -0
  375. package/src/define-schema.ts +10 -0
  376. package/src/desktop-app.ts +50 -0
  377. package/src/direct-model-provider.ts +112 -0
  378. package/src/editable-artifact-binary.ts +29 -8
  379. package/src/editable-artifact-committed-transaction.ts +19 -18
  380. package/src/editable-artifact-serialized-commit.ts +8 -2
  381. package/src/editable-artifact-versions.ts +7 -1
  382. package/src/event-preview.ts +53 -3
  383. package/src/event-triggers.ts +891 -0
  384. package/src/external-identities.ts +239 -195
  385. package/src/feedback.ts +125 -30
  386. package/src/file-access.ts +26 -0
  387. package/src/first-party-tool-authorization.ts +383 -0
  388. package/src/github-repository-contracts.ts +78 -64
  389. package/src/google-drive-native-retirement.ts +20 -0
  390. package/src/google-drive.ts +286 -234
  391. package/src/governed-learning-activation.ts +159 -137
  392. package/src/governed-learning-evaluator.ts +141 -133
  393. package/src/host-mcp-bindings.ts +244 -221
  394. package/src/image-generation.ts +105 -95
  395. package/src/index.ts +13928 -9899
  396. package/src/inference-residency.ts +36 -0
  397. package/src/insights-usage.ts +774 -0
  398. package/src/integration-capability-id.ts +16 -0
  399. package/src/interaction-action-deadline.ts +143 -0
  400. package/src/interaction-driver-diagnostic.ts +89 -0
  401. package/src/interaction.ts +3527 -2427
  402. package/src/knowledge-entries.ts +386 -299
  403. package/src/knowledge-preparation.ts +49 -41
  404. package/src/knowledge.ts +242 -213
  405. package/src/learning-refusal.ts +90 -0
  406. package/src/managed-auth-session-sets.ts +180 -133
  407. package/src/managed-sign-in-methods.ts +156 -34
  408. package/src/mcp-oauth.ts +58 -46
  409. package/src/mcp-receipts.ts +199 -194
  410. package/src/mcp-structured-content.ts +81 -0
  411. package/src/memory-slack-delivery.ts +172 -142
  412. package/src/message-time-zone.ts +109 -0
  413. package/src/modal-native-proof-v2.ts +430 -0
  414. package/src/model-account-choice.ts +178 -0
  415. package/src/model-account-settings.ts +210 -0
  416. package/src/model-availability.ts +22 -0
  417. package/src/model-connection-access.ts +62 -14
  418. package/src/model-context-inspector.ts +130 -109
  419. package/src/model-display.ts +221 -0
  420. package/src/model-picker-order.ts +1 -1
  421. package/src/model-residency.ts +535 -0
  422. package/src/organization-access.ts +216 -0
  423. package/src/organization-integration-policy.ts +47 -28
  424. package/src/organization-membership-lifecycle.ts +558 -384
  425. package/src/organization-model-usage.ts +82 -0
  426. package/src/organization-recovery.ts +148 -135
  427. package/src/organization-usage.ts +84 -52
  428. package/src/passkey-only-account.ts +29 -0
  429. package/src/permissions.ts +94 -52
  430. package/src/personal-github.ts +211 -171
  431. package/src/personal-integration-setup.ts +150 -0
  432. package/src/preference-registry.ts +319 -263
  433. package/src/prepared-mcp-setup.ts +190 -0
  434. package/src/primitives.ts +22 -0
  435. package/src/product-analytics.ts +40 -15
  436. package/src/product-lifecycle-facts.ts +50 -20
  437. package/src/prompt-cache-diagnostics.ts +212 -0
  438. package/src/recordings.ts +1153 -0
  439. package/src/remember.ts +184 -172
  440. package/src/retained-output.ts +181 -168
  441. package/src/sandbox-file-artifacts.ts +78 -57
  442. package/src/sandbox-provider-command.ts +55 -72
  443. package/src/sandbox-recovery.ts +163 -77
  444. package/src/scoped-knowledge.ts +62 -43
  445. package/src/secret-generator.ts +156 -0
  446. package/src/secret-mask-strings.ts +175 -0
  447. package/src/secret-references.ts +414 -0
  448. package/src/secret-resolution.ts +322 -0
  449. package/src/secret-shape-masking.ts +573 -0
  450. package/src/secret-totp.ts +188 -0
  451. package/src/secret-use-approval-question.ts +22 -0
  452. package/src/secret-use-approvals.ts +219 -0
  453. package/src/secret-value-masking.ts +1283 -0
  454. package/src/secret-value.ts +22 -0
  455. package/src/session-goal-reports.ts +55 -49
  456. package/src/session-history-import.ts +84 -68
  457. package/src/session-history.ts +197 -0
  458. package/src/session-list-entries.ts +106 -0
  459. package/src/session-mcp-projections.ts +21 -3
  460. package/src/session-mcp-tool-permissions.ts +109 -0
  461. package/src/session-message-search.ts +46 -38
  462. package/src/session-target.ts +58 -0
  463. package/src/session-titles.ts +40 -4
  464. package/src/session-topology-primitives.ts +20 -12
  465. package/src/session-usage-limit-refusal.ts +101 -0
  466. package/src/session-usage-limits.ts +169 -0
  467. package/src/signup-attribution.ts +20 -15
  468. package/src/site-data.ts +337 -0
  469. package/src/site-operations.ts +154 -0
  470. package/src/site-publishing.ts +903 -0
  471. package/src/site-session-http.ts +344 -16
  472. package/src/site-sql.ts +1120 -0
  473. package/src/skill-use.ts +18 -17
  474. package/src/skills.ts +105 -50
  475. package/src/slack-bot-scopes.ts +18 -35
  476. package/src/slack-rest-mcp.ts +222 -0
  477. package/src/slack-task-policy.ts +97 -73
  478. package/src/spreadsheet-artifact-commands.ts +74 -13
  479. package/src/spreadsheet-artifact-query.ts +188 -50
  480. package/src/subscription-account-actions.ts +103 -0
  481. package/src/subscription-account-pools.ts +74 -0
  482. package/src/subscription-personal-authority-v2.ts +69 -0
  483. package/src/subscription-plans.ts +51 -0
  484. package/src/subscription-usage-pool.ts +44 -0
  485. package/src/task-notes.ts +70 -68
  486. package/src/tool-action-review.ts +271 -0
  487. package/src/tool-catalog.ts +694 -379
  488. package/src/tool-policy.ts +82 -0
  489. package/src/tool-result-spill.ts +13 -9
  490. package/src/tool-review-presentation.ts +643 -0
  491. package/src/turn-serving-policy.ts +167 -0
  492. package/src/usage-allowances.ts +212 -136
  493. package/src/values.ts +25 -0
  494. package/src/vault-provider-wire.ts +580 -0
  495. package/src/vaults.ts +1296 -0
  496. package/src/video-generation.ts +430 -361
  497. package/src/work-claims.ts +183 -166
  498. package/src/workspace-control-event.ts +134 -0
  499. package/src/workspace-governance-context.ts +63 -0
  500. package/src/workspace-instruction-policies.ts +346 -279
  501. package/src/workspace-integration-wire.ts +10 -0
  502. package/src/workspace-integrations.ts +488 -398
  503. package/src/workspace-learning-administration.ts +58 -44
  504. package/src/workspace-learning-policy.ts +126 -99
  505. package/src/workspace-state.ts +239 -220
  506. package/src/xai-provider-account-authority.ts +23 -17
  507. package/dist/chunk-3SIZGL3O.js.map +0 -1
  508. package/dist/chunk-566IFOVP.js +0 -26133
  509. package/dist/chunk-566IFOVP.js.map +0 -1
  510. package/dist/chunk-5IXYF6XN.js +0 -728
  511. package/dist/chunk-5IXYF6XN.js.map +0 -1
  512. package/dist/chunk-5Q54VCCH.js.map +0 -1
  513. package/dist/chunk-BCS7WHCK.js +0 -139
  514. package/dist/chunk-BCS7WHCK.js.map +0 -1
  515. package/dist/chunk-EK7NDGFR.js +0 -128
  516. package/dist/chunk-EK7NDGFR.js.map +0 -1
  517. package/dist/chunk-GRG7PHWQ.js +0 -25
  518. package/dist/chunk-GRG7PHWQ.js.map +0 -1
  519. package/dist/chunk-HHZSZYYF.js.map +0 -1
  520. package/dist/chunk-ICDZGUX2.js +0 -186
  521. package/dist/chunk-ICDZGUX2.js.map +0 -1
  522. package/dist/chunk-JUFK3T4Q.js +0 -80
  523. package/dist/chunk-JUFK3T4Q.js.map +0 -1
  524. package/dist/chunk-MYBZRDTY.js.map +0 -1
  525. package/dist/chunk-NRMCVHAU.js.map +0 -1
  526. package/dist/chunk-O77VSFYZ.js.map +0 -1
  527. package/dist/chunk-P3HLDT77.js +0 -59
  528. package/dist/chunk-P3HLDT77.js.map +0 -1
  529. package/dist/chunk-TXTQIYCV.js.map +0 -1
  530. package/dist/chunk-WYBDERIY.js.map +0 -1
  531. package/dist/chunk-Y3KNXVTD.js.map +0 -1
  532. package/dist/chunk-YBW5JSA3.js.map +0 -1
  533. package/dist/chunk-YRXAWWCU.js +0 -45
  534. package/dist/chunk-YRXAWWCU.js.map +0 -1
  535. package/dist/chunk-YWMOIZ6A.js +0 -185
  536. package/dist/chunk-YWMOIZ6A.js.map +0 -1
  537. package/dist/site-request-headers.test.d.ts +0 -1
  538. package/dist/transcription-recordings.d.ts +0 -300
  539. package/src/transcription-recordings.ts +0 -169
  540. /package/dist/{chunk-SIOU2K4U.js.map → chunk-LJH2EYGT.js.map} +0 -0
  541. /package/dist/{chunk-RIY7GYQS.js.map → chunk-PTSROVDG.js.map} +0 -0
  542. /package/dist/{chunk-YRKRZ6OF.js.map → chunk-TOOJIBJC.js.map} +0 -0
  543. /package/dist/{chunk-D2HKF2EF.js.map → chunk-XP5M3IKT.js.map} +0 -0
@@ -0,0 +1,643 @@
1
+ import type {
2
+ ToolActionReview,
3
+ ToolReviewContext,
4
+ ToolReviewDetailsPage,
5
+ } from "./tool-action-review";
6
+
7
+ const protectedName =
8
+ /password|passwd|passphrase|secret|credential|authorization|cookie|(^|[_-])token($|[_-])|api[_-]?key|accessToken|refreshToken|privateKey/i;
9
+ const protectedReviewField = (key: string, fields: readonly string[] = []) =>
10
+ protectedName.test(key) || fields.includes(key) || fields.includes("*");
11
+
12
+ const SECRET_LAST_WORDS = new Set([
13
+ "password",
14
+ "passwd",
15
+ "passphrase",
16
+ "secret",
17
+ "secrets",
18
+ "credential",
19
+ "credentials",
20
+ "cookie",
21
+ "cookies",
22
+ "token",
23
+ "otp",
24
+ "totp",
25
+ "dsn",
26
+ "authorization",
27
+ ]);
28
+ // "code" alone is a sign-in code; "errorCode" or "countryCode" are not.
29
+ const SECRET_CODE_KINDS = new Set([
30
+ "user",
31
+ "auth",
32
+ "authorization",
33
+ "oauth",
34
+ "verification",
35
+ "setup",
36
+ "recovery",
37
+ "device",
38
+ "otp",
39
+ ]);
40
+ const SECRET_KEY_KINDS = new Set([
41
+ "api",
42
+ "private",
43
+ "access",
44
+ "secret",
45
+ "signing",
46
+ "encryption",
47
+ "master",
48
+ "license",
49
+ ]);
50
+ // Flags and checks about a secret ("hasWebhookSecret", "expectedCredential…")
51
+ // say whether one exists, never what it is.
52
+ const SECRET_FLAG_FIRST_WORDS = new Set(["has", "is", "awaiting", "can", "needs", "expected"]);
53
+ // Facts about a secret ("credentialVersion", "secretName", "apiKeyPrefix")
54
+ // describe it without being it.
55
+ const SECRET_METADATA_LAST_WORDS = new Set([
56
+ "version",
57
+ "versions",
58
+ "id",
59
+ "ids",
60
+ "count",
61
+ "at",
62
+ "name",
63
+ "names",
64
+ "label",
65
+ "kind",
66
+ "type",
67
+ "status",
68
+ "mode",
69
+ "source",
70
+ "ref",
71
+ "refs",
72
+ "reference",
73
+ "references",
74
+ "configured",
75
+ "present",
76
+ "set",
77
+ "enabled",
78
+ "required",
79
+ "length",
80
+ "prefix",
81
+ "hint",
82
+ "fingerprint",
83
+ "scope",
84
+ "scopes",
85
+ "provider",
86
+ "expiry",
87
+ "expires",
88
+ "suffix",
89
+ "url",
90
+ "uri",
91
+ "epoch",
92
+ ]);
93
+
94
+ function nameWords(name: string): string[] {
95
+ return name
96
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
97
+ .replace(/[_\s-]+/g, " ")
98
+ .toLowerCase()
99
+ .split(" ")
100
+ .filter(Boolean);
101
+ }
102
+
103
+ /**
104
+ * Whether a field with this name carries a key, password, token, code or
105
+ * other secret, judged by its last word: "apiKey", "clientSecret", "code",
106
+ * "userCode" and "masterPassword" do; "credentialVersion", "credentialId",
107
+ * "errorCode", "hasWebhookSecret" and "nextPageToken" don't. The app-action catalog
108
+ * generator marks actions by it and an app action's card hides by it.
109
+ */
110
+ export function secretFieldName(name: string): boolean {
111
+ const words = nameWords(name);
112
+ const last = words.at(-1);
113
+ const before = words.at(-2);
114
+ if (!last || SECRET_FLAG_FIRST_WORDS.has(words[0]!)) return false;
115
+ if (last === "token" && before === "page") return false;
116
+ if (SECRET_LAST_WORDS.has(last)) return true;
117
+ if (last === "code") return before === undefined || SECRET_CODE_KINDS.has(before);
118
+ if (last === "key" && before !== undefined && SECRET_KEY_KINDS.has(before)) return true;
119
+ // A secret word earlier in the name ("secretValue", "privateKeyPem",
120
+ // "passwordHash"), unless the name only describes the secret.
121
+ return protectedName.test(name) && !SECRET_METADATA_LAST_WORDS.has(last);
122
+ }
123
+
124
+ // Hosts whose webhook URLs carry their secret in the path
125
+ // ("https://hooks.slack.com/services/T…/B…/<secret>"), including ones whose
126
+ // secret is too short to look random.
127
+ const SECRET_PATH_HOSTS =
128
+ /^(hooks\.slack\.com|(\w+\.)?discord(app)?\.com|[\w-]+\.webhook\.office\.com|outlook\.office\.com|chat\.googleapis\.com|hooks\.zapier\.com)$/i;
129
+ const URL_IN_TEXT = /[a-z][a-z0-9+.-]*:\/\/[^\s"'<>]+/gi;
130
+ // "Server=db;User Id=app;Password=…" and similar key=value connection strings.
131
+ const CONNECTION_STRING_SECRET =
132
+ /((?:^|;)\s*(?:password|pwd|user ?password|account ?key|shared ?access ?key|shared ?access ?signature|access ?key|secret|token|sig)\s*=)[^;]*/gi;
133
+ const AUTHORIZATION_VALUE = /\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/g;
134
+ // Bare tokens with a well-known shape: OpenAI/Anthropic and Stripe keys,
135
+ // GitHub tokens, Slack tokens, AWS access key IDs and JWTs.
136
+ const TOKEN_SHAPES =
137
+ /\b(?:sk-[A-Za-z0-9_-]{16,}|sk_(?:live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|xox[abprs]-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,})/g;
138
+
139
+ /**
140
+ * Whether one URL path segment looks like a random secret rather than a
141
+ * readable name: a long run of letters and digits mixed, or a long opaque
142
+ * token. Slugs ("getting-started") and dates stay readable.
143
+ */
144
+ function secretLookingPathSegment(segment: string): boolean {
145
+ if (/^[A-Za-z0-9_-]{32,}$/.test(segment)) return true;
146
+ return segment
147
+ .split(/[-_.~]/)
148
+ .some((chunk) => chunk.length >= 12 && /\d/.test(chunk) && /[A-Za-z]/.test(chunk));
149
+ }
150
+
151
+ /**
152
+ * One URL with its sign-in parts and query removed, and its path too for
153
+ * webhook hosts that keep the secret there:
154
+ * "postgres://app:pw@db:5432/x" → "postgres://db:5432/x",
155
+ * "https://hooks.example.com/in?token=…" → "https://hooks.example.com/in",
156
+ * "https://hooks.slack.com/services/…" → "https://hooks.slack.com/…",
157
+ * and any random-looking path segment hidden:
158
+ * "https://example.com/hooks/a1b2c3d4e5f6g7h8" → "https://example.com/hooks/…".
159
+ */
160
+ function withoutUrlSecret(url: string): string {
161
+ const scheme = url.slice(0, url.indexOf("://") + 3);
162
+ const rest = url.slice(scheme.length).split(/[?#]/, 1)[0]!;
163
+ // The last "@" ends the sign-in part even when an unencoded password holds
164
+ // a "/"; a path with an "@" in it only loses its start.
165
+ const address = rest.slice(rest.lastIndexOf("@") + 1);
166
+ const host = address.split("/", 1)[0]!;
167
+ const hostname = host.replace(/:\d+$/, "");
168
+ if (SECRET_PATH_HOSTS.test(hostname) && address.length > host.length + 1) {
169
+ return `${scheme}${host}/…`;
170
+ }
171
+ const path = address
172
+ .slice(host.length)
173
+ .split("/")
174
+ .map((segment) => (secretLookingPathSegment(segment) ? "…" : segment))
175
+ .join("/");
176
+ return `${scheme}${host}${path}`;
177
+ }
178
+
179
+ /**
180
+ * Text with the secrets it may carry removed: the sign-in parts, query and
181
+ * webhook paths of every URL in it, password-like parts of a connection
182
+ * string, bearer or basic credentials, and bare tokens of a well-known shape.
183
+ */
184
+ function withoutTextSecrets(text: string): string {
185
+ return text
186
+ .replace(URL_IN_TEXT, withoutUrlSecret)
187
+ .replace(CONNECTION_STRING_SECRET, "$1[Protected value]")
188
+ .replace(AUTHORIZATION_VALUE, "$1 [Protected value]")
189
+ .replace(TOKEN_SHAPES, "[Protected value]");
190
+ }
191
+ const bound = (value: string, limit: number) =>
192
+ value.length > limit ? `${value.slice(0, limit)}…` : value;
193
+ export function toolReviewFieldLabel(key: string): string {
194
+ const label = key
195
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
196
+ .replace(/[_-]+/g, " ")
197
+ .replace(/\bids?\b/gi, (word) => (word.length === 3 ? "IDs" : "ID"))
198
+ .replace(
199
+ /\b(api|url|uri|http|https|ip|sql|json|html)(s?)\b/gi,
200
+ (_word, name: string, plural: string) => `${name.toUpperCase()}${plural}`,
201
+ )
202
+ // Sentence case, keeping acronyms: "Working Directory" → "Working directory".
203
+ .replace(
204
+ /(?<=\S\s+)([A-Z])([a-z]+)\b/g,
205
+ (_word, first: string, rest: string) => `${first.toLowerCase()}${rest}`,
206
+ )
207
+ .trim();
208
+ return label.charAt(0).toUpperCase() + label.slice(1);
209
+ }
210
+ export function decodeReviewArguments(value: unknown): Record<string, unknown> | null {
211
+ // Historical SDK entries sometimes wrapped arguments in JSON. Decode only once.
212
+ let decoded = value;
213
+ if (typeof decoded === "string") {
214
+ try {
215
+ decoded = JSON.parse(decoded);
216
+ } catch {
217
+ return null;
218
+ }
219
+ }
220
+ return decoded && typeof decoded === "object" && !Array.isArray(decoded)
221
+ ? (decoded as Record<string, unknown>)
222
+ : null;
223
+ }
224
+ export function safeReviewValue(
225
+ value: unknown,
226
+ key = "",
227
+ protectedFields: readonly string[] = [],
228
+ depth = 0,
229
+ ): unknown {
230
+ if (protectedReviewField(key, protectedFields)) return "[Protected value]";
231
+ if (depth > 20) return "[Nested value; open this field for details]";
232
+ if (Array.isArray(value))
233
+ return value.map((entry) => safeReviewValue(entry, "", protectedFields, depth + 1));
234
+ if (value && typeof value === "object")
235
+ return Object.fromEntries(
236
+ Object.entries(value).map(([name, entry]) => [
237
+ name,
238
+ safeReviewValue(entry, name, protectedFields, depth + 1),
239
+ ]),
240
+ );
241
+ return value;
242
+ }
243
+ function valueText(value: unknown): string {
244
+ return typeof value === "string"
245
+ ? value
246
+ : value === null
247
+ ? "None"
248
+ : typeof value === "boolean"
249
+ ? value
250
+ ? "Yes"
251
+ : "No"
252
+ : (JSON.stringify(value) ?? "Unavailable");
253
+ }
254
+ const pointer = (name: string) => `/${name.replaceAll("~", "~0").replaceAll("/", "~1")}`;
255
+ // Long arbitrary property names remain readable without placing them in every
256
+ // preview or URL. An indexed segment opens their saved name and value together.
257
+ const fieldPointer = (key: string, index: number, parent = "") =>
258
+ pointer(key).length > 256 || parent.length + pointer(key).length > 1024
259
+ ? `/~2${index}`
260
+ : pointer(key);
261
+
262
+ export function toolReviewFields(
263
+ argumentsValue: unknown,
264
+ context?: ToolReviewContext,
265
+ toolName?: string,
266
+ ): { fields: ToolActionReview["fields"]; moreFields: number } {
267
+ // An app action's card says what it does in one plain line (its
268
+ // consequence); its raw arguments (action id, path, body) stay in Details.
269
+ if (toolName === APP_ACTION_REVIEW_TOOL) return { fields: [], moreFields: 0 };
270
+ const args = decodeReviewArguments(argumentsValue);
271
+ if (!args) return { fields: [], moreFields: 0 };
272
+ const entries = Object.entries(args);
273
+ if (context?.email) {
274
+ const email = toolReviewFields(context.email);
275
+ const original = toolReviewFields(args, { ...context, email: undefined });
276
+ const fields = [
277
+ ...email.fields
278
+ .filter(
279
+ (field) =>
280
+ field.path !== "/contentSha256" && field.path !== "/htmlBody" && field.preview !== "",
281
+ )
282
+ .map((field) => ({
283
+ ...field,
284
+ label: field.path === "/textBody" ? "Message" : field.label,
285
+ path: `/$email${field.path}`,
286
+ ...(field.path === "/attachments"
287
+ ? {
288
+ preview: context
289
+ .email!.attachments.map((attachment) => attachment.name)
290
+ .join(", ")
291
+ .slice(0, 240),
292
+ }
293
+ : {}),
294
+ })),
295
+ ...original.fields.filter(
296
+ (field) =>
297
+ ![
298
+ "/raw",
299
+ "/expectedContentSha256",
300
+ "/from",
301
+ "/to",
302
+ "/cc",
303
+ "/bcc",
304
+ "/subject",
305
+ "/body",
306
+ "/textBody",
307
+ "/htmlBody",
308
+ "/attachments",
309
+ ].includes(field.path),
310
+ ),
311
+ ];
312
+ return {
313
+ fields: fields.slice(0, 16),
314
+ moreFields: original.moreFields + Math.max(0, fields.length - 16),
315
+ };
316
+ }
317
+ return {
318
+ moreFields: Math.max(0, entries.length - 16),
319
+ fields: entries.slice(0, 16).map(([key, value], index) => {
320
+ const hidden = protectedReviewField(key, context?.protectedFields);
321
+ const safe = hidden ? "[Protected value]" : value;
322
+ const count = !hidden && Array.isArray(value) ? value.length : undefined;
323
+ const compactList =
324
+ !hidden &&
325
+ Array.isArray(value) &&
326
+ value.length > 0 &&
327
+ value.length <= 4 &&
328
+ value.every(
329
+ (entry) =>
330
+ typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean",
331
+ )
332
+ ? value.map(valueText).join(", ")
333
+ : undefined;
334
+ const text =
335
+ compactList !== undefined
336
+ ? compactList
337
+ : count !== undefined
338
+ ? `${count.toLocaleString("en-US")} item${count === 1 ? "" : "s"}`
339
+ : safe && typeof safe === "object"
340
+ ? `${Object.keys(safe).length} field${Object.keys(safe).length === 1 ? "" : "s"}`
341
+ : valueText(safe);
342
+ return {
343
+ path: fieldPointer(key, index),
344
+ label: bound(
345
+ (context?.fieldLabels && Object.hasOwn(context.fieldLabels, key)
346
+ ? context.fieldLabels[key]
347
+ : undefined) ?? toolReviewFieldLabel(key),
348
+ 256,
349
+ ),
350
+ preview: bound(text, 240),
351
+ ...(count !== undefined ? { count } : {}),
352
+ truncated:
353
+ !hidden &&
354
+ (text.length > 240 ||
355
+ (compactList === undefined && typeof value === "object" && value !== null)),
356
+ ...(hidden ? { protected: true } : {}),
357
+ };
358
+ }),
359
+ };
360
+ }
361
+
362
+ /** The tool that runs an app action as the person (see @opengeni/contracts/app-actions). */
363
+ const APP_ACTION_REVIEW_TOOL = "admin_action_call";
364
+ // Bookkeeping and opaque identifiers say nothing a person can check.
365
+ const APP_ACTION_UNREADABLE_KEY =
366
+ /^(id|operationId|idempotencyKey|expiresAt|expectedVersion|expectedRevision|expectedEtag)$|Ids?$/;
367
+
368
+ /**
369
+ * One short readable line of an app action's key values, for example
370
+ * "Email: anna@example.com · Role: admin", taken from its body and query.
371
+ * Values are shown as labelled data, never as the question itself. Secrets
372
+ * (by field name), and the secrets text can carry (URL sign-in parts, queries
373
+ * and webhook paths, connection string passwords, bearer credentials), are
374
+ * never shown.
375
+ */
376
+ export function appActionReviewSummary(argumentsValue: unknown): string | undefined {
377
+ const args = decodeReviewArguments(argumentsValue);
378
+ if (!args) return undefined;
379
+ const parts: string[] = [];
380
+ const visit = (key: string, value: unknown, depth: number) => {
381
+ if (parts.length >= 4 || APP_ACTION_UNREADABLE_KEY.test(key)) return;
382
+ if (secretFieldName(key)) {
383
+ parts.push(`${toolReviewFieldLabel(key)}: [Protected value]`);
384
+ return;
385
+ }
386
+ if (value && typeof value === "object" && !Array.isArray(value)) {
387
+ if (depth < 2)
388
+ for (const [name, entry] of Object.entries(value)) visit(name, entry, depth + 1);
389
+ return;
390
+ }
391
+ const scalar = (entry: unknown) =>
392
+ entry === null || ["string", "number", "boolean"].includes(typeof entry);
393
+ const shown = (entry: unknown) =>
394
+ valueText(typeof entry === "string" ? withoutTextSecrets(entry.trim()) : entry);
395
+ const text = Array.isArray(value)
396
+ ? value.length > 0 && value.length <= 4 && value.every(scalar)
397
+ ? value.map(shown).join(", ")
398
+ : ""
399
+ : scalar(value)
400
+ ? shown(value)
401
+ : "";
402
+ const line = text.replace(/\s+/g, " ").trim();
403
+ if (line) parts.push(`${toolReviewFieldLabel(key)}: ${bound(line, 80)}`);
404
+ };
405
+ for (const source of [args.body, args.query]) {
406
+ if (source && typeof source === "object" && !Array.isArray(source))
407
+ for (const [name, entry] of Object.entries(source)) visit(name, entry, 0);
408
+ }
409
+ return parts.length > 0 ? bound(parts.join(" · "), 240) : undefined;
410
+ }
411
+
412
+ /** Deterministic consequences from the reviewed bytes. Unknown fields remain visible. */
413
+ export function toolReviewAction(
414
+ toolName: string,
415
+ argumentsValue: unknown,
416
+ context?: ToolReviewContext,
417
+ ): Pick<
418
+ ToolActionReview,
419
+ "title" | "approveLabel" | "effects" | "consequence" | "selectionCount" | "selectionKind"
420
+ > {
421
+ const fallback = {
422
+ title:
423
+ context?.title ??
424
+ bound(
425
+ toolReviewFieldLabel(
426
+ toolName.replace(/^mcp_[^_]+__/, "").replace(/^batch[_-](?=[a-z])/i, ""),
427
+ ),
428
+ 256,
429
+ ),
430
+ // An app action's card asks the person a plain question ("Invite … to
431
+ // your organization?"), so its button answers it.
432
+ approveLabel: toolName === APP_ACTION_REVIEW_TOOL ? "Allow" : "Approve action",
433
+ effects: [] as string[],
434
+ };
435
+ if (toolName === APP_ACTION_REVIEW_TOOL) {
436
+ const consequence = appActionReviewSummary(argumentsValue);
437
+ return consequence ? { ...fallback, consequence } : fallback;
438
+ }
439
+ if (context?.kind !== "gmail") return fallback;
440
+ const args = decodeReviewArguments(argumentsValue);
441
+ if (!args) return fallback;
442
+ const thread = toolName.endsWith("_thread");
443
+ const selectionKind = thread ? ("threads" as const) : ("messages" as const);
444
+ const ids =
445
+ thread && typeof args.threadId === "string"
446
+ ? [args.threadId]
447
+ : Array.isArray(args.messageIds)
448
+ ? args.messageIds
449
+ : typeof args.messageId === "string"
450
+ ? [args.messageId]
451
+ : null;
452
+ const selectionCount = ids?.every((id) => typeof id === "string") ? new Set(ids).size : undefined;
453
+ const noun =
454
+ selectionCount === undefined
455
+ ? thread
456
+ ? "conversations"
457
+ : "messages"
458
+ : `${selectionCount.toLocaleString("en-US")} ${thread ? "conversation" : "message"}${selectionCount === 1 ? "" : "s"}`;
459
+ const addValues = toolName.startsWith("label_") ? args.labelIds : args.addLabelIds;
460
+ const adds = Array.isArray(addValues)
461
+ ? addValues.filter((v): v is string => typeof v === "string")
462
+ : [];
463
+ const removeValues = toolName.startsWith("unlabel_") ? args.labelIds : args.removeLabelIds;
464
+ const removes = Array.isArray(removeValues)
465
+ ? removeValues.filter((v): v is string => typeof v === "string")
466
+ : [];
467
+ const labelEffect = (label: string, adding: boolean): string => {
468
+ const known: Record<string, [string, string]> = {
469
+ TRASH: ["Move to Trash", "Remove from Trash"],
470
+ INBOX: ["Move to Inbox", "Remove from Inbox"],
471
+ UNREAD: ["Mark as unread", "Mark as read"],
472
+ STARRED: ["Add star", "Remove star"],
473
+ SPAM: ["Mark as spam", "Remove from Spam"],
474
+ IMPORTANT: ["Mark as important", "Remove importance"],
475
+ };
476
+ return (
477
+ (Object.hasOwn(known, label) ? known[label]?.[adding ? 0 : 1] : undefined) ??
478
+ `${adding ? "Add" : "Remove"} label ${bound(label, 120)}`
479
+ );
480
+ };
481
+ const effects = [
482
+ ...adds.map((id) => labelEffect(id, true)),
483
+ ...removes.map((id) => labelEffect(id, false)),
484
+ ];
485
+ if (
486
+ [
487
+ "batch_modify_messages",
488
+ "modify_message",
489
+ "modify_thread",
490
+ "label_message",
491
+ "label_thread",
492
+ "unlabel_message",
493
+ "unlabel_thread",
494
+ ].includes(toolName)
495
+ ) {
496
+ const trash = adds.includes("TRASH");
497
+ return {
498
+ title: trash ? `Move ${noun} to Trash` : `Update ${noun}`,
499
+ approveLabel: trash ? "Move to Trash" : "Apply changes",
500
+ effects,
501
+ ...(selectionCount === undefined ? {} : { selectionCount, selectionKind }),
502
+ ...(trash
503
+ ? { consequence: "Messages stay recoverable in Trash until Gmail deletes them." }
504
+ : thread
505
+ ? { consequence: "Applies to every message in the conversation." }
506
+ : {}),
507
+ };
508
+ }
509
+ if (["trash_message", "restore_message", "trash_thread", "restore_thread"].includes(toolName))
510
+ return {
511
+ title: toolName.startsWith("trash_") ? `Move ${noun} to Trash` : `Remove ${noun} from Trash`,
512
+ approveLabel: toolName.startsWith("trash_") ? "Move to Trash" : "Remove from Trash",
513
+ effects,
514
+ ...(selectionCount === undefined ? {} : { selectionCount, selectionKind }),
515
+ };
516
+ const named: Record<string, [string, string]> = {
517
+ send_message: ["Send email", "Send email"],
518
+ send_draft: ["Send draft", "Send draft"],
519
+ create_draft: ["Create email draft", "Create draft"],
520
+ update_draft: ["Update email draft", "Update draft"],
521
+ delete_draft: ["Delete email draft", "Delete draft"],
522
+ create_label: ["Create label", "Create label"],
523
+ update_label: ["Update label", "Update label"],
524
+ delete_label: ["Delete label", "Delete label"],
525
+ };
526
+ const action = Object.hasOwn(named, toolName) ? named[toolName] : undefined;
527
+ return action ? { title: action[0], approveLabel: action[1], effects } : fallback;
528
+ }
529
+
530
+ /** A bounded slice of the immutable saved arguments; never evaluates a fresh provider query. */
531
+ export function toolReviewDetails(
532
+ argumentsValue: unknown,
533
+ context: ToolReviewContext | undefined,
534
+ path: string,
535
+ offset: number,
536
+ limit = 25,
537
+ ): Omit<ToolReviewDetailsPage, "id" | "actionDigest" | "version"> {
538
+ if (
539
+ !Number.isSafeInteger(offset) ||
540
+ offset < 0 ||
541
+ !Number.isSafeInteger(limit) ||
542
+ limit < 1 ||
543
+ limit > 50
544
+ )
545
+ throw new Error("Invalid review page");
546
+ const args = decodeReviewArguments(argumentsValue);
547
+ let value: unknown = context?.email ? { ...args, $email: context.email } : args;
548
+ if (path !== "") {
549
+ if (!path.startsWith("/")) throw new Error("Invalid review field");
550
+ for (const escaped of path.slice(1).split("/")) {
551
+ if (/^~2\d+$/.test(escaped)) {
552
+ if (!value || typeof value !== "object" || Array.isArray(value))
553
+ throw new Error("Review field not found");
554
+ const selected = Object.entries(value)[Number(escaped.slice(2))];
555
+ if (!selected) throw new Error("Review field not found");
556
+ value = {
557
+ fieldName: selected[0],
558
+ value: protectedReviewField(selected[0], context?.protectedFields)
559
+ ? "[Protected value]"
560
+ : selected[1],
561
+ };
562
+ continue;
563
+ }
564
+ const key = escaped.replaceAll("~1", "/").replaceAll("~0", "~");
565
+ if (protectedReviewField(key, context?.protectedFields)) {
566
+ value = "[Protected value]";
567
+ break;
568
+ }
569
+ if (!value || typeof value !== "object" || !Object.hasOwn(value, key))
570
+ throw new Error("Review field not found");
571
+ value = (value as Record<string, unknown>)[key];
572
+ }
573
+ }
574
+ type DetailItem = ToolReviewDetailsPage["items"][number];
575
+ const preview = (
576
+ entry: unknown,
577
+ key: string,
578
+ childPath: string,
579
+ ): Pick<DetailItem, "value" | "truncated" | "path"> => {
580
+ const hidden = protectedReviewField(key, context?.protectedFields);
581
+ if (!hidden && entry !== null && typeof entry === "object") {
582
+ const count = Array.isArray(entry) ? entry.length : Object.keys(entry).length;
583
+ return {
584
+ value: `${count.toLocaleString("en-US")} ${Array.isArray(entry) ? (count === 1 ? "item" : "items") : count === 1 ? "field" : "fields"}`,
585
+ path: childPath,
586
+ truncated: true,
587
+ };
588
+ }
589
+ const text = valueText(safeReviewValue(entry, key, context?.protectedFields));
590
+ return {
591
+ value: bound(text, 4000),
592
+ ...(hidden ? {} : { path: childPath }),
593
+ truncated: !hidden && text.length > 4000,
594
+ };
595
+ };
596
+ // Selected messages read as subject and sender rather than bare provider ids.
597
+ const labels =
598
+ (path === "/messageIds" || path === "/messageId") && context?.selectionLabels?.length
599
+ ? new Map(context.selectionLabels.map((label) => [label.id, label]))
600
+ : undefined;
601
+ const labelled = (entry: unknown): Pick<DetailItem, "value" | "detail"> | undefined => {
602
+ const label = typeof entry === "string" ? labels?.get(entry) : undefined;
603
+ return label && typeof entry === "string"
604
+ ? {
605
+ value: label.title,
606
+ detail: label.subtitle ? `${label.subtitle} · ${entry}` : entry,
607
+ }
608
+ : undefined;
609
+ };
610
+ let total: number;
611
+ let items: DetailItem[];
612
+ if (Array.isArray(value)) {
613
+ total = value.length;
614
+ items = value.slice(offset, offset + limit).map((entry, index) => ({
615
+ label: `${offset + index + 1}`,
616
+ ...preview(entry, "", `${path}/${offset + index}`),
617
+ ...labelled(entry),
618
+ }));
619
+ } else if (offset === 0 && labelled(value)) {
620
+ total = 1;
621
+ items = [{ label: "Message", ...labelled(value)! }];
622
+ } else if (value && typeof value === "object") {
623
+ const entries = Object.entries(value);
624
+ total = entries.length;
625
+ items = entries.slice(offset, offset + limit).map(([key, entry], index) => ({
626
+ label: bound(
627
+ (context?.fieldLabels && Object.hasOwn(context.fieldLabels, key)
628
+ ? context.fieldLabels[key]
629
+ : undefined) ?? toolReviewFieldLabel(key),
630
+ 256,
631
+ ),
632
+ ...preview(entry, key, `${path}${fieldPointer(key, offset + index, path)}`),
633
+ }));
634
+ } else {
635
+ const text = valueText(value);
636
+ total = Math.max(1, Math.ceil(text.length / 4000));
637
+ items = Array.from({ length: Math.max(0, Math.min(limit, total - offset)) }, (_, index) => ({
638
+ label: `Part ${offset + index + 1}`,
639
+ value: text.slice((offset + index) * 4000, (offset + index + 1) * 4000),
640
+ }));
641
+ }
642
+ return { path, items, total, nextOffset: offset + limit < total ? offset + limit : null };
643
+ }