@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.
- package/README.md +35 -83
- package/dist/beeuni.esm.min.js +35 -35
- package/dist/beeuni.global.js +35 -35
- package/dist/browser/stores/sync-store.d.ts +6 -0
- package/dist/browser/stores/sync-store.js +52 -21
- package/dist/core/client/beeuni.d.ts +7 -29
- package/dist/core/client/beeuni.js +3 -11
- package/dist/core/client/facade-catalog.d.ts +0 -4
- package/dist/core/client/facade-catalog.js +1 -5
- 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.d.ts +4 -15
- 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/http/api-client.d.ts +0 -7
- package/dist/core/http/api-client.js +1 -37
- package/dist/core/http/auth.d.ts +2 -4
- package/dist/core/http/auth.js +2 -8
- 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 +3 -4
- package/dist/core/rest/platform-client/index.js +3 -4
- package/dist/core/rest/platform-client/types.d.ts +1 -1
- package/dist/core/rest/projects-client/apps.d.ts +8 -1
- package/dist/core/rest/projects-client/connectors.d.ts +6 -55
- package/dist/core/rest/projects-client/connectors.js +2 -29
- 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-sso.d.ts +0 -10
- package/dist/core/rest/projects-client/iam-sso.js +0 -3
- 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/projects.d.ts +2 -1
- package/dist/core/rest/projects-client/projects.js +3 -0
- package/dist/core/rest/projects-client/sandbox.d.ts +8 -9
- package/dist/core/rest/projects-client/session-sandbox.d.ts +1 -1
- package/dist/core/rest/projects-client/sessions.d.ts +2 -2
- package/dist/core/session/control-stream.d.ts +1 -0
- package/dist/core/session/control-stream.js +18 -1
- 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 +3 -0
- package/dist/core/session-log/index.js +2 -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 +6 -0
- package/dist/core/session-log/tool-call.js +46 -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 +10 -0
- package/dist/core/session-log/v1-view.js +151 -0
- package/dist/core/session-log/v1.d.ts +31 -0
- package/dist/core/session-log/v1.js +466 -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/stream/event-stream.js +2 -2
- package/dist/core/turns/classify.d.ts +2 -1
- package/dist/core/turns/classify.js +3 -1
- package/dist/core/turns/parts.d.ts +3 -2
- package/dist/core/turns/parts.js +4 -2
- package/dist/core/turns/segments/index.d.ts +1 -0
- package/dist/core/turns/segments/index.js +1 -0
- 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/state.d.ts +2 -7
- package/dist/core/turns/state.js +28 -134
- package/dist/core/turns/tools/tool-meta.d.ts +2 -1
- package/dist/core/turns/tools/tool-meta.js +3 -1
- 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/warm-session-pool.d.ts +29 -0
- package/dist/core/warm-session-pool.js +127 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/connector-catalog.d.ts +47 -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/react/index.d.ts +0 -13
- package/dist/react/index.js +0 -13
- package/dist/react/opencode.d.ts +1 -0
- package/dist/react/opencode.js +1 -0
- package/dist/react/query-keys.d.ts +0 -1
- package/dist/react/query-keys.js +0 -1
- package/dist/react/session-transcript-subscription.js +3 -1
- package/dist/react/sign-in-with-beeuni.d.ts +1 -1
- package/dist/react/use-admin-providers.d.ts +5 -5
- 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/index.js +1 -0
- package/dist/react/use-runtime-reconnect.js +2 -2
- package/dist/react/use-session-log.d.ts +15 -0
- package/dist/react/use-session-log.js +134 -0
- package/dist/react/use-session.js +2 -0
- package/package.json +15 -7
|
@@ -103,7 +103,7 @@ export type ConnectorAuthorizationStrategy = 'project' | 'user';
|
|
|
103
103
|
export interface AdminConnector {
|
|
104
104
|
slug: string;
|
|
105
105
|
name: string;
|
|
106
|
-
provider:
|
|
106
|
+
provider: string;
|
|
107
107
|
platform?: 'slack' | 'email' | null;
|
|
108
108
|
iconUrl?: string | null;
|
|
109
109
|
status: 'active' | 'disabled' | 'needs_auth' | 'error';
|
|
@@ -379,7 +379,7 @@ export interface ConnectionSharePrincipal {
|
|
|
379
379
|
principal_id: string;
|
|
380
380
|
}
|
|
381
381
|
export declare function shareConnection(projectId: string, connectionId: string, principals?: ConnectionSharePrincipal[]): Promise<Connection>;
|
|
382
|
-
export type ConnectorConnectProvider =
|
|
382
|
+
export type ConnectorConnectProvider = string;
|
|
383
383
|
export interface ConnectorConnectResult {
|
|
384
384
|
provider?: ConnectorConnectProvider;
|
|
385
385
|
app?: string;
|
|
@@ -404,8 +404,8 @@ export interface ConnectorConnectStatus {
|
|
|
404
404
|
provider: ConnectorConnectProvider | null;
|
|
405
405
|
providers?: ConnectorConnectProvider[];
|
|
406
406
|
}
|
|
407
|
-
export declare function
|
|
408
|
-
export declare function
|
|
407
|
+
export declare function connectorConnectConnection(projectId: string, connectionId: string, input?: ConnectionConnectInput): Promise<ConnectorConnectResult>;
|
|
408
|
+
export declare function connectorFinalizeConnection(projectId: string, connectionId: string): Promise<ConnectorFinalizeResult>;
|
|
409
409
|
export interface ListConnectorsOptions {
|
|
410
410
|
includeSchemas?: boolean;
|
|
411
411
|
}
|
|
@@ -485,7 +485,6 @@ export interface ConnectorConnectOptions {
|
|
|
485
485
|
errorRedirectUri?: string;
|
|
486
486
|
}
|
|
487
487
|
export declare function connectorConnect(projectId: string, slug: string, options?: ConnectorConnectOptions): Promise<ConnectorConnectResult>;
|
|
488
|
-
export declare const pipedreamConnect: typeof connectorConnect;
|
|
489
488
|
export interface SessionConnectRequest {
|
|
490
489
|
slug: string;
|
|
491
490
|
app: string;
|
|
@@ -526,53 +525,6 @@ export declare function discoverConnectorAuth(projectId: string, draft: Connecto
|
|
|
526
525
|
export declare function deleteConnector(projectId: string, slug: string): Promise<{
|
|
527
526
|
ok: boolean;
|
|
528
527
|
}>;
|
|
529
|
-
export interface PipedreamApp {
|
|
530
|
-
slug: string;
|
|
531
|
-
name: string;
|
|
532
|
-
description: string | null;
|
|
533
|
-
imgSrc: string | null;
|
|
534
|
-
authType: string | null;
|
|
535
|
-
categories: string[];
|
|
536
|
-
hasActions: boolean;
|
|
537
|
-
hasTriggers: boolean;
|
|
538
|
-
featuredWeight: number;
|
|
539
|
-
directId?: string | null;
|
|
540
|
-
}
|
|
541
|
-
export interface PipedreamCategory {
|
|
542
|
-
key: string;
|
|
543
|
-
label: string;
|
|
544
|
-
count: number;
|
|
545
|
-
}
|
|
546
|
-
export interface PipedreamCatalogQuery {
|
|
547
|
-
q?: string;
|
|
548
|
-
category?: string;
|
|
549
|
-
cursor?: string;
|
|
550
|
-
limit?: number;
|
|
551
|
-
}
|
|
552
|
-
export interface PipedreamCatalogPage {
|
|
553
|
-
apps: PipedreamApp[];
|
|
554
|
-
categories: PipedreamCategory[];
|
|
555
|
-
total?: number;
|
|
556
|
-
nextCursor?: string;
|
|
557
|
-
hasMore: boolean;
|
|
558
|
-
indexReady?: boolean;
|
|
559
|
-
excludedNoActions?: number;
|
|
560
|
-
}
|
|
561
|
-
export declare function listPipedreamApps(projectId: string, qOrQuery?: string | PipedreamCatalogQuery, cursor?: string): Promise<PipedreamCatalogPage>;
|
|
562
|
-
export interface PipedreamSection {
|
|
563
|
-
key: string;
|
|
564
|
-
label: string;
|
|
565
|
-
total: number;
|
|
566
|
-
apps: PipedreamApp[];
|
|
567
|
-
}
|
|
568
|
-
export declare function listPipedreamSections(projectId: string, opts?: {
|
|
569
|
-
perCategory?: number;
|
|
570
|
-
maxCategories?: number;
|
|
571
|
-
}): Promise<{
|
|
572
|
-
sections: PipedreamSection[];
|
|
573
|
-
categories: PipedreamCategory[];
|
|
574
|
-
indexReady?: boolean;
|
|
575
|
-
}>;
|
|
576
528
|
export interface ConnectToolkit {
|
|
577
529
|
slug: string;
|
|
578
530
|
name: string;
|
|
@@ -584,7 +536,7 @@ export interface ConnectToolkit {
|
|
|
584
536
|
directId?: string | null;
|
|
585
537
|
}
|
|
586
538
|
export interface ConnectToolkitsPage {
|
|
587
|
-
provider:
|
|
539
|
+
provider: string;
|
|
588
540
|
toolkits: ConnectToolkit[];
|
|
589
541
|
total?: number;
|
|
590
542
|
nextCursor?: string;
|
|
@@ -609,7 +561,7 @@ export interface ConnectCategory {
|
|
|
609
561
|
count: number;
|
|
610
562
|
}
|
|
611
563
|
export interface ConnectSectionsPage {
|
|
612
|
-
provider:
|
|
564
|
+
provider: string;
|
|
613
565
|
sections: ConnectSection[];
|
|
614
566
|
categories: ConnectCategory[];
|
|
615
567
|
}
|
|
@@ -717,5 +669,4 @@ export interface ConnectorFinalizeOptions {
|
|
|
717
669
|
connectionId?: string;
|
|
718
670
|
}
|
|
719
671
|
export declare function connectorFinalize(projectId: string, slug: string, options?: ConnectorFinalizeOptions): Promise<ConnectorFinalizeResult>;
|
|
720
|
-
export declare const pipedreamFinalize: typeof connectorFinalize;
|
|
721
672
|
export {};
|
|
@@ -249,10 +249,10 @@ export async function shareConnection(projectId, connectionId, principals = [])
|
|
|
249
249
|
principals,
|
|
250
250
|
}));
|
|
251
251
|
}
|
|
252
|
-
export async function
|
|
252
|
+
export async function connectorConnectConnection(projectId, connectionId, input = {}) {
|
|
253
253
|
return unwrap(await backendApi.post(`/projects/${projectId}/connections/${connectionId}/connect`, input));
|
|
254
254
|
}
|
|
255
|
-
export async function
|
|
255
|
+
export async function connectorFinalizeConnection(projectId, connectionId) {
|
|
256
256
|
return unwrap(await backendApi.post(`/projects/${projectId}/connections/${connectionId}/connect/finalize`, {}));
|
|
257
257
|
}
|
|
258
258
|
export async function listConnectors(projectId, options) {
|
|
@@ -296,7 +296,6 @@ export async function connectorConnect(projectId, slug, options = {}) {
|
|
|
296
296
|
...(options.errorRedirectUri ? { error_redirect_uri: options.errorRedirectUri } : {}),
|
|
297
297
|
}));
|
|
298
298
|
}
|
|
299
|
-
export const pipedreamConnect = connectorConnect;
|
|
300
299
|
export async function listSessionConnectRequests(projectId, sessionId) {
|
|
301
300
|
const result = unwrap(await backendApi.get(`/connectors/projects/${projectId}/sessions/${encodeURIComponent(sessionId)}/connect-requests`));
|
|
302
301
|
return result.connectors ?? [];
|
|
@@ -310,31 +309,6 @@ export async function discoverConnectorAuth(projectId, draft) {
|
|
|
310
309
|
export async function deleteConnector(projectId, slug) {
|
|
311
310
|
return unwrap(await backendApi.delete(`/connectors/projects/${projectId}/connectors/${encodeURIComponent(slug)}`));
|
|
312
311
|
}
|
|
313
|
-
export async function listPipedreamApps(projectId, qOrQuery, cursor) {
|
|
314
|
-
const query = typeof qOrQuery === 'string' || qOrQuery === undefined
|
|
315
|
-
? { ...(qOrQuery ? { q: qOrQuery } : {}), ...(cursor ? { cursor } : {}) }
|
|
316
|
-
: qOrQuery;
|
|
317
|
-
const params = new URLSearchParams();
|
|
318
|
-
if (query.q)
|
|
319
|
-
params.set('q', query.q);
|
|
320
|
-
if (query.category)
|
|
321
|
-
params.set('category', query.category);
|
|
322
|
-
if (query.cursor)
|
|
323
|
-
params.set('cursor', query.cursor);
|
|
324
|
-
if (query.limit)
|
|
325
|
-
params.set('limit', String(query.limit));
|
|
326
|
-
const qs = params.toString();
|
|
327
|
-
return unwrap(await backendApi.get(`/connectors/projects/${projectId}/pipedream/apps${qs ? `?${qs}` : ''}`));
|
|
328
|
-
}
|
|
329
|
-
export async function listPipedreamSections(projectId, opts) {
|
|
330
|
-
const params = new URLSearchParams();
|
|
331
|
-
if (opts?.perCategory)
|
|
332
|
-
params.set('perCategory', String(opts.perCategory));
|
|
333
|
-
if (opts?.maxCategories)
|
|
334
|
-
params.set('maxCategories', String(opts.maxCategories));
|
|
335
|
-
const qs = params.toString();
|
|
336
|
-
return unwrap(await backendApi.get(`/connectors/projects/${projectId}/pipedream/sections${qs ? `?${qs}` : ''}`));
|
|
337
|
-
}
|
|
338
312
|
export async function listConnectToolkits(projectId, query = {}) {
|
|
339
313
|
const params = new URLSearchParams();
|
|
340
314
|
if (query.q)
|
|
@@ -418,4 +392,3 @@ export async function connectorFinalize(projectId, slug, options = {}) {
|
|
|
418
392
|
body.connection_id = options.connectionId;
|
|
419
393
|
return unwrap(await backendApi.post(`/connectors/projects/${projectId}/connectors/${encodeURIComponent(slug)}/connect/finalize`, body));
|
|
420
394
|
}
|
|
421
|
-
export const pipedreamFinalize = connectorFinalize;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import type { GitHubRepository } from './github.js';
|
|
2
1
|
export interface ManagedGitBackend {
|
|
3
2
|
configured: boolean;
|
|
4
|
-
kind:
|
|
3
|
+
kind: string | null;
|
|
5
4
|
owner: string | null;
|
|
6
5
|
}
|
|
7
|
-
export interface ManagedGitRepositoriesResponse {
|
|
8
|
-
owner: string;
|
|
9
|
-
repositories: GitHubRepository[];
|
|
10
|
-
}
|
|
11
6
|
export declare function getManagedGitBackend(): Promise<ManagedGitBackend>;
|
|
12
|
-
export declare function listManagedGitRepositories(options?: {
|
|
13
|
-
search?: string;
|
|
14
|
-
limit?: number;
|
|
15
|
-
}): Promise<ManagedGitRepositoriesResponse>;
|
|
@@ -3,13 +3,3 @@ import { unwrap } from './shared.js';
|
|
|
3
3
|
export async function getManagedGitBackend() {
|
|
4
4
|
return unwrap(await backendApi.get('/projects/git/backend', { showErrors: false }));
|
|
5
5
|
}
|
|
6
|
-
export async function listManagedGitRepositories(options) {
|
|
7
|
-
const params = new URLSearchParams();
|
|
8
|
-
const search = options?.search?.trim();
|
|
9
|
-
if (search)
|
|
10
|
-
params.set('search', search);
|
|
11
|
-
if (options?.limit !== undefined)
|
|
12
|
-
params.set('limit', String(options.limit));
|
|
13
|
-
const query = params.toString();
|
|
14
|
-
return unwrap(await backendApi.get(`/projects/git/backend/repositories${query ? `?${query}` : ''}`, { showErrors: false }));
|
|
15
|
-
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface SsoProvider {
|
|
2
2
|
sso_provider_id: string;
|
|
3
|
-
supabase_sso_provider_id: string;
|
|
4
3
|
name: string;
|
|
5
4
|
primary_domain: string;
|
|
6
5
|
group_claim_name: string;
|
|
@@ -26,15 +25,6 @@ export interface SsoGroupMapping {
|
|
|
26
25
|
created_at: string;
|
|
27
26
|
}
|
|
28
27
|
export declare function getSsoProvider(accountId: string): Promise<SsoProvider | null>;
|
|
29
|
-
export declare function upsertSsoProvider(accountId: string, input: {
|
|
30
|
-
supabase_sso_provider_id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
primary_domain: string;
|
|
33
|
-
group_claim_name?: string;
|
|
34
|
-
auto_create_members?: boolean;
|
|
35
|
-
auto_provision_groups?: boolean;
|
|
36
|
-
enforce_sso?: boolean;
|
|
37
|
-
}): Promise<SsoProvider>;
|
|
38
28
|
export declare function importSsoProviderFromMetadata(accountId: string, input: {
|
|
39
29
|
name: string;
|
|
40
30
|
primary_domain: string;
|
|
@@ -3,9 +3,6 @@ import { iamGet, iamUnwrap as unwrap } from './iam-shared.js';
|
|
|
3
3
|
export async function getSsoProvider(accountId) {
|
|
4
4
|
return unwrap(await iamGet(`/accounts/${accountId}/iam/sso/provider`)).provider;
|
|
5
5
|
}
|
|
6
|
-
export async function upsertSsoProvider(accountId, input) {
|
|
7
|
-
return unwrap(await backendApi.put(`/accounts/${accountId}/iam/sso/provider`, input, { showErrors: false })).provider;
|
|
8
|
-
}
|
|
9
6
|
export async function importSsoProviderFromMetadata(accountId, input) {
|
|
10
7
|
return unwrap(await backendApi.post(`/accounts/${accountId}/iam/sso/provider/from-metadata`, input, { showErrors: false })).provider;
|
|
11
8
|
}
|
|
@@ -30,8 +30,7 @@ export * from './referrals.js';
|
|
|
30
30
|
export * from './iam.js';
|
|
31
31
|
export * from './oauth-clients.js';
|
|
32
32
|
export * from './assignments.js';
|
|
33
|
-
export
|
|
34
|
-
export * from './admin-providers.js';
|
|
33
|
+
export { getAccountDeletionStatus, requestAccountDeletion, cancelAccountDeletion, deleteAccountImmediately, type AccountDeletionStatus, type AccountDeletionMutationResult, } from './account-lifecycle.js';
|
|
35
34
|
export * from './presentations.js';
|
|
36
35
|
export * from './review.js';
|
|
37
36
|
export * from './review-items.js';
|
|
@@ -49,7 +48,5 @@ export * from './drives.js';
|
|
|
49
48
|
export * from './notifications.js';
|
|
50
49
|
export type { AccountRole, ProjectRole, ConnectorSharing, ProjectGitConnection, ProjectFileEntry, } from './shared.js';
|
|
51
50
|
export * from './model-access.js';
|
|
52
|
-
export * from './provider-connections.js';
|
|
53
|
-
export * from './starter-suggestions.js';
|
|
54
51
|
export * from './session-attachments.js';
|
|
55
52
|
export * from './project-agents.js';
|
|
@@ -30,8 +30,7 @@ export * from './referrals.js';
|
|
|
30
30
|
export * from './iam.js';
|
|
31
31
|
export * from './oauth-clients.js';
|
|
32
32
|
export * from './assignments.js';
|
|
33
|
-
export
|
|
34
|
-
export * from './admin-providers.js';
|
|
33
|
+
export { getAccountDeletionStatus, requestAccountDeletion, cancelAccountDeletion, deleteAccountImmediately, } from './account-lifecycle.js';
|
|
35
34
|
export * from './presentations.js';
|
|
36
35
|
export * from './review.js';
|
|
37
36
|
export * from './review-items.js';
|
|
@@ -48,7 +47,5 @@ export * from './apps-fleet.js';
|
|
|
48
47
|
export * from './drives.js';
|
|
49
48
|
export * from './notifications.js';
|
|
50
49
|
export * from './model-access.js';
|
|
51
|
-
export * from './provider-connections.js';
|
|
52
|
-
export * from './starter-suggestions.js';
|
|
53
50
|
export * from './session-attachments.js';
|
|
54
51
|
export * from './project-agents.js';
|
|
@@ -2,7 +2,7 @@ import type { CatalogModel } from '@beeuni/llm-catalog';
|
|
|
2
2
|
import { type ApiClientOptions } from '../../http/api-client.js';
|
|
3
3
|
import type { SandboxProviderName } from '../platform-client/types.js';
|
|
4
4
|
import { type ProjectFileEntry, type ProjectGitConnection, type ProjectRole, type ServerTokenOptions } from './shared.js';
|
|
5
|
-
export type FeatureFlagKey = 'agent_tunnel' | 'marketplace' | 'connectors_api_discover' | 'agentmail_email' | 'teams' | 'llm_gateway' | 'review_center' | 'meta_agent' | 'apps' | 'monitors' | 'reminders' | 'warm_sessions' | 'secrets_egress' | 'pi_worker' | 'session_transcript_history' | 'pooled_provider_secrets' | 'pi_harness' | 'config_releases' | 'agent_principal' | 'us_region' | 'event_triggers' | 'notification_center' | 'drives' | 'ephemeral_sandboxes' | 'human_messaging';
|
|
5
|
+
export type FeatureFlagKey = 'agent_tunnel' | 'marketplace' | 'connectors_api_discover' | 'agentmail_email' | 'teams' | 'llm_gateway' | 'review_center' | 'meta_agent' | 'apps' | 'monitors' | 'reminders' | 'warm_sessions' | 'secrets_egress' | 'pi_worker' | 'session_transcript_history' | 'pooled_provider_secrets' | 'pi_harness' | 'config_releases' | 'agent_principal' | 'us_region' | 'event_triggers' | 'notification_center' | 'volumes' | 'stateless_sessions' | 'drives' | 'ephemeral_sandboxes' | 'session_log' | 'human_messaging';
|
|
6
6
|
type GraduatedFeatureFlagKey = 'agent_tunnel' | 'teams' | 'review_center' | 'session_transcript_history' | 'agent_principal' | 'human_messaging' | 'pi_worker' | 'config_releases';
|
|
7
7
|
type ServedFeatureFlagKey = Exclude<FeatureFlagKey, GraduatedFeatureFlagKey>;
|
|
8
8
|
export declare const FEATURE_FLAG_KEYS: readonly FeatureFlagKey[];
|
|
@@ -16,6 +16,7 @@ export interface FeatureFlagView {
|
|
|
16
16
|
enabled: boolean;
|
|
17
17
|
overridden: boolean;
|
|
18
18
|
operator_only?: boolean;
|
|
19
|
+
scope?: 'project' | 'organization';
|
|
19
20
|
}
|
|
20
21
|
export type ExperimentalFeatureKey = FeatureFlagKey;
|
|
21
22
|
export type ExperimentalFeatureView = FeatureFlagView;
|
|
@@ -17,8 +17,11 @@ export const FEATURE_FLAG_KEYS = [
|
|
|
17
17
|
'us_region',
|
|
18
18
|
'event_triggers',
|
|
19
19
|
'notification_center',
|
|
20
|
+
'volumes',
|
|
21
|
+
'stateless_sessions',
|
|
20
22
|
'drives',
|
|
21
23
|
'ephemeral_sandboxes',
|
|
24
|
+
'session_log',
|
|
22
25
|
];
|
|
23
26
|
export async function listProjects() {
|
|
24
27
|
return unwrap(await backendApi.get('/projects'));
|
|
@@ -18,11 +18,10 @@ export interface SandboxTemplate {
|
|
|
18
18
|
snapshot_name: string;
|
|
19
19
|
content_hash: string;
|
|
20
20
|
built_from_commit: string | null;
|
|
21
|
-
daytona_state: string;
|
|
22
21
|
provider_state: string;
|
|
23
22
|
ready: boolean;
|
|
24
23
|
provider_coverage?: Array<{
|
|
25
|
-
provider:
|
|
24
|
+
provider: string;
|
|
26
25
|
available: boolean;
|
|
27
26
|
snapshot_name: string;
|
|
28
27
|
state: 'active' | 'building' | 'build_failed' | 'removing' | 'unknown' | 'missing' | null;
|
|
@@ -41,7 +40,7 @@ export interface SandboxTemplatesResponse {
|
|
|
41
40
|
items: SandboxTemplate[];
|
|
42
41
|
default_slug: string | null;
|
|
43
42
|
provider_mode?: 'automatic' | 'pinned';
|
|
44
|
-
selected_provider?:
|
|
43
|
+
selected_provider?: string | null;
|
|
45
44
|
warm_pool_available?: boolean;
|
|
46
45
|
}
|
|
47
46
|
export interface ProjectSnapshotBuild {
|
|
@@ -55,7 +54,7 @@ export interface ProjectSnapshotBuild {
|
|
|
55
54
|
error_category: SnapshotErrorCategory | null;
|
|
56
55
|
fixable_by_agent: boolean;
|
|
57
56
|
source: 'session-start' | 'project-create' | 'cr-merge' | 'manual' | 'background' | 'startup' | null;
|
|
58
|
-
provider?:
|
|
57
|
+
provider?: string | null;
|
|
59
58
|
started_at: string;
|
|
60
59
|
finished_at: string | null;
|
|
61
60
|
}
|
|
@@ -78,7 +77,7 @@ export interface ProjectSnapshotsResponse {
|
|
|
78
77
|
builds: ProjectSnapshotBuild[];
|
|
79
78
|
status?: SandboxRuntimeStatus | null;
|
|
80
79
|
provider_mode?: 'automatic' | 'pinned';
|
|
81
|
-
selected_provider?:
|
|
80
|
+
selected_provider?: string | null;
|
|
82
81
|
warm_pool_available?: boolean;
|
|
83
82
|
}
|
|
84
83
|
export interface ProjectSandboxHealth {
|
|
@@ -90,15 +89,15 @@ export interface ProjectSandboxHealth {
|
|
|
90
89
|
latest_failure: ProjectSnapshotBuild | null;
|
|
91
90
|
status?: SandboxRuntimeStatus | null;
|
|
92
91
|
provider_mode?: 'automatic' | 'pinned';
|
|
93
|
-
selected_provider?:
|
|
92
|
+
selected_provider?: string | null;
|
|
94
93
|
}
|
|
95
94
|
export interface RebuildSnapshotResponse {
|
|
96
95
|
status: 'started';
|
|
97
96
|
slug: string;
|
|
98
97
|
deleted_existing: boolean;
|
|
99
98
|
snapshot_name: string;
|
|
100
|
-
providers?: Array<
|
|
101
|
-
failed_providers?: Array<
|
|
99
|
+
providers?: Array<string>;
|
|
100
|
+
failed_providers?: Array<string>;
|
|
102
101
|
}
|
|
103
102
|
export declare function listProjectSandboxTemplates(projectId: string): Promise<SandboxTemplatesResponse>;
|
|
104
103
|
export declare function listProjectSnapshots(projectId: string): Promise<ProjectSnapshotsResponse>;
|
|
@@ -139,6 +138,6 @@ export declare function buildSandboxTemplate(projectId: string, templateId: stri
|
|
|
139
138
|
status: "started";
|
|
140
139
|
template_id: string;
|
|
141
140
|
slug: string;
|
|
142
|
-
providers?: Array<
|
|
141
|
+
providers?: Array<string>;
|
|
143
142
|
}>;
|
|
144
143
|
export declare function listProjectSandboxes(projectId: string): Promise<SandboxTemplatesResponse>;
|
|
@@ -5,7 +5,7 @@ export interface ProjectSessionSandbox {
|
|
|
5
5
|
session_id: string;
|
|
6
6
|
project_id: string;
|
|
7
7
|
account_id: string;
|
|
8
|
-
provider:
|
|
8
|
+
provider: string;
|
|
9
9
|
external_id: string | null;
|
|
10
10
|
base_url: string | null;
|
|
11
11
|
status: ProjectSessionSandboxStatus;
|
|
@@ -18,7 +18,7 @@ export interface ProjectSession {
|
|
|
18
18
|
project_id: string;
|
|
19
19
|
branch_name: string;
|
|
20
20
|
base_ref: string;
|
|
21
|
-
sandbox_provider:
|
|
21
|
+
sandbox_provider: string | null;
|
|
22
22
|
sandbox_id: string | null;
|
|
23
23
|
sandbox_url: string | null;
|
|
24
24
|
runtime_session_id?: string | null;
|
|
@@ -89,7 +89,7 @@ export interface CreateProjectSessionInput {
|
|
|
89
89
|
name?: string;
|
|
90
90
|
labels?: string[];
|
|
91
91
|
session_id?: string;
|
|
92
|
-
provider?:
|
|
92
|
+
provider?: string;
|
|
93
93
|
persistent_machine?: boolean;
|
|
94
94
|
branch_already_created?: boolean;
|
|
95
95
|
metadata?: Record<string, unknown>;
|
|
@@ -16,6 +16,8 @@ export function openSessionStream(options) {
|
|
|
16
16
|
lastHealth: null,
|
|
17
17
|
runtimeRefs: 0,
|
|
18
18
|
connectedWithRuntime: false,
|
|
19
|
+
logRefs: 0,
|
|
20
|
+
connectedWithLog: false,
|
|
19
21
|
tabId: null,
|
|
20
22
|
authoritative: false,
|
|
21
23
|
reconnectNow: false,
|
|
@@ -33,6 +35,10 @@ export function openSessionStream(options) {
|
|
|
33
35
|
if (!target.connectedWithRuntime)
|
|
34
36
|
reconnect = true;
|
|
35
37
|
}
|
|
38
|
+
if (options.schema === 'v2')
|
|
39
|
+
target.logRefs += 1;
|
|
40
|
+
if (target.runtimeRefs > 0 && target.logRefs > 0 && !target.connectedWithLog)
|
|
41
|
+
reconnect = true;
|
|
36
42
|
if (options.tabId && target.tabId !== options.tabId) {
|
|
37
43
|
target.tabId = options.tabId;
|
|
38
44
|
reconnect = true;
|
|
@@ -66,8 +72,15 @@ export function openSessionStream(options) {
|
|
|
66
72
|
target.subscribers.delete(options);
|
|
67
73
|
if (options.runtime)
|
|
68
74
|
target.runtimeRefs -= 1;
|
|
69
|
-
if (
|
|
75
|
+
if (options.schema === 'v2')
|
|
76
|
+
target.logRefs -= 1;
|
|
77
|
+
if (target.subscribers.size > 0) {
|
|
78
|
+
if (target.connectedWithLog && (target.logRefs === 0 || target.runtimeRefs === 0) && target.attempt) {
|
|
79
|
+
target.reconnectNow = true;
|
|
80
|
+
target.attempt.abort();
|
|
81
|
+
}
|
|
70
82
|
return;
|
|
83
|
+
}
|
|
71
84
|
target.abort.abort();
|
|
72
85
|
if (streams.get(key) === target)
|
|
73
86
|
streams.delete(key);
|
|
@@ -132,10 +145,14 @@ async function run(options, shared) {
|
|
|
132
145
|
arm();
|
|
133
146
|
const withRuntime = shared.runtimeRefs > 0;
|
|
134
147
|
shared.connectedWithRuntime = withRuntime;
|
|
148
|
+
const withLog = withRuntime && shared.logRefs > 0;
|
|
149
|
+
shared.connectedWithLog = withLog;
|
|
135
150
|
try {
|
|
136
151
|
const url = new URL(`${platformConfig().backendUrl.replace(/\/$/, '')}/projects/${encodeURIComponent(options.projectId)}/sessions/${encodeURIComponent(options.sessionId)}/events`);
|
|
137
152
|
if (!withRuntime)
|
|
138
153
|
url.searchParams.set('channels', 'control');
|
|
154
|
+
if (withLog)
|
|
155
|
+
url.searchParams.set('schema', 'v2');
|
|
139
156
|
if (shared.tabId)
|
|
140
157
|
url.searchParams.set('tab_id', shared.tabId);
|
|
141
158
|
if (withRuntime && seq !== null && epoch) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SessionLogPage } from './source.js';
|
|
2
|
+
import type { SessionLogThreadHead } from './store.js';
|
|
3
|
+
import { type SessionLogMessage } from './types.js';
|
|
4
|
+
export declare function isSessionLogMessage(v: unknown): v is SessionLogMessage;
|
|
5
|
+
export declare function isSessionLogThreadHead(v: unknown): v is SessionLogThreadHead;
|
|
6
|
+
export declare function isSessionLogPage(v: unknown): v is SessionLogPage;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { SESSION_LOG_SCHEMA } from './types.js';
|
|
2
|
+
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
3
|
+
const isStr = (v) => typeof v === 'string';
|
|
4
|
+
const isId = (v) => isStr(v) && v.length > 0;
|
|
5
|
+
const isStrOrNull = (v) => v === null || isStr(v);
|
|
6
|
+
const isOptional = (v, check) => v === undefined || check(v);
|
|
7
|
+
const oneOf = (...values) => (v) => values.includes(v);
|
|
8
|
+
const isCount = (v) => Number.isInteger(v) && v >= 0;
|
|
9
|
+
const isNum = (v) => typeof v === 'number';
|
|
10
|
+
const isSchemaRef = (v) => v.schema === SESSION_LOG_SCHEMA && isCount(v.v);
|
|
11
|
+
const isOptStr = (v) => isOptional(v, isStr);
|
|
12
|
+
const isExt = (v) => v === undefined || (isObj(v) && Object.values(v).every((e) => isObj(e) && isStr(e.version)));
|
|
13
|
+
const isModel = (v) => v === null || (isObj(v) && isStr(v.provider) && isStr(v.model) && isOptStr(v.variant));
|
|
14
|
+
const isUsage = (v) => v === null ||
|
|
15
|
+
(isObj(v) && isNum(v.input) && isNum(v.output) && isNum(v.cache_read) && isNum(v.cache_write) && isOptional(v.reasoning, isNum) && isOptional(v.cost, isNum));
|
|
16
|
+
const isResultContent = (c) => isObj(c) && ((c.type === 'text' && isStr(c.text)) || (c.type === 'attachment' && isStr(c.mime)));
|
|
17
|
+
const isToolResult = (r) => isObj(r) && Array.isArray(r.content) && r.content.every(isResultContent) && isOptional(r.model_content, (m) => Array.isArray(m) && m.every(isResultContent)) && typeof r.is_error === 'boolean';
|
|
18
|
+
const BLOCK = {
|
|
19
|
+
text: (b) => isStr(b.text) && isOptional(b.bytes, isCount) && isOptStr(b.ref) && (b.ref === undefined || b.bytes !== undefined),
|
|
20
|
+
reasoning: (b) => isStr(b.text),
|
|
21
|
+
attachment: (b) => isStr(b.mime) && isOptStr(b.ref) && isOptional(b.bytes, isCount) && (b.ref === undefined) === (b.bytes === undefined),
|
|
22
|
+
tool_call: (b) => isStr(b.call_id) &&
|
|
23
|
+
isStr(b.name) &&
|
|
24
|
+
isId(b.kind) &&
|
|
25
|
+
oneOf('pending', 'running', 'complete', 'error')(b.status) &&
|
|
26
|
+
isOptional(b.result, isToolResult),
|
|
27
|
+
compaction: (b) => isStrOrNull(b.summary) && isStrOrNull(b.first_kept_message_id),
|
|
28
|
+
subtask: (b) => isStr(b.thread_id) && isStr(b.agent) && isStr(b.description),
|
|
29
|
+
step: (b) => oneOf('start', 'finish')(b.phase),
|
|
30
|
+
harness: (b) => isId(b.harness) && isId(b.kind) && typeof b.model_visible === 'boolean',
|
|
31
|
+
};
|
|
32
|
+
function isBlocks(blocks, atRestInContext) {
|
|
33
|
+
if (!Array.isArray(blocks))
|
|
34
|
+
return false;
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
for (const b of blocks) {
|
|
37
|
+
if (!isObj(b) || !isId(b.id) || seen.has(b.id) || !Object.hasOwn(BLOCK, b.type))
|
|
38
|
+
return false;
|
|
39
|
+
if (!BLOCK[b.type](b) || !isExt(b.ext))
|
|
40
|
+
return false;
|
|
41
|
+
if (atRestInContext && b.type === 'tool_call' && (b.status === 'pending' || b.status === 'running' || !b.result))
|
|
42
|
+
return false;
|
|
43
|
+
seen.add(b.id);
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
export function isSessionLogMessage(v) {
|
|
48
|
+
return (isObj(v) &&
|
|
49
|
+
isSchemaRef(v) &&
|
|
50
|
+
isId(v.message_id) &&
|
|
51
|
+
isId(v.thread_id) &&
|
|
52
|
+
Number.isInteger(v.seq) &&
|
|
53
|
+
oneOf('user', 'assistant', 'system')(v.role) &&
|
|
54
|
+
oneOf('turn', 'compaction', 'context')(v.kind) &&
|
|
55
|
+
oneOf('streaming', 'complete', 'error', 'aborted', 'interrupted')(v.status) &&
|
|
56
|
+
typeof v.in_context === 'boolean' &&
|
|
57
|
+
isOptional(v.hidden_reason, oneOf('failed_attempt', 'aborted', 'retracted', 'reverted', 'superseded')) &&
|
|
58
|
+
isOptional(v.origin, oneOf('prompt', 'steer', 'command', 'automation', 'subagent', 'notification')) &&
|
|
59
|
+
isOptional(v.agent, isStrOrNull) &&
|
|
60
|
+
isOptional(v.reply_to, isStrOrNull) &&
|
|
61
|
+
isOptional(v.parent_message_id, isStrOrNull) &&
|
|
62
|
+
isOptStr(v.native_agent_id) &&
|
|
63
|
+
isOptStr(v.context_ref) &&
|
|
64
|
+
isModel(v.model) &&
|
|
65
|
+
isUsage(v.usage) &&
|
|
66
|
+
oneOf('stop', 'tool_calls', 'length', 'error', 'aborted', null)(v.finish) &&
|
|
67
|
+
(v.error === null || (isObj(v.error) && isId(v.error.code) && isStr(v.error.message))) &&
|
|
68
|
+
isStr(v.created_at) &&
|
|
69
|
+
isStrOrNull(v.completed_at) &&
|
|
70
|
+
isObj(v.producer) &&
|
|
71
|
+
isId(v.producer.harness) &&
|
|
72
|
+
isStr(v.producer.harness_version) &&
|
|
73
|
+
isStr(v.producer.adapter_version) &&
|
|
74
|
+
isExt(v.ext) &&
|
|
75
|
+
isBlocks(v.blocks, v.status !== 'streaming' && v.in_context === true));
|
|
76
|
+
}
|
|
77
|
+
export function isSessionLogThreadHead(v) {
|
|
78
|
+
return (isObj(v) &&
|
|
79
|
+
isSchemaRef(v) &&
|
|
80
|
+
isId(v.thread_id) &&
|
|
81
|
+
isStrOrNull(v.parent_thread_id) &&
|
|
82
|
+
(v.spawned_by === null || isObj(v.spawned_by)) &&
|
|
83
|
+
isStr(v.created_at));
|
|
84
|
+
}
|
|
85
|
+
function isSessionPatch(v) {
|
|
86
|
+
return (isObj(v) &&
|
|
87
|
+
isOptional(v.schema, (x) => x === SESSION_LOG_SCHEMA) &&
|
|
88
|
+
isOptional(v.v, isCount) &&
|
|
89
|
+
isOptStr(v.session_id) &&
|
|
90
|
+
isOptional(v.title, isStrOrNull) &&
|
|
91
|
+
isOptStr(v.created_at) &&
|
|
92
|
+
isOptional(v.restore_grade, oneOf('native', 'converted', 'partial')) &&
|
|
93
|
+
isOptional(v.todos, Array.isArray) &&
|
|
94
|
+
isOptional(v.pending, (p) => isObj(p) && Array.isArray(p.questions) && Array.isArray(p.permissions)) &&
|
|
95
|
+
isOptional(v.selection, (x) => isObj(x) && isOptional(x.agent, isStrOrNull) && isModel(x.model ?? null)) &&
|
|
96
|
+
isOptional(v.harness, (x) => isObj(x) && isStr(x.current) && Array.isArray(x.history)) &&
|
|
97
|
+
isExt(v.ext));
|
|
98
|
+
}
|
|
99
|
+
export function isSessionLogPage(v) {
|
|
100
|
+
return (isObj(v) &&
|
|
101
|
+
isCount(v.generation) &&
|
|
102
|
+
typeof v.has_more === 'boolean' &&
|
|
103
|
+
isSessionPatch(v.session) &&
|
|
104
|
+
Array.isArray(v.threads) &&
|
|
105
|
+
v.threads.every(isSessionLogThreadHead) &&
|
|
106
|
+
(v.thread_id === null || isId(v.thread_id)) &&
|
|
107
|
+
Array.isArray(v.messages) &&
|
|
108
|
+
v.messages.every((m) => isSessionLogMessage(m) && m.thread_id === v.thread_id));
|
|
109
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { KNOWN_TOOL_KINDS, SESSION_LOG_MINOR, SESSION_LOG_SCHEMA, type AttachmentBlock, type CompactionBlock, type CompactionLayoutEntry, type GradeCounts, type HarnessBlock, type KnownToolKind, type ModelRef, type ReasoningBlock, type RestoreGrade, type SessionLog, type SessionLogBlock, type SessionLogMessage, type SessionLogThread, type StepBlock, type SubtaskBlock, type TextBlock, type ThreadInteraction, type ToolCallBlock, type ToolResultContent, } from './types.js';
|
|
2
|
+
export type { Todo as SessionLogTodo, ToolKind as SessionLogToolKind } from './types.js';
|
|
3
|
+
export { toolCallBlock, toolCallMetadata } from './tool-call.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CopyCodec, CopyStore } from '../session-sync/copy-store-types.js';
|
|
2
|
+
import type { SavedCopyStore } from '../session-sync/saved-copy-store.js';
|
|
3
|
+
import type { SessionLogPage } from './source.js';
|
|
4
|
+
export declare const SESSION_LOG_COPY: CopyCodec<SessionLogPage>;
|
|
5
|
+
export interface SessionLogCopies {
|
|
6
|
+
read(projectId: string, sessionId: string): SessionLogPage | null | Promise<SessionLogPage | null>;
|
|
7
|
+
write(projectId: string, sessionId: string, page: SessionLogPage): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerSessionLogCopies(store: SavedCopyStore, v2: CopyStore<SessionLogPage>, removeV1: (projectId: string, sessionId: string) => Promise<void>): void;
|
|
10
|
+
export declare function savedSessionLogCopies(store: SavedCopyStore | null | undefined): SessionLogCopies | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isSessionLogPage } from './guard.js';
|
|
2
|
+
const paintable = (page) => isSessionLogPage(page) && page.messages.length > 0;
|
|
3
|
+
function fit(stored, maxChars) {
|
|
4
|
+
const { messages } = stored.e;
|
|
5
|
+
for (let from = 0; from < messages.length; from++) {
|
|
6
|
+
const text = JSON.stringify(from === 0 ? stored : { ...stored, e: { ...stored.e, messages: messages.slice(from), has_more: true } });
|
|
7
|
+
if (text.length <= maxChars)
|
|
8
|
+
return text;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
export const SESSION_LOG_COPY = { paintable, fit, capturedAt: () => 0 };
|
|
13
|
+
const copies = new WeakMap();
|
|
14
|
+
export function registerSessionLogCopies(store, v2, removeV1) {
|
|
15
|
+
copies.set(store, {
|
|
16
|
+
read: (projectId, sessionId) => v2.read(projectId, sessionId),
|
|
17
|
+
write: async (projectId, sessionId, page) => {
|
|
18
|
+
await v2.write(projectId, sessionId, page);
|
|
19
|
+
await removeV1(projectId, sessionId);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function savedSessionLogCopies(store) {
|
|
24
|
+
return (store && copies.get(store)) ?? null;
|
|
25
|
+
}
|