@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
|
@@ -45,5 +45,11 @@ export declare const FRESHNESS: {
|
|
|
45
45
|
readonly modelPicker: "config";
|
|
46
46
|
readonly gateway: "inventory";
|
|
47
47
|
readonly triggers: "config";
|
|
48
|
+
readonly captureDevices: "directory";
|
|
49
|
+
readonly captureTimeline: "inventory";
|
|
50
|
+
readonly capturePolicy: "config";
|
|
51
|
+
readonly captureWorkspace: "config";
|
|
52
|
+
readonly captureEnrollmentTokens: "config";
|
|
53
|
+
readonly captureEnrollments: "directory";
|
|
48
54
|
};
|
|
49
55
|
export {};
|
|
@@ -60,4 +60,10 @@ export const FRESHNESS = {
|
|
|
60
60
|
modelPicker: 'config',
|
|
61
61
|
gateway: 'inventory',
|
|
62
62
|
triggers: 'config',
|
|
63
|
+
captureDevices: 'directory',
|
|
64
|
+
captureTimeline: 'inventory',
|
|
65
|
+
capturePolicy: 'config',
|
|
66
|
+
captureWorkspace: 'config',
|
|
67
|
+
captureEnrollmentTokens: 'config',
|
|
68
|
+
captureEnrollments: 'directory',
|
|
63
69
|
};
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
import type { ReviewItemsQuery } from '../core/rest/projects-client/review.js';
|
|
1
2
|
import type { ListProjectSessionsOptions } from '../core/rest/projects-client/sessions.js';
|
|
2
|
-
type SessionListFilters = Pick<ListProjectSessionsOptions, 'parent' | 'startedBy' | 'q' | 'labels'>;
|
|
3
|
+
type SessionListFilters = Pick<ListProjectSessionsOptions, 'parent' | 'startedBy' | 'q' | 'labels' | 'view'>;
|
|
3
4
|
export declare const qk: {
|
|
5
|
+
readonly capture: {
|
|
6
|
+
readonly deviceGrant: (userCode: string) => readonly ["capture", "device-grant", string];
|
|
7
|
+
readonly account: (accountId: string) => readonly ["capture", "account", string];
|
|
8
|
+
readonly workspace: (accountId: string) => readonly ["capture", "account", string, "workspace"];
|
|
9
|
+
readonly devices: (accountId: string, scope: string, userId: string | null) => readonly ["capture", "account", string, "devices", string, string | null];
|
|
10
|
+
readonly timeline: (accountId: string) => readonly ["capture", "account", string, "timeline"];
|
|
11
|
+
readonly timelineRead: (accountId: string, kind: string, query: unknown) => readonly ["capture", "account", string, "timeline", string, unknown];
|
|
12
|
+
readonly policy: (accountId: string) => readonly ["capture", "account", string, "policy"];
|
|
13
|
+
readonly enrollmentTokens: (accountId: string) => readonly ["capture", "account", string, "enrollment-tokens"];
|
|
14
|
+
readonly enrollments: (accountId: string) => readonly ["capture", "account", string, "enrollments"];
|
|
15
|
+
};
|
|
4
16
|
readonly accounts: {
|
|
5
17
|
readonly scope: () => readonly ["kx", "accounts"];
|
|
6
18
|
readonly list: (userId: string | null | undefined) => readonly ["kx", "accounts", string];
|
|
@@ -30,9 +42,11 @@ export declare const qk: {
|
|
|
30
42
|
readonly session: (projectId: string, sessionId: string) => readonly ["kx", "drives", "session", string, string];
|
|
31
43
|
};
|
|
32
44
|
readonly project: {
|
|
33
|
-
readonly starterSuggestions: (id: string) => readonly ["kx", "project", string, "starter-suggestions"];
|
|
34
45
|
readonly scope: (id: string) => readonly ["kx", "project", string];
|
|
35
46
|
readonly needsInput: (id: string) => readonly ["kx", "project", string, "needs-input"];
|
|
47
|
+
readonly reviewSummary: (id: string) => readonly ["kx", "project", string, "review-summary"];
|
|
48
|
+
readonly reviewItemsScope: (id: string) => readonly ["kx", "project", string, "review-items"];
|
|
49
|
+
readonly reviewItemPages: (id: string, query?: ReviewItemsQuery) => readonly ["kx", "project", string, "review-items", "pages", "all" | import("../index.js").ReviewSegment, "all" | import("../index.js").ReviewItemKind, string, number | "default"];
|
|
36
50
|
readonly summary: (id: string) => readonly ["kx", "project", string, "summary"];
|
|
37
51
|
readonly detail: (id: string) => readonly ["kx", "project", string, "detail"];
|
|
38
52
|
readonly config: (id: string) => readonly ["kx", "project", string, "config"];
|
|
@@ -41,6 +55,7 @@ export declare const qk: {
|
|
|
41
55
|
readonly sessionsScope: (id: string) => readonly ["kx", "project", string, "sessions"];
|
|
42
56
|
readonly sessions: (id: string, scope?: "visible" | "project") => readonly ["kx", "project", string, "sessions", "list", "project" | "visible"];
|
|
43
57
|
readonly sessionsPaged: (id: string, scope?: "visible" | "project", filters?: SessionListFilters) => readonly ["kx", "project", string, "sessions", "list-paged", "project" | "visible"] | readonly ["kx", "project", string, "sessions", "list-paged", "project" | "visible", {
|
|
58
|
+
view?: "archived" | "pinned" | undefined;
|
|
44
59
|
labels?: string[] | undefined;
|
|
45
60
|
parent: string | null;
|
|
46
61
|
startedBy: "me" | "others" | "automated" | null;
|
package/dist/react/query-keys.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
function normalizeSessionListFilters(filters) {
|
|
2
2
|
const q = filters?.q?.trim();
|
|
3
3
|
const labels = filters?.labels?.length ? [...filters.labels].sort() : null;
|
|
4
|
-
|
|
4
|
+
const view = filters?.view;
|
|
5
|
+
if (!filters?.parent && !filters?.startedBy && !q && !labels && !view)
|
|
5
6
|
return undefined;
|
|
6
7
|
return {
|
|
7
8
|
parent: filters?.parent ?? null,
|
|
8
9
|
startedBy: filters?.startedBy ?? null,
|
|
9
10
|
q: q ?? null,
|
|
10
11
|
...(labels ? { labels } : {}),
|
|
12
|
+
...(view ? { view } : {}),
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
export const qk = {
|
|
16
|
+
capture: {
|
|
17
|
+
deviceGrant: (userCode) => ['capture', 'device-grant', userCode],
|
|
18
|
+
account: (accountId) => ['capture', 'account', accountId],
|
|
19
|
+
workspace: (accountId) => [...qk.capture.account(accountId), 'workspace'],
|
|
20
|
+
devices: (accountId, scope, userId) => [...qk.capture.account(accountId), 'devices', scope, userId],
|
|
21
|
+
timeline: (accountId) => [...qk.capture.account(accountId), 'timeline'],
|
|
22
|
+
timelineRead: (accountId, kind, query) => [...qk.capture.timeline(accountId), kind, query],
|
|
23
|
+
policy: (accountId) => [...qk.capture.account(accountId), 'policy'],
|
|
24
|
+
enrollmentTokens: (accountId) => [...qk.capture.account(accountId), 'enrollment-tokens'],
|
|
25
|
+
enrollments: (accountId) => [...qk.capture.account(accountId), 'enrollments'],
|
|
26
|
+
},
|
|
14
27
|
accounts: {
|
|
15
28
|
scope: () => ['kx', 'accounts'],
|
|
16
29
|
list: (userId) => [...qk.accounts.scope(), userId ?? 'anonymous'],
|
|
@@ -42,9 +55,18 @@ export const qk = {
|
|
|
42
55
|
session: (projectId, sessionId) => [...qk.drives.scope(), 'session', projectId, sessionId],
|
|
43
56
|
},
|
|
44
57
|
project: {
|
|
45
|
-
starterSuggestions: (id) => [...qk.project.scope(id), 'starter-suggestions'],
|
|
46
58
|
scope: (id) => ['kx', 'project', id],
|
|
47
59
|
needsInput: (id) => [...qk.project.scope(id), 'needs-input'],
|
|
60
|
+
reviewSummary: (id) => [...qk.project.scope(id), 'review-summary'],
|
|
61
|
+
reviewItemsScope: (id) => [...qk.project.scope(id), 'review-items'],
|
|
62
|
+
reviewItemPages: (id, query = {}) => [
|
|
63
|
+
...qk.project.reviewItemsScope(id),
|
|
64
|
+
'pages',
|
|
65
|
+
query.segment ?? 'all',
|
|
66
|
+
query.kind ?? 'all',
|
|
67
|
+
query.sessionId ?? 'all',
|
|
68
|
+
query.limit ?? 'default',
|
|
69
|
+
],
|
|
48
70
|
summary: (id) => [...qk.project.scope(id), 'summary'],
|
|
49
71
|
detail: (id) => [...qk.project.scope(id), 'detail'],
|
|
50
72
|
config: (id) => [...qk.project.scope(id), 'config'],
|
|
@@ -4,6 +4,7 @@ import { useSessionWorkingStore } from '../browser/stores/session-working-store.
|
|
|
4
4
|
import { useSyncStore } from '../browser/stores/sync-store.js';
|
|
5
5
|
import { resetSessionCacheOwnership } from '../browser/session-sync/session-cache-ownership.js';
|
|
6
6
|
import { resetSessionSyncControllers } from '../browser/session-sync/session-sync-registry.js';
|
|
7
|
+
import { resetSessionOpenBundles } from '../core/session/open-bundle.js';
|
|
7
8
|
import { registerIdentityReset, runIdentityResets } from './identity-reset-registry.js';
|
|
8
9
|
import { resetSessionOpenPrefetches } from './prefetch-session-open.js';
|
|
9
10
|
import './use-model-store.js';
|
|
@@ -14,6 +15,7 @@ registerIdentityReset(() => useDiagnosticsStore.getState().clearAll());
|
|
|
14
15
|
registerIdentityReset(resetSessionSyncControllers);
|
|
15
16
|
registerIdentityReset(resetSessionCacheOwnership);
|
|
16
17
|
registerIdentityReset(resetSessionOpenPrefetches);
|
|
18
|
+
registerIdentityReset(resetSessionOpenBundles);
|
|
17
19
|
export function resetIdentityState() {
|
|
18
20
|
runIdentityResets();
|
|
19
21
|
}
|
|
@@ -3,6 +3,7 @@ import { type ProjectSession } from '../core/rest/projects-client/sessions.js';
|
|
|
3
3
|
export type ProjectSessionsUpdater = (sessions: ProjectSession[]) => ProjectSession[];
|
|
4
4
|
export declare function applyToCachedSessionShape(cached: unknown, update: ProjectSessionsUpdater): unknown;
|
|
5
5
|
export declare function updateCachedProjectSessions(queryClient: QueryClient, projectId: string, update: ProjectSessionsUpdater): void;
|
|
6
|
+
export declare function findCachedProjectSession(queryClient: QueryClient, projectId: string, match: (session: ProjectSession) => boolean): ProjectSession | undefined;
|
|
6
7
|
export declare function upsertIntoCachedSessionShape(cached: unknown, session: ProjectSession): unknown;
|
|
7
8
|
export declare function removeCachedProjectSession(queryClient: QueryClient, projectId: string, sessionId: string): () => void;
|
|
8
9
|
export declare function upsertCachedProjectSession(queryClient: QueryClient, projectId: string, session: ProjectSession): void;
|
|
@@ -21,6 +21,10 @@ function sessionBelongsInList(projectId, query, session) {
|
|
|
21
21
|
return true;
|
|
22
22
|
if (filters.q)
|
|
23
23
|
return false;
|
|
24
|
+
if (filters.view === 'pinned' && !session.pinned_at)
|
|
25
|
+
return false;
|
|
26
|
+
if (filters.view === 'archived' && !session.archived_at)
|
|
27
|
+
return false;
|
|
24
28
|
if (filters.parent === 'root' && parentId !== null)
|
|
25
29
|
return false;
|
|
26
30
|
if (filters.parent && filters.parent !== 'root')
|
|
@@ -68,6 +72,22 @@ export function updateCachedProjectSessions(queryClient, projectId, update) {
|
|
|
68
72
|
predicate: (query) => isSessionCacheKey(projectId, query),
|
|
69
73
|
}, (cached) => applyToCachedSessionShape(cached, update));
|
|
70
74
|
}
|
|
75
|
+
export function findCachedProjectSession(queryClient, projectId, match) {
|
|
76
|
+
let found;
|
|
77
|
+
const entries = queryClient.getQueriesData({
|
|
78
|
+
queryKey: qk.project.sessionsScope(projectId),
|
|
79
|
+
predicate: (query) => isSessionCacheKey(projectId, query),
|
|
80
|
+
});
|
|
81
|
+
for (const [, cached] of entries) {
|
|
82
|
+
applyToCachedSessionShape(cached, (rows) => {
|
|
83
|
+
found ??= rows.find(match);
|
|
84
|
+
return rows;
|
|
85
|
+
});
|
|
86
|
+
if (found)
|
|
87
|
+
return found;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
71
91
|
export function upsertIntoCachedSessionShape(cached, session) {
|
|
72
92
|
const upsert = (items) => {
|
|
73
93
|
const index = items.findIndex((row) => row.session_id === session.session_id);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { getSessionCacheOwnership, resolveSessionCacheOwnerScope, sessionCacheOwnerScopesConflict, } from '../browser/session-sync/session-cache-ownership.js';
|
|
3
|
+
import { sessionLogRowsFor } from '../core/session-log/v1-view.js';
|
|
3
4
|
import { useCurrentRuntime } from './use-current-runtime.js';
|
|
4
5
|
export function useReadableSessionId(sessionId, beeuniSessionScope) {
|
|
5
6
|
const runtimeScope = useCurrentRuntime((state) => state.sandboxId) ?? 'none';
|
|
@@ -9,7 +10,8 @@ export function useReadableSessionId(sessionId, beeuniSessionScope) {
|
|
|
9
10
|
return cacheBelongsToAnotherRuntime ? '' : sessionId;
|
|
10
11
|
}
|
|
11
12
|
export function selectSessionRows(state, sessionId) {
|
|
12
|
-
|
|
13
|
+
const rows = state.buildSessionMessages(sessionId, state.messages[sessionId], state.parts);
|
|
14
|
+
return sessionLogRowsFor(state.sessionLogs, sessionId, rows, (id) => state.optimisticEchoOf(sessionId, id));
|
|
13
15
|
}
|
|
14
16
|
const toolSignatures = new WeakMap();
|
|
15
17
|
function toolSignature(parts) {
|
|
@@ -51,6 +51,7 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
51
51
|
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
52
52
|
id?: string | undefined | undefined;
|
|
53
53
|
content?: string | undefined | undefined;
|
|
54
|
+
rev?: string | undefined | undefined;
|
|
54
55
|
role?: import("react").AriaRole | undefined;
|
|
55
56
|
dir?: string | undefined | undefined;
|
|
56
57
|
download?: any;
|
|
@@ -61,9 +62,12 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
61
62
|
security?: string | undefined | undefined;
|
|
62
63
|
onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
63
64
|
slot?: string | undefined | undefined;
|
|
65
|
+
target?: import("react").HTMLAttributeAnchorTarget | undefined;
|
|
66
|
+
rel?: string | undefined | undefined;
|
|
67
|
+
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
68
|
+
onEnded?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
64
69
|
hrefLang?: string | undefined | undefined;
|
|
65
70
|
ping?: string | undefined | undefined;
|
|
66
|
-
target?: import("react").HTMLAttributeAnchorTarget | undefined;
|
|
67
71
|
defaultChecked?: boolean | undefined | undefined;
|
|
68
72
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
69
73
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -72,7 +76,7 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
72
76
|
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
73
77
|
autoFocus?: boolean | undefined | undefined;
|
|
74
78
|
className?: string | undefined | undefined;
|
|
75
|
-
contentEditable?: (boolean | "true" | "false") | "
|
|
79
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
76
80
|
contextMenu?: string | undefined | undefined;
|
|
77
81
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
78
82
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
@@ -85,8 +89,6 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
85
89
|
datatype?: string | undefined | undefined;
|
|
86
90
|
inlist?: any;
|
|
87
91
|
property?: string | undefined | undefined;
|
|
88
|
-
rel?: string | undefined | undefined;
|
|
89
|
-
rev?: string | undefined | undefined;
|
|
90
92
|
typeof?: string | undefined | undefined;
|
|
91
93
|
vocab?: string | undefined | undefined;
|
|
92
94
|
autoCorrect?: string | undefined | undefined;
|
|
@@ -209,7 +211,6 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
209
211
|
onEmptiedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
210
212
|
onEncrypted?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
211
213
|
onEncryptedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
212
|
-
onEnded?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
213
214
|
onEndedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
214
215
|
onLoadedData?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
215
216
|
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -243,7 +244,6 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
|
|
|
243
244
|
onWaitingCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
244
245
|
onAuxClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
245
246
|
onAuxClickCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
246
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
247
247
|
onClickCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
248
248
|
onContextMenu?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
249
249
|
onContextMenuCapture?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TurnEndWatchDeps } from '../core/session/turn-end-watch.js';
|
|
2
|
+
export declare function resetTurnEndHandoffForTests(deps?: Partial<TurnEndWatchDeps>): void;
|
|
3
|
+
export declare function turnEndHandoffWatching(): string[];
|
|
4
|
+
export interface TurnEndHandoffInput {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
projectId: string;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
runtimeSessionId?: string | null;
|
|
9
|
+
working: boolean;
|
|
10
|
+
openTurnToken: string | null;
|
|
11
|
+
lastEndedToken: string | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function useTurnEndHandoff(input: TurnEndHandoffInput): void;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { getSessionTurn } from '../core/rest/projects-client/sessions.js';
|
|
5
|
+
import { openSessionStream, sessionStreamConnected } from '../core/session/control-stream.js';
|
|
6
|
+
import { createTurnEndWatch, } from '../core/session/turn-end-watch.js';
|
|
7
|
+
import { unwrapError } from '../core/turns/errors.js';
|
|
8
|
+
import { hasNotifySink, notifySessionError, notifyTaskComplete } from '../platform/ui.js';
|
|
9
|
+
import { registerIdentityReset } from './identity-reset-registry.js';
|
|
10
|
+
import { findCachedProjectSession } from './session-cache-write.js';
|
|
11
|
+
import { realRuntimeTitle } from './use-opencode-events/helpers.js';
|
|
12
|
+
import { runtimeKeys } from './use-opencode-sessions/index.js';
|
|
13
|
+
let watch = null;
|
|
14
|
+
let overrides = null;
|
|
15
|
+
function announce(...[handoff, outcome, watchedSinceMs]) {
|
|
16
|
+
const title = handoff.title?.();
|
|
17
|
+
if (outcome.kind === 'completed') {
|
|
18
|
+
notifyTaskComplete(handoff.sessionId, title, { watchedSinceMs, projectId: handoff.projectId });
|
|
19
|
+
}
|
|
20
|
+
else if (outcome.kind === 'failed') {
|
|
21
|
+
notifySessionError(handoff.sessionId, unwrapError(outcome.error), title, {
|
|
22
|
+
projectId: handoff.projectId,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function subscribeTurnFrames(projectId, sessionId, onRead) {
|
|
27
|
+
const handle = openSessionStream({
|
|
28
|
+
projectId,
|
|
29
|
+
sessionId,
|
|
30
|
+
onControl: (frame) => {
|
|
31
|
+
if (frame.type !== 'beeuni.control.turn')
|
|
32
|
+
return;
|
|
33
|
+
const payload = frame.payload;
|
|
34
|
+
if (!payload?.known || !Array.isArray(payload.turns))
|
|
35
|
+
return;
|
|
36
|
+
onRead({
|
|
37
|
+
turns: payload.turns,
|
|
38
|
+
...(payload.last_ended ? { last_ended: payload.last_ended } : {}),
|
|
39
|
+
...(payload.recent_failures ? { recent_failures: payload.recent_failures } : {}),
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return () => handle.close();
|
|
44
|
+
}
|
|
45
|
+
function turnEndWatch() {
|
|
46
|
+
watch ??= createTurnEndWatch({
|
|
47
|
+
readTurn: (projectId, sessionId) => getSessionTurn(projectId, sessionId, { showErrors: false }),
|
|
48
|
+
subscribe: subscribeTurnFrames,
|
|
49
|
+
pushLive: sessionStreamConnected,
|
|
50
|
+
onEnded: announce,
|
|
51
|
+
...overrides,
|
|
52
|
+
});
|
|
53
|
+
return watch;
|
|
54
|
+
}
|
|
55
|
+
registerIdentityReset(() => watch?.releaseAll());
|
|
56
|
+
export function resetTurnEndHandoffForTests(deps) {
|
|
57
|
+
overrides = deps ?? null;
|
|
58
|
+
watch = null;
|
|
59
|
+
}
|
|
60
|
+
export function turnEndHandoffWatching() {
|
|
61
|
+
return watch?.watching() ?? [];
|
|
62
|
+
}
|
|
63
|
+
function sessionTitle(queryClient, projectId, sessionId, runtimeSessionId) {
|
|
64
|
+
const row = findCachedProjectSession(queryClient, projectId, (session) => session.session_id === sessionId);
|
|
65
|
+
const named = row?.custom_name || row?.name;
|
|
66
|
+
if (named)
|
|
67
|
+
return named;
|
|
68
|
+
if (!runtimeSessionId)
|
|
69
|
+
return undefined;
|
|
70
|
+
const runtime = queryClient.getQueryData(runtimeKeys.runtimeSession(runtimeSessionId)) ??
|
|
71
|
+
queryClient.getQueryData(runtimeKeys.sessions())?.find((s) => s.id === runtimeSessionId);
|
|
72
|
+
return realRuntimeTitle(runtime?.title) ?? undefined;
|
|
73
|
+
}
|
|
74
|
+
export function useTurnEndHandoff(input) {
|
|
75
|
+
const queryClient = useQueryClient();
|
|
76
|
+
const latest = useRef(input);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
latest.current = input;
|
|
79
|
+
});
|
|
80
|
+
const { enabled, projectId, sessionId } = input;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!enabled || !projectId || !sessionId)
|
|
83
|
+
return;
|
|
84
|
+
watch?.release(projectId, sessionId);
|
|
85
|
+
return () => {
|
|
86
|
+
const last = latest.current;
|
|
87
|
+
if (!last.working || last.projectId !== projectId || last.sessionId !== sessionId)
|
|
88
|
+
return;
|
|
89
|
+
if (!hasNotifySink())
|
|
90
|
+
return;
|
|
91
|
+
const runtimeSessionId = last.runtimeSessionId;
|
|
92
|
+
turnEndWatch().watch({
|
|
93
|
+
projectId,
|
|
94
|
+
sessionId,
|
|
95
|
+
openTurnToken: last.openTurnToken,
|
|
96
|
+
lastEndedToken: last.lastEndedToken,
|
|
97
|
+
title: () => sessionTitle(queryClient, projectId, sessionId, runtimeSessionId),
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}, [enabled, projectId, sessionId, queryClient]);
|
|
101
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function useAdminProviderAnalytics(days: number, enabled: boolean): import("@tanstack/react-query").UseQueryResult<import("../index.js").AdminProviderAnalytics, Error>;
|
|
1
|
+
export declare function useAdminProviderDistribution(): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderDistribution, Error>;
|
|
2
|
+
export declare function useAdminProviderSandboxes(): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderSandboxesResponse, Error>;
|
|
3
|
+
export declare function useAdminProviderAnalytics(days: number, enabled: boolean): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderAnalytics, Error>;
|
|
5
4
|
export declare function useAdminProviderFallback(): import("@tanstack/react-query").UseQueryResult<{
|
|
6
5
|
enabled: boolean;
|
|
7
6
|
}, Error>;
|
|
@@ -16,5 +15,3 @@ export interface AdminProviderMigrationVariables {
|
|
|
16
15
|
export declare function useSetAdminProviderDistribution(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<unknown, Error, Record<string, number>, unknown>;
|
|
17
16
|
export declare function useMigrateAdminSandboxProvider(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<unknown, Error, AdminProviderMigrationVariables, unknown>;
|
|
18
17
|
export declare function useSetAdminProviderFallback(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<unknown, Error, boolean, unknown>;
|
|
19
|
-
export declare function useAdminBootModes(): import("@tanstack/react-query").UseQueryResult<import("../index.js").AdminBootModes, Error>;
|
|
20
|
-
export declare function useSetAdminBootModes(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<import("../index.js").AdminBootModes, Error, AdminBootModePolicy, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { getAdminProviderDistribution, listAdminSandboxes, getAdminProviderAnalytics, getAdminProviderFallback, setAdminProviderDistribution, migrateAdminSandboxProvider, setAdminProviderFallback
|
|
2
|
+
import { getAdminProviderDistribution, listAdminSandboxes, getAdminProviderAnalytics, getAdminProviderFallback, setAdminProviderDistribution, migrateAdminSandboxProvider, setAdminProviderFallback } from '../core/rest/projects-client/admin-providers.js';
|
|
3
3
|
export function useAdminProviderDistribution() {
|
|
4
4
|
return useQuery({ queryKey: ['admin', 'provider-distribution'], queryFn: () => getAdminProviderDistribution() });
|
|
5
5
|
}
|
|
@@ -33,13 +33,3 @@ export function useSetAdminProviderFallback(options = {}) {
|
|
|
33
33
|
void qc.invalidateQueries({ queryKey: ['admin', 'provider-fallback'] });
|
|
34
34
|
} });
|
|
35
35
|
}
|
|
36
|
-
export function useAdminBootModes() {
|
|
37
|
-
return useQuery({ queryKey: ['admin', 'boot-modes'], queryFn: () => getAdminBootModes(), refetchInterval: 30_000 });
|
|
38
|
-
}
|
|
39
|
-
export function useSetAdminBootModes(options = {}) {
|
|
40
|
-
const qc = useQueryClient();
|
|
41
|
-
return useMutation({ mutationFn: (policy) => setAdminBootModes(policy), onError: options.onError, onSuccess: (data) => {
|
|
42
|
-
options.onSuccess?.();
|
|
43
|
-
qc.setQueryData(['admin', 'boot-modes'], data);
|
|
44
|
-
} });
|
|
45
|
-
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type CaptureEnrollmentStatus, type CaptureEnrollmentTokenInput, type CaptureDaysQuery, type CapturePolicy, type CaptureSearchQuery, type CaptureWindowQuery } from '../core/rest/platform-client/capture.js';
|
|
2
|
+
export declare function useCaptureDeviceGrant(userCode: string | null | undefined): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureDeviceGrantDetail, Error>;
|
|
3
|
+
export declare function useApproveCaptureDevice(): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureDeviceGrant, Error, {
|
|
4
|
+
userCode: string;
|
|
5
|
+
accountId?: string;
|
|
6
|
+
}, unknown>;
|
|
7
|
+
export declare function useDenyCaptureDevice(): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureDeviceGrant, Error, string, unknown>;
|
|
8
|
+
type AccountId = string | null | undefined;
|
|
9
|
+
export declare function useCaptureDevices(accountId: AccountId, opts?: {
|
|
10
|
+
scope?: 'mine' | 'account';
|
|
11
|
+
userId?: string;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<{
|
|
13
|
+
devices: import("../index.js").CaptureDevice[];
|
|
14
|
+
health: import("../index.js").CaptureHealthSummary;
|
|
15
|
+
}, Error>;
|
|
16
|
+
export declare function useRevokeCaptureDevice(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureDevice, Error, string, unknown>;
|
|
17
|
+
export declare function useCaptureDays(accountId: AccountId, query?: CaptureDaysQuery): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureDays, Error>;
|
|
18
|
+
export declare function useCaptureTimeline(accountId: AccountId, query: CaptureWindowQuery | null): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureTimeline, Error>;
|
|
19
|
+
export declare function useCaptureTimelineItems(accountId: AccountId, query: CaptureWindowQuery | null): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureTimelineItems, Error>;
|
|
20
|
+
export declare function useCaptureSearch(accountId: AccountId, query: CaptureSearchQuery | null): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureSearchResult, Error>;
|
|
21
|
+
export declare function useCaptureChunkMedia(accountId: AccountId, chunkId: string | null | undefined, opts?: {
|
|
22
|
+
userId?: string;
|
|
23
|
+
}): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureChunkMedia, Error>;
|
|
24
|
+
export declare function useCaptureEnrollmentTokens(accountId: AccountId): import("@tanstack/react-query").UseQueryResult<{
|
|
25
|
+
tokens: import("../index.js").CaptureEnrollmentToken[];
|
|
26
|
+
}, Error>;
|
|
27
|
+
export declare function useCreateCaptureEnrollmentToken(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureEnrollmentTokenSecret, Error, CaptureEnrollmentTokenInput, unknown>;
|
|
28
|
+
export declare function useRevokeCaptureEnrollmentToken(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureEnrollmentToken, Error, string, unknown>;
|
|
29
|
+
export declare function useCaptureEnrollments(accountId: AccountId, opts?: {
|
|
30
|
+
status?: CaptureEnrollmentStatus;
|
|
31
|
+
}): import("@tanstack/react-query").UseQueryResult<{
|
|
32
|
+
enrollments: import("../index.js").CaptureEnrollment[];
|
|
33
|
+
}, Error>;
|
|
34
|
+
export declare function useApproveCaptureEnrollment(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureEnrollment, Error, {
|
|
35
|
+
enrollmentId: string;
|
|
36
|
+
userId?: string | null;
|
|
37
|
+
}, unknown>;
|
|
38
|
+
export declare function useDenyCaptureEnrollment(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureEnrollment, Error, string, unknown>;
|
|
39
|
+
export declare function useLinkCaptureDevice(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureDevice, Error, {
|
|
40
|
+
deviceId: string;
|
|
41
|
+
userId: string | null;
|
|
42
|
+
}, unknown>;
|
|
43
|
+
export declare function useCapturePolicy(accountId: AccountId): import("@tanstack/react-query").UseQueryResult<import("../index.js").CapturePolicyRecord, Error>;
|
|
44
|
+
export declare function useSetCapturePolicy(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CapturePolicyRecord, Error, CapturePolicy, unknown>;
|
|
45
|
+
export declare function useCaptureWorkspace(accountId: AccountId): import("@tanstack/react-query").UseQueryResult<import("../index.js").CaptureWorkspace, Error>;
|
|
46
|
+
export declare function useSetCaptureEnabled(accountId: AccountId): import("@tanstack/react-query").UseMutationResult<import("../index.js").CaptureWorkspace, Error, boolean, unknown>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { approveCaptureDeviceGrant, approveCaptureEnrollment, createCaptureEnrollmentToken, denyCaptureEnrollment, listCaptureEnrollments, listCaptureEnrollmentTokens, linkCaptureDevice, revokeCaptureEnrollmentToken, denyCaptureDeviceGrant, getCaptureChunkMedia, getCaptureDays, getCaptureDeviceGrant, getCapturePolicy, getCaptureTimeline, getCaptureTimelineItems, getCaptureWorkspace, listCaptureDevices, revokeCaptureDevice, searchCapture, setCaptureEnabled, setCapturePolicy, } from '../core/rest/platform-client/capture.js';
|
|
4
|
+
import { contract, FRESHNESS } from './query-contracts.js';
|
|
5
|
+
import { qk } from './query-keys.js';
|
|
6
|
+
export function useCaptureDeviceGrant(userCode) {
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: qk.capture.deviceGrant(userCode ?? ''),
|
|
9
|
+
queryFn: () => getCaptureDeviceGrant(userCode),
|
|
10
|
+
enabled: !!userCode,
|
|
11
|
+
...contract('volatile'),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function useApproveCaptureDevice() {
|
|
15
|
+
const queryClient = useQueryClient();
|
|
16
|
+
return useMutation({
|
|
17
|
+
mutationFn: (args) => approveCaptureDeviceGrant(args.userCode, args.accountId),
|
|
18
|
+
onSuccess: (grant, args) => queryClient.setQueryData(qk.capture.deviceGrant(args.userCode), grant),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function useDenyCaptureDevice() {
|
|
22
|
+
const queryClient = useQueryClient();
|
|
23
|
+
return useMutation({
|
|
24
|
+
mutationFn: (userCode) => denyCaptureDeviceGrant(userCode),
|
|
25
|
+
onSuccess: (grant, userCode) => queryClient.setQueryData(qk.capture.deviceGrant(userCode), grant),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function useCaptureDevices(accountId, opts = {}) {
|
|
29
|
+
return useQuery({
|
|
30
|
+
queryKey: qk.capture.devices(accountId ?? '', opts.scope ?? 'mine', opts.userId ?? null),
|
|
31
|
+
queryFn: () => listCaptureDevices(accountId, opts),
|
|
32
|
+
enabled: !!accountId,
|
|
33
|
+
...contract(FRESHNESS.captureDevices),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function useRevokeCaptureDevice(accountId) {
|
|
37
|
+
const queryClient = useQueryClient();
|
|
38
|
+
return useMutation({
|
|
39
|
+
mutationFn: (deviceId) => revokeCaptureDevice(accountId, deviceId),
|
|
40
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: qk.capture.account(accountId ?? '') }),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function useCaptureDays(accountId, query = {}) {
|
|
44
|
+
return useQuery({
|
|
45
|
+
queryKey: qk.capture.timelineRead(accountId ?? '', 'days', query),
|
|
46
|
+
queryFn: () => getCaptureDays(accountId, query),
|
|
47
|
+
enabled: !!accountId,
|
|
48
|
+
...contract(FRESHNESS.captureTimeline),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function useCaptureTimeline(accountId, query) {
|
|
52
|
+
return useQuery({
|
|
53
|
+
queryKey: qk.capture.timelineRead(accountId ?? '', 'runs', query),
|
|
54
|
+
queryFn: () => getCaptureTimeline(accountId, query ?? undefined),
|
|
55
|
+
enabled: !!accountId && !!query,
|
|
56
|
+
...contract(FRESHNESS.captureTimeline),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export function useCaptureTimelineItems(accountId, query) {
|
|
60
|
+
return useQuery({
|
|
61
|
+
queryKey: qk.capture.timelineRead(accountId ?? '', 'items', query),
|
|
62
|
+
queryFn: () => getCaptureTimelineItems(accountId, query ?? undefined),
|
|
63
|
+
enabled: !!accountId && !!query,
|
|
64
|
+
...contract(FRESHNESS.captureTimeline),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export function useCaptureSearch(accountId, query) {
|
|
68
|
+
return useQuery({
|
|
69
|
+
queryKey: qk.capture.timelineRead(accountId ?? '', 'search', query),
|
|
70
|
+
queryFn: () => searchCapture(accountId, query),
|
|
71
|
+
enabled: !!accountId && !!query?.q.trim(),
|
|
72
|
+
...contract(FRESHNESS.captureTimeline),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function useCaptureChunkMedia(accountId, chunkId, opts = {}) {
|
|
76
|
+
return useQuery({
|
|
77
|
+
queryKey: qk.capture.timelineRead(accountId ?? '', 'media', { chunkId, userId: opts.userId ?? null }),
|
|
78
|
+
queryFn: () => getCaptureChunkMedia(accountId, chunkId, opts),
|
|
79
|
+
enabled: !!accountId && !!chunkId,
|
|
80
|
+
...contract(FRESHNESS.captureTimeline),
|
|
81
|
+
staleTime: 240_000,
|
|
82
|
+
refetchInterval: 240_000,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export function useCaptureEnrollmentTokens(accountId) {
|
|
86
|
+
return useQuery({
|
|
87
|
+
queryKey: qk.capture.enrollmentTokens(accountId ?? ''),
|
|
88
|
+
queryFn: () => listCaptureEnrollmentTokens(accountId),
|
|
89
|
+
enabled: !!accountId,
|
|
90
|
+
...contract(FRESHNESS.captureEnrollmentTokens),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function useCreateCaptureEnrollmentToken(accountId) {
|
|
94
|
+
const queryClient = useQueryClient();
|
|
95
|
+
return useMutation({
|
|
96
|
+
mutationFn: (input) => createCaptureEnrollmentToken(accountId, input),
|
|
97
|
+
onSuccess: () => void queryClient.invalidateQueries({ queryKey: qk.capture.enrollmentTokens(accountId ?? '') }),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export function useRevokeCaptureEnrollmentToken(accountId) {
|
|
101
|
+
const queryClient = useQueryClient();
|
|
102
|
+
return useMutation({
|
|
103
|
+
mutationFn: (tokenId) => revokeCaptureEnrollmentToken(accountId, tokenId),
|
|
104
|
+
onSuccess: () => void queryClient.invalidateQueries({ queryKey: qk.capture.enrollmentTokens(accountId ?? '') }),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export function useCaptureEnrollments(accountId, opts = {}) {
|
|
108
|
+
return useQuery({
|
|
109
|
+
queryKey: [...qk.capture.enrollments(accountId ?? ''), opts.status ?? 'all'],
|
|
110
|
+
queryFn: () => listCaptureEnrollments(accountId, opts),
|
|
111
|
+
enabled: !!accountId,
|
|
112
|
+
...contract(FRESHNESS.captureEnrollments),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function invalidateRollout(queryClient, accountId) {
|
|
116
|
+
for (const queryKey of [qk.capture.enrollments(accountId), qk.capture.enrollmentTokens(accountId), [...qk.capture.account(accountId), 'devices']]) {
|
|
117
|
+
void queryClient.invalidateQueries({ queryKey });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function useApproveCaptureEnrollment(accountId) {
|
|
121
|
+
const queryClient = useQueryClient();
|
|
122
|
+
return useMutation({
|
|
123
|
+
mutationFn: (args) => approveCaptureEnrollment(accountId, args.enrollmentId, args.userId),
|
|
124
|
+
onSuccess: () => invalidateRollout(queryClient, accountId ?? ''),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export function useDenyCaptureEnrollment(accountId) {
|
|
128
|
+
const queryClient = useQueryClient();
|
|
129
|
+
return useMutation({
|
|
130
|
+
mutationFn: (enrollmentId) => denyCaptureEnrollment(accountId, enrollmentId),
|
|
131
|
+
onSuccess: () => invalidateRollout(queryClient, accountId ?? ''),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
export function useLinkCaptureDevice(accountId) {
|
|
135
|
+
const queryClient = useQueryClient();
|
|
136
|
+
return useMutation({
|
|
137
|
+
mutationFn: (args) => linkCaptureDevice(accountId, args.deviceId, args.userId),
|
|
138
|
+
onSuccess: () => invalidateRollout(queryClient, accountId ?? ''),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export function useCapturePolicy(accountId) {
|
|
142
|
+
return useQuery({
|
|
143
|
+
queryKey: qk.capture.policy(accountId ?? ''),
|
|
144
|
+
queryFn: () => getCapturePolicy(accountId),
|
|
145
|
+
enabled: !!accountId,
|
|
146
|
+
...contract(FRESHNESS.capturePolicy),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export function useSetCapturePolicy(accountId) {
|
|
150
|
+
const queryClient = useQueryClient();
|
|
151
|
+
return useMutation({
|
|
152
|
+
mutationFn: (policy) => setCapturePolicy(accountId, policy),
|
|
153
|
+
onSuccess: (record) => queryClient.setQueryData(qk.capture.policy(accountId ?? ''), record),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
export function useCaptureWorkspace(accountId) {
|
|
157
|
+
return useQuery({
|
|
158
|
+
queryKey: qk.capture.workspace(accountId ?? ''),
|
|
159
|
+
queryFn: () => getCaptureWorkspace(accountId),
|
|
160
|
+
enabled: !!accountId,
|
|
161
|
+
...contract(FRESHNESS.captureWorkspace),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
export function useSetCaptureEnabled(accountId) {
|
|
165
|
+
const queryClient = useQueryClient();
|
|
166
|
+
return useMutation({
|
|
167
|
+
mutationFn: (enabled) => setCaptureEnabled(accountId, enabled),
|
|
168
|
+
onSuccess: (workspace) => {
|
|
169
|
+
queryClient.setQueryData(qk.capture.workspace(accountId ?? ''), workspace);
|
|
170
|
+
void queryClient.invalidateQueries({ queryKey: qk.capture.account(accountId ?? '') });
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|