@beeuni/sdk 0.1.0 → 0.3.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 +53 -92
- package/dist/beeuni.esm.min.js +36 -34
- package/dist/beeuni.global.js +36 -34
- package/dist/browser/cache/idb-sync-cache.js +15 -5
- package/dist/browser/session-sync/server-transcript-mirror.d.ts +7 -1
- package/dist/browser/session-sync/server-transcript-mirror.js +30 -24
- package/dist/browser/session-sync/session-sync-registry.d.ts +3 -1
- package/dist/browser/session-sync/session-sync-registry.js +48 -3
- package/dist/browser/stores/sync-store/keep-unchanged.d.ts +4 -0
- package/dist/browser/stores/sync-store/keep-unchanged.js +34 -0
- package/dist/browser/stores/sync-store.d.ts +7 -0
- package/dist/browser/stores/sync-store.js +122 -35
- package/dist/core/attachments/prompt-attachments.d.ts +4 -0
- package/dist/core/attachments/prompt-attachments.js +34 -0
- package/dist/core/capture/rules.d.ts +17 -0
- package/dist/core/capture/rules.js +27 -0
- package/dist/core/client/beeuni.d.ts +99 -34
- package/dist/core/client/beeuni.js +5 -11
- package/dist/core/client/capture.d.ts +105 -0
- package/dist/core/client/capture.js +48 -0
- package/dist/core/client/facade-catalog.d.ts +0 -4
- package/dist/core/client/facade-catalog.js +1 -5
- package/dist/core/client/facade-identity.d.ts +1 -0
- package/dist/core/client/facade-identity.js +1 -0
- package/dist/core/client/project-access-resources.d.ts +3 -1
- package/dist/core/client/project-access-resources.js +1 -1
- package/dist/core/client/project-connections.d.ts +2 -2
- package/dist/core/client/project-connections.js +2 -2
- package/dist/core/client/project-operations-admin.d.ts +4 -4
- package/dist/core/client/project-operations-review.d.ts +2 -3
- package/dist/core/client/project-operations-review.js +1 -0
- package/dist/core/client/project-operations-workspace.d.ts +4 -4
- package/dist/core/client/project-operations-workspace.js +1 -1
- package/dist/core/client/project-operations.d.ts +9 -19
- package/dist/core/client/project-operations.js +2 -6
- package/dist/core/client/project-platform-security.d.ts +1 -1
- package/dist/core/client/project-platform-settings.d.ts +1 -1
- package/dist/core/client/session-context.d.ts +2 -0
- package/dist/core/client/session-handle.d.ts +13 -0
- package/dist/core/client/session-lifecycle-resources.d.ts +11 -0
- package/dist/core/client/session-lifecycle-resources.js +4 -0
- package/dist/core/client/session-lifecycle-security.d.ts +2 -0
- package/dist/core/client/session-lifecycle-security.js +1 -0
- package/dist/core/client/session-readiness.d.ts +2 -0
- package/dist/core/client/session-readiness.js +20 -1
- package/dist/core/http/api-client.d.ts +1 -7
- package/dist/core/http/api-client.js +2 -37
- package/dist/core/http/auth.d.ts +2 -4
- package/dist/core/http/auth.js +2 -8
- package/dist/core/http/config.d.ts +2 -0
- package/dist/core/http/response-error.js +26 -11
- package/dist/core/http/transport.js +6 -1
- package/dist/core/models/composer-model.d.ts +14 -0
- package/dist/core/models/composer-model.js +21 -1
- package/dist/core/rest/platform-client/capture.d.ts +363 -0
- package/dist/core/rest/platform-client/capture.js +116 -0
- package/dist/core/rest/platform-client/client-policy.d.ts +8 -0
- package/dist/core/rest/platform-client/client-policy.js +30 -0
- package/dist/core/rest/platform-client/index.d.ts +4 -4
- package/dist/core/rest/platform-client/index.js +4 -4
- package/dist/core/rest/platform-client/lifecycle.js +18 -12
- package/dist/core/rest/platform-client/shared.d.ts +5 -0
- package/dist/core/rest/platform-client/shared.js +18 -0
- package/dist/core/rest/platform-client/types.d.ts +1 -1
- package/dist/core/rest/projects-client/account-secret-resources.d.ts +2 -1
- package/dist/core/rest/projects-client/accounts.d.ts +34 -0
- package/dist/core/rest/projects-client/accounts.js +10 -0
- package/dist/core/rest/projects-client/admin-providers.d.ts +0 -61
- package/dist/core/rest/projects-client/admin-providers.js +0 -6
- package/dist/core/rest/projects-client/agent-config.d.ts +3 -0
- package/dist/core/rest/projects-client/apps-fleet.d.ts +5 -1
- package/dist/core/rest/projects-client/apps-fleet.js +2 -2
- package/dist/core/rest/projects-client/apps.d.ts +11 -1
- package/dist/core/rest/projects-client/change-requests.d.ts +2 -0
- package/dist/core/rest/projects-client/change-requests.js +2 -0
- package/dist/core/rest/projects-client/connectors.d.ts +13 -55
- package/dist/core/rest/projects-client/connectors.js +5 -29
- package/dist/core/rest/projects-client/files.d.ts +3 -0
- package/dist/core/rest/projects-client/files.js +4 -0
- package/dist/core/rest/projects-client/gateway.d.ts +5 -0
- package/dist/core/rest/projects-client/git-backend.d.ts +1 -10
- package/dist/core/rest/projects-client/git-backend.js +0 -10
- package/dist/core/rest/projects-client/iam-actions.d.ts +76 -0
- package/dist/core/rest/projects-client/iam-actions.js +101 -0
- package/dist/core/rest/projects-client/iam-sso.d.ts +0 -10
- package/dist/core/rest/projects-client/iam-sso.js +0 -3
- package/dist/core/rest/projects-client/iam.d.ts +1 -0
- package/dist/core/rest/projects-client/iam.js +1 -0
- package/dist/core/rest/projects-client/index.d.ts +1 -4
- package/dist/core/rest/projects-client/index.js +1 -4
- package/dist/core/rest/projects-client/notifications.d.ts +1 -1
- package/dist/core/rest/projects-client/notifications.js +4 -0
- package/dist/core/rest/projects-client/projects.d.ts +4 -2
- package/dist/core/rest/projects-client/projects.js +4 -2
- package/dist/core/rest/projects-client/review-items.d.ts +2 -0
- package/dist/core/rest/projects-client/review-items.js +4 -0
- package/dist/core/rest/projects-client/review.d.ts +17 -3
- package/dist/core/rest/projects-client/review.js +11 -0
- package/dist/core/rest/projects-client/sandbox.d.ts +8 -9
- package/dist/core/rest/projects-client/secrets.d.ts +3 -0
- package/dist/core/rest/projects-client/session-attachments.js +14 -1
- package/dist/core/rest/projects-client/session-sandbox.d.ts +1 -1
- package/dist/core/rest/projects-client/sessions.d.ts +31 -4
- package/dist/core/rest/projects-client/sessions.js +34 -4
- package/dist/core/runtime/runtime-rest-client.js +1 -1
- package/dist/core/runtime/runtime-types.d.ts +1 -0
- package/dist/core/session/control-stream.d.ts +1 -0
- package/dist/core/session/control-stream.js +18 -1
- package/dist/core/session/open-bundle.d.ts +4 -4
- package/dist/core/session/open-bundle.js +29 -46
- package/dist/core/session/turn-end-watch.d.ts +47 -0
- package/dist/core/session/turn-end-watch.js +141 -0
- package/dist/core/session-log/guard.d.ts +6 -0
- package/dist/core/session-log/guard.js +109 -0
- package/dist/core/session-log/index.d.ts +7 -0
- package/dist/core/session-log/index.js +5 -0
- package/dist/core/session-log/saved-log.d.ts +10 -0
- package/dist/core/session-log/saved-log.js +25 -0
- package/dist/core/session-log/source.d.ts +25 -0
- package/dist/core/session-log/source.js +30 -0
- package/dist/core/session-log/store.d.ts +21 -0
- package/dist/core/session-log/store.js +126 -0
- package/dist/core/session-log/tool-call.d.ts +11 -0
- package/dist/core/session-log/tool-call.js +65 -0
- package/dist/core/session-log/turns/blocks.d.ts +60 -0
- package/dist/core/session-log/turns/blocks.js +124 -0
- package/dist/core/session-log/turns/history.d.ts +32 -0
- package/dist/core/session-log/turns/history.js +99 -0
- package/dist/core/session-log/turns/index.d.ts +4 -0
- package/dist/core/session-log/turns/index.js +4 -0
- package/dist/core/session-log/turns/metrics.d.ts +21 -0
- package/dist/core/session-log/turns/metrics.js +29 -0
- package/dist/core/session-log/turns/turn.d.ts +55 -0
- package/dist/core/session-log/turns/turn.js +279 -0
- package/dist/core/session-log/turns/v1-parts.d.ts +8 -0
- package/dist/core/session-log/turns/v1-parts.js +43 -0
- package/dist/core/session-log/types.d.ts +264 -0
- package/dist/core/session-log/types.js +6 -0
- package/dist/core/session-log/v1-view.d.ts +13 -0
- package/dist/core/session-log/v1-view.js +215 -0
- package/dist/core/session-log/v1.d.ts +31 -0
- package/dist/core/session-log/v1.js +473 -0
- package/dist/core/session-sync/copy-store-types.d.ts +19 -0
- package/dist/core/session-sync/copy-store-types.js +1 -0
- package/dist/core/session-sync/saved-copy-store.js +25 -4
- package/dist/core/session-sync/saved-transcript.d.ts +15 -1
- package/dist/core/session-sync/saved-transcript.js +55 -0
- package/dist/core/session-sync/session-sync-controller.js +3 -0
- package/dist/core/stream/event-stream.js +2 -2
- package/dist/core/turns/classify.d.ts +2 -1
- package/dist/core/turns/classify.js +7 -3
- package/dist/core/turns/edit-blocks.d.ts +1 -0
- package/dist/core/turns/edit-blocks.js +15 -0
- package/dist/core/turns/parts.d.ts +3 -2
- package/dist/core/turns/parts.js +4 -2
- package/dist/core/turns/segments/burst-summary.d.ts +1 -0
- package/dist/core/turns/segments/burst-summary.js +24 -0
- package/dist/core/turns/segments/group-steps.d.ts +4 -3
- package/dist/core/turns/segments/group-steps.js +9 -6
- package/dist/core/turns/segments/index.d.ts +1 -0
- package/dist/core/turns/segments/index.js +1 -0
- package/dist/core/turns/segments/narration.d.ts +5 -4
- package/dist/core/turns/segments/narration.js +12 -3
- package/dist/core/turns/segments/session-activity-groups.d.ts +2 -1
- package/dist/core/turns/segments/session-activity-groups.js +3 -1
- package/dist/core/turns/segments/step-label.d.ts +2 -1
- package/dist/core/turns/segments/step-label.js +3 -1
- package/dist/core/turns/segments/work-split.d.ts +10 -0
- package/dist/core/turns/segments/work-split.js +40 -0
- package/dist/core/turns/segments/working-turn.d.ts +4 -2
- package/dist/core/turns/segments/working-turn.js +9 -8
- package/dist/core/turns/state.d.ts +2 -7
- package/dist/core/turns/state.js +28 -134
- package/dist/core/turns/tool-kind.d.ts +1 -1
- package/dist/core/turns/tool-kind.js +3 -2
- package/dist/core/turns/tool-registry.js +1 -0
- package/dist/core/turns/tools/tool-meta.d.ts +3 -2
- package/dist/core/turns/tools/tool-meta.js +5 -2
- package/dist/core/turns/tools/tool-outcome.d.ts +2 -1
- package/dist/core/turns/tools/tool-outcome.js +3 -1
- package/dist/core/turns/types.d.ts +1 -1
- package/dist/core/turns/view-model.js +1 -13
- package/dist/core/warm-session-pool.d.ts +29 -0
- package/dist/core/warm-session-pool.js +127 -0
- package/dist/genui/catalog.d.ts +28 -0
- package/dist/genui/catalog.js +396 -0
- package/dist/genui/expansion.d.ts +3 -0
- package/dist/genui/expansion.js +295 -0
- package/dist/genui/fence-entry.d.ts +2 -0
- package/dist/genui/fence-entry.js +1 -0
- package/dist/genui/fence.d.ts +21 -0
- package/dist/genui/fence.js +138 -0
- package/dist/genui/index.d.ts +6 -0
- package/dist/genui/index.js +6 -0
- package/dist/genui/markdown.d.ts +12 -0
- package/dist/genui/markdown.js +104 -0
- package/dist/genui/parse.d.ts +6 -0
- package/dist/genui/parse.js +75 -0
- package/dist/genui/prompt.d.ts +2 -0
- package/dist/genui/prompt.js +206 -0
- package/dist/genui/react/default-components.d.ts +2 -0
- package/dist/genui/react/default-components.js +72 -0
- package/dist/genui/react/default-components.test.d.ts +1 -0
- package/dist/genui/react/default-components.test.js +94 -0
- package/dist/genui/react/genui-block-disabled.test.d.ts +1 -0
- package/dist/genui/react/genui-block-disabled.test.js +50 -0
- package/dist/genui/react/genui-block.d.ts +28 -0
- package/dist/genui/react/genui-block.js +91 -0
- package/dist/genui/react/genui-block.test.d.ts +1 -0
- package/dist/genui/react/genui-block.test.js +205 -0
- package/dist/genui/react/index.d.ts +2 -0
- package/dist/genui/react/index.js +2 -0
- package/dist/genui/share.d.ts +5 -0
- package/dist/genui/share.js +30 -0
- package/dist/genui/test-fixtures.d.ts +2 -0
- package/dist/genui/test-fixtures.js +16 -0
- package/dist/genui/types.d.ts +29 -0
- package/dist/genui/types.js +1 -0
- package/dist/genui/urls.d.ts +1 -0
- package/dist/genui/urls.js +18 -0
- package/dist/genui/validate.d.ts +9 -0
- package/dist/genui/validate.js +116 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/internal/connector-catalog.d.ts +48 -0
- package/dist/internal/connector-catalog.js +27 -0
- package/dist/internal/host-configuration.d.ts +22 -0
- package/dist/internal/host-configuration.js +28 -0
- package/dist/internal/platform-admin-react.d.ts +12 -0
- package/dist/internal/platform-admin-react.js +13 -0
- package/dist/internal/platform-admin.d.ts +9 -0
- package/dist/internal/platform-admin.js +9 -0
- package/dist/platform/ui.d.ts +8 -2
- package/dist/platform/ui.js +19 -4
- package/dist/react/chat/use-chat-turns.d.ts +1 -1
- package/dist/react/human-presence.d.ts +9 -0
- package/dist/react/human-presence.js +12 -0
- package/dist/react/index.d.ts +4 -13
- package/dist/react/index.js +4 -13
- package/dist/react/opencode.d.ts +1 -0
- package/dist/react/opencode.js +1 -0
- package/dist/react/query-contracts.d.ts +6 -0
- package/dist/react/query-contracts.js +6 -0
- package/dist/react/query-keys.d.ts +17 -2
- package/dist/react/query-keys.js +24 -2
- package/dist/react/reset-identity-state.js +2 -0
- package/dist/react/session-cache-write.d.ts +1 -0
- package/dist/react/session-cache-write.js +20 -0
- package/dist/react/session-transcript-subscription.js +3 -1
- package/dist/react/sign-in-with-beeuni.d.ts +6 -6
- package/dist/react/turn-end-handoff.d.ts +13 -0
- package/dist/react/turn-end-handoff.js +101 -0
- package/dist/react/use-admin-providers.d.ts +3 -6
- package/dist/react/use-admin-providers.js +1 -11
- package/dist/react/use-capture.d.ts +47 -0
- package/dist/react/use-capture.js +173 -0
- package/dist/react/use-feature-flag.js +1 -0
- package/dist/react/use-opencode-events/handle-event.d.ts +1 -0
- package/dist/react/use-opencode-events/handle-event.js +5 -0
- package/dist/react/use-opencode-events/handle-interaction-event.js +8 -3
- package/dist/react/use-opencode-events/handle-session-event.js +13 -8
- package/dist/react/use-opencode-events/handler-context.d.ts +1 -0
- package/dist/react/use-opencode-events/helpers.d.ts +1 -0
- package/dist/react/use-opencode-events/helpers.js +11 -1
- package/dist/react/use-opencode-events/index.js +1 -0
- package/dist/react/use-opencode-local.d.ts +5 -1
- package/dist/react/use-opencode-local.js +15 -2
- package/dist/react/use-opencode-sessions/commands.d.ts +11 -1
- package/dist/react/use-opencode-sessions/commands.js +21 -1
- package/dist/react/use-opencode-sessions/permissions.js +28 -1
- package/dist/react/use-project-sessions.d.ts +1 -1
- package/dist/react/use-project-sessions.js +6 -5
- package/dist/react/use-prompt-attachments.js +1 -0
- package/dist/react/use-review-summary.d.ts +13 -0
- package/dist/react/use-review-summary.js +32 -0
- package/dist/react/use-runtime-reconnect.js +1 -1
- package/dist/react/use-session-list-state.d.ts +6 -0
- package/dist/react/use-session-list-state.js +33 -0
- package/dist/react/use-session-log.d.ts +16 -0
- package/dist/react/use-session-log.js +143 -0
- package/dist/react/use-session-messages.d.ts +2 -1
- package/dist/react/use-session-messages.js +15 -14
- package/dist/react/use-session-stream.js +12 -1
- package/dist/react/use-session-sync.d.ts +2 -2
- package/dist/react/use-session-sync.js +10 -8
- package/dist/react/use-session-transcript-history.js +2 -12
- package/dist/react/use-session-working.d.ts +2 -0
- package/dist/react/use-session-working.js +10 -0
- package/dist/react/use-session.d.ts +6 -0
- package/dist/react/use-session.js +88 -6
- package/package.json +62 -8
|
@@ -9,9 +9,8 @@ export declare function bindProjectOperationsReview(projectId: string): {
|
|
|
9
9
|
claimWarm: (input: Parameters<typeof P.claimWarmProjectSession>[1]) => Promise<P.ProjectSession>;
|
|
10
10
|
};
|
|
11
11
|
review: {
|
|
12
|
-
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<
|
|
13
|
-
|
|
14
|
-
}>;
|
|
12
|
+
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<P.ReviewItemsPage>;
|
|
13
|
+
summary: () => Promise<P.ReviewSummary>;
|
|
15
14
|
get: (reviewItemId: string) => Promise<{
|
|
16
15
|
review_item: P.ApiReviewItem;
|
|
17
16
|
}>;
|
|
@@ -10,6 +10,7 @@ export function bindProjectOperationsReview(projectId) {
|
|
|
10
10
|
},
|
|
11
11
|
review: {
|
|
12
12
|
list: (params) => P.listReviewItems(projectId, params),
|
|
13
|
+
summary: () => P.getReviewSummary(projectId),
|
|
13
14
|
get: (reviewItemId) => P.getReviewItem(projectId, reviewItemId),
|
|
14
15
|
submit: (input) => P.submitReviewItem(projectId, input),
|
|
15
16
|
act: (...a) => P.actReviewItem(projectId, ...a),
|
|
@@ -8,9 +8,8 @@ export declare function bindProjectOperationsWorkspace(projectId: string): {
|
|
|
8
8
|
claimWarm: (input: Parameters<typeof P.claimWarmProjectSession>[1]) => Promise<P.ProjectSession>;
|
|
9
9
|
};
|
|
10
10
|
review: {
|
|
11
|
-
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<
|
|
12
|
-
|
|
13
|
-
}>;
|
|
11
|
+
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<P.ReviewItemsPage>;
|
|
12
|
+
summary: () => Promise<P.ReviewSummary>;
|
|
14
13
|
get: (reviewItemId: string) => Promise<{
|
|
15
14
|
review_item: P.ApiReviewItem;
|
|
16
15
|
}>;
|
|
@@ -64,8 +63,9 @@ export declare function bindProjectOperationsWorkspace(projectId: string): {
|
|
|
64
63
|
inviteCollaborator: (githubUsername: string, permission?: "read" | "write" | undefined) => Promise<P.RepoCollaboratorInvite>;
|
|
65
64
|
};
|
|
66
65
|
changeRequests: {
|
|
67
|
-
list: () => Promise<{
|
|
66
|
+
list: (status?: "all" | P.ChangeRequestStatus | undefined, options?: P.ListChangeRequestsOptions | undefined) => Promise<{
|
|
68
67
|
change_requests: P.ChangeRequest[];
|
|
68
|
+
next_cursor?: string | null;
|
|
69
69
|
}>;
|
|
70
70
|
get: (crId: string) => Promise<P.ChangeRequestDetailResponse>;
|
|
71
71
|
update: (crId: string, input: {
|
|
@@ -20,7 +20,7 @@ export function bindProjectOperationsWorkspace(projectId) {
|
|
|
20
20
|
inviteCollaborator: (...a) => P.inviteRepoCollaborator(projectId, ...a),
|
|
21
21
|
},
|
|
22
22
|
changeRequests: {
|
|
23
|
-
list: () => P.listChangeRequests(projectId),
|
|
23
|
+
list: (...a) => P.listChangeRequests(projectId, ...a),
|
|
24
24
|
get: (crId) => P.getChangeRequest(projectId, crId),
|
|
25
25
|
update: (...a) => P.updateChangeRequest(projectId, ...a),
|
|
26
26
|
diff: (crId) => P.getChangeRequestDiff(projectId, crId),
|
|
@@ -9,9 +9,8 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
9
9
|
claimWarm: (input: Parameters<typeof P.claimWarmProjectSession>[1]) => Promise<P.ProjectSession>;
|
|
10
10
|
};
|
|
11
11
|
review: {
|
|
12
|
-
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<
|
|
13
|
-
|
|
14
|
-
}>;
|
|
12
|
+
list: (params?: Parameters<typeof P.listReviewItems>[1]) => Promise<P.ReviewItemsPage>;
|
|
13
|
+
summary: () => Promise<P.ReviewSummary>;
|
|
15
14
|
get: (reviewItemId: string) => Promise<{
|
|
16
15
|
review_item: P.ApiReviewItem;
|
|
17
16
|
}>;
|
|
@@ -65,8 +64,9 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
65
64
|
inviteCollaborator: (githubUsername: string, permission?: "read" | "write" | undefined) => Promise<P.RepoCollaboratorInvite>;
|
|
66
65
|
};
|
|
67
66
|
changeRequests: {
|
|
68
|
-
list: () => Promise<{
|
|
67
|
+
list: (status?: "all" | P.ChangeRequestStatus | undefined, options?: P.ListChangeRequestsOptions | undefined) => Promise<{
|
|
69
68
|
change_requests: P.ChangeRequest[];
|
|
69
|
+
next_cursor?: string | null;
|
|
70
70
|
}>;
|
|
71
71
|
get: (crId: string) => Promise<P.ChangeRequestDetailResponse>;
|
|
72
72
|
update: (crId: string, input: {
|
|
@@ -152,6 +152,7 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
152
152
|
}>;
|
|
153
153
|
setCredential: (slug: string, credential: string | P.ConnectionCredentialInput) => Promise<{
|
|
154
154
|
ok: boolean;
|
|
155
|
+
sync?: P.ConnectorSyncResult;
|
|
155
156
|
}>;
|
|
156
157
|
deleteCredential: (slug: string) => Promise<{
|
|
157
158
|
ok: boolean;
|
|
@@ -187,8 +188,8 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
187
188
|
tunnelId: string;
|
|
188
189
|
share?: P.ConnectorConnectOwner;
|
|
189
190
|
}) => Promise<P.Connection>;
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
connect: (connectionId: string, input?: P.ConnectionConnectInput | undefined) => Promise<P.ConnectorConnectResult>;
|
|
192
|
+
finalize: (connectionId: string) => Promise<P.ConnectorFinalizeResult>;
|
|
192
193
|
};
|
|
193
194
|
policies: {
|
|
194
195
|
get: (slug: string) => Promise<{
|
|
@@ -202,19 +203,8 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
202
203
|
sync?: P.ConnectorSyncResult;
|
|
203
204
|
}>;
|
|
204
205
|
};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
listSections: (opts?: {
|
|
208
|
-
perCategory?: number;
|
|
209
|
-
maxCategories?: number;
|
|
210
|
-
} | undefined) => Promise<{
|
|
211
|
-
sections: P.PipedreamSection[];
|
|
212
|
-
categories: P.PipedreamCategory[];
|
|
213
|
-
indexReady?: boolean;
|
|
214
|
-
}>;
|
|
215
|
-
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
216
|
-
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
217
|
-
};
|
|
206
|
+
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
207
|
+
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
218
208
|
discover: {
|
|
219
209
|
list: (qOrQuery?: string | P.DiscoverConnectorsQuery | undefined, cursor?: string | undefined) => Promise<P.DiscoverConnectorsPage>;
|
|
220
210
|
sections: (opts?: {
|
|
@@ -24,12 +24,8 @@ export function bindProjectOperations(projectId, connections) {
|
|
|
24
24
|
get: (...a) => P.getConnectorPolicies(projectId, ...a),
|
|
25
25
|
set: (...a) => P.setConnectorPolicies(projectId, ...a),
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
listSections: (...a) => P.listPipedreamSections(projectId, ...a),
|
|
30
|
-
connect: (...a) => P.pipedreamConnect(projectId, ...a),
|
|
31
|
-
finalize: (...a) => P.pipedreamFinalize(projectId, ...a),
|
|
32
|
-
},
|
|
27
|
+
connect: (...a) => P.connectorConnect(projectId, ...a),
|
|
28
|
+
finalize: (...a) => P.connectorFinalize(projectId, ...a),
|
|
33
29
|
discover: {
|
|
34
30
|
list: (...a) => P.listDiscoverConnectors(projectId, ...a),
|
|
35
31
|
sections: (...a) => P.listDiscoverSections(projectId, ...a),
|
|
@@ -33,7 +33,7 @@ export declare function bindProjectPlatformSecurity(projectId: string): {
|
|
|
33
33
|
status: "started";
|
|
34
34
|
template_id: string;
|
|
35
35
|
slug: string;
|
|
36
|
-
providers?: Array<
|
|
36
|
+
providers?: Array<string>;
|
|
37
37
|
}>;
|
|
38
38
|
setProvider: (provider: Parameters<typeof P.updateProjectSandboxProvider>[1]) => Promise<P.UpdateProjectSandboxProviderResult>;
|
|
39
39
|
};
|
|
@@ -34,7 +34,7 @@ export declare function bindProjectPlatformSettings(projectId: string): {
|
|
|
34
34
|
status: "started";
|
|
35
35
|
template_id: string;
|
|
36
36
|
slug: string;
|
|
37
|
-
providers?: Array<
|
|
37
|
+
providers?: Array<string>;
|
|
38
38
|
}>;
|
|
39
39
|
setProvider: (provider: Parameters<typeof P.updateProjectSandboxProvider>[1]) => Promise<P.UpdateProjectSandboxProviderResult>;
|
|
40
40
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProjectSession } from '../rest/projects-client/sessions.js';
|
|
1
2
|
import type { ResolvedPreviewOptions } from '../session/preview-options.js';
|
|
2
3
|
import type { SessionRuntimeEntry } from '../session/session-runtime-registry.js';
|
|
3
4
|
import type { SessionModel } from './session-shared.js';
|
|
@@ -6,6 +7,7 @@ export type SessionBindingContext = {
|
|
|
6
7
|
sessionId: string;
|
|
7
8
|
ensureReady: (opts?: {
|
|
8
9
|
readyTimeoutMs?: number;
|
|
10
|
+
session?: ProjectSession;
|
|
9
11
|
}) => Promise<SessionRuntimeEntry>;
|
|
10
12
|
tryResolveReady: () => SessionRuntimeEntry | null;
|
|
11
13
|
requireReady: (action: string) => SessionRuntimeEntry;
|
|
@@ -115,6 +115,7 @@ export declare function session(projectId: string, sessionId: string, config: Be
|
|
|
115
115
|
messageAuthors: () => Promise<import("../../index.js").SessionMessageAuthors>;
|
|
116
116
|
modelUsage: () => Promise<import("../../index.js").SessionModelUsage>;
|
|
117
117
|
transcriptSync: (options?: Parameters<typeof import("../../index.js").getSessionTranscriptSync>[2]) => Promise<import("../../index.js").SessionTranscriptSyncEnvelope>;
|
|
118
|
+
log: (query?: Parameters<typeof import("../../index.js").getSessionLogPage>[2]) => Promise<import("../session-log/index.js").SessionLogPage | null>;
|
|
118
119
|
turn: () => Promise<import("../../index.js").SessionTurnStatus>;
|
|
119
120
|
prompts: {
|
|
120
121
|
create: (input: import("../../index.js").CreateSessionPromptInput) => Promise<import("../../index.js").CreateSessionPromptResult>;
|
|
@@ -133,6 +134,7 @@ export declare function session(projectId: string, sessionId: string, config: Be
|
|
|
133
134
|
};
|
|
134
135
|
ensureReady: (opts?: {
|
|
135
136
|
readyTimeoutMs?: number;
|
|
137
|
+
session?: import("../../index.js").ProjectSession;
|
|
136
138
|
}) => Promise<import("../../index.js").SessionRuntimeEntry>;
|
|
137
139
|
get: (opts?: {
|
|
138
140
|
showErrors?: boolean;
|
|
@@ -145,11 +147,20 @@ export declare function session(projectId: string, sessionId: string, config: Be
|
|
|
145
147
|
keepalive?: boolean;
|
|
146
148
|
}) => Promise<import("../../index.js").ApiResponse<{
|
|
147
149
|
ok: boolean;
|
|
150
|
+
awake_until?: string | null;
|
|
151
|
+
awake_cap_at?: string | null;
|
|
148
152
|
}>>;
|
|
149
153
|
cost: () => Promise<import("../../index.js").SessionCostDetail>;
|
|
150
154
|
update: (input: Parameters<typeof import("../../index.js").updateProjectSession>[2]) => Promise<import("../../index.js").ProjectSession>;
|
|
151
155
|
delete: () => Promise<{
|
|
152
156
|
ok: boolean;
|
|
157
|
+
restore_until?: string;
|
|
158
|
+
}>;
|
|
159
|
+
restore: () => Promise<{
|
|
160
|
+
ok: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
recover: () => Promise<{
|
|
163
|
+
ok: true;
|
|
153
164
|
}>;
|
|
154
165
|
start: (options?: (number | {
|
|
155
166
|
waitMs?: number;
|
|
@@ -192,6 +203,8 @@ export declare function session(projectId: string, sessionId: string, config: Be
|
|
|
192
203
|
setWatch: (watching: boolean) => Promise<{
|
|
193
204
|
watching: boolean;
|
|
194
205
|
}>;
|
|
206
|
+
setPinned: (pinned: boolean) => Promise<import("../../index.js").SessionListState>;
|
|
207
|
+
setArchived: (archived: boolean) => Promise<import("../../index.js").SessionListState>;
|
|
195
208
|
commit: (input?: Parameters<typeof import("../../index.js").commitSessionChanges>[2]) => Promise<import("../../index.js").CommitSessionResult>;
|
|
196
209
|
publicShares: {
|
|
197
210
|
list: () => Promise<{
|
|
@@ -13,11 +13,20 @@ export declare function bindSessionLifecycleResources(ctx: SessionBindingContext
|
|
|
13
13
|
keepalive?: boolean;
|
|
14
14
|
}) => Promise<import("../../index.js").ApiResponse<{
|
|
15
15
|
ok: boolean;
|
|
16
|
+
awake_until?: string | null;
|
|
17
|
+
awake_cap_at?: string | null;
|
|
16
18
|
}>>;
|
|
17
19
|
cost: () => Promise<P.SessionCostDetail>;
|
|
18
20
|
update: (input: Parameters<typeof P.updateProjectSession>[2]) => Promise<P.ProjectSession>;
|
|
19
21
|
delete: () => Promise<{
|
|
20
22
|
ok: boolean;
|
|
23
|
+
restore_until?: string;
|
|
24
|
+
}>;
|
|
25
|
+
restore: () => Promise<{
|
|
26
|
+
ok: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
recover: () => Promise<{
|
|
29
|
+
ok: true;
|
|
21
30
|
}>;
|
|
22
31
|
start: (options?: (number | {
|
|
23
32
|
waitMs?: number;
|
|
@@ -60,6 +69,8 @@ export declare function bindSessionLifecycleResources(ctx: SessionBindingContext
|
|
|
60
69
|
setWatch: (watching: boolean) => Promise<{
|
|
61
70
|
watching: boolean;
|
|
62
71
|
}>;
|
|
72
|
+
setPinned: (pinned: boolean) => Promise<P.SessionListState>;
|
|
73
|
+
setArchived: (archived: boolean) => Promise<P.SessionListState>;
|
|
63
74
|
commit: (input?: Parameters<typeof P.commitSessionChanges>[2]) => Promise<P.CommitSessionResult>;
|
|
64
75
|
publicShares: {
|
|
65
76
|
list: () => Promise<{
|
|
@@ -10,6 +10,8 @@ export function bindSessionLifecycleResources(ctx) {
|
|
|
10
10
|
ctx.forgetReady();
|
|
11
11
|
return P.deleteProjectSession(ctx.projectId, ctx.sessionId);
|
|
12
12
|
},
|
|
13
|
+
restore: () => P.restoreProjectSession(ctx.projectId, ctx.sessionId),
|
|
14
|
+
recover: () => P.recoverProjectSession(ctx.projectId, ctx.sessionId),
|
|
13
15
|
start: (...a) => P.startProjectSession(ctx.projectId, ctx.sessionId, ...a),
|
|
14
16
|
startOrThrow: (...a) => P.startProjectSessionOrThrow(ctx.projectId, ctx.sessionId, ...a),
|
|
15
17
|
restart: () => {
|
|
@@ -34,6 +36,8 @@ export function bindSessionLifecycleResources(ctx) {
|
|
|
34
36
|
participants: () => P.getSessionParticipants(ctx.projectId, ctx.sessionId),
|
|
35
37
|
watch: () => P.getSessionWatch(ctx.projectId, ctx.sessionId),
|
|
36
38
|
setWatch: (watching) => P.setSessionWatch(ctx.projectId, ctx.sessionId, watching),
|
|
39
|
+
setPinned: (pinned) => P.setSessionPinned(ctx.projectId, ctx.sessionId, pinned),
|
|
40
|
+
setArchived: (archived) => P.setSessionArchived(ctx.projectId, ctx.sessionId, archived),
|
|
37
41
|
commit: (input) => P.commitSessionChanges(ctx.projectId, ctx.sessionId, input),
|
|
38
42
|
publicShares: {
|
|
39
43
|
list: () => P.listSessionPublicShares(ctx.projectId, ctx.sessionId),
|
|
@@ -20,6 +20,7 @@ export declare function bindSessionLifecycleSecurity(ctx: SessionBindingContext)
|
|
|
20
20
|
messageAuthors: () => Promise<P.SessionMessageAuthors>;
|
|
21
21
|
modelUsage: () => Promise<P.SessionModelUsage>;
|
|
22
22
|
transcriptSync: (options?: Parameters<typeof P.getSessionTranscriptSync>[2]) => Promise<P.SessionTranscriptSyncEnvelope>;
|
|
23
|
+
log: (query?: Parameters<typeof P.getSessionLogPage>[2]) => Promise<import("../session-log/index.js").SessionLogPage | null>;
|
|
23
24
|
turn: () => Promise<P.SessionTurnStatus>;
|
|
24
25
|
prompts: {
|
|
25
26
|
create: (input: P.CreateSessionPromptInput) => Promise<P.CreateSessionPromptResult>;
|
|
@@ -38,5 +39,6 @@ export declare function bindSessionLifecycleSecurity(ctx: SessionBindingContext)
|
|
|
38
39
|
};
|
|
39
40
|
ensureReady: (opts?: {
|
|
40
41
|
readyTimeoutMs?: number;
|
|
42
|
+
session?: P.ProjectSession;
|
|
41
43
|
}) => Promise<import("../../index.js").SessionRuntimeEntry>;
|
|
42
44
|
};
|
|
@@ -16,6 +16,7 @@ export function bindSessionLifecycleSecurity(ctx) {
|
|
|
16
16
|
messageAuthors: () => P.getSessionMessageAuthors(ctx.projectId, ctx.sessionId),
|
|
17
17
|
modelUsage: () => P.getSessionModelUsage(ctx.projectId, ctx.sessionId),
|
|
18
18
|
transcriptSync: (options) => P.getSessionTranscriptSync(ctx.projectId, ctx.sessionId, options),
|
|
19
|
+
log: (query) => P.getSessionLogPage(ctx.projectId, ctx.sessionId, query),
|
|
19
20
|
turn: () => P.getSessionTurn(ctx.projectId, ctx.sessionId),
|
|
20
21
|
prompts: {
|
|
21
22
|
create: (input) => P.createSessionPrompt(ctx.projectId, ctx.sessionId, input),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type BeeuniPlatformConfig } from '../http/config.js';
|
|
2
|
+
import type { ProjectSession } from '../rest/projects-client/sessions.js';
|
|
2
3
|
import { type SessionRuntimeEntry } from '../session/session-runtime-registry.js';
|
|
3
4
|
export declare function bindSessionReadiness(projectId: string, sessionId: string, config: BeeuniPlatformConfig): {
|
|
4
5
|
ensureReady: (opts?: {
|
|
5
6
|
readyTimeoutMs?: number;
|
|
7
|
+
session?: ProjectSession;
|
|
6
8
|
}) => Promise<SessionRuntimeEntry>;
|
|
7
9
|
tryResolveReady: () => SessionRuntimeEntry | null;
|
|
8
10
|
requireReady: (action: string) => SessionRuntimeEntry;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { platformConfig } from '../http/config.js';
|
|
2
|
+
import { projectSessionStartSeed } from '../rest/projects-client/session-sandbox.js';
|
|
3
|
+
import { setCurrentRuntime } from '../session/current-runtime.js';
|
|
2
4
|
import { loadPreviewUrlTemplate } from '../session/preview-config.js';
|
|
3
|
-
import {
|
|
5
|
+
import { getSandboxUrlForExternalId } from '../session/server-store/url-helpers.js';
|
|
6
|
+
import { clearSessionRuntime, getSessionRuntime, setSessionRuntime, } from '../session/session-runtime-registry.js';
|
|
4
7
|
import { SessionNotReadyError, inFlightSessionStarts } from './session-shared.js';
|
|
5
8
|
import { bindSessionStart } from './session-start.js';
|
|
6
9
|
export function bindSessionReadiness(projectId, sessionId, config) {
|
|
@@ -20,6 +23,22 @@ export function bindSessionReadiness(projectId, sessionId, config) {
|
|
|
20
23
|
return cached;
|
|
21
24
|
const readyTimeoutMs = opts?.readyTimeoutMs ?? 180_000;
|
|
22
25
|
const previewConfig = loadPreviewUrlTemplate(platformConfig().backendUrl ?? config.backendUrl).catch(() => null);
|
|
26
|
+
const seed = opts?.session?.session_id === sessionId ? projectSessionStartSeed(opts.session) : null;
|
|
27
|
+
const seededSandbox = seed?.sandbox?.external_id;
|
|
28
|
+
const seededRuntimeSession = seed?.runtime_session_id;
|
|
29
|
+
if (seededSandbox && seededRuntimeSession) {
|
|
30
|
+
const runtimeUrl = getSandboxUrlForExternalId(seededSandbox);
|
|
31
|
+
setCurrentRuntime(runtimeUrl, seededSandbox);
|
|
32
|
+
_ready = {
|
|
33
|
+
runtimeSessionId: seededRuntimeSession,
|
|
34
|
+
opencodeSessionId: seededRuntimeSession,
|
|
35
|
+
runtimeUrl,
|
|
36
|
+
sandboxId: seededSandbox,
|
|
37
|
+
};
|
|
38
|
+
setSessionRuntime(projectId, sessionId, _ready);
|
|
39
|
+
await previewConfig;
|
|
40
|
+
return _ready;
|
|
41
|
+
}
|
|
23
42
|
const key = `${projectId}\n${sessionId}`;
|
|
24
43
|
const inFlight = inFlightSessionStarts.get(key);
|
|
25
44
|
if (inFlight) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ApiError } from './api/errors.js';
|
|
2
|
-
export { isAdminBypassEnabled, setAdminBypass } from './transport.js';
|
|
3
2
|
export { ApiError, AuthError, BillingError, RequestTooLargeError, parseBillingError, isAuthFailure, isBillingError, formatBillingErrorForUI, FEATURE_DISABLED_CODE, isFeatureDisabledError, featureDisabledKey, type ApiErrorFields, type BillingErrorUI, type FeatureDisabledError, } from './api/errors.js';
|
|
4
3
|
export interface ErrorContext {
|
|
5
4
|
operation?: string;
|
|
@@ -22,14 +21,9 @@ export interface ApiResponse<T = any> {
|
|
|
22
21
|
export declare const FEATURE_NOT_SUPPORTED_CODE = "feature_not_supported";
|
|
23
22
|
export declare const MODEL_NOT_SERVABLE_CODE = "model_not_servable";
|
|
24
23
|
export declare const PROVISION_IN_FLIGHT_CODE = "provision_in_flight";
|
|
24
|
+
export declare const SANDBOX_STATE_CHANGE_IN_PROGRESS_CODE = "sandbox_state_change_in_progress";
|
|
25
25
|
export declare const ANALYTICS_UNAVAILABLE_CODE = "analytics_unavailable";
|
|
26
26
|
export declare const ACCOUNTS_LIST_UNAVAILABLE_CODE = "accounts_list_unavailable";
|
|
27
|
-
export declare const supabaseClient: {
|
|
28
|
-
execute<T = any>(queryFn: () => Promise<{
|
|
29
|
-
data: T | null;
|
|
30
|
-
error: any;
|
|
31
|
-
}>, errorContext?: ErrorContext): Promise<ApiResponse<T>>;
|
|
32
|
-
};
|
|
33
27
|
declare function postStream(endpoint: string, data: unknown, options?: ApiClientOptions): Promise<Response>;
|
|
34
28
|
export declare const backendApi: {
|
|
35
29
|
putRaw: <T = any>(endpoint: string, body: BodyInit, options?: Omit<RequestInit & ApiClientOptions, "method" | "body">) => Promise<ApiResponse<T>>;
|
|
@@ -1,51 +1,16 @@
|
|
|
1
1
|
import { syntheticUnauthenticatedResponse } from '../../platform/auth-core.js';
|
|
2
|
-
import {
|
|
2
|
+
import { AuthError } from './api/errors.js';
|
|
3
3
|
import { platformConfig } from './config.js';
|
|
4
4
|
import { makeRequest } from './request.js';
|
|
5
5
|
import { send } from './transport.js';
|
|
6
|
-
export { isAdminBypassEnabled, setAdminBypass } from './transport.js';
|
|
7
6
|
const getApiUrl = () => platformConfig().backendUrl || '';
|
|
8
7
|
export { ApiError, AuthError, BillingError, RequestTooLargeError, parseBillingError, isAuthFailure, isBillingError, formatBillingErrorForUI, FEATURE_DISABLED_CODE, isFeatureDisabledError, featureDisabledKey, } from './api/errors.js';
|
|
9
8
|
export const FEATURE_NOT_SUPPORTED_CODE = 'feature_not_supported';
|
|
10
9
|
export const MODEL_NOT_SERVABLE_CODE = 'model_not_servable';
|
|
11
10
|
export const PROVISION_IN_FLIGHT_CODE = 'provision_in_flight';
|
|
11
|
+
export const SANDBOX_STATE_CHANGE_IN_PROGRESS_CODE = 'sandbox_state_change_in_progress';
|
|
12
12
|
export const ANALYTICS_UNAVAILABLE_CODE = 'analytics_unavailable';
|
|
13
13
|
export const ACCOUNTS_LIST_UNAVAILABLE_CODE = 'accounts_list_unavailable';
|
|
14
|
-
export const supabaseClient = {
|
|
15
|
-
async execute(queryFn, errorContext) {
|
|
16
|
-
try {
|
|
17
|
-
const { data, error } = await queryFn();
|
|
18
|
-
if (error) {
|
|
19
|
-
const apiError = new ApiError(error.message || 'Database error', {
|
|
20
|
-
code: error.code,
|
|
21
|
-
details: error,
|
|
22
|
-
});
|
|
23
|
-
platformConfig().onError?.(apiError, errorContext);
|
|
24
|
-
return {
|
|
25
|
-
error: apiError,
|
|
26
|
-
success: false,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
data: data,
|
|
31
|
-
success: true,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
const apiError = error instanceof Error
|
|
36
|
-
? new ApiError(error.message, {
|
|
37
|
-
name: error.name || 'ApiError',
|
|
38
|
-
stack: error.stack,
|
|
39
|
-
})
|
|
40
|
-
: new ApiError(String(error));
|
|
41
|
-
platformConfig().onError?.(apiError, errorContext);
|
|
42
|
-
return {
|
|
43
|
-
error: apiError,
|
|
44
|
-
success: false,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
14
|
async function postStream(endpoint, data, options = {}) {
|
|
50
15
|
const { timeout = 30000, fetch: fetchImpl } = options;
|
|
51
16
|
const controller = new AbortController();
|
package/dist/core/http/auth.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type TokenRetryOptions } from '../../platform/auth-core.js';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function getAuthToken(): Promise<string | null>;
|
|
3
|
+
export declare function getAuthTokenWithRetry(options?: TokenRetryOptions): Promise<string | null>;
|
|
4
4
|
export declare function invalidateTokenCache(): void;
|
|
5
5
|
export declare function setCachedAuthToken(token: string | null): void;
|
|
6
6
|
export declare function setBootstrapAuthToken(_token: string | null): void;
|
|
7
|
-
export declare function getAuthToken(): Promise<string | null>;
|
|
8
|
-
export declare function getAuthTokenWithRetry(options?: TokenRetryOptions): Promise<string | null>;
|
|
9
7
|
export declare function authenticatedFetch(input: RequestInfo | URL, init?: RequestInit, options?: {
|
|
10
8
|
retryOnAuthError?: boolean;
|
|
11
9
|
timeoutMs?: number | null;
|
package/dist/core/http/auth.js
CHANGED
|
@@ -2,10 +2,10 @@ import { syntheticUnauthenticatedResponse, withTokenRetry, } from '../../platfor
|
|
|
2
2
|
import { AuthError } from './api/errors.js';
|
|
3
3
|
import { platformConfig } from './config.js';
|
|
4
4
|
import { hostToken, invalidateHostToken, send } from './transport.js';
|
|
5
|
-
export async function
|
|
5
|
+
export async function getAuthToken() {
|
|
6
6
|
return hostToken();
|
|
7
7
|
}
|
|
8
|
-
export async function
|
|
8
|
+
export async function getAuthTokenWithRetry(options) {
|
|
9
9
|
return withTokenRetry(() => platformConfig().getToken(), options, invalidateTokenCache);
|
|
10
10
|
}
|
|
11
11
|
export function invalidateTokenCache() {
|
|
@@ -16,12 +16,6 @@ export function setCachedAuthToken(token) {
|
|
|
16
16
|
invalidateHostToken();
|
|
17
17
|
}
|
|
18
18
|
export function setBootstrapAuthToken(_token) { }
|
|
19
|
-
export async function getAuthToken() {
|
|
20
|
-
return getSupabaseAccessToken();
|
|
21
|
-
}
|
|
22
|
-
export async function getAuthTokenWithRetry(options) {
|
|
23
|
-
return getSupabaseAccessTokenWithRetry(options);
|
|
24
|
-
}
|
|
25
19
|
export async function authenticatedFetch(input, init, options) {
|
|
26
20
|
try {
|
|
27
21
|
return await send(input, init, {
|
|
@@ -10,11 +10,13 @@ export interface BeeuniPlatformConfig {
|
|
|
10
10
|
getToken: (() => Promise<string | null>) & {
|
|
11
11
|
invalidate?: (rejectedToken: string) => void;
|
|
12
12
|
};
|
|
13
|
+
credentialHeader?: string;
|
|
13
14
|
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
14
15
|
eventStreamTransport?: RuntimeEventTransport;
|
|
15
16
|
clientSource?: 'api' | 'cli' | 'mobile' | 'tui' | 'web';
|
|
16
17
|
clientVersion?: string;
|
|
17
18
|
onError?: (error: unknown, context?: unknown) => void;
|
|
19
|
+
onAccessRemedy?: (code: 'sso_required' | 'account_mfa_required') => void;
|
|
18
20
|
sandboxId?: string | null;
|
|
19
21
|
billingEnabled?: boolean;
|
|
20
22
|
getUserId?: () => Promise<string | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { abortable, createAbortError } from './abort.js';
|
|
2
|
-
import { ACCOUNTS_LIST_UNAVAILABLE_CODE, ANALYTICS_UNAVAILABLE_CODE, FEATURE_NOT_SUPPORTED_CODE, MODEL_NOT_SERVABLE_CODE, PROVISION_IN_FLIGHT_CODE, } from './api-client.js';
|
|
2
|
+
import { ACCOUNTS_LIST_UNAVAILABLE_CODE, ANALYTICS_UNAVAILABLE_CODE, FEATURE_NOT_SUPPORTED_CODE, MODEL_NOT_SERVABLE_CODE, PROVISION_IN_FLIGHT_CODE, SANDBOX_STATE_CHANGE_IN_PROGRESS_CODE, } from './api-client.js';
|
|
3
3
|
import { ApiError, RequestTooLargeError, parseBillingError } from './api/errors.js';
|
|
4
4
|
import { platformConfig } from './config.js';
|
|
5
5
|
const REQUEST_DEADLINE_CODE = 'request_deadline';
|
|
@@ -22,6 +22,15 @@ const isGitMirrorUnavailableResponse = (status, errorData, message) => {
|
|
|
22
22
|
: undefined;
|
|
23
23
|
return (code === GIT_MIRROR_UNAVAILABLE_CODE || LEGACY_GIT_MIRROR_UNAVAILABLE_MESSAGE.test(message));
|
|
24
24
|
};
|
|
25
|
+
const CONNECTORS_PROVIDER_UNAVAILABLE_CODE = 'connectors_provider_unavailable';
|
|
26
|
+
const isConnectorsProviderUnavailableResponse = (status, errorData) => {
|
|
27
|
+
if (status !== 503)
|
|
28
|
+
return false;
|
|
29
|
+
const code = typeof errorData === 'object' && errorData !== null && 'code' in errorData
|
|
30
|
+
? errorData.code
|
|
31
|
+
: undefined;
|
|
32
|
+
return code === CONNECTORS_PROVIDER_UNAVAILABLE_CODE;
|
|
33
|
+
};
|
|
25
34
|
async function readErrorBody(response, signal) {
|
|
26
35
|
let message = `HTTP ${response.status}: ${response.statusText}`;
|
|
27
36
|
let data = null;
|
|
@@ -46,9 +55,12 @@ async function readErrorBody(response, signal) {
|
|
|
46
55
|
function isExpectedResponse(status, data, message) {
|
|
47
56
|
return (isRequestDeadlineResponse(status, data, message) ||
|
|
48
57
|
isGitMirrorUnavailableResponse(status, data, message) ||
|
|
58
|
+
isConnectorsProviderUnavailableResponse(status, data) ||
|
|
49
59
|
(status === 501 && data?.code === FEATURE_NOT_SUPPORTED_CODE) ||
|
|
50
60
|
(status === 409 &&
|
|
51
|
-
(data?.code === MODEL_NOT_SERVABLE_CODE ||
|
|
61
|
+
(data?.code === MODEL_NOT_SERVABLE_CODE ||
|
|
62
|
+
data?.code === PROVISION_IN_FLIGHT_CODE ||
|
|
63
|
+
data?.code === SANDBOX_STATE_CHANGE_IN_PROGRESS_CODE)) ||
|
|
52
64
|
(status === 503 &&
|
|
53
65
|
(data?.code === ANALYTICS_UNAVAILABLE_CODE || data?.code === ACCOUNTS_LIST_UNAVAILABLE_CODE)));
|
|
54
66
|
}
|
|
@@ -66,18 +78,21 @@ export async function handleErrorResponse(response, signal, showErrors, errorCon
|
|
|
66
78
|
});
|
|
67
79
|
if (response.status === 402)
|
|
68
80
|
error = parseBillingError(error);
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
? 'beeuni:sso-required'
|
|
75
|
-
: null;
|
|
76
|
-
if (remedyEvent && typeof window !== 'undefined' && typeof window.dispatchEvent === 'function') {
|
|
81
|
+
const remedyCode = response.status === 403 &&
|
|
82
|
+
(data?.code === 'account_mfa_required' || data?.code === 'sso_required')
|
|
83
|
+
? data.code
|
|
84
|
+
: null;
|
|
85
|
+
if (remedyCode) {
|
|
77
86
|
try {
|
|
78
|
-
|
|
87
|
+
platformConfig().onAccessRemedy?.(remedyCode);
|
|
79
88
|
}
|
|
80
89
|
catch { }
|
|
90
|
+
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function') {
|
|
91
|
+
try {
|
|
92
|
+
window.dispatchEvent(new CustomEvent(remedyCode === 'account_mfa_required' ? 'beeuni:mfa-required' : 'beeuni:sso-required'));
|
|
93
|
+
}
|
|
94
|
+
catch { }
|
|
95
|
+
}
|
|
81
96
|
}
|
|
82
97
|
if (response.status === 431) {
|
|
83
98
|
error = new RequestTooLargeError(431, {
|
|
@@ -45,7 +45,12 @@ function withPlatformHeaders(url, base, token) {
|
|
|
45
45
|
setHeader(headers, 'x-beeuni-admin-bypass', '1');
|
|
46
46
|
for (const [name, value] of Object.entries(impersonationHeaders(url)))
|
|
47
47
|
setHeader(headers, name, value);
|
|
48
|
-
|
|
48
|
+
const credentialHeader = platformConfig().credentialHeader?.trim();
|
|
49
|
+
if (credentialHeader) {
|
|
50
|
+
if (!hasHeader(headers, credentialHeader))
|
|
51
|
+
setHeader(headers, credentialHeader, token);
|
|
52
|
+
}
|
|
53
|
+
else if (!hasHeader(headers, 'authorization'))
|
|
49
54
|
setHeader(headers, 'Authorization', `Bearer ${token}`);
|
|
50
55
|
return headers;
|
|
51
56
|
}
|
|
@@ -3,6 +3,20 @@ import type { ModelDefaultsResponse } from '../rest/projects-client/model-defaul
|
|
|
3
3
|
import { type FlatModel } from './model-flatten.js';
|
|
4
4
|
import { type ModelKey } from './model-key.js';
|
|
5
5
|
export declare function resolveModelDefault(data: ModelDefaultsResponse | undefined, agentName: string | undefined): ModelKey | undefined;
|
|
6
|
+
export declare function latestPromptModel(messages: ReadonlyArray<{
|
|
7
|
+
role: string;
|
|
8
|
+
model?: {
|
|
9
|
+
provider?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
} | null;
|
|
12
|
+
}> | null | undefined): ModelKey | undefined;
|
|
13
|
+
export declare function sessionModelCandidates(input: {
|
|
14
|
+
session?: {
|
|
15
|
+
metadata?: Record<string, unknown> | null;
|
|
16
|
+
} | null;
|
|
17
|
+
lastPromptModel?: ModelKey;
|
|
18
|
+
gatewayEnabled: boolean;
|
|
19
|
+
}): ModelKey[];
|
|
6
20
|
export interface ComposerModelResolution {
|
|
7
21
|
model: ModelKey | undefined;
|
|
8
22
|
explicit: ModelKey | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { autoSeedableModels } from '@beeuni/llm-catalog/lite';
|
|
2
|
+
import { sessionModelPin } from '../rest/projects-client/sessions.js';
|
|
2
3
|
import { healBedrockModelKey } from './bedrock-invokable.js';
|
|
3
4
|
import { isOfferedModel } from './model-flatten.js';
|
|
4
|
-
import { wireToModelKey } from './model-key.js';
|
|
5
|
+
import { modelRefToKey, wireToModelKey } from './model-key.js';
|
|
5
6
|
export function resolveModelDefault(data, agentName) {
|
|
6
7
|
const wire = (agentName ? data?.agentDefaults?.[agentName] : undefined) ??
|
|
7
8
|
data?.projectDefault ??
|
|
@@ -9,6 +10,25 @@ export function resolveModelDefault(data, agentName) {
|
|
|
9
10
|
data?.platformDefault;
|
|
10
11
|
return wire ? wireToModelKey(wire) : undefined;
|
|
11
12
|
}
|
|
13
|
+
export function latestPromptModel(messages) {
|
|
14
|
+
for (let i = (messages?.length ?? 0) - 1; i >= 0; i--) {
|
|
15
|
+
const message = messages[i];
|
|
16
|
+
const { provider, model } = message.model ?? {};
|
|
17
|
+
if (message.role === 'user' && provider && model)
|
|
18
|
+
return { providerID: provider, modelID: model };
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const CHOSEN_PIN_SOURCES = new Set(['explicit', 'repointed']);
|
|
23
|
+
export function sessionModelCandidates(input) {
|
|
24
|
+
const pin = input.session ? sessionModelPin(input.session) : null;
|
|
25
|
+
const pinKey = pin ? modelRefToKey(pin, input.gatewayEnabled) : undefined;
|
|
26
|
+
const chosen = CHOSEN_PIN_SOURCES.has(String(input.session?.metadata?.opencode_model_source));
|
|
27
|
+
const ordered = chosen
|
|
28
|
+
? [pinKey, input.lastPromptModel]
|
|
29
|
+
: [input.lastPromptModel, pinKey];
|
|
30
|
+
return ordered.filter((model) => !!model);
|
|
31
|
+
}
|
|
12
32
|
export function resolveComposerModel(input) {
|
|
13
33
|
const { models, providers } = input;
|
|
14
34
|
const isValid = (model) => isOfferedModel(models, model);
|