@opengeni/contracts 0.44.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/dist/agent-authored-durable-text.d.ts +70 -0
  2. package/dist/agent-config.d.ts +869 -0
  3. package/dist/agent-instruction-changes.d.ts +110 -0
  4. package/dist/agent-learning.d.ts +243 -0
  5. package/dist/agent-topology.d.ts +292 -0
  6. package/dist/allowance-refusal.d.ts +9 -0
  7. package/dist/allowance-refusal.js +50 -0
  8. package/dist/allowance-refusal.js.map +1 -0
  9. package/dist/analytics-consent-report.d.ts +19 -0
  10. package/dist/analytics-consent-report.js +10 -0
  11. package/dist/analytics-consent-report.js.map +1 -0
  12. package/dist/api-key-presets.d.ts +19 -0
  13. package/dist/artifact-catalog.d.ts +161 -0
  14. package/dist/artifacts.d.ts +135 -11
  15. package/dist/atlassian-native-retirement.d.ts +16 -0
  16. package/dist/atlassian-native-retirement.js +30 -0
  17. package/dist/atlassian-native-retirement.js.map +1 -0
  18. package/dist/atlassian.d.ts +2 -0
  19. package/dist/atlassian.js +27 -11
  20. package/dist/browser-storage.d.ts +5 -0
  21. package/dist/browser-storage.js +9 -0
  22. package/dist/browser-storage.js.map +1 -0
  23. package/dist/bundled-skills.d.ts +40 -0
  24. package/dist/canonical-human-identities.d.ts +157 -0
  25. package/dist/canonical-human-identities.js +23 -0
  26. package/dist/canonical-human-identities.js.map +1 -0
  27. package/dist/chunk-2ACYHZFB.js +292 -0
  28. package/dist/chunk-2ACYHZFB.js.map +1 -0
  29. package/dist/chunk-2VORLN2R.js +353 -0
  30. package/dist/chunk-2VORLN2R.js.map +1 -0
  31. package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
  32. package/dist/chunk-3SIZGL3O.js.map +1 -0
  33. package/dist/chunk-46KLD2UH.js +186 -0
  34. package/dist/chunk-46KLD2UH.js.map +1 -0
  35. package/dist/chunk-4JGHSSB7.js +11 -0
  36. package/dist/chunk-4JGHSSB7.js.map +1 -0
  37. package/dist/{chunk-52SGB2QO.js → chunk-5IXYF6XN.js} +50 -10
  38. package/dist/chunk-5IXYF6XN.js.map +1 -0
  39. package/dist/chunk-BCS7WHCK.js +139 -0
  40. package/dist/chunk-BCS7WHCK.js.map +1 -0
  41. package/dist/chunk-EK7NDGFR.js +128 -0
  42. package/dist/chunk-EK7NDGFR.js.map +1 -0
  43. package/dist/{chunk-5UDNP7AO.js → chunk-FZ6BXQHL.js} +78 -38
  44. package/dist/chunk-FZ6BXQHL.js.map +1 -0
  45. package/dist/chunk-GRG7PHWQ.js +25 -0
  46. package/dist/chunk-GRG7PHWQ.js.map +1 -0
  47. package/dist/chunk-JUFK3T4Q.js +80 -0
  48. package/dist/chunk-JUFK3T4Q.js.map +1 -0
  49. package/dist/chunk-KHHZTBP7.js +11 -0
  50. package/dist/chunk-KHHZTBP7.js.map +1 -0
  51. package/dist/chunk-KR2V42UZ.js +187 -0
  52. package/dist/chunk-KR2V42UZ.js.map +1 -0
  53. package/dist/chunk-MZLBPKFE.js +168 -0
  54. package/dist/chunk-MZLBPKFE.js.map +1 -0
  55. package/dist/{chunk-H5BVCZKF.js → chunk-NRMCVHAU.js} +6 -5
  56. package/dist/chunk-NRMCVHAU.js.map +1 -0
  57. package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
  58. package/dist/chunk-NVJMJWLL.js.map +1 -0
  59. package/dist/chunk-O77VSFYZ.js +70 -0
  60. package/dist/chunk-O77VSFYZ.js.map +1 -0
  61. package/dist/chunk-PX3VCKAU.js +29 -0
  62. package/dist/chunk-PX3VCKAU.js.map +1 -0
  63. package/dist/chunk-QR5D2IQC.js +61 -0
  64. package/dist/chunk-QR5D2IQC.js.map +1 -0
  65. package/dist/chunk-RJ76DRPO.js +117 -0
  66. package/dist/chunk-RJ76DRPO.js.map +1 -0
  67. package/dist/chunk-RKX3NQYS.js +28 -0
  68. package/dist/chunk-RKX3NQYS.js.map +1 -0
  69. package/dist/{chunk-FJBG5E4O.js → chunk-SIOU2K4U.js} +45 -22
  70. package/dist/chunk-SIOU2K4U.js.map +1 -0
  71. package/dist/chunk-TSCDAGET.js +75 -0
  72. package/dist/chunk-TSCDAGET.js.map +1 -0
  73. package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
  74. package/dist/chunk-TXTQIYCV.js.map +1 -0
  75. package/dist/chunk-X7ETVO4P.js +26544 -0
  76. package/dist/chunk-X7ETVO4P.js.map +1 -0
  77. package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
  78. package/dist/chunk-YBW5JSA3.js +251 -0
  79. package/dist/chunk-YBW5JSA3.js.map +1 -0
  80. package/dist/chunk-YRXAWWCU.js +45 -0
  81. package/dist/chunk-YRXAWWCU.js.map +1 -0
  82. package/dist/claude-provider-account-authority.d.ts +18 -0
  83. package/dist/claude-subscription-oauth.d.ts +42 -0
  84. package/dist/claude-subscription-usage.d.ts +159 -0
  85. package/dist/client-error-report.d.ts +109 -0
  86. package/dist/client-error-report.js +87 -0
  87. package/dist/client-error-report.js.map +1 -0
  88. package/dist/code-search.d.ts +52 -0
  89. package/dist/code-search.js +40 -0
  90. package/dist/code-search.js.map +1 -0
  91. package/dist/codex-provider-account-authority.d.ts +23 -0
  92. package/dist/codex-provider-account-authority.js +23 -0
  93. package/dist/codex-provider-account-authority.js.map +1 -0
  94. package/dist/company-brain-governed-writes.d.ts +475 -0
  95. package/dist/company-brain.d.ts +336 -0
  96. package/dist/company-profile.d.ts +566 -0
  97. package/dist/connect.d.ts +325 -0
  98. package/dist/connect.js +191 -0
  99. package/dist/connect.js.map +1 -0
  100. package/dist/connection-account-label.d.ts +2 -0
  101. package/dist/connection-account-label.js +35 -0
  102. package/dist/connection-account-label.js.map +1 -0
  103. package/dist/connection-authority.d.ts +193 -0
  104. package/dist/connection-authority.js +50 -0
  105. package/dist/connection-authority.js.map +1 -0
  106. package/dist/connector-attachments.d.ts +95 -0
  107. package/dist/connector-attachments.js +51 -0
  108. package/dist/connector-attachments.js.map +1 -0
  109. package/dist/connector-tool-permissions.d.ts +73 -0
  110. package/dist/direct-model-provider.d.ts +36 -0
  111. package/dist/editable-artifact-codec-registry.d.ts +16 -7
  112. package/dist/editable-artifact-codec-registry.js +19 -9
  113. package/dist/editable-artifact-committed-transaction.d.ts +2 -2
  114. package/dist/editable-artifact-committed-transaction.js +2 -2
  115. package/dist/editable-artifact-live.d.ts +11 -12
  116. package/dist/editable-artifact-live.js +110 -45
  117. package/dist/editable-artifact-live.js.map +1 -1
  118. package/dist/editable-artifact-serialized-commit.d.ts +2 -1
  119. package/dist/editable-artifact-serialized-commit.js +8 -7
  120. package/dist/editable-artifact-versions.d.ts +20 -5
  121. package/dist/editable-artifact-versions.js +23 -5
  122. package/dist/editable-artifacts.d.ts +2 -0
  123. package/dist/editable-artifacts.js +48 -36
  124. package/dist/external-identities.d.ts +784 -0
  125. package/dist/external-identities.js +44 -0
  126. package/dist/external-identities.js.map +1 -0
  127. package/dist/feedback.d.ts +51 -0
  128. package/dist/github-repository-contracts.d.ts +36 -0
  129. package/dist/github-repository-contracts.js +59 -0
  130. package/dist/github-repository-contracts.js.map +1 -0
  131. package/dist/github-repository.d.ts +14 -0
  132. package/dist/github-repository.js +36 -0
  133. package/dist/github-repository.js.map +1 -0
  134. package/dist/google-drive.d.ts +90 -1
  135. package/dist/google-drive.js +91 -15
  136. package/dist/google-drive.js.map +1 -1
  137. package/dist/governed-learning-activation.d.ts +154 -0
  138. package/dist/governed-learning-evaluator.d.ts +152 -0
  139. package/dist/host-mcp-bindings.d.ts +326 -0
  140. package/dist/host-mcp-bindings.js +252 -0
  141. package/dist/host-mcp-bindings.js.map +1 -0
  142. package/dist/image-generation.d.ts +1 -0
  143. package/dist/index.d.ts +27574 -5374
  144. package/dist/index.js +2531 -177
  145. package/dist/insights-usage.d.ts +877 -0
  146. package/dist/insights-usage.js +509 -0
  147. package/dist/insights-usage.js.map +1 -0
  148. package/dist/interaction.d.ts +1752 -13
  149. package/dist/knowledge-entries.d.ts +982 -0
  150. package/dist/knowledge-preparation.d.ts +237 -0
  151. package/dist/knowledge.d.ts +740 -0
  152. package/dist/managed-auth-session-sets.d.ts +241 -0
  153. package/dist/managed-auth-session-sets.js +191 -0
  154. package/dist/managed-auth-session-sets.js.map +1 -0
  155. package/dist/managed-sign-in-methods.d.ts +56 -0
  156. package/dist/managed-sign-in-methods.js +46 -0
  157. package/dist/managed-sign-in-methods.js.map +1 -0
  158. package/dist/mcp-catalog-limits.d.ts +2 -0
  159. package/dist/mcp-endpoint.d.ts +7 -0
  160. package/dist/mcp-endpoint.js +9 -0
  161. package/dist/mcp-endpoint.js.map +1 -0
  162. package/dist/mcp-oauth.d.ts +71 -0
  163. package/dist/modal-native-proof-v2.d.ts +587 -0
  164. package/dist/modal-native-proof-v2.js +37 -0
  165. package/dist/modal-native-proof-v2.js.map +1 -0
  166. package/dist/model-availability.d.ts +15 -0
  167. package/dist/model-connection-access.d.ts +24 -0
  168. package/dist/model-context-inspector.d.ts +329 -0
  169. package/dist/model-display.d.ts +38 -0
  170. package/dist/model-display.js +134 -0
  171. package/dist/model-display.js.map +1 -0
  172. package/dist/model-picker-order.d.ts +25 -0
  173. package/dist/model-picker-order.js +42 -0
  174. package/dist/model-picker-order.js.map +1 -0
  175. package/dist/organization-access.d.ts +231 -0
  176. package/dist/organization-access.js +34 -0
  177. package/dist/organization-access.js.map +1 -0
  178. package/dist/organization-integration-policy.d.ts +27 -0
  179. package/dist/organization-membership-lifecycle.d.ts +1022 -0
  180. package/dist/organization-model-usage.d.ts +146 -0
  181. package/dist/organization-model-usage.js +67 -0
  182. package/dist/organization-model-usage.js.map +1 -0
  183. package/dist/organization-recovery.d.ts +337 -0
  184. package/dist/organization-recovery.js +37 -0
  185. package/dist/organization-recovery.js.map +1 -0
  186. package/dist/organization-usage.d.ts +138 -0
  187. package/dist/permissions.d.ts +54 -0
  188. package/dist/personal-github.d.ts +320 -0
  189. package/dist/personal-github.js +222 -0
  190. package/dist/personal-github.js.map +1 -0
  191. package/dist/plugin-discovery.d.ts +35 -0
  192. package/dist/plugin-discovery.js +7 -0
  193. package/dist/plugin-discovery.js.map +1 -0
  194. package/dist/preference-registry.d.ts +44 -1
  195. package/dist/product-analytics.d.ts +113 -0
  196. package/dist/product-lifecycle-facts.d.ts +73 -0
  197. package/dist/remember.d.ts +350 -0
  198. package/dist/retained-output.d.ts +8 -0
  199. package/dist/sandbox-file-artifacts.d.ts +57 -0
  200. package/dist/sandbox-provider-command.d.ts +113 -0
  201. package/dist/sandbox-recovery.d.ts +146 -0
  202. package/dist/sandbox-snapshots.d.ts +39 -0
  203. package/dist/session-final-reply.d.ts +6 -0
  204. package/dist/session-final-reply.js +9 -0
  205. package/dist/session-final-reply.js.map +1 -0
  206. package/dist/session-goal-reports.d.ts +21 -0
  207. package/dist/session-history-import.d.ts +947 -0
  208. package/dist/session-list-entries.d.ts +4 -0
  209. package/dist/session-list-entries.js +51 -0
  210. package/dist/session-list-entries.js.map +1 -0
  211. package/dist/session-mcp-projections.d.ts +215 -0
  212. package/dist/session-message-search.d.ts +68 -0
  213. package/dist/session-titles.d.ts +68 -0
  214. package/dist/session-titles.js +25 -0
  215. package/dist/session-titles.js.map +1 -0
  216. package/dist/session-topology-primitives.d.ts +22 -0
  217. package/dist/signup-attribution.d.ts +39 -0
  218. package/dist/site-request-headers.test.d.ts +1 -0
  219. package/dist/site-session-http.d.ts +11 -0
  220. package/dist/site-session-http.js +11 -0
  221. package/dist/site-session-http.js.map +1 -0
  222. package/dist/skill-catalog-context.d.ts +7 -0
  223. package/dist/skill-files.d.ts +12 -0
  224. package/dist/skill-metadata.d.ts +9 -0
  225. package/dist/skill-use.d.ts +61 -0
  226. package/dist/skills.d.ts +185 -0
  227. package/dist/slack-bot-scopes.d.ts +46 -21
  228. package/dist/slack-bot-scopes.js +14 -3
  229. package/dist/slack-rest-mcp.d.ts +31 -0
  230. package/dist/slack-rest-mcp.js +19 -0
  231. package/dist/slack-rest-mcp.js.map +1 -0
  232. package/dist/slack-task-policy.d.ts +294 -0
  233. package/dist/spreadsheet-artifact-commands.d.ts +2 -3
  234. package/dist/spreadsheet-artifact-commands.js +4 -2
  235. package/dist/spreadsheet-artifact-query.js +3 -2
  236. package/dist/subscription-account-pools.d.ts +292 -0
  237. package/dist/task-notes.d.ts +169 -0
  238. package/dist/tool-catalog.d.ts +286 -0
  239. package/dist/tool-result-spill.d.ts +16 -0
  240. package/dist/usage-allowances.d.ts +285 -0
  241. package/dist/usage-allowances.js +49 -0
  242. package/dist/usage-allowances.js.map +1 -0
  243. package/dist/video-generation.d.ts +51 -0
  244. package/dist/video-generation.js +9 -1
  245. package/dist/work-claims.d.ts +411 -0
  246. package/dist/workspace-instruction-policies.d.ts +94 -0
  247. package/dist/workspace-integration-wire.d.ts +36 -0
  248. package/dist/workspace-integration-wire.js +23 -0
  249. package/dist/workspace-integration-wire.js.map +1 -0
  250. package/dist/workspace-integrations.d.ts +948 -0
  251. package/dist/workspace-learning-administration.d.ts +289 -0
  252. package/dist/workspace-learning-policy.d.ts +1 -1
  253. package/dist/workspace-state.d.ts +85 -416
  254. package/dist/xai-provider-account-authority.d.ts +26 -0
  255. package/dist/xai-provider-account-authority.js +9 -0
  256. package/dist/xai-provider-account-authority.js.map +1 -0
  257. package/package.json +146 -1
  258. package/src/agent-authored-durable-text.ts +116 -0
  259. package/src/agent-config.ts +1527 -0
  260. package/src/agent-instruction-changes.ts +98 -0
  261. package/src/agent-learning.ts +161 -0
  262. package/src/agent-topology.ts +69 -0
  263. package/src/allowance-refusal.ts +81 -0
  264. package/src/analytics-consent-report.ts +20 -0
  265. package/src/api-key-presets.ts +25 -0
  266. package/src/artifact-catalog.ts +60 -0
  267. package/src/artifacts.ts +146 -18
  268. package/src/atlassian-native-retirement.ts +33 -0
  269. package/src/browser-storage.ts +10 -0
  270. package/src/bundled-skills.ts +73 -0
  271. package/src/canonical-human-identities.ts +93 -0
  272. package/src/claude-provider-account-authority.ts +12 -0
  273. package/src/claude-subscription-oauth.ts +62 -0
  274. package/src/claude-subscription-usage.ts +59 -0
  275. package/src/client-error-report.ts +184 -0
  276. package/src/code-search.ts +105 -0
  277. package/src/codex-provider-account-authority.ts +37 -0
  278. package/src/company-brain-governed-writes.ts +356 -0
  279. package/src/company-brain.ts +201 -0
  280. package/src/company-profile.ts +167 -1
  281. package/src/connect.ts +202 -0
  282. package/src/connection-account-label.ts +46 -0
  283. package/src/connection-authority.ts +213 -0
  284. package/src/connector-attachments.ts +327 -0
  285. package/src/connector-tool-permissions.ts +60 -0
  286. package/src/direct-model-provider.ts +98 -0
  287. package/src/editable-artifact-codec-registry.ts +55 -17
  288. package/src/editable-artifact-committed-transaction.ts +44 -31
  289. package/src/editable-artifact-live.ts +123 -57
  290. package/src/editable-artifact-serialized-commit.ts +2 -1
  291. package/src/editable-artifact-versions.ts +26 -5
  292. package/src/editable-artifacts.ts +2 -0
  293. package/src/external-identities.ts +285 -0
  294. package/src/feedback.ts +39 -0
  295. package/src/github-repository-contracts.ts +85 -0
  296. package/src/github-repository.ts +59 -0
  297. package/src/google-drive.ts +76 -4
  298. package/src/governed-learning-activation.ts +191 -0
  299. package/src/governed-learning-evaluator.ts +176 -0
  300. package/src/host-mcp-bindings.ts +298 -0
  301. package/src/image-generation.ts +8 -2
  302. package/src/index.ts +8019 -1799
  303. package/src/insights-usage.ts +679 -0
  304. package/src/interaction.ts +1102 -6
  305. package/src/knowledge-entries.ts +375 -0
  306. package/src/knowledge-preparation.ts +50 -0
  307. package/src/knowledge.ts +335 -0
  308. package/src/managed-auth-session-sets.ts +253 -0
  309. package/src/managed-sign-in-methods.ts +37 -0
  310. package/src/mcp-catalog-limits.ts +2 -0
  311. package/src/mcp-endpoint.ts +30 -0
  312. package/src/mcp-oauth.ts +66 -0
  313. package/src/modal-native-proof-v2.ts +398 -0
  314. package/src/model-availability.ts +22 -0
  315. package/src/model-connection-access.ts +17 -0
  316. package/src/model-context-inspector.ts +139 -0
  317. package/src/model-display.ts +195 -0
  318. package/src/model-picker-order.ts +97 -0
  319. package/src/organization-access.ts +176 -0
  320. package/src/organization-integration-policy.ts +54 -0
  321. package/src/organization-membership-lifecycle.ts +559 -0
  322. package/src/organization-model-usage.ts +72 -0
  323. package/src/organization-recovery.ts +186 -0
  324. package/src/organization-usage.ts +79 -0
  325. package/src/permissions.ts +58 -0
  326. package/src/personal-github.ts +267 -0
  327. package/src/plugin-discovery.ts +33 -0
  328. package/src/preference-registry.ts +20 -1
  329. package/src/product-analytics.ts +253 -0
  330. package/src/product-lifecycle-facts.ts +121 -0
  331. package/src/remember.ts +243 -0
  332. package/src/retained-output.ts +20 -3
  333. package/src/sandbox-file-artifacts.ts +73 -0
  334. package/src/sandbox-provider-command.ts +82 -0
  335. package/src/sandbox-recovery.ts +116 -0
  336. package/src/sandbox-snapshots.ts +142 -0
  337. package/src/session-final-reply.ts +16 -0
  338. package/src/session-goal-reports.ts +55 -0
  339. package/src/session-history-import.ts +159 -0
  340. package/src/session-list-entries.ts +91 -0
  341. package/src/session-mcp-projections.ts +273 -0
  342. package/src/session-message-search.ts +54 -0
  343. package/src/session-titles.ts +467 -0
  344. package/src/session-topology-primitives.ts +21 -0
  345. package/src/signup-attribution.ts +81 -0
  346. package/src/site-request-headers.test.ts +28 -0
  347. package/src/site-session-http.ts +63 -0
  348. package/src/skill-catalog-context.ts +50 -0
  349. package/src/skill-files.ts +52 -0
  350. package/src/skill-metadata.ts +40 -0
  351. package/src/skill-use.ts +77 -0
  352. package/src/skills.ts +136 -0
  353. package/src/slack-bot-scopes.ts +106 -42
  354. package/src/slack-rest-mcp.ts +194 -0
  355. package/src/slack-task-policy.ts +215 -0
  356. package/src/spreadsheet-artifact-commands.ts +12 -13
  357. package/src/subscription-account-pools.ts +44 -0
  358. package/src/task-notes.ts +105 -0
  359. package/src/tool-catalog.ts +155 -0
  360. package/src/tool-result-spill.ts +35 -0
  361. package/src/usage-allowances.ts +187 -0
  362. package/src/video-generation.ts +43 -6
  363. package/src/work-claims.ts +266 -0
  364. package/src/workspace-instruction-policies.ts +31 -0
  365. package/src/workspace-integration-wire.ts +99 -0
  366. package/src/workspace-integrations.ts +640 -0
  367. package/src/workspace-learning-administration.ts +88 -0
  368. package/src/workspace-learning-policy.ts +4 -3
  369. package/src/workspace-state.ts +16 -126
  370. package/src/xai-provider-account-authority.ts +38 -0
  371. package/dist/chunk-52SGB2QO.js.map +0 -1
  372. package/dist/chunk-5UDNP7AO.js.map +0 -1
  373. package/dist/chunk-BVGIYW7D.js +0 -11
  374. package/dist/chunk-BVGIYW7D.js.map +0 -1
  375. package/dist/chunk-FJBG5E4O.js.map +0 -1
  376. package/dist/chunk-H5BVCZKF.js.map +0 -1
  377. package/dist/chunk-LSB7GRLG.js.map +0 -1
  378. package/dist/chunk-TZ6YEYN4.js.map +0 -1
  379. package/dist/chunk-VA22KRHS.js +0 -15177
  380. package/dist/chunk-VA22KRHS.js.map +0 -1
  381. package/dist/chunk-Y3MLSLB4.js.map +0 -1
  382. /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Wire grammar of the content-free web client error beacon
3
+ * (`POST /v1/client-errors`).
4
+ *
5
+ * A report is only a closed error kind, the matched route PATTERN (never a
6
+ * concrete URL), and the bundle revision. The web client that projects a
7
+ * report, the API route that admits it, and the public structured-log
8
+ * projection that prints it all validate against these exact values, so the
9
+ * browser can only send what the API accepts and logs.
10
+ *
11
+ * The same route also admits the closed operational signals below (requests
12
+ * that never reached the server, live-stream health, and web vitals). They
13
+ * follow the same rules: closed values only, a route pattern or page label,
14
+ * never a URL, message, identifier, or user content.
15
+ */
16
+ export declare const CLIENT_ERRORS_PATH = "/v1/client-errors";
17
+ export declare const CLIENT_ERROR_KINDS: readonly ["route_error", "unhandled_rejection", "window_error", "chunk_load"];
18
+ export type ClientErrorKind = (typeof CLIENT_ERROR_KINDS)[number];
19
+ /** Largest accepted report body. A valid report is well under 256 bytes. */
20
+ export declare const CLIENT_ERROR_REPORT_MAX_BYTES = 512;
21
+ /**
22
+ * A route pattern of at most 160 characters that is `/`, `unknown`, or up to
23
+ * twelve `/`-separated segments that are each either a lowercase literal
24
+ * (`variable-sets`) or a `$param` placeholder. The grammar excludes digits in
25
+ * literals, so a concrete id cannot pass as one.
26
+ */
27
+ export declare const CLIENT_ERROR_ROUTE_PATTERN: RegExp;
28
+ /** The bundle revision token (a commit SHA, `dev`, or `unknown`). */
29
+ export declare const CLIENT_ERROR_REVISION_PATTERN: RegExp;
30
+ export type ClientErrorReport = {
31
+ kind: ClientErrorKind;
32
+ route: string;
33
+ revision: string;
34
+ };
35
+ /**
36
+ * Content-free operational signals that share the error beacon route. A
37
+ * signal report carries a `signal` discriminator and only closed values; a
38
+ * report without `signal` is a {@link ClientErrorReport}. Older API servers
39
+ * reject signal reports as invalid, so the extension is backward compatible in
40
+ * both directions.
41
+ */
42
+ export declare const CLIENT_SIGNALS: readonly ["request_failure", "stream", "web_vital"];
43
+ export type ClientSignal = (typeof CLIENT_SIGNALS)[number];
44
+ /**
45
+ * Key product mutations whose failure before any HTTP response is counted.
46
+ * `send_message` includes sends the server queues behind an active turn.
47
+ */
48
+ export declare const CLIENT_REQUEST_ACTIONS: readonly ["create_session", "send_message", "steer_message", "composer_submit", "retry_turn", "connect_integration", "connect_model", "checkout_start"];
49
+ export type ClientRequestAction = (typeof CLIENT_REQUEST_ACTIONS)[number];
50
+ /**
51
+ * Why a request never produced an HTTP response: the browser reported no
52
+ * connectivity (`offline`), the client's own deadline expired (`timeout`), or
53
+ * the transport failed (`network`). Cancellations the user or the app
54
+ * initiated are never reported.
55
+ */
56
+ export declare const CLIENT_REQUEST_FAILURE_REASONS: readonly ["network", "timeout", "offline"];
57
+ export type ClientRequestFailureReason = (typeof CLIENT_REQUEST_FAILURE_REASONS)[number];
58
+ /** Browser live streams: one session's event stream, or the workspace live stream. */
59
+ export declare const CLIENT_STREAMS: readonly ["session", "workspace"];
60
+ export type ClientStream = (typeof CLIENT_STREAMS)[number];
61
+ /**
62
+ * Live stream health: a live stream dropped and started reconnecting
63
+ * (`reconnect`), stopped reconnecting (`reconnect_exhausted`), or stayed
64
+ * disconnected for longer than the long-disconnect threshold while the tab
65
+ * was visible (`long_disconnect`).
66
+ */
67
+ export declare const CLIENT_STREAM_EVENTS: readonly ["reconnect", "reconnect_exhausted", "long_disconnect"];
68
+ export type ClientStreamEvent = (typeof CLIENT_STREAM_EVENTS)[number];
69
+ /** Core Web Vitals plus time to first byte, measured once per document. */
70
+ export declare const CLIENT_WEB_VITAL_METRICS: readonly ["lcp", "inp", "cls", "ttfb"];
71
+ export type ClientWebVitalMetric = (typeof CLIENT_WEB_VITAL_METRICS)[number];
72
+ /**
73
+ * Largest accepted value: seconds for the timing metrics, the unitless layout
74
+ * shift score for `cls`.
75
+ */
76
+ export declare const CLIENT_WEB_VITAL_MAX_VALUE: Readonly<Record<ClientWebVitalMetric, number>>;
77
+ /**
78
+ * The closed page labels of the web console's product-journey projection
79
+ * (`journeyPage` in apps/web/src/lib/analytics-journey.ts; a drift test keeps
80
+ * the two identical). Workspace pages are the first path segment after
81
+ * `/workspaces/<id>/`; the rest are exact top-level routes.
82
+ */
83
+ export declare const CLIENT_PAGES: readonly ["sessions", "priority", "plugins", "capabilities", "documents", "state", "memory", "schedules", "artifacts", "settings", "organization", "insights", "machines", "files", "agents", "variable-sets", "environments", "rigs", "home", "session-link", "identity-link", "checkout-return", "integration-return", "device", "connect-agent", "reset-password", "setup-account", "account-auth", "personal-security", "other"];
84
+ export type ClientPage = (typeof CLIENT_PAGES)[number];
85
+ export type ClientRequestFailureReport = {
86
+ signal: "request_failure";
87
+ action: ClientRequestAction;
88
+ reason: ClientRequestFailureReason;
89
+ route: string;
90
+ revision: string;
91
+ };
92
+ export type ClientStreamReport = {
93
+ signal: "stream";
94
+ stream: ClientStream;
95
+ event: ClientStreamEvent;
96
+ route: string;
97
+ revision: string;
98
+ };
99
+ export type ClientWebVitalReport = {
100
+ signal: "web_vital";
101
+ metric: ClientWebVitalMetric;
102
+ page: ClientPage;
103
+ /** Seconds for timing metrics, the unitless score for `cls`. */
104
+ value: number;
105
+ revision: string;
106
+ };
107
+ export type ClientSignalReport = ClientRequestFailureReport | ClientStreamReport | ClientWebVitalReport;
108
+ /** Every body the beacon route accepts. */
109
+ export type ClientBeaconReport = ClientErrorReport | ClientSignalReport;
@@ -0,0 +1,87 @@
1
+ // src/client-error-report.ts
2
+ var CLIENT_ERRORS_PATH = "/v1/client-errors";
3
+ var CLIENT_ERROR_KINDS = [
4
+ "route_error",
5
+ "unhandled_rejection",
6
+ "window_error",
7
+ "chunk_load"
8
+ ];
9
+ var CLIENT_ERROR_REPORT_MAX_BYTES = 512;
10
+ var ROUTE_SEGMENT = String.raw`(?:[a-z]+(?:-[a-z]+)*|\$[A-Za-z][A-Za-z0-9]{0,31})`;
11
+ var CLIENT_ERROR_ROUTE_PATTERN = new RegExp(
12
+ String.raw`^(?=.{1,160}$)(?:unknown|/|(?:/${ROUTE_SEGMENT}){1,12})$`
13
+ );
14
+ var CLIENT_ERROR_REVISION_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
15
+ var CLIENT_SIGNALS = ["request_failure", "stream", "web_vital"];
16
+ var CLIENT_REQUEST_ACTIONS = [
17
+ "create_session",
18
+ "send_message",
19
+ "steer_message",
20
+ "composer_submit",
21
+ "retry_turn",
22
+ "connect_integration",
23
+ "connect_model",
24
+ "checkout_start"
25
+ ];
26
+ var CLIENT_REQUEST_FAILURE_REASONS = ["network", "timeout", "offline"];
27
+ var CLIENT_STREAMS = ["session", "workspace"];
28
+ var CLIENT_STREAM_EVENTS = [
29
+ "reconnect",
30
+ "reconnect_exhausted",
31
+ "long_disconnect"
32
+ ];
33
+ var CLIENT_WEB_VITAL_METRICS = ["lcp", "inp", "cls", "ttfb"];
34
+ var CLIENT_WEB_VITAL_MAX_VALUE = {
35
+ lcp: 600,
36
+ inp: 600,
37
+ cls: 100,
38
+ ttfb: 600
39
+ };
40
+ var CLIENT_PAGES = [
41
+ "sessions",
42
+ "priority",
43
+ "plugins",
44
+ "capabilities",
45
+ "documents",
46
+ "state",
47
+ "memory",
48
+ "schedules",
49
+ "artifacts",
50
+ "settings",
51
+ "organization",
52
+ "insights",
53
+ "machines",
54
+ "files",
55
+ "agents",
56
+ "variable-sets",
57
+ "environments",
58
+ "rigs",
59
+ "home",
60
+ "session-link",
61
+ "identity-link",
62
+ "checkout-return",
63
+ "integration-return",
64
+ "device",
65
+ "connect-agent",
66
+ "reset-password",
67
+ "setup-account",
68
+ "account-auth",
69
+ "personal-security",
70
+ "other"
71
+ ];
72
+ export {
73
+ CLIENT_ERRORS_PATH,
74
+ CLIENT_ERROR_KINDS,
75
+ CLIENT_ERROR_REPORT_MAX_BYTES,
76
+ CLIENT_ERROR_REVISION_PATTERN,
77
+ CLIENT_ERROR_ROUTE_PATTERN,
78
+ CLIENT_PAGES,
79
+ CLIENT_REQUEST_ACTIONS,
80
+ CLIENT_REQUEST_FAILURE_REASONS,
81
+ CLIENT_SIGNALS,
82
+ CLIENT_STREAMS,
83
+ CLIENT_STREAM_EVENTS,
84
+ CLIENT_WEB_VITAL_MAX_VALUE,
85
+ CLIENT_WEB_VITAL_METRICS
86
+ };
87
+ //# sourceMappingURL=client-error-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client-error-report.ts"],"sourcesContent":["/**\n * Wire grammar of the content-free web client error beacon\n * (`POST /v1/client-errors`).\n *\n * A report is only a closed error kind, the matched route PATTERN (never a\n * concrete URL), and the bundle revision. The web client that projects a\n * report, the API route that admits it, and the public structured-log\n * projection that prints it all validate against these exact values, so the\n * browser can only send what the API accepts and logs.\n *\n * The same route also admits the closed operational signals below (requests\n * that never reached the server, live-stream health, and web vitals). They\n * follow the same rules: closed values only, a route pattern or page label,\n * never a URL, message, identifier, or user content.\n */\nexport const CLIENT_ERRORS_PATH = \"/v1/client-errors\";\n\nexport const CLIENT_ERROR_KINDS = [\n \"route_error\",\n \"unhandled_rejection\",\n \"window_error\",\n \"chunk_load\",\n] as const;\nexport type ClientErrorKind = (typeof CLIENT_ERROR_KINDS)[number];\n\n/** Largest accepted report body. A valid report is well under 256 bytes. */\nexport const CLIENT_ERROR_REPORT_MAX_BYTES = 512;\n\nconst ROUTE_SEGMENT = String.raw`(?:[a-z]+(?:-[a-z]+)*|\\$[A-Za-z][A-Za-z0-9]{0,31})`;\n\n/**\n * A route pattern of at most 160 characters that is `/`, `unknown`, or up to\n * twelve `/`-separated segments that are each either a lowercase literal\n * (`variable-sets`) or a `$param` placeholder. The grammar excludes digits in\n * literals, so a concrete id cannot pass as one.\n */\nexport const CLIENT_ERROR_ROUTE_PATTERN = new RegExp(\n String.raw`^(?=.{1,160}$)(?:unknown|/|(?:/${ROUTE_SEGMENT}){1,12})$`,\n);\n\n/** The bundle revision token (a commit SHA, `dev`, or `unknown`). */\nexport const CLIENT_ERROR_REVISION_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;\n\nexport type ClientErrorReport = { kind: ClientErrorKind; route: string; revision: string };\n\n/**\n * Content-free operational signals that share the error beacon route. A\n * signal report carries a `signal` discriminator and only closed values; a\n * report without `signal` is a {@link ClientErrorReport}. Older API servers\n * reject signal reports as invalid, so the extension is backward compatible in\n * both directions.\n */\nexport const CLIENT_SIGNALS = [\"request_failure\", \"stream\", \"web_vital\"] as const;\nexport type ClientSignal = (typeof CLIENT_SIGNALS)[number];\n\n/**\n * Key product mutations whose failure before any HTTP response is counted.\n * `send_message` includes sends the server queues behind an active turn.\n */\nexport const CLIENT_REQUEST_ACTIONS = [\n \"create_session\",\n \"send_message\",\n \"steer_message\",\n \"composer_submit\",\n \"retry_turn\",\n \"connect_integration\",\n \"connect_model\",\n \"checkout_start\",\n] as const;\nexport type ClientRequestAction = (typeof CLIENT_REQUEST_ACTIONS)[number];\n\n/**\n * Why a request never produced an HTTP response: the browser reported no\n * connectivity (`offline`), the client's own deadline expired (`timeout`), or\n * the transport failed (`network`). Cancellations the user or the app\n * initiated are never reported.\n */\nexport const CLIENT_REQUEST_FAILURE_REASONS = [\"network\", \"timeout\", \"offline\"] as const;\nexport type ClientRequestFailureReason = (typeof CLIENT_REQUEST_FAILURE_REASONS)[number];\n\n/** Browser live streams: one session's event stream, or the workspace live stream. */\nexport const CLIENT_STREAMS = [\"session\", \"workspace\"] as const;\nexport type ClientStream = (typeof CLIENT_STREAMS)[number];\n\n/**\n * Live stream health: a live stream dropped and started reconnecting\n * (`reconnect`), stopped reconnecting (`reconnect_exhausted`), or stayed\n * disconnected for longer than the long-disconnect threshold while the tab\n * was visible (`long_disconnect`).\n */\nexport const CLIENT_STREAM_EVENTS = [\n \"reconnect\",\n \"reconnect_exhausted\",\n \"long_disconnect\",\n] as const;\nexport type ClientStreamEvent = (typeof CLIENT_STREAM_EVENTS)[number];\n\n/** Core Web Vitals plus time to first byte, measured once per document. */\nexport const CLIENT_WEB_VITAL_METRICS = [\"lcp\", \"inp\", \"cls\", \"ttfb\"] as const;\nexport type ClientWebVitalMetric = (typeof CLIENT_WEB_VITAL_METRICS)[number];\n\n/**\n * Largest accepted value: seconds for the timing metrics, the unitless layout\n * shift score for `cls`.\n */\nexport const CLIENT_WEB_VITAL_MAX_VALUE: Readonly<Record<ClientWebVitalMetric, number>> = {\n lcp: 600,\n inp: 600,\n cls: 100,\n ttfb: 600,\n};\n\n/**\n * The closed page labels of the web console's product-journey projection\n * (`journeyPage` in apps/web/src/lib/analytics-journey.ts; a drift test keeps\n * the two identical). Workspace pages are the first path segment after\n * `/workspaces/<id>/`; the rest are exact top-level routes.\n */\nexport const CLIENT_PAGES = [\n \"sessions\",\n \"priority\",\n \"plugins\",\n \"capabilities\",\n \"documents\",\n \"state\",\n \"memory\",\n \"schedules\",\n \"artifacts\",\n \"settings\",\n \"organization\",\n \"insights\",\n \"machines\",\n \"files\",\n \"agents\",\n \"variable-sets\",\n \"environments\",\n \"rigs\",\n \"home\",\n \"session-link\",\n \"identity-link\",\n \"checkout-return\",\n \"integration-return\",\n \"device\",\n \"connect-agent\",\n \"reset-password\",\n \"setup-account\",\n \"account-auth\",\n \"personal-security\",\n \"other\",\n] as const;\nexport type ClientPage = (typeof CLIENT_PAGES)[number];\n\nexport type ClientRequestFailureReport = {\n signal: \"request_failure\";\n action: ClientRequestAction;\n reason: ClientRequestFailureReason;\n route: string;\n revision: string;\n};\n\nexport type ClientStreamReport = {\n signal: \"stream\";\n stream: ClientStream;\n event: ClientStreamEvent;\n route: string;\n revision: string;\n};\n\nexport type ClientWebVitalReport = {\n signal: \"web_vital\";\n metric: ClientWebVitalMetric;\n page: ClientPage;\n /** Seconds for timing metrics, the unitless score for `cls`. */\n value: number;\n revision: string;\n};\n\nexport type ClientSignalReport =\n | ClientRequestFailureReport\n | ClientStreamReport\n | ClientWebVitalReport;\n\n/** Every body the beacon route accepts. */\nexport type ClientBeaconReport = ClientErrorReport | ClientSignalReport;\n"],"mappings":";AAeO,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,gCAAgC;AAE7C,IAAM,gBAAgB,OAAO;AAQtB,IAAM,6BAA6B,IAAI;AAAA,EAC5C,OAAO,qCAAqC,aAAa;AAC3D;AAGO,IAAM,gCAAgC;AAWtC,IAAM,iBAAiB,CAAC,mBAAmB,UAAU,WAAW;AAOhE,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASO,IAAM,iCAAiC,CAAC,WAAW,WAAW,SAAS;AAIvE,IAAM,iBAAiB,CAAC,WAAW,WAAW;AAS9C,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,2BAA2B,CAAC,OAAO,OAAO,OAAO,MAAM;AAO7D,IAAM,6BAA6E;AAAA,EACxF,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AACR;AAQO,IAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Directories holding platform credential material that `code_search` never
3
+ * searches or reads, as path segments matched at any depth: OpenGeni's
4
+ * sandbox state (`.opengeni/`: Codemode bearer tokens, Git credential files
5
+ * and bindings), the Azure CLI login cache (`.azure/`, from the sandbox's
6
+ * service-principal login with HOME=/workspace) and a Connected Machine
7
+ * agent's enrollment credentials (`.config/opengeni/`). The sandbox channel
8
+ * enforces this list; `@opengeni/jev` keeps the same list for its engine, and
9
+ * a worker test pins that the two agree.
10
+ */
11
+ export declare const CODE_SEARCH_CREDENTIAL_DIRS: readonly (readonly string[])[];
12
+ /**
13
+ * The deployment half of the `code_search` decision. `split` gives the tool to
14
+ * a fixed half of sessions (see `codeSearchSessionInExperiment`) so staging can
15
+ * compare sessions with and without it.
16
+ */
17
+ export type CodeSearchWorkspaceDefault = "off" | "on" | "split";
18
+ export type CodeSearchDeploymentPolicy = {
19
+ available: boolean;
20
+ workspaceDefault: CodeSearchWorkspaceDefault;
21
+ };
22
+ /**
23
+ * What a workspace gets: the deployment decides first, so nothing enables the
24
+ * tool where the deployment does not offer it. Otherwise an explicit workspace
25
+ * choice wins, and an absent, null or malformed setting follows the deployment
26
+ * default. Only this field is read, so an invalid sibling setting cannot turn
27
+ * an explicit Off back into the deployment default.
28
+ */
29
+ export declare function resolveWorkspaceCodeSearchMode(settings: unknown, deployment: CodeSearchDeploymentPolicy): CodeSearchWorkspaceDefault;
30
+ /**
31
+ * Fixed per-session half for the `split` experiment: 32-bit FNV-1a of the
32
+ * session id, low bit 0 gets the tool. Deterministic and dependency-free, so
33
+ * a root session's arm can be recomputed from its id. Child sessions inherit
34
+ * their parent's decision instead.
35
+ */
36
+ export declare function codeSearchSessionInExperiment(sessionId: string): boolean;
37
+ /**
38
+ * The decision frozen on a new root session when it is created. Later changes
39
+ * to the workspace setting or the deployment mode never turn the tool on for a
40
+ * session that was created without it.
41
+ */
42
+ export declare function resolveSessionCodeSearchEnabled(settings: unknown, deployment: CodeSearchDeploymentPolicy, sessionId: string): boolean;
43
+ /**
44
+ * Whether a turn of this session gets `code_search`. Only a session frozen on
45
+ * at creation can have it. The deployment (mode off or no usable key) and an
46
+ * explicit workspace Off still pause it in running sessions, because they stop
47
+ * repository content going to Jev; undoing that switch-off gives it back to
48
+ * sessions frozen on. Each such change costs every affected session one
49
+ * prompt-cache miss, which is accepted for a deliberate switch. Nothing else
50
+ * changes the tool list of a running session.
51
+ */
52
+ export declare function codeSearchEnabledForTurn(frozen: boolean | null | undefined, settings: unknown, deployment: CodeSearchDeploymentPolicy): boolean;
@@ -0,0 +1,40 @@
1
+ // src/code-search.ts
2
+ var CODE_SEARCH_CREDENTIAL_DIRS = [
3
+ [".opengeni"],
4
+ [".azure"],
5
+ [".config", "opengeni"]
6
+ ];
7
+ function resolveWorkspaceCodeSearchMode(settings, deployment) {
8
+ if (!deployment.available) return "off";
9
+ const explicit = explicitWorkspaceCodeSearchSetting(settings);
10
+ if (explicit === true) return "on";
11
+ if (explicit === false) return "off";
12
+ return deployment.workspaceDefault;
13
+ }
14
+ function explicitWorkspaceCodeSearchSetting(settings) {
15
+ const explicit = typeof settings === "object" && settings !== null ? settings.codeSearchEnabled : void 0;
16
+ return typeof explicit === "boolean" ? explicit : void 0;
17
+ }
18
+ function codeSearchSessionInExperiment(sessionId) {
19
+ let hash = 2166136261;
20
+ for (let index = 0; index < sessionId.length; index++) {
21
+ hash ^= sessionId.charCodeAt(index);
22
+ hash = Math.imul(hash, 16777619) >>> 0;
23
+ }
24
+ return (hash & 1) === 0;
25
+ }
26
+ function resolveSessionCodeSearchEnabled(settings, deployment, sessionId) {
27
+ const mode = resolveWorkspaceCodeSearchMode(settings, deployment);
28
+ return mode === "on" || mode === "split" && codeSearchSessionInExperiment(sessionId);
29
+ }
30
+ function codeSearchEnabledForTurn(frozen, settings, deployment) {
31
+ return frozen === true && deployment.available && explicitWorkspaceCodeSearchSetting(settings) !== false;
32
+ }
33
+ export {
34
+ CODE_SEARCH_CREDENTIAL_DIRS,
35
+ codeSearchEnabledForTurn,
36
+ codeSearchSessionInExperiment,
37
+ resolveSessionCodeSearchEnabled,
38
+ resolveWorkspaceCodeSearchMode
39
+ };
40
+ //# sourceMappingURL=code-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/code-search.ts"],"sourcesContent":["// Resolvers for the optional Jev-backed `code_search` agent tool. A separate\n// subpath keeps them out of browser bundles; only server code decides.\n\n/**\n * Directories holding platform credential material that `code_search` never\n * searches or reads, as path segments matched at any depth: OpenGeni's\n * sandbox state (`.opengeni/`: Codemode bearer tokens, Git credential files\n * and bindings), the Azure CLI login cache (`.azure/`, from the sandbox's\n * service-principal login with HOME=/workspace) and a Connected Machine\n * agent's enrollment credentials (`.config/opengeni/`). The sandbox channel\n * enforces this list; `@opengeni/jev` keeps the same list for its engine, and\n * a worker test pins that the two agree.\n */\nexport const CODE_SEARCH_CREDENTIAL_DIRS: readonly (readonly string[])[] = [\n [\".opengeni\"],\n [\".azure\"],\n [\".config\", \"opengeni\"],\n];\n\n/**\n * The deployment half of the `code_search` decision. `split` gives the tool to\n * a fixed half of sessions (see `codeSearchSessionInExperiment`) so staging can\n * compare sessions with and without it.\n */\nexport type CodeSearchWorkspaceDefault = \"off\" | \"on\" | \"split\";\nexport type CodeSearchDeploymentPolicy = {\n available: boolean;\n workspaceDefault: CodeSearchWorkspaceDefault;\n};\n\n/**\n * What a workspace gets: the deployment decides first, so nothing enables the\n * tool where the deployment does not offer it. Otherwise an explicit workspace\n * choice wins, and an absent, null or malformed setting follows the deployment\n * default. Only this field is read, so an invalid sibling setting cannot turn\n * an explicit Off back into the deployment default.\n */\nexport function resolveWorkspaceCodeSearchMode(\n settings: unknown,\n deployment: CodeSearchDeploymentPolicy,\n): CodeSearchWorkspaceDefault {\n if (!deployment.available) return \"off\";\n const explicit = explicitWorkspaceCodeSearchSetting(settings);\n if (explicit === true) return \"on\";\n if (explicit === false) return \"off\";\n return deployment.workspaceDefault;\n}\n\nfunction explicitWorkspaceCodeSearchSetting(settings: unknown): boolean | undefined {\n const explicit =\n typeof settings === \"object\" && settings !== null\n ? (settings as { codeSearchEnabled?: unknown }).codeSearchEnabled\n : undefined;\n return typeof explicit === \"boolean\" ? explicit : undefined;\n}\n\n/**\n * Fixed per-session half for the `split` experiment: 32-bit FNV-1a of the\n * session id, low bit 0 gets the tool. Deterministic and dependency-free, so\n * a root session's arm can be recomputed from its id. Child sessions inherit\n * their parent's decision instead.\n */\nexport function codeSearchSessionInExperiment(sessionId: string): boolean {\n let hash = 0x811c9dc5;\n for (let index = 0; index < sessionId.length; index++) {\n hash ^= sessionId.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193) >>> 0;\n }\n return (hash & 1) === 0;\n}\n\n/**\n * The decision frozen on a new root session when it is created. Later changes\n * to the workspace setting or the deployment mode never turn the tool on for a\n * session that was created without it.\n */\nexport function resolveSessionCodeSearchEnabled(\n settings: unknown,\n deployment: CodeSearchDeploymentPolicy,\n sessionId: string,\n): boolean {\n const mode = resolveWorkspaceCodeSearchMode(settings, deployment);\n return mode === \"on\" || (mode === \"split\" && codeSearchSessionInExperiment(sessionId));\n}\n\n/**\n * Whether a turn of this session gets `code_search`. Only a session frozen on\n * at creation can have it. The deployment (mode off or no usable key) and an\n * explicit workspace Off still pause it in running sessions, because they stop\n * repository content going to Jev; undoing that switch-off gives it back to\n * sessions frozen on. Each such change costs every affected session one\n * prompt-cache miss, which is accepted for a deliberate switch. Nothing else\n * changes the tool list of a running session.\n */\nexport function codeSearchEnabledForTurn(\n frozen: boolean | null | undefined,\n settings: unknown,\n deployment: CodeSearchDeploymentPolicy,\n): boolean {\n return (\n frozen === true &&\n deployment.available &&\n explicitWorkspaceCodeSearchSetting(settings) !== false\n );\n}\n"],"mappings":";AAaO,IAAM,8BAA8D;AAAA,EACzE,CAAC,WAAW;AAAA,EACZ,CAAC,QAAQ;AAAA,EACT,CAAC,WAAW,UAAU;AACxB;AAoBO,SAAS,+BACd,UACA,YAC4B;AAC5B,MAAI,CAAC,WAAW,UAAW,QAAO;AAClC,QAAM,WAAW,mCAAmC,QAAQ;AAC5D,MAAI,aAAa,KAAM,QAAO;AAC9B,MAAI,aAAa,MAAO,QAAO;AAC/B,SAAO,WAAW;AACpB;AAEA,SAAS,mCAAmC,UAAwC;AAClF,QAAM,WACJ,OAAO,aAAa,YAAY,aAAa,OACxC,SAA6C,oBAC9C;AACN,SAAO,OAAO,aAAa,YAAY,WAAW;AACpD;AAQO,SAAS,8BAA8B,WAA4B;AACxE,MAAI,OAAO;AACX,WAAS,QAAQ,GAAG,QAAQ,UAAU,QAAQ,SAAS;AACrD,YAAQ,UAAU,WAAW,KAAK;AAClC,WAAO,KAAK,KAAK,MAAM,QAAU,MAAM;AAAA,EACzC;AACA,UAAQ,OAAO,OAAO;AACxB;AAOO,SAAS,gCACd,UACA,YACA,WACS;AACT,QAAM,OAAO,+BAA+B,UAAU,UAAU;AAChE,SAAO,SAAS,QAAS,SAAS,WAAW,8BAA8B,SAAS;AACtF;AAWO,SAAS,yBACd,QACA,UACA,YACS;AACT,SACE,WAAW,QACX,WAAW,aACX,mCAAmC,QAAQ,MAAM;AAErD;","names":[]}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Opaque authority frozen at a Codex provider-account acceptance boundary.
4
+ *
5
+ * The snapshot deliberately carries no organization, membership, credential,
6
+ * provider-account, subject, label, quota, token, or plan identity. A later
7
+ * activation slice may use the user generation only together with separately
8
+ * authorized durable state; this value is never sufficient authority alone.
9
+ */
10
+ export declare const CodexProviderAccountAuthoritySnapshotV1: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ version: z.ZodLiteral<1>;
12
+ scope: z.ZodLiteral<"workspace">;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ version: z.ZodLiteral<1>;
15
+ scope: z.ZodLiteral<"user">;
16
+ authorityGeneration: z.ZodNumber;
17
+ }, z.core.$strict>], "scope">;
18
+ export type CodexProviderAccountAuthoritySnapshotV1 = z.infer<typeof CodexProviderAccountAuthoritySnapshotV1>;
19
+ /** Explicit compatibility value for all pre-foundation accepted work. */
20
+ export declare const LEGACY_WORKSPACE_CODEX_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1: {
21
+ readonly version: 1;
22
+ readonly scope: "workspace";
23
+ };
@@ -0,0 +1,23 @@
1
+ // src/codex-provider-account-authority.ts
2
+ import { z } from "zod";
3
+ var PositiveSafeInteger = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
4
+ var CodexProviderAccountAuthoritySnapshotV1 = z.discriminatedUnion("scope", [
5
+ z.object({
6
+ version: z.literal(1),
7
+ scope: z.literal("workspace")
8
+ }).strict(),
9
+ z.object({
10
+ version: z.literal(1),
11
+ scope: z.literal("user"),
12
+ authorityGeneration: PositiveSafeInteger
13
+ }).strict()
14
+ ]);
15
+ var LEGACY_WORKSPACE_CODEX_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1 = {
16
+ version: 1,
17
+ scope: "workspace"
18
+ };
19
+ export {
20
+ CodexProviderAccountAuthoritySnapshotV1,
21
+ LEGACY_WORKSPACE_CODEX_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1
22
+ };
23
+ //# sourceMappingURL=codex-provider-account-authority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/codex-provider-account-authority.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst PositiveSafeInteger = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);\n\n/**\n * Opaque authority frozen at a Codex provider-account acceptance boundary.\n *\n * The snapshot deliberately carries no organization, membership, credential,\n * provider-account, subject, label, quota, token, or plan identity. A later\n * activation slice may use the user generation only together with separately\n * authorized durable state; this value is never sufficient authority alone.\n */\nexport const CodexProviderAccountAuthoritySnapshotV1 = z.discriminatedUnion(\"scope\", [\n z\n .object({\n version: z.literal(1),\n scope: z.literal(\"workspace\"),\n })\n .strict(),\n z\n .object({\n version: z.literal(1),\n scope: z.literal(\"user\"),\n authorityGeneration: PositiveSafeInteger,\n })\n .strict(),\n]);\n\nexport type CodexProviderAccountAuthoritySnapshotV1 = z.infer<\n typeof CodexProviderAccountAuthoritySnapshotV1\n>;\n\n/** Explicit compatibility value for all pre-foundation accepted work. */\nexport const LEGACY_WORKSPACE_CODEX_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1 = {\n version: 1,\n scope: \"workspace\",\n} as const satisfies CodexProviderAccountAuthoritySnapshotV1;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,IAAM,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,OAAO,gBAAgB;AAU5E,IAAM,0CAA0C,EAAE,mBAAmB,SAAS;AAAA,EACnF,EACG,OAAO;AAAA,IACN,SAAS,EAAE,QAAQ,CAAC;AAAA,IACpB,OAAO,EAAE,QAAQ,WAAW;AAAA,EAC9B,CAAC,EACA,OAAO;AAAA,EACV,EACG,OAAO;AAAA,IACN,SAAS,EAAE,QAAQ,CAAC;AAAA,IACpB,OAAO,EAAE,QAAQ,MAAM;AAAA,IACvB,qBAAqB;AAAA,EACvB,CAAC,EACA,OAAO;AACZ,CAAC;AAOM,IAAM,gEAAgE;AAAA,EAC3E,SAAS;AAAA,EACT,OAAO;AACT;","names":[]}