@neta-art/cohub 5.8.2 → 5.10.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/dist/board/animation.js +34 -5
- package/dist/board/codec.js +1 -1
- package/dist/board/export/index.d.ts +6 -0
- package/dist/board/export/index.js +6 -3
- package/dist/board/export/scene.d.ts +6 -0
- package/dist/board/export/scene.js +26 -2
- package/dist/board/geometry.d.ts +27 -1
- package/dist/board/geometry.js +92 -1
- package/dist/board/headless/index.d.ts +7 -1
- package/dist/board/headless/index.js +6 -2
- package/dist/board/index.d.ts +6 -4
- package/dist/board/index.js +7 -5
- package/dist/board/mutation.d.ts +21 -0
- package/dist/board/mutation.js +104 -0
- package/dist/board/render/css-color.d.ts +4 -0
- package/dist/board/render/css-color.js +36 -0
- package/dist/board/render/index.d.ts +2 -1
- package/dist/board/render/index.js +2 -1
- package/dist/board/render/renderers/base-card-renderer.js +3 -20
- package/dist/board/render/themes/clean-theme.js +6 -3
- package/dist/chunks/http.d.ts +16 -4
- package/dist/chunks/http.js +180 -16
- package/dist/chunks/websocket.d.ts +74 -4
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +33 -6
- package/dist/protocol/dist/board-constants.d.ts +2 -1
- package/dist/protocol/dist/board-constants.js +61 -6
- package/dist/protocol/dist/board-document.d.ts +28 -2
- package/dist/protocol/dist/board-document.js +16 -3
- package/dist/protocol/dist/board-node.d.ts +2 -1
- package/dist/protocol/dist/board-url.d.ts +2 -1
- package/dist/protocol/dist/board-url.js +8 -3
- package/dist/protocol/dist/board.d.ts +136 -4
- package/dist/protocol/dist/board.js +42 -1
- package/dist/protocol/dist/index.d.ts +3 -3
- package/dist/protocol/dist/index.js +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DOMAdapter } from "pixi.js";
|
|
2
|
+
//#region src/board/render/css-color.ts
|
|
3
|
+
const CACHE_LIMIT = 256;
|
|
4
|
+
const cache = /* @__PURE__ */ new Map();
|
|
5
|
+
let canvas = null;
|
|
6
|
+
function parseBoardCssColor(value) {
|
|
7
|
+
const key = value.trim();
|
|
8
|
+
if (!key) return null;
|
|
9
|
+
const cached = cache.get(key);
|
|
10
|
+
if (cached !== void 0 || cache.has(key)) return cached ?? null;
|
|
11
|
+
let result = null;
|
|
12
|
+
try {
|
|
13
|
+
const direct = /^#([0-9a-f]{6})$/i.exec(key);
|
|
14
|
+
if (direct?.[1]) result = Number.parseInt(direct[1], 16);
|
|
15
|
+
else {
|
|
16
|
+
canvas ??= DOMAdapter.get().createCanvas(1, 1);
|
|
17
|
+
const context = canvas.getContext("2d");
|
|
18
|
+
if (context) {
|
|
19
|
+
context.fillStyle = "#010203";
|
|
20
|
+
context.fillStyle = key;
|
|
21
|
+
const first = String(context.fillStyle);
|
|
22
|
+
context.fillStyle = "#040506";
|
|
23
|
+
context.fillStyle = key;
|
|
24
|
+
const match = first === String(context.fillStyle) ? /^#([0-9a-f]{6})$/i.exec(first) : null;
|
|
25
|
+
if (match?.[1]) result = Number.parseInt(match[1], 16);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch {
|
|
29
|
+
result = null;
|
|
30
|
+
}
|
|
31
|
+
if (cache.size >= CACHE_LIMIT) cache.clear();
|
|
32
|
+
cache.set(key, result);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { parseBoardCssColor };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConnectionLayer, ConnectionRenderInput, createConnectionLayer, framesFromItems } from "./connection-layer.js";
|
|
2
|
+
import { parseBoardCssColor } from "./css-color.js";
|
|
2
3
|
import { BoardMediaAction, boardMediaActionAt, mediaPlayBadgeHit, mediaPlayBadgeVisible } from "./media-interaction.js";
|
|
3
4
|
import { BoardCardRenderer, BoardRenderContext, BoardRenderPalette, boardCardRenderersForTest, getBoardCardRenderer, registerBoardCardRenderer } from "./renderers/board-renderer-registry.js";
|
|
4
5
|
import { defaultBoardPalette } from "./palette.js";
|
|
@@ -7,4 +8,4 @@ import { ensureBoardTextMeasurement, installBoardTextMeasurement } from "./text-
|
|
|
7
8
|
import { getBoardResolution, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket } from "./text-resolution.js";
|
|
8
9
|
import { BoardThemeContext, BoardThemeRenderer, getBoardThemeRenderer, registerBoardThemeRenderer } from "./themes/board-theme-registry.js";
|
|
9
10
|
import { VIDEO_THUMBNAIL_MAX_EDGE, VideoNaturalSize, loadVideoThumbnailTexture, videoTextureNaturalSize, videoThumbnailSize } from "./video-thumbnail.js";
|
|
10
|
-
export { BoardCardRenderer, BoardMediaAction, BoardRenderContext, BoardRenderPalette, BoardThemeContext, BoardThemeRenderer, ConnectionLayer, ConnectionRenderInput, TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, VideoNaturalSize, boardCardRenderersForTest, boardMediaActionAt, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, getBoardThemeRenderer, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, registerBoardCardRenderer, registerBoardThemeRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, videoTextureNaturalSize, videoThumbnailSize };
|
|
11
|
+
export { BoardCardRenderer, BoardMediaAction, BoardRenderContext, BoardRenderPalette, BoardThemeContext, BoardThemeRenderer, ConnectionLayer, ConnectionRenderInput, TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, VideoNaturalSize, boardCardRenderersForTest, boardMediaActionAt, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, getBoardThemeRenderer, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, parseBoardCssColor, registerBoardCardRenderer, registerBoardThemeRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, videoTextureNaturalSize, videoThumbnailSize };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseBoardCssColor } from "./css-color.js";
|
|
1
2
|
import { getBoardResolution, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket } from "./text-resolution.js";
|
|
2
3
|
import { createConnectionLayer, framesFromItems } from "./connection-layer.js";
|
|
3
4
|
import { TASK_CARD_FULL_DETAIL_ZOOM } from "./renderers/task-card-renderer.js";
|
|
@@ -7,4 +8,4 @@ import { ensureBoardTextMeasurement, installBoardTextMeasurement } from "./text-
|
|
|
7
8
|
import { boardCardRenderersForTest, getBoardCardRenderer, registerBoardCardRenderer } from "./renderers/board-renderer-registry.js";
|
|
8
9
|
import { getBoardThemeRenderer, registerBoardThemeRenderer } from "./themes/board-theme-registry.js";
|
|
9
10
|
import { VIDEO_THUMBNAIL_MAX_EDGE, loadVideoThumbnailTexture, videoTextureNaturalSize, videoThumbnailSize } from "./video-thumbnail.js";
|
|
10
|
-
export { TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, boardCardRenderersForTest, boardMediaActionAt, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, getBoardThemeRenderer, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, registerBoardCardRenderer, registerBoardThemeRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, videoTextureNaturalSize, videoThumbnailSize };
|
|
11
|
+
export { TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, boardCardRenderersForTest, boardMediaActionAt, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, getBoardThemeRenderer, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, parseBoardCssColor, registerBoardCardRenderer, registerBoardThemeRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, videoTextureNaturalSize, videoThumbnailSize };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BOARD_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
2
|
+
import { parseBoardCssColor } from "../css-color.js";
|
|
2
3
|
import { getBoardResolution } from "../text-resolution.js";
|
|
3
|
-
import { Container,
|
|
4
|
+
import { Container, Graphics, Text } from "pixi.js";
|
|
4
5
|
//#region src/board/render/renderers/base-card-renderer.ts
|
|
5
6
|
const CARD_RADIUS = 10;
|
|
6
7
|
const CARD_PADDING = 12;
|
|
@@ -11,7 +12,7 @@ const TEXT_OPTIONS = {
|
|
|
11
12
|
};
|
|
12
13
|
function emphasisColor(item, palette) {
|
|
13
14
|
if (item.style?.accentColor) {
|
|
14
|
-
const normalized =
|
|
15
|
+
const normalized = parseBoardCssColor(item.style.accentColor);
|
|
15
16
|
if (normalized != null) return normalized;
|
|
16
17
|
}
|
|
17
18
|
switch (item.style?.emphasis) {
|
|
@@ -21,24 +22,6 @@ function emphasisColor(item, palette) {
|
|
|
21
22
|
default: return palette.brand;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Normalise any CSS color to a number by letting a 2D context parse it.
|
|
26
|
-
*
|
|
27
|
-
* Goes through `DOMAdapter` rather than `document` so a headless export resolves
|
|
28
|
-
* accent colors exactly as the browser does; without it, custom accents would
|
|
29
|
-
* silently fall back to the emphasis palette only when exporting.
|
|
30
|
-
*/
|
|
31
|
-
function parseCssColor(value) {
|
|
32
|
-
try {
|
|
33
|
-
const context = DOMAdapter.get().createCanvas(1, 1).getContext("2d");
|
|
34
|
-
if (!context) return null;
|
|
35
|
-
context.fillStyle = value;
|
|
36
|
-
const match = /^#([0-9a-f]{6})$/i.exec(String(context.fillStyle));
|
|
37
|
-
return match?.[1] ? Number.parseInt(match[1], 16) : null;
|
|
38
|
-
} catch {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
25
|
function createLabel(text, style) {
|
|
43
26
|
return new Text({
|
|
44
27
|
...TEXT_OPTIONS,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseBoardCssColor } from "../css-color.js";
|
|
1
2
|
import { Container, Graphics, RenderTexture, TilingSprite } from "pixi.js";
|
|
2
3
|
//#region src/board/render/themes/clean-theme.ts
|
|
3
4
|
const partsByContainer = /* @__PURE__ */ new WeakMap();
|
|
@@ -31,16 +32,18 @@ function sync(parts, context) {
|
|
|
31
32
|
const { app, document, viewport, palette } = context;
|
|
32
33
|
const width = app.screen.width;
|
|
33
34
|
const height = app.screen.height;
|
|
35
|
+
const declaredBackground = document.appearance.background;
|
|
36
|
+
const bgColor = declaredBackground.color ? parseBoardCssColor(declaredBackground.color) ?? palette.bg : palette.bg;
|
|
34
37
|
const bgAlpha = context.hasImageBackground ? 0 : 1;
|
|
35
|
-
if (parts.lastWidth !== width || parts.lastHeight !== height || parts.lastBg !==
|
|
38
|
+
if (parts.lastWidth !== width || parts.lastHeight !== height || parts.lastBg !== bgColor || parts.lastBgAlpha !== bgAlpha) {
|
|
36
39
|
parts.fill.clear();
|
|
37
40
|
parts.fill.rect(0, 0, width, height).fill({
|
|
38
|
-
color:
|
|
41
|
+
color: bgColor,
|
|
39
42
|
alpha: bgAlpha
|
|
40
43
|
});
|
|
41
44
|
parts.lastWidth = width;
|
|
42
45
|
parts.lastHeight = height;
|
|
43
|
-
parts.lastBg =
|
|
46
|
+
parts.lastBg = bgColor;
|
|
44
47
|
parts.lastBgAlpha = bgAlpha;
|
|
45
48
|
}
|
|
46
49
|
const appearance = document.appearance;
|
package/dist/chunks/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CreateInvitationInput, $n as SpaceFsPreparingFile,
|
|
1
|
+
import { $ as CreateInvitationInput, $n as SpaceFsPreparingFile, Aa as BoardTransaction, Ar as SpaceTurnAuthorFilter, At as MeResponse, Bn as SpaceDefaultResponse, Cr as SpacePublicProfile, Ct as LabelItemsResponse, Dn as SpaceCommerceBenefit, Dt as LabelResourceType, Ei as SessionTurnPatchEvent, En as SpaceCheckpointDetailResponse, G as CheckpointDiffFileResponse, Ga as BoardConnectionRecord, Gn as SpaceFsCreateUploadInput, Gt as ReferenceAggregateResponse, H as Channel, Hn as SpaceFsCompleteUploadInput, Hr as UserProfile, In as SpaceConfigInput, Ir as TaskRunDetailResponse, Ji as UiCommandError, Jr as ChannelHealth, Jt as ReferenceQueryResponse, Ki as UiCommand, Kn as SpaceFsCreateUploadResponse, Kr as UserSessionsResponse, Kt as ReferenceDirection, Ln as SpaceConfigResponse, Lr as TaskRunRecord, Lt as PromptTemplateCatalogResponse, Mi as WorkArtifactDescriptor, Mn as SpaceCommerceProduct, Mt as PatchResourceLabelsInput, Nn as SpaceCommerceProductBenefitBinding, Nt as PatchResourceLabelsResponse, Oa as BoardSummary, On as SpaceCommerceBuyerProfile, Pr as SpaceUsageResponse, Pt as Permission, Q as ClaimReferralResponse, Qn as SpaceFsMoveInput, Qt as ReferralDashboard, Ri as WorkContentKind, Rn as SpaceConfigUpdateResponse, Rr as UserActivityQuery, Rt as PublicReferral, Sa as BoardPlaybackCommand, St as LabelAssignmentRecord, Ta as BoardPlaybackSnapshot, Tr as SpaceRole, Tt as LabelListItem, Ua as BoardConnection, Un as SpaceFsCompleteUploadResponse, Ur as UserRulesResponse, Vn as SpaceEnvInput, Vr as UserActivityResponse, Wa as BoardConnectionDirection, Wt as ReferenceAggregateGroupBy, X as CheckpointDiffSummary, Xa as MessageRecord, Xi as UiCommandStatus, Ya as SpacePublicEndpoints, Yi as UiCommandRecord, Yt as ReferenceQueryableType, Z as CheckpointRecord, Za as SessionForkRecord, Zn as SpaceFsFileResponse, _n as SkillCatalogResponse, _o as RequestSource, a as WebsocketClientOptions, at as CreateSpaceSessionInput, bn as SpaceAccessPolicy, br as SpacePendingDiffSummary, cn as SessionMessagesResponse, ct as CronJobUpdatePatch, d as BatchUserProfilesResponse, di as GenerationContentBlock, dn as SessionTurnResponse, do as Usage, dr as SpaceFsWriteFileInput, eo as SessionTurnRecord, et as CreateInvitationResponse, fa as BoardCreateInput, fi as GenerationModelDeclaration, fn as SessionTurnSignedUrlsResponse, fo as BillingPayload, ga as BoardInspectInput, gi as BoardTransactionAppliedEvent$1, gr as SpaceMember, gt as InvitationDetail, hi as BoardPlaybackChangedEvent$1, hn as SessionTurnsPaginatedResponse, ht as GlobalSearchType, it as CreateSpacePromptResponse, ja as BoardValidationResult, ji as BoardAwarenessUpdate, jn as SpaceCommerceOrder, jt as ModelCatalogEntry, kr as SpaceSessionsResponse, l as AcceptInvitationResponse, ln as SessionRecord, lo as SpaceCompletionResult, lt as CursorPageInfo, mi as BoardAwarenessUpdatedEvent$1, mn as SessionTurnWindowResponse, nr as SpaceFsReadFilesResponse, oa as BoardBootstrap, on as SessionMessageResponse, pn as SessionTurnStreamSnapshotResponse, po as ContentBlock, pr as SpaceInvitationListResponse, pt as GlobalSearchResponse, qr as ChannelConfig, qt as ReferenceKind, r as WebsocketClient, rr as SpaceFsTreeResponse, rt as CreateSpacePromptInput, s as WebsocketEventPayload, sn as SessionMessagesPaginatedResponse, so as CreateSpaceCompletionInput, st as CronJobRecord, to as SpaceTurnsResponse, tt as CreateSpaceInput, ua as BoardCapabilities, un as SessionTurnIndexResponse, uo as SpaceCompletionStreamEvent, ur as SpaceFsUploadResponse, vr as SpaceModListItem, wr as SpaceRecord, xa as BoardOperation, xr as SpacePresenceSnapshot, yi as RealtimePatchOperation, yr as SpacePendingDiffFileResponse, zn as SpaceCreateResponse, zt as PublicUserPageResponse } from "./websocket.js";
|
|
2
2
|
import { n as CohubEnvironment } from "./environment.js";
|
|
3
3
|
import { a as VoiceInputCreateOptions } from "./voice-input.js";
|
|
4
4
|
//#region ../protocol/dist/model/status.d.ts
|
|
@@ -969,6 +969,11 @@ declare class BoardTransactionError extends Error {
|
|
|
969
969
|
get isVersionConflict(): boolean;
|
|
970
970
|
}
|
|
971
971
|
type BoardTransactionInput = Omit<BoardTransaction, "boardId">;
|
|
972
|
+
type BoardMutationInput = {
|
|
973
|
+
include?: BoardInspectInput["include"];
|
|
974
|
+
retries?: number;
|
|
975
|
+
build: (current: BoardBootstrap) => BoardOperation[] | Promise<BoardOperation[]>;
|
|
976
|
+
};
|
|
972
977
|
type BoardTransactionAppliedEvent = BoardTransactionAppliedEvent$1;
|
|
973
978
|
type BoardAwarenessUpdatedEvent = BoardAwarenessUpdatedEvent$1;
|
|
974
979
|
type BoardPlaybackChangedEvent = BoardPlaybackChangedEvent$1;
|
|
@@ -1511,8 +1516,12 @@ declare class BoardClient {
|
|
|
1511
1516
|
constructor(spaceId: string, id: string, transport: HttpTransport, websocketClient: WebsocketClient | null);
|
|
1512
1517
|
inspect(input?: BoardInspectInput, customFetch?: Fetch): Promise<BoardBootstrap>;
|
|
1513
1518
|
capabilities(customFetch?: Fetch): Promise<BoardCapabilities>;
|
|
1519
|
+
summary(customFetch?: Fetch): Promise<BoardSummary>;
|
|
1520
|
+
mutate(input: BoardMutationInput): Promise<BoardBootstrap>;
|
|
1514
1521
|
validate(transaction: BoardTransactionInput): Promise<BoardValidationResult>;
|
|
1515
|
-
apply(transaction: BoardTransactionInput
|
|
1522
|
+
apply(transaction: BoardTransactionInput, options?: {
|
|
1523
|
+
compact?: boolean;
|
|
1524
|
+
}): Promise<BoardBootstrap>;
|
|
1516
1525
|
updateAwareness(seq: number, update: BoardAwarenessUpdate): Promise<void>;
|
|
1517
1526
|
playback(command: BoardPlaybackCommand): Promise<BoardPlaybackSnapshot>;
|
|
1518
1527
|
/**
|
|
@@ -1596,9 +1605,12 @@ declare class SpaceBoardsApi {
|
|
|
1596
1605
|
byId(boardId: string): BoardClient;
|
|
1597
1606
|
create(input: BoardCreateInput): Promise<BoardBootstrap>;
|
|
1598
1607
|
inspect(boardId: string, input?: BoardInspectInput, customFetch?: Fetch): Promise<BoardBootstrap>;
|
|
1608
|
+
summary(boardId: string, customFetch?: Fetch): Promise<BoardSummary>;
|
|
1599
1609
|
capabilities(boardId: string, customFetch?: Fetch): Promise<BoardCapabilities>;
|
|
1600
1610
|
validate(transaction: BoardTransaction): Promise<BoardValidationResult>;
|
|
1601
|
-
apply(transaction: BoardTransaction
|
|
1611
|
+
apply(transaction: BoardTransaction, options?: {
|
|
1612
|
+
compact?: boolean;
|
|
1613
|
+
}): Promise<BoardBootstrap>;
|
|
1602
1614
|
playback(boardId: string, command: BoardPlaybackCommand): Promise<BoardPlaybackSnapshot>;
|
|
1603
1615
|
play(boardId: string, command: Omit<Extract<BoardPlaybackCommand, {
|
|
1604
1616
|
type: "play";
|
|
@@ -2246,4 +2258,4 @@ declare class CohubHttpClient {
|
|
|
2246
2258
|
}
|
|
2247
2259
|
declare const createHttpClient: (options?: CohubClientOptions) => CohubHttpClient;
|
|
2248
2260
|
//#endregion
|
|
2249
|
-
export {
|
|
2261
|
+
export { BoardTransactionAppliedEvent as $, ModelsApi as $t, WorkResolveResponse as A, PublicFileUploadEntryInput as An, parseAssistantMessageCommit as At, ReferralsApi as B, ModelStatusEntry as Bn, SearchApi as Bt, WorkPromotionProvider as C, createSlugWorkIdResolver as Cn, GenerationStreamOutOfSyncEvent as Ct, WorkPublicOwnerRecord as D, PublicFileCreateUploadResponse as Dn, GenerationStreamTurnUpdatedEvent as Dt, WorkPromotionStatsResponse as E, PublicFileCreateUploadInput as En, GenerationStreamSubscriptionHandlers as Et, WorkVersionRecord as F, CreateGenerationTaskResponse as Fn, SessionPatchStatus as Ft, WaitForUiCommandOptions as G, PublicAssetUploadProgress as Gt, UserApi as H, CreatePublicAssetUploadResponse as Ht, WorkViewSource as I, GenerationTaskResult as In, createSessionPatchReducer as It, BoardClient as J, UploadChatAttachmentInput as Jt, TasksApi as K, PublicAssetUploadProtocol as Kt, WorkViewStatsResponse as L, GenerationUsageBilling as Ln, SessionAccessApi as Lt, WorkStatus as M, PublicFileUrlResponse as Mn, SessionPatchApplyResult as Mt, WorkTargetType as N, SpaceStartupResponse as Nn, SessionPatchReducer as Nt, WorkPublicSpaceRecord as O, PublicFileListEntry as On, SessionGenerationStreamClient as Ot, WorkUpdateInput as P, CreateGenerationTaskRequest as Pn, SessionPatchState as Pt, BoardSubscriptionHandlers as Q, PromptsApi as Qt, WorkVisibility as R, ListGenerationModelsResponse as Rn, ReferenceResourceSelector as Rt, WorkPromotionEventResponse as S, WorkRuntimeTransport as Sn, GenerationStreamLifecycleEvent as St, WorkPromotionRecord as T, resolveWorkTransport as Tn, GenerationStreamSubscribeOptions as Tt, CreateUiCommandInput as U, PublicAssetMimeType as Ut, UsersApi as V, ModelStatusResponse as Vn, CreatePublicAssetUploadInput as Vt, UiCommandsApi as W, PublicAssetPurpose as Wt, BoardMutationInput as X, UploadPublicAssetInput as Xt, BoardEventName as Y, UploadChatImageAttachmentInput as Yt, BoardPlaybackChangedEvent as Z, SkillsApi as Zt, WorkExtractedPageMeta as _, WorkRuntimeCheckoutState as _n, GenerationStreamCommitEvent as _t, WorkCommerceCreditConsumeResponse as a, HttpError as an, SpaceClient as at, WorkPresentationMeta as b, WorkRuntimeModeConfig as bn, GenerationStreamFinalizedEvent as bt, WorkCommerceEntitlementsResponse as c, RawHttpResponse as cn, SpaceTurnListOptions as ct, WorkCommercePurchaseResponse as d, matchesUnauthorizedErrorToken as dn, BuildSpaceInvitePathInput as dt, GenerationsApi as en, BoardTransactionError as et, WorkAuthorizeResponse as f, sanitizeAccessToken as fn, BuildSpacePathInput as ft, WorkDetailResponse as g, WorkRuntimeApi as gn, AssistantMessageCommit as gt, WorkCreateInput as h, WorkIdResolver as hn, buildSpacePath as ht, WorkCommerceCheckoutStatus as i, Fetch as in, SpaceChannelBindingRecord as it, WorkSessionResponse as j, PublicFileUploadPlanEntry as jn, SessionPatchApplyInput as jt, WorkRecord as k, PublicFileListResponse as kn, createSessionGenerationStreamClient as kt, WorkCommerceOrder as l, UnauthorizedContext as ln, SpacesApi as lt, WorkContentDownload as m, PopupBrokerTransport as mn, buildSpaceInvitePath as mt, createHttpClient as n, ChannelsApi as nn, SessionEventName as nt, WorkCommerceCreditConsumeStatus as o, HttpTraceContext as on, SpaceEventName as ot, WorkContent as p, ParentBridgeTransport as pn, PublicInviteApi as pt, BoardAwarenessUpdatedEvent as q, PublicAssetsApi as qt, WorkCommerceApi as r, CohubClientOptions as rn, SessionSubscriptionHandlers as rt, WorkCommerceEntitlement as s, HttpTransport as sn, SpacePublicFilesApi as st, CohubHttpClient as t, CronJobsApi as tn, BoardTransactionInput as tt, WorkCommerceProductResolveResponse as u, joinApiUrl as un, WebSocketConnectionState as ut, WorkGetResponse as v, WorkRuntimeCheckoutStatus as vn, GenerationStreamErrorEvent as vt, WorkPromotionProviderStatus as w, createWorkRuntime as wn, GenerationStreamStateEvent as wt, WorkPromotionCreateInput as x, WorkRuntimeRequestOptions as xn, GenerationStreamIntermediateMessage as xt, WorkMeta as y, WorkRuntimeContext as yn, GenerationStreamEvent as yt, WorksApi as z, PublicGenerationDeclaration as zn, ReferencesApi as zt };
|
package/dist/chunks/http.js
CHANGED
|
@@ -466,6 +466,7 @@ const BOARD_BUILTIN_CLIP_KINDS = [
|
|
|
466
466
|
"effects.color",
|
|
467
467
|
"camera.pan",
|
|
468
468
|
"camera.zoom",
|
|
469
|
+
"camera.focus",
|
|
469
470
|
"camera.shake"
|
|
470
471
|
];
|
|
471
472
|
const BOARD_BUILTIN_EFFECT_KINDS = ["effects.pulse", "effects.float"];
|
|
@@ -475,12 +476,66 @@ function clampBoardStrokeSize(size) {
|
|
|
475
476
|
if (!Number.isFinite(size)) return BOARD_CONNECTION_STROKE_SIZE;
|
|
476
477
|
return Math.min(64, Math.max(1, size));
|
|
477
478
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
479
|
+
function clipSchema(id) {
|
|
480
|
+
switch (id) {
|
|
481
|
+
case "motion.keyframes": return { params: {
|
|
482
|
+
x: {
|
|
483
|
+
coordinateSpace: "world-offset",
|
|
484
|
+
unit: "board"
|
|
485
|
+
},
|
|
486
|
+
y: {
|
|
487
|
+
coordinateSpace: "world-offset",
|
|
488
|
+
unit: "board"
|
|
489
|
+
}
|
|
490
|
+
} };
|
|
491
|
+
case "motion.path": return { params: { points: {
|
|
492
|
+
coordinateSpace: "world-offset",
|
|
493
|
+
unit: "board"
|
|
494
|
+
} } };
|
|
495
|
+
case "effects.particles": return { params: { bounds: {
|
|
496
|
+
coordinateSpace: "world",
|
|
497
|
+
unit: "board"
|
|
498
|
+
} } };
|
|
499
|
+
case "camera.pan": return { params: {
|
|
500
|
+
x: {
|
|
501
|
+
coordinateSpace: "screen-offset",
|
|
502
|
+
unit: "css-px"
|
|
503
|
+
},
|
|
504
|
+
y: {
|
|
505
|
+
coordinateSpace: "screen-offset",
|
|
506
|
+
unit: "css-px"
|
|
507
|
+
}
|
|
508
|
+
} };
|
|
509
|
+
case "camera.zoom": return { params: { scale: { unit: "ratio" } } };
|
|
510
|
+
case "camera.focus": return { params: {
|
|
511
|
+
focus: {
|
|
512
|
+
coordinateSpace: "world",
|
|
513
|
+
unit: "board"
|
|
514
|
+
},
|
|
515
|
+
padding: {
|
|
516
|
+
coordinateSpace: "screen",
|
|
517
|
+
unit: "css-px"
|
|
518
|
+
},
|
|
519
|
+
minZoom: { unit: "ratio" },
|
|
520
|
+
maxZoom: { unit: "ratio" }
|
|
521
|
+
} };
|
|
522
|
+
case "camera.shake": return { params: { amount: {
|
|
523
|
+
coordinateSpace: "screen-offset",
|
|
524
|
+
unit: "css-px"
|
|
525
|
+
} } };
|
|
526
|
+
default: return;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
const BOARD_BUILTIN_CAPABILITIES = [...BOARD_BUILTIN_CLIP_KINDS.map((id) => {
|
|
530
|
+
const schema = clipSchema(id);
|
|
531
|
+
return {
|
|
532
|
+
kind: "clip",
|
|
533
|
+
id,
|
|
534
|
+
version: 1,
|
|
535
|
+
renderers: ["webgpu", "webgl"],
|
|
536
|
+
...schema ? { schema } : {}
|
|
537
|
+
};
|
|
538
|
+
}), ...BOARD_BUILTIN_EFFECT_KINDS.map((id) => ({
|
|
484
539
|
kind: "effect",
|
|
485
540
|
id,
|
|
486
541
|
version: 1,
|
|
@@ -671,6 +726,47 @@ const BoardTargetSchema = z.discriminatedUnion("type", [
|
|
|
671
726
|
z.object({ type: z.literal("board") }),
|
|
672
727
|
z.object({ type: z.literal("camera") })
|
|
673
728
|
]);
|
|
729
|
+
z.object({
|
|
730
|
+
centerX: finiteSchema$1,
|
|
731
|
+
centerY: finiteSchema$1,
|
|
732
|
+
zoom: finiteSchema$1.positive()
|
|
733
|
+
});
|
|
734
|
+
const BoardCameraFocusSchema = z.discriminatedUnion("type", [
|
|
735
|
+
z.object({
|
|
736
|
+
type: z.literal("rect"),
|
|
737
|
+
rect: z.object({
|
|
738
|
+
x: finiteSchema$1,
|
|
739
|
+
y: finiteSchema$1,
|
|
740
|
+
width: finiteSchema$1.positive(),
|
|
741
|
+
height: finiteSchema$1.positive()
|
|
742
|
+
})
|
|
743
|
+
}),
|
|
744
|
+
z.object({
|
|
745
|
+
type: z.literal("node"),
|
|
746
|
+
nodeId: idSchema$1
|
|
747
|
+
}),
|
|
748
|
+
z.object({
|
|
749
|
+
type: z.literal("nodes"),
|
|
750
|
+
nodeIds: z.array(idSchema$1).min(1).max(1e3)
|
|
751
|
+
}),
|
|
752
|
+
z.object({
|
|
753
|
+
type: z.literal("frame"),
|
|
754
|
+
frameId: idSchema$1
|
|
755
|
+
})
|
|
756
|
+
]);
|
|
757
|
+
const BoardCameraFocusParamsSchema = z.object({
|
|
758
|
+
focus: BoardCameraFocusSchema,
|
|
759
|
+
fit: z.enum(["contain", "cover"]).default("contain"),
|
|
760
|
+
padding: finiteSchema$1.nonnegative().default(32),
|
|
761
|
+
minZoom: finiteSchema$1.positive().optional(),
|
|
762
|
+
maxZoom: finiteSchema$1.positive().optional()
|
|
763
|
+
}).superRefine((value, context) => {
|
|
764
|
+
if (value.minZoom !== void 0 && value.maxZoom !== void 0 && value.minZoom > value.maxZoom) context.addIssue({
|
|
765
|
+
code: "custom",
|
|
766
|
+
message: "minZoom must not exceed maxZoom",
|
|
767
|
+
path: ["minZoom"]
|
|
768
|
+
});
|
|
769
|
+
});
|
|
674
770
|
const BoardAssetRefSchema = z.object({
|
|
675
771
|
type: z.enum(["space-file", "extension"]),
|
|
676
772
|
ref: z.string().min(1).max(4096),
|
|
@@ -916,11 +1012,16 @@ function isBlockedIpv6(host) {
|
|
|
916
1012
|
if ((first & 65280) === 65280) return true;
|
|
917
1013
|
return parts[0] === "2001" && parts[1] === "0db8";
|
|
918
1014
|
}
|
|
1015
|
+
function isPublicBoardRemoteAddress(value) {
|
|
1016
|
+
const address = value.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
1017
|
+
if (parseIpv4(address)) return !isBlockedIpv4(address);
|
|
1018
|
+
return address.includes(":") && !isBlockedIpv6(address);
|
|
1019
|
+
}
|
|
919
1020
|
function isBlockedHost(hostname) {
|
|
920
1021
|
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
921
1022
|
if (host === "localhost" || host.endsWith(".localhost") || host.endsWith(".local") || host.endsWith(".internal")) return true;
|
|
922
|
-
if (parseIpv4(host)) return
|
|
923
|
-
return
|
|
1023
|
+
if (parseIpv4(host) || host.includes(":")) return !isPublicBoardRemoteAddress(host);
|
|
1024
|
+
return false;
|
|
924
1025
|
}
|
|
925
1026
|
/**
|
|
926
1027
|
* Normalize a browser-loadable public HTTP(S) URL. This blocks explicit local
|
|
@@ -974,7 +1075,20 @@ const BoardAppearanceSchema = z.object({
|
|
|
974
1075
|
"custom"
|
|
975
1076
|
]).default("dots"),
|
|
976
1077
|
color: z.string().optional(),
|
|
977
|
-
imageUrl:
|
|
1078
|
+
imageUrl: BoardRemoteUrlSchema.optional(),
|
|
1079
|
+
fit: z.enum([
|
|
1080
|
+
"cover",
|
|
1081
|
+
"contain",
|
|
1082
|
+
"repeat"
|
|
1083
|
+
]).optional(),
|
|
1084
|
+
position: z.enum([
|
|
1085
|
+
"center",
|
|
1086
|
+
"top",
|
|
1087
|
+
"bottom",
|
|
1088
|
+
"left",
|
|
1089
|
+
"right"
|
|
1090
|
+
]).optional(),
|
|
1091
|
+
opacity: z.number().finite().min(0).max(1).optional()
|
|
978
1092
|
}).default({ kind: "solid" }),
|
|
979
1093
|
grid: z.object({
|
|
980
1094
|
visible: z.boolean().default(false),
|
|
@@ -1811,10 +1925,36 @@ const parseUiCommand = (input) => {
|
|
|
1811
1925
|
command: null,
|
|
1812
1926
|
error: "command.preview is required"
|
|
1813
1927
|
};
|
|
1814
|
-
if (preview.kind !== "work") return {
|
|
1928
|
+
if (preview.kind !== "work" && preview.kind !== "file") return {
|
|
1815
1929
|
command: null,
|
|
1816
|
-
error: "command.preview.kind must be one of: work"
|
|
1930
|
+
error: "command.preview.kind must be one of: work, file"
|
|
1817
1931
|
};
|
|
1932
|
+
if (preview.kind === "file") {
|
|
1933
|
+
const path = asTrimmed(preview.path);
|
|
1934
|
+
if (!path) return {
|
|
1935
|
+
command: null,
|
|
1936
|
+
error: "command.preview.path is required"
|
|
1937
|
+
};
|
|
1938
|
+
if (path.length > 2048 || path.startsWith("/") || path.includes("\0") || path.includes("\\") || path.split("/").some((segment) => segment === "..")) return {
|
|
1939
|
+
command: null,
|
|
1940
|
+
error: "command.preview.path must be a relative Space file path"
|
|
1941
|
+
};
|
|
1942
|
+
const command = {
|
|
1943
|
+
type: "preview.show",
|
|
1944
|
+
preview: {
|
|
1945
|
+
kind: "file",
|
|
1946
|
+
path
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
if (input.request !== void 0 && input.request !== null) return {
|
|
1950
|
+
command: null,
|
|
1951
|
+
error: "command.request is only supported for Work previews"
|
|
1952
|
+
};
|
|
1953
|
+
return {
|
|
1954
|
+
command,
|
|
1955
|
+
error: null
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1818
1958
|
const workId = asTrimmed(preview.workId);
|
|
1819
1959
|
if (!workId) return {
|
|
1820
1960
|
command: null,
|
|
@@ -4239,17 +4379,38 @@ var BoardClient = class {
|
|
|
4239
4379
|
capabilities(customFetch) {
|
|
4240
4380
|
return this.boards.capabilities(this.id, customFetch);
|
|
4241
4381
|
}
|
|
4382
|
+
summary(customFetch) {
|
|
4383
|
+
return this.boards.summary(this.id, customFetch);
|
|
4384
|
+
}
|
|
4385
|
+
async mutate(input) {
|
|
4386
|
+
const retries = input.retries ?? 1;
|
|
4387
|
+
if (!Number.isSafeInteger(retries) || retries < 0 || retries > 3) throw new RangeError("Board mutation retries must be an integer from 0 to 3");
|
|
4388
|
+
for (let attempt = 0;; attempt += 1) {
|
|
4389
|
+
const current = await this.inspect({ include: input.include ?? [] });
|
|
4390
|
+
const operations = await input.build(current);
|
|
4391
|
+
if (operations.length === 0) return current;
|
|
4392
|
+
try {
|
|
4393
|
+
return await this.apply({
|
|
4394
|
+
txId: randomBoardId(),
|
|
4395
|
+
baseVersion: current.board.version,
|
|
4396
|
+
operations
|
|
4397
|
+
}, { compact: true });
|
|
4398
|
+
} catch (cause) {
|
|
4399
|
+
if (!(cause instanceof BoardTransactionError) || !cause.isVersionConflict || attempt >= retries) throw cause;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4242
4403
|
validate(transaction) {
|
|
4243
4404
|
return this.boards.validate({
|
|
4244
4405
|
...transaction,
|
|
4245
4406
|
boardId: this.id
|
|
4246
4407
|
});
|
|
4247
4408
|
}
|
|
4248
|
-
apply(transaction) {
|
|
4409
|
+
apply(transaction, options) {
|
|
4249
4410
|
return this.boards.apply({
|
|
4250
4411
|
...transaction,
|
|
4251
4412
|
boardId: this.id
|
|
4252
|
-
});
|
|
4413
|
+
}, options);
|
|
4253
4414
|
}
|
|
4254
4415
|
updateAwareness(seq, update) {
|
|
4255
4416
|
if (!this.websocketClient) return Promise.resolve();
|
|
@@ -4393,6 +4554,9 @@ var SpaceBoardsApi = class {
|
|
|
4393
4554
|
const query = params.toString();
|
|
4394
4555
|
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}${query ? `?${query}` : ""}`, { fetch: customFetch });
|
|
4395
4556
|
}
|
|
4557
|
+
summary(boardId, customFetch) {
|
|
4558
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/summary`, { fetch: customFetch });
|
|
4559
|
+
}
|
|
4396
4560
|
capabilities(boardId, customFetch) {
|
|
4397
4561
|
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/capabilities`, { fetch: customFetch });
|
|
4398
4562
|
}
|
|
@@ -4403,10 +4567,10 @@ var SpaceBoardsApi = class {
|
|
|
4403
4567
|
body: JSON.stringify(transaction)
|
|
4404
4568
|
});
|
|
4405
4569
|
}
|
|
4406
|
-
async apply(transaction) {
|
|
4570
|
+
async apply(transaction, options) {
|
|
4407
4571
|
assertBoardTransactionNodeCreates(transaction.operations);
|
|
4408
4572
|
try {
|
|
4409
|
-
return await this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/transactions`, {
|
|
4573
|
+
return await this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/transactions${options?.compact ? "?compact=1" : ""}`, {
|
|
4410
4574
|
method: "POST",
|
|
4411
4575
|
headers: { "Content-Type": "application/json" },
|
|
4412
4576
|
body: JSON.stringify(transaction)
|
|
@@ -5195,4 +5359,4 @@ var CohubHttpClient = class {
|
|
|
5195
5359
|
};
|
|
5196
5360
|
const createHttpClient = (options) => new CohubHttpClient(options);
|
|
5197
5361
|
//#endregion
|
|
5198
|
-
export { parseUsername as $, WORK_SURFACE_READY_TIMEOUT_MS as A, parseWorkSurfaceRequest as B, BoardInputError as C, WORK_COMPOSER_CHIP_CONTENT_MAX_BYTES as D, validateBoardNodes as E, buildWorkSurfaceRequest as F, UI_COMMAND_PENDING_TTL_SECONDS as G, UI_COMMAND_DEFAULT_TIMEOUT_MS as H, buildWorkSurfaceResponse as I, UI_COMMAND_VERSION as J, UI_COMMAND_SETTLEMENT_GRACE_SECONDS as K, parseWorkComposerChipClear as L, buildWorkComposerChipClear as M, buildWorkComposerChipSet as N, WORK_COMPOSER_CHIP_KEY_MAX_LENGTH as O, buildWorkSurfaceReady as P, parseSpaceSlug as Q, parseWorkComposerChipSet as R, createSessionPatchReducer as S, createBoardNode as T, UI_COMMAND_MAX_TIMEOUT_MS as U, parseWorkSurfaceResponse as V, UI_COMMAND_PAYLOAD_MAX_BYTES as W, isUiSurfaceMethod as X, isTerminalUiCommandStatus as Y, parseUiCommand as Z, buildSpacePath as _,
|
|
5362
|
+
export { parseUsername as $, WORK_SURFACE_READY_TIMEOUT_MS as A, parseWorkSurfaceRequest as B, BoardInputError as C, WORK_COMPOSER_CHIP_CONTENT_MAX_BYTES as D, validateBoardNodes as E, buildWorkSurfaceRequest as F, UI_COMMAND_PENDING_TTL_SECONDS as G, UI_COMMAND_DEFAULT_TIMEOUT_MS as H, buildWorkSurfaceResponse as I, UI_COMMAND_VERSION as J, UI_COMMAND_SETTLEMENT_GRACE_SECONDS as K, parseWorkComposerChipClear as L, buildWorkComposerChipClear as M, buildWorkComposerChipSet as N, WORK_COMPOSER_CHIP_KEY_MAX_LENGTH as O, buildWorkSurfaceReady as P, parseSpaceSlug as Q, parseWorkComposerChipSet as R, createSessionPatchReducer as S, createBoardNode as T, UI_COMMAND_MAX_TIMEOUT_MS as U, parseWorkSurfaceResponse as V, UI_COMMAND_PAYLOAD_MAX_BYTES as W, isUiSurfaceMethod as X, isTerminalUiCommandStatus as Y, parseUiCommand as Z, buildSpacePath as _, PromptsApi as _t, ReferralsApi as a, validateBoardNodeInput as at, parseAssistantMessageCommit as b, CronJobsApi as bt, UiCommandsApi as c, parseBoardPlaybackPolicy as ct, BoardTransactionError as d, DEFAULT_BOARD_RENDER_LIMITS as dt, BoardAwarenessClientPayloadSchema as et, SpaceClient as f, SessionAccessApi as ft, buildSpaceInvitePath as g, SkillsApi as gt, PublicInviteApi as h, PublicAssetsApi as ht, WorksApi as i, BOARD_NODE_CONTRACT as it, WORK_SURFACE_REQUEST_TIMEOUT_MS as j, WORK_COMPOSER_CHIP_LABEL_MAX_LENGTH as k, TasksApi as l, ensureRealtimeConnected as lt, SpacesApi as m, SearchApi as mt, createHttpClient as n, BOARD_GEO_KINDS as nt, UsersApi as o, BoardCameraFocusParamsSchema as ot, SpacePublicFilesApi as p, ReferencesApi as pt, UI_COMMAND_TERMINAL_TTL_SECONDS as q, WorkCommerceApi as r, BOARD_NATIVE_NODE_TYPES as rt, UserApi as s, BoardPlaybackPolicySchema as st, CohubHttpClient as t, BOARD_COLOR_IDS as tt, BoardClient as u, BOARD_BUILTIN_CAPABILITIES as ut, SessionGenerationStreamClient as v, ModelsApi as vt, assertBoardNodes as w, SessionPatchReducer as x, ChannelsApi as xt, createSessionGenerationStreamClient as y, GenerationsApi as yt, parseWorkSurfaceReady as z };
|