@beeuni/sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +35 -83
  2. package/dist/beeuni.esm.min.js +35 -35
  3. package/dist/beeuni.global.js +35 -35
  4. package/dist/browser/stores/sync-store.d.ts +6 -0
  5. package/dist/browser/stores/sync-store.js +52 -21
  6. package/dist/core/client/beeuni.d.ts +7 -29
  7. package/dist/core/client/beeuni.js +3 -11
  8. package/dist/core/client/facade-catalog.d.ts +0 -4
  9. package/dist/core/client/facade-catalog.js +1 -5
  10. package/dist/core/client/project-connections.d.ts +2 -2
  11. package/dist/core/client/project-connections.js +2 -2
  12. package/dist/core/client/project-operations.d.ts +4 -15
  13. package/dist/core/client/project-operations.js +2 -6
  14. package/dist/core/client/project-platform-security.d.ts +1 -1
  15. package/dist/core/client/project-platform-settings.d.ts +1 -1
  16. package/dist/core/http/api-client.d.ts +0 -7
  17. package/dist/core/http/api-client.js +1 -37
  18. package/dist/core/http/auth.d.ts +2 -4
  19. package/dist/core/http/auth.js +2 -8
  20. package/dist/core/rest/platform-client/client-policy.d.ts +8 -0
  21. package/dist/core/rest/platform-client/client-policy.js +30 -0
  22. package/dist/core/rest/platform-client/index.d.ts +3 -4
  23. package/dist/core/rest/platform-client/index.js +3 -4
  24. package/dist/core/rest/platform-client/types.d.ts +1 -1
  25. package/dist/core/rest/projects-client/apps.d.ts +8 -1
  26. package/dist/core/rest/projects-client/connectors.d.ts +6 -55
  27. package/dist/core/rest/projects-client/connectors.js +2 -29
  28. package/dist/core/rest/projects-client/git-backend.d.ts +1 -10
  29. package/dist/core/rest/projects-client/git-backend.js +0 -10
  30. package/dist/core/rest/projects-client/iam-sso.d.ts +0 -10
  31. package/dist/core/rest/projects-client/iam-sso.js +0 -3
  32. package/dist/core/rest/projects-client/index.d.ts +1 -4
  33. package/dist/core/rest/projects-client/index.js +1 -4
  34. package/dist/core/rest/projects-client/projects.d.ts +2 -1
  35. package/dist/core/rest/projects-client/projects.js +3 -0
  36. package/dist/core/rest/projects-client/sandbox.d.ts +8 -9
  37. package/dist/core/rest/projects-client/session-sandbox.d.ts +1 -1
  38. package/dist/core/rest/projects-client/sessions.d.ts +2 -2
  39. package/dist/core/session/control-stream.d.ts +1 -0
  40. package/dist/core/session/control-stream.js +18 -1
  41. package/dist/core/session-log/guard.d.ts +6 -0
  42. package/dist/core/session-log/guard.js +109 -0
  43. package/dist/core/session-log/index.d.ts +3 -0
  44. package/dist/core/session-log/index.js +2 -0
  45. package/dist/core/session-log/saved-log.d.ts +10 -0
  46. package/dist/core/session-log/saved-log.js +25 -0
  47. package/dist/core/session-log/source.d.ts +25 -0
  48. package/dist/core/session-log/source.js +30 -0
  49. package/dist/core/session-log/store.d.ts +21 -0
  50. package/dist/core/session-log/store.js +126 -0
  51. package/dist/core/session-log/tool-call.d.ts +6 -0
  52. package/dist/core/session-log/tool-call.js +46 -0
  53. package/dist/core/session-log/types.d.ts +264 -0
  54. package/dist/core/session-log/types.js +6 -0
  55. package/dist/core/session-log/v1-view.d.ts +10 -0
  56. package/dist/core/session-log/v1-view.js +151 -0
  57. package/dist/core/session-log/v1.d.ts +31 -0
  58. package/dist/core/session-log/v1.js +466 -0
  59. package/dist/core/session-sync/copy-store-types.d.ts +19 -0
  60. package/dist/core/session-sync/copy-store-types.js +1 -0
  61. package/dist/core/session-sync/saved-copy-store.js +25 -4
  62. package/dist/core/stream/event-stream.js +2 -2
  63. package/dist/core/turns/classify.d.ts +2 -1
  64. package/dist/core/turns/classify.js +3 -1
  65. package/dist/core/turns/parts.d.ts +3 -2
  66. package/dist/core/turns/parts.js +4 -2
  67. package/dist/core/turns/segments/index.d.ts +1 -0
  68. package/dist/core/turns/segments/index.js +1 -0
  69. package/dist/core/turns/segments/work-split.d.ts +10 -0
  70. package/dist/core/turns/segments/work-split.js +40 -0
  71. package/dist/core/turns/state.d.ts +2 -7
  72. package/dist/core/turns/state.js +28 -134
  73. package/dist/core/turns/tools/tool-meta.d.ts +2 -1
  74. package/dist/core/turns/tools/tool-meta.js +3 -1
  75. package/dist/core/turns/tools/tool-outcome.d.ts +2 -1
  76. package/dist/core/turns/tools/tool-outcome.js +3 -1
  77. package/dist/core/turns/types.d.ts +1 -1
  78. package/dist/core/warm-session-pool.d.ts +29 -0
  79. package/dist/core/warm-session-pool.js +127 -0
  80. package/dist/index.d.ts +2 -2
  81. package/dist/index.js +2 -2
  82. package/dist/internal/connector-catalog.d.ts +47 -0
  83. package/dist/internal/connector-catalog.js +27 -0
  84. package/dist/internal/host-configuration.d.ts +22 -0
  85. package/dist/internal/host-configuration.js +28 -0
  86. package/dist/internal/platform-admin-react.d.ts +12 -0
  87. package/dist/internal/platform-admin-react.js +13 -0
  88. package/dist/internal/platform-admin.d.ts +9 -0
  89. package/dist/internal/platform-admin.js +9 -0
  90. package/dist/react/index.d.ts +0 -13
  91. package/dist/react/index.js +0 -13
  92. package/dist/react/opencode.d.ts +1 -0
  93. package/dist/react/opencode.js +1 -0
  94. package/dist/react/query-keys.d.ts +0 -1
  95. package/dist/react/query-keys.js +0 -1
  96. package/dist/react/session-transcript-subscription.js +3 -1
  97. package/dist/react/sign-in-with-beeuni.d.ts +1 -1
  98. package/dist/react/use-admin-providers.d.ts +5 -5
  99. package/dist/react/use-opencode-events/handle-event.d.ts +1 -0
  100. package/dist/react/use-opencode-events/handle-event.js +5 -0
  101. package/dist/react/use-opencode-events/index.js +1 -0
  102. package/dist/react/use-runtime-reconnect.js +2 -2
  103. package/dist/react/use-session-log.d.ts +15 -0
  104. package/dist/react/use-session-log.js +134 -0
  105. package/dist/react/use-session.js +2 -0
  106. package/package.json +15 -7
package/dist/index.js CHANGED
@@ -22,8 +22,6 @@ export * from './core/http/authenticated-request.js';
22
22
  export * from './core/http/config.js';
23
23
  export * from './core/http/feature-flags.js';
24
24
  export * from './core/http/fresh-sessions.js';
25
- export * from './core/http/impersonation.js';
26
- export * from './core/http/instance-routes.js';
27
25
  export * from './core/http/runtime-errors.js';
28
26
  export * from './core/rest/platform-client/index.js';
29
27
  export * from './core/rest/projects-client/index.js';
@@ -33,6 +31,8 @@ export * from './core/attachments/prompt-attachments.js';
33
31
  export * from './core/runtime/client.js';
34
32
  export * from './core/runtime/attachment-part.js';
35
33
  export * from './core/session/index.js';
34
+ export * from './core/session-log/index.js';
35
+ export * from './core/warm-session-pool.js';
36
36
  export { createHttpSessionSyncController, loadHttpSessionHistory, } from './core/session-sync/session-sync-controller.js';
37
37
  export * from './core/session-sync/saved-copy-store.js';
38
38
  export { isEmptyConversation, savedCopyEmptyRoot, } from './core/session-sync/saved-transcript.js';
@@ -0,0 +1,47 @@
1
+ export interface PipedreamApp {
2
+ slug: string;
3
+ name: string;
4
+ description: string | null;
5
+ imgSrc: string | null;
6
+ authType: string | null;
7
+ categories: string[];
8
+ hasActions: boolean;
9
+ hasTriggers: boolean;
10
+ featuredWeight: number;
11
+ directId?: string | null;
12
+ }
13
+ export interface PipedreamCategory {
14
+ key: string;
15
+ label: string;
16
+ count: number;
17
+ }
18
+ export interface PipedreamCatalogQuery {
19
+ q?: string;
20
+ category?: string;
21
+ cursor?: string;
22
+ limit?: number;
23
+ }
24
+ export interface PipedreamCatalogPage {
25
+ apps: PipedreamApp[];
26
+ categories: PipedreamCategory[];
27
+ total?: number;
28
+ nextCursor?: string;
29
+ hasMore: boolean;
30
+ indexReady?: boolean;
31
+ excludedNoActions?: number;
32
+ }
33
+ export declare function listPipedreamApps(projectId: string, qOrQuery?: string | PipedreamCatalogQuery, cursor?: string): Promise<PipedreamCatalogPage>;
34
+ export interface PipedreamSection {
35
+ key: string;
36
+ label: string;
37
+ total: number;
38
+ apps: PipedreamApp[];
39
+ }
40
+ export declare function listPipedreamSections(projectId: string, opts?: {
41
+ perCategory?: number;
42
+ maxCategories?: number;
43
+ }): Promise<{
44
+ sections: PipedreamSection[];
45
+ categories: PipedreamCategory[];
46
+ indexReady?: boolean;
47
+ }>;
@@ -0,0 +1,27 @@
1
+ import { backendApi } from '../core/http/api-client.js';
2
+ import { unwrap } from '../core/rest/projects-client/shared.js';
3
+ export async function listPipedreamApps(projectId, qOrQuery, cursor) {
4
+ const query = typeof qOrQuery === 'string' || qOrQuery === undefined
5
+ ? { ...(qOrQuery ? { q: qOrQuery } : {}), ...(cursor ? { cursor } : {}) }
6
+ : qOrQuery;
7
+ const params = new URLSearchParams();
8
+ if (query.q)
9
+ params.set('q', query.q);
10
+ if (query.category)
11
+ params.set('category', query.category);
12
+ if (query.cursor)
13
+ params.set('cursor', query.cursor);
14
+ if (query.limit)
15
+ params.set('limit', String(query.limit));
16
+ const qs = params.toString();
17
+ return unwrap(await backendApi.get(`/connectors/projects/${projectId}/pipedream/apps${qs ? `?${qs}` : ''}`));
18
+ }
19
+ export async function listPipedreamSections(projectId, opts) {
20
+ const params = new URLSearchParams();
21
+ if (opts?.perCategory)
22
+ params.set('perCategory', String(opts.perCategory));
23
+ if (opts?.maxCategories)
24
+ params.set('maxCategories', String(opts.maxCategories));
25
+ const qs = params.toString();
26
+ return unwrap(await backendApi.get(`/connectors/projects/${projectId}/pipedream/sections${qs ? `?${qs}` : ''}`));
27
+ }
@@ -0,0 +1,22 @@
1
+ import { type SsoProvider as PublicSsoProvider } from '../core/rest/projects-client/iam-sso.js';
2
+ import type { GitHubRepository } from '../core/rest/projects-client/github.js';
3
+ export type HostSsoProvider = PublicSsoProvider & {
4
+ supabase_sso_provider_id: string;
5
+ };
6
+ export declare function getHostSsoProvider(accountId: string): Promise<HostSsoProvider | null>;
7
+ export declare function upsertSsoProvider(accountId: string, input: {
8
+ supabase_sso_provider_id: string;
9
+ name: string;
10
+ primary_domain: string;
11
+ group_claim_name?: string;
12
+ auto_create_members?: boolean;
13
+ auto_provision_groups?: boolean;
14
+ enforce_sso?: boolean;
15
+ }): Promise<HostSsoProvider>;
16
+ export declare function listManagedGitRepositories(options?: {
17
+ search?: string;
18
+ limit?: number;
19
+ }): Promise<{
20
+ owner: string;
21
+ repositories: GitHubRepository[];
22
+ }>;
@@ -0,0 +1,28 @@
1
+ import { backendApi } from '../core/http/api-client.js';
2
+ import { getSsoProvider as readSsoProvider } from '../core/rest/projects-client/iam-sso.js';
3
+ export async function getHostSsoProvider(accountId) {
4
+ return await readSsoProvider(accountId);
5
+ }
6
+ export async function upsertSsoProvider(accountId, input) {
7
+ const response = await backendApi.put(`/accounts/${accountId}/iam/sso/provider`, input, { showErrors: false });
8
+ if (response.error)
9
+ throw response.error;
10
+ if (!response.data)
11
+ throw new Error('SSO configuration could not be saved');
12
+ return response.data.provider;
13
+ }
14
+ export async function listManagedGitRepositories(options) {
15
+ const params = new URLSearchParams();
16
+ const search = options?.search?.trim();
17
+ if (search)
18
+ params.set('search', search);
19
+ if (options?.limit !== undefined)
20
+ params.set('limit', String(options.limit));
21
+ const query = params.toString();
22
+ const response = await backendApi.get(`/projects/git/backend/repositories${query ? `?${query}` : ''}`, { showErrors: false });
23
+ if (response.error)
24
+ throw response.error;
25
+ if (!response.data)
26
+ throw new Error('Repositories could not be loaded');
27
+ return response.data;
28
+ }
@@ -0,0 +1,12 @@
1
+ export * from '../react/use-admin-accounts.js';
2
+ export * from '../react/use-admin-role.js';
3
+ export * from '../react/use-admin-projects.js';
4
+ export * from '../react/use-admin-analytics.js';
5
+ export * from '../react/use-admin-activity-analytics.js';
6
+ export * from '../react/use-admin-feedback.js';
7
+ export * from '../react/use-system-status.js';
8
+ export * from '../react/use-ops-overview.js';
9
+ export * from '../react/use-admin-billing.js';
10
+ export * from '../react/use-impersonation.js';
11
+ export * from '../react/use-admin-sandboxes.js';
12
+ export * from '../react/use-admin-providers.js';
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ export * from '../react/use-admin-accounts.js';
3
+ export * from '../react/use-admin-role.js';
4
+ export * from '../react/use-admin-projects.js';
5
+ export * from '../react/use-admin-analytics.js';
6
+ export * from '../react/use-admin-activity-analytics.js';
7
+ export * from '../react/use-admin-feedback.js';
8
+ export * from '../react/use-system-status.js';
9
+ export * from '../react/use-ops-overview.js';
10
+ export * from '../react/use-admin-billing.js';
11
+ export * from '../react/use-impersonation.js';
12
+ export * from '../react/use-admin-sandboxes.js';
13
+ export * from '../react/use-admin-providers.js';
@@ -0,0 +1,9 @@
1
+ export * from './host-configuration.js';
2
+ export * from '../core/rest/platform-client/github-app.js';
3
+ export * from '../core/rest/projects-client/admin-providers.js';
4
+ export * from '../core/http/impersonation.js';
5
+ export * from '../core/http/instance-routes.js';
6
+ export { isAdminBypassEnabled, setAdminBypass } from '../core/http/transport.js';
7
+ export { getAdminRole, type AdminRole } from '../core/rest/projects-client/account-lifecycle.js';
8
+ export { getMaintenanceConfig, setMaintenanceConfig, openStressTestStream, getUserRolesWithToken, } from '../core/rest/platform-client/host-boundary.js';
9
+ export { getSandboxUpdateStatus, triggerSandboxUpdate, resetSandboxUpdateStatus, cancelSandboxUpdate, DESTRUCTIVE_PHASES, isDestructivePhase, type SandboxUpdateResult, type SandboxUpdateStatus, type UpdatePhase, } from '../core/rest/platform-client/updates.js';
@@ -0,0 +1,9 @@
1
+ export * from './host-configuration.js';
2
+ export * from '../core/rest/platform-client/github-app.js';
3
+ export * from '../core/rest/projects-client/admin-providers.js';
4
+ export * from '../core/http/impersonation.js';
5
+ export * from '../core/http/instance-routes.js';
6
+ export { isAdminBypassEnabled, setAdminBypass } from '../core/http/transport.js';
7
+ export { getAdminRole } from '../core/rest/projects-client/account-lifecycle.js';
8
+ export { getMaintenanceConfig, setMaintenanceConfig, openStressTestStream, getUserRolesWithToken, } from '../core/rest/platform-client/host-boundary.js';
9
+ export { getSandboxUpdateStatus, triggerSandboxUpdate, resetSandboxUpdateStatus, cancelSandboxUpdate, DESTRUCTIVE_PHASES, isDestructivePhase, } from '../core/rest/platform-client/updates.js';
@@ -1,5 +1,4 @@
1
1
  export * from './use-prompt-attachments.js';
2
- export * from './use-project-starter-suggestions.js';
3
2
  export { useConnectorSetup, useConnectorLinkInfo, type ConnectorSetupOptions, type ConnectorSetupPhase, type ConnectorPopupOpener, } from './connector-setup.js';
4
3
  export { useConnectorQuery, type ConnectorQueryOptions } from './use-connector-query.js';
5
4
  export { resetIdentityState } from './reset-identity-state.js';
@@ -23,19 +22,8 @@ export { useChangeRequests, changeRequestsKey } from './use-change-requests.js';
23
22
  export { useGatewayRoutingPolicy, gatewayRoutingPolicyKey } from './use-gateway-routing-policy.js';
24
23
  export { useProjectApps, useAppDeployments, useAppDeployment, useAppMachines, useAppVolumes, useAppVolumeSnapshots, appMachinesKey, appVolumesKey, useAppAccess, projectAppsKey, appDeploymentsKey, appDeploymentKey, } from './use-project-apps.js';
25
24
  export { NoCompactionModelError } from './use-opencode-sessions/no-compaction-model-error.js';
26
- export * from './use-admin-accounts.js';
27
- export * from './use-admin-role.js';
28
- export * from './use-admin-projects.js';
29
- export * from './use-admin-analytics.js';
30
- export * from './use-admin-activity-analytics.js';
31
- export * from './use-admin-feedback.js';
32
- export * from './use-system-status.js';
33
- export * from './use-ops-overview.js';
34
- export * from './use-admin-billing.js';
35
- export * from './use-impersonation.js';
36
25
  export * from './use-teams-installations.js';
37
26
  export * from './use-tunnel.js';
38
- export * from './use-admin-sandboxes.js';
39
27
  export * from './use-authenticated-preview-url.js';
40
28
  export * from './use-static-file-preview.js';
41
29
  export * from './run-pty-command.js';
@@ -59,4 +47,3 @@ export { useBeeuniAppViewer, type BeeuniAppViewerState, } from './use-beeuni-app
59
47
  export { useModelAccess } from './use-model-access.js';
60
48
  export { formatMegabytes, useSandboxImage } from './use-sandbox-image.js';
61
49
  export { GATEWAY_LOGS_PAGE_SIZE, useGatewayOverview, useGatewaySeries, useGatewayBreakdown, useGatewaySessions, useGatewayErrors, useGatewayLogs, useGatewayLog, useGatewayBudgets, useSetGatewayBudget, useDeleteGatewayBudget, useGatewayKeys, useCreateGatewayKey, useRevokeGatewayKey, } from './use-project-gateway.js';
62
- export * from './use-admin-providers.js';
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  export * from './use-prompt-attachments.js';
3
- export * from './use-project-starter-suggestions.js';
4
3
  export { useConnectorSetup, useConnectorLinkInfo, } from './connector-setup.js';
5
4
  export { useConnectorQuery } from './use-connector-query.js';
6
5
  export { resetIdentityState } from './reset-identity-state.js';
@@ -24,19 +23,8 @@ export { useChangeRequests, changeRequestsKey } from './use-change-requests.js';
24
23
  export { useGatewayRoutingPolicy, gatewayRoutingPolicyKey } from './use-gateway-routing-policy.js';
25
24
  export { useProjectApps, useAppDeployments, useAppDeployment, useAppMachines, useAppVolumes, useAppVolumeSnapshots, appMachinesKey, appVolumesKey, useAppAccess, projectAppsKey, appDeploymentsKey, appDeploymentKey, } from './use-project-apps.js';
26
25
  export { NoCompactionModelError } from './use-opencode-sessions/no-compaction-model-error.js';
27
- export * from './use-admin-accounts.js';
28
- export * from './use-admin-role.js';
29
- export * from './use-admin-projects.js';
30
- export * from './use-admin-analytics.js';
31
- export * from './use-admin-activity-analytics.js';
32
- export * from './use-admin-feedback.js';
33
- export * from './use-system-status.js';
34
- export * from './use-ops-overview.js';
35
- export * from './use-admin-billing.js';
36
- export * from './use-impersonation.js';
37
26
  export * from './use-teams-installations.js';
38
27
  export * from './use-tunnel.js';
39
- export * from './use-admin-sandboxes.js';
40
28
  export * from './use-authenticated-preview-url.js';
41
29
  export * from './use-static-file-preview.js';
42
30
  export * from './run-pty-command.js';
@@ -60,4 +48,3 @@ export { useBeeuniAppViewer, } from './use-beeuni-app-viewer.js';
60
48
  export { useModelAccess } from './use-model-access.js';
61
49
  export { formatMegabytes, useSandboxImage } from './use-sandbox-image.js';
62
50
  export { GATEWAY_LOGS_PAGE_SIZE, useGatewayOverview, useGatewaySeries, useGatewayBreakdown, useGatewaySessions, useGatewayErrors, useGatewayLogs, useGatewayLog, useGatewayBudgets, useSetGatewayBudget, useDeleteGatewayBudget, useGatewayKeys, useCreateGatewayKey, useRevokeGatewayKey, } from './use-project-gateway.js';
63
- export * from './use-admin-providers.js';
@@ -30,6 +30,7 @@ export { useProjectConfig } from './use-project-config.js';
30
30
  export type { ProjectConfigSummary } from '../core/rest/projects-client/index.js';
31
31
  export { useSession, type SessionPhase, type UseSessionResult, type UseSessionOptions, } from './use-session.js';
32
32
  export { useSessionMessages, type SessionMessagesOptions, type SessionMessagesSource, } from './use-session-messages.js';
33
+ export { useSessionLog, useSessionLogThread } from './use-session-log.js';
33
34
  export { useSessionPicks, type SessionPicks } from './use-session-picks.js';
34
35
  export { useSessionPrompts, sessionPromptsPollMs, startSessionWithPrompt, isOptimisticSessionPrompt, optimisticSessionPrompt, applyOptimisticPrompt, settleOptimisticPrompt, removeOptimisticPrompt, reconcileOptimisticPrompts, OPTIMISTIC_PROMPT_PREFIX, SESSION_PROMPTS_POLL_MS, SESSION_PROMPTS_IDLE_POLL_MS, type StartSessionWithPromptAdapters, type UseSessionPromptsResult, } from './use-session-prompts.js';
35
36
  export { readSessionAudit } from './use-session-audit.js';
@@ -30,6 +30,7 @@ export { useProjectModelPickerCatalog, useProjectModels } from './use-project-mo
30
30
  export { useProjectConfig } from './use-project-config.js';
31
31
  export { useSession, } from './use-session.js';
32
32
  export { useSessionMessages, } from './use-session-messages.js';
33
+ export { useSessionLog, useSessionLogThread } from './use-session-log.js';
33
34
  export { useSessionPicks } from './use-session-picks.js';
34
35
  export { useSessionPrompts, sessionPromptsPollMs, startSessionWithPrompt, isOptimisticSessionPrompt, optimisticSessionPrompt, applyOptimisticPrompt, settleOptimisticPrompt, removeOptimisticPrompt, reconcileOptimisticPrompts, OPTIMISTIC_PROMPT_PREFIX, SESSION_PROMPTS_POLL_MS, SESSION_PROMPTS_IDLE_POLL_MS, } from './use-session-prompts.js';
35
36
  export { readSessionAudit } from './use-session-audit.js';
@@ -30,7 +30,6 @@ export declare const qk: {
30
30
  readonly session: (projectId: string, sessionId: string) => readonly ["kx", "drives", "session", string, string];
31
31
  };
32
32
  readonly project: {
33
- readonly starterSuggestions: (id: string) => readonly ["kx", "project", string, "starter-suggestions"];
34
33
  readonly scope: (id: string) => readonly ["kx", "project", string];
35
34
  readonly needsInput: (id: string) => readonly ["kx", "project", string, "needs-input"];
36
35
  readonly summary: (id: string) => readonly ["kx", "project", string, "summary"];
@@ -42,7 +42,6 @@ export const qk = {
42
42
  session: (projectId, sessionId) => [...qk.drives.scope(), 'session', projectId, sessionId],
43
43
  },
44
44
  project: {
45
- starterSuggestions: (id) => [...qk.project.scope(id), 'starter-suggestions'],
46
45
  scope: (id) => ['kx', 'project', id],
47
46
  needsInput: (id) => [...qk.project.scope(id), 'needs-input'],
48
47
  summary: (id) => [...qk.project.scope(id), 'summary'],
@@ -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
- return state.buildSessionMessages(sessionId, state.messages[sessionId], state.parts);
13
+ const rows = state.buildSessionMessages(sessionId, state.messages[sessionId], state.parts);
14
+ return sessionLogRowsFor(state.sessionLogs, sessionId, rows);
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;
@@ -86,7 +87,6 @@ export declare function SignInWithBeeuni({ basePath, returnTo, children, ...rest
86
87
  inlist?: any;
87
88
  property?: string | undefined | undefined;
88
89
  rel?: string | undefined | undefined;
89
- rev?: string | undefined | undefined;
90
90
  typeof?: string | undefined | undefined;
91
91
  vocab?: string | undefined | undefined;
92
92
  autoCorrect?: string | undefined | undefined;
@@ -1,7 +1,7 @@
1
1
  import { type AdminBootModePolicy } from '../core/rest/projects-client/admin-providers.js';
2
- export declare function useAdminProviderDistribution(): import("@tanstack/react-query").UseQueryResult<import("../index.js").AdminProviderDistribution, Error>;
3
- export declare function useAdminProviderSandboxes(): import("@tanstack/react-query").UseQueryResult<import("../index.js").AdminProviderSandboxesResponse, Error>;
4
- export declare function useAdminProviderAnalytics(days: number, enabled: boolean): import("@tanstack/react-query").UseQueryResult<import("../index.js").AdminProviderAnalytics, Error>;
2
+ export declare function useAdminProviderDistribution(): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderDistribution, Error>;
3
+ export declare function useAdminProviderSandboxes(): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderSandboxesResponse, Error>;
4
+ export declare function useAdminProviderAnalytics(days: number, enabled: boolean): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminProviderAnalytics, Error>;
5
5
  export declare function useAdminProviderFallback(): import("@tanstack/react-query").UseQueryResult<{
6
6
  enabled: boolean;
7
7
  }, Error>;
@@ -16,5 +16,5 @@ export interface AdminProviderMigrationVariables {
16
16
  export declare function useSetAdminProviderDistribution(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<unknown, Error, Record<string, number>, unknown>;
17
17
  export declare function useMigrateAdminSandboxProvider(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<unknown, Error, AdminProviderMigrationVariables, unknown>;
18
18
  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>;
19
+ export declare function useAdminBootModes(): import("@tanstack/react-query").UseQueryResult<import("../internal/platform-admin.js").AdminBootModes, Error>;
20
+ export declare function useSetAdminBootModes(options?: AdminProviderMutationOptions): import("@tanstack/react-query").UseMutationResult<import("../internal/platform-admin.js").AdminBootModes, Error, AdminBootModePolicy, unknown>;
@@ -20,4 +20,5 @@ export declare function createEventHandler(deps: {
20
20
  reconcileSessionTail?: (sessionID: string, reason: SessionSyncReason) => Promise<void>;
21
21
  userPartsGraceMs?: number;
22
22
  projectId?: string | null;
23
+ sessionId?: string | null;
23
24
  }): (event: RuntimeEvent) => void;
@@ -44,6 +44,11 @@ export function createEventHandler(deps) {
44
44
  const statusBeforeEvent = sessionID
45
45
  ? useSyncStore.getState().sessionStatus[sessionID]
46
46
  : undefined;
47
+ if (event.type.startsWith('log.')) {
48
+ if (deps.sessionId)
49
+ useSyncStore.getState().applySessionLogEvent(deps.sessionId, event);
50
+ return;
51
+ }
47
52
  deps.applySyncEvent(event);
48
53
  if (event.type.startsWith('message.'))
49
54
  handleMessageEvent(event, ctx);
@@ -101,6 +101,7 @@ export function useRuntimeEventStream(options = {}) {
101
101
  fetchLspDiagnosticsDebounced,
102
102
  reconcileSessionTail: reconcileSessionTailFromRegistry,
103
103
  projectId,
104
+ sessionId: options.projectId && options.sessionId ? options.sessionId : null,
104
105
  });
105
106
  const hydrate = (options) => hydrateCore({
106
107
  client,
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useEffect, useRef } from 'react';
3
- import { getSupabaseAccessToken } from '../core/http/auth.js';
3
+ import { getAuthToken } from '../core/http/auth.js';
4
4
  import { CONNECTION_FAULT_GRACE_MS, getSessionHealth, isRuntimeReady, } from '../core/session/index.js';
5
5
  import { incrementSandboxFail, markInitialCheckDone, resetForServerSwitch, resetSandboxFail, setRuntimeHealth, setRuntimeCapabilities, setSandboxStatus, useSandboxConnectionStore, } from '../browser/stores/sandbox-connection-store.js';
6
6
  import { useServerStore } from '../browser/stores/server-store.js';
@@ -109,7 +109,7 @@ export function useRuntimeReconnect() {
109
109
  scheduleNext();
110
110
  return;
111
111
  }
112
- token = await getSupabaseAccessToken();
112
+ token = await getAuthToken();
113
113
  if (!token) {
114
114
  scheduleNext();
115
115
  return;
@@ -0,0 +1,15 @@
1
+ import { type SessionControlStreamOptions } from '../core/session/control-stream.js';
2
+ import { type LoadSessionLogPage, type SessionLogDialect } from '../core/session-log/source.js';
3
+ import type { SessionLog, SessionLogThread } from '../core/session-log/types.js';
4
+ import { type SessionMessagesSource } from './use-session-messages.js';
5
+ export declare function useSessionLog(session: SessionMessagesSource): (SessionLog & {
6
+ source: 'v1' | 'v2';
7
+ }) | null;
8
+ export declare function useSessionLogThread(session: SessionMessagesSource, threadId?: string | null): SessionLogThread | null;
9
+ export declare function useSessionLogSync(projectId: string, sessionId: string, options: {
10
+ enabled: boolean;
11
+ loader?: LoadSessionLogPage | null;
12
+ joinStream?: (options: SessionControlStreamOptions) => {
13
+ close: () => void;
14
+ };
15
+ }): SessionLogDialect;
@@ -0,0 +1,134 @@
1
+ 'use client';
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { useSandboxConnectionStore } from '../browser/stores/sandbox-connection-store.js';
4
+ import { useSyncStore } from '../browser/stores/sync-store.js';
5
+ import { openSessionStream } from '../core/session/control-stream.js';
6
+ import { savedSessionLogCopies } from '../core/session-log/saved-log.js';
7
+ import { isV1Thread, sessionLogOfV1Rows } from '../core/session-log/v1-view.js';
8
+ import { fetchFirstSessionLogPage, loadSessionLogPage, negotiateSessionLog, } from '../core/session-log/source.js';
9
+ import { currentSavedCopyStore } from '../core/session-sync/saved-copy-store.js';
10
+ import { selectSessionLog, selectSessionLogThread } from '../core/session-log/store.js';
11
+ import { useFeatureFlag } from './use-feature-flag.js';
12
+ import { useSessionMessages } from './use-session-messages.js';
13
+ const sourced = new WeakMap();
14
+ const withSource = (log, source) => {
15
+ let out = sourced.get(log);
16
+ if (!out)
17
+ sourced.set(log, (out = { ...log, source }));
18
+ return out;
19
+ };
20
+ function useV1SessionLog(session, threadId) {
21
+ const native = threadId || session.runtimeSessionId || session.opencodeSessionId || null;
22
+ const rows = useSessionMessages({ ...session, runtimeSessionId: native });
23
+ return useMemo(() => (native && rows.length ? sessionLogOfV1Rows(session.sessionId, native, rows) : null), [session.sessionId, native, rows]);
24
+ }
25
+ export function useSessionLog(session) {
26
+ const v2 = useSyncStore((state) => {
27
+ const log = state.sessionLogs[session.sessionId];
28
+ return log ? selectSessionLog(log) : null;
29
+ });
30
+ const v1 = useV1SessionLog(session);
31
+ return v2 ? withSource(v2, 'v2') : v1 ? withSource(v1, 'v1') : null;
32
+ }
33
+ export function useSessionLogThread(session, threadId) {
34
+ const v2 = useSyncStore((state) => {
35
+ const log = state.sessionLogs[session.sessionId];
36
+ return log ? selectSessionLogThread(log, threadId) : undefined;
37
+ });
38
+ const v1 = useV1SessionLog(session, threadId);
39
+ return v2 !== undefined ? v2 : (v1?.threads[0] ?? null);
40
+ }
41
+ const pageThreadIsV1 = (page) => isV1Thread(page.threads.find((t) => t.thread_id === page.thread_id));
42
+ export function useSessionLogSync(projectId, sessionId, options) {
43
+ const loader = options.loader === undefined ? loadSessionLogPage : options.loader;
44
+ const joinStream = options.joinStream ?? openSessionStream;
45
+ const active = options.enabled && !!loader && !!projectId && !!sessionId;
46
+ const live = useSandboxConnectionStore((state) => state.runtimeCapabilities);
47
+ const served = useRef(null);
48
+ const key = `${projectId}/${sessionId}`;
49
+ if (live?.includes('session.log.v2'))
50
+ served.current = key;
51
+ const capabilities = served.current === key ? ['session.log.v2'] : live;
52
+ const flag = useFeatureFlag(active ? projectId : null, 'session_log').enabled;
53
+ const negotiated = active ? negotiateSessionLog({ capabilities, flag, loader }) : 'v1';
54
+ const [refusedKey, setRefusedKey] = useState(null);
55
+ const dialect = negotiated === 'v2' && refusedKey !== key ? 'v2' : 'v1';
56
+ useEffect(() => {
57
+ if (negotiated !== 'v2' || !loader)
58
+ return;
59
+ const controller = new AbortController();
60
+ const store = useSyncStore.getState;
61
+ const copies = savedSessionLogCopies(currentSavedCopyStore());
62
+ let stream = null;
63
+ let stopped = false;
64
+ let busy = false;
65
+ let lastEnded;
66
+ const join = (options) => {
67
+ stream?.close();
68
+ stream = joinStream({ projectId, sessionId, ...options });
69
+ };
70
+ const load = async () => {
71
+ const page = await fetchFirstSessionLogPage(loader, projectId, sessionId, controller.signal);
72
+ if (stopped)
73
+ return null;
74
+ if (page && pageThreadIsV1(page)) {
75
+ store().applySessionLogPage(sessionId, page);
76
+ void copies?.write(projectId, sessionId, page);
77
+ }
78
+ return page;
79
+ };
80
+ const onReconnect = (run) => {
81
+ let connected = true;
82
+ return (up) => {
83
+ if (up && !connected)
84
+ run();
85
+ connected = up;
86
+ };
87
+ };
88
+ const attempt = async () => {
89
+ if (busy || stopped)
90
+ return;
91
+ busy = true;
92
+ const page = await load();
93
+ busy = false;
94
+ if (stopped)
95
+ return;
96
+ if (page && pageThreadIsV1(page)) {
97
+ setRefusedKey(null);
98
+ join({ schema: 'v2', onConnectionChange: onReconnect(() => void load()), onRuntimeResync: () => void load() });
99
+ return;
100
+ }
101
+ store().dropSessionLog(sessionId);
102
+ setRefusedKey(`${projectId}/${sessionId}`);
103
+ if (page)
104
+ return;
105
+ join({
106
+ onControl: (frame) => {
107
+ if (frame.type !== 'beeuni.control.turn')
108
+ return;
109
+ const ended = frame.payload?.last_ended?.turn_token ?? null;
110
+ const seen = lastEnded;
111
+ lastEnded = ended;
112
+ if (seen !== undefined && ended !== seen)
113
+ void attempt();
114
+ },
115
+ onConnectionChange: onReconnect(() => void attempt()),
116
+ });
117
+ };
118
+ void (async () => {
119
+ const saved = await Promise.resolve(copies?.read(projectId, sessionId) ?? null).catch(() => null);
120
+ if (stopped)
121
+ return;
122
+ if (saved && pageThreadIsV1(saved) && !store().sessionLogs[sessionId])
123
+ store().applySessionLogPage(sessionId, saved);
124
+ await attempt();
125
+ })();
126
+ return () => {
127
+ stopped = true;
128
+ controller.abort();
129
+ stream?.close();
130
+ store().dropSessionLog(sessionId);
131
+ };
132
+ }, [negotiated, loader, joinStream, projectId, sessionId]);
133
+ return dialect;
134
+ }
@@ -42,6 +42,7 @@ import { useRuntimePhase } from './use-runtime-phase.js';
42
42
  import { useSessionPicks } from './use-session-picks.js';
43
43
  import { derivePhase } from './use-session-phase.js';
44
44
  import { isEmptyConversation, resolveSavedTranscript } from '../core/session-sync/saved-transcript.js';
45
+ import { useSessionLogSync } from './use-session-log.js';
45
46
  import { useSessionSync } from './use-session-sync.js';
46
47
  import { selectTranscriptShapeKey } from './session-transcript-subscription.js';
47
48
  import { useSessionStartGiveUp } from './use-session-start-give-up.js';
@@ -549,6 +550,7 @@ export function useSession(projectId, sessionId, options = {}) {
549
550
  }, [startEnabled, switchedBoxId, refetchStart]);
550
551
  useRuntimeEventStream({ enabled: switched, projectId, sessionId });
551
552
  const transcriptHistoryEnabled = startEnabled && chatEngine;
553
+ useSessionLogSync(projectId, sessionId, { enabled: transcriptHistoryEnabled });
552
554
  const transcriptHistory = useSessionTranscriptHistory(projectId, sessionId, transcriptHistoryEnabled);
553
555
  const canonicalSession = useCanonicalRuntimeSession({
554
556
  projectId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beeuni/sdk",
3
- "version": "0.1.0",
4
- "description": "Official Beeuni frontend TypeScript SDK — one typed client for the Beeuni API. Unifies project/session lifecycle and live agent streaming behind a single ergonomic Session handle, so web, mobile, and white-label apps never touch the raw HTTP API or OpenCode semantics.",
3
+ "version": "0.2.0",
4
+ "description": "Official Beeuni TypeScript SDK. Connect your product to Beeuni Computer with typed projects, sessions, tools, files, and live agent streaming.",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",
7
7
  "homepage": "https://www.beeuni.ai/docs",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "sideEffects": false,
16
16
  "dependencies": {
17
- "@beeuni/llm-catalog": "0.1.0",
17
+ "@beeuni/llm-catalog": "0.2.0",
18
18
  "zustand": "^5.0.3"
19
19
  },
20
20
  "peerDependencies": {
@@ -72,6 +72,18 @@
72
72
  "types": "./dist/internal/managed-storage.d.ts",
73
73
  "import": "./dist/internal/managed-storage.js"
74
74
  },
75
+ "./internal/connector-catalog": {
76
+ "types": "./dist/internal/connector-catalog.d.ts",
77
+ "import": "./dist/internal/connector-catalog.js"
78
+ },
79
+ "./internal/platform-admin": {
80
+ "types": "./dist/internal/platform-admin.d.ts",
81
+ "import": "./dist/internal/platform-admin.js"
82
+ },
83
+ "./internal/platform-admin-react": {
84
+ "types": "./dist/internal/platform-admin-react.d.ts",
85
+ "import": "./dist/internal/platform-admin-react.js"
86
+ },
75
87
  "./opencode-client": {
76
88
  "types": "./dist/deprecated/opencode-client.d.ts",
77
89
  "import": "./dist/deprecated/opencode-client.js"
@@ -100,10 +112,6 @@
100
112
  "types": "./dist/deprecated/fresh-sessions.d.ts",
101
113
  "import": "./dist/deprecated/fresh-sessions.js"
102
114
  },
103
- "./instance-routes": {
104
- "types": "./dist/deprecated/instance-routes.d.ts",
105
- "import": "./dist/deprecated/instance-routes.js"
106
- },
107
115
  "./opencode-errors": {
108
116
  "types": "./dist/deprecated/opencode-errors.d.ts",
109
117
  "import": "./dist/deprecated/opencode-errors.js"