@neta-art/cohub 5.7.0 → 5.8.1
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 +18 -5
- package/dist/board/core/palette.d.ts +3 -2
- package/dist/board/core/shape-types.d.ts +3 -1
- package/dist/board/core/shape-types.js +3 -7
- package/dist/board/core/tool-styles.d.ts +2 -1
- package/dist/board/image-key.js +3 -5
- package/dist/board/index.d.ts +9 -4
- package/dist/board/index.js +7 -3
- package/dist/board/media-playback.d.ts +22 -0
- package/dist/board/media-playback.js +67 -0
- package/dist/board/media.d.ts +7 -0
- package/dist/board/media.js +70 -0
- package/dist/board/nodes.d.ts +113 -0
- package/dist/board/nodes.js +154 -0
- package/dist/board/render/index.d.ts +3 -1
- package/dist/board/render/index.js +4 -2
- package/dist/board/render/media-interaction.d.ts +19 -0
- package/dist/board/render/media-interaction.js +26 -0
- package/dist/board/render/renderers/audio-card-renderer.js +1 -1
- package/dist/board/render/renderers/board-renderer-registry.js +2 -2
- package/dist/board/render/renderers/draw-card-renderer.js +1 -1
- package/dist/board/render/renderers/file-card-renderer.js +1 -1
- package/dist/board/render/renderers/frame-card-renderer.js +1 -1
- package/dist/board/render/renderers/geo-card-renderer.js +1 -1
- package/dist/board/render/renderers/image-card-renderer.js +1 -1
- package/dist/board/render/renderers/task-card-renderer.js +16 -13
- package/dist/board/render/renderers/text-card-renderer.js +1 -1
- package/dist/board/render/renderers/unknown-card-renderer.js +1 -1
- package/dist/board/render/renderers/video-card-renderer.js +1 -1
- package/dist/board/render/video-thumbnail.d.ts +16 -0
- package/dist/board/render/video-thumbnail.js +86 -0
- package/dist/board/task.d.ts +10 -5
- package/dist/board/task.js +159 -103
- package/dist/chunks/environment.d.ts +6 -6
- package/dist/chunks/environment.js +6 -6
- package/dist/chunks/http.d.ts +152 -5
- package/dist/chunks/http.js +1707 -169
- package/dist/chunks/transport.js +24 -4
- package/dist/chunks/websocket.d.ts +144 -2
- package/dist/chunks/websocket.js +1 -1
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +273 -4
- package/dist/index.js +275 -741
- package/dist/protocol/dist/board-connection.d.ts +7 -0
- package/dist/protocol/dist/board-connection.js +4 -0
- package/dist/protocol/dist/board-content.d.ts +1 -0
- package/dist/protocol/dist/board-content.js +26 -0
- package/dist/protocol/dist/board-document.d.ts +157 -48
- package/dist/protocol/dist/board-document.js +40 -19
- package/dist/protocol/dist/board-node.d.ts +18 -0
- package/dist/protocol/dist/board-node.js +239 -0
- package/dist/protocol/dist/board-url.d.ts +12 -0
- package/dist/protocol/dist/board-url.js +83 -0
- package/dist/protocol/dist/board.d.ts +5 -0
- package/dist/protocol/dist/identifiers.js +10 -0
- package/dist/protocol/dist/index.d.ts +3 -1
- package/dist/protocol/dist/index.js +7 -1
- package/dist/protocol/dist/provenance.js +2 -0
- package/dist/protocol/dist/ui-command.js +2 -0
- package/dist/protocol/dist/work-promotion-stats.js +11 -0
- package/dist/protocol/dist/work-surface.js +2 -0
- package/dist/protocol/dist/work-view-stats.js +1 -0
- package/docs/work-runtime-guide.md +7 -7
- package/package.json +1 -1
package/dist/board/task.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { normalizeBoardRemoteUrl } from "../protocol/dist/board-url.js";
|
|
2
|
+
import "../protocol/dist/board-document.js";
|
|
1
3
|
//#region src/board/task.ts
|
|
2
4
|
const EXCERPT_LIMIT = 240;
|
|
3
5
|
function record(value) {
|
|
@@ -9,85 +11,12 @@ function cleanExcerpt(value, limit = EXCERPT_LIMIT) {
|
|
|
9
11
|
if (!clean) return void 0;
|
|
10
12
|
return clean.length > limit ? `${clean.slice(0, limit - 3).trimEnd()}...` : clean;
|
|
11
13
|
}
|
|
12
|
-
function parseIpv4(host) {
|
|
13
|
-
const parts = host.split(".").map(Number);
|
|
14
|
-
return parts.length === 4 && parts.every((part) => Number.isInteger(part) && part >= 0 && part <= 255) ? parts : null;
|
|
15
|
-
}
|
|
16
|
-
function isBlockedIpv4(host) {
|
|
17
|
-
const parts = parseIpv4(host);
|
|
18
|
-
if (!parts) return false;
|
|
19
|
-
const [first, second, third] = parts;
|
|
20
|
-
if (first === 0 || first === 10 || first === 127) return true;
|
|
21
|
-
if (first === 100 && second >= 64 && second <= 127) return true;
|
|
22
|
-
if (first === 169 && second === 254) return true;
|
|
23
|
-
if (first === 172 && second >= 16 && second <= 31) return true;
|
|
24
|
-
if (first === 192 && second === 168) return true;
|
|
25
|
-
if (first === 192 && second === 0 && (third === 0 || third === 2)) return true;
|
|
26
|
-
if (first === 192 && second === 88 && third === 99) return true;
|
|
27
|
-
if (first === 198 && (second === 18 || second === 19)) return true;
|
|
28
|
-
if (first === 198 && second === 51 && third === 100) return true;
|
|
29
|
-
if (first === 203 && second === 0 && third === 113) return true;
|
|
30
|
-
return first >= 224;
|
|
31
|
-
}
|
|
32
|
-
function expandIpv6(host) {
|
|
33
|
-
const [head, tail, extra] = host.toLowerCase().split("::");
|
|
34
|
-
if (extra !== void 0) return null;
|
|
35
|
-
const headParts = head ? head.split(":").filter(Boolean) : [];
|
|
36
|
-
const tailParts = tail ? tail.split(":").filter(Boolean) : [];
|
|
37
|
-
const missing = 8 - headParts.length - tailParts.length;
|
|
38
|
-
if (missing < 0 || tail === void 0 && missing !== 0) return null;
|
|
39
|
-
const parts = [
|
|
40
|
-
...headParts,
|
|
41
|
-
...Array.from({ length: missing }, () => "0"),
|
|
42
|
-
...tailParts
|
|
43
|
-
];
|
|
44
|
-
if (parts.length !== 8 || parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return null;
|
|
45
|
-
return parts.map((part) => part.padStart(4, "0"));
|
|
46
|
-
}
|
|
47
|
-
function isBlockedIpv6(host) {
|
|
48
|
-
const parts = expandIpv6(host);
|
|
49
|
-
if (!parts) return true;
|
|
50
|
-
if (parts.every((part) => part === "0000")) return true;
|
|
51
|
-
if (parts.slice(0, 7).every((part) => part === "0000") && parts[7] === "0001") return true;
|
|
52
|
-
if (parts.slice(0, 5).every((part) => part === "0000") && parts[5] === "ffff") {
|
|
53
|
-
const high = Number.parseInt(parts[6] ?? "0", 16);
|
|
54
|
-
const low = Number.parseInt(parts[7] ?? "0", 16);
|
|
55
|
-
return isBlockedIpv4(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);
|
|
56
|
-
}
|
|
57
|
-
if (parts.slice(0, 6).every((part) => part === "0000")) return true;
|
|
58
|
-
const first = Number.parseInt(parts[0] ?? "0", 16);
|
|
59
|
-
if ((first & 65024) === 64512) return true;
|
|
60
|
-
if ((first & 65472) === 65152 || (first & 65472) === 65216) return true;
|
|
61
|
-
if ((first & 65280) === 65280) return true;
|
|
62
|
-
return parts[0] === "2001" && parts[1] === "0db8";
|
|
63
|
-
}
|
|
64
|
-
function isBlockedTaskOutputHost(hostname) {
|
|
65
|
-
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
66
|
-
if (host === "localhost" || host.endsWith(".localhost") || host.endsWith(".local") || host.endsWith(".internal")) return true;
|
|
67
|
-
if (parseIpv4(host)) return isBlockedIpv4(host);
|
|
68
|
-
return host.includes(":") && isBlockedIpv6(host);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Normalize a persistable remote media URL and reject credentialed or visibly
|
|
72
|
-
* non-public hosts. Server-side fetchers must still validate resolved DNS addresses.
|
|
73
|
-
*/
|
|
74
|
-
function normalizeBoardTaskOutputUrl(value) {
|
|
75
|
-
if (typeof value !== "string") return void 0;
|
|
76
|
-
try {
|
|
77
|
-
const url = new URL(value.trim());
|
|
78
|
-
if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
|
|
79
|
-
if (url.username || url.password || isBlockedTaskOutputHost(url.hostname)) return void 0;
|
|
80
|
-
return url.toString();
|
|
81
|
-
} catch {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
14
|
function blockText(block) {
|
|
86
15
|
return cleanExcerpt(block.text ?? block.content ?? block.value);
|
|
87
16
|
}
|
|
88
17
|
function blockUrl(block) {
|
|
89
18
|
const source = record(block.source);
|
|
90
|
-
return
|
|
19
|
+
return normalizeBoardRemoteUrl(source?.url ?? source?.src ?? block.url ?? block.src);
|
|
91
20
|
}
|
|
92
21
|
function blockMimeType(block) {
|
|
93
22
|
const source = record(block.source);
|
|
@@ -122,37 +51,163 @@ function generationPrompt(run) {
|
|
|
122
51
|
if (text) return text;
|
|
123
52
|
}
|
|
124
53
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
54
|
+
function blockMeta(block) {
|
|
55
|
+
return record(block.meta);
|
|
56
|
+
}
|
|
57
|
+
function blockIdentity(block) {
|
|
58
|
+
const meta = blockMeta(block);
|
|
59
|
+
const value = meta?.id ?? meta?.clip_id ?? meta?.clipId ?? block.id ?? block.clip_id ?? block.clipId;
|
|
60
|
+
if (typeof value !== "string" && typeof value !== "number") return void 0;
|
|
61
|
+
return cleanExcerpt(String(value), 220);
|
|
62
|
+
}
|
|
63
|
+
function blockTitle(block) {
|
|
64
|
+
return cleanExcerpt(blockMeta(block)?.title ?? block.title ?? block.name, 240);
|
|
65
|
+
}
|
|
66
|
+
function blockDurationMs(block) {
|
|
67
|
+
const source = record(block.source);
|
|
68
|
+
const meta = blockMeta(block);
|
|
69
|
+
const milliseconds = positiveNumber(source?.durationMs ?? meta?.durationMs ?? block.durationMs);
|
|
70
|
+
if (milliseconds) return Math.round(milliseconds);
|
|
71
|
+
const seconds = positiveNumber(source?.duration ?? meta?.duration ?? block.duration);
|
|
72
|
+
return seconds ? Math.round(seconds * 1e3) : void 0;
|
|
73
|
+
}
|
|
74
|
+
function blockPreviewUrl(block) {
|
|
75
|
+
const source = record(block.source);
|
|
76
|
+
return normalizeBoardRemoteUrl(source?.poster ?? source?.thumbnail ?? source?.previewUrl ?? block.poster ?? block.thumbnail ?? block.previewUrl);
|
|
77
|
+
}
|
|
78
|
+
function artifactId(base, used, suffix) {
|
|
79
|
+
const stem = cleanExcerpt(base, 220) ?? "output";
|
|
80
|
+
let candidate = suffix ? `${stem}-${suffix}` : stem;
|
|
81
|
+
let sequence = 2;
|
|
82
|
+
while (used.has(candidate)) {
|
|
83
|
+
candidate = `${stem}-${suffix ? `${suffix}-` : ""}${sequence}`;
|
|
84
|
+
sequence += 1;
|
|
137
85
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
86
|
+
used.add(candidate);
|
|
87
|
+
return candidate;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Group provider blocks into user-facing works. A cover/poster sharing a stable
|
|
91
|
+
* provider id with playable media belongs to that work instead of becoming a
|
|
92
|
+
* competing image result.
|
|
93
|
+
*/
|
|
94
|
+
function taskArtifacts(blocks) {
|
|
95
|
+
const groups = /* @__PURE__ */ new Map();
|
|
96
|
+
blocks.forEach((block, index) => {
|
|
97
|
+
const key = blockIdentity(block) ?? `output-${index + 1}`;
|
|
98
|
+
const group = groups.get(key);
|
|
99
|
+
if (group) group.push(block);
|
|
100
|
+
else groups.set(key, [block]);
|
|
101
|
+
});
|
|
102
|
+
const artifacts = [];
|
|
103
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
104
|
+
for (const [groupId, blocksInGroup] of groups) {
|
|
105
|
+
const images = blocksInGroup.filter((block) => block.type === "image").map((block) => ({
|
|
106
|
+
block,
|
|
107
|
+
url: blockUrl(block)
|
|
108
|
+
})).filter((entry) => Boolean(entry.url));
|
|
109
|
+
const media = blocksInGroup.filter((block) => block.type === "video" || block.type === "audio").map((block) => ({
|
|
110
|
+
block,
|
|
111
|
+
url: blockUrl(block)
|
|
112
|
+
})).filter((entry) => Boolean(entry.url));
|
|
113
|
+
const pairedPreview = images[0];
|
|
114
|
+
media.forEach(({ block, url }, mediaIndex) => {
|
|
115
|
+
const type = block.type;
|
|
116
|
+
const mimeType = blockMimeType(block);
|
|
117
|
+
const title = blockTitle(block);
|
|
118
|
+
const durationMs = blockDurationMs(block);
|
|
119
|
+
const previewUrl = blockPreviewUrl(block) ?? pairedPreview?.url;
|
|
120
|
+
const id = artifactId(groupId, usedIds, media.length > 1 ? `${type}-${mediaIndex + 1}` : void 0);
|
|
121
|
+
if (type === "video") {
|
|
122
|
+
artifacts.push({
|
|
123
|
+
id,
|
|
124
|
+
type,
|
|
125
|
+
url,
|
|
126
|
+
...title ? { title } : {},
|
|
127
|
+
...previewUrl ? { previewUrl } : {},
|
|
128
|
+
...mimeType ? { mimeType } : {},
|
|
129
|
+
...durationMs ? { durationMs } : {},
|
|
130
|
+
...blockNaturalSize(block)
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
artifacts.push({
|
|
135
|
+
id,
|
|
136
|
+
type,
|
|
137
|
+
url,
|
|
138
|
+
...title ? { title } : {},
|
|
139
|
+
...previewUrl ? { previewUrl } : {},
|
|
140
|
+
...mimeType ? { mimeType } : {},
|
|
141
|
+
...durationMs ? { durationMs } : {}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
const firstUnpairedImage = media.length > 0 ? 1 : 0;
|
|
145
|
+
images.slice(firstUnpairedImage).forEach(({ block, url }, imageIndex) => {
|
|
141
146
|
const mimeType = blockMimeType(block);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const title = blockTitle(block);
|
|
148
|
+
artifacts.push({
|
|
149
|
+
id: artifactId(groupId, usedIds, images.length - firstUnpairedImage > 1 ? `image-${imageIndex + 1}` : void 0),
|
|
150
|
+
type: "image",
|
|
151
|
+
url,
|
|
152
|
+
...title ? { title } : {},
|
|
153
|
+
...mimeType ? { mimeType } : {},
|
|
154
|
+
...blockNaturalSize(block)
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
blocksInGroup.filter((block) => block.type === "text").forEach((block, textIndex, texts) => {
|
|
149
158
|
const textExcerpt = blockText(block);
|
|
150
|
-
if (textExcerpt) return
|
|
159
|
+
if (!textExcerpt) return;
|
|
160
|
+
const title = blockTitle(block);
|
|
161
|
+
artifacts.push({
|
|
162
|
+
id: artifactId(groupId, usedIds, texts.length > 1 ? `text-${textIndex + 1}` : void 0),
|
|
151
163
|
type: "text",
|
|
164
|
+
...title ? { title } : {},
|
|
152
165
|
textExcerpt
|
|
153
|
-
};
|
|
154
|
-
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
155
168
|
}
|
|
169
|
+
return artifacts;
|
|
170
|
+
}
|
|
171
|
+
function artifactScore(artifact) {
|
|
172
|
+
const kind = {
|
|
173
|
+
text: 1,
|
|
174
|
+
image: 2,
|
|
175
|
+
audio: 3,
|
|
176
|
+
video: 4
|
|
177
|
+
}[artifact.type];
|
|
178
|
+
if (artifact.type === "text") return [kind, artifact.textExcerpt.length];
|
|
179
|
+
if (artifact.type === "image") return [kind, (artifact.naturalWidth ?? 0) * (artifact.naturalHeight ?? 0)];
|
|
180
|
+
return [
|
|
181
|
+
kind,
|
|
182
|
+
artifact.previewUrl ? 1 : 0,
|
|
183
|
+
artifact.durationMs ? 1 : 0,
|
|
184
|
+
artifact.durationMs ?? 0
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
function compareArtifacts(a, b) {
|
|
188
|
+
const left = artifactScore(a);
|
|
189
|
+
const right = artifactScore(b);
|
|
190
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
191
|
+
const difference = (right[index] ?? 0) - (left[index] ?? 0);
|
|
192
|
+
if (difference !== 0) return difference;
|
|
193
|
+
}
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
/** Highest-value artifact first, with provider order as the stable final tie. */
|
|
197
|
+
function rankedTaskArtifacts(artifacts) {
|
|
198
|
+
return artifacts.map((artifact, index) => ({
|
|
199
|
+
artifact,
|
|
200
|
+
index
|
|
201
|
+
})).sort((a, b) => compareArtifacts(a.artifact, b.artifact) || a.index - b.index).map(({ artifact }) => artifact);
|
|
202
|
+
}
|
|
203
|
+
function featuredTaskArtifact(artifacts) {
|
|
204
|
+
let featured;
|
|
205
|
+
for (const artifact of artifacts) if (!featured || compareArtifacts(artifact, featured) < 0) featured = artifact;
|
|
206
|
+
return featured;
|
|
207
|
+
}
|
|
208
|
+
function taskArtifactPreviewUrl(artifact) {
|
|
209
|
+
if (artifact?.type === "image") return artifact.url;
|
|
210
|
+
if (artifact?.type === "video" || artifact?.type === "audio") return artifact.previewUrl;
|
|
156
211
|
}
|
|
157
212
|
function taskTypeTitle(taskType) {
|
|
158
213
|
return taskType.replace(/[._-]+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
@@ -166,17 +221,18 @@ function taskRunToBoardTaskSnapshot(run) {
|
|
|
166
221
|
const blocks = run.taskType === "generation" ? generationOutput(run) : [];
|
|
167
222
|
const promptExcerpt = run.taskType === "generation" ? generationPrompt(run) : cleanExcerpt(data?.command ?? data?.prompt ?? data?.title);
|
|
168
223
|
const model = typeof data?.model === "string" ? data.model : void 0;
|
|
169
|
-
const
|
|
224
|
+
const allArtifacts = taskArtifacts(blocks);
|
|
225
|
+
const artifacts = rankedTaskArtifacts(allArtifacts).slice(0, 6);
|
|
170
226
|
return {
|
|
171
227
|
taskType: run.taskType,
|
|
172
228
|
status: run.status,
|
|
173
229
|
title: promptExcerpt ?? taskTypeTitle(run.taskType),
|
|
174
230
|
...model ? { model } : {},
|
|
175
231
|
...promptExcerpt ? { promptExcerpt } : {},
|
|
176
|
-
|
|
177
|
-
|
|
232
|
+
artifactCount: allArtifacts.length,
|
|
233
|
+
artifacts,
|
|
178
234
|
updatedAt: run.updatedAt
|
|
179
235
|
};
|
|
180
236
|
}
|
|
181
237
|
//#endregion
|
|
182
|
-
export {
|
|
238
|
+
export { featuredTaskArtifact, rankedTaskArtifacts, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
type CohubEnvironment = "prod" | "dev";
|
|
3
3
|
declare const COHUB_ENVIRONMENTS: {
|
|
4
4
|
readonly prod: {
|
|
5
|
-
readonly apiBaseUrl: "https://api.cohub.
|
|
6
|
-
readonly websocketUrl: "wss://gateway.cohub.
|
|
7
|
-
readonly voiceInputWebsocketUrl: "wss://gateway.cohub.
|
|
5
|
+
readonly apiBaseUrl: "https://api.cohub.live";
|
|
6
|
+
readonly websocketUrl: "wss://gateway.cohub.live/ws";
|
|
7
|
+
readonly voiceInputWebsocketUrl: "wss://gateway.cohub.live/asr/ws";
|
|
8
8
|
};
|
|
9
9
|
readonly dev: {
|
|
10
|
-
readonly apiBaseUrl: "https://api-dev.cohub.
|
|
11
|
-
readonly websocketUrl: "wss://gateway-dev.cohub.
|
|
12
|
-
readonly voiceInputWebsocketUrl: "wss://gateway-dev.cohub.
|
|
10
|
+
readonly apiBaseUrl: "https://api-dev.cohub.live";
|
|
11
|
+
readonly websocketUrl: "wss://gateway-dev.cohub.live/ws";
|
|
12
|
+
readonly voiceInputWebsocketUrl: "wss://gateway-dev.cohub.live/asr/ws";
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
declare const resolveCohubEnvironment: (env?: CohubEnvironment) => CohubEnvironment;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
//#region src/environment.ts
|
|
2
2
|
const COHUB_ENVIRONMENTS = {
|
|
3
3
|
prod: {
|
|
4
|
-
apiBaseUrl: "https://api.cohub.
|
|
5
|
-
websocketUrl: "wss://gateway.cohub.
|
|
6
|
-
voiceInputWebsocketUrl: "wss://gateway.cohub.
|
|
4
|
+
apiBaseUrl: "https://api.cohub.live",
|
|
5
|
+
websocketUrl: "wss://gateway.cohub.live/ws",
|
|
6
|
+
voiceInputWebsocketUrl: "wss://gateway.cohub.live/asr/ws"
|
|
7
7
|
},
|
|
8
8
|
dev: {
|
|
9
|
-
apiBaseUrl: "https://api-dev.cohub.
|
|
10
|
-
websocketUrl: "wss://gateway-dev.cohub.
|
|
11
|
-
voiceInputWebsocketUrl: "wss://gateway-dev.cohub.
|
|
9
|
+
apiBaseUrl: "https://api-dev.cohub.live",
|
|
10
|
+
websocketUrl: "wss://gateway-dev.cohub.live/ws",
|
|
11
|
+
voiceInputWebsocketUrl: "wss://gateway-dev.cohub.live/asr/ws"
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
const readRuntimeEnv = () => {
|
package/dist/chunks/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as CreateInvitationInput, $n as SpaceFsPreparingFile, Ar as SpaceTurnAuthorFilter, At as MeResponse, Ba as BoardConnectionRecord, Bn as SpaceDefaultResponse, Cr as SpacePublicProfile, Ct as LabelItemsResponse, Dn as SpaceCommerceBenefit, Dt as LabelResourceType, Ea as BoardValidationResult, Ei as SessionTurnPatchEvent, En as SpaceCheckpointDetailResponse, G as CheckpointDiffFileResponse, Ga as SessionForkRecord, Gn as SpaceFsCreateUploadInput, Gt as ReferenceAggregateResponse, H as Channel, Hn as SpaceFsCompleteUploadInput, Hr as UserProfile, In as SpaceConfigInput, Ir as TaskRunDetailResponse, Ja as SessionTurnRecord, 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, On as SpaceCommerceBuyerProfile, Pr as SpaceUsageResponse, Pt as Permission, Q as ClaimReferralResponse, Qn as SpaceFsMoveInput, Qt as ReferralDashboard, Ra as BoardConnection, Ri as WorkContentKind, Rn as SpaceConfigUpdateResponse, Rr as UserActivityQuery, Rt as PublicReferral, St as LabelAssignmentRecord, Ta as BoardTransaction, Tr as SpaceRole, Tt as LabelListItem, Ua as SpacePublicEndpoints, Un as SpaceFsCompleteUploadResponse, Ur as UserRulesResponse, Vn as SpaceEnvInput, Vr as UserActivityResponse, Wa as MessageRecord, Wt as ReferenceAggregateGroupBy, X as CheckpointDiffSummary, Xi as UiCommandStatus, Ya as SpaceTurnsResponse, Yi as UiCommandRecord, Yt as ReferenceQueryableType, Z as CheckpointRecord, Zn as SpaceFsFileResponse, _n as SkillCatalogResponse, a as WebsocketClientOptions, aa as BoardBootstrap, ao as Usage, at as CreateSpaceSessionInput, bn as SpaceAccessPolicy, br as SpacePendingDiffSummary, ca as BoardCreateInput, cn as SessionMessagesResponse, ct as CronJobUpdatePatch, d as BatchUserProfilesResponse, di as GenerationContentBlock, dn as SessionTurnResponse, do as RequestSource, dr as SpaceFsWriteFileInput, et as CreateInvitationResponse, fa as BoardInspectInput, fi as GenerationModelDeclaration, fn as SessionTurnSignedUrlsResponse, gi as BoardTransactionAppliedEvent$1, gr as SpaceMember, gt as InvitationDetail, hi as BoardPlaybackChangedEvent$1, hn as SessionTurnsPaginatedResponse, ht as GlobalSearchType, io as SpaceCompletionStreamEvent, it as CreateSpacePromptResponse, ji as BoardAwarenessUpdate, jn as SpaceCommerceOrder, jt as ModelCatalogEntry, kr as SpaceSessionsResponse, l as AcceptInvitationResponse, ln as SessionRecord, lt as CursorPageInfo, mi as BoardAwarenessUpdatedEvent$1, mn as SessionTurnWindowResponse, nr as SpaceFsReadFilesResponse, oa as BoardCapabilities, on as SessionMessageResponse, oo as BillingPayload, pn as SessionTurnStreamSnapshotResponse, pr as SpaceInvitationListResponse, pt as GlobalSearchResponse, qr as ChannelConfig, qt as ReferenceKind, r as WebsocketClient, ro as SpaceCompletionResult, rr as SpaceFsTreeResponse, rt as CreateSpacePromptInput, s as WebsocketEventPayload, sn as SessionMessagesPaginatedResponse, so as ContentBlock, st as CronJobRecord, to as CreateSpaceCompletionInput, tt as CreateSpaceInput, un as SessionTurnIndexResponse, ur as SpaceFsUploadResponse, va as BoardPlaybackCommand, vr as SpaceModListItem, wr as SpaceRecord, xa as BoardPlaybackSnapshot, xr as SpacePresenceSnapshot, yi as RealtimePatchOperation, yr as SpacePendingDiffFileResponse, za as BoardConnectionDirection, 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
|
|
@@ -161,6 +161,49 @@ type SpaceStartupResponse = {
|
|
|
161
161
|
retryAfterMs?: number;
|
|
162
162
|
};
|
|
163
163
|
//#endregion
|
|
164
|
+
//#region ../protocol/dist/public-files.d.ts
|
|
165
|
+
type PublicFileUploadEntryInput = {
|
|
166
|
+
id: string;
|
|
167
|
+
relativePath: string;
|
|
168
|
+
size: number;
|
|
169
|
+
mimeType?: string | null;
|
|
170
|
+
};
|
|
171
|
+
type PublicFileCreateUploadInput = {
|
|
172
|
+
entries: PublicFileUploadEntryInput[];
|
|
173
|
+
overwrite?: boolean;
|
|
174
|
+
};
|
|
175
|
+
type PublicFileUploadPlanEntry = {
|
|
176
|
+
id: string;
|
|
177
|
+
path: string;
|
|
178
|
+
uploadUrl: string;
|
|
179
|
+
publicUrl: string;
|
|
180
|
+
headers?: Record<string, string>;
|
|
181
|
+
};
|
|
182
|
+
type PublicFileCreateUploadResponse = {
|
|
183
|
+
entries: PublicFileUploadPlanEntry[];
|
|
184
|
+
};
|
|
185
|
+
type PublicFileListEntry = {
|
|
186
|
+
path: string;
|
|
187
|
+
name: string;
|
|
188
|
+
kind: "file" | "directory";
|
|
189
|
+
size: number | null;
|
|
190
|
+
updatedAt: string | null;
|
|
191
|
+
publicUrl: string | null;
|
|
192
|
+
};
|
|
193
|
+
type PublicFileListResponse = {
|
|
194
|
+
path: string;
|
|
195
|
+
entries: PublicFileListEntry[];
|
|
196
|
+
nextCursor: string | null;
|
|
197
|
+
};
|
|
198
|
+
type PublicFileUrlResponse = {
|
|
199
|
+
path: string;
|
|
200
|
+
url: string;
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region ../protocol/dist/work-promotion-stats.d.ts
|
|
204
|
+
declare const WORK_PROMOTION_EVENT_KEYS: readonly ["landing", "ready", "registration_completed", "paywall_viewed", "checkout_started"];
|
|
205
|
+
type WorkPromotionEventKey = typeof WORK_PROMOTION_EVENT_KEYS[number];
|
|
206
|
+
//#endregion
|
|
164
207
|
//#region src/work-runtime.d.ts
|
|
165
208
|
type WorkRuntimeContext = {
|
|
166
209
|
work: {
|
|
@@ -293,7 +336,7 @@ declare class WorkRuntimeApi {
|
|
|
293
336
|
type WorkRuntimeModeConfig = {
|
|
294
337
|
/** Explicit mode selection. When omitted, auto-detection is used. */
|
|
295
338
|
mode?: "bridge" | "broker";
|
|
296
|
-
/** Cohub origin for the broker page (e.g. "https://cohub.
|
|
339
|
+
/** Cohub origin for the broker page (e.g. "https://cohub.live"). */
|
|
297
340
|
brokerOrigin?: string;
|
|
298
341
|
/**
|
|
299
342
|
* The work's public id. Required for broker mode unless the slug triple
|
|
@@ -961,12 +1004,38 @@ declare class SpacesApi {
|
|
|
961
1004
|
getBySlug(username: string, slug: string, customFetch?: Fetch): Promise<SpaceRecord>;
|
|
962
1005
|
create(input: CreateSpaceInput, headers?: Record<string, string>): Promise<SpaceCreateResponse>;
|
|
963
1006
|
}
|
|
1007
|
+
type SpaceFileUrlPurpose = "preview" | "playback";
|
|
1008
|
+
type ResolveSpaceFileUrlOptions = {
|
|
1009
|
+
/** Playback only accepts a streamable URL; previews may fall back to a data URL. */
|
|
1010
|
+
purpose?: SpaceFileUrlPurpose;
|
|
1011
|
+
/** Maximum time to wait while CDN delivery is being prepared. */
|
|
1012
|
+
timeoutMs?: number;
|
|
1013
|
+
signal?: AbortSignal;
|
|
1014
|
+
fetch?: Fetch;
|
|
1015
|
+
};
|
|
1016
|
+
declare class SpacePublicFilesApi {
|
|
1017
|
+
private readonly transport;
|
|
1018
|
+
private readonly spaceId;
|
|
1019
|
+
constructor(transport: HttpTransport, spaceId: string);
|
|
1020
|
+
createUpload(input: PublicFileCreateUploadInput, options?: {
|
|
1021
|
+
signal?: AbortSignal;
|
|
1022
|
+
}): Promise<PublicFileCreateUploadResponse>;
|
|
1023
|
+
list(path?: string, options?: {
|
|
1024
|
+
recursive?: boolean;
|
|
1025
|
+
limit?: number;
|
|
1026
|
+
cursor?: string;
|
|
1027
|
+
fetch?: Fetch;
|
|
1028
|
+
}): Promise<PublicFileListResponse>;
|
|
1029
|
+
url(path: string, customFetch?: Fetch): Promise<PublicFileUrlResponse>;
|
|
1030
|
+
}
|
|
964
1031
|
declare class SpaceFilesApi {
|
|
965
1032
|
private readonly transport;
|
|
966
1033
|
private readonly spaceId;
|
|
967
1034
|
constructor(transport: HttpTransport, spaceId: string);
|
|
968
1035
|
list(path?: string, customFetch?: Fetch): Promise<SpaceFsTreeResponse>;
|
|
969
|
-
read(path: string, customFetch?: Fetch): Promise<SpaceFsFileResponse | SpaceFsPreparingFile>;
|
|
1036
|
+
read(path: string, customFetch?: Fetch, signal?: AbortSignal): Promise<SpaceFsFileResponse | SpaceFsPreparingFile>;
|
|
1037
|
+
/** Resolve a browser-ready file URL, waiting for CDN delivery when necessary. */
|
|
1038
|
+
resolveUrl(path: string, options?: ResolveSpaceFileUrlOptions): Promise<string | null>;
|
|
970
1039
|
/** Pending workspace changes vs the space head checkpoint. */
|
|
971
1040
|
diff(customFetch?: Fetch): Promise<SpacePendingDiffSummary>;
|
|
972
1041
|
/** Per-file pending workspace diff vs the space head checkpoint. */
|
|
@@ -1475,6 +1544,8 @@ declare class BoardClient {
|
|
|
1475
1544
|
relation?: string;
|
|
1476
1545
|
direction?: BoardConnectionDirection;
|
|
1477
1546
|
label?: string;
|
|
1547
|
+
sourcePortId?: string;
|
|
1548
|
+
targetPortId?: string;
|
|
1478
1549
|
txId?: string;
|
|
1479
1550
|
}): Promise<BoardBootstrap>;
|
|
1480
1551
|
/** Remove a connection. The nodes it joined are untouched. */
|
|
@@ -1600,6 +1671,7 @@ declare class SpaceClient {
|
|
|
1600
1671
|
private readonly transport;
|
|
1601
1672
|
private readonly websocketClient;
|
|
1602
1673
|
readonly files: SpaceFilesApi;
|
|
1674
|
+
readonly publicFiles: SpacePublicFilesApi;
|
|
1603
1675
|
readonly sessions: SpaceSessionsApi;
|
|
1604
1676
|
readonly turns: SpaceTurnsApi;
|
|
1605
1677
|
readonly members: SpaceMembersApi;
|
|
@@ -1744,7 +1816,7 @@ declare class UserApi {
|
|
|
1744
1816
|
space: SpaceRecord;
|
|
1745
1817
|
session: SessionRecord;
|
|
1746
1818
|
}>;
|
|
1747
|
-
|
|
1819
|
+
getActivity(options?: UserActivityQuery, customFetch?: Fetch): Promise<UserActivityResponse>;
|
|
1748
1820
|
setAuthToken(token: string): Promise<any>;
|
|
1749
1821
|
clearAuthToken(): Promise<null>;
|
|
1750
1822
|
}
|
|
@@ -1948,6 +2020,54 @@ type WorkViewStatsResponse = {
|
|
|
1948
2020
|
views: number;
|
|
1949
2021
|
}>;
|
|
1950
2022
|
};
|
|
2023
|
+
type WorkPromotionProvider = "generic" | "meta";
|
|
2024
|
+
type WorkPromotionRecord = {
|
|
2025
|
+
id: string;
|
|
2026
|
+
workId: string;
|
|
2027
|
+
name: string;
|
|
2028
|
+
provider: WorkPromotionProvider | string;
|
|
2029
|
+
parameters: Record<string, string>;
|
|
2030
|
+
createdBy: string;
|
|
2031
|
+
createdAt: string;
|
|
2032
|
+
};
|
|
2033
|
+
type WorkPromotionProviderStatus = {
|
|
2034
|
+
key: WorkPromotionProvider | string;
|
|
2035
|
+
configured: boolean;
|
|
2036
|
+
};
|
|
2037
|
+
type WorkPromotionCreateInput = {
|
|
2038
|
+
name: string;
|
|
2039
|
+
provider: WorkPromotionProvider | string;
|
|
2040
|
+
parameters: Record<string, string>;
|
|
2041
|
+
};
|
|
2042
|
+
type WorkPromotionStatsResponse = {
|
|
2043
|
+
promotion: WorkPromotionRecord;
|
|
2044
|
+
summary: {
|
|
2045
|
+
landing: number;
|
|
2046
|
+
ready: number;
|
|
2047
|
+
registrationCompleted: number;
|
|
2048
|
+
paywallViewed: number;
|
|
2049
|
+
checkoutStarted: number;
|
|
2050
|
+
readyRate: number;
|
|
2051
|
+
};
|
|
2052
|
+
daily: Array<{
|
|
2053
|
+
date: string;
|
|
2054
|
+
landing: number;
|
|
2055
|
+
ready: number;
|
|
2056
|
+
registrationCompleted: number;
|
|
2057
|
+
paywallViewed: number;
|
|
2058
|
+
checkoutStarted: number;
|
|
2059
|
+
}>;
|
|
2060
|
+
};
|
|
2061
|
+
type WorkPromotionEventResponse = {
|
|
2062
|
+
ok: true;
|
|
2063
|
+
eventId: string;
|
|
2064
|
+
browser: {
|
|
2065
|
+
provider: "generic";
|
|
2066
|
+
} | {
|
|
2067
|
+
provider: "meta";
|
|
2068
|
+
pixelId: string;
|
|
2069
|
+
} | null;
|
|
2070
|
+
};
|
|
1951
2071
|
type WorkSessionResponse = {
|
|
1952
2072
|
token: string;
|
|
1953
2073
|
expiresIn: number;
|
|
@@ -1987,6 +2107,31 @@ declare class WorksApi {
|
|
|
1987
2107
|
ok: true;
|
|
1988
2108
|
}>;
|
|
1989
2109
|
getStats(workId: string): Promise<WorkViewStatsResponse>;
|
|
2110
|
+
listPromotions(workId: string): Promise<{
|
|
2111
|
+
promotions: WorkPromotionRecord[];
|
|
2112
|
+
providers: WorkPromotionProviderStatus[];
|
|
2113
|
+
}>;
|
|
2114
|
+
createPromotion(workId: string, input: WorkPromotionCreateInput): Promise<{
|
|
2115
|
+
promotion: WorkPromotionRecord;
|
|
2116
|
+
}>;
|
|
2117
|
+
getPromotionStats(workId: string, promotionId: string): Promise<WorkPromotionStatsResponse>;
|
|
2118
|
+
recordPromotionEvent(workId: string, promotionId: string, input: {
|
|
2119
|
+
eventKey: WorkPromotionEventKey;
|
|
2120
|
+
eventId?: string;
|
|
2121
|
+
sourceUrl?: string;
|
|
2122
|
+
fbp?: string;
|
|
2123
|
+
fbc?: string;
|
|
2124
|
+
productKey?: string;
|
|
2125
|
+
}): Promise<WorkPromotionEventResponse>;
|
|
2126
|
+
recordPromotionRegistration(workId: string, promotionId: string, input?: {
|
|
2127
|
+
sourceUrl?: string;
|
|
2128
|
+
fbp?: string;
|
|
2129
|
+
fbc?: string;
|
|
2130
|
+
}): Promise<{
|
|
2131
|
+
reported: boolean;
|
|
2132
|
+
eventId: string | null;
|
|
2133
|
+
browser: WorkPromotionEventResponse["browser"];
|
|
2134
|
+
}>;
|
|
1990
2135
|
listVersions(workId: string): Promise<{
|
|
1991
2136
|
versions: WorkVersionRecord[];
|
|
1992
2137
|
}>;
|
|
@@ -2038,6 +2183,8 @@ type WorkCommercePurchaseResponse = {
|
|
|
2038
2183
|
message: string | null;
|
|
2039
2184
|
orderId: string;
|
|
2040
2185
|
productKey: string;
|
|
2186
|
+
value: number | null;
|
|
2187
|
+
currency: string | null;
|
|
2041
2188
|
};
|
|
2042
2189
|
};
|
|
2043
2190
|
type WorkCommerceOrder = {
|
|
@@ -2098,4 +2245,4 @@ declare class CohubHttpClient {
|
|
|
2098
2245
|
}
|
|
2099
2246
|
declare const createHttpClient: (options?: CohubClientOptions) => CohubHttpClient;
|
|
2100
2247
|
//#endregion
|
|
2101
|
-
export {
|
|
2248
|
+
export { BoardTransactionError as $, GenerationsApi as $t, WorkResolveResponse as A, PublicFileUploadPlanEntry as An, SessionPatchApplyInput as At, ReferralsApi as B, ModelStatusResponse as Bn, CreatePublicAssetUploadInput as Bt, WorkPromotionProvider as C, createWorkRuntime as Cn, GenerationStreamStateEvent as Ct, WorkPublicOwnerRecord as D, PublicFileListEntry as Dn, SessionGenerationStreamClient as Dt, WorkPromotionStatsResponse as E, PublicFileCreateUploadResponse as En, GenerationStreamTurnUpdatedEvent as Et, WorkVersionRecord as F, GenerationTaskResult as Fn, createSessionPatchReducer as Ft, WaitForUiCommandOptions as G, PublicAssetUploadProtocol as Gt, UserApi as H, PublicAssetMimeType as Ht, WorkViewSource as I, GenerationUsageBilling as In, SessionAccessApi as It, BoardClient as J, UploadChatImageAttachmentInput as Jt, TasksApi as K, PublicAssetsApi as Kt, WorkViewStatsResponse as L, ListGenerationModelsResponse as Ln, ReferenceResourceSelector as Lt, WorkStatus as M, SpaceStartupResponse as Mn, SessionPatchReducer as Mt, WorkTargetType as N, CreateGenerationTaskRequest as Nn, SessionPatchState as Nt, WorkPublicSpaceRecord as O, PublicFileListResponse as On, createSessionGenerationStreamClient as Ot, WorkUpdateInput as P, CreateGenerationTaskResponse as Pn, SessionPatchStatus as Pt, BoardTransactionAppliedEvent as Q, ModelsApi as Qt, WorkVisibility as R, PublicGenerationDeclaration as Rn, ReferencesApi as Rt, WorkPromotionEventResponse as S, createSlugWorkIdResolver as Sn, GenerationStreamOutOfSyncEvent as St, WorkPromotionRecord as T, PublicFileCreateUploadInput as Tn, GenerationStreamSubscriptionHandlers as Tt, CreateUiCommandInput as U, PublicAssetPurpose as Ut, UsersApi as V, CreatePublicAssetUploadResponse as Vt, UiCommandsApi as W, PublicAssetUploadProgress as Wt, BoardPlaybackChangedEvent as X, SkillsApi as Xt, BoardEventName as Y, UploadPublicAssetInput as Yt, BoardSubscriptionHandlers as Z, PromptsApi as Zt, WorkExtractedPageMeta as _, WorkRuntimeCheckoutStatus as _n, GenerationStreamErrorEvent as _t, WorkCommerceCreditConsumeResponse as a, HttpTraceContext as an, SpaceEventName as at, WorkPresentationMeta as b, WorkRuntimeRequestOptions as bn, GenerationStreamIntermediateMessage as bt, WorkCommerceEntitlementsResponse as c, UnauthorizedContext as cn, SpacesApi as ct, WorkCommercePurchaseResponse as d, sanitizeAccessToken as dn, BuildSpacePathInput as dt, CronJobsApi as en, BoardTransactionInput as et, WorkAuthorizeResponse as f, ParentBridgeTransport as fn, PublicInviteApi as ft, WorkDetailResponse as g, WorkRuntimeCheckoutState as gn, GenerationStreamCommitEvent as gt, WorkCreateInput as h, WorkRuntimeApi as hn, AssistantMessageCommit as ht, WorkCommerceCheckoutStatus as i, HttpError as in, SpaceClient as it, WorkSessionResponse as j, PublicFileUrlResponse as jn, SessionPatchApplyResult as jt, WorkRecord as k, PublicFileUploadEntryInput as kn, parseAssistantMessageCommit as kt, WorkCommerceOrder as l, joinApiUrl as ln, WebSocketConnectionState as lt, WorkContentDownload as m, WorkIdResolver as mn, buildSpacePath as mt, createHttpClient as n, CohubClientOptions as nn, SessionSubscriptionHandlers as nt, WorkCommerceCreditConsumeStatus as o, HttpTransport as on, SpacePublicFilesApi as ot, WorkContent as p, PopupBrokerTransport as pn, buildSpaceInvitePath as pt, BoardAwarenessUpdatedEvent as q, UploadChatAttachmentInput as qt, WorkCommerceApi as r, Fetch as rn, SpaceChannelBindingRecord as rt, WorkCommerceEntitlement as s, RawHttpResponse as sn, SpaceTurnListOptions as st, CohubHttpClient as t, ChannelsApi as tn, SessionEventName as tt, WorkCommerceProductResolveResponse as u, matchesUnauthorizedErrorToken as un, BuildSpaceInvitePathInput as ut, WorkGetResponse as v, WorkRuntimeContext as vn, GenerationStreamEvent as vt, WorkPromotionProviderStatus as w, resolveWorkTransport as wn, GenerationStreamSubscribeOptions as wt, WorkPromotionCreateInput as x, WorkRuntimeTransport as xn, GenerationStreamLifecycleEvent as xt, WorkMeta as y, WorkRuntimeModeConfig as yn, GenerationStreamFinalizedEvent as yt, WorksApi as z, ModelStatusEntry as zn, SearchApi as zt };
|