@slatesvideo/shared 0.7.18 → 0.7.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.
@@ -42,6 +42,8 @@ const READ_ONLY_PREFIXES = [
42
42
  'slates_blender_search_docs',
43
43
  // Runs HyperFrames' check on a composition and writes nothing; it POSTs because the document is the payload.
44
44
  'slates_check_composition',
45
+ 'slates_quote_cut_drafts',
46
+ 'slates_quote_draft_finish',
45
47
  ];
46
48
  /**
47
49
  * Ops whose effect a user cannot undo from inside Slates.
@@ -154,6 +156,7 @@ export const OPERATION_GROUPS = {
154
156
  'slates_update_style',
155
157
  'slates_delete_style',
156
158
  'slates_list_library',
159
+ 'slates_quote_draft_finish', 'slates_finish_draft',
157
160
  'slates_create_library_item',
158
161
  'slates_update_library_item',
159
162
  'slates_delete_library_item',
@@ -174,8 +177,11 @@ export const OPERATION_GROUPS = {
174
177
  script: ['slates_get_script_document', 'slates_update_script_document', 'slates_get_script_sections', 'slates_update_script_section', 'slates_get_script_suggestions', 'slates_update_script_suggestions', 'slates_get_script_uses', 'slates_preview_script_variation', 'slates_create_script_variation', 'slates_get_shot_inputs', 'slates_reuse_shot_take'],
175
178
  timeline: [
176
179
  'slates_list_timelines', 'slates_save_timeline', 'slates_export_cuts',
180
+ 'slates_quote_cut_drafts', 'slates_finish_cut_drafts', 'slates_get_cut_draft_status',
177
181
  'slates_get_export_batch', 'slates_cancel_export_batch', 'slates_get_variant_grid', 'slates_get_recipe',
178
182
  'slates_reframe_clip', 'slates_get_reframe_report',
183
+ 'slates_freeze_frame', 'slates_stabilize_clip', 'slates_slide_clip', 'slates_punch_in', 'slates_clean_up_dialogue',
184
+ 'slates_auto_colour_clip', 'slates_auto_duck', 'slates_match_loudness',
179
185
  'slates_get_timeline',
180
186
  'slates_get_timeline_loudness',
181
187
  'slates_add_clip_to_timeline',
@@ -118,7 +118,7 @@ export const WORKING_METHOD = [
118
118
  // the exception: it is multi-line and generated, and supplies its own bullet.
119
119
  export const HARD_RULES = [
120
120
  // FORKED: "outside an approved plan" names the desktop's code-level gate.
121
- fork(`- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation outside an approved plan. Estimate before you promise. Batch related generations into one plan. When the user says cheap or cheapest, price decides: plan the lowest-priced setting the estimates show (at a tie, the better quality at that price); "best" then means the best picture at that price, never a dearer tier. A dearer tier is named in words, never generated unless the user asks for it.`, `- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation the user has not agreed to. Estimate before you promise. Batch related generations into one quote so the user approves a total, not a drip.`),
121
+ fork(`- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation outside an approved plan. Estimate before you promise, and say each price exactly as the estimate gives it, never rounded. Batch related generations into one plan. When the user says cheap or cheapest, price decides: plan the lowest-priced setting the estimates show (at a tie, the better quality at that price); "best" then means the best picture at that price, never a dearer tier. A dearer tier is named in words, never generated unless the user asks for it.`, `- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation the user has not agreed to. Estimate before you promise, and say each price exactly as the estimate gives it, never rounded. Batch related generations into one quote so the user approves a total, not a drip.`),
122
122
  both(`- CONTENT POLICY: before writing prompts involving real people/celebrities, minors, brands/logos, weapons, or gore, load slates-content-policy and build the scene safe from the first word. If a provider rejects (e.g. real-face detection), explain in plain language — refunds for provider rejections are automatic.`),
123
123
  both(`- PROMPT IS LAW (reference doctrine): references are cited inline by name and image number ("Marcus (images 1 and 2)"); the prompt text leads. Never write role-essays about what each reference is "for".`),
124
124
  both(`- NAMES AND DESCRIPTIONS ARE THE USER'S UI, NOT YOUR NOTEPAD. A project, board or shot name is rendered at the top of the user's screen at all times. Name it after the piece ("Kaiju selfie"), never after your process, and NEVER append your own status or housekeeping — no "shot list", no "v2", no "Written from IMG-A172 and IMG-A182", no "Delete freely", no "scratch". Leave the description empty unless the user gave you one worth keeping: a note-to-self at the top of the screen reads as part of the product, and the user has to look at it every day. Say that kind of thing in your reply to them instead.`),
@@ -640,15 +640,8 @@ export const MODEL_CAPABILITIES = {
640
640
  },
641
641
  'seedance-2.5': {
642
642
  aspectRatios: SEEDANCE_ASPECT_RATIOS,
643
- // 1080p landed 2026-08-24 on ALL THREE rails — BytePlus and EvoLink publish
644
- // 1080p rate rows and fal's live OpenAPI enum reads
645
- // ['480p','720p','1080p']. There is still NO 4K on 2.5 (2.0 is the only
646
- // Seedance with one), which is what keeps `is4kVideoKey` version-blind.
647
- //
648
- // DEFAULT STAYS 720p, deliberately: a 30s take at 1080p is ~853 credits
649
- // against a 1,000-credit welcome grant. Reaching a tier and defaulting to it
650
- // are different decisions.
651
- videoResolution: { options: ['480p', '720p', '1080p'], default: '720p' },
643
+ // Keep 720p as the default: a 30s take at 1080p is ~853 credits.
644
+ videoResolution: { options: ['480p', '720p', '1080p', '4k'], default: '720p' },
652
645
  duration: { min: 4, max: 30, mode: 'continuous' },
653
646
  maxIngredientImages: 30,
654
647
  maxReferenceVideos: 10,
@@ -660,10 +653,7 @@ export const MODEL_CAPABILITIES = {
660
653
  },
661
654
  'seedance-2.5-edit': {
662
655
  aspectRatios: SEEDANCE_ASPECT_RATIOS,
663
- // Same ladder as the generation row (1080p added 2026-08-24). EvoLink's
664
- // rate card carries 1080p on the edit/extend row and BytePlus's video-input
665
- // column runs the full tier list; an edit bills that tier × 2.
666
- videoResolution: { options: ['480p', '720p', '1080p'], default: '720p' },
656
+ videoResolution: { options: ['480p', '720p', '1080p', '4k'], default: '720p' },
667
657
  duration: { min: 4, max: 30, mode: 'continuous' },
668
658
  // 🚨 ZERO, AND IT MUST MATCH WHAT THE HANDLER SENDS. The model's edit task
669
659
  // type does accept reference images, but slate's
@@ -207,7 +207,7 @@ export const MODEL_FACTS = [
207
207
  kind: 'video',
208
208
  ...caps('seedance-2'),
209
209
  audioRefNeedsCompanion: true,
210
- notes: 'THE 4K AND VALUE SEAT beside the 2.5 default — the only Seedance with native 4K (Pro-gated; base accounts get PRO_REQUIRED) and cheaper than 2.5 at every resolution they share, with the same physics, effects and scale strengths; shorter takes, fewer references, no timestamps. VIDEO-ONLY. A bare "seedance" still resolves here for older CLIs that expect 4K.',
210
+ notes: 'The lower-cost Seedance seat through native 4K (Pro), with the same physics, effects and scale strengths; shorter takes, fewer references, no timestamps. VIDEO-ONLY. A bare "seedance" still resolves here for older CLIs that expect 4K.',
211
211
  },
212
212
  {
213
213
  id: 'seedance-2.5',
@@ -218,7 +218,7 @@ export const MODEL_FACTS = [
218
218
  ...caps('seedance-2.5'),
219
219
  // No companion requirement — audio-only references are one of the things
220
220
  // the second seat actually buys.
221
- notes: 'DEFAULT VIDEO MODEL — the strongest seat for physics, effects, scale and hero shots, and the only Seedance that takes long single takes, many references, audio-only references and integer-second timestamps. No 4K, and dearer than 2.0 at every shared resolution: go to 2.0 for 4K or the same resolution cheaper. LENGTH is the price dial — quote long takes first. VIDEO-ONLY. Timestamp grammar and the edit/extend words that make the provider reclassify and fail a generation are in slates-prompting-seedance-2-5.',
221
+ notes: 'DEFAULT VIDEO MODEL — the strongest seat for physics, effects, scale and hero shots, and the only Seedance that takes long single takes, many references, audio-only references and integer-second timestamps. Generate directly through native 4K (Pro), or finish a selected 480p draft at 1080p or 4K. The final is billed separately at full duration. LENGTH is the price dial — quote long takes first. VIDEO-ONLY. Timestamp grammar and the edit/extend words that make the provider reclassify and fail a generation are in slates-prompting-seedance-2-5.',
222
222
  },
223
223
  {
224
224
  id: 'seedance-2.5-edit',
@@ -121,7 +121,7 @@ const SEEDANCE_25 = {
121
121
  ...SEEDANCE,
122
122
  label: 'Seedance 2.5',
123
123
  intro: [
124
- 'Seedance 2.5 is the default video model. Against 2.0 it buys one 30-second take instead of 15, up to 30 image references (plus 10 video and 10 audio), audio-only references and integer-second timestamps — and it gives up 4K. It runs at 480p, 720p or 1080p, and it costs more than 2.0 at every tier they share, so pick 2.0 when you want the same resolution cheaper or you want 4K.',
124
+ 'Seedance 2.5 supports takes up to 30 seconds, up to 30 image references plus 10 video and 10 audio references, audio-only references and integer-second timestamps. Both 2.0 and 2.5 can generate directly at native 4K with Pro. Choose 2.5 to cut with 480p drafts and finish approved takes at 1080p or 4K.',
125
125
  "ByteDance's official advanced formula has 8 slots: precise subject + action details + scene/environment + lighting & color tone + camera movement + visual style + image quality + constraints. Sweet spot 60-150 words for a single shot, longer for multi-shot.",
126
126
  ],
127
127
  columns: [
@@ -144,7 +144,7 @@ const SEEDANCE_25 = {
144
144
  {
145
145
  heading: '720p is not the cheap one here',
146
146
  example: '30s \u00b7 720p \u00b7 Seedance 2.5 Face = 489 credits\n15s \u00b7 1080p \u00b7 Seedance 2.0 Face = 411 credits',
147
- note: 'Length is what moves the price, and 2.5 doubles the length ceiling — so a 30-second 720p clip can cost more than a 15-second 1080p one, against a 1,000-credit starting balance. Explore at short LENGTH rather than low resolution: cut the seconds to 4-8 while you are finding the shot, and stay at the resolution you actually want. A 480p pass does not de-risk a 720p render — generation is stochastic, so the 720p run is a different take, not the same shot rendered better. The Generate button always shows the exact number first.',
147
+ note: 'Length affects the price. Try 4–8 seconds while finding the shot. For a take you can finish later, select Draft before generating and save the 480p proxy. The finish quote covers the whole source at the chosen resolution, including referenced video, even if the cut uses only a few seconds. The draft and final are billed separately.',
148
148
  critical: true,
149
149
  },
150
150
  {
@@ -80,6 +80,7 @@ export interface ShotParams {
80
80
  audioLanguage?: string;
81
81
  audioAccent?: string;
82
82
  generateMusic?: boolean;
83
+ seedanceDraft?: boolean;
83
84
  seedanceFace?: boolean;
84
85
  multiShot?: boolean;
85
86
  multiShotSegments?: Array<{
@@ -193,10 +193,13 @@ function readParams(v) {
193
193
  n('audioPromptInfluence');
194
194
  b('sound');
195
195
  b('generateMusic');
196
+ b('seedanceDraft');
196
197
  b('seedanceFace');
197
198
  b('multiShot');
198
199
  b('audioLoop');
199
200
  b('audioMultilingual');
201
+ if (out.seedanceDraft && out.videoResolution === undefined)
202
+ out.videoResolution = '480p';
200
203
  // Shape validation only. The pre-2026-09-09 tier MIGRATION deliberately does
201
204
  // NOT live here: this file is a dependency-free leaf, and the migration's
202
205
  // SSOT is `migrateGptQuality` in slate/src/shared/pricing.ts, applied in
@@ -35,6 +35,7 @@ export const BRAIN_SHAPE = {
35
35
  "rule": [
36
36
  "slates-blocking-to-prompt",
37
37
  "slates-camera-language",
38
+ "slates-cinematic-advertisement",
38
39
  "slates-cinematic-look",
39
40
  "slates-content-policy",
40
41
  "slates-cost-discipline",
@@ -45,6 +46,7 @@ export const BRAIN_SHAPE = {
45
46
  "slates-shot-variety",
46
47
  "slates-style-prompting",
47
48
  "slates-transitions",
49
+ "slates-ugc-advertisement",
48
50
  "slates-vision-feedback-loop"
49
51
  ],
50
52
  "model": [
@@ -74,8 +76,8 @@ export const BRAIN_SHAPE = {
74
76
  "model": 6500
75
77
  },
76
78
  "layerWords": {
77
- "playbook": 29500,
78
- "rule": 25000,
79
+ "playbook": 29600,
80
+ "rule": 29000,
79
81
  "model": 43000
80
82
  },
81
83
  "mine": {
@@ -0,0 +1,34 @@
1
+ /** The file a lesson goes to when the agent names none. */
2
+ export declare const MY_BRAIN_RULES = "my-rules";
3
+ export interface RememberInput {
4
+ /** One lesson in the user's words, as a rule or a preset ("cut every hook to its first word"). */
5
+ lesson?: string;
6
+ /** Their file to put it in; a shared guide's name adds to that guide for them. */
7
+ file?: string;
8
+ /** What taught it: "said always", "corrected twice", "kept take IMG-A8". */
9
+ source?: string;
10
+ /** An existing line this lesson replaces, or with no lesson, the line to remove (undo, forget). */
11
+ replaces?: string;
12
+ }
13
+ export interface RememberResult {
14
+ file: string;
15
+ saved?: string;
16
+ removed?: string;
17
+ unchanged?: boolean;
18
+ }
19
+ /** Whether agents may save lessons on their own. On unless the user switched it off (the desktop's My brain panel). */
20
+ export declare function myBrainLearning(dir?: string): boolean;
21
+ export declare function setMyBrainLearning(on: boolean, dir?: string): void;
22
+ export interface MyBrainLesson {
23
+ text: string;
24
+ source: string;
25
+ date: string;
26
+ }
27
+ /** Every saved lesson, file by file, for a panel that lists them; lines written by hand are not lessons and are left out. */
28
+ export declare function myBrainLessons(dir?: string): Array<{
29
+ file: string;
30
+ lessons: MyBrainLesson[];
31
+ }>;
32
+ /** Add, replace or remove one lesson. Throws with a reason the agent can act on. */
33
+ export declare function remember(input: RememberInput, dir?: string, now?: Date): RememberResult;
34
+ //# sourceMappingURL=my-brain-write.d.ts.map
@@ -0,0 +1,126 @@
1
+ // ============================================================
2
+ // MY BRAIN, THE WRITE SIDE: a lesson the user teaches lands in their own brain
3
+ // (second-brain plans/2026-10-25-slates-brain.md § My brain, step 5).
4
+ //
5
+ // One lesson is one line in the operative summary of one file, with its source
6
+ // and date, so the loader (my-brain.ts) reads it first and every line can be
7
+ // traced and reverted. A lesson already there is not written twice; one that
8
+ // replaces an older line removes it, and the older line is kept in
9
+ // .history.jsonl (the newest wins, the loser is logged). After every write the
10
+ // file is checked with the loader's own checks; a write that would leave it
11
+ // unloaded (over a cap, a passage the shared brain already holds) is undone and
12
+ // the reason returned, so the agent consolidates instead.
13
+ // ============================================================
14
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
15
+ import { join } from 'node:path';
16
+ import { MY_BRAIN_PROFILE, loadMyBrain, myBrainDir } from './my-brain.js';
17
+ const NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
18
+ const SUMMARY_RE = /(<!--\s*@operative:start\s*-->\r?\n)([\s\S]*?)(<!--\s*@operative:end\s*-->)/;
19
+ const LESSON_RE = /^- (.*?) _\(from (.*?), (\d{4}-\d{2}-\d{2})\)_$/;
20
+ const HISTORY_FILE = '.history.jsonl';
21
+ /** The file a lesson goes to when the agent names none. */
22
+ export const MY_BRAIN_RULES = 'my-rules';
23
+ const norm = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
24
+ const oneLine = (text) => text.replace(/\s+/g, ' ').trim();
25
+ function newFile(name) {
26
+ const title = name === MY_BRAIN_PROFILE ? 'My profile' : name === MY_BRAIN_RULES ? 'My rules' : `My ${name.replace(/-/g, ' ')}`;
27
+ const what = name === MY_BRAIN_PROFILE ? 'who they are, what they make, for whom, in what voice' : 'rules and presets they taught Slates';
28
+ return `---\nname: ${name}\ndescription: "${title}: ${what}. Theirs, and it wins over the shared brain."\n---\n\n# ${title}\n\n<!-- @operative:start -->\n**Operative summary.**\n<!-- @operative:end -->\n`;
29
+ }
30
+ function writeAtomic(path, text) {
31
+ const temp = `${path}.${process.pid}.tmp`;
32
+ writeFileSync(temp, text);
33
+ renameSync(temp, path);
34
+ }
35
+ const SETTINGS_FILE = '.settings.json';
36
+ /** Whether agents may save lessons on their own. On unless the user switched it off (the desktop's My brain panel). */
37
+ export function myBrainLearning(dir = myBrainDir()) {
38
+ try {
39
+ return JSON.parse(readFileSync(join(dir, SETTINGS_FILE), 'utf8')).learning !== false;
40
+ }
41
+ catch {
42
+ return true;
43
+ }
44
+ }
45
+ export function setMyBrainLearning(on, dir = myBrainDir()) {
46
+ mkdirSync(dir, { recursive: true });
47
+ writeAtomic(join(dir, SETTINGS_FILE), JSON.stringify({ learning: on }, null, 2));
48
+ }
49
+ /** Every saved lesson, file by file, for a panel that lists them; lines written by hand are not lessons and are left out. */
50
+ export function myBrainLessons(dir = myBrainDir()) {
51
+ const { files } = loadMyBrain(dir);
52
+ return Object.entries(files).map(([file, text]) => ({
53
+ file,
54
+ lessons: (SUMMARY_RE.exec(text)?.[2] ?? '').split(/\r?\n/).flatMap((l) => {
55
+ const m = LESSON_RE.exec(l);
56
+ return m ? [{ text: m[1], source: m[2], date: m[3] }] : [];
57
+ }),
58
+ })).filter((f) => f.lessons.length);
59
+ }
60
+ /** Add, replace or remove one lesson. Throws with a reason the agent can act on. */
61
+ export function remember(input, dir = myBrainDir(), now = new Date()) {
62
+ if (input.lesson && !myBrainLearning(dir))
63
+ throw new Error('not saved: the user turned learning off (Settings → AI tools → My brain). Tell them in one line; nothing was saved.');
64
+ const file = (input.file ?? MY_BRAIN_RULES).trim().toLowerCase();
65
+ if (!NAME_RE.test(file))
66
+ throw new Error('file must be lowercase words joined by hyphens, for example "hooks" or "profile"');
67
+ const lesson = input.lesson ? oneLine(input.lesson) : '';
68
+ const replaces = input.replaces ? norm(input.replaces) : '';
69
+ if (!lesson && !replaces)
70
+ throw new Error('pass a lesson to save, or replaces alone to remove a line');
71
+ if (lesson.includes('_(from '))
72
+ throw new Error('write the lesson alone; the source goes in source');
73
+ const path = join(dir, `${file}.md`);
74
+ const before = existsSync(path) ? readFileSync(path, 'utf8') : null;
75
+ if (before === null && !lesson)
76
+ throw new Error(`${file}.md does not exist, so there is nothing to remove`);
77
+ const text = before ?? newFile(file);
78
+ const match = SUMMARY_RE.exec(text);
79
+ if (!match)
80
+ throw new Error(`${file}.md has no operative summary to add to; fix the file or name another`);
81
+ const lines = match[2].split(/\r?\n/).filter((l) => l.trim());
82
+ const lessonText = (l) => {
83
+ const m = LESSON_RE.exec(l);
84
+ return m ? norm(m[1]) : null;
85
+ };
86
+ if (lesson && lines.some((l) => lessonText(l) === norm(lesson)))
87
+ return { file, saved: lesson, unchanged: true };
88
+ let removed;
89
+ if (replaces) {
90
+ const at = lines.findIndex((l) => lessonText(l) === replaces) >= 0
91
+ ? lines.findIndex((l) => lessonText(l) === replaces)
92
+ : lines.findIndex((l) => lessonText(l)?.includes(replaces));
93
+ if (at >= 0) {
94
+ removed = LESSON_RE.exec(lines[at])[1];
95
+ lines.splice(at, 1);
96
+ }
97
+ else if (!lesson)
98
+ throw new Error(`no line in ${file}.md matches "${input.replaces}"`);
99
+ }
100
+ if (lesson)
101
+ lines.push(`- ${lesson} _(from ${oneLine(input.source || 'the user')}, ${now.toISOString().slice(0, 10)})_`);
102
+ const next = text.replace(SUMMARY_RE, (_all, start, _body, end) => `${start}${lines.join('\n')}\n${end}`);
103
+ mkdirSync(dir, { recursive: true });
104
+ // A file this op made, left with no lesson, is removed whole; a file with anything else of theirs is kept.
105
+ const empty = next.trim() === newFile(file).trim();
106
+ if (empty)
107
+ rmSync(path);
108
+ else
109
+ writeAtomic(path, next);
110
+ const problem = empty ? undefined : loadMyBrain(dir).skipped.find((s) => s.file === `${file}.md`);
111
+ if (problem) {
112
+ if (before === null)
113
+ rmSync(path);
114
+ else
115
+ writeAtomic(path, before);
116
+ throw new Error(`not saved: ${problem.reason}. Merge it into a line ${file}.md already has (pass replaces), or remove one first.`);
117
+ }
118
+ try {
119
+ appendFileSync(join(dir, HISTORY_FILE), `${JSON.stringify({ at: now.toISOString(), file, saved: lesson || undefined, removed, source: input.source })}\n`);
120
+ }
121
+ catch {
122
+ // The history is for tracing; the lesson is saved either way.
123
+ }
124
+ return { file, ...(lesson ? { saved: lesson } : {}), ...(removed ? { removed } : {}) };
125
+ }
126
+ //# sourceMappingURL=my-brain-write.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slatesvideo/shared",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "description": "Shared operations layer for the Slates MCP server and CLI: auth, cloud/desktop clients, and the single tool surface both consume. Most users want @slatesvideo/mcp-server or @slatesvideo/cli instead.",
5
5
  "license": "MIT",
6
6
  "type": "module",