@vivix-labs/studio-workbench 1.0.0-beta.2 → 1.0.0-beta.20
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/assets/add-circle-RPMXNTWW.svg +4 -0
- package/dist/assets/copy-document-EF4PHM7F.svg +10 -0
- package/dist/assets/create-custom-view-WUWJL7YC.svg +5 -0
- package/dist/assets/crop-5JXWHIPN.svg +6 -0
- package/dist/assets/dashboard-overview-Y32BCZQC.svg +8 -0
- package/dist/assets/dashboard-views-GOG66UAH.svg +7 -0
- package/dist/assets/delete-4Y3OUMEL.svg +8 -0
- package/dist/assets/download-VTKCEAZG.svg +6 -0
- package/dist/assets/favorite-6GMNHJCN.svg +5 -0
- package/dist/assets/favorite-filled-FR74TEBM.svg +3 -0
- package/dist/assets/filter-JSDZZVGN.svg +5 -0
- package/dist/assets/fullscreen-exit-ADYOPBYH.svg +3 -0
- package/dist/assets/inria-serif-latin-400-italic-ZCFRMMVP.woff2 +0 -0
- package/dist/assets/inter-latin-900-normal-FKACR3DR.woff2 +0 -0
- package/dist/assets/refresh-WQ3CTB57.svg +3 -0
- package/dist/assets/replace-PJXDOQDX.svg +3 -0
- package/dist/assets/{search-JUOSGQRM.svg → search-FMYQZJWA.svg} +1 -1
- package/dist/assets/select-items-GJZIVO37.svg +6 -0
- package/dist/assets/trim-LQMHHN2M.svg +9 -0
- package/dist/assets/upload-U5RZT5QI.svg +5 -0
- package/dist/assets/welcome-add-HS6LIH63.svg +5 -0
- package/dist/assets/welcome-close-NOBXBZOT.svg +5 -0
- package/dist/assets/welcome-product-ad-YRPDJRAH.png +0 -0
- package/dist/assets/welcome-short-drama-YDTZHBGK.png +0 -0
- package/dist/client.bundle.js +2727 -1094
- package/dist/client.css +1838 -295
- package/dist/server.d.ts +1 -0
- package/dist/server.js +326 -36
- package/dist/shared.d.ts +27 -1
- package/dist/shared.js +2 -1
- package/package.json +25 -25
- package/presets/table.json +4 -4
- package/presets/user-base.json +13 -9
- package/skills/SKILL.md +20 -39
- package/skills/references/assets-and-views.md +6 -6
- package/skills/references/sql-custom-views.md +2 -0
- package/skills/scripts/initialize-home.mjs +350 -119
- package/dist/assets/player-cover-shade-LLH6KOCQ.png +0 -0
package/dist/server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ServerContext } from 'vivix-studio/sdk/server';
|
|
|
2
2
|
import { WorkbenchConfig } from './shared.js';
|
|
3
3
|
export { Config } from './shared.js';
|
|
4
4
|
import 'vivix-studio/sdk/shared';
|
|
5
|
+
import 'vivix-studio/sdk/client';
|
|
5
6
|
|
|
6
7
|
declare const dependencies: (config: WorkbenchConfig) => string[];
|
|
7
8
|
declare function activate(ctx: ServerContext<WorkbenchConfig>): void;
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// packages/studio-workbench/src/server.ts
|
|
2
|
+
import { execFile } from "child_process";
|
|
2
3
|
import { createReadStream } from "fs";
|
|
3
|
-
import { stat } from "fs/promises";
|
|
4
|
+
import { readFile, stat } from "fs/promises";
|
|
5
|
+
import { dirname, join } from "path";
|
|
4
6
|
import { Readable as Readable2 } from "stream";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
import { promisify } from "util";
|
|
9
|
+
import { defineOperation as defineOperation2, PluginError } from "vivix-studio/sdk/server";
|
|
10
|
+
import { z as z6 } from "vivix-studio/sdk/shared";
|
|
7
11
|
|
|
8
12
|
// packages/studio-workbench/src/shared.ts
|
|
9
13
|
import { z } from "vivix-studio/sdk/shared";
|
|
@@ -18,7 +22,8 @@ var Config = z.object({
|
|
|
18
22
|
libraryInstance: z.string().min(1).nullable().default(null),
|
|
19
23
|
libraryServiceInstance: z.string().min(1).nullable().default(null),
|
|
20
24
|
views: z.object({
|
|
21
|
-
assetList: uiReference.optional()
|
|
25
|
+
assetList: uiReference.optional(),
|
|
26
|
+
projectCreator: uiReference.optional()
|
|
22
27
|
}).strict().default({}),
|
|
23
28
|
dashboard: z.array(uiReference).optional(),
|
|
24
29
|
savedViews: z.array(z.union([uiReference, savedProjectView])).default([]),
|
|
@@ -26,34 +31,202 @@ var Config = z.object({
|
|
|
26
31
|
}).strict();
|
|
27
32
|
|
|
28
33
|
// packages/studio-workbench/src/query-view.ts
|
|
34
|
+
import { z as z4 } from "vivix-studio/sdk/shared";
|
|
35
|
+
|
|
36
|
+
// packages/project-studio/src/cost.ts
|
|
37
|
+
var creditsFormat = new Intl.NumberFormat("en-US", {
|
|
38
|
+
minimumFractionDigits: 1,
|
|
39
|
+
maximumFractionDigits: 1,
|
|
40
|
+
useGrouping: false
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// packages/project-studio/src/shared.ts
|
|
44
|
+
import { z as z3, defineOperation } from "vivix-studio/sdk/shared";
|
|
45
|
+
|
|
46
|
+
// packages/project-studio/src/ads-shared.ts
|
|
29
47
|
import { z as z2 } from "vivix-studio/sdk/shared";
|
|
48
|
+
var fixedRef = z2.object({ storeId: z2.uuid(), objectId: z2.uuid(), versionId: z2.uuid() }).strict();
|
|
49
|
+
var copy = z2.string().max(8e3).default("");
|
|
50
|
+
var clipScript = z2.object({
|
|
51
|
+
title: z2.string().trim().min(1).max(200),
|
|
52
|
+
visual: copy,
|
|
53
|
+
voiceover: copy,
|
|
54
|
+
onScreenText: copy,
|
|
55
|
+
cta: copy,
|
|
56
|
+
plannedDurationMs: z2.number().int().positive().nullable().default(null)
|
|
57
|
+
}).strict();
|
|
58
|
+
var adBrief = z2.object({
|
|
59
|
+
product: copy,
|
|
60
|
+
category: copy,
|
|
61
|
+
audience: copy,
|
|
62
|
+
sellingPoints: copy,
|
|
63
|
+
channel: copy,
|
|
64
|
+
aspectRatio: z2.string().max(40).nullable().default(null),
|
|
65
|
+
targetDurationMs: z2.number().int().positive().nullable().default(null),
|
|
66
|
+
body: copy,
|
|
67
|
+
productRefs: z2.array(fixedRef).max(100).default([]),
|
|
68
|
+
modelRefs: z2.array(fixedRef).max(100).default([])
|
|
69
|
+
}).strict();
|
|
70
|
+
var adFilm = z2.object({
|
|
71
|
+
title: z2.string().trim().min(1).max(150),
|
|
72
|
+
source: fixedRef,
|
|
73
|
+
width: z2.number().int().positive().max(8192),
|
|
74
|
+
height: z2.number().int().positive().max(8192),
|
|
75
|
+
aspectRatio: z2.string().regex(/^\d+:\d+$/)
|
|
76
|
+
}).strict();
|
|
77
|
+
var adStoryboard = z2.object({
|
|
78
|
+
brief: adBrief,
|
|
79
|
+
films: z2.array(adFilm).max(100).optional(),
|
|
80
|
+
clips: z2.array(
|
|
81
|
+
z2.object({
|
|
82
|
+
assetId: z2.uuid(),
|
|
83
|
+
filmId: z2.uuid().optional(),
|
|
84
|
+
script: clipScript,
|
|
85
|
+
edits: z2.array(z2.object({ sourceVersionId: z2.uuid(), editRef: fixedRef }).strict()).max(200)
|
|
86
|
+
}).strict()
|
|
87
|
+
).max(200)
|
|
88
|
+
}).strict().superRefine((value, context) => {
|
|
89
|
+
if (new Set(value.clips.map((c) => c.assetId)).size !== value.clips.length)
|
|
90
|
+
context.addIssue({ code: "custom", message: "A clip can appear only once in a storyboard." });
|
|
91
|
+
for (const clip of value.clips)
|
|
92
|
+
if (new Set(clip.edits.map((e) => e.sourceVersionId)).size !== clip.edits.length)
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: "custom",
|
|
95
|
+
message: "Each candidate has one current edit binding."
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// packages/project-studio/src/shared.ts
|
|
100
|
+
var projectType = z3.enum(["short-drama", "product-ad", "other"]);
|
|
101
|
+
var studioConfig = z3.object({
|
|
102
|
+
role: z3.enum(["project", "coordinator"]).default("project"),
|
|
103
|
+
projectType: projectType.optional(),
|
|
104
|
+
dataInstance: z3.string().min(1).default("user:data"),
|
|
105
|
+
apiInstance: z3.string().min(1).default("api"),
|
|
106
|
+
libraryInstance: z3.string().min(1).nullable().default(null),
|
|
107
|
+
coordinatorInstance: z3.string().min(1).optional()
|
|
108
|
+
}).strict();
|
|
109
|
+
var versionRef = z3.object({ storeId: z3.uuid(), objectId: z3.uuid(), versionId: z3.uuid() }).strict();
|
|
110
|
+
var tags = z3.array(z3.string().trim().min(1).max(64)).max(50).transform((x) => [...new Set(x)]).default([]);
|
|
111
|
+
var kind = z3.enum(["text", "image", "video", "audio", "file"]);
|
|
112
|
+
var projectData = z3.object({
|
|
113
|
+
name: z3.string().trim().min(1).max(120),
|
|
114
|
+
description: z3.string().max(4e3).default(""),
|
|
115
|
+
status: z3.enum(["draft", "active", "archived"]).default("draft"),
|
|
116
|
+
aspectRatio: z3.string().nullable().default(null),
|
|
117
|
+
projectType: projectType.optional(),
|
|
118
|
+
coverRef: versionRef.nullable().default(null),
|
|
119
|
+
briefRef: z3.object({ storeId: z3.uuid(), objectId: z3.uuid() }).strict().nullable().default(null),
|
|
120
|
+
tags
|
|
121
|
+
}).strict();
|
|
122
|
+
var assetData = z3.object({
|
|
123
|
+
projectId: z3.uuid(),
|
|
124
|
+
name: z3.string().trim().min(1).max(200),
|
|
125
|
+
kind,
|
|
126
|
+
purpose: z3.enum(["reference", "script", "shot", "music", "voice", "subtitle", "final", "other"]).default("other"),
|
|
127
|
+
origin: z3.enum(["upload", "library", "generated", "authored"]),
|
|
128
|
+
orderKey: z3.number().int().nullable().default(null),
|
|
129
|
+
tags,
|
|
130
|
+
lifecycle: z3.enum(["draft", "ready", "archived"]).default("draft"),
|
|
131
|
+
sourceRef: versionRef.nullable().default(null),
|
|
132
|
+
adoptedVersionId: z3.uuid().nullable().default(null)
|
|
133
|
+
}).strict();
|
|
134
|
+
var anchor = z3.discriminatedUnion("kind", [
|
|
135
|
+
z3.object({ kind: z3.literal("whole") }).strict(),
|
|
136
|
+
z3.object({
|
|
137
|
+
kind: z3.literal("timeRange"),
|
|
138
|
+
startMs: z3.number().int().nonnegative(),
|
|
139
|
+
endMs: z3.number().int().nonnegative()
|
|
140
|
+
}).strict()
|
|
141
|
+
]);
|
|
142
|
+
var generationInput = z3.object({
|
|
143
|
+
targetAssetId: z3.uuid().optional(),
|
|
144
|
+
taskName: z3.string().trim().min(1).max(200).optional(),
|
|
145
|
+
context: z3.record(z3.string().min(1).max(64), z3.string().min(1).max(200)).optional(),
|
|
146
|
+
expectedRevision: z3.number().int().positive().optional(),
|
|
147
|
+
newAsset: z3.object({
|
|
148
|
+
name: z3.string().trim().min(1).max(200),
|
|
149
|
+
kind: z3.enum(["image", "video", "audio"])
|
|
150
|
+
}).strict().optional(),
|
|
151
|
+
modelId: z3.string().min(1),
|
|
152
|
+
capabilityId: z3.string().min(1),
|
|
153
|
+
prompt: z3.string().max(32e3),
|
|
154
|
+
parameters: z3.record(z3.string(), z3.unknown()).default({}),
|
|
155
|
+
outputCount: z3.number().int().min(1).max(100).default(1),
|
|
156
|
+
inputs: z3.array(
|
|
157
|
+
z3.object({
|
|
158
|
+
ref: versionRef,
|
|
159
|
+
role: z3.string().min(1),
|
|
160
|
+
order: z3.number().int().nonnegative(),
|
|
161
|
+
weight: z3.number().finite().nullable().default(null)
|
|
162
|
+
}).strict()
|
|
163
|
+
).max(100).default([]),
|
|
164
|
+
baseVersionId: z3.uuid().optional(),
|
|
165
|
+
changeRequest: z3.string().trim().min(1).max(4e3).optional(),
|
|
166
|
+
preserveRequest: z3.string().max(4e3).default(""),
|
|
167
|
+
anchor: anchor.default({ kind: "whole" }),
|
|
168
|
+
retryOfTaskId: z3.uuid().optional(),
|
|
169
|
+
acknowledgeUnknown: z3.boolean().optional()
|
|
170
|
+
}).strict();
|
|
171
|
+
var projectSettingsInput = z3.object({
|
|
172
|
+
projectId: z3.uuid(),
|
|
173
|
+
expectedRevision: z3.number().int().positive(),
|
|
174
|
+
changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
|
|
175
|
+
description: projectData.shape.description.unwrap(),
|
|
176
|
+
tags: projectData.shape.tags.unwrap(),
|
|
177
|
+
aspectRatio: projectData.shape.aspectRatio.unwrap(),
|
|
178
|
+
coverRef: projectData.shape.coverRef.unwrap()
|
|
179
|
+
}).partial().strict()
|
|
180
|
+
}).strict();
|
|
181
|
+
var generationSubmitOperation = defineOperation({
|
|
182
|
+
id: "generation.submit",
|
|
183
|
+
title: "Generate",
|
|
184
|
+
description: "Submit one media generation without approval, retaining its paid request identity.",
|
|
185
|
+
input: generationInput,
|
|
186
|
+
output: z3.any(),
|
|
187
|
+
effects: ["write", "paid"],
|
|
188
|
+
confirm: "none"
|
|
189
|
+
});
|
|
190
|
+
var favoriteData = z3.object({ ref: versionRef }).strict();
|
|
191
|
+
var sqlScalar = z3.union([z3.string(), z3.number().finite(), z3.null()]);
|
|
192
|
+
var globalQueryInput = z3.object({
|
|
193
|
+
sql: z3.string().trim().min(1),
|
|
194
|
+
params: z3.union([z3.array(sqlScalar), z3.record(z3.string(), sqlScalar)]).optional(),
|
|
195
|
+
timeoutMs: z3.number().int().positive().optional(),
|
|
196
|
+
maxRows: z3.number().int().positive().optional(),
|
|
197
|
+
limit: z3.number().int().min(1).max(200).optional(),
|
|
198
|
+
offset: z3.number().int().nonnegative().optional(),
|
|
199
|
+
source: z3.enum(["projects", "assets", "tasks"]),
|
|
200
|
+
excludeProjectIds: z3.array(z3.uuid()).optional(),
|
|
201
|
+
catalog: z3.array(z3.object({ id: z3.string().min(1), name: z3.string(), available: z3.boolean() }).strict()).optional()
|
|
202
|
+
}).strict();
|
|
30
203
|
|
|
31
204
|
// packages/studio-workbench/src/view-common.ts
|
|
32
205
|
var pageSources = ["projects", "assets", "tasks"];
|
|
33
206
|
|
|
34
207
|
// packages/studio-workbench/src/query-view.ts
|
|
35
|
-
var columnName =
|
|
36
|
-
var scalar =
|
|
37
|
-
var customViewSchema =
|
|
38
|
-
source:
|
|
39
|
-
projectId:
|
|
40
|
-
name:
|
|
41
|
-
sql:
|
|
42
|
-
params:
|
|
43
|
-
columns:
|
|
44
|
-
|
|
208
|
+
var columnName = z4.string().min(1).max(200).refine((value) => !/[\u0000-\u001f]/.test(value));
|
|
209
|
+
var scalar = z4.union([z4.null(), z4.string(), z4.number().finite()]);
|
|
210
|
+
var customViewSchema = z4.object({
|
|
211
|
+
source: z4.enum(pageSources),
|
|
212
|
+
projectId: z4.uuid().optional(),
|
|
213
|
+
name: z4.string().trim().min(1).max(120),
|
|
214
|
+
sql: z4.string().trim().min(1).max(32e3),
|
|
215
|
+
params: z4.union([z4.array(scalar), z4.record(z4.string(), scalar)]).default([]),
|
|
216
|
+
columns: z4.array(
|
|
217
|
+
z4.object({
|
|
45
218
|
path: columnName,
|
|
46
|
-
label:
|
|
47
|
-
width:
|
|
48
|
-
visible:
|
|
49
|
-
format:
|
|
50
|
-
role:
|
|
219
|
+
label: z4.string().min(1).max(120).optional(),
|
|
220
|
+
width: z4.number().int().min(80).max(600).default(140),
|
|
221
|
+
visible: z4.boolean().default(true),
|
|
222
|
+
format: z4.enum(["text", "categories", "date", "json"]).default("text"),
|
|
223
|
+
role: z4.enum(["name", "preview", "state", "project"]).optional()
|
|
51
224
|
}).strict()
|
|
52
225
|
).min(1).max(60).refine(
|
|
53
226
|
(columns) => new Set(columns.map((c) => c.path)).size === columns.length,
|
|
54
227
|
"Column names must be unique."
|
|
55
228
|
),
|
|
56
|
-
identity:
|
|
229
|
+
identity: z4.object({
|
|
57
230
|
row: columnName.default("rowId"),
|
|
58
231
|
project: columnName.default("projectId"),
|
|
59
232
|
ref: columnName.default("ref"),
|
|
@@ -112,6 +285,42 @@ function saveView(data, input, call) {
|
|
|
112
285
|
return { id: record.objectId, revision: record.revision, view };
|
|
113
286
|
}
|
|
114
287
|
|
|
288
|
+
// packages/studio-workbench/src/project-visibility.ts
|
|
289
|
+
import { z as z5 } from "vivix-studio/sdk/shared";
|
|
290
|
+
var namespace = "@vivix/table-workbench/hidden-projects/1";
|
|
291
|
+
var name = "Hidden workspace projects";
|
|
292
|
+
var projectIds = z5.array(z5.uuid());
|
|
293
|
+
function settings(data) {
|
|
294
|
+
for (let offset = 0; ; ) {
|
|
295
|
+
const page = data.list({ typeId: "extensions.document", search: name, limit: 200, offset });
|
|
296
|
+
const record = page.items.find(({ data: data2 }) => data2.payload?.namespace === namespace);
|
|
297
|
+
if (record || page.nextOffset === null) return record;
|
|
298
|
+
offset = page.nextOffset;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function listHiddenProjects(data) {
|
|
302
|
+
return projectIds.parse(settings(data)?.data.payload.projectIds ?? []);
|
|
303
|
+
}
|
|
304
|
+
function setProjectHidden(data, input, call) {
|
|
305
|
+
const record = settings(data);
|
|
306
|
+
const current = projectIds.parse(record?.data.payload.projectIds ?? []);
|
|
307
|
+
const hidden = new Set(current);
|
|
308
|
+
if (hidden.has(input.projectId) === input.hidden) return current;
|
|
309
|
+
if (input.hidden) hidden.add(input.projectId);
|
|
310
|
+
else hidden.delete(input.projectId);
|
|
311
|
+
const next = [...hidden];
|
|
312
|
+
data.documents(
|
|
313
|
+
record ? "update" : "create",
|
|
314
|
+
{
|
|
315
|
+
...record && { objectId: record.objectId, expectedRevision: record.revision },
|
|
316
|
+
name,
|
|
317
|
+
payload: { namespace, projectIds: next }
|
|
318
|
+
},
|
|
319
|
+
call
|
|
320
|
+
);
|
|
321
|
+
return next;
|
|
322
|
+
}
|
|
323
|
+
|
|
115
324
|
// packages/studio-workbench/src/export.ts
|
|
116
325
|
import archiver from "archiver";
|
|
117
326
|
import { Readable } from "stream";
|
|
@@ -121,8 +330,8 @@ function failure(code, message) {
|
|
|
121
330
|
}
|
|
122
331
|
function archiveNames(entries) {
|
|
123
332
|
const used = /* @__PURE__ */ new Set();
|
|
124
|
-
return entries.map(({ name }, index) => {
|
|
125
|
-
const base =
|
|
333
|
+
return entries.map(({ name: name2 }, index) => {
|
|
334
|
+
const base = name2.replace(/[\\/\u0000-\u001f\u007f:]/g, "_").replace(/^\.+/, "").trim().slice(0, 180) || `asset-${index + 1}`;
|
|
126
335
|
const dot = base.lastIndexOf(".");
|
|
127
336
|
const stem = dot > 0 ? base.slice(0, dot) : base;
|
|
128
337
|
const extension = dot > 0 ? base.slice(dot) : "";
|
|
@@ -266,6 +475,8 @@ var homeClips = [
|
|
|
266
475
|
];
|
|
267
476
|
|
|
268
477
|
// packages/studio-workbench/src/server.ts
|
|
478
|
+
var exec = promisify(execFile);
|
|
479
|
+
var sampleProject = z6.object({ id: z6.uuid(), name: z6.string(), available: z6.literal(true) });
|
|
269
480
|
var dependencies = (config) => [
|
|
270
481
|
...new Set(
|
|
271
482
|
[
|
|
@@ -281,7 +492,7 @@ function activate(ctx) {
|
|
|
281
492
|
if ((ctx.scope?.kind || "project") === "project" && !ctx.config.studioInstance)
|
|
282
493
|
throw Error("A project workbench requires studioInstance.");
|
|
283
494
|
if (ctx.scope?.kind === "user") {
|
|
284
|
-
const clipId =
|
|
495
|
+
const clipId = z6.enum(homeClips);
|
|
285
496
|
ctx.onDispose(
|
|
286
497
|
ctx.http.register({
|
|
287
498
|
id: "home-media",
|
|
@@ -304,6 +515,61 @@ function activate(ctx) {
|
|
|
304
515
|
}
|
|
305
516
|
ctx.provide({ frontendId: "table-workbench", config: ctx.config });
|
|
306
517
|
if (ctx.scope?.kind !== "user") return;
|
|
518
|
+
const homeReceipt = join(dirname(ctx.scope.root), "home-initialization.json");
|
|
519
|
+
ctx.handle(
|
|
520
|
+
defineOperation2({
|
|
521
|
+
id: "workspace.dramaSample",
|
|
522
|
+
title: "Resolve the short drama sample",
|
|
523
|
+
description: "Resolve the prepared preset and any existing sample import.",
|
|
524
|
+
input: z6.object({}).strict(),
|
|
525
|
+
output: z6.object({ legacy: z6.boolean(), preset: z6.string() }),
|
|
526
|
+
effects: ["read"]
|
|
527
|
+
}),
|
|
528
|
+
async () => {
|
|
529
|
+
const owner = "@vivix-labs/short-drama-workbench";
|
|
530
|
+
const home = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
531
|
+
const preset = `${owner}@${home.vivixStudio.runtimePlugins[owner]}:out-of-steps`;
|
|
532
|
+
let legacy = false;
|
|
533
|
+
try {
|
|
534
|
+
const receipt = JSON.parse(await readFile(homeReceipt, "utf8"));
|
|
535
|
+
legacy = Boolean(receipt.projects?.["out-of-steps"]);
|
|
536
|
+
} catch (error) {
|
|
537
|
+
if (error.code !== "ENOENT") throw error;
|
|
538
|
+
}
|
|
539
|
+
return { legacy, preset };
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
ctx.handle(
|
|
543
|
+
defineOperation2({
|
|
544
|
+
id: "workspace.openSample",
|
|
545
|
+
title: "Open sample project",
|
|
546
|
+
description: "Import a bundled sample once and return its editable project.",
|
|
547
|
+
input: z6.object({ sample: z6.enum(["out-of-steps", "cobalt-headphones"]) }).strict(),
|
|
548
|
+
output: sampleProject,
|
|
549
|
+
effects: ["write"],
|
|
550
|
+
confirm: "none"
|
|
551
|
+
}),
|
|
552
|
+
async ({ sample }) => {
|
|
553
|
+
const script = fileURLToPath(
|
|
554
|
+
new URL("../skills/scripts/initialize-home.mjs", import.meta.url)
|
|
555
|
+
);
|
|
556
|
+
const cli = fileURLToPath(
|
|
557
|
+
new URL("../cli.js", import.meta.resolve("vivix-studio/sdk/server"))
|
|
558
|
+
);
|
|
559
|
+
try {
|
|
560
|
+
const { stdout } = await exec(process.execPath, [script, "--sample", sample], {
|
|
561
|
+
env: { ...process.env, VIVIX_STUDIO_CLI: cli }
|
|
562
|
+
});
|
|
563
|
+
return sampleProject.parse(JSON.parse(stdout).project);
|
|
564
|
+
} catch (error) {
|
|
565
|
+
throw new PluginError(
|
|
566
|
+
"SAMPLE_IMPORT_FAILED",
|
|
567
|
+
error.stderr?.trim() || "Unable to load the sample project.",
|
|
568
|
+
"Choose the sample again to retry."
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
);
|
|
307
573
|
const scope = { kind: "user", id: ctx.scope.id };
|
|
308
574
|
const workspace = ctx.plugins.get(ctx.config.dataInstance);
|
|
309
575
|
const dataFor = (actorId) => workspace.bind({
|
|
@@ -313,47 +579,71 @@ function activate(ctx) {
|
|
|
313
579
|
actorId,
|
|
314
580
|
access: []
|
|
315
581
|
});
|
|
316
|
-
const saveInput =
|
|
317
|
-
id:
|
|
318
|
-
expectedRevision:
|
|
582
|
+
const saveInput = z6.object({
|
|
583
|
+
id: z6.uuid().optional(),
|
|
584
|
+
expectedRevision: z6.number().int().positive().optional(),
|
|
319
585
|
view: customViewSchema
|
|
320
586
|
}).strict();
|
|
321
587
|
ctx.handle(
|
|
322
|
-
|
|
588
|
+
defineOperation2({
|
|
323
589
|
id: "views.list",
|
|
324
590
|
title: "Custom Views",
|
|
325
591
|
description: "List persisted Custom Views for this page.",
|
|
326
|
-
input:
|
|
327
|
-
output:
|
|
592
|
+
input: z6.object({ source: z6.enum(pageSources) }).strict(),
|
|
593
|
+
output: z6.any(),
|
|
328
594
|
effects: ["read"],
|
|
329
595
|
confirm: "none"
|
|
330
596
|
}),
|
|
331
597
|
(input, call) => listViews(dataFor(call.actor.id), input.source)
|
|
332
598
|
);
|
|
333
599
|
ctx.handle(
|
|
334
|
-
|
|
600
|
+
defineOperation2({
|
|
335
601
|
id: "views.save",
|
|
336
602
|
title: "Save Custom View",
|
|
337
603
|
description: "Persist the SQL, parameters and columns with revision checks.",
|
|
338
604
|
input: saveInput,
|
|
339
|
-
output:
|
|
605
|
+
output: z6.any(),
|
|
340
606
|
effects: ["write"],
|
|
341
607
|
confirm: "none"
|
|
342
608
|
}),
|
|
343
609
|
(input, call) => saveView(dataFor(call.actor.id), input, { ...call, scope })
|
|
344
610
|
);
|
|
611
|
+
ctx.handle(
|
|
612
|
+
defineOperation2({
|
|
613
|
+
id: "workspace.hiddenProjects",
|
|
614
|
+
title: "Hidden workspace projects",
|
|
615
|
+
description: "Read project IDs hidden from this user workbench.",
|
|
616
|
+
input: z6.object({}).strict(),
|
|
617
|
+
output: projectIds,
|
|
618
|
+
effects: ["read"],
|
|
619
|
+
confirm: "none"
|
|
620
|
+
}),
|
|
621
|
+
(_input, call) => listHiddenProjects(dataFor(call.actor.id))
|
|
622
|
+
);
|
|
623
|
+
ctx.handle(
|
|
624
|
+
defineOperation2({
|
|
625
|
+
id: "workspace.setProjectHidden",
|
|
626
|
+
title: "Set workspace project visibility",
|
|
627
|
+
description: "Hide or restore a project in the user workbench.",
|
|
628
|
+
input: z6.object({ projectId: z6.uuid(), hidden: z6.boolean() }).strict(),
|
|
629
|
+
output: projectIds,
|
|
630
|
+
effects: ["write"],
|
|
631
|
+
confirm: "none"
|
|
632
|
+
}),
|
|
633
|
+
(input, call) => setProjectHidden(dataFor(call.actor.id), input, { ...call, scope })
|
|
634
|
+
);
|
|
345
635
|
if (!ctx.config.studioInstance) return;
|
|
346
636
|
const coordinator = ctx.plugins.get(ctx.config.studioInstance);
|
|
347
637
|
const exports = createExportService(coordinator.global);
|
|
348
638
|
ctx.onDispose(() => exports.dispose());
|
|
349
|
-
const ref =
|
|
639
|
+
const ref = z6.object({ storeId: z6.uuid(), objectId: z6.uuid(), versionId: z6.uuid() }).strict();
|
|
350
640
|
ctx.handle(
|
|
351
|
-
|
|
641
|
+
defineOperation2({
|
|
352
642
|
id: "exports.prepare",
|
|
353
643
|
title: "Prepare download",
|
|
354
644
|
description: "Prepare one exact selection of saved asset versions for streaming.",
|
|
355
|
-
input:
|
|
356
|
-
output:
|
|
645
|
+
input: z6.object({ refs: z6.array(ref).min(1).max(100) }).strict(),
|
|
646
|
+
output: z6.object({ exportId: z6.uuid(), expiresAt: z6.number().int() }).strict(),
|
|
357
647
|
effects: ["read"],
|
|
358
648
|
confirm: "none"
|
|
359
649
|
}),
|
|
@@ -367,7 +657,7 @@ function activate(ctx) {
|
|
|
367
657
|
if (contentType?.split(";")[0]?.trim() !== "application/x-www-form-urlencoded")
|
|
368
658
|
throw Error("Use the prepared download form.");
|
|
369
659
|
const fields = new URLSearchParams(await new Response(body).text());
|
|
370
|
-
const input =
|
|
660
|
+
const input = z6.object({ exportId: z6.uuid() }).strict().parse(Object.fromEntries(fields));
|
|
371
661
|
if ([...fields].length !== 1) throw Error("The prepared download form is invalid.");
|
|
372
662
|
return exports.response(input.exportId, signal);
|
|
373
663
|
}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { z } from 'vivix-studio/sdk/shared';
|
|
2
|
+
import { WorkbenchProject } from 'vivix-studio/sdk/client';
|
|
2
3
|
|
|
4
|
+
interface VersionRef {
|
|
5
|
+
storeId: string;
|
|
6
|
+
objectId: string;
|
|
7
|
+
versionId: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type HomeProject = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
available: boolean;
|
|
14
|
+
};
|
|
15
|
+
type CardProps = {
|
|
16
|
+
onProjectCreated?(project: WorkbenchProject): void;
|
|
17
|
+
openProject(id: string, view?: string): void;
|
|
18
|
+
openProjects(): void;
|
|
19
|
+
openAssets(ref?: VersionRef): void;
|
|
20
|
+
projects: readonly HomeProject[];
|
|
21
|
+
projectCovers?: ReadonlyMap<string, VersionRef | null>;
|
|
22
|
+
hiddenProjectIds?: readonly string[];
|
|
23
|
+
ready: boolean;
|
|
24
|
+
};
|
|
3
25
|
declare const Config: z.ZodObject<{
|
|
4
26
|
studioInstance: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
5
27
|
operationInstance: z.ZodDefault<z.ZodString>;
|
|
@@ -13,6 +35,10 @@ declare const Config: z.ZodObject<{
|
|
|
13
35
|
plugin: z.ZodString;
|
|
14
36
|
id: z.ZodString;
|
|
15
37
|
}, z.core.$strict>>;
|
|
38
|
+
projectCreator: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
plugin: z.ZodString;
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
}, z.core.$strict>>;
|
|
16
42
|
}, z.core.$strict>>;
|
|
17
43
|
dashboard: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18
44
|
plugin: z.ZodString;
|
|
@@ -54,4 +80,4 @@ declare function sortQuery(sort: View['sort']): {
|
|
|
54
80
|
};
|
|
55
81
|
declare function viewSort(field: string, direction: string): View['sort'];
|
|
56
82
|
|
|
57
|
-
export { Config, type View, type WorkbenchConfig, dependencies, draftKey, parseView, sortQuery, viewKey, viewSort };
|
|
83
|
+
export { type CardProps, Config, type HomeProject, type View, type WorkbenchConfig, dependencies, draftKey, parseView, sortQuery, viewKey, viewSort };
|
package/dist/shared.js
CHANGED
|
@@ -11,7 +11,8 @@ var Config = z.object({
|
|
|
11
11
|
libraryInstance: z.string().min(1).nullable().default(null),
|
|
12
12
|
libraryServiceInstance: z.string().min(1).nullable().default(null),
|
|
13
13
|
views: z.object({
|
|
14
|
-
assetList: uiReference.optional()
|
|
14
|
+
assetList: uiReference.optional(),
|
|
15
|
+
projectCreator: uiReference.optional()
|
|
15
16
|
}).strict().default({}),
|
|
16
17
|
dashboard: z.array(uiReference).optional(),
|
|
17
18
|
savedViews: z.array(z.union([uiReference, savedProjectView])).default([]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vivix-labs/studio-workbench",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -45,33 +45,33 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/archiver": "7.0.0",
|
|
48
|
-
"@vivix-labs/project-studio": "1.0.0-beta.
|
|
49
|
-
"@vivix-labs/ui-system": "1.0.0-beta.
|
|
48
|
+
"@vivix-labs/project-studio": "1.0.0-beta.17",
|
|
49
|
+
"@vivix-labs/ui-system": "1.0.0-beta.20"
|
|
50
50
|
},
|
|
51
51
|
"vivixStudio": {
|
|
52
52
|
"runtimePlugins": {
|
|
53
|
-
"@vivix-labs/ads-compare": "1.0.0-beta.
|
|
54
|
-
"@vivix-labs/ads-storyboard": "1.0.0-beta.
|
|
55
|
-
"@vivix-labs/creative-data": "1.0.0-beta.
|
|
56
|
-
"@vivix-labs/dashboard-assets": "1.0.0-beta.
|
|
57
|
-
"@vivix-labs/dashboard-projects": "1.0.0-beta.
|
|
58
|
-
"@vivix-labs/magic-edit": "1.0.0-beta.
|
|
59
|
-
"@vivix-labs/material-library": "1.0.0-beta.
|
|
60
|
-
"@vivix-labs/media-tools": "1.0.0-beta.
|
|
61
|
-
"@vivix-labs/project-studio": "1.0.0-beta.
|
|
62
|
-
"@vivix-labs/short-drama-characters": "1.0.0-beta.
|
|
63
|
-
"@vivix-labs/short-drama-compare": "1.0.0-beta.
|
|
64
|
-
"@vivix-labs/short-drama-production": "1.0.0-beta.
|
|
65
|
-
"@vivix-labs/short-drama-script-editor": "1.0.0-beta.
|
|
66
|
-
"@vivix-labs/short-drama-social-preview": "1.0.0-beta.
|
|
67
|
-
"@vivix-labs/short-drama-storyboard": "1.0.0-beta.
|
|
68
|
-
"@vivix-labs/short-drama-workbench": "1.0.0-beta.
|
|
69
|
-
"@vivix-labs/studio-asset-list": "1.0.0-beta.
|
|
70
|
-
"@vivix-labs/studio-workbench": "1.0.0-beta.
|
|
71
|
-
"@vivix-labs/vivix-api": "1.0.0-beta.
|
|
72
|
-
"@vivix-labs/ads-workbench": "1.0.0-beta.
|
|
73
|
-
"@vivix-labs/chat-components": "1.0.0-beta.
|
|
74
|
-
"@vivix-labs/short-drama-authoring": "1.0.0-beta.
|
|
53
|
+
"@vivix-labs/ads-compare": "1.0.0-beta.17",
|
|
54
|
+
"@vivix-labs/ads-storyboard": "1.0.0-beta.17",
|
|
55
|
+
"@vivix-labs/creative-data": "1.0.0-beta.17",
|
|
56
|
+
"@vivix-labs/dashboard-assets": "1.0.0-beta.17",
|
|
57
|
+
"@vivix-labs/dashboard-projects": "1.0.0-beta.17",
|
|
58
|
+
"@vivix-labs/magic-edit": "1.0.0-beta.17",
|
|
59
|
+
"@vivix-labs/material-library": "1.0.0-beta.17",
|
|
60
|
+
"@vivix-labs/media-tools": "1.0.0-beta.17",
|
|
61
|
+
"@vivix-labs/project-studio": "1.0.0-beta.17",
|
|
62
|
+
"@vivix-labs/short-drama-characters": "1.0.0-beta.20",
|
|
63
|
+
"@vivix-labs/short-drama-compare": "1.0.0-beta.17",
|
|
64
|
+
"@vivix-labs/short-drama-production": "1.0.0-beta.17",
|
|
65
|
+
"@vivix-labs/short-drama-script-editor": "1.0.0-beta.17",
|
|
66
|
+
"@vivix-labs/short-drama-social-preview": "1.0.0-beta.17",
|
|
67
|
+
"@vivix-labs/short-drama-storyboard": "1.0.0-beta.17",
|
|
68
|
+
"@vivix-labs/short-drama-workbench": "1.0.0-beta.20",
|
|
69
|
+
"@vivix-labs/studio-asset-list": "1.0.0-beta.20",
|
|
70
|
+
"@vivix-labs/studio-workbench": "1.0.0-beta.20",
|
|
71
|
+
"@vivix-labs/vivix-api": "1.0.0-beta.17",
|
|
72
|
+
"@vivix-labs/ads-workbench": "1.0.0-beta.17",
|
|
73
|
+
"@vivix-labs/chat-components": "1.0.0-beta.20",
|
|
74
|
+
"@vivix-labs/short-drama-authoring": "1.0.0-beta.17"
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
package/presets/table.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
"id": "api",
|
|
9
9
|
"package": "@vivix-labs/vivix-api",
|
|
10
|
-
"version": "1.0.0-beta.
|
|
10
|
+
"version": "1.0.0-beta.17",
|
|
11
11
|
"enabled": true,
|
|
12
12
|
"config": {},
|
|
13
13
|
"requiredAccess": ["official.request"]
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
{
|
|
16
16
|
"id": "studio",
|
|
17
17
|
"package": "@vivix-labs/project-studio",
|
|
18
|
-
"version": "1.0.0-beta.
|
|
18
|
+
"version": "1.0.0-beta.17",
|
|
19
19
|
"enabled": true,
|
|
20
20
|
"config": {
|
|
21
21
|
"role": "project",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
{
|
|
30
30
|
"id": "library",
|
|
31
31
|
"package": "@vivix-labs/material-library",
|
|
32
|
-
"version": "1.0.0-beta.
|
|
32
|
+
"version": "1.0.0-beta.17",
|
|
33
33
|
"enabled": true,
|
|
34
34
|
"config": {
|
|
35
35
|
"role": "client",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
{
|
|
40
40
|
"id": "workbench",
|
|
41
41
|
"package": "@vivix-labs/studio-workbench",
|
|
42
|
-
"version": "1.0.0-beta.
|
|
42
|
+
"version": "1.0.0-beta.20",
|
|
43
43
|
"enabled": true,
|
|
44
44
|
"config": {
|
|
45
45
|
"studioInstance": "studio",
|