@beeuni/sdk 0.1.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 (938) hide show
  1. package/README.md +1234 -0
  2. package/dist/beeuni.esm.min.js +96 -0
  3. package/dist/beeuni.global.js +96 -0
  4. package/dist/browser/cache/idb-sync-cache.d.ts +12 -0
  5. package/dist/browser/cache/idb-sync-cache.js +88 -0
  6. package/dist/browser/session-sync/mirror-paging.d.ts +7 -0
  7. package/dist/browser/session-sync/mirror-paging.js +10 -0
  8. package/dist/browser/session-sync/server-transcript-mirror.d.ts +33 -0
  9. package/dist/browser/session-sync/server-transcript-mirror.js +112 -0
  10. package/dist/browser/session-sync/session-cache-ownership.d.ts +8 -0
  11. package/dist/browser/session-sync/session-cache-ownership.js +36 -0
  12. package/dist/browser/session-sync/session-sync-registry.d.ts +44 -0
  13. package/dist/browser/session-sync/session-sync-registry.js +253 -0
  14. package/dist/browser/session-sync/visibility.d.ts +6 -0
  15. package/dist/browser/session-sync/visibility.js +21 -0
  16. package/dist/browser/stores/diagnostics-store.d.ts +61 -0
  17. package/dist/browser/stores/diagnostics-store.js +216 -0
  18. package/dist/browser/stores/opencode-compaction-store.d.ts +7 -0
  19. package/dist/browser/stores/opencode-compaction-store.js +21 -0
  20. package/dist/browser/stores/opencode-pending-store.d.ts +19 -0
  21. package/dist/browser/stores/opencode-pending-store.js +65 -0
  22. package/dist/browser/stores/sandbox-connection-store.d.ts +35 -0
  23. package/dist/browser/stores/sandbox-connection-store.js +230 -0
  24. package/dist/browser/stores/server-store.d.ts +4 -0
  25. package/dist/browser/stores/server-store.js +7 -0
  26. package/dist/browser/stores/session-working-store.d.ts +21 -0
  27. package/dist/browser/stores/session-working-store.js +106 -0
  28. package/dist/browser/stores/sync-store/ascending-id.d.ts +1 -0
  29. package/dist/browser/stores/sync-store/ascending-id.js +17 -0
  30. package/dist/browser/stores/sync-store/binary.d.ts +6 -0
  31. package/dist/browser/stores/sync-store/binary.js +17 -0
  32. package/dist/browser/stores/sync-store/delta-event-window.d.ts +1 -0
  33. package/dist/browser/stores/sync-store/delta-event-window.js +1 -0
  34. package/dist/browser/stores/sync-store/reconcile-parts.d.ts +12 -0
  35. package/dist/browser/stores/sync-store/reconcile-parts.js +53 -0
  36. package/dist/browser/stores/sync-store/types.d.ts +20 -0
  37. package/dist/browser/stores/sync-store/types.js +1 -0
  38. package/dist/browser/stores/sync-store.d.ts +65 -0
  39. package/dist/browser/stores/sync-store.js +1336 -0
  40. package/dist/core/agents/composer-agents.d.ts +19 -0
  41. package/dist/core/agents/composer-agents.js +57 -0
  42. package/dist/core/attachments/limits.d.ts +3 -0
  43. package/dist/core/attachments/limits.js +3 -0
  44. package/dist/core/attachments/prompt-attachments.d.ts +37 -0
  45. package/dist/core/attachments/prompt-attachments.js +377 -0
  46. package/dist/core/auth/app-viewer.d.ts +43 -0
  47. package/dist/core/auth/app-viewer.js +104 -0
  48. package/dist/core/auth/beeuni-member.d.ts +31 -0
  49. package/dist/core/auth/beeuni-member.js +168 -0
  50. package/dist/core/auth/session.d.ts +24 -0
  51. package/dist/core/auth/session.js +145 -0
  52. package/dist/core/cache/persisted-query-cache.d.ts +55 -0
  53. package/dist/core/cache/persisted-query-cache.js +220 -0
  54. package/dist/core/client/beeuni.d.ts +1216 -0
  55. package/dist/core/client/beeuni.js +96 -0
  56. package/dist/core/client/binding-types.d.ts +1 -0
  57. package/dist/core/client/binding-types.js +1 -0
  58. package/dist/core/client/facade-accounts.d.ts +51 -0
  59. package/dist/core/client/facade-accounts.js +53 -0
  60. package/dist/core/client/facade-catalog.d.ts +54 -0
  61. package/dist/core/client/facade-catalog.js +53 -0
  62. package/dist/core/client/facade-commerce.d.ts +39 -0
  63. package/dist/core/client/facade-commerce.js +40 -0
  64. package/dist/core/client/facade-iam.d.ts +43 -0
  65. package/dist/core/client/facade-iam.js +45 -0
  66. package/dist/core/client/facade-identity.d.ts +103 -0
  67. package/dist/core/client/facade-identity.js +33 -0
  68. package/dist/core/client/facade-preview.d.ts +3 -0
  69. package/dist/core/client/facade-preview.js +30 -0
  70. package/dist/core/client/project-access-resources.d.ts +65 -0
  71. package/dist/core/client/project-access-resources.js +54 -0
  72. package/dist/core/client/project-access-security.d.ts +109 -0
  73. package/dist/core/client/project-access-security.js +33 -0
  74. package/dist/core/client/project-connections.d.ts +32 -0
  75. package/dist/core/client/project-connections.js +18 -0
  76. package/dist/core/client/project-connectors.d.ts +15 -0
  77. package/dist/core/client/project-connectors.js +34 -0
  78. package/dist/core/client/project-core.d.ts +74 -0
  79. package/dist/core/client/project-core.js +25 -0
  80. package/dist/core/client/project-membership.d.ts +62 -0
  81. package/dist/core/client/project-membership.js +24 -0
  82. package/dist/core/client/project-operations-admin.d.ts +125 -0
  83. package/dist/core/client/project-operations-admin.js +26 -0
  84. package/dist/core/client/project-operations-review.d.ts +35 -0
  85. package/dist/core/client/project-operations-review.js +24 -0
  86. package/dist/core/client/project-operations-workspace.d.ts +94 -0
  87. package/dist/core/client/project-operations-workspace.js +36 -0
  88. package/dist/core/client/project-operations.d.ts +237 -0
  89. package/dist/core/client/project-operations.js +41 -0
  90. package/dist/core/client/project-platform-resources.d.ts +34 -0
  91. package/dist/core/client/project-platform-resources.js +27 -0
  92. package/dist/core/client/project-platform-security.d.ts +76 -0
  93. package/dist/core/client/project-platform-security.js +31 -0
  94. package/dist/core/client/project-platform-settings.d.ts +53 -0
  95. package/dist/core/client/project-platform-settings.js +23 -0
  96. package/dist/core/client/session-actions-resources.d.ts +7 -0
  97. package/dist/core/client/session-actions-resources.js +13 -0
  98. package/dist/core/client/session-actions-security.d.ts +22 -0
  99. package/dist/core/client/session-actions-security.js +38 -0
  100. package/dist/core/client/session-actions-services.d.ts +39 -0
  101. package/dist/core/client/session-actions-services.js +34 -0
  102. package/dist/core/client/session-context.d.ts +21 -0
  103. package/dist/core/client/session-context.js +1 -0
  104. package/dist/core/client/session-defaults.d.ts +8 -0
  105. package/dist/core/client/session-defaults.js +35 -0
  106. package/dist/core/client/session-files.d.ts +20 -0
  107. package/dist/core/client/session-files.js +18 -0
  108. package/dist/core/client/session-handle.d.ts +207 -0
  109. package/dist/core/client/session-handle.js +53 -0
  110. package/dist/core/client/session-lifecycle-resources.d.ts +76 -0
  111. package/dist/core/client/session-lifecycle-resources.js +44 -0
  112. package/dist/core/client/session-lifecycle-security.d.ts +42 -0
  113. package/dist/core/client/session-lifecycle-security.js +31 -0
  114. package/dist/core/client/session-preview.d.ts +7 -0
  115. package/dist/core/client/session-preview.js +11 -0
  116. package/dist/core/client/session-readiness.d.ts +10 -0
  117. package/dist/core/client/session-readiness.js +54 -0
  118. package/dist/core/client/session-runtime.d.ts +21 -0
  119. package/dist/core/client/session-runtime.js +15 -0
  120. package/dist/core/client/session-shared.d.ts +20 -0
  121. package/dist/core/client/session-shared.js +22 -0
  122. package/dist/core/client/session-start.d.ts +2 -0
  123. package/dist/core/client/session-start.js +39 -0
  124. package/dist/core/files/client.d.ts +68 -0
  125. package/dist/core/files/client.js +491 -0
  126. package/dist/core/files/types.d.ts +75 -0
  127. package/dist/core/files/types.js +1 -0
  128. package/dist/core/http/abort-error.d.ts +5 -0
  129. package/dist/core/http/abort-error.js +74 -0
  130. package/dist/core/http/abort.d.ts +3 -0
  131. package/dist/core/http/abort.js +34 -0
  132. package/dist/core/http/api/errors.d.ts +68 -0
  133. package/dist/core/http/api/errors.js +132 -0
  134. package/dist/core/http/api-client.d.ts +44 -0
  135. package/dist/core/http/api-client.js +121 -0
  136. package/dist/core/http/auth.d.ts +12 -0
  137. package/dist/core/http/auth.js +37 -0
  138. package/dist/core/http/authenticated-request.d.ts +5 -0
  139. package/dist/core/http/authenticated-request.js +11 -0
  140. package/dist/core/http/config.d.ts +35 -0
  141. package/dist/core/http/config.js +23 -0
  142. package/dist/core/http/env.d.ts +1 -0
  143. package/dist/core/http/env.js +8 -0
  144. package/dist/core/http/feature-flags.d.ts +8 -0
  145. package/dist/core/http/feature-flags.js +41 -0
  146. package/dist/core/http/fresh-sessions.d.ts +3 -0
  147. package/dist/core/http/fresh-sessions.js +17 -0
  148. package/dist/core/http/impersonation.d.ts +14 -0
  149. package/dist/core/http/impersonation.js +110 -0
  150. package/dist/core/http/instance-routes.d.ts +16 -0
  151. package/dist/core/http/instance-routes.js +99 -0
  152. package/dist/core/http/logger.d.ts +10 -0
  153. package/dist/core/http/logger.js +29 -0
  154. package/dist/core/http/request.d.ts +2 -0
  155. package/dist/core/http/request.js +194 -0
  156. package/dist/core/http/response-error.d.ts +2 -0
  157. package/dist/core/http/response-error.js +92 -0
  158. package/dist/core/http/runtime-errors.d.ts +32 -0
  159. package/dist/core/http/runtime-errors.js +116 -0
  160. package/dist/core/http/session-stopped.d.ts +2 -0
  161. package/dist/core/http/session-stopped.js +16 -0
  162. package/dist/core/http/transport.d.ts +20 -0
  163. package/dist/core/http/transport.js +133 -0
  164. package/dist/core/models/bedrock-invokable.d.ts +3 -0
  165. package/dist/core/models/bedrock-invokable.js +22 -0
  166. package/dist/core/models/composer-model.d.ts +20 -0
  167. package/dist/core/models/composer-model.js +57 -0
  168. package/dist/core/models/model-flatten.d.ts +43 -0
  169. package/dist/core/models/model-flatten.js +73 -0
  170. package/dist/core/models/model-key.d.ts +8 -0
  171. package/dist/core/models/model-key.js +18 -0
  172. package/dist/core/models/model-lookup.d.ts +2 -0
  173. package/dist/core/models/model-lookup.js +3 -0
  174. package/dist/core/models/model-visibility.d.ts +28 -0
  175. package/dist/core/models/model-visibility.js +110 -0
  176. package/dist/core/models/provider-selection.d.ts +72 -0
  177. package/dist/core/models/provider-selection.js +307 -0
  178. package/dist/core/rest/platform-client/auth.d.ts +139 -0
  179. package/dist/core/rest/platform-client/auth.js +92 -0
  180. package/dist/core/rest/platform-client/backups.d.ts +18 -0
  181. package/dist/core/rest/platform-client/backups.js +12 -0
  182. package/dist/core/rest/platform-client/connector-setup.d.ts +35 -0
  183. package/dist/core/rest/platform-client/connector-setup.js +105 -0
  184. package/dist/core/rest/platform-client/github-app.d.ts +45 -0
  185. package/dist/core/rest/platform-client/github-app.js +54 -0
  186. package/dist/core/rest/platform-client/host-boundary.d.ts +140 -0
  187. package/dist/core/rest/platform-client/host-boundary.js +188 -0
  188. package/dist/core/rest/platform-client/index.d.ts +12 -0
  189. package/dist/core/rest/platform-client/index.js +12 -0
  190. package/dist/core/rest/platform-client/instance-admin.d.ts +53 -0
  191. package/dist/core/rest/platform-client/instance-admin.js +20 -0
  192. package/dist/core/rest/platform-client/invites.d.ts +31 -0
  193. package/dist/core/rest/platform-client/invites.js +11 -0
  194. package/dist/core/rest/platform-client/lifecycle.d.ts +27 -0
  195. package/dist/core/rest/platform-client/lifecycle.js +80 -0
  196. package/dist/core/rest/platform-client/members.d.ts +14 -0
  197. package/dist/core/rest/platform-client/members.js +28 -0
  198. package/dist/core/rest/platform-client/shared.d.ts +18 -0
  199. package/dist/core/rest/platform-client/shared.js +99 -0
  200. package/dist/core/rest/platform-client/ssh.d.ts +21 -0
  201. package/dist/core/rest/platform-client/ssh.js +6 -0
  202. package/dist/core/rest/platform-client/types.d.ts +47 -0
  203. package/dist/core/rest/platform-client/types.js +10 -0
  204. package/dist/core/rest/platform-client/updates.d.ts +77 -0
  205. package/dist/core/rest/platform-client/updates.js +54 -0
  206. package/dist/core/rest/platform-client/urls.d.ts +3 -0
  207. package/dist/core/rest/platform-client/urls.js +16 -0
  208. package/dist/core/rest/projects-client/access.d.ts +226 -0
  209. package/dist/core/rest/projects-client/access.js +82 -0
  210. package/dist/core/rest/projects-client/account-lifecycle.d.ts +21 -0
  211. package/dist/core/rest/projects-client/account-lifecycle.js +25 -0
  212. package/dist/core/rest/projects-client/account-secret-resources.d.ts +60 -0
  213. package/dist/core/rest/projects-client/account-secret-resources.js +40 -0
  214. package/dist/core/rest/projects-client/accounts.d.ts +240 -0
  215. package/dist/core/rest/projects-client/accounts.js +82 -0
  216. package/dist/core/rest/projects-client/admin-providers.d.ts +131 -0
  217. package/dist/core/rest/projects-client/admin-providers.js +39 -0
  218. package/dist/core/rest/projects-client/agent-config.d.ts +72 -0
  219. package/dist/core/rest/projects-client/agent-config.js +39 -0
  220. package/dist/core/rest/projects-client/agent-connectors.d.ts +6 -0
  221. package/dist/core/rest/projects-client/agent-connectors.js +32 -0
  222. package/dist/core/rest/projects-client/agent-scope.d.ts +13 -0
  223. package/dist/core/rest/projects-client/agent-scope.js +7 -0
  224. package/dist/core/rest/projects-client/apps-fleet.d.ts +82 -0
  225. package/dist/core/rest/projects-client/apps-fleet.js +45 -0
  226. package/dist/core/rest/projects-client/apps.d.ts +356 -0
  227. package/dist/core/rest/projects-client/apps.js +126 -0
  228. package/dist/core/rest/projects-client/assignments.d.ts +73 -0
  229. package/dist/core/rest/projects-client/assignments.js +45 -0
  230. package/dist/core/rest/projects-client/audit-filter.d.ts +4 -0
  231. package/dist/core/rest/projects-client/audit-filter.js +9 -0
  232. package/dist/core/rest/projects-client/audit.d.ts +125 -0
  233. package/dist/core/rest/projects-client/audit.js +49 -0
  234. package/dist/core/rest/projects-client/billing.d.ts +390 -0
  235. package/dist/core/rest/projects-client/billing.js +257 -0
  236. package/dist/core/rest/projects-client/change-requests.d.ts +116 -0
  237. package/dist/core/rest/projects-client/change-requests.js +50 -0
  238. package/dist/core/rest/projects-client/channels.d.ts +131 -0
  239. package/dist/core/rest/projects-client/channels.js +112 -0
  240. package/dist/core/rest/projects-client/connector-run.d.ts +62 -0
  241. package/dist/core/rest/projects-client/connector-run.js +155 -0
  242. package/dist/core/rest/projects-client/connectors.d.ts +721 -0
  243. package/dist/core/rest/projects-client/connectors.js +421 -0
  244. package/dist/core/rest/projects-client/drives.d.ts +149 -0
  245. package/dist/core/rest/projects-client/drives.js +88 -0
  246. package/dist/core/rest/projects-client/files.d.ts +45 -0
  247. package/dist/core/rest/projects-client/files.js +69 -0
  248. package/dist/core/rest/projects-client/gateway.d.ts +257 -0
  249. package/dist/core/rest/projects-client/gateway.js +72 -0
  250. package/dist/core/rest/projects-client/git-backend.d.ts +15 -0
  251. package/dist/core/rest/projects-client/git-backend.js +15 -0
  252. package/dist/core/rest/projects-client/git-history.d.ts +78 -0
  253. package/dist/core/rest/projects-client/git-history.js +47 -0
  254. package/dist/core/rest/projects-client/github.d.ts +128 -0
  255. package/dist/core/rest/projects-client/github.js +54 -0
  256. package/dist/core/rest/projects-client/iam-audit.d.ts +81 -0
  257. package/dist/core/rest/projects-client/iam-audit.js +21 -0
  258. package/dist/core/rest/projects-client/iam-enterprise.d.ts +2 -0
  259. package/dist/core/rest/projects-client/iam-enterprise.js +11 -0
  260. package/dist/core/rest/projects-client/iam-grants.d.ts +21 -0
  261. package/dist/core/rest/projects-client/iam-grants.js +6 -0
  262. package/dist/core/rest/projects-client/iam-groups.d.ts +65 -0
  263. package/dist/core/rest/projects-client/iam-groups.js +42 -0
  264. package/dist/core/rest/projects-client/iam-policies.d.ts +53 -0
  265. package/dist/core/rest/projects-client/iam-policies.js +26 -0
  266. package/dist/core/rest/projects-client/iam-probe.d.ts +27 -0
  267. package/dist/core/rest/projects-client/iam-probe.js +16 -0
  268. package/dist/core/rest/projects-client/iam-query.d.ts +1 -0
  269. package/dist/core/rest/projects-client/iam-query.js +9 -0
  270. package/dist/core/rest/projects-client/iam-roles.d.ts +47 -0
  271. package/dist/core/rest/projects-client/iam-roles.js +43 -0
  272. package/dist/core/rest/projects-client/iam-scim.d.ts +22 -0
  273. package/dist/core/rest/projects-client/iam-scim.js +14 -0
  274. package/dist/core/rest/projects-client/iam-security.d.ts +28 -0
  275. package/dist/core/rest/projects-client/iam-security.js +17 -0
  276. package/dist/core/rest/projects-client/iam-service-accounts.d.ts +26 -0
  277. package/dist/core/rest/projects-client/iam-service-accounts.js +14 -0
  278. package/dist/core/rest/projects-client/iam-sessions.d.ts +27 -0
  279. package/dist/core/rest/projects-client/iam-sessions.js +25 -0
  280. package/dist/core/rest/projects-client/iam-shared.d.ts +6 -0
  281. package/dist/core/rest/projects-client/iam-shared.js +8 -0
  282. package/dist/core/rest/projects-client/iam-sso.d.ts +60 -0
  283. package/dist/core/rest/projects-client/iam-sso.js +28 -0
  284. package/dist/core/rest/projects-client/iam-types.d.ts +52 -0
  285. package/dist/core/rest/projects-client/iam-types.js +1 -0
  286. package/dist/core/rest/projects-client/iam.d.ts +13 -0
  287. package/dist/core/rest/projects-client/iam.js +13 -0
  288. package/dist/core/rest/projects-client/index.d.ts +55 -0
  289. package/dist/core/rest/projects-client/index.js +54 -0
  290. package/dist/core/rest/projects-client/marketplace-catalog.d.ts +74 -0
  291. package/dist/core/rest/projects-client/marketplace-catalog.js +41 -0
  292. package/dist/core/rest/projects-client/model-access.d.ts +13 -0
  293. package/dist/core/rest/projects-client/model-access.js +8 -0
  294. package/dist/core/rest/projects-client/model-defaults.d.ts +28 -0
  295. package/dist/core/rest/projects-client/model-defaults.js +15 -0
  296. package/dist/core/rest/projects-client/model-enablement.d.ts +4 -0
  297. package/dist/core/rest/projects-client/model-enablement.js +5 -0
  298. package/dist/core/rest/projects-client/notifications.d.ts +95 -0
  299. package/dist/core/rest/projects-client/notifications.js +61 -0
  300. package/dist/core/rest/projects-client/oauth-clients.d.ts +41 -0
  301. package/dist/core/rest/projects-client/oauth-clients.js +24 -0
  302. package/dist/core/rest/projects-client/policies.d.ts +26 -0
  303. package/dist/core/rest/projects-client/policies.js +8 -0
  304. package/dist/core/rest/projects-client/presentations.d.ts +11 -0
  305. package/dist/core/rest/projects-client/presentations.js +8 -0
  306. package/dist/core/rest/projects-client/project-agents.d.ts +10 -0
  307. package/dist/core/rest/projects-client/project-agents.js +22 -0
  308. package/dist/core/rest/projects-client/projects.d.ts +376 -0
  309. package/dist/core/rest/projects-client/projects.js +237 -0
  310. package/dist/core/rest/projects-client/prompt-attachments.d.ts +31 -0
  311. package/dist/core/rest/projects-client/prompt-attachments.js +294 -0
  312. package/dist/core/rest/projects-client/provider-connections.d.ts +54 -0
  313. package/dist/core/rest/projects-client/provider-connections.js +28 -0
  314. package/dist/core/rest/projects-client/public-session-shares.d.ts +49 -0
  315. package/dist/core/rest/projects-client/public-session-shares.js +35 -0
  316. package/dist/core/rest/projects-client/referrals.d.ts +52 -0
  317. package/dist/core/rest/projects-client/referrals.js +19 -0
  318. package/dist/core/rest/projects-client/review-items.d.ts +139 -0
  319. package/dist/core/rest/projects-client/review-items.js +217 -0
  320. package/dist/core/rest/projects-client/review.d.ts +56 -0
  321. package/dist/core/rest/projects-client/review.js +23 -0
  322. package/dist/core/rest/projects-client/sandbox-shares.d.ts +21 -0
  323. package/dist/core/rest/projects-client/sandbox-shares.js +19 -0
  324. package/dist/core/rest/projects-client/sandbox.d.ts +144 -0
  325. package/dist/core/rest/projects-client/sandbox.js +35 -0
  326. package/dist/core/rest/projects-client/secrets.d.ts +187 -0
  327. package/dist/core/rest/projects-client/secrets.js +79 -0
  328. package/dist/core/rest/projects-client/session-attachments.d.ts +22 -0
  329. package/dist/core/rest/projects-client/session-attachments.js +166 -0
  330. package/dist/core/rest/projects-client/session-costs.d.ts +193 -0
  331. package/dist/core/rest/projects-client/session-costs.js +87 -0
  332. package/dist/core/rest/projects-client/session-prompt-actions.d.ts +10 -0
  333. package/dist/core/rest/projects-client/session-prompt-actions.js +4 -0
  334. package/dist/core/rest/projects-client/session-reminders.d.ts +58 -0
  335. package/dist/core/rest/projects-client/session-reminders.js +50 -0
  336. package/dist/core/rest/projects-client/session-sandbox.d.ts +85 -0
  337. package/dist/core/rest/projects-client/session-sandbox.js +113 -0
  338. package/dist/core/rest/projects-client/sessions.d.ts +670 -0
  339. package/dist/core/rest/projects-client/sessions.js +321 -0
  340. package/dist/core/rest/projects-client/setup-links.d.ts +54 -0
  341. package/dist/core/rest/projects-client/setup-links.js +22 -0
  342. package/dist/core/rest/projects-client/shared.d.ts +51 -0
  343. package/dist/core/rest/projects-client/shared.js +29 -0
  344. package/dist/core/rest/projects-client/skills.d.ts +11 -0
  345. package/dist/core/rest/projects-client/skills.js +8 -0
  346. package/dist/core/rest/projects-client/starter-suggestions.d.ts +17 -0
  347. package/dist/core/rest/projects-client/starter-suggestions.js +5 -0
  348. package/dist/core/rest/projects-client/templates.d.ts +47 -0
  349. package/dist/core/rest/projects-client/templates.js +7 -0
  350. package/dist/core/rest/projects-client/tokens.d.ts +94 -0
  351. package/dist/core/rest/projects-client/tokens.js +46 -0
  352. package/dist/core/rest/projects-client/triggers.d.ts +175 -0
  353. package/dist/core/rest/projects-client/triggers.js +29 -0
  354. package/dist/core/runtime/attachment-part.d.ts +3 -0
  355. package/dist/core/runtime/attachment-part.js +18 -0
  356. package/dist/core/runtime/beeuni-master.d.ts +477 -0
  357. package/dist/core/runtime/beeuni-master.js +264 -0
  358. package/dist/core/runtime/client.d.ts +30 -0
  359. package/dist/core/runtime/client.js +124 -0
  360. package/dist/core/runtime/env.d.ts +8 -0
  361. package/dist/core/runtime/env.js +42 -0
  362. package/dist/core/runtime/pty.d.ts +43 -0
  363. package/dist/core/runtime/pty.js +117 -0
  364. package/dist/core/runtime/runtime-rest-client.d.ts +414 -0
  365. package/dist/core/runtime/runtime-rest-client.js +296 -0
  366. package/dist/core/runtime/runtime-types.d.ts +1094 -0
  367. package/dist/core/runtime/runtime-types.js +1 -0
  368. package/dist/core/runtime/transcript-types.d.ts +507 -0
  369. package/dist/core/runtime/transcript-types.js +31 -0
  370. package/dist/core/runtime/triggers.d.ts +1 -0
  371. package/dist/core/runtime/triggers.js +18 -0
  372. package/dist/core/session/compaction.d.ts +10 -0
  373. package/dist/core/session/compaction.js +22 -0
  374. package/dist/core/session/connection.d.ts +20 -0
  375. package/dist/core/session/connection.js +52 -0
  376. package/dist/core/session/control-stream.d.ts +62 -0
  377. package/dist/core/session/control-stream.js +329 -0
  378. package/dist/core/session/current-runtime.d.ts +14 -0
  379. package/dist/core/session/current-runtime.js +34 -0
  380. package/dist/core/session/health.d.ts +41 -0
  381. package/dist/core/session/health.js +53 -0
  382. package/dist/core/session/host-signals.d.ts +3 -0
  383. package/dist/core/session/host-signals.js +16 -0
  384. package/dist/core/session/index.d.ts +15 -0
  385. package/dist/core/session/index.js +14 -0
  386. package/dist/core/session/message-queue.d.ts +43 -0
  387. package/dist/core/session/message-queue.js +101 -0
  388. package/dist/core/session/open-bundle.d.ts +24 -0
  389. package/dist/core/session/open-bundle.js +135 -0
  390. package/dist/core/session/poll-owner.d.ts +5 -0
  391. package/dist/core/session/poll-owner.js +58 -0
  392. package/dist/core/session/presentation.d.ts +11 -0
  393. package/dist/core/session/presentation.js +70 -0
  394. package/dist/core/session/preview-auth.d.ts +6 -0
  395. package/dist/core/session/preview-auth.js +36 -0
  396. package/dist/core/session/preview-config.d.ts +5 -0
  397. package/dist/core/session/preview-config.js +54 -0
  398. package/dist/core/session/preview-options.d.ts +9 -0
  399. package/dist/core/session/preview-options.js +12 -0
  400. package/dist/core/session/preview-origin-trust.d.ts +7 -0
  401. package/dist/core/session/preview-origin-trust.js +64 -0
  402. package/dist/core/session/preview-probe.d.ts +7 -0
  403. package/dist/core/session/preview-probe.js +36 -0
  404. package/dist/core/session/preview.d.ts +3 -0
  405. package/dist/core/session/preview.js +66 -0
  406. package/dist/core/session/project-session-read.d.ts +5 -0
  407. package/dist/core/session/project-session-read.js +12 -0
  408. package/dist/core/session/rewind.d.ts +29 -0
  409. package/dist/core/session/rewind.js +53 -0
  410. package/dist/core/session/runtime-gone.d.ts +5 -0
  411. package/dist/core/session/runtime-gone.js +14 -0
  412. package/dist/core/session/runtime-sessions.d.ts +7 -0
  413. package/dist/core/session/runtime-sessions.js +26 -0
  414. package/dist/core/session/runtime-verbs.d.ts +34 -0
  415. package/dist/core/session/runtime-verbs.js +94 -0
  416. package/dist/core/session/server-store/active.d.ts +7 -0
  417. package/dist/core/session/server-store/active.js +35 -0
  418. package/dist/core/session/server-store/types.d.ts +4 -0
  419. package/dist/core/session/server-store/types.js +1 -0
  420. package/dist/core/session/server-store/url-helpers.d.ts +5 -0
  421. package/dist/core/session/server-store/url-helpers.js +25 -0
  422. package/dist/core/session/session-runtime-registry.d.ts +9 -0
  423. package/dist/core/session/session-runtime-registry.js +28 -0
  424. package/dist/core/session/single-flight.d.ts +3 -0
  425. package/dist/core/session/single-flight.js +22 -0
  426. package/dist/core/session/static-file-preview.d.ts +10 -0
  427. package/dist/core/session/static-file-preview.js +34 -0
  428. package/dist/core/session/status-vocabulary.d.ts +23 -0
  429. package/dist/core/session/status-vocabulary.js +59 -0
  430. package/dist/core/session/turn-end-cause.d.ts +22 -0
  431. package/dist/core/session/turn-end-cause.js +41 -0
  432. package/dist/core/session/turn-end-settle.d.ts +1 -0
  433. package/dist/core/session/turn-end-settle.js +1 -0
  434. package/dist/core/session/url.d.ts +49 -0
  435. package/dist/core/session/url.js +415 -0
  436. package/dist/core/session/wake-escalation.d.ts +37 -0
  437. package/dist/core/session/wake-escalation.js +104 -0
  438. package/dist/core/session/wire-id-unwrap.d.ts +2 -0
  439. package/dist/core/session/wire-id-unwrap.js +15 -0
  440. package/dist/core/session/wire-message-id.d.ts +27 -0
  441. package/dist/core/session/wire-message-id.js +88 -0
  442. package/dist/core/session/working-evidence.d.ts +13 -0
  443. package/dist/core/session/working-evidence.js +25 -0
  444. package/dist/core/session/working-project.d.ts +2 -0
  445. package/dist/core/session/working-project.js +145 -0
  446. package/dist/core/session/working-runtime.d.ts +3 -0
  447. package/dist/core/session/working-runtime.js +16 -0
  448. package/dist/core/session/working-server.d.ts +20 -0
  449. package/dist/core/session/working-server.js +57 -0
  450. package/dist/core/session/working-time.d.ts +1 -0
  451. package/dist/core/session/working-time.js +6 -0
  452. package/dist/core/session/working.d.ts +58 -0
  453. package/dist/core/session/working.js +48 -0
  454. package/dist/core/session-sync/fragment.d.ts +4 -0
  455. package/dist/core/session-sync/fragment.js +3 -0
  456. package/dist/core/session-sync/saved-copy-store.d.ts +23 -0
  457. package/dist/core/session-sync/saved-copy-store.js +232 -0
  458. package/dist/core/session-sync/saved-transcript.d.ts +20 -0
  459. package/dist/core/session-sync/saved-transcript.js +35 -0
  460. package/dist/core/session-sync/session-sync-controller.d.ts +111 -0
  461. package/dist/core/session-sync/session-sync-controller.js +440 -0
  462. package/dist/core/stream/chat-events.d.ts +96 -0
  463. package/dist/core/stream/chat-events.js +95 -0
  464. package/dist/core/stream/event-stream.d.ts +52 -0
  465. package/dist/core/stream/event-stream.js +372 -0
  466. package/dist/core/stream/fetch-sse.d.ts +20 -0
  467. package/dist/core/stream/fetch-sse.js +136 -0
  468. package/dist/core/stream/keepalive.d.ts +4 -0
  469. package/dist/core/stream/keepalive.js +6 -0
  470. package/dist/core/stream/platform-event-transport.d.ts +2 -0
  471. package/dist/core/stream/platform-event-transport.js +20 -0
  472. package/dist/core/turns/classify.d.ts +131 -0
  473. package/dist/core/turns/classify.js +306 -0
  474. package/dist/core/turns/errors.d.ts +24 -0
  475. package/dist/core/turns/errors.js +355 -0
  476. package/dist/core/turns/grouping.d.ts +47 -0
  477. package/dist/core/turns/grouping.js +247 -0
  478. package/dist/core/turns/index.d.ts +13 -0
  479. package/dist/core/turns/index.js +12 -0
  480. package/dist/core/turns/open-turn.d.ts +13 -0
  481. package/dist/core/turns/open-turn.js +17 -0
  482. package/dist/core/turns/parts.d.ts +60 -0
  483. package/dist/core/turns/parts.js +414 -0
  484. package/dist/core/turns/segments/burst-summary.d.ts +9 -0
  485. package/dist/core/turns/segments/burst-summary.js +45 -0
  486. package/dist/core/turns/segments/compaction-state.d.ts +19 -0
  487. package/dist/core/turns/segments/compaction-state.js +42 -0
  488. package/dist/core/turns/segments/group-steps.d.ts +11 -0
  489. package/dist/core/turns/segments/group-steps.js +65 -0
  490. package/dist/core/turns/segments/index.d.ts +12 -0
  491. package/dist/core/turns/segments/index.js +12 -0
  492. package/dist/core/turns/segments/merge-steps.d.ts +21 -0
  493. package/dist/core/turns/segments/merge-steps.js +100 -0
  494. package/dist/core/turns/segments/message-time.d.ts +12 -0
  495. package/dist/core/turns/segments/message-time.js +82 -0
  496. package/dist/core/turns/segments/narration.d.ts +9 -0
  497. package/dist/core/turns/segments/narration.js +573 -0
  498. package/dist/core/turns/segments/segment-turn.d.ts +15 -0
  499. package/dist/core/turns/segments/segment-turn.js +32 -0
  500. package/dist/core/turns/segments/session-activity-groups.d.ts +20 -0
  501. package/dist/core/turns/segments/session-activity-groups.js +56 -0
  502. package/dist/core/turns/segments/show-group.d.ts +23 -0
  503. package/dist/core/turns/segments/show-group.js +101 -0
  504. package/dist/core/turns/segments/step-label.d.ts +10 -0
  505. package/dist/core/turns/segments/step-label.js +85 -0
  506. package/dist/core/turns/segments/turn-busy-visibility.d.ts +6 -0
  507. package/dist/core/turns/segments/turn-busy-visibility.js +9 -0
  508. package/dist/core/turns/segments/working-turn.d.ts +70 -0
  509. package/dist/core/turns/segments/working-turn.js +98 -0
  510. package/dist/core/turns/shell.d.ts +5 -0
  511. package/dist/core/turns/shell.js +21 -0
  512. package/dist/core/turns/state.d.ts +24 -0
  513. package/dist/core/turns/state.js +364 -0
  514. package/dist/core/turns/text-scan.d.ts +21 -0
  515. package/dist/core/turns/text-scan.js +347 -0
  516. package/dist/core/turns/tool-kind.d.ts +3 -0
  517. package/dist/core/turns/tool-kind.js +99 -0
  518. package/dist/core/turns/tool-registry.d.ts +8 -0
  519. package/dist/core/turns/tool-registry.js +87 -0
  520. package/dist/core/turns/tools/agent-helpers.d.ts +9 -0
  521. package/dist/core/turns/tools/agent-helpers.js +53 -0
  522. package/dist/core/turns/tools/file-verb.d.ts +10 -0
  523. package/dist/core/turns/tools/file-verb.js +22 -0
  524. package/dist/core/turns/tools/index.d.ts +14 -0
  525. package/dist/core/turns/tools/index.js +14 -0
  526. package/dist/core/turns/tools/memory-helpers.d.ts +15 -0
  527. package/dist/core/turns/tools/memory-helpers.js +50 -0
  528. package/dist/core/turns/tools/patch-summary.d.ts +6 -0
  529. package/dist/core/turns/tools/patch-summary.js +21 -0
  530. package/dist/core/turns/tools/presentation-helpers.d.ts +15 -0
  531. package/dist/core/turns/tools/presentation-helpers.js +17 -0
  532. package/dist/core/turns/tools/question-helpers.d.ts +9 -0
  533. package/dist/core/turns/tools/question-helpers.js +12 -0
  534. package/dist/core/turns/tools/read-helpers.d.ts +7 -0
  535. package/dist/core/turns/tools/read-helpers.js +24 -0
  536. package/dist/core/turns/tools/search-query.d.ts +1 -0
  537. package/dist/core/turns/tools/search-query.js +73 -0
  538. package/dist/core/turns/tools/show-availability.d.ts +11 -0
  539. package/dist/core/turns/tools/show-availability.js +38 -0
  540. package/dist/core/turns/tools/skill-helpers.d.ts +5 -0
  541. package/dist/core/turns/tools/skill-helpers.js +61 -0
  542. package/dist/core/turns/tools/tool-meta.d.ts +30 -0
  543. package/dist/core/turns/tools/tool-meta.js +146 -0
  544. package/dist/core/turns/tools/tool-outcome.d.ts +15 -0
  545. package/dist/core/turns/tools/tool-outcome.js +147 -0
  546. package/dist/core/turns/tools/tool-output-format.d.ts +17 -0
  547. package/dist/core/turns/tools/tool-output-format.js +124 -0
  548. package/dist/core/turns/tools/web-helpers.d.ts +34 -0
  549. package/dist/core/turns/tools/web-helpers.js +229 -0
  550. package/dist/core/turns/types.d.ts +110 -0
  551. package/dist/core/turns/types.js +1 -0
  552. package/dist/core/turns/view-model.d.ts +76 -0
  553. package/dist/core/turns/view-model.js +300 -0
  554. package/dist/deprecated/api-client.d.ts +1 -0
  555. package/dist/deprecated/api-client.js +1 -0
  556. package/dist/deprecated/auth.d.ts +1 -0
  557. package/dist/deprecated/auth.js +1 -0
  558. package/dist/deprecated/config.d.ts +1 -0
  559. package/dist/deprecated/config.js +1 -0
  560. package/dist/deprecated/event-stream.d.ts +1 -0
  561. package/dist/deprecated/event-stream.js +1 -0
  562. package/dist/deprecated/feature-flags.d.ts +1 -0
  563. package/dist/deprecated/feature-flags.js +1 -0
  564. package/dist/deprecated/files.d.ts +1 -0
  565. package/dist/deprecated/files.js +1 -0
  566. package/dist/deprecated/fresh-sessions.d.ts +1 -0
  567. package/dist/deprecated/fresh-sessions.js +1 -0
  568. package/dist/deprecated/idb-sync-cache.d.ts +1 -0
  569. package/dist/deprecated/idb-sync-cache.js +1 -0
  570. package/dist/deprecated/instance-routes.d.ts +1 -0
  571. package/dist/deprecated/instance-routes.js +1 -0
  572. package/dist/deprecated/opencode-client.d.ts +1 -0
  573. package/dist/deprecated/opencode-client.js +1 -0
  574. package/dist/deprecated/opencode-errors.d.ts +1 -0
  575. package/dist/deprecated/opencode-errors.js +1 -0
  576. package/dist/deprecated/opencode-pending-store.d.ts +1 -0
  577. package/dist/deprecated/opencode-pending-store.js +1 -0
  578. package/dist/deprecated/platform-client.d.ts +1 -0
  579. package/dist/deprecated/platform-client.js +1 -0
  580. package/dist/deprecated/projects-client.d.ts +1 -0
  581. package/dist/deprecated/projects-client.js +1 -0
  582. package/dist/deprecated/sandbox-connection-store.d.ts +1 -0
  583. package/dist/deprecated/sandbox-connection-store.js +1 -0
  584. package/dist/deprecated/server-store.d.ts +1 -0
  585. package/dist/deprecated/server-store.js +1 -0
  586. package/dist/deprecated/session-url.d.ts +1 -0
  587. package/dist/deprecated/session-url.js +1 -0
  588. package/dist/deprecated/session.d.ts +1 -0
  589. package/dist/deprecated/session.js +1 -0
  590. package/dist/deprecated/sync-store.d.ts +1 -0
  591. package/dist/deprecated/sync-store.js +1 -0
  592. package/dist/deprecated/turns.d.ts +1 -0
  593. package/dist/deprecated/turns.js +1 -0
  594. package/dist/index.d.ts +61 -0
  595. package/dist/index.js +53 -0
  596. package/dist/internal/diagnostics-store.d.ts +1 -0
  597. package/dist/internal/diagnostics-store.js +1 -0
  598. package/dist/internal/idb-sync-cache.d.ts +1 -0
  599. package/dist/internal/idb-sync-cache.js +1 -0
  600. package/dist/internal/managed-storage.d.ts +1 -0
  601. package/dist/internal/managed-storage.js +1 -0
  602. package/dist/internal/opencode-pending-store.d.ts +1 -0
  603. package/dist/internal/opencode-pending-store.js +1 -0
  604. package/dist/internal/sandbox-connection-store.d.ts +1 -0
  605. package/dist/internal/sandbox-connection-store.js +1 -0
  606. package/dist/internal/server-store.d.ts +1 -0
  607. package/dist/internal/server-store.js +1 -0
  608. package/dist/internal/sync-store.d.ts +1 -0
  609. package/dist/internal/sync-store.js +1 -0
  610. package/dist/node/app-guard.d.ts +36 -0
  611. package/dist/node/app-guard.js +118 -0
  612. package/dist/node/app-viewer.d.ts +30 -0
  613. package/dist/node/app-viewer.js +113 -0
  614. package/dist/node/auth.d.ts +52 -0
  615. package/dist/node/auth.js +387 -0
  616. package/dist/node/scoped-client.d.ts +9 -0
  617. package/dist/node/scoped-client.js +106 -0
  618. package/dist/node/server.d.ts +8 -0
  619. package/dist/node/server.js +5 -0
  620. package/dist/platform/auth-core.d.ts +10 -0
  621. package/dist/platform/auth-core.js +44 -0
  622. package/dist/platform/config-node.d.ts +4 -0
  623. package/dist/platform/config-node.js +13 -0
  624. package/dist/platform/session-id.d.ts +1 -0
  625. package/dist/platform/session-id.js +15 -0
  626. package/dist/platform/storage/managed-storage.d.ts +25 -0
  627. package/dist/platform/storage/managed-storage.js +215 -0
  628. package/dist/platform/strings.d.ts +1 -0
  629. package/dist/platform/strings.js +6 -0
  630. package/dist/platform/ui.d.ts +5 -0
  631. package/dist/platform/ui.js +16 -0
  632. package/dist/react/agent-selection-scope.d.ts +7 -0
  633. package/dist/react/agent-selection-scope.js +3 -0
  634. package/dist/react/bedrock-invokable.d.ts +1 -0
  635. package/dist/react/bedrock-invokable.js +1 -0
  636. package/dist/react/chat/index.d.ts +2 -0
  637. package/dist/react/chat/index.js +3 -0
  638. package/dist/react/chat/render-parts.d.ts +11 -0
  639. package/dist/react/chat/render-parts.js +10 -0
  640. package/dist/react/chat/use-chat-turns.d.ts +9 -0
  641. package/dist/react/chat/use-chat-turns.js +9 -0
  642. package/dist/react/connector-setup.d.ts +21 -0
  643. package/dist/react/connector-setup.js +130 -0
  644. package/dist/react/file-keys.d.ts +16 -0
  645. package/dist/react/file-keys.js +16 -0
  646. package/dist/react/hold-live-start.d.ts +3 -0
  647. package/dist/react/hold-live-start.js +27 -0
  648. package/dist/react/human-presence.d.ts +15 -0
  649. package/dist/react/human-presence.js +62 -0
  650. package/dist/react/identity-reset-registry.d.ts +2 -0
  651. package/dist/react/identity-reset-registry.js +14 -0
  652. package/dist/react/index.d.ts +62 -0
  653. package/dist/react/index.js +63 -0
  654. package/dist/react/initial-session-pin.d.ts +14 -0
  655. package/dist/react/initial-session-pin.js +28 -0
  656. package/dist/react/invalidate-project.d.ts +22 -0
  657. package/dist/react/invalidate-project.js +26 -0
  658. package/dist/react/model-flatten.d.ts +1 -0
  659. package/dist/react/model-flatten.js +1 -0
  660. package/dist/react/opencode.d.ts +43 -0
  661. package/dist/react/opencode.js +43 -0
  662. package/dist/react/prefetch-session-open.d.ts +5 -0
  663. package/dist/react/prefetch-session-open.js +48 -0
  664. package/dist/react/prefetch-session-start.d.ts +2 -0
  665. package/dist/react/prefetch-session-start.js +9 -0
  666. package/dist/react/provider-refresh.d.ts +9 -0
  667. package/dist/react/provider-refresh.js +72 -0
  668. package/dist/react/provider-selection.d.ts +1 -0
  669. package/dist/react/provider-selection.js +1 -0
  670. package/dist/react/pty-query-state.d.ts +2 -0
  671. package/dist/react/pty-query-state.js +6 -0
  672. package/dist/react/query-contracts.d.ts +49 -0
  673. package/dist/react/query-contracts.js +63 -0
  674. package/dist/react/query-keys.d.ts +105 -0
  675. package/dist/react/query-keys.js +115 -0
  676. package/dist/react/reset-identity-state.d.ts +2 -0
  677. package/dist/react/reset-identity-state.js +19 -0
  678. package/dist/react/retired-endpoint.d.ts +3 -0
  679. package/dist/react/retired-endpoint.js +15 -0
  680. package/dist/react/route-project.d.ts +6 -0
  681. package/dist/react/route-project.js +9 -0
  682. package/dist/react/run-pty-command.d.ts +4 -0
  683. package/dist/react/run-pty-command.js +41 -0
  684. package/dist/react/runtime-actions.d.ts +31 -0
  685. package/dist/react/runtime-actions.js +87 -0
  686. package/dist/react/self-heal-poll-gate.d.ts +8 -0
  687. package/dist/react/self-heal-poll-gate.js +5 -0
  688. package/dist/react/session-agent-name-guard.d.ts +1 -0
  689. package/dist/react/session-agent-name-guard.js +5 -0
  690. package/dist/react/session-cache-write.d.ts +8 -0
  691. package/dist/react/session-cache-write.js +116 -0
  692. package/dist/react/session-start-giveup.d.ts +4 -0
  693. package/dist/react/session-start-giveup.js +5 -0
  694. package/dist/react/session-start-stash.d.ts +17 -0
  695. package/dist/react/session-start-stash.js +146 -0
  696. package/dist/react/session-stop.d.ts +20 -0
  697. package/dist/react/session-stop.js +63 -0
  698. package/dist/react/session-title-sync.d.ts +12 -0
  699. package/dist/react/session-title-sync.js +88 -0
  700. package/dist/react/session-transcript-subscription.d.ts +7 -0
  701. package/dist/react/session-transcript-subscription.js +71 -0
  702. package/dist/react/sign-in-with-beeuni.d.ts +330 -0
  703. package/dist/react/sign-in-with-beeuni.js +51 -0
  704. package/dist/react/teams-install-polling.d.ts +3 -0
  705. package/dist/react/teams-install-polling.js +4 -0
  706. package/dist/react/use-accounts.d.ts +47 -0
  707. package/dist/react/use-accounts.js +31 -0
  708. package/dist/react/use-admin-accounts.d.ts +236 -0
  709. package/dist/react/use-admin-accounts.js +287 -0
  710. package/dist/react/use-admin-activity-analytics.d.ts +48 -0
  711. package/dist/react/use-admin-activity-analytics.js +47 -0
  712. package/dist/react/use-admin-analytics.d.ts +331 -0
  713. package/dist/react/use-admin-analytics.js +85 -0
  714. package/dist/react/use-admin-billing.d.ts +26 -0
  715. package/dist/react/use-admin-billing.js +13 -0
  716. package/dist/react/use-admin-feedback.d.ts +118 -0
  717. package/dist/react/use-admin-feedback.js +46 -0
  718. package/dist/react/use-admin-projects.d.ts +31 -0
  719. package/dist/react/use-admin-projects.js +27 -0
  720. package/dist/react/use-admin-providers.d.ts +20 -0
  721. package/dist/react/use-admin-providers.js +45 -0
  722. package/dist/react/use-admin-role.d.ts +4 -0
  723. package/dist/react/use-admin-role.js +15 -0
  724. package/dist/react/use-admin-sandboxes.d.ts +156 -0
  725. package/dist/react/use-admin-sandboxes.js +52 -0
  726. package/dist/react/use-authenticated-preview-url.d.ts +3 -0
  727. package/dist/react/use-authenticated-preview-url.js +96 -0
  728. package/dist/react/use-beeuni-app-viewer.d.ts +12 -0
  729. package/dist/react/use-beeuni-app-viewer.js +19 -0
  730. package/dist/react/use-beeuni-master.d.ts +333 -0
  731. package/dist/react/use-beeuni-master.js +845 -0
  732. package/dist/react/use-can.d.ts +35 -0
  733. package/dist/react/use-can.js +129 -0
  734. package/dist/react/use-canonical-opencode-session.d.ts +21 -0
  735. package/dist/react/use-canonical-opencode-session.js +44 -0
  736. package/dist/react/use-change-requests.d.ts +291 -0
  737. package/dist/react/use-change-requests.js +31 -0
  738. package/dist/react/use-connector-query.d.ts +7 -0
  739. package/dist/react/use-connector-query.js +23 -0
  740. package/dist/react/use-current-runtime.d.ts +2 -0
  741. package/dist/react/use-current-runtime.js +6 -0
  742. package/dist/react/use-feature-flag.d.ts +6 -0
  743. package/dist/react/use-feature-flag.js +25 -0
  744. package/dist/react/use-gateway-catalog-sync.d.ts +1 -0
  745. package/dist/react/use-gateway-catalog-sync.js +40 -0
  746. package/dist/react/use-gateway-routing-policy.d.ts +8 -0
  747. package/dist/react/use-gateway-routing-policy.js +36 -0
  748. package/dist/react/use-impersonation.d.ts +20 -0
  749. package/dist/react/use-impersonation.js +55 -0
  750. package/dist/react/use-model-access.d.ts +9 -0
  751. package/dist/react/use-model-access.js +46 -0
  752. package/dist/react/use-model-defaults.d.ts +23 -0
  753. package/dist/react/use-model-defaults.js +115 -0
  754. package/dist/react/use-model-enablement.d.ts +8 -0
  755. package/dist/react/use-model-enablement.js +69 -0
  756. package/dist/react/use-model-store.d.ts +47 -0
  757. package/dist/react/use-model-store.js +234 -0
  758. package/dist/react/use-notifications.d.ts +618 -0
  759. package/dist/react/use-notifications.js +104 -0
  760. package/dist/react/use-opencode-config.d.ts +12 -0
  761. package/dist/react/use-opencode-config.js +69 -0
  762. package/dist/react/use-opencode-events/diagnostics.d.ts +4 -0
  763. package/dist/react/use-opencode-events/diagnostics.js +42 -0
  764. package/dist/react/use-opencode-events/handle-event.d.ts +23 -0
  765. package/dist/react/use-opencode-events/handle-event.js +57 -0
  766. package/dist/react/use-opencode-events/handle-interaction-event.d.ts +3 -0
  767. package/dist/react/use-opencode-events/handle-interaction-event.js +41 -0
  768. package/dist/react/use-opencode-events/handle-message-event.d.ts +3 -0
  769. package/dist/react/use-opencode-events/handle-message-event.js +32 -0
  770. package/dist/react/use-opencode-events/handle-session-event.d.ts +4 -0
  771. package/dist/react/use-opencode-events/handle-session-event.js +240 -0
  772. package/dist/react/use-opencode-events/handle-workspace-event.d.ts +3 -0
  773. package/dist/react/use-opencode-events/handle-workspace-event.js +112 -0
  774. package/dist/react/use-opencode-events/handler-context.d.ts +28 -0
  775. package/dist/react/use-opencode-events/handler-context.js +1 -0
  776. package/dist/react/use-opencode-events/helpers.d.ts +27 -0
  777. package/dist/react/use-opencode-events/helpers.js +126 -0
  778. package/dist/react/use-opencode-events/hydrate-core.d.ts +22 -0
  779. package/dist/react/use-opencode-events/hydrate-core.js +78 -0
  780. package/dist/react/use-opencode-events/index.d.ts +9 -0
  781. package/dist/react/use-opencode-events/index.js +181 -0
  782. package/dist/react/use-opencode-events/rehydrate-targets.d.ts +1 -0
  783. package/dist/react/use-opencode-events/rehydrate-targets.js +3 -0
  784. package/dist/react/use-opencode-events/runtime-stream-signals.d.ts +19 -0
  785. package/dist/react/use-opencode-events/runtime-stream-signals.js +22 -0
  786. package/dist/react/use-opencode-events/stream-revival.d.ts +11 -0
  787. package/dist/react/use-opencode-events/stream-revival.js +60 -0
  788. package/dist/react/use-opencode-events/types.d.ts +2 -0
  789. package/dist/react/use-opencode-events/types.js +1 -0
  790. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +16 -0
  791. package/dist/react/use-opencode-events/use-event-stream-refs.js +129 -0
  792. package/dist/react/use-opencode-local.d.ts +72 -0
  793. package/dist/react/use-opencode-local.js +306 -0
  794. package/dist/react/use-opencode-mcp.d.ts +29 -0
  795. package/dist/react/use-opencode-mcp.js +149 -0
  796. package/dist/react/use-opencode-pty.d.ts +39 -0
  797. package/dist/react/use-opencode-pty.js +61 -0
  798. package/dist/react/use-opencode-sessions/agents.d.ts +11 -0
  799. package/dist/react/use-opencode-sessions/agents.js +57 -0
  800. package/dist/react/use-opencode-sessions/commands.d.ts +16 -0
  801. package/dist/react/use-opencode-sessions/commands.js +42 -0
  802. package/dist/react/use-opencode-sessions/files.d.ts +2 -0
  803. package/dist/react/use-opencode-sessions/files.js +144 -0
  804. package/dist/react/use-opencode-sessions/index.d.ts +15 -0
  805. package/dist/react/use-opencode-sessions/index.js +15 -0
  806. package/dist/react/use-opencode-sessions/keys.d.ts +102 -0
  807. package/dist/react/use-opencode-sessions/keys.js +38 -0
  808. package/dist/react/use-opencode-sessions/mcp.d.ts +2 -0
  809. package/dist/react/use-opencode-sessions/mcp.js +19 -0
  810. package/dist/react/use-opencode-sessions/messages.d.ts +57 -0
  811. package/dist/react/use-opencode-sessions/messages.js +342 -0
  812. package/dist/react/use-opencode-sessions/no-compaction-model-error.d.ts +3 -0
  813. package/dist/react/use-opencode-sessions/no-compaction-model-error.js +6 -0
  814. package/dist/react/use-opencode-sessions/parts.d.ts +12 -0
  815. package/dist/react/use-opencode-sessions/parts.js +31 -0
  816. package/dist/react/use-opencode-sessions/permissions.d.ts +5 -0
  817. package/dist/react/use-opencode-sessions/permissions.js +44 -0
  818. package/dist/react/use-opencode-sessions/projects.d.ts +6 -0
  819. package/dist/react/use-opencode-sessions/projects.js +49 -0
  820. package/dist/react/use-opencode-sessions/provider-load-plan.d.ts +5 -0
  821. package/dist/react/use-opencode-sessions/provider-load-plan.js +3 -0
  822. package/dist/react/use-opencode-sessions/providers.d.ts +10 -0
  823. package/dist/react/use-opencode-sessions/providers.js +98 -0
  824. package/dist/react/use-opencode-sessions/sessions.d.ts +34 -0
  825. package/dist/react/use-opencode-sessions/sessions.js +330 -0
  826. package/dist/react/use-opencode-sessions/shared.d.ts +10 -0
  827. package/dist/react/use-opencode-sessions/shared.js +36 -0
  828. package/dist/react/use-opencode-sessions/sharing.d.ts +3 -0
  829. package/dist/react/use-opencode-sessions/sharing.js +51 -0
  830. package/dist/react/use-opencode-sessions/tools.d.ts +5 -0
  831. package/dist/react/use-opencode-sessions/tools.js +48 -0
  832. package/dist/react/use-opencode-sessions/vcs.d.ts +7 -0
  833. package/dist/react/use-opencode-sessions/vcs.js +24 -0
  834. package/dist/react/use-ops-overview.d.ts +63 -0
  835. package/dist/react/use-ops-overview.js +15 -0
  836. package/dist/react/use-permission-self-heal.d.ts +10 -0
  837. package/dist/react/use-permission-self-heal.js +114 -0
  838. package/dist/react/use-poll-owner.d.ts +1 -0
  839. package/dist/react/use-poll-owner.js +14 -0
  840. package/dist/react/use-project-apps.d.ts +879 -0
  841. package/dist/react/use-project-apps.js +185 -0
  842. package/dist/react/use-project-config.d.ts +2 -0
  843. package/dist/react/use-project-config.js +16 -0
  844. package/dist/react/use-project-files.d.ts +87 -0
  845. package/dist/react/use-project-files.js +109 -0
  846. package/dist/react/use-project-gateway.d.ts +26 -0
  847. package/dist/react/use-project-gateway.js +111 -0
  848. package/dist/react/use-project-llm-gateway.d.ts +6 -0
  849. package/dist/react/use-project-llm-gateway.js +20 -0
  850. package/dist/react/use-project-models.d.ts +4 -0
  851. package/dist/react/use-project-models.js +31 -0
  852. package/dist/react/use-project-name.d.ts +4 -0
  853. package/dist/react/use-project-name.js +35 -0
  854. package/dist/react/use-project-secrets.d.ts +279 -0
  855. package/dist/react/use-project-secrets.js +34 -0
  856. package/dist/react/use-project-session.d.ts +4 -0
  857. package/dist/react/use-project-session.js +18 -0
  858. package/dist/react/use-project-sessions.d.ts +447 -0
  859. package/dist/react/use-project-sessions.js +86 -0
  860. package/dist/react/use-project-starter-suggestions.d.ts +2 -0
  861. package/dist/react/use-project-starter-suggestions.js +13 -0
  862. package/dist/react/use-project-triggers.d.ts +221 -0
  863. package/dist/react/use-project-triggers.js +53 -0
  864. package/dist/react/use-prompt-attachments.d.ts +3 -0
  865. package/dist/react/use-prompt-attachments.js +34 -0
  866. package/dist/react/use-provider-secrets.d.ts +229 -0
  867. package/dist/react/use-provider-secrets.js +38 -0
  868. package/dist/react/use-question-self-heal.d.ts +7 -0
  869. package/dist/react/use-question-self-heal.js +81 -0
  870. package/dist/react/use-reminders.d.ts +501 -0
  871. package/dist/react/use-reminders.js +51 -0
  872. package/dist/react/use-runtime-boot-stalled.d.ts +2 -0
  873. package/dist/react/use-runtime-boot-stalled.js +18 -0
  874. package/dist/react/use-runtime-phase.d.ts +2 -0
  875. package/dist/react/use-runtime-phase.js +13 -0
  876. package/dist/react/use-runtime-reconnect.d.ts +52 -0
  877. package/dist/react/use-runtime-reconnect.js +248 -0
  878. package/dist/react/use-runtime-supports.d.ts +2 -0
  879. package/dist/react/use-runtime-supports.js +5 -0
  880. package/dist/react/use-sandbox-image.d.ts +33 -0
  881. package/dist/react/use-sandbox-image.js +119 -0
  882. package/dist/react/use-session-audit.d.ts +4 -0
  883. package/dist/react/use-session-audit.js +25 -0
  884. package/dist/react/use-session-message-authors.d.ts +1 -0
  885. package/dist/react/use-session-message-authors.js +14 -0
  886. package/dist/react/use-session-messages.d.ts +11 -0
  887. package/dist/react/use-session-messages.js +62 -0
  888. package/dist/react/use-session-model-selection.d.ts +8 -0
  889. package/dist/react/use-session-model-selection.js +20 -0
  890. package/dist/react/use-session-model-usage.d.ts +1 -0
  891. package/dist/react/use-session-model-usage.js +13 -0
  892. package/dist/react/use-session-participants.d.ts +4 -0
  893. package/dist/react/use-session-participants.js +13 -0
  894. package/dist/react/use-session-phase.d.ts +8 -0
  895. package/dist/react/use-session-phase.js +9 -0
  896. package/dist/react/use-session-picks.d.ts +13 -0
  897. package/dist/react/use-session-picks.js +65 -0
  898. package/dist/react/use-session-prefetch.d.ts +6 -0
  899. package/dist/react/use-session-prefetch.js +22 -0
  900. package/dist/react/use-session-prompts.d.ts +53 -0
  901. package/dist/react/use-session-prompts.js +378 -0
  902. package/dist/react/use-session-send.d.ts +97 -0
  903. package/dist/react/use-session-send.js +233 -0
  904. package/dist/react/use-session-start-give-up.d.ts +19 -0
  905. package/dist/react/use-session-start-give-up.js +59 -0
  906. package/dist/react/use-session-stream.d.ts +17 -0
  907. package/dist/react/use-session-stream.js +181 -0
  908. package/dist/react/use-session-sync.d.ts +43 -0
  909. package/dist/react/use-session-sync.js +252 -0
  910. package/dist/react/use-session-transcript-history.d.ts +6 -0
  911. package/dist/react/use-session-transcript-history.js +38 -0
  912. package/dist/react/use-session-working.d.ts +37 -0
  913. package/dist/react/use-session-working.js +217 -0
  914. package/dist/react/use-session.d.ts +201 -0
  915. package/dist/react/use-session.js +893 -0
  916. package/dist/react/use-sessions-needing-input.d.ts +5 -0
  917. package/dist/react/use-sessions-needing-input.js +23 -0
  918. package/dist/react/use-static-file-preview.d.ts +9 -0
  919. package/dist/react/use-static-file-preview.js +72 -0
  920. package/dist/react/use-system-status.d.ts +38 -0
  921. package/dist/react/use-system-status.js +5 -0
  922. package/dist/react/use-teams-installations.d.ts +41 -0
  923. package/dist/react/use-teams-installations.js +95 -0
  924. package/dist/react/use-tunnel.d.ts +165 -0
  925. package/dist/react/use-tunnel.js +186 -0
  926. package/dist/react/use-visible-agents.d.ts +9 -0
  927. package/dist/react/use-visible-agents.js +12 -0
  928. package/dist/react/use-wake-escalation.d.ts +31 -0
  929. package/dist/react/use-wake-escalation.js +82 -0
  930. package/dist/transcript.d.ts +50 -0
  931. package/dist/transcript.js +93 -0
  932. package/dist/workspace-search/client.d.ts +19 -0
  933. package/dist/workspace-search/client.js +229 -0
  934. package/dist/workspace-search/core.d.ts +21 -0
  935. package/dist/workspace-search/core.js +259 -0
  936. package/dist/workspace-search/index.d.ts +2 -0
  937. package/dist/workspace-search/index.js +2 -0
  938. package/package.json +178 -0
package/README.md ADDED
@@ -0,0 +1,1234 @@
1
+ # @beeuni/sdk
2
+
3
+ The **single, opinionated data layer** for the Beeuni API. One typed
4
+ client wraps both the **Beeuni REST API** and the **agent runtime** so a
5
+ host app — web, mobile, reference — imports **only `@beeuni/sdk`**. The SDK
6
+ owns its types: the transcript is Beeuni's own format (`beeuni.transcript.v1`),
7
+ and the package depends on no harness SDK. (The no-raw-`backendApi`/`authenticatedFetch` rule
8
+ below is the target state, not yet fully true of apps/web — see Rules of the
9
+ road.)
10
+
11
+ > Philosophy: **one Beeuni token, one client, every action a method.** Keys never
12
+ > leave the server; mutations own their side-effects there; the host states intent.
13
+
14
+ 📖 **Full documentation:** [beeuni.ai/docs/sdk](https://beeuni.ai/docs/sdk) —
15
+ getting started, the full client, sessions, React hooks, and the subpath modules.
16
+ The REST API has an auto-generated reference at
17
+ [api.beeuni.ai/v1/docs](https://api.beeuni.ai/v1/docs).
18
+
19
+ ---
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install @beeuni/sdk
25
+ ```
26
+
27
+ ```ts
28
+ import { createBeeuni } from "@beeuni/sdk";
29
+
30
+ const beeuni = createBeeuni({
31
+ backendUrl: "https://api.beeuni.ai/v1",
32
+ getToken,
33
+ });
34
+ await beeuni.projects.list();
35
+ ```
36
+
37
+ ### Call external systems through Connectors
38
+
39
+ Use one data plane for every Connector provider. A user token binds
40
+ the project explicitly. An agent-minted session token already carries its
41
+ project scope, so it can use the top-level fallback.
42
+
43
+ ```ts
44
+ const connectors = projectId
45
+ ? beeuni.project(projectId).connectors
46
+ : beeuni.connectors;
47
+
48
+ await connectors.catalog();
49
+ await connectors.tools();
50
+ await connectors.search('send email');
51
+ await connectors.describe('gmail.send_email');
52
+ await connectors.call('gmail.send_email', { to, subject, body });
53
+ await connectors.accounts('gmail');
54
+ const { ref } = await connectors.uploadAttachment(bytes, {
55
+ filename: 'invoice.pdf',
56
+ contentType: 'application/pdf',
57
+ connector: 'microsoft-graph', // the connector the file is for
58
+ });
59
+ // `ref` is { $beeuni_attachment: '<id>' }. The gateway swaps in the file:
60
+ // as an attachments[] element it becomes the provider's attachment item,
61
+ // in a string field it becomes the base64. The bytes never enter call args.
62
+ await connectors.call('microsoft-graph.sendmail', {
63
+ user: 'sender@example.com',
64
+ body: { message: { subject: 'Invoice', attachments: [ref] } },
65
+ });
66
+ ```
67
+
68
+ A Connector defines callable tools. A Connection stores one authorization for
69
+ that Connector. Credentials remain server-side and never enter the sandbox.
70
+
71
+ #### Typed calls
72
+
73
+ `beeuni connectors types --out beeuni-connectors.d.ts` writes a declaration
74
+ file that fills `ConnectorActionRegistry`. `callAction` then types `args` and
75
+ `output` from it. The request and the result are the same as `call`:
76
+
77
+ ```ts
78
+ const r = await connectors.callAction('linear', 'list_issues', { team: 'CORE' });
79
+ r.output?.issues; // typed from the action's output schema
80
+ ```
81
+
82
+ One connector as a handle: `run` returns the output itself and throws
83
+ `ConnectorCallError` (`code`, `connectUrl`, `availableAccounts`,
84
+ `upstreamStatus`, `retryAfterSeconds`) or `ConnectorApprovalPendingError`;
85
+ `paginate` follows a cursor and throws `ConnectorPageLimitError` (with
86
+ `nextArgs`) past `maxPages`; `useConnectorQuery` (`@beeuni/sdk/react`) caches a
87
+ read. Guide: `/docs/sdk/connectors`; runnable: `examples/13-connectors-as-code.ts`.
88
+
89
+ ```ts
90
+ const linear = beeuni.project(projectId).connector('linear');
91
+ const { issues } = await linear.run('list_issues', { team: 'CORE' });
92
+ await linear.describe(); // actions with input and output schemas
93
+ await linear.accounts();
94
+ ```
95
+
96
+ An action outside the file accepts any object and returns `output: unknown`.
97
+ Managed Composio and Pipedream connectors publish no output schema, so their
98
+ `output` stays `unknown`. `ConnectorArgs<'linear', 'list_issues'>` and
99
+ `ConnectorResult<'linear', 'list_issues'>` name the same types.
100
+
101
+ #### Choose which account a call runs as
102
+
103
+ One Connector can hold the project's shared account and each member's own. List
104
+ the accounts a caller may use, then name one on the call:
105
+
106
+ ```ts
107
+ const accounts = await connectors.accounts('gmail');
108
+ // [{ connection_id, label, owner_type: 'project' | 'member', is_default }]
109
+
110
+ const result = await connectors.call('gmail.send_email', { to, subject, body }, {
111
+ account: 'Support inbox', // a label, a connection id, `me`, or `project`
112
+ });
113
+ result.account; // { connection_id, label, owner_type } — the identity that ran
114
+ ```
115
+
116
+ `account` takes a connection label (case-insensitive), a connection id, or one
117
+ of two selector words: `me` (the caller's own default private account) and
118
+ `project` (the default account shared with the whole project). Omit it and
119
+ resolution takes the caller's own default first, then the project's.
120
+
121
+ A named account is never silently substituted. If it does not match one this
122
+ caller is entitled to, the call is denied with `connector_not_connected` and the
123
+ denial lists the accounts that were available. Every successful call echoes
124
+ `account`, so a transcript can always show which identity acted.
125
+
126
+ Nothing connected yet? Start a hosted authorization and say who the new account
127
+ belongs to:
128
+
129
+ ```ts
130
+ await project.connectors.pipedream.connect('gmail', { owner: 'me' }); // my own
131
+ await project.connectors.pipedream.connect('gmail', { owner: 'project' }); // shared
132
+
133
+ // Or hand a human a link instead of authorizing inline:
134
+ await project.setupLinks.requestConnector({ slug: 'gmail', owner: 'project' });
135
+ ```
136
+
137
+ `owner` defaults to `me`. Creating a `project`-owned account requires
138
+ `project.connector.write`.
139
+
140
+ #### Call from an App, a Convex action, or a script
141
+
142
+ The call is the same everywhere. The credential decides which accounts it
143
+ reaches:
144
+
145
+ | Where the code runs | `createBeeuni` options | Acts as | Reaches |
146
+ |---|---|---|---|
147
+ | App, browser | `backendUrl: '/_beeuni/api/v1'`, `getToken: beeuniAppViewerToken()` | the viewer | shared accounts the viewer may use, and the viewer's own private accounts |
148
+ | App, server | `createAppViewerBeeuni(request, { backendUrl })` | the viewer | the same |
149
+ | Convex action, App job with no viewer | `getToken: async () => process.env.BEEUNI_API_KEY!` (a `beeuni_sa_…` service account bearer a person minted) | the service account | shared accounts nobody narrowed; never a private account |
150
+ | External program, CI | `getToken: async () => process.env.BEEUNI_API_KEY!` (a `beeuni_pat_…`) | you | your shared and private accounts |
151
+
152
+ The browser path needs the App's viewer scope set to `api`
153
+ (`beeuni apps access <app> --viewer api`); with `identity` a call answers
154
+ `403 insufficient_scope`. A service account answers `403` until a person
155
+ grants it a project role (`beeuni access grant --service-account <id> --role
156
+ member --project <id>`). Never put a provider API key in an App or a Convex
157
+ deployment when a connector exists. Guide: `/docs/sdk/connectors`.
158
+
159
+ ### Upload prompt attachments before Send
160
+
161
+ Create one controller per composer. `add(file)` starts a private project upload
162
+ without waiting for a session runtime. Subscribe to `getSnapshot()` for tile state.
163
+
164
+ ```ts
165
+ const attachments = beeuni.project(projectId).attachments.createController();
166
+ const localId = attachments.add(file);
167
+ const unsubscribe = attachments.subscribe(() => render(attachments.getSnapshot()));
168
+
169
+ // Inside the submit handler. Send never waits for uploads.
170
+ const ids = attachments.getSnapshot().attachments.map((item) => item.id);
171
+ attachments.submit(ids); // hand-off: the composer clears, the uploads continue
172
+ paintMessage(text, ids);
173
+ try {
174
+ const parts = await attachments.whenReady(ids); // handle-only parts, in `ids` order
175
+ await beeuni.session(projectId, sessionId).prompts.create({
176
+ clientMessageId,
177
+ messageId,
178
+ parts: [{ type: 'text', text }, ...parts],
179
+ });
180
+ attachments.forget(ids); // release; does not delete storage objects
181
+ } catch (error) {
182
+ attachments.reclaim(ids); // back to the composer, with the failed file's state
183
+ }
184
+ ```
185
+
186
+ React consumers use `usePromptAttachments(projectId)` from `@beeuni/sdk/react`.
187
+ It returns the controller methods plus the reactive `attachments` list. It omits
188
+ `dispose`, `subscribe`, and `getSnapshot`, and keeps its identity until the list
189
+ changes.
190
+
191
+ Files move through `pending`, `uploading`, `processing`, `ready`, `error`, or
192
+ `aborted`. Progress counts bytes sent. Progress snapshots are throttled: one per
193
+ whole-percent change, at most ten per second per upload. The default concurrency
194
+ is two files.
195
+ Limits are 50 MiB per file, 100 MiB per message, and 20 files. Empty files are
196
+ rejected. Refuse Send only while a selected file is `error` or `aborted`.
197
+
198
+ `whenReady(ids, { signal })` resolves once every upload is `ready`. It rejects
199
+ when one fails, is aborted or removed, or `signal` aborts. A rejected wait does
200
+ not stop the upload.
201
+
202
+ Ownership: `submit(ids)` hands entries to one send. They leave `attachments` and
203
+ stop counting toward the limits. `dispose()` aborts and deletes only listed
204
+ work, so a composer that unmounts after Send (a navigation, a remount) does not
205
+ cancel its held uploads. The controller object lives as long as the send's `whenReady`
206
+ promise references it. Call `forget(ids)` after the prompt POST succeeds, or
207
+ `reclaim(ids)` when a failed send restores its draft. `forget()` with no argument
208
+ releases only the listed selection. A host that keeps a failed send on screen
209
+ keeps its entries: `retry(id)` reaches a handed-off entry after `dispose()`.
210
+
211
+ `retry(localId)` resumes the same upload and preserves the original File. After
212
+ `attachment_size_mismatch` or `attachment_failed` the server keeps no usable
213
+ handle, so `retry` uploads the File again as a new attachment. An expired upload
214
+ cannot retry: `retry` throws, and the item error carries code
215
+ `attachment_expired`. `remove(localId)` removes the entry, aborts its upload, and
216
+ resolves at once. It deletes unbound storage best-effort and never rejects; a
217
+ failed or refused DELETE leaves the object to the 24-hour expiry.
218
+ `abort(localId)` cancels unfinished work. `dispose()` aborts listed work and
219
+ deletes its uploads best-effort: no send holds them, and drafts keep no handle.
220
+ Call it on non-React cleanup; the hook handles unmount and project changes.
221
+ Unused uploads expire after 24 hours.
222
+
223
+ Selections live in memory only. Never persist a File, blob URL, signed URL, or
224
+ upload handle in a draft.
225
+
226
+ For non-composer uploads, call `beeuni.project(projectId).attachments.upload(file,
227
+ { signal, onProgress, onUpload, resume })`. The server selects the transport in the
228
+ handle's `upload` field:
229
+
230
+ - `kind: 'direct'` (default): one `PUT` of the whole file to `upload.url` with
231
+ `upload.headers` and no Authorization header. Hosts with `XMLHttpRequest`
232
+ (browsers, React Native) report sent bytes; other hosts use `fetch` and report
233
+ 0, then the full size. An expired URL, or one Storage refuses with 400/401/403,
234
+ is re-signed once for the same `attachment_id`; the server creates no second
235
+ upload. A `409` from Storage means an earlier attempt already stored the file.
236
+ - `kind: 'chunked'`: sequential authenticated `PUT`s of `upload.chunk_size` bytes.
237
+ The SDK accepts any positive `chunk_size`. Only a deployment whose edge drops
238
+ large request bodies selects it.
239
+
240
+ Completion then verifies the stored bytes. Retain the `onUpload` handle for manual
241
+ same-ID recovery. If completion answers `409 attachment_not_uploaded`, `onUpload`
242
+ reports the direct handle with `received_bytes: 0`, so a resume sends the file
243
+ again. Initiation, the upload, and completion retry timeouts, network errors,
244
+ 429, and 5xx with jittered exponential backoff. The budget is 60 seconds from the
245
+ first failure, so a long upload that fails late still retries. Completion also
246
+ retries `attachment_processing`, with a five-minute budget. Initiation never
247
+ retries 402 (a `BillingError`: the account cannot run) or 429
248
+ `attachment_budget_exceeded` (40 unfinished uploads or 500 MiB of unsent uploads
249
+ for the user; unused uploads expire within 24 hours). The server answers or
250
+ refuses one completion within 105 seconds; each completion request allows 120
251
+ seconds. Caller aborts never retry.
252
+
253
+ A sent attachment's reference is released 1 hour after its prompt is delivered,
254
+ and when its session or project is deleted. The next maintenance sweep then
255
+ removes the file, and its `attachment_id` can no longer be sent.
256
+ Completed `attachment_id` parts use platform prompt routes. Runtime `sendParts`
257
+ continues to accept runtime URL parts. Legacy platform URL parts remain supported.
258
+
259
+ ## No bundler, no framework
260
+
261
+ The published package ships a browser IIFE bundle alongside its ESM `dist/` —
262
+ no build step required:
263
+
264
+ ```html
265
+ <script src="https://unpkg.com/@beeuni/sdk"></script>
266
+ <script>
267
+ const beeuni = Beeuni.createBeeuni({ backendUrl, getToken });
268
+ </script>
269
+ ```
270
+
271
+ > **CORS:** a `<script>` page calls the API from its own origin, so that origin
272
+ > must be in the API's CORS allowlist. Beeuni's own domains and `localhost:3000/3010`
273
+ > are allowed out of the box; any third-party origin (or a local page on another
274
+ > port) needs adding via the API's `CORS_ALLOWED_ORIGINS` — otherwise the browser
275
+ > blocks the request before it leaves the page. A Beeuni-hosted App needs no
276
+ > allowlist entry: it sets `backendUrl: '/_beeuni/api/v1'`, its own origin
277
+ > (see "A Beeuni-hosted App is already signed in").
278
+
279
+ ## Entry points
280
+
281
+ `@beeuni/sdk` is the canonical entry — everything framework-free lives there.
282
+ Four others exist, each for a reason that fits in one sentence:
283
+
284
+ | Entry | Why it is separate |
285
+ | ----------------------------- | ---------------------------------------------------------- |
286
+ | `@beeuni/sdk/react` | React is a peer dependency |
287
+ | `@beeuni/sdk/server` | imports `node:async_hooks` |
288
+ | `@beeuni/sdk/wire-message-id` | the wire-id clock alone, one file with no imports (also at root) |
289
+ | `@beeuni/sdk/internal/*` | unsupported, outside semver |
290
+
291
+ Install the optional peers before you use the React entry:
292
+
293
+ ```bash
294
+ npm install @beeuni/sdk react @tanstack/react-query
295
+ ```
296
+
297
+ Older subpaths (`@beeuni/sdk/projects-client`, `/turns`, …) still work and are
298
+ `@deprecated`. Import from the root instead — see **Entry points** below for
299
+ the four that are real, and **API-MAP.md**'s Stability table for the full
300
+ list of aliases (20 of them).
301
+
302
+ > **React Native / Expo:** REST works. Live streaming works with a host
303
+ > transport: pass `configureBeeuni({ eventStreamTransport })` (one connection's
304
+ > messages over the wire your runtime has, e.g. `react-native-sse`), and report
305
+ > foreground and network changes with `notifyHostSignal`. `apps/mobile` runs
306
+ > `useSession` from `@beeuni/sdk/react` this way.
307
+
308
+ ## Quick start
309
+
310
+ ```ts
311
+ import { createBeeuni } from "@beeuni/sdk";
312
+
313
+ const beeuni = createBeeuni({
314
+ backendUrl: "https://api.beeuni.ai/v1",
315
+ getToken: () =>
316
+ supabase.auth
317
+ .getSession()
318
+ .then((s) => s.data.session?.access_token ?? null),
319
+ });
320
+
321
+ // Projects
322
+ const projects = await beeuni.projects.list();
323
+ const detail = await beeuni.project(pid).detail();
324
+ await beeuni.project(pid).secrets.upsert({
325
+ name: "LOCAL_TOOL_TOKEN",
326
+ value,
327
+ strategy: "runtime",
328
+ consumer: "sandbox",
329
+ });
330
+ // Who can use a value: [] = everyone (default), or people and groups. A
331
+ // narrowed value reaches only them — directly, or in their own private
332
+ // sessions; never a shared session or a trigger.
333
+ await beeuni.project(pid).secrets.upsert({
334
+ name: "DEEL_API_TOKEN",
335
+ value: deelToken,
336
+ strategy: "broker",
337
+ consumer: "connector",
338
+ shared_with: [{ principal_type: "user", principal_id: userId }],
339
+ });
340
+ await beeuni.project(pid).secrets.upsert({
341
+ identifier: "anthropic-primary",
342
+ name: "ANTHROPIC_API_KEY",
343
+ value: providerKey,
344
+ strategy: "broker",
345
+ consumer: "llm_gateway",
346
+ });
347
+ // When pooled_provider_secrets and llm_gateway are enabled for the project,
348
+ // a new account secret is available to this project's members by default.
349
+ const shared = await beeuni.accounts.secretResources.create(accountId, {
350
+ project_id: pid,
351
+ label: "Anthropic backup",
352
+ provider_id: "anthropic",
353
+ name: "ANTHROPIC_API_KEY",
354
+ value: providerKey,
355
+ consumer: "llm_gateway",
356
+ strategy: "broker",
357
+ });
358
+ // Restrict it to selected members when needed. The creator keeps access.
359
+ await beeuni.accounts.secretResources.setAccess(accountId, shared.secret_id, "members", [memberUserId]);
360
+ await beeuni.session(pid, sid).providerSecretPool.set("anthropic", [shared.secret_id]);
361
+ const { pools, can_edit } = await beeuni.session(pid, sid).providerSecretPool.list();
362
+ // Passing null to set() resets the session to the project default.
363
+ const visibleSessions = await beeuni.project(pid).sessions.list();
364
+ const projectInventory = await beeuni
365
+ .project(pid)
366
+ .sessions.list({ scope: "project" }); // manager only; inaccessible rows omitted
367
+ // Top-level sessions the caller started; spawned sessions load under their parent.
368
+ const mine = await beeuni.project(pid).sessions.list({ parent: "root", startedBy: "me" });
369
+ const found = await beeuni.project(pid).sessions.list({ parent: "root", q: "nightly" }); // searches every visible session
370
+ const spawned = await beeuni.project(pid).sessions.list({ parent: mine[0].session_id });
371
+ // React: useProjectSessions(pid, { parent: "root", startedBy: "me" }), useSessionChildren(pid, parentId)
372
+ const warm = await beeuni.project(pid).sessions.ensureWarm(); // ordinary session, pre-created
373
+
374
+ // Sessions (id-bound handle)
375
+ const s = beeuni.session(pid, sid);
376
+ const cost = await s.cost(); // reads finalized LLM + compute cost; no runtime start
377
+ await s.send("Build me a widget"); // provisions/resumes if needed, then prompts
378
+ await s.rewind(userMessageId); // stages a reversible rollback on this session
379
+ await s.restoreRewind(); // restores the removed path before the next prompt
380
+ await s.previews();
381
+ await s.participants(); // who can open the session
382
+ await s.reloadConfig({ refresh_repo: false });
383
+ await s.reloadConfigStream(
384
+ { refresh_repo: false },
385
+ (event) => event.type === "phase" && console.log(event.phase),
386
+ );
387
+
388
+ // The session verbs, bound to THIS session's own runtime (each provisions it first).
389
+ const { messages, hasMore } = await s.messages({ limit: 50 }); // { info, parts }[], oldest first
390
+ const { statuses, permissions, questions } = await s.pending();
391
+ await s.answerPermission(permissions[0].id, "once"); // "once" | "always" | "reject"
392
+ await s.answerQuestion(questions[0].id, [["Yes"]]); // null dismisses it
393
+ await s.compact(); // only when health() lists `session.compact`
394
+ ```
395
+
396
+ React consumers use `useAccountSecretResources(accountId)` and
397
+ `useSessionProviderSecretPools(projectId, sessionId)` from `@beeuni/sdk/react`.
398
+ The latter exposes `setPool.mutate({ providerId, secretIds })`. `null` restores
399
+ inheritance; `[]` disables that provider for the session. Empty configured pools
400
+ remain listed after their last resource is deleted. Successful writes refresh
401
+ both the pool list and the session's provider-specific query cache.
402
+
403
+ ### Apps
404
+
405
+ `beeuni.project(projectId).apps` deploys immutable App releases behind one stable URL, on the Fly.io model: releases, machines per process group, persistent volumes. New Apps use `private` access. Apps is an experimental project feature, so API operations return `404` until a project manager enables it.
406
+
407
+ ```ts
408
+ const apps = beeuni.project(projectId).apps;
409
+ const app = await apps.create({ slug: 'docs', name: 'Docs' });
410
+ const artifact = await apps.artifacts.uploadArchive(tarGzBytes);
411
+ await apps.deployments.create(app.app_id, {
412
+ artifact_id: artifact.artifact_id,
413
+ source: { kind: 'static', spa: true },
414
+ });
415
+ await apps.access.update(app.app_id, {
416
+ mode: 'restricted',
417
+ member_ids: [memberId],
418
+ group_ids: [groupId],
419
+ });
420
+ const browserSession = await apps.access.session(app.app_id);
421
+ ```
422
+
423
+ Access modes are `private`, `project`, `restricted`, `public`, and `password`. An access session exchanges a five-minute URL for an eight-hour, host-only cookie. A stopped or idle App resumes on the same public request. Transient machine requests receive `202 app_starting` and `Retry-After: 3`.
424
+
425
+ Branch on `app.capabilities` (`machines`, `scale`, `exec`, `volumes`, `snapshots`, `static`, …). A call for a capability the App lacks answers `409 app_capability_unsupported`. A backend (database, Convex) is an ordinary server App with a volume; there is no backend type.
426
+
427
+ `apps.list()` returns only the Apps the caller may open under each App's access policy (a project manager sees all), so `viewer_can_access` is `true` on every listed App. A `get` of an App the caller cannot open answers `404`. Apps have no budget: account credits pay for App compute. An always-on App bills its machines 24/7; an on-demand App only while awake.
428
+
429
+ ```ts
430
+ await apps.deployments.create(api.app_id, {
431
+ artifact_id, source: { kind: 'oci_image', image, command: ['node', 'server.js'] },
432
+ config: { // the release config (beeuni.yaml apps.<name> ≈ fly.toml)
433
+ processes: { app: '', worker: 'node worker.js' },
434
+ http_service: { internal_port: 3000, access: 'app', processes: ['app'] },
435
+ mounts: [{ source: 'data', destination: '/data', initial_size_gb: 10, processes: ['app'] }],
436
+ },
437
+ });
438
+ const machines = await apps.machines.list(api.app_id); // machine_id stays across releases
439
+ await apps.scale(api.app_id, { worker: 3 }); // 0-20 per group, applied in the background
440
+ const { exit_code, stdout } = await apps.exec(api.app_id, { command: ['ls', '/data'] }); // project.app.admin
441
+ const [data] = await apps.volumes.list(api.app_id);
442
+ const snap = await apps.volumes.snapshot(api.app_id, data.volume_id);
443
+ await apps.volumes.restore(api.app_id, data.volume_id, snap.snapshot_id); // project.app.admin
444
+ await apps.update(site.app_id, { uses: ['api'], labels: ['frontend'] }); // the site may mint api tokens and bind to it
445
+ ```
446
+
447
+ `@beeuni/sdk/react` adds `useAppMachines`, `useAppVolumes`, and `useAppVolumeSnapshots`.
448
+
449
+ `send()` reads the persisted session model and
450
+ agent before the first prompt on a handle. This prevents a snapshot-inherited
451
+ runtime session from reusing stale snapshot defaults. A per-call choice
452
+ overrides a `setModel()` or `setAgent()` choice. A handle choice overrides the
453
+ persisted session default.
454
+
455
+ ### Saved session attachments
456
+
457
+ `session.attachments.upload(file)` stores up to 50 MiB in private object storage. It
458
+ returns `{ attachment_id, filename, mime, size, url }`. Use `url` in a file part sent to
459
+ the prompt inbox. The API copies those bytes into the sandbox after startup. Uploads and `session.attachments.read(attachment_id)` do not start a
460
+ sandbox. Reads return a `Blob` and require access to the session. Retries of the same `File`
461
+ reuse the successful upload; an explicit `attachmentId` supports caller-managed retries.
462
+
463
+ ### Session labels and metadata
464
+
465
+ Every session carries `labels: string[]` and a free-form `metadata` object. Set both
466
+ at `project.sessions.create({ labels, metadata })`. `session.update({ labels })`
467
+ replaces the labels; `session.update({ metadata })` merges keys, and a `null` value
468
+ removes a key. `project.sessions.listPage({ labels })` returns only sessions that carry
469
+ every given label, and `useProjectSessions(projectId, { labels })` does the same in
470
+ React. Each label is 1–64 characters, at most 20 per session; one metadata write is at
471
+ most 16,384 characters of JSON. Example: `examples/12-session-labels.ts`.
472
+
473
+ ### Who wrote each message
474
+
475
+ `beeuni.session(projectId, sessionId).messageAuthors()` (or `getSessionMessageAuthors`) returns
476
+ `{ authors, initial_author }`: `authors` maps a runtime message id to a `SessionMessageAuthor`,
477
+ `{ kind: 'member', user_id, name, email, avatar_url }` or `{ kind: 'session', session_id, name, agent? }`.
478
+ In React, `useSessionMessageAuthors(projectId, sessionId, messageCount)` reads the same data.
479
+
480
+ ### Which model answered a turn
481
+
482
+ `beeuni.session(projectId, sessionId).modelUsage()` (or `getSessionModelUsage`) returns
483
+ `{ latest, billed_cost, turns }` from the gateway's request record. `latest` is
484
+ `{ served_model, fallback_from, at }` for the newest answered request: `served_model` is the model
485
+ that answered, and `fallback_from` is the routed model when a fallback model answered in its place.
486
+ `turns` maps the runtime message id of each prompt to `{ served_models, fallback_from, billed_cost }`.
487
+ A transcript message carries only the model its turn asked for. In React,
488
+ `useSessionModelUsage(projectId, sessionId)` reads the same record.
489
+
490
+ ### React runtime
491
+
492
+ `useSession(projectId, sessionId)` opens the session runtime returned by
493
+ `POST /start`. The runtime is OpenCode or pi; the hook reads the same routes,
494
+ transcript and events from both. The hook owns messages, rewind and restore,
495
+ cancellation, commands, permissions, and questions. Hosts do not construct
496
+ runtime routes. A feature one harness lacks is a capability: gate its control
497
+ with `runtimeSupports(health?.capabilities, 'session.rewind')`. pi lists
498
+ `session.subagents` only, so rewind, compaction, slash commands, the todo list
499
+ and the runtime config document stay hidden or empty on a pi session.
500
+
501
+ Every session saves its transcript at the end of each turn. `useSession` reads saved
502
+ messages from the platform database while `/start` continues. It uses the
503
+ server-validated runtime session id and lets the live read reconcile the saved messages by ID.
504
+ A live read that returns no messages keeps the saved messages on screen: it means the computer
505
+ lost its state, not that the conversation is empty. The first live read with messages reconciles them.
506
+ Missing or rejected history falls back to the existing runtime path.
507
+
508
+ `useSession().savedTranscript` says whether that saved conversation can show before the
509
+ computer wakes: `loading` while a saved copy may still arrive, `shown` once messages are in
510
+ `messages`, and `none` when nothing can show until the runtime answers. A host renders
511
+ placeholder rows on `loading` and its boot screen only on `none`.
512
+ `useSession().conversationEmpty` is true when the saved copy proves the conversation empty
513
+ (a complete read of the runtime found no messages), no turn ended since, and nothing is open
514
+ or queued. A host renders the composer then, not a boot screen.
515
+
516
+ A host that registers a saved-copy store (`setSavedCopyStore(createSavedCopyStore({ storage,
517
+ userId }))`) gets the kept copy painted before the first frame; the server's copy reconciles
518
+ into it by message ID. `createPersistedQueryCache` does the same for accounts, projects and
519
+ the paged session list. Both are per user and bounded; clear both on sign-out. Session
520
+ states have one set of words for every host: `sessionListStatus`, `SESSION_LIST_STATUS`,
521
+ `sessionConnectionLabel`, `SESSION_NOTICE`, and `turnRetryLabel`.
522
+
523
+ A server-rendered host can seed a known runtime session pin while `/start` runs:
524
+
525
+ ```tsx
526
+ useSession(projectId, sessionId, {
527
+ initialRuntimeSessionId: persistedSession.runtime_session_id ?? persistedSession.opencode_session_id,
528
+ });
529
+ ```
530
+
531
+ Use only a pin that the host authorized for the same `(projectId, sessionId)`.
532
+ The seed hydrates cached content. It does not choose the runtime identity.
533
+ The pin returned by `/start` always replaces a stale seed. The SDK also scopes
534
+ runtime query and synchronization controllers to the sandbox runtime. Two
535
+ sandboxes cannot share browser cache state when a snapshot exposes the same
536
+ runtime session id during adoption. `opencode_session_id` is the older name
537
+ of `runtime_session_id`; read it only as the fallback above.
538
+
539
+ After a project replaces its repository, a session created before the
540
+ replacement still starts. It runs the project's CURRENT config release and
541
+ converges like any other session. What stays true of it is physical: its
542
+ `/workspace` clone came from the old repository while `origin` now resolves to
543
+ the new one. The two histories are unrelated, so a push from that clone needs a
544
+ rebase first.
545
+
546
+ `repositoryMode: 'previous'` is accepted and changes nothing:
547
+
548
+ ```tsx
549
+ useSession(projectId, sessionId, { repositoryMode: 'previous' });
550
+ ```
551
+
552
+ The server reads it as telemetry. Keep it only for callers built against the
553
+ older behaviour.
554
+
555
+ Message retries keep the originating sandbox URL after navigation. A `404` or
556
+ `410` message read stops automatic retries and preserves the cached transcript.
557
+ An explicit reconciliation can recover the controller when the session returns.
558
+
559
+ ## The facade surface
560
+
561
+ `createBeeuni(config)` returns one client. The table below is illustrative, not
562
+ exhaustive — see `API-MAP.md` for the full per-domain surface:
563
+
564
+ | namespace | what |
565
+ |---|---|
566
+ | `beeuni.projects` | list · get · detail · create · provision · update · archive · llmCatalog · modelPicker · sandboxTemplates · sessions (+ more: `listForAccount`, `sandboxHealth`, `createSession`) |
567
+ | `beeuni.accounts` | list · get · create · members · invites · `secretResources.{list,create,rotate,delete,grant,revoke,setAccess}` · `tokens.{list,create,revoke}` (account-scoped CLI PATs, `beeuni_pat_…`) · `audit.{log,export,webhooks.*}` (filterable project/session reconstruction log) · `branding.{get,update,uploadAsset,removeAsset,reset}` (Enterprise organization branding: logo / icon / favicon, light + dark, product name) (+ more: `updateName`, `leave`, `invite`, `removeMember`, `updateMemberRole`) |
568
+ | `beeuni.billing` | entitlement/usage reads: `accountState` · `accountStateMinimal` · `transactions` · `transactionsSummary` · `creditBreakdown` · `usageHistory` · `usageRollup` · `sessionCosts.{list,get}` · `tierConfigurations` — plus a curated mutation surface: `subscription.{createPortalSession,cancel,reactivate,cancelScheduledChange,prorationPreview}` · `credits.{purchase,autoTopupSettings,configureAutoTopup}`. `checkout.{createSession,confirmSession}` and `subscription.scheduleDowngrade` are deprecated: they reject with `ENDPOINT_RETIRED` |
569
+ | `beeuni.marketplace` | public marketplace catalog browse + sources (not project-scoped): `items` · `item` · `itemFile` · `marketplaces` · `featured` · `sources.{list,add,remove}` — distinct from the install-scoped `project(id).marketplace` |
570
+ | `beeuni.github` | account-scoped GitHub App installs and repo linking: `getInstallation` · `listInstallations` · `listLinkableInstallations` (each entry carries `linked_to_other_accounts`, a count and never a tenant name) · `listRepositories` · `listRepositoryBranches` · `linkInstallation` · `saveInstallation` · `deleteInstallation` · `linkRepository` (`source: 'managed'` imports a repository the instance backend holds — instance operator only, and mutually exclusive with `installation_id`) · `replaceProjectRepository` (changes an existing project's repository with an expected old URL; accepts a repository-scoped PAT or a temporary GitHub user proof for a repository-scoped App grant; can atomically copy selected shared runtime secrets from another project in the same account) |
571
+ | `beeuni.gitBackend` | the instance git backend ("Beeuni managed", one per deployment, never an account connection): `get()` → `{configured, kind: 'app'|'pat'|null, owner}` (any authenticated user) · `repositories({search?, limit?})` (instance operator only; 403 otherwise) |
572
+ | `beeuni.notifications` | the caller's notifications, across accounts: `list({ limit?, before? })` (inbox page + `unread_count`) · `markRead({ ids } \| { all: true } \| { sessionId })` · `preferences` · `updatePreferences({ kinds })` (push and email per kind) · `webPushPublicKey` · `registerWebPushSubscription` · `unregisterWebPushSubscription` · `registerDeviceToken` · `unregisterDeviceToken` (native Expo push). Muting one session is `session(pid, sid).setWatch(false)`. Hooks: `useNotificationInbox`, `useNotificationPreferences`, `useSessionWatch`. Inbox rows, Web Push, email, and session watch are served only for projects with the `notification_center` flag on, off by default; with it off, the session creator's phone still gets the push |
573
+ | `beeuni.validateToken()` | pasted-API-key validation helper — `GET /accounts/me`, never throws, resolves `{valid, identity?, error?}` |
574
+ | `beeuni.connectors` | Connector data plane for an agent-minted session token: `catalog` · `tools` · `search` · `describe` · `call` (`{ account }`) · `accounts` · `uploadAttachment` |
575
+ | `beeuni.project(id)` | id-bound handle: `.apps` (stable App URLs, access, artifacts, deployments, logs, rollback, start/stop, machines (`machines.list/start/stop/restart/destroy`, `scale`, `exec`), volumes (`volumes.list/create/update/destroy/snapshots/snapshot/restore/fork`), and `token`) · `.secrets` · `.access` · `.connectors` (data plane + configuration + Connections) · `.policies` · `.triggers` (cron / webhook / monitor / event; `.eventTypes({ connector })` lists a connector's app events) · `.files` · `.git` · `.changeRequests` (incl. `requestChanges`) · `.sessions` · `.tokens` (project-scoped CLI PATs — the `BEEUNI_TOKEN` shape) · `.marketplace` / `.registry` (install/update/remove catalog items) · `.setupLinks.{requestSecret,requestConnector}` (agent-minted secret-entry / connector links) · `.validateManifest` · `.gitToken` · `.setDefaultAgent(name)` · `.session(sid)` (+ more namespaces: `.review`, `.approvals`, `.gateway` (incl. `.routing` and `.playground`), `.channels`, `.modelDefaults`, `.sandbox`) |
576
+ | `beeuni.session(pid, sid)` | id-bound handle: lifecycle (`get`/`update`/`delete`/`start`/`restart`/`stop`/`reloadConfig`/`reloadConfigStream`/`setSharing`/`participants`/`watch`/`setWatch`/`presence`/`previews`/`commit`/`publicShares`/`ensureReady`) · `providerSecretPool.{list,get,set}` · finalized `cost()` · `send`/`abort`/`rewind`/`restoreRewind`/`setModel`/`setAgent` · `transcript()` · `.files` · runtime URL helpers (`health`/`previewUrl`/`proxyUrl`) · runtime REST escape hatches: `stream()` and the deprecated `.runtime` |
577
+ | `beeuni.runtime()` | the runtime REST client for the active sandbox (the SDK's own `RuntimeClient`, frozen at the `@opencode-ai/sdk` 1.18.23 route shapes); use a session-scoped handle in multi-tenant code |
578
+
579
+ Runnable, self-contained scripts for the highest-value flows live in
580
+ [`examples/`](./examples): list projects with a PAT, send + stream, the
581
+ multi-tenant server-wrapper pattern, headless transcript rendering, cost
582
+ pass-through / re-billing, and session files + project secrets. Each file's
583
+ header comment states the env vars and the exact `bun run examples/….ts`
584
+ invocation.
585
+
586
+ Wrapper backends can attach bounded, non-secret scalar context when creating a
587
+ session. It is persisted across cold recovery/replacement restart and exposed
588
+ to the agent only as one `BEEUNI_SESSION_CONTEXT` JSON envelope:
589
+
590
+ ```ts
591
+ await beeuni.project(projectId).sessions.create({
592
+ runtime_context: { workspace_id: "org_123", locale: "de" },
593
+ });
594
+ ```
595
+
596
+ Do not put credentials in this map. For a white-label/backend wrapper, create an
597
+ operator-managed connection, store its credential through the dedicated
598
+ credential endpoint, and pass only the non-secret connection id at session create:
599
+
600
+ ```ts
601
+ const project = beeuni.project(projectId);
602
+ const connection = await project.connectors.connections.reconcile({
603
+ connector_alias: "customer-data",
604
+ owner_type: "external",
605
+ owner_id: wrapperUserId,
606
+ label: "Customer data",
607
+ metadata: { tenant_ref: wrapperTenantReference },
608
+ });
609
+
610
+ // Omit `auth` when creating to apply source-advertised authentication.
611
+ const auth = await project.connectors.auth.discover({
612
+ slug: "hubspot",
613
+ provider: "postman",
614
+ spec: "https://github.com/HubSpot/HubSpot-public-api-spec-collection",
615
+ });
616
+ await project.connectors.connections.updateCredential(connection.connection_id, {
617
+ value: shortLivedCapability,
618
+ kind: "secret",
619
+ });
620
+ await project.sessions.create({
621
+ runtime_context: { locale: "de" },
622
+ connector_bindings: {
623
+ "customer-data": { connection_id: connection.connection_id },
624
+ },
625
+ });
626
+ ```
627
+
628
+ For bring-your-own authorization, each logged-in member creates their own
629
+ connection without supplying an owner id; Beeuni derives ownership from the bearer
630
+ token:
631
+
632
+ ```ts
633
+ const connection = await project.connectors.connections.reconcileMember({
634
+ connector_alias: "gmail",
635
+ label: "My Gmail",
636
+ });
637
+ await project.connectors.connections.pipedreamConnect(connection.connection_id);
638
+ // Complete OAuth, then:
639
+ await project.connectors.connections.pipedreamFinalize(connection.connection_id);
640
+ await project.sessions.create({
641
+ connector_bindings: { gmail: { connection_id: connection.connection_id } },
642
+ });
643
+ ```
644
+
645
+ Member connections are owner-only even for project managers, and sessions using
646
+ one must remain private. A service account — an agent or a trigger — never
647
+ reaches a member connection, only the shared project one. Project defaults
648
+ remain shared; external/agent/subject connections remain operator-managed. Every connection is project/connector scoped
649
+ and resolved on every Connector request, so revocation takes effect without a
650
+ restart. Credentials are encrypted server-side and are never returned, placed
651
+ in `BEEUNI_SESSION_CONTEXT`, or injected into the sandbox environment. Raw env
652
+ and MCP configuration are not session-create inputs.
653
+
654
+ `session.stream()` is a thin facade over the
655
+ framework-free `openEventStream`
656
+ primitive (also exported directly, for hosts that want to manage the client
657
+ themselves): it resolves THIS handle's own runtime (`ensureReady()`), connects
658
+ to that runtime's SSE endpoint, and hands you a `close()`-able handle. No React
659
+ required — safe to call from a server-side "Beeuni as a Backend" wrapper
660
+ (Node/Bun), a worker, or a CLI:
661
+
662
+ ```ts
663
+ const handle = await beeuni.session(pid, sid).stream({
664
+ onEvent: (event) => console.log(event.type, event),
665
+ onGapRehydrate: (gapMs) => console.warn(`reconnected after a ${gapMs}ms gap`),
666
+ });
667
+ // later, to stop:
668
+ handle.close();
669
+ ```
670
+
671
+ `session.stream()` emits the runtime's events (`message.updated`,
672
+ `message.part.updated`, `session.status`, `permission.*`, `question.*`, …),
673
+ the same from OpenCode and pi. Use `useSession()` in React.
674
+
675
+ Events arrive in batches, 16 ms apart. Consecutive `message.part.delta` events
676
+ for one part field in a batch arrive as one event: `properties.delta` is their
677
+ text joined in order, `id` is the last event's id, and `coalesced` lists the
678
+ events it replaced.
679
+
680
+ `@beeuni/sdk/react`'s `useRuntimeEventStream` uses the exact same primitive
681
+ under the hood — it just also writes into the React Query cache.
682
+
683
+ ## Beeuni as a Backend (server-side)
684
+
685
+ `createBeeuni()` stores its config — crucially, the bearer-token getter — in a
686
+ process-wide singleton. That's correct for a host with one config for its whole
687
+ lifetime (a browser tab, a CLI, a single-tenant server), but **unsafe for a
688
+ server process handling concurrent requests for different end users**: two
689
+ in-flight requests racing through `createBeeuni()`/`configureBeeuni()` with
690
+ different tokens clobber each other, and the last write wins for every other
691
+ in-flight request.
692
+
693
+ `@beeuni/sdk/server` (Node/Bun only — never import it from a browser bundle;
694
+ it statically imports `node:async_hooks`) fixes this with `AsyncLocalStorage`:
695
+
696
+ ```ts
697
+ import { createScopedBeeuni } from "@beeuni/sdk/server";
698
+
699
+ // Express/Hono/Bun.serve — any per-request handler. One scoped client PER
700
+ // REQUEST; each end user's token stays isolated to that request's own async
701
+ // call tree, even across `await`s, even under concurrency.
702
+ app.get("/projects", async (req, res) => {
703
+ const beeuni = createScopedBeeuni({
704
+ backendUrl: process.env.BEEUNI_API_URL!,
705
+ getToken: async () => resolveBeeuniTokenFor(req), // per-end-user PAT/token
706
+ });
707
+ res.json(await beeuni.projects.list());
708
+ });
709
+ ```
710
+
711
+ `createScopedBeeuni(config)` has the same shape as `createBeeuni(config)` —
712
+ every method call (including calls through `.project(id)` / `.session(pid, sid)`
713
+ handles minted at call time) automatically runs inside that config's scope, and
714
+ it never writes the process-global singleton. For middleware-style wrapping of
715
+ an entire request body instead, use the lower-level primitive:
716
+
717
+ ```ts
718
+ import { runWithBeeuni } from "@beeuni/sdk/server";
719
+
720
+ app.use(async (req, res, next) => {
721
+ await runWithBeeuni(
722
+ { backendUrl, getToken: async () => resolveBeeuniTokenFor(req) },
723
+ async () => {
724
+ await next(); // every Beeuni call anywhere in this request sees THIS config
725
+ },
726
+ );
727
+ });
728
+ ```
729
+
730
+ A runnable version of the pattern is `examples/03-server-wrapper.ts`, and the
731
+ full production-shaped reference (per-user project isolation, route policy,
732
+ rate limiting, cost markup for re-billing) is `apps/whitelabel-demo` in wrapper
733
+ mode — see its README.
734
+
735
+ ## Rendering chat (the headless chat kit)
736
+
737
+ Everything needed to render an agent transcript without adopting any Beeuni
738
+ UI: `classifyPart`/`classifyTurn` (framework-free, from the root entry)
739
+ normalize all twelve part types of the Beeuni transcript format
740
+ (`beeuni.transcript.v1`; both harnesses emit it) (text, reasoning, tool, file,
741
+ subtask, patch, snapshot, agent, retry, compaction, step, + a forward-compat
742
+ `unknown`) into a typed `ClassifiedPart`, and normalize a failed assistant
743
+ turn's `info.error` into a `{ name, message }` `TurnError` — so "assistant
744
+ message with zero parts but an error" renders as a failure, not silence.
745
+ `renderParts` (`@beeuni/sdk/react`, though it has no React import) requires a
746
+ renderer for **every** part kind at compile time, so a new part type is a
747
+ build error at your call site instead of a silent drop in production:
748
+
749
+ ```tsx
750
+ import { renderParts, type PartRenderers } from "@beeuni/sdk/react";
751
+ import { classifyTurn } from "@beeuni/sdk";
752
+
753
+ const renderers: PartRenderers<React.ReactNode> = {
754
+ text: (p) => <Markdown>{p.text}</Markdown>,
755
+ reasoning: (p) => <Thinking text={p.text} />,
756
+ tool: (p) => <ToolCard name={p.tool.name} status={p.tool.status} />,
757
+ file: (p) => <Attachment name={p.filename ?? p.url} />,
758
+ subtask: (p) => <Delegated agent={p.agent} />,
759
+ patch: (p) => <DiffStat files={p.fileCount} />,
760
+ retry: (p) => <Note>{`retrying (attempt ${p.attempt})`}</Note>,
761
+ compaction: () => <Note>context compacted</Note>,
762
+ snapshot: () => null, // internal checkpoint hash — nothing to show
763
+ agent: () => null, // inline @mention, already in the sibling text
764
+ step: () => null, // model-step bookkeeping
765
+ unknown: () => null, // forward-compat: newer server than client
766
+ };
767
+
768
+ function Turn({ message }: { message: MessageWithParts }) {
769
+ const { parts, error, isEmpty } = classifyTurn(message);
770
+ if (isEmpty && !error) return null;
771
+ return (
772
+ <>
773
+ {renderParts(parts, renderers)}
774
+ {error && <TurnFailed {...error} />}
775
+ </>
776
+ );
777
+ }
778
+ ```
779
+
780
+ The living reference is
781
+ `apps/whitelabel-demo/src/components/chat/message-view.tsx` — one deliberate
782
+ rendering decision per part kind, with the rationale for each `null`. For a
783
+ memoized message-list binding use `useChatTurns(messages)` (`@beeuni/sdk/react`);
784
+ for a no-React plain-text version of the same classification see
785
+ `examples/04-render-transcript.ts`. On the live side, `narrowChatEvent`
786
+ (root barrel) narrows the raw ~50-variant SSE union from `session.stream()` /
787
+ `openEventStream` down to the curated `BeeuniChatEvent` union (~14 members) a
788
+ chat UI actually dispatches on.
789
+
790
+ ## Composer agent and model lists (no React)
791
+
792
+ The session composer's pickers are built from pure functions on the root
793
+ entry, so every host — the web app through its hooks, React Native through
794
+ the root import — offers the same agents and models and sends the same pick.
795
+ `@beeuni/sdk/react`'s `useRuntimeAgents`, `useRuntimeProviders`,
796
+ `useRuntimeLocal`, and `useModelStore` call these.
797
+
798
+ | Function | Input → output |
799
+ |---|---|
800
+ | `projectConfigAgentsToRuntimeAgents(config)` | `/projects/:id/detail` config → agent roster, project default first |
801
+ | `composerSelectableAgents(agents, { enableProjects?, includeSubagents? })` | roster → picker list (no hidden agents, no subagents, `project-manager` only with `enableProjects`) |
802
+ | `resolveComposerAgent({ agents, boundAgent, defaultAgent, selectedAgent })` | → the agent to send, and `disabled` when none is accessible |
803
+ | `pickerProviderList({ gatewayEnabled, modelPicker, runtimeProviders, llmCatalogProviders, secretNames })` | raw sources → provider list |
804
+ | `flattenModels(providers, { providerMode })` | provider list → `ModelOption[]` (a `FlatModel` plus `id`, the ref a pick stores) |
805
+ | `modelRefToKey(ref, gatewayEnabled)` | a stored ref (session pin, channel binding, trigger, agent `model`) → `ModelKey`; `beeuni/x` and `x` are one gateway model |
806
+ | `createModelVisibility({ catalogModels, pins?, connectedProviderIds?, freeTier? })` | → default-visibility predicate |
807
+ | `modelInDefaultView(model, { search, isStoreVisible, selected })` | → whether the empty-search picker shows the model |
808
+ | `resolveModelDefault(modelDefaults, agentName)` | `/model-defaults` → agent → project → account → platform default |
809
+ | `resolveComposerModel({ models, picks, serverDefault, globalDefault, agentModel, configModel, recent, providers })` | → `{ model, explicit, fallback }` |
810
+
811
+ The root barrel reads catalog helpers from `@beeuni/llm-catalog/lite`, which
812
+ never includes the ~7.6 MB models.dev snapshot, so a bundler that does not
813
+ tree-shake (Metro) stays small.
814
+
815
+ ## Errors
816
+
817
+ One typed hierarchy, produced by **every** HTTP layer — `backendApi`, the
818
+ `authenticatedFetch`, the files client, the runtime REST client, and
819
+ `ensureReady()` all throw/return the same classes (from
820
+ the root barrel; `@beeuni/sdk/react` re-exports them too). They're real classes: `instanceof` works across every host, and
821
+ `name`/shape are preserved for legacy `error.name === 'ApiError'` sniffers.
822
+
823
+ - `ApiError` — any failed request; branch on `.status` / `.code` (e.g.
824
+ `'TIMEOUT'`, `'RUNTIME_UNAVAILABLE'`, `'ABORTED'`). Timeout errors carry
825
+ `.url` / `.endpoint` / `.timeout`.
826
+ - `HeadlessAuthError extends ApiError` — `getToken()` returned null; the request was
827
+ never sent (`code: 'NO_SESSION'`).
828
+ - `BillingError extends ApiError` — HTTP 402, with the backend's payload on
829
+ `.detail` and its machine code on `.code`.
830
+ - `RequestTooLargeError extends ApiError` — HTTP 431 (usually a too-large
831
+ upload batch), with a `.detail.suggestion`.
832
+ - `SessionNotReadyError` (root barrel) — a session handle's runtime-scoped
833
+ member (`.runtime`, `.previewUrl()`, `.proxyUrl()`) was touched before
834
+ `ensureReady()` resolved this session's own sandbox.
835
+
836
+ The canonical server-side wrapper shape — catch a 402 and pass the payload
837
+ through to your own client for re-billing, instead of leaking a Beeuni error:
838
+
839
+ ```ts
840
+ import { ApiError, HeadlessAuthError, BillingError } from "@beeuni/sdk";
841
+
842
+ try {
843
+ await beeuni.session(pid, sid).send(prompt);
844
+ } catch (err) {
845
+ if (err instanceof BillingError) {
846
+ // 402 — surface the upgrade/cost payload under YOUR billing story.
847
+ return res.status(402).json({ reason: "quota", detail: err.detail });
848
+ }
849
+ if (err instanceof HeadlessAuthError)
850
+ return res.status(401).json({ error: "not authenticated" });
851
+ if (err instanceof ApiError)
852
+ return res.status(err.status ?? 502).json({ error: err.message });
853
+ throw err;
854
+ }
855
+ ```
856
+
857
+ Every non-streaming request also carries a **30s default timeout** (the
858
+ long-lived SSE event stream is exempt), so a hung sandbox/daemon call can't
859
+ wedge a server-side handler forever — it surfaces as an `ApiError` with
860
+ `code: 'TIMEOUT'` instead.
861
+
862
+ Idempotent reads (`GET`/`HEAD`) also absorb transient gateway blips: `502`,
863
+ `503`, and `504` retry up to two times with 250ms → 500ms backoff before an
864
+ `ApiError` is surfaced. Mutations and HTTP `500` responses are never retried.
865
+
866
+ LLM session retries can carry the gateway's structured failure chain. Use
867
+ `getRetryInfo(status)`. Its optional `details` field contains the final
868
+ `provider`, gateway `code`, `requestId`, and ordered `attemptFailures`. Each
869
+ failure identifies the provider, route model, resolved model, stage, upstream
870
+ status when available, concrete code, and bounded message. Plain legacy retry
871
+ messages remain supported and return `details: undefined`. When the runtime keeps
872
+ only the HTTP error message, `getRetryMessage(status)` still returns the full
873
+ gateway composite. That message includes the request ID and each candidate's
874
+ provider, resolved model, HTTP status, code, and bounded message.
875
+
876
+ ## Entry points
877
+
878
+ **There are four, plus one internal.** Everything framework-free lives at the
879
+ root. `react` and `server` exist because each carries a dependency the root
880
+ cannot; `wire-message-id` exists so a server can load one module, not the barrel.
881
+ That is the whole map — learn it once.
882
+
883
+ | import | when you use it | why it is separate |
884
+ | --- | --- | --- |
885
+ | `@beeuni/sdk` | **almost always.** `createBeeuni`, `configureBeeuni`, the REST surface, `files`, session URLs + health (`runtimeSupports` reads a runtime's `capabilities`), `classifyPart`/`classifyTurn`/`toolViewModel`/`toToolView`/`toolKind`, `openEventStream`, `narrowChatEvent`, the message queue, the error classes, and every domain type | — |
886
+ | `@beeuni/sdk/react` | hooks and providers: `useSession`, every `useRuntime*` (each pre-W4 `useOpenCode*` name is a deprecated alias), `useChatTurns`/`renderParts`, the domain hooks | `react` is an **optional peer dependency**. Putting these at the root would force React on a CLI, a worker, or a React Native host |
887
+ | `@beeuni/sdk/server` | `runWithBeeuni`, `createScopedBeeuni`, `getScopedConfig` — per-request config isolation in a Node/Bun backend | imports `node:async_hooks`. Never let it into a browser bundle |
888
+ | `@beeuni/sdk/wire-message-id` | `mintWireMessageId`, `mintWireMessageIdAbove`, `newestWireIdClock`, `wireIdClock`, `wireIdClockDelta`, `maxWireIdClock`, `isWireIdAheadOf` — the OpenCode wire message-id clock | not a dependency split: the root exports the same names. A server that mints ids loads this one import-free module instead of the whole barrel |
889
+ | `@beeuni/sdk/internal/*` | nothing, in host code | apps/web's zustand stores. Browser-only, **outside semver**, and not on the `window.Beeuni` global. Implementation detail that is regrettably visible |
890
+
891
+ The root really is canonical, and that is a test rather than a promise:
892
+ `src/root-canonical.test.ts` asserts that every name exported by every other
893
+ isomorphic subpath is also exported from `@beeuni/sdk`. The only names it
894
+ permits to be missing are the browser-only stores above — `zustand` is a
895
+ forbidden import in the root's `isomorphic-core` tier, so they cannot live
896
+ there.
897
+
898
+ ```ts
899
+ import { createBeeuni, classifyTurn, listFiles, openEventStream } from '@beeuni/sdk';
900
+ import { useSession } from '@beeuni/sdk/react';
901
+ ```
902
+
903
+ ### Legacy aliases — do not use in new code
904
+
905
+ `package.json` still declares about twenty more subpaths: `/turns`, `/files`,
906
+ `/session`, `/session/url`, `/auth`, `/config`, `/api-client`,
907
+ `/projects-client`, `/platform-client`, `/opencode-client`, `/opencode-errors`,
908
+ `/event-stream`, `/feature-flags`, `/fresh-sessions`, `/instance-routes`,
909
+ `/message-queue`, and the un-prefixed store aliases.
910
+
911
+ Every one of them is a one-line `export *` re-export under `src/deprecated/`,
912
+ kept alive only so an existing `npm install` does not break. **They add nothing
913
+ the root does not already export.** They are removed at the next major; new
914
+ code imports the root.
915
+
916
+ ## Configuration
917
+
918
+ `configureBeeuni(config)` (called for you by `createBeeuni`) wires one seam:
919
+
920
+ ```ts
921
+ interface BeeuniPlatformConfig {
922
+ backendUrl: string;
923
+ getToken: () => Promise<string | null>;
924
+ /** @deprecated Inert: the SDK sends no client label. */
925
+ clientSource?: 'api' | 'cli' | 'mobile' | 'tui' | 'web';
926
+ clientVersion?: string; // '<surface>/<version>', sent as X-Beeuni-Client-Version
927
+ getUserId?: () => Promise<string | null>;
928
+ billingEnabled?: boolean;
929
+ sandboxId?: string | null;
930
+ onError?: (error: unknown, context?: unknown) => void;
931
+ onToast?: (level, message, options?) => void;
932
+ onNotify?: (event) => void;
933
+ featureFlags?: BeeuniFeatureFlagOverrides; // per-flag overrides for non-Next.js hosts
934
+ }
935
+ ```
936
+
937
+ `clientSource` is deprecated and inert. The audit log records what the API
938
+ authenticated (`credential_kind`: browser session, personal access token,
939
+ connected app, agent session, API key, service account), never a label the
940
+ client reports about itself.
941
+
942
+ Set `clientVersion` to the host's surface and release version, for example
943
+ `cli/0.13.42`. The SDK sends it as `X-Beeuni-Client-Version` on every request.
944
+ The API writes it to its request log only, so a route is retired only when no
945
+ supported client version still calls it. It is telemetry: it never reaches the
946
+ audit log and grants nothing. A blank value sends nothing.
947
+
948
+ The SDK is host-agnostic: no Next.js / web coupling in the core. The host injects
949
+ its token getter and toast/notify sinks; the SDK does the rest. Today that's proven
950
+ in React DOM (`apps/web` and the `apps/whitelabel-demo` reference app are the
951
+ `configureBeeuni`/`@beeuni/sdk/react` consumers).
952
+ The framework-free core — turn classification, session URLs and health, the
953
+ REST clients, file operations, transcript formatting — has no React or DOM
954
+ dependency and is usable from any JS host, all of it from the root entry;
955
+ `apps/mobile` imports `classifyTurn` from `@beeuni/sdk` this way.
956
+ `apps/mobile` (React Native) also runs `useSession` from `@beeuni/sdk/react`.
957
+ Its only platform code for the session runtime is the event transport
958
+ (`eventStreamTransport`, `react-native-sse`) and the lifecycle signals
959
+ (`notifyHostSignal` from `AppState` and its network listener).
960
+
961
+ ## Rules of the road
962
+
963
+ - **No harness SDK in host code.** Import transcript and runtime types from
964
+ `@beeuni/sdk`, and reach the runtime through the session verbs. `session.runtime`
965
+ (the raw REST compatibility client) is deprecated.
966
+ (Holds today — no host imports `@opencode-ai/sdk`, and neither does the SDK.)
967
+ - **No raw `backendApi` / `authenticatedFetch` in host code.** Use the facade or a
968
+ subpath module. (Aspirational: apps/web still calls `backendApi` via its
969
+ `@/lib/api-client` re-export in ~30 files and keeps a parallel
970
+ `authenticatedFetch` in `apps/web/src/lib/auth-token.ts` — migration pending.)
971
+ - **React data** comes from `@beeuni/sdk/react` hooks; **imperative actions** from
972
+ the `createBeeuni` facade.
973
+
974
+ ## Auth
975
+
976
+ `Authorization: Bearer <token>` — a Supabase JWT (user sessions), a Beeuni PAT
977
+ (`beeuni_pat_…`) for server-side / automation use, or an OAuth access token
978
+ (`beeuni_oat_…`) minted by "Sign in with Beeuni" — supplied via `getToken`.
979
+
980
+ To use Beeuni from an MCP client (Claude, ChatGPT, Cursor, Codex) instead of code, see the hosted MCP server: <https://beeuni.ai/docs/connect/mcp>.
981
+
982
+ ### Sign in with Beeuni (your app, their Beeuni account)
983
+
984
+ Make Beeuni the identity provider for an app you run. Register the app once
985
+ (`beeuni.iam.oauthClients.create`, or Account → Tokens → OAuth apps), then:
986
+
987
+ ```ts
988
+ import { createBeeuniAuth } from '@beeuni/sdk/server';
989
+
990
+ export const auth = createBeeuniAuth({
991
+ backendUrl: 'https://api.beeuni.ai/v1',
992
+ clientId: process.env.BEEUNI_OAUTH_CLIENT_ID!,
993
+ clientSecret: process.env.BEEUNI_OAUTH_CLIENT_SECRET, // omit for a public (PKCE-only) client
994
+ redirectUri: 'https://app.example.com/api/beeuni/auth/callback',
995
+ cookieSecret: process.env.BEEUNI_AUTH_COOKIE_SECRET!, // ≥ 32 chars
996
+ });
997
+
998
+ // one catch-all route: /signin /callback /refresh /signout /me /proxy/*
999
+ export const GET = (req: Request) => auth.handler(req);
1000
+ export const POST = GET;
1001
+
1002
+ // anywhere on the server
1003
+ const gate = await auth.requireViewer(req); // { viewer } | { response: 302 }
1004
+ const beeuni = await auth.beeuni(req); // acts as the viewer
1005
+ // in the browser
1006
+ const client = createBeeuni(auth.clientConfig()); // talks to Beeuni through /proxy
1007
+ ```
1008
+
1009
+ `@beeuni/sdk/react` adds `useBeeuniViewer()` and `<SignInWithBeeuni />`.
1010
+ Full guide: `/docs/sdk/sign-in`. Example: `examples/11-sign-in-with-beeuni.ts`.
1011
+
1012
+ ### A Beeuni-hosted App is already signed in
1013
+
1014
+ ```ts
1015
+ const beeuni = createBeeuni({ backendUrl: '/_beeuni/api/v1', getToken: beeuniAppViewerToken() }); // browser
1016
+ const viewer = await readAppViewer(request); // server (@beeuni/sdk/server)
1017
+ const asViewer = await createAppViewerBeeuni(request, { backendUrl }); // act as them
1018
+ ```
1019
+
1020
+ The Apps gate authenticated the visitor before your App was served and signs
1021
+ their identity into every request; `viewer_token_scope` on the App's access
1022
+ policy decides whether the App also gets a token to act with. On the server,
1023
+ read it per request; in the browser, `beeuniAppViewerToken()` replaces a token
1024
+ the API refused (after an access-policy change) and replays the call once.
1025
+ In the browser, `backendUrl` is `/_beeuni/api/v1`: the gate on the App's own
1026
+ origin forwards to the Beeuni API as the viewer (`viewer_token_scope: 'api'`).
1027
+ A direct call to `https://api.beeuni.ai/v1` from an App origin fails CORS.
1028
+ Guide: `/docs/sdk/apps`.
1029
+
1030
+ ### One member on every runtime: sign-in tokens, groups, roles
1031
+
1032
+ ```ts
1033
+ const db = beeuniBinding('db'); // an App this App uses, same origin
1034
+ convex = new ConvexReactClient(db.url); convex.setAuth(db.token); // its client, signed in as the viewer
1035
+ const token = await beeuniToken()(); // a token for this App itself
1036
+ const me = requireBeeuniMember(await ctx.auth.getUserIdentity(), { groups: ['Finance'] }); // a server function
1037
+ const caller = await verifyBeeuniToken(bearer); // a server App (Beeuni injects BEEUNI_AUTH_*)
1038
+ const viewer = readBeeuniMember(await fetchBeeuniAppViewer()); // browser
1039
+ ```
1040
+
1041
+ One issuer per project signs every App's tokens: `iss` =
1042
+ `<API origin>/v1/projects/<projectId>`, `aud` = the App id, 15 minutes. Every
1043
+ App JSON carries the values that verify them: `auth.issuer`, `auth.audience`,
1044
+ `auth.jwks_uri`. `beeuniToken({ audience })` asks the App's own origin
1045
+ (`/_beeuni/token`) for a token for the App itself or an App it uses (`uses`);
1046
+ any other App yields `null` and warns (`403 app_not_linked`). `beeuniBinding(slug)`
1047
+ reaches a used App's endpoint through `/_beeuni/apps/<slug>` on the same origin.
1048
+ `readBeeuniMember` reads every shape Beeuni vouches with (gate answer, signed
1049
+ header, sign-in token) into one `BeeuniMember`: `userId`, `email`, `name`,
1050
+ `picture`, `groups`, `groupIds`, `role`, `accountId`, `projectId`.
1051
+ `requireBeeuniMember` throws `BeeuniMemberError` (`unauthenticated` |
1052
+ `forbidden`). In React, read the member with a `members:me` query (`readBeeuniMember(await ctx.auth.getUserIdentity())` in `convex/members.ts`, then `useQuery(api.members.me)`: `undefined` loading, `null` signed out). Never call `useConvexAuth()`: it throws under a plain `ConvexProvider`. Beeuni injects `BEEUNI_AUTH_ISSUER`, `BEEUNI_AUTH_AUDIENCE` (the App's own id) and `BEEUNI_AUTH_JWKS` into every server App, so do not set `BEEUNI_AUTH_*` in its `env`. `verifyBeeuniToken` takes the key set inline or as an https URL
1053
+ (`auth.jwks_uri`), and refuses every token when no audience is set (option or
1054
+ `BEEUNI_AUTH_AUDIENCE`): one project key signs every App's tokens, so `aud` is
1055
+ the only thing that keeps another App's token out. `audience: false` opts out. WebCrypto only; no dependency. Guide: `/docs/sdk/apps`.
1056
+
1057
+ ### Headless sign-in (your users, straight through the API)
1058
+
1059
+ ```ts
1060
+ const session = beeuni.auth.session({ storage }); // self-refreshing token store
1061
+ const { session: s, user } = await beeuni.auth.signInWithPassword({ email, password });
1062
+ await session.set(s, user);
1063
+ const asUser = createBeeuni({ backendUrl, getToken: session.getToken });
1064
+ ```
1065
+
1066
+ Also `signUp`, `sendMagicLink` + `verifyOtp`, `signInWithProvider` +
1067
+ `exchangeCode` (PKCE), `resetPassword`, `updatePassword`, `user`, `signOut` —
1068
+ all `/v1/auth/*`, no Supabase in the client. Guide: `/docs/sdk/auth`.
1069
+
1070
+ ## Tests
1071
+
1072
+ ```sh
1073
+ pnpm --filter @beeuni/sdk typecheck # package + examples/ (examples/tsconfig.json)
1074
+ pnpm --filter @beeuni/sdk test # facade, files, react hooks, turns, transcript, session url/health, projects-client domains
1075
+ ```
1076
+
1077
+ See **`API-MAP.md`** for the complete endpoint catalogue. It covers the Beeuni
1078
+ REST API and the session runtime's REST routes. See **`CHANGELOG.md`** for
1079
+ per-release changes.
1080
+
1081
+
1082
+ ### Agent repository access
1083
+
1084
+ Agent configuration accepts `repository_access?: boolean` (default `true`).
1085
+ Set `false` to run new sessions without the project repository or repository API access.
1086
+ Git, secret, connector, and tool permissions remain separate. Existing sessions retain their saved policy.
1087
+ `AgentConfigBlock.workspace` is deprecated. The SDK maps legacy `branch`/`runtime` to the boolean field.
1088
+ A legacy `read` write requires an explicit `repository_access` choice; it does not enable read-only repository access.
1089
+
1090
+
1091
+ ### Project provider and model access
1092
+
1093
+ ```ts
1094
+ const policy = await beeuni.projects.modelAccess(projectId);
1095
+ await beeuni.projects.setModelAccess(projectId, {
1096
+ target: 'provider', id: 'beeuni', enabled: false,
1097
+ });
1098
+ await beeuni.projects.setModelAccess(projectId, {
1099
+ target: 'model', id: 'openai/gpt-5.5', enabled: false,
1100
+ });
1101
+ ```
1102
+
1103
+ `beeuni` identifies Beeuni Managed Models. Other provider IDs identify BYOK, Codex, or custom providers. Provider disable takes precedence over individual model choices. Each write changes one target and preserves credentials. Disabling the current project default or its provider returns `409 cannot_disable_default`; select another default first.
1104
+
1105
+ `useModelAccess(projectId)` from `@beeuni/sdk/react` exposes the policy, write state, and `setEnabled(change)`. Successful writes refresh both picker caches. Rejected writes leave the displayed policy unchanged. The policy blocks gateway inference; legacy `setProjectModelEnablement` remains display-only. Native runtimes that bypass the gateway return `enforced: false`.
1106
+
1107
+ ### Pooled ChatGPT connections
1108
+
1109
+ With the `pooled_provider_secrets` and `llm_gateway` project flags enabled, a
1110
+ member can create a named ChatGPT OAuth account resource:
1111
+
1112
+ ```ts
1113
+ const challenge = await beeuni.project(projectId).secrets.startProviderOAuth('openai', {
1114
+ resourceLabel: 'My ChatGPT account',
1115
+ });
1116
+ // Show challenge.verification_url and challenge.user_code, then poll the flow.
1117
+ const result = await beeuni.project(projectId).secrets.pollProviderOAuth('openai', challenge.flow_id);
1118
+ ```
1119
+
1120
+ Poll until `result.status` is `success`, `failed`, or `expired`. A successful
1121
+ named flow returns `credential.secret_id`. It creates a separate project-scoped
1122
+ account resource; reconnecting does not replace another account. Every project
1123
+ member can use it by default. The owner can restrict access to selected members.
1124
+ A session can select one or more available
1125
+ ChatGPT resources through its provider secret pool (`providerId: 'codex'`).
1126
+ Without an explicit session selection, the caller's newest personal ChatGPT
1127
+ resource is used. The legacy project login remains the fallback when that
1128
+ caller has no personal resource.
1129
+
1130
+ ### ChatGPT subscription usage
1131
+
1132
+ `getSessionCost` and `getTurnCost` report zero LLM cost for ChatGPT/Codex
1133
+ subscription messages. This also corrects historical runtime costs. Token
1134
+ counts remain available. Mixed sessions retain paid API costs; OpenAI API
1135
+ models remain billable. Subscription coverage does not include sandbox compute.
1136
+
1137
+ ### Durable prompt placement
1138
+
1139
+ `createSessionPrompt` and `useSessionPrompts().enqueue` accept an optional
1140
+ `placement: 'transcript' | 'composer'`. `transcript` (Quick Queue) runs before
1141
+ every `composer` (Queue List) entry and ends the active response after its
1142
+ current tool call. `composer` waits for the active response to finish. Each
1143
+ placement keeps submission order. A row without placement keeps its submission
1144
+ order ahead of `composer` entries and is presented as `composer`.
1145
+
1146
+ ### Prompt delivery: steer, queue, interrupt
1147
+
1148
+ `createSessionPrompt` and `enqueue` also accept `delivery: 'steer' | 'queue' |
1149
+ 'interrupt'`. It decides how a prompt reaches a running turn:
1150
+
1151
+ - `steer`: the running turn reads the prompt at its next step boundary. The
1152
+ turn does not stop.
1153
+ - `queue` (Queue List): the prompt waits for the turn to end.
1154
+ - `interrupt` (Quick Queue): the turn ends after its running tool, then the
1155
+ prompt runs.
1156
+
1157
+ With no turn running, every mode starts a turn. When only `delivery` is given,
1158
+ the SDK also sends the placement it implies (`interrupt` → `transcript`, the
1159
+ others → `composer`), so an API built before steering treats a steer prompt as
1160
+ a Queue List entry.
1161
+
1162
+ A steer prompt falls back to `queue` when the runtime cannot take messages
1163
+ mid-turn, when another member's turn is running, or when the turn ended first.
1164
+ The row then reads `delivery: 'queue'` and `steer_fallback: 'unsupported' |
1165
+ 'not_prompter' | 'turn_ended'`.
1166
+
1167
+ `interruptSessionPrompt` (`session.prompts.interrupt`,
1168
+ `useSessionPrompts().interrupt`) is "Stop and send": it turns a row still
1169
+ waiting in the queue into Quick Queue. A row already on the wire answers `409`.
1170
+
1171
+ `SessionPrompt.full_text` preserves complete text for rendering after reload;
1172
+ `text` remains the bounded preview. List responses expose attachment names and
1173
+ MIME types without attachment bytes. Removal responses retain the complete
1174
+ parts and captured model options for undo.
1175
+
1176
+ Queued work keeps `useSessionWorking().state` at `working` so it can be stopped.
1177
+ `pendingDelivery: true` distinguishes a send waiting for runtime delivery from an
1178
+ active agent response. The web app still shows one working indicator whenever the
1179
+ session is `working`, so Stop is never the only sign of work.
1180
+ A timed-out or skipped cancel does not acknowledge an abort receipt.
1181
+
1182
+ A worker claim only checks admission and keeps the prompt waiting. Delivery starts
1183
+ after admission succeeds. A confirmed active turn clears the pending presentation
1184
+ even if the previous inbox snapshot still lists that prompt. Runtime activity
1185
+ preserves the active turn's message ID during this handoff.
1186
+
1187
+ Web sends Enter while a turn runs as **steer**, Command/Ctrl+Enter as **Queue
1188
+ List**, and "Stop and send" on a queued row as **Quick Queue**. Enter on an idle
1189
+ session starts a turn. Queued entries advance automatically; Quick Queue entries run first. Queue List entries stay editable
1190
+ until delivery begins. Stop pauses pending entries; Resume releases that hold.
1191
+
1192
+ Pass the inbox IDs, in queue order, as `pendingMessageIds` to
1193
+ `groupMessagesIntoTurns(messages, { pendingMessageIds })`. Client-minted wire
1194
+ IDs still represent waiting prompts. The renderer keeps them after delivered
1195
+ turns until the inbox releases them.
1196
+
1197
+ Queue acceptance and runtime execution are separate states. Each distinct submission
1198
+ appears immediately, including while a previous POST is pending. The working hook
1199
+ updates `pendingDelivery` when the same turn becomes active, without waiting for
1200
+ a different turn ID or timestamp.
1201
+
1202
+ `useSessionPrompts` reads queue changes from the session's control stream
1203
+ (`GET .../sessions/:id/events?channels=control`, one connection per session per
1204
+ client). Every write of an inbox row arrives as a `beeuni.control.queue` frame,
1205
+ whichever API replica served the write. The `GET .../prompts` poll runs only
1206
+ while that stream is not connected, and a reconnect reads the list once.
1207
+
1208
+
1209
+ ### Why a turn ended
1210
+
1211
+ The transcript of an interrupted turn only carries `MessageAbortedError`. The
1212
+ control plane records the cause the sandbox reported, for example
1213
+ `SandboxMemoryGuard` when box memory passed its guard threshold, in
1214
+ `session_turns.end_error`. A stop somebody asked for is recorded there too, as a
1215
+ request (`UserStop` for a client abort, `QueueInterrupt` for a prompt sent into a
1216
+ busy session), and a request is never reported as a failure.
1217
+
1218
+ `GET .../turn` returns the cause in `last_ended.error` and lists the turns that
1219
+ died in `recent_failures`, keyed by `message_id`, whether or not a turn is
1220
+ running: named causes, and failures with `error: null` when nobody named one.
1221
+ `useSessionTurnOutcome(projectId, sessionId)` reads both, plus the read time
1222
+ `atMs`, from the cache `useSessionWorking()` keeps fresh and makes no request of
1223
+ its own. `turnEndNotice(outcome, messageId, transcript)` turns that into one
1224
+ typed notice per turn — `sandbox-memory`, `cause`, `unexplained`, or `null` — so
1225
+ a host maps a kind to copy and never parses the sandbox's message.
1226
+ `turnEndCause(outcome, messageId)` returns the raw recorded cause.
1227
+
1228
+ ### External directory freshness
1229
+
1230
+ `contract('directory')` from `@beeuni/sdk/react` refreshes mounted group and
1231
+ member queries every 10 seconds while the tab is visible. It also refreshes on
1232
+ focus and reconnect, including data still inside the stale-time window. It does
1233
+ not poll background tabs or change the identity provider's provisioning schedule.
1234
+ Other freshness tiers keep their existing behavior.