@slatesvideo/shared 0.7.24 → 0.7.25

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.
@@ -7964,12 +7964,29 @@ export const updateOverlayClip = {
7964
7964
  },
7965
7965
  };
7966
7966
  const KEYFRAME_PROPERTY_IDS = ['positionX', 'positionY', 'scale', 'rotation', 'opacity', 'cropLeft', 'cropTop', 'cropRight', 'cropBottom', 'focusX', 'focusY', 'zoom',
7967
- 'saturation', 'grain', 'exposure', 'pitch', 'yaw', 'perspective', 'radius', 'shadowX', 'shadowY', 'shadowBlur', 'shadowOpacity', 'borderWidth', 'borderOpacity',
7967
+ 'saturation', 'grain', 'exposure', 'contrast', 'temperature', 'tint', 'highlights', 'shadows',
7968
+ 'lutIntensity', 'matteFeather', 'chromaTolerance', 'chromaSoftness', 'chromaSpill',
7969
+ 'pitch', 'yaw', 'perspective', 'radius', 'shadowX', 'shadowY', 'shadowBlur', 'shadowOpacity', 'borderWidth', 'borderOpacity',
7968
7970
  'shadowRed', 'shadowGreen', 'shadowBlue', 'borderRed', 'borderGreen', 'borderBlue', 'blur'];
7969
7971
  /** The keys a desktop before layers and panels refuses. */
7970
7972
  const PANEL_KEY_IDS = new Set(KEYFRAME_PROPERTY_IDS.slice(KEYFRAME_PROPERTY_IDS.indexOf('saturation')));
7971
7973
  /** A panel colour's channels, which a desktop before panel colour keys refuses. */
7972
7974
  const PANEL_COLOUR_KEY_IDS = new Set(['shadowRed', 'shadowGreen', 'shadowBlue', 'borderRed', 'borderGreen', 'borderBlue']);
7975
+ /** Mirrors the grade, LUT and mask ranges in slate's KEYFRAME_PROPERTIES (lockstep check 12). */
7976
+ const GRADE_MASK_KEY_RANGES = {
7977
+ contrast: { min: -1, max: 1 },
7978
+ temperature: { min: -1, max: 1 },
7979
+ tint: { min: -1, max: 1 },
7980
+ highlights: { min: -1, max: 1 },
7981
+ shadows: { min: -1, max: 1 },
7982
+ lutIntensity: { min: 0, max: 1 },
7983
+ matteFeather: { min: 0, max: 1 },
7984
+ chromaTolerance: { min: 0, max: 1 },
7985
+ chromaSoftness: { min: 0, max: 1 },
7986
+ chromaSpill: { min: 0, max: 1 },
7987
+ };
7988
+ const GRADE_MASK_KEY_IDS = new Set(Object.keys(GRADE_MASK_KEY_RANGES));
7989
+ const GRADE_MASK_KEY_LIMITS = Object.entries(GRADE_MASK_KEY_RANGES).map(([id, { min, max }]) => `${id} ${min}..${max}`).join(', ');
7973
7990
  export const setClipKeyframes = {
7974
7991
  id: 'slates_set_clip_keyframes',
7975
7992
  description: "Animate or set a timeline clip's transform with keyframes: a punch-in, a slow push, a Ken Burns move, a slide, a spin, a fade, a crop. Each property you name gets exactly the keys you send ([] clears it back to its static value); properties you leave out keep theirs, and all of them land in one transaction. One key holds a value for the whole clip. Frames count from the clip's start and may fall between frames (110.4), read at that exact time. Units: positionX/positionY move the picture's centre in frame widths/heights (0.1 = a tenth of the frame right or down, -4..4); scale multiplies the framed size about the frame's centre (1 = as framed, 0.01..20); rotation is degrees clockwise; opacity 0..1; cropLeft/Top/Right/Bottom remove that fraction of the source from its side (0..0.99); focusX/focusY (0..1) and zoom (1..20) animate the clip's reframe for the aspect being exported. The look and the panel key too, each key replacing the clip's own value: saturation 0..2 (1 as shot), grain 0..1, exposure -4..4 stops; pitch and yaw -85..85 degrees, perspective 0..1; radius 0..0.5, shadowX and shadowY -0.5..0.5, shadowBlur 0..0.25 and borderWidth 0..0.05, all in frame heights; shadowOpacity and borderOpacity 0..1 (a key above 0 draws a shadow or border the clip has none of); a shadow or border colour keys as its red, green and blue, each 0..1 (shadowRed, shadowGreen, shadowBlue; borderRed, borderGreen, borderBlue), keyed on the same frames so the colour eases from key to key; blur 0..1. Drawn by the Cut's monitor and its export alike, both the timeline engine. Returns the clip's keys; slates_get_timeline lists every clip's keys in timeline.keyframes. Requires timeline-keyframes; update Slates on capability refusal.",
@@ -7981,7 +7998,7 @@ export const setClipKeyframes = {
7981
7998
  .object(Object.fromEntries(KEYFRAME_PROPERTY_IDS.map((id) => [id, keyframeList.optional()])))
7982
7999
  .strict()
7983
8000
  .refine((p) => Object.keys(p).length > 0, { message: 'name at least one property' })
7984
- .describe('Each property to set, with its keys. Example punch-in over one second at 24 fps: {"scale":[{"frame":0,"value":1,"easing":"ease-in-out"},{"frame":24,"value":1.25}]}.'),
8001
+ .describe(`Each property to set, with its keys. Grade, LUT and mask ranges: ${GRADE_MASK_KEY_LIMITS}. LUT and mask keys apply only while the corresponding LUT or mask is present. matteFeather is for subject or shape masks. Example punch-in over one second at 24 fps: {"scale":[{"frame":0,"value":1,"easing":"ease-in-out"},{"frame":24,"value":1.25}]}.`),
7985
8002
  }),
7986
8003
  async run(input, ctx) {
7987
8004
  const desktop = ctx.desktop();
@@ -7990,6 +8007,8 @@ export const setClipKeyframes = {
7990
8007
  await desktop.requireCapability('clip-panels', "keys on a clip's look, 3D, panel and blur");
7991
8008
  if (Object.keys(input.properties).some((id) => PANEL_COLOUR_KEY_IDS.has(id)))
7992
8009
  await desktop.requireCapability('panel-colour-keys', "keys on a panel's shadow and border colours");
8010
+ if (Object.keys(input.properties).some((id) => GRADE_MASK_KEY_IDS.has(id)))
8011
+ await desktop.requireCapability('grade-mask-keys', 'keys on grade, LUT strength and mask amounts');
7993
8012
  await requireKeysBetweenFrames(desktop, ...Object.values(input.properties));
7994
8013
  return ok(await desktop.post('/agent/timeline/keyframes', input));
7995
8014
  },
@@ -10073,6 +10092,57 @@ export const writeScriptDocument = {
10073
10092
  return ok(data, 'Script document updated.');
10074
10093
  },
10075
10094
  };
10095
+ // The document capability predates the Markdown and breakdown routes.
10096
+ const SCRIPT_MARKDOWN_MIN_VERSION = '1.6.15';
10097
+ export const readScriptMarkdown = {
10098
+ id: 'slates_read_script_markdown',
10099
+ description: 'Read the board script as anchored Markdown, with its revision, scene and block offsets, Shot ranges, and new human edits. Advances the reader’s cursor. For edits or a shot breakdown, open the job’s playbook first, then read the script. Use slates_get_script_document for structured text and formatting without advancing the cursor.',
10100
+ input: z.object({
10101
+ storyboardId: z.string().uuid(),
10102
+ readerId: z.string().refine(id => id.trim().length > 0).optional()
10103
+ .describe('Reuse a stable reader ID to track human edits independently. Defaults to default.'),
10104
+ }),
10105
+ async run(input, ctx) {
10106
+ await ctx.desktop().requireCapability('script-documents', 'Reading script Markdown', SCRIPT_MARKDOWN_MIN_VERSION);
10107
+ return ok(await ctx.desktop().post('/agent/script/read', input), 'Script Markdown read and reader cursor advanced.');
10108
+ },
10109
+ };
10110
+ export const proposeScriptMarkdown = {
10111
+ id: 'slates_propose_script_markdown',
10112
+ description: 'Propose changes to the board’s anchored Markdown as a group of text and formatting suggestions for review. Returns the group ID and redlines, or a null group ID if nothing changed. Read with slates_read_script_markdown first and preserve scene anchors in order. For exact passage suggestions use slates_update_script_suggestions. For a direct text edit use slates_edit_script.',
10113
+ input: z.object({
10114
+ storyboardId: z.string().uuid(),
10115
+ boardRevision: z.number().int().nonnegative().describe('The revision returned by slates_read_script_markdown. Stale revisions are refused.'),
10116
+ markdown: z.string().describe('The full revised Markdown, with the scene anchor comments in their original order.'),
10117
+ }),
10118
+ async run(input, ctx) {
10119
+ await ctx.desktop().requireCapability('script-documents', 'Proposing script Markdown edits', SCRIPT_MARKDOWN_MIN_VERSION);
10120
+ const data = await ctx.desktop().post('/agent/script/write', input);
10121
+ return ok(data, data.groupId ? 'Script Markdown edits proposed for review.' : 'The proposed Markdown matches the script.');
10122
+ },
10123
+ };
10124
+ const shotBreakdownInput = z.object({
10125
+ storyboardId: z.string().uuid(),
10126
+ boardRevision: z.number().int().nonnegative().describe('The revision returned by slates_read_script_markdown. Stale revisions are refused.'),
10127
+ ranges: z.array(z.object({ sceneId: z.string().uuid(), start: z.number().int().nonnegative(), end: z.number().int().positive() })).min(1)
10128
+ .describe('Non-overlapping UTF-16 ranges [start, end) in scene text. Include each affected Shot in full.'),
10129
+ options: z.array(z.object({
10130
+ name: z.string().refine(name => name.trim().length > 0),
10131
+ rationale: z.string(),
10132
+ cuts: z.array(z.object({ sceneId: z.string().uuid(), at: z.number().int().positive() }))
10133
+ .describe('UTF-16 cut offsets between words inside the affected ranges. An empty list leaves each range as one segment.'),
10134
+ })).min(2).refine(options => new Set(options.map(option => option.name)).size === options.length)
10135
+ .describe('At least two distinctly named cut options.'),
10136
+ });
10137
+ export const proposeShotBreakdown = {
10138
+ id: 'slates_propose_shot_breakdown',
10139
+ description: 'Save alternative ways to cut script passages into Shots for the creator to review in Slates. Returns the proposal ID, options, existing Shot ranges and a preview of settings each merge would discard. The script and Shots change only when the creator applies an option. For immediate Shot creation from ranges, use slates_update_script_document.',
10140
+ input: shotBreakdownInput,
10141
+ async run(input, ctx) {
10142
+ await ctx.desktop().requireCapability('script-documents', 'Proposing a shot breakdown', SCRIPT_MARKDOWN_MIN_VERSION);
10143
+ return ok(await ctx.desktop().post('/agent/script/propose-breakdown', input), 'Shot breakdown proposed for review.');
10144
+ },
10145
+ };
10076
10146
  export const editScript = {
10077
10147
  id: 'slates_edit_script',
10078
10148
  description: "One text replacement in one scene (for several edits, formatting or scene changes in one write, use slates_update_script_document): one contiguous replacement — `removed` characters at `at` become `text` (insert: removed 0; delete: text ''). Every Shot's range follows the way comment anchors follow a document: text before a Shot moves it, text after leaves it, an edit inside grows or shrinks it, typing at its end extends it unless the text starts a new line, and deleting all of a Shot's words leaves it with no words and no place on the page. Every affected Shot's `line` changes at once: this is editing the Shots. Read slates_get_script first; offsets are into that text. Pass its `rev` (or the document `revision` as `expectedRevision`): when the Script page or anything else changed the words since, the edit is refused ('the script changed since you read it', or SCRIPT_CONFLICT for a stale revision), and you re-read and measure again. The result carries the new `rev` and `revision` for a following edit.",
@@ -11304,6 +11374,9 @@ export const ALL_OPERATIONS = [
11304
11374
  getScriptSuggestions,
11305
11375
  changeScriptSuggestions,
11306
11376
  getScriptDocument,
11377
+ readScriptMarkdown,
11378
+ proposeScriptMarkdown,
11379
+ proposeShotBreakdown,
11307
11380
  writeScriptDocument,
11308
11381
  editScript,
11309
11382
  makeShotFromScript,
@@ -178,7 +178,13 @@ export const OPERATION_GROUPS = {
178
178
  'slates_link_asset_source',
179
179
  ],
180
180
  // The cut and the export. A generation session never touches these.
181
- 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'],
181
+ script: [
182
+ 'slates_get_script_document', 'slates_update_script_document', 'slates_read_script_markdown',
183
+ 'slates_propose_script_markdown', 'slates_propose_shot_breakdown', 'slates_get_script_sections',
184
+ 'slates_update_script_section', 'slates_get_script_suggestions', 'slates_update_script_suggestions',
185
+ 'slates_get_script_uses', 'slates_preview_script_variation', 'slates_create_script_variation',
186
+ 'slates_get_shot_inputs', 'slates_reuse_shot_take',
187
+ ],
182
188
  timeline: [
183
189
  'slates_list_timelines', 'slates_save_timeline', 'slates_export_cuts',
184
190
  'slates_quote_cut_drafts', 'slates_finish_cut_drafts', 'slates_get_cut_draft_status',
@@ -80,7 +80,7 @@ export function buildSkillIndex() {
80
80
  // pointer to the full method. mcp-instructions-smoke asserts these lines and
81
81
  // that pointer land inside the cut when UPDATE AVAILABLE follows the first
82
82
  // doctrine paragraph.
83
- const PREAMBLE = fork(`You are Slates Director — a production assistant living inside Slates, the AI video creation studio. Turn the user's vision into finished work using the optional Slates tools and relevant production craft. Choose the workflow for the brief; start from the user's existing material and bring results into their project or timeline when asked.`, `Turn the user's vision into finished work in Slates. Start every job at slates_get_prompting_guide(topic: "${BRAIN_ROUTER}"). Tools generate real media and spend credits. Before generation, estimate every step, show the itemized total and wait for approval.
83
+ const PREAMBLE = fork(`You are Slates Director — a production assistant living inside Slates, the AI video creation studio. Turn the user's vision into finished work using the optional Slates tools and relevant production craft. Choose the workflow for the brief; start from the user's existing material and bring results into their project or timeline when asked.`, `Turn the user's vision into finished work in Slates. First, use slates_get_prompting_guide to read "${BRAIN_ROUTER}" or the job's playbook. Generation tools spend credits. Before generation, estimate every step, show the itemized total and wait for approval.
84
84
 
85
85
  ## Essentials
86
86
 
@@ -88,7 +88,7 @@ const PREAMBLE = fork(`You are Slates Director — a production assistant living
88
88
  - SPENDING: before ANY generation, price every step with slates_estimate_generation_cost, show the user the itemized total in ONE message, and wait for their OK. Pass confirm: true only to relay an explicit user OK for that exact spend.
89
89
  - REAL NUMBERS ONLY: every cost, balance or count you state is copied from a tool result in this session. Never describe how a generation looks unless you fetched it this session.
90
90
  - PROJECT: call slates_get_workspace_state once and work in the user's current project; never create one unless asked. Read any shot or board they name before answering.
91
- - CRAFT: call slates_get_prompting_guide for the job's playbook before answering. Estimate cards cover single shots; full guide (depth: full) for multi-ref, previs, edits, lip-sync, motion transfer or retries. UI: "app-manual".
91
+ - CRAFT: read the job's playbook before using script, timeline, or edit tools. Estimate cards cover single shots; full guide (depth: full) for multi-ref, previs, edits, lip-sync, motion transfer or retries. UI: "app-manual".
92
92
  - Speak in the app's words and name assets by code and label (IMG-A12), never by tool name or UUID.`);
93
93
  // ── The working method ─────────────────────────────────────────────
94
94
  export const WORKING_METHOD = [
@@ -181,7 +181,7 @@ export const HARD_RULES = [
181
181
  // record, so this paragraph would be dead weight in its cached prefix.
182
182
  const MCP_FOOTER = `## Working without skill files
183
183
 
184
- If slates-* skill files are not installed in this client, every one of them is still reachable as data: call slates_get_prompting_guide with the skill name. Query the brief or browse topic "catalog" for generated discovery and entitled member playbooks. "No skill installed" is never a reason to prompt a model blind.
184
+ If slates-* skill files are missing, fetch them by name with slates_get_prompting_guide. Query with the brief or browse topic "catalog" for generated discovery and entitled member playbooks. "No skill installed" is never a reason to prompt a model blind.
185
185
  `;
186
186
  // ── The MCP instructions: what every request needs ────────────────
187
187
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slatesvideo/shared",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
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",