@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.
- package/README.md +1234 -0
- package/dist/beeuni.esm.min.js +96 -0
- package/dist/beeuni.global.js +96 -0
- package/dist/browser/cache/idb-sync-cache.d.ts +12 -0
- package/dist/browser/cache/idb-sync-cache.js +88 -0
- package/dist/browser/session-sync/mirror-paging.d.ts +7 -0
- package/dist/browser/session-sync/mirror-paging.js +10 -0
- package/dist/browser/session-sync/server-transcript-mirror.d.ts +33 -0
- package/dist/browser/session-sync/server-transcript-mirror.js +112 -0
- package/dist/browser/session-sync/session-cache-ownership.d.ts +8 -0
- package/dist/browser/session-sync/session-cache-ownership.js +36 -0
- package/dist/browser/session-sync/session-sync-registry.d.ts +44 -0
- package/dist/browser/session-sync/session-sync-registry.js +253 -0
- package/dist/browser/session-sync/visibility.d.ts +6 -0
- package/dist/browser/session-sync/visibility.js +21 -0
- package/dist/browser/stores/diagnostics-store.d.ts +61 -0
- package/dist/browser/stores/diagnostics-store.js +216 -0
- package/dist/browser/stores/opencode-compaction-store.d.ts +7 -0
- package/dist/browser/stores/opencode-compaction-store.js +21 -0
- package/dist/browser/stores/opencode-pending-store.d.ts +19 -0
- package/dist/browser/stores/opencode-pending-store.js +65 -0
- package/dist/browser/stores/sandbox-connection-store.d.ts +35 -0
- package/dist/browser/stores/sandbox-connection-store.js +230 -0
- package/dist/browser/stores/server-store.d.ts +4 -0
- package/dist/browser/stores/server-store.js +7 -0
- package/dist/browser/stores/session-working-store.d.ts +21 -0
- package/dist/browser/stores/session-working-store.js +106 -0
- package/dist/browser/stores/sync-store/ascending-id.d.ts +1 -0
- package/dist/browser/stores/sync-store/ascending-id.js +17 -0
- package/dist/browser/stores/sync-store/binary.d.ts +6 -0
- package/dist/browser/stores/sync-store/binary.js +17 -0
- package/dist/browser/stores/sync-store/delta-event-window.d.ts +1 -0
- package/dist/browser/stores/sync-store/delta-event-window.js +1 -0
- package/dist/browser/stores/sync-store/reconcile-parts.d.ts +12 -0
- package/dist/browser/stores/sync-store/reconcile-parts.js +53 -0
- package/dist/browser/stores/sync-store/types.d.ts +20 -0
- package/dist/browser/stores/sync-store/types.js +1 -0
- package/dist/browser/stores/sync-store.d.ts +65 -0
- package/dist/browser/stores/sync-store.js +1336 -0
- package/dist/core/agents/composer-agents.d.ts +19 -0
- package/dist/core/agents/composer-agents.js +57 -0
- package/dist/core/attachments/limits.d.ts +3 -0
- package/dist/core/attachments/limits.js +3 -0
- package/dist/core/attachments/prompt-attachments.d.ts +37 -0
- package/dist/core/attachments/prompt-attachments.js +377 -0
- package/dist/core/auth/app-viewer.d.ts +43 -0
- package/dist/core/auth/app-viewer.js +104 -0
- package/dist/core/auth/beeuni-member.d.ts +31 -0
- package/dist/core/auth/beeuni-member.js +168 -0
- package/dist/core/auth/session.d.ts +24 -0
- package/dist/core/auth/session.js +145 -0
- package/dist/core/cache/persisted-query-cache.d.ts +55 -0
- package/dist/core/cache/persisted-query-cache.js +220 -0
- package/dist/core/client/beeuni.d.ts +1216 -0
- package/dist/core/client/beeuni.js +96 -0
- package/dist/core/client/binding-types.d.ts +1 -0
- package/dist/core/client/binding-types.js +1 -0
- package/dist/core/client/facade-accounts.d.ts +51 -0
- package/dist/core/client/facade-accounts.js +53 -0
- package/dist/core/client/facade-catalog.d.ts +54 -0
- package/dist/core/client/facade-catalog.js +53 -0
- package/dist/core/client/facade-commerce.d.ts +39 -0
- package/dist/core/client/facade-commerce.js +40 -0
- package/dist/core/client/facade-iam.d.ts +43 -0
- package/dist/core/client/facade-iam.js +45 -0
- package/dist/core/client/facade-identity.d.ts +103 -0
- package/dist/core/client/facade-identity.js +33 -0
- package/dist/core/client/facade-preview.d.ts +3 -0
- package/dist/core/client/facade-preview.js +30 -0
- package/dist/core/client/project-access-resources.d.ts +65 -0
- package/dist/core/client/project-access-resources.js +54 -0
- package/dist/core/client/project-access-security.d.ts +109 -0
- package/dist/core/client/project-access-security.js +33 -0
- package/dist/core/client/project-connections.d.ts +32 -0
- package/dist/core/client/project-connections.js +18 -0
- package/dist/core/client/project-connectors.d.ts +15 -0
- package/dist/core/client/project-connectors.js +34 -0
- package/dist/core/client/project-core.d.ts +74 -0
- package/dist/core/client/project-core.js +25 -0
- package/dist/core/client/project-membership.d.ts +62 -0
- package/dist/core/client/project-membership.js +24 -0
- package/dist/core/client/project-operations-admin.d.ts +125 -0
- package/dist/core/client/project-operations-admin.js +26 -0
- package/dist/core/client/project-operations-review.d.ts +35 -0
- package/dist/core/client/project-operations-review.js +24 -0
- package/dist/core/client/project-operations-workspace.d.ts +94 -0
- package/dist/core/client/project-operations-workspace.js +36 -0
- package/dist/core/client/project-operations.d.ts +237 -0
- package/dist/core/client/project-operations.js +41 -0
- package/dist/core/client/project-platform-resources.d.ts +34 -0
- package/dist/core/client/project-platform-resources.js +27 -0
- package/dist/core/client/project-platform-security.d.ts +76 -0
- package/dist/core/client/project-platform-security.js +31 -0
- package/dist/core/client/project-platform-settings.d.ts +53 -0
- package/dist/core/client/project-platform-settings.js +23 -0
- package/dist/core/client/session-actions-resources.d.ts +7 -0
- package/dist/core/client/session-actions-resources.js +13 -0
- package/dist/core/client/session-actions-security.d.ts +22 -0
- package/dist/core/client/session-actions-security.js +38 -0
- package/dist/core/client/session-actions-services.d.ts +39 -0
- package/dist/core/client/session-actions-services.js +34 -0
- package/dist/core/client/session-context.d.ts +21 -0
- package/dist/core/client/session-context.js +1 -0
- package/dist/core/client/session-defaults.d.ts +8 -0
- package/dist/core/client/session-defaults.js +35 -0
- package/dist/core/client/session-files.d.ts +20 -0
- package/dist/core/client/session-files.js +18 -0
- package/dist/core/client/session-handle.d.ts +207 -0
- package/dist/core/client/session-handle.js +53 -0
- package/dist/core/client/session-lifecycle-resources.d.ts +76 -0
- package/dist/core/client/session-lifecycle-resources.js +44 -0
- package/dist/core/client/session-lifecycle-security.d.ts +42 -0
- package/dist/core/client/session-lifecycle-security.js +31 -0
- package/dist/core/client/session-preview.d.ts +7 -0
- package/dist/core/client/session-preview.js +11 -0
- package/dist/core/client/session-readiness.d.ts +10 -0
- package/dist/core/client/session-readiness.js +54 -0
- package/dist/core/client/session-runtime.d.ts +21 -0
- package/dist/core/client/session-runtime.js +15 -0
- package/dist/core/client/session-shared.d.ts +20 -0
- package/dist/core/client/session-shared.js +22 -0
- package/dist/core/client/session-start.d.ts +2 -0
- package/dist/core/client/session-start.js +39 -0
- package/dist/core/files/client.d.ts +68 -0
- package/dist/core/files/client.js +491 -0
- package/dist/core/files/types.d.ts +75 -0
- package/dist/core/files/types.js +1 -0
- package/dist/core/http/abort-error.d.ts +5 -0
- package/dist/core/http/abort-error.js +74 -0
- package/dist/core/http/abort.d.ts +3 -0
- package/dist/core/http/abort.js +34 -0
- package/dist/core/http/api/errors.d.ts +68 -0
- package/dist/core/http/api/errors.js +132 -0
- package/dist/core/http/api-client.d.ts +44 -0
- package/dist/core/http/api-client.js +121 -0
- package/dist/core/http/auth.d.ts +12 -0
- package/dist/core/http/auth.js +37 -0
- package/dist/core/http/authenticated-request.d.ts +5 -0
- package/dist/core/http/authenticated-request.js +11 -0
- package/dist/core/http/config.d.ts +35 -0
- package/dist/core/http/config.js +23 -0
- package/dist/core/http/env.d.ts +1 -0
- package/dist/core/http/env.js +8 -0
- package/dist/core/http/feature-flags.d.ts +8 -0
- package/dist/core/http/feature-flags.js +41 -0
- package/dist/core/http/fresh-sessions.d.ts +3 -0
- package/dist/core/http/fresh-sessions.js +17 -0
- package/dist/core/http/impersonation.d.ts +14 -0
- package/dist/core/http/impersonation.js +110 -0
- package/dist/core/http/instance-routes.d.ts +16 -0
- package/dist/core/http/instance-routes.js +99 -0
- package/dist/core/http/logger.d.ts +10 -0
- package/dist/core/http/logger.js +29 -0
- package/dist/core/http/request.d.ts +2 -0
- package/dist/core/http/request.js +194 -0
- package/dist/core/http/response-error.d.ts +2 -0
- package/dist/core/http/response-error.js +92 -0
- package/dist/core/http/runtime-errors.d.ts +32 -0
- package/dist/core/http/runtime-errors.js +116 -0
- package/dist/core/http/session-stopped.d.ts +2 -0
- package/dist/core/http/session-stopped.js +16 -0
- package/dist/core/http/transport.d.ts +20 -0
- package/dist/core/http/transport.js +133 -0
- package/dist/core/models/bedrock-invokable.d.ts +3 -0
- package/dist/core/models/bedrock-invokable.js +22 -0
- package/dist/core/models/composer-model.d.ts +20 -0
- package/dist/core/models/composer-model.js +57 -0
- package/dist/core/models/model-flatten.d.ts +43 -0
- package/dist/core/models/model-flatten.js +73 -0
- package/dist/core/models/model-key.d.ts +8 -0
- package/dist/core/models/model-key.js +18 -0
- package/dist/core/models/model-lookup.d.ts +2 -0
- package/dist/core/models/model-lookup.js +3 -0
- package/dist/core/models/model-visibility.d.ts +28 -0
- package/dist/core/models/model-visibility.js +110 -0
- package/dist/core/models/provider-selection.d.ts +72 -0
- package/dist/core/models/provider-selection.js +307 -0
- package/dist/core/rest/platform-client/auth.d.ts +139 -0
- package/dist/core/rest/platform-client/auth.js +92 -0
- package/dist/core/rest/platform-client/backups.d.ts +18 -0
- package/dist/core/rest/platform-client/backups.js +12 -0
- package/dist/core/rest/platform-client/connector-setup.d.ts +35 -0
- package/dist/core/rest/platform-client/connector-setup.js +105 -0
- package/dist/core/rest/platform-client/github-app.d.ts +45 -0
- package/dist/core/rest/platform-client/github-app.js +54 -0
- package/dist/core/rest/platform-client/host-boundary.d.ts +140 -0
- package/dist/core/rest/platform-client/host-boundary.js +188 -0
- package/dist/core/rest/platform-client/index.d.ts +12 -0
- package/dist/core/rest/platform-client/index.js +12 -0
- package/dist/core/rest/platform-client/instance-admin.d.ts +53 -0
- package/dist/core/rest/platform-client/instance-admin.js +20 -0
- package/dist/core/rest/platform-client/invites.d.ts +31 -0
- package/dist/core/rest/platform-client/invites.js +11 -0
- package/dist/core/rest/platform-client/lifecycle.d.ts +27 -0
- package/dist/core/rest/platform-client/lifecycle.js +80 -0
- package/dist/core/rest/platform-client/members.d.ts +14 -0
- package/dist/core/rest/platform-client/members.js +28 -0
- package/dist/core/rest/platform-client/shared.d.ts +18 -0
- package/dist/core/rest/platform-client/shared.js +99 -0
- package/dist/core/rest/platform-client/ssh.d.ts +21 -0
- package/dist/core/rest/platform-client/ssh.js +6 -0
- package/dist/core/rest/platform-client/types.d.ts +47 -0
- package/dist/core/rest/platform-client/types.js +10 -0
- package/dist/core/rest/platform-client/updates.d.ts +77 -0
- package/dist/core/rest/platform-client/updates.js +54 -0
- package/dist/core/rest/platform-client/urls.d.ts +3 -0
- package/dist/core/rest/platform-client/urls.js +16 -0
- package/dist/core/rest/projects-client/access.d.ts +226 -0
- package/dist/core/rest/projects-client/access.js +82 -0
- package/dist/core/rest/projects-client/account-lifecycle.d.ts +21 -0
- package/dist/core/rest/projects-client/account-lifecycle.js +25 -0
- package/dist/core/rest/projects-client/account-secret-resources.d.ts +60 -0
- package/dist/core/rest/projects-client/account-secret-resources.js +40 -0
- package/dist/core/rest/projects-client/accounts.d.ts +240 -0
- package/dist/core/rest/projects-client/accounts.js +82 -0
- package/dist/core/rest/projects-client/admin-providers.d.ts +131 -0
- package/dist/core/rest/projects-client/admin-providers.js +39 -0
- package/dist/core/rest/projects-client/agent-config.d.ts +72 -0
- package/dist/core/rest/projects-client/agent-config.js +39 -0
- package/dist/core/rest/projects-client/agent-connectors.d.ts +6 -0
- package/dist/core/rest/projects-client/agent-connectors.js +32 -0
- package/dist/core/rest/projects-client/agent-scope.d.ts +13 -0
- package/dist/core/rest/projects-client/agent-scope.js +7 -0
- package/dist/core/rest/projects-client/apps-fleet.d.ts +82 -0
- package/dist/core/rest/projects-client/apps-fleet.js +45 -0
- package/dist/core/rest/projects-client/apps.d.ts +356 -0
- package/dist/core/rest/projects-client/apps.js +126 -0
- package/dist/core/rest/projects-client/assignments.d.ts +73 -0
- package/dist/core/rest/projects-client/assignments.js +45 -0
- package/dist/core/rest/projects-client/audit-filter.d.ts +4 -0
- package/dist/core/rest/projects-client/audit-filter.js +9 -0
- package/dist/core/rest/projects-client/audit.d.ts +125 -0
- package/dist/core/rest/projects-client/audit.js +49 -0
- package/dist/core/rest/projects-client/billing.d.ts +390 -0
- package/dist/core/rest/projects-client/billing.js +257 -0
- package/dist/core/rest/projects-client/change-requests.d.ts +116 -0
- package/dist/core/rest/projects-client/change-requests.js +50 -0
- package/dist/core/rest/projects-client/channels.d.ts +131 -0
- package/dist/core/rest/projects-client/channels.js +112 -0
- package/dist/core/rest/projects-client/connector-run.d.ts +62 -0
- package/dist/core/rest/projects-client/connector-run.js +155 -0
- package/dist/core/rest/projects-client/connectors.d.ts +721 -0
- package/dist/core/rest/projects-client/connectors.js +421 -0
- package/dist/core/rest/projects-client/drives.d.ts +149 -0
- package/dist/core/rest/projects-client/drives.js +88 -0
- package/dist/core/rest/projects-client/files.d.ts +45 -0
- package/dist/core/rest/projects-client/files.js +69 -0
- package/dist/core/rest/projects-client/gateway.d.ts +257 -0
- package/dist/core/rest/projects-client/gateway.js +72 -0
- package/dist/core/rest/projects-client/git-backend.d.ts +15 -0
- package/dist/core/rest/projects-client/git-backend.js +15 -0
- package/dist/core/rest/projects-client/git-history.d.ts +78 -0
- package/dist/core/rest/projects-client/git-history.js +47 -0
- package/dist/core/rest/projects-client/github.d.ts +128 -0
- package/dist/core/rest/projects-client/github.js +54 -0
- package/dist/core/rest/projects-client/iam-audit.d.ts +81 -0
- package/dist/core/rest/projects-client/iam-audit.js +21 -0
- package/dist/core/rest/projects-client/iam-enterprise.d.ts +2 -0
- package/dist/core/rest/projects-client/iam-enterprise.js +11 -0
- package/dist/core/rest/projects-client/iam-grants.d.ts +21 -0
- package/dist/core/rest/projects-client/iam-grants.js +6 -0
- package/dist/core/rest/projects-client/iam-groups.d.ts +65 -0
- package/dist/core/rest/projects-client/iam-groups.js +42 -0
- package/dist/core/rest/projects-client/iam-policies.d.ts +53 -0
- package/dist/core/rest/projects-client/iam-policies.js +26 -0
- package/dist/core/rest/projects-client/iam-probe.d.ts +27 -0
- package/dist/core/rest/projects-client/iam-probe.js +16 -0
- package/dist/core/rest/projects-client/iam-query.d.ts +1 -0
- package/dist/core/rest/projects-client/iam-query.js +9 -0
- package/dist/core/rest/projects-client/iam-roles.d.ts +47 -0
- package/dist/core/rest/projects-client/iam-roles.js +43 -0
- package/dist/core/rest/projects-client/iam-scim.d.ts +22 -0
- package/dist/core/rest/projects-client/iam-scim.js +14 -0
- package/dist/core/rest/projects-client/iam-security.d.ts +28 -0
- package/dist/core/rest/projects-client/iam-security.js +17 -0
- package/dist/core/rest/projects-client/iam-service-accounts.d.ts +26 -0
- package/dist/core/rest/projects-client/iam-service-accounts.js +14 -0
- package/dist/core/rest/projects-client/iam-sessions.d.ts +27 -0
- package/dist/core/rest/projects-client/iam-sessions.js +25 -0
- package/dist/core/rest/projects-client/iam-shared.d.ts +6 -0
- package/dist/core/rest/projects-client/iam-shared.js +8 -0
- package/dist/core/rest/projects-client/iam-sso.d.ts +60 -0
- package/dist/core/rest/projects-client/iam-sso.js +28 -0
- package/dist/core/rest/projects-client/iam-types.d.ts +52 -0
- package/dist/core/rest/projects-client/iam-types.js +1 -0
- package/dist/core/rest/projects-client/iam.d.ts +13 -0
- package/dist/core/rest/projects-client/iam.js +13 -0
- package/dist/core/rest/projects-client/index.d.ts +55 -0
- package/dist/core/rest/projects-client/index.js +54 -0
- package/dist/core/rest/projects-client/marketplace-catalog.d.ts +74 -0
- package/dist/core/rest/projects-client/marketplace-catalog.js +41 -0
- package/dist/core/rest/projects-client/model-access.d.ts +13 -0
- package/dist/core/rest/projects-client/model-access.js +8 -0
- package/dist/core/rest/projects-client/model-defaults.d.ts +28 -0
- package/dist/core/rest/projects-client/model-defaults.js +15 -0
- package/dist/core/rest/projects-client/model-enablement.d.ts +4 -0
- package/dist/core/rest/projects-client/model-enablement.js +5 -0
- package/dist/core/rest/projects-client/notifications.d.ts +95 -0
- package/dist/core/rest/projects-client/notifications.js +61 -0
- package/dist/core/rest/projects-client/oauth-clients.d.ts +41 -0
- package/dist/core/rest/projects-client/oauth-clients.js +24 -0
- package/dist/core/rest/projects-client/policies.d.ts +26 -0
- package/dist/core/rest/projects-client/policies.js +8 -0
- package/dist/core/rest/projects-client/presentations.d.ts +11 -0
- package/dist/core/rest/projects-client/presentations.js +8 -0
- package/dist/core/rest/projects-client/project-agents.d.ts +10 -0
- package/dist/core/rest/projects-client/project-agents.js +22 -0
- package/dist/core/rest/projects-client/projects.d.ts +376 -0
- package/dist/core/rest/projects-client/projects.js +237 -0
- package/dist/core/rest/projects-client/prompt-attachments.d.ts +31 -0
- package/dist/core/rest/projects-client/prompt-attachments.js +294 -0
- package/dist/core/rest/projects-client/provider-connections.d.ts +54 -0
- package/dist/core/rest/projects-client/provider-connections.js +28 -0
- package/dist/core/rest/projects-client/public-session-shares.d.ts +49 -0
- package/dist/core/rest/projects-client/public-session-shares.js +35 -0
- package/dist/core/rest/projects-client/referrals.d.ts +52 -0
- package/dist/core/rest/projects-client/referrals.js +19 -0
- package/dist/core/rest/projects-client/review-items.d.ts +139 -0
- package/dist/core/rest/projects-client/review-items.js +217 -0
- package/dist/core/rest/projects-client/review.d.ts +56 -0
- package/dist/core/rest/projects-client/review.js +23 -0
- package/dist/core/rest/projects-client/sandbox-shares.d.ts +21 -0
- package/dist/core/rest/projects-client/sandbox-shares.js +19 -0
- package/dist/core/rest/projects-client/sandbox.d.ts +144 -0
- package/dist/core/rest/projects-client/sandbox.js +35 -0
- package/dist/core/rest/projects-client/secrets.d.ts +187 -0
- package/dist/core/rest/projects-client/secrets.js +79 -0
- package/dist/core/rest/projects-client/session-attachments.d.ts +22 -0
- package/dist/core/rest/projects-client/session-attachments.js +166 -0
- package/dist/core/rest/projects-client/session-costs.d.ts +193 -0
- package/dist/core/rest/projects-client/session-costs.js +87 -0
- package/dist/core/rest/projects-client/session-prompt-actions.d.ts +10 -0
- package/dist/core/rest/projects-client/session-prompt-actions.js +4 -0
- package/dist/core/rest/projects-client/session-reminders.d.ts +58 -0
- package/dist/core/rest/projects-client/session-reminders.js +50 -0
- package/dist/core/rest/projects-client/session-sandbox.d.ts +85 -0
- package/dist/core/rest/projects-client/session-sandbox.js +113 -0
- package/dist/core/rest/projects-client/sessions.d.ts +670 -0
- package/dist/core/rest/projects-client/sessions.js +321 -0
- package/dist/core/rest/projects-client/setup-links.d.ts +54 -0
- package/dist/core/rest/projects-client/setup-links.js +22 -0
- package/dist/core/rest/projects-client/shared.d.ts +51 -0
- package/dist/core/rest/projects-client/shared.js +29 -0
- package/dist/core/rest/projects-client/skills.d.ts +11 -0
- package/dist/core/rest/projects-client/skills.js +8 -0
- package/dist/core/rest/projects-client/starter-suggestions.d.ts +17 -0
- package/dist/core/rest/projects-client/starter-suggestions.js +5 -0
- package/dist/core/rest/projects-client/templates.d.ts +47 -0
- package/dist/core/rest/projects-client/templates.js +7 -0
- package/dist/core/rest/projects-client/tokens.d.ts +94 -0
- package/dist/core/rest/projects-client/tokens.js +46 -0
- package/dist/core/rest/projects-client/triggers.d.ts +175 -0
- package/dist/core/rest/projects-client/triggers.js +29 -0
- package/dist/core/runtime/attachment-part.d.ts +3 -0
- package/dist/core/runtime/attachment-part.js +18 -0
- package/dist/core/runtime/beeuni-master.d.ts +477 -0
- package/dist/core/runtime/beeuni-master.js +264 -0
- package/dist/core/runtime/client.d.ts +30 -0
- package/dist/core/runtime/client.js +124 -0
- package/dist/core/runtime/env.d.ts +8 -0
- package/dist/core/runtime/env.js +42 -0
- package/dist/core/runtime/pty.d.ts +43 -0
- package/dist/core/runtime/pty.js +117 -0
- package/dist/core/runtime/runtime-rest-client.d.ts +414 -0
- package/dist/core/runtime/runtime-rest-client.js +296 -0
- package/dist/core/runtime/runtime-types.d.ts +1094 -0
- package/dist/core/runtime/runtime-types.js +1 -0
- package/dist/core/runtime/transcript-types.d.ts +507 -0
- package/dist/core/runtime/transcript-types.js +31 -0
- package/dist/core/runtime/triggers.d.ts +1 -0
- package/dist/core/runtime/triggers.js +18 -0
- package/dist/core/session/compaction.d.ts +10 -0
- package/dist/core/session/compaction.js +22 -0
- package/dist/core/session/connection.d.ts +20 -0
- package/dist/core/session/connection.js +52 -0
- package/dist/core/session/control-stream.d.ts +62 -0
- package/dist/core/session/control-stream.js +329 -0
- package/dist/core/session/current-runtime.d.ts +14 -0
- package/dist/core/session/current-runtime.js +34 -0
- package/dist/core/session/health.d.ts +41 -0
- package/dist/core/session/health.js +53 -0
- package/dist/core/session/host-signals.d.ts +3 -0
- package/dist/core/session/host-signals.js +16 -0
- package/dist/core/session/index.d.ts +15 -0
- package/dist/core/session/index.js +14 -0
- package/dist/core/session/message-queue.d.ts +43 -0
- package/dist/core/session/message-queue.js +101 -0
- package/dist/core/session/open-bundle.d.ts +24 -0
- package/dist/core/session/open-bundle.js +135 -0
- package/dist/core/session/poll-owner.d.ts +5 -0
- package/dist/core/session/poll-owner.js +58 -0
- package/dist/core/session/presentation.d.ts +11 -0
- package/dist/core/session/presentation.js +70 -0
- package/dist/core/session/preview-auth.d.ts +6 -0
- package/dist/core/session/preview-auth.js +36 -0
- package/dist/core/session/preview-config.d.ts +5 -0
- package/dist/core/session/preview-config.js +54 -0
- package/dist/core/session/preview-options.d.ts +9 -0
- package/dist/core/session/preview-options.js +12 -0
- package/dist/core/session/preview-origin-trust.d.ts +7 -0
- package/dist/core/session/preview-origin-trust.js +64 -0
- package/dist/core/session/preview-probe.d.ts +7 -0
- package/dist/core/session/preview-probe.js +36 -0
- package/dist/core/session/preview.d.ts +3 -0
- package/dist/core/session/preview.js +66 -0
- package/dist/core/session/project-session-read.d.ts +5 -0
- package/dist/core/session/project-session-read.js +12 -0
- package/dist/core/session/rewind.d.ts +29 -0
- package/dist/core/session/rewind.js +53 -0
- package/dist/core/session/runtime-gone.d.ts +5 -0
- package/dist/core/session/runtime-gone.js +14 -0
- package/dist/core/session/runtime-sessions.d.ts +7 -0
- package/dist/core/session/runtime-sessions.js +26 -0
- package/dist/core/session/runtime-verbs.d.ts +34 -0
- package/dist/core/session/runtime-verbs.js +94 -0
- package/dist/core/session/server-store/active.d.ts +7 -0
- package/dist/core/session/server-store/active.js +35 -0
- package/dist/core/session/server-store/types.d.ts +4 -0
- package/dist/core/session/server-store/types.js +1 -0
- package/dist/core/session/server-store/url-helpers.d.ts +5 -0
- package/dist/core/session/server-store/url-helpers.js +25 -0
- package/dist/core/session/session-runtime-registry.d.ts +9 -0
- package/dist/core/session/session-runtime-registry.js +28 -0
- package/dist/core/session/single-flight.d.ts +3 -0
- package/dist/core/session/single-flight.js +22 -0
- package/dist/core/session/static-file-preview.d.ts +10 -0
- package/dist/core/session/static-file-preview.js +34 -0
- package/dist/core/session/status-vocabulary.d.ts +23 -0
- package/dist/core/session/status-vocabulary.js +59 -0
- package/dist/core/session/turn-end-cause.d.ts +22 -0
- package/dist/core/session/turn-end-cause.js +41 -0
- package/dist/core/session/turn-end-settle.d.ts +1 -0
- package/dist/core/session/turn-end-settle.js +1 -0
- package/dist/core/session/url.d.ts +49 -0
- package/dist/core/session/url.js +415 -0
- package/dist/core/session/wake-escalation.d.ts +37 -0
- package/dist/core/session/wake-escalation.js +104 -0
- package/dist/core/session/wire-id-unwrap.d.ts +2 -0
- package/dist/core/session/wire-id-unwrap.js +15 -0
- package/dist/core/session/wire-message-id.d.ts +27 -0
- package/dist/core/session/wire-message-id.js +88 -0
- package/dist/core/session/working-evidence.d.ts +13 -0
- package/dist/core/session/working-evidence.js +25 -0
- package/dist/core/session/working-project.d.ts +2 -0
- package/dist/core/session/working-project.js +145 -0
- package/dist/core/session/working-runtime.d.ts +3 -0
- package/dist/core/session/working-runtime.js +16 -0
- package/dist/core/session/working-server.d.ts +20 -0
- package/dist/core/session/working-server.js +57 -0
- package/dist/core/session/working-time.d.ts +1 -0
- package/dist/core/session/working-time.js +6 -0
- package/dist/core/session/working.d.ts +58 -0
- package/dist/core/session/working.js +48 -0
- package/dist/core/session-sync/fragment.d.ts +4 -0
- package/dist/core/session-sync/fragment.js +3 -0
- package/dist/core/session-sync/saved-copy-store.d.ts +23 -0
- package/dist/core/session-sync/saved-copy-store.js +232 -0
- package/dist/core/session-sync/saved-transcript.d.ts +20 -0
- package/dist/core/session-sync/saved-transcript.js +35 -0
- package/dist/core/session-sync/session-sync-controller.d.ts +111 -0
- package/dist/core/session-sync/session-sync-controller.js +440 -0
- package/dist/core/stream/chat-events.d.ts +96 -0
- package/dist/core/stream/chat-events.js +95 -0
- package/dist/core/stream/event-stream.d.ts +52 -0
- package/dist/core/stream/event-stream.js +372 -0
- package/dist/core/stream/fetch-sse.d.ts +20 -0
- package/dist/core/stream/fetch-sse.js +136 -0
- package/dist/core/stream/keepalive.d.ts +4 -0
- package/dist/core/stream/keepalive.js +6 -0
- package/dist/core/stream/platform-event-transport.d.ts +2 -0
- package/dist/core/stream/platform-event-transport.js +20 -0
- package/dist/core/turns/classify.d.ts +131 -0
- package/dist/core/turns/classify.js +306 -0
- package/dist/core/turns/errors.d.ts +24 -0
- package/dist/core/turns/errors.js +355 -0
- package/dist/core/turns/grouping.d.ts +47 -0
- package/dist/core/turns/grouping.js +247 -0
- package/dist/core/turns/index.d.ts +13 -0
- package/dist/core/turns/index.js +12 -0
- package/dist/core/turns/open-turn.d.ts +13 -0
- package/dist/core/turns/open-turn.js +17 -0
- package/dist/core/turns/parts.d.ts +60 -0
- package/dist/core/turns/parts.js +414 -0
- package/dist/core/turns/segments/burst-summary.d.ts +9 -0
- package/dist/core/turns/segments/burst-summary.js +45 -0
- package/dist/core/turns/segments/compaction-state.d.ts +19 -0
- package/dist/core/turns/segments/compaction-state.js +42 -0
- package/dist/core/turns/segments/group-steps.d.ts +11 -0
- package/dist/core/turns/segments/group-steps.js +65 -0
- package/dist/core/turns/segments/index.d.ts +12 -0
- package/dist/core/turns/segments/index.js +12 -0
- package/dist/core/turns/segments/merge-steps.d.ts +21 -0
- package/dist/core/turns/segments/merge-steps.js +100 -0
- package/dist/core/turns/segments/message-time.d.ts +12 -0
- package/dist/core/turns/segments/message-time.js +82 -0
- package/dist/core/turns/segments/narration.d.ts +9 -0
- package/dist/core/turns/segments/narration.js +573 -0
- package/dist/core/turns/segments/segment-turn.d.ts +15 -0
- package/dist/core/turns/segments/segment-turn.js +32 -0
- package/dist/core/turns/segments/session-activity-groups.d.ts +20 -0
- package/dist/core/turns/segments/session-activity-groups.js +56 -0
- package/dist/core/turns/segments/show-group.d.ts +23 -0
- package/dist/core/turns/segments/show-group.js +101 -0
- package/dist/core/turns/segments/step-label.d.ts +10 -0
- package/dist/core/turns/segments/step-label.js +85 -0
- package/dist/core/turns/segments/turn-busy-visibility.d.ts +6 -0
- package/dist/core/turns/segments/turn-busy-visibility.js +9 -0
- package/dist/core/turns/segments/working-turn.d.ts +70 -0
- package/dist/core/turns/segments/working-turn.js +98 -0
- package/dist/core/turns/shell.d.ts +5 -0
- package/dist/core/turns/shell.js +21 -0
- package/dist/core/turns/state.d.ts +24 -0
- package/dist/core/turns/state.js +364 -0
- package/dist/core/turns/text-scan.d.ts +21 -0
- package/dist/core/turns/text-scan.js +347 -0
- package/dist/core/turns/tool-kind.d.ts +3 -0
- package/dist/core/turns/tool-kind.js +99 -0
- package/dist/core/turns/tool-registry.d.ts +8 -0
- package/dist/core/turns/tool-registry.js +87 -0
- package/dist/core/turns/tools/agent-helpers.d.ts +9 -0
- package/dist/core/turns/tools/agent-helpers.js +53 -0
- package/dist/core/turns/tools/file-verb.d.ts +10 -0
- package/dist/core/turns/tools/file-verb.js +22 -0
- package/dist/core/turns/tools/index.d.ts +14 -0
- package/dist/core/turns/tools/index.js +14 -0
- package/dist/core/turns/tools/memory-helpers.d.ts +15 -0
- package/dist/core/turns/tools/memory-helpers.js +50 -0
- package/dist/core/turns/tools/patch-summary.d.ts +6 -0
- package/dist/core/turns/tools/patch-summary.js +21 -0
- package/dist/core/turns/tools/presentation-helpers.d.ts +15 -0
- package/dist/core/turns/tools/presentation-helpers.js +17 -0
- package/dist/core/turns/tools/question-helpers.d.ts +9 -0
- package/dist/core/turns/tools/question-helpers.js +12 -0
- package/dist/core/turns/tools/read-helpers.d.ts +7 -0
- package/dist/core/turns/tools/read-helpers.js +24 -0
- package/dist/core/turns/tools/search-query.d.ts +1 -0
- package/dist/core/turns/tools/search-query.js +73 -0
- package/dist/core/turns/tools/show-availability.d.ts +11 -0
- package/dist/core/turns/tools/show-availability.js +38 -0
- package/dist/core/turns/tools/skill-helpers.d.ts +5 -0
- package/dist/core/turns/tools/skill-helpers.js +61 -0
- package/dist/core/turns/tools/tool-meta.d.ts +30 -0
- package/dist/core/turns/tools/tool-meta.js +146 -0
- package/dist/core/turns/tools/tool-outcome.d.ts +15 -0
- package/dist/core/turns/tools/tool-outcome.js +147 -0
- package/dist/core/turns/tools/tool-output-format.d.ts +17 -0
- package/dist/core/turns/tools/tool-output-format.js +124 -0
- package/dist/core/turns/tools/web-helpers.d.ts +34 -0
- package/dist/core/turns/tools/web-helpers.js +229 -0
- package/dist/core/turns/types.d.ts +110 -0
- package/dist/core/turns/types.js +1 -0
- package/dist/core/turns/view-model.d.ts +76 -0
- package/dist/core/turns/view-model.js +300 -0
- package/dist/deprecated/api-client.d.ts +1 -0
- package/dist/deprecated/api-client.js +1 -0
- package/dist/deprecated/auth.d.ts +1 -0
- package/dist/deprecated/auth.js +1 -0
- package/dist/deprecated/config.d.ts +1 -0
- package/dist/deprecated/config.js +1 -0
- package/dist/deprecated/event-stream.d.ts +1 -0
- package/dist/deprecated/event-stream.js +1 -0
- package/dist/deprecated/feature-flags.d.ts +1 -0
- package/dist/deprecated/feature-flags.js +1 -0
- package/dist/deprecated/files.d.ts +1 -0
- package/dist/deprecated/files.js +1 -0
- package/dist/deprecated/fresh-sessions.d.ts +1 -0
- package/dist/deprecated/fresh-sessions.js +1 -0
- package/dist/deprecated/idb-sync-cache.d.ts +1 -0
- package/dist/deprecated/idb-sync-cache.js +1 -0
- package/dist/deprecated/instance-routes.d.ts +1 -0
- package/dist/deprecated/instance-routes.js +1 -0
- package/dist/deprecated/opencode-client.d.ts +1 -0
- package/dist/deprecated/opencode-client.js +1 -0
- package/dist/deprecated/opencode-errors.d.ts +1 -0
- package/dist/deprecated/opencode-errors.js +1 -0
- package/dist/deprecated/opencode-pending-store.d.ts +1 -0
- package/dist/deprecated/opencode-pending-store.js +1 -0
- package/dist/deprecated/platform-client.d.ts +1 -0
- package/dist/deprecated/platform-client.js +1 -0
- package/dist/deprecated/projects-client.d.ts +1 -0
- package/dist/deprecated/projects-client.js +1 -0
- package/dist/deprecated/sandbox-connection-store.d.ts +1 -0
- package/dist/deprecated/sandbox-connection-store.js +1 -0
- package/dist/deprecated/server-store.d.ts +1 -0
- package/dist/deprecated/server-store.js +1 -0
- package/dist/deprecated/session-url.d.ts +1 -0
- package/dist/deprecated/session-url.js +1 -0
- package/dist/deprecated/session.d.ts +1 -0
- package/dist/deprecated/session.js +1 -0
- package/dist/deprecated/sync-store.d.ts +1 -0
- package/dist/deprecated/sync-store.js +1 -0
- package/dist/deprecated/turns.d.ts +1 -0
- package/dist/deprecated/turns.js +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +53 -0
- package/dist/internal/diagnostics-store.d.ts +1 -0
- package/dist/internal/diagnostics-store.js +1 -0
- package/dist/internal/idb-sync-cache.d.ts +1 -0
- package/dist/internal/idb-sync-cache.js +1 -0
- package/dist/internal/managed-storage.d.ts +1 -0
- package/dist/internal/managed-storage.js +1 -0
- package/dist/internal/opencode-pending-store.d.ts +1 -0
- package/dist/internal/opencode-pending-store.js +1 -0
- package/dist/internal/sandbox-connection-store.d.ts +1 -0
- package/dist/internal/sandbox-connection-store.js +1 -0
- package/dist/internal/server-store.d.ts +1 -0
- package/dist/internal/server-store.js +1 -0
- package/dist/internal/sync-store.d.ts +1 -0
- package/dist/internal/sync-store.js +1 -0
- package/dist/node/app-guard.d.ts +36 -0
- package/dist/node/app-guard.js +118 -0
- package/dist/node/app-viewer.d.ts +30 -0
- package/dist/node/app-viewer.js +113 -0
- package/dist/node/auth.d.ts +52 -0
- package/dist/node/auth.js +387 -0
- package/dist/node/scoped-client.d.ts +9 -0
- package/dist/node/scoped-client.js +106 -0
- package/dist/node/server.d.ts +8 -0
- package/dist/node/server.js +5 -0
- package/dist/platform/auth-core.d.ts +10 -0
- package/dist/platform/auth-core.js +44 -0
- package/dist/platform/config-node.d.ts +4 -0
- package/dist/platform/config-node.js +13 -0
- package/dist/platform/session-id.d.ts +1 -0
- package/dist/platform/session-id.js +15 -0
- package/dist/platform/storage/managed-storage.d.ts +25 -0
- package/dist/platform/storage/managed-storage.js +215 -0
- package/dist/platform/strings.d.ts +1 -0
- package/dist/platform/strings.js +6 -0
- package/dist/platform/ui.d.ts +5 -0
- package/dist/platform/ui.js +16 -0
- package/dist/react/agent-selection-scope.d.ts +7 -0
- package/dist/react/agent-selection-scope.js +3 -0
- package/dist/react/bedrock-invokable.d.ts +1 -0
- package/dist/react/bedrock-invokable.js +1 -0
- package/dist/react/chat/index.d.ts +2 -0
- package/dist/react/chat/index.js +3 -0
- package/dist/react/chat/render-parts.d.ts +11 -0
- package/dist/react/chat/render-parts.js +10 -0
- package/dist/react/chat/use-chat-turns.d.ts +9 -0
- package/dist/react/chat/use-chat-turns.js +9 -0
- package/dist/react/connector-setup.d.ts +21 -0
- package/dist/react/connector-setup.js +130 -0
- package/dist/react/file-keys.d.ts +16 -0
- package/dist/react/file-keys.js +16 -0
- package/dist/react/hold-live-start.d.ts +3 -0
- package/dist/react/hold-live-start.js +27 -0
- package/dist/react/human-presence.d.ts +15 -0
- package/dist/react/human-presence.js +62 -0
- package/dist/react/identity-reset-registry.d.ts +2 -0
- package/dist/react/identity-reset-registry.js +14 -0
- package/dist/react/index.d.ts +62 -0
- package/dist/react/index.js +63 -0
- package/dist/react/initial-session-pin.d.ts +14 -0
- package/dist/react/initial-session-pin.js +28 -0
- package/dist/react/invalidate-project.d.ts +22 -0
- package/dist/react/invalidate-project.js +26 -0
- package/dist/react/model-flatten.d.ts +1 -0
- package/dist/react/model-flatten.js +1 -0
- package/dist/react/opencode.d.ts +43 -0
- package/dist/react/opencode.js +43 -0
- package/dist/react/prefetch-session-open.d.ts +5 -0
- package/dist/react/prefetch-session-open.js +48 -0
- package/dist/react/prefetch-session-start.d.ts +2 -0
- package/dist/react/prefetch-session-start.js +9 -0
- package/dist/react/provider-refresh.d.ts +9 -0
- package/dist/react/provider-refresh.js +72 -0
- package/dist/react/provider-selection.d.ts +1 -0
- package/dist/react/provider-selection.js +1 -0
- package/dist/react/pty-query-state.d.ts +2 -0
- package/dist/react/pty-query-state.js +6 -0
- package/dist/react/query-contracts.d.ts +49 -0
- package/dist/react/query-contracts.js +63 -0
- package/dist/react/query-keys.d.ts +105 -0
- package/dist/react/query-keys.js +115 -0
- package/dist/react/reset-identity-state.d.ts +2 -0
- package/dist/react/reset-identity-state.js +19 -0
- package/dist/react/retired-endpoint.d.ts +3 -0
- package/dist/react/retired-endpoint.js +15 -0
- package/dist/react/route-project.d.ts +6 -0
- package/dist/react/route-project.js +9 -0
- package/dist/react/run-pty-command.d.ts +4 -0
- package/dist/react/run-pty-command.js +41 -0
- package/dist/react/runtime-actions.d.ts +31 -0
- package/dist/react/runtime-actions.js +87 -0
- package/dist/react/self-heal-poll-gate.d.ts +8 -0
- package/dist/react/self-heal-poll-gate.js +5 -0
- package/dist/react/session-agent-name-guard.d.ts +1 -0
- package/dist/react/session-agent-name-guard.js +5 -0
- package/dist/react/session-cache-write.d.ts +8 -0
- package/dist/react/session-cache-write.js +116 -0
- package/dist/react/session-start-giveup.d.ts +4 -0
- package/dist/react/session-start-giveup.js +5 -0
- package/dist/react/session-start-stash.d.ts +17 -0
- package/dist/react/session-start-stash.js +146 -0
- package/dist/react/session-stop.d.ts +20 -0
- package/dist/react/session-stop.js +63 -0
- package/dist/react/session-title-sync.d.ts +12 -0
- package/dist/react/session-title-sync.js +88 -0
- package/dist/react/session-transcript-subscription.d.ts +7 -0
- package/dist/react/session-transcript-subscription.js +71 -0
- package/dist/react/sign-in-with-beeuni.d.ts +330 -0
- package/dist/react/sign-in-with-beeuni.js +51 -0
- package/dist/react/teams-install-polling.d.ts +3 -0
- package/dist/react/teams-install-polling.js +4 -0
- package/dist/react/use-accounts.d.ts +47 -0
- package/dist/react/use-accounts.js +31 -0
- package/dist/react/use-admin-accounts.d.ts +236 -0
- package/dist/react/use-admin-accounts.js +287 -0
- package/dist/react/use-admin-activity-analytics.d.ts +48 -0
- package/dist/react/use-admin-activity-analytics.js +47 -0
- package/dist/react/use-admin-analytics.d.ts +331 -0
- package/dist/react/use-admin-analytics.js +85 -0
- package/dist/react/use-admin-billing.d.ts +26 -0
- package/dist/react/use-admin-billing.js +13 -0
- package/dist/react/use-admin-feedback.d.ts +118 -0
- package/dist/react/use-admin-feedback.js +46 -0
- package/dist/react/use-admin-projects.d.ts +31 -0
- package/dist/react/use-admin-projects.js +27 -0
- package/dist/react/use-admin-providers.d.ts +20 -0
- package/dist/react/use-admin-providers.js +45 -0
- package/dist/react/use-admin-role.d.ts +4 -0
- package/dist/react/use-admin-role.js +15 -0
- package/dist/react/use-admin-sandboxes.d.ts +156 -0
- package/dist/react/use-admin-sandboxes.js +52 -0
- package/dist/react/use-authenticated-preview-url.d.ts +3 -0
- package/dist/react/use-authenticated-preview-url.js +96 -0
- package/dist/react/use-beeuni-app-viewer.d.ts +12 -0
- package/dist/react/use-beeuni-app-viewer.js +19 -0
- package/dist/react/use-beeuni-master.d.ts +333 -0
- package/dist/react/use-beeuni-master.js +845 -0
- package/dist/react/use-can.d.ts +35 -0
- package/dist/react/use-can.js +129 -0
- package/dist/react/use-canonical-opencode-session.d.ts +21 -0
- package/dist/react/use-canonical-opencode-session.js +44 -0
- package/dist/react/use-change-requests.d.ts +291 -0
- package/dist/react/use-change-requests.js +31 -0
- package/dist/react/use-connector-query.d.ts +7 -0
- package/dist/react/use-connector-query.js +23 -0
- package/dist/react/use-current-runtime.d.ts +2 -0
- package/dist/react/use-current-runtime.js +6 -0
- package/dist/react/use-feature-flag.d.ts +6 -0
- package/dist/react/use-feature-flag.js +25 -0
- package/dist/react/use-gateway-catalog-sync.d.ts +1 -0
- package/dist/react/use-gateway-catalog-sync.js +40 -0
- package/dist/react/use-gateway-routing-policy.d.ts +8 -0
- package/dist/react/use-gateway-routing-policy.js +36 -0
- package/dist/react/use-impersonation.d.ts +20 -0
- package/dist/react/use-impersonation.js +55 -0
- package/dist/react/use-model-access.d.ts +9 -0
- package/dist/react/use-model-access.js +46 -0
- package/dist/react/use-model-defaults.d.ts +23 -0
- package/dist/react/use-model-defaults.js +115 -0
- package/dist/react/use-model-enablement.d.ts +8 -0
- package/dist/react/use-model-enablement.js +69 -0
- package/dist/react/use-model-store.d.ts +47 -0
- package/dist/react/use-model-store.js +234 -0
- package/dist/react/use-notifications.d.ts +618 -0
- package/dist/react/use-notifications.js +104 -0
- package/dist/react/use-opencode-config.d.ts +12 -0
- package/dist/react/use-opencode-config.js +69 -0
- package/dist/react/use-opencode-events/diagnostics.d.ts +4 -0
- package/dist/react/use-opencode-events/diagnostics.js +42 -0
- package/dist/react/use-opencode-events/handle-event.d.ts +23 -0
- package/dist/react/use-opencode-events/handle-event.js +57 -0
- package/dist/react/use-opencode-events/handle-interaction-event.d.ts +3 -0
- package/dist/react/use-opencode-events/handle-interaction-event.js +41 -0
- package/dist/react/use-opencode-events/handle-message-event.d.ts +3 -0
- package/dist/react/use-opencode-events/handle-message-event.js +32 -0
- package/dist/react/use-opencode-events/handle-session-event.d.ts +4 -0
- package/dist/react/use-opencode-events/handle-session-event.js +240 -0
- package/dist/react/use-opencode-events/handle-workspace-event.d.ts +3 -0
- package/dist/react/use-opencode-events/handle-workspace-event.js +112 -0
- package/dist/react/use-opencode-events/handler-context.d.ts +28 -0
- package/dist/react/use-opencode-events/handler-context.js +1 -0
- package/dist/react/use-opencode-events/helpers.d.ts +27 -0
- package/dist/react/use-opencode-events/helpers.js +126 -0
- package/dist/react/use-opencode-events/hydrate-core.d.ts +22 -0
- package/dist/react/use-opencode-events/hydrate-core.js +78 -0
- package/dist/react/use-opencode-events/index.d.ts +9 -0
- package/dist/react/use-opencode-events/index.js +181 -0
- package/dist/react/use-opencode-events/rehydrate-targets.d.ts +1 -0
- package/dist/react/use-opencode-events/rehydrate-targets.js +3 -0
- package/dist/react/use-opencode-events/runtime-stream-signals.d.ts +19 -0
- package/dist/react/use-opencode-events/runtime-stream-signals.js +22 -0
- package/dist/react/use-opencode-events/stream-revival.d.ts +11 -0
- package/dist/react/use-opencode-events/stream-revival.js +60 -0
- package/dist/react/use-opencode-events/types.d.ts +2 -0
- package/dist/react/use-opencode-events/types.js +1 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +16 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.js +129 -0
- package/dist/react/use-opencode-local.d.ts +72 -0
- package/dist/react/use-opencode-local.js +306 -0
- package/dist/react/use-opencode-mcp.d.ts +29 -0
- package/dist/react/use-opencode-mcp.js +149 -0
- package/dist/react/use-opencode-pty.d.ts +39 -0
- package/dist/react/use-opencode-pty.js +61 -0
- package/dist/react/use-opencode-sessions/agents.d.ts +11 -0
- package/dist/react/use-opencode-sessions/agents.js +57 -0
- package/dist/react/use-opencode-sessions/commands.d.ts +16 -0
- package/dist/react/use-opencode-sessions/commands.js +42 -0
- package/dist/react/use-opencode-sessions/files.d.ts +2 -0
- package/dist/react/use-opencode-sessions/files.js +144 -0
- package/dist/react/use-opencode-sessions/index.d.ts +15 -0
- package/dist/react/use-opencode-sessions/index.js +15 -0
- package/dist/react/use-opencode-sessions/keys.d.ts +102 -0
- package/dist/react/use-opencode-sessions/keys.js +38 -0
- package/dist/react/use-opencode-sessions/mcp.d.ts +2 -0
- package/dist/react/use-opencode-sessions/mcp.js +19 -0
- package/dist/react/use-opencode-sessions/messages.d.ts +57 -0
- package/dist/react/use-opencode-sessions/messages.js +342 -0
- package/dist/react/use-opencode-sessions/no-compaction-model-error.d.ts +3 -0
- package/dist/react/use-opencode-sessions/no-compaction-model-error.js +6 -0
- package/dist/react/use-opencode-sessions/parts.d.ts +12 -0
- package/dist/react/use-opencode-sessions/parts.js +31 -0
- package/dist/react/use-opencode-sessions/permissions.d.ts +5 -0
- package/dist/react/use-opencode-sessions/permissions.js +44 -0
- package/dist/react/use-opencode-sessions/projects.d.ts +6 -0
- package/dist/react/use-opencode-sessions/projects.js +49 -0
- package/dist/react/use-opencode-sessions/provider-load-plan.d.ts +5 -0
- package/dist/react/use-opencode-sessions/provider-load-plan.js +3 -0
- package/dist/react/use-opencode-sessions/providers.d.ts +10 -0
- package/dist/react/use-opencode-sessions/providers.js +98 -0
- package/dist/react/use-opencode-sessions/sessions.d.ts +34 -0
- package/dist/react/use-opencode-sessions/sessions.js +330 -0
- package/dist/react/use-opencode-sessions/shared.d.ts +10 -0
- package/dist/react/use-opencode-sessions/shared.js +36 -0
- package/dist/react/use-opencode-sessions/sharing.d.ts +3 -0
- package/dist/react/use-opencode-sessions/sharing.js +51 -0
- package/dist/react/use-opencode-sessions/tools.d.ts +5 -0
- package/dist/react/use-opencode-sessions/tools.js +48 -0
- package/dist/react/use-opencode-sessions/vcs.d.ts +7 -0
- package/dist/react/use-opencode-sessions/vcs.js +24 -0
- package/dist/react/use-ops-overview.d.ts +63 -0
- package/dist/react/use-ops-overview.js +15 -0
- package/dist/react/use-permission-self-heal.d.ts +10 -0
- package/dist/react/use-permission-self-heal.js +114 -0
- package/dist/react/use-poll-owner.d.ts +1 -0
- package/dist/react/use-poll-owner.js +14 -0
- package/dist/react/use-project-apps.d.ts +879 -0
- package/dist/react/use-project-apps.js +185 -0
- package/dist/react/use-project-config.d.ts +2 -0
- package/dist/react/use-project-config.js +16 -0
- package/dist/react/use-project-files.d.ts +87 -0
- package/dist/react/use-project-files.js +109 -0
- package/dist/react/use-project-gateway.d.ts +26 -0
- package/dist/react/use-project-gateway.js +111 -0
- package/dist/react/use-project-llm-gateway.d.ts +6 -0
- package/dist/react/use-project-llm-gateway.js +20 -0
- package/dist/react/use-project-models.d.ts +4 -0
- package/dist/react/use-project-models.js +31 -0
- package/dist/react/use-project-name.d.ts +4 -0
- package/dist/react/use-project-name.js +35 -0
- package/dist/react/use-project-secrets.d.ts +279 -0
- package/dist/react/use-project-secrets.js +34 -0
- package/dist/react/use-project-session.d.ts +4 -0
- package/dist/react/use-project-session.js +18 -0
- package/dist/react/use-project-sessions.d.ts +447 -0
- package/dist/react/use-project-sessions.js +86 -0
- package/dist/react/use-project-starter-suggestions.d.ts +2 -0
- package/dist/react/use-project-starter-suggestions.js +13 -0
- package/dist/react/use-project-triggers.d.ts +221 -0
- package/dist/react/use-project-triggers.js +53 -0
- package/dist/react/use-prompt-attachments.d.ts +3 -0
- package/dist/react/use-prompt-attachments.js +34 -0
- package/dist/react/use-provider-secrets.d.ts +229 -0
- package/dist/react/use-provider-secrets.js +38 -0
- package/dist/react/use-question-self-heal.d.ts +7 -0
- package/dist/react/use-question-self-heal.js +81 -0
- package/dist/react/use-reminders.d.ts +501 -0
- package/dist/react/use-reminders.js +51 -0
- package/dist/react/use-runtime-boot-stalled.d.ts +2 -0
- package/dist/react/use-runtime-boot-stalled.js +18 -0
- package/dist/react/use-runtime-phase.d.ts +2 -0
- package/dist/react/use-runtime-phase.js +13 -0
- package/dist/react/use-runtime-reconnect.d.ts +52 -0
- package/dist/react/use-runtime-reconnect.js +248 -0
- package/dist/react/use-runtime-supports.d.ts +2 -0
- package/dist/react/use-runtime-supports.js +5 -0
- package/dist/react/use-sandbox-image.d.ts +33 -0
- package/dist/react/use-sandbox-image.js +119 -0
- package/dist/react/use-session-audit.d.ts +4 -0
- package/dist/react/use-session-audit.js +25 -0
- package/dist/react/use-session-message-authors.d.ts +1 -0
- package/dist/react/use-session-message-authors.js +14 -0
- package/dist/react/use-session-messages.d.ts +11 -0
- package/dist/react/use-session-messages.js +62 -0
- package/dist/react/use-session-model-selection.d.ts +8 -0
- package/dist/react/use-session-model-selection.js +20 -0
- package/dist/react/use-session-model-usage.d.ts +1 -0
- package/dist/react/use-session-model-usage.js +13 -0
- package/dist/react/use-session-participants.d.ts +4 -0
- package/dist/react/use-session-participants.js +13 -0
- package/dist/react/use-session-phase.d.ts +8 -0
- package/dist/react/use-session-phase.js +9 -0
- package/dist/react/use-session-picks.d.ts +13 -0
- package/dist/react/use-session-picks.js +65 -0
- package/dist/react/use-session-prefetch.d.ts +6 -0
- package/dist/react/use-session-prefetch.js +22 -0
- package/dist/react/use-session-prompts.d.ts +53 -0
- package/dist/react/use-session-prompts.js +378 -0
- package/dist/react/use-session-send.d.ts +97 -0
- package/dist/react/use-session-send.js +233 -0
- package/dist/react/use-session-start-give-up.d.ts +19 -0
- package/dist/react/use-session-start-give-up.js +59 -0
- package/dist/react/use-session-stream.d.ts +17 -0
- package/dist/react/use-session-stream.js +181 -0
- package/dist/react/use-session-sync.d.ts +43 -0
- package/dist/react/use-session-sync.js +252 -0
- package/dist/react/use-session-transcript-history.d.ts +6 -0
- package/dist/react/use-session-transcript-history.js +38 -0
- package/dist/react/use-session-working.d.ts +37 -0
- package/dist/react/use-session-working.js +217 -0
- package/dist/react/use-session.d.ts +201 -0
- package/dist/react/use-session.js +893 -0
- package/dist/react/use-sessions-needing-input.d.ts +5 -0
- package/dist/react/use-sessions-needing-input.js +23 -0
- package/dist/react/use-static-file-preview.d.ts +9 -0
- package/dist/react/use-static-file-preview.js +72 -0
- package/dist/react/use-system-status.d.ts +38 -0
- package/dist/react/use-system-status.js +5 -0
- package/dist/react/use-teams-installations.d.ts +41 -0
- package/dist/react/use-teams-installations.js +95 -0
- package/dist/react/use-tunnel.d.ts +165 -0
- package/dist/react/use-tunnel.js +186 -0
- package/dist/react/use-visible-agents.d.ts +9 -0
- package/dist/react/use-visible-agents.js +12 -0
- package/dist/react/use-wake-escalation.d.ts +31 -0
- package/dist/react/use-wake-escalation.js +82 -0
- package/dist/transcript.d.ts +50 -0
- package/dist/transcript.js +93 -0
- package/dist/workspace-search/client.d.ts +19 -0
- package/dist/workspace-search/client.js +229 -0
- package/dist/workspace-search/core.d.ts +21 -0
- package/dist/workspace-search/core.js +259 -0
- package/dist/workspace-search/index.d.ts +2 -0
- package/dist/workspace-search/index.js +2 -0
- 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.
|