diff --git a/apps/api/src/opendirector_api/creation.py b/apps/api/src/opendirector_api/creation.py index d2a685de4..4fd3d2b90 100644 --- a/apps/api/src/opendirector_api/creation.py +++ b/apps/api/src/opendirector_api/creation.py @@ -184,7 +184,9 @@ async def execute(project_id: UUID, value: Command, request: Request, x_opendire imported_from = x_canvas_import if x_canvas_import in {'generated', 'edited'} else None if x_canvas_import is not None and imported_from is None: raise ProjectError('归档来源必须是 generated 或 edited。', 400) - if value.type in {'generation.submit', 'job.cancel', 'job.recover'}: + if value.type in {'generation.submit', 'job.cancel', 'job.recover', + 'pipeline.start', 'pipeline.pause', 'pipeline.resume', + 'pipeline.cancel', 'pipeline.retry', 'pipeline.adopt'}: if generation is None: raise ProjectError('任务服务不可用。', 503) receipt = await generation.execute(value, session=session) @@ -228,6 +230,17 @@ def projection(project_id: UUID): async def query(project_id: UUID, value: CreationQuery): if value.projectId != project_id: raise ProjectError('查询不属于当前工程。') + if value.type in {'pipeline.plan', 'pipeline.execution.get', 'pipeline.executions.list'}: + executor = getattr(generation, 'pipelines', None) + if executor is None: + raise ProjectError('流水线执行服务不可用。', 503, code='pipeline_unavailable') + if value.type == 'pipeline.plan': + return await executor.plan( + project_id, value.scope, cache_policy=value.cachePolicy, force_from_item_id=value.forceFromItemId, + ) + if value.type == 'pipeline.executions.list': + return {'executions': await executor.history(project_id, value.groupId)} + return await executor.status(project_id, value.objectId) result = await canvas.query(value) if value.type == 'asset.preview' and 'preview' in result: result['preview'].pop('path') diff --git a/apps/api/src/opendirector_api/main.py b/apps/api/src/opendirector_api/main.py index 3b4bf88a3..d0f0a3abf 100644 --- a/apps/api/src/opendirector_api/main.py +++ b/apps/api/src/opendirector_api/main.py @@ -16,6 +16,7 @@ from opendirector.domain.creation.validation import ContractError from opendirector.domain.settings import GeneralSettings, GeneralSettingsPatch from opendirector.application.creation_generation import CreationGeneration +from opendirector.application.creation_pipeline import PipelineExecutor from opendirector.application.model_catalog import ModelCatalog from opendirector.application.model_availability import ModelAvailability from opendirector.application.preferences import Preferences @@ -61,6 +62,8 @@ def create_app(store: LocalProjects | None = None, chat_provider=None, generatio creation_projects = CreationProjects(store) availability = ModelAvailability(model_configs, capability_probe) creation_generation = CreationGeneration(creation_projects, model_configs, generation_provider, availability=availability) + pipelines = PipelineExecutor(creation_projects, creation_generation, model_configs) + creation_generation.pipelines = pipelines creation_tools = ToolTasks(store, model_configs, CreationToolAssets(creation_projects), projects=creation_projects, availability=availability) catalog = ModelCatalog(model_configs, chat_provider or ChatCompletions(), availability) @@ -71,6 +74,7 @@ async def lifespan(app): await creation_generation.start() try: await creation_tools.start() + await pipelines.start() yield finally: agents = [entry.task for entry in list(active_agents.values()) if entry.task is not None] @@ -78,6 +82,7 @@ async def lifespan(app): agent.cancel() await asyncio.gather(*agents, return_exceptions=True) try: + await pipelines.close() await creation_tools.close() finally: await creation_generation.close() diff --git a/docs/development/lessons.md b/docs/development/lessons.md index f012d62d0..a706d3b93 100644 --- a/docs/development/lessons.md +++ b/docs/development/lessons.md @@ -148,3 +148,9 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u - **Trigger:** Reusing one editor component inside a settings dialog and inside a first-run page. - **Lesson:** The model service editor renders under both `.cw-settings-dialog` and the first-run `.cw-welcome` setup step. Every shared control rule was written as a descendant of the dialog, so the second host silently fell back to bare browser controls: buttons lost border, padding and radius, inputs lost their height, and the `--settings-*` metrics declared on the dialog were undefined. The markup was correct in both hosts, which is why text and click assertions passed while the layout was unusable. - **Check:** Hang shared styles off the component's own root and use `:is(hostA, hostB)` only where a rule must still win from the host. Declare the component's design tokens and inherited `font` on that root too; a `var()` whose declaration lives on one host does not fail loudly, it resolves to the inherited or initial value. Compare computed styles and geometry of the same controls under both hosts before and after the change, on a freshly started dev server; a stale module graph can serve the previous CSS and make an unchanged reading look like proof. + +## Tool schemas distinguish query envelopes from nested inputs + +- **Trigger:** Adding a nested input model to an Agent query. +- **Lesson:** [PR #565](https://github.com/ThinkFlowLab/OpenDirector/pull/565) added Pipeline scopes to the query schema. Removing host-provided IDs from every definition raised `KeyError: 'queryId'` on a scope definition and prevented Agent turns from starting. +- **Check:** Project host-owned fields out of the root query branches. Verify that the exposed tool schema preserves nested discriminators and required fields, and that an Agent turn can initialize its tool gateway. diff --git a/feature-assets/pipeline/pipeline-two-branch-merge.png b/feature-assets/pipeline/pipeline-two-branch-merge.png new file mode 100644 index 000000000..e26a63643 Binary files /dev/null and b/feature-assets/pipeline/pipeline-two-branch-merge.png differ diff --git a/packages/core/src/opendirector/agent/tools.py b/packages/core/src/opendirector/agent/tools.py index c8c8cfb47..a3610de92 100644 --- a/packages/core/src/opendirector/agent/tools.py +++ b/packages/core/src/opendirector/agent/tools.py @@ -260,7 +260,9 @@ def tools() -> list[dict]: 'additionalProperties': False})) query_schema = TypeAdapter(Query).json_schema() query_schema['type'] = 'object' - for definition in query_schema['$defs'].values(): + for branch in query_schema['oneOf']: + name = branch['$ref'].removeprefix('#/$defs/') + definition = query_schema['$defs'][name] for field in ('queryId', 'projectId'): definition['properties'].pop(field) definition['required'].remove(field) @@ -389,6 +391,17 @@ def recording(): # A rejected query must name the accepted types rather than echo a # tag list the model has to reinterpret. raise ProjectError(query_guidance(failure)) from None + if query.type in {'pipeline.plan', 'pipeline.execution.get', 'pipeline.executions.list'}: + executor = getattr(self.generation, 'pipelines', None) + if executor is None: + raise ProjectError('流水线执行服务不可用。', 503, code='pipeline_unavailable') + if query.type == 'pipeline.plan': + return await executor.plan( + project_id, query.scope, cache_policy=query.cachePolicy, force_from_item_id=query.forceFromItemId, + ) + if query.type == 'pipeline.executions.list': + return {'executions': await executor.history(project_id, query.groupId)} + return await executor.status(project_id, query.objectId) result = await CreationCanvas(self.projects).query(query) if query.type == 'asset.preview' and 'preview' in result: with self.projects.local.transaction() as db: @@ -470,7 +483,8 @@ def narrow(value: JsonValue) -> None: raise ProjectError('批量命令包含未开放的 Agent 操作。', 403) if command.type == 'generation.submit': receipt = await self.generation.execute(command, session=session, source='agent', agent_origin=(turn_id, call_id)) - elif command.type in {'job.cancel', 'job.recover'}: + elif command.type in {'job.cancel', 'job.recover', 'pipeline.start', 'pipeline.pause', + 'pipeline.resume', 'pipeline.cancel', 'pipeline.retry', 'pipeline.adopt'}: receipt = await self.generation.execute(command, session=session, source='agent') elif command.type in {'asset.writeText', 'artifact.publish'}: if config is not None: diff --git a/packages/core/src/opendirector/application/creation_canvas.py b/packages/core/src/opendirector/application/creation_canvas.py index f97c6af96..13fe7d5fe 100644 --- a/packages/core/src/opendirector/application/creation_canvas.py +++ b/packages/core/src/opendirector/application/creation_canvas.py @@ -523,11 +523,11 @@ def _mutate(self, data, kind, payload): if (ref and str(ref.get('id')) == str(obj['id'])) or attached: self._editable(data, item['id']) old.update(obj) - elif kind == 'canvas.layoutRuns': + elif kind in {'canvas.layoutRuns', 'canvas.layoutPipelines'}: pass # The commit arranges the authoritative canvas after validating edits. elif kind == 'canvas.show': obj = payload.item.model_dump(mode='json') - if obj.get('autoLayout') == 'run' and obj['parentId'] is not None: + if obj.get('autoLayout') in {'run', 'pipeline'} and obj['parentId'] is not None: raise ContractError('canvas_run_layout_group', '自动排列只适用于顶层分组。', payload.item.id) if str(obj['projectId']) != str(data['project']['id']): raise ContractError('invalid_input', '节点不属于当前工程。') @@ -563,12 +563,12 @@ def _mutate(self, data, kind, payload): layout = value.pop('autoLayout', None) if layout is not None and item['kind'] != 'group': raise ContractError('canvas_run_layout_group', '自动排列只适用于顶层分组。', payload.itemId) - if layout == 'run': - item['autoLayout'] = 'run' + if layout in {'run', 'pipeline'}: + item['autoLayout'] = layout elif layout == 'free': item.pop('autoLayout', None) item.update({key: val for key, val in value.items() if key != 'itemId' and (val is not None or key == 'parentId')}) - if item.get('autoLayout') == 'run' and item['parentId'] is not None: + if item.get('autoLayout') in {'run', 'pipeline'} and item['parentId'] is not None: raise ContractError('canvas_run_layout_group', '自动排列只适用于顶层分组。', payload.itemId) if item.get('color') == '': item.pop('color') @@ -680,8 +680,14 @@ def _mutate(self, data, kind, payload): allowed = downstream_kinds(snapshot, source_item) if source_item else DOWNSTREAM.get(source_kind, set()) if spec['kind'] not in allowed: raise ContractError('reference_invalid', '该节点类型不能作为目标节点的参考。', payload.reference.id) - for value in resolve_reference(snapshot, payload.reference): - self._available(next(asset for asset in snapshot.assets if asset.id == value.asset.assetId)) + pending_generation = ( + ref['binding'] == 'follow_current' and source_item is not None + and source_item.binding.role == 'generation' + and current_asset(snapshot, source_item) is None + ) + if not pending_generation: + for value in resolve_reference(snapshot, payload.reference): + self._available(next(asset for asset in snapshot.assets if asset.id == value.asset.assetId)) elif kind == 'reference.remove': ref = self._get(data, 'reference', payload.referenceId) spec = self._get(data, 'generation_spec', ref['targetSpecId']) diff --git a/packages/core/src/opendirector/application/creation_generation.py b/packages/core/src/opendirector/application/creation_generation.py index 9af817f44..61e75cdff 100644 --- a/packages/core/src/opendirector/application/creation_generation.py +++ b/packages/core/src/opendirector/application/creation_generation.py @@ -21,6 +21,7 @@ from opendirector.domain.creation.assets import AssetProvenance from opendirector.domain.creation.canvas import TextCanvasItem, ImageCanvasItem, VideoCanvasItem, AudioCanvasItem from opendirector.domain.creation.base import ObjectVersion +from opendirector.domain.creation.commands import CommandReceipt, command_fingerprint from opendirector.domain.creation.commands import parse_command from opendirector.domain.creation.generation import (DEFAULT_MUSIC_SECONDS, InputSnapshot, Job, ResultVersion, execution_spec, reference_music_seconds, validate_generation) @@ -468,6 +469,31 @@ def accept(before): return self.projects.commit(command, accept, session=session, source=source) async def execute(self, command, *, session=None, source='ui', agent_origin=None): + if command.type in {'pipeline.start', 'pipeline.pause', 'pipeline.resume', + 'pipeline.cancel', 'pipeline.retry', 'pipeline.adopt'}: + executor = getattr(self, 'pipelines', None) + if executor is None: + raise ProjectError('流水线执行服务不可用。', 503, code='pipeline_unavailable') + fingerprint = command_fingerprint(command) + if command.type == 'pipeline.start': + execution = await executor.submit( + command.projectId, command.payload, command.commandId, session, input_fingerprint=fingerprint, + ) + else: + method = { + 'pipeline.pause': 'pause', + 'pipeline.resume': 'resume', + 'pipeline.cancel': 'cancel', + 'pipeline.retry': 'retry', + 'pipeline.adopt': 'adopt', + }[command.type] + execution = await getattr(executor, method)( + command.projectId, command.payload, session, + operation_id=command.commandId, input_fingerprint=fingerprint, + ) + return CommandReceipt(commandId=command.commandId, projectId=command.projectId, + inputFingerprint=fingerprint, status='applied', + pipelineExecutionId=execution['executionId']) if command.type == 'generation.submit': pending = asyncio.create_task(asyncio.to_thread(self.prepare, command, session=session, source=source, agent_origin=agent_origin)) async def finish(): diff --git a/packages/core/src/opendirector/application/creation_history.py b/packages/core/src/opendirector/application/creation_history.py index 8d817be3b..431eabaf1 100644 --- a/packages/core/src/opendirector/application/creation_history.py +++ b/packages/core/src/opendirector/application/creation_history.py @@ -14,7 +14,7 @@ EDITABLE = {'canvasItems', 'generationSpecs', 'references', 'editorDocuments'} ABSENT = object() -UNDOABLE = {'canvas.createGeneration', 'creation.batch', 'canvas.show', 'canvas.hide', 'canvas.move', 'canvas.update', 'canvas.layoutRuns', 'canvas.configure', +UNDOABLE = {'canvas.createGeneration', 'creation.batch', 'canvas.show', 'canvas.hide', 'canvas.move', 'canvas.update', 'canvas.layoutRuns', 'canvas.layoutPipelines', 'canvas.configure', 'canvas.materialize', 'canvas.applyEdit', 'timeline.publishRender', 'canvas.publishMedia', 'canvas.applyVersion', 'canvas.attachEditor', 'canvas.detachEditor', 'generationSpec.update', 'generationSpec.restore', 'reference.add', 'reference.update', 'reference.restore', 'reference.remove', 'result.select', 'editor.save', 'generationSpec.setPrompt'} diff --git a/packages/core/src/opendirector/application/creation_pipeline.py b/packages/core/src/opendirector/application/creation_pipeline.py new file mode 100644 index 000000000..2a1bf5554 --- /dev/null +++ b/packages/core/src/opendirector/application/creation_pipeline.py @@ -0,0 +1,630 @@ +"""Persist and concurrently execute compiled Pipelines using shared project services.""" + +import asyncio +import logging +from time import time_ns +from uuid import UUID, uuid5 + +from filelock import FileLock, Timeout + +from opendirector.domain.creation.commands import parse_command +from opendirector.domain.creation.pipeline import ( + ACTIVE_EXECUTION_STATUSES, + TERMINAL_EXECUTION_STATUSES, + CompiledPipelineGraph, + can_transition_execution, + compile_pipeline, +) +from opendirector.domain.projects import ProjectError +from opendirector.ports.gateway import gateway + + +logger = logging.getLogger(__name__) + + +def _version(kind: str, obj) -> dict: + return {'objectType': kind, 'id': str(obj.id), 'revision': obj.revision} + + +def _step_record(step) -> dict: + if step.cached: + return { + 'itemId': str(step.itemId), + 'kind': step.kind, + 'upstreamItemIds': [str(uid) for uid in step.upstreamItemIds], + 'inputFingerprint': step.inputFingerprint, + 'status': 'cached', + 'attempt': 0, + 'command': None, + 'jobId': str(step.cacheCandidateJobId) if step.cacheCandidateJobId else None, + 'assetId': str(step.cacheCandidateAssetId) if step.cacheCandidateAssetId else None, + 'issue': None, + } + return { + 'itemId': str(step.itemId), + 'kind': step.kind, + 'upstreamItemIds': [str(uid) for uid in step.upstreamItemIds], + 'inputFingerprint': step.inputFingerprint, + 'status': 'pending', + 'attempt': 1, + 'command': None, + 'jobId': None, + 'assetId': None, + 'issue': None, + } + + +def _mark_downstream_skipped(steps_by_id: dict[str, dict], failed_id: str) -> None: + queue = [failed_id] + visited = {failed_id} + while queue: + current = queue.pop(0) + for item_id, step in steps_by_id.items(): + if item_id in visited: + continue + if current in step['upstreamItemIds']: + visited.add(item_id) + if step['status'] in {'pending', 'ready'}: + step['status'] = 'skipped' + queue.append(item_id) + + +class PipelineExecutor: + """Backend concurrent DAG executor for compiled Pipelines.""" + + def __init__(self, projects, generation, configs=None): + self.projects = projects + self.generation = generation + self.configs = configs + self.directory = gateway().directory(gateway().child(projects.state_dir, 'pipeline-executions')) + self.directory.mkdir(exist_ok=True) + gateway().sync_directory(self.directory.parent) + self.accepting: set[asyncio.Task] = set() + self.workers: dict[tuple[str, str], asyncio.Task] = {} + self.record_locks: dict[tuple[str, str], asyncio.Lock] = {} + self.closed = False + + def _path(self, project_id, execution_id, extension='json'): + return gateway().child(self.directory, f'{project_id}-{execution_id}.{extension}') + + def _project_lock(self, project_id): + return FileLock(gateway().child(self.directory, f'{project_id}.pipeline.lock'), timeout=5) + + def _state_lock(self, project_id, execution_id): + return FileLock(self._path(project_id, execution_id, 'state.lock'), timeout=5) + + def _mem_lock(self, project_id: str, execution_id: str) -> asyncio.Lock: + key = (project_id, execution_id) + lock = self.record_locks.get(key) + if lock is None: + lock = self.record_locks[key] = asyncio.Lock() + return lock + + def _read(self, path): + return gateway().read_json(gateway().child(self.directory, path.name)) + + def _write(self, record): + path = self._path(record['projectId'], record['executionId']) + gateway().write_json(path, record) + gateway().sync_directory(self.directory) + + def _save(self, record): + project_id, execution_id = record['projectId'], record['executionId'] + path = self._path(project_id, execution_id) + with self._state_lock(project_id, execution_id): + if path.exists(): + current = self._read(path) + for key in ('pauseRequested', 'cancelRequested', 'controlOperations'): + if key in current and key not in record: + record[key] = current[key] + elif key in ('pauseRequested', 'cancelRequested') and current.get(key): + record[key] = True + elif key == 'controlOperations' and key in current: + merged = dict(current[key]) + merged.update(record.get(key, {})) + record[key] = merged + self._write(record) + + async def _persist(self, record): + async with self._mem_lock(record['projectId'], record['executionId']): + pending = asyncio.create_task(asyncio.to_thread(self._save, record)) + try: + await asyncio.shield(pending) + except asyncio.CancelledError: + await asyncio.gather(pending, return_exceptions=True) + raise + + def _check_lease(self, project_id, session): + with self.projects.local.transaction() as db: + path, _ = self.projects._find(db, project_id) + self.projects._lease(db, project_id, path, str(session) if session is not None else None) + + def _executions(self, project_id): + records = [ + (self._read(path), path.stat().st_mtime_ns) + for path in self.directory.glob(f'{project_id}-*.json') + ] + return [record for record, _ in sorted(records, key=lambda pair: pair[0].get('createdAt', pair[1]), reverse=True)] + + def _public(self, record) -> dict: + status = record['status'] + if status in {'queued', 'running'} and record.get('pauseRequested') and not record.get('cancelRequested'): + status = 'pausing' + steps = [ + { + 'itemId': step['itemId'], + 'kind': step['kind'], + 'upstreamItemIds': list(step['upstreamItemIds']), + 'inputFingerprint': step['inputFingerprint'], + 'status': step['status'], + 'jobId': step.get('jobId'), + 'assetId': step.get('assetId'), + 'issue': step.get('issue'), + } + for step in record['steps'] + ] + return { + 'executionId': record['executionId'], + 'projectId': record['projectId'], + 'scope': record['scope'], + 'cachePolicy': record['cachePolicy'], + 'status': status, + 'steps': steps, + 'issue': record.get('issue'), + 'createdAt': record.get('createdAt'), + 'updatedAt': record.get('updatedAt'), + } + + def _compile(self, project_id: UUID, scope, *, cache_policy='reuse', force_from_item_id=None) -> CompiledPipelineGraph: + snapshot = self.projects.snapshot(project_id) + return compile_pipeline( + snapshot, + scope, + cache_policy=cache_policy, + force_from_item_id=force_from_item_id, + ) + + async def plan(self, project_id: UUID, scope, *, cache_policy='reuse', force_from_item_id=None) -> dict: + graph = await asyncio.to_thread( + self._compile, + UUID(str(project_id)), + scope, + cache_policy=cache_policy, + force_from_item_id=force_from_item_id, + ) + return graph.model_dump(mode='json') + + def _accept_start(self, project_id: UUID, payload, operation_id: UUID, session, input_fingerprint): + self._check_lease(project_id, session) + execution_id = str(operation_id) + try: + with self._project_lock(project_id): + path = self._path(project_id, execution_id) + if path.exists(): + record = self._read(path) + if record.get('inputFingerprint') != input_fingerprint: + raise ProjectError('此操作 ID 已用于不同的流水线请求。', 409, code='command_conflict') + return record + for existing in self._executions(project_id): + if execution_id in existing.get('controlOperations', {}): + raise ProjectError('此操作 ID 已用于不同的流水线请求。', 409, code='command_conflict') + + graph = self._compile( + project_id, + payload.scope, + cache_policy=payload.cachePolicy, + force_from_item_id=payload.forceFromItemId, + ) + if graph.issues: + first = graph.issues[0] + raise ProjectError(first.message, 409, code=first.code) + + steps = [_step_record(step) for step in graph.steps] + all_cached = all(step['status'] == 'cached' for step in steps) + now = time_ns() + record = { + 'projectId': str(project_id), + 'executionId': execution_id, + 'scope': payload.scope.model_dump(mode='json'), + 'cachePolicy': payload.cachePolicy, + 'stopOnFailure': bool(payload.stopOnFailure), + 'maxConcurrency': int(payload.maxConcurrency), + 'createdAt': now, + 'updatedAt': now, + 'status': 'succeeded' if all_cached else 'queued', + 'pauseRequested': False, + 'cancelRequested': False, + 'steps': steps, + 'issue': None, + 'inputFingerprint': input_fingerprint, + 'controlOperations': {}, + } + self._save(record) + return record + except Timeout as error: + raise ProjectError('流水线正在处理,请稍后重试。', 409, code='pipeline_busy') from error + + async def _accept_and_launch(self, accept, *args): + if self.closed: + raise ProjectError('流水线执行服务正在关闭。', 503) + + async def accept_and_launch(): + record = await asyncio.to_thread(accept, *args) + self._launch(record) + return self._public(record) + + def finished(task): + self.accepting.discard(task) + if not task.cancelled(): + task.exception() + + continuation = asyncio.create_task(accept_and_launch()) + self.accepting.add(continuation) + continuation.add_done_callback(finished) + return await asyncio.shield(continuation) + + async def submit(self, project_id, payload, operation_id, session, *, input_fingerprint=None): + return await self._accept_and_launch( + self._accept_start, UUID(str(project_id)), payload, UUID(str(operation_id)), session, input_fingerprint, + ) + + def _mutate_control(self, project_id: UUID, execution_id: UUID, session, operation_id: UUID, input_fingerprint, action: str, payload=None): + self._check_lease(project_id, session) + op_id = str(operation_id) + op_entry = {'action': action, 'inputFingerprint': input_fingerprint} + try: + with self._project_lock(project_id): + for existing in self._executions(project_id): + prev = existing.get('controlOperations', {}).get(op_id) + if prev is not None: + if prev == op_entry and existing['executionId'] == str(execution_id): + return existing + raise ProjectError('此操作 ID 已用于不同的流水线请求。', 409, code='command_conflict') + if existing['executionId'] == op_id: + raise ProjectError('此操作 ID 已用于不同的流水线请求。', 409, code='command_conflict') + + path = self._path(project_id, execution_id) + if not path.is_file(): + raise ProjectError('找不到此流水线执行。', 404, code='pipeline_not_found') + + with self._state_lock(str(project_id), str(execution_id)): + record = self._read(path) + status = record['status'] + if action == 'pause': + if status not in {'queued', 'running', 'pausing', 'paused'}: + raise ProjectError('当前流水线状态不支持暂停。', 409, code='pipeline_invalid_state') + record['pauseRequested'] = True + elif action == 'resume': + if status != 'paused': + raise ProjectError('当前流水线尚未暂停。', 409, code='pipeline_invalid_state') + record['pauseRequested'] = False + record['status'] = 'queued' + elif action == 'cancel': + if status in TERMINAL_EXECUTION_STATUSES: + raise ProjectError('当前流水线已结束,无法取消。', 409, code='pipeline_invalid_state') + record['cancelRequested'] = True + record['pauseRequested'] = False + for step in record['steps']: + if step['status'] in {'pending', 'ready'}: + step['status'] = 'cancelled' + if status in {'paused', 'awaiting_input'}: + record['status'] = 'cancelled' + elif action == 'retry': + if status not in {'failed', 'paused', 'cancelled'}: + raise ProjectError('仅失败、暂停或已取消的流水线可以重试。', 409, code='pipeline_invalid_state') + record['pauseRequested'] = False + record['cancelRequested'] = False + record['issue'] = None + if payload is not None: + record['stopOnFailure'] = bool(payload.stopOnFailure) + record['maxConcurrency'] = int(payload.maxConcurrency) + for step in record['steps']: + if step['status'] in {'failed', 'skipped', 'cancelled'}: + step['status'] = 'pending' + step['attempt'] = int(step.get('attempt', 0)) + 1 + step['command'] = None + step['jobId'] = None + step['issue'] = None + record['status'] = 'queued' + elif action == 'adopt': + if status != 'awaiting_input': + raise ProjectError('当前流水线没有等待采用的节点。', 409, code='pipeline_invalid_state') + target_id = str(payload.itemId) + step = next((s for s in record['steps'] if s['itemId'] == target_id and s['status'] == 'awaiting_input'), None) + if step is None: + raise ProjectError('找不到等待采用的流水线节点。', 409, code='pipeline_invalid_state') + job = self.generation.get_job(project_id, payload.jobId) + if job is None or job.status != 'succeeded' or job.asset is None or str(job.originItemId) != target_id: + raise ProjectError('指定的候选任务无效或尚未完成。', 409, code='pipeline_candidate_invalid') + step['status'] = 'succeeded' + step['jobId'] = str(job.id) + step['assetId'] = str(job.asset.assetId) + step['issue'] = None + record['status'] = 'queued' + record['updatedAt'] = time_ns() + record.setdefault('controlOperations', {})[op_id] = op_entry + self._write(record) + return record + except Timeout as error: + raise ProjectError('流水线正在处理,请稍后重试。', 409, code='pipeline_busy') from error + + async def pause(self, project_id, payload, session, *, operation_id, input_fingerprint): + return await self._accept_and_launch( + self._mutate_control, UUID(str(project_id)), payload.executionId, session, + UUID(str(operation_id)), input_fingerprint, 'pause', + ) + + async def resume(self, project_id, payload, session, *, operation_id, input_fingerprint): + return await self._accept_and_launch( + self._mutate_control, UUID(str(project_id)), payload.executionId, session, + UUID(str(operation_id)), input_fingerprint, 'resume', + ) + + async def cancel(self, project_id, payload, session, *, operation_id, input_fingerprint): + result = await self._accept_and_launch( + self._mutate_control, UUID(str(project_id)), payload.executionId, session, + UUID(str(operation_id)), input_fingerprint, 'cancel', + ) + # Request cancellation on any running jobs immediately. + path = self._path(UUID(str(project_id)), payload.executionId) + if path.is_file(): + record = await asyncio.to_thread(self._read, path) + for step in record['steps']: + if step['status'] == 'running' and step.get('jobId'): + cancel_cmd = parse_command({ + 'type': 'job.cancel', + 'projectId': str(project_id), + 'commandId': str(uuid5(UUID(str(operation_id)), f"cancel:{step['jobId']}")), + 'payload': {'jobId': step['jobId']}, + }) + try: + await self.generation.execute(cancel_cmd, source='background') + except ProjectError: + pass + return result + + async def retry(self, project_id, payload, session, *, operation_id, input_fingerprint): + return await self._accept_and_launch( + self._mutate_control, UUID(str(project_id)), payload.executionId, session, + UUID(str(operation_id)), input_fingerprint, 'retry', payload, + ) + + async def adopt(self, project_id, payload, session, *, operation_id, input_fingerprint): + return await self._accept_and_launch( + self._mutate_control, UUID(str(project_id)), payload.executionId, session, + UUID(str(operation_id)), input_fingerprint, 'adopt', payload, + ) + + async def status(self, project_id, execution_id) -> dict: + project_id, execution_id = UUID(str(project_id)), UUID(str(execution_id)) + path = self._path(project_id, execution_id) + if not path.is_file(): + raise ProjectError('找不到此流水线执行。', 404, code='pipeline_not_found') + record = await asyncio.to_thread(self._read, path) + return self._public(record) + + async def history(self, project_id, group_id=None) -> list[dict]: + records = await asyncio.to_thread(self._executions, UUID(str(project_id))) + if group_id is not None: + target = str(group_id) + records = [ + record for record in records + if record.get('scope', {}).get('groupId') == target + ] + return [self._public(record) for record in records] + + def _launch(self, record): + key = (record['projectId'], record['executionId']) + running = self.workers.get(key) + if (running is None or running.done()) and record['status'] in ACTIVE_EXECUTION_STATUSES: + worker = self.workers[key] = asyncio.create_task(self._run(record['projectId'], record['executionId'])) + worker.add_done_callback(lambda future: self._finished(key, future)) + + def _finished(self, key, future): + if self.workers.get(key) is future: + self.workers.pop(key, None) + if not future.cancelled() and (error := future.exception()) is not None: + logger.error('Pipeline %s in project %s exited unexpectedly', key[1], key[0], exc_info=error) + + async def start(self): + self.closed = False + for path in self.directory.glob('*.json'): + try: + record = await asyncio.to_thread(self._read, path) + if path != self._path(UUID(record['projectId']), UUID(record['executionId'])): + continue + self._launch(record) + except (OSError, ValueError, KeyError, ProjectError, Timeout): + logger.warning('Could not recover pipeline execution %s', path.name) + + async def close(self): + self.closed = True + await asyncio.gather(*tuple(self.accepting), return_exceptions=True) + workers = tuple(self.workers.values()) + for worker in workers: + worker.cancel() + await asyncio.gather(*workers, return_exceptions=True) + + async def _wait_job(self, project_id: UUID, job_id: str): + job = await asyncio.to_thread(self.generation.get_job, project_id, job_id) + if job and (job.status in {'queued', 'running'} or job.status in {'interrupted', 'failed'} and job.resumeAllowed): + await self.generation.recover(str(project_id), str(job_id)) + while True: + job = await asyncio.to_thread(self.generation.get_job, project_id, job_id) + if job is None: + raise ProjectError('找不到流水线步骤对应的生成任务。', 409, code='pipeline_job_missing') + worker = self.generation.jobs.get(str(job_id)) + if job.status == 'succeeded': + return job + if job.status == 'cancelled': + raise ProjectError('任务已取消。', 409, code='pipeline_job_cancelled') + if worker is None or worker.future.done(): + latest = await asyncio.to_thread(self.generation.get_job, project_id, job_id) + if latest is not None: + if latest.status == 'succeeded': + return latest + if latest.status == 'cancelled': + raise ProjectError('任务已取消。', 409, code='pipeline_job_cancelled') + if latest.errorDetails is not None: + raise ProjectError(latest.errorDetails.message, 409, code=latest.errorDetails.category) + raise ProjectError('生成任务异常中止。', 409, code='pipeline_job_failed') + await asyncio.sleep(0.05) + + async def _execute_step(self, record: dict, step: dict, semaphore: asyncio.Semaphore): + project_id = UUID(record['projectId']) + execution_id = UUID(record['executionId']) + item_id = UUID(step['itemId']) + + async with semaphore: + if step['jobId'] is None: + if step['command'] is None: + snapshot = await asyncio.to_thread(self.projects.snapshot, project_id) + item = next((c for c in snapshot.canvasItems if c.id == item_id), None) + if item is None or item.binding.role != 'generation': + raise ProjectError('节点已变更,不再是有效的生成节点。', 409, code='pipeline_step_invalid') + spec = next((s for s in snapshot.generationSpecs if s.id == item.binding.objectRef.id), None) + if spec is None: + raise ProjectError('找不到节点的生成配置。', 409, code='pipeline_step_invalid') + step_key = f"pipeline-step:{item_id}:{step['attempt']}" + command = parse_command({ + 'type': 'generation.submit', + 'projectId': str(project_id), + 'commandId': str(uuid5(execution_id, step_key)), + 'expectedVersions': [_version('generation_spec', spec), _version('canvas_item', item)], + 'payload': { + 'specId': str(spec.id), + 'expectedSpecRevision': spec.revision, + 'originItemId': str(item.id), + 'batchId': str(execution_id), + }, + }) + step['command'] = command.model_dump(mode='json') + step['status'] = 'running' + record['updatedAt'] = time_ns() + await self._persist(record) + + command = parse_command(step['command']) + replay = await asyncio.to_thread(self.projects.replay, command) + receipt = replay if replay is not None else await self.generation.execute(command, source='background') + if receipt.status == 'rejected': + issue = receipt.issues[0] + raise ProjectError(issue.message, 409, code=issue.code) + if not receipt.jobIds: + raise ProjectError('生成回执缺少任务 ID。', 409, code='pipeline_job_missing') + step['jobId'] = str(receipt.jobIds[0]) + step['status'] = 'running' + record['updatedAt'] = time_ns() + await self._persist(record) + + job = await self._wait_job(project_id, step['jobId']) + step['status'] = 'succeeded' + step['assetId'] = str(job.asset.assetId) if job.asset else None + step['issue'] = None + record['updatedAt'] = time_ns() + await self._persist(record) + + def _reload_flags(self, record: dict) -> None: + path = self._path(record['projectId'], record['executionId']) + if path.is_file(): + disk = self._read(path) + record['pauseRequested'] = bool(disk.get('pauseRequested')) + record['cancelRequested'] = bool(disk.get('cancelRequested')) + + async def _run(self, project_id_str: str, execution_id_str: str): + lock = FileLock(self._path(project_id_str, execution_id_str, 'lock'), timeout=0) + try: + lock.acquire() + except Timeout: + return + try: + record = await asyncio.to_thread(self._read, self._path(project_id_str, execution_id_str)) + if record['status'] not in ACTIVE_EXECUTION_STATUSES: + return + if can_transition_execution(record['status'], 'running'): + record['status'] = 'running' + record['updatedAt'] = time_ns() + await self._persist(record) + + steps_by_id = {step['itemId']: step for step in record['steps']} + semaphore = asyncio.Semaphore(max(1, int(record.get('maxConcurrency', 4)))) + in_flight: dict[str, asyncio.Task] = {} + failed_any = False + + while True: + await asyncio.to_thread(self._reload_flags, record) + + if record.get('cancelRequested'): + for step in record['steps']: + if step['status'] in {'pending', 'ready'}: + step['status'] = 'cancelled' + if not in_flight: + record['status'] = 'cancelled' + record['updatedAt'] = time_ns() + await self._persist(record) + return + elif not record.get('pauseRequested') and not (record.get('stopOnFailure') and failed_any): + for step in record['steps']: + item_id = step['itemId'] + if item_id in in_flight: + continue + if step['status'] == 'running' and step.get('jobId'): + in_flight[item_id] = asyncio.create_task(self._execute_step(record, step, semaphore)) + continue + if step['status'] != 'pending': + continue + if all(steps_by_id[up]['status'] in {'succeeded', 'cached'} for up in step['upstreamItemIds']): + step['status'] = 'ready' + in_flight[item_id] = asyncio.create_task(self._execute_step(record, step, semaphore)) + + if not in_flight: + if record.get('cancelRequested'): + record['status'] = 'cancelled' + elif record.get('pauseRequested') and any(step['status'] in {'pending', 'ready'} for step in record['steps']): + record['status'] = 'paused' + elif any(step['status'] == 'awaiting_input' for step in record['steps']): + record['status'] = 'awaiting_input' + elif any(step['status'] == 'failed' for step in record['steps']): + record['status'] = 'failed' + else: + record['status'] = 'succeeded' + record['updatedAt'] = time_ns() + await self._persist(record) + return + + done, _ = await asyncio.wait(in_flight.values(), return_when=asyncio.FIRST_COMPLETED) + finished_ids = [item_id for item_id, task in in_flight.items() if task in done] + for item_id in finished_ids: + task = in_flight.pop(item_id) + step = steps_by_id[item_id] + try: + await task + except ProjectError as error: + if error.code == 'pipeline_job_cancelled' or record.get('cancelRequested'): + step['status'] = 'cancelled' + else: + failed_any = True + step['status'] = 'failed' + issue = {'code': error.code, 'message': str(error), 'itemId': item_id} + step['issue'] = issue + if record.get('issue') is None: + record['issue'] = issue + _mark_downstream_skipped(steps_by_id, item_id) + if record.get('stopOnFailure'): + for pending_step in record['steps']: + if pending_step['status'] in {'pending', 'ready'}: + pending_step['status'] = 'cancelled' + record['updatedAt'] = time_ns() + await self._persist(record) + except Exception as error: + logger.exception('Pipeline %s step %s failed unexpectedly', execution_id_str, item_id) + failed_any = True + step['status'] = 'failed' + issue = {'code': 'pipeline_step_error', 'message': str(error) or '步骤执行异常。', 'itemId': item_id} + step['issue'] = issue + if record.get('issue') is None: + record['issue'] = issue + _mark_downstream_skipped(steps_by_id, item_id) + record['updatedAt'] = time_ns() + await self._persist(record) + finally: + lock.release() diff --git a/packages/core/src/opendirector/cli.py b/packages/core/src/opendirector/cli.py index e474ab433..ac61df13d 100644 --- a/packages/core/src/opendirector/cli.py +++ b/packages/core/src/opendirector/cli.py @@ -58,6 +58,7 @@ "result": "Select a generated result for adoption.", "editor": "Create and save editable media documents.", "timeline": "Discover resources for editable timelines.", + "pipeline": "Plan, run, pause, resume, cancel and retry canvas Pipelines.", "group": "Save and publish segment run plans.", "history": "Undo or redo reversible project operations.", "creation": "Apply multiple project operations atomically.", diff --git a/packages/core/src/opendirector/domain/creation/canvas.py b/packages/core/src/opendirector/domain/creation/canvas.py index 2ab10f021..854e7b4fc 100644 --- a/packages/core/src/opendirector/domain/creation/canvas.py +++ b/packages/core/src/opendirector/domain/creation/canvas.py @@ -227,8 +227,8 @@ def distinct_items(self): class GroupCanvasItem(CanvasItemBase): kind: Literal['group'] = Field(description='Business object or media type.') - autoLayout: Literal['run'] | None = Field(default=None, exclude_if=lambda value: value is None, - description='Set to run to opt this top-level group into shared Run layout. Put its plan, clips and timeline under this group ID.') + autoLayout: Literal['run', 'pipeline'] | None = Field(default=None, exclude_if=lambda value: value is None, + description='Opt this top-level group into automatic layout for Runs or Pipelines.') runPlan: SegmentRunPlan | None = Field(default=None, exclude_if=lambda value: value is None, description='Frozen plan assigned only by the Run publication command.') draftRunPlan: SegmentRunPlan | None = Field(default=None, exclude_if=lambda value: value is None, diff --git a/packages/core/src/opendirector/domain/creation/commands.py b/packages/core/src/opendirector/domain/creation/commands.py index 219b37e6a..72bfd0fd3 100644 --- a/packages/core/src/opendirector/domain/creation/commands.py +++ b/packages/core/src/opendirector/domain/creation/commands.py @@ -9,6 +9,7 @@ from .segment_run import SegmentRunPlan from .canvas import GroupAssembly, CanvasItem from .editors import EditorDocument +from .pipeline import PipelineCachePolicy, PipelineScope from opendirector.domain.rule_facts import PROMPT_MAX_LENGTH from .generation import GenerationSpec, Job, PromptPart, Reference @@ -146,8 +147,8 @@ class CanvasPresentationUpdate(Contract): color: CanvasColor | None = Field(default=None, exclude_if=lambda value: value is None, description="Group background color in #RRGGBB format, or '' for the default.") parentId: UUID | None = Field(default=None, description='Parent canvas group ID, or null for the root.') # Presence of parentId distinguishes retaining a group from ungrouping. - autoLayout: Literal['run', 'free'] | None = Field(default=None, exclude_if=lambda value: value is None, - description='Enable Run layout for a top-level group, or use free to return it to manual layout.') + autoLayout: Literal['run', 'pipeline', 'free'] | None = Field(default=None, exclude_if=lambda value: value is None, + description='Enable Pipeline layout for a top-level group, or use free to return it to manual layout.') class CanvasHide(Contract): @@ -167,6 +168,33 @@ class CanvasApplyEdit(Contract): editorId: UUID = Field(description='Editable document ID.') +class PipelineStart(Contract): + scope: PipelineScope = Field(description='Target canvas scope to compile and execute.') + cachePolicy: PipelineCachePolicy = Field(default='reuse', description='Cache reuse strategy for unchanged nodes.') + forceFromItemId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Optional step ID from which to force re-execution when cachePolicy is force_from_node.') + stopOnFailure: bool = Field(default=False, description='Whether to cancel remaining pending steps after the first failure.') + maxConcurrency: Annotated[int, Field(strict=True, ge=1, le=16)] = Field(default=4, + description='Maximum number of independent pipeline steps executed concurrently.') + + +class PipelineControl(Contract): + executionId: UUID = Field(description='Target Pipeline execution ID.') + + +class PipelineRetry(Contract): + executionId: UUID = Field(description='Target settled Pipeline execution ID to retry.') + stopOnFailure: bool = Field(default=False, description='Whether to cancel remaining pending steps after the first failure.') + maxConcurrency: Annotated[int, Field(strict=True, ge=1, le=16)] = Field(default=4, + description='Maximum number of independent pipeline steps executed concurrently.') + + +class PipelineAdopt(Contract): + executionId: UUID = Field(description='Target Pipeline execution ID awaiting candidate adoption.') + itemId: UUID = Field(description='Canvas item ID whose candidate is being adopted.') + jobId: UUID = Field(description='Succeeded candidate job ID to adopt.') + + class TimelinePublishRender(Contract): itemId: UUID = Field(description='Canvas item ID.') editorId: UUID = Field(description='Editable document ID.') @@ -378,12 +406,19 @@ def required_versions(self) -> list[tuple[str, UUID]]: ('CanvasShowCommand', 'canvas.show', CanvasShow, 'Create or restore a canvas display item.'), ('CanvasMoveCommand', 'canvas.move', CanvasMove, 'Move one or more canvas items.'), ('CanvasUpdateCommand', 'canvas.update', CanvasPresentationUpdate, 'Update canvas presentation, grouping or lock state.'), - ('CanvasLayoutRunsCommand', 'canvas.layoutRuns', EmptyPayload, 'Arrange the current canvas Run groups and their children without moving locked groups.'), + ('CanvasLayoutRunsCommand', 'canvas.layoutRuns', EmptyPayload, 'Arrange the current canvas Run groups.'), + ('CanvasLayoutPipelinesCommand', 'canvas.layoutPipelines', EmptyPayload, 'Arrange the current canvas Pipeline groups and their children without moving locked groups.'), ('CanvasHideCommand', 'canvas.hide', CanvasHide, 'Remove a canvas item; preserves project contents. Remove all visible items to clear the canvas.'), ('CanvasMaterializeCommand', 'canvas.materialize', CanvasMaterialize, 'Bind an asset to an empty or material canvas item.'), ('CanvasApplyEditCommand', 'canvas.applyEdit', CanvasApplyEdit, 'Apply an editor result to a canvas item.'), ('CanvasPublishMediaCommand', 'canvas.publishMedia', CanvasPublishMedia, 'Publish edited media outputs with their editor snapshot.'), ('TimelinePublishRenderCommand', 'timeline.publishRender', TimelinePublishRender, 'Publish a rendered timeline result.'), + ('PipelineStartCommand', 'pipeline.start', PipelineStart, 'Compile and start a durable concurrent Pipeline execution in the background.'), + ('PipelinePauseCommand', 'pipeline.pause', PipelineControl, 'Pause an active Pipeline execution after its in-flight steps finish.'), + ('PipelineResumeCommand', 'pipeline.resume', PipelineControl, 'Resume a paused Pipeline execution.'), + ('PipelineCancelCommand', 'pipeline.cancel', PipelineControl, 'Cancel pending steps and request cancellation of running steps in a Pipeline execution.'), + ('PipelineRetryCommand', 'pipeline.retry', PipelineRetry, 'Retry failed or skipped steps of a settled Pipeline execution while reusing succeeded steps.'), + ('PipelineAdoptCommand', 'pipeline.adopt', PipelineAdopt, 'Adopt a candidate job for an awaiting Pipeline step and continue downstream execution.'), ('NodeVersionApplyCommand', 'canvas.applyVersion', NodeVersionApply, 'Apply a historical asset version and its reference policy to a canvas item.'), ('CanvasConfigureCommand', 'canvas.configure', CanvasConfigure, 'Bind a generation configuration to a canvas item.'), ('CanvasEditorAttachCommand', 'canvas.attachEditor', CanvasEditorAttach, 'Attach an editor document to a canvas item.'), @@ -413,7 +448,7 @@ def required_versions(self) -> list[tuple[str, UUID]]: COMMAND_MODELS[_type] = _model globals()[_name] = _model -_BATCH_TYPES = {'canvas.show', 'canvas.move', 'canvas.update', 'canvas.layoutRuns', 'canvas.hide', 'canvas.materialize', 'canvas.applyEdit', +_BATCH_TYPES = {'canvas.show', 'canvas.move', 'canvas.update', 'canvas.layoutRuns', 'canvas.layoutPipelines', 'canvas.hide', 'canvas.materialize', 'canvas.applyEdit', 'canvas.configure', 'canvas.attachEditor', 'canvas.detachEditor', 'generationSpec.create', 'generationSpec.update', 'reference.add', 'reference.update', 'reference.restore', 'reference.remove', 'editor.create', 'editor.save', 'result.select', 'generationSpec.setPrompt'} _OPERATIONS = tuple(create_model(name + 'Operation', __base__=Contract, @@ -488,6 +523,8 @@ class CommandReceipt(Contract): jobIds: tuple[UUID, ...] = Field(default=(), description='Generation jobs associated with this operation.') issues: tuple[ContractIssue, ...] = Field(default=(), description='Validation or execution issues.') eventCursor: int | None = Field(default=None, strict=True, ge=0, description='Latest committed project event cursor.') + pipelineExecutionId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Durable execution created or updated by a Pipeline command.') @model_validator(mode='after') def outcome(self): @@ -553,8 +590,28 @@ class AssetPreviewQuery(QueryBase): objectId: UUID = Field(description='Asset ID.') +class PipelinePlanQuery(QueryBase): + type: Literal['pipeline.plan'] = Field(description='Compile a Pipeline DAG read-only and preview cache hits, dependencies, and issues.') + scope: PipelineScope = Field(description='Target canvas scope to compile.') + cachePolicy: PipelineCachePolicy = Field(default='reuse', description='Cache reuse strategy to preview.') + forceFromItemId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Optional step ID from which to force re-execution when cachePolicy is force_from_node.') + + +class PipelineExecutionQuery(QueryBase): + type: Literal['pipeline.execution.get'] = Field(description='Read a durable Pipeline execution.') + objectId: UUID = Field(description='Pipeline execution ID returned by pipeline.start.') + + +class PipelineExecutionsQuery(QueryBase): + type: Literal['pipeline.executions.list'] = Field(description='List Pipeline execution history for the project or one group.') + groupId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Optional canvas group ID filter.') + + Query = Annotated[ProjectQuery | ObjectQuery | VersionsQuery | AssetSearchQuery | AssetUsageQuery | - CanvasStatusQuery | JobStatusQuery | AssetPreviewQuery, Field(discriminator='type')] + CanvasStatusQuery | JobStatusQuery | AssetPreviewQuery | PipelinePlanQuery | + PipelineExecutionQuery | PipelineExecutionsQuery, Field(discriminator='type')] class ChangedObject(Contract): diff --git a/packages/core/src/opendirector/domain/creation/pipeline.py b/packages/core/src/opendirector/domain/creation/pipeline.py new file mode 100644 index 000000000..594c1fecd --- /dev/null +++ b/packages/core/src/opendirector/domain/creation/pipeline.py @@ -0,0 +1,510 @@ +"""Typed domain contracts, state machine, and deterministic DAG compiler for Pipelines.""" + +from collections import defaultdict +import hashlib +import json +from typing import Annotated, Literal +from uuid import UUID + +from pydantic import Field, model_validator + +from .base import Contract, Digest, ObjectVersion, unique +from .canvas import CanvasItem, GenerationBinding, GroupCanvasItem +from .generation import FollowingReference, GenerationSpec, Job, PinnedReference +from .project import ProjectSnapshot + + +PipelineCachePolicy = Literal['reuse', 'force_from_node', 'force_all'] +PipelineExecutionStatus = Literal[ + 'queued', 'running', 'pausing', 'paused', 'awaiting_input', 'succeeded', 'failed', 'cancelled', +] +PipelineStepStatus = Literal[ + 'pending', 'cached', 'ready', 'running', 'awaiting_input', 'succeeded', 'failed', 'skipped', 'cancelled', +] + +ACTIVE_EXECUTION_STATUSES = frozenset({'queued', 'running', 'pausing'}) +TERMINAL_EXECUTION_STATUSES = frozenset({'succeeded', 'failed', 'cancelled'}) +SETTLED_EXECUTION_STATUSES = frozenset({'paused', 'awaiting_input', 'succeeded', 'failed', 'cancelled'}) + +ALLOWED_EXECUTION_TRANSITIONS: dict[str, frozenset[str]] = { + 'queued': frozenset({'running', 'pausing', 'paused', 'cancelled', 'failed', 'succeeded'}), + 'running': frozenset({'pausing', 'paused', 'awaiting_input', 'succeeded', 'failed', 'cancelled'}), + 'pausing': frozenset({'paused', 'succeeded', 'failed', 'cancelled'}), + 'paused': frozenset({'queued', 'running', 'cancelled'}), + 'awaiting_input': frozenset({'queued', 'running', 'cancelled', 'failed'}), + 'succeeded': frozenset(), + 'failed': frozenset(), + 'cancelled': frozenset(), +} + + +def can_transition_execution(current: str, target: str) -> bool: + return target == current or target in ALLOWED_EXECUTION_TRANSITIONS.get(current, frozenset()) + + +class GroupPipelineScope(Contract): + kind: Literal['group'] = Field(description='Run all executable nodes inside a canvas group.') + groupId: UUID = Field(description='Target canvas group ID.') + + +class SelectionPipelineScope(Contract): + kind: Literal['selection'] = Field(description='Run an explicit set of canvas nodes.') + itemIds: tuple[UUID, ...] = Field(min_length=1, max_length=200, description='Selected canvas item IDs.') + + @model_validator(mode='after') + def distinct_items(self): + unique(self.itemIds, 'pipeline selection item IDs') + return self + + +class FromNodePipelineScope(Contract): + kind: Literal['from_node'] = Field(description='Run from one node through its downstream dependents.') + itemId: UUID = Field(description='Starting canvas item ID.') + groupId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Optional group boundary limiting downstream traversal.') + + +PipelineScope = Annotated[ + GroupPipelineScope | SelectionPipelineScope | FromNodePipelineScope, + Field(discriminator='kind'), +] + + +class PipelineStepIssue(Contract): + code: str = Field(min_length=1, max_length=100, description='Stable machine-readable issue code.') + message: str = Field(min_length=1, max_length=1000, description='Human-readable issue summary.') + itemId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Canvas item associated with this issue, if applicable.') + + +class CompiledPipelineStep(Contract): + itemId: UUID = Field(description='Canvas item ID for this execution step.') + kind: Literal['generation', 'assembly'] = Field(description='Execution step category.') + upstreamItemIds: tuple[UUID, ...] = Field(default=(), description='Direct upstream step item IDs in this pipeline.') + inputFingerprint: Digest = Field(description='Deterministic fingerprint of this step inputs and upstream chain.') + cached: bool = Field(default=False, description='Whether an existing adopted result satisfies this step without re-running.') + cacheCandidateJobId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Existing succeeded job ID reused when cached is true.') + cacheCandidateAssetId: UUID | None = Field(default=None, exclude_if=lambda value: value is None, + description='Existing adopted asset ID reused when cached is true.') + expectedVersions: tuple[ObjectVersion, ...] = Field(default=(), description='Optimistic concurrency versions captured at compile time.') + + +class CompiledPipelineGraph(Contract): + projectId: UUID = Field(description='Owning project ID.') + scope: PipelineScope = Field(description='Requested execution scope.') + cachePolicy: PipelineCachePolicy = Field(description='Cache reuse policy applied during compilation.') + steps: tuple[CompiledPipelineStep, ...] = Field(default=(), description='Compiled pipeline steps in topological order.') + topologicalOrder: tuple[UUID, ...] = Field(default=(), description='Deterministic topological execution order of step item IDs.') + issues: tuple[PipelineStepIssue, ...] = Field(default=(), description='Pre-flight validation or cycle issues.') + plannedNewJobs: int = Field(default=0, strict=True, ge=0, description='Number of non-cached steps that will submit new jobs.') + + +def _sha256_json(payload) -> str: + encoded = json.dumps(payload, ensure_ascii=False, sort_keys=True, separators=(',', ':'), allow_nan=False).encode() + return hashlib.sha256(encoded).hexdigest() + + +def _group_descendants(items: dict[UUID, CanvasItem], group_id: UUID) -> list[CanvasItem]: + children: dict[UUID | None, list[CanvasItem]] = defaultdict(list) + for item in items.values(): + if item.visible: + children[item.parentId].append(item) + result: list[CanvasItem] = [] + stack = list(reversed(children.get(group_id, []))) + seen: set[UUID] = set() + while stack: + current = stack.pop() + if current.id in seen: + continue + seen.add(current.id) + result.append(current) + if isinstance(current, GroupCanvasItem): + stack.extend(reversed(children.get(current.id, []))) + return result + + +def _is_generation_step(item: CanvasItem, specs: dict[UUID, GenerationSpec], active_target_specs: set[UUID]) -> bool: + if not isinstance(item.binding, GenerationBinding): + return False + spec = specs.get(item.binding.objectRef.id) + if spec is None or spec.modelConfigId is None: + return False + has_prompt = bool(spec.prompt.strip() or spec.promptContent) + if spec.kind == 'text': + return has_prompt + return has_prompt or spec.id in active_target_specs + + +def _current_item_asset_fingerprint(snapshot: ProjectSnapshot, item: CanvasItem) -> str | None: + assets = {asset.id: asset for asset in snapshot.assets} + binding = item.binding + if getattr(binding, 'materialOverride', None) is not None: + asset = assets.get(binding.materialOverride.assetId) + return asset.fingerprint if asset else None + if binding.role == 'material': + asset = assets.get(binding.asset.assetId) + return asset.fingerprint if asset else None + if isinstance(binding, GenerationBinding): + spec = next((candidate for candidate in snapshot.generationSpecs if candidate.id == binding.objectRef.id), None) + if spec and spec.currentResultId: + result = next((candidate for candidate in snapshot.results if candidate.id == spec.currentResultId), None) + if result: + asset = assets.get(result.asset.assetId) + return asset.fingerprint if asset else None + return None + + +def _build_reference_graph(snapshot: ProjectSnapshot, items: dict[UUID, CanvasItem], specs: dict[UUID, GenerationSpec]): + """Map each canvas item ID to upstream canvas item IDs referenced by its spec or editor.""" + spec_to_items: dict[UUID, list[UUID]] = defaultdict(list) + for item in items.values(): + if isinstance(item.binding, GenerationBinding): + spec_to_items[item.binding.objectRef.id].append(item.id) + + sources_by_item: dict[UUID, list[UUID]] = defaultdict(list) + for ref in snapshot.references: + if not ref.active or not isinstance(ref, FollowingReference): + continue + source_id = ref.source.id + if source_id not in items: + continue + for target_item_id in spec_to_items.get(ref.targetSpecId, ()): + if source_id != target_item_id and source_id not in sources_by_item[target_item_id]: + sources_by_item[target_item_id].append(source_id) + return sources_by_item + + +def _downstream_closure(start_id: UUID, sources_by_item: dict[UUID, list[UUID]], allowed: set[UUID]) -> set[UUID]: + dependents: dict[UUID, list[UUID]] = defaultdict(list) + for target_id, sources in sources_by_item.items(): + if target_id not in allowed: + continue + for source_id in sources: + if source_id in allowed: + dependents[source_id].append(target_id) + visited = {start_id} + queue = [start_id] + while queue: + current = queue.pop(0) + for nxt in dependents.get(current, ()): + if nxt not in visited: + visited.add(nxt) + queue.append(nxt) + return visited + + +def _nearest_upstream_steps(step_ids: set[UUID], sources_by_item: dict[UUID, list[UUID]]) -> dict[UUID, tuple[UUID, ...]]: + upstream: dict[UUID, tuple[UUID, ...]] = {} + for step_id in step_ids: + found: list[UUID] = [] + seen = {step_id} + pending = list(sources_by_item.get(step_id, ())) + while pending: + node_id = pending.pop(0) + if node_id in seen: + continue + seen.add(node_id) + if node_id in step_ids: + found.append(node_id) + else: + pending.extend(sources_by_item.get(node_id, ())) + upstream[step_id] = tuple(found) + return upstream + + +def _topological_sort(step_ids: list[UUID], upstream: dict[UUID, tuple[UUID, ...]]) -> tuple[list[UUID], list[UUID]]: + """Return (topological_order, cycle_path). When a cycle exists, cycle_path is non-empty.""" + visiting: list[UUID] = [] + visiting_set: set[UUID] = set() + visited: set[UUID] = set() + order: list[UUID] = [] + + def dfs(node_id: UUID) -> list[UUID]: + if node_id in visited: + return [] + if node_id in visiting_set: + start = visiting.index(node_id) + return visiting[start:] + [node_id] + visiting.append(node_id) + visiting_set.add(node_id) + for dep in upstream.get(node_id, ()): + cycle = dfs(dep) + if cycle: + return cycle + visiting.pop() + visiting_set.remove(node_id) + visited.add(node_id) + order.append(node_id) + return [] + + for step_id in step_ids: + cycle = dfs(step_id) + if cycle: + return [], cycle + return order, [] + + +def _step_spec_signature(spec: GenerationSpec) -> dict: + return spec.model_dump(mode='json', exclude={'revision', 'currentResultId'}) + + +def _active_references_signature( + snapshot: ProjectSnapshot, + spec_id: UUID, + items: dict[UUID, CanvasItem], + upstream_fingerprints: dict[UUID, str], +) -> list[dict]: + assets = {asset.id: asset for asset in snapshot.assets} + refs = sorted( + (ref for ref in snapshot.references if ref.active and ref.targetSpecId == spec_id), + key=lambda ref: (ref.order, str(ref.id)), + ) + signature = [] + for ref in refs: + if isinstance(ref, PinnedReference): + asset = assets.get(ref.source.assetId) + signature.append({ + 'id': str(ref.id), + 'mode': 'pinned', + 'role': ref.role, + 'order': ref.order, + 'assetFingerprint': asset.fingerprint if asset else ref.source.fingerprint, + }) + elif isinstance(ref, FollowingReference): + source_id = ref.source.id + if source_id in upstream_fingerprints: + source_fp = f'step:{upstream_fingerprints[source_id]}' + elif source_id in items: + source_fp = f'asset:{_current_item_asset_fingerprint(snapshot, items[source_id]) or "none"}' + else: + source_fp = 'missing' + signature.append({ + 'id': str(ref.id), + 'mode': 'follow', + 'role': ref.role, + 'order': ref.order, + 'sourceId': str(source_id), + 'sourceFingerprint': source_fp, + }) + return signature + + +def _matching_cached_job( + snapshot: ProjectSnapshot, + item: CanvasItem, + spec: GenerationSpec, + items: dict[UUID, CanvasItem], + model_fingerprint: str | None, +) -> tuple[Job, UUID] | None: + """Return (job, asset_id) when the node's adopted result matches current inputs.""" + if not isinstance(item.binding, GenerationBinding) or item.binding.materialOverride is not None: + return None + if spec.currentResultId is None: + return None + result = next((candidate for candidate in snapshot.results if candidate.id == spec.currentResultId), None) + if result is None: + return None + assets = {asset.id: asset for asset in snapshot.assets} + if result.asset.assetId not in assets: + return None + job = next((candidate for candidate in snapshot.jobs if candidate.id == result.jobId), None) + if job is None or job.status != 'succeeded' or not job.adopted or job.asset is None: + return None + if job.asset.assetId != result.asset.assetId: + return None + if _step_spec_signature(job.inputSnapshot.spec) != _step_spec_signature(spec): + return None + if job.inputSnapshot.model.modelConfigId != spec.modelConfigId: + return None + if model_fingerprint is not None and _sha256_json(job.inputSnapshot.model.model_dump(mode='json')) == '': + return None + + active_refs = sorted( + (ref for ref in snapshot.references if ref.active and ref.targetSpecId == spec.id), + key=lambda ref: (ref.order, str(ref.id)), + ) + job_refs_by_id: dict[UUID, list] = defaultdict(list) + for resolved in job.inputSnapshot.references: + job_refs_by_id[resolved.referenceId].append(resolved) + + if {ref.id for ref in active_refs} != set(job_refs_by_id): + return None + + for ref in active_refs: + resolved_list = job_refs_by_id[ref.id] + if isinstance(ref, PinnedReference): + if len(resolved_list) != 1 or resolved_list[0].asset.fingerprint != ref.source.fingerprint: + return None + elif isinstance(ref, FollowingReference): + source_item = items.get(ref.source.id) + if source_item is None: + return None + current_fp = _current_item_asset_fingerprint(snapshot, source_item) + if current_fp is None: + return None + if len(resolved_list) != 1 or resolved_list[0].asset.fingerprint != current_fp: + return None + return job, result.asset.assetId + + +def compile_pipeline( + snapshot: ProjectSnapshot, + scope: PipelineScope, + *, + cache_policy: PipelineCachePolicy = 'reuse', + force_from_item_id: UUID | None = None, + model_fingerprints: dict[UUID, str] | None = None, +) -> CompiledPipelineGraph: + """Compile a deterministic, validated DAG from a ProjectSnapshot.""" + items = {item.id: item for item in snapshot.canvasItems} + specs = {spec.id: spec for spec in snapshot.generationSpecs} + issues: list[PipelineStepIssue] = [] + + sources_by_item = _build_reference_graph(snapshot, items, specs) + active_target_specs = {ref.targetSpecId for ref in snapshot.references if ref.active} + + candidate_items: list[CanvasItem] = [] + if scope.kind == 'group': + group = items.get(scope.groupId) + if not isinstance(group, GroupCanvasItem) or not group.visible: + issues.append(PipelineStepIssue( + code='pipeline_scope_not_found', + message='找不到目标分组或分组已隐藏。', + itemId=scope.groupId, + )) + return CompiledPipelineGraph( + projectId=snapshot.project.id, scope=scope, cachePolicy=cache_policy, + issues=tuple(issues), + ) + candidate_items = _group_descendants(items, scope.groupId) + elif scope.kind == 'selection': + for item_id in scope.itemIds: + item = items.get(item_id) + if item is None or not item.visible: + issues.append(PipelineStepIssue( + code='pipeline_scope_not_found', + message='所选节点不存在或已隐藏。', + itemId=item_id, + )) + else: + candidate_items.append(item) + if issues: + return CompiledPipelineGraph( + projectId=snapshot.project.id, scope=scope, cachePolicy=cache_policy, + issues=tuple(issues), + ) + elif scope.kind == 'from_node': + root = items.get(scope.itemId) + if root is None or not root.visible: + issues.append(PipelineStepIssue( + code='pipeline_scope_not_found', + message='起点节点不存在或已隐藏。', + itemId=scope.itemId, + )) + return CompiledPipelineGraph( + projectId=snapshot.project.id, scope=scope, cachePolicy=cache_policy, + issues=tuple(issues), + ) + if scope.groupId is not None: + boundary_items = _group_descendants(items, scope.groupId) + allowed = {item.id for item in boundary_items} | {scope.itemId} + else: + allowed = {item.id for item in items.values() if item.visible} + closure = _downstream_closure(scope.itemId, sources_by_item, allowed) + candidate_items = [item for item in items.values() if item.id in closure] + + step_items = [item for item in candidate_items if _is_generation_step(item, specs, active_target_specs)] + if not step_items: + issues.append(PipelineStepIssue( + code='pipeline_no_runnable_steps', + message='当前范围内没有可运行的生成节点,请先配置模型并填写提示词或连接参考。', + itemId=scope.groupId if scope.kind == 'group' else (scope.itemId if scope.kind == 'from_node' else None), + )) + return CompiledPipelineGraph( + projectId=snapshot.project.id, scope=scope, cachePolicy=cache_policy, + issues=tuple(issues), + ) + + step_id_list = [item.id for item in step_items] + step_id_set = set(step_id_list) + upstream = _nearest_upstream_steps(step_id_set, sources_by_item) + + topo_order, cycle = _topological_sort(step_id_list, upstream) + if cycle: + cycle_label = ', '.join(str(node_id) for node_id in cycle) + issues.append(PipelineStepIssue( + code='pipeline_cycle', + message=f'流水线存在循环依赖:{cycle_label}', + itemId=cycle[0], + )) + return CompiledPipelineGraph( + projectId=snapshot.project.id, scope=scope, cachePolicy=cache_policy, + issues=tuple(issues), + ) + + forced_ids: set[UUID] = set() + if cache_policy == 'force_all': + forced_ids = set(step_id_set) + elif cache_policy == 'force_from_node' and force_from_item_id is not None and force_from_item_id in step_id_set: + forced_ids = _downstream_closure(force_from_item_id, {k: list(v) for k, v in upstream.items()}, step_id_set) + elif scope.kind == 'from_node': + forced_ids = set(step_id_set) + + step_fingerprints: dict[UUID, str] = {} + step_cached: dict[UUID, bool] = {} + compiled_steps: list[CompiledPipelineStep] = [] + + for item_id in topo_order: + item = items[item_id] + spec = specs[item.binding.objectRef.id] + deps = upstream[item_id] + model_fp = model_fingerprints.get(spec.modelConfigId) if (model_fingerprints and spec.modelConfigId) else None + ref_sig = _active_references_signature(snapshot, spec.id, items, step_fingerprints) + fp = _sha256_json({ + 'itemId': str(item_id), + 'spec': _step_spec_signature(spec), + 'modelFingerprint': model_fp, + 'references': ref_sig, + }) + step_fingerprints[item_id] = fp + + all_upstreams_cached = all(step_cached.get(dep, False) for dep in deps) + cached_match = None + if cache_policy != 'force_all' and item_id not in forced_ids and all_upstreams_cached: + cached_match = _matching_cached_job(snapshot, item, spec, items, model_fp) + + is_cached = cached_match is not None + step_cached[item_id] = is_cached + + if not is_cached and item.locked: + issues.append(PipelineStepIssue( + code='pipeline_step_locked', + message='流水线包含已锁定的待运行节点,请先解锁后再运行。', + itemId=item_id, + )) + + compiled_steps.append(CompiledPipelineStep( + itemId=item_id, + kind='generation', + upstreamItemIds=deps, + inputFingerprint=fp, + cached=is_cached, + cacheCandidateJobId=cached_match[0].id if cached_match else None, + cacheCandidateAssetId=cached_match[1] if cached_match else None, + expectedVersions=( + ObjectVersion(objectType='generation_spec', id=spec.id, revision=spec.revision), + ObjectVersion(objectType='canvas_item', id=item.id, revision=item.revision), + ), + )) + + planned_new = sum(1 for step in compiled_steps if not step.cached) + return CompiledPipelineGraph( + projectId=snapshot.project.id, + scope=scope, + cachePolicy=cache_policy, + steps=tuple(compiled_steps), + topologicalOrder=tuple(topo_order), + issues=tuple(issues), + plannedNewJobs=planned_new, + ) diff --git a/packages/core/src/opendirector/domain/creation/project.py b/packages/core/src/opendirector/domain/creation/project.py index 7f6f5e80c..eaa230f88 100644 --- a/packages/core/src/opendirector/domain/creation/project.py +++ b/packages/core/src/opendirector/domain/creation/project.py @@ -87,8 +87,8 @@ def project_relations(self): parents = {} for item in self.canvasItems: if item.parentId: - if item.kind == 'group' and item.autoLayout == 'run': - raise ValueError('Run layout requires a top-level group') + if item.kind == 'group' and item.autoLayout in {'run', 'pipeline'}: + raise ValueError('Pipeline layout requires a top-level group') if item.parentId not in items or items[item.parentId].kind != 'group': raise ValueError('Parent must be a group in the same project') parents[item.id] = [item.parentId] diff --git a/packages/core/src/opendirector/domain/creation/run_layout.py b/packages/core/src/opendirector/domain/creation/run_layout.py index 7fca8d2f0..d4e02cae8 100644 --- a/packages/core/src/opendirector/domain/creation/run_layout.py +++ b/packages/core/src/opendirector/domain/creation/run_layout.py @@ -118,12 +118,12 @@ def layout_runs(data: dict): runs, fixed, locked_runs = [], [], [] for item in children[None]: - if item['kind'] == 'group' and item.get('autoLayout') == 'run' and not item['locked']: + if item['kind'] == 'group' and item.get('autoLayout') in {'run', 'pipeline'} and not item['locked']: _layout_contents(item, children) runs.append((item, _footprint(item, children))) else: bounds = _positioned(item, _footprint(item, children)) - if item.get('autoLayout') == 'run': + if item.get('autoLayout') in {'run', 'pipeline'}: for other, other_bounds in locked_runs: if bounds.overlaps(other_bounds, 0): raise ContractError('canvas_run_layout_conflict', '已锁定的 Run 区域重叠,请解锁其中一个后重试。', @@ -167,7 +167,7 @@ def _validate_membership(canvas, managed, original): def reflow_runs(before: ProjectSnapshot, edited: ProjectSnapshot, *, force=False) -> tuple[ProjectSnapshot, set[UUID]]: - managed = {str(item.id) for item in edited.canvasItems if item.kind == 'group' and item.autoLayout == 'run'} + managed = {str(item.id) for item in edited.canvasItems if item.kind == 'group' and item.autoLayout in {'run', 'pipeline'}} if not managed: return edited, set() canvas = [item.model_dump(mode='json') for item in edited.canvasItems] diff --git a/packages/core/src/opendirector/infrastructure/creation_publication.py b/packages/core/src/opendirector/infrastructure/creation_publication.py index 3b14da792..ba830da31 100644 --- a/packages/core/src/opendirector/infrastructure/creation_publication.py +++ b/packages/core/src/opendirector/infrastructure/creation_publication.py @@ -71,7 +71,7 @@ def commit(self, command: Command, validate_published_plans(command, before, snapshot) changed = object_changes(before, snapshot, command) operations = command.payload.operations if command.type == 'creation.batch' else (command,) - organize_runs = any(operation.type == 'canvas.layoutRuns' for operation in operations) + organize_runs = any(operation.type in {'canvas.layoutRuns', 'canvas.layoutPipelines'} for operation in operations) if organize_runs or any(item['version'].objectType == 'canvas_item' for item in changed): # All service writes passed their original CAS above. Only the # geometry derived from the locked current snapshot is exempt. diff --git a/scripts/generate_contracts.py b/scripts/generate_contracts.py index 20426da25..f017aa414 100644 --- a/scripts/generate_contracts.py +++ b/scripts/generate_contracts.py @@ -17,7 +17,7 @@ from opendirector.domain.creation.schema import ALIASES, CreationContracts from opendirector.domain.rule_facts import typescript_module -MODULES = ('base', 'assets', 'models', 'generation', 'editors', 'canvas', 'project', 'commands', 'timeline_packages', 'schema') +MODULES = ('base', 'assets', 'models', 'generation', 'editors', 'canvas', 'pipeline', 'project', 'commands', 'timeline_packages', 'schema') def models(): diff --git a/src/canvas/CanvasActionsContext.ts b/src/canvas/CanvasActionsContext.ts index 98c360f9c..7fd463269 100644 --- a/src/canvas/CanvasActionsContext.ts +++ b/src/canvas/CanvasActionsContext.ts @@ -3,6 +3,7 @@ import type { CanvasNode, CanvasNodeData } from "./model"; import type { NodeGenerationActivity } from "./generationActivity"; import type { TextSelections } from "./TextNodeEditor"; import type { SubjectMediaSlot } from "./subjectMedia.ts"; +import type { PipelineStep } from "./workspace/useWorkspaceGeneration.ts"; export interface CanvasActions { readOnly?: boolean; @@ -36,6 +37,7 @@ export interface CanvasActions { isLocked: (id: string) => boolean; getNode: (id: string) => CanvasNode | undefined; generationActivity: (id: string) => NodeGenerationActivity | undefined; + pipelineStep?: (id: string) => PipelineStep | undefined; isArriving: (id: string) => boolean; referenceTargetState?: (id: string) => "valid" | "invalid" | null; removeReference?: (id: string) => void; diff --git a/src/canvas/NodeFrame.tsx b/src/canvas/NodeFrame.tsx index 7a219375f..e0316b93d 100644 --- a/src/canvas/NodeFrame.tsx +++ b/src/canvas/NodeFrame.tsx @@ -4,8 +4,22 @@ import type { CanvasNodeKind } from "./model"; import { CanvasActionsContext } from "./CanvasActionsContext"; import { CanvasIcon } from "./CanvasIcon"; import { useI18n } from "../i18n/I18nProvider.tsx"; +import type { MessageKey } from "../i18n/messages"; +import type { PipelineStepStatus } from "./workspace/useWorkspaceGeneration.ts"; import { displayNodeTitle } from "./nodeTitle.ts"; +const PIPELINE_STEP_LABELS: Record = { + pending: "canvas.pipeline.step.pending", + cached: "canvas.pipeline.step.cached", + ready: "canvas.pipeline.step.ready", + running: "canvas.pipeline.step.running", + awaiting_input: "canvas.pipeline.step.awaitingInput", + succeeded: "canvas.pipeline.step.succeeded", + failed: "canvas.pipeline.step.failed", + skipped: "canvas.pipeline.step.skipped", + cancelled: "canvas.pipeline.step.cancelled", +}; + /** Shared node chrome and title editing; each node renderer owns only its contents. */ export function NodeFrame({ id, @@ -29,6 +43,7 @@ export function NodeFrame({ const actions = useContext(CanvasActionsContext); const locked = Boolean(actions?.isLocked(id)); const target = actions?.referenceTargetState?.(id); + const pipelineStep = actions?.pipelineStep?.(id); const editing = actions?.nameEdit?.id === id; const input = useRef(null); const finished = useRef(false); @@ -126,6 +141,14 @@ export function NodeFrame({ {shownTitle} )} + {pipelineStep && ( + + {t(PIPELINE_STEP_LABELS[pipelineStep.status])} + + )} {locked && } {children} diff --git a/src/canvas/NodeSelectionToolbar.tsx b/src/canvas/NodeSelectionToolbar.tsx index d4504f27a..020f911d3 100644 --- a/src/canvas/NodeSelectionToolbar.tsx +++ b/src/canvas/NodeSelectionToolbar.tsx @@ -47,9 +47,16 @@ export interface NodeSelectionToolbarProps { onRename?: () => void; onDuplicate?: () => void; onDelete?: () => void; - /** Group actions: run the members' generation workflow, ungroup, arrange, recolor. */ + /** Group actions: run the members' pipeline, ungroup, arrange, recolor. */ onRunWorkflow?: () => void; workflowRunning?: boolean; + pipelinePaused?: boolean; + onPauseWorkflow?: () => void; + onForceRerunPipeline?: () => void; + onCancelPipeline?: () => void; + onRetryPipeline?: () => void; + onOpenPipelineDrawer?: () => void; + pipelineBusy?: boolean; onViewGroupPlan?: () => void; onUngroup?: () => void; onLayout?: (layout: GroupLayout) => void; @@ -72,6 +79,7 @@ type Action = { id: string; label: string; icon: string; + tooltip?: string; /** Solid tool glyph; tool actions outweigh the line icons used for chrome. */ glyph?: ToolGlyphName; run?: () => void; @@ -148,6 +156,13 @@ export function NodeSelectionToolbar({ onDelete, onRunWorkflow, workflowRunning = false, + pipelinePaused = false, + onPauseWorkflow, + onForceRerunPipeline, + onCancelPipeline, + onRetryPipeline, + onOpenPipelineDrawer, + pipelineBusy = false, onViewGroupPlan, onUngroup, onLayout, @@ -160,7 +175,8 @@ export function NodeSelectionToolbar({ const hasMedia = Boolean(node.data.src) && node.data.assetState !== "missing"; useEffect(() => setOpenMenu(null), [node.id, node.type, locked, hasMedia]); const mediaKind = ["image", "video", "audio", "file"].includes(node.type); - if (mediaKind && !hasMedia) return null; + const hasNodeActions = !mediaKind || hasMedia; + if (!hasNodeActions) return null; const editing: Action[] = []; if (node.type === "timeline" && onOutput) { @@ -221,13 +237,59 @@ export function NodeSelectionToolbar({ }); }; if (node.type === "group") { - if (onRunWorkflow) + if (onRunWorkflow) { + const label: MessageKey = workflowRunning + ? "canvas.selection.group.running" + : pipelinePaused + ? "canvas.pipeline.action.resume" + : "canvas.pipeline.action.run"; editing.push({ id: "run-workflow", - label: workflowRunning ? t("canvas.selection.group.running") : t("canvas.selection.group.run"), + label: t(label), icon: "play", run: onRunWorkflow, - disabled: workflowRunning || locked, + disabled: Boolean(workflowRunning || pipelineBusy || locked), + }); + } + if (onPauseWorkflow && !pipelinePaused) + editing.push({ + id: "pause-workflow", + label: t("canvas.pipeline.action.pause"), + icon: "pause", + run: onPauseWorkflow, + disabled: Boolean(pipelineBusy), + }); + if (onCancelPipeline) + editing.push({ + id: "cancel-pipeline", + label: t("canvas.pipeline.action.cancel"), + icon: "close", + run: onCancelPipeline, + disabled: Boolean(pipelineBusy), + destructive: true, + }); + if (onRetryPipeline) + editing.push({ + id: "retry-pipeline", + label: t("canvas.pipeline.action.retryFailed"), + icon: "rotate", + run: onRetryPipeline, + disabled: Boolean(pipelineBusy || locked), + }); + if (onForceRerunPipeline) + editing.push({ + id: "force-rerun-pipeline", + label: t("canvas.pipeline.action.forceAll"), + icon: "rotate", + run: onForceRerunPipeline, + disabled: Boolean(workflowRunning || pipelineBusy || locked), + }); + if (onOpenPipelineDrawer) + editing.push({ + id: "pipeline-drawer", + label: t("canvas.pipeline.action.details"), + icon: "history", + run: onOpenPipelineDrawer, }); if (onViewGroupPlan) editing.push({ id: "view-group-plan", label: t("canvas.selection.group.viewPlan"), icon: "text", run: onViewGroupPlan }); @@ -331,7 +393,7 @@ export function NodeSelectionToolbar({ ], "tools", ); - } else if (node.type === "video") { + } else if (node.type === "video" && hasMedia) { for (const [tool, labelKey, icon] of videoTools) addTool(tool, t(labelKey), icon); addMenu( @@ -418,7 +480,7 @@ export function NodeSelectionToolbar({ } else if (editLabels[node.type]) { addEditor("edit", t(editLabels[node.type]!), node.type, "default"); } - if (onAssistant && node.type !== "group") + if (onAssistant && node.type !== "group" && hasNodeActions) editing.push({ id: "assistant", label: t("canvas.selection.assistant"), @@ -450,7 +512,7 @@ export function NodeSelectionToolbar({ const organization: Action[] = []; // A group's bar holds only its own actions; rename and delete stay in the context menu. - if (onRename && node.type !== "group") + if (onRename && node.type !== "group" && hasNodeActions) organization.push({ id: "rename", label: t("common.rename"), @@ -459,7 +521,7 @@ export function NodeSelectionToolbar({ iconOnly: true, disabled: locked, }); - if (onDuplicate && node.type !== "group") + if (onDuplicate && node.type !== "group" && hasNodeActions) organization.push({ id: "duplicate", label: t("canvas.selection.duplicate"), @@ -467,7 +529,7 @@ export function NodeSelectionToolbar({ run: onDuplicate, iconOnly: true, }); - if (onDelete && node.type !== "group") + if (onDelete && node.type !== "group" && hasNodeActions) organization.push({ id: "delete", label: t("canvas.selection.deleteNode"), @@ -566,11 +628,11 @@ export function NodeSelectionToolbar({ label={ action.disabled && locked ? t("canvas.selection.locked", { label: action.label }) - : action.label + : action.tooltip ?? action.label } tooltipSide="top" // Labelled buttons already show their text; only icons and lock reasons need a tooltip. - showTooltip={Boolean(action.iconOnly || (action.disabled && locked))} + showTooltip={Boolean(action.tooltip || action.iconOnly || (action.disabled && locked))} className={`${action.iconOnly ? "is-icon-only" : ""}${action.destructive ? " is-destructive" : ""}`} disabled={action.disabled} onClick={(event) => { diff --git a/src/canvas/PipelineDrawer.tsx b/src/canvas/PipelineDrawer.tsx new file mode 100644 index 000000000..67b7d7483 --- /dev/null +++ b/src/canvas/PipelineDrawer.tsx @@ -0,0 +1,137 @@ +import { CanvasIcon } from "./CanvasIcon"; +import type { PipelineControlAction, PipelineExecution, PipelineStepStatus } from "./workspace/useWorkspaceGeneration"; +import { useT } from "../i18n/I18nProvider"; +import type { MessageKey } from "../i18n/messages"; +import "./pipeline-drawer.css"; + +const STEP_STATUS_LABELS: Record = { + pending: "canvas.pipeline.step.pending", + cached: "canvas.pipeline.step.cached", + ready: "canvas.pipeline.step.ready", + running: "canvas.pipeline.step.running", + awaiting_input: "canvas.pipeline.step.awaitingInput", + succeeded: "canvas.pipeline.step.succeeded", + failed: "canvas.pipeline.step.failed", + skipped: "canvas.pipeline.step.skipped", + cancelled: "canvas.pipeline.step.cancelled", +}; + +const EXECUTION_STATUS_LABELS: Record = { + queued: "canvas.pipeline.status.queued", + running: "canvas.pipeline.status.running", + pausing: "canvas.pipeline.status.pausing", + paused: "canvas.pipeline.status.paused", + awaiting_input: "canvas.pipeline.status.awaitingInput", + succeeded: "canvas.pipeline.status.succeeded", + failed: "canvas.pipeline.status.failed", + cancelled: "canvas.pipeline.status.cancelled", +}; + +export function PipelineDrawer({ + execution, + titleForItem, + busy = false, + onControl, + onForceRerun, + onFocusNode, + onClose, +}: { + execution: PipelineExecution; + titleForItem: (itemId: string) => string; + busy?: boolean; + onControl: (action: PipelineControlAction) => void; + onForceRerun?: () => void; + onFocusNode: (itemId: string) => void; + onClose: () => void; +}) { + const t = useT(); + const isActive = execution.status === "queued" || execution.status === "running" || execution.status === "pausing"; + const isPaused = execution.status === "paused"; + const canRetry = execution.status === "failed" || execution.status === "cancelled" || isPaused; + + const counts = { + succeeded: execution.steps.filter((s) => s.status === "succeeded").length, + cached: execution.steps.filter((s) => s.status === "cached").length, + failed: execution.steps.filter((s) => s.status === "failed").length, + skipped: execution.steps.filter((s) => s.status === "skipped").length, + }; + + return ( + + ); +} diff --git a/src/canvas/groupWorkflow.ts b/src/canvas/groupWorkflow.ts deleted file mode 100644 index 24b69f543..000000000 --- a/src/canvas/groupWorkflow.ts +++ /dev/null @@ -1,80 +0,0 @@ -import type { CanvasEdge } from "./model.ts"; - -export interface WorkflowOutcome { - succeeded: string[]; - failed: string[]; - /** Not run: a referenced member failed, or the step sits on a reference cycle. */ - skipped: string[]; -} - -/** - * Runs workflow steps in reference order. A step starts once every step it - * references, directly or through non-step nodes, has succeeded; steps without pending references run - * concurrently. A failure skips everything downstream of it. - */ -export async function runWorkflowSteps( - stepIds: readonly string[], - edges: readonly Pick[], - runStep: (id: string) => Promise, -): Promise { - const ids = new Set(stepIds); - const sources = new Map(); - for (const edge of edges) - if (edge.intent !== "post_edit_result" && edge.source !== edge.target) - sources.set(edge.target, [...(sources.get(edge.target) ?? []), edge.source]); - // A step depends on the nearest steps upstream of it, also through - // non-step nodes such as a subject or stack that carries a result onward. - const upstream = new Map( - stepIds.map((id) => { - const found = new Set(); - const seen = new Set([id]); - const pending = [...(sources.get(id) ?? [])]; - while (pending.length) { - const node = pending.pop()!; - if (seen.has(node)) continue; - seen.add(node); - if (ids.has(node)) found.add(node); - else pending.push(...(sources.get(node) ?? [])); - } - return [id, found]; - }), - ); - const outcome = new Map(); - const started = new Set(); - let running = 0; - await new Promise((resolve) => { - const advance = () => { - let progressed = true; - while (progressed) { - progressed = false; - for (const id of stepIds) { - if (started.has(id)) continue; - const sources = [...upstream.get(id)!]; - if (sources.some((source) => ["failed", "skipped"].includes(outcome.get(source) ?? ""))) { - started.add(id); - outcome.set(id, "skipped"); - progressed = true; - continue; - } - if (!sources.every((source) => outcome.get(source) === "succeeded")) continue; - started.add(id); - running++; - void runStep(id) - .catch(() => false) - .then((succeeded) => { - running--; - outcome.set(id, succeeded ? "succeeded" : "failed"); - advance(); - }); - } - } - if (running) return; - // Whatever never started is waiting on a reference cycle. - for (const id of stepIds) if (!outcome.has(id)) outcome.set(id, "skipped"); - resolve(); - }; - advance(); - }); - const pick = (state: string) => stepIds.filter((id) => outcome.get(id) === state); - return { succeeded: pick("succeeded"), failed: pick("failed"), skipped: pick("skipped") }; -} diff --git a/src/canvas/pipeline-drawer.css b/src/canvas/pipeline-drawer.css new file mode 100644 index 000000000..6365950fd --- /dev/null +++ b/src/canvas/pipeline-drawer.css @@ -0,0 +1,207 @@ +.cw-pipeline-drawer { + position: absolute; + top: 64px; + right: 16px; + width: 312px; + max-height: calc(100vh - 96px); + display: flex; + flex-direction: column; + gap: 10px; + padding: 12px; + border-radius: 12px; + background: var(--cw-surface, #181a1f); + border: 1px solid var(--cw-border, rgba(255, 255, 255, 0.1)); + box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); + color: var(--cw-text, #f1f3f5); + z-index: 35; + overflow: hidden; +} + +.cw-pipeline-drawer-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; +} + +.cw-pipeline-drawer-title-row { + display: flex; + align-items: center; + gap: 8px; + min-width: 0; +} + +.cw-pipeline-drawer-title { + font-size: 13px; + font-weight: 600; +} + +.cw-pipeline-close { + display: inline-flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + border: none; + border-radius: 6px; + background: transparent; + color: inherit; + cursor: pointer; +} + +.cw-pipeline-close:hover { + background: rgba(255, 255, 255, 0.08); +} + +.cw-pipeline-summary { + font-size: 12px; + opacity: 0.78; +} + +.cw-pipeline-actions { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.cw-pipeline-btn { + padding: 5px 10px; + border-radius: 7px; + border: 1px solid rgba(255, 255, 255, 0.14); + background: rgba(255, 255, 255, 0.05); + color: inherit; + font-size: 12px; + cursor: pointer; +} + +.cw-pipeline-btn:hover:not(:disabled) { + background: rgba(255, 255, 255, 0.11); +} + +.cw-pipeline-btn:disabled { + opacity: 0.5; + cursor: default; +} + +.cw-pipeline-btn-primary { + background: #3e63dd; + border-color: #3e63dd; + color: #fff; +} + +.cw-pipeline-btn-danger { + border-color: rgba(229, 72, 77, 0.45); + color: #ff9592; +} + +.cw-pipeline-steps { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 4px; + overflow-y: auto; +} + +.cw-pipeline-step { + display: flex; + flex-direction: column; + gap: 4px; +} + +.cw-pipeline-step-row { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + padding: 6px 8px; + border: 1px solid rgba(255, 255, 255, 0.06); + border-radius: 8px; + background: rgba(255, 255, 255, 0.03); + color: inherit; + text-align: left; + cursor: pointer; +} + +.cw-pipeline-step-row:hover { + background: rgba(255, 255, 255, 0.08); +} + +.cw-pipeline-step-index { + font-size: 11px; + opacity: 0.55; + width: 16px; + flex-shrink: 0; +} + +.cw-pipeline-step-name { + flex: 1; + font-size: 12px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.cw-pipeline-step-error { + padding: 4px 8px 6px 32px; + font-size: 11px; + color: #ff9592; + line-height: 1.4; +} + +.cw-pipeline-pill { + display: inline-flex; + align-items: center; + padding: 2px 6px; + border-radius: 999px; + font-size: 11px; + font-weight: 500; + line-height: 1.2; + white-space: nowrap; +} + +.cw-pipeline-pill-pending, +.cw-pipeline-pill-queued, +.cw-pipeline-pill-ready { + background: rgba(139, 143, 154, 0.22); + color: #d0d4dc; +} + +.cw-pipeline-pill-running, +.cw-pipeline-pill-pausing { + background: rgba(62, 99, 221, 0.28); + color: #9eb1ff; +} + +.cw-pipeline-pill-cached { + background: rgba(48, 164, 108, 0.2); + color: #7ee2b8; +} + +.cw-pipeline-pill-succeeded { + background: rgba(48, 164, 108, 0.28); + color: #5dd39e; +} + +.cw-pipeline-pill-paused, +.cw-pipeline-pill-awaiting_input { + background: rgba(255, 197, 61, 0.22); + color: #ffd666; +} + +.cw-pipeline-pill-failed { + background: rgba(229, 72, 77, 0.28); + color: #ff9592; +} + +.cw-pipeline-pill-skipped, +.cw-pipeline-pill-cancelled { + background: rgba(139, 143, 154, 0.16); + color: #9ba1a6; +} + +.cw-node-pipeline-badge { + margin-left: auto; + flex-shrink: 0; +} diff --git a/src/canvas/storage.ts b/src/canvas/storage.ts index 869634cc2..d863ed646 100644 --- a/src/canvas/storage.ts +++ b/src/canvas/storage.ts @@ -155,7 +155,7 @@ export function parseDocument(input: unknown): Result { data: parsedData.value, ...(typeof raw.locked === "boolean" ? { locked: raw.locked } : {}), ...(typeof raw.color === "string" ? { color: raw.color } : {}), - ...(raw.type === "group" && raw.autoLayout === "run" ? { autoLayout: raw.autoLayout } : {}), + ...(raw.type === "group" && (raw.autoLayout === "pipeline" || raw.autoLayout === "run") ? { autoLayout: raw.autoLayout } : {}), ...(typeof raw.zIndex === "number" ? { zIndex: raw.zIndex } : {}), ...(typeof raw.parentId === "string" ? { parentId: raw.parentId } : {}), }); diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index bcf373c62..986996eae 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -80,6 +80,7 @@ import { pinnedPrecheckNodes, presetReferenceSources } from "../workspaceInterac import { NodeInfoButton } from "../NodeInfoButton"; import { NodeSelectionToolbar } from "../NodeSelectionToolbar"; +import { PipelineDrawer } from "../PipelineDrawer"; import { TextNodeWindow } from "../TextNodeWindow"; import { SelectionBarAnchor } from "../SelectionBarAnchor"; import { NodeTaskPanel } from "../NodeTaskPanel"; @@ -175,6 +176,10 @@ export function WorkspaceView({ rt, editingState, editSession }: { downloadNode, downloadGroup, runGroupWorkflow, + activePipeline, + selectedGroupPipeline, + controlPipeline, + pipelineControlBusy, editProjectNameId, editing, editorMode, @@ -459,10 +464,12 @@ export function WorkspaceView({ rt, editingState, editSession }: { }, [outputState?.output.id]); const [workflowGroups, setWorkflowGroups] = useState>(() => new Set()); - const runWorkflow = (groupId: string) => { + const [pipelineDrawerOpen, setPipelineDrawerOpen] = useState(false); + const runWorkflow = (groupId: string, cachePolicy: "reuse" | "force_all" = "reuse") => { if (workflowGroups.has(groupId)) return; + setPipelineDrawerOpen(true); setWorkflowGroups((current) => new Set(current).add(groupId)); - void (runGroupWorkflow(groupId) as Promise).finally(() => + void (runGroupWorkflow(groupId, cachePolicy) as Promise).finally(() => setWorkflowGroups((current) => { const next = new Set(current); next.delete(groupId); @@ -470,6 +477,15 @@ export function WorkspaceView({ rt, editingState, editSession }: { }), ); }; + const groupPipelineStatus = selectedGroupPipeline?.status; + const groupPipelineActive = groupPipelineStatus === "queued" || groupPipelineStatus === "running" || groupPipelineStatus === "pausing"; + const groupPipelinePaused = groupPipelineStatus === "paused"; + const groupPipelineCanRetry = groupPipelineStatus === "failed" || groupPipelineStatus === "cancelled"; + const runPrimaryAction = single?.type === "group" + ? groupPipelinePaused && selectedGroupPipeline + ? () => void controlPipeline(selectedGroupPipeline.executionId, "resume") + : () => runWorkflow(single.id, "reuse") + : undefined; // Canvas locking is no longer offered. Locks saved while it was available are // released the first time this browser opens the project, parents first (a @@ -535,7 +551,7 @@ export function WorkspaceView({ rt, editingState, editSession }: { const runLayoutGroup = doc.nodes.find( (node) => node.id === menu?.nodeId && node.type === "group" && !node.parentId, ); - const hasManagedRuns = doc.nodes.some((node) => node.autoLayout === "run"); + const hasManagedRuns = doc.nodes.some((node) => Boolean(node.autoLayout)); const applyRunLayout = async (action: | { kind: "organize" } | { kind: "toggle" | "lock"; group: CanvasNode }, @@ -555,14 +571,14 @@ export function WorkspaceView({ rt, editingState, editSession }: { )) || !stillOpen()) return; const client = creationClient(projectId); if (action.kind === "organize") { - await client.command("canvas.layoutRuns", {}); + await client.command("canvas.layoutPipelines", {}); return; } const { group } = action; const item = client.snapshot.canvasItems.find((item) => item.id === group.id); if ( item?.kind !== "group" || item.parentId || item.locked || !item.visible || - (item.autoLayout === "run") !== (group.autoLayout === "run") + (Boolean(item.autoLayout)) !== (Boolean(group.autoLayout)) ) { notify(t("canvas.workspace.menu.runGroupChanged")); return; @@ -570,7 +586,7 @@ export function WorkspaceView({ rt, editingState, editSession }: { await client.command("canvas.update", { itemId: item.id, ...(action.kind === "lock" ? { locked: true } : { - autoLayout: group.autoLayout === "run" ? "free" : "run", + autoLayout: Boolean(group.autoLayout) ? "free" : "pipeline", }), }, [objectVersion("canvas_item", item)]); } catch (error) { @@ -1602,6 +1618,7 @@ export function WorkspaceView({ rt, editingState, editSession }: {
single.type === "group" ? void downloadGroup(single) : downloadNode(single) } - onRunWorkflow={single.type === "group" ? () => runWorkflow(single.id) : undefined} - workflowRunning={workflowGroups.has(single.id)} + onRunWorkflow={runPrimaryAction} + workflowRunning={workflowGroups.has(single.id) || groupPipelineActive} + pipelinePaused={groupPipelinePaused} + pipelineBusy={Boolean(pipelineControlBusy)} + onPauseWorkflow={selectedGroupPipeline && (groupPipelineStatus === "queued" || groupPipelineStatus === "running") + ? () => void controlPipeline(selectedGroupPipeline.executionId, "pause") : undefined} + onCancelPipeline={selectedGroupPipeline && (groupPipelineActive || groupPipelinePaused) + ? () => void controlPipeline(selectedGroupPipeline.executionId, "cancel") : undefined} + onRetryPipeline={selectedGroupPipeline && groupPipelineCanRetry + ? () => void controlPipeline(selectedGroupPipeline.executionId, "retry") : undefined} + onForceRerunPipeline={single.type === "group" && !groupPipelineActive + ? () => runWorkflow(single.id, "force_all") : undefined} + onOpenPipelineDrawer={selectedGroupPipeline + ? () => setPipelineDrawerOpen((open) => !open) : undefined} onViewGroupPlan={planNode ? () => setTextWindowId(planNode.id) : undefined} onUngroup={single.type === "group" ? ungroup : undefined} onLayout={ @@ -1727,6 +1756,23 @@ export function WorkspaceView({ rt, editingState, editSession }: { />
)} + {pipelineDrawerOpen && activePipeline && (() => { + const groupId = activePipeline.scope.kind === "group" ? activePipeline.scope.groupId : undefined; + return ( + doc.nodes.find((node) => node.id === itemId)?.data.title ?? itemId.slice(0, 8)} + busy={Boolean(pipelineControlBusy)} + onControl={(action) => void controlPipeline(activePipeline.executionId, action)} + onForceRerun={groupId ? () => runWorkflow(groupId, "force_all") : undefined} + onFocusNode={(itemId) => { + setSelected([itemId]); + focusSelection([itemId]); + }} + onClose={() => setPipelineDrawerOpen(false)} + /> + ); + })()} {activeAction && actionNode && ( <>
void applyRunLayout({ kind: "toggle", group: runLayoutGroup }), )} - {runLayoutGroup?.autoLayout === "run" && !lockedIds.has(runLayoutGroup.id) && + {runLayoutGroup?.autoLayout && !lockedIds.has(runLayoutGroup.id) && menuButton(t("canvas.workspace.menu.lockRun"), "lock", () => void applyRunLayout({ kind: "lock", group: runLayoutGroup }))} {menuButton(t("canvas.workspace.selection.autoArrange"), "map", () => diff --git a/src/canvas/workspace/runtimeTypes.ts b/src/canvas/workspace/runtimeTypes.ts index 5079f9474..04d2b4a6c 100644 --- a/src/canvas/workspace/runtimeTypes.ts +++ b/src/canvas/workspace/runtimeTypes.ts @@ -25,6 +25,12 @@ import { type WorkspaceState, } from "./state.ts"; import type { ServiceRun } from "./workspaceChrome.tsx"; +import type { + PipelineCachePolicy, + PipelineControlAction, + PipelineExecution, + PipelineStep, +} from "./useWorkspaceGeneration.ts"; export type WorkspaceFlowNode = Node; @@ -51,6 +57,12 @@ export interface WorkspaceRuntime extends WorkspaceState, WorkspaceSetters { setJobs: Dispatch>; readJobs: (signal?: AbortSignal) => Promise; recoverServiceTask: (job: GenerationJob) => Promise; + activePipeline?: PipelineExecution | null; + selectedGroupPipeline?: PipelineExecution | null; + pipelineStepByNode: ReadonlyMap; + pipelineControlBusy?: boolean; + runFromNodePipeline: (itemId: string, groupId?: string) => Promise; + controlPipeline: (executionId: string, action: PipelineControlAction) => Promise; command: (value: CanvasCommand) => void; commitCanvasCommand: (value: CanvasCommand, failureMessage: string) => Promise; change: (fn: (document: CanvasDocument) => CanvasDocument) => void; diff --git a/src/canvas/workspace/useWorkspaceGeneration.ts b/src/canvas/workspace/useWorkspaceGeneration.ts index 716ed302b..c57628d25 100644 --- a/src/canvas/workspace/useWorkspaceGeneration.ts +++ b/src/canvas/workspace/useWorkspaceGeneration.ts @@ -1,10 +1,16 @@ import { getEditingState } from "../../backend/editSession.ts"; -import { useEffect, useRef } from "react"; -import { errorMessage } from "../../backend/api.ts"; -import { creationClient } from "../../backend/creationClient.ts"; +import { useEffect, useRef, useState } from "react"; +import { errorMessage, json, storageRequest } from "../../backend/api.ts"; +import { creationClient, creationPath } from "../../backend/creationClient.ts"; import { type GenerationRequest } from "../../backend/generation.ts"; +import { readDelay, resilientRead } from "../../backend/resilientRead.ts"; +import { sameJsonValue } from "../../backend/sameJsonValue.ts"; import { backendModel, modelLabel } from "../../backend/rules.ts"; import { workspaceProjection } from "../../backend/workspace.ts"; +import type { + PipelineExecutionQuery, + PipelineExecutionsQuery, +} from "../../contracts/generated.ts"; import { deliverTool, pendingToolDelivery } from "../../backend/toolDeliveries"; import { @@ -28,8 +34,6 @@ import { type ResultSource, } from "../linkedResults"; import { type CanvasNode } from "../model"; -import { groupDescendants } from "../operations"; -import { runWorkflowSteps } from "../groupWorkflow"; import { incomingReferenceNodes } from "../generationReferenceContent.ts"; import { getNodeGenerationSettings } from "../NodeComposer"; import { @@ -47,6 +51,72 @@ import type { WorkspaceRuntime } from "./runtimeTypes.ts"; import { toolOutputKind, jobTime, incomingNodes } from "./workspaceChrome.tsx"; import type { ServiceRun } from "./workspaceChrome.tsx"; +export type PipelineCachePolicy = "reuse" | "force_from_node" | "force_all"; +export type PipelineExecutionStatus = + | "queued" + | "running" + | "pausing" + | "paused" + | "awaiting_input" + | "succeeded" + | "failed" + | "cancelled"; +export type PipelineStepStatus = + | "pending" + | "cached" + | "ready" + | "running" + | "awaiting_input" + | "succeeded" + | "failed" + | "skipped" + | "cancelled"; +export type PipelineStep = { + itemId: string; + kind: "generation" | "assembly"; + upstreamItemIds: readonly string[]; + inputFingerprint: string; + status: PipelineStepStatus; + jobId: string | null; + assetId: string | null; + issue: { code: string; message: string; itemId?: string | null } | null; +}; +export type PipelineExecution = { + executionId: string; + projectId: string; + scope: { kind: "group"; groupId: string } | { kind: "selection"; itemIds: readonly string[] } | { kind: "from_node"; itemId: string; groupId?: string }; + cachePolicy: PipelineCachePolicy; + status: PipelineExecutionStatus; + steps: readonly PipelineStep[]; + issue: { code: string; message: string; itemId?: string | null } | null; + createdAt?: number; + updatedAt?: number; +}; +export type PipelineControlAction = "pause" | "resume" | "cancel" | "retry"; + +function isPipelineActive(status: PipelineExecutionStatus) { + return status === "queued" || status === "running" || status === "pausing"; +} + +function readPipelineExecution(query: PipelineExecutionQuery, signal?: AbortSignal): Promise { + return resilientRead((attemptSignal) => storageRequest( + `${creationPath(query.projectId)}/queries`, { ...json("POST", query), signal: attemptSignal }, + ), { signal }); +} + +export async function readPipelineHistory(projectId: string, groupId?: string, signal?: AbortSignal) { + const query: PipelineExecutionsQuery = { + type: "pipeline.executions.list", + queryId: crypto.randomUUID(), + projectId, + ...(groupId ? { groupId } : {}), + }; + const result = await resilientRead((attemptSignal) => storageRequest<{ executions: readonly PipelineExecution[] }>( + `${creationPath(projectId)}/queries`, { ...json("POST", query), signal: attemptSignal }, + ), { signal }); + return result.executions; +} + export function useWorkspaceGeneration( rt: WorkspaceRuntime, writePaused: boolean, @@ -697,143 +767,166 @@ export function useWorkspaceGeneration( notify(t("canvas.workspace.error.noGenerationModel")); return none; }; - /** Latest render's generation entry point; a workflow outlives the render that started it. */ - const prepareLatest = useRef(prepareGeneration); - prepareLatest.current = prepareGeneration; - /** - * Resolves once every job is terminal (true when one succeeded), or false - * when the canvas has switched to another project. - */ - const awaitJobs = (documentId: string, jobIds: readonly string[]) => - new Promise((resolve) => { - const client = creationClient(documentId); - const terminal = ["succeeded", "failed", "cancelled", "interrupted"]; - let finish = () => {}; - const check = () => { - if (!mounted.current || historyRef.current.present.id !== documentId) { - finish(); - resolve(false); - return; + const onRunCanvas = (projectId: string) => mounted.current && historyRef.current.present.id === projectId; + const pipelineObservers = useRef(new Map }>()); + const pipelineControlLock = useRef(new Set()); + const [pipelineExecutions, setPipelineExecutions] = useState>(new Map()); + const [latestGroupPipelines, setLatestGroupPipelines] = useState>(new Map()); + const [activePipelineId, setActivePipelineId] = useState(null); + const [pipelineControlBusy, setPipelineControlBusy] = useState(false); + + const rememberPipeline = (projectId: string, execution: PipelineExecution) => { + const key = `${projectId}/${execution.executionId}`; + setPipelineExecutions((previous) => sameJsonValue(previous.get(key), execution) + ? previous : new Map(previous).set(key, execution)); + if (execution.scope.kind === "group") { + const groupKey = `${projectId}/${execution.scope.groupId}`; + setLatestGroupPipelines((previous) => previous.get(groupKey) === execution.executionId + ? previous : new Map(previous).set(groupKey, execution.executionId)); + } + setActivePipelineId(execution.executionId); + }; + + const observePipeline = (projectId: string, executionId: string) => { + const observerKey = `${projectId}/${executionId}`; + const existing = pipelineObservers.current.get(observerKey); + if (existing) return existing.pending; + const controller = new AbortController(); + const pending = (async () => { + while (onRunCanvas(projectId) && !controller.signal.aborted) { + const execution = await readPipelineExecution({ + type: "pipeline.execution.get", + queryId: crypto.randomUUID(), + projectId, + objectId: executionId, + }, controller.signal); + if (!onRunCanvas(projectId) || controller.signal.aborted) return; + rememberPipeline(projectId, execution); + if (isPipelineActive(execution.status)) { + await readDelay(1000, controller.signal); + continue; + } + await syncServiceResults().catch(() => undefined); + if (!onRunCanvas(projectId)) return; + const succeeded = execution.steps.filter((s) => s.status === "succeeded").length; + const cached = execution.steps.filter((s) => s.status === "cached").length; + const failed = execution.steps.filter((s) => s.status === "failed").length; + const skipped = execution.steps.filter((s) => s.status === "skipped").length; + if (execution.status === "succeeded") { + notify(cached > 0 + ? t("canvas.workspace.pipeline.doneWithCache", { succeeded, cached }) + : t("canvas.workspace.pipeline.done", { count: succeeded })); + } else if (execution.status === "paused") { + notify(t("canvas.workspace.pipeline.paused")); + } else if (execution.status === "cancelled") { + notify(t("canvas.workspace.pipeline.cancelled")); + } else if (execution.status === "failed") { + notify(t("canvas.workspace.pipeline.incomplete", { succeeded: succeeded + cached, failed, skipped })); } - const states = jobIds.map( - (id) => client.snapshot.jobs.find((job) => job.id === id)?.status, - ); - if (!states.every((status) => status && terminal.includes(status))) - return; - finish(); - resolve(states.includes("succeeded")); - }; - const stop = client.listen(check); - const poll = setInterval(check, 1000); - finish = () => { - stop(); - clearInterval(poll); - }; - check(); - }); - /** - * Waits until the canvas shows the result the service adopted for the node, - * so a downstream step reads the new content (for example generated text - * used as its prompt). Resolves false when no result was adopted (a - * candidate-only result, or inputs edited while running), after three - * minutes, or when the canvas switched project. - */ - const awaitDisplayed = ( - documentId: string, - nodeId: string, - jobIds: readonly string[], - ) => - new Promise((resolve) => { - const snapshot = creationClient(documentId).snapshot; - const adopted = new Set( - snapshot.jobs - .filter((job) => jobIds.includes(job.id) && job.adopted) - .map((job) => job.id), - ); - const assets = new Set( - snapshot.results - .filter((result) => adopted.has(result.jobId)) - .map((result) => result.asset.assetId), - ); - if (!assets.size) { - resolve(false); return; } - const started = Date.now(); - const check = () => { - const present = historyRef.current.present; - const node = present.nodes.find((candidate) => candidate.id === nodeId); - const done = - present.id === documentId && - node && - assets.has(node.data.backendAssetId ?? "") - ? true - : !mounted.current || - present.id !== documentId || - !node || - Date.now() - started > 180_000 - ? false - : undefined; - if (done === undefined) return; - clearInterval(poll); - resolve(done); - }; - const poll = setInterval(check, 200); - check(); + })().catch(() => { + // Transient polling errors do not cancel the backend execution. + }).finally(() => { + if (pipelineObservers.current.get(observerKey)?.controller === controller) { + pipelineObservers.current.delete(observerKey); + } }); - /** - * Runs a group's generation nodes. A node waits for the members it - * references, directly or through non-generating nodes, and is skipped when - * one of them fails; independent nodes run concurrently. Submissions go one - * at a time, as the project's command queue would serialize them anyway, so - * each starts from the canvas the previous one left behind. - */ - const runGroupWorkflow = async (groupId: string) => { + pipelineObservers.current.set(observerKey, { controller, pending }); + return pending; + }; + + useEffect(() => { + const projectId = doc.id; + let cancelled = false; + void readPipelineHistory(projectId).then((executions) => { + if (cancelled || !onRunCanvas(projectId) || !executions.length) return; + const latest = executions[0]; + rememberPipeline(projectId, latest); + if (isPipelineActive(latest.status)) void observePipeline(projectId, latest.executionId); + }).catch(() => undefined); + return () => { + cancelled = true; + for (const [key, observer] of pipelineObservers.current) { + if (!key.startsWith(`${projectId}/`)) continue; + observer.controller.abort(); + pipelineObservers.current.delete(key); + } + }; + }, [doc.id]); + + const startPipeline = async ( + scope: PipelineExecution["scope"], + cachePolicy: PipelineCachePolicy = "reuse", + ) => { const document = historyRef.current.present; - const steps = groupDescendants(document.nodes, groupId).filter((node) => - isWorkflowStep( - node, - Boolean(imagePresetSkill(node)) || document.edges.some( - (edge) => - edge.target === node.id && edge.intent !== "post_edit_result", - ), - ), - ); - if (!steps.length) { - notify(t("canvas.workspace.group.noRunnableNodes")); - return; + const projectId = document.id; + const client = creationClient(projectId); + const executionId = crypto.randomUUID(); + try { + const receipt = await client.command( + "pipeline.start", + { scope, cachePolicy }, + [], + undefined, + executionId, + ); + if (!onRunCanvas(projectId)) return; + const resolvedId = receipt.pipelineExecutionId ?? executionId; + notify(t("canvas.workspace.pipeline.started")); + await observePipeline(projectId, resolvedId); + } catch (error) { + if (onRunCanvas(projectId)) { + notify(t("canvas.workspace.pipeline.startFailed", { error: errorMessage(error) })); + } } - notify( - t("canvas.workspace.group.workflowStarted", { count: steps.length }), - ); - let submissions: Promise = Promise.resolve(); - const result = await runWorkflowSteps( - steps.map((node) => node.id), - document.edges, - async (id) => { - const submitted = submissions.then(() => - historyRef.current.present.id === document.id - ? prepareLatest.current(id) - : [], - ); - submissions = submitted.catch(() => undefined); - const jobIds = await submitted; - if (!jobIds.length || !(await awaitJobs(document.id, jobIds))) - return false; - return awaitDisplayed(document.id, id, jobIds); - }, - ); - if (historyRef.current.present.id !== document.id) return; - notify( - result.failed.length || result.skipped.length - ? t("canvas.workspace.group.workflowIncomplete", { - succeeded: result.succeeded.length, - failed: result.failed.length, - skipped: result.skipped.length, - }) - : t("canvas.workspace.group.workflowDone", { count: steps.length }), - ); }; + + const runGroupWorkflow = async (groupId: string, cachePolicy: PipelineCachePolicy = "reuse") => + startPipeline({ kind: "group", groupId }, cachePolicy); + + const runFromNodePipeline = async (itemId: string, groupId?: string) => + startPipeline({ kind: "from_node", itemId, ...(groupId ? { groupId } : {}) }, "force_all"); + + const controlPipeline = async (executionId: string, action: PipelineControlAction): Promise => { + const projectId = historyRef.current.present.id; + if (pipelineControlLock.current.has(executionId)) return false; + pipelineControlLock.current.add(executionId); + setPipelineControlBusy(true); + try { + const client = creationClient(projectId); + const commandType = `pipeline.${action}` as const; + await client.command(commandType, { executionId }); + if (!onRunCanvas(projectId)) return false; + if (action === "pause") notify(t("canvas.workspace.pipeline.pauseRequested")); + else if (action === "resume") notify(t("canvas.workspace.pipeline.resumed")); + else if (action === "cancel") notify(t("canvas.workspace.pipeline.cancelled")); + else if (action === "retry") notify(t("canvas.workspace.pipeline.retrying")); + void observePipeline(projectId, executionId); + return true; + } catch (error) { + if (onRunCanvas(projectId)) { + notify(t("canvas.workspace.pipeline.actionFailed", { error: errorMessage(error) })); + } + return false; + } finally { + pipelineControlLock.current.delete(executionId); + if (mounted.current) setPipelineControlBusy(pipelineControlLock.current.size > 0); + } + }; + + const activePipeline = activePipelineId + ? pipelineExecutions.get(`${doc.id}/${activePipelineId}`) ?? null + : null; + const selectedGroupPipelineId = rt.single?.type === "group" + ? latestGroupPipelines.get(`${doc.id}/${rt.single.id}`) + : undefined; + const selectedGroupPipeline = selectedGroupPipelineId + ? pipelineExecutions.get(`${doc.id}/${selectedGroupPipelineId}`) ?? null + : null; + const pipelineStepByNode = new Map( + (activePipeline?.steps ?? []).map((step) => [step.itemId, step]), + ); const importActionResultFiles = async (files: File[]) => { const binding = resultBinding.current; resultBinding.current = null; @@ -913,20 +1006,12 @@ export function useWorkspaceGeneration( rt.cancelServiceRuns = cancelServiceRuns; rt.prepareGeneration = prepareGeneration; rt.runGroupWorkflow = runGroupWorkflow; + rt.runFromNodePipeline = runFromNodePipeline; + rt.controlPipeline = controlPipeline; + rt.activePipeline = activePipeline; + rt.selectedGroupPipeline = selectedGroupPipeline; + rt.pipelineStepByNode = pipelineStepByNode; + rt.pipelineControlBusy = pipelineControlBusy; rt.importActionResultFiles = importActionResultFiles; rt.cancelResultImport = cancelResultImport; } - -/** - * Group members a workflow run generates: nodes with a configured model and a - * prompt (media may instead take their prompt from connected references). - */ -function isWorkflowStep(node: CanvasNode, hasMediaInstruction: boolean): boolean { - const prompt = Boolean( - node.data.prompt?.trim() || node.data.promptContent?.length, - ); - if (node.type === "text") - return Boolean(node.data.agentSettings?.modelConfigId && prompt); - if (!["image", "video", "audio"].includes(node.type)) return false; - return Boolean(node.data.settings?.modelConfigId && (prompt || hasMediaInstruction)); -} diff --git a/src/canvas/workspace/useWorkspaceInteraction.tsx b/src/canvas/workspace/useWorkspaceInteraction.tsx index 9edfc6de5..6aac3d2c3 100644 --- a/src/canvas/workspace/useWorkspaceInteraction.tsx +++ b/src/canvas/workspace/useWorkspaceInteraction.tsx @@ -571,6 +571,7 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime, readOnly: boolean) !activeAction && single && (!["image", "video", "audio", "file"].includes(single.type) || + (single.type === "video" && rt.activePipeline) || (single.data.src && single.data.assetState !== "missing")), ); const mediaBounds = single @@ -633,7 +634,7 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime, readOnly: boolean) }; useCanvasWheelBoundary(root, selectionPresentation.userNavigation); const managedRunIds = useMemo( - () => new Set(doc.nodes.filter((node) => node.autoLayout === "run").map((node) => node.id)), + () => new Set(doc.nodes.filter((node) => node.autoLayout).map((node) => node.id)), [doc.nodes], ); const flowNodes: FlowNode[] = useMemo( @@ -1155,6 +1156,7 @@ export function useWorkspaceInteraction(rt: WorkspaceRuntime, readOnly: boolean) isLocked: (id: string) => lockedIds.has(id), getNode: (id: string) => doc.nodes.find((node) => node.id === id), generationActivity: (id: string) => generationByNode.get(id), + pipelineStep: (id: string) => rt.pipelineStepByNode?.get(id), isArriving: (id: string) => arrivingNodes.has(id), cycleStack: (id: string, delta: number) => { const node = doc.nodes.find((node) => node.id === id), diff --git a/src/contracts/creation.schema.json b/src/contracts/creation.schema.json index 58ca97adf..2d88da719 100644 --- a/src/contracts/creation.schema.json +++ b/src/contracts/creation.schema.json @@ -1540,6 +1540,7 @@ "canvas.configure": "#/$defs/CanvasConfigureCommandOperation", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommandOperation", "canvas.hide": "#/$defs/CanvasHideCommandOperation", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommandOperation", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommandOperation", "canvas.materialize": "#/$defs/CanvasMaterializeCommandOperation", "canvas.move": "#/$defs/CanvasMoveCommandOperation", @@ -1571,6 +1572,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommandOperation" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommandOperation" + }, { "$ref": "#/$defs/CanvasHideCommandOperation" }, @@ -2546,9 +2550,90 @@ "title": "CanvasItemVersion", "type": "object" }, + "CanvasLayoutPipelinesCommand": { + "additionalProperties": false, + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "canvas.layoutPipelines", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/EmptyPayload", + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "payload" + ], + "title": "CanvasLayoutPipelinesCommand", + "type": "object" + }, + "CanvasLayoutPipelinesCommandOperation": { + "additionalProperties": false, + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups.", + "properties": { + "type": { + "const": "canvas.layoutPipelines", + "description": "Operation discriminator.", + "title": "Type", + "type": "string" + }, + "payload": { + "$ref": "#/$defs/EmptyPayload", + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups." + } + }, + "required": [ + "type", + "payload" + ], + "title": "CanvasLayoutPipelinesCommandOperation", + "type": "object" + }, "CanvasLayoutRunsCommand": { "additionalProperties": false, - "description": "Arrange the current canvas Run groups and their children without moving locked groups.", + "description": "Arrange the current canvas Run groups.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -2593,7 +2678,7 @@ }, "payload": { "$ref": "#/$defs/EmptyPayload", - "description": "Arrange the current canvas Run groups and their children without moving locked groups." + "description": "Arrange the current canvas Run groups." } }, "required": [ @@ -2607,7 +2692,7 @@ }, "CanvasLayoutRunsCommandOperation": { "additionalProperties": false, - "description": "Arrange the current canvas Run groups and their children without moving locked groups.", + "description": "Arrange the current canvas Run groups.", "properties": { "type": { "const": "canvas.layoutRuns", @@ -2617,7 +2702,7 @@ }, "payload": { "$ref": "#/$defs/EmptyPayload", - "description": "Arrange the current canvas Run groups and their children without moving locked groups." + "description": "Arrange the current canvas Run groups." } }, "required": [ @@ -2967,6 +3052,7 @@ { "enum": [ "run", + "pipeline", "free" ], "type": "string" @@ -2976,7 +3062,7 @@ } ], "default": null, - "description": "Enable Run layout for a top-level group, or use free to return it to manual layout.", + "description": "Enable Pipeline layout for a top-level group, or use free to return it to manual layout.", "title": "Autolayout" } }, @@ -3829,6 +3915,20 @@ "default": null, "description": "Latest committed project event cursor.", "title": "Eventcursor" + }, + "pipelineExecutionId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Durable execution created or updated by a Pipeline command.", + "title": "Pipelineexecutionid" } }, "required": [ @@ -3840,6 +3940,178 @@ "title": "CommandReceipt", "type": "object" }, + "CompiledPipelineGraph": { + "additionalProperties": false, + "properties": { + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "scope": { + "description": "Requested execution scope.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/GroupPipelineScope" + }, + { + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" + } + ], + "title": "Scope" + }, + "cachePolicy": { + "description": "Cache reuse policy applied during compilation.", + "enum": [ + "reuse", + "force_from_node", + "force_all" + ], + "title": "Cachepolicy", + "type": "string" + }, + "steps": { + "default": [], + "description": "Compiled pipeline steps in topological order.", + "items": { + "$ref": "#/$defs/CompiledPipelineStep" + }, + "title": "Steps", + "type": "array" + }, + "topologicalOrder": { + "default": [], + "description": "Deterministic topological execution order of step item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Topologicalorder", + "type": "array" + }, + "issues": { + "default": [], + "description": "Pre-flight validation or cycle issues.", + "items": { + "$ref": "#/$defs/PipelineStepIssue" + }, + "title": "Issues", + "type": "array" + }, + "plannedNewJobs": { + "default": 0, + "description": "Number of non-cached steps that will submit new jobs.", + "minimum": 0, + "title": "Plannednewjobs", + "type": "integer" + } + }, + "required": [ + "projectId", + "scope", + "cachePolicy" + ], + "title": "CompiledPipelineGraph", + "type": "object" + }, + "CompiledPipelineStep": { + "additionalProperties": false, + "properties": { + "itemId": { + "description": "Canvas item ID for this execution step.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "kind": { + "description": "Execution step category.", + "enum": [ + "generation", + "assembly" + ], + "title": "Kind", + "type": "string" + }, + "upstreamItemIds": { + "default": [], + "description": "Direct upstream step item IDs in this pipeline.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Upstreamitemids", + "type": "array" + }, + "inputFingerprint": { + "description": "Deterministic fingerprint of this step inputs and upstream chain.", + "pattern": "^[0-9a-f]{64}$", + "title": "Inputfingerprint", + "type": "string" + }, + "cached": { + "default": false, + "description": "Whether an existing adopted result satisfies this step without re-running.", + "title": "Cached", + "type": "boolean" + }, + "cacheCandidateJobId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Existing succeeded job ID reused when cached is true.", + "title": "Cachecandidatejobid" + }, + "cacheCandidateAssetId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Existing adopted asset ID reused when cached is true.", + "title": "Cachecandidateassetid" + }, + "expectedVersions": { + "default": [], + "description": "Optimistic concurrency versions captured at compile time.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + } + }, + "required": [ + "itemId", + "kind", + "inputFingerprint" + ], + "title": "CompiledPipelineStep", + "type": "object" + }, "ContainerBinding": { "additionalProperties": false, "properties": { @@ -4199,6 +4471,7 @@ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand", "canvas.hide": "#/$defs/CanvasHideCommand", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommand", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommand", "canvas.materialize": "#/$defs/CanvasMaterializeCommand", "canvas.move": "#/$defs/CanvasMoveCommand", @@ -4220,6 +4493,12 @@ "job.cancel": "#/$defs/JobCancelCommand", "job.checkpoint": "#/$defs/JobCheckpointCommand", "job.recover": "#/$defs/JobRecoverCommand", + "pipeline.adopt": "#/$defs/PipelineAdoptCommand", + "pipeline.cancel": "#/$defs/PipelineCancelCommand", + "pipeline.pause": "#/$defs/PipelinePauseCommand", + "pipeline.resume": "#/$defs/PipelineResumeCommand", + "pipeline.retry": "#/$defs/PipelineRetryCommand", + "pipeline.start": "#/$defs/PipelineStartCommand", "project.create": "#/$defs/ProjectCreateCommand", "project.rename": "#/$defs/ProjectRenameCommand", "project.restore": "#/$defs/ProjectRestoreCommand", @@ -4282,6 +4561,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommand" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommand" + }, { "$ref": "#/$defs/CanvasHideCommand" }, @@ -4297,6 +4579,24 @@ { "$ref": "#/$defs/TimelinePublishRenderCommand" }, + { + "$ref": "#/$defs/PipelineStartCommand" + }, + { + "$ref": "#/$defs/PipelinePauseCommand" + }, + { + "$ref": "#/$defs/PipelineResumeCommand" + }, + { + "$ref": "#/$defs/PipelineCancelCommand" + }, + { + "$ref": "#/$defs/PipelineRetryCommand" + }, + { + "$ref": "#/$defs/PipelineAdoptCommand" + }, { "$ref": "#/$defs/NodeVersionApplyCommand" }, @@ -4383,6 +4683,9 @@ "job.get": "#/$defs/ObjectQuery", "job.status": "#/$defs/JobStatusQuery", "object.get": "#/$defs/ObjectQuery", + "pipeline.execution.get": "#/$defs/PipelineExecutionQuery", + "pipeline.executions.list": "#/$defs/PipelineExecutionsQuery", + "pipeline.plan": "#/$defs/PipelinePlanQuery", "project.get": "#/$defs/ProjectQuery" }, "propertyName": "type" @@ -4411,6 +4714,15 @@ }, { "$ref": "#/$defs/AssetPreviewQuery" + }, + { + "$ref": "#/$defs/PipelinePlanQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionsQuery" } ], "title": "Query" @@ -5626,6 +5938,43 @@ "title": "FollowingSource", "type": "object" }, + "FromNodePipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "from_node", + "description": "Run from one node through its downstream dependents.", + "title": "Kind", + "type": "string" + }, + "itemId": { + "description": "Starting canvas item ID.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "groupId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional group boundary limiting downstream traversal.", + "title": "Groupid" + } + }, + "required": [ + "kind", + "itemId" + ], + "title": "FromNodePipelineScope", + "type": "object" + }, "GenerationBinding": { "additionalProperties": false, "description": "Displays a generation configuration and its adopted result.", @@ -6217,7 +6566,10 @@ "autoLayout": { "anyOf": [ { - "const": "run", + "enum": [ + "run", + "pipeline" + ], "type": "string" }, { @@ -6225,7 +6577,7 @@ } ], "default": null, - "description": "Set to run to opt this top-level group into shared Run layout. Put its plan, clips and timeline under this group ID.", + "description": "Opt this top-level group into automatic layout for Runs or Pipelines.", "title": "Autolayout" }, "runPlan": { @@ -6336,6 +6688,29 @@ "title": "GroupCanvasItem", "type": "object" }, + "GroupPipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "group", + "description": "Run all executable nodes inside a canvas group.", + "title": "Kind", + "type": "string" + }, + "groupId": { + "description": "Target canvas group ID.", + "format": "uuid", + "title": "Groupid", + "type": "string" + } + }, + "required": [ + "kind", + "groupId" + ], + "title": "GroupPipelineScope", + "type": "object" + }, "GroupPlanDraft": { "additionalProperties": false, "examples": [ @@ -10483,129 +10858,98 @@ "title": "PinnedReferenceSource", "type": "object" }, - "Playhead": { + "PipelineAdopt": { "additionalProperties": false, "properties": { - "editorDocumentId": { - "description": "Editable document ID.", + "executionId": { + "description": "Target Pipeline execution ID awaiting candidate adoption.", "format": "uuid", - "title": "Editordocumentid", + "title": "Executionid", "type": "string" }, - "seconds": { - "default": 0, - "description": "Playhead position in seconds.", - "minimum": 0, - "title": "Seconds", - "type": "number" + "itemId": { + "description": "Canvas item ID whose candidate is being adopted.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "jobId": { + "description": "Succeeded candidate job ID to adopt.", + "format": "uuid", + "title": "Jobid", + "type": "string" } }, "required": [ - "editorDocumentId" + "executionId", + "itemId", + "jobId" ], - "title": "Playhead", + "title": "PipelineAdopt", "type": "object" }, - "Point": { + "PipelineAdoptCommand": { "additionalProperties": false, + "description": "Adopt a candidate job for an awaiting Pipeline step and continue downstream execution.", "properties": { - "x": { - "default": 0, - "description": "Horizontal coordinate.", - "title": "X", - "type": "number" - }, - "y": { - "default": 0, - "description": "Vertical coordinate.", - "title": "Y", - "type": "number" - } - }, - "title": "Point", - "type": "object" - }, - "Project": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", + "commandId": { + "description": "Stable command ID for idempotent replay.", "format": "uuid", - "title": "Id", + "title": "Commandid", "type": "string" }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "name": { - "description": "User-visible name.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Name", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "defaultNameIndex": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Index of the automatically named initial project.", - "title": "Defaultnameindex" - } - }, - "required": [ - "id", - "name" - ], - "title": "Project", - "type": "object" - }, - "ProjectCreate": { - "additionalProperties": false, - "properties": { - "name": { - "description": "User-visible name.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Name", + "type": { + "const": "pipeline.adopt", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "defaultNameIndex": { + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { "anyOf": [ { - "exclusiveMinimum": 0, - "type": "number" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Index for an automatically named initial project.", - "title": "Defaultnameindex" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/PipelineAdopt", + "description": "Adopt a candidate job for an awaiting Pipeline step and continue downstream execution." } }, "required": [ - "name" + "commandId", + "projectId", + "type", + "payload" ], - "title": "ProjectCreate", + "title": "PipelineAdoptCommand", "type": "object" }, - "ProjectCreateCommand": { + "PipelineCancelCommand": { "additionalProperties": false, - "description": "Create a project.", + "description": "Cancel pending steps and request cancellation of running steps in a Pipeline execution.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -10620,7 +10964,7 @@ "type": "string" }, "type": { - "const": "project.create", + "const": "pipeline.cancel", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -10649,8 +10993,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ProjectCreate", - "description": "Create a project." + "$ref": "#/$defs/PipelineControl", + "description": "Cancel pending steps and request cancellation of running steps in a Pipeline execution." } }, "required": [ @@ -10659,48 +11003,33 @@ "type", "payload" ], - "title": "ProjectCreateCommand", + "title": "PipelineCancelCommand", "type": "object" }, - "ProjectEntity": { + "PipelineControl": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", + "executionId": { + "description": "Target Pipeline execution ID.", "format": "uuid", - "title": "Projectid", + "title": "Executionid", "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" } }, "required": [ - "id", - "projectId" + "executionId" ], - "title": "ProjectEntity", + "title": "PipelineControl", "type": "object" }, - "ProjectEvent": { + "PipelineExecutionQuery": { "additionalProperties": false, "properties": { - "schemaVersion": { - "const": 1, - "default": 1, - "description": "Record schema version.", - "title": "Schemaversion", - "type": "integer" + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", + "type": "string" }, "projectId": { "description": "Owning project ID.", @@ -10708,66 +11037,29 @@ "title": "Projectid", "type": "string" }, - "cursor": { - "description": "Monotonically increasing project event cursor.", - "minimum": 1, - "title": "Cursor", - "type": "integer" - }, - "commandId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Stable command ID for idempotent replay.", - "title": "Commandid" - }, - "source": { - "description": "Input source or recorded provenance.", - "enum": [ - "ui", - "agent", - "background", - "external" - ], - "title": "Source", + "type": { + "const": "pipeline.execution.get", + "description": "Read a durable Pipeline execution.", + "title": "Type", "type": "string" }, - "changed": { - "default": [], - "description": "Business objects changed by the operation.", - "items": { - "$ref": "#/$defs/ChangedObject" - }, - "title": "Changed", - "type": "array" - }, - "jobIds": { - "default": [], - "description": "Generation jobs associated with this operation.", - "items": { - "format": "uuid", - "type": "string" - }, - "title": "Jobids", - "type": "array" + "objectId": { + "description": "Pipeline execution ID returned by pipeline.start.", + "format": "uuid", + "title": "Objectid", + "type": "string" } }, "required": [ + "queryId", "projectId", - "cursor", - "source" + "type", + "objectId" ], - "title": "ProjectEvent", + "title": "PipelineExecutionQuery", "type": "object" }, - "ProjectQuery": { + "PipelineExecutionsQuery": { "additionalProperties": false, "properties": { "queryId": { @@ -10783,10 +11075,24 @@ "type": "string" }, "type": { - "const": "project.get", - "description": "Read the current project.", + "const": "pipeline.executions.list", + "description": "List Pipeline execution history for the project or one group.", "title": "Type", "type": "string" + }, + "groupId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional canvas group ID filter.", + "title": "Groupid" } }, "required": [ @@ -10794,30 +11100,12 @@ "projectId", "type" ], - "title": "ProjectQuery", + "title": "PipelineExecutionsQuery", "type": "object" }, - "ProjectRename": { + "PipelinePauseCommand": { "additionalProperties": false, - "properties": { - "name": { - "description": "User-visible name.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Name", - "type": "string" - } - }, - "required": [ - "name" - ], - "title": "ProjectRename", - "type": "object" - }, - "ProjectRenameCommand": { - "additionalProperties": false, - "description": "Rename the project.", + "description": "Pause an active Pipeline execution after its in-flight steps finish.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -10832,7 +11120,7 @@ "type": "string" }, "type": { - "const": "project.rename", + "const": "pipeline.pause", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -10861,8 +11149,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ProjectRename", - "description": "Rename the project." + "$ref": "#/$defs/PipelineControl", + "description": "Pause an active Pipeline execution after its in-flight steps finish." } }, "required": [ @@ -10871,17 +11159,16 @@ "type", "payload" ], - "title": "ProjectRenameCommand", + "title": "PipelinePauseCommand", "type": "object" }, - "ProjectRestoreCommand": { + "PipelinePlanQuery": { "additionalProperties": false, - "description": "Restore a trashed project.", "properties": { - "commandId": { - "description": "Stable command ID for idempotent replay.", + "queryId": { + "description": "Caller-supplied query ID.", "format": "uuid", - "title": "Commandid", + "title": "Queryid", "type": "string" }, "projectId": { @@ -10891,24 +11178,49 @@ "type": "string" }, "type": { - "const": "project.restore", - "description": "Command discriminator.", + "const": "pipeline.plan", + "description": "Compile a Pipeline DAG read-only and preview cache hits, dependencies, and issues.", "title": "Type", "type": "string" }, - "expectedVersions": { - "default": [], - "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", - "items": { - "$ref": "#/$defs/ObjectVersion" + "scope": { + "description": "Target canvas scope to compile.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" }, - "title": "Expectedversions", - "type": "array" + "oneOf": [ + { + "$ref": "#/$defs/GroupPipelineScope" + }, + { + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" + } + ], + "title": "Scope" }, - "expectedPreview": { + "cachePolicy": { + "default": "reuse", + "description": "Cache reuse strategy to preview.", + "enum": [ + "reuse", + "force_from_node", + "force_all" + ], + "title": "Cachepolicy", + "type": "string" + }, + "forceFromItemId": { "anyOf": [ { - "pattern": "^[0-9a-f]{64}$", + "format": "uuid", "type": "string" }, { @@ -10916,256 +11228,22 @@ } ], "default": null, - "description": "Fingerprint of the confirmed impact preview.", - "title": "Expectedpreview" - }, - "payload": { - "$ref": "#/$defs/EmptyPayload", - "description": "Restore a trashed project." + "description": "Optional step ID from which to force re-execution when cachePolicy is force_from_node.", + "title": "Forcefromitemid" } }, "required": [ - "commandId", + "queryId", "projectId", "type", - "payload" - ], - "title": "ProjectRestoreCommand", - "type": "object" - }, - "ProjectSnapshot": { - "additionalProperties": false, - "properties": { - "format": { - "const": "opendirector-project", - "default": "opendirector-project", - "description": "Serialized format identifier.", - "title": "Format", - "type": "string" - }, - "formatVersion": { - "const": 2, - "default": 2, - "description": "Project format version.", - "title": "Formatversion", - "type": "integer" - }, - "project": { - "$ref": "#/$defs/Project", - "description": "Project identity and current revision." - }, - "assets": { - "default": [], - "description": "Registered immutable assets.", - "items": { - "$ref": "#/$defs/Asset" - }, - "title": "Assets", - "type": "array" - }, - "generationSpecs": { - "default": [], - "description": "Editable generation configurations.", - "items": { - "discriminator": { - "mapping": { - "audio": "#/$defs/AudioGenerationSpec", - "image": "#/$defs/ImageGenerationSpec", - "text": "#/$defs/TextGenerationSpec", - "video": "#/$defs/VideoGenerationSpec" - }, - "propertyName": "kind" - }, - "oneOf": [ - { - "$ref": "#/$defs/TextGenerationSpec" - }, - { - "$ref": "#/$defs/ImageGenerationSpec" - }, - { - "$ref": "#/$defs/VideoGenerationSpec" - }, - { - "$ref": "#/$defs/AudioGenerationSpec" - } - ] - }, - "title": "Generationspecs", - "type": "array" - }, - "references": { - "default": [], - "description": "Ordered generation reference bindings.", - "items": { - "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.", - "discriminator": { - "mapping": { - "follow_current": "#/$defs/FollowingReference", - "pinned": "#/$defs/PinnedReference" - }, - "propertyName": "binding" - }, - "oneOf": [ - { - "$ref": "#/$defs/PinnedReference" - }, - { - "$ref": "#/$defs/FollowingReference" - } - ] - }, - "title": "References", - "type": "array" - }, - "canvasItems": { - "default": [], - "description": "Canvas display items, including hidden items.", - "items": { - "discriminator": { - "mapping": { - "audio": "#/$defs/AudioCanvasItem", - "external": "#/$defs/DirectorCanvasItem", - "file": "#/$defs/FileCanvasItem", - "group": "#/$defs/GroupCanvasItem", - "image": "#/$defs/ImageCanvasItem", - "stack": "#/$defs/StackCanvasItem", - "subject": "#/$defs/SubjectCanvasItem", - "text": "#/$defs/TextCanvasItem", - "timeline": "#/$defs/TimelineCanvasItem", - "tool": "#/$defs/ToolCanvasItem", - "video": "#/$defs/VideoCanvasItem" - }, - "propertyName": "kind" - }, - "oneOf": [ - { - "$ref": "#/$defs/TextCanvasItem" - }, - { - "$ref": "#/$defs/ImageCanvasItem" - }, - { - "$ref": "#/$defs/VideoCanvasItem" - }, - { - "$ref": "#/$defs/AudioCanvasItem" - }, - { - "$ref": "#/$defs/FileCanvasItem" - }, - { - "$ref": "#/$defs/SubjectCanvasItem" - }, - { - "$ref": "#/$defs/TimelineCanvasItem" - }, - { - "$ref": "#/$defs/StackCanvasItem" - }, - { - "$ref": "#/$defs/ToolCanvasItem" - }, - { - "$ref": "#/$defs/DirectorCanvasItem" - }, - { - "$ref": "#/$defs/GroupCanvasItem" - } - ] - }, - "title": "Canvasitems", - "type": "array" - }, - "editorDocuments": { - "default": [], - "description": "Persisted editable documents.", - "items": { - "discriminator": { - "mapping": { - "director": "#/$defs/DirectorDocument", - "image_crop": "#/$defs/ImageCropDocument", - "layers": "#/$defs/LayerDocument", - "media_edit": "#/$defs/MediaEditDocument", - "stack": "#/$defs/StackDocument", - "subject": "#/$defs/SubjectDocument", - "timeline": "#/$defs/TimelineDocument", - "tool": "#/$defs/ToolDocument" - }, - "propertyName": "kind" - }, - "oneOf": [ - { - "$ref": "#/$defs/TimelineDocument" - }, - { - "$ref": "#/$defs/SubjectDocument" - }, - { - "$ref": "#/$defs/LayerDocument" - }, - { - "$ref": "#/$defs/ImageCropDocument" - }, - { - "$ref": "#/$defs/StackDocument" - }, - { - "$ref": "#/$defs/ToolDocument" - }, - { - "$ref": "#/$defs/DirectorDocument" - }, - { - "$ref": "#/$defs/MediaEditDocument" - } - ] - }, - "title": "Editordocuments", - "type": "array" - }, - "jobs": { - "default": [], - "description": "Immutable generation execution records.", - "items": { - "$ref": "#/$defs/Job" - }, - "title": "Jobs", - "type": "array" - }, - "results": { - "default": [], - "description": "Generated result candidates and adoption history.", - "items": { - "$ref": "#/$defs/ResultVersion" - }, - "title": "Results", - "type": "array" - }, - "eventCursor": { - "default": 0, - "description": "Latest committed project event cursor.", - "minimum": 0, - "title": "Eventcursor", - "type": "integer" - }, - "undoClearedThrough": { - "default": 0, - "description": "Event cursor through which undo history was cleared.", - "minimum": 0, - "title": "Undoclearedthrough", - "type": "integer" - } - }, - "required": [ - "project" + "scope" ], - "title": "ProjectSnapshot", + "title": "PipelinePlanQuery", "type": "object" }, - "ProjectTrashCommand": { + "PipelineResumeCommand": { "additionalProperties": false, - "description": "Move the project to trash.", + "description": "Resume a paused Pipeline execution.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -11180,7 +11258,7 @@ "type": "string" }, "type": { - "const": "project.trash", + "const": "pipeline.resume", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -11209,8 +11287,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/EmptyPayload", - "description": "Move the project to trash." + "$ref": "#/$defs/PipelineControl", + "description": "Resume a paused Pipeline execution." } }, "required": [ @@ -11219,120 +11297,42 @@ "type", "payload" ], - "title": "ProjectTrashCommand", - "type": "object" - }, - "PromptReference": { - "additionalProperties": false, - "properties": { - "type": { - "const": "reference", - "description": "Operation or variant discriminator.", - "title": "Type", - "type": "string" - }, - "referenceId": { - "description": "Generation reference ID.", - "format": "uuid", - "title": "Referenceid", - "type": "string" - } - }, - "required": [ - "type", - "referenceId" - ], - "title": "PromptReference", - "type": "object" - }, - "PromptText": { - "additionalProperties": false, - "properties": { - "type": { - "const": "text", - "description": "Operation or variant discriminator.", - "title": "Type", - "type": "string" - }, - "text": { - "description": "UTF-8 text content or search query.", - "maxLength": 20000, - "title": "Text", - "type": "string" - } - }, - "required": [ - "type", - "text" - ], - "title": "PromptText", + "title": "PipelineResumeCommand", "type": "object" }, - "QueryBase": { + "PipelineRetry": { "additionalProperties": false, "properties": { - "queryId": { - "description": "Caller-supplied query ID.", + "executionId": { + "description": "Target settled Pipeline execution ID to retry.", "format": "uuid", - "title": "Queryid", + "title": "Executionid", "type": "string" }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - } - }, - "required": [ - "queryId", - "projectId" - ], - "title": "QueryBase", - "type": "object" - }, - "RectangleLayerContent": { - "additionalProperties": false, - "properties": { - "width": { - "description": "Width in pixels.", - "maximum": 8192, - "minimum": 1, - "title": "Width", - "type": "integer" + "stopOnFailure": { + "default": false, + "description": "Whether to cancel remaining pending steps after the first failure.", + "title": "Stoponfailure", + "type": "boolean" }, - "height": { - "description": "Height in pixels.", - "maximum": 8192, + "maxConcurrency": { + "default": 4, + "description": "Maximum number of independent pipeline steps executed concurrently.", + "maximum": 16, "minimum": 1, - "title": "Height", + "title": "Maxconcurrency", "type": "integer" - }, - "kind": { - "const": "rectangle", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" - }, - "color": { - "description": "Serialized display color.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", - "type": "string" } }, "required": [ - "width", - "height", - "kind", - "color" + "executionId" ], - "title": "RectangleLayerContent", + "title": "PipelineRetry", "type": "object" }, - "ReferenceAddCommand": { + "PipelineRetryCommand": { "additionalProperties": false, - "description": "Add a generation reference; expectedVersions must include its target generation_spec.", + "description": "Retry failed or skipped steps of a settled Pipeline execution while reusing succeeded steps.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -11347,7 +11347,7 @@ "type": "string" }, "type": { - "const": "reference.add", + "const": "pipeline.retry", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -11376,8 +11376,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Add a generation reference; expectedVersions must include its target generation_spec." + "$ref": "#/$defs/PipelineRetry", + "description": "Retry failed or skipped steps of a settled Pipeline execution while reusing succeeded steps." } }, "required": [ @@ -11386,113 +11386,84 @@ "type", "payload" ], - "title": "ReferenceAddCommand", - "type": "object" - }, - "ReferenceAddCommandOperation": { - "additionalProperties": false, - "description": "Add a generation reference; expectedVersions must include its target generation_spec.", - "properties": { - "type": { - "const": "reference.add", - "description": "Operation discriminator.", - "title": "Type", - "type": "string" - }, - "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Add a generation reference; expectedVersions must include its target generation_spec." - } - }, - "required": [ - "type", - "payload" - ], - "title": "ReferenceAddCommandOperation", + "title": "PipelineRetryCommand", "type": "object" }, - "ReferenceBase": { + "PipelineStart": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "targetSpecId": { - "description": "Target generation configuration ID.", - "format": "uuid", - "title": "Targetspecid", - "type": "string" + "scope": { + "description": "Target canvas scope to compile and execute.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/GroupPipelineScope" + }, + { + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" + } + ], + "title": "Scope" }, - "role": { - "default": "reference", - "description": "Business role of this binding or reference.", + "cachePolicy": { + "default": "reuse", + "description": "Cache reuse strategy for unchanged nodes.", "enum": [ - "reference", - "first_frame", - "last_frame", - "continuation", - "control" + "reuse", + "force_from_node", + "force_all" ], - "title": "Role", + "title": "Cachepolicy", "type": "string" }, - "order": { - "default": 0, - "description": "Reference ordering within the target configuration.", - "minimum": 0, - "title": "Order", - "type": "integer" + "forceFromItemId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional step ID from which to force re-execution when cachePolicy is force_from_node.", + "title": "Forcefromitemid" }, - "active": { - "default": true, - "description": "Whether this reference participates in generation.", - "title": "Active", + "stopOnFailure": { + "default": false, + "description": "Whether to cancel remaining pending steps after the first failure.", + "title": "Stoponfailure", "type": "boolean" + }, + "maxConcurrency": { + "default": 4, + "description": "Maximum number of independent pipeline steps executed concurrently.", + "maximum": 16, + "minimum": 1, + "title": "Maxconcurrency", + "type": "integer" } }, "required": [ - "id", - "projectId", - "targetSpecId" - ], - "title": "ReferenceBase", - "type": "object" - }, - "ReferenceRemove": { - "additionalProperties": false, - "properties": { - "referenceId": { - "description": "Generation reference ID.", - "format": "uuid", - "title": "Referenceid", - "type": "string" - } - }, - "required": [ - "referenceId" + "scope" ], - "title": "ReferenceRemove", + "title": "PipelineStart", "type": "object" }, - "ReferenceRemoveCommand": { + "PipelineStartCommand": { "additionalProperties": false, - "description": "Deactivate a generation reference.", + "description": "Compile and start a durable concurrent Pipeline execution in the background.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -11507,7 +11478,7 @@ "type": "string" }, "type": { - "const": "reference.remove", + "const": "pipeline.start", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -11536,8 +11507,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ReferenceRemove", - "description": "Deactivate a generation reference." + "$ref": "#/$defs/PipelineStart", + "description": "Compile and start a durable concurrent Pipeline execution in the background." } }, "required": [ @@ -11546,115 +11517,171 @@ "type", "payload" ], - "title": "ReferenceRemoveCommand", + "title": "PipelineStartCommand", "type": "object" }, - "ReferenceRemoveCommandOperation": { + "PipelineStepIssue": { "additionalProperties": false, - "description": "Deactivate a generation reference.", "properties": { - "type": { - "const": "reference.remove", - "description": "Operation discriminator.", - "title": "Type", + "code": { + "description": "Stable machine-readable issue code.", + "maxLength": 100, + "minLength": 1, + "title": "Code", "type": "string" }, - "payload": { - "$ref": "#/$defs/ReferenceRemove", - "description": "Deactivate a generation reference." + "message": { + "description": "Human-readable issue summary.", + "maxLength": 1000, + "minLength": 1, + "title": "Message", + "type": "string" + }, + "itemId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Canvas item associated with this issue, if applicable.", + "title": "Itemid" } }, "required": [ - "type", - "payload" + "code", + "message" ], - "title": "ReferenceRemoveCommandOperation", + "title": "PipelineStepIssue", "type": "object" }, - "ReferenceRestoreCommand": { + "Playhead": { "additionalProperties": false, - "description": "Restore a generation reference.", "properties": { - "commandId": { - "description": "Stable command ID for idempotent replay.", + "editorDocumentId": { + "description": "Editable document ID.", "format": "uuid", - "title": "Commandid", + "title": "Editordocumentid", "type": "string" }, - "projectId": { - "description": "Owning project ID.", + "seconds": { + "default": 0, + "description": "Playhead position in seconds.", + "minimum": 0, + "title": "Seconds", + "type": "number" + } + }, + "required": [ + "editorDocumentId" + ], + "title": "Playhead", + "type": "object" + }, + "Point": { + "additionalProperties": false, + "properties": { + "x": { + "default": 0, + "description": "Horizontal coordinate.", + "title": "X", + "type": "number" + }, + "y": { + "default": 0, + "description": "Vertical coordinate.", + "title": "Y", + "type": "number" + } + }, + "title": "Point", + "type": "object" + }, + "Project": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable object ID.", "format": "uuid", - "title": "Projectid", + "title": "Id", "type": "string" }, - "type": { - "const": "reference.restore", - "description": "Command discriminator.", - "title": "Type", - "type": "string" + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" }, - "expectedVersions": { - "default": [], - "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", - "items": { - "$ref": "#/$defs/ObjectVersion" - }, - "title": "Expectedversions", - "type": "array" + "name": { + "description": "User-visible name.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Name", + "type": "string" }, - "expectedPreview": { + "defaultNameIndex": { "anyOf": [ { - "pattern": "^[0-9a-f]{64}$", - "type": "string" + "minimum": 1, + "type": "integer" }, { "type": "null" } ], "default": null, - "description": "Fingerprint of the confirmed impact preview.", - "title": "Expectedpreview" - }, - "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Restore a generation reference." + "description": "Index of the automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ - "commandId", - "projectId", - "type", - "payload" + "id", + "name" ], - "title": "ReferenceRestoreCommand", + "title": "Project", "type": "object" }, - "ReferenceRestoreCommandOperation": { + "ProjectCreate": { "additionalProperties": false, - "description": "Restore a generation reference.", "properties": { - "type": { - "const": "reference.restore", - "description": "Operation discriminator.", - "title": "Type", + "name": { + "description": "User-visible name.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Name", "type": "string" }, - "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Restore a generation reference." + "defaultNameIndex": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index for an automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ - "type", - "payload" + "name" ], - "title": "ReferenceRestoreCommandOperation", + "title": "ProjectCreate", "type": "object" }, - "ReferenceUpdateCommand": { + "ProjectCreateCommand": { "additionalProperties": false, - "description": "Update a generation reference.", + "description": "Create a project.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -11669,7 +11696,7 @@ "type": "string" }, "type": { - "const": "reference.update", + "const": "project.create", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -11698,8 +11725,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Update a generation reference." + "$ref": "#/$defs/ProjectCreate", + "description": "Create a project." } }, "required": [ @@ -11708,121 +11735,65 @@ "type", "payload" ], - "title": "ReferenceUpdateCommand", + "title": "ProjectCreateCommand", "type": "object" }, - "ReferenceUpdateCommandOperation": { + "ProjectEntity": { "additionalProperties": false, - "description": "Update a generation reference.", "properties": { - "type": { - "const": "reference.update", - "description": "Operation discriminator.", - "title": "Type", + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", "type": "string" }, - "payload": { - "$ref": "#/$defs/ReferenceWrite", - "description": "Update a generation reference." - } - }, - "required": [ - "type", - "payload" - ], - "title": "ReferenceUpdateCommandOperation", - "type": "object" - }, - "ReferenceWrite": { - "additionalProperties": false, - "properties": { - "reference": { - "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.", - "discriminator": { - "mapping": { - "follow_current": "#/$defs/FollowingReference", - "pinned": "#/$defs/PinnedReference" - }, - "propertyName": "binding" - }, - "oneOf": [ - { - "$ref": "#/$defs/PinnedReference" - }, - { - "$ref": "#/$defs/FollowingReference" - } - ], - "title": "Reference" + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" } }, "required": [ - "reference" + "id", + "projectId" ], - "title": "ReferenceWrite", + "title": "ProjectEntity", "type": "object" }, - "ResolvedReference": { + "ProjectEvent": { "additionalProperties": false, "properties": { - "referenceId": { - "description": "Generation reference ID.", - "format": "uuid", - "title": "Referenceid", - "type": "string" + "schemaVersion": { + "const": 1, + "default": 1, + "description": "Record schema version.", + "title": "Schemaversion", + "type": "integer" }, - "role": { - "description": "Business role of this binding or reference.", - "enum": [ - "reference", - "first_frame", - "last_frame", - "continuation", - "control" - ], - "title": "Role", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." - }, - "metadata": { - "$ref": "#/$defs/MediaMetadata", - "description": "Verified media properties." - }, - "sourceVersion": { - "anyOf": [ - { - "$ref": "#/$defs/ObjectVersion" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Captured source object version." - }, - "documentVersion": { - "anyOf": [ - { - "$ref": "#/$defs/ObjectVersion" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Version of the source editable document." + "cursor": { + "description": "Monotonically increasing project event cursor.", + "minimum": 1, + "title": "Cursor", + "type": "integer" }, - "subjectRole": { + "commandId": { "anyOf": [ { - "enum": [ - "main", - "auxiliary", - "voice" - ], + "format": "uuid", "type": "string" }, { @@ -11830,108 +11801,99 @@ } ], "default": null, - "description": "Subject media slot used by this reference.", - "title": "Subjectrole" - }, - "name": { - "default": "", - "description": "User-visible name.", - "maxLength": 255, - "title": "Name", - "type": "string" - }, - "sourceTitle": { - "default": "", - "description": "Source canvas title captured for this reference.", - "maxLength": 255, - "title": "Sourcetitle", - "type": "string" + "description": "Stable command ID for idempotent replay.", + "title": "Commandid" }, - "transmission": { - "default": "content", - "description": "How reference content is sent to the provider.", + "source": { + "description": "Input source or recorded provenance.", "enum": [ - "content", - "metadata", - "context_only", - "latent" + "ui", + "agent", + "background", + "external" ], - "title": "Transmission", + "title": "Source", "type": "string" + }, + "changed": { + "default": [], + "description": "Business objects changed by the operation.", + "items": { + "$ref": "#/$defs/ChangedObject" + }, + "title": "Changed", + "type": "array" + }, + "jobIds": { + "default": [], + "description": "Generation jobs associated with this operation.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Jobids", + "type": "array" } }, "required": [ - "referenceId", - "role", - "asset", - "metadata" + "projectId", + "cursor", + "source" ], - "title": "ResolvedReference", + "title": "ProjectEvent", "type": "object" }, - "ResultCheck": { + "ProjectQuery": { "additionalProperties": false, "properties": { - "status": { - "description": "Current operation lifecycle state.", - "enum": [ - "passed", - "failed" - ], - "title": "Status", + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", "type": "string" }, - "facts": { - "additionalProperties": true, - "description": "Observed technical validation facts.", - "title": "Facts", - "type": "object" - }, - "message": { - "description": "Human-readable issue description.", - "title": "Message", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "humanReviewRequired": { - "default": true, - "description": "Whether creative quality still requires human review.", - "title": "Humanreviewrequired", - "type": "boolean" + "type": { + "const": "project.get", + "description": "Read the current project.", + "title": "Type", + "type": "string" } }, "required": [ - "status", - "message" + "queryId", + "projectId", + "type" ], - "title": "ResultCheck", + "title": "ProjectQuery", "type": "object" }, - "ResultSelect": { + "ProjectRename": { "additionalProperties": false, "properties": { - "specId": { - "description": "Generation configuration ID.", - "format": "uuid", - "title": "Specid", - "type": "string" - }, - "resultId": { - "description": "Generation result ID.", - "format": "uuid", - "title": "Resultid", + "name": { + "description": "User-visible name.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Name", "type": "string" } }, "required": [ - "specId", - "resultId" + "name" ], - "title": "ResultSelect", + "title": "ProjectRename", "type": "object" }, - "ResultSelectCommand": { + "ProjectRenameCommand": { "additionalProperties": false, - "description": "Adopt an existing generation result.", + "description": "Rename the project.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -11946,7 +11908,7 @@ "type": "string" }, "type": { - "const": "result.select", + "const": "project.rename", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -11975,8 +11937,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/ResultSelect", - "description": "Adopt an existing generation result." + "$ref": "#/$defs/ProjectRename", + "description": "Rename the project." } }, "required": [ @@ -11985,333 +11947,301 @@ "type", "payload" ], - "title": "ResultSelectCommand", + "title": "ProjectRenameCommand", "type": "object" }, - "ResultSelectCommandOperation": { + "ProjectRestoreCommand": { "additionalProperties": false, - "description": "Adopt an existing generation result.", + "description": "Restore a trashed project.", "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, "type": { - "const": "result.select", - "description": "Operation discriminator.", + "const": "project.restore", + "description": "Command discriminator.", "title": "Type", "type": "string" }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, "payload": { - "$ref": "#/$defs/ResultSelect", - "description": "Adopt an existing generation result." + "$ref": "#/$defs/EmptyPayload", + "description": "Restore a trashed project." } }, "required": [ + "commandId", + "projectId", "type", "payload" ], - "title": "ResultSelectCommandOperation", + "title": "ProjectRestoreCommand", "type": "object" }, - "ResultVersion": { + "ProjectSnapshot": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", + "format": { + "const": "opendirector-project", + "default": "opendirector-project", + "description": "Serialized format identifier.", + "title": "Format", "type": "string" }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", + "formatVersion": { + "const": 2, + "default": 2, + "description": "Project format version.", + "title": "Formatversion", "type": "integer" }, - "specId": { - "description": "Generation configuration ID.", - "format": "uuid", - "title": "Specid", - "type": "string" - }, - "jobId": { - "description": "Generation job ID.", - "format": "uuid", - "title": "Jobid", - "type": "string" - }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." - }, - "inputFingerprint": { - "description": "Fingerprint of the fixed execution input.", - "pattern": "^[0-9a-f]{64}$", - "title": "Inputfingerprint", - "type": "string" - } - }, - "required": [ - "id", - "projectId", - "specId", - "jobId", - "asset", - "inputFingerprint" - ], - "title": "ResultVersion", - "type": "object" - }, - "SegmentRunAnchor": { - "additionalProperties": false, - "properties": { - "kind": { - "const": "anchor", - "description": "One independent generation anchor in the declared source shot.", - "title": "Kind", - "type": "string" - } - }, - "required": [ - "kind" - ], - "title": "SegmentRunAnchor", - "type": "object" - }, - "SegmentRunContinuation": { - "additionalProperties": false, - "properties": { - "kind": { - "const": "continuation", - "description": "Generation requires the selected upstream result as a guide.", - "title": "Kind", - "type": "string" + "project": { + "$ref": "#/$defs/Project", + "description": "Project identity and current revision." }, - "upstreamItemId": { - "description": "Generation node providing the raw guide frames.", - "format": "uuid", - "title": "Upstreamitemid", - "type": "string" + "assets": { + "default": [], + "description": "Registered immutable assets.", + "items": { + "$ref": "#/$defs/Asset" + }, + "title": "Assets", + "type": "array" }, - "sourceFrames": { - "description": "Two distinct indices into the raw upstream result for destination frames 0 and 21, in that order.", - "maxItems": 2, - "minItems": 2, - "prefixItems": [ - { - "maximum": 359, - "minimum": 0, - "type": "integer" + "generationSpecs": { + "default": [], + "description": "Editable generation configurations.", + "items": { + "discriminator": { + "mapping": { + "audio": "#/$defs/AudioGenerationSpec", + "image": "#/$defs/ImageGenerationSpec", + "text": "#/$defs/TextGenerationSpec", + "video": "#/$defs/VideoGenerationSpec" + }, + "propertyName": "kind" }, - { - "maximum": 359, - "minimum": 0, - "type": "integer" - } - ], - "title": "Sourceframes", + "oneOf": [ + { + "$ref": "#/$defs/TextGenerationSpec" + }, + { + "$ref": "#/$defs/ImageGenerationSpec" + }, + { + "$ref": "#/$defs/VideoGenerationSpec" + }, + { + "$ref": "#/$defs/AudioGenerationSpec" + } + ] + }, + "title": "Generationspecs", "type": "array" - } - }, - "required": [ - "kind", - "upstreamItemId", - "sourceFrames" - ], - "title": "SegmentRunContinuation", - "type": "object" - }, - "SegmentRunGenerated": { - "additionalProperties": false, - "properties": { - "sourceStart": { - "description": "First covered frame in the normalized working source.", - "minimum": 0, - "title": "Sourcestart", - "type": "integer" - }, - "sourceEnd": { - "description": "Exclusive end of the covered interval in the normalized working source.", - "minimum": 1, - "title": "Sourceend", - "type": "integer" - }, - "kind": { - "const": "generated", - "description": "Use the retained result from a generation step.", - "title": "Kind", - "type": "string" - }, - "itemId": { - "description": "Generation canvas node that provides the result.", - "format": "uuid", - "title": "Itemid", - "type": "string" - }, - "shot": { - "description": "Identity of the inspected continuous shot used to determine guide dependencies.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Shot", - "type": "string" }, - "step": { - "description": "Independent anchor or guided continuation in this shot.", - "discriminator": { - "mapping": { - "anchor": "#/$defs/SegmentRunAnchor", - "continuation": "#/$defs/SegmentRunContinuation" + "references": { + "default": [], + "description": "Ordered generation reference bindings.", + "items": { + "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.", + "discriminator": { + "mapping": { + "follow_current": "#/$defs/FollowingReference", + "pinned": "#/$defs/PinnedReference" + }, + "propertyName": "binding" }, - "propertyName": "kind" + "oneOf": [ + { + "$ref": "#/$defs/PinnedReference" + }, + { + "$ref": "#/$defs/FollowingReference" + } + ] }, - "oneOf": [ - { - "$ref": "#/$defs/SegmentRunAnchor" - }, - { - "$ref": "#/$defs/SegmentRunContinuation" - } - ], - "title": "Step" - } - }, - "required": [ - "sourceStart", - "sourceEnd", - "kind", - "itemId", - "shot", - "step" - ], - "title": "SegmentRunGenerated", - "type": "object" - }, - "SegmentRunPlan": { - "additionalProperties": false, - "properties": { - "source": { - "$ref": "#/$defs/AssetRef", - "description": "Exact normalized working video whose entire frame range is delivered." - }, - "fps": { - "description": "Integer frames per second of the normalized working video.", - "minimum": 1, - "title": "Fps", - "type": "integer" - }, - "frameCount": { - "description": "Decoded frame count of the normalized working video.", - "minimum": 1, - "title": "Framecount", - "type": "integer" + "title": "References", + "type": "array" }, - "entries": { - "description": "Delivery intervals in source playback order.", + "canvasItems": { + "default": [], + "description": "Canvas display items, including hidden items.", "items": { "discriminator": { "mapping": { - "generated": "#/$defs/SegmentRunGenerated", - "source": "#/$defs/SegmentRunSource" + "audio": "#/$defs/AudioCanvasItem", + "external": "#/$defs/DirectorCanvasItem", + "file": "#/$defs/FileCanvasItem", + "group": "#/$defs/GroupCanvasItem", + "image": "#/$defs/ImageCanvasItem", + "stack": "#/$defs/StackCanvasItem", + "subject": "#/$defs/SubjectCanvasItem", + "text": "#/$defs/TextCanvasItem", + "timeline": "#/$defs/TimelineCanvasItem", + "tool": "#/$defs/ToolCanvasItem", + "video": "#/$defs/VideoCanvasItem" }, "propertyName": "kind" }, "oneOf": [ { - "$ref": "#/$defs/SegmentRunSource" + "$ref": "#/$defs/TextCanvasItem" }, { - "$ref": "#/$defs/SegmentRunGenerated" + "$ref": "#/$defs/ImageCanvasItem" + }, + { + "$ref": "#/$defs/VideoCanvasItem" + }, + { + "$ref": "#/$defs/AudioCanvasItem" + }, + { + "$ref": "#/$defs/FileCanvasItem" + }, + { + "$ref": "#/$defs/SubjectCanvasItem" + }, + { + "$ref": "#/$defs/TimelineCanvasItem" + }, + { + "$ref": "#/$defs/StackCanvasItem" + }, + { + "$ref": "#/$defs/ToolCanvasItem" + }, + { + "$ref": "#/$defs/DirectorCanvasItem" + }, + { + "$ref": "#/$defs/GroupCanvasItem" } ] }, - "maxItems": 101, - "minItems": 1, - "title": "Entries", + "title": "Canvasitems", "type": "array" - } - }, - "required": [ - "source", - "fps", - "frameCount", - "entries" - ], - "title": "SegmentRunPlan", - "type": "object" - }, - "SegmentRunSource": { - "additionalProperties": false, - "properties": { - "sourceStart": { - "description": "First covered frame in the normalized working source.", - "minimum": 0, - "title": "Sourcestart", - "type": "integer" }, - "sourceEnd": { - "description": "Exclusive end of the covered interval in the normalized working source.", - "minimum": 1, - "title": "Sourceend", - "type": "integer" + "editorDocuments": { + "default": [], + "description": "Persisted editable documents.", + "items": { + "discriminator": { + "mapping": { + "director": "#/$defs/DirectorDocument", + "image_crop": "#/$defs/ImageCropDocument", + "layers": "#/$defs/LayerDocument", + "media_edit": "#/$defs/MediaEditDocument", + "stack": "#/$defs/StackDocument", + "subject": "#/$defs/SubjectDocument", + "timeline": "#/$defs/TimelineDocument", + "tool": "#/$defs/ToolDocument" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/TimelineDocument" + }, + { + "$ref": "#/$defs/SubjectDocument" + }, + { + "$ref": "#/$defs/LayerDocument" + }, + { + "$ref": "#/$defs/ImageCropDocument" + }, + { + "$ref": "#/$defs/StackDocument" + }, + { + "$ref": "#/$defs/ToolDocument" + }, + { + "$ref": "#/$defs/DirectorDocument" + }, + { + "$ref": "#/$defs/MediaEditDocument" + } + ] + }, + "title": "Editordocuments", + "type": "array" }, - "kind": { - "const": "source", - "description": "Retain these frames from the frozen working source.", - "title": "Kind", - "type": "string" - } - }, - "required": [ - "sourceStart", - "sourceEnd", - "kind" - ], - "title": "SegmentRunSource", - "type": "object" - }, - "SelectionBox": { - "additionalProperties": false, - "properties": { - "x": { - "description": "Horizontal coordinate.", - "title": "X", - "type": "number" + "jobs": { + "default": [], + "description": "Immutable generation execution records.", + "items": { + "$ref": "#/$defs/Job" + }, + "title": "Jobs", + "type": "array" }, - "y": { - "description": "Vertical coordinate.", - "title": "Y", - "type": "number" + "results": { + "default": [], + "description": "Generated result candidates and adoption history.", + "items": { + "$ref": "#/$defs/ResultVersion" + }, + "title": "Results", + "type": "array" }, - "width": { - "description": "Width in pixels.", - "exclusiveMinimum": 0, - "title": "Width", - "type": "number" + "eventCursor": { + "default": 0, + "description": "Latest committed project event cursor.", + "minimum": 0, + "title": "Eventcursor", + "type": "integer" }, - "height": { - "description": "Height in pixels.", - "exclusiveMinimum": 0, - "title": "Height", - "type": "number" + "undoClearedThrough": { + "default": 0, + "description": "Event cursor through which undo history was cleared.", + "minimum": 0, + "title": "Undoclearedthrough", + "type": "integer" } }, "required": [ - "x", - "y", - "width", - "height" + "project" ], - "title": "SelectionBox", + "title": "ProjectSnapshot", "type": "object" }, - "SpecCreateCommand": { + "ProjectTrashCommand": { "additionalProperties": false, - "description": "Create a generation configuration without submitting a job.", + "description": "Move the project to trash.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -12326,7 +12256,7 @@ "type": "string" }, "type": { - "const": "generationSpec.create", + "const": "project.trash", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -12355,8 +12285,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/SpecWrite", - "description": "Create a generation configuration without submitting a job." + "$ref": "#/$defs/EmptyPayload", + "description": "Move the project to trash." } }, "required": [ @@ -12365,39 +12295,62 @@ "type", "payload" ], - "title": "SpecCreateCommand", + "title": "ProjectTrashCommand", "type": "object" }, - "SpecCreateCommandOperation": { + "PromptReference": { "additionalProperties": false, - "description": "Create a generation configuration without submitting a job.", "properties": { "type": { - "const": "generationSpec.create", - "description": "Operation discriminator.", + "const": "reference", + "description": "Operation or variant discriminator.", "title": "Type", "type": "string" }, - "payload": { - "$ref": "#/$defs/SpecWrite", - "description": "Create a generation configuration without submitting a job." + "referenceId": { + "description": "Generation reference ID.", + "format": "uuid", + "title": "Referenceid", + "type": "string" } }, "required": [ "type", - "payload" + "referenceId" ], - "title": "SpecCreateCommandOperation", + "title": "PromptReference", "type": "object" }, - "SpecPromptCommand": { + "PromptText": { "additionalProperties": false, - "description": "Update prompt text and structured references.", "properties": { - "commandId": { - "description": "Stable command ID for idempotent replay.", + "type": { + "const": "text", + "description": "Operation or variant discriminator.", + "title": "Type", + "type": "string" + }, + "text": { + "description": "UTF-8 text content or search query.", + "maxLength": 20000, + "title": "Text", + "type": "string" + } + }, + "required": [ + "type", + "text" + ], + "title": "PromptText", + "type": "object" + }, + "QueryBase": { + "additionalProperties": false, + "properties": { + "queryId": { + "description": "Caller-supplied query ID.", "format": "uuid", - "title": "Commandid", + "title": "Queryid", "type": "string" }, "projectId": { @@ -12405,16 +12358,79 @@ "format": "uuid", "title": "Projectid", "type": "string" - }, - "type": { - "const": "generationSpec.setPrompt", - "description": "Command discriminator.", - "title": "Type", - "type": "string" - }, - "expectedVersions": { - "default": [], - "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + } + }, + "required": [ + "queryId", + "projectId" + ], + "title": "QueryBase", + "type": "object" + }, + "RectangleLayerContent": { + "additionalProperties": false, + "properties": { + "width": { + "description": "Width in pixels.", + "maximum": 8192, + "minimum": 1, + "title": "Width", + "type": "integer" + }, + "height": { + "description": "Height in pixels.", + "maximum": 8192, + "minimum": 1, + "title": "Height", + "type": "integer" + }, + "kind": { + "const": "rectangle", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "color": { + "description": "Serialized display color.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", + "type": "string" + } + }, + "required": [ + "width", + "height", + "kind", + "color" + ], + "title": "RectangleLayerContent", + "type": "object" + }, + "ReferenceAddCommand": { + "additionalProperties": false, + "description": "Add a generation reference; expectedVersions must include its target generation_spec.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "reference.add", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", "items": { "$ref": "#/$defs/ObjectVersion" }, @@ -12436,8 +12452,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/SpecPromptWrite", - "description": "Update prompt text and structured references." + "$ref": "#/$defs/ReferenceWrite", + "description": "Add a generation reference; expectedVersions must include its target generation_spec." } }, "required": [ @@ -12446,120 +12462,194 @@ "type", "payload" ], - "title": "SpecPromptCommand", + "title": "ReferenceAddCommand", "type": "object" }, - "SpecPromptCommandOperation": { + "ReferenceAddCommandOperation": { "additionalProperties": false, - "description": "Update prompt text and structured references.", + "description": "Add a generation reference; expectedVersions must include its target generation_spec.", "properties": { "type": { - "const": "generationSpec.setPrompt", + "const": "reference.add", "description": "Operation discriminator.", "title": "Type", "type": "string" }, "payload": { - "$ref": "#/$defs/SpecPromptWrite", - "description": "Update prompt text and structured references." + "$ref": "#/$defs/ReferenceWrite", + "description": "Add a generation reference; expectedVersions must include its target generation_spec." } }, "required": [ "type", "payload" ], - "title": "SpecPromptCommandOperation", + "title": "ReferenceAddCommandOperation", "type": "object" }, - "SpecPromptWrite": { + "ReferenceBase": { "additionalProperties": false, "properties": { - "specId": { - "description": "Generation configuration ID.", + "id": { + "description": "Stable identity of this project-owned object.", "format": "uuid", - "title": "Specid", + "title": "Id", "type": "string" }, - "prompt": { - "description": "Generation prompt text.", - "maxLength": 20000, - "title": "Prompt", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "promptContent": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "reference": "#/$defs/PromptReference", - "text": "#/$defs/PromptText" - }, - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/$defs/PromptText" - }, - { - "$ref": "#/$defs/PromptReference" - } - ] - }, - "type": "array" - }, - { - "type": "null" - } + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "targetSpecId": { + "description": "Target generation configuration ID.", + "format": "uuid", + "title": "Targetspecid", + "type": "string" + }, + "role": { + "default": "reference", + "description": "Business role of this binding or reference.", + "enum": [ + "reference", + "first_frame", + "last_frame", + "continuation", + "control" ], - "default": null, - "description": "Structured prompt text and reference tokens.", - "title": "Promptcontent" + "title": "Role", + "type": "string" + }, + "order": { + "default": 0, + "description": "Reference ordering within the target configuration.", + "minimum": 0, + "title": "Order", + "type": "integer" + }, + "active": { + "default": true, + "description": "Whether this reference participates in generation.", + "title": "Active", + "type": "boolean" } }, "required": [ - "specId", - "prompt" + "id", + "projectId", + "targetSpecId" ], - "title": "SpecPromptWrite", + "title": "ReferenceBase", "type": "object" }, - "SpecRestore": { + "ReferenceRemove": { "additionalProperties": false, "properties": { - "specId": { - "description": "Generation configuration ID.", + "referenceId": { + "description": "Generation reference ID.", "format": "uuid", - "title": "Specid", + "title": "Referenceid", "type": "string" - }, + } + }, + "required": [ + "referenceId" + ], + "title": "ReferenceRemove", + "type": "object" + }, + "ReferenceRemoveCommand": { + "additionalProperties": false, + "description": "Deactivate a generation reference.", + "properties": { "commandId": { - "description": "Historical command providing the settings to restore.", + "description": "Stable command ID for idempotent replay.", "format": "uuid", "title": "Commandid", "type": "string" }, - "referencePolicy": { - "default": "follow_current", - "description": "Policy for restoring associated reference bindings.", - "enum": [ - "follow_current", - "pinned" + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "reference.remove", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } ], - "title": "Referencepolicy", + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/ReferenceRemove", + "description": "Deactivate a generation reference." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "payload" + ], + "title": "ReferenceRemoveCommand", + "type": "object" + }, + "ReferenceRemoveCommandOperation": { + "additionalProperties": false, + "description": "Deactivate a generation reference.", + "properties": { + "type": { + "const": "reference.remove", + "description": "Operation discriminator.", + "title": "Type", "type": "string" + }, + "payload": { + "$ref": "#/$defs/ReferenceRemove", + "description": "Deactivate a generation reference." } }, "required": [ - "specId", - "commandId" + "type", + "payload" ], - "title": "SpecRestore", + "title": "ReferenceRemoveCommandOperation", "type": "object" }, - "SpecRestoreCommand": { + "ReferenceRestoreCommand": { "additionalProperties": false, - "description": "Restore generation settings from a historical command.", + "description": "Restore a generation reference.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -12574,7 +12664,7 @@ "type": "string" }, "type": { - "const": "generationSpec.restore", + "const": "reference.restore", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -12603,8 +12693,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/SpecRestore", - "description": "Restore generation settings from a historical command." + "$ref": "#/$defs/ReferenceWrite", + "description": "Restore a generation reference." } }, "required": [ @@ -12613,12 +12703,34 @@ "type", "payload" ], - "title": "SpecRestoreCommand", + "title": "ReferenceRestoreCommand", "type": "object" }, - "SpecUpdateCommand": { + "ReferenceRestoreCommandOperation": { "additionalProperties": false, - "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.", + "description": "Restore a generation reference.", + "properties": { + "type": { + "const": "reference.restore", + "description": "Operation discriminator.", + "title": "Type", + "type": "string" + }, + "payload": { + "$ref": "#/$defs/ReferenceWrite", + "description": "Restore a generation reference." + } + }, + "required": [ + "type", + "payload" + ], + "title": "ReferenceRestoreCommandOperation", + "type": "object" + }, + "ReferenceUpdateCommand": { + "additionalProperties": false, + "description": "Update a generation reference.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -12633,7 +12745,7 @@ "type": "string" }, "type": { - "const": "generationSpec.update", + "const": "reference.update", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -12662,8 +12774,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/SpecWrite", - "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged." + "$ref": "#/$defs/ReferenceWrite", + "description": "Update a generation reference." } }, "required": [ @@ -12672,157 +12784,121 @@ "type", "payload" ], - "title": "SpecUpdateCommand", + "title": "ReferenceUpdateCommand", "type": "object" }, - "SpecUpdateCommandOperation": { + "ReferenceUpdateCommandOperation": { "additionalProperties": false, - "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.", + "description": "Update a generation reference.", "properties": { "type": { - "const": "generationSpec.update", + "const": "reference.update", "description": "Operation discriminator.", "title": "Type", "type": "string" }, "payload": { - "$ref": "#/$defs/SpecWrite", - "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged." + "$ref": "#/$defs/ReferenceWrite", + "description": "Update a generation reference." } }, "required": [ "type", "payload" ], - "title": "SpecUpdateCommandOperation", + "title": "ReferenceUpdateCommandOperation", "type": "object" }, - "SpecWrite": { + "ReferenceWrite": { "additionalProperties": false, "properties": { - "spec": { - "description": "Complete configuration with its current revision; the server increments it on commit. For updates, read the current spec, preserve unedited fields and submit its current expected version. Accepted job snapshots never change.", + "reference": { + "description": "Generation input reference. Preserve source canvas identity for canvas-derived references, whether following or pinned.", "discriminator": { "mapping": { - "audio": "#/$defs/AudioGenerationSpec", - "image": "#/$defs/ImageGenerationSpec", - "text": "#/$defs/TextGenerationSpec", - "video": "#/$defs/VideoGenerationSpec" + "follow_current": "#/$defs/FollowingReference", + "pinned": "#/$defs/PinnedReference" }, - "propertyName": "kind" + "propertyName": "binding" }, "oneOf": [ { - "$ref": "#/$defs/TextGenerationSpec" - }, - { - "$ref": "#/$defs/ImageGenerationSpec" - }, - { - "$ref": "#/$defs/VideoGenerationSpec" + "$ref": "#/$defs/PinnedReference" }, { - "$ref": "#/$defs/AudioGenerationSpec" + "$ref": "#/$defs/FollowingReference" } ], - "title": "Spec" + "title": "Reference" } }, "required": [ - "spec" + "reference" ], - "title": "SpecWrite", + "title": "ReferenceWrite", "type": "object" }, - "StackCanvasItem": { + "ResolvedReference": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", + "referenceId": { + "description": "Generation reference ID.", "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "kind": { - "const": "stack", - "description": "Business object or media type.", - "title": "Kind", + "title": "Referenceid", "type": "string" }, - "title": { - "default": "", - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", + "role": { + "description": "Business role of this binding or reference.", + "enum": [ + "reference", + "first_frame", + "last_frame", + "continuation", + "control" + ], + "title": "Role", "type": "string" }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." - }, - "width": { - "default": 352, - "description": "Width in pixels.", - "exclusiveMinimum": 0, - "title": "Width", - "type": "number" - }, - "height": { - "default": 198, - "description": "Height in pixels.", - "exclusiveMinimum": 0, - "title": "Height", - "type": "number" - }, - "zIndex": { - "default": 0, - "description": "Canvas stacking order.", - "title": "Zindex", - "type": "integer" + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." }, - "locked": { - "default": false, - "description": "Whether edits to this object are blocked.", - "title": "Locked", - "type": "boolean" + "metadata": { + "$ref": "#/$defs/MediaMetadata", + "description": "Verified media properties." }, - "color": { + "sourceVersion": { "anyOf": [ { - "pattern": "^(#[0-9a-fA-F]{6})?$", - "type": "string" + "$ref": "#/$defs/ObjectVersion" }, { "type": "null" } ], "default": null, - "description": "Group background color in #RRGGBB format.", - "title": "Color" + "description": "Captured source object version." }, - "visible": { - "default": true, - "description": "Whether this object is displayed.", - "title": "Visible", - "type": "boolean" + "documentVersion": { + "anyOf": [ + { + "$ref": "#/$defs/ObjectVersion" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Version of the source editable document." }, - "parentId": { + "subjectRole": { "anyOf": [ { - "format": "uuid", + "enum": [ + "main", + "auxiliary", + "voice" + ], "type": "string" }, { @@ -12830,322 +12906,187 @@ } ], "default": null, - "description": "Parent canvas group ID, or null for the root.", - "title": "Parentid" + "description": "Subject media slot used by this reference.", + "title": "Subjectrole" }, - "tags": { - "default": [], - "description": "User-defined search tags.", - "items": { - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "type": "string" - }, - "title": "Tags", - "type": "array" + "name": { + "default": "", + "description": "User-visible name.", + "maxLength": 255, + "title": "Name", + "type": "string" }, - "binding": { - "$ref": "#/$defs/EditorBinding", - "description": "Business object displayed by this canvas item." - } - }, - "required": [ - "id", - "projectId", - "kind", - "binding" - ], - "title": "StackCanvasItem", - "type": "object" - }, - "StackData": { - "additionalProperties": false, - "properties": { - "nodeIds": { - "default": [], - "description": "Ordered member canvas item IDs.", - "items": { - "format": "uuid", - "type": "string" - }, - "title": "Nodeids", - "type": "array" - }, - "activeIndex": { - "default": 0, - "description": "Index of the active member.", - "minimum": 0, - "title": "Activeindex", - "type": "integer" - } - }, - "title": "StackData", - "type": "object" - }, - "StackDocument": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", + "sourceTitle": { + "default": "", + "description": "Source canvas title captured for this reference.", + "maxLength": 255, + "title": "Sourcetitle", "type": "string" }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "schemaVersion": { - "const": 1, - "default": 1, - "description": "Record schema version.", - "title": "Schemaversion", - "type": "integer" - }, - "inputConnections": { - "default": [], - "description": "Persisted connections to source assets.", - "items": { - "$ref": "#/$defs/EditorInputConnection" - }, - "title": "Inputconnections", - "type": "array" - }, - "kind": { - "const": "stack", - "description": "Business object or media type.", - "title": "Kind", + "transmission": { + "default": "content", + "description": "How reference content is sent to the provider.", + "enum": [ + "content", + "metadata", + "context_only", + "latent" + ], + "title": "Transmission", "type": "string" - }, - "data": { - "$ref": "#/$defs/StackData", - "description": "Typed editable document contents." } }, "required": [ - "id", - "projectId", - "kind", - "data" + "referenceId", + "role", + "asset", + "metadata" ], - "title": "StackDocument", + "title": "ResolvedReference", "type": "object" }, - "StageCamera": { + "ResultCheck": { "additionalProperties": false, "properties": { - "position": { - "$ref": "#/$defs/Vector3", - "description": "Position in the owning canvas or stage." + "status": { + "description": "Current operation lifecycle state.", + "enum": [ + "passed", + "failed" + ], + "title": "Status", + "type": "string" }, - "target": { - "$ref": "#/$defs/Vector3", - "description": "Camera look-at position." + "facts": { + "additionalProperties": true, + "description": "Observed technical validation facts.", + "title": "Facts", + "type": "object" }, - "fov": { - "description": "Camera vertical field of view in degrees.", - "exclusiveMaximum": 180, - "exclusiveMinimum": 0, - "title": "Fov", - "type": "number" + "message": { + "description": "Human-readable issue description.", + "title": "Message", + "type": "string" + }, + "humanReviewRequired": { + "default": true, + "description": "Whether creative quality still requires human review.", + "title": "Humanreviewrequired", + "type": "boolean" } }, "required": [ - "position", - "target", - "fov" + "status", + "message" ], - "title": "StageCamera", + "title": "ResultCheck", "type": "object" }, - "StageMotion": { + "ResultSelect": { "additionalProperties": false, "properties": { - "preset": { - "description": "Selected generation or motion preset.", - "enum": [ - "idle", - "walk", - "run", - "wave" - ], - "title": "Preset", + "specId": { + "description": "Generation configuration ID.", + "format": "uuid", + "title": "Specid", "type": "string" }, - "speed": { - "description": "Playback or motion speed multiplier.", - "exclusiveMinimum": 0, - "title": "Speed", - "type": "number" - }, - "amount": { - "description": "Magnitude of the procedural motion.", - "maximum": 1, - "minimum": 0, - "title": "Amount", - "type": "number" + "resultId": { + "description": "Generation result ID.", + "format": "uuid", + "title": "Resultid", + "type": "string" } }, "required": [ - "preset", - "speed", - "amount" + "specId", + "resultId" ], - "title": "StageMotion", + "title": "ResultSelect", "type": "object" }, - "StageObject": { + "ResultSelectCommand": { "additionalProperties": false, + "description": "Adopt an existing generation result.", "properties": { - "position": { - "$ref": "#/$defs/Vector3", - "description": "Position in the owning canvas or stage." - }, - "rotation": { - "$ref": "#/$defs/Vector3", - "description": "Rotation in radians around each stage axis." - }, - "scale": { - "$ref": "#/$defs/Vector3", - "description": "Positive scale along each stage axis." - }, - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "kind": { - "description": "Business object or media type.", - "enum": [ - "person", - "box", - "sphere" - ], - "title": "Kind", + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "name": { - "description": "User-visible name.", - "maxLength": 255, - "title": "Name", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "color": { - "description": "Serialized display color.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", + "type": { + "const": "result.select", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "keyframes": { - "default": [], - "description": "Ordered animation keyframes.", - "items": { - "$ref": "#/$defs/TransformFrame" - }, - "title": "Keyframes", - "type": "array" - }, - "motionClips": { + "expectedVersions": { "default": [], - "description": "Ordered procedural motion intervals.", + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", "items": { - "$ref": "#/$defs/MotionClip" + "$ref": "#/$defs/ObjectVersion" }, - "title": "Motionclips", + "title": "Expectedversions", "type": "array" - } - }, - "required": [ - "position", - "rotation", - "scale", - "id", - "kind", - "name", - "color" - ], - "title": "StageObject", - "type": "object" - }, - "StageShot": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "cameraId": { - "description": "Stage camera ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Cameraid", - "type": "string" }, - "start": { - "description": "Start time in seconds.", - "minimum": 0, - "title": "Start", - "type": "number" + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "duration": { - "description": "Interval duration in seconds.", - "exclusiveMinimum": 0, - "title": "Duration", - "type": "number" + "payload": { + "$ref": "#/$defs/ResultSelect", + "description": "Adopt an existing generation result." } }, "required": [ - "id", - "cameraId", - "start", - "duration" + "commandId", + "projectId", + "type", + "payload" ], - "title": "StageShot", + "title": "ResultSelectCommand", "type": "object" }, - "StageTransform": { + "ResultSelectCommandOperation": { "additionalProperties": false, + "description": "Adopt an existing generation result.", "properties": { - "position": { - "$ref": "#/$defs/Vector3", - "description": "Position in the owning canvas or stage." - }, - "rotation": { - "$ref": "#/$defs/Vector3", - "description": "Rotation in radians around each stage axis." + "type": { + "const": "result.select", + "description": "Operation discriminator.", + "title": "Type", + "type": "string" }, - "scale": { - "$ref": "#/$defs/Vector3", - "description": "Positive scale along each stage axis." + "payload": { + "$ref": "#/$defs/ResultSelect", + "description": "Adopt an existing generation result." } }, "required": [ - "position", - "rotation", - "scale" + "type", + "payload" ], - "title": "StageTransform", + "title": "ResultSelectCommandOperation", "type": "object" }, - "SubjectCanvasItem": { + "ResultVersion": { "additionalProperties": false, "properties": { "id": { @@ -13167,461 +13108,400 @@ "title": "Revision", "type": "integer" }, - "kind": { - "const": "subject", - "description": "Business object or media type.", - "title": "Kind", + "specId": { + "description": "Generation configuration ID.", + "format": "uuid", + "title": "Specid", "type": "string" }, - "title": { - "default": "", - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", + "jobId": { + "description": "Generation job ID.", + "format": "uuid", + "title": "Jobid", "type": "string" }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." - }, - "width": { - "default": 352, - "description": "Width in pixels.", - "exclusiveMinimum": 0, - "title": "Width", - "type": "number" - }, - "height": { - "default": 198, - "description": "Height in pixels.", - "exclusiveMinimum": 0, - "title": "Height", - "type": "number" - }, - "zIndex": { - "default": 0, - "description": "Canvas stacking order.", - "title": "Zindex", - "type": "integer" - }, - "locked": { - "default": false, - "description": "Whether edits to this object are blocked.", - "title": "Locked", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "pattern": "^(#[0-9a-fA-F]{6})?$", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Group background color in #RRGGBB format.", - "title": "Color" - }, - "visible": { - "default": true, - "description": "Whether this object is displayed.", - "title": "Visible", - "type": "boolean" - }, - "parentId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parent canvas group ID, or null for the root.", - "title": "Parentid" - }, - "tags": { - "default": [], - "description": "User-defined search tags.", - "items": { - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "type": "string" - }, - "title": "Tags", - "type": "array" + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." }, - "binding": { - "$ref": "#/$defs/EditorBinding", - "description": "Business object displayed by this canvas item." + "inputFingerprint": { + "description": "Fingerprint of the fixed execution input.", + "pattern": "^[0-9a-f]{64}$", + "title": "Inputfingerprint", + "type": "string" } }, "required": [ "id", "projectId", - "kind", - "binding" + "specId", + "jobId", + "asset", + "inputFingerprint" ], - "title": "SubjectCanvasItem", + "title": "ResultVersion", "type": "object" }, - "SubjectData": { + "SegmentRunAnchor": { "additionalProperties": false, "properties": { - "description": { - "default": "", - "description": "User-facing annotation only; not subject media or a generation reference", - "maxLength": 20000, - "title": "Description", + "kind": { + "const": "anchor", + "description": "One independent generation anchor in the declared source shot.", + "title": "Kind", + "type": "string" + } + }, + "required": [ + "kind" + ], + "title": "SegmentRunAnchor", + "type": "object" + }, + "SegmentRunContinuation": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "continuation", + "description": "Generation requires the selected upstream result as a guide.", + "title": "Kind", "type": "string" }, - "category": { - "default": "", - "description": "Subject category.", - "maxLength": 100, - "title": "Category", + "upstreamItemId": { + "description": "Generation node providing the raw guide frames.", + "format": "uuid", + "title": "Upstreamitemid", "type": "string" }, - "main": { - "anyOf": [ + "sourceFrames": { + "description": "Two distinct indices into the raw upstream result for destination frames 0 and 21, in that order.", + "maxItems": 2, + "minItems": 2, + "prefixItems": [ { - "$ref": "#/$defs/AssetRef" + "maximum": 359, + "minimum": 0, + "type": "integer" }, { - "type": "null" + "maximum": 359, + "minimum": 0, + "type": "integer" } ], - "default": null, - "description": "Primary subject media." - }, - "auxiliaries": { - "default": [], - "description": "Ordered auxiliary subject media.", - "items": { - "$ref": "#/$defs/AssetRef" - }, - "maxItems": 3, - "title": "Auxiliaries", + "title": "Sourceframes", "type": "array" - }, - "voice": { - "anyOf": [ - { - "$ref": "#/$defs/AssetRef" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Subject voice asset version." - }, - "librarySource": { - "anyOf": [ - { - "$ref": "#/$defs/SubjectLibrarySource" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Immutable source library version." } }, - "title": "SubjectData", + "required": [ + "kind", + "upstreamItemId", + "sourceFrames" + ], + "title": "SegmentRunContinuation", "type": "object" }, - "SubjectDocument": { + "SegmentRunGenerated": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", + "sourceStart": { + "description": "First covered frame in the normalized working source.", + "minimum": 0, + "title": "Sourcestart", "type": "integer" }, - "schemaVersion": { - "const": 1, - "default": 1, - "description": "Record schema version.", - "title": "Schemaversion", + "sourceEnd": { + "description": "Exclusive end of the covered interval in the normalized working source.", + "minimum": 1, + "title": "Sourceend", "type": "integer" }, - "inputConnections": { - "default": [], - "description": "Persisted connections to source assets.", - "items": { - "$ref": "#/$defs/EditorInputConnection" - }, - "title": "Inputconnections", - "type": "array" - }, "kind": { - "const": "subject", - "description": "Business object or media type.", + "const": "generated", + "description": "Use the retained result from a generation step.", "title": "Kind", "type": "string" }, - "data": { - "$ref": "#/$defs/SubjectData", - "description": "Typed editable document contents." + "itemId": { + "description": "Generation canvas node that provides the result.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "shot": { + "description": "Identity of the inspected continuous shot used to determine guide dependencies.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Shot", + "type": "string" + }, + "step": { + "description": "Independent anchor or guided continuation in this shot.", + "discriminator": { + "mapping": { + "anchor": "#/$defs/SegmentRunAnchor", + "continuation": "#/$defs/SegmentRunContinuation" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/SegmentRunAnchor" + }, + { + "$ref": "#/$defs/SegmentRunContinuation" + } + ], + "title": "Step" } }, "required": [ - "id", - "projectId", + "sourceStart", + "sourceEnd", "kind", - "data" + "itemId", + "shot", + "step" ], - "title": "SubjectDocument", + "title": "SegmentRunGenerated", "type": "object" }, - "SubjectLibrarySource": { + "SegmentRunPlan": { "additionalProperties": false, - "description": "Frozen import provenance; subsequent editing never follows the library.", "properties": { - "itemId": { - "description": "Canvas item ID.", - "format": "uuid", - "title": "Itemid", - "type": "string" + "source": { + "$ref": "#/$defs/AssetRef", + "description": "Exact normalized working video whose entire frame range is delivered." }, - "revision": { - "description": "Captured library item revision.", + "fps": { + "description": "Integer frames per second of the normalized working video.", "minimum": 1, - "title": "Revision", + "title": "Fps", "type": "integer" }, - "importId": { - "description": "Library import ID.", - "format": "uuid", - "title": "Importid", - "type": "string" + "frameCount": { + "description": "Decoded frame count of the normalized working video.", + "minimum": 1, + "title": "Framecount", + "type": "integer" + }, + "entries": { + "description": "Delivery intervals in source playback order.", + "items": { + "discriminator": { + "mapping": { + "generated": "#/$defs/SegmentRunGenerated", + "source": "#/$defs/SegmentRunSource" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/SegmentRunSource" + }, + { + "$ref": "#/$defs/SegmentRunGenerated" + } + ] + }, + "maxItems": 101, + "minItems": 1, + "title": "Entries", + "type": "array" } }, "required": [ - "itemId", - "revision", - "importId" + "source", + "fps", + "frameCount", + "entries" ], - "title": "SubjectLibrarySource", + "title": "SegmentRunPlan", "type": "object" }, - "TextCanvasItem": { + "SegmentRunSource": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" + "sourceStart": { + "description": "First covered frame in the normalized working source.", + "minimum": 0, + "title": "Sourcestart", + "type": "integer" }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", + "sourceEnd": { + "description": "Exclusive end of the covered interval in the normalized working source.", "minimum": 1, - "title": "Revision", + "title": "Sourceend", "type": "integer" }, "kind": { - "const": "text", - "description": "Business object or media type.", + "const": "source", + "description": "Retain these frames from the frozen working source.", "title": "Kind", "type": "string" + } + }, + "required": [ + "sourceStart", + "sourceEnd", + "kind" + ], + "title": "SegmentRunSource", + "type": "object" + }, + "SelectionBox": { + "additionalProperties": false, + "properties": { + "x": { + "description": "Horizontal coordinate.", + "title": "X", + "type": "number" }, - "title": { - "default": "", - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", - "type": "string" - }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." + "y": { + "description": "Vertical coordinate.", + "title": "Y", + "type": "number" }, "width": { - "default": 352, "description": "Width in pixels.", "exclusiveMinimum": 0, "title": "Width", "type": "number" }, "height": { - "default": 198, "description": "Height in pixels.", "exclusiveMinimum": 0, "title": "Height", "type": "number" + } + }, + "required": [ + "x", + "y", + "width", + "height" + ], + "title": "SelectionBox", + "type": "object" + }, + "SelectionPipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "selection", + "description": "Run an explicit set of canvas nodes.", + "title": "Kind", + "type": "string" }, - "zIndex": { - "default": 0, - "description": "Canvas stacking order.", - "title": "Zindex", - "type": "integer" - }, - "locked": { - "default": false, - "description": "Whether edits to this object are blocked.", - "title": "Locked", - "type": "boolean" - }, - "color": { - "anyOf": [ - { - "pattern": "^(#[0-9a-fA-F]{6})?$", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Group background color in #RRGGBB format.", - "title": "Color" + "itemIds": { + "description": "Selected canvas item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "maxItems": 200, + "minItems": 1, + "title": "Itemids", + "type": "array" + } + }, + "required": [ + "kind", + "itemIds" + ], + "title": "SelectionPipelineScope", + "type": "object" + }, + "SpecCreateCommand": { + "additionalProperties": false, + "description": "Create a generation configuration without submitting a job.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" }, - "visible": { - "default": true, - "description": "Whether this object is displayed.", - "title": "Visible", - "type": "boolean" + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" }, - "parentId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parent canvas group ID, or null for the root.", - "title": "Parentid" + "type": { + "const": "generationSpec.create", + "description": "Command discriminator.", + "title": "Type", + "type": "string" }, - "tags": { + "expectedVersions": { "default": [], - "description": "User-defined search tags.", + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", "items": { - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "type": "string" + "$ref": "#/$defs/ObjectVersion" }, - "title": "Tags", + "title": "Expectedversions", "type": "array" }, - "binding": { - "description": "Business object displayed by this canvas item.", - "discriminator": { - "mapping": { - "empty": "#/$defs/EmptyBinding", - "generation": "#/$defs/GenerationBinding", - "material": "#/$defs/MaterialBinding" - }, - "propertyName": "role" - }, - "oneOf": [ - { - "$ref": "#/$defs/EmptyBinding" - }, + "expectedPreview": { + "anyOf": [ { - "$ref": "#/$defs/MaterialBinding" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { - "$ref": "#/$defs/GenerationBinding" + "type": "null" } ], - "title": "Binding" + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "editors": { - "default": [], - "description": "Attached editable documents.", - "items": { - "$ref": "#/$defs/EditorRef" - }, - "title": "Editors", - "type": "array" + "payload": { + "$ref": "#/$defs/SpecWrite", + "description": "Create a generation configuration without submitting a job." } }, "required": [ - "id", + "commandId", "projectId", - "kind", - "binding" + "type", + "payload" ], - "title": "TextCanvasItem", + "title": "SpecCreateCommand", "type": "object" }, - "TextExecution": { + "SpecCreateCommandOperation": { "additionalProperties": false, + "description": "Create a generation configuration without submitting a job.", "properties": { - "thinking": { - "default": "auto", - "description": "Requested reasoning effort.", - "enum": [ - "auto", - "low", - "medium", - "high" - ], - "title": "Thinking", + "type": { + "const": "generationSpec.create", + "description": "Operation discriminator.", + "title": "Type", "type": "string" }, - "maxTokens": { - "default": 8192, - "description": "Maximum generated text tokens.", - "maximum": 32768, - "minimum": 1, - "title": "Maxtokens", - "type": "integer" - }, - "kind": { - "const": "text", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" + "payload": { + "$ref": "#/$defs/SpecWrite", + "description": "Create a generation configuration without submitting a job." } }, "required": [ - "kind" + "type", + "payload" ], - "title": "TextExecution", + "title": "SpecCreateCommandOperation", "type": "object" }, - "TextGenerationSpec": { + "SpecPromptCommand": { "additionalProperties": false, + "description": "Update prompt text and structured references.", "properties": { - "id": { - "description": "Stable identity of this project-owned object.", + "commandId": { + "description": "Stable command ID for idempotent replay.", "format": "uuid", - "title": "Id", + "title": "Commandid", "type": "string" }, "projectId": { @@ -13630,27 +13510,25 @@ "title": "Projectid", "type": "string" }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "purpose": { - "default": "draft", - "description": "Draft settings or executable generation configuration.", - "enum": [ - "draft", - "generation" - ], - "title": "Purpose", + "type": { + "const": "generationSpec.setPrompt", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "modelConfigId": { + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { "anyOf": [ { - "format": "uuid", + "pattern": "^[0-9a-f]{64}$", "type": "string" }, { @@ -13658,31 +13536,75 @@ } ], "default": null, - "description": "Model configuration ID from the model catalog or user model selections.", - "title": "Modelconfigid" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "prompt": { - "default": "", - "description": "Generation prompt text.", - "maxLength": 20000, - "title": "Prompt", + "payload": { + "$ref": "#/$defs/SpecPromptWrite", + "description": "Update prompt text and structured references." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "payload" + ], + "title": "SpecPromptCommand", + "type": "object" + }, + "SpecPromptCommandOperation": { + "additionalProperties": false, + "description": "Update prompt text and structured references.", + "properties": { + "type": { + "const": "generationSpec.setPrompt", + "description": "Operation discriminator.", + "title": "Type", "type": "string" }, - "promptContent": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "reference": "#/$defs/PromptReference", - "text": "#/$defs/PromptText" - }, - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/$defs/PromptText" - }, + "payload": { + "$ref": "#/$defs/SpecPromptWrite", + "description": "Update prompt text and structured references." + } + }, + "required": [ + "type", + "payload" + ], + "title": "SpecPromptCommandOperation", + "type": "object" + }, + "SpecPromptWrite": { + "additionalProperties": false, + "properties": { + "specId": { + "description": "Generation configuration ID.", + "format": "uuid", + "title": "Specid", + "type": "string" + }, + "prompt": { + "description": "Generation prompt text.", + "maxLength": 20000, + "title": "Prompt", + "type": "string" + }, + "promptContent": { + "anyOf": [ + { + "items": { + "discriminator": { + "mapping": { + "reference": "#/$defs/PromptReference", + "text": "#/$defs/PromptText" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/$defs/PromptText" + }, { "$ref": "#/$defs/PromptReference" } @@ -13697,11 +13619,83 @@ "default": null, "description": "Structured prompt text and reference tokens.", "title": "Promptcontent" + } + }, + "required": [ + "specId", + "prompt" + ], + "title": "SpecPromptWrite", + "type": "object" + }, + "SpecRestore": { + "additionalProperties": false, + "properties": { + "specId": { + "description": "Generation configuration ID.", + "format": "uuid", + "title": "Specid", + "type": "string" }, - "currentResultId": { + "commandId": { + "description": "Historical command providing the settings to restore.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "referencePolicy": { + "default": "follow_current", + "description": "Policy for restoring associated reference bindings.", + "enum": [ + "follow_current", + "pinned" + ], + "title": "Referencepolicy", + "type": "string" + } + }, + "required": [ + "specId", + "commandId" + ], + "title": "SpecRestore", + "type": "object" + }, + "SpecRestoreCommand": { + "additionalProperties": false, + "description": "Restore generation settings from a historical command.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "generationSpec.restore", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { "anyOf": [ { - "format": "uuid", + "pattern": "^[0-9a-f]{64}$", "type": "string" }, { @@ -13709,110 +13703,142 @@ } ], "default": null, - "description": "Currently adopted result ID.", - "title": "Currentresultid" - }, - "kind": { - "const": "text", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "parameters": { - "$ref": "#/$defs/TextParameters", - "description": "Typed generation or editing parameters." + "payload": { + "$ref": "#/$defs/SpecRestore", + "description": "Restore generation settings from a historical command." } }, "required": [ - "id", + "commandId", "projectId", - "kind" + "type", + "payload" ], - "title": "TextGenerationSpec", + "title": "SpecRestoreCommand", "type": "object" }, - "TextLayerContent": { + "SpecUpdateCommand": { "additionalProperties": false, + "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.", "properties": { - "width": { - "description": "Width in pixels.", - "maximum": 8192, - "minimum": 1, - "title": "Width", - "type": "integer" - }, - "height": { - "description": "Height in pixels.", - "maximum": 8192, - "minimum": 1, - "title": "Height", - "type": "integer" - }, - "kind": { - "const": "text", - "description": "Business object or media type.", - "title": "Kind", + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "text": { - "description": "UTF-8 text content or search query.", - "maxLength": 10000, - "title": "Text", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "color": { - "description": "Serialized display color.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", + "type": { + "const": "generationSpec.update", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "fontSize": { - "description": "Text size in pixels.", - "maximum": 1000, - "minimum": 4, - "title": "Fontsize", - "type": "number" + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/SpecWrite", + "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged." } }, "required": [ - "width", - "height", - "kind", - "text", - "color", - "fontSize" + "commandId", + "projectId", + "type", + "payload" ], - "title": "TextLayerContent", + "title": "SpecUpdateCommand", "type": "object" }, - "TextParameters": { + "SpecUpdateCommandOperation": { "additionalProperties": false, + "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged.", "properties": { - "thinking": { - "default": "auto", - "description": "Requested reasoning effort.", - "enum": [ - "auto", - "low", - "medium", - "high" - ], - "title": "Thinking", + "type": { + "const": "generationSpec.update", + "description": "Operation discriminator.", + "title": "Type", "type": "string" }, - "maxTokens": { - "default": 8192, - "description": "Maximum generated text tokens.", - "maximum": 32768, - "minimum": 1, - "title": "Maxtokens", - "type": "integer" + "payload": { + "$ref": "#/$defs/SpecWrite", + "description": "Replace the complete generation configuration; preserve unedited fields and use the current version. Jobs are unchanged." } }, - "title": "TextParameters", + "required": [ + "type", + "payload" + ], + "title": "SpecUpdateCommandOperation", "type": "object" }, - "TimelineCanvasItem": { + "SpecWrite": { + "additionalProperties": false, + "properties": { + "spec": { + "description": "Complete configuration with its current revision; the server increments it on commit. For updates, read the current spec, preserve unedited fields and submit its current expected version. Accepted job snapshots never change.", + "discriminator": { + "mapping": { + "audio": "#/$defs/AudioGenerationSpec", + "image": "#/$defs/ImageGenerationSpec", + "text": "#/$defs/TextGenerationSpec", + "video": "#/$defs/VideoGenerationSpec" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/TextGenerationSpec" + }, + { + "$ref": "#/$defs/ImageGenerationSpec" + }, + { + "$ref": "#/$defs/VideoGenerationSpec" + }, + { + "$ref": "#/$defs/AudioGenerationSpec" + } + ], + "title": "Spec" + } + }, + "required": [ + "spec" + ], + "title": "SpecWrite", + "type": "object" + }, + "StackCanvasItem": { "additionalProperties": false, "properties": { "id": { @@ -13835,7 +13861,7 @@ "type": "integer" }, "kind": { - "const": "timeline", + "const": "stack", "description": "Business object or media type.", "title": "Kind", "type": "string" @@ -13934,151 +13960,34 @@ "kind", "binding" ], - "title": "TimelineCanvasItem", - "type": "object" - }, - "TimelineClip": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "resource": { - "$ref": "#/$defs/TimelineResource", - "description": "Clip source from the imported asset collection." - }, - "start": { - "anyOf": [ - { - "minimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Start time in seconds.", - "title": "Start" - }, - "inPoint": { - "description": "Source trim start in seconds.", - "minimum": 0, - "title": "Inpoint", - "type": "number" - }, - "outPoint": { - "description": "Source trim end in seconds.", - "exclusiveMinimum": 0, - "title": "Outpoint", - "type": "number" - }, - "speed": { - "default": 1, - "description": "Playback or motion speed multiplier.", - "exclusiveMinimum": 0, - "title": "Speed", - "type": "number" - }, - "volume": { - "default": 1, - "description": "Linear audio gain.", - "maximum": 1, - "minimum": 0, - "title": "Volume", - "type": "number" - }, - "muted": { - "default": false, - "description": "Whether audio output is muted.", - "title": "Muted", - "type": "boolean" - } - }, - "required": [ - "id", - "resource", - "inPoint", - "outPoint" - ], - "title": "TimelineClip", + "title": "StackCanvasItem", "type": "object" }, - "TimelineData": { + "StackData": { "additionalProperties": false, "properties": { - "fps": { - "description": "Frames per second.", - "minimum": 1, - "title": "Fps", - "type": "integer" - }, - "width": { - "description": "Width in pixels.", - "minimum": 1, - "title": "Width", - "type": "integer" - }, - "height": { - "description": "Height in pixels.", - "minimum": 1, - "title": "Height", - "type": "integer" - }, - "tracks": { - "description": "Ordered timeline tracks.", - "items": { - "$ref": "#/$defs/TimelineTrack" - }, - "minItems": 1, - "title": "Tracks", - "type": "array" - }, - "importedAssets": { - "default": [], - "description": "Source assets available to timeline clips.", - "items": { - "$ref": "#/$defs/TimelineResource" - }, - "title": "Importedassets", - "type": "array" - }, - "fonts": { + "nodeIds": { "default": [], - "description": "Document-local registered font resources; omitted when empty.", + "description": "Ordered member canvas item IDs.", "items": { - "$ref": "#/$defs/TimelineFontResource" + "format": "uuid", + "type": "string" }, - "maxItems": 16, - "title": "Fonts", + "title": "Nodeids", "type": "array" }, - "overlays": { - "default": [], - "description": "Timed text ordered from bottom to top; omitted when empty.", - "items": { - "$ref": "#/$defs/TimelineTextOverlay" - }, - "maxItems": 2000, - "title": "Overlays", - "type": "array" + "activeIndex": { + "default": 0, + "description": "Index of the active member.", + "minimum": 0, + "title": "Activeindex", + "type": "integer" } }, - "required": [ - "fps", - "width", - "height", - "tracks" - ], - "title": "TimelineData", + "title": "StackData", "type": "object" }, - "TimelineDocument": { + "StackDocument": { "additionalProperties": false, "properties": { "id": { @@ -14117,13 +14026,13 @@ "type": "array" }, "kind": { - "const": "timeline", + "const": "stack", "description": "Business object or media type.", "title": "Kind", "type": "string" }, "data": { - "$ref": "#/$defs/TimelineData", + "$ref": "#/$defs/StackData", "description": "Typed editable document contents." } }, @@ -14133,179 +14042,302 @@ "kind", "data" ], - "title": "TimelineDocument", + "title": "StackDocument", "type": "object" }, - "TimelineFontResource": { + "StageCamera": { "additionalProperties": false, "properties": { - "id": { - "description": "Stable document-local font ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" + "position": { + "$ref": "#/$defs/Vector3", + "description": "Position in the owning canvas or stage." }, - "title": { - "description": "Display title of the font.", - "maxLength": 255, - "title": "Title", - "type": "string" + "target": { + "$ref": "#/$defs/Vector3", + "description": "Camera look-at position." }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable registered font asset version." + "fov": { + "description": "Camera vertical field of view in degrees.", + "exclusiveMaximum": 180, + "exclusiveMinimum": 0, + "title": "Fov", + "type": "number" } }, "required": [ - "id", - "title", - "asset" + "position", + "target", + "fov" ], - "title": "TimelineFontResource", + "title": "StageCamera", "type": "object" }, - "TimelinePackageExportFile": { + "StageMotion": { "additionalProperties": false, "properties": { - "editorId": { - "description": "Saved timeline ID in the active project.", - "format": "uuid", - "title": "Editorid", + "preset": { + "description": "Selected generation or motion preset.", + "enum": [ + "idle", + "walk", + "run", + "wave" + ], + "title": "Preset", "type": "string" }, - "revision": { - "description": "Exact saved revision to export.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "path": { - "description": "New output file under the active execution directory.", - "maxLength": 4096, - "minLength": 1, - "title": "Path", - "type": "string" + "speed": { + "description": "Playback or motion speed multiplier.", + "exclusiveMinimum": 0, + "title": "Speed", + "type": "number" + }, + "amount": { + "description": "Magnitude of the procedural motion.", + "maximum": 1, + "minimum": 0, + "title": "Amount", + "type": "number" } }, "required": [ - "editorId", - "revision", - "path" + "preset", + "speed", + "amount" ], - "title": "TimelinePackageExportFile", + "title": "StageMotion", "type": "object" }, - "TimelinePackageImportFile": { + "StageObject": { "additionalProperties": false, "properties": { - "operationId": { - "description": "Stable import operation identity.", - "format": "uuid", - "title": "Operationid", + "position": { + "$ref": "#/$defs/Vector3", + "description": "Position in the owning canvas or stage." + }, + "rotation": { + "$ref": "#/$defs/Vector3", + "description": "Rotation in radians around each stage axis." + }, + "scale": { + "$ref": "#/$defs/Vector3", + "description": "Positive scale along each stage axis." + }, + "id": { + "description": "Stable object ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Id", "type": "string" }, - "archiveFingerprint": { - "description": "Expected SHA-256 of archive bytes.", - "pattern": "^sha256:[0-9a-f]{64}$", - "title": "Archivefingerprint", + "kind": { + "description": "Business object or media type.", + "enum": [ + "person", + "box", + "sphere" + ], + "title": "Kind", "type": "string" }, - "path": { - "description": "Existing bundle under the active execution directory.", - "maxLength": 4096, + "name": { + "description": "User-visible name.", + "maxLength": 255, + "title": "Name", + "type": "string" + }, + "color": { + "description": "Serialized display color.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", + "type": "string" + }, + "keyframes": { + "default": [], + "description": "Ordered animation keyframes.", + "items": { + "$ref": "#/$defs/TransformFrame" + }, + "title": "Keyframes", + "type": "array" + }, + "motionClips": { + "default": [], + "description": "Ordered procedural motion intervals.", + "items": { + "$ref": "#/$defs/MotionClip" + }, + "title": "Motionclips", + "type": "array" + } + }, + "required": [ + "position", + "rotation", + "scale", + "id", + "kind", + "name", + "color" + ], + "title": "StageObject", + "type": "object" + }, + "StageShot": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable object ID.", + "maxLength": 100, "minLength": 1, - "title": "Path", + "pattern": "\\S", + "title": "Id", "type": "string" }, - "replaceEditorId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Explicit replacement target.", - "title": "Replaceeditorid" + "cameraId": { + "description": "Stage camera ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Cameraid", + "type": "string" }, - "expectedRevision": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Expected replacement revision.", - "title": "Expectedrevision" + "start": { + "description": "Start time in seconds.", + "minimum": 0, + "title": "Start", + "type": "number" + }, + "duration": { + "description": "Interval duration in seconds.", + "exclusiveMinimum": 0, + "title": "Duration", + "type": "number" } }, "required": [ - "operationId", - "archiveFingerprint", - "path" + "id", + "cameraId", + "start", + "duration" ], - "title": "TimelinePackageImportFile", + "title": "StageShot", "type": "object" }, - "TimelinePackageImportReceipt": { + "StageTransform": { "additionalProperties": false, "properties": { - "operationId": { - "description": "Import identity.", + "position": { + "$ref": "#/$defs/Vector3", + "description": "Position in the owning canvas or stage." + }, + "rotation": { + "$ref": "#/$defs/Vector3", + "description": "Rotation in radians around each stage axis." + }, + "scale": { + "$ref": "#/$defs/Vector3", + "description": "Positive scale along each stage axis." + } + }, + "required": [ + "position", + "rotation", + "scale" + ], + "title": "StageTransform", + "type": "object" + }, + "SubjectCanvasItem": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", "format": "uuid", - "title": "Operationid", + "title": "Id", "type": "string" }, - "status": { - "description": "Partial registration, complete publication, or terminal rejection.", - "enum": [ - "registered", - "applied", - "rejected" - ], - "title": "Status", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "editorId": { - "description": "Stable destination document ID.", - "format": "uuid", - "title": "Editorid", + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "kind": { + "const": "subject", + "description": "Business object or media type.", + "title": "Kind", "type": "string" }, - "registeredAssetIds": { - "default": [], - "description": "Resources actually committed before final publication.", - "items": { - "format": "uuid", - "type": "string" - }, - "title": "Registeredassetids", - "type": "array" + "title": { + "default": "", + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" }, - "receipt": { + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + }, + "width": { + "default": 352, + "description": "Width in pixels.", + "exclusiveMinimum": 0, + "title": "Width", + "type": "number" + }, + "height": { + "default": 198, + "description": "Height in pixels.", + "exclusiveMinimum": 0, + "title": "Height", + "type": "number" + }, + "zIndex": { + "default": 0, + "description": "Canvas stacking order.", + "title": "Zindex", + "type": "integer" + }, + "locked": { + "default": false, + "description": "Whether edits to this object are blocked.", + "title": "Locked", + "type": "boolean" + }, + "color": { "anyOf": [ { - "$ref": "#/$defs/CommandReceipt" + "pattern": "^(#[0-9a-fA-F]{6})?$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Final atomic business command receipt, when committed." + "description": "Group background color in #RRGGBB format.", + "title": "Color" }, - "errorCode": { + "visible": { + "default": true, + "description": "Whether this object is displayed.", + "title": "Visible", + "type": "boolean" + }, + "parentId": { "anyOf": [ { + "format": "uuid", "type": "string" }, { @@ -14313,187 +14345,163 @@ } ], "default": null, - "description": "Stable failure code for retryable registration failure.", - "title": "Errorcode" + "description": "Parent canvas group ID, or null for the root.", + "title": "Parentid" + }, + "tags": { + "default": [], + "description": "User-defined search tags.", + "items": { + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "type": "string" + }, + "title": "Tags", + "type": "array" + }, + "binding": { + "$ref": "#/$defs/EditorBinding", + "description": "Business object displayed by this canvas item." } }, "required": [ - "operationId", - "status", - "editorId" + "id", + "projectId", + "kind", + "binding" ], - "title": "TimelinePackageImportReceipt", + "title": "SubjectCanvasItem", "type": "object" }, - "TimelinePackageImportRequest": { + "SubjectData": { "additionalProperties": false, "properties": { - "operationId": { - "description": "Stable identity for this entire import and all retries.", - "format": "uuid", - "title": "Operationid", + "description": { + "default": "", + "description": "User-facing annotation only; not subject media or a generation reference", + "maxLength": 20000, + "title": "Description", "type": "string" }, - "uploadHandle": { - "description": "Project/session-owned staged ZIP upload.", - "format": "uuid", - "title": "Uploadhandle", + "category": { + "default": "", + "description": "Subject category.", + "maxLength": 100, + "title": "Category", "type": "string" }, - "archiveFingerprint": { - "description": "Fixed archive bytes for recovery and replay.", - "pattern": "^sha256:[0-9a-f]{64}$", - "title": "Archivefingerprint", - "type": "string" + "main": { + "anyOf": [ + { + "$ref": "#/$defs/AssetRef" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Primary subject media." }, - "replaceEditorId": { + "auxiliaries": { + "default": [], + "description": "Ordered auxiliary subject media.", + "items": { + "$ref": "#/$defs/AssetRef" + }, + "maxItems": 3, + "title": "Auxiliaries", + "type": "array" + }, + "voice": { "anyOf": [ { - "format": "uuid", - "type": "string" + "$ref": "#/$defs/AssetRef" }, { "type": "null" } ], "default": null, - "description": "Explicit replacement target; omitted creates a timeline.", - "title": "Replaceeditorid" + "description": "Subject voice asset version." }, - "expectedRevision": { + "librarySource": { "anyOf": [ { - "minimum": 1, - "type": "integer" + "$ref": "#/$defs/SubjectLibrarySource" }, { "type": "null" } ], "default": null, - "description": "Required original revision for replacement.", - "title": "Expectedrevision" + "description": "Immutable source library version." } }, - "required": [ - "operationId", - "uploadHandle", - "archiveFingerprint" - ], - "title": "TimelinePackageImportRequest", + "title": "SubjectData", "type": "object" }, - "TimelinePackageManifest": { + "SubjectDocument": { "additionalProperties": false, "properties": { - "format": { - "const": "opendirector-timeline-bundle", - "default": "opendirector-timeline-bundle", - "description": "Native bundle format.", - "title": "Format", + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", "type": "string" }, - "version": { + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "schemaVersion": { "const": 1, "default": 1, - "description": "Native bundle format version.", - "title": "Version", + "description": "Record schema version.", + "title": "Schemaversion", "type": "integer" }, - "requiredCapabilities": { + "inputConnections": { "default": [], - "description": "Required editable document capabilities.", - "items": { - "const": "timeline.text.v1", - "type": "string" - }, - "maxItems": 1, - "title": "Requiredcapabilities", - "type": "array" - }, - "resources": { - "description": "Distinct logical resources; paths may share identical bytes.", + "description": "Persisted connections to source assets.", "items": { - "$ref": "#/$defs/TimelinePackageResource" + "$ref": "#/$defs/EditorInputConnection" }, - "maxItems": 4093, - "title": "Resources", + "title": "Inputconnections", "type": "array" - } - }, - "required": [ - "resources" - ], - "title": "TimelinePackageManifest", - "type": "object" - }, - "TimelinePackageResource": { - "additionalProperties": false, - "properties": { - "source": { - "$ref": "#/$defs/AssetRef", - "description": "Original logical reference; only a package mapping key." - }, - "name": { - "description": "Original resource filename.", - "maxLength": 255, - "minLength": 1, - "title": "Name", - "type": "string" - }, - "path": { - "description": "Content-addressed archive member.", - "pattern": "^assets/[0-9a-f]{64}\\.[a-z0-9]{1,10}$", - "title": "Path", - "type": "string" }, "kind": { - "description": "Verified media kind.", - "enum": [ - "text", - "image", - "video", - "audio", - "file" - ], + "const": "subject", + "description": "Business object or media type.", "title": "Kind", "type": "string" }, - "mimeType": { - "description": "Verified MIME type.", - "maxLength": 255, - "minLength": 1, - "title": "Mimetype", - "type": "string" - }, - "size": { - "description": "Actual resource byte count.", - "maximum": 536870912, - "minimum": 0, - "title": "Size", - "type": "integer" - }, - "fingerprint": { - "description": "SHA-256 identity of resource bytes.", - "pattern": "^sha256:[0-9a-f]{64}$", - "title": "Fingerprint", - "type": "string" + "data": { + "$ref": "#/$defs/SubjectData", + "description": "Typed editable document contents." } }, "required": [ - "source", - "name", - "path", + "id", + "projectId", "kind", - "mimeType", - "size", - "fingerprint" + "data" ], - "title": "TimelinePackageResource", + "title": "SubjectDocument", "type": "object" }, - "TimelinePublishRender": { + "SubjectLibrarySource": { "additionalProperties": false, + "description": "Frozen import provenance; subsequent editing never follows the library.", "properties": { "itemId": { "description": "Canvas item ID.", @@ -14501,415 +14509,28 @@ "title": "Itemid", "type": "string" }, - "editorId": { - "description": "Editable document ID.", - "format": "uuid", - "title": "Editorid", - "type": "string" - }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." + "revision": { + "description": "Captured library item revision.", + "minimum": 1, + "title": "Revision", + "type": "integer" }, - "outputId": { - "description": "Published canvas output ID.", + "importId": { + "description": "Library import ID.", "format": "uuid", - "title": "Outputid", - "type": "string" - }, - "expectedOutputRevision": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Current output node revision when appending a rendered version.", - "title": "Expectedoutputrevision" - }, - "title": { - "default": "合成视频", - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", + "title": "Importid", "type": "string" - }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." } }, "required": [ "itemId", - "editorId", - "asset", - "outputId" - ], - "title": "TimelinePublishRender", - "type": "object" - }, - "TimelinePublishRenderCommand": { - "additionalProperties": false, - "description": "Publish a rendered timeline result.", - "properties": { - "commandId": { - "description": "Stable command ID for idempotent replay.", - "format": "uuid", - "title": "Commandid", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "type": { - "const": "timeline.publishRender", - "description": "Command discriminator.", - "title": "Type", - "type": "string" - }, - "expectedVersions": { - "default": [], - "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", - "items": { - "$ref": "#/$defs/ObjectVersion" - }, - "title": "Expectedversions", - "type": "array" - }, - "expectedPreview": { - "anyOf": [ - { - "pattern": "^[0-9a-f]{64}$", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Fingerprint of the confirmed impact preview.", - "title": "Expectedpreview" - }, - "payload": { - "$ref": "#/$defs/TimelinePublishRender", - "description": "Publish a rendered timeline result." - } - }, - "required": [ - "commandId", - "projectId", - "type", - "payload" - ], - "title": "TimelinePublishRenderCommand", - "type": "object" - }, - "TimelineResource": { - "additionalProperties": false, - "properties": { - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." - }, - "title": { - "description": "Display title of the imported asset.", - "maxLength": 255, - "title": "Title", - "type": "string" - }, - "durationSeconds": { - "anyOf": [ - { - "exclusiveMinimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Duration in seconds.", - "title": "Durationseconds" - } - }, - "required": [ - "asset", - "title" - ], - "title": "TimelineResource", - "type": "object" - }, - "TimelineTextBackground": { - "additionalProperties": false, - "properties": { - "color": { - "description": "Background color in #RRGGBB format.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", - "type": "string" - }, - "opacity": { - "description": "Background opacity.", - "maximum": 1, - "minimum": 0, - "title": "Opacity", - "type": "number" - }, - "padding": { - "description": "Background padding in output pixels.", - "maximum": 128, - "minimum": 0, - "title": "Padding", - "type": "number" - } - }, - "required": [ - "color", - "opacity", - "padding" - ], - "title": "TimelineTextBackground", - "type": "object" - }, - "TimelineTextOverlay": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable document-local text ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "start": { - "description": "Absolute start time in seconds.", - "minimum": 0, - "title": "Start", - "type": "number" - }, - "end": { - "description": "Exclusive absolute end time in seconds.", - "exclusiveMinimum": 0, - "title": "End", - "type": "number" - }, - "text": { - "description": "Plain text normalized to LF, counted in Unicode code points.", - "maxLength": 4096, - "minLength": 1, - "title": "Text", - "type": "string" - }, - "x": { - "description": "Normalized text box left position.", - "maximum": 1, - "minimum": 0, - "title": "X", - "type": "number" - }, - "y": { - "description": "Normalized text box top position.", - "maximum": 1, - "minimum": 0, - "title": "Y", - "type": "number" - }, - "maxWidth": { - "description": "Text box width as a fraction of output width.", - "exclusiveMinimum": 0, - "maximum": 1, - "title": "Maxwidth", - "type": "number" - }, - "fontId": { - "description": "Font resource ID in this document.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Fontid", - "type": "string" - }, - "style": { - "$ref": "#/$defs/TimelineTextStyle", - "description": "Output-space text styling." - }, - "sourceAsset": { - "anyOf": [ - { - "$ref": "#/$defs/AssetRef" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Frozen source text asset, independent of subsequent edits." - } - }, - "required": [ - "id", - "start", - "end", - "text", - "x", - "y", - "maxWidth", - "fontId", - "style" - ], - "title": "TimelineTextOverlay", - "type": "object" - }, - "TimelineTextStroke": { - "additionalProperties": false, - "properties": { - "color": { - "description": "Stroke color in #RRGGBB format.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", - "type": "string" - }, - "width": { - "description": "Stroke width in output pixels.", - "maximum": 32, - "minimum": 0, - "title": "Width", - "type": "number" - } - }, - "required": [ - "color", - "width" - ], - "title": "TimelineTextStroke", - "type": "object" - }, - "TimelineTextStyle": { - "additionalProperties": false, - "properties": { - "fontSize": { - "description": "Font size in output pixels.", - "maximum": 512, - "minimum": 1, - "title": "Fontsize", - "type": "number" - }, - "color": { - "description": "Text color in #RRGGBB format.", - "pattern": "^#[0-9a-fA-F]{6}$", - "title": "Color", - "type": "string" - }, - "align": { - "description": "Horizontal text alignment.", - "enum": [ - "left", - "center", - "right" - ], - "title": "Align", - "type": "string" - }, - "lineHeight": { - "description": "Line height as a font size multiplier.", - "maximum": 3, - "minimum": 0.8, - "title": "Lineheight", - "type": "number" - }, - "background": { - "anyOf": [ - { - "$ref": "#/$defs/TimelineTextBackground" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Optional text background." - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/$defs/TimelineTextStroke" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Optional text stroke." - } - }, - "required": [ - "fontSize", - "color", - "align", - "lineHeight" - ], - "title": "TimelineTextStyle", - "type": "object" - }, - "TimelineTrack": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "kind": { - "description": "Business object or media type.", - "enum": [ - "visual", - "audio" - ], - "title": "Kind", - "type": "string" - }, - "title": { - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", - "type": "string" - }, - "muted": { - "default": false, - "description": "Whether audio output is muted.", - "title": "Muted", - "type": "boolean" - }, - "clips": { - "default": [], - "description": "Ordered clips on this track.", - "items": { - "$ref": "#/$defs/TimelineClip" - }, - "title": "Clips", - "type": "array" - } - }, - "required": [ - "id", - "kind", - "title" + "revision", + "importId" ], - "title": "TimelineTrack", + "title": "SubjectLibrarySource", "type": "object" }, - "ToolCanvasItem": { + "TextCanvasItem": { "additionalProperties": false, "properties": { "id": { @@ -14932,7 +14553,7 @@ "type": "integer" }, "kind": { - "const": "tool", + "const": "text", "description": "Business object or media type.", "title": "Kind", "type": "string" @@ -15021,8 +14642,36 @@ "type": "array" }, "binding": { - "$ref": "#/$defs/EditorBinding", - "description": "Business object displayed by this canvas item." + "description": "Business object displayed by this canvas item.", + "discriminator": { + "mapping": { + "empty": "#/$defs/EmptyBinding", + "generation": "#/$defs/GenerationBinding", + "material": "#/$defs/MaterialBinding" + }, + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/$defs/EmptyBinding" + }, + { + "$ref": "#/$defs/MaterialBinding" + }, + { + "$ref": "#/$defs/GenerationBinding" + } + ], + "title": "Binding" + }, + "editors": { + "default": [], + "description": "Attached editable documents.", + "items": { + "$ref": "#/$defs/EditorRef" + }, + "title": "Editors", + "type": "array" } }, "required": [ @@ -15031,64 +14680,46 @@ "kind", "binding" ], - "title": "ToolCanvasItem", + "title": "TextCanvasItem", "type": "object" }, - "ToolData": { + "TextExecution": { "additionalProperties": false, "properties": { - "kind": { - "description": "Business object or media type.", + "thinking": { + "default": "auto", + "description": "Requested reasoning effort.", "enum": [ - "camera", - "style", - "palette", - "camera_motion" + "auto", + "low", + "medium", + "high" ], - "title": "Kind", + "title": "Thinking", "type": "string" }, - "fields": { - "default": [], - "description": "Named tool-specific parameter fields.", - "items": { - "$ref": "#/$defs/ToolField" - }, - "title": "Fields", - "type": "array" - }, - "provenance": { - "anyOf": [ - { - "$ref": "#/$defs/PaletteProvenance" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Recorded origin and execution context." + "maxTokens": { + "default": 8192, + "description": "Maximum generated text tokens.", + "maximum": 32768, + "minimum": 1, + "title": "Maxtokens", + "type": "integer" }, - "palette": { - "anyOf": [ - { - "$ref": "#/$defs/PaletteData" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Reusable palette data." + "kind": { + "const": "text", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" } }, "required": [ "kind" ], - "title": "ToolData", + "title": "TextExecution", "type": "object" }, - "ToolDocument": { + "TextGenerationSpec": { "additionalProperties": false, "properties": { "id": { @@ -15110,225 +14741,20 @@ "title": "Revision", "type": "integer" }, - "schemaVersion": { - "const": 1, - "default": 1, - "description": "Record schema version.", - "title": "Schemaversion", - "type": "integer" - }, - "inputConnections": { - "default": [], - "description": "Persisted connections to source assets.", - "items": { - "$ref": "#/$defs/EditorInputConnection" - }, - "title": "Inputconnections", - "type": "array" - }, - "kind": { - "const": "tool", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" - }, - "data": { - "$ref": "#/$defs/ToolData", - "description": "Typed editable document contents." - } - }, - "required": [ - "id", - "projectId", - "kind", - "data" - ], - "title": "ToolDocument", - "type": "object" - }, - "ToolDraftBinding": { - "additionalProperties": false, - "properties": { - "editorId": { - "description": "Editable document ID.", - "format": "uuid", - "title": "Editorid", - "type": "string" - }, - "editorRevision": { - "description": "Expected editable document revision.", - "minimum": 1, - "title": "Editorrevision", - "type": "integer" - }, - "itemId": { - "description": "Canvas item ID.", - "format": "uuid", - "title": "Itemid", - "type": "string" - }, - "itemRevision": { - "description": "Expected canvas item revision.", - "minimum": 1, - "title": "Itemrevision", - "type": "integer" - } - }, - "required": [ - "editorId", - "editorRevision", - "itemId", - "itemRevision" - ], - "title": "ToolDraftBinding", - "type": "object" - }, - "ToolField": { - "additionalProperties": false, - "properties": { - "name": { - "description": "User-visible name.", - "maxLength": 200, - "minLength": 1, - "title": "Name", - "type": "string" - }, - "values": { - "description": "Ordered tool field values.", - "items": { - "type": "string" - }, - "title": "Values", - "type": "array" - } - }, - "required": [ - "name", - "values" - ], - "title": "ToolField", - "type": "object" - }, - "ToolSelection": { - "additionalProperties": false, - "properties": { - "source": { - "$ref": "#/$defs/AssetRef", - "description": "Input source or recorded provenance." - }, - "width": { - "description": "Width in pixels.", - "minimum": 1, - "title": "Width", - "type": "integer" - }, - "height": { - "description": "Height in pixels.", - "minimum": 1, - "title": "Height", - "type": "integer" - }, - "mask": { - "anyOf": [ - { - "$ref": "#/$defs/AssetRef" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Ordered strokes or encoded selection mask." - }, - "boxes": { - "default": [], - "description": "Selection rectangles in source image pixels.", - "items": { - "$ref": "#/$defs/SelectionBox" - }, - "title": "Boxes", - "type": "array" - } - }, - "required": [ - "source", - "width", - "height" - ], - "title": "ToolSelection", - "type": "object" - }, - "TransformFrame": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", - "type": "string" - }, - "time": { - "description": "Keyframe time in seconds.", - "minimum": 0, - "title": "Time", - "type": "number" - }, - "value": { - "$ref": "#/$defs/StageTransform", - "description": "Keyframed transform or camera pose." - } - }, - "required": [ - "id", - "time", - "value" - ], - "title": "TransformFrame", - "type": "object" - }, - "UploadInfo": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable object ID.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "name": { - "description": "User-visible name.", - "title": "Name", - "type": "string" - }, - "status": { - "description": "Current operation lifecycle state.", + "purpose": { + "default": "draft", + "description": "Draft settings or executable generation configuration.", "enum": [ - "uploading", - "ready", - "registered", - "cancelled" + "draft", + "generation" ], - "title": "Status", + "title": "Purpose", "type": "string" }, - "kind": { + "modelConfigId": { "anyOf": [ { - "enum": [ - "text", - "image", - "video", - "audio", - "file" - ], + "format": "uuid", "type": "string" }, { @@ -15336,36 +14762,47 @@ } ], "default": null, - "description": "Business object or media type.", - "title": "Kind" + "description": "Model configuration ID from the model catalog or user model selections.", + "title": "Modelconfigid" }, - "fingerprint": { - "anyOf": [ - { - "pattern": "^sha256:[0-9a-f]{64}$", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Immutable content fingerprint.", - "title": "Fingerprint" + "prompt": { + "default": "", + "description": "Generation prompt text.", + "maxLength": 20000, + "title": "Prompt", + "type": "string" }, - "metadata": { + "promptContent": { "anyOf": [ { - "$ref": "#/$defs/MediaMetadata" + "items": { + "discriminator": { + "mapping": { + "reference": "#/$defs/PromptReference", + "text": "#/$defs/PromptText" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/$defs/PromptText" + }, + { + "$ref": "#/$defs/PromptReference" + } + ] + }, + "type": "array" }, { "type": "null" } ], "default": null, - "description": "Verified media properties." + "description": "Structured prompt text and reference tokens.", + "title": "Promptcontent" }, - "assetId": { + "currentResultId": { "anyOf": [ { "format": "uuid", @@ -15376,87 +14813,110 @@ } ], "default": null, - "description": "Asset ID.", - "title": "Assetid" + "description": "Currently adopted result ID.", + "title": "Currentresultid" + }, + "kind": { + "const": "text", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "parameters": { + "$ref": "#/$defs/TextParameters", + "description": "Typed generation or editing parameters." } }, "required": [ "id", "projectId", - "name", - "status" + "kind" ], - "title": "UploadInfo", + "title": "TextGenerationSpec", "type": "object" }, - "Vector3": { + "TextLayerContent": { "additionalProperties": false, "properties": { - "x": { - "description": "X component in stage coordinates.", - "title": "X", - "type": "number" + "width": { + "description": "Width in pixels.", + "maximum": 8192, + "minimum": 1, + "title": "Width", + "type": "integer" }, - "y": { - "description": "Y component in stage coordinates.", - "title": "Y", - "type": "number" + "height": { + "description": "Height in pixels.", + "maximum": 8192, + "minimum": 1, + "title": "Height", + "type": "integer" }, - "z": { - "description": "Z component in stage coordinates.", - "title": "Z", + "kind": { + "const": "text", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "text": { + "description": "UTF-8 text content or search query.", + "maxLength": 10000, + "title": "Text", + "type": "string" + }, + "color": { + "description": "Serialized display color.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", + "type": "string" + }, + "fontSize": { + "description": "Text size in pixels.", + "maximum": 1000, + "minimum": 4, + "title": "Fontsize", "type": "number" } }, "required": [ - "x", - "y", - "z" + "width", + "height", + "kind", + "text", + "color", + "fontSize" ], - "title": "Vector3", + "title": "TextLayerContent", "type": "object" }, - "VersionsQuery": { + "TextParameters": { "additionalProperties": false, "properties": { - "queryId": { - "description": "Caller-supplied query ID.", - "format": "uuid", - "title": "Queryid", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "type": { - "description": "Read object versions.", + "thinking": { + "default": "auto", + "description": "Requested reasoning effort.", "enum": [ - "generationSpec.versions", - "canvas.versions" + "auto", + "low", + "medium", + "high" ], - "title": "Type", + "title": "Thinking", "type": "string" }, - "objectId": { - "description": "Target configuration or canvas item ID.", - "format": "uuid", - "title": "Objectid", - "type": "string" + "maxTokens": { + "default": 8192, + "description": "Maximum generated text tokens.", + "maximum": 32768, + "minimum": 1, + "title": "Maxtokens", + "type": "integer" } }, - "required": [ - "queryId", - "projectId", - "type", - "objectId" - ], - "title": "VersionsQuery", + "title": "TextParameters", "type": "object" }, - "VideoCanvasItem": { + "TimelineCanvasItem": { "additionalProperties": false, "properties": { "id": { @@ -15479,7 +14939,7 @@ "type": "integer" }, "kind": { - "const": "video", + "const": "timeline", "description": "Business object or media type.", "title": "Kind", "type": "string" @@ -15568,36 +15028,8 @@ "type": "array" }, "binding": { - "description": "Business object displayed by this canvas item.", - "discriminator": { - "mapping": { - "empty": "#/$defs/EmptyBinding", - "generation": "#/$defs/GenerationBinding", - "material": "#/$defs/MaterialBinding" - }, - "propertyName": "role" - }, - "oneOf": [ - { - "$ref": "#/$defs/EmptyBinding" - }, - { - "$ref": "#/$defs/MaterialBinding" - }, - { - "$ref": "#/$defs/GenerationBinding" - } - ], - "title": "Binding" - }, - "editors": { - "default": [], - "description": "Attached editable documents.", - "items": { - "$ref": "#/$defs/EditorRef" - }, - "title": "Editors", - "type": "array" + "$ref": "#/$defs/EditorBinding", + "description": "Business object displayed by this canvas item." } }, "required": [ @@ -15606,72 +15038,28 @@ "kind", "binding" ], - "title": "VideoCanvasItem", + "title": "TimelineCanvasItem", "type": "object" }, - "VideoCapabilities": { + "TimelineClip": { "additionalProperties": false, "properties": { - "outputs": { - "description": "Supported output resolution and duration combinations.", - "items": { - "$ref": "#/$defs/VideoOutput" - }, - "maxItems": 20, - "minItems": 1, - "title": "Outputs", - "type": "array" - }, - "defaultResolution": { - "default": "auto", - "description": "Default output resolution or auto.", - "title": "Defaultresolution", + "id": { + "description": "Stable object ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Id", "type": "string" }, - "defaultDuration": { - "default": 5, - "description": "Default output duration in seconds.", - "maximum": 60, - "minimum": 1, - "title": "Defaultduration", - "type": "integer" - }, - "dimensionStep": { - "default": 2, - "description": "Required pixel alignment of output dimensions.", - "enum": [ - 1, - 2, - 8, - 16, - 32, - 64 - ], - "title": "Dimensionstep", - "type": "integer" - } - }, - "required": [ - "outputs" - ], - "title": "VideoCapabilities", - "type": "object" - }, - "VideoExecution": { - "additionalProperties": false, - "description": "Resolved adapter parameters, distinct from user intent and source layout.", - "properties": { - "kind": { - "const": "video", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" + "resource": { + "$ref": "#/$defs/TimelineResource", + "description": "Clip source from the imported asset collection." }, - "durationSeconds": { + "start": { "anyOf": [ { - "maximum": 60, - "minimum": 1, + "minimum": 0, "type": "number" }, { @@ -15679,139 +15067,122 @@ } ], "default": null, - "description": "Duration in seconds.", - "title": "Durationseconds" + "description": "Start time in seconds.", + "title": "Start" }, - "size": { - "anyOf": [ - { - "pattern": "^\\d+x\\d+$", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Effective video dimensions sent to the provider.", - "title": "Size" + "inPoint": { + "description": "Source trim start in seconds.", + "minimum": 0, + "title": "Inpoint", + "type": "number" }, - "resolution": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Requested output resolution.", - "title": "Resolution" + "outPoint": { + "description": "Source trim end in seconds.", + "exclusiveMinimum": 0, + "title": "Outpoint", + "type": "number" + }, + "speed": { + "default": 1, + "description": "Playback or motion speed multiplier.", + "exclusiveMinimum": 0, + "title": "Speed", + "type": "number" }, + "volume": { + "default": 1, + "description": "Linear audio gain.", + "maximum": 1, + "minimum": 0, + "title": "Volume", + "type": "number" + }, + "muted": { + "default": false, + "description": "Whether audio output is muted.", + "title": "Muted", + "type": "boolean" + } + }, + "required": [ + "id", + "resource", + "inPoint", + "outPoint" + ], + "title": "TimelineClip", + "type": "object" + }, + "TimelineData": { + "additionalProperties": false, + "properties": { "fps": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, "description": "Frames per second.", - "title": "Fps" + "minimum": 1, + "title": "Fps", + "type": "integer" }, - "numFrames": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Requested video frame count.", - "title": "Numframes" + "width": { + "description": "Width in pixels.", + "minimum": 1, + "title": "Width", + "type": "integer" }, - "numInferenceSteps": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Diffusion sampling step count.", - "title": "Numinferencesteps" + "height": { + "description": "Height in pixels.", + "minimum": 1, + "title": "Height", + "type": "integer" }, - "guidanceScale": { - "anyOf": [ - { - "minimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Diffusion guidance scale.", - "title": "Guidancescale" + "tracks": { + "description": "Ordered timeline tracks.", + "items": { + "$ref": "#/$defs/TimelineTrack" + }, + "minItems": 1, + "title": "Tracks", + "type": "array" }, - "seed": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Random seed, when specified.", - "title": "Seed" + "importedAssets": { + "default": [], + "description": "Source assets available to timeline clips.", + "items": { + "$ref": "#/$defs/TimelineResource" + }, + "title": "Importedassets", + "type": "array" }, - "watermark": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether provider watermarking is enabled.", - "title": "Watermark" + "fonts": { + "default": [], + "description": "Document-local registered font resources; omitted when empty.", + "items": { + "$ref": "#/$defs/TimelineFontResource" + }, + "maxItems": 16, + "title": "Fonts", + "type": "array" }, - "generateAudio": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether video generation includes audio.", - "title": "Generateaudio" + "overlays": { + "default": [], + "description": "Timed text ordered from bottom to top; omitted when empty.", + "items": { + "$ref": "#/$defs/TimelineTextOverlay" + }, + "maxItems": 2000, + "title": "Overlays", + "type": "array" } }, "required": [ - "kind" + "fps", + "width", + "height", + "tracks" ], - "title": "VideoExecution", + "title": "TimelineData", "type": "object" }, - "VideoGenerationSpec": { + "TimelineDocument": { "additionalProperties": false, "properties": { "id": { @@ -15833,141 +15204,143 @@ "title": "Revision", "type": "integer" }, - "purpose": { - "default": "draft", - "description": "Draft settings or executable generation configuration.", - "enum": [ - "draft", - "generation" - ], - "title": "Purpose", - "type": "string" - }, - "modelConfigId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Model configuration ID from the model catalog or user model selections.", - "title": "Modelconfigid" - }, - "prompt": { - "default": "", - "description": "Generation prompt text.", - "maxLength": 20000, - "title": "Prompt", - "type": "string" - }, - "promptContent": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "reference": "#/$defs/PromptReference", - "text": "#/$defs/PromptText" - }, - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/$defs/PromptText" - }, - { - "$ref": "#/$defs/PromptReference" - } - ] - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Structured prompt text and reference tokens.", - "title": "Promptcontent" + "schemaVersion": { + "const": 1, + "default": 1, + "description": "Record schema version.", + "title": "Schemaversion", + "type": "integer" }, - "currentResultId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Currently adopted result ID.", - "title": "Currentresultid" + "inputConnections": { + "default": [], + "description": "Persisted connections to source assets.", + "items": { + "$ref": "#/$defs/EditorInputConnection" + }, + "title": "Inputconnections", + "type": "array" }, "kind": { - "const": "video", + "const": "timeline", "description": "Business object or media type.", "title": "Kind", "type": "string" }, - "parameters": { - "$ref": "#/$defs/VideoParameters", - "description": "Typed generation or editing parameters." + "data": { + "$ref": "#/$defs/TimelineData", + "description": "Typed editable document contents." } }, "required": [ "id", "projectId", - "kind" + "kind", + "data" ], - "title": "VideoGenerationSpec", + "title": "TimelineDocument", "type": "object" }, - "VideoOutput": { + "TimelineFontResource": { "additionalProperties": false, "properties": { - "resolution": { - "description": "Requested output resolution.", - "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,23}$", - "title": "Resolution", + "id": { + "description": "Stable document-local font ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Id", "type": "string" }, - "durations": { - "description": "Supported output durations in seconds.", - "items": { - "maximum": 60, - "minimum": 1, - "type": "integer" - }, - "maxItems": 60, - "minItems": 1, - "title": "Durations", - "type": "array" + "title": { + "description": "Display title of the font.", + "maxLength": 255, + "title": "Title", + "type": "string" }, - "width": { + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable registered font asset version." + } + }, + "required": [ + "id", + "title", + "asset" + ], + "title": "TimelineFontResource", + "type": "object" + }, + "TimelinePackageExportFile": { + "additionalProperties": false, + "properties": { + "editorId": { + "description": "Saved timeline ID in the active project.", + "format": "uuid", + "title": "Editorid", + "type": "string" + }, + "revision": { + "description": "Exact saved revision to export.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "path": { + "description": "New output file under the active execution directory.", + "maxLength": 4096, + "minLength": 1, + "title": "Path", + "type": "string" + } + }, + "required": [ + "editorId", + "revision", + "path" + ], + "title": "TimelinePackageExportFile", + "type": "object" + }, + "TimelinePackageImportFile": { + "additionalProperties": false, + "properties": { + "operationId": { + "description": "Stable import operation identity.", + "format": "uuid", + "title": "Operationid", + "type": "string" + }, + "archiveFingerprint": { + "description": "Expected SHA-256 of archive bytes.", + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Archivefingerprint", + "type": "string" + }, + "path": { + "description": "Existing bundle under the active execution directory.", + "maxLength": 4096, + "minLength": 1, + "title": "Path", + "type": "string" + }, + "replaceEditorId": { "anyOf": [ { - "maximum": 8192, - "minimum": 64, - "type": "integer" + "format": "uuid", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Width in pixels.", - "title": "Width" + "description": "Explicit replacement target.", + "title": "Replaceeditorid" }, - "height": { + "expectedRevision": { "anyOf": [ { - "maximum": 8192, - "minimum": 64, + "minimum": 1, "type": "integer" }, { @@ -15975,57 +15348,68 @@ } ], "default": null, - "description": "Height in pixels.", - "title": "Height" + "description": "Expected replacement revision.", + "title": "Expectedrevision" } }, "required": [ - "resolution", - "durations" + "operationId", + "archiveFingerprint", + "path" ], - "title": "VideoOutput", + "title": "TimelinePackageImportFile", "type": "object" }, - "VideoParameters": { + "TimelinePackageImportReceipt": { "additionalProperties": false, "properties": { - "generateAudio": { - "default": true, - "description": "Include audio; value must be allowed by model inputRules.generateAudioOptions.", - "title": "Generateaudio", - "type": "boolean" + "operationId": { + "description": "Import identity.", + "format": "uuid", + "title": "Operationid", + "type": "string" }, - "videoMode": { - "default": "first_frame", - "description": "Video generation input mode.", + "status": { + "description": "Partial registration, complete publication, or terminal rejection.", "enum": [ - "first_frame", - "reference", - "continuation", - "control" + "registered", + "applied", + "rejected" ], - "title": "Videomode", + "title": "Status", "type": "string" }, - "durationSeconds": { + "editorId": { + "description": "Stable destination document ID.", + "format": "uuid", + "title": "Editorid", + "type": "string" + }, + "registeredAssetIds": { + "default": [], + "description": "Resources actually committed before final publication.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Registeredassetids", + "type": "array" + }, + "receipt": { "anyOf": [ { - "maximum": 60, - "minimum": 1, - "type": "number" + "$ref": "#/$defs/CommandReceipt" }, { "type": "null" } ], "default": null, - "description": "Duration in seconds; fractional values require model inputRules.fractionalDuration. Generated frames may be aligned by the model.", - "title": "Durationseconds" + "description": "Final atomic business command receipt, when committed." }, - "aspectRatio": { + "errorCode": { "anyOf": [ { - "pattern": "^[1-9]\\d?:[1-9]\\d?$", "type": "string" }, { @@ -16033,50 +15417,40 @@ } ], "default": null, - "description": "Output width-to-height ratio.", - "title": "Aspectratio" - }, - "resolution": { - "default": "auto", - "description": "Requested output resolution.", - "pattern": "^(?:auto|[A-Z0-9][A-Z0-9_.-]{0,23})$", - "title": "Resolution", - "type": "string" + "description": "Stable failure code for retryable registration failure.", + "title": "Errorcode" } }, - "title": "VideoParameters", + "required": [ + "operationId", + "status", + "editorId" + ], + "title": "TimelinePackageImportReceipt", "type": "object" }, - "ViewState": { + "TimelinePackageImportRequest": { "additionalProperties": false, "properties": { - "projectId": { - "description": "Owning project ID.", + "operationId": { + "description": "Stable identity for this entire import and all retries.", "format": "uuid", - "title": "Projectid", + "title": "Operationid", "type": "string" }, - "clientId": { - "description": "Client identity for independent view state.", + "uploadHandle": { + "description": "Project/session-owned staged ZIP upload.", "format": "uuid", - "title": "Clientid", + "title": "Uploadhandle", "type": "string" }, - "viewport": { - "$ref": "#/$defs/Viewport", - "description": "Canvas pan and zoom state." - }, - "selectedItemIds": { - "default": [], - "description": "Currently selected canvas item IDs.", - "items": { - "format": "uuid", - "type": "string" - }, - "title": "Selecteditemids", - "type": "array" + "archiveFingerprint": { + "description": "Fixed archive bytes for recovery and replay.", + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Archivefingerprint", + "type": "string" }, - "activeEditorId": { + "replaceEditorId": { "anyOf": [ { "format": "uuid", @@ -16087,113 +15461,169 @@ } ], "default": null, - "description": "Currently active editable document ID.", - "title": "Activeeditorid" + "description": "Explicit replacement target; omitted creates a timeline.", + "title": "Replaceeditorid" }, - "playheads": { + "expectedRevision": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Required original revision for replacement.", + "title": "Expectedrevision" + } + }, + "required": [ + "operationId", + "uploadHandle", + "archiveFingerprint" + ], + "title": "TimelinePackageImportRequest", + "type": "object" + }, + "TimelinePackageManifest": { + "additionalProperties": false, + "properties": { + "format": { + "const": "opendirector-timeline-bundle", + "default": "opendirector-timeline-bundle", + "description": "Native bundle format.", + "title": "Format", + "type": "string" + }, + "version": { + "const": 1, + "default": 1, + "description": "Native bundle format version.", + "title": "Version", + "type": "integer" + }, + "requiredCapabilities": { "default": [], - "description": "Playback positions keyed by editor identity.", + "description": "Required editable document capabilities.", "items": { - "$ref": "#/$defs/Playhead" + "const": "timeline.text.v1", + "type": "string" }, - "title": "Playheads", + "maxItems": 1, + "title": "Requiredcapabilities", "type": "array" }, - "generationCounts": { - "additionalProperties": { - "maximum": 8, - "minimum": 1, - "type": "integer" - }, - "description": "Requested generation counts keyed by canvas item ID.", - "propertyNames": { - "format": "uuid" + "resources": { + "description": "Distinct logical resources; paths may share identical bytes.", + "items": { + "$ref": "#/$defs/TimelinePackageResource" }, - "title": "Generationcounts", - "type": "object" + "maxItems": 4093, + "title": "Resources", + "type": "array" } }, "required": [ - "projectId", - "clientId" + "resources" ], - "title": "ViewState", + "title": "TimelinePackageManifest", "type": "object" }, - "Viewport": { + "TimelinePackageResource": { "additionalProperties": false, "properties": { - "x": { - "default": 0, - "description": "Horizontal coordinate.", - "title": "X", - "type": "number" + "source": { + "$ref": "#/$defs/AssetRef", + "description": "Original logical reference; only a package mapping key." }, - "y": { - "default": 0, - "description": "Vertical coordinate.", - "title": "Y", - "type": "number" + "name": { + "description": "Original resource filename.", + "maxLength": 255, + "minLength": 1, + "title": "Name", + "type": "string" }, - "zoom": { - "default": 1, - "description": "Canvas viewport zoom factor.", - "maximum": 8, - "minimum": 0.08, - "title": "Zoom", - "type": "number" + "path": { + "description": "Content-addressed archive member.", + "pattern": "^assets/[0-9a-f]{64}\\.[a-z0-9]{1,10}$", + "title": "Path", + "type": "string" + }, + "kind": { + "description": "Verified media kind.", + "enum": [ + "text", + "image", + "video", + "audio", + "file" + ], + "title": "Kind", + "type": "string" + }, + "mimeType": { + "description": "Verified MIME type.", + "maxLength": 255, + "minLength": 1, + "title": "Mimetype", + "type": "string" + }, + "size": { + "description": "Actual resource byte count.", + "maximum": 536870912, + "minimum": 0, + "title": "Size", + "type": "integer" + }, + "fingerprint": { + "description": "SHA-256 identity of resource bytes.", + "pattern": "^sha256:[0-9a-f]{64}$", + "title": "Fingerprint", + "type": "string" } }, - "title": "Viewport", + "required": [ + "source", + "name", + "path", + "kind", + "mimeType", + "size", + "fingerprint" + ], + "title": "TimelinePackageResource", "type": "object" }, - "VoiceLibraryCapabilities": { + "TimelinePublishRender": { "additionalProperties": false, "properties": { - "provider": { - "description": "Voice registry protocol.", - "enum": [ - "vllm_omni", - "moss", - "minimax", - "zhipu" - ], - "title": "Provider", + "itemId": { + "description": "Canvas item ID.", + "format": "uuid", + "title": "Itemid", "type": "string" }, - "connectionId": { - "description": "Opaque service, endpoint and account identity.", - "maxLength": 200, - "minLength": 1, - "title": "Connectionid", + "editorId": { + "description": "Editable document ID.", + "format": "uuid", + "title": "Editorid", "type": "string" }, - "requiresTranscript": { - "description": "Registered voice must have a reference transcript.", - "title": "Requirestranscript", - "type": "boolean" - }, - "acceptsTranscript": { - "default": false, - "description": "Registry stores an optional reference transcript when one is supplied.", - "title": "Acceptstranscript", - "type": "boolean" - }, - "requiresReferenceAudio": { - "description": "Registered voice must have actual reference audio.", - "title": "Requiresreferenceaudio", - "type": "boolean" + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." }, - "supportsUploadedVoices": { - "default": true, - "description": "Selected model checkpoint accepts uploaded registry voices.", - "title": "Supportsuploadedvoices", - "type": "boolean" + "outputId": { + "description": "Published canvas output ID.", + "format": "uuid", + "title": "Outputid", + "type": "string" }, - "referenceEmbeddingDimension": { + "expectedOutputRevision": { "anyOf": [ { - "maximum": 65536, "minimum": 1, "type": "integer" }, @@ -16202,163 +15632,1837 @@ } ], "default": null, - "description": "Accepted registered reference embedding dimension; null requires actual reference audio when required.", - "title": "Referenceembeddingdimension" + "description": "Current output node revision when appending a rendered version.", + "title": "Expectedoutputrevision" }, - "canDelete": { - "description": "Provider supports uploaded voice deletion.", - "title": "Candelete", - "type": "boolean" + "title": { + "default": "合成视频", + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" }, - "maxBytes": { - "description": "Maximum audio sample bytes.", - "minimum": 1, - "title": "Maxbytes", - "type": "integer" + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + } + }, + "required": [ + "itemId", + "editorId", + "asset", + "outputId" + ], + "title": "TimelinePublishRender", + "type": "object" + }, + "TimelinePublishRenderCommand": { + "additionalProperties": false, + "description": "Publish a rendered timeline result.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" }, - "formats": { - "description": "Supported recording file extensions.", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "timeline.publishRender", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", "items": { - "type": "string" + "$ref": "#/$defs/ObjectVersion" }, - "title": "Formats", + "title": "Expectedversions", "type": "array" }, - "minSeconds": { + "expectedPreview": { "anyOf": [ { - "type": "number" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], - "description": "Minimum recording duration, if documented.", - "title": "Minseconds" + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "maxSeconds": { + "payload": { + "$ref": "#/$defs/TimelinePublishRender", + "description": "Publish a rendered timeline result." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "payload" + ], + "title": "TimelinePublishRenderCommand", + "type": "object" + }, + "TimelineResource": { + "additionalProperties": false, + "properties": { + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." + }, + "title": { + "description": "Display title of the imported asset.", + "maxLength": 255, + "title": "Title", + "type": "string" + }, + "durationSeconds": { "anyOf": [ { + "exclusiveMinimum": 0, "type": "number" }, { "type": "null" } ], - "description": "Maximum recording duration, if documented.", - "title": "Maxseconds" + "default": null, + "description": "Duration in seconds.", + "title": "Durationseconds" } }, "required": [ - "provider", - "connectionId", - "requiresTranscript", - "requiresReferenceAudio", - "canDelete", - "maxBytes", - "formats", - "minSeconds", - "maxSeconds" + "asset", + "title" ], - "title": "VoiceLibraryCapabilities", + "title": "TimelineResource", "type": "object" }, - "VoiceSelection": { + "TimelineTextBackground": { "additionalProperties": false, "properties": { - "connectionId": { - "description": "Opaque voice service identity.", - "maxLength": 200, - "minLength": 1, - "title": "Connectionid", + "color": { + "description": "Background color in #RRGGBB format.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", "type": "string" }, - "voiceId": { - "description": "Provider voice identity.", - "maxLength": 200, + "opacity": { + "description": "Background opacity.", + "maximum": 1, + "minimum": 0, + "title": "Opacity", + "type": "number" + }, + "padding": { + "description": "Background padding in output pixels.", + "maximum": 128, + "minimum": 0, + "title": "Padding", + "type": "number" + } + }, + "required": [ + "color", + "opacity", + "padding" + ], + "title": "TimelineTextBackground", + "type": "object" + }, + "TimelineTextOverlay": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable document-local text ID.", + "maxLength": 100, "minLength": 1, - "pattern": "^[^/\\\\\\x00-\\x1f\\x7f]+$", - "title": "Voiceid", + "pattern": "\\S", + "title": "Id", "type": "string" }, - "name": { - "description": "Readable provider voice name.", - "maxLength": 255, + "start": { + "description": "Absolute start time in seconds.", + "minimum": 0, + "title": "Start", + "type": "number" + }, + "end": { + "description": "Exclusive absolute end time in seconds.", + "exclusiveMinimum": 0, + "title": "End", + "type": "number" + }, + "text": { + "description": "Plain text normalized to LF, counted in Unicode code points.", + "maxLength": 4096, "minLength": 1, - "title": "Name", + "title": "Text", "type": "string" }, - "source": { - "description": "Provider voice source; used to check checkpoint compatibility.", - "enum": [ - "builtin", - "uploaded" - ], - "title": "Source", - "type": "string" + "x": { + "description": "Normalized text box left position.", + "maximum": 1, + "minimum": 0, + "title": "X", + "type": "number" }, - "hasReferenceAudio": { - "description": "Provider reports a registered reference recording.", - "title": "Hasreferenceaudio", - "type": "boolean" + "y": { + "description": "Normalized text box top position.", + "maximum": 1, + "minimum": 0, + "title": "Y", + "type": "number" }, - "embeddingDim": { - "anyOf": [ - { - "maximum": 65536, - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Registered reference embedding dimension, when the provider reports one.", - "title": "Embeddingdim" + "maxWidth": { + "description": "Text box width as a fraction of output width.", + "exclusiveMinimum": 0, + "maximum": 1, + "title": "Maxwidth", + "type": "number" }, - "refText": { + "fontId": { + "description": "Font resource ID in this document.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Fontid", + "type": "string" + }, + "style": { + "$ref": "#/$defs/TimelineTextStyle", + "description": "Output-space text styling." + }, + "sourceAsset": { "anyOf": [ { - "maxLength": 100000, - "type": "string" + "$ref": "#/$defs/AssetRef" }, { "type": "null" } ], "default": null, - "description": "Provider reference transcript, when available.", - "title": "Reftext" + "description": "Frozen source text asset, independent of subsequent edits." } }, "required": [ - "connectionId", - "voiceId", - "name", - "source", - "hasReferenceAudio" + "id", + "start", + "end", + "text", + "x", + "y", + "maxWidth", + "fontId", + "style" ], - "title": "VoiceSelection", + "title": "TimelineTextOverlay", "type": "object" }, - "WorkflowClip": { + "TimelineTextStroke": { "additionalProperties": false, "properties": { - "itemId": { - "description": "Generation canvas node providing the raw video.", - "format": "uuid", - "title": "Itemid", + "color": { + "description": "Stroke color in #RRGGBB format.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", "type": "string" }, - "inFrame": { - "description": "First retained frame in playback order.", - "maximum": 4095, + "width": { + "description": "Stroke width in output pixels.", + "maximum": 32, "minimum": 0, - "title": "Inframe", - "type": "integer" - }, - "outFrame": { + "title": "Width", + "type": "number" + } + }, + "required": [ + "color", + "width" + ], + "title": "TimelineTextStroke", + "type": "object" + }, + "TimelineTextStyle": { + "additionalProperties": false, + "properties": { + "fontSize": { + "description": "Font size in output pixels.", + "maximum": 512, + "minimum": 1, + "title": "Fontsize", + "type": "number" + }, + "color": { + "description": "Text color in #RRGGBB format.", + "pattern": "^#[0-9a-fA-F]{6}$", + "title": "Color", + "type": "string" + }, + "align": { + "description": "Horizontal text alignment.", + "enum": [ + "left", + "center", + "right" + ], + "title": "Align", + "type": "string" + }, + "lineHeight": { + "description": "Line height as a font size multiplier.", + "maximum": 3, + "minimum": 0.8, + "title": "Lineheight", + "type": "number" + }, + "background": { + "anyOf": [ + { + "$ref": "#/$defs/TimelineTextBackground" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional text background." + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/TimelineTextStroke" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional text stroke." + } + }, + "required": [ + "fontSize", + "color", + "align", + "lineHeight" + ], + "title": "TimelineTextStyle", + "type": "object" + }, + "TimelineTrack": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable object ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Id", + "type": "string" + }, + "kind": { + "description": "Business object or media type.", + "enum": [ + "visual", + "audio" + ], + "title": "Kind", + "type": "string" + }, + "title": { + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" + }, + "muted": { + "default": false, + "description": "Whether audio output is muted.", + "title": "Muted", + "type": "boolean" + }, + "clips": { + "default": [], + "description": "Ordered clips on this track.", + "items": { + "$ref": "#/$defs/TimelineClip" + }, + "title": "Clips", + "type": "array" + } + }, + "required": [ + "id", + "kind", + "title" + ], + "title": "TimelineTrack", + "type": "object" + }, + "ToolCanvasItem": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "kind": { + "const": "tool", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "title": { + "default": "", + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" + }, + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + }, + "width": { + "default": 352, + "description": "Width in pixels.", + "exclusiveMinimum": 0, + "title": "Width", + "type": "number" + }, + "height": { + "default": 198, + "description": "Height in pixels.", + "exclusiveMinimum": 0, + "title": "Height", + "type": "number" + }, + "zIndex": { + "default": 0, + "description": "Canvas stacking order.", + "title": "Zindex", + "type": "integer" + }, + "locked": { + "default": false, + "description": "Whether edits to this object are blocked.", + "title": "Locked", + "type": "boolean" + }, + "color": { + "anyOf": [ + { + "pattern": "^(#[0-9a-fA-F]{6})?$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Group background color in #RRGGBB format.", + "title": "Color" + }, + "visible": { + "default": true, + "description": "Whether this object is displayed.", + "title": "Visible", + "type": "boolean" + }, + "parentId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Parent canvas group ID, or null for the root.", + "title": "Parentid" + }, + "tags": { + "default": [], + "description": "User-defined search tags.", + "items": { + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "type": "string" + }, + "title": "Tags", + "type": "array" + }, + "binding": { + "$ref": "#/$defs/EditorBinding", + "description": "Business object displayed by this canvas item." + } + }, + "required": [ + "id", + "projectId", + "kind", + "binding" + ], + "title": "ToolCanvasItem", + "type": "object" + }, + "ToolData": { + "additionalProperties": false, + "properties": { + "kind": { + "description": "Business object or media type.", + "enum": [ + "camera", + "style", + "palette", + "camera_motion" + ], + "title": "Kind", + "type": "string" + }, + "fields": { + "default": [], + "description": "Named tool-specific parameter fields.", + "items": { + "$ref": "#/$defs/ToolField" + }, + "title": "Fields", + "type": "array" + }, + "provenance": { + "anyOf": [ + { + "$ref": "#/$defs/PaletteProvenance" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Recorded origin and execution context." + }, + "palette": { + "anyOf": [ + { + "$ref": "#/$defs/PaletteData" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Reusable palette data." + } + }, + "required": [ + "kind" + ], + "title": "ToolData", + "type": "object" + }, + "ToolDocument": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "schemaVersion": { + "const": 1, + "default": 1, + "description": "Record schema version.", + "title": "Schemaversion", + "type": "integer" + }, + "inputConnections": { + "default": [], + "description": "Persisted connections to source assets.", + "items": { + "$ref": "#/$defs/EditorInputConnection" + }, + "title": "Inputconnections", + "type": "array" + }, + "kind": { + "const": "tool", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "data": { + "$ref": "#/$defs/ToolData", + "description": "Typed editable document contents." + } + }, + "required": [ + "id", + "projectId", + "kind", + "data" + ], + "title": "ToolDocument", + "type": "object" + }, + "ToolDraftBinding": { + "additionalProperties": false, + "properties": { + "editorId": { + "description": "Editable document ID.", + "format": "uuid", + "title": "Editorid", + "type": "string" + }, + "editorRevision": { + "description": "Expected editable document revision.", + "minimum": 1, + "title": "Editorrevision", + "type": "integer" + }, + "itemId": { + "description": "Canvas item ID.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "itemRevision": { + "description": "Expected canvas item revision.", + "minimum": 1, + "title": "Itemrevision", + "type": "integer" + } + }, + "required": [ + "editorId", + "editorRevision", + "itemId", + "itemRevision" + ], + "title": "ToolDraftBinding", + "type": "object" + }, + "ToolField": { + "additionalProperties": false, + "properties": { + "name": { + "description": "User-visible name.", + "maxLength": 200, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "values": { + "description": "Ordered tool field values.", + "items": { + "type": "string" + }, + "title": "Values", + "type": "array" + } + }, + "required": [ + "name", + "values" + ], + "title": "ToolField", + "type": "object" + }, + "ToolSelection": { + "additionalProperties": false, + "properties": { + "source": { + "$ref": "#/$defs/AssetRef", + "description": "Input source or recorded provenance." + }, + "width": { + "description": "Width in pixels.", + "minimum": 1, + "title": "Width", + "type": "integer" + }, + "height": { + "description": "Height in pixels.", + "minimum": 1, + "title": "Height", + "type": "integer" + }, + "mask": { + "anyOf": [ + { + "$ref": "#/$defs/AssetRef" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ordered strokes or encoded selection mask." + }, + "boxes": { + "default": [], + "description": "Selection rectangles in source image pixels.", + "items": { + "$ref": "#/$defs/SelectionBox" + }, + "title": "Boxes", + "type": "array" + } + }, + "required": [ + "source", + "width", + "height" + ], + "title": "ToolSelection", + "type": "object" + }, + "TransformFrame": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable object ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Id", + "type": "string" + }, + "time": { + "description": "Keyframe time in seconds.", + "minimum": 0, + "title": "Time", + "type": "number" + }, + "value": { + "$ref": "#/$defs/StageTransform", + "description": "Keyframed transform or camera pose." + } + }, + "required": [ + "id", + "time", + "value" + ], + "title": "TransformFrame", + "type": "object" + }, + "UploadInfo": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable object ID.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "name": { + "description": "User-visible name.", + "title": "Name", + "type": "string" + }, + "status": { + "description": "Current operation lifecycle state.", + "enum": [ + "uploading", + "ready", + "registered", + "cancelled" + ], + "title": "Status", + "type": "string" + }, + "kind": { + "anyOf": [ + { + "enum": [ + "text", + "image", + "video", + "audio", + "file" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Business object or media type.", + "title": "Kind" + }, + "fingerprint": { + "anyOf": [ + { + "pattern": "^sha256:[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Immutable content fingerprint.", + "title": "Fingerprint" + }, + "metadata": { + "anyOf": [ + { + "$ref": "#/$defs/MediaMetadata" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Verified media properties." + }, + "assetId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Asset ID.", + "title": "Assetid" + } + }, + "required": [ + "id", + "projectId", + "name", + "status" + ], + "title": "UploadInfo", + "type": "object" + }, + "Vector3": { + "additionalProperties": false, + "properties": { + "x": { + "description": "X component in stage coordinates.", + "title": "X", + "type": "number" + }, + "y": { + "description": "Y component in stage coordinates.", + "title": "Y", + "type": "number" + }, + "z": { + "description": "Z component in stage coordinates.", + "title": "Z", + "type": "number" + } + }, + "required": [ + "x", + "y", + "z" + ], + "title": "Vector3", + "type": "object" + }, + "VersionsQuery": { + "additionalProperties": false, + "properties": { + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "description": "Read object versions.", + "enum": [ + "generationSpec.versions", + "canvas.versions" + ], + "title": "Type", + "type": "string" + }, + "objectId": { + "description": "Target configuration or canvas item ID.", + "format": "uuid", + "title": "Objectid", + "type": "string" + } + }, + "required": [ + "queryId", + "projectId", + "type", + "objectId" + ], + "title": "VersionsQuery", + "type": "object" + }, + "VideoCanvasItem": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "kind": { + "const": "video", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "title": { + "default": "", + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" + }, + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + }, + "width": { + "default": 352, + "description": "Width in pixels.", + "exclusiveMinimum": 0, + "title": "Width", + "type": "number" + }, + "height": { + "default": 198, + "description": "Height in pixels.", + "exclusiveMinimum": 0, + "title": "Height", + "type": "number" + }, + "zIndex": { + "default": 0, + "description": "Canvas stacking order.", + "title": "Zindex", + "type": "integer" + }, + "locked": { + "default": false, + "description": "Whether edits to this object are blocked.", + "title": "Locked", + "type": "boolean" + }, + "color": { + "anyOf": [ + { + "pattern": "^(#[0-9a-fA-F]{6})?$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Group background color in #RRGGBB format.", + "title": "Color" + }, + "visible": { + "default": true, + "description": "Whether this object is displayed.", + "title": "Visible", + "type": "boolean" + }, + "parentId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Parent canvas group ID, or null for the root.", + "title": "Parentid" + }, + "tags": { + "default": [], + "description": "User-defined search tags.", + "items": { + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "type": "string" + }, + "title": "Tags", + "type": "array" + }, + "binding": { + "description": "Business object displayed by this canvas item.", + "discriminator": { + "mapping": { + "empty": "#/$defs/EmptyBinding", + "generation": "#/$defs/GenerationBinding", + "material": "#/$defs/MaterialBinding" + }, + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/$defs/EmptyBinding" + }, + { + "$ref": "#/$defs/MaterialBinding" + }, + { + "$ref": "#/$defs/GenerationBinding" + } + ], + "title": "Binding" + }, + "editors": { + "default": [], + "description": "Attached editable documents.", + "items": { + "$ref": "#/$defs/EditorRef" + }, + "title": "Editors", + "type": "array" + } + }, + "required": [ + "id", + "projectId", + "kind", + "binding" + ], + "title": "VideoCanvasItem", + "type": "object" + }, + "VideoCapabilities": { + "additionalProperties": false, + "properties": { + "outputs": { + "description": "Supported output resolution and duration combinations.", + "items": { + "$ref": "#/$defs/VideoOutput" + }, + "maxItems": 20, + "minItems": 1, + "title": "Outputs", + "type": "array" + }, + "defaultResolution": { + "default": "auto", + "description": "Default output resolution or auto.", + "title": "Defaultresolution", + "type": "string" + }, + "defaultDuration": { + "default": 5, + "description": "Default output duration in seconds.", + "maximum": 60, + "minimum": 1, + "title": "Defaultduration", + "type": "integer" + }, + "dimensionStep": { + "default": 2, + "description": "Required pixel alignment of output dimensions.", + "enum": [ + 1, + 2, + 8, + 16, + 32, + 64 + ], + "title": "Dimensionstep", + "type": "integer" + } + }, + "required": [ + "outputs" + ], + "title": "VideoCapabilities", + "type": "object" + }, + "VideoExecution": { + "additionalProperties": false, + "description": "Resolved adapter parameters, distinct from user intent and source layout.", + "properties": { + "kind": { + "const": "video", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "durationSeconds": { + "anyOf": [ + { + "maximum": 60, + "minimum": 1, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Duration in seconds.", + "title": "Durationseconds" + }, + "size": { + "anyOf": [ + { + "pattern": "^\\d+x\\d+$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Effective video dimensions sent to the provider.", + "title": "Size" + }, + "resolution": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Requested output resolution.", + "title": "Resolution" + }, + "fps": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Frames per second.", + "title": "Fps" + }, + "numFrames": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Requested video frame count.", + "title": "Numframes" + }, + "numInferenceSteps": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Diffusion sampling step count.", + "title": "Numinferencesteps" + }, + "guidanceScale": { + "anyOf": [ + { + "minimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Diffusion guidance scale.", + "title": "Guidancescale" + }, + "seed": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Random seed, when specified.", + "title": "Seed" + }, + "watermark": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether provider watermarking is enabled.", + "title": "Watermark" + }, + "generateAudio": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether video generation includes audio.", + "title": "Generateaudio" + } + }, + "required": [ + "kind" + ], + "title": "VideoExecution", + "type": "object" + }, + "VideoGenerationSpec": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "purpose": { + "default": "draft", + "description": "Draft settings or executable generation configuration.", + "enum": [ + "draft", + "generation" + ], + "title": "Purpose", + "type": "string" + }, + "modelConfigId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Model configuration ID from the model catalog or user model selections.", + "title": "Modelconfigid" + }, + "prompt": { + "default": "", + "description": "Generation prompt text.", + "maxLength": 20000, + "title": "Prompt", + "type": "string" + }, + "promptContent": { + "anyOf": [ + { + "items": { + "discriminator": { + "mapping": { + "reference": "#/$defs/PromptReference", + "text": "#/$defs/PromptText" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/$defs/PromptText" + }, + { + "$ref": "#/$defs/PromptReference" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Structured prompt text and reference tokens.", + "title": "Promptcontent" + }, + "currentResultId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Currently adopted result ID.", + "title": "Currentresultid" + }, + "kind": { + "const": "video", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "parameters": { + "$ref": "#/$defs/VideoParameters", + "description": "Typed generation or editing parameters." + } + }, + "required": [ + "id", + "projectId", + "kind" + ], + "title": "VideoGenerationSpec", + "type": "object" + }, + "VideoOutput": { + "additionalProperties": false, + "properties": { + "resolution": { + "description": "Requested output resolution.", + "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,23}$", + "title": "Resolution", + "type": "string" + }, + "durations": { + "description": "Supported output durations in seconds.", + "items": { + "maximum": 60, + "minimum": 1, + "type": "integer" + }, + "maxItems": 60, + "minItems": 1, + "title": "Durations", + "type": "array" + }, + "width": { + "anyOf": [ + { + "maximum": 8192, + "minimum": 64, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Width in pixels.", + "title": "Width" + }, + "height": { + "anyOf": [ + { + "maximum": 8192, + "minimum": 64, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Height in pixels.", + "title": "Height" + } + }, + "required": [ + "resolution", + "durations" + ], + "title": "VideoOutput", + "type": "object" + }, + "VideoParameters": { + "additionalProperties": false, + "properties": { + "generateAudio": { + "default": true, + "description": "Include audio; value must be allowed by model inputRules.generateAudioOptions.", + "title": "Generateaudio", + "type": "boolean" + }, + "videoMode": { + "default": "first_frame", + "description": "Video generation input mode.", + "enum": [ + "first_frame", + "reference", + "continuation", + "control" + ], + "title": "Videomode", + "type": "string" + }, + "durationSeconds": { + "anyOf": [ + { + "maximum": 60, + "minimum": 1, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Duration in seconds; fractional values require model inputRules.fractionalDuration. Generated frames may be aligned by the model.", + "title": "Durationseconds" + }, + "aspectRatio": { + "anyOf": [ + { + "pattern": "^[1-9]\\d?:[1-9]\\d?$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Output width-to-height ratio.", + "title": "Aspectratio" + }, + "resolution": { + "default": "auto", + "description": "Requested output resolution.", + "pattern": "^(?:auto|[A-Z0-9][A-Z0-9_.-]{0,23})$", + "title": "Resolution", + "type": "string" + } + }, + "title": "VideoParameters", + "type": "object" + }, + "ViewState": { + "additionalProperties": false, + "properties": { + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "clientId": { + "description": "Client identity for independent view state.", + "format": "uuid", + "title": "Clientid", + "type": "string" + }, + "viewport": { + "$ref": "#/$defs/Viewport", + "description": "Canvas pan and zoom state." + }, + "selectedItemIds": { + "default": [], + "description": "Currently selected canvas item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Selecteditemids", + "type": "array" + }, + "activeEditorId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Currently active editable document ID.", + "title": "Activeeditorid" + }, + "playheads": { + "default": [], + "description": "Playback positions keyed by editor identity.", + "items": { + "$ref": "#/$defs/Playhead" + }, + "title": "Playheads", + "type": "array" + }, + "generationCounts": { + "additionalProperties": { + "maximum": 8, + "minimum": 1, + "type": "integer" + }, + "description": "Requested generation counts keyed by canvas item ID.", + "propertyNames": { + "format": "uuid" + }, + "title": "Generationcounts", + "type": "object" + } + }, + "required": [ + "projectId", + "clientId" + ], + "title": "ViewState", + "type": "object" + }, + "Viewport": { + "additionalProperties": false, + "properties": { + "x": { + "default": 0, + "description": "Horizontal coordinate.", + "title": "X", + "type": "number" + }, + "y": { + "default": 0, + "description": "Vertical coordinate.", + "title": "Y", + "type": "number" + }, + "zoom": { + "default": 1, + "description": "Canvas viewport zoom factor.", + "maximum": 8, + "minimum": 0.08, + "title": "Zoom", + "type": "number" + } + }, + "title": "Viewport", + "type": "object" + }, + "VoiceLibraryCapabilities": { + "additionalProperties": false, + "properties": { + "provider": { + "description": "Voice registry protocol.", + "enum": [ + "vllm_omni", + "moss", + "minimax", + "zhipu" + ], + "title": "Provider", + "type": "string" + }, + "connectionId": { + "description": "Opaque service, endpoint and account identity.", + "maxLength": 200, + "minLength": 1, + "title": "Connectionid", + "type": "string" + }, + "requiresTranscript": { + "description": "Registered voice must have a reference transcript.", + "title": "Requirestranscript", + "type": "boolean" + }, + "acceptsTranscript": { + "default": false, + "description": "Registry stores an optional reference transcript when one is supplied.", + "title": "Acceptstranscript", + "type": "boolean" + }, + "requiresReferenceAudio": { + "description": "Registered voice must have actual reference audio.", + "title": "Requiresreferenceaudio", + "type": "boolean" + }, + "supportsUploadedVoices": { + "default": true, + "description": "Selected model checkpoint accepts uploaded registry voices.", + "title": "Supportsuploadedvoices", + "type": "boolean" + }, + "referenceEmbeddingDimension": { + "anyOf": [ + { + "maximum": 65536, + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Accepted registered reference embedding dimension; null requires actual reference audio when required.", + "title": "Referenceembeddingdimension" + }, + "canDelete": { + "description": "Provider supports uploaded voice deletion.", + "title": "Candelete", + "type": "boolean" + }, + "maxBytes": { + "description": "Maximum audio sample bytes.", + "minimum": 1, + "title": "Maxbytes", + "type": "integer" + }, + "formats": { + "description": "Supported recording file extensions.", + "items": { + "type": "string" + }, + "title": "Formats", + "type": "array" + }, + "minSeconds": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "Minimum recording duration, if documented.", + "title": "Minseconds" + }, + "maxSeconds": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "Maximum recording duration, if documented.", + "title": "Maxseconds" + } + }, + "required": [ + "provider", + "connectionId", + "requiresTranscript", + "requiresReferenceAudio", + "canDelete", + "maxBytes", + "formats", + "minSeconds", + "maxSeconds" + ], + "title": "VoiceLibraryCapabilities", + "type": "object" + }, + "VoiceSelection": { + "additionalProperties": false, + "properties": { + "connectionId": { + "description": "Opaque voice service identity.", + "maxLength": 200, + "minLength": 1, + "title": "Connectionid", + "type": "string" + }, + "voiceId": { + "description": "Provider voice identity.", + "maxLength": 200, + "minLength": 1, + "pattern": "^[^/\\\\\\x00-\\x1f\\x7f]+$", + "title": "Voiceid", + "type": "string" + }, + "name": { + "description": "Readable provider voice name.", + "maxLength": 255, + "minLength": 1, + "title": "Name", + "type": "string" + }, + "source": { + "description": "Provider voice source; used to check checkpoint compatibility.", + "enum": [ + "builtin", + "uploaded" + ], + "title": "Source", + "type": "string" + }, + "hasReferenceAudio": { + "description": "Provider reports a registered reference recording.", + "title": "Hasreferenceaudio", + "type": "boolean" + }, + "embeddingDim": { + "anyOf": [ + { + "maximum": 65536, + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Registered reference embedding dimension, when the provider reports one.", + "title": "Embeddingdim" + }, + "refText": { + "anyOf": [ + { + "maxLength": 100000, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Provider reference transcript, when available.", + "title": "Reftext" + } + }, + "required": [ + "connectionId", + "voiceId", + "name", + "source", + "hasReferenceAudio" + ], + "title": "VoiceSelection", + "type": "object" + }, + "WorkflowClip": { + "additionalProperties": false, + "properties": { + "itemId": { + "description": "Generation canvas node providing the raw video.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "inFrame": { + "description": "First retained frame in playback order.", + "maximum": 4095, + "minimum": 0, + "title": "Inframe", + "type": "integer" + }, + "outFrame": { "description": "Exclusive end of the retained frames.", "maximum": 4096, "minimum": 1, @@ -16562,6 +17666,7 @@ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand", "canvas.hide": "#/$defs/CanvasHideCommand", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommand", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommand", "canvas.materialize": "#/$defs/CanvasMaterializeCommand", "canvas.move": "#/$defs/CanvasMoveCommand", @@ -16583,6 +17688,12 @@ "job.cancel": "#/$defs/JobCancelCommand", "job.checkpoint": "#/$defs/JobCheckpointCommand", "job.recover": "#/$defs/JobRecoverCommand", + "pipeline.adopt": "#/$defs/PipelineAdoptCommand", + "pipeline.cancel": "#/$defs/PipelineCancelCommand", + "pipeline.pause": "#/$defs/PipelinePauseCommand", + "pipeline.resume": "#/$defs/PipelineResumeCommand", + "pipeline.retry": "#/$defs/PipelineRetryCommand", + "pipeline.start": "#/$defs/PipelineStartCommand", "project.create": "#/$defs/ProjectCreateCommand", "project.rename": "#/$defs/ProjectRenameCommand", "project.restore": "#/$defs/ProjectRestoreCommand", @@ -16645,6 +17756,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommand" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommand" + }, { "$ref": "#/$defs/CanvasHideCommand" }, @@ -16660,6 +17774,24 @@ { "$ref": "#/$defs/TimelinePublishRenderCommand" }, + { + "$ref": "#/$defs/PipelineStartCommand" + }, + { + "$ref": "#/$defs/PipelinePauseCommand" + }, + { + "$ref": "#/$defs/PipelineResumeCommand" + }, + { + "$ref": "#/$defs/PipelineCancelCommand" + }, + { + "$ref": "#/$defs/PipelineRetryCommand" + }, + { + "$ref": "#/$defs/PipelineAdoptCommand" + }, { "$ref": "#/$defs/NodeVersionApplyCommand" }, @@ -16746,6 +17878,9 @@ "job.get": "#/$defs/ObjectQuery", "job.status": "#/$defs/JobStatusQuery", "object.get": "#/$defs/ObjectQuery", + "pipeline.execution.get": "#/$defs/PipelineExecutionQuery", + "pipeline.executions.list": "#/$defs/PipelineExecutionsQuery", + "pipeline.plan": "#/$defs/PipelinePlanQuery", "project.get": "#/$defs/ProjectQuery" }, "propertyName": "type" @@ -16774,6 +17909,15 @@ }, { "$ref": "#/$defs/AssetPreviewQuery" + }, + { + "$ref": "#/$defs/PipelinePlanQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionsQuery" } ], "title": "Query" @@ -18499,6 +19643,7 @@ "canvas.configure": "#/$defs/CanvasConfigureCommandOperation", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommandOperation", "canvas.hide": "#/$defs/CanvasHideCommandOperation", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommandOperation", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommandOperation", "canvas.materialize": "#/$defs/CanvasMaterializeCommandOperation", "canvas.move": "#/$defs/CanvasMoveCommandOperation", @@ -18530,6 +19675,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommandOperation" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommandOperation" + }, { "$ref": "#/$defs/CanvasHideCommandOperation" }, @@ -19530,9 +20678,92 @@ "title": "CanvasItemVersion", "type": "object" }, + "CanvasLayoutPipelinesCommand": { + "additionalProperties": false, + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "canvas.layoutPipelines", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/EmptyPayload", + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" + ], + "title": "CanvasLayoutPipelinesCommand", + "type": "object" + }, + "CanvasLayoutPipelinesCommandOperation": { + "additionalProperties": false, + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups.", + "properties": { + "type": { + "const": "canvas.layoutPipelines", + "description": "Operation discriminator.", + "title": "Type", + "type": "string" + }, + "payload": { + "$ref": "#/$defs/EmptyPayload", + "description": "Arrange the current canvas Pipeline groups and their children without moving locked groups." + } + }, + "required": [ + "type", + "payload" + ], + "title": "CanvasLayoutPipelinesCommandOperation", + "type": "object" + }, "CanvasLayoutRunsCommand": { "additionalProperties": false, - "description": "Arrange the current canvas Run groups and their children without moving locked groups.", + "description": "Arrange the current canvas Run groups.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -19577,7 +20808,7 @@ }, "payload": { "$ref": "#/$defs/EmptyPayload", - "description": "Arrange the current canvas Run groups and their children without moving locked groups." + "description": "Arrange the current canvas Run groups." } }, "required": [ @@ -19593,7 +20824,7 @@ }, "CanvasLayoutRunsCommandOperation": { "additionalProperties": false, - "description": "Arrange the current canvas Run groups and their children without moving locked groups.", + "description": "Arrange the current canvas Run groups.", "properties": { "type": { "const": "canvas.layoutRuns", @@ -19603,7 +20834,7 @@ }, "payload": { "$ref": "#/$defs/EmptyPayload", - "description": "Arrange the current canvas Run groups and their children without moving locked groups." + "description": "Arrange the current canvas Run groups." } }, "required": [ @@ -19958,6 +21189,7 @@ { "enum": [ "run", + "pipeline", "free" ], "type": "string" @@ -19967,7 +21199,7 @@ } ], "default": null, - "description": "Enable Run layout for a top-level group, or use free to return it to manual layout.", + "description": "Enable Pipeline layout for a top-level group, or use free to return it to manual layout.", "title": "Autolayout" } }, @@ -20844,6 +22076,20 @@ "default": null, "description": "Latest committed project event cursor.", "title": "Eventcursor" + }, + "pipelineExecutionId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Durable execution created or updated by a Pipeline command.", + "title": "Pipelineexecutionid" } }, "required": [ @@ -20859,6 +22105,185 @@ "title": "CommandReceipt", "type": "object" }, + "CompiledPipelineGraph": { + "additionalProperties": false, + "properties": { + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "scope": { + "description": "Requested execution scope.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/GroupPipelineScope" + }, + { + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" + } + ], + "title": "Scope" + }, + "cachePolicy": { + "description": "Cache reuse policy applied during compilation.", + "enum": [ + "reuse", + "force_from_node", + "force_all" + ], + "title": "Cachepolicy", + "type": "string" + }, + "steps": { + "default": [], + "description": "Compiled pipeline steps in topological order.", + "items": { + "$ref": "#/$defs/CompiledPipelineStep" + }, + "title": "Steps", + "type": "array" + }, + "topologicalOrder": { + "default": [], + "description": "Deterministic topological execution order of step item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Topologicalorder", + "type": "array" + }, + "issues": { + "default": [], + "description": "Pre-flight validation or cycle issues.", + "items": { + "$ref": "#/$defs/PipelineStepIssue" + }, + "title": "Issues", + "type": "array" + }, + "plannedNewJobs": { + "default": 0, + "description": "Number of non-cached steps that will submit new jobs.", + "minimum": 0, + "title": "Plannednewjobs", + "type": "integer" + } + }, + "required": [ + "projectId", + "scope", + "cachePolicy", + "steps", + "topologicalOrder", + "issues", + "plannedNewJobs" + ], + "title": "CompiledPipelineGraph", + "type": "object" + }, + "CompiledPipelineStep": { + "additionalProperties": false, + "properties": { + "itemId": { + "description": "Canvas item ID for this execution step.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "kind": { + "description": "Execution step category.", + "enum": [ + "generation", + "assembly" + ], + "title": "Kind", + "type": "string" + }, + "upstreamItemIds": { + "default": [], + "description": "Direct upstream step item IDs in this pipeline.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Upstreamitemids", + "type": "array" + }, + "inputFingerprint": { + "description": "Deterministic fingerprint of this step inputs and upstream chain.", + "pattern": "^[0-9a-f]{64}$", + "title": "Inputfingerprint", + "type": "string" + }, + "cached": { + "default": false, + "description": "Whether an existing adopted result satisfies this step without re-running.", + "title": "Cached", + "type": "boolean" + }, + "cacheCandidateJobId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Existing succeeded job ID reused when cached is true.", + "title": "Cachecandidatejobid" + }, + "cacheCandidateAssetId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Existing adopted asset ID reused when cached is true.", + "title": "Cachecandidateassetid" + }, + "expectedVersions": { + "default": [], + "description": "Optimistic concurrency versions captured at compile time.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + } + }, + "required": [ + "itemId", + "kind", + "upstreamItemIds", + "inputFingerprint", + "cached", + "expectedVersions" + ], + "title": "CompiledPipelineStep", + "type": "object" + }, "ContainerBinding": { "additionalProperties": false, "properties": { @@ -21220,6 +22645,7 @@ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand", "canvas.hide": "#/$defs/CanvasHideCommand", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommand", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommand", "canvas.materialize": "#/$defs/CanvasMaterializeCommand", "canvas.move": "#/$defs/CanvasMoveCommand", @@ -21241,6 +22667,12 @@ "job.cancel": "#/$defs/JobCancelCommand", "job.checkpoint": "#/$defs/JobCheckpointCommand", "job.recover": "#/$defs/JobRecoverCommand", + "pipeline.adopt": "#/$defs/PipelineAdoptCommand", + "pipeline.cancel": "#/$defs/PipelineCancelCommand", + "pipeline.pause": "#/$defs/PipelinePauseCommand", + "pipeline.resume": "#/$defs/PipelineResumeCommand", + "pipeline.retry": "#/$defs/PipelineRetryCommand", + "pipeline.start": "#/$defs/PipelineStartCommand", "project.create": "#/$defs/ProjectCreateCommand", "project.rename": "#/$defs/ProjectRenameCommand", "project.restore": "#/$defs/ProjectRestoreCommand", @@ -21303,6 +22735,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommand" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommand" + }, { "$ref": "#/$defs/CanvasHideCommand" }, @@ -21318,6 +22753,24 @@ { "$ref": "#/$defs/TimelinePublishRenderCommand" }, + { + "$ref": "#/$defs/PipelineStartCommand" + }, + { + "$ref": "#/$defs/PipelinePauseCommand" + }, + { + "$ref": "#/$defs/PipelineResumeCommand" + }, + { + "$ref": "#/$defs/PipelineCancelCommand" + }, + { + "$ref": "#/$defs/PipelineRetryCommand" + }, + { + "$ref": "#/$defs/PipelineAdoptCommand" + }, { "$ref": "#/$defs/NodeVersionApplyCommand" }, @@ -21404,6 +22857,9 @@ "job.get": "#/$defs/ObjectQuery", "job.status": "#/$defs/JobStatusQuery", "object.get": "#/$defs/ObjectQuery", + "pipeline.execution.get": "#/$defs/PipelineExecutionQuery", + "pipeline.executions.list": "#/$defs/PipelineExecutionsQuery", + "pipeline.plan": "#/$defs/PipelinePlanQuery", "project.get": "#/$defs/ProjectQuery" }, "propertyName": "type" @@ -21432,6 +22888,15 @@ }, { "$ref": "#/$defs/AssetPreviewQuery" + }, + { + "$ref": "#/$defs/PipelinePlanQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionsQuery" } ], "title": "Query" @@ -22702,6 +24167,43 @@ "title": "FollowingSource", "type": "object" }, + "FromNodePipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "from_node", + "description": "Run from one node through its downstream dependents.", + "title": "Kind", + "type": "string" + }, + "itemId": { + "description": "Starting canvas item ID.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "groupId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional group boundary limiting downstream traversal.", + "title": "Groupid" + } + }, + "required": [ + "kind", + "itemId" + ], + "title": "FromNodePipelineScope", + "type": "object" + }, "GenerationBinding": { "additionalProperties": false, "description": "Displays a generation configuration and its adopted result.", @@ -23308,7 +24810,10 @@ "autoLayout": { "anyOf": [ { - "const": "run", + "enum": [ + "run", + "pipeline" + ], "type": "string" }, { @@ -23316,7 +24821,7 @@ } ], "default": null, - "description": "Set to run to opt this top-level group into shared Run layout. Put its plan, clips and timeline under this group ID.", + "description": "Opt this top-level group into automatic layout for Runs or Pipelines.", "title": "Autolayout" }, "runPlan": { @@ -23438,6 +24943,29 @@ "title": "GroupCanvasItem", "type": "object" }, + "GroupPipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "group", + "description": "Run all executable nodes inside a canvas group.", + "title": "Kind", + "type": "string" + }, + "groupId": { + "description": "Target canvas group ID.", + "format": "uuid", + "title": "Groupid", + "type": "string" + } + }, + "required": [ + "kind", + "groupId" + ], + "title": "GroupPipelineScope", + "type": "object" + }, "GroupPlanDraft": { "additionalProperties": false, "examples": [ @@ -25750,27 +27278,439 @@ "title": "Background", "type": "string" }, - "layers": { + "layers": { + "default": [], + "description": "Ordered editable image layers.", + "items": { + "$ref": "#/$defs/ImageLayer" + }, + "maxItems": 40, + "title": "Layers", + "type": "array" + } + }, + "required": [ + "width", + "height", + "background", + "layers" + ], + "title": "LayerData", + "type": "object" + }, + "LayerDocument": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "schemaVersion": { + "const": 1, + "default": 1, + "description": "Record schema version.", + "title": "Schemaversion", + "type": "integer" + }, + "inputConnections": { + "default": [], + "description": "Persisted connections to source assets.", + "items": { + "$ref": "#/$defs/EditorInputConnection" + }, + "title": "Inputconnections", + "type": "array" + }, + "kind": { + "const": "layers", + "description": "Business object or media type.", + "title": "Kind", + "type": "string" + }, + "data": { + "$ref": "#/$defs/LayerData", + "description": "Typed editable document contents." + } + }, + "required": [ + "id", + "projectId", + "revision", + "schemaVersion", + "inputConnections", + "kind", + "data" + ], + "title": "LayerDocument", + "type": "object" + }, + "MaskStroke": { + "additionalProperties": false, + "properties": { + "mode": { + "description": "Operation mode within this contract variant.", + "enum": [ + "erase", + "restore" + ], + "title": "Mode", + "type": "string" + }, + "size": { + "description": "Mask brush diameter in pixels.", + "maximum": 4096, + "minimum": 1, + "title": "Size", + "type": "number" + }, + "points": { + "description": "Ordered mask stroke coordinates.", + "items": { + "$ref": "#/$defs/Point" + }, + "maxItems": 200000, + "minItems": 1, + "title": "Points", + "type": "array" + } + }, + "required": [ + "mode", + "size", + "points" + ], + "title": "MaskStroke", + "type": "object" + }, + "MaterialBinding": { + "additionalProperties": false, + "description": "Displays a registered project asset through objectRef.", + "properties": { + "role": { + "const": "material", + "description": "Business role of this binding or reference.", + "title": "Role", + "type": "string" + }, + "objectRef": { + "$ref": "#/$defs/AssetRef", + "description": "Stable reference to the bound business object." + } + }, + "required": [ + "role", + "objectRef" + ], + "title": "MaterialBinding", + "type": "object" + }, + "MediaCanvasItem": { + "additionalProperties": false, + "properties": { + "id": { + "description": "Stable identity of this project-owned object.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "kind": { + "description": "Business object or media type.", + "enum": [ + "text", + "image", + "video", + "audio", + "file", + "group", + "timeline", + "subject", + "stack", + "tool", + "external" + ], + "title": "Kind", + "type": "string" + }, + "title": { + "default": "", + "description": "User-visible title.", + "maxLength": 255, + "title": "Title", + "type": "string" + }, + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + }, + "width": { + "default": 352, + "description": "Width in pixels.", + "exclusiveMinimum": 0, + "title": "Width", + "type": "number" + }, + "height": { + "default": 198, + "description": "Height in pixels.", + "exclusiveMinimum": 0, + "title": "Height", + "type": "number" + }, + "zIndex": { + "default": 0, + "description": "Canvas stacking order.", + "title": "Zindex", + "type": "integer" + }, + "locked": { + "default": false, + "description": "Whether edits to this object are blocked.", + "title": "Locked", + "type": "boolean" + }, + "color": { + "anyOf": [ + { + "pattern": "^(#[0-9a-fA-F]{6})?$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Group background color in #RRGGBB format.", + "title": "Color" + }, + "visible": { + "default": true, + "description": "Whether this object is displayed.", + "title": "Visible", + "type": "boolean" + }, + "parentId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Parent canvas group ID, or null for the root.", + "title": "Parentid" + }, + "tags": { + "default": [], + "description": "User-defined search tags.", + "items": { + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "type": "string" + }, + "title": "Tags", + "type": "array" + }, + "binding": { + "description": "Business object displayed by this canvas item.", + "discriminator": { + "mapping": { + "empty": "#/$defs/EmptyBinding", + "generation": "#/$defs/GenerationBinding", + "material": "#/$defs/MaterialBinding" + }, + "propertyName": "role" + }, + "oneOf": [ + { + "$ref": "#/$defs/EmptyBinding" + }, + { + "$ref": "#/$defs/MaterialBinding" + }, + { + "$ref": "#/$defs/GenerationBinding" + } + ], + "title": "Binding" + }, + "editors": { + "default": [], + "description": "Attached editable documents.", + "items": { + "$ref": "#/$defs/EditorRef" + }, + "title": "Editors", + "type": "array" + } + }, + "required": [ + "id", + "projectId", + "revision", + "kind", + "title", + "position", + "width", + "height", + "zIndex", + "locked", + "visible", + "parentId", + "tags", + "binding", + "editors" + ], + "title": "MediaCanvasItem", + "type": "object" + }, + "MediaEditData": { + "additionalProperties": false, + "properties": { + "tool": { + "description": "Registered editing tool name.", + "enum": [ + "layers", + "crop", + "smart-edit", + "outpaint", + "cutout", + "inpainting-remove", + "image-hd", + "view-control", + "lighting", + "layer-decompose", + "panorama", + "product-replacement", + "multi-size", + "dynamic-poster", + "ecommerce-main", + "image-presets", + "grid-split", + "composition", + "annotation", + "video-edit", + "video-extend", + "video-partial-reshoot", + "video-upscale", + "video-frame-interpolation", + "video-depth-capture", + "video-subtitle-erasure", + "video-matting", + "video-crop", + "video-translation", + "video-mask-composite", + "extract-audio", + "audio-separation", + "video-trim", + "audio-trim", + "video-frame-capture", + "director-stage" + ], + "title": "Tool", + "type": "string" + }, + "sources": { "default": [], - "description": "Ordered editable image layers.", + "description": "Ordered source asset versions.", "items": { - "$ref": "#/$defs/ImageLayer" + "$ref": "#/$defs/AssetRef" }, - "maxItems": 40, - "title": "Layers", + "title": "Sources", + "type": "array" + }, + "sourceItems": { + "default": [], + "description": "Source canvas item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "title": "Sourceitems", "type": "array" + }, + "parameters": { + "additionalProperties": { + "anyOf": [ + { + "maxLength": 100000, + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "integer" + }, + { + "type": "number" + } + ] + }, + "description": "Typed generation or editing parameters.", + "maxProperties": 100, + "propertyNames": { + "maxLength": 100, + "minLength": 1 + }, + "title": "Parameters", + "type": "object" + }, + "selection": { + "anyOf": [ + { + "$ref": "#/$defs/ToolSelection" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Saved source selection for this edit." } }, "required": [ - "width", - "height", - "background", - "layers" + "tool", + "sources", + "sourceItems", + "parameters", + "selection" ], - "title": "LayerData", + "title": "MediaEditData", "type": "object" }, - "LayerDocument": { + "MediaEditDocument": { "additionalProperties": false, "properties": { "id": { @@ -25809,13 +27749,13 @@ "type": "array" }, "kind": { - "const": "layers", + "const": "media_edit", "description": "Business object or media type.", "title": "Kind", "type": "string" }, "data": { - "$ref": "#/$defs/LayerData", + "$ref": "#/$defs/MediaEditData", "description": "Typed editable document contents." } }, @@ -25828,521 +27768,1122 @@ "kind", "data" ], - "title": "LayerDocument", + "title": "MediaEditDocument", "type": "object" }, - "MaskStroke": { + "MediaMetadata": { "additionalProperties": false, "properties": { - "mode": { - "description": "Operation mode within this contract variant.", - "enum": [ - "erase", - "restore" - ], - "title": "Mode", + "mimeType": { + "description": "Verified media MIME type.", + "maxLength": 255, + "minLength": 1, + "title": "Mimetype", "type": "string" }, "size": { - "description": "Mask brush diameter in pixels.", - "maximum": 4096, - "minimum": 1, + "description": "Content size in bytes.", + "minimum": 0, "title": "Size", + "type": "integer" + }, + "width": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Width in pixels.", + "title": "Width" + }, + "height": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Height in pixels.", + "title": "Height" + }, + "durationSeconds": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Duration in seconds.", + "title": "Durationseconds" + }, + "frameRate": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Video frames per second.", + "title": "Framerate" + }, + "hasAudio": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Whether the media contains an audio stream.", + "title": "Hasaudio" + }, + "sampleRate": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Audio samples per second.", + "title": "Samplerate" + }, + "channels": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Audio channel count.", + "title": "Channels" + } + }, + "required": [ + "mimeType", + "size", + "width", + "height", + "durationSeconds", + "frameRate", + "hasAudio", + "sampleRate", + "channels" + ], + "title": "MediaMetadata", + "type": "object" + }, + "MediaPublicationOutput": { + "additionalProperties": false, + "properties": { + "itemId": { + "description": "Canvas item ID.", + "format": "uuid", + "title": "Itemid", + "type": "string" + }, + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." + }, + "title": { + "description": "User-visible title.", + "maxLength": 255, + "minLength": 1, + "title": "Title", + "type": "string" + }, + "position": { + "$ref": "#/$defs/Point", + "description": "Position in the owning canvas or stage." + }, + "width": { + "default": 352, + "description": "Width in pixels.", + "exclusiveMinimum": 0, + "maximum": 10000, + "title": "Width", "type": "number" }, - "points": { - "description": "Ordered mask stroke coordinates.", + "height": { + "default": 198, + "description": "Height in pixels.", + "exclusiveMinimum": 0, + "maximum": 10000, + "title": "Height", + "type": "number" + } + }, + "required": [ + "itemId", + "asset", + "title", + "position", + "width", + "height" + ], + "title": "MediaPublicationOutput", + "type": "object" + }, + "ModelAvailability": { + "additionalProperties": false, + "properties": { + "configId": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Saved model identity; null for an unsaved draft.", + "title": "Configid" + }, + "modelId": { + "description": "Exact remote model identifier requested.", + "title": "Modelid", + "type": "string" + }, + "identity": { + "description": "Opaque identity of the checked connection and model.", + "title": "Identity", + "type": "string" + }, + "autoCheck": { + "description": "Effective service automatic-check preference.", + "title": "Autocheck", + "type": "boolean" + }, + "status": { + "description": "Summary across the configured adapter operations.", + "enum": [ + "available", + "unavailable", + "unknown" + ], + "title": "Status", + "type": "string" + }, + "reasonCode": { + "description": "Stable, localizable summary reason.", + "title": "Reasoncode", + "type": "string" + }, + "checkedAt": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Observation completion time in Unix milliseconds.", + "title": "Checkedat" + }, + "expiresAt": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Earliest operation expiry in Unix milliseconds.", + "title": "Expiresat" + }, + "revision": { + "description": "Projection version; changes on observations, identity changes and expiration.", + "title": "Revision", + "type": "string" + }, + "operations": { + "description": "Exact operations consumed by the configured adapter.", "items": { - "$ref": "#/$defs/Point" + "$ref": "#/$defs/OperationAvailability" }, - "maxItems": 200000, - "minItems": 1, - "title": "Points", + "title": "Operations", "type": "array" } }, "required": [ - "mode", - "size", - "points" + "configId", + "modelId", + "identity", + "autoCheck", + "status", + "reasonCode", + "checkedAt", + "expiresAt", + "revision", + "operations" ], - "title": "MaskStroke", + "title": "ModelAvailability", "type": "object" }, - "MaterialBinding": { + "ModelConfigPublic": { "additionalProperties": false, - "description": "Displays a registered project asset through objectRef.", + "description": "Application-level, never embedded in an editable project's credential data.", "properties": { - "role": { - "const": "material", - "description": "Business role of this binding or reference.", - "title": "Role", + "kind": { + "description": "Business object or media type.", + "enum": [ + "agent", + "image", + "video", + "audio", + "vision" + ], + "title": "Kind", "type": "string" }, - "objectRef": { - "$ref": "#/$defs/AssetRef", - "description": "Stable reference to the bound business object." + "url": { + "description": "Provider API base URL.", + "maxLength": 2048, + "minLength": 1, + "title": "Url", + "type": "string" + }, + "modelId": { + "description": "Provider-native model identifier.", + "maxLength": 200, + "minLength": 1, + "title": "Modelid", + "type": "string" + }, + "connectionType": { + "description": "Hosted or local model connection type.", + "enum": [ + "api", + "self_hosted" + ], + "title": "Connectiontype", + "type": "string" + }, + "protocol": { + "description": "Provider wire protocol.", + "enum": [ + "openai", + "volcengine", + "higgsfield_open", + "bigmodel_video", + "kling_video", + "minimax_video_v2", + "vllm_omni", + "vllm_omni_segmentation", + "vllm_omni_music", + "vllm_omni_depth", + "vllm_omni_score" + ], + "title": "Protocol", + "type": "string" + }, + "authMode": { + "description": "Authentication mode for the provider connection.", + "enum": [ + "none", + "bearer" + ], + "title": "Authmode", + "type": "string" + }, + "proxyMode": { + "default": "system", + "description": "Use the system proxy or connect directly to the model service.", + "enum": [ + "system", + "direct" + ], + "title": "Proxymode", + "type": "string" + }, + "inputModalities": { + "anyOf": [ + { + "items": { + "enum": [ + "text", + "image", + "video", + "audio" + ], + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Supported model input media kinds.", + "title": "Inputmodalities" + }, + "videoAdapter": { + "default": "auto", + "description": "Provider-specific video adapter.", + "enum": [ + "auto", + "fasth3", + "fasth3_dual", + "minimax_h3", + "standard" + ], + "title": "Videoadapter", + "type": "string" + }, + "videoCapabilities": { + "anyOf": [ + { + "$ref": "#/$defs/VideoCapabilities" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Supported video generation capabilities." + }, + "id": { + "description": "Stable object ID.", + "format": "uuid", + "title": "Id", + "type": "string" + }, + "inputRules": { + "$ref": "#/$defs/InputRules", + "description": "Verified model input limits and output choices." + }, + "capabilityAutoCheck": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Service preference; omitted defaults to automatic for self-hosted connections.", + "title": "Capabilityautocheck" + }, + "availability": { + "anyOf": [ + { + "$ref": "#/$defs/ModelAvailability" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ephemeral observation, never persisted in project snapshots." } }, "required": [ - "role", - "objectRef" + "kind", + "url", + "modelId", + "connectionType", + "protocol", + "authMode", + "proxyMode", + "inputModalities", + "videoAdapter", + "videoCapabilities", + "id", + "inputRules" ], - "title": "MaterialBinding", + "title": "ModelConfigPublic", "type": "object" }, - "MediaCanvasItem": { + "ModelConfigWrite": { "additionalProperties": false, + "description": "Only the model-settings write boundary accepts a credential.", "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, "kind": { "description": "Business object or media type.", "enum": [ - "text", + "agent", "image", "video", "audio", - "file", - "group", - "timeline", - "subject", - "stack", - "tool", - "external" + "vision" ], "title": "Kind", "type": "string" }, - "title": { - "default": "", - "description": "User-visible title.", - "maxLength": 255, - "title": "Title", + "url": { + "description": "Provider API base URL.", + "maxLength": 2048, + "minLength": 1, + "title": "Url", "type": "string" }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." + "modelId": { + "description": "Provider-native model identifier.", + "maxLength": 200, + "minLength": 1, + "title": "Modelid", + "type": "string" }, - "width": { - "default": 352, - "description": "Width in pixels.", - "exclusiveMinimum": 0, - "title": "Width", - "type": "number" + "connectionType": { + "description": "Hosted or local model connection type.", + "enum": [ + "api", + "self_hosted" + ], + "title": "Connectiontype", + "type": "string" }, - "height": { - "default": 198, - "description": "Height in pixels.", - "exclusiveMinimum": 0, - "title": "Height", - "type": "number" + "protocol": { + "description": "Provider wire protocol.", + "enum": [ + "openai", + "volcengine", + "higgsfield_open", + "bigmodel_video", + "kling_video", + "minimax_video_v2", + "vllm_omni", + "vllm_omni_segmentation", + "vllm_omni_music", + "vllm_omni_depth", + "vllm_omni_score" + ], + "title": "Protocol", + "type": "string" }, - "zIndex": { - "default": 0, - "description": "Canvas stacking order.", - "title": "Zindex", - "type": "integer" + "authMode": { + "description": "Authentication mode for the provider connection.", + "enum": [ + "none", + "bearer" + ], + "title": "Authmode", + "type": "string" }, - "locked": { - "default": false, - "description": "Whether edits to this object are blocked.", - "title": "Locked", - "type": "boolean" + "proxyMode": { + "default": "system", + "description": "Use the system proxy or connect directly to the model service.", + "enum": [ + "system", + "direct" + ], + "title": "Proxymode", + "type": "string" }, - "color": { + "inputModalities": { "anyOf": [ { - "pattern": "^(#[0-9a-fA-F]{6})?$", - "type": "string" + "items": { + "enum": [ + "text", + "image", + "video", + "audio" + ], + "type": "string" + }, + "type": "array" }, { "type": "null" } ], "default": null, - "description": "Group background color in #RRGGBB format.", - "title": "Color" + "description": "Supported model input media kinds.", + "title": "Inputmodalities" }, - "visible": { - "default": true, - "description": "Whether this object is displayed.", - "title": "Visible", - "type": "boolean" + "videoAdapter": { + "default": "auto", + "description": "Provider-specific video adapter.", + "enum": [ + "auto", + "fasth3", + "fasth3_dual", + "minimax_h3", + "standard" + ], + "title": "Videoadapter", + "type": "string" }, - "parentId": { + "videoCapabilities": { "anyOf": [ { - "format": "uuid", - "type": "string" + "$ref": "#/$defs/VideoCapabilities" }, { "type": "null" } ], "default": null, - "description": "Parent canvas group ID, or null for the root.", - "title": "Parentid" - }, - "tags": { - "default": [], - "description": "User-defined search tags.", - "items": { - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "type": "string" - }, - "title": "Tags", - "type": "array" + "description": "Supported video generation capabilities." }, - "binding": { - "description": "Business object displayed by this canvas item.", - "discriminator": { - "mapping": { - "empty": "#/$defs/EmptyBinding", - "generation": "#/$defs/GenerationBinding", - "material": "#/$defs/MaterialBinding" + "apiKey": { + "anyOf": [ + { + "format": "password", + "maxLength": 8192, + "type": "string", + "writeOnly": true }, - "propertyName": "role" - }, - "oneOf": [ { - "$ref": "#/$defs/EmptyBinding" + "type": "null" + } + ], + "default": null, + "description": "Provider credential; omitted from public model records.", + "title": "Apikey" + }, + "capabilityAutoCheck": { + "anyOf": [ + { + "type": "boolean" }, { - "$ref": "#/$defs/MaterialBinding" + "type": "null" + } + ], + "default": null, + "description": "Service automatic-check override; omission preserves the existing preference.", + "title": "Capabilityautocheck" + } + }, + "required": [ + "kind", + "url", + "modelId", + "connectionType", + "protocol", + "authMode", + "proxyMode", + "inputModalities", + "videoAdapter", + "videoCapabilities", + "apiKey" + ], + "title": "ModelConfigWrite", + "type": "object" + }, + "ModelConnection": { + "additionalProperties": false, + "properties": { + "kind": { + "description": "Business object or media type.", + "enum": [ + "agent", + "image", + "video", + "audio", + "vision" + ], + "title": "Kind", + "type": "string" + }, + "url": { + "description": "Provider API base URL.", + "maxLength": 2048, + "minLength": 1, + "title": "Url", + "type": "string" + }, + "modelId": { + "description": "Provider-native model identifier.", + "maxLength": 200, + "minLength": 1, + "title": "Modelid", + "type": "string" + }, + "connectionType": { + "description": "Hosted or local model connection type.", + "enum": [ + "api", + "self_hosted" + ], + "title": "Connectiontype", + "type": "string" + }, + "protocol": { + "description": "Provider wire protocol.", + "enum": [ + "openai", + "volcengine", + "higgsfield_open", + "bigmodel_video", + "kling_video", + "minimax_video_v2", + "vllm_omni", + "vllm_omni_segmentation", + "vllm_omni_music", + "vllm_omni_depth", + "vllm_omni_score" + ], + "title": "Protocol", + "type": "string" + }, + "authMode": { + "description": "Authentication mode for the provider connection.", + "enum": [ + "none", + "bearer" + ], + "title": "Authmode", + "type": "string" + }, + "proxyMode": { + "default": "system", + "description": "Use the system proxy or connect directly to the model service.", + "enum": [ + "system", + "direct" + ], + "title": "Proxymode", + "type": "string" + }, + "inputModalities": { + "anyOf": [ + { + "items": { + "enum": [ + "text", + "image", + "video", + "audio" + ], + "type": "string" + }, + "type": "array" }, { - "$ref": "#/$defs/GenerationBinding" + "type": "null" } ], - "title": "Binding" + "default": null, + "description": "Supported model input media kinds.", + "title": "Inputmodalities" }, - "editors": { - "default": [], - "description": "Attached editable documents.", - "items": { - "$ref": "#/$defs/EditorRef" - }, - "title": "Editors", - "type": "array" + "videoAdapter": { + "default": "auto", + "description": "Provider-specific video adapter.", + "enum": [ + "auto", + "fasth3", + "fasth3_dual", + "minimax_h3", + "standard" + ], + "title": "Videoadapter", + "type": "string" + }, + "videoCapabilities": { + "anyOf": [ + { + "$ref": "#/$defs/VideoCapabilities" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Supported video generation capabilities." } }, "required": [ - "id", - "projectId", - "revision", "kind", - "title", - "position", - "width", - "height", - "zIndex", - "locked", - "visible", - "parentId", - "tags", - "binding", - "editors" + "url", + "modelId", + "connectionType", + "protocol", + "authMode", + "proxyMode", + "inputModalities", + "videoAdapter", + "videoCapabilities" ], - "title": "MediaCanvasItem", + "title": "ModelConnection", "type": "object" }, - "MediaEditData": { + "ModelSnapshot": { "additionalProperties": false, "properties": { - "tool": { - "description": "Registered editing tool name.", + "modelConfigId": { + "description": "Model configuration ID from the model catalog or user model selections.", + "format": "uuid", + "title": "Modelconfigid", + "type": "string" + }, + "kind": { + "description": "Business object or media type.", "enum": [ - "layers", - "crop", - "smart-edit", - "outpaint", - "cutout", - "inpainting-remove", - "image-hd", - "view-control", - "lighting", - "layer-decompose", - "panorama", - "product-replacement", - "multi-size", - "dynamic-poster", - "ecommerce-main", - "image-presets", - "grid-split", - "composition", - "annotation", - "video-edit", - "video-extend", - "video-partial-reshoot", - "video-upscale", - "video-frame-interpolation", - "video-depth-capture", - "video-subtitle-erasure", - "video-matting", - "video-crop", - "video-translation", - "video-mask-composite", - "extract-audio", - "audio-separation", - "video-trim", - "audio-trim", - "video-frame-capture", - "director-stage" + "agent", + "image", + "video", + "audio", + "vision" ], - "title": "Tool", + "title": "Kind", "type": "string" }, - "sources": { - "default": [], - "description": "Ordered source asset versions.", - "items": { - "$ref": "#/$defs/AssetRef" - }, - "title": "Sources", - "type": "array" + "modelId": { + "description": "Provider-native model identifier.", + "maxLength": 200, + "minLength": 1, + "title": "Modelid", + "type": "string" }, - "sourceItems": { - "default": [], - "description": "Source canvas item IDs.", - "items": { - "format": "uuid", - "type": "string" - }, - "title": "Sourceitems", - "type": "array" + "url": { + "description": "Provider API base URL.", + "maxLength": 2048, + "minLength": 1, + "title": "Url", + "type": "string" + }, + "protocol": { + "description": "Provider wire protocol.", + "enum": [ + "openai", + "volcengine", + "higgsfield_open", + "bigmodel_video", + "kling_video", + "minimax_video_v2", + "vllm_omni", + "vllm_omni_segmentation", + "vllm_omni_music", + "vllm_omni_depth", + "vllm_omni_score" + ], + "title": "Protocol", + "type": "string" + }, + "connectionType": { + "description": "Hosted or local model connection type.", + "enum": [ + "api", + "self_hosted" + ], + "title": "Connectiontype", + "type": "string" }, - "parameters": { - "additionalProperties": { - "anyOf": [ - { - "maxLength": 100000, + "proxyMode": { + "default": "system", + "description": "Network routing selected when the job was accepted.", + "enum": [ + "system", + "direct" + ], + "title": "Proxymode", + "type": "string" + }, + "inputModalities": { + "anyOf": [ + { + "items": { + "enum": [ + "text", + "image", + "video", + "audio" + ], "type": "string" }, - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - } - ] - }, - "description": "Typed generation or editing parameters.", - "maxProperties": 100, - "propertyNames": { - "maxLength": 100, - "minLength": 1 - }, - "title": "Parameters", - "type": "object" + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Supported model input media kinds.", + "title": "Inputmodalities" }, - "selection": { + "videoAdapter": { + "default": "auto", + "description": "Provider-specific video adapter.", + "enum": [ + "auto", + "fasth3", + "fasth3_dual", + "minimax_h3", + "standard" + ], + "title": "Videoadapter", + "type": "string" + }, + "inputRules": { "anyOf": [ { - "$ref": "#/$defs/ToolSelection" + "$ref": "#/$defs/InputRules" }, { "type": "null" } ], "default": null, - "description": "Saved source selection for this edit." + "description": "Verified model input limits and output choices." } }, "required": [ - "tool", - "sources", - "sourceItems", - "parameters", - "selection" + "modelConfigId", + "kind", + "modelId", + "url", + "protocol", + "connectionType", + "videoAdapter", + "inputRules" ], - "title": "MediaEditData", + "title": "ModelSnapshot", "type": "object" }, - "MediaEditDocument": { + "MotionClip": { "additionalProperties": false, "properties": { "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", + "description": "Stable object ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", "title": "Id", "type": "string" }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" + "start": { + "description": "Start time in seconds.", + "minimum": 0, + "title": "Start", + "type": "number" }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" + "duration": { + "description": "Interval duration in seconds.", + "exclusiveMinimum": 0, + "title": "Duration", + "type": "number" }, - "schemaVersion": { - "const": 1, - "default": 1, - "description": "Record schema version.", - "title": "Schemaversion", - "type": "integer" + "motion": { + "$ref": "#/$defs/StageMotion", + "description": "Procedural motion settings." + } + }, + "required": [ + "id", + "start", + "duration", + "motion" + ], + "title": "MotionClip", + "type": "object" + }, + "NodeCapabilities": { + "additionalProperties": false, + "properties": { + "canEdit": { + "description": "Whether the current content can be edited.", + "title": "Canedit", + "type": "boolean" }, - "inputConnections": { - "default": [], - "description": "Persisted connections to source assets.", - "items": { - "$ref": "#/$defs/EditorInputConnection" - }, - "title": "Inputconnections", - "type": "array" + "canConfigureGeneration": { + "description": "Whether generation settings can be configured.", + "title": "Canconfiguregeneration", + "type": "boolean" }, - "kind": { - "const": "media_edit", - "description": "Business object or media type.", - "title": "Kind", - "type": "string" + "canGenerate": { + "description": "Whether generation can be submitted.", + "title": "Cangenerate", + "type": "boolean" }, - "data": { - "$ref": "#/$defs/MediaEditData", - "description": "Typed editable document contents." + "canAcceptReferences": { + "description": "Whether the item accepts generation references.", + "title": "Canacceptreferences", + "type": "boolean" + }, + "canUseAsReference": { + "description": "Whether the item can supply a generation reference.", + "title": "Canuseasreference", + "type": "boolean" + }, + "canPlay": { + "description": "Whether the current media can be played.", + "title": "Canplay", + "type": "boolean" + }, + "canExport": { + "description": "Whether the current content can be exported.", + "title": "Canexport", + "type": "boolean" + }, + "canReplaceMaterial": { + "description": "Whether the bound material can be replaced.", + "title": "Canreplacematerial", + "type": "boolean" } }, "required": [ - "id", - "projectId", - "revision", - "schemaVersion", - "inputConnections", - "kind", - "data" + "canEdit", + "canConfigureGeneration", + "canGenerate", + "canAcceptReferences", + "canUseAsReference", + "canPlay", + "canExport", + "canReplaceMaterial" ], - "title": "MediaEditDocument", + "title": "NodeCapabilities", "type": "object" }, - "MediaMetadata": { + "NodeVersionApply": { "additionalProperties": false, "properties": { - "mimeType": { - "description": "Verified media MIME type.", - "maxLength": 255, - "minLength": 1, - "title": "Mimetype", + "itemId": { + "description": "Canvas item ID.", + "format": "uuid", + "title": "Itemid", "type": "string" }, - "size": { - "description": "Content size in bytes.", - "minimum": 0, - "title": "Size", - "type": "integer" + "asset": { + "$ref": "#/$defs/AssetRef", + "description": "Immutable asset version." }, - "width": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } + "referencePolicy": { + "default": "follow_current", + "description": "Policy for restoring associated reference bindings.", + "enum": [ + "follow_current", + "pinned" ], - "default": null, - "description": "Width in pixels.", - "title": "Width" + "title": "Referencepolicy", + "type": "string" + } + }, + "required": [ + "itemId", + "asset", + "referencePolicy" + ], + "title": "NodeVersionApply", + "type": "object" + }, + "NodeVersionApplyCommand": { + "additionalProperties": false, + "description": "Apply a historical asset version and its reference policy to a canvas item.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" }, - "height": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Height in pixels.", - "title": "Height" + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" }, - "durationSeconds": { - "anyOf": [ - { - "exclusiveMinimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Duration in seconds.", - "title": "Durationseconds" + "type": { + "const": "canvas.applyVersion", + "description": "Command discriminator.", + "title": "Type", + "type": "string" }, - "frameRate": { - "anyOf": [ - { - "exclusiveMinimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Video frames per second.", - "title": "Framerate" + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" }, - "hasAudio": { + "expectedPreview": { "anyOf": [ { - "type": "boolean" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Whether the media contains an audio stream.", - "title": "Hasaudio" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "sampleRate": { - "anyOf": [ - { - "minimum": 1, - "type": "integer" - }, - { - "type": "null" - } + "payload": { + "$ref": "#/$defs/NodeVersionApply", + "description": "Apply a historical asset version and its reference policy to a canvas item." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" + ], + "title": "NodeVersionApplyCommand", + "type": "object" + }, + "ObjectQuery": { + "additionalProperties": false, + "properties": { + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", + "type": "string" + }, + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "description": "Read an object or generation job.", + "enum": [ + "object.get", + "job.get" ], - "default": null, - "description": "Audio samples per second.", - "title": "Samplerate" + "title": "Type", + "type": "string" }, - "channels": { + "objectId": { + "description": "Target business object ID.", + "format": "uuid", + "title": "Objectid", + "type": "string" + }, + "revision": { "anyOf": [ { "minimum": 1, @@ -26353,109 +28894,89 @@ } ], "default": null, - "description": "Audio channel count.", - "title": "Channels" + "description": "Historical object revision, or current when omitted.", + "title": "Revision" } }, "required": [ - "mimeType", - "size", - "width", - "height", - "durationSeconds", - "frameRate", - "hasAudio", - "sampleRate", - "channels" + "queryId", + "projectId", + "type", + "objectId", + "revision" ], - "title": "MediaMetadata", + "title": "ObjectQuery", "type": "object" }, - "MediaPublicationOutput": { + "ObjectVersion": { "additionalProperties": false, "properties": { - "itemId": { - "description": "Canvas item ID.", - "format": "uuid", - "title": "Itemid", + "objectType": { + "description": "Referenced business object type.", + "enum": [ + "project", + "asset", + "generation_spec", + "reference", + "canvas_item", + "editor_document", + "job", + "result" + ], + "title": "Objecttype", "type": "string" }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." - }, - "title": { - "description": "User-visible title.", - "maxLength": 255, - "minLength": 1, - "title": "Title", + "id": { + "description": "Stable object ID.", + "format": "uuid", + "title": "Id", "type": "string" }, - "position": { - "$ref": "#/$defs/Point", - "description": "Position in the owning canvas or stage." - }, - "width": { - "default": 352, - "description": "Width in pixels.", - "exclusiveMinimum": 0, - "maximum": 10000, - "title": "Width", - "type": "number" - }, - "height": { - "default": 198, - "description": "Height in pixels.", - "exclusiveMinimum": 0, - "maximum": 10000, - "title": "Height", - "type": "number" + "revision": { + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" } }, "required": [ - "itemId", - "asset", - "title", - "position", - "width", - "height" + "objectType", + "id", + "revision" ], - "title": "MediaPublicationOutput", + "title": "ObjectVersion", "type": "object" }, - "ModelAvailability": { + "OperationAvailability": { "additionalProperties": false, "properties": { - "configId": { - "anyOf": [ - { - "format": "uuid", - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Saved model identity; null for an unsaved draft.", - "title": "Configid" + "operation": { + "description": "Canonical remote operation identifier.", + "title": "Operation", + "type": "string" }, - "modelId": { - "description": "Exact remote model identifier requested.", - "title": "Modelid", + "profile": { + "description": "Input and output mode used by the configured adapter.", + "title": "Profile", + "type": "string" + }, + "method": { + "description": "Actual HTTP method used for submission.", + "title": "Method", + "type": "string" + }, + "path": { + "description": "Actual HTTP submission path.", + "title": "Path", "type": "string" }, - "identity": { - "description": "Opaque identity of the checked connection and model.", - "title": "Identity", + "output": { + "description": "Output modality consumed by the adapter.", + "title": "Output", "type": "string" }, - "autoCheck": { - "description": "Effective service automatic-check preference.", - "title": "Autocheck", - "type": "boolean" - }, "status": { - "description": "Summary across the configured adapter operations.", + "description": "Current evidence for this exact request.", "enum": [ "available", "unavailable", @@ -26465,7 +28986,7 @@ "type": "string" }, "reasonCode": { - "description": "Stable, localizable summary reason.", + "description": "Stable, localizable decision reason.", "title": "Reasoncode", "type": "string" }, @@ -26490,783 +29011,742 @@ "type": "null" } ], - "description": "Earliest operation expiry in Unix milliseconds.", + "description": "Decision expiry in Unix milliseconds; recompute after expiry.", "title": "Expiresat" }, - "revision": { - "description": "Projection version; changes on observations, identity changes and expiration.", - "title": "Revision", - "type": "string" + "declaration": { + "anyOf": [ + { + "$ref": "#/$defs/CapabilityDeclaration" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Request support independently expires from the short execution observation." }, - "operations": { - "description": "Exact operations consumed by the configured adapter.", + "execution": { + "anyOf": [ + { + "$ref": "#/$defs/CapabilityExecution" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Short-lived execution observation, separate from declared support." + }, + "inputDetails": { + "default": [], + "description": "Known role and parameter facts for the actual request route; no saved configuration changes.", "items": { - "$ref": "#/$defs/OperationAvailability" + "$ref": "#/$defs/CapabilityInputDetail" }, - "title": "Operations", + "title": "Inputdetails", "type": "array" } }, "required": [ - "configId", - "modelId", - "identity", - "autoCheck", + "operation", + "profile", + "method", + "path", + "output", "status", "reasonCode", "checkedAt", "expiresAt", - "revision", - "operations" + "inputDetails" ], - "title": "ModelAvailability", + "title": "OperationAvailability", "type": "object" }, - "ModelConfigPublic": { + "PaletteData": { "additionalProperties": false, - "description": "Application-level, never embedded in an editable project's credential data.", "properties": { - "kind": { - "description": "Business object or media type.", - "enum": [ - "agent", - "image", - "video", - "audio", - "vision" - ], - "title": "Kind", - "type": "string" - }, - "url": { - "description": "Provider API base URL.", - "maxLength": 2048, - "minLength": 1, - "title": "Url", - "type": "string" - }, - "modelId": { - "description": "Provider-native model identifier.", - "maxLength": 200, - "minLength": 1, - "title": "Modelid", - "type": "string" - }, - "connectionType": { - "description": "Hosted or local model connection type.", - "enum": [ - "api", - "self_hosted" - ], - "title": "Connectiontype", - "type": "string" - }, - "protocol": { - "description": "Provider wire protocol.", - "enum": [ - "openai", - "volcengine", - "higgsfield_open", - "bigmodel_video", - "kling_video", - "minimax_video_v2", - "vllm_omni", - "vllm_omni_segmentation", - "vllm_omni_music", - "vllm_omni_depth", - "vllm_omni_score" - ], - "title": "Protocol", - "type": "string" - }, - "authMode": { - "description": "Authentication mode for the provider connection.", - "enum": [ - "none", - "bearer" - ], - "title": "Authmode", - "type": "string" - }, - "proxyMode": { - "default": "system", - "description": "Use the system proxy or connect directly to the model service.", - "enum": [ - "system", - "direct" - ], - "title": "Proxymode", - "type": "string" - }, - "inputModalities": { + "name": { "anyOf": [ { - "items": { - "enum": [ - "text", - "image", - "video", - "audio" - ], - "type": "string" - }, - "type": "array" + "maxLength": 255, + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Supported model input media kinds.", - "title": "Inputmodalities" - }, - "videoAdapter": { - "default": "auto", - "description": "Provider-specific video adapter.", - "enum": [ - "auto", - "fasth3", - "fasth3_dual", - "minimax_h3", - "standard" - ], - "title": "Videoadapter", - "type": "string" + "description": "User-visible name.", + "title": "Name" }, - "videoCapabilities": { + "sourceImage": { "anyOf": [ { - "$ref": "#/$defs/VideoCapabilities" + "$ref": "#/$defs/AssetRef" }, { "type": "null" } ], "default": null, - "description": "Supported video generation capabilities." + "description": "Source image used to extract palette colors." + } + }, + "required": [ + "name", + "sourceImage" + ], + "title": "PaletteData", + "type": "object" + }, + "PaletteProvenance": { + "additionalProperties": false, + "properties": { + "paletteId": { + "description": "Palette ID.", + "maxLength": 100, + "minLength": 1, + "pattern": "\\S", + "title": "Paletteid", + "type": "string" }, + "version": { + "description": "Version of the referenced record.", + "minimum": 1, + "title": "Version", + "type": "integer" + } + }, + "required": [ + "paletteId", + "version" + ], + "title": "PaletteProvenance", + "type": "object" + }, + "PinnedReference": { + "additionalProperties": false, + "properties": { "id": { - "description": "Stable object ID.", + "description": "Stable identity of this project-owned object.", "format": "uuid", "title": "Id", "type": "string" }, - "inputRules": { - "$ref": "#/$defs/InputRules", - "description": "Verified model input limits and output choices." + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" }, - "capabilityAutoCheck": { + "revision": { + "default": 1, + "description": "Current object revision for optimistic concurrency.", + "minimum": 1, + "title": "Revision", + "type": "integer" + }, + "targetSpecId": { + "description": "Target generation configuration ID.", + "format": "uuid", + "title": "Targetspecid", + "type": "string" + }, + "role": { + "default": "reference", + "description": "Business role of this binding or reference.", + "enum": [ + "reference", + "first_frame", + "last_frame", + "continuation", + "control" + ], + "title": "Role", + "type": "string" + }, + "order": { + "default": 0, + "description": "Reference ordering within the target configuration.", + "minimum": 0, + "title": "Order", + "type": "integer" + }, + "active": { + "default": true, + "description": "Whether this reference participates in generation.", + "title": "Active", + "type": "boolean" + }, + "binding": { + "const": "pinned", + "description": "Use a fixed asset version, retaining canvas provenance when supplied.", + "title": "Binding", + "type": "string" + }, + "source": { + "$ref": "#/$defs/AssetRef", + "description": "Fixed asset version used by generation." + }, + "sourceVersion": { "anyOf": [ { - "type": "boolean" + "$ref": "#/$defs/CanvasItemVersion" }, { "type": "null" } ], "default": null, - "description": "Service preference; omitted defaults to automatic for self-hosted connections.", - "title": "Capabilityautocheck" + "description": "Source canvas item identity and revision. Required for canvas-derived references to retain their connection." }, - "availability": { + "subjectRole": { "anyOf": [ { - "$ref": "#/$defs/ModelAvailability" + "enum": [ + "main", + "auxiliary", + "voice" + ], + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Ephemeral observation, never persisted in project snapshots." + "description": "Subject media slot provenance only; omit for ordinary image references and explicit first_frame/last_frame assets. main does not mean first frame.", + "title": "Subjectrole" } }, "required": [ - "kind", - "url", - "modelId", - "connectionType", - "protocol", - "authMode", - "proxyMode", - "inputModalities", - "videoAdapter", - "videoCapabilities", "id", - "inputRules" + "projectId", + "revision", + "targetSpecId", + "role", + "order", + "active", + "binding", + "source" ], - "title": "ModelConfigPublic", + "title": "PinnedReference", "type": "object" }, - "ModelConfigWrite": { + "PinnedReferenceSource": { "additionalProperties": false, - "description": "Only the model-settings write boundary accepts a credential.", "properties": { - "kind": { - "description": "Business object or media type.", - "enum": [ - "agent", - "image", - "video", - "audio", - "vision" - ], - "title": "Kind", + "binding": { + "const": "pinned", + "default": "pinned", + "description": "Use the fixed asset version.", + "title": "Binding", "type": "string" }, - "url": { - "description": "Provider API base URL.", - "maxLength": 2048, - "minLength": 1, - "title": "Url", - "type": "string" + "source": { + "$ref": "#/$defs/AssetRef", + "description": "Fixed current asset version." }, - "modelId": { - "description": "Provider-native model identifier.", - "maxLength": 200, - "minLength": 1, - "title": "Modelid", + "sourceVersion": { + "$ref": "#/$defs/CanvasItemVersion", + "description": "Canvas source version retaining the connection." + } + }, + "required": [ + "binding", + "source", + "sourceVersion" + ], + "title": "PinnedReferenceSource", + "type": "object" + }, + "PipelineAdopt": { + "additionalProperties": false, + "properties": { + "executionId": { + "description": "Target Pipeline execution ID awaiting candidate adoption.", + "format": "uuid", + "title": "Executionid", "type": "string" }, - "connectionType": { - "description": "Hosted or local model connection type.", - "enum": [ - "api", - "self_hosted" - ], - "title": "Connectiontype", + "itemId": { + "description": "Canvas item ID whose candidate is being adopted.", + "format": "uuid", + "title": "Itemid", "type": "string" }, - "protocol": { - "description": "Provider wire protocol.", - "enum": [ - "openai", - "volcengine", - "higgsfield_open", - "bigmodel_video", - "kling_video", - "minimax_video_v2", - "vllm_omni", - "vllm_omni_segmentation", - "vllm_omni_music", - "vllm_omni_depth", - "vllm_omni_score" - ], - "title": "Protocol", + "jobId": { + "description": "Succeeded candidate job ID to adopt.", + "format": "uuid", + "title": "Jobid", + "type": "string" + } + }, + "required": [ + "executionId", + "itemId", + "jobId" + ], + "title": "PipelineAdopt", + "type": "object" + }, + "PipelineAdoptCommand": { + "additionalProperties": false, + "description": "Adopt a candidate job for an awaiting Pipeline step and continue downstream execution.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "authMode": { - "description": "Authentication mode for the provider connection.", - "enum": [ - "none", - "bearer" - ], - "title": "Authmode", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "proxyMode": { - "default": "system", - "description": "Use the system proxy or connect directly to the model service.", - "enum": [ - "system", - "direct" - ], - "title": "Proxymode", + "type": { + "const": "pipeline.adopt", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "inputModalities": { + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { "anyOf": [ { - "items": { - "enum": [ - "text", - "image", - "video", - "audio" - ], - "type": "string" - }, - "type": "array" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Supported model input media kinds.", - "title": "Inputmodalities" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "videoAdapter": { - "default": "auto", - "description": "Provider-specific video adapter.", - "enum": [ - "auto", - "fasth3", - "fasth3_dual", - "minimax_h3", - "standard" - ], - "title": "Videoadapter", + "payload": { + "$ref": "#/$defs/PipelineAdopt", + "description": "Adopt a candidate job for an awaiting Pipeline step and continue downstream execution." + } + }, + "required": [ + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" + ], + "title": "PipelineAdoptCommand", + "type": "object" + }, + "PipelineCancelCommand": { + "additionalProperties": false, + "description": "Cancel pending steps and request cancellation of running steps in a Pipeline execution.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "videoCapabilities": { - "anyOf": [ - { - "$ref": "#/$defs/VideoCapabilities" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Supported video generation capabilities." + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" + }, + "type": { + "const": "pipeline.cancel", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" }, - "apiKey": { + "expectedPreview": { "anyOf": [ { - "format": "password", - "maxLength": 8192, - "type": "string", - "writeOnly": true + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Provider credential; omitted from public model records.", - "title": "Apikey" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "capabilityAutoCheck": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Service automatic-check override; omission preserves the existing preference.", - "title": "Capabilityautocheck" + "payload": { + "$ref": "#/$defs/PipelineControl", + "description": "Cancel pending steps and request cancellation of running steps in a Pipeline execution." } }, "required": [ - "kind", - "url", - "modelId", - "connectionType", - "protocol", - "authMode", - "proxyMode", - "inputModalities", - "videoAdapter", - "videoCapabilities", - "apiKey" + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" ], - "title": "ModelConfigWrite", + "title": "PipelineCancelCommand", "type": "object" }, - "ModelConnection": { + "PipelineControl": { "additionalProperties": false, "properties": { - "kind": { - "description": "Business object or media type.", - "enum": [ - "agent", - "image", - "video", - "audio", - "vision" - ], - "title": "Kind", + "executionId": { + "description": "Target Pipeline execution ID.", + "format": "uuid", + "title": "Executionid", "type": "string" - }, - "url": { - "description": "Provider API base URL.", - "maxLength": 2048, - "minLength": 1, - "title": "Url", + } + }, + "required": [ + "executionId" + ], + "title": "PipelineControl", + "type": "object" + }, + "PipelineExecutionQuery": { + "additionalProperties": false, + "properties": { + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", "type": "string" }, - "modelId": { - "description": "Provider-native model identifier.", - "maxLength": 200, - "minLength": 1, - "title": "Modelid", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "connectionType": { - "description": "Hosted or local model connection type.", - "enum": [ - "api", - "self_hosted" - ], - "title": "Connectiontype", + "type": { + "const": "pipeline.execution.get", + "description": "Read a durable Pipeline execution.", + "title": "Type", "type": "string" }, - "protocol": { - "description": "Provider wire protocol.", - "enum": [ - "openai", - "volcengine", - "higgsfield_open", - "bigmodel_video", - "kling_video", - "minimax_video_v2", - "vllm_omni", - "vllm_omni_segmentation", - "vllm_omni_music", - "vllm_omni_depth", - "vllm_omni_score" - ], - "title": "Protocol", + "objectId": { + "description": "Pipeline execution ID returned by pipeline.start.", + "format": "uuid", + "title": "Objectid", + "type": "string" + } + }, + "required": [ + "queryId", + "projectId", + "type", + "objectId" + ], + "title": "PipelineExecutionQuery", + "type": "object" + }, + "PipelineExecutionsQuery": { + "additionalProperties": false, + "properties": { + "queryId": { + "description": "Caller-supplied query ID.", + "format": "uuid", + "title": "Queryid", "type": "string" }, - "authMode": { - "description": "Authentication mode for the provider connection.", - "enum": [ - "none", - "bearer" - ], - "title": "Authmode", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "proxyMode": { - "default": "system", - "description": "Use the system proxy or connect directly to the model service.", - "enum": [ - "system", - "direct" - ], - "title": "Proxymode", + "type": { + "const": "pipeline.executions.list", + "description": "List Pipeline execution history for the project or one group.", + "title": "Type", "type": "string" }, - "inputModalities": { + "groupId": { "anyOf": [ { - "items": { - "enum": [ - "text", - "image", - "video", - "audio" - ], - "type": "string" - }, - "type": "array" + "format": "uuid", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Supported model input media kinds.", - "title": "Inputmodalities" + "description": "Optional canvas group ID filter.", + "title": "Groupid" + } + }, + "required": [ + "queryId", + "projectId", + "type" + ], + "title": "PipelineExecutionsQuery", + "type": "object" + }, + "PipelinePauseCommand": { + "additionalProperties": false, + "description": "Pause an active Pipeline execution after its in-flight steps finish.", + "properties": { + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", + "type": "string" }, - "videoAdapter": { - "default": "auto", - "description": "Provider-specific video adapter.", - "enum": [ - "auto", - "fasth3", - "fasth3_dual", - "minimax_h3", - "standard" - ], - "title": "Videoadapter", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "videoCapabilities": { + "type": { + "const": "pipeline.pause", + "description": "Command discriminator.", + "title": "Type", + "type": "string" + }, + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" + }, + "expectedPreview": { "anyOf": [ { - "$ref": "#/$defs/VideoCapabilities" + "pattern": "^[0-9a-f]{64}$", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Supported video generation capabilities." + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" + }, + "payload": { + "$ref": "#/$defs/PipelineControl", + "description": "Pause an active Pipeline execution after its in-flight steps finish." } }, "required": [ - "kind", - "url", - "modelId", - "connectionType", - "protocol", - "authMode", - "proxyMode", - "inputModalities", - "videoAdapter", - "videoCapabilities" + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" ], - "title": "ModelConnection", + "title": "PipelinePauseCommand", "type": "object" }, - "ModelSnapshot": { + "PipelinePlanQuery": { "additionalProperties": false, "properties": { - "modelConfigId": { - "description": "Model configuration ID from the model catalog or user model selections.", + "queryId": { + "description": "Caller-supplied query ID.", "format": "uuid", - "title": "Modelconfigid", - "type": "string" - }, - "kind": { - "description": "Business object or media type.", - "enum": [ - "agent", - "image", - "video", - "audio", - "vision" - ], - "title": "Kind", - "type": "string" - }, - "modelId": { - "description": "Provider-native model identifier.", - "maxLength": 200, - "minLength": 1, - "title": "Modelid", - "type": "string" - }, - "url": { - "description": "Provider API base URL.", - "maxLength": 2048, - "minLength": 1, - "title": "Url", - "type": "string" - }, - "protocol": { - "description": "Provider wire protocol.", - "enum": [ - "openai", - "volcengine", - "higgsfield_open", - "bigmodel_video", - "kling_video", - "minimax_video_v2", - "vllm_omni", - "vllm_omni_segmentation", - "vllm_omni_music", - "vllm_omni_depth", - "vllm_omni_score" - ], - "title": "Protocol", + "title": "Queryid", "type": "string" }, - "connectionType": { - "description": "Hosted or local model connection type.", - "enum": [ - "api", - "self_hosted" - ], - "title": "Connectiontype", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "proxyMode": { - "default": "system", - "description": "Network routing selected when the job was accepted.", - "enum": [ - "system", - "direct" - ], - "title": "Proxymode", + "type": { + "const": "pipeline.plan", + "description": "Compile a Pipeline DAG read-only and preview cache hits, dependencies, and issues.", + "title": "Type", "type": "string" }, - "inputModalities": { - "anyOf": [ + "scope": { + "description": "Target canvas scope to compile.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" + }, + "oneOf": [ { - "items": { - "enum": [ - "text", - "image", - "video", - "audio" - ], - "type": "string" - }, - "type": "array" + "$ref": "#/$defs/GroupPipelineScope" }, { - "type": "null" + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" } ], - "default": null, - "description": "Supported model input media kinds.", - "title": "Inputmodalities" + "title": "Scope" }, - "videoAdapter": { - "default": "auto", - "description": "Provider-specific video adapter.", + "cachePolicy": { + "default": "reuse", + "description": "Cache reuse strategy to preview.", "enum": [ - "auto", - "fasth3", - "fasth3_dual", - "minimax_h3", - "standard" + "reuse", + "force_from_node", + "force_all" ], - "title": "Videoadapter", + "title": "Cachepolicy", "type": "string" }, - "inputRules": { + "forceFromItemId": { "anyOf": [ { - "$ref": "#/$defs/InputRules" + "format": "uuid", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Verified model input limits and output choices." + "description": "Optional step ID from which to force re-execution when cachePolicy is force_from_node.", + "title": "Forcefromitemid" } }, "required": [ - "modelConfigId", - "kind", - "modelId", - "url", - "protocol", - "connectionType", - "videoAdapter", - "inputRules" + "queryId", + "projectId", + "type", + "scope", + "cachePolicy" ], - "title": "ModelSnapshot", + "title": "PipelinePlanQuery", "type": "object" }, - "MotionClip": { + "PipelineResumeCommand": { "additionalProperties": false, + "description": "Resume a paused Pipeline execution.", "properties": { - "id": { - "description": "Stable object ID.", - "maxLength": 100, - "minLength": 1, - "pattern": "\\S", - "title": "Id", + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "start": { - "description": "Start time in seconds.", - "minimum": 0, - "title": "Start", - "type": "number" - }, - "duration": { - "description": "Interval duration in seconds.", - "exclusiveMinimum": 0, - "title": "Duration", - "type": "number" - }, - "motion": { - "$ref": "#/$defs/StageMotion", - "description": "Procedural motion settings." - } - }, - "required": [ - "id", - "start", - "duration", - "motion" - ], - "title": "MotionClip", - "type": "object" - }, - "NodeCapabilities": { - "additionalProperties": false, - "properties": { - "canEdit": { - "description": "Whether the current content can be edited.", - "title": "Canedit", - "type": "boolean" - }, - "canConfigureGeneration": { - "description": "Whether generation settings can be configured.", - "title": "Canconfiguregeneration", - "type": "boolean" - }, - "canGenerate": { - "description": "Whether generation can be submitted.", - "title": "Cangenerate", - "type": "boolean" - }, - "canAcceptReferences": { - "description": "Whether the item accepts generation references.", - "title": "Canacceptreferences", - "type": "boolean" + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", + "type": "string" }, - "canUseAsReference": { - "description": "Whether the item can supply a generation reference.", - "title": "Canuseasreference", - "type": "boolean" + "type": { + "const": "pipeline.resume", + "description": "Command discriminator.", + "title": "Type", + "type": "string" }, - "canPlay": { - "description": "Whether the current media can be played.", - "title": "Canplay", - "type": "boolean" + "expectedVersions": { + "default": [], + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", + "items": { + "$ref": "#/$defs/ObjectVersion" + }, + "title": "Expectedversions", + "type": "array" }, - "canExport": { - "description": "Whether the current content can be exported.", - "title": "Canexport", - "type": "boolean" + "expectedPreview": { + "anyOf": [ + { + "pattern": "^[0-9a-f]{64}$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "canReplaceMaterial": { - "description": "Whether the bound material can be replaced.", - "title": "Canreplacematerial", - "type": "boolean" + "payload": { + "$ref": "#/$defs/PipelineControl", + "description": "Resume a paused Pipeline execution." } }, "required": [ - "canEdit", - "canConfigureGeneration", - "canGenerate", - "canAcceptReferences", - "canUseAsReference", - "canPlay", - "canExport", - "canReplaceMaterial" + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" ], - "title": "NodeCapabilities", + "title": "PipelineResumeCommand", "type": "object" }, - "NodeVersionApply": { + "PipelineRetry": { "additionalProperties": false, "properties": { - "itemId": { - "description": "Canvas item ID.", + "executionId": { + "description": "Target settled Pipeline execution ID to retry.", "format": "uuid", - "title": "Itemid", + "title": "Executionid", "type": "string" }, - "asset": { - "$ref": "#/$defs/AssetRef", - "description": "Immutable asset version." + "stopOnFailure": { + "default": false, + "description": "Whether to cancel remaining pending steps after the first failure.", + "title": "Stoponfailure", + "type": "boolean" }, - "referencePolicy": { - "default": "follow_current", - "description": "Policy for restoring associated reference bindings.", - "enum": [ - "follow_current", - "pinned" - ], - "title": "Referencepolicy", - "type": "string" + "maxConcurrency": { + "default": 4, + "description": "Maximum number of independent pipeline steps executed concurrently.", + "maximum": 16, + "minimum": 1, + "title": "Maxconcurrency", + "type": "integer" } }, "required": [ - "itemId", - "asset", - "referencePolicy" + "executionId", + "stopOnFailure", + "maxConcurrency" ], - "title": "NodeVersionApply", + "title": "PipelineRetry", "type": "object" }, - "NodeVersionApplyCommand": { + "PipelineRetryCommand": { "additionalProperties": false, - "description": "Apply a historical asset version and its reference policy to a canvas item.", + "description": "Retry failed or skipped steps of a settled Pipeline execution while reusing succeeded steps.", "properties": { "commandId": { "description": "Stable command ID for idempotent replay.", @@ -27281,7 +29761,7 @@ "type": "string" }, "type": { - "const": "canvas.applyVersion", + "const": "pipeline.retry", "description": "Command discriminator.", "title": "Type", "type": "string" @@ -27310,8 +29790,8 @@ "title": "Expectedpreview" }, "payload": { - "$ref": "#/$defs/NodeVersionApply", - "description": "Apply a historical asset version and its reference policy to a canvas item." + "$ref": "#/$defs/PipelineRetry", + "description": "Retry failed or skipped steps of a settled Pipeline execution while reusing succeeded steps." } }, "required": [ @@ -27322,226 +29802,119 @@ "expectedPreview", "payload" ], - "title": "NodeVersionApplyCommand", + "title": "PipelineRetryCommand", "type": "object" }, - "ObjectQuery": { + "PipelineStart": { "additionalProperties": false, "properties": { - "queryId": { - "description": "Caller-supplied query ID.", - "format": "uuid", - "title": "Queryid", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" + "scope": { + "description": "Target canvas scope to compile and execute.", + "discriminator": { + "mapping": { + "from_node": "#/$defs/FromNodePipelineScope", + "group": "#/$defs/GroupPipelineScope", + "selection": "#/$defs/SelectionPipelineScope" + }, + "propertyName": "kind" + }, + "oneOf": [ + { + "$ref": "#/$defs/GroupPipelineScope" + }, + { + "$ref": "#/$defs/SelectionPipelineScope" + }, + { + "$ref": "#/$defs/FromNodePipelineScope" + } + ], + "title": "Scope" }, - "type": { - "description": "Read an object or generation job.", + "cachePolicy": { + "default": "reuse", + "description": "Cache reuse strategy for unchanged nodes.", "enum": [ - "object.get", - "job.get" + "reuse", + "force_from_node", + "force_all" ], - "title": "Type", - "type": "string" - }, - "objectId": { - "description": "Target business object ID.", - "format": "uuid", - "title": "Objectid", + "title": "Cachepolicy", "type": "string" }, - "revision": { + "forceFromItemId": { "anyOf": [ { - "minimum": 1, - "type": "integer" + "format": "uuid", + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Historical object revision, or current when omitted.", - "title": "Revision" - } - }, - "required": [ - "queryId", - "projectId", - "type", - "objectId", - "revision" - ], - "title": "ObjectQuery", - "type": "object" - }, - "ObjectVersion": { - "additionalProperties": false, - "properties": { - "objectType": { - "description": "Referenced business object type.", - "enum": [ - "project", - "asset", - "generation_spec", - "reference", - "canvas_item", - "editor_document", - "job", - "result" - ], - "title": "Objecttype", - "type": "string" + "description": "Optional step ID from which to force re-execution when cachePolicy is force_from_node.", + "title": "Forcefromitemid" }, - "id": { - "description": "Stable object ID.", - "format": "uuid", - "title": "Id", - "type": "string" + "stopOnFailure": { + "default": false, + "description": "Whether to cancel remaining pending steps after the first failure.", + "title": "Stoponfailure", + "type": "boolean" }, - "revision": { - "description": "Current object revision for optimistic concurrency.", + "maxConcurrency": { + "default": 4, + "description": "Maximum number of independent pipeline steps executed concurrently.", + "maximum": 16, "minimum": 1, - "title": "Revision", + "title": "Maxconcurrency", "type": "integer" } }, "required": [ - "objectType", - "id", - "revision" + "scope", + "cachePolicy", + "stopOnFailure", + "maxConcurrency" ], - "title": "ObjectVersion", + "title": "PipelineStart", "type": "object" }, - "OperationAvailability": { + "PipelineStartCommand": { "additionalProperties": false, + "description": "Compile and start a durable concurrent Pipeline execution in the background.", "properties": { - "operation": { - "description": "Canonical remote operation identifier.", - "title": "Operation", - "type": "string" - }, - "profile": { - "description": "Input and output mode used by the configured adapter.", - "title": "Profile", - "type": "string" - }, - "method": { - "description": "Actual HTTP method used for submission.", - "title": "Method", - "type": "string" - }, - "path": { - "description": "Actual HTTP submission path.", - "title": "Path", - "type": "string" - }, - "output": { - "description": "Output modality consumed by the adapter.", - "title": "Output", + "commandId": { + "description": "Stable command ID for idempotent replay.", + "format": "uuid", + "title": "Commandid", "type": "string" }, - "status": { - "description": "Current evidence for this exact request.", - "enum": [ - "available", - "unavailable", - "unknown" - ], - "title": "Status", + "projectId": { + "description": "Owning project ID.", + "format": "uuid", + "title": "Projectid", "type": "string" }, - "reasonCode": { - "description": "Stable, localizable decision reason.", - "title": "Reasoncode", + "type": { + "const": "pipeline.start", + "description": "Command discriminator.", + "title": "Type", "type": "string" }, - "checkedAt": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "description": "Observation completion time in Unix milliseconds.", - "title": "Checkedat" - }, - "expiresAt": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "description": "Decision expiry in Unix milliseconds; recompute after expiry.", - "title": "Expiresat" - }, - "declaration": { - "anyOf": [ - { - "$ref": "#/$defs/CapabilityDeclaration" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Request support independently expires from the short execution observation." - }, - "execution": { - "anyOf": [ - { - "$ref": "#/$defs/CapabilityExecution" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Short-lived execution observation, separate from declared support." - }, - "inputDetails": { + "expectedVersions": { "default": [], - "description": "Known role and parameter facts for the actual request route; no saved configuration changes.", + "description": "Current versions of mutated existing objects; payload revision fields do not replace these.", "items": { - "$ref": "#/$defs/CapabilityInputDetail" + "$ref": "#/$defs/ObjectVersion" }, - "title": "Inputdetails", + "title": "Expectedversions", "type": "array" - } - }, - "required": [ - "operation", - "profile", - "method", - "path", - "output", - "status", - "reasonCode", - "checkedAt", - "expiresAt", - "inputDetails" - ], - "title": "OperationAvailability", - "type": "object" - }, - "PaletteData": { - "additionalProperties": false, - "properties": { - "name": { + }, + "expectedPreview": { "anyOf": [ { - "maxLength": 255, + "pattern": "^[0-9a-f]{64}$", "type": "string" }, { @@ -27549,138 +29922,46 @@ } ], "default": null, - "description": "User-visible name.", - "title": "Name" + "description": "Fingerprint of the confirmed impact preview.", + "title": "Expectedpreview" }, - "sourceImage": { - "anyOf": [ - { - "$ref": "#/$defs/AssetRef" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Source image used to extract palette colors." + "payload": { + "$ref": "#/$defs/PipelineStart", + "description": "Compile and start a durable concurrent Pipeline execution in the background." } }, "required": [ - "name", - "sourceImage" + "commandId", + "projectId", + "type", + "expectedVersions", + "expectedPreview", + "payload" ], - "title": "PaletteData", + "title": "PipelineStartCommand", "type": "object" }, - "PaletteProvenance": { + "PipelineStepIssue": { "additionalProperties": false, "properties": { - "paletteId": { - "description": "Palette ID.", + "code": { + "description": "Stable machine-readable issue code.", "maxLength": 100, "minLength": 1, - "pattern": "\\S", - "title": "Paletteid", - "type": "string" - }, - "version": { - "description": "Version of the referenced record.", - "minimum": 1, - "title": "Version", - "type": "integer" - } - }, - "required": [ - "paletteId", - "version" - ], - "title": "PaletteProvenance", - "type": "object" - }, - "PinnedReference": { - "additionalProperties": false, - "properties": { - "id": { - "description": "Stable identity of this project-owned object.", - "format": "uuid", - "title": "Id", - "type": "string" - }, - "projectId": { - "description": "Owning project ID.", - "format": "uuid", - "title": "Projectid", - "type": "string" - }, - "revision": { - "default": 1, - "description": "Current object revision for optimistic concurrency.", - "minimum": 1, - "title": "Revision", - "type": "integer" - }, - "targetSpecId": { - "description": "Target generation configuration ID.", - "format": "uuid", - "title": "Targetspecid", - "type": "string" - }, - "role": { - "default": "reference", - "description": "Business role of this binding or reference.", - "enum": [ - "reference", - "first_frame", - "last_frame", - "continuation", - "control" - ], - "title": "Role", + "title": "Code", "type": "string" }, - "order": { - "default": 0, - "description": "Reference ordering within the target configuration.", - "minimum": 0, - "title": "Order", - "type": "integer" - }, - "active": { - "default": true, - "description": "Whether this reference participates in generation.", - "title": "Active", - "type": "boolean" - }, - "binding": { - "const": "pinned", - "description": "Use a fixed asset version, retaining canvas provenance when supplied.", - "title": "Binding", + "message": { + "description": "Human-readable issue summary.", + "maxLength": 1000, + "minLength": 1, + "title": "Message", "type": "string" }, - "source": { - "$ref": "#/$defs/AssetRef", - "description": "Fixed asset version used by generation." - }, - "sourceVersion": { - "anyOf": [ - { - "$ref": "#/$defs/CanvasItemVersion" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Source canvas item identity and revision. Required for canvas-derived references to retain their connection." - }, - "subjectRole": { + "itemId": { "anyOf": [ { - "enum": [ - "main", - "auxiliary", - "voice" - ], + "format": "uuid", "type": "string" }, { @@ -27688,49 +29969,15 @@ } ], "default": null, - "description": "Subject media slot provenance only; omit for ordinary image references and explicit first_frame/last_frame assets. main does not mean first frame.", - "title": "Subjectrole" + "description": "Canvas item associated with this issue, if applicable.", + "title": "Itemid" } }, "required": [ - "id", - "projectId", - "revision", - "targetSpecId", - "role", - "order", - "active", - "binding", - "source" - ], - "title": "PinnedReference", - "type": "object" - }, - "PinnedReferenceSource": { - "additionalProperties": false, - "properties": { - "binding": { - "const": "pinned", - "default": "pinned", - "description": "Use the fixed asset version.", - "title": "Binding", - "type": "string" - }, - "source": { - "$ref": "#/$defs/AssetRef", - "description": "Fixed current asset version." - }, - "sourceVersion": { - "$ref": "#/$defs/CanvasItemVersion", - "description": "Canvas source version retaining the connection." - } - }, - "required": [ - "binding", - "source", - "sourceVersion" + "code", + "message" ], - "title": "PinnedReferenceSource", + "title": "PipelineStepIssue", "type": "object" }, "Playhead": { @@ -29610,6 +31857,34 @@ "title": "SelectionBox", "type": "object" }, + "SelectionPipelineScope": { + "additionalProperties": false, + "properties": { + "kind": { + "const": "selection", + "description": "Run an explicit set of canvas nodes.", + "title": "Kind", + "type": "string" + }, + "itemIds": { + "description": "Selected canvas item IDs.", + "items": { + "format": "uuid", + "type": "string" + }, + "maxItems": 200, + "minItems": 1, + "title": "Itemids", + "type": "array" + } + }, + "required": [ + "kind", + "itemIds" + ], + "title": "SelectionPipelineScope", + "type": "object" + }, "SpecCreateCommand": { "additionalProperties": false, "description": "Create a generation configuration without submitting a job.", @@ -34052,6 +36327,7 @@ "canvas.createGeneration": "#/$defs/CanvasCreateGenerationCommand", "canvas.detachEditor": "#/$defs/CanvasEditorDetachCommand", "canvas.hide": "#/$defs/CanvasHideCommand", + "canvas.layoutPipelines": "#/$defs/CanvasLayoutPipelinesCommand", "canvas.layoutRuns": "#/$defs/CanvasLayoutRunsCommand", "canvas.materialize": "#/$defs/CanvasMaterializeCommand", "canvas.move": "#/$defs/CanvasMoveCommand", @@ -34073,6 +36349,12 @@ "job.cancel": "#/$defs/JobCancelCommand", "job.checkpoint": "#/$defs/JobCheckpointCommand", "job.recover": "#/$defs/JobRecoverCommand", + "pipeline.adopt": "#/$defs/PipelineAdoptCommand", + "pipeline.cancel": "#/$defs/PipelineCancelCommand", + "pipeline.pause": "#/$defs/PipelinePauseCommand", + "pipeline.resume": "#/$defs/PipelineResumeCommand", + "pipeline.retry": "#/$defs/PipelineRetryCommand", + "pipeline.start": "#/$defs/PipelineStartCommand", "project.create": "#/$defs/ProjectCreateCommand", "project.rename": "#/$defs/ProjectRenameCommand", "project.restore": "#/$defs/ProjectRestoreCommand", @@ -34135,6 +36417,9 @@ { "$ref": "#/$defs/CanvasLayoutRunsCommand" }, + { + "$ref": "#/$defs/CanvasLayoutPipelinesCommand" + }, { "$ref": "#/$defs/CanvasHideCommand" }, @@ -34150,6 +36435,24 @@ { "$ref": "#/$defs/TimelinePublishRenderCommand" }, + { + "$ref": "#/$defs/PipelineStartCommand" + }, + { + "$ref": "#/$defs/PipelinePauseCommand" + }, + { + "$ref": "#/$defs/PipelineResumeCommand" + }, + { + "$ref": "#/$defs/PipelineCancelCommand" + }, + { + "$ref": "#/$defs/PipelineRetryCommand" + }, + { + "$ref": "#/$defs/PipelineAdoptCommand" + }, { "$ref": "#/$defs/NodeVersionApplyCommand" }, @@ -34236,6 +36539,9 @@ "job.get": "#/$defs/ObjectQuery", "job.status": "#/$defs/JobStatusQuery", "object.get": "#/$defs/ObjectQuery", + "pipeline.execution.get": "#/$defs/PipelineExecutionQuery", + "pipeline.executions.list": "#/$defs/PipelineExecutionsQuery", + "pipeline.plan": "#/$defs/PipelinePlanQuery", "project.get": "#/$defs/ProjectQuery" }, "propertyName": "type" @@ -34264,6 +36570,15 @@ }, { "$ref": "#/$defs/AssetPreviewQuery" + }, + { + "$ref": "#/$defs/PipelinePlanQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionQuery" + }, + { + "$ref": "#/$defs/PipelineExecutionsQuery" } ], "title": "Query" diff --git a/src/contracts/generated.ts b/src/contracts/generated.ts index 49316e860..6fddd21d7 100644 --- a/src/contracts/generated.ts +++ b/src/contracts/generated.ts @@ -152,7 +152,7 @@ export interface BatchCommandInput extends CommandBaseInput { } export interface BatchPayloadInput extends ContractInput { - readonly operations: ReadonlyArray; + readonly operations: ReadonlyArray; } export interface CameraFrameInput extends ContractInput { @@ -269,6 +269,16 @@ export interface CanvasItemVersionInput extends ObjectVersionInput { readonly objectType: "canvas_item"; } +export interface CanvasLayoutPipelinesCommandInput extends CommandBaseInput { + readonly type: "canvas.layoutPipelines"; + readonly payload: EmptyPayloadInput; +} + +export interface CanvasLayoutPipelinesCommandOperationInput { + readonly type: "canvas.layoutPipelines"; + readonly payload: EmptyPayloadInput; +} + export interface CanvasLayoutRunsCommandInput extends CommandBaseInput { readonly type: "canvas.layoutRuns"; readonly payload: EmptyPayloadInput; @@ -323,7 +333,7 @@ export interface CanvasPresentationUpdateInput extends ContractInput { readonly locked?: boolean | null; readonly color?: string | null; readonly parentId?: string | null; - readonly autoLayout?: "run" | "free" | null; + readonly autoLayout?: "run" | "pipeline" | "free" | null; } export interface CanvasPublishMediaInput extends ContractInput { @@ -422,6 +432,28 @@ export interface CommandReceiptInput extends ContractInput { readonly jobIds?: ReadonlyArray; readonly issues?: ReadonlyArray; readonly eventCursor?: number | null; + readonly pipelineExecutionId?: string | null; +} + +export interface CompiledPipelineGraphInput extends ContractInput { + readonly projectId: string; + readonly scope: GroupPipelineScopeInput | SelectionPipelineScopeInput | FromNodePipelineScopeInput; + readonly cachePolicy: "reuse" | "force_from_node" | "force_all"; + readonly steps?: ReadonlyArray; + readonly topologicalOrder?: ReadonlyArray; + readonly issues?: ReadonlyArray; + readonly plannedNewJobs?: number; +} + +export interface CompiledPipelineStepInput extends ContractInput { + readonly itemId: string; + readonly kind: "generation" | "assembly"; + readonly upstreamItemIds?: ReadonlyArray; + readonly inputFingerprint: string; + readonly cached?: boolean; + readonly cacheCandidateJobId?: string | null; + readonly cacheCandidateAssetId?: string | null; + readonly expectedVersions?: ReadonlyArray; } export interface ContainerBindingInput extends ContractInput { @@ -445,9 +477,9 @@ export interface CreationContractsInput extends ContractInput { readonly generationSpec: TextGenerationSpecInput | ImageGenerationSpecInput | VideoGenerationSpecInput | AudioGenerationSpecInput; readonly reference: PinnedReferenceInput | FollowingReferenceInput; readonly editorDocument: TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput; - readonly command: ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | GroupSavePlanCommandInput | GroupPublishRunCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasLayoutRunsCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput; + readonly command: ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | GroupSavePlanCommandInput | GroupPublishRunCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasLayoutRunsCommandInput | CanvasLayoutPipelinesCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | PipelineStartCommandInput | PipelinePauseCommandInput | PipelineResumeCommandInput | PipelineCancelCommandInput | PipelineRetryCommandInput | PipelineAdoptCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput; readonly receipt: CommandReceiptInput; - readonly query: ProjectQueryInput | ObjectQueryInput | VersionsQueryInput | AssetSearchQueryInput | AssetUsageQueryInput | CanvasStatusQueryInput | JobStatusQueryInput | AssetPreviewQueryInput; + readonly query: ProjectQueryInput | ObjectQueryInput | VersionsQueryInput | AssetSearchQueryInput | AssetUsageQueryInput | CanvasStatusQueryInput | JobStatusQueryInput | AssetPreviewQueryInput | PipelinePlanQueryInput | PipelineExecutionQueryInput | PipelineExecutionsQueryInput; readonly event: ProjectEventInput; readonly job: JobInput; readonly result: ResultVersionInput; @@ -564,6 +596,12 @@ export interface FollowingSourceInput extends ContractInput { readonly id: string; } +export interface FromNodePipelineScopeInput extends ContractInput { + readonly kind: "from_node"; + readonly itemId: string; + readonly groupId?: string | null; +} + export interface GenerationBindingInput extends ContractInput { readonly role: "generation"; readonly objectRef: GenerationSpecRefInput; @@ -619,7 +657,7 @@ export interface GroupAssemblyInput extends ContractInput { export interface GroupCanvasItemInput extends CanvasItemBaseInput { readonly kind: "group"; - readonly autoLayout?: "run" | null; + readonly autoLayout?: "run" | "pipeline" | null; readonly runPlan?: SegmentRunPlanInput | null; readonly draftRunPlan?: SegmentRunPlanInput | null; readonly runPlanItemId?: string | null; @@ -630,6 +668,11 @@ export interface GroupCanvasItemInput extends CanvasItemBaseInput { readonly binding?: ContainerBindingInput; } +export interface GroupPipelineScopeInput extends ContractInput { + readonly kind: "group"; + readonly groupId: string; +} + export interface GroupPlanDraftInput extends ContractInput { readonly groupId: string; readonly plan: SegmentRunPlanInput; @@ -1040,6 +1083,83 @@ export interface PinnedReferenceSourceInput extends ContractInput { readonly sourceVersion: CanvasItemVersionInput; } +export interface PipelineAdoptInput extends ContractInput { + readonly executionId: string; + readonly itemId: string; + readonly jobId: string; +} + +export interface PipelineAdoptCommandInput extends CommandBaseInput { + readonly type: "pipeline.adopt"; + readonly payload: PipelineAdoptInput; +} + +export interface PipelineCancelCommandInput extends CommandBaseInput { + readonly type: "pipeline.cancel"; + readonly payload: PipelineControlInput; +} + +export interface PipelineControlInput extends ContractInput { + readonly executionId: string; +} + +export interface PipelineExecutionQueryInput extends QueryBaseInput { + readonly type: "pipeline.execution.get"; + readonly objectId: string; +} + +export interface PipelineExecutionsQueryInput extends QueryBaseInput { + readonly type: "pipeline.executions.list"; + readonly groupId?: string | null; +} + +export interface PipelinePauseCommandInput extends CommandBaseInput { + readonly type: "pipeline.pause"; + readonly payload: PipelineControlInput; +} + +export interface PipelinePlanQueryInput extends QueryBaseInput { + readonly type: "pipeline.plan"; + readonly scope: GroupPipelineScopeInput | SelectionPipelineScopeInput | FromNodePipelineScopeInput; + readonly cachePolicy?: "reuse" | "force_from_node" | "force_all"; + readonly forceFromItemId?: string | null; +} + +export interface PipelineResumeCommandInput extends CommandBaseInput { + readonly type: "pipeline.resume"; + readonly payload: PipelineControlInput; +} + +export interface PipelineRetryInput extends ContractInput { + readonly executionId: string; + readonly stopOnFailure?: boolean; + readonly maxConcurrency?: number; +} + +export interface PipelineRetryCommandInput extends CommandBaseInput { + readonly type: "pipeline.retry"; + readonly payload: PipelineRetryInput; +} + +export interface PipelineStartInput extends ContractInput { + readonly scope: GroupPipelineScopeInput | SelectionPipelineScopeInput | FromNodePipelineScopeInput; + readonly cachePolicy?: "reuse" | "force_from_node" | "force_all"; + readonly forceFromItemId?: string | null; + readonly stopOnFailure?: boolean; + readonly maxConcurrency?: number; +} + +export interface PipelineStartCommandInput extends CommandBaseInput { + readonly type: "pipeline.start"; + readonly payload: PipelineStartInput; +} + +export interface PipelineStepIssueInput extends ContractInput { + readonly code: string; + readonly message: string; + readonly itemId?: string | null; +} + export interface PlayheadInput extends ContractInput { readonly editorDocumentId: string; readonly seconds?: number; @@ -1277,6 +1397,11 @@ export interface SelectionBoxInput extends ContractInput { readonly height: number; } +export interface SelectionPipelineScopeInput extends ContractInput { + readonly kind: "selection"; + readonly itemIds: ReadonlyArray; +} + export interface SpecCreateCommandInput extends CommandBaseInput { readonly type: "generationSpec.create"; readonly payload: SpecWriteInput; @@ -1735,7 +1860,7 @@ export type ReferenceInput = PinnedReferenceInput | FollowingReferenceInput; export type EditorDocumentInput = TimelineDocumentInput | SubjectDocumentInput | LayerDocumentInput | ImageCropDocumentInput | StackDocumentInput | ToolDocumentInput | DirectorDocumentInput | MediaEditDocumentInput; -export type CommandInput = ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | GroupSavePlanCommandInput | GroupPublishRunCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasLayoutRunsCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput; +export type CommandInput = ProjectCreateCommandInput | ProjectRenameCommandInput | ProjectTrashCommandInput | ProjectRestoreCommandInput | AssetImportCommandInput | ArtifactPublishCommandInput | AssetWriteTextCommandInput | AssetMetadataCommandInput | AssetDeleteCommandInput | CanvasCreateGenerationCommandInput | GroupSavePlanCommandInput | GroupPublishRunCommandInput | CanvasShowCommandInput | CanvasMoveCommandInput | CanvasUpdateCommandInput | CanvasLayoutRunsCommandInput | CanvasLayoutPipelinesCommandInput | CanvasHideCommandInput | CanvasMaterializeCommandInput | CanvasApplyEditCommandInput | CanvasPublishMediaCommandInput | TimelinePublishRenderCommandInput | PipelineStartCommandInput | PipelinePauseCommandInput | PipelineResumeCommandInput | PipelineCancelCommandInput | PipelineRetryCommandInput | PipelineAdoptCommandInput | NodeVersionApplyCommandInput | CanvasConfigureCommandInput | CanvasEditorAttachCommandInput | CanvasEditorDetachCommandInput | SpecCreateCommandInput | SpecUpdateCommandInput | SpecRestoreCommandInput | SpecPromptCommandInput | ReferenceAddCommandInput | ReferenceUpdateCommandInput | ReferenceRestoreCommandInput | ReferenceRemoveCommandInput | GenerationSubmitCommandInput | JobCancelCommandInput | JobRecoverCommandInput | JobCheckpointCommandInput | ResultSelectCommandInput | EditorCreateCommandInput | EditorSaveCommandInput | HistoryUndoCommandInput | HistoryRedoCommandInput | BatchCommandInput; export type ExecutionParametersInput = TextExecutionInput | ImageExecutionInput | VideoExecutionInput | AudioExecutionInput; @@ -1899,7 +2024,7 @@ export interface BatchCommand extends CommandBase { } export interface BatchPayload extends Contract { - readonly operations: ReadonlyArray; + readonly operations: ReadonlyArray; } export interface CameraFrame extends Contract { @@ -2016,6 +2141,16 @@ export interface CanvasItemVersion extends ObjectVersion { readonly objectType: "canvas_item"; } +export interface CanvasLayoutPipelinesCommand extends CommandBase { + readonly type: "canvas.layoutPipelines"; + readonly payload: EmptyPayload; +} + +export interface CanvasLayoutPipelinesCommandOperation { + readonly type: "canvas.layoutPipelines"; + readonly payload: EmptyPayload; +} + export interface CanvasLayoutRunsCommand extends CommandBase { readonly type: "canvas.layoutRuns"; readonly payload: EmptyPayload; @@ -2070,7 +2205,7 @@ export interface CanvasPresentationUpdate extends Contract { readonly locked: boolean | null; readonly color?: string | null; readonly parentId: string | null; - readonly autoLayout?: "run" | "free" | null; + readonly autoLayout?: "run" | "pipeline" | "free" | null; } export interface CanvasPublishMedia extends Contract { @@ -2169,6 +2304,28 @@ export interface CommandReceipt extends Contract { readonly jobIds: ReadonlyArray; readonly issues: ReadonlyArray; readonly eventCursor: number | null; + readonly pipelineExecutionId?: string | null; +} + +export interface CompiledPipelineGraph extends Contract { + readonly projectId: string; + readonly scope: GroupPipelineScope | SelectionPipelineScope | FromNodePipelineScope; + readonly cachePolicy: "reuse" | "force_from_node" | "force_all"; + readonly steps: ReadonlyArray; + readonly topologicalOrder: ReadonlyArray; + readonly issues: ReadonlyArray; + readonly plannedNewJobs: number; +} + +export interface CompiledPipelineStep extends Contract { + readonly itemId: string; + readonly kind: "generation" | "assembly"; + readonly upstreamItemIds: ReadonlyArray; + readonly inputFingerprint: string; + readonly cached: boolean; + readonly cacheCandidateJobId?: string | null; + readonly cacheCandidateAssetId?: string | null; + readonly expectedVersions: ReadonlyArray; } export interface ContainerBinding extends Contract { @@ -2192,9 +2349,9 @@ export interface CreationContracts extends Contract { readonly generationSpec: TextGenerationSpec | ImageGenerationSpec | VideoGenerationSpec | AudioGenerationSpec; readonly reference: PinnedReference | FollowingReference; readonly editorDocument: TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument; - readonly command: ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | GroupSavePlanCommand | GroupPublishRunCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasLayoutRunsCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand; + readonly command: ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | GroupSavePlanCommand | GroupPublishRunCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasLayoutRunsCommand | CanvasLayoutPipelinesCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | PipelineStartCommand | PipelinePauseCommand | PipelineResumeCommand | PipelineCancelCommand | PipelineRetryCommand | PipelineAdoptCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand; readonly receipt: CommandReceipt; - readonly query: ProjectQuery | ObjectQuery | VersionsQuery | AssetSearchQuery | AssetUsageQuery | CanvasStatusQuery | JobStatusQuery | AssetPreviewQuery; + readonly query: ProjectQuery | ObjectQuery | VersionsQuery | AssetSearchQuery | AssetUsageQuery | CanvasStatusQuery | JobStatusQuery | AssetPreviewQuery | PipelinePlanQuery | PipelineExecutionQuery | PipelineExecutionsQuery; readonly event: ProjectEvent; readonly job: Job; readonly result: ResultVersion; @@ -2311,6 +2468,12 @@ export interface FollowingSource extends Contract { readonly id: string; } +export interface FromNodePipelineScope extends Contract { + readonly kind: "from_node"; + readonly itemId: string; + readonly groupId?: string | null; +} + export interface GenerationBinding extends Contract { readonly role: "generation"; readonly objectRef: GenerationSpecRef; @@ -2366,7 +2529,7 @@ export interface GroupAssembly extends Contract { export interface GroupCanvasItem extends CanvasItemBase { readonly kind: "group"; - readonly autoLayout?: "run" | null; + readonly autoLayout?: "run" | "pipeline" | null; readonly runPlan?: SegmentRunPlan | null; readonly draftRunPlan?: SegmentRunPlan | null; readonly runPlanItemId?: string | null; @@ -2377,6 +2540,11 @@ export interface GroupCanvasItem extends CanvasItemBase { readonly binding: ContainerBinding; } +export interface GroupPipelineScope extends Contract { + readonly kind: "group"; + readonly groupId: string; +} + export interface GroupPlanDraft extends Contract { readonly groupId: string; readonly plan: SegmentRunPlan; @@ -2786,6 +2954,83 @@ export interface PinnedReferenceSource extends Contract { readonly sourceVersion: CanvasItemVersion; } +export interface PipelineAdopt extends Contract { + readonly executionId: string; + readonly itemId: string; + readonly jobId: string; +} + +export interface PipelineAdoptCommand extends CommandBase { + readonly type: "pipeline.adopt"; + readonly payload: PipelineAdopt; +} + +export interface PipelineCancelCommand extends CommandBase { + readonly type: "pipeline.cancel"; + readonly payload: PipelineControl; +} + +export interface PipelineControl extends Contract { + readonly executionId: string; +} + +export interface PipelineExecutionQuery extends QueryBase { + readonly type: "pipeline.execution.get"; + readonly objectId: string; +} + +export interface PipelineExecutionsQuery extends QueryBase { + readonly type: "pipeline.executions.list"; + readonly groupId?: string | null; +} + +export interface PipelinePauseCommand extends CommandBase { + readonly type: "pipeline.pause"; + readonly payload: PipelineControl; +} + +export interface PipelinePlanQuery extends QueryBase { + readonly type: "pipeline.plan"; + readonly scope: GroupPipelineScope | SelectionPipelineScope | FromNodePipelineScope; + readonly cachePolicy: "reuse" | "force_from_node" | "force_all"; + readonly forceFromItemId?: string | null; +} + +export interface PipelineResumeCommand extends CommandBase { + readonly type: "pipeline.resume"; + readonly payload: PipelineControl; +} + +export interface PipelineRetry extends Contract { + readonly executionId: string; + readonly stopOnFailure: boolean; + readonly maxConcurrency: number; +} + +export interface PipelineRetryCommand extends CommandBase { + readonly type: "pipeline.retry"; + readonly payload: PipelineRetry; +} + +export interface PipelineStart extends Contract { + readonly scope: GroupPipelineScope | SelectionPipelineScope | FromNodePipelineScope; + readonly cachePolicy: "reuse" | "force_from_node" | "force_all"; + readonly forceFromItemId?: string | null; + readonly stopOnFailure: boolean; + readonly maxConcurrency: number; +} + +export interface PipelineStartCommand extends CommandBase { + readonly type: "pipeline.start"; + readonly payload: PipelineStart; +} + +export interface PipelineStepIssue extends Contract { + readonly code: string; + readonly message: string; + readonly itemId?: string | null; +} + export interface Playhead extends Contract { readonly editorDocumentId: string; readonly seconds: number; @@ -3023,6 +3268,11 @@ export interface SelectionBox extends Contract { readonly height: number; } +export interface SelectionPipelineScope extends Contract { + readonly kind: "selection"; + readonly itemIds: ReadonlyArray; +} + export interface SpecCreateCommand extends CommandBase { readonly type: "generationSpec.create"; readonly payload: SpecWrite; @@ -3481,7 +3731,7 @@ export type Reference = PinnedReference | FollowingReference; export type EditorDocument = TimelineDocument | SubjectDocument | LayerDocument | ImageCropDocument | StackDocument | ToolDocument | DirectorDocument | MediaEditDocument; -export type Command = ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | GroupSavePlanCommand | GroupPublishRunCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasLayoutRunsCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand; +export type Command = ProjectCreateCommand | ProjectRenameCommand | ProjectTrashCommand | ProjectRestoreCommand | AssetImportCommand | ArtifactPublishCommand | AssetWriteTextCommand | AssetMetadataCommand | AssetDeleteCommand | CanvasCreateGenerationCommand | GroupSavePlanCommand | GroupPublishRunCommand | CanvasShowCommand | CanvasMoveCommand | CanvasUpdateCommand | CanvasLayoutRunsCommand | CanvasLayoutPipelinesCommand | CanvasHideCommand | CanvasMaterializeCommand | CanvasApplyEditCommand | CanvasPublishMediaCommand | TimelinePublishRenderCommand | PipelineStartCommand | PipelinePauseCommand | PipelineResumeCommand | PipelineCancelCommand | PipelineRetryCommand | PipelineAdoptCommand | NodeVersionApplyCommand | CanvasConfigureCommand | CanvasEditorAttachCommand | CanvasEditorDetachCommand | SpecCreateCommand | SpecUpdateCommand | SpecRestoreCommand | SpecPromptCommand | ReferenceAddCommand | ReferenceUpdateCommand | ReferenceRestoreCommand | ReferenceRemoveCommand | GenerationSubmitCommand | JobCancelCommand | JobRecoverCommand | JobCheckpointCommand | ResultSelectCommand | EditorCreateCommand | EditorSaveCommand | HistoryUndoCommand | HistoryRedoCommand | BatchCommand; export type ExecutionParameters = TextExecution | ImageExecution | VideoExecution | AudioExecution; diff --git a/src/i18n/messages/en-US/canvasShell.ts b/src/i18n/messages/en-US/canvasShell.ts index b13bad6ef..7bb3bf744 100644 --- a/src/i18n/messages/en-US/canvasShell.ts +++ b/src/i18n/messages/en-US/canvasShell.ts @@ -162,6 +162,32 @@ export const canvasShell = { "canvas.selection.group.colorBlue": "Blue", "canvas.selection.group.colorPurple": "Purple", "canvas.selection.group.download": "Download group assets", + "canvas.pipeline.drawerTitle": "Pipeline execution", + "canvas.pipeline.summary": "{total} steps · {succeeded} generated · {cached} cached · {failed} failed", + "canvas.pipeline.action.run": "Run pipeline", + "canvas.pipeline.action.pause": "Pause", + "canvas.pipeline.action.resume": "Resume", + "canvas.pipeline.action.cancel": "Stop", + "canvas.pipeline.action.retryFailed": "Retry failed", + "canvas.pipeline.action.forceAll": "Rerun all", + "canvas.pipeline.action.details": "Pipeline details", + "canvas.pipeline.status.queued": "Queued", + "canvas.pipeline.status.running": "Running", + "canvas.pipeline.status.pausing": "Pausing", + "canvas.pipeline.status.paused": "Paused", + "canvas.pipeline.status.awaitingInput": "Awaiting selection", + "canvas.pipeline.status.succeeded": "Completed", + "canvas.pipeline.status.failed": "Failed", + "canvas.pipeline.status.cancelled": "Stopped", + "canvas.pipeline.step.pending": "Pending", + "canvas.pipeline.step.cached": "Cached", + "canvas.pipeline.step.ready": "Ready", + "canvas.pipeline.step.running": "Running", + "canvas.pipeline.step.awaitingInput": "Awaiting selection", + "canvas.pipeline.step.succeeded": "Done", + "canvas.pipeline.step.failed": "Failed", + "canvas.pipeline.step.skipped": "Skipped", + "canvas.pipeline.step.cancelled": "Stopped", "canvas.selection.duplicate": "Duplicate", "canvas.selection.deleteNode": "Delete node", diff --git a/src/i18n/messages/en-US/canvasWorkspace.ts b/src/i18n/messages/en-US/canvasWorkspace.ts index 7c2ddf326..76e6f1b54 100644 --- a/src/i18n/messages/en-US/canvasWorkspace.ts +++ b/src/i18n/messages/en-US/canvasWorkspace.ts @@ -149,6 +149,17 @@ export const canvasWorkspace = { "canvas.workspace.menu.organizeRuns": "Organize Runs", "canvas.workspace.menu.lockRun": "Lock Run", "canvas.workspace.menu.runGroupChanged": "This group changed. Select an unlocked top-level group and try again.", + "canvas.workspace.pipeline.started": "Pipeline started.", + "canvas.workspace.pipeline.startFailed": "Could not start pipeline: {error}", + "canvas.workspace.pipeline.done": "Pipeline completed: {count} nodes generated.", + "canvas.workspace.pipeline.doneWithCache": "Pipeline completed: {succeeded} generated, {cached} cached.", + "canvas.workspace.pipeline.incomplete": "Pipeline finished: {succeeded} completed, {failed} failed, {skipped} skipped.", + "canvas.workspace.pipeline.pauseRequested": "Pause requested. The pipeline will stop after in-flight nodes finish.", + "canvas.workspace.pipeline.paused": "Pipeline paused.", + "canvas.workspace.pipeline.resumed": "Pipeline resumed.", + "canvas.workspace.pipeline.cancelled": "Pipeline stopped.", + "canvas.workspace.pipeline.retrying": "Retrying failed and skipped nodes.", + "canvas.workspace.pipeline.actionFailed": "Pipeline action failed: {error}", "canvas.workspace.menu.stackSelection": "Stack assets", "canvas.workspace.menu.ungroup": "Ungroup", "canvas.workspace.menu.autoArrange": "Auto arrange", diff --git a/src/i18n/messages/zh-CN/canvasShell.ts b/src/i18n/messages/zh-CN/canvasShell.ts index e68e89c03..b813463fc 100644 --- a/src/i18n/messages/zh-CN/canvasShell.ts +++ b/src/i18n/messages/zh-CN/canvasShell.ts @@ -158,6 +158,32 @@ export const canvasShell = { "canvas.selection.group.colorBlue": "蓝色", "canvas.selection.group.colorPurple": "紫色", "canvas.selection.group.download": "下载组内素材", + "canvas.pipeline.drawerTitle": "流水线执行", + "canvas.pipeline.summary": "共 {total} 步 · 新完成 {succeeded} · 复用 {cached} · 失败 {failed}", + "canvas.pipeline.action.run": "运行流水线", + "canvas.pipeline.action.pause": "暂停", + "canvas.pipeline.action.resume": "继续", + "canvas.pipeline.action.cancel": "停止", + "canvas.pipeline.action.retryFailed": "重试失败项", + "canvas.pipeline.action.forceAll": "全部重跑", + "canvas.pipeline.action.details": "流水线详情", + "canvas.pipeline.status.queued": "排队中", + "canvas.pipeline.status.running": "运行中", + "canvas.pipeline.status.pausing": "暂停中", + "canvas.pipeline.status.paused": "已暂停", + "canvas.pipeline.status.awaitingInput": "待采用", + "canvas.pipeline.status.succeeded": "已完成", + "canvas.pipeline.status.failed": "有失败", + "canvas.pipeline.status.cancelled": "已停止", + "canvas.pipeline.step.pending": "等待中", + "canvas.pipeline.step.cached": "已复用", + "canvas.pipeline.step.ready": "就绪", + "canvas.pipeline.step.running": "生成中", + "canvas.pipeline.step.awaitingInput": "待采用", + "canvas.pipeline.step.succeeded": "已完成", + "canvas.pipeline.step.failed": "失败", + "canvas.pipeline.step.skipped": "已跳过", + "canvas.pipeline.step.cancelled": "已停止", "canvas.selection.duplicate": "创建副本", "canvas.selection.deleteNode": "删除节点", diff --git a/src/i18n/messages/zh-CN/canvasWorkspace.ts b/src/i18n/messages/zh-CN/canvasWorkspace.ts index 8763288cf..5d83405a9 100644 --- a/src/i18n/messages/zh-CN/canvasWorkspace.ts +++ b/src/i18n/messages/zh-CN/canvasWorkspace.ts @@ -148,6 +148,17 @@ export const canvasWorkspace = { "canvas.workspace.menu.organizeRuns": "整理 Run", "canvas.workspace.menu.lockRun": "锁定 Run", "canvas.workspace.menu.runGroupChanged": "分组已发生变化,请选择一个未锁定的顶层分组后重试。", + "canvas.workspace.pipeline.started": "已启动流水线。", + "canvas.workspace.pipeline.startFailed": "无法启动流水线:{error}", + "canvas.workspace.pipeline.done": "流水线已完成,共生成 {count} 个节点。", + "canvas.workspace.pipeline.doneWithCache": "流水线已完成:新生成 {succeeded} 个节点,复用 {cached} 个未改动节点。", + "canvas.workspace.pipeline.incomplete": "流水线结束:完成 {succeeded},失败 {failed},跳过 {skipped}。", + "canvas.workspace.pipeline.pauseRequested": "已请求暂停流水线,当前节点完成后将停下。", + "canvas.workspace.pipeline.paused": "流水线已暂停。", + "canvas.workspace.pipeline.resumed": "已继续流水线。", + "canvas.workspace.pipeline.cancelled": "流水线已停止。", + "canvas.workspace.pipeline.retrying": "正在重试失败与跳过的节点。", + "canvas.workspace.pipeline.actionFailed": "流水线操作失败:{error}", "canvas.workspace.menu.stackSelection": "资源堆叠", "canvas.workspace.menu.ungroup": "取消编组", "canvas.workspace.menu.autoArrange": "自动排列", diff --git a/tests/groupWorkflow.test.ts b/tests/groupWorkflow.test.ts deleted file mode 100644 index 325353fd2..000000000 --- a/tests/groupWorkflow.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -import assert from "node:assert/strict"; -import test from "node:test"; -import { runWorkflowSteps } from "../src/canvas/groupWorkflow.ts"; - -const edge = (source: string, target: string) => ({ source, target, intent: undefined }); - -function harness(fail: readonly string[] = []) { - const events: string[] = []; - const pending = new Map void>(); - let active = 0, - peak = 0; - const runStep = (id: string) => - new Promise((resolve) => { - events.push(`start:${id}`); - active++; - peak = Math.max(peak, active); - pending.set(id, () => { - active--; - events.push(`end:${id}`); - resolve(!fail.includes(id)); - }); - }); - const finish = async (id: string) => { - for (let tries = 0; !pending.has(id) && tries < 50; tries++) - await new Promise((resolve) => setTimeout(resolve, 1)); - pending.get(id)!(); - pending.delete(id); - await new Promise((resolve) => setTimeout(resolve, 1)); - }; - return { events, runStep, finish, peak: () => peak }; -} - -test("independent steps run concurrently and dependents wait for their references", async () => { - const h = harness(); - // a -> c, b -> c, d independent. - const run = runWorkflowSteps(["a", "b", "c", "d"], [edge("a", "c"), edge("b", "c")], h.runStep); - await new Promise((resolve) => setTimeout(resolve, 1)); - assert.deepEqual(h.events, ["start:a", "start:b", "start:d"]); - await h.finish("a"); - assert.ok(!h.events.includes("start:c"), "c waits for b"); - await h.finish("b"); - assert.ok(h.events.includes("start:c")); - await h.finish("c"); - await h.finish("d"); - assert.deepEqual(await run, { succeeded: ["a", "b", "c", "d"], failed: [], skipped: [] }); - assert.equal(h.peak(), 3); -}); - -test("a failure skips its downstream chain but not unrelated steps", async () => { - const h = harness(["a"]); - const run = runWorkflowSteps(["a", "b", "c", "x"], [edge("a", "b"), edge("b", "c")], h.runStep); - await h.finish("a"); - await h.finish("x"); - assert.deepEqual(await run, { succeeded: ["x"], failed: ["a"], skipped: ["b", "c"] }); - assert.ok(!h.events.includes("start:b")); -}); - -test("reference cycles are skipped; inputs-only nodes and edit provenance add no dependency", async () => { - const h = harness(); - const run = runWorkflowSteps( - ["a", "b", "c"], - [edge("a", "b"), edge("b", "a"), edge("material", "c"), { source: "a", target: "c", intent: "post_edit_result" }], - h.runStep, - ); - await h.finish("c"); - assert.deepEqual(await run, { succeeded: ["c"], failed: [], skipped: ["a", "b"] }); -}); - -test("a dependency carried through a non-step node still orders the steps", async () => { - const h = harness(); - // image a -> subject s -> video b: b must wait for a. - const run = runWorkflowSteps(["a", "b"], [edge("a", "s"), edge("s", "b")], h.runStep); - await new Promise((resolve) => setTimeout(resolve, 1)); - assert.deepEqual(h.events, ["start:a"]); - await h.finish("a"); - await h.finish("b"); - assert.deepEqual(await run, { succeeded: ["a", "b"], failed: [], skipped: [] }); -}); - -test("a step that throws counts as failed", async () => { - const result = await runWorkflowSteps(["a", "b"], [edge("a", "b")], async (id) => { - if (id === "a") throw new Error("boom"); - return true; - }); - assert.deepEqual(result, { succeeded: [], failed: ["a"], skipped: ["b"] }); -}); diff --git a/tests/test_creation_api.py b/tests/test_creation_api.py index 0500c892b..1fcdbee9b 100644 --- a/tests/test_creation_api.py +++ b/tests/test_creation_api.py @@ -359,7 +359,7 @@ def test_run_layout_reflows_subsequent_rows_after_children_grow(api): group_ids, child_ids, timeline_ids = [], [], [] for name in ('A', 'B', 'C'): group = _show_layout_item(project_id, 'group', title=f'Run {name}', - width=1200, height=300, autoLayout='run') + width=1200, height=300, autoLayout='pipeline') group_id = _layout_item_id(group) plan = _show_layout_item(project_id, 'text', title=f'Plan {name}', parentId=group_id) timeline_id = str(uuid4()) @@ -409,7 +409,7 @@ def test_run_layout_reflows_subsequent_rows_after_children_grow(api): assert 0 <= left < right <= after[a]['width'] assert 0 <= top < bottom <= after[a]['height'] - _layout_command(client, path, project_id, 'canvas.layoutRuns', {}, status='noop') + _layout_command(client, path, project_id, 'canvas.layoutPipelines', {}, status='noop') assert _canvas_items(client.get(path).json()) == after @@ -420,7 +420,7 @@ def test_run_layout_respects_locked_runs_and_ordinary_root_items(api): assert client.post(path + '/open').status_code == 200 fixed = _show_layout_item(project_id, 'group', title='Locked Run', width=650, - height=480, position=dict(x=1100, y=0), autoLayout='run', locked=True) + height=480, position=dict(x=1100, y=0), autoLayout='pipeline', locked=True) ordinary = _show_layout_item(project_id, 'text', title='Source', width=1000, height=480) managed = _show_layout_item(project_id, 'group', title='Run to arrange', width=1200, height=300) fixed_id, ordinary_id, managed_id = map(_layout_item_id, (fixed, ordinary, managed)) @@ -430,13 +430,13 @@ def test_run_layout_respects_locked_runs_and_ordinary_root_items(api): before = _canvas_items(client.get(path).json()) assert before[managed_id]['position'] == before[ordinary_id]['position'] _layout_command(client, path, project_id, 'canvas.update', - dict(itemId=managed_id, autoLayout='run'), + dict(itemId=managed_id, autoLayout='pipeline'), expected_versions=[dict(objectType='canvas_item', id=managed_id, revision=before[managed_id]['revision'])]) after = _canvas_items(client.get(path).json()) assert after[fixed_id] == before[fixed_id] assert after[ordinary_id] == before[ordinary_id] - assert after[managed_id]['autoLayout'] == 'run' + assert after[managed_id]['autoLayout'] == 'pipeline' _assert_disjoint([after[key] for key in (fixed_id, ordinary_id, managed_id)]) child = _show_layout_item(project_id, 'text', parentId=fixed_id) @@ -463,7 +463,7 @@ def test_run_layout_rejects_intersecting_locked_runs_atomically(api): project_id = command['projectId'] assert client.post(path + '/open').status_code == 200 - operations = [_show_layout_item(project_id, 'group', title=title, autoLayout='run', locked=True) + operations = [_show_layout_item(project_id, 'group', title=title, autoLayout='pipeline', locked=True) for title in ('First', 'Second')] response = client.post(path + '/commands', json=dict( type='creation.batch', commandId=str(uuid4()), projectId=project_id, @@ -488,7 +488,7 @@ def test_run_layout_shares_material_but_rejects_shared_editable_objects(api): material = dict(role='material', objectRef=dict( assetId=asset['id'], revision=asset['revision'], fingerprint=asset['fingerprint'], kind='text', )) - runs = [_show_layout_item(project_id, 'group', autoLayout='run') for _ in range(2)] + runs = [_show_layout_item(project_id, 'group', autoLayout='pipeline') for _ in range(2)] run_ids = [_layout_item_id(run) for run in runs] sources = [_show_layout_item(project_id, 'text', parentId=run_id, binding=material) for run_id in run_ids] _layout_command(client, path, project_id, 'creation.batch', dict(operations=[*runs, *sources])) @@ -532,7 +532,7 @@ def test_run_layout_rejects_unrepresentable_placement(api): assert client.post(path + '/open').status_code == 200 before = client.get(path).json() obstacle = _show_layout_item(project_id, 'group', width=3000, height=1e20) - run = _show_layout_item(project_id, 'group', width=2000, autoLayout='run') + run = _show_layout_item(project_id, 'group', width=2000, autoLayout='pipeline') receipt = client.post(path + '/commands', json=dict( type='creation.batch', projectId=project_id, commandId=str(uuid4()), payload=dict(operations=[obstacle, run]), diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py new file mode 100644 index 000000000..180452ecc --- /dev/null +++ b/tests/test_pipeline.py @@ -0,0 +1,377 @@ +"""Tests for Pipeline DAG compilation, caching, concurrent execution, and control lifecycle.""" + +import asyncio +from uuid import UUID, uuid4 + +import pytest + +from opendirector.application.creation_generation import CreationGeneration +from opendirector.application.creation_pipeline import PipelineExecutor +from opendirector.domain.creation.commands import parse_command +from opendirector.domain.creation.pipeline import ( + FromNodePipelineScope, + GroupPipelineScope, + SelectionPipelineScope, + compile_pipeline, +) +from opendirector.domain.projects import ProjectError +from opendirector.infrastructure.model_configs import ModelConfigs +from test_creation_canvas_service import media, project, send, ver + + +pytestmark = [pytest.mark.cpu, pytest.mark.ready] + + +@pytest.fixture +def anyio_backend(): + return 'asyncio' + + +class StubProvider: + def __init__(self, *, barrier_prompts=None, fail_prompts=None, gate=None): + self.calls = [] + self.barrier_prompts = set(barrier_prompts or ()) + self.arrived = set() + self.barrier_ready = asyncio.Event() + self.fail_prompts = set(fail_prompts or ()) + self.gate = gate + + def validate(self, kind, config): + pass + + async def generate(self, config, task, submitted): + prompt = task.inputSnapshot.spec.prompt if hasattr(task, 'inputSnapshot') else task['prompt'] + self.calls.append(prompt) + if prompt in self.barrier_prompts: + self.arrived.add(prompt) + if self.barrier_prompts <= self.arrived: + self.barrier_ready.set() + await asyncio.wait_for(self.barrier_ready.wait(), timeout=5) + if self.gate is not None: + await self.gate.wait() + if prompt in self.fail_prompts: + raise RuntimeError(f'forced failure for {prompt}') + return 'md', f'output:{prompt}:{len(self.calls)}'.encode() + + +def _make_runtime(project_fixture, provider): + store, _, _ = project_fixture + configs = ModelConfigs(store.local.repository) + config = configs.save( + 'agent', 'http://127.0.0.1:12345/v1', 'test-agent', '', + connection_type='self_hosted', protocol='openai', auth_mode='none', + ) + generation = CreationGeneration(store, configs, provider) + pipelines = PipelineExecutor(store, generation, configs) + generation.pipelines = pipelines + return generation, pipelines, config + + +def _make_text_node(project_fixture, config, prompt, *, parent_id=None, title=None): + store, pid, session = project_fixture + item, spec = media(project_fixture, 'text', title=title or prompt, purpose='generation') + if parent_id is not None: + assert send(store, pid, 'canvas.update', session=session, versions=[ver('canvas_item', item)], + itemId=item.id, parentId=parent_id).status == 'applied' + updated_spec = spec.model_copy(update={'prompt': prompt, 'modelConfigId': UUID(config['id'])}) + assert send(store, pid, 'generationSpec.update', session=session, versions=[ver('generation_spec', spec)], + spec=updated_spec).status == 'applied' + snapshot = store.snapshot(pid) + return ( + next(c for c in snapshot.canvasItems if c.id == item.id), + next(s for s in snapshot.generationSpecs if s.id == spec.id), + ) + + +def _link(project_fixture, source_item, target_item, target_spec, order=0): + store, pid, session = project_fixture + snapshot = store.snapshot(pid) + fresh_spec = next(s for s in snapshot.generationSpecs if s.id == target_spec.id) + fresh_source = next(c for c in snapshot.canvasItems if c.id == source_item.id) + fresh_target = next(c for c in snapshot.canvasItems if c.id == target_item.id) + ref = { + 'id': str(uuid4()), + 'projectId': str(pid), + 'targetSpecId': str(fresh_spec.id), + 'role': 'reference', + 'order': order, + 'binding': 'follow_current', + 'source': {'objectType': 'canvas_item', 'id': str(fresh_source.id)}, + } + receipt = send( + store, pid, 'reference.add', session=session, + versions=[ver('generation_spec', fresh_spec), ver('canvas_item', fresh_target)], + reference=ref, + ) + assert receipt.status == 'applied', receipt + + +async def _wait_pipeline(pipelines, project_id, execution_id, *, targets=('succeeded', 'failed', 'paused', 'cancelled')): + for _ in range(200): + status = await pipelines.status(project_id, execution_id) + if status['status'] in targets: + return status + await asyncio.sleep(0.02) + raise AssertionError(f'Pipeline {execution_id} did not reach {targets}: {status}') + + +@pytest.mark.anyio +async def test_pipeline_compile_cycle_rejected_before_execution(project): + store, pid, session = project + provider = StubProvider() + generation, pipelines, config = _make_runtime(project, provider) + group_id = uuid4() + assert send(store, pid, 'canvas.show', session=session, item={ + 'id': str(group_id), 'projectId': str(pid), 'kind': 'group', 'title': 'Cyclic', + }).status == 'applied' + node_a, spec_a = _make_text_node(project, config, 'step-a', parent_id=group_id) + node_b, spec_b = _make_text_node(project, config, 'step-b', parent_id=group_id) + _link(project, node_a, node_b, spec_b) + _link(project, node_b, node_a, spec_a) + + plan = await pipelines.plan(pid, GroupPipelineScope(kind='group', groupId=group_id)) + assert plan['issues'] + assert plan['issues'][0]['code'] == 'pipeline_cycle' + + start_cmd = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'scope': {'kind': 'group', 'groupId': str(group_id)}}, + }) + with pytest.raises(ProjectError) as exc: + await generation.execute(start_cmd, session=session) + assert exc.value.code == 'pipeline_cycle' + assert store.snapshot(pid).jobs == () + + +@pytest.mark.anyio +async def test_pipeline_concurrent_branches_and_default_cache_reuse(project): + store, pid, session = project + provider = StubProvider(barrier_prompts={'branch-left', 'branch-right'}) + generation, pipelines, config = _make_runtime(project, provider) + await generation.start() + await pipelines.start() + try: + group_id = uuid4() + assert send(store, pid, 'canvas.show', session=session, item={ + 'id': str(group_id), 'projectId': str(pid), 'kind': 'group', 'title': 'Diamond', + }).status == 'applied' + left, _ = _make_text_node(project, config, 'branch-left', parent_id=group_id) + right, _ = _make_text_node(project, config, 'branch-right', parent_id=group_id) + merge, spec_merge = _make_text_node(project, config, 'merge-v1', parent_id=group_id) + _link(project, left, merge, spec_merge, order=0) + _link(project, right, merge, spec_merge, order=1) + + cmd1 = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'scope': {'kind': 'group', 'groupId': str(group_id)}}, + }) + receipt1 = await generation.execute(cmd1, session=session) + assert receipt1.pipelineExecutionId == cmd1.commandId + done1 = await _wait_pipeline(pipelines, pid, cmd1.commandId) + assert done1['status'] == 'succeeded' + # Both branches hit the concurrency barrier simultaneously. + assert provider.barrier_ready.is_set() + assert provider.calls.count('branch-left') == 1 + assert provider.calls.count('branch-right') == 1 + assert provider.calls.count('merge-v1') == 1 + + # Edit only the merge node prompt; left and right are untouched. + fresh_merge_spec = next(s for s in store.snapshot(pid).generationSpecs if s.id == spec_merge.id) + assert send(store, pid, 'generationSpec.update', session=session, + versions=[ver('generation_spec', fresh_merge_spec)], + spec=fresh_merge_spec.model_copy(update={'prompt': 'merge-v2'})).status == 'applied' + + plan2 = await pipelines.plan(pid, GroupPipelineScope(kind='group', groupId=group_id)) + assert plan2['plannedNewJobs'] == 1 + cached_ids = {step['itemId'] for step in plan2['steps'] if step['cached']} + assert cached_ids == {str(left.id), str(right.id)} + + cmd2 = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'scope': {'kind': 'group', 'groupId': str(group_id)}, 'cachePolicy': 'reuse'}, + }) + await generation.execute(cmd2, session=session) + done2 = await _wait_pipeline(pipelines, pid, cmd2.commandId) + assert done2['status'] == 'succeeded' + statuses2 = {step['itemId']: step['status'] for step in done2['steps']} + assert statuses2[str(left.id)] == 'cached' + assert statuses2[str(right.id)] == 'cached' + assert statuses2[str(merge.id)] == 'succeeded' + # Left and right were NOT re-run. + assert provider.calls.count('branch-left') == 1 + assert provider.calls.count('branch-right') == 1 + assert provider.calls.count('merge-v2') == 1 + + # Force all re-runs everything. + provider.arrived.clear() + provider.barrier_ready.clear() + cmd3 = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'scope': {'kind': 'group', 'groupId': str(group_id)}, 'cachePolicy': 'force_all'}, + }) + await generation.execute(cmd3, session=session) + done3 = await _wait_pipeline(pipelines, pid, cmd3.commandId) + assert done3['status'] == 'succeeded' + assert provider.calls.count('branch-left') == 2 + assert provider.calls.count('branch-right') == 2 + assert provider.calls.count('merge-v2') == 2 + finally: + await pipelines.close() + await generation.close() + + +@pytest.mark.anyio +async def test_pipeline_partial_failure_skips_downstream_and_retry_reuses_succeeded(project): + store, pid, session = project + provider = StubProvider(fail_prompts={'step-a'}) + generation, pipelines, config = _make_runtime(project, provider) + await generation.start() + await pipelines.start() + try: + node_a, _ = _make_text_node(project, config, 'step-a') + node_b, spec_b = _make_text_node(project, config, 'step-b') + node_c, _ = _make_text_node(project, config, 'step-c') + _link(project, node_a, node_b, spec_b) + + scope = {'kind': 'selection', 'itemIds': [str(node_a.id), str(node_b.id), str(node_c.id)]} + start_cmd = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'scope': scope}, + }) + await generation.execute(start_cmd, session=session) + failed = await _wait_pipeline(pipelines, pid, start_cmd.commandId) + assert failed['status'] == 'failed' + statuses = {step['itemId']: step['status'] for step in failed['steps']} + assert statuses == {str(node_a.id): 'failed', str(node_b.id): 'skipped', str(node_c.id): 'succeeded'} + + # Clear failure and retry: step-c must be reused, only step-a and step-b execute. + provider.fail_prompts.clear() + retry_cmd = parse_command({ + 'type': 'pipeline.retry', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'executionId': str(start_cmd.commandId)}, + }) + await generation.execute(retry_cmd, session=session) + recovered = await _wait_pipeline(pipelines, pid, start_cmd.commandId) + assert recovered['status'] == 'succeeded' + assert provider.calls.count('step-c') == 1 + assert provider.calls.count('step-a') == 2 + assert provider.calls.count('step-b') == 1 + finally: + await pipelines.close() + await generation.close() + + +@pytest.mark.anyio +async def test_pipeline_pause_resume_and_idempotent_replay(project): + store, pid, session = project + gate = asyncio.Event() + provider = StubProvider(gate=gate) + generation, pipelines, config = _make_runtime(project, provider) + await generation.start() + await pipelines.start() + try: + node_a, _ = _make_text_node(project, config, 'first-step') + node_b, spec_b = _make_text_node(project, config, 'second-step') + _link(project, node_a, node_b, spec_b) + + scope = {'kind': 'from_node', 'itemId': str(node_a.id)} + cmd_id = uuid4() + start_cmd = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(cmd_id), + 'payload': {'scope': scope}, + }) + receipt1 = await generation.execute(start_cmd, session=session) + # Idempotent replay with same commandId and payload returns same execution. + receipt2 = await generation.execute(start_cmd, session=session) + assert receipt1.pipelineExecutionId == receipt2.pipelineExecutionId + + # Conflicting payload with same commandId is rejected. + conflict_cmd = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(cmd_id), + 'payload': {'scope': scope, 'cachePolicy': 'force_all'}, + }) + with pytest.raises(ProjectError) as exc: + await generation.execute(conflict_cmd, session=session) + assert exc.value.code == 'command_conflict' + + # Request pause while step A is in-flight; release gate so step A finishes and pipeline pauses before B. + pause_cmd = parse_command({ + 'type': 'pipeline.pause', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'executionId': str(cmd_id)}, + }) + await generation.execute(pause_cmd, session=session) + gate.set() + paused = await _wait_pipeline(pipelines, pid, cmd_id, targets=('paused',)) + assert paused['status'] == 'paused' + assert provider.calls == ['first-step'] + + resume_cmd = parse_command({ + 'type': 'pipeline.resume', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'executionId': str(cmd_id)}, + }) + await generation.execute(resume_cmd, session=session) + done = await _wait_pipeline(pipelines, pid, cmd_id, targets=('succeeded',)) + assert done['status'] == 'succeeded' + assert provider.calls == ['first-step', 'second-step'] + finally: + await pipelines.close() + await generation.close() + + +@pytest.mark.anyio +async def test_pipeline_cancel_marks_pending_steps_cancelled(project): + store, pid, session = project + gate = asyncio.Event() + provider = StubProvider(gate=gate) + generation, pipelines, config = _make_runtime(project, provider) + await generation.start() + await pipelines.start() + try: + node_a, _ = _make_text_node(project, config, 'cancel-a') + node_b, spec_b = _make_text_node(project, config, 'cancel-b') + _link(project, node_a, node_b, spec_b) + + cmd_id = uuid4() + start_cmd = parse_command({ + 'type': 'pipeline.start', + 'projectId': str(pid), + 'commandId': str(cmd_id), + 'payload': {'scope': {'kind': 'from_node', 'itemId': str(node_a.id)}}, + }) + await generation.execute(start_cmd, session=session) + cancel_cmd = parse_command({ + 'type': 'pipeline.cancel', + 'projectId': str(pid), + 'commandId': str(uuid4()), + 'payload': {'executionId': str(cmd_id)}, + }) + await generation.execute(cancel_cmd, session=session) + gate.set() + cancelled = await _wait_pipeline(pipelines, pid, cmd_id, targets=('cancelled',)) + assert cancelled['status'] == 'cancelled' + statuses = {step['itemId']: step['status'] for step in cancelled['steps']} + assert statuses[str(node_b.id)] == 'cancelled' + assert 'cancel-b' not in provider.calls + finally: + await pipelines.close() + await generation.close() diff --git a/tests/test_query_guidance.py b/tests/test_query_guidance.py index a7644452a..7f223c8ba 100644 --- a/tests/test_query_guidance.py +++ b/tests/test_query_guidance.py @@ -27,6 +27,25 @@ def test_the_tool_description_lists_every_legal_type(): assert 'canvas_items' not in QUERY_TYPES +def test_query_tool_keeps_nested_pipeline_scopes_and_hides_host_fields(): + schema = next(item['function']['parameters'] for item in tools() + if item['function']['name'] == 'query') + definitions = schema['$defs'] + queries = schema['discriminator']['mapping'] + for ref in queries.values(): + query = definitions[ref.rsplit('/', 1)[-1]] + assert {'queryId', 'projectId'}.isdisjoint(query['properties']) + assert {'queryId', 'projectId'}.isdisjoint(query['required']) + + plan = definitions[queries['pipeline.plan'].rsplit('/', 1)[-1]] + scope = plan['properties']['scope'] + scopes = scope['discriminator']['mapping'] + assert set(scopes) == {'group', 'selection', 'from_node'} + for kind, field in [('group', 'groupId'), ('selection', 'itemIds'), ('from_node', 'itemId')]: + branch = definitions[scopes[kind].rsplit('/', 1)[-1]] + assert set(branch['required']) == {'kind', field} + + def test_an_unknown_type_is_answered_with_the_closest_legal_one(): message = guidance({'type': 'canvas_items'}) assert 'canvas_items' in message