@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
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Message, Event as RuntimeEvent, Part, SessionStatus, Todo } from "../../core/runtime/runtime-types.js";
|
|
2
|
+
import type { SessionLogPage } from "../../core/session-log/source.js";
|
|
3
|
+
import { type SessionLogEventInput, type SessionLogState } from "../../core/session-log/store.js";
|
|
2
4
|
import { ascendingId } from "./sync-store/ascending-id.js";
|
|
3
5
|
import { Binary } from "./sync-store/binary.js";
|
|
4
6
|
import type { FileDiff, MessageError, MessageWithParts, SessionRewindState } from "./sync-store/types.js";
|
|
@@ -16,7 +18,11 @@ interface SyncState {
|
|
|
16
18
|
todos: Record<string, Todo[]>;
|
|
17
19
|
sessionRevert: Record<string, SessionRewindState | null>;
|
|
18
20
|
sessionRevertNeedsTailReconcile: Record<string, boolean>;
|
|
21
|
+
sessionLogs: Record<string, SessionLogState>;
|
|
19
22
|
applyEvent: (event: RuntimeEvent) => void;
|
|
23
|
+
applySessionLogPage: (sessionId: string, page: SessionLogPage) => void;
|
|
24
|
+
applySessionLogEvent: (sessionId: string, event: SessionLogEventInput) => void;
|
|
25
|
+
dropSessionLog: (sessionId: string) => void;
|
|
20
26
|
upsertMessage: (sessionID: string, message: Message) => void;
|
|
21
27
|
removeMessage: (sessionID: string, messageID: string) => void;
|
|
22
28
|
upsertPart: (messageID: string, part: Part, sessionID?: string) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { create } from "zustand";
|
|
3
3
|
import { commitSessionRewind, isWithinRewindWindow, stageSessionRewind, } from "../../core/session/rewind.js";
|
|
4
|
+
import { EMPTY_SESSION_LOG_STATE, applySessionLogEvent, applySessionLogPage, } from "../../core/session-log/store.js";
|
|
4
5
|
import { isRetryableTurnError } from "../../core/turns/open-turn.js";
|
|
5
6
|
import { ascendingId } from "./sync-store/ascending-id.js";
|
|
6
7
|
import { Binary } from "./sync-store/binary.js";
|
|
@@ -280,6 +281,41 @@ function pruneDetachedSessions(messages) {
|
|
|
280
281
|
}
|
|
281
282
|
return evicted;
|
|
282
283
|
}
|
|
284
|
+
function takeDeltaEventId(sessionID, tailKey, id) {
|
|
285
|
+
let sessionTails = deltaEventTails.get(sessionID);
|
|
286
|
+
if (!sessionTails) {
|
|
287
|
+
sessionTails = new Map();
|
|
288
|
+
deltaEventTails.set(sessionID, sessionTails);
|
|
289
|
+
}
|
|
290
|
+
let appliedIds = sessionTails.get(tailKey);
|
|
291
|
+
if (appliedIds?.has(id))
|
|
292
|
+
return false;
|
|
293
|
+
if (!appliedIds) {
|
|
294
|
+
appliedIds = new Set();
|
|
295
|
+
sessionTails.set(tailKey, appliedIds);
|
|
296
|
+
}
|
|
297
|
+
appliedIds.add(id);
|
|
298
|
+
if (appliedIds.size > DELTA_EVENT_TAIL_LIMIT) {
|
|
299
|
+
const oldest = appliedIds.values().next().value;
|
|
300
|
+
if (oldest !== undefined)
|
|
301
|
+
appliedIds.delete(oldest);
|
|
302
|
+
}
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
function applySessionLogFrame(sessionId, event) {
|
|
306
|
+
const state = useSyncStore.getState();
|
|
307
|
+
const current = state.sessionLogs[sessionId] ?? EMPTY_SESSION_LOG_STATE;
|
|
308
|
+
const next = applySessionLogEvent(current, event);
|
|
309
|
+
if (next === current)
|
|
310
|
+
return;
|
|
311
|
+
if (event.type === "log.block.delta") {
|
|
312
|
+
const p = event.properties;
|
|
313
|
+
if (event.id && !takeDeltaEventId(p.thread_id, `${p.message_id}:${p.block_id}:log`, event.id))
|
|
314
|
+
return;
|
|
315
|
+
state.noteSessionActivity(p.thread_id);
|
|
316
|
+
}
|
|
317
|
+
useSyncStore.setState((s) => ({ sessionLogs: { ...s.sessionLogs, [sessionId]: next } }));
|
|
318
|
+
}
|
|
283
319
|
function appendPartDeltas(sessionID, messageID, partID, field, pieces) {
|
|
284
320
|
trackId(deltaActiveParts, sessionID, partID);
|
|
285
321
|
let applied = false;
|
|
@@ -292,27 +328,8 @@ function appendPartDeltas(sessionID, messageID, partID, field, pieces) {
|
|
|
292
328
|
return s;
|
|
293
329
|
let delta = "";
|
|
294
330
|
for (const piece of pieces) {
|
|
295
|
-
if (piece.id
|
|
296
|
-
|
|
297
|
-
let sessionTails = deltaEventTails.get(sessionID);
|
|
298
|
-
if (!sessionTails) {
|
|
299
|
-
sessionTails = new Map();
|
|
300
|
-
deltaEventTails.set(sessionID, sessionTails);
|
|
301
|
-
}
|
|
302
|
-
let appliedIds = sessionTails.get(tailKey);
|
|
303
|
-
if (appliedIds?.has(piece.id))
|
|
304
|
-
continue;
|
|
305
|
-
if (!appliedIds) {
|
|
306
|
-
appliedIds = new Set();
|
|
307
|
-
sessionTails.set(tailKey, appliedIds);
|
|
308
|
-
}
|
|
309
|
-
appliedIds.add(piece.id);
|
|
310
|
-
if (appliedIds.size > DELTA_EVENT_TAIL_LIMIT) {
|
|
311
|
-
const oldest = appliedIds.values().next().value;
|
|
312
|
-
if (oldest !== undefined)
|
|
313
|
-
appliedIds.delete(oldest);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
331
|
+
if (piece.id && !takeDeltaEventId(sessionID, `${messageID}:${partID}:${field}`, piece.id))
|
|
332
|
+
continue;
|
|
316
333
|
delta += piece.delta;
|
|
317
334
|
applied = true;
|
|
318
335
|
}
|
|
@@ -339,6 +356,7 @@ export const useSyncStore = create()((set, get) => ({
|
|
|
339
356
|
todos: {},
|
|
340
357
|
sessionRevert: {},
|
|
341
358
|
sessionRevertNeedsTailReconcile: {},
|
|
359
|
+
sessionLogs: {},
|
|
342
360
|
get statuses() {
|
|
343
361
|
return get().sessionStatus;
|
|
344
362
|
},
|
|
@@ -1041,8 +1059,21 @@ export const useSyncStore = create()((set, get) => ({
|
|
|
1041
1059
|
todos: {},
|
|
1042
1060
|
sessionRevert: {},
|
|
1043
1061
|
sessionRevertNeedsTailReconcile: {},
|
|
1062
|
+
sessionLogs: {},
|
|
1044
1063
|
});
|
|
1045
1064
|
},
|
|
1065
|
+
applySessionLogPage: (sessionId, page) => set((s) => {
|
|
1066
|
+
const current = s.sessionLogs[sessionId] ?? EMPTY_SESSION_LOG_STATE;
|
|
1067
|
+
const next = applySessionLogPage(current, { ...page, session: { session_id: sessionId, ...page.session } });
|
|
1068
|
+
return next === current ? s : { sessionLogs: { ...s.sessionLogs, [sessionId]: next } };
|
|
1069
|
+
}),
|
|
1070
|
+
applySessionLogEvent: (sessionId, event) => applySessionLogFrame(sessionId, event),
|
|
1071
|
+
dropSessionLog: (sessionId) => set((s) => {
|
|
1072
|
+
if (!(sessionId in s.sessionLogs))
|
|
1073
|
+
return s;
|
|
1074
|
+
const { [sessionId]: _dropped, ...rest } = s.sessionLogs;
|
|
1075
|
+
return { sessionLogs: rest };
|
|
1076
|
+
}),
|
|
1046
1077
|
hasOptimisticMessages: (sessionID) => {
|
|
1047
1078
|
const list = get().messages[sessionID];
|
|
1048
1079
|
if (!list || list.length === 0)
|
|
@@ -3,6 +3,7 @@ export type { SessionModel } from './session-shared.js';
|
|
|
3
3
|
import type { RuntimeClient } from '../runtime/client.js';
|
|
4
4
|
import { type BeeuniPlatformConfig } from '../http/config.js';
|
|
5
5
|
import * as P from '../rest/projects-client/index.js';
|
|
6
|
+
import { getMobileClientPolicy } from '../rest/platform-client/client-policy.js';
|
|
6
7
|
declare function runtime(): RuntimeClient;
|
|
7
8
|
export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
8
9
|
global?: boolean;
|
|
@@ -59,15 +60,6 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
};
|
|
62
|
-
providerConnections: {
|
|
63
|
-
list: typeof P.listUserProviderConnections;
|
|
64
|
-
saveApiKey: typeof P.saveUserProviderApiKey;
|
|
65
|
-
remove: typeof P.deleteUserProviderConnection;
|
|
66
|
-
startOAuth: typeof P.startUserProviderOAuth;
|
|
67
|
-
pollOAuth: typeof P.pollUserProviderOAuth;
|
|
68
|
-
listProject: typeof P.listProjectPersonalProviders;
|
|
69
|
-
setProject: typeof P.setProjectPersonalProvider;
|
|
70
|
-
};
|
|
71
63
|
iam: {
|
|
72
64
|
assignments: {
|
|
73
65
|
list: typeof P.listAssignments;
|
|
@@ -386,7 +378,7 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
386
378
|
status: "started";
|
|
387
379
|
template_id: string;
|
|
388
380
|
slug: string;
|
|
389
|
-
providers?: Array<
|
|
381
|
+
providers?: Array<string>;
|
|
390
382
|
}>;
|
|
391
383
|
setProvider: (provider: Parameters<typeof P.updateProjectSandboxProvider>[1]) => Promise<P.UpdateProjectSandboxProviderResult>;
|
|
392
384
|
};
|
|
@@ -643,8 +635,8 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
643
635
|
tunnelId: string;
|
|
644
636
|
share?: P.ConnectorConnectOwner;
|
|
645
637
|
}) => Promise<P.Connection>;
|
|
646
|
-
|
|
647
|
-
|
|
638
|
+
connect: (connectionId: string, input?: P.ConnectionConnectInput | undefined) => Promise<P.ConnectorConnectResult>;
|
|
639
|
+
finalize: (connectionId: string) => Promise<P.ConnectorFinalizeResult>;
|
|
648
640
|
};
|
|
649
641
|
policies: {
|
|
650
642
|
get: (slug: string) => Promise<{
|
|
@@ -658,19 +650,8 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
658
650
|
sync?: P.ConnectorSyncResult;
|
|
659
651
|
}>;
|
|
660
652
|
};
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
listSections: (opts?: {
|
|
664
|
-
perCategory?: number;
|
|
665
|
-
maxCategories?: number;
|
|
666
|
-
} | undefined) => Promise<{
|
|
667
|
-
sections: P.PipedreamSection[];
|
|
668
|
-
categories: P.PipedreamCategory[];
|
|
669
|
-
indexReady?: boolean;
|
|
670
|
-
}>;
|
|
671
|
-
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
672
|
-
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
673
|
-
};
|
|
653
|
+
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
654
|
+
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
674
655
|
discover: {
|
|
675
656
|
list: (qOrQuery?: string | P.DiscoverConnectorsQuery | undefined, cursor?: string | undefined) => Promise<P.DiscoverConnectorsPage>;
|
|
676
657
|
sections: (opts?: {
|
|
@@ -1142,10 +1123,6 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
1142
1123
|
deleteInstallation: typeof P.deleteGitHubInstallation;
|
|
1143
1124
|
storeUserToken: typeof P.storeGitHubUserToken;
|
|
1144
1125
|
};
|
|
1145
|
-
gitBackend: {
|
|
1146
|
-
get: typeof P.getManagedGitBackend;
|
|
1147
|
-
repositories: typeof P.listManagedGitRepositories;
|
|
1148
|
-
};
|
|
1149
1126
|
billing: {
|
|
1150
1127
|
accountState: typeof P.getAccountState;
|
|
1151
1128
|
accountStateMinimal: typeof P.getAccountStateMinimal;
|
|
@@ -1208,6 +1185,7 @@ export declare function createBeeuni(config: BeeuniPlatformConfig, opts?: {
|
|
|
1208
1185
|
registerWebPushSubscription: typeof P.registerWebPushSubscription;
|
|
1209
1186
|
unregisterWebPushSubscription: typeof P.unregisterWebPushSubscription;
|
|
1210
1187
|
};
|
|
1188
|
+
mobileClientPolicy: typeof getMobileClientPolicy;
|
|
1211
1189
|
validateToken: typeof P.validateToken;
|
|
1212
1190
|
runtime: typeof runtime;
|
|
1213
1191
|
};
|
|
@@ -15,6 +15,7 @@ import { bindProjectPlatformSecurity } from './project-platform-security.js';
|
|
|
15
15
|
import { getClient } from '../runtime/client.js';
|
|
16
16
|
import { configureBeeuni } from '../http/config.js';
|
|
17
17
|
import * as P from '../rest/projects-client/index.js';
|
|
18
|
+
import { getMobileClientPolicy } from '../rest/platform-client/client-policy.js';
|
|
18
19
|
function runtime() {
|
|
19
20
|
return getClient();
|
|
20
21
|
}
|
|
@@ -39,7 +40,7 @@ export function createBeeuni(config, opts) {
|
|
|
39
40
|
const resolvePreviewOptsForSandbox = bindPreviewOptions(config);
|
|
40
41
|
const { auth, accounts, iam, accountInvites } = bindIdentity();
|
|
41
42
|
const { billing, sandboxShares } = bindCommerce();
|
|
42
|
-
const { projects, github,
|
|
43
|
+
const { projects, github, connectStatus, marketplace } = bindCatalog();
|
|
43
44
|
function project(projectId) {
|
|
44
45
|
const connections = projectConnections(projectId);
|
|
45
46
|
return {
|
|
@@ -57,15 +58,6 @@ export function createBeeuni(config, opts) {
|
|
|
57
58
|
config,
|
|
58
59
|
auth,
|
|
59
60
|
accounts,
|
|
60
|
-
providerConnections: {
|
|
61
|
-
list: P.listUserProviderConnections,
|
|
62
|
-
saveApiKey: P.saveUserProviderApiKey,
|
|
63
|
-
remove: P.deleteUserProviderConnection,
|
|
64
|
-
startOAuth: P.startUserProviderOAuth,
|
|
65
|
-
pollOAuth: P.pollUserProviderOAuth,
|
|
66
|
-
listProject: P.listProjectPersonalProviders,
|
|
67
|
-
setProject: P.setProjectPersonalProvider,
|
|
68
|
-
},
|
|
69
61
|
iam,
|
|
70
62
|
accountInvites,
|
|
71
63
|
projects,
|
|
@@ -74,7 +66,6 @@ export function createBeeuni(config, opts) {
|
|
|
74
66
|
project,
|
|
75
67
|
session: (projectId, sessionId) => session(projectId, sessionId, config, resolvePreviewOptsForSandbox),
|
|
76
68
|
github,
|
|
77
|
-
gitBackend,
|
|
78
69
|
billing,
|
|
79
70
|
sandboxShares,
|
|
80
71
|
connectStatus,
|
|
@@ -90,6 +81,7 @@ export function createBeeuni(config, opts) {
|
|
|
90
81
|
registerWebPushSubscription: P.registerWebPushSubscription,
|
|
91
82
|
unregisterWebPushSubscription: P.unregisterWebPushSubscription,
|
|
92
83
|
},
|
|
84
|
+
mobileClientPolicy: getMobileClientPolicy,
|
|
93
85
|
validateToken: P.validateToken,
|
|
94
86
|
runtime,
|
|
95
87
|
};
|
|
@@ -32,10 +32,6 @@ export declare function bindCatalog(): {
|
|
|
32
32
|
deleteInstallation: typeof P.deleteGitHubInstallation;
|
|
33
33
|
storeUserToken: typeof P.storeGitHubUserToken;
|
|
34
34
|
};
|
|
35
|
-
gitBackend: {
|
|
36
|
-
get: typeof P.getManagedGitBackend;
|
|
37
|
-
repositories: typeof P.listManagedGitRepositories;
|
|
38
|
-
};
|
|
39
35
|
connectStatus: typeof P.getConnectStatus;
|
|
40
36
|
marketplace: {
|
|
41
37
|
items: (options?: Parameters<typeof P.listMarketplaceCatalogItems>[0]) => Promise<P.MarketplaceItemsResponse>;
|
|
@@ -32,10 +32,6 @@ export function bindCatalog() {
|
|
|
32
32
|
deleteInstallation: P.deleteGitHubInstallation,
|
|
33
33
|
storeUserToken: P.storeGitHubUserToken,
|
|
34
34
|
};
|
|
35
|
-
const gitBackend = {
|
|
36
|
-
get: P.getManagedGitBackend,
|
|
37
|
-
repositories: P.listManagedGitRepositories,
|
|
38
|
-
};
|
|
39
35
|
const connectStatus = P.getConnectStatus;
|
|
40
36
|
const marketplace = {
|
|
41
37
|
items: (options) => P.listMarketplaceCatalogItems(options),
|
|
@@ -49,5 +45,5 @@ export function bindCatalog() {
|
|
|
49
45
|
remove: (id) => P.removeMarketplaceSource(id),
|
|
50
46
|
},
|
|
51
47
|
};
|
|
52
|
-
return { projects, github,
|
|
48
|
+
return { projects, github, connectStatus, marketplace };
|
|
53
49
|
}
|
|
@@ -27,6 +27,6 @@ export declare function projectConnections(projectId: string): {
|
|
|
27
27
|
tunnelId: string;
|
|
28
28
|
share?: P.ConnectorConnectOwner;
|
|
29
29
|
}) => Promise<P.Connection>;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
connect: (connectionId: string, input?: P.ConnectionConnectInput | undefined) => Promise<P.ConnectorConnectResult>;
|
|
31
|
+
finalize: (connectionId: string) => Promise<P.ConnectorFinalizeResult>;
|
|
32
32
|
};
|
|
@@ -12,7 +12,7 @@ export function projectConnections(projectId) {
|
|
|
12
12
|
rename: (...a) => P.renameConnection(projectId, ...a),
|
|
13
13
|
share: (...a) => P.shareConnection(projectId, ...a),
|
|
14
14
|
addComputer: (...a) => P.addComputerToProject(projectId, ...a),
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
connect: (...a) => P.connectorConnectConnection(projectId, ...a),
|
|
16
|
+
finalize: (...a) => P.connectorFinalizeConnection(projectId, ...a),
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -187,8 +187,8 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
187
187
|
tunnelId: string;
|
|
188
188
|
share?: P.ConnectorConnectOwner;
|
|
189
189
|
}) => Promise<P.Connection>;
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
connect: (connectionId: string, input?: P.ConnectionConnectInput | undefined) => Promise<P.ConnectorConnectResult>;
|
|
191
|
+
finalize: (connectionId: string) => Promise<P.ConnectorFinalizeResult>;
|
|
192
192
|
};
|
|
193
193
|
policies: {
|
|
194
194
|
get: (slug: string) => Promise<{
|
|
@@ -202,19 +202,8 @@ export declare function bindProjectOperations(projectId: string, connections: Re
|
|
|
202
202
|
sync?: P.ConnectorSyncResult;
|
|
203
203
|
}>;
|
|
204
204
|
};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
listSections: (opts?: {
|
|
208
|
-
perCategory?: number;
|
|
209
|
-
maxCategories?: number;
|
|
210
|
-
} | undefined) => Promise<{
|
|
211
|
-
sections: P.PipedreamSection[];
|
|
212
|
-
categories: P.PipedreamCategory[];
|
|
213
|
-
indexReady?: boolean;
|
|
214
|
-
}>;
|
|
215
|
-
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
216
|
-
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
217
|
-
};
|
|
205
|
+
connect: (slug: string, options?: P.ConnectorConnectOptions | undefined) => Promise<P.ConnectorConnectResult>;
|
|
206
|
+
finalize: (slug: string, options?: P.ConnectorFinalizeOptions | undefined) => Promise<P.ConnectorFinalizeResult>;
|
|
218
207
|
discover: {
|
|
219
208
|
list: (qOrQuery?: string | P.DiscoverConnectorsQuery | undefined, cursor?: string | undefined) => Promise<P.DiscoverConnectorsPage>;
|
|
220
209
|
sections: (opts?: {
|
|
@@ -24,12 +24,8 @@ export function bindProjectOperations(projectId, connections) {
|
|
|
24
24
|
get: (...a) => P.getConnectorPolicies(projectId, ...a),
|
|
25
25
|
set: (...a) => P.setConnectorPolicies(projectId, ...a),
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
listSections: (...a) => P.listPipedreamSections(projectId, ...a),
|
|
30
|
-
connect: (...a) => P.pipedreamConnect(projectId, ...a),
|
|
31
|
-
finalize: (...a) => P.pipedreamFinalize(projectId, ...a),
|
|
32
|
-
},
|
|
27
|
+
connect: (...a) => P.connectorConnect(projectId, ...a),
|
|
28
|
+
finalize: (...a) => P.connectorFinalize(projectId, ...a),
|
|
33
29
|
discover: {
|
|
34
30
|
list: (...a) => P.listDiscoverConnectors(projectId, ...a),
|
|
35
31
|
sections: (...a) => P.listDiscoverSections(projectId, ...a),
|
|
@@ -33,7 +33,7 @@ export declare function bindProjectPlatformSecurity(projectId: string): {
|
|
|
33
33
|
status: "started";
|
|
34
34
|
template_id: string;
|
|
35
35
|
slug: string;
|
|
36
|
-
providers?: Array<
|
|
36
|
+
providers?: Array<string>;
|
|
37
37
|
}>;
|
|
38
38
|
setProvider: (provider: Parameters<typeof P.updateProjectSandboxProvider>[1]) => Promise<P.UpdateProjectSandboxProviderResult>;
|
|
39
39
|
};
|
|
@@ -34,7 +34,7 @@ export declare function bindProjectPlatformSettings(projectId: string): {
|
|
|
34
34
|
status: "started";
|
|
35
35
|
template_id: string;
|
|
36
36
|
slug: string;
|
|
37
|
-
providers?: Array<
|
|
37
|
+
providers?: Array<string>;
|
|
38
38
|
}>;
|
|
39
39
|
setProvider: (provider: Parameters<typeof P.updateProjectSandboxProvider>[1]) => Promise<P.UpdateProjectSandboxProviderResult>;
|
|
40
40
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ApiError } from './api/errors.js';
|
|
2
|
-
export { isAdminBypassEnabled, setAdminBypass } from './transport.js';
|
|
3
2
|
export { ApiError, AuthError, BillingError, RequestTooLargeError, parseBillingError, isAuthFailure, isBillingError, formatBillingErrorForUI, FEATURE_DISABLED_CODE, isFeatureDisabledError, featureDisabledKey, type ApiErrorFields, type BillingErrorUI, type FeatureDisabledError, } from './api/errors.js';
|
|
4
3
|
export interface ErrorContext {
|
|
5
4
|
operation?: string;
|
|
@@ -24,12 +23,6 @@ export declare const MODEL_NOT_SERVABLE_CODE = "model_not_servable";
|
|
|
24
23
|
export declare const PROVISION_IN_FLIGHT_CODE = "provision_in_flight";
|
|
25
24
|
export declare const ANALYTICS_UNAVAILABLE_CODE = "analytics_unavailable";
|
|
26
25
|
export declare const ACCOUNTS_LIST_UNAVAILABLE_CODE = "accounts_list_unavailable";
|
|
27
|
-
export declare const supabaseClient: {
|
|
28
|
-
execute<T = any>(queryFn: () => Promise<{
|
|
29
|
-
data: T | null;
|
|
30
|
-
error: any;
|
|
31
|
-
}>, errorContext?: ErrorContext): Promise<ApiResponse<T>>;
|
|
32
|
-
};
|
|
33
26
|
declare function postStream(endpoint: string, data: unknown, options?: ApiClientOptions): Promise<Response>;
|
|
34
27
|
export declare const backendApi: {
|
|
35
28
|
putRaw: <T = any>(endpoint: string, body: BodyInit, options?: Omit<RequestInit & ApiClientOptions, "method" | "body">) => Promise<ApiResponse<T>>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { syntheticUnauthenticatedResponse } from '../../platform/auth-core.js';
|
|
2
|
-
import {
|
|
2
|
+
import { AuthError } from './api/errors.js';
|
|
3
3
|
import { platformConfig } from './config.js';
|
|
4
4
|
import { makeRequest } from './request.js';
|
|
5
5
|
import { send } from './transport.js';
|
|
6
|
-
export { isAdminBypassEnabled, setAdminBypass } from './transport.js';
|
|
7
6
|
const getApiUrl = () => platformConfig().backendUrl || '';
|
|
8
7
|
export { ApiError, AuthError, BillingError, RequestTooLargeError, parseBillingError, isAuthFailure, isBillingError, formatBillingErrorForUI, FEATURE_DISABLED_CODE, isFeatureDisabledError, featureDisabledKey, } from './api/errors.js';
|
|
9
8
|
export const FEATURE_NOT_SUPPORTED_CODE = 'feature_not_supported';
|
|
@@ -11,41 +10,6 @@ export const MODEL_NOT_SERVABLE_CODE = 'model_not_servable';
|
|
|
11
10
|
export const PROVISION_IN_FLIGHT_CODE = 'provision_in_flight';
|
|
12
11
|
export const ANALYTICS_UNAVAILABLE_CODE = 'analytics_unavailable';
|
|
13
12
|
export const ACCOUNTS_LIST_UNAVAILABLE_CODE = 'accounts_list_unavailable';
|
|
14
|
-
export const supabaseClient = {
|
|
15
|
-
async execute(queryFn, errorContext) {
|
|
16
|
-
try {
|
|
17
|
-
const { data, error } = await queryFn();
|
|
18
|
-
if (error) {
|
|
19
|
-
const apiError = new ApiError(error.message || 'Database error', {
|
|
20
|
-
code: error.code,
|
|
21
|
-
details: error,
|
|
22
|
-
});
|
|
23
|
-
platformConfig().onError?.(apiError, errorContext);
|
|
24
|
-
return {
|
|
25
|
-
error: apiError,
|
|
26
|
-
success: false,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
data: data,
|
|
31
|
-
success: true,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
const apiError = error instanceof Error
|
|
36
|
-
? new ApiError(error.message, {
|
|
37
|
-
name: error.name || 'ApiError',
|
|
38
|
-
stack: error.stack,
|
|
39
|
-
})
|
|
40
|
-
: new ApiError(String(error));
|
|
41
|
-
platformConfig().onError?.(apiError, errorContext);
|
|
42
|
-
return {
|
|
43
|
-
error: apiError,
|
|
44
|
-
success: false,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
13
|
async function postStream(endpoint, data, options = {}) {
|
|
50
14
|
const { timeout = 30000, fetch: fetchImpl } = options;
|
|
51
15
|
const controller = new AbortController();
|
package/dist/core/http/auth.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type TokenRetryOptions } from '../../platform/auth-core.js';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function getAuthToken(): Promise<string | null>;
|
|
3
|
+
export declare function getAuthTokenWithRetry(options?: TokenRetryOptions): Promise<string | null>;
|
|
4
4
|
export declare function invalidateTokenCache(): void;
|
|
5
5
|
export declare function setCachedAuthToken(token: string | null): void;
|
|
6
6
|
export declare function setBootstrapAuthToken(_token: string | null): void;
|
|
7
|
-
export declare function getAuthToken(): Promise<string | null>;
|
|
8
|
-
export declare function getAuthTokenWithRetry(options?: TokenRetryOptions): Promise<string | null>;
|
|
9
7
|
export declare function authenticatedFetch(input: RequestInfo | URL, init?: RequestInit, options?: {
|
|
10
8
|
retryOnAuthError?: boolean;
|
|
11
9
|
timeoutMs?: number | null;
|
package/dist/core/http/auth.js
CHANGED
|
@@ -2,10 +2,10 @@ import { syntheticUnauthenticatedResponse, withTokenRetry, } from '../../platfor
|
|
|
2
2
|
import { AuthError } from './api/errors.js';
|
|
3
3
|
import { platformConfig } from './config.js';
|
|
4
4
|
import { hostToken, invalidateHostToken, send } from './transport.js';
|
|
5
|
-
export async function
|
|
5
|
+
export async function getAuthToken() {
|
|
6
6
|
return hostToken();
|
|
7
7
|
}
|
|
8
|
-
export async function
|
|
8
|
+
export async function getAuthTokenWithRetry(options) {
|
|
9
9
|
return withTokenRetry(() => platformConfig().getToken(), options, invalidateTokenCache);
|
|
10
10
|
}
|
|
11
11
|
export function invalidateTokenCache() {
|
|
@@ -16,12 +16,6 @@ export function setCachedAuthToken(token) {
|
|
|
16
16
|
invalidateHostToken();
|
|
17
17
|
}
|
|
18
18
|
export function setBootstrapAuthToken(_token) { }
|
|
19
|
-
export async function getAuthToken() {
|
|
20
|
-
return getSupabaseAccessToken();
|
|
21
|
-
}
|
|
22
|
-
export async function getAuthTokenWithRetry(options) {
|
|
23
|
-
return getSupabaseAccessTokenWithRetry(options);
|
|
24
|
-
}
|
|
25
19
|
export async function authenticatedFetch(input, init, options) {
|
|
26
20
|
try {
|
|
27
21
|
return await send(input, init, {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AuthRequestOptions } from './auth.js';
|
|
2
|
+
export interface MobileClientPolicy {
|
|
3
|
+
minimum_version: string | null;
|
|
4
|
+
store_url_ios: string | null;
|
|
5
|
+
store_url_android: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getMobileClientPolicy(opts?: AuthRequestOptions): Promise<MobileClientPolicy>;
|
|
8
|
+
export declare function compareSemver(a: string, b: string): -1 | 0 | 1 | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiError } from '../../http/api/errors.js';
|
|
2
|
+
import { platformConfig } from '../../http/config.js';
|
|
3
|
+
import { platformApiBase } from './shared.js';
|
|
4
|
+
export async function getMobileClientPolicy(opts) {
|
|
5
|
+
const fetchImpl = opts?.fetch ?? platformConfig().fetch ?? ((input, init) => fetch(input, init));
|
|
6
|
+
const backendUrl = opts?.backendUrl ?? platformConfig().backendUrl;
|
|
7
|
+
const res = await fetchImpl(`${platformApiBase(backendUrl)}/clients/mobile`, {
|
|
8
|
+
headers: { accept: 'application/json' },
|
|
9
|
+
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
10
|
+
});
|
|
11
|
+
if (!res.ok) {
|
|
12
|
+
throw new ApiError(`Mobile client policy request failed (HTTP ${res.status})`, { status: res.status, response: res });
|
|
13
|
+
}
|
|
14
|
+
return (await res.json());
|
|
15
|
+
}
|
|
16
|
+
const SEMVER = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/i;
|
|
17
|
+
export function compareSemver(a, b) {
|
|
18
|
+
const parts = (v) => {
|
|
19
|
+
const m = SEMVER.exec(v.trim());
|
|
20
|
+
return m ? [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)] : null;
|
|
21
|
+
};
|
|
22
|
+
const pa = parts(a);
|
|
23
|
+
const pb = parts(b);
|
|
24
|
+
if (!pa || !pb)
|
|
25
|
+
return null;
|
|
26
|
+
for (let i = 0; i < 3; i++)
|
|
27
|
+
if (pa[i] !== pb[i])
|
|
28
|
+
return pa[i] < pb[i] ? -1 : 1;
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
@@ -5,8 +5,7 @@ export * from './members.js';
|
|
|
5
5
|
export * from './invites.js';
|
|
6
6
|
export * from './backups.js';
|
|
7
7
|
export * from './ssh.js';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export * from './host-boundary.js';
|
|
8
|
+
export { getLatestSandboxVersion, getFullChangelog, getAllVersions, type ChangelogChange, type ChangelogArtifact, type ChangelogEntry, type VersionChannel, type VersionEntry, type AllVersionsResponse, type SandboxVersionInfo, } from './updates.js';
|
|
9
|
+
export { HostBoundaryError, listPublicMarketplaceItems, listPublicMarketplaces, getPublicMarketplaceItem, getPublicMarketplaceItemFile, checkAccessEmail, submitAccessRequest, recordPlatformLogout, getOAuthConsentRequest, submitOAuthConsent, getConnectorSetupLink, startConnectorSetupLink, finalizeConnectorSetupLink, getSecretSetupLink, submitSecretSetupLink, getPublicShareByToken, startSessionWithToken, submitDemoRequest, downloadAccountAudit, buildPublicTemplateUrl, getPublicTemplate, type HostRequestOptions, type PublicMarketplaceQuery, type OAuthConsentRequest, type ConnectorSetupLinkInfo, type ConnectorSetupLinkStart, type ConnectorSetupLinkFinalize, type FinalizeConnectorSetupLinkInput, type SecretSetupLinkInfo, type SecretWithheldReason, type SecretSetupLinkWithheld, type SecretSetupLinkSubmitResult, type AccountAuditExport, } from './host-boundary.js';
|
|
11
10
|
export * from './connector-setup.js';
|
|
12
|
-
export * from './
|
|
11
|
+
export * from './client-policy.js';
|
|
@@ -5,8 +5,7 @@ export * from './members.js';
|
|
|
5
5
|
export * from './invites.js';
|
|
6
6
|
export * from './backups.js';
|
|
7
7
|
export * from './ssh.js';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export * from './host-boundary.js';
|
|
8
|
+
export { getLatestSandboxVersion, getFullChangelog, getAllVersions, } from './updates.js';
|
|
9
|
+
export { HostBoundaryError, listPublicMarketplaceItems, listPublicMarketplaces, getPublicMarketplaceItem, getPublicMarketplaceItemFile, checkAccessEmail, submitAccessRequest, recordPlatformLogout, getOAuthConsentRequest, submitOAuthConsent, getConnectorSetupLink, startConnectorSetupLink, finalizeConnectorSetupLink, getSecretSetupLink, submitSecretSetupLink, getPublicShareByToken, startSessionWithToken, submitDemoRequest, downloadAccountAudit, buildPublicTemplateUrl, getPublicTemplate, } from './host-boundary.js';
|
|
11
10
|
export * from './connector-setup.js';
|
|
12
|
-
export * from './
|
|
11
|
+
export * from './client-policy.js';
|
|
@@ -8,7 +8,7 @@ export declare const SANDBOX_PORTS: {
|
|
|
8
8
|
readonly BROWSER_VIEWER: "9224";
|
|
9
9
|
readonly SSH: "22";
|
|
10
10
|
};
|
|
11
|
-
export type SandboxProviderName =
|
|
11
|
+
export type SandboxProviderName = string;
|
|
12
12
|
export type ServerTypeOption = string;
|
|
13
13
|
export interface SandboxCreateProgress {
|
|
14
14
|
status: 'pulling';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AppHostingProvider =
|
|
1
|
+
export type AppHostingProvider = string;
|
|
2
2
|
export type AppDesiredState = 'running' | 'stopped';
|
|
3
3
|
export type AppAccessMode = 'private' | 'project' | 'restricted' | 'public' | 'password';
|
|
4
4
|
export type AppArtifactKind = 'archive' | 'oci_image';
|
|
@@ -120,6 +120,7 @@ export interface App {
|
|
|
120
120
|
used_by?: string[];
|
|
121
121
|
auth?: AppAuth;
|
|
122
122
|
labels?: string[];
|
|
123
|
+
display?: AppDisplay;
|
|
123
124
|
scale?: Record<string, number>;
|
|
124
125
|
services?: AppServiceSummary[];
|
|
125
126
|
machines?: {
|
|
@@ -135,6 +136,11 @@ export interface App {
|
|
|
135
136
|
created_at: string;
|
|
136
137
|
updated_at: string;
|
|
137
138
|
}
|
|
139
|
+
export interface AppDisplay {
|
|
140
|
+
listed?: boolean;
|
|
141
|
+
preview?: 'live' | 'none';
|
|
142
|
+
parent?: string;
|
|
143
|
+
}
|
|
138
144
|
export interface CreateAppInput {
|
|
139
145
|
slug: string;
|
|
140
146
|
name: string;
|
|
@@ -154,6 +160,7 @@ export interface UpdateAppInput {
|
|
|
154
160
|
always_on?: boolean;
|
|
155
161
|
uses?: string[];
|
|
156
162
|
labels?: string[];
|
|
163
|
+
display?: AppDisplay;
|
|
157
164
|
}
|
|
158
165
|
export type AppViewerTokenScope = 'off' | 'identity' | 'api';
|
|
159
166
|
export interface AppAccessConfig {
|