@neta-art/cohub 10.0.0 → 11.0.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 +11 -2
- package/dist/board/editor/animation.d.ts +3 -0
- package/dist/board/editor/animation.js +16 -1
- package/dist/board/editor/clipboard.js +7 -0
- package/dist/board/editor/copy.js +23 -18
- package/dist/board/editor/creation.d.ts +5 -1
- package/dist/board/editor/creation.js +2 -1
- package/dist/board/editor/deletion.js +3 -3
- package/dist/board/editor/document.d.ts +8 -2
- package/dist/board/editor/document.js +54 -7
- package/dist/board/editor/editor.d.ts +18 -3
- package/dist/board/editor/editor.js +11 -1
- package/dist/board/editor/query.d.ts +5 -5
- package/dist/board/editor/query.js +14 -12
- package/dist/board/editor/selection.js +2 -1
- package/dist/board/export/index.d.ts +25 -4
- package/dist/board/export/index.js +45 -12
- package/dist/board/export/node/index.d.ts +5 -4
- package/dist/board/export/node/index.js +16 -11
- package/dist/board/export/node/scripts.d.ts +16 -0
- package/dist/board/export/node/scripts.js +258 -0
- package/dist/board/export/scene.d.ts +2 -1
- package/dist/board/export/scene.js +20 -6
- package/dist/board/model/animation.d.ts +4 -1
- package/dist/board/model/animation.js +34 -7
- package/dist/board/model/authoring.d.ts +20 -0
- package/dist/board/model/authoring.js +185 -0
- package/dist/board/model/export-plan.js +1 -0
- package/dist/board/model/file-preview.js +1 -1
- package/dist/board/model/file-snapshot.js +3 -2
- package/dist/board/model/image-key.js +6 -2
- package/dist/board/model/index.d.ts +13 -6
- package/dist/board/model/index.js +14 -8
- package/dist/board/model/items/builtin.js +2 -2
- package/dist/board/model/items/create.d.ts +4 -2
- package/dist/board/model/items/create.js +6 -5
- package/dist/board/model/items/index.d.ts +2 -2
- package/dist/board/model/items/index.js +2 -2
- package/dist/board/model/media-playback.d.ts +2 -1
- package/dist/board/model/media-playback.js +14 -4
- package/dist/board/model/media.js +7 -1
- package/dist/board/model/sampling.d.ts +19 -0
- package/dist/board/model/sampling.js +96 -0
- package/dist/board/model/script-example.d.ts +4 -0
- package/dist/board/model/script-example.js +21 -0
- package/dist/board/model/script-hit.d.ts +10 -0
- package/dist/board/model/script-hit.js +52 -0
- package/dist/board/model/script-index.d.ts +7 -0
- package/dist/board/model/script-index.js +15 -0
- package/dist/board/model/script-scene.d.ts +24 -0
- package/dist/board/model/script-scene.js +267 -0
- package/dist/board/model/script.d.ts +105 -0
- package/dist/board/model/script.js +1 -0
- package/dist/board/render/css-color.d.ts +6 -1
- package/dist/board/render/css-color.js +34 -20
- package/dist/board/render/diagnostics.d.ts +20 -0
- package/dist/board/render/diagnostics.js +117 -0
- package/dist/board/render/index.d.ts +9 -6
- package/dist/board/render/index.js +9 -6
- package/dist/board/render/palette.d.ts +2 -1
- package/dist/board/render/palette.js +6 -2
- package/dist/board/render/renderers/arrow-card-renderer.js +3 -2
- package/dist/board/render/renderers/audio-card-renderer.js +2 -1
- package/dist/board/render/renderers/board-renderer-registry.d.ts +10 -5
- package/dist/board/render/renderers/board-renderer-registry.js +3 -3
- package/dist/board/render/renderers/custom-card-renderer.d.ts +5 -0
- package/dist/board/render/renderers/{sketch-card-renderer.js → custom-card-renderer.js} +16 -15
- package/dist/board/render/renderers/draw-card-renderer.js +3 -2
- package/dist/board/render/renderers/effect-card-renderer.js +22 -5
- package/dist/board/render/renderers/frame-card-renderer.js +30 -14
- package/dist/board/render/renderers/image-card-renderer.js +43 -4
- package/dist/board/render/renderers/shape-card-renderer.js +10 -27
- package/dist/board/render/renderers/text-card-renderer.js +5 -3
- package/dist/board/render/renderers/unknown-card-renderer.js +1 -0
- package/dist/board/render/renderers/video-card-renderer.js +2 -1
- package/dist/board/render/sampling.d.ts +22 -0
- package/dist/board/render/sampling.js +21 -0
- package/dist/board/render/script-export.d.ts +11 -0
- package/dist/board/render/script-export.js +86 -0
- package/dist/board/render/script-host.d.ts +31 -0
- package/dist/board/render/script-host.js +421 -0
- package/dist/board/render/script-modules.d.ts +2 -0
- package/dist/board/render/script-modules.js +2 -0
- package/dist/board/render/script-runtime.d.ts +29 -0
- package/dist/board/render/script-runtime.js +213 -0
- package/dist/board/render/script-sandbox.d.ts +4 -0
- package/dist/board/render/script-sandbox.js +173 -0
- package/dist/board/render/stroke.d.ts +2 -1
- package/dist/board/render/stroke.js +22 -1
- package/dist/board/render/text-measurement.js +1 -1
- package/dist/board/stage/assets.js +6 -1
- package/dist/board/stage/maintenance.d.ts +5 -0
- package/dist/board/stage/maintenance.js +11 -0
- package/dist/board/stage/scene.js +5 -2
- package/dist/board/stage/script-pointer.d.ts +19 -0
- package/dist/board/stage/script-pointer.js +35 -0
- package/dist/board/stage/stage.d.ts +10 -0
- package/dist/board/stage/stage.js +249 -43
- package/dist/board/stage/texture-pool.js +2 -3
- package/dist/chunks/environment.d.ts +266 -23
- package/dist/chunks/host-bridge.d.ts +2 -2
- package/dist/chunks/http.d.ts +88 -7
- package/dist/chunks/http.js +155 -63
- package/dist/chunks/transport.js +3 -1
- package/dist/chunks/websocket.d.ts +9 -1
- package/dist/chunks/websocket.js +16 -2
- package/dist/host-bridge.js +2 -1
- package/dist/http.d.ts +2 -2
- package/dist/index.d.ts +182 -4
- package/dist/index.js +1374 -126
- package/dist/protocol/dist/board-assets.d.ts +1 -0
- package/dist/protocol/dist/board-constants.js +2 -2
- package/dist/protocol/dist/board-model.d.ts +201 -11
- package/dist/protocol/dist/board-model.js +33 -14
- package/dist/protocol/dist/board-patch.js +2 -1
- package/dist/protocol/dist/board-schema.d.ts +4 -2
- package/dist/protocol/dist/board-schema.js +18 -4
- package/dist/protocol/dist/board-script-modules.d.ts +25 -0
- package/dist/protocol/dist/board-script-modules.js +127 -0
- package/dist/protocol/dist/display/index.d.ts +1 -0
- package/dist/protocol/dist/index.d.ts +4 -2
- package/dist/protocol/dist/realtime/types.d.ts +1 -0
- package/dist/protocol/dist/rtc/index.d.ts +1 -0
- package/package.json +2 -1
- package/dist/board/export/node/sketch.d.ts +0 -19
- package/dist/board/export/node/sketch.js +0 -146
- package/dist/board/render/renderers/sketch-card-renderer.d.ts +0 -5
- package/dist/board/render/sketch-host.d.ts +0 -14
- package/dist/board/render/sketch-host.js +0 -216
package/dist/chunks/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $a as BoardPlaybackChangedEvent$1, $n as SpaceCommerceProduct, $
|
|
1
|
+
import { $a as BoardPlaybackChangedEvent$1, $n as SpaceCommerceProduct, $r as SpaceSessionsResponse, $s as RuntimeArchiveUpload, $t as PromptTemplateCatalogResponse, An as SessionTurnSignedUrlsResponse, As as BoardDelta, Bi as SessionTurnRecord, Br as SpaceMember, Ci as ChannelHealth, Cr as SpaceFsReadFilesResponse, Dn as SessionRecord, En as SessionMessagesResponse, Et as GlobalSearchType, Fn as SkillCatalogResponse, Ft as LabelItemsResponse, Gr as SpacePresenceSnapshot, Gs as AppAuthorizationRequest$1, Gt as PaletteOverviewResponse, Hi as StoredIntermediateMessage, Hr as SpaceModListItem, Ht as MeResponse, Ic as SpaceCompletionResult, Ii as SessionStats, Io as DesktopCommandError, Is as BoardPatch, Jn as SpaceCommerceBenefit, Jo as NavigationCall, Jr as SpaceRecord, Jt as PatchResourceLabelsInput, Ka as GenerationContentBlock, Kc as RequestSource, Ks as AppAuthorizationResult, Lc as SpaceCompletionStreamEvent, Lo as DesktopCommandRecord, Lt as LabelListItem, Mi as SessionForkRecord, Mn as SessionTurnWindowResponse, Mr as SpaceFsWriteFileInput, Nn as SessionTurnsPaginatedResponse, Oi as MessageRecord, On as SessionTurnIndexResponse, Ot as InvitationDetail, Pc as CreateSpaceCompletionInput, Po as DesktopCommand, Pr as SpaceInvitationListResponse, Pt as LabelAssignmentRecord, Q as Channel, Qa as BoardChangedEvent$1, Qn as SpaceCommerceOrder, Qo as SpaceFsCopyInput, Rc as Usage, Ri as MessageToolCallsFile, Rn as SpaceAccessPolicy, Ro as DesktopCommandStatus, Rr as SpaceListOptions, Sc as RtcIceServers, Si as ChannelConfig, So as AppVersionSource, Tn as SessionMessagesPaginatedResponse, Ur as SpacePendingDiffFileResponse, Us as BillingPayload, Ut as ModelCatalogEntry, Vi as SpaceTurnsResponse, Vn as SpaceActivityResponse, Wi as TurnIntermediateMessagesFile, Wr as SpacePendingDiffSummary, Xo as SpacePublicEndpoints, Xt as Permission, Yn as SpaceCommerceBuyerProfile, Yo as NavigationLaunch, Yr as SpaceRole, Ys as HarnessArchiveIndex, Yt as PatchResourceLabelsResponse, Za as BoardAwarenessUpdatedEvent$1, Zs as RuntimeArchivePage, _ as AcceptInvitationResponse, _i as UserSessionSourceKey, _t as CronJobRecord, aa as RuntimeStopConfirmation, ac as DisplayCaptureParams, ar as SpaceConfigUpdateResponse, br as SpaceFsPreparingFile, bs as BoardReadResult, cc as DisplayInputEvent, cn as ReferenceAggregateResponse, cr as SpaceEnvInput, cs as BoardAwarenessUpdate, ct as ClaimReferralResponse, dn as ReferenceQueryResponse, ds as BoardApplyResult, dt as CreateSpaceInput, ei as SpaceTurnAuthorFilter, en as PublicReferral, er as SpaceCommerceProductBenefitBinding, es as SpaceFsCopyResponse, fn as ReferenceQueryableType, fr as SpaceFsCreateUploadInput, hc as DisplayVirtualStart, hi as UserRulesResponse, hn as ReferralDashboard, ho as AppArtifactDescriptor, hs as BoardHistoryPage, ht as CreateSpaceSessionInput, ia as RuntimeStatus, ic as DisplayCapture, ii as SpaceUsageResponse, io as RealtimePatchOperation, ir as SpaceConfigResponse, ji as SessionFilesResponse, jn as SessionTurnStreamSnapshotResponse, jr as SpaceFsUploadResponse, kn as SessionTurnResponse, lc as DisplayList, ln as ReferenceDirection, lo as RealtimeRoomHistoryEvent, lr as SpaceFsCompleteUploadInput, lt as CreateInvitationInput, mi as UserProfile, mo as SessionTurnPatchEvent, ms as BoardHistoryInput, mt as CreateSpacePromptResponse, nn as PublicUserPageResponse, oi as TaskRunDetailResponse, oo as RealtimeRoomDescriptor, or as SpaceCreateResponse, ot as CheckpointDiffSummary, pc as DisplayTreeParams, pi as UserActivityResponse, pr as SpaceFsCreateUploadResponse, ps as BoardCreateInput, pt as CreateSpacePromptInput, qa as GenerationModelDeclaration, qn as SpaceCheckpointDetailResponse, qr as SpacePublicProfile, r as CohubEnvironment, ra as RuntimeSessionRecoveryStatus, rn as PublicUserProfile, rr as SpaceConfigInput, rs as SpaceFsCopyStats, sc as DisplayInfo, si as TaskRunRecord, sn as ReferenceAggregateGroupBy, sr as SpaceDefaultResponse, st as CheckpointRecord, ts as SpaceFsCopyResult, tt as CheckpointDiffFileResponse, uc as DisplaySession, ui as UserActivityQuery, un as ReferenceKind, uo as RealtimeRoomMember, ur as SpaceFsCompleteUploadResponse, us as BoardApplyInput, ut as CreateInvitationResponse, vr as SpaceFsFileResponse, vs as BoardPlaybackSnapshot, vt as CronJobUpdatePatch, wn as SessionMessageResponse, wr as SpaceFsTreeResponse, wt as GlobalSearchResponse, xo as AppContentKind, y as BatchUserProfilesResponse, yi as UserSessionsResponse, yr as SpaceFsMoveInput, ys as BoardReadInput, yt as CursorPageInfo, zc as ContentBlock, zr as SpaceListPage, zt as LabelResourceType } from "./environment.js";
|
|
2
2
|
import { a as WebsocketClientOptions, r as WebsocketClient, s as WebsocketEventPayload } from "./websocket.js";
|
|
3
3
|
import { a as VoiceInputCreateOptions } from "./voice-input.js";
|
|
4
4
|
//#region ../protocol/dist/model/status.d.ts
|
|
@@ -280,7 +280,7 @@ type AppDropResource = {
|
|
|
280
280
|
snapshot?: Record<string, unknown>;
|
|
281
281
|
};
|
|
282
282
|
/** Public design tokens, sent as resolved CSS values. */
|
|
283
|
-
declare const APP_APPEARANCE_TOKENS: readonly ["bg-primary", "bg-content", "bg-surface", "bg-elevated", "bg-input", "bg-hover", "bg-active", "text-primary", "text-secondary", "text-tertiary", "text-placeholder", "text-disabled", "border-primary", "border-subtle", "brand", "brand-hover", "brand-soft", "brand-muted", "brand-border", "brand-ring", "brand-contrast-fg", "error-fg", "selection-bg", "overlay-scrim", "shadow-subtle", "shadow-medium", "shadow-strong", "font-sans", "font-mono"];
|
|
283
|
+
declare const APP_APPEARANCE_TOKENS: readonly ["bg-primary", "bg-content", "bg-surface", "bg-elevated", "bg-input", "bg-hover", "bg-active", "text-primary", "text-secondary", "text-tertiary", "text-placeholder", "text-disabled", "border-primary", "border-subtle", "brand", "brand-hover", "brand-soft", "brand-muted", "brand-border", "brand-ring", "brand-contrast-fg", "error-fg", "success", "warning", "error", "info", "status-running", "selection-bg", "overlay-scrim", "shadow-subtle", "shadow-medium", "shadow-strong", "font-sans", "font-mono"];
|
|
284
284
|
type AppAppearanceToken = (typeof APP_APPEARANCE_TOKENS)[number];
|
|
285
285
|
type AppAppearance = {
|
|
286
286
|
colorScheme: "light" | "dark";
|
|
@@ -353,6 +353,11 @@ type AppNavigationOpenResponse = {
|
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
355
|
//#endregion
|
|
356
|
+
//#region ../protocol/dist/app-devices.d.ts
|
|
357
|
+
declare const APP_DEVICES: readonly ["camera", "microphone", "screen"];
|
|
358
|
+
type AppDevice = (typeof APP_DEVICES)[number];
|
|
359
|
+
type AppDevicesStatus = "granted" | "denied" | "unavailable";
|
|
360
|
+
//#endregion
|
|
356
361
|
//#region ../protocol/dist/app-promotion-stats.d.ts
|
|
357
362
|
declare const APP_PROMOTION_EVENT_KEYS: readonly ["landing", "ready", "registration_completed", "paywall_viewed", "checkout_started"];
|
|
358
363
|
type AppPromotionEventKey = typeof APP_PROMOTION_EVENT_KEYS[number];
|
|
@@ -413,6 +418,7 @@ type AppRuntimeContext = {
|
|
|
413
418
|
capabilities?: {
|
|
414
419
|
authorization: 2;
|
|
415
420
|
serverGrants: true;
|
|
421
|
+
devices?: true;
|
|
416
422
|
};
|
|
417
423
|
mode?: "bridge" | "broker";
|
|
418
424
|
app: {
|
|
@@ -648,6 +654,8 @@ declare class AppRuntimeApi {
|
|
|
648
654
|
*/
|
|
649
655
|
dispose(): void;
|
|
650
656
|
navigationOpen(target: AppNavigationTarget, call?: AppNavigationCall): Promise<AppNavigationOpenResponse>;
|
|
657
|
+
/** Asks for devices declared with `<meta name="cohub:devices">`; allowing the camera or microphone reloads the App once. */
|
|
658
|
+
requestDevices(devices: AppDevice[]): Promise<AppDevicesStatus>;
|
|
651
659
|
/**
|
|
652
660
|
* Asks the host to close this App: a workspace tab closes, an embedded page
|
|
653
661
|
* forwards the request to its embedder, a standalone page closes the tab.
|
|
@@ -1241,11 +1249,16 @@ declare class SpaceBoardsApi {
|
|
|
1241
1249
|
create(input: BoardCreateInput): Promise<BoardReadResult>;
|
|
1242
1250
|
}
|
|
1243
1251
|
//#endregion
|
|
1244
|
-
//#region src/
|
|
1245
|
-
type
|
|
1246
|
-
|
|
1252
|
+
//#region src/rtc/index.d.ts
|
|
1253
|
+
type RtcPath = "direct" | "relay";
|
|
1254
|
+
type RtcTransportStats = {
|
|
1255
|
+
path: RtcPath | null;
|
|
1247
1256
|
relayProtocol: string | null;
|
|
1248
1257
|
rttMs: number | null;
|
|
1258
|
+
};
|
|
1259
|
+
//#endregion
|
|
1260
|
+
//#region src/display-stats.d.ts
|
|
1261
|
+
type DisplayConnectionStats = RtcTransportStats & {
|
|
1249
1262
|
fps: number | null;
|
|
1250
1263
|
bitrate: number | null;
|
|
1251
1264
|
width: number | null;
|
|
@@ -1317,7 +1330,7 @@ declare function connectDisplay(api: SpaceDisplaysApi, displayId: string, option
|
|
|
1317
1330
|
declare class SpaceDisplaysApi {
|
|
1318
1331
|
private readonly transport;
|
|
1319
1332
|
readonly spaceId: string;
|
|
1320
|
-
private ice;
|
|
1333
|
+
private readonly ice;
|
|
1321
1334
|
constructor(transport: HttpTransport, spaceId: string);
|
|
1322
1335
|
private path;
|
|
1323
1336
|
list(options?: {
|
|
@@ -2487,6 +2500,7 @@ type AppExtractedPageMeta = {
|
|
|
2487
2500
|
themeColor?: string | null;
|
|
2488
2501
|
surface?: "window" | "overlay" | null;
|
|
2489
2502
|
fileHandlers?: string[];
|
|
2503
|
+
devices?: AppDevice[];
|
|
2490
2504
|
sourcePath?: string | null;
|
|
2491
2505
|
extractedAt?: string | null;
|
|
2492
2506
|
};
|
|
@@ -2509,6 +2523,7 @@ type AppMeta = Record<string, unknown> & {
|
|
|
2509
2523
|
presentation?: AppPresentationMeta;
|
|
2510
2524
|
/** File extensions the App opens (`[".board"]`), from `<meta name="cohub:file-handlers">`. */
|
|
2511
2525
|
fileHandlers?: string[];
|
|
2526
|
+
devices?: AppDevice[];
|
|
2512
2527
|
extracted?: AppExtractedPageMeta;
|
|
2513
2528
|
source?: RequestSource;
|
|
2514
2529
|
};
|
|
@@ -3018,6 +3033,71 @@ declare class WorkCommerceApi extends AppCommerceApi {}
|
|
|
3018
3033
|
/** @deprecated Use `AppCommerceOrder`. */
|
|
3019
3034
|
type WorkCommerceOrder = AppCommerceOrder;
|
|
3020
3035
|
//#endregion
|
|
3036
|
+
//#region src/apis/rooms.d.ts
|
|
3037
|
+
type RoomView = {
|
|
3038
|
+
room: RealtimeRoomDescriptor;
|
|
3039
|
+
participantId: string;
|
|
3040
|
+
members: RealtimeRoomMember[];
|
|
3041
|
+
sequence: number;
|
|
3042
|
+
};
|
|
3043
|
+
type RoomInvite = {
|
|
3044
|
+
invite: string;
|
|
3045
|
+
expiresAt: string;
|
|
3046
|
+
};
|
|
3047
|
+
type RoomCreated = RoomInvite & {
|
|
3048
|
+
room: RealtimeRoomDescriptor;
|
|
3049
|
+
url: string | null;
|
|
3050
|
+
};
|
|
3051
|
+
type RoomEvent = RealtimeRoomHistoryEvent & {
|
|
3052
|
+
self: boolean;
|
|
3053
|
+
};
|
|
3054
|
+
type RoomEvents = {
|
|
3055
|
+
events: RoomEvent[];
|
|
3056
|
+
cursor: number;
|
|
3057
|
+
truncated: boolean;
|
|
3058
|
+
};
|
|
3059
|
+
type RoomEventsQuery = {
|
|
3060
|
+
after?: number;
|
|
3061
|
+
types?: string[];
|
|
3062
|
+
waitMs?: number;
|
|
3063
|
+
limit?: number;
|
|
3064
|
+
signal?: AbortSignal;
|
|
3065
|
+
};
|
|
3066
|
+
declare class RoomsApi {
|
|
3067
|
+
private readonly transport;
|
|
3068
|
+
constructor(transport: HttpTransport);
|
|
3069
|
+
create(input: {
|
|
3070
|
+
appId: string;
|
|
3071
|
+
code?: string;
|
|
3072
|
+
expiresInSeconds?: number;
|
|
3073
|
+
maxParticipants?: number;
|
|
3074
|
+
seatPerUser?: boolean;
|
|
3075
|
+
}): Promise<RoomCreated>;
|
|
3076
|
+
join(input: {
|
|
3077
|
+
invite: string;
|
|
3078
|
+
presence?: Record<string, unknown> | null;
|
|
3079
|
+
idleSeconds?: number;
|
|
3080
|
+
}): Promise<RoomView>;
|
|
3081
|
+
get(roomId: string): Promise<RoomView>;
|
|
3082
|
+
events(roomId: string, query?: RoomEventsQuery): Promise<RoomEvents>;
|
|
3083
|
+
publish(roomId: string, type: string, data?: unknown): Promise<{
|
|
3084
|
+
sequence: number;
|
|
3085
|
+
eventId: string;
|
|
3086
|
+
}>;
|
|
3087
|
+
setPresence(roomId: string, presence: Record<string, unknown> | null): Promise<{
|
|
3088
|
+
member: RealtimeRoomMember;
|
|
3089
|
+
sequence: number;
|
|
3090
|
+
}>;
|
|
3091
|
+
invite(roomId: string, input?: {
|
|
3092
|
+
expiresInSeconds?: number;
|
|
3093
|
+
}): Promise<RoomInvite>;
|
|
3094
|
+
leave(roomId: string): Promise<{
|
|
3095
|
+
left: boolean;
|
|
3096
|
+
}>;
|
|
3097
|
+
private path;
|
|
3098
|
+
private post;
|
|
3099
|
+
}
|
|
3100
|
+
//#endregion
|
|
3021
3101
|
//#region src/http.d.ts
|
|
3022
3102
|
declare class CohubHttpClient {
|
|
3023
3103
|
readonly spaces: SpacesApi;
|
|
@@ -3038,6 +3118,7 @@ declare class CohubHttpClient {
|
|
|
3038
3118
|
readonly referrals: ReferralsApi;
|
|
3039
3119
|
readonly apps: AppsApi;
|
|
3040
3120
|
readonly appCommerce: AppCommerceApi;
|
|
3121
|
+
readonly rooms: RoomsApi;
|
|
3041
3122
|
/** @deprecated Use `apps`. */
|
|
3042
3123
|
get works(): AppsApi;
|
|
3043
3124
|
/** @deprecated Use `appCommerce`. */
|
|
@@ -3051,4 +3132,4 @@ declare class CohubHttpClient {
|
|
|
3051
3132
|
}
|
|
3052
3133
|
declare const createHttpClient: (options?: CohubClientOptions) => CohubHttpClient;
|
|
3053
3134
|
//#endregion
|
|
3054
|
-
export {
|
|
3135
|
+
export { AppPromotionStatsResponse as $, PublicAssetPurpose as $n, AppNavigationLaunch as $r, SpaceFileStream as $t, DesktopCommandsApi as A, ModelStatusEntry as Ai, SessionPatchStatus as An, AppRuntimeAppResolver as Ar, WorkPublicOwnerRecord as At, AppContent as B, BoardChangedEvent as Bn, AppRuntimeShellContext as Br, WorkViewStatsResponse as Bt, WorkCommerceEntitlement as C, SpaceStartupResponse as Ci, SessionGenerationStreamClient as Cn, sanitizeAccessToken as Cr, WorkPresentationMeta as Ct, WorkCommercePurchaseResponse as D, GenerationUsageBilling as Di, SessionPatchApplyResult as Dn, AppDiagnosticListener as Dr, WorkPromotionProviderStatus as Dt, WorkCommerceProductResolveResponse as E, GenerationTaskResult as Ei, SessionPatchApplyInput as En, AppDiagnostic as Er, WorkPromotionProvider as Et, UiCommandsApi as F, DisplayConnectionState as Fn, AppRuntimeError as Fr, WorkStatus as Ft, AppGetResponse as G, BoardSubscriptionHandlers as Gn, createAppRuntime as Gr, TaskWaitOptions as Gt, AppCreateInput as H, BoardClientOptions as Hn, OriginBrokerTransport as Hr, ReferralsApi as Ht, WaitForDesktopCommandOptions as I, connectDisplay as In, AppRuntimeInvocationContext as Ir, WorkTargetType as It, AppPromotionCreateInput as J, ReferencesApi as Jn, resolveAppTransport as Jr, SessionEventName as Jt, AppMeta as K, SessionAccessApi as Kn, createOriginAppResolver as Kr, TasksApi as Kt, WaitForUiCommandOptions as L, DisplayConnectionStats as Ln, AppRuntimeModeConfig as Lr, WorkUpdateInput as Lt, UiCommandError as M, SpaceDisplaysApi as Mn, AppRuntimeCheckoutState as Mr, WorkRecord as Mt, UiCommandRecord as N, ConnectDisplayOptions as Nn, AppRuntimeCheckoutStatus as Nr, WorkResolveResponse as Nt, CreateDesktopCommandInput as O, ListGenerationModelsResponse as Oi, SessionPatchReducer as On, AppIdResolver as Or, WorkPromotionRecord as Ot, UiCommandStatus as P, DisplayConnection as Pn, AppRuntimeContext as Pr, WorkSessionResponse as Pt, AppPromotionRecord as Q, PublicAssetMimeType as Qn, AppNavigationCall as Qr, SpaceEventName as Qt, AppActionRunResponse as R, RtcTransportStats as Rn, AppRuntimeRequestOptions as Rr, WorkVersionRecord as Rt, WorkCommerceCreditConsumeStatus as S, SpaceWebhookTriggerResponse as Si, GenerationStreamTurnUpdatedEvent as Sn, matchesUnauthorizedErrorToken as Sr, WorkMeta as St, WorkCommerceOrder as T, CreateGenerationTaskResponse as Ti, parseAssistantMessageCommit as Tn, AppContextChangedListener as Tr, WorkPromotionEventResponse as Tt, AppDetailResponse as U, BoardEventName as Un, ParentBridgeTransport as Ur, UsersApi as Ut, AppContentDownload as V, BoardClient as Vn, AppRuntimeTransport as Vr, WorkVisibility as Vt, AppExtractedPageMeta as W, BoardPlaybackChangedEvent as Wn, PopupBrokerTransport as Wr, UserApi as Wt, AppPromotionProvider as X, CreatePublicAssetUploadInput as Xn, AppDevice as Xr, SpaceChannelBindingRecord as Xt, AppPromotionEventResponse as Y, SearchApi as Yn, APP_DEVICES as Yr, SessionSubscriptionHandlers as Yt, AppPromotionProviderStatus as Z, CreatePublicAssetUploadResponse as Zn, AppDevicesStatus as Zr, SpaceClient as Zt, AppCommerceProductResolveResponse as _, PublicFileListResponse as _i, GenerationStreamLifecycleEvent as _n, HttpTraceContext as _r, WorkContentDownload as _t, RoomEvents as a, AppAppearanceToken as ai, WebSocketConnectionState as an, UploadChatImageAttachmentInput as ar, AppStatus as at, WorkCommerceCheckoutStatus as b, PublicFileUrlResponse as bi, GenerationStreamSubscribeOptions as bn, UnauthorizedContext as br, WorkExtractedPageMeta as bt, RoomView as c, AppRuntimeAnchor as ci, PublicInviteApi as cn, SkillsApi as cr, AppVersionRecord as ct, AppCommerceCheckoutStatus as d, AppWindowState as di, AssistantMessageCommit as dn, GenerationsApi as dr, AppViewerGrantRecord as dt, AppNavigationOpenMessage as ei, SpacePublicFilesApi as en, PublicAssetUploadProgress as er, AppPublicOwnerRecord as et, AppCommerceCreditConsumeResponse as f, AppWindowStatus as fi, GenerationStreamCommitEvent as fn, CronJobsApi as fr, AppVisibility as ft, AppCommerceOrder as g, PublicFileListEntry as gi, GenerationStreamIntermediateMessage as gn, HttpError as gr, WorkContent as gt, AppCommerceEntitlementsResponse as h, PublicFileCreateUploadResponse as hi, GenerationStreamFinalizedEvent as hn, Fetch as hr, WorkAuthorizeResponse as ht, RoomEvent as i, AppAppearance as ii, WaitForSpaceFsCopyOptions as in, UploadChatAttachmentInput as ir, AppSessionResponse as it, UiCommand as j, ModelStatusResponse as ji, createSessionPatchReducer as jn, AppRuntimeAuthorizationResult as jr, WorkPublicSpaceRecord as jt, CreateUiCommandInput as k, PublicGenerationDeclaration as ki, SessionPatchState as kn, AppRuntimeApi as kr, WorkPromotionStatsResponse as kt, RoomsApi as l, AppRuntimeConfigureRequest as li, buildSpaceInvitePath as ln, PromptsApi as lr, AppViewSource as lt, AppCommerceEntitlement as m, PublicFileCreateUploadInput as mi, GenerationStreamEvent as mn, CohubClientOptions as mr, PublicAppVersionSummary as mt, createHttpClient as n, AppNavigationTarget as ni, SpaceWebhooksApi as nn, PublicAssetsApi as nr, AppRecord as nt, RoomEventsQuery as o, AppDropResource as oi, BuildSpaceInvitePathInput as on, UploadGenerationInputInput as or, AppTargetType as ot, AppCommerceCreditConsumeStatus as p, appAppearanceVar as pi, GenerationStreamErrorEvent as pn, ChannelsApi as pr, AppsApi as pt, AppPresentationMeta as q, ReferenceResourceSelector as qn, createSlugAppIdResolver as qr, OpenSpaceFileOptions as qt, RoomCreated as r, APP_APPEARANCE_TOKENS as ri, SpacesApi as rn, UploadAppSourceInput as rr, AppResolveResponse as rt, RoomInvite as s, AppDropResourceType as si, BuildSpacePathInput as sn, UploadPublicAssetInput as sr, AppUpdateInput as st, CohubHttpClient as t, AppNavigationOpenResponse as ti, SpaceTurnListOptions as tn, PublicAssetUploadProtocol as tr, AppPublicSpaceRecord as tt, AppCommerceApi as u, AppRuntimeRect as ui, buildSpacePath as un, ModelsApi as ur, AppViewStatsResponse as ut, AppCommercePurchaseResponse as v, PublicFileUploadEntryInput as vi, GenerationStreamOutOfSyncEvent as vn, HttpTransport as vr, WorkCreateInput as vt, WorkCommerceEntitlementsResponse as w, CreateGenerationTaskRequest as wi, createSessionGenerationStreamClient as wn, AppAuthorizationRequest as wr, WorkPromotionCreateInput as wt, WorkCommerceCreditConsumeResponse as x, SpaceWebhookListItem as xi, GenerationStreamSubscriptionHandlers as xn, joinApiUrl as xr, WorkGetResponse as xt, WorkCommerceApi as y, PublicFileUploadPlanEntry as yi, GenerationStreamStateEvent as yn, RawHttpResponse as yr, WorkDetailResponse as yt, AppAuthorizeResponse as z, BoardAwarenessUpdatedEvent as zn, AppRuntimeResolvedApp as zr, WorkViewSource as zt };
|
package/dist/chunks/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as isUuid, h as getRealtimeSpaceRoom, m as getRealtimeBoardRoom, n as HttpTransport, t as HttpError } from "./transport.js";
|
|
2
2
|
import { l as resolveExecutionToken, o as resolveApiBaseUrl } from "./environment.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region ../protocol/dist/model/metrics.js
|
|
@@ -360,11 +360,6 @@ z.object({
|
|
|
360
360
|
quality: z.number().int().min(1).max(100).optional(),
|
|
361
361
|
maxSize: z.number().int().min(1).max(DISPLAY_DIMENSION_MAX).optional()
|
|
362
362
|
});
|
|
363
|
-
z.object({
|
|
364
|
-
urls: z.union([z.string().min(1).max(512), z.array(z.string().min(1).max(512)).min(1).max(16)]),
|
|
365
|
-
username: z.string().max(512).optional(),
|
|
366
|
-
credential: z.string().max(512).optional()
|
|
367
|
-
});
|
|
368
363
|
z.object({
|
|
369
364
|
offer: z.string().min(1).max(65536),
|
|
370
365
|
control: z.boolean().optional()
|
|
@@ -1258,17 +1253,78 @@ var SpaceBoardsApi = class {
|
|
|
1258
1253
|
}
|
|
1259
1254
|
};
|
|
1260
1255
|
//#endregion
|
|
1256
|
+
//#region src/rtc/index.ts
|
|
1257
|
+
const ICE_REFRESH_MARGIN_MS = 3e5;
|
|
1258
|
+
var IceServerCache = class {
|
|
1259
|
+
load;
|
|
1260
|
+
cached = null;
|
|
1261
|
+
constructor(load) {
|
|
1262
|
+
this.load = load;
|
|
1263
|
+
}
|
|
1264
|
+
async get(signal) {
|
|
1265
|
+
if (this.cached && this.cached.refreshAt > Date.now()) return this.cached.value;
|
|
1266
|
+
const value = await this.load(signal);
|
|
1267
|
+
this.cached = {
|
|
1268
|
+
value,
|
|
1269
|
+
refreshAt: Date.parse(value.expiresAt) - ICE_REFRESH_MARGIN_MS
|
|
1270
|
+
};
|
|
1271
|
+
return value;
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
function waitForIceGathering(pc, timeoutMs, signal) {
|
|
1275
|
+
if (pc.iceGatheringState === "complete") return Promise.resolve();
|
|
1276
|
+
if (signal?.aborted) return Promise.reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
1277
|
+
return new Promise((resolve, reject) => {
|
|
1278
|
+
const cleanup = () => {
|
|
1279
|
+
clearTimeout(timer);
|
|
1280
|
+
pc.removeEventListener("icegatheringstatechange", check);
|
|
1281
|
+
signal?.removeEventListener("abort", abort);
|
|
1282
|
+
};
|
|
1283
|
+
const done = () => {
|
|
1284
|
+
cleanup();
|
|
1285
|
+
resolve();
|
|
1286
|
+
};
|
|
1287
|
+
const check = () => {
|
|
1288
|
+
if (pc.iceGatheringState === "complete") done();
|
|
1289
|
+
};
|
|
1290
|
+
const abort = () => {
|
|
1291
|
+
cleanup();
|
|
1292
|
+
reject(signal?.reason ?? new DOMException("Aborted", "AbortError"));
|
|
1293
|
+
};
|
|
1294
|
+
const timer = setTimeout(done, timeoutMs);
|
|
1295
|
+
pc.addEventListener("icegatheringstatechange", check);
|
|
1296
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
const statNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1300
|
+
function readRtcTransportStats(report) {
|
|
1301
|
+
const stats = {
|
|
1302
|
+
path: null,
|
|
1303
|
+
relayProtocol: null,
|
|
1304
|
+
rttMs: null
|
|
1305
|
+
};
|
|
1306
|
+
report.forEach((entry) => {
|
|
1307
|
+
if (entry.type !== "candidate-pair" || !entry.nominated || entry.state !== "succeeded") return;
|
|
1308
|
+
const local = report.get(String(entry.localCandidateId));
|
|
1309
|
+
const remote = report.get(String(entry.remoteCandidateId));
|
|
1310
|
+
stats.path = local?.candidateType === "relay" || remote?.candidateType === "relay" ? "relay" : "direct";
|
|
1311
|
+
if (local?.candidateType === "relay" && typeof local.relayProtocol === "string") stats.relayProtocol = local.relayProtocol;
|
|
1312
|
+
const rtt = statNumber(entry.currentRoundTripTime);
|
|
1313
|
+
if (rtt !== null) stats.rttMs = Math.round(rtt * 1e3);
|
|
1314
|
+
});
|
|
1315
|
+
return stats;
|
|
1316
|
+
}
|
|
1317
|
+
//#endregion
|
|
1261
1318
|
//#region src/display-stats.ts
|
|
1262
|
-
const num = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1263
1319
|
function perFrame(seconds, previousSeconds, frames, previousFrames) {
|
|
1264
1320
|
const count = frames - previousFrames;
|
|
1265
1321
|
return count > 0 ? Math.round((seconds - previousSeconds) * 1e3 / count) : null;
|
|
1266
1322
|
}
|
|
1267
1323
|
function readDisplayStats(report, previous, fallbackRttMs = null) {
|
|
1324
|
+
const transport = readRtcTransportStats(report);
|
|
1268
1325
|
const stats = {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
rttMs: fallbackRttMs,
|
|
1326
|
+
...transport,
|
|
1327
|
+
rttMs: transport.rttMs ?? fallbackRttMs,
|
|
1272
1328
|
fps: null,
|
|
1273
1329
|
bitrate: null,
|
|
1274
1330
|
width: null,
|
|
@@ -1280,27 +1336,19 @@ function readDisplayStats(report, previous, fallbackRttMs = null) {
|
|
|
1280
1336
|
};
|
|
1281
1337
|
let counters = null;
|
|
1282
1338
|
report.forEach((entry) => {
|
|
1283
|
-
if (entry.type === "candidate-pair" && entry.nominated && entry.state === "succeeded") {
|
|
1284
|
-
const local = report.get(String(entry.localCandidateId));
|
|
1285
|
-
const remote = report.get(String(entry.remoteCandidateId));
|
|
1286
|
-
stats.path = local?.candidateType === "relay" || remote?.candidateType === "relay" ? "relay" : "direct";
|
|
1287
|
-
if (local?.candidateType === "relay" && typeof local.relayProtocol === "string") stats.relayProtocol = local.relayProtocol;
|
|
1288
|
-
const rtt = num(entry.currentRoundTripTime);
|
|
1289
|
-
if (rtt !== null) stats.rttMs = Math.round(rtt * 1e3);
|
|
1290
|
-
}
|
|
1291
1339
|
if (entry.type === "inbound-rtp" && entry.kind === "video") {
|
|
1292
|
-
stats.fps =
|
|
1293
|
-
stats.width =
|
|
1294
|
-
stats.height =
|
|
1295
|
-
stats.packetsLost =
|
|
1296
|
-
stats.freezes =
|
|
1340
|
+
stats.fps = statNumber(entry.framesPerSecond);
|
|
1341
|
+
stats.width = statNumber(entry.frameWidth);
|
|
1342
|
+
stats.height = statNumber(entry.frameHeight);
|
|
1343
|
+
stats.packetsLost = statNumber(entry.packetsLost);
|
|
1344
|
+
stats.freezes = statNumber(entry.freezeCount);
|
|
1297
1345
|
counters = {
|
|
1298
|
-
at:
|
|
1299
|
-
bytes:
|
|
1300
|
-
jitterBufferDelay:
|
|
1301
|
-
jitterBufferEmitted:
|
|
1302
|
-
decodeTime:
|
|
1303
|
-
decoded:
|
|
1346
|
+
at: statNumber(entry.timestamp) ?? 0,
|
|
1347
|
+
bytes: statNumber(entry.bytesReceived) ?? 0,
|
|
1348
|
+
jitterBufferDelay: statNumber(entry.jitterBufferDelay) ?? 0,
|
|
1349
|
+
jitterBufferEmitted: statNumber(entry.jitterBufferEmittedCount) ?? 0,
|
|
1350
|
+
decodeTime: statNumber(entry.totalDecodeTime) ?? 0,
|
|
1351
|
+
decoded: statNumber(entry.framesDecoded) ?? 0
|
|
1304
1352
|
};
|
|
1305
1353
|
if (previous && counters.at > previous.at) {
|
|
1306
1354
|
stats.bitrate = Math.round((counters.bytes - previous.bytes) * 8 * 1e3 / (counters.at - previous.at));
|
|
@@ -1372,7 +1420,7 @@ var DisplayConnection = class DisplayConnection {
|
|
|
1372
1420
|
const connection = new DisplayConnection(api, displayId, options.control ?? true, pc);
|
|
1373
1421
|
try {
|
|
1374
1422
|
await pc.setLocalDescription(await pc.createOffer());
|
|
1375
|
-
await
|
|
1423
|
+
await waitForIceGathering(pc, options.gatherTimeoutMs ?? DEFAULT_GATHER_TIMEOUT_MS, options.signal);
|
|
1376
1424
|
const offer = pc.localDescription?.sdp;
|
|
1377
1425
|
if (!offer) throw new Error("The browser produced no offer");
|
|
1378
1426
|
const session = await api.openSession(displayId, {
|
|
@@ -1506,38 +1554,15 @@ var DisplayConnection = class DisplayConnection {
|
|
|
1506
1554
|
}
|
|
1507
1555
|
}
|
|
1508
1556
|
};
|
|
1509
|
-
function gathered(pc, timeoutMs, signal) {
|
|
1510
|
-
if (pc.iceGatheringState === "complete") return Promise.resolve();
|
|
1511
|
-
return new Promise((resolve, reject) => {
|
|
1512
|
-
const done = () => {
|
|
1513
|
-
clearTimeout(timer);
|
|
1514
|
-
pc.removeEventListener("icegatheringstatechange", check);
|
|
1515
|
-
signal?.removeEventListener("abort", abort);
|
|
1516
|
-
resolve();
|
|
1517
|
-
};
|
|
1518
|
-
const check = () => {
|
|
1519
|
-
if (pc.iceGatheringState === "complete") done();
|
|
1520
|
-
};
|
|
1521
|
-
const abort = () => {
|
|
1522
|
-
clearTimeout(timer);
|
|
1523
|
-
pc.removeEventListener("icegatheringstatechange", check);
|
|
1524
|
-
reject(signal?.reason ?? new DOMException("Aborted", "AbortError"));
|
|
1525
|
-
};
|
|
1526
|
-
const timer = setTimeout(done, timeoutMs);
|
|
1527
|
-
pc.addEventListener("icegatheringstatechange", check);
|
|
1528
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
1557
|
function connectDisplay(api, displayId, options) {
|
|
1532
1558
|
return DisplayConnection.open(api, displayId, options);
|
|
1533
1559
|
}
|
|
1534
1560
|
//#endregion
|
|
1535
1561
|
//#region src/apis/displays.ts
|
|
1536
|
-
const ICE_REFRESH_MARGIN_MS = 3e5;
|
|
1537
1562
|
var SpaceDisplaysApi = class {
|
|
1538
1563
|
transport;
|
|
1539
1564
|
spaceId;
|
|
1540
|
-
ice =
|
|
1565
|
+
ice = new IceServerCache((signal) => this.transport.request(`/api/spaces/${this.spaceId}/rtc/ice-servers`, { signal }));
|
|
1541
1566
|
constructor(transport, spaceId) {
|
|
1542
1567
|
this.transport = transport;
|
|
1543
1568
|
this.spaceId = spaceId;
|
|
@@ -1581,14 +1606,8 @@ var SpaceDisplaysApi = class {
|
|
|
1581
1606
|
signal: options.signal
|
|
1582
1607
|
});
|
|
1583
1608
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
const value = await this.transport.request(`/api/spaces/${this.spaceId}/rtc/ice-servers`, { signal: options.signal });
|
|
1587
|
-
this.ice = {
|
|
1588
|
-
value,
|
|
1589
|
-
refreshAt: Date.parse(value.expiresAt) - ICE_REFRESH_MARGIN_MS
|
|
1590
|
-
};
|
|
1591
|
-
return value;
|
|
1609
|
+
iceServers(options = {}) {
|
|
1610
|
+
return this.ice.get(options.signal);
|
|
1592
1611
|
}
|
|
1593
1612
|
connect(displayId, options) {
|
|
1594
1613
|
return connectDisplay(this, displayId, options);
|
|
@@ -4746,6 +4765,77 @@ var AppCommerceApi = class {
|
|
|
4746
4765
|
/** @deprecated Use `AppCommerceApi`. */
|
|
4747
4766
|
var WorkCommerceApi = class extends AppCommerceApi {};
|
|
4748
4767
|
//#endregion
|
|
4768
|
+
//#region src/apis/rooms.ts
|
|
4769
|
+
const MAX_WAIT_PER_READ_MS = 25e3;
|
|
4770
|
+
var RoomsApi = class {
|
|
4771
|
+
transport;
|
|
4772
|
+
constructor(transport) {
|
|
4773
|
+
this.transport = transport;
|
|
4774
|
+
}
|
|
4775
|
+
create(input) {
|
|
4776
|
+
return this.post("", input);
|
|
4777
|
+
}
|
|
4778
|
+
join(input) {
|
|
4779
|
+
return this.post("/join", input);
|
|
4780
|
+
}
|
|
4781
|
+
get(roomId) {
|
|
4782
|
+
return this.transport.request(this.path(roomId));
|
|
4783
|
+
}
|
|
4784
|
+
async events(roomId, query = {}) {
|
|
4785
|
+
const deadline = Date.now() + Math.max(0, query.waitMs ?? 0);
|
|
4786
|
+
const result = {
|
|
4787
|
+
events: [],
|
|
4788
|
+
cursor: query.after ?? 0,
|
|
4789
|
+
truncated: false
|
|
4790
|
+
};
|
|
4791
|
+
if (query.limit !== void 0 && query.limit <= 0) return result;
|
|
4792
|
+
let after = query.after;
|
|
4793
|
+
for (;;) {
|
|
4794
|
+
const waitMs = Math.min(Math.max(0, deadline - Date.now()), MAX_WAIT_PER_READ_MS);
|
|
4795
|
+
const params = new URLSearchParams();
|
|
4796
|
+
if (after !== void 0) params.set("after", String(after));
|
|
4797
|
+
if (query.types?.length) params.set("types", query.types.join(","));
|
|
4798
|
+
if (query.limit !== void 0) params.set("limit", String(query.limit - result.events.length));
|
|
4799
|
+
if (waitMs > 0) params.set("wait", String(waitMs));
|
|
4800
|
+
const page = await this.transport.request(`${this.path(roomId)}/events?${params}`, { signal: query.signal });
|
|
4801
|
+
result.events.push(...page.events);
|
|
4802
|
+
result.cursor = page.cursor;
|
|
4803
|
+
result.truncated ||= page.truncated;
|
|
4804
|
+
if (result.events.some((event) => !event.self) || result.events.length >= (query.limit ?? Number.POSITIVE_INFINITY) || waitMs === 0 || Date.now() >= deadline || query.signal?.aborted) return result;
|
|
4805
|
+
after = page.cursor;
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
publish(roomId, type, data) {
|
|
4809
|
+
return this.post(`/${encodeURIComponent(roomId)}/events`, {
|
|
4810
|
+
type,
|
|
4811
|
+
data: data ?? null
|
|
4812
|
+
});
|
|
4813
|
+
}
|
|
4814
|
+
setPresence(roomId, presence) {
|
|
4815
|
+
return this.transport.request(`${this.path(roomId)}/presence`, {
|
|
4816
|
+
method: "PUT",
|
|
4817
|
+
headers: { "Content-Type": "application/json" },
|
|
4818
|
+
body: JSON.stringify({ presence })
|
|
4819
|
+
});
|
|
4820
|
+
}
|
|
4821
|
+
invite(roomId, input = {}) {
|
|
4822
|
+
return this.post(`/${encodeURIComponent(roomId)}/invites`, input);
|
|
4823
|
+
}
|
|
4824
|
+
leave(roomId) {
|
|
4825
|
+
return this.transport.request(`${this.path(roomId)}/seat`, { method: "DELETE" });
|
|
4826
|
+
}
|
|
4827
|
+
path(roomId) {
|
|
4828
|
+
return `/api/rooms/${encodeURIComponent(roomId)}`;
|
|
4829
|
+
}
|
|
4830
|
+
post(path, body) {
|
|
4831
|
+
return this.transport.request(`/api/rooms${path}`, {
|
|
4832
|
+
method: "POST",
|
|
4833
|
+
headers: { "Content-Type": "application/json" },
|
|
4834
|
+
body: JSON.stringify(body)
|
|
4835
|
+
});
|
|
4836
|
+
}
|
|
4837
|
+
};
|
|
4838
|
+
//#endregion
|
|
4749
4839
|
//#region src/http.ts
|
|
4750
4840
|
var CohubHttpClient = class {
|
|
4751
4841
|
spaces;
|
|
@@ -4766,6 +4856,7 @@ var CohubHttpClient = class {
|
|
|
4766
4856
|
referrals;
|
|
4767
4857
|
apps;
|
|
4768
4858
|
appCommerce;
|
|
4859
|
+
rooms;
|
|
4769
4860
|
/** @deprecated Use `apps`. */
|
|
4770
4861
|
get works() {
|
|
4771
4862
|
return this.apps;
|
|
@@ -4806,6 +4897,7 @@ var CohubHttpClient = class {
|
|
|
4806
4897
|
this.referrals = new ReferralsApi(this.transport);
|
|
4807
4898
|
this.apps = new AppsApi(this.transport);
|
|
4808
4899
|
this.appCommerce = new AppCommerceApi(this.transport);
|
|
4900
|
+
this.rooms = new RoomsApi(this.transport);
|
|
4809
4901
|
this.desktop = new DesktopCommandsApi(this.transport);
|
|
4810
4902
|
}
|
|
4811
4903
|
space(spaceId) {
|
|
@@ -4814,4 +4906,4 @@ var CohubHttpClient = class {
|
|
|
4814
4906
|
};
|
|
4815
4907
|
const createHttpClient = (options) => new CohubHttpClient(options);
|
|
4816
4908
|
//#endregion
|
|
4817
|
-
export {
|
|
4909
|
+
export { isTerminalDesktopCommandStatus as $, BoardClient as A, CronJobsApi as B, SessionPatchReducer as C, connectDisplay as D, DisplayConnection as E, PublicAssetsApi as F, DESKTOP_COMMAND_OPEN_TIMEOUT_MS as G, DESKTOP_COMMAND_ACCEPT_TIMEOUT_MS as H, SkillsApi as I, DESKTOP_COMMAND_SETTLEMENT_GRACE_SECONDS as J, DESKTOP_COMMAND_PAYLOAD_MAX_BYTES as K, PromptsApi as L, SessionAccessApi as M, ReferencesApi as N, readRtcTransportStats as O, SearchApi as P, isDesktopCallMethod as Q, ModelsApi as R, parseAssistantMessageCommit as S, SpaceDisplaysApi as T, DESKTOP_COMMAND_DEFAULT_TIMEOUT_MS as U, ChannelsApi as V, DESKTOP_COMMAND_MAX_TIMEOUT_MS as W, DESKTOP_COMMAND_VERSION as X, DESKTOP_COMMAND_TERMINAL_TTL_SECONDS as Y, defaultDesktopCommandTimeoutMs as Z, PublicInviteApi as _, WorkCommerceApi as a, DISPLAY_INPUT_MAX_SCHEDULE_MS as at, SessionGenerationStreamClient as b, AppsApi as c, normalizeDisplayPoint as ct, UserApi as d, parseDesktopCommand as et, TasksApi as f, SpacesApi as g, SpaceWebhooksApi as h, AppCommerceApi as i, DISPLAY_ELEMENT_REF_PATTERN as it, ensureRealtimeConnected as j, waitForIceGathering as k, ReferralsApi as l, splitDisplayText as lt, SpacePublicFilesApi as m, createHttpClient as n, resolveOpenSurface as nt, DesktopCommandsApi as o, DISPLAY_INPUT_MAX_TEXT as ot, SpaceClient as p, DESKTOP_COMMAND_PENDING_TTL_SECONDS as q, RoomsApi as r, NAVIGATION_ERROR_MESSAGE_MAX_LENGTH as rt, UiCommandsApi as s, DISPLAY_SYSTEM_ACTIONS as st, CohubHttpClient as t, parseDesktopCommandId as tt, UsersApi as u, buildSpaceInvitePath as v, createSessionPatchReducer as w, createSessionGenerationStreamClient as x, buildSpacePath as y, GenerationsApi as z };
|
package/dist/chunks/transport.js
CHANGED
|
@@ -152,6 +152,8 @@ const WS_COMPACT_STREAM_CAPABILITY = "session.compact_stream.v1";
|
|
|
152
152
|
const WS_ROOM_SUBSCRIPTION_CAPABILITY = "realtime.rooms.v1";
|
|
153
153
|
const WS_BOARD_AWARENESS_CAPABILITY = "board.awareness.v1";
|
|
154
154
|
const WS_REALTIME_ROOM_CAPABILITY = "realtime.room.v1";
|
|
155
|
+
const WS_REALTIME_ROOM_RTC_CAPABILITY = "realtime.room.rtc.v1";
|
|
156
|
+
const WS_REALTIME_ROOM_HISTORY_CAPABILITY = "realtime.room.history.v1";
|
|
155
157
|
const REALTIME_DOMAINS = [
|
|
156
158
|
"system",
|
|
157
159
|
"session",
|
|
@@ -507,4 +509,4 @@ var HttpTransport = class {
|
|
|
507
509
|
}
|
|
508
510
|
};
|
|
509
511
|
//#endregion
|
|
510
|
-
export {
|
|
512
|
+
export { requestSourceToHeaders as A, isRequestSourceClientId as C, normalizeRequestSource as D, mergeRequestSourceIntoMeta as E, isUuid as M, isUuidLike as N, parseRequestSourceFromHeaders as O, isUuidOrShortUuid as P, hasRequestSourceIdentity as S, isRequestSourceUuid as T, isRealtimeDomain as _, sanitizeAccessToken as a, COHUB_SOURCE_HEADER_NAMES as b, WS_BOARD_AWARENESS_CAPABILITY as c, WS_REALTIME_ROOM_HISTORY_CAPABILITY as d, WS_REALTIME_ROOM_RTC_CAPABILITY as f, getSessionTurnPatchStreamKey as g, getRealtimeSpaceRoom as h, matchesUnauthorizedErrorToken as i, resolveRequestSourceChannel as j, readRequestSourceFromEnv as k, WS_COMPACT_STREAM_CAPABILITY as l, getRealtimeBoardRoom as m, HttpTransport as n, REALTIME_ROOM_EVENT_NAME_PATTERN as o, WS_ROOM_SUBSCRIPTION_CAPABILITY as p, joinApiUrl as r, REALTIME_ROOM_MAX_PAYLOAD_BYTES as s, HttpError as t, WS_REALTIME_ROOM_CAPABILITY as u, normalizeRealtimeRooms as v, isRequestSourceEmpty as w, REQUEST_SOURCE_VIA_MAX_LENGTH as x, COHUB_SOURCE_HEADER as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fc as ModelThinkingLevel, J as BillingResponsePayload, ao as RealtimeRoom, cs as BoardAwarenessUpdate, eo as ChannelEnvelope, r as CohubEnvironment, zc as ContentBlock } from "./environment.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/websocket.d.ts
|
|
4
4
|
type WebsocketEventPayload = ChannelEnvelope;
|
|
@@ -151,6 +151,14 @@ declare class WebsocketClient {
|
|
|
151
151
|
joinRealtimeRoom(input: {
|
|
152
152
|
roomId: string;
|
|
153
153
|
ticket: string;
|
|
154
|
+
instanceId?: string;
|
|
155
|
+
after?: number;
|
|
156
|
+
requestId?: string;
|
|
157
|
+
}): Promise<void>;
|
|
158
|
+
readRealtimeRoomHistory(input: {
|
|
159
|
+
roomId: string;
|
|
160
|
+
after?: number;
|
|
161
|
+
limit?: number;
|
|
154
162
|
requestId?: string;
|
|
155
163
|
}): Promise<void>;
|
|
156
164
|
publishRealtimeRoom(input: {
|
package/dist/chunks/websocket.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as isRealtimeDomain, c as WS_BOARD_AWARENESS_CAPABILITY, g as getSessionTurnPatchStreamKey, h as getRealtimeSpaceRoom, l as WS_COMPACT_STREAM_CAPABILITY, p as WS_ROOM_SUBSCRIPTION_CAPABILITY, t as HttpError, u as WS_REALTIME_ROOM_CAPABILITY, v as normalizeRealtimeRooms } from "./transport.js";
|
|
2
2
|
import { f as resolveWebsocketUrl } from "./environment.js";
|
|
3
3
|
//#region src/http-error.ts
|
|
4
4
|
/** Shared HTTP error code for every plan entitlement gate (402). */
|
|
@@ -403,7 +403,21 @@ var WebsocketClient = class {
|
|
|
403
403
|
requestId: input.requestId,
|
|
404
404
|
payload: {
|
|
405
405
|
roomId: input.roomId,
|
|
406
|
-
ticket: input.ticket
|
|
406
|
+
ticket: input.ticket,
|
|
407
|
+
...input.instanceId ? { instanceId: input.instanceId } : {},
|
|
408
|
+
...input.after !== void 0 ? { after: input.after } : {}
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
async readRealtimeRoomHistory(input) {
|
|
413
|
+
await this.ensureOpen();
|
|
414
|
+
this.send({
|
|
415
|
+
type: "realtime.room.history",
|
|
416
|
+
requestId: input.requestId,
|
|
417
|
+
payload: {
|
|
418
|
+
roomId: input.roomId,
|
|
419
|
+
...input.after !== void 0 ? { after: input.after } : {},
|
|
420
|
+
...input.limit !== void 0 ? { limit: input.limit } : {}
|
|
407
421
|
}
|
|
408
422
|
});
|
|
409
423
|
}
|