@vivix-labs/studio-workbench 1.0.0-beta.2 → 1.0.0-beta.21
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 +2731 -1096
- package/dist/client.css +1838 -295
- package/dist/server.d.ts +1 -0
- package/dist/server.js +328 -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,204 @@ 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)).describe(
|
|
146
|
+
"Owning-domain binding stored with the task. Short drama passes { episodeId, shotId } so the finished take attaches to that shot; production.generateShot sets it automatically."
|
|
147
|
+
).optional(),
|
|
148
|
+
expectedRevision: z3.number().int().positive().optional(),
|
|
149
|
+
newAsset: z3.object({
|
|
150
|
+
name: z3.string().trim().min(1).max(200),
|
|
151
|
+
kind: z3.enum(["image", "video", "audio"])
|
|
152
|
+
}).strict().optional(),
|
|
153
|
+
modelId: z3.string().min(1),
|
|
154
|
+
capabilityId: z3.string().min(1),
|
|
155
|
+
prompt: z3.string().max(32e3),
|
|
156
|
+
parameters: z3.record(z3.string(), z3.unknown()).default({}),
|
|
157
|
+
outputCount: z3.number().int().min(1).max(100).default(1),
|
|
158
|
+
inputs: z3.array(
|
|
159
|
+
z3.object({
|
|
160
|
+
ref: versionRef,
|
|
161
|
+
role: z3.string().min(1),
|
|
162
|
+
order: z3.number().int().nonnegative(),
|
|
163
|
+
weight: z3.number().finite().nullable().default(null)
|
|
164
|
+
}).strict()
|
|
165
|
+
).max(100).default([]),
|
|
166
|
+
baseVersionId: z3.uuid().optional(),
|
|
167
|
+
changeRequest: z3.string().trim().min(1).max(4e3).optional(),
|
|
168
|
+
preserveRequest: z3.string().max(4e3).default(""),
|
|
169
|
+
anchor: anchor.default({ kind: "whole" }),
|
|
170
|
+
retryOfTaskId: z3.uuid().optional(),
|
|
171
|
+
acknowledgeUnknown: z3.boolean().optional()
|
|
172
|
+
}).strict();
|
|
173
|
+
var projectSettingsInput = z3.object({
|
|
174
|
+
projectId: z3.uuid(),
|
|
175
|
+
expectedRevision: z3.number().int().positive(),
|
|
176
|
+
changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
|
|
177
|
+
description: projectData.shape.description.unwrap(),
|
|
178
|
+
tags: projectData.shape.tags.unwrap(),
|
|
179
|
+
aspectRatio: projectData.shape.aspectRatio.unwrap(),
|
|
180
|
+
coverRef: projectData.shape.coverRef.unwrap()
|
|
181
|
+
}).partial().strict()
|
|
182
|
+
}).strict();
|
|
183
|
+
var generationSubmitOperation = defineOperation({
|
|
184
|
+
id: "generation.submit",
|
|
185
|
+
title: "Generate",
|
|
186
|
+
description: "Submit one media generation without approval, retaining its paid request identity. Pass context with the owning domain identifiers; without it the output is only stored in the media library.",
|
|
187
|
+
input: generationInput,
|
|
188
|
+
output: z3.any(),
|
|
189
|
+
effects: ["write", "paid"],
|
|
190
|
+
confirm: "none"
|
|
191
|
+
});
|
|
192
|
+
var favoriteData = z3.object({ ref: versionRef }).strict();
|
|
193
|
+
var sqlScalar = z3.union([z3.string(), z3.number().finite(), z3.null()]);
|
|
194
|
+
var globalQueryInput = z3.object({
|
|
195
|
+
sql: z3.string().trim().min(1),
|
|
196
|
+
params: z3.union([z3.array(sqlScalar), z3.record(z3.string(), sqlScalar)]).optional(),
|
|
197
|
+
timeoutMs: z3.number().int().positive().optional(),
|
|
198
|
+
maxRows: z3.number().int().positive().optional(),
|
|
199
|
+
limit: z3.number().int().min(1).max(200).optional(),
|
|
200
|
+
offset: z3.number().int().nonnegative().optional(),
|
|
201
|
+
source: z3.enum(["projects", "assets", "tasks"]),
|
|
202
|
+
excludeProjectIds: z3.array(z3.uuid()).optional(),
|
|
203
|
+
catalog: z3.array(z3.object({ id: z3.string().min(1), name: z3.string(), available: z3.boolean() }).strict()).optional()
|
|
204
|
+
}).strict();
|
|
30
205
|
|
|
31
206
|
// packages/studio-workbench/src/view-common.ts
|
|
32
207
|
var pageSources = ["projects", "assets", "tasks"];
|
|
33
208
|
|
|
34
209
|
// 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
|
-
|
|
210
|
+
var columnName = z4.string().min(1).max(200).refine((value) => !/[\u0000-\u001f]/.test(value));
|
|
211
|
+
var scalar = z4.union([z4.null(), z4.string(), z4.number().finite()]);
|
|
212
|
+
var customViewSchema = z4.object({
|
|
213
|
+
source: z4.enum(pageSources),
|
|
214
|
+
projectId: z4.uuid().optional(),
|
|
215
|
+
name: z4.string().trim().min(1).max(120),
|
|
216
|
+
sql: z4.string().trim().min(1).max(32e3),
|
|
217
|
+
params: z4.union([z4.array(scalar), z4.record(z4.string(), scalar)]).default([]),
|
|
218
|
+
columns: z4.array(
|
|
219
|
+
z4.object({
|
|
45
220
|
path: columnName,
|
|
46
|
-
label:
|
|
47
|
-
width:
|
|
48
|
-
visible:
|
|
49
|
-
format:
|
|
50
|
-
role:
|
|
221
|
+
label: z4.string().min(1).max(120).optional(),
|
|
222
|
+
width: z4.number().int().min(80).max(600).default(140),
|
|
223
|
+
visible: z4.boolean().default(true),
|
|
224
|
+
format: z4.enum(["text", "categories", "date", "json"]).default("text"),
|
|
225
|
+
role: z4.enum(["name", "preview", "state", "project"]).optional()
|
|
51
226
|
}).strict()
|
|
52
227
|
).min(1).max(60).refine(
|
|
53
228
|
(columns) => new Set(columns.map((c) => c.path)).size === columns.length,
|
|
54
229
|
"Column names must be unique."
|
|
55
230
|
),
|
|
56
|
-
identity:
|
|
231
|
+
identity: z4.object({
|
|
57
232
|
row: columnName.default("rowId"),
|
|
58
233
|
project: columnName.default("projectId"),
|
|
59
234
|
ref: columnName.default("ref"),
|
|
@@ -112,6 +287,42 @@ function saveView(data, input, call) {
|
|
|
112
287
|
return { id: record.objectId, revision: record.revision, view };
|
|
113
288
|
}
|
|
114
289
|
|
|
290
|
+
// packages/studio-workbench/src/project-visibility.ts
|
|
291
|
+
import { z as z5 } from "vivix-studio/sdk/shared";
|
|
292
|
+
var namespace = "@vivix/table-workbench/hidden-projects/1";
|
|
293
|
+
var name = "Hidden workspace projects";
|
|
294
|
+
var projectIds = z5.array(z5.uuid());
|
|
295
|
+
function settings(data) {
|
|
296
|
+
for (let offset = 0; ; ) {
|
|
297
|
+
const page = data.list({ typeId: "extensions.document", search: name, limit: 200, offset });
|
|
298
|
+
const record = page.items.find(({ data: data2 }) => data2.payload?.namespace === namespace);
|
|
299
|
+
if (record || page.nextOffset === null) return record;
|
|
300
|
+
offset = page.nextOffset;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function listHiddenProjects(data) {
|
|
304
|
+
return projectIds.parse(settings(data)?.data.payload.projectIds ?? []);
|
|
305
|
+
}
|
|
306
|
+
function setProjectHidden(data, input, call) {
|
|
307
|
+
const record = settings(data);
|
|
308
|
+
const current = projectIds.parse(record?.data.payload.projectIds ?? []);
|
|
309
|
+
const hidden = new Set(current);
|
|
310
|
+
if (hidden.has(input.projectId) === input.hidden) return current;
|
|
311
|
+
if (input.hidden) hidden.add(input.projectId);
|
|
312
|
+
else hidden.delete(input.projectId);
|
|
313
|
+
const next = [...hidden];
|
|
314
|
+
data.documents(
|
|
315
|
+
record ? "update" : "create",
|
|
316
|
+
{
|
|
317
|
+
...record && { objectId: record.objectId, expectedRevision: record.revision },
|
|
318
|
+
name,
|
|
319
|
+
payload: { namespace, projectIds: next }
|
|
320
|
+
},
|
|
321
|
+
call
|
|
322
|
+
);
|
|
323
|
+
return next;
|
|
324
|
+
}
|
|
325
|
+
|
|
115
326
|
// packages/studio-workbench/src/export.ts
|
|
116
327
|
import archiver from "archiver";
|
|
117
328
|
import { Readable } from "stream";
|
|
@@ -121,8 +332,8 @@ function failure(code, message) {
|
|
|
121
332
|
}
|
|
122
333
|
function archiveNames(entries) {
|
|
123
334
|
const used = /* @__PURE__ */ new Set();
|
|
124
|
-
return entries.map(({ name }, index) => {
|
|
125
|
-
const base =
|
|
335
|
+
return entries.map(({ name: name2 }, index) => {
|
|
336
|
+
const base = name2.replace(/[\\/\u0000-\u001f\u007f:]/g, "_").replace(/^\.+/, "").trim().slice(0, 180) || `asset-${index + 1}`;
|
|
126
337
|
const dot = base.lastIndexOf(".");
|
|
127
338
|
const stem = dot > 0 ? base.slice(0, dot) : base;
|
|
128
339
|
const extension = dot > 0 ? base.slice(dot) : "";
|
|
@@ -266,6 +477,8 @@ var homeClips = [
|
|
|
266
477
|
];
|
|
267
478
|
|
|
268
479
|
// packages/studio-workbench/src/server.ts
|
|
480
|
+
var exec = promisify(execFile);
|
|
481
|
+
var sampleProject = z6.object({ id: z6.uuid(), name: z6.string(), available: z6.literal(true) });
|
|
269
482
|
var dependencies = (config) => [
|
|
270
483
|
...new Set(
|
|
271
484
|
[
|
|
@@ -281,7 +494,7 @@ function activate(ctx) {
|
|
|
281
494
|
if ((ctx.scope?.kind || "project") === "project" && !ctx.config.studioInstance)
|
|
282
495
|
throw Error("A project workbench requires studioInstance.");
|
|
283
496
|
if (ctx.scope?.kind === "user") {
|
|
284
|
-
const clipId =
|
|
497
|
+
const clipId = z6.enum(homeClips);
|
|
285
498
|
ctx.onDispose(
|
|
286
499
|
ctx.http.register({
|
|
287
500
|
id: "home-media",
|
|
@@ -304,6 +517,61 @@ function activate(ctx) {
|
|
|
304
517
|
}
|
|
305
518
|
ctx.provide({ frontendId: "table-workbench", config: ctx.config });
|
|
306
519
|
if (ctx.scope?.kind !== "user") return;
|
|
520
|
+
const homeReceipt = join(dirname(ctx.scope.root), "home-initialization.json");
|
|
521
|
+
ctx.handle(
|
|
522
|
+
defineOperation2({
|
|
523
|
+
id: "workspace.dramaSample",
|
|
524
|
+
title: "Resolve the short drama sample",
|
|
525
|
+
description: "Resolve the prepared preset and any existing sample import.",
|
|
526
|
+
input: z6.object({}).strict(),
|
|
527
|
+
output: z6.object({ legacy: z6.boolean(), preset: z6.string() }),
|
|
528
|
+
effects: ["read"]
|
|
529
|
+
}),
|
|
530
|
+
async () => {
|
|
531
|
+
const owner = "@vivix-labs/short-drama-workbench";
|
|
532
|
+
const home = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
533
|
+
const preset = `${owner}@${home.vivixStudio.runtimePlugins[owner]}:out-of-steps`;
|
|
534
|
+
let legacy = false;
|
|
535
|
+
try {
|
|
536
|
+
const receipt = JSON.parse(await readFile(homeReceipt, "utf8"));
|
|
537
|
+
legacy = Boolean(receipt.projects?.["out-of-steps"]);
|
|
538
|
+
} catch (error) {
|
|
539
|
+
if (error.code !== "ENOENT") throw error;
|
|
540
|
+
}
|
|
541
|
+
return { legacy, preset };
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
ctx.handle(
|
|
545
|
+
defineOperation2({
|
|
546
|
+
id: "workspace.openSample",
|
|
547
|
+
title: "Open sample project",
|
|
548
|
+
description: "Import a bundled sample once and return its editable project.",
|
|
549
|
+
input: z6.object({ sample: z6.enum(["out-of-steps", "cobalt-headphones"]) }).strict(),
|
|
550
|
+
output: sampleProject,
|
|
551
|
+
effects: ["write"],
|
|
552
|
+
confirm: "none"
|
|
553
|
+
}),
|
|
554
|
+
async ({ sample }) => {
|
|
555
|
+
const script = fileURLToPath(
|
|
556
|
+
new URL("../skills/scripts/initialize-home.mjs", import.meta.url)
|
|
557
|
+
);
|
|
558
|
+
const cli = fileURLToPath(
|
|
559
|
+
new URL("../cli.js", import.meta.resolve("vivix-studio/sdk/server"))
|
|
560
|
+
);
|
|
561
|
+
try {
|
|
562
|
+
const { stdout } = await exec(process.execPath, [script, "--sample", sample], {
|
|
563
|
+
env: { ...process.env, VIVIX_STUDIO_CLI: cli }
|
|
564
|
+
});
|
|
565
|
+
return sampleProject.parse(JSON.parse(stdout).project);
|
|
566
|
+
} catch (error) {
|
|
567
|
+
throw new PluginError(
|
|
568
|
+
"SAMPLE_IMPORT_FAILED",
|
|
569
|
+
error.stderr?.trim() || "Unable to load the sample project.",
|
|
570
|
+
"Choose the sample again to retry."
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
);
|
|
307
575
|
const scope = { kind: "user", id: ctx.scope.id };
|
|
308
576
|
const workspace = ctx.plugins.get(ctx.config.dataInstance);
|
|
309
577
|
const dataFor = (actorId) => workspace.bind({
|
|
@@ -313,47 +581,71 @@ function activate(ctx) {
|
|
|
313
581
|
actorId,
|
|
314
582
|
access: []
|
|
315
583
|
});
|
|
316
|
-
const saveInput =
|
|
317
|
-
id:
|
|
318
|
-
expectedRevision:
|
|
584
|
+
const saveInput = z6.object({
|
|
585
|
+
id: z6.uuid().optional(),
|
|
586
|
+
expectedRevision: z6.number().int().positive().optional(),
|
|
319
587
|
view: customViewSchema
|
|
320
588
|
}).strict();
|
|
321
589
|
ctx.handle(
|
|
322
|
-
|
|
590
|
+
defineOperation2({
|
|
323
591
|
id: "views.list",
|
|
324
592
|
title: "Custom Views",
|
|
325
593
|
description: "List persisted Custom Views for this page.",
|
|
326
|
-
input:
|
|
327
|
-
output:
|
|
594
|
+
input: z6.object({ source: z6.enum(pageSources) }).strict(),
|
|
595
|
+
output: z6.any(),
|
|
328
596
|
effects: ["read"],
|
|
329
597
|
confirm: "none"
|
|
330
598
|
}),
|
|
331
599
|
(input, call) => listViews(dataFor(call.actor.id), input.source)
|
|
332
600
|
);
|
|
333
601
|
ctx.handle(
|
|
334
|
-
|
|
602
|
+
defineOperation2({
|
|
335
603
|
id: "views.save",
|
|
336
604
|
title: "Save Custom View",
|
|
337
605
|
description: "Persist the SQL, parameters and columns with revision checks.",
|
|
338
606
|
input: saveInput,
|
|
339
|
-
output:
|
|
607
|
+
output: z6.any(),
|
|
340
608
|
effects: ["write"],
|
|
341
609
|
confirm: "none"
|
|
342
610
|
}),
|
|
343
611
|
(input, call) => saveView(dataFor(call.actor.id), input, { ...call, scope })
|
|
344
612
|
);
|
|
613
|
+
ctx.handle(
|
|
614
|
+
defineOperation2({
|
|
615
|
+
id: "workspace.hiddenProjects",
|
|
616
|
+
title: "Hidden workspace projects",
|
|
617
|
+
description: "Read project IDs hidden from this user workbench.",
|
|
618
|
+
input: z6.object({}).strict(),
|
|
619
|
+
output: projectIds,
|
|
620
|
+
effects: ["read"],
|
|
621
|
+
confirm: "none"
|
|
622
|
+
}),
|
|
623
|
+
(_input, call) => listHiddenProjects(dataFor(call.actor.id))
|
|
624
|
+
);
|
|
625
|
+
ctx.handle(
|
|
626
|
+
defineOperation2({
|
|
627
|
+
id: "workspace.setProjectHidden",
|
|
628
|
+
title: "Set workspace project visibility",
|
|
629
|
+
description: "Hide or restore a project in the user workbench.",
|
|
630
|
+
input: z6.object({ projectId: z6.uuid(), hidden: z6.boolean() }).strict(),
|
|
631
|
+
output: projectIds,
|
|
632
|
+
effects: ["write"],
|
|
633
|
+
confirm: "none"
|
|
634
|
+
}),
|
|
635
|
+
(input, call) => setProjectHidden(dataFor(call.actor.id), input, { ...call, scope })
|
|
636
|
+
);
|
|
345
637
|
if (!ctx.config.studioInstance) return;
|
|
346
638
|
const coordinator = ctx.plugins.get(ctx.config.studioInstance);
|
|
347
639
|
const exports = createExportService(coordinator.global);
|
|
348
640
|
ctx.onDispose(() => exports.dispose());
|
|
349
|
-
const ref =
|
|
641
|
+
const ref = z6.object({ storeId: z6.uuid(), objectId: z6.uuid(), versionId: z6.uuid() }).strict();
|
|
350
642
|
ctx.handle(
|
|
351
|
-
|
|
643
|
+
defineOperation2({
|
|
352
644
|
id: "exports.prepare",
|
|
353
645
|
title: "Prepare download",
|
|
354
646
|
description: "Prepare one exact selection of saved asset versions for streaming.",
|
|
355
|
-
input:
|
|
356
|
-
output:
|
|
647
|
+
input: z6.object({ refs: z6.array(ref).min(1).max(100) }).strict(),
|
|
648
|
+
output: z6.object({ exportId: z6.uuid(), expiresAt: z6.number().int() }).strict(),
|
|
357
649
|
effects: ["read"],
|
|
358
650
|
confirm: "none"
|
|
359
651
|
}),
|
|
@@ -367,7 +659,7 @@ function activate(ctx) {
|
|
|
367
659
|
if (contentType?.split(";")[0]?.trim() !== "application/x-www-form-urlencoded")
|
|
368
660
|
throw Error("Use the prepared download form.");
|
|
369
661
|
const fields = new URLSearchParams(await new Response(body).text());
|
|
370
|
-
const input =
|
|
662
|
+
const input = z6.object({ exportId: z6.uuid() }).strict().parse(Object.fromEntries(fields));
|
|
371
663
|
if ([...fields].length !== 1) throw Error("The prepared download form is invalid.");
|
|
372
664
|
return exports.response(input.exportId, signal);
|
|
373
665
|
}
|
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.21",
|
|
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/
|
|
49
|
-
"@vivix-labs/
|
|
48
|
+
"@vivix-labs/ui-system": "1.0.0-beta.20",
|
|
49
|
+
"@vivix-labs/project-studio": "1.0.0-beta.18"
|
|
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.18",
|
|
61
|
+
"@vivix-labs/project-studio": "1.0.0-beta.18",
|
|
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.18",
|
|
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.21",
|
|
69
|
+
"@vivix-labs/studio-asset-list": "1.0.0-beta.20",
|
|
70
|
+
"@vivix-labs/studio-workbench": "1.0.0-beta.21",
|
|
71
|
+
"@vivix-labs/vivix-api": "1.0.0-beta.17",
|
|
72
|
+
"@vivix-labs/ads-workbench": "1.0.0-beta.18",
|
|
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",
|