@neta-art/cohub 2.15.0 → 3.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 +56 -0
- package/dist/board.d.ts +99 -0
- package/dist/board.js +2 -0
- package/dist/chunks/board.d.ts +2589 -0
- package/dist/chunks/board.js +392 -0
- package/dist/chunks/http.d.ts +238 -52
- package/dist/chunks/http.js +179 -66
- package/dist/chunks/websocket.d.ts +37 -116
- package/dist/chunks/websocket.js +0 -16
- package/dist/http.d.ts +4 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/package.json +5 -1
package/dist/chunks/http.js
CHANGED
|
@@ -169,6 +169,9 @@ var ModelsApi = class {
|
|
|
169
169
|
async listMultimodal() {
|
|
170
170
|
return this.transport.request(`/api/models?modelType=${MULTIMODAL_MODEL_TYPE}`);
|
|
171
171
|
}
|
|
172
|
+
async status() {
|
|
173
|
+
return this.transport.request("/api/models/status");
|
|
174
|
+
}
|
|
172
175
|
};
|
|
173
176
|
//#endregion
|
|
174
177
|
//#region src/apis/prompts.ts
|
|
@@ -1313,21 +1316,23 @@ const getFilenameFromContentDisposition = (value) => {
|
|
|
1313
1316
|
return value.match(/filename="?([^";]+)"?/i)?.[1] ?? null;
|
|
1314
1317
|
};
|
|
1315
1318
|
/**
|
|
1316
|
-
* A
|
|
1319
|
+
* A board transaction rejected by the server. `status`/`code` let callers
|
|
1317
1320
|
* distinguish a recoverable version conflict (409 / "VERSION_CONFLICT") from
|
|
1318
1321
|
* transient failures, so they can rebase and retry instead of surfacing an error.
|
|
1319
1322
|
*/
|
|
1320
|
-
var
|
|
1323
|
+
var BoardTransactionError = class extends Error {
|
|
1321
1324
|
status;
|
|
1322
1325
|
code;
|
|
1323
|
-
|
|
1324
|
-
|
|
1326
|
+
body;
|
|
1327
|
+
constructor(message, status, code, body, options) {
|
|
1328
|
+
super(message, options);
|
|
1325
1329
|
this.status = status;
|
|
1326
1330
|
this.code = code;
|
|
1327
|
-
this.
|
|
1331
|
+
this.body = body;
|
|
1332
|
+
this.name = "BoardTransactionError";
|
|
1328
1333
|
}
|
|
1329
1334
|
get isVersionConflict() {
|
|
1330
|
-
return this.
|
|
1335
|
+
return this.code === "VERSION_CONFLICT";
|
|
1331
1336
|
}
|
|
1332
1337
|
};
|
|
1333
1338
|
const toSessionEventName = (type) => {
|
|
@@ -1805,15 +1810,11 @@ var SpaceEventsApi = class {
|
|
|
1805
1810
|
handler(event);
|
|
1806
1811
|
return;
|
|
1807
1812
|
}
|
|
1808
|
-
if (type === "
|
|
1809
|
-
handler(event);
|
|
1810
|
-
return;
|
|
1811
|
-
}
|
|
1812
|
-
if (type === "canvas.tx.ack" && event.type === "canvas.tx.ack") {
|
|
1813
|
+
if (type === "board.transaction.applied" && event.type === "board.transaction.applied") {
|
|
1813
1814
|
handler(event);
|
|
1814
1815
|
return;
|
|
1815
1816
|
}
|
|
1816
|
-
if (type === "
|
|
1817
|
+
if (type === "board.playback.changed" && event.type === "board.playback.changed") {
|
|
1817
1818
|
handler(event);
|
|
1818
1819
|
return;
|
|
1819
1820
|
}
|
|
@@ -2148,34 +2149,159 @@ var SpaceCommerceApi = class {
|
|
|
2148
2149
|
return this.transport.request(`/api/spaces/${this.spaceId}/commerce/orders${params.toString() ? `?${params.toString()}` : ""}`);
|
|
2149
2150
|
}
|
|
2150
2151
|
};
|
|
2151
|
-
var
|
|
2152
|
+
var BoardRealtimeClient = class {
|
|
2153
|
+
websocketClient;
|
|
2154
|
+
spaceId;
|
|
2155
|
+
boardId;
|
|
2156
|
+
constructor(websocketClient, spaceId, boardId) {
|
|
2157
|
+
this.websocketClient = websocketClient;
|
|
2158
|
+
this.spaceId = spaceId;
|
|
2159
|
+
this.boardId = boardId;
|
|
2160
|
+
}
|
|
2161
|
+
subscribe(handlers) {
|
|
2162
|
+
if (!this.websocketClient) throw new Error("realtime transport is not configured for this client");
|
|
2163
|
+
ensureRealtimeConnected(this.websocketClient);
|
|
2164
|
+
const releaseRoom = this.websocketClient.retainRooms([getRealtimeSpaceRoom(this.spaceId)]);
|
|
2165
|
+
const unsubscribe = this.websocketClient.on("event", (event) => {
|
|
2166
|
+
if (event.spaceId !== this.spaceId) return;
|
|
2167
|
+
if (event.type === "board.transaction.applied" && event.payload.boardId === this.boardId) {
|
|
2168
|
+
const transactionEvent = event;
|
|
2169
|
+
handlers.event?.(transactionEvent);
|
|
2170
|
+
handlers.transaction?.(transactionEvent);
|
|
2171
|
+
}
|
|
2172
|
+
if (event.type === "board.playback.changed" && event.payload.boardId === this.boardId) {
|
|
2173
|
+
const playbackEvent = event;
|
|
2174
|
+
handlers.event?.(playbackEvent);
|
|
2175
|
+
handlers.playback?.(playbackEvent);
|
|
2176
|
+
}
|
|
2177
|
+
});
|
|
2178
|
+
return () => {
|
|
2179
|
+
unsubscribe();
|
|
2180
|
+
releaseRoom();
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
on(type, handler) {
|
|
2184
|
+
return type === "transaction" ? this.subscribe({ transaction: handler }) : this.subscribe({ playback: handler });
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
var BoardClient = class {
|
|
2188
|
+
spaceId;
|
|
2189
|
+
id;
|
|
2190
|
+
realtime;
|
|
2191
|
+
boards;
|
|
2192
|
+
constructor(spaceId, id, transport, websocketClient) {
|
|
2193
|
+
this.spaceId = spaceId;
|
|
2194
|
+
this.id = id;
|
|
2195
|
+
this.boards = new SpaceBoardsApi(transport, spaceId, websocketClient);
|
|
2196
|
+
this.realtime = new BoardRealtimeClient(websocketClient, spaceId, id);
|
|
2197
|
+
}
|
|
2198
|
+
inspect(input = {}, customFetch) {
|
|
2199
|
+
return this.boards.inspect(this.id, input, customFetch);
|
|
2200
|
+
}
|
|
2201
|
+
capabilities(customFetch) {
|
|
2202
|
+
return this.boards.capabilities(this.id, customFetch);
|
|
2203
|
+
}
|
|
2204
|
+
validate(transaction) {
|
|
2205
|
+
return this.boards.validate({
|
|
2206
|
+
...transaction,
|
|
2207
|
+
boardId: this.id
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
apply(transaction) {
|
|
2211
|
+
return this.boards.apply({
|
|
2212
|
+
...transaction,
|
|
2213
|
+
boardId: this.id
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
playback(command) {
|
|
2217
|
+
return this.boards.playback(this.id, command);
|
|
2218
|
+
}
|
|
2219
|
+
play(command) {
|
|
2220
|
+
return this.boards.play(this.id, command);
|
|
2221
|
+
}
|
|
2222
|
+
pause(command) {
|
|
2223
|
+
return this.boards.pause(this.id, command);
|
|
2224
|
+
}
|
|
2225
|
+
seek(command) {
|
|
2226
|
+
return this.boards.seek(this.id, command);
|
|
2227
|
+
}
|
|
2228
|
+
stop(command) {
|
|
2229
|
+
return this.boards.stop(this.id, command);
|
|
2230
|
+
}
|
|
2231
|
+
subscribe(handlers) {
|
|
2232
|
+
return this.realtime.subscribe(handlers);
|
|
2233
|
+
}
|
|
2234
|
+
on(type, handler) {
|
|
2235
|
+
return type === "transaction" ? this.realtime.on("transaction", handler) : this.realtime.on("playback", handler);
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
var SpaceBoardsApi = class {
|
|
2152
2239
|
transport;
|
|
2153
2240
|
spaceId;
|
|
2154
|
-
|
|
2241
|
+
websocketClient;
|
|
2242
|
+
constructor(transport, spaceId, websocketClient) {
|
|
2155
2243
|
this.transport = transport;
|
|
2156
2244
|
this.spaceId = spaceId;
|
|
2245
|
+
this.websocketClient = websocketClient;
|
|
2246
|
+
}
|
|
2247
|
+
byId(boardId) {
|
|
2248
|
+
return new BoardClient(this.spaceId, boardId, this.transport, this.websocketClient);
|
|
2157
2249
|
}
|
|
2158
2250
|
create(input) {
|
|
2159
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2251
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards`, {
|
|
2160
2252
|
method: "POST",
|
|
2161
2253
|
headers: { "Content-Type": "application/json" },
|
|
2162
2254
|
body: JSON.stringify(input)
|
|
2163
2255
|
});
|
|
2164
2256
|
}
|
|
2165
|
-
|
|
2166
|
-
const params = new URLSearchParams(
|
|
2167
|
-
|
|
2257
|
+
inspect(boardId, input = {}, customFetch) {
|
|
2258
|
+
const params = new URLSearchParams();
|
|
2259
|
+
for (const section of input.include ?? []) params.append("include", section);
|
|
2260
|
+
if (input.viewport) params.set("viewport", JSON.stringify(input.viewport));
|
|
2261
|
+
const query = params.toString();
|
|
2262
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}${query ? `?${query}` : ""}`, { fetch: customFetch });
|
|
2168
2263
|
}
|
|
2169
|
-
|
|
2170
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2264
|
+
capabilities(boardId, customFetch) {
|
|
2265
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/capabilities`, { fetch: customFetch });
|
|
2171
2266
|
}
|
|
2172
|
-
|
|
2173
|
-
return this.transport.request(`/api/spaces/${this.spaceId}/
|
|
2267
|
+
validate(transaction) {
|
|
2268
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/validate`, {
|
|
2174
2269
|
method: "POST",
|
|
2175
2270
|
headers: { "Content-Type": "application/json" },
|
|
2176
|
-
body: JSON.stringify(
|
|
2271
|
+
body: JSON.stringify(transaction)
|
|
2272
|
+
});
|
|
2273
|
+
}
|
|
2274
|
+
async apply(transaction) {
|
|
2275
|
+
try {
|
|
2276
|
+
return await this.transport.request(`/api/spaces/${this.spaceId}/boards/${transaction.boardId}/transactions`, {
|
|
2277
|
+
method: "POST",
|
|
2278
|
+
headers: { "Content-Type": "application/json" },
|
|
2279
|
+
body: JSON.stringify(transaction)
|
|
2280
|
+
});
|
|
2281
|
+
} catch (cause) {
|
|
2282
|
+
if (cause instanceof HttpError) throw new BoardTransactionError(cause.message, cause.status, cause.code ?? void 0, cause.body, { cause });
|
|
2283
|
+
throw cause;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
playback(boardId, command) {
|
|
2287
|
+
return this.transport.request(`/api/spaces/${this.spaceId}/boards/${boardId}/playback`, {
|
|
2288
|
+
method: "POST",
|
|
2289
|
+
headers: { "Content-Type": "application/json" },
|
|
2290
|
+
body: JSON.stringify(command)
|
|
2177
2291
|
});
|
|
2178
2292
|
}
|
|
2293
|
+
play(boardId, command) {
|
|
2294
|
+
return this.playback(boardId, command);
|
|
2295
|
+
}
|
|
2296
|
+
pause(boardId, command) {
|
|
2297
|
+
return this.playback(boardId, command);
|
|
2298
|
+
}
|
|
2299
|
+
seek(boardId, command) {
|
|
2300
|
+
return this.playback(boardId, command);
|
|
2301
|
+
}
|
|
2302
|
+
stop(boardId, command) {
|
|
2303
|
+
return this.playback(boardId, command);
|
|
2304
|
+
}
|
|
2179
2305
|
};
|
|
2180
2306
|
var SpaceCheckpointFilesApi = class {
|
|
2181
2307
|
transport;
|
|
@@ -2313,7 +2439,7 @@ var SpaceClient = class {
|
|
|
2313
2439
|
sandbox;
|
|
2314
2440
|
invitations;
|
|
2315
2441
|
labels;
|
|
2316
|
-
|
|
2442
|
+
boards;
|
|
2317
2443
|
commerce;
|
|
2318
2444
|
constructor(id, transport, websocketClient) {
|
|
2319
2445
|
this.id = id;
|
|
@@ -2332,12 +2458,15 @@ var SpaceClient = class {
|
|
|
2332
2458
|
this.sandbox = new SpaceSandboxApi(transport, id);
|
|
2333
2459
|
this.invitations = new SpaceInvitationsApi(transport, id);
|
|
2334
2460
|
this.labels = new SpaceLabelsApi(transport, id);
|
|
2335
|
-
this.
|
|
2461
|
+
this.boards = new SpaceBoardsApi(transport, id, websocketClient);
|
|
2336
2462
|
this.commerce = new SpaceCommerceApi(transport, id);
|
|
2337
2463
|
}
|
|
2338
2464
|
get(customFetch) {
|
|
2339
2465
|
return this.transport.request(`/api/spaces/${this.id}`, { fetch: customFetch });
|
|
2340
2466
|
}
|
|
2467
|
+
getStartup(customFetch) {
|
|
2468
|
+
return this.transport.request(`/api/spaces/${this.id}/startup`, { fetch: customFetch });
|
|
2469
|
+
}
|
|
2341
2470
|
prompt(input) {
|
|
2342
2471
|
return this.transport.request(`/api/spaces/${this.id}/prompt`, {
|
|
2343
2472
|
method: "POST",
|
|
@@ -2471,46 +2600,6 @@ var SpaceClient = class {
|
|
|
2471
2600
|
rename(name) {
|
|
2472
2601
|
return this.update({ name });
|
|
2473
2602
|
}
|
|
2474
|
-
async sendCanvasTransactionRealtime(documentId, input) {
|
|
2475
|
-
if (!this.websocketClient) return this.canvas.sendTransaction(documentId, input);
|
|
2476
|
-
const requestId = `canvas-${input.txId}`;
|
|
2477
|
-
const result = new Promise((resolve, reject) => {
|
|
2478
|
-
let settled = false;
|
|
2479
|
-
let timeout = null;
|
|
2480
|
-
const settle = (fn) => {
|
|
2481
|
-
if (settled) return;
|
|
2482
|
-
settled = true;
|
|
2483
|
-
if (timeout) clearTimeout(timeout);
|
|
2484
|
-
cleanupAck?.();
|
|
2485
|
-
cleanupError?.();
|
|
2486
|
-
fn();
|
|
2487
|
-
};
|
|
2488
|
-
const cleanupAck = this.websocketClient?.on("event", (event) => {
|
|
2489
|
-
if (event.type !== "canvas.tx.ack" || event.requestId !== requestId) return;
|
|
2490
|
-
const version = event.payload.version;
|
|
2491
|
-
settle(() => {
|
|
2492
|
-
if (typeof version === "number") resolve({ document: { version } });
|
|
2493
|
-
else reject(/* @__PURE__ */ new Error("Invalid canvas ack"));
|
|
2494
|
-
});
|
|
2495
|
-
});
|
|
2496
|
-
const cleanupError = this.websocketClient?.on("event", (event) => {
|
|
2497
|
-
if (event.type !== "canvas.tx.error" || event.requestId !== requestId) return;
|
|
2498
|
-
settle(() => reject(new CanvasTransactionError(typeof event.payload.message === "string" ? event.payload.message : "Canvas sync failed", typeof event.payload.status === "number" ? event.payload.status : void 0, typeof event.payload.code === "string" ? event.payload.code : void 0)));
|
|
2499
|
-
});
|
|
2500
|
-
timeout = setTimeout(() => settle(() => reject(/* @__PURE__ */ new Error("Canvas sync timed out"))), 15e3);
|
|
2501
|
-
});
|
|
2502
|
-
await this.websocketClient.sendCanvasTransaction({
|
|
2503
|
-
spaceId: this.id,
|
|
2504
|
-
documentId,
|
|
2505
|
-
txId: input.txId,
|
|
2506
|
-
baseVersion: input.baseVersion ?? null,
|
|
2507
|
-
clientId: input.clientId ?? null,
|
|
2508
|
-
undoGroupId: input.undoGroupId ?? null,
|
|
2509
|
-
ops: input.ops,
|
|
2510
|
-
requestId
|
|
2511
|
-
});
|
|
2512
|
-
return result;
|
|
2513
|
-
}
|
|
2514
2603
|
profile(body) {
|
|
2515
2604
|
return this.transport.request(`/api/spaces/${this.id}/profile`, {
|
|
2516
2605
|
method: "PATCH",
|
|
@@ -2538,6 +2627,9 @@ var SpaceClient = class {
|
|
|
2538
2627
|
session(sessionId) {
|
|
2539
2628
|
return new SessionClient(this.id, sessionId, this.transport, this.websocketClient);
|
|
2540
2629
|
}
|
|
2630
|
+
board(boardId) {
|
|
2631
|
+
return new BoardClient(this.id, boardId, this.transport, this.websocketClient);
|
|
2632
|
+
}
|
|
2541
2633
|
updatePresence(meta) {
|
|
2542
2634
|
if (!this.websocketClient) return Promise.resolve();
|
|
2543
2635
|
return this.websocketClient.updatePresence({
|
|
@@ -2582,11 +2674,13 @@ var UserApi = class {
|
|
|
2582
2674
|
transportBaseUrl;
|
|
2583
2675
|
setStoredAuthToken;
|
|
2584
2676
|
clearStoredAuthToken;
|
|
2677
|
+
labels;
|
|
2585
2678
|
constructor(transport, transportBaseUrl, setStoredAuthToken, clearStoredAuthToken) {
|
|
2586
2679
|
this.transport = transport;
|
|
2587
2680
|
this.transportBaseUrl = transportBaseUrl;
|
|
2588
2681
|
this.setStoredAuthToken = setStoredAuthToken;
|
|
2589
2682
|
this.clearStoredAuthToken = clearStoredAuthToken;
|
|
2683
|
+
this.labels = new UserLabelsApi(transport);
|
|
2590
2684
|
}
|
|
2591
2685
|
getMe(options) {
|
|
2592
2686
|
const init = typeof options === "function" ? { fetch: options } : options;
|
|
@@ -2636,6 +2730,25 @@ var UserApi = class {
|
|
|
2636
2730
|
return null;
|
|
2637
2731
|
}
|
|
2638
2732
|
};
|
|
2733
|
+
/** User-scoped labels — same label/assignment model as space labels, but private to the viewer. */
|
|
2734
|
+
var UserLabelsApi = class {
|
|
2735
|
+
transport;
|
|
2736
|
+
constructor(transport) {
|
|
2737
|
+
this.transport = transport;
|
|
2738
|
+
}
|
|
2739
|
+
getResourceLabels(resourceType, resourceRef) {
|
|
2740
|
+
const params = new URLSearchParams({ resourceRef });
|
|
2741
|
+
return this.transport.request(`/api/me/resources/${resourceType}/labels?${params.toString()}`);
|
|
2742
|
+
}
|
|
2743
|
+
patchResourceLabels(resourceType, resourceRef, input) {
|
|
2744
|
+
const params = new URLSearchParams({ resourceRef });
|
|
2745
|
+
return this.transport.request(`/api/me/resources/${resourceType}/labels?${params.toString()}`, {
|
|
2746
|
+
method: "PATCH",
|
|
2747
|
+
headers: { "Content-Type": "application/json" },
|
|
2748
|
+
body: JSON.stringify(input)
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
};
|
|
2639
2752
|
//#endregion
|
|
2640
2753
|
//#region src/apis/users.ts
|
|
2641
2754
|
const MAX_BATCH_USER_PROFILES = 100;
|
|
@@ -2822,4 +2935,4 @@ var CohubHttpClient = class {
|
|
|
2822
2935
|
};
|
|
2823
2936
|
const createHttpClient = (options) => new CohubHttpClient(options);
|
|
2824
2937
|
//#endregion
|
|
2825
|
-
export {
|
|
2938
|
+
export { PublicAssetsApi as C, GenerationsApi as D, ModelsApi as E, CronJobsApi as O, SearchApi as S, PromptsApi as T, SessionPatchReducer as _, ReferralsApi as a, SessionAccessApi as b, TasksApi as c, SpaceClient as d, SpacesApi as f, parseAssistantMessageCommit as g, createSessionGenerationStreamClient as h, WorksApi as i, ChannelsApi as k, BoardClient as l, SessionGenerationStreamClient as m, createHttpClient as n, UsersApi as o, PublicInviteApi as p, WorkCommerceApi as r, UserApi as s, CohubHttpClient as t, BoardTransactionError as u, createSessionPatchReducer as v, SkillsApi as w, ReferencesApi as x, ensureRealtimeConnected as y };
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
import { g as BoardPlaybackSnapshot, m as BoardOperation } from "./board.js";
|
|
1
2
|
import { n as CohubEnvironment } from "./environment.js";
|
|
3
|
+
//#region ../protocol/dist/billing.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Standard billing payload attached under the `billing` key of any response
|
|
6
|
+
* or realtime event that involves a billing gate. Present on 402 error bodies
|
|
7
|
+
* (blocked / not entitled), on success responses carrying a soft debt warning,
|
|
8
|
+
* and on realtime error events. `conversion` always drives the shared upgrade
|
|
9
|
+
* UI; balance fields appear only for balance-based gates.
|
|
10
|
+
*
|
|
11
|
+
* `conversion` is intentionally `unknown` here to keep the protocol layer free
|
|
12
|
+
* of a billing dependency — clients validate it against `BillingConversionIntent`.
|
|
13
|
+
*/
|
|
14
|
+
type BillingPayload = {
|
|
15
|
+
conversion: unknown;
|
|
16
|
+
status?: "blocked" | "allowed_with_debt";
|
|
17
|
+
netUsd?: number;
|
|
18
|
+
hardNegativeLimitUsd?: number;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
2
21
|
//#region ../protocol/dist/core/content.d.ts
|
|
3
22
|
type ContentBlockMeta = Record<string, unknown>;
|
|
4
23
|
type ContentBlock = {
|
|
@@ -45,24 +64,6 @@ type ContentBlock = {
|
|
|
45
64
|
_meta?: ContentBlockMeta;
|
|
46
65
|
};
|
|
47
66
|
//#endregion
|
|
48
|
-
//#region ../protocol/dist/billing.d.ts
|
|
49
|
-
/**
|
|
50
|
-
* Standard billing payload attached under the `billing` key of any response
|
|
51
|
-
* or realtime event that involves a billing gate. Present on 402 error bodies
|
|
52
|
-
* (blocked / not entitled), on success responses carrying a soft debt warning,
|
|
53
|
-
* and on realtime error events. `conversion` always drives the shared upgrade
|
|
54
|
-
* UI; balance fields appear only for balance-based gates.
|
|
55
|
-
*
|
|
56
|
-
* `conversion` is intentionally `unknown` here to keep the protocol layer free
|
|
57
|
-
* of a billing dependency — clients validate it against `BillingConversionIntent`.
|
|
58
|
-
*/
|
|
59
|
-
type BillingPayload = {
|
|
60
|
-
conversion: unknown;
|
|
61
|
-
status?: "blocked" | "allowed_with_debt";
|
|
62
|
-
netUsd?: number;
|
|
63
|
-
hardNegativeLimitUsd?: number;
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
67
|
//#region ../protocol/dist/core/usage.d.ts
|
|
67
68
|
type Usage = {
|
|
68
69
|
input?: number;
|
|
@@ -731,49 +732,31 @@ type SpacePresenceUpdatedEvent = {
|
|
|
731
732
|
sessionId?: string | null;
|
|
732
733
|
payload: SpacePresenceSnapshot$1;
|
|
733
734
|
};
|
|
734
|
-
type
|
|
735
|
+
type BoardTransactionAppliedEvent = {
|
|
735
736
|
id: string;
|
|
736
737
|
timestamp: number;
|
|
737
738
|
domain: "space";
|
|
738
|
-
type: "
|
|
739
|
+
type: "board.transaction.applied";
|
|
739
740
|
requestId?: string | null;
|
|
740
741
|
spaceId: string;
|
|
741
742
|
sessionId?: string | null;
|
|
742
743
|
payload: {
|
|
743
|
-
|
|
744
|
+
boardId: string;
|
|
744
745
|
actorId: string;
|
|
745
746
|
txId: string;
|
|
746
747
|
version: number;
|
|
747
|
-
|
|
748
|
+
operations: BoardOperation[];
|
|
748
749
|
};
|
|
749
750
|
};
|
|
750
|
-
type
|
|
751
|
+
type BoardPlaybackChangedEvent = {
|
|
751
752
|
id: string;
|
|
752
753
|
timestamp: number;
|
|
753
754
|
domain: "space";
|
|
754
|
-
type: "
|
|
755
|
+
type: "board.playback.changed";
|
|
755
756
|
requestId?: string | null;
|
|
756
757
|
spaceId: string;
|
|
757
758
|
sessionId?: string | null;
|
|
758
|
-
payload:
|
|
759
|
-
documentId: string;
|
|
760
|
-
txId: string;
|
|
761
|
-
version: number;
|
|
762
|
-
};
|
|
763
|
-
};
|
|
764
|
-
type CanvasTransactionErrorEvent = {
|
|
765
|
-
id: string;
|
|
766
|
-
timestamp: number;
|
|
767
|
-
domain: "space";
|
|
768
|
-
type: "canvas.tx.error";
|
|
769
|
-
requestId?: string | null;
|
|
770
|
-
spaceId?: string | null;
|
|
771
|
-
sessionId?: string | null;
|
|
772
|
-
payload: {
|
|
773
|
-
documentId?: string | null;
|
|
774
|
-
txId?: string | null;
|
|
775
|
-
message: string;
|
|
776
|
-
};
|
|
759
|
+
payload: BoardPlaybackSnapshot;
|
|
777
760
|
};
|
|
778
761
|
type RealtimeTaskRecord = {
|
|
779
762
|
id: string;
|
|
@@ -824,10 +807,11 @@ type LabelAssignmentsUpdatedEvent = {
|
|
|
824
807
|
domain: "label";
|
|
825
808
|
type: "label.assignments.updated";
|
|
826
809
|
requestId?: string | null;
|
|
827
|
-
|
|
810
|
+
/** Space room target; null for user-scoped label events (delivered to user room). */
|
|
811
|
+
spaceId: string | null;
|
|
828
812
|
sessionId?: string | null;
|
|
829
813
|
payload: {
|
|
830
|
-
resourceType: "session" | "checkpoint" | "file";
|
|
814
|
+
resourceType: "session" | "checkpoint" | "file" | "space";
|
|
831
815
|
resourceRef: string;
|
|
832
816
|
labels: unknown[];
|
|
833
817
|
assignments: unknown[];
|
|
@@ -835,7 +819,7 @@ type LabelAssignmentsUpdatedEvent = {
|
|
|
835
819
|
affectedLabelIds: string[];
|
|
836
820
|
};
|
|
837
821
|
};
|
|
838
|
-
type RealtimeServerEvent = SystemReadyEvent | SystemAuthOkEvent | SystemRequestErrorEvent | SystemPongEvent | SystemAckOkEvent | SystemSubscribeOkEvent | SystemSubscribeErrorEvent | SessionCreatedEvent | SessionUpdatedEvent | SessionRequestAcceptedEvent | SessionRequestErrorEvent | SessionTurnCreatedEvent | SessionTurnPatchEvent | SessionTurnErrorEvent | SessionTurnLifecycleEvent | SessionTurnUpdatedEvent | SessionTurnFinalizedEvent | SessionTurnNotifyEvent | SessionMessagePersistedEvent | SpaceFsChangedEvent | SpacePortsChangedEvent | SpacePresenceUpdatedEvent |
|
|
822
|
+
type RealtimeServerEvent = SystemReadyEvent | SystemAuthOkEvent | SystemRequestErrorEvent | SystemPongEvent | SystemAckOkEvent | SystemSubscribeOkEvent | SystemSubscribeErrorEvent | SessionCreatedEvent | SessionUpdatedEvent | SessionRequestAcceptedEvent | SessionRequestErrorEvent | SessionTurnCreatedEvent | SessionTurnPatchEvent | SessionTurnErrorEvent | SessionTurnLifecycleEvent | SessionTurnUpdatedEvent | SessionTurnFinalizedEvent | SessionTurnNotifyEvent | SessionMessagePersistedEvent | SpaceFsChangedEvent | SpacePortsChangedEvent | SpacePresenceUpdatedEvent | BoardTransactionAppliedEvent | BoardPlaybackChangedEvent | TaskCreatedEvent | TaskUpdatedEvent | LabelAssignmentsUpdatedEvent;
|
|
839
823
|
//#endregion
|
|
840
824
|
//#region ../../node_modules/.pnpm/@neta-art+generation@0.1.16/node_modules/@neta-art/generation/dist/builtins-DQq2dSq-.d.ts
|
|
841
825
|
//#region src/types.d.ts
|
|
@@ -1671,6 +1655,8 @@ type SpaceRecord = {
|
|
|
1671
1655
|
access?: SpaceAccess;
|
|
1672
1656
|
accessLevel?: "minimal";
|
|
1673
1657
|
ownerProfile?: Pick<UserProfile, "userUuid" | "username" | "displayName" | "avatarUrl"> | null;
|
|
1658
|
+
/** Whether the viewer has pinned this space (only present in list responses). */
|
|
1659
|
+
isPinned?: boolean;
|
|
1674
1660
|
};
|
|
1675
1661
|
type SpaceBootstrapSource = {
|
|
1676
1662
|
type: "blank";
|
|
@@ -1720,63 +1706,6 @@ type SpaceConfigUpdateResponse = {
|
|
|
1720
1706
|
message?: string;
|
|
1721
1707
|
};
|
|
1722
1708
|
};
|
|
1723
|
-
type CanvasDocumentRecord = {
|
|
1724
|
-
id: string;
|
|
1725
|
-
spaceId: string;
|
|
1726
|
-
filePath: string;
|
|
1727
|
-
title: string;
|
|
1728
|
-
version: number;
|
|
1729
|
-
meta?: Record<string, unknown> | null;
|
|
1730
|
-
createdAt: string | null;
|
|
1731
|
-
updatedAt: string | null;
|
|
1732
|
-
deletedAt?: string | null;
|
|
1733
|
-
};
|
|
1734
|
-
type CanvasNodeRecord = {
|
|
1735
|
-
documentId: string;
|
|
1736
|
-
nodeId: string;
|
|
1737
|
-
type: string;
|
|
1738
|
-
parentId?: string | null;
|
|
1739
|
-
orderKey?: string | null;
|
|
1740
|
-
x: number;
|
|
1741
|
-
y: number;
|
|
1742
|
-
width: number;
|
|
1743
|
-
height: number;
|
|
1744
|
-
rotation: number;
|
|
1745
|
-
refKind?: string | null;
|
|
1746
|
-
refPath?: string | null;
|
|
1747
|
-
refUrl?: string | null;
|
|
1748
|
-
view: Record<string, unknown>;
|
|
1749
|
-
style: Record<string, unknown>;
|
|
1750
|
-
animation: Record<string, unknown>;
|
|
1751
|
-
data: Record<string, unknown>;
|
|
1752
|
-
version: number;
|
|
1753
|
-
createdAt: string | null;
|
|
1754
|
-
updatedAt: string | null;
|
|
1755
|
-
deletedAt?: string | null;
|
|
1756
|
-
};
|
|
1757
|
-
type CanvasNodeInput = Omit<CanvasNodeRecord, "documentId" | "version" | "createdAt" | "updatedAt" | "deletedAt">;
|
|
1758
|
-
type CanvasSemanticOp = {
|
|
1759
|
-
opId?: string;
|
|
1760
|
-
type: "node.create" | "node.patch" | "node.delete";
|
|
1761
|
-
payload: Record<string, unknown>;
|
|
1762
|
-
inverse?: Record<string, unknown>;
|
|
1763
|
-
};
|
|
1764
|
-
type CanvasTransactionInput = {
|
|
1765
|
-
txId: string;
|
|
1766
|
-
baseVersion?: number | null;
|
|
1767
|
-
clientId?: string | null;
|
|
1768
|
-
undoGroupId?: string | null;
|
|
1769
|
-
ops: CanvasSemanticOp[];
|
|
1770
|
-
};
|
|
1771
|
-
type CanvasCreateInput = {
|
|
1772
|
-
path: string;
|
|
1773
|
-
title?: string;
|
|
1774
|
-
nodes?: CanvasNodeInput[];
|
|
1775
|
-
};
|
|
1776
|
-
type CanvasBootstrapResponse = {
|
|
1777
|
-
document: CanvasDocumentRecord;
|
|
1778
|
-
nodes: CanvasNodeRecord[];
|
|
1779
|
-
};
|
|
1780
1709
|
type SpaceCreateResponse = {
|
|
1781
1710
|
space: SpaceRecord;
|
|
1782
1711
|
taskRunId: string;
|
|
@@ -2186,7 +2115,7 @@ type SpaceMember = {
|
|
|
2186
2115
|
};
|
|
2187
2116
|
type LabelScopeType = "space" | "user" | "org";
|
|
2188
2117
|
type LabelSource = "user" | "system";
|
|
2189
|
-
type LabelResourceType = "session" | "checkpoint" | "file";
|
|
2118
|
+
type LabelResourceType = "session" | "checkpoint" | "file" | "space";
|
|
2190
2119
|
type LabelRecord = {
|
|
2191
2120
|
id: string;
|
|
2192
2121
|
scopeType: LabelScopeType;
|
|
@@ -2218,6 +2147,9 @@ type LabelAssignmentRecord = {
|
|
|
2218
2147
|
meta: Record<string, unknown> | null;
|
|
2219
2148
|
createdAt: string | null;
|
|
2220
2149
|
updatedAt: string | null;
|
|
2150
|
+
/** Label metadata joined in user-scope assignment responses. */
|
|
2151
|
+
labelSystemKey?: string | null;
|
|
2152
|
+
labelName?: string;
|
|
2221
2153
|
};
|
|
2222
2154
|
type LabelAssignmentListItem = LabelAssignmentRecord & {
|
|
2223
2155
|
href: string;
|
|
@@ -2288,7 +2220,6 @@ type ExploreSpaceItem = {
|
|
|
2288
2220
|
category: string | null;
|
|
2289
2221
|
tags: string[];
|
|
2290
2222
|
saveCount: number;
|
|
2291
|
-
pinCount: number;
|
|
2292
2223
|
forkCount: number;
|
|
2293
2224
|
updatedAt: string | null;
|
|
2294
2225
|
accessLabel: "public" | "sign-in-required" | "unknown";
|
|
@@ -2608,16 +2539,6 @@ declare class WebsocketClient {
|
|
|
2608
2539
|
private log;
|
|
2609
2540
|
connect(): Promise<void>;
|
|
2610
2541
|
disconnect(code?: number, reason?: string): Promise<void>;
|
|
2611
|
-
sendCanvasTransaction(input: {
|
|
2612
|
-
spaceId: string;
|
|
2613
|
-
documentId: string;
|
|
2614
|
-
txId: string;
|
|
2615
|
-
ops: Array<Record<string, unknown>>;
|
|
2616
|
-
baseVersion?: number | null;
|
|
2617
|
-
clientId?: string | null;
|
|
2618
|
-
undoGroupId?: string | null;
|
|
2619
|
-
requestId?: string;
|
|
2620
|
-
}): Promise<void>;
|
|
2621
2542
|
updatePresence(input: {
|
|
2622
2543
|
spaceId: string;
|
|
2623
2544
|
meta?: Record<string, unknown> | null;
|
|
@@ -2660,4 +2581,4 @@ declare class WebsocketClient {
|
|
|
2660
2581
|
}
|
|
2661
2582
|
declare const createWebsocketClient: (options?: WebsocketClientOptions) => WebsocketClient;
|
|
2662
2583
|
//#endregion
|
|
2663
|
-
export {
|
|
2584
|
+
export { CreateSpacePromptInput as $, SpaceFsUploadError as $n, BoardTransactionAppliedEvent as $r, ReferralReward as $t, BillingProductDisplay as A, SpaceConfig as An, UserSessionsResponse as Ar, ModelCatalogEntry as At, CheckpointDiffFile as B, SpaceFsCreateUploadResponse as Bn, GenerationPolicyError as Br, PublicUserSpaceItem as Bt, BillingCreditStatus as C, SpaceCommerceBuyerProfile as Cn, SpaceUsageSummary as Cr, LabelItemsSessionFork as Ct, BillingPluginStatus as D, SpaceCommerceProduct as Dn, UserRulesResponse as Dr, LabelScopeType as Dt, BillingPaymentStatus as E, SpaceCommerceOrder as En, UserProfile as Er, LabelResourceType as Et, BillingSubscriptionHistoryList as F, SpaceDefaultResponse as Fn, DiscordChannelConfig as Fr, PromptTemplateCatalogEntry as Ft, CheckpointDiffStatus as G, SpaceFsMoveInput as Gn, findGenerationModelPolicy as Gr, ReferenceDirection as Gt, CheckpointDiffPatchKind as H, SpaceFsEntry as Hn, decodeGenerationPolicy as Hr, ReferenceAggregateGroup as Ht, BillingSubscriptionHistoryStatus as I, SpaceEnvInput as In, FeishuChannelConfig as Ir, PromptTemplateCatalogResponse as It, ClaimReferralResponse as J, SpaceFsReadFilesInput as Jn, parseGenerationPolicyFromEnv as Jr, ReferenceQueryableType as Jt, CheckpointDiffSummary as K, SpaceFsPreparingFile as Kn, getAllowedGenerationModelIds as Kr, ReferenceKind as Kt, BillingSubscriptionSummary as L, SpaceFsCompleteUploadInput as Ln, GenerationModelPolicy as Lr, PublicReferral as Lt, BillingProductPricing as M, SpaceConfigResponse as Mn, ChannelHealth as Mr, PatchResourceLabelsResponse as Mt, BillingRedemptionResult as N, SpaceConfigUpdateResponse as Nn, ChannelHealthReasonCode as Nr, Permission as Nt, BillingProductBillingInterval as O, SpaceCommerceProductBenefitBinding as On, UserSessionListItem as Or, LabelSource as Ot, BillingResponsePayload as P, SpaceCreateResponse as Pn, ChannelRuntimeState as Pr, PromptAccessMode as Pt, CreateSpaceModInput as Q, SpaceFsUploadEntry as Qn, BoardPlaybackChangedEvent as Qr, ReferralListItem as Qt, Channel as R, SpaceFsCompleteUploadResponse as Rn, GenerationParameterConstraint as Rr, PublicUserPageResponse as Rt, BillingCreditGrantStatus as S, BillingPayload as Si, SpaceCommerceBenefit as Sn, SpaceUsageResponse as Sr, LabelItemsResponse as St, BillingHistoryPagination as T, SpaceCommerceFeatureBenefit as Tn, TaskRunRecord as Tr, LabelRecord as Tt, CheckpointDiffPatchLine as U, SpaceFsFileKind as Un, encodeGenerationPolicy as Ur, ReferenceAggregateGroupBy as Ut, CheckpointDiffFileResponse as V, SpaceFsEncoding as Vn, assertGenerationRequestAllowedByPolicy as Vr, PublicUserWorkItem as Vt, CheckpointDiffStats as W, SpaceFsFileResponse as Wn, filterGenerationDeclarationsByPolicy as Wr, ReferenceAggregateResponse as Wt, CreateInvitationResponse as X, SpaceFsTreeResponse as Xn, GenerationModelDeclaration as Xr, ReferenceResourceType as Xt, CreateInvitationInput as Y, SpaceFsReadFilesResponse as Yn, GenerationContentBlock as Yr, ReferenceRecord as Yt, CreateSpaceInput as Z, SpaceFsUploadDestination as Zn, GenerationResult as Zr, ReferralDashboard as Zt, BillingCatalogProduct as _, ModelThinkingLevel as _i, SpaceAccess as _n, SpaceSandboxAutoDestroyPolicy as _r, JsonPrimitive as _t, WebsocketClientOptions as a, SpacePublicEndpoints as ai, SessionMessageResponse as an, SpaceInvitation as ar, CursorPageInfo as at, BillingConversionIntent as b, Usage as bi, SpaceChannelBindingInput as bn, SpaceSessionsResponse as br, LabelAssignmentPageInfo as bt, createWebsocketClient as c, SessionTurnSegmentRecord as ci, SessionRecord as cn, SpaceMeta as cr, ExploreSpacesResponse as ct, BatchUserProfilesResponse as d, CompletionAssistantMessage as di, SessionTurnSignedUrlsResponse as dn, SpacePendingDiffSummary as dr, GenerationUsageSummary as dt, ChannelEnvelope as ei, ReferralStatus as en, SpaceFsUploadPlanEntry as er, CreateSpacePromptResponse as et, BillingBalanceActivity as f, CompletionMessage as fi, SessionTurnStreamSnapshotResponse as fn, SpacePresenceSnapshot as fr, GlobalSearchResponse as ft, BillingCatalog as g, CreateSpaceCompletionInput as gi, SkillCatalogResponse as gn, SpaceRole as gr, JsonObject as gt, BillingBalanceActivityStatus as h, CompletionUsage as hi, SkillCatalogEntry as hn, SpaceRecord as hr, InvitationDetail as ht, WebsocketClientEvents as i, SessionTurnPatchEvent as ii, SessionBindingRecord as in, SpaceFsWriteFileInput as ir, CronJobUpdatePatch as it, BillingProductKind as j, SpaceConfigInput as jn, ChannelConfig as jr, PatchResourceLabelsInput as jt, BillingProductCreditBenefit as k, SpaceCommerceProductCreditBenefit as kn, UserSessionSpaceSummary as kr, MeResponse as kt, AcceptInvitationResponse as l, SessionTurnIndexItem as li, SessionTurnIndexResponse as ln, SpaceModListItem as lr, GenerationUsageBlock as lt, BillingBalanceActivityList as m, CompletionThinkingLevel as mi, SessionTurnsPaginatedResponse as mn, SpacePublicProfile as mr, GlobalSearchType as mt, WebSocketLike as n, RealtimePatchOperation as ni, SandboxSpecId as nn, SpaceFsUploadProgress as nr, CronJobPayload as nt, WebsocketClientState as o, MessageRecord as oi, SessionMessagesPaginatedResponse as on, SpaceListItem as or, ExploreSection as ot, BillingBalanceActivityKind as p, CompletionMessageRole as pi, SessionTurnWindowResponse as pn, SpacePresenceUser as pr, GlobalSearchResult as pt, CheckpointRecord as q, SpaceFsReadFilesError as qn, normalizeGenerationPolicy as qr, ReferenceQueryResponse as qt, WebsocketClient as r, RealtimeServerEvent as ri, SendMessageCronJobPayload as rn, SpaceFsUploadResponse as rr, CronJobRecord as rt, WebsocketEventPayload as s, SessionForkRecord as si, SessionMessagesResponse as sn, SpaceMember as sr, ExploreSpaceItem as st, WebSocketConstructor as t, LabelAssignmentsUpdatedEvent as ti, ResourceLabelsResponse as tn, SpaceFsUploadPlanEntryInput as tr, CreateSpaceSessionInput as tt, ApiError as u, SessionTurnRecord as ui, SessionTurnResponse as un, SpacePendingDiffFileResponse as ur, GenerationUsageHourlyStat as ut, BillingCheckoutActionState as v, SpaceCompletionResult as vi, SpaceAccessPolicy as vn, SpaceSandboxConfig as vr, JsonValue as vt, BillingCreditUnit as w, SpaceCommerceCreditsBenefit as wn, TaskRunDetailResponse as wr, LabelListItem as wt, BillingCreditExpiryGroup as x, ContentBlock as xi, SpaceCheckpointDetailResponse as xn, SpaceUsageHourlyStat as xr, LabelAssignmentRecord as xt, BillingCheckoutResult as y, SpaceCompletionStreamEvent as yi, SpaceBootstrapSource as yn, SpaceSandboxProvider as yr, LabelAssignmentListItem as yt, CheckpointDiffDelivery as z, SpaceFsCreateUploadInput as zn, GenerationPolicy as zr, PublicUserProfile as zt };
|
package/dist/chunks/websocket.js
CHANGED
|
@@ -298,22 +298,6 @@ var WebsocketClient = class {
|
|
|
298
298
|
state.pending = false;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
async sendCanvasTransaction(input) {
|
|
302
|
-
await this.ensureOpen();
|
|
303
|
-
this.send({
|
|
304
|
-
type: "canvas.tx",
|
|
305
|
-
requestId: input.requestId,
|
|
306
|
-
payload: {
|
|
307
|
-
spaceId: input.spaceId,
|
|
308
|
-
documentId: input.documentId,
|
|
309
|
-
txId: input.txId,
|
|
310
|
-
baseVersion: input.baseVersion ?? null,
|
|
311
|
-
clientId: input.clientId ?? null,
|
|
312
|
-
undoGroupId: input.undoGroupId ?? null,
|
|
313
|
-
ops: input.ops
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
301
|
async updatePresence(input) {
|
|
318
302
|
await this.ensureOpen();
|
|
319
303
|
this.send({
|