diff --git a/.agents/skills/opendirector-agent-development/SKILL.md b/.agents/skills/opendirector-agent-development/SKILL.md index b604768f7..2c594ff20 100644 --- a/.agents/skills/opendirector-agent-development/SKILL.md +++ b/.agents/skills/opendirector-agent-development/SKILL.md @@ -20,6 +20,7 @@ Read the upstream files at the revisions pinned by OpenDirector. If a matching c - **Changes to Agent behavior or reliability** → [eval-harness](../../upstream/ecc/skills/eval-harness/SKILL.md#eval-types). Use **Eval Types** and the grader and repeat-run guidance in **Product Evals**. Grade observable effects through OpenDirector's test entry points and apply the project’s acceptance criteria. - **Tool scope, workspace isolation, or sensitive trace output** → [agent-security-hardening](../../upstream/ecc/skills/agent-security-hardening/SKILL.md#hardening-workflow). Use **Map Trust Boundaries** and **Bound and Sanitize Tool Output** when reviewing the affected boundary. - **Formal pull request review** → [opendirector-review](../opendirector-review/SKILL.md) for the review procedure. Apply the matching development references and the constraints below to the Agent change. +- **Submitting an AI-authored pull request** → Complete the [independent scoring step](../../../AGENTS.md#ai-authored-pr-submission) before opening the PR, updating its head, or marking it ready. ## OpenDirector constraints diff --git a/.agents/skills/opendirector-review/SKILL.md b/.agents/skills/opendirector-review/SKILL.md index 61b26cbf1..67f243fa7 100644 --- a/.agents/skills/opendirector-review/SKILL.md +++ b/.agents/skills/opendirector-review/SKILL.md @@ -1,6 +1,6 @@ --- name: opendirector-review -description: Review one OpenDirector pull request tip, verify evidence, and report PASS, WITHHOLD, or REQUEST CHANGES. Use when asked to review or score an OpenDirector PR or tip. +description: Review one OpenDirector pull request tip, verify evidence, and report PASS, WITHHOLD, or REQUEST CHANGES. Use to review or score an OpenDirector PR or to score a committed candidate before submission. --- # OpenDirector review @@ -45,6 +45,19 @@ architecture pages indexed from [docs/README.md](../../../docs/README.md). Review the tip against the fetched default branch. If the tip is itself the rule change, say so and review that change. +## Score an unpublished candidate + +For author-delegated pre-review, read the review guidance at the pinned +target base. Review the committed diff between the supplied base and head, +the draft PR body, any linked Issue, and the test and artifact evidence. +Apply the issue-fit, architecture, test, and evidence criteria below. +List applicable PR-triggered checks that have yet to run. + +Keep this review read-only. Return findings and the +[advisory score](#advisory-score) to the author for the supplied SHAs. +Withhold the total on a stale or materially incomplete snapshot. Use +the live PR workflow and its verdicts below for formal PR review. + ## Establish the tip Record these from the remote before reading the narrative: diff --git a/.agents/upstream/minimax-h3 b/.agents/upstream/minimax-h3 new file mode 160000 index 000000000..199b7d0e1 --- /dev/null +++ b/.agents/upstream/minimax-h3 @@ -0,0 +1 @@ +Subproject commit 199b7d0e1fd95e7b3eafa8c15eca692534142427 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0a2ab67d9..48e35ae9d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -22,6 +22,7 @@ Say what you ran locally and what you left to Release checks. Name checks you co - Local: - Left to CI: +- For AI-authored PRs, include the independent pre-review score, reviewed base and head, and any material validation gaps. ## Evidence that it works diff --git a/.gitmodules b/.gitmodules index 88ef9e6ba..0c5150f93 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ path = .agents/upstream/agents-best-practices url = https://github.com/DenisSergeevitch/agents-best-practices.git shallow = true +[submodule "minimax-h3"] + path = .agents/upstream/minimax-h3 + url = https://github.com/MiniMax-AI/MiniMax-H3.git + shallow = true diff --git a/AGENTS.md b/AGENTS.md index a9cae012c..5b75677f8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -153,6 +153,32 @@ Acceptance focuses on output that actually meets creative requirements, recovera - Production studios, complete scriptwriting and full-series delivery systems, additional model capabilities, and background rendering engines require explicit requirements; do not expand scope automatically because of the unified project model. - When adding or changing user-visible content, follow the new-feature checklist in [Bilingual interface](docs/development/i18n.md) and run `npm run check:i18n`. Automated checks alone are insufficient; switch between both languages and inspect the new flow. +## AI-authored PR submission + +Before opening an AI-authored PR, updating its head, or marking a draft +ready, the author first runs the +[OpenDirector review skill in candidate review mode](.agents/skills/opendirector-review/SKILL.md#score-an-unpublished-candidate) +on the committed diff against the full target base SHA. Use the intended +PR body and available check and artifact evidence to score the candidate +against the skill's rubric. Address findings, fill evidence gaps, and +rerun the self-review on the revised candidate before requesting +independent review. + +Then start a separate subagent that did not contribute to the change. +Give it the full base and committed candidate head SHAs, the intended PR body, +and check and artifact evidence. Ask it to use the same candidate review +mode and return findings and a score. + +Proceed when the subagent scores the candidate **at least 80/100** and +blocking findings are resolved. Address a lower or withheld score with +fixes or evidence, then request a fresh review. Before submission, confirm +the current target base and outgoing head still match the review. Rescore +if either SHA or any material claim or evidence changes. When no subagent +is available, keep submission pending and report the blocker. + +Record the independent score, reviewed base and head, and material validation gaps +in the PR body. Follow the existing PR review and Release checks process. + ## Documentation maintenance Update this document when architectural principles or development direction change; do not maintain implementation progress here. The [documentation index and maintenance rules](docs/README.md) index the formal documentation, which is delivered with the code through Git. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7739c8130..81407bef3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ Labels are short, English and prefixed by dimension, so issues and PRs can be fi | --- | --- | | `area:canvas` | Canvas, nodes, direct manipulation | | `area:agent` | Agent runtime, assistant chat, tools | -| `area:harness` | Harness and skill integration (Default, OpenCode, Codex, Claude Code, JiuwenSwarm, DSH, Pi) | +| `area:harness` | Harness and skill integration (Default, OpenCode, Codex, Claude Code, JiuwenSwarm, DSH, Pi, Antigravity) | | `area:provider` | Model providers and generation protocols | | `area:assets` | Assets, library, reference inputs | | `area:timeline` | Timeline, subtitles, export | diff --git a/README.md b/README.md index 2d3c755c9..de194958a 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ Use Chrome or Edge for MP4 export, and keep the page and editor open while rende ## Community -Join the **OpenDirector with vLLM-Omni (2)** WeChat group to discuss OpenDirector and share your creations. Scan the QR code below in WeChat, or click the image to view it at full resolution. +Join the **OpenDirector with vLLM-Omni (3)** WeChat group to discuss OpenDirector and share your creations. Scan the QR code below in WeChat, or click the image to view it at full resolution.

- - QR code for the OpenDirector with vLLM-Omni (2) WeChat group + + QR code for the OpenDirector with vLLM-Omni (3) WeChat group

diff --git a/README.zh-CN.md b/README.zh-CN.md index 7b4d4894c..b28e0a2df 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -112,8 +112,8 @@ opendirector serve 欢迎加入 **OpenDirector** 交流群,交流 OpenDirector 的使用经验、分享创作。使用微信扫描下方二维码入群,点击图片可查看完整分辨率。

- - OpenDirector with vLLM-Omni (2) 微信群二维码 + + OpenDirector with vLLM-Omni (3) 微信群二维码

diff --git a/RFC.md b/RFC.md new file mode 100644 index 000000000..b0257c491 --- /dev/null +++ b/RFC.md @@ -0,0 +1,58 @@ +# RFC: Benchmark TTFA and TTC and Reduce Agent Tool Overhead + +Draft for discussion + +## Problem + +In a face-replacement run, the execution record showed 1,224 calls, 1,209 completed and 15 failed. The Agent reported publishing an editable timeline and a finished video. Users have to open the trace to tell whether the Agent changed the project, is still waiting for generation, or hit an error that needs attention. + +![The execution record in AI chat after a face-replacement task.](feature-assets/agent-perf/execution-record.png) + +Six Bash calls waiting on 15 generation jobs produced 968 `job wait` requests (91.9% of CLI traffic). These included 954 status queries and 14 project snapshot reads. Of the status queries, 939 returned `queued` or `running`. All 939 counted as completed calls while their jobs were still in progress. [Polling loop](packages/core/src/opendirector/cli.py#L679) + +Some errors led to avoidable retries. Five of 20 `generation submit` attempts failed. The gateway rejected two of those attempts because the Agent changed the input and reused the original call ID. The panel keeps the latest status per ID, so it showed 14 failed CLI records and one failed DeepSeek record. The CLI trace had 16 failed attempts out of 1,053. The 1,224 panel records came from 173 DeepSeek tool IDs and 1,051 CLI call IDs. Of the 15 generation jobs, 14 succeeded and one failed after the provider returned HTTP 500 during a status check. [Local trace](http://127.0.0.1:18000/?traceProject=4e200d00-f9e6-4b45-9f2f-50bf39cdb67c&turn=3f68aec5-8fc4-481b-914a-69e5de2f1078&runtime=deepseek) · [Panel summary](src/canvas/AssistantReply.tsx#L151) · [Tool updates](src/canvas/useAssistantChat.ts#L563) · [Call ID validation](packages/core/src/opendirector/agent/gateway.py#L48) + +After sending an image prompt, users wait for an editable node to appear. The node can be visible while the image is still generating. The single-image benchmark times both waits from Send so we can see where users spend their time. + +## Latency metrics + +Both timers start when the user submits the prompt in AI chat. The browser benchmark uses the same Send click and monotonic clock for both. It requests one 2048 × 2048 PNG in an empty project. A fresh baseline with real models is pending. [Benchmark guide](docs/development/agent-image-benchmark.md) + +| Metric | End event | Single-image benchmark | +| --- | --- | --- | +| TTFA (Time to First Action) | The first frame that shows a canvas change in the viewport from this turn's committed project state. | The new editable image node appears in the viewport. | +| TTC (Time to Completion) | The first frame that shows the requested result ready for use on the canvas. | The decoded image appears in the node. Verify that this turn's successful job produced the image and the preview matches the persisted asset adopted by the project. | + +Use the same benchmark definition for baseline and candidate runs. Pin the following inputs for each case. + +- The exact user prompt, any reference assets, and the starting project state. +- The Agent harness, including the resolved runtime and version and its tool and skill settings. +- The Agent model and image model, including their providers, model IDs, versions where available, and effective settings. Record settings such as the Agent's reasoning level and the image's generation size and output format. + +Report P50 and P90 for both metrics and include sample counts, failures, and timeouts. Keep the TTFA sample if the node appears and generation later fails. The TTFA budget for an explicit single-image request is 3 seconds. Report the share of runs within 3 seconds and the share over 8 seconds. Set the TTC target after collecting the baseline. [Interaction budgets](docs/development/ui-performance.md#interaction-budgets) · [Browser benchmark](tests/browser/agent_image_latency.mjs) + +## Tool calls and failures + +- Count runtime tool calls, CLI attempts, and internal polling separately for each turn. Link requests to the parent tool call where the trace records that relationship. Use project receipts and subsequent actions to mark calls that advanced the task, necessary reads or waits, avoidable repeats, and calls with unclear purpose. Review a sample before automating the labels. For repeated reads, check the revision and whether the Agent used the result. +- Report failures as a share of attempts in each layer. Include error codes, retry outcomes, and generation job status. Start with reproducible parameter, contract, revision, and call ID errors. + +## Parallel work items + +T1 and T2 can start with the DeepSeek video trace. T3 and T4 can profile the existing single-image case while T5 defines the shared benchmark for final comparisons. + +| Task | Work | Acceptance | +| --- | --- | --- | +| T1. Explain and reduce avoidable calls | Reconcile the execution record with the trace. Label sample calls and propose ways to reduce redundant reads or polling and improve the breakdown shown in the panel. | Reproduce the panel count of 1,224. For candidate changes, check actual request counts, how quickly status updates appear, and which changes the project records. | +| T2. Reduce tool failures | Reproduce the parameter, revision, and call ID errors. Propose changes to tool contracts, error messages, or retry behavior. Look up the original operation if its submission outcome is unknown. | Rank preventable errors by code. Compare failure and recovery rates on the same cases and verify that recovery preserves receipts and avoids duplicate writes. | +| T3. Reduce TTFA | Measure draft save, turn admission, runtime startup, node commit, project sync, and the first visible frame. | Propose a change based on the measured delay and compare TTFA. Match the visible node to its project commit and verify that selection, viewport, and unsaved input are preserved. | +| T4. Reduce TTC | Measure from job submission through provider execution, asset registration, adoption, and preview decoding. Use those timings to locate the critical path from Send to completion. | Propose a change and compare TTC, success rate, and duplicate submissions. Check that the displayed image matches the adopted asset and meets the requested dimensions and format. | +| T5. Define the reference benchmark | Turn the existing single-image case into a versioned benchmark. Fix the prompt, Agent harness, and model settings. Document the runner command, browser version, warmup and sample counts, concurrency, timeout, and output checks. | A second contributor can reproduce the setup and run it to collect TTFA and TTC from the same Send click. Publish a real-model baseline with the effective configuration, raw per-run results, and failures. | + +Measure cold and warm runs separately. Correlate stages by turn, call, and job IDs and the project event cursor. Rerun both metrics on the shared benchmark after combining changes. The shared business services continue to enforce authorization, revisions, locks, and adoption rules. Check execution-record changes in English and Chinese. + +## Decisions for discussion + +1. What should the execution record show by default, and which labels can we support with trace evidence? +2. Which percentile and sample size should we use for the TTFA budget? Do cold starts or large projects need separate budgets? What progress should users see after 8 seconds? +3. Which proposals should we pursue based on the baselines? What TTC target is realistic once we know the provider time and the time OpenDirector can reduce? +4. Which Agent harness and models should the first benchmark pin? When should we add other runtimes or requests that use reference images? diff --git a/apps/api/src/opendirector_api/agent.py b/apps/api/src/opendirector_api/agent.py index b311d8f03..a75f2562a 100644 --- a/apps/api/src/opendirector_api/agent.py +++ b/apps/api/src/opendirector_api/agent.py @@ -20,6 +20,7 @@ from opendirector.agent.catalog import model_choices from opendirector.agent.context import RunContext, RuntimeId +from opendirector.agent.references import TurnReference, resolve_turn_references from opendirector.agent.citations import referenced_sources, with_trace_sources from opendirector.agent.runtime import AgentRuntimes, runtime_available, configured_runtimes, runtime_spec, runtime_catalog, runtime_status from opendirector.agent.skills import skills @@ -53,7 +54,7 @@ class Draft(BaseModel): assets: list[dict[str, JsonValue]] = Field(default_factory=list, max_length=MAX_REFERENCES) runtime: Runtime = 'default' runtimeModel: str | None = Field(default=None, max_length=200) - harnessModels: dict[Literal["opencode", "codex", "claude", "jiuwenswarm", "deepseek", "pi"], Annotated[str, Field(max_length=200)] | None] = Field(default_factory=dict) + harnessModels: dict[Literal["opencode", "codex", "claude", "jiuwenswarm", "deepseek", "pi", "antigravity"], Annotated[str, Field(max_length=200)] | None] = Field(default_factory=dict) thinking: Literal['auto', 'low', 'medium', 'high'] = 'auto' builtinModelThinking: dict[str, Literal['auto', 'low', 'medium', 'high']] = Field(default_factory=dict) modelSelections: dict[str, str | None] = Field(default_factory=dict) @@ -154,27 +155,29 @@ def __init__(self, projects): def path(self, project_id: UUID, session: str | None = None) -> Path: with self.projects.local.transaction() as db: self.projects._recover() - directory, _ = self.projects._find(db, project_id) + directory, _ = self.projects._find(db if session else None, project_id) if session: self.projects._lease(db, project_id, directory, session, browser_only=True) return directory def update(self, project_id: UUID, session: str | None = None, *, draft: Draft | None = None, begin: dict | None = None, finish: dict | None = None, conversation_id: UUID | None = None, + finish_turn_id: UUID | None = None, edited_documents: dict[str, int] | None = None, before_begin=None, agent_session: str | None = None) -> dict: finish_mono, finish_at = (_monotonic(), _utc_now()) if finish is not None else (None, None) + mutating = draft is not None or begin is not None or finish is not None with self.projects.local.transaction() as db: self.projects._recover() - directory, _ = self.projects._find(db, project_id) + # Chat reads use the published directory while a project command writes its next commit. + directory, manifest = self.projects._find(db if mutating or session else None, project_id) if session: self.projects._lease(db, project_id, directory, session, browser_only=True) folder = child(directory, 'agent-runs') - folder.mkdir(exist_ok=True) file = child(folder, 'conversation.json') value = read_json(file) if file.exists() else {'messages': [], **Draft().model_dump()} value['conversationId'] = value.get('conversationId') or str(uuid5(project_id, 'assistant')) supplied = draft.conversationId if draft is not None else conversation_id - if (draft is not None or begin is not None or finish is not None) and str(supplied) != value['conversationId'] and (supplied is not None or value.get('archivedConversations')): + if mutating and str(supplied) != value['conversationId'] and (supplied is not None or value.get('archivedConversations')): raise ProjectError('当前对话已切换,请重新加载后重试;原对话未覆盖。', 409) changed = False started = None @@ -182,7 +185,10 @@ def update(self, project_id: UUID, session: str | None = None, *, draft: Draft | value.update(draft.model_dump(mode="json", exclude={"conversationId"})) changed = True if begin is not None: - if any(message['id'] == begin['id'] for message in value['messages']): + # Tool commands and completed jobs use project + turn as their origin. + if any(message['id'] == begin['id'] + for conversation in [value, *value.get('archivedConversations', [])] + for message in conversation['messages']): raise ProjectError('这条消息已接受,请读取对话,不要重复发送。', 409) if before_begin is not None: before_begin() @@ -196,6 +202,29 @@ def update(self, project_id: UUID, session: str | None = None, *, draft: Draft | value.update(draft='', draftContent=None, assets=[], skills=[]) changed = True if finish is not None: + # Unlike job results, directly published files can later be deleted. + # Keep just their immutable identity with the reply that delivered them. + if finish_turn_id is not None: + snapshot = self.projects._current(db, project_id, directory, manifest).snapshot + outputs = [{'id': str(asset.id), 'name': asset.name, 'fingerprint': asset.fingerprint} + for asset in snapshot.assets if asset.provenance.source == 'agent_written' + and asset.provenance.agentRunId == finish_turn_id] + if outputs: + finish = {**finish, 'publishedAssets': {'projectId': str(project_id), + 'eventCursor': snapshot.eventCursor, 'assets': outputs}} + if edited_documents: + owners = {str(item.binding.objectRef.id): item for item in snapshot.canvasItems + if item.kind == 'timeline'} + timelines = [] + for doc in snapshot.editorDocuments: + revision = edited_documents.get(str(doc.id)) + if doc.kind == 'timeline' and revision is not None: + owner = owners.get(str(doc.id)) + timelines.append({'editorId': str(doc.id), 'revision': revision, + 'itemId': str(owner.id) if owner else None, 'title': owner.title if owner else ''}) + if timelines: + finish = {**finish, 'publishedTimelines': {'projectId': str(project_id), + 'eventCursor': snapshot.eventCursor, 'timelines': timelines}} with self._started_lock: started = self._started.pop(finish['id'], None) def stamped(message): @@ -211,6 +240,7 @@ def stamped(message): changed = True if changed: try: + folder.mkdir(exist_ok=True) durable_json(file, value) except BaseException: if started is not None: @@ -236,7 +266,7 @@ def queue(self, project_id: UUID, session: str, message: dict, conversation_id: with self.projects.local.transaction() as db: self.projects._recover() directory, _, _ = self.projects._load(db, project_id) - self.projects._lease(db, project_id, directory, session) + self.projects._lease(db, project_id, directory, session, browser_only=True) folder = child(directory, 'agent-runs') folder.mkdir(exist_ok=True) file = child(folder, 'conversation.json') @@ -244,7 +274,9 @@ def queue(self, project_id: UUID, session: str, message: dict, conversation_id: value['conversationId'] = value.get('conversationId') or str(uuid5(project_id, 'assistant')) if conversation_id is not None and str(conversation_id) != value['conversationId']: raise ProjectError('当前对话已切换,请重新加载后重试;原对话未覆盖。', 409) - if any(item['id'] == message['id'] for item in value['messages']): + if any(item['id'] == message['id'] + for conversation in [value, *value.get('archivedConversations', [])] + for item in conversation['messages']): raise ProjectError('这条消息已接受,请读取对话,不要重复发送。', 409) if 'queueSeq' in value: value['_queueSeq'] = value.pop('queueSeq') @@ -267,8 +299,6 @@ def dispatch(self, project_id: UUID, session: str | None = None, directory, _, _ = self.projects._load(db, project_id) if session: self.projects._lease(db, project_id, directory, session) - if agent_session is not None: - self.projects.local.start_agent_session(db, project_id, directory, agent_session) folder = child(directory, 'agent-runs') folder.mkdir(exist_ok=True) file = child(folder, 'conversation.json') @@ -277,6 +307,8 @@ def dispatch(self, project_id: UUID, session: str | None = None, pending = next((item for item in value['messages'] if item.get('status') == 'queued'), None) if pending is None: return None + if agent_session is not None: + self.projects.local.start_agent_session(db, project_id, directory, agent_session) index = value['messages'].index(pending) pending['status'] = 'complete' reply_id = str(uuid5(UUID(pending['id']), 'assistant')) @@ -514,7 +546,7 @@ def trace_input(project_id: UUID, turn_id: UUID): @router.get('/traces/{turn_id}/{source}') def trace(project_id: UUID, turn_id: UUID, - source: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'model'], + source: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'antigravity', 'model'], cursor: Annotated[str | None, Query(pattern=r'^(?:[0-9]+:[0-9]+:[0-9]+)?$', max_length=64)] = None): folder = child(conversations.path(project_id), 'agent-runs') filename = normpath(join(folder, f'{turn_id}.{source}.jsonl')) @@ -615,7 +647,7 @@ async def runtime_detail(project_id: UUID, runtime: Runtime): return {**item, 'status': await runtime_status(runtime)} @router.get('/runtimes/{runtime}/models') - async def runtime_models(project_id: UUID, runtime: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi'], selected: str | None = None): + async def runtime_models(project_id: UUID, runtime: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'antigravity'], selected: str | None = None): await asyncio.to_thread(conversations.path, project_id) if runtime == 'deepseek': from opendirector.agent.deepseek import model_choices as deepseek_models @@ -675,9 +707,8 @@ async def prepare(project_id: UUID, value: Turn, session: str, accept_language: raise ProjectError('技能已失效,请重新选择。', 409) snapshot = await asyncio.to_thread(projects.snapshot, project_id) assets = {str(asset.id): asset for asset in snapshot.assets} - for asset_id in value.assets: - if str(asset_id) not in assets: - raise ProjectError('引用素材不属于当前工程。', 409) + turn_refs = resolve_turn_references(snapshot, value.id, value.content or (), value.assets) + attachment_ids = dict.fromkeys(str(ref.asset.assetId) for ref in turn_refs) model = config['modelId'] if config else value.runtimeModel model_is_cli_default = spec.modelSource == 'cli' and not model model_selections = dict(value.modelSelections) @@ -691,21 +722,21 @@ async def prepare(project_id: UUID, value: Turn, session: str, accept_language: 'message': {'id': str(value.id), 'role': 'user', 'text': value.text, 'content': value.content, 'assets': [{'id': str(asset.id), 'name': asset.name, 'type': asset.metadata.mimeType, 'size': asset.metadata.size, 'fingerprint': asset.fingerprint} - for asset in (assets[str(key)] for key in value.assets)], + for asset in (assets[key] for key in attachment_ids)], + 'turnReferences': [ref.model_dump(mode='json', exclude_none=True) for ref in turn_refs], 'skills': value.skills, 'runtime': value.runtime, 'runtimeModel': value.runtimeModel, 'modelSelections': dict(value.modelSelections), 'model': model, 'modelIsCliDefault': model_is_cli_default, 'thinking': value.thinking, 'status': 'complete', **({'modelConfigId': str(value.modelId)} if value.modelId else {})}} - async def plan_for(project_id: UUID, message: dict, session: str, accept_language: str | None) -> dict: + async def plan_for(project_id: UUID, message: dict, session: str, directory: Path, accept_language: str | None) -> dict: """Settings for a message that was accepted earlier and is due now. The message was validated when the user sent it, so this rebuilds the run settings without rejecting input that is already typed: a model that has disappeared in the meantime falls back to the runtime default. """ - directory = await asyncio.to_thread(conversations.path, project_id, session) spec = runtime_spec(message['runtime']) config = None if spec.modelSource == 'settings' and message.get('modelConfigId'): @@ -730,10 +761,11 @@ async def produce_one(chain: Chain, plan: dict) -> tuple[dict | None, str | None turn_id = UUID(message['id']) text, status, error = '', 'complete', None activities: list[dict] = [] + edited_documents: dict[str, int] = {} sources: dict = {} previous_sources: dict = {} steps = None - run_session = plan.get('run_session') or chain.session + run_session = plan['run_session'] timing: dict = {} turn_started = time.monotonic() renewal: asyncio.Task | None = None @@ -760,6 +792,9 @@ async def renew_session() -> None: context = [] for reply in saved['messages'][:-1]: content = reply['text'] or '(empty reply)' + bound = [TurnReference.model_validate(ref).observation() for ref in reply.get('turnReferences', [])] + if bound: + content += '\nProject references in chat order: ' + json.dumps(bound, ensure_ascii=False) references = [] for attachment in reply.get('assets', []): asset = assets.get(attachment['id']) @@ -778,7 +813,10 @@ async def renew_session() -> None: session=run_session, directory=plan['directory'], config=plan['config'], messages=context, selected_skills=message.get('skills') or [], thinking=plan['thinking'], model_selections=plan['model_selections'], runtime_model=message.get('runtimeModel'), - skills=plan['available'], conversation_id=chain.conversation_id) + skills=plan['available'], conversation_id=chain.conversation_id, edited_documents=edited_documents, + turn_references=tuple(TurnReference.model_validate(ref) for ref in message.get('turnReferences', [])), + earlier_references=tuple(TurnReference.model_validate(ref) for reply in saved['messages'][:-2] + for ref in reply.get('turnReferences', []))) async with aclosing(runtimes.stream(run)) as stream: async for event in stream: if event['type'] == 'delta': @@ -789,6 +827,8 @@ async def renew_session() -> None: if inherited: sources.update({source['id']: source for source in inherited}) chain.events.put({'type': 'sources', 'sources': inherited}) + if event['type'] == 'replace': + text = event['text'] if event['type'] == 'sources': for source in event['sources']: sources.setdefault(source['id'], source) @@ -834,7 +874,8 @@ async def renew_session() -> None: 'model': plan['model'], 'modelIsCliDefault': plan.get('model_is_cli_default', False), 'runtime': message['runtime'], 'thinking': plan['thinking'], 'tools': activities, 'sources': list(sources.values()), - **({'plan': steps} if steps is not None else {})}, conversation_id=chain.conversation_id) + **({'plan': steps} if steps is not None else {})}, conversation_id=chain.conversation_id, + finish_turn_id=turn_id, edited_documents=edited_documents) except Exception: logger.exception(f'agent.turn.unfinished project_id={project_id} turn_id={turn_id}') saved = None @@ -844,17 +885,19 @@ async def renew_session() -> None: with suppress(asyncio.CancelledError): await renewal try: - # Measurement and the lease are both best effort: losing - # either may cost a file or a lock, never the turn's reply. await asyncio.to_thread(agent_timing.write, plan['directory'], turn_id, timing, round(time.monotonic() - turn_started, 3)) - if plan.get('run_session'): - await asyncio.to_thread(projects.local.release_agent_session, plan['run_session']) except Exception: logger.exception(f'agent.turn.timing.failed project_id={project_id} turn_id={turn_id}') chain.last = saved return saved, error, status + async def release_session(session: str) -> None: + try: + await asyncio.to_thread(projects.local.release_agent_session, session) + except Exception: + logger.exception('Could not release Agent project write session') + async def run_chain(chain: Chain, plan: dict) -> None: """Run a turn, then take the next queued message until the queue is empty. @@ -865,22 +908,31 @@ async def run_chain(chain: Chain, plan: dict) -> None: """ project_id = chain.project_id turn_id, saved, error, status = chain.turn, None, None, 'complete' + run_session = plan['run_session'] try: while True: saved, error, status = await produce_one(chain, plan) turn_id = UUID(plan['message']['id']) if status != 'complete' or chain.stopped: break - run_session = str(uuid4()) + next_session = str(uuid4()) async with admission.setdefault(project_id, asyncio.Lock()): + # The queue was admitted by the browser. Authorize its + # successor under the still-live project lease of this turn. dispatched = None if chain.stopped else await asyncio.to_thread( - conversations.dispatch, project_id, chain.session, run_session) - if dispatched is None: - break + conversations.dispatch, project_id, run_session, next_session) + if dispatched is None: + # Keep admission closed until the empty chain releases + # its lease and synchronously leaves the active slot. + await release_session(run_session) + run_session = None + break + previous_session, run_session = run_session, next_session + await release_session(previous_session) chain.turn = UUID(dispatched['message']['id']) chain.events.put({'type': 'end', 'turnId': str(turn_id), 'nextTurnId': str(chain.turn), 'conversation': dispatched['conversation'], 'error': None}) - plan = await plan_for(project_id, dispatched['message'], chain.session, None) + plan = await plan_for(project_id, dispatched['message'], chain.session, plan['directory'], None) plan['start'] = dispatched['conversation'] plan['run_session'] = run_session saved = None @@ -888,6 +940,8 @@ async def run_chain(chain: Chain, plan: dict) -> None: status, error = 'stopped', None raise finally: + if run_session is not None: + await release_session(run_session) chain.events.put({'type': 'end', 'turnId': str(turn_id), 'nextTurnId': None, 'conversation': saved if saved is not None else chain.last, 'error': error}) if active.get(project_id) is chain: @@ -1006,7 +1060,7 @@ async def message(project_id: UUID, value: Turn, x_opendirector_session: UUID = dispatched = await asyncio.to_thread(conversations.dispatch, project_id, session, start_session) if dispatched is None: raise ProjectError('这条消息未能开始执行,请重新发送。', 409) - started = await plan_for(project_id, dispatched['message'], session, accept_language) + started = await plan_for(project_id, dispatched['message'], session, plan['directory'], accept_language) started['start'] = dispatched['conversation'] started['run_session'] = start_session return launch(project_id, started, UUID(dispatched['conversation']['conversationId'])) diff --git a/apps/api/src/opendirector_api/creation.py b/apps/api/src/opendirector_api/creation.py index 76d6d100f..085577a4a 100644 --- a/apps/api/src/opendirector_api/creation.py +++ b/apps/api/src/opendirector_api/creation.py @@ -24,7 +24,7 @@ from opendirector.application.creation_timeline_packages import CreationTimelinePackages from opendirector.application.creation_video_compatibility import CreationVideoCompatibility, VideoConversionTask from opendirector.domain.creation.timeline_packages import TimelinePackageImportRequest, TimelinePackageImportReceipt -from opendirector.domain.creation.assets import Asset, UploadInfo +from opendirector.domain.creation.assets import ASSET_REVISION_HEADER, Asset, UploadInfo from opendirector.domain.creation.base import MediaKind from opendirector.domain.creation.commands import Command, CommandReceipt, Query as CreationQuery from opendirector.domain.creation.project import ProjectSnapshot, ViewState @@ -209,8 +209,9 @@ def edit_session(project_id: UUID, x_opendirector_session: UUID = Header()): return projects.editing_state(project_id, str(x_opendirector_session)) @router.post('/projects/{project_id}/edit-session') - def take_edit_ownership(project_id: UUID, x_opendirector_session: UUID = Header()): - return projects.take_edit_ownership(project_id, str(x_opendirector_session)) + def take_edit_ownership(project_id: UUID, x_opendirector_session: UUID = Header(), + x_opendirector_persistent: bool = Header(default=True)): + return projects.take_edit_ownership(project_id, str(x_opendirector_session), persistent=x_opendirector_persistent) @router.put('/sessions/{session_id}') def heartbeat(session_id: UUID, value: Session): @@ -281,7 +282,7 @@ def projection(project_id: UUID): return canvas.projection(project_id) @router.post('/projects/{project_id}/queries') - async def query(project_id: UUID, value: CreationQuery): + async def query(project_id: UUID, value: CreationQuery, request: Request): if value.projectId != project_id: raise ProjectError('查询不属于当前工程。') if value.type in {'pipeline.plan', 'pipeline.execution.get', 'pipeline.executions.list'}: @@ -454,12 +455,13 @@ def browser_image(project_id: UUID, asset_id: UUID, 'X-Content-Type-Options': 'nosniff'}) @router.get('/projects/{project_id}/assets/{asset_id}/content') - def content(project_id: UUID, asset_id: UUID, range_header: str | None = Header(default=None, alias='Range'), + def content(project_id: UUID, asset_id: UUID, revision: int | None = Query(default=None, ge=1), + range_header: str | None = Header(default=None, alias='Range'), if_none_match: str | None = Header(default=None, alias='If-None-Match')): - stream, asset = assets.open_media(project_id, asset_id) + stream, asset = assets.open_media(project_id, asset_id, revision=revision) size, etag = asset.metadata.size, '"' + asset.fingerprint + '"' headers = {'Accept-Ranges': 'bytes', 'ETag': etag, 'Cache-Control': 'private, no-cache', - 'X-Content-Type-Options': 'nosniff', + 'X-Content-Type-Options': 'nosniff', ASSET_REVISION_HEADER: str(asset.revision), 'Content-Disposition': ('attachment' if asset.kind == 'file' else 'inline') + "; filename*=utf-8''" + quote(asset.name, safe='')} if range_header is None and if_none_match == etag: diff --git a/apps/api/src/opendirector_api/localization.py b/apps/api/src/opendirector_api/localization.py index cf7a982f5..7fba27288 100644 --- a/apps/api/src/opendirector_api/localization.py +++ b/apps/api/src/opendirector_api/localization.py @@ -11,11 +11,19 @@ from opendirector.domain.timeline_errors import timeline_error_message +from opendirector.domain.creation.assets import ASSET_DOWNLOAD_ENGLISH from opendirector.domain.creation.commands import CommandReceipt from opendirector.domain.capabilities import Capability from opendirector.domain.capability_messages import english_capability_message, missing_tool_model_message ENGLISH_BY_CODE = { + 'keyframe_unsupported': 'This model or mode does not support keyframes. Clear the keyframe times or choose another model.', + 'keyframe_mode': 'Keyframes work in Universal reference mode only, not with first/last frames, continuation or structure control.', + 'keyframe_kind': 'A keyframe must be an image.', + 'keyframe_count': 'There are more keyframes than this model accepts.', + 'keyframe_needs_reference': 'Keyframes also need at least one ordinary reference image or video.', + 'keyframe_time': 'Each keyframe needs its own time, earlier than the end of the video and at least 1/24 second from the others.', + 'keyframe_image': 'A keyframe must be a PNG, JPEG or WebP image within the size limit.', 'higgsfield_model': 'Choose MAGI-2 with the official Higgsfield Open API address.', 'higgsfield_key': 'Enter your Higgsfield Open KEY_ID:KEY_SECRET.', 'higgsfield_output': 'MAGI-2 supports 1080p and whole-second durations from 4 to 30 seconds.', @@ -42,6 +50,12 @@ 'prompt_optimization_too_large': 'The references are too large for prompt optimization. Reduce their size or number and try again.', 'prompt_optimization_result': 'The model did not return a usable prompt. Your original text was kept.', 'prompt_optimization_provider': 'The text model could not optimize the prompt. Check its settings and try again. Your original text was kept.', + **ASSET_DOWNLOAD_ENGLISH, + "desktop_auth_required": "The desktop connection has expired. Reopen the application.", + 'h3_timeline_guides_single_model': 'Configure timeline guides for an individual FastH3 model.', + 'h3_timeline_guides_source_limit': 'An H3 segment accepts one source video reference.', + 'h3_timeline_guides_deployment': 'Enable timeline guides only for a compatible self-hosted FastH3 video endpoint.', + 'h3_timeline_guides_unsupported': 'H3 source video segments require a self-hosted H3 endpoint with timeline guides and Reference mode.', 'image_quality_unsupported': 'This model does not support the selected image quality. Choose Auto or select another model.', 'bigmodel_video_model': 'The BigModel video protocol supports CogVideoX-3 only.', 'bigmodel_video_output': 'Choose a supported CogVideoX-3 pixel size and a 5- or 10-second duration. The size determines the aspect ratio.', @@ -49,6 +63,23 @@ 'bigmodel_video_frames': 'Use text, one first-frame image, or an explicit first/last pair. Each frame slot accepts one image; a last frame requires a first frame. Reference and continuation modes are not supported.', 'bigmodel_video_prompt': 'CogVideoX-3 prompts allow up to 512 characters. Provide a prompt or frame image.', 'bigmodel_video_cancel': 'Remote BigModel video cancellation is not connected. The task may continue running and incur charges.', + 'workflow_assembly_busy': 'This assembly run is already processing. Wait for its result.', + 'workflow_media_invalid': 'The source frame range, dimensions, frame rate, or soundtrack does not match the assembly.', + 'workflow_media_failed': 'Media processing failed. Check FFmpeg and the source videos.', + 'segment_run_busy': 'This Run has an unresolved execution. Check its execution status before starting again.', + 'segment_run_unavailable': 'The Run execution service is unavailable.', + 'segment_run_no_execution': 'This Run has no execution available to pause or resume.', + 'segment_run_not_paused': 'This Run has no paused execution to resume.', + 'segment_run_invalid_state': 'This action is unavailable in the execution’s current state.', + 'segment_run_stale_execution': 'This Run’s execution changed. Refresh its status and select the execution again.', + 'segment_run_incompatible_result': 'The selected result is incompatible with this Run’s frozen inputs or selected guides.', + 'segment_run_candidate_missing': 'The selected candidate is unavailable in this execution.', + 'segment_run_guide_mismatch': 'The continuation guide does not match the result produced by its upstream step in this execution.', + 'segment_run_job_missing': 'The segment execution did not return a matching job.', + 'segment_run_job_unsettled': 'The original segment job can still be recovered. Check that job before starting again.', + 'segment_run_reconciliation_pending': 'The original provider task is still unresolved.', + 'segment_run_remote_missing': 'The provider could not find the original task. Regenerate this segment to continue.', + 'submission_unknown': 'The provider may have received the request. Check that submission before retrying.', 'execution_file_link': 'Execution files must not have hard links.', 'kling_model': 'This Kling protocol does not support the selected model.', 'kling_mode': 'Kling currently supports first/last frames and image-reference generation.', @@ -121,6 +152,11 @@ "bigmodel_image_prompt": "Enter a GLM-Image prompt.", "bigmodel_image_size": "GLM-Image requires a preset size, or dimensions of 1024–2048 in multiples of 32.", "moss_layout_reference": "MOSS layout JSON does not accept additional text references. Put the requirements in the JSON or remove the text references.", + "antigravity_login": "Antigravity CLI is not signed in or its sign-in expired. Run agy in a terminal to sign in, then try again.", + "antigravity_models": "Could not read the Antigravity model list. Check the local agy installation.", + "antigravity_failed": "Antigravity did not finish this turn. Check its sign-in, the selected model, or the native trace.", + "antigravity_denied": "Antigravity requested a tool outside OpenDirector's allowed scope. It was denied and this turn has no reply.", + "antigravity_empty": "Antigravity returned no reply for this turn. Check the native trace.", "agent_dependency_unavailable": "Bundled Agent is unavailable. Reinstall with pip install --force-reinstall opendirector; for a source checkout, use pip install -e .", "invalid_input": "The request is invalid. Check the required fields and their formats.", "invalid_project": "The project or asset identifier is invalid.", @@ -131,6 +167,7 @@ "reference_invalid": "A reference is no longer valid. Select it again and retry.", "role_restricted": "This item does not allow that operation.", "canvas_run_layout_extent": "Canvas positions or dimensions are too large to arrange. Resize the affected items.", + "canvas_position_space_required": "Set positionSpace explicitly to canvas or parent when creating a child item in a group.", "canvas_run_layout_group": "Run layout is only available for top-level groups.", "canvas_run_layout_conflict": "Locked Run areas overlap. Unlock one of the groups and try again.", "canvas_run_layout_shared_object": "Two Runs use the same editable object. Copy the configuration or editor document and try again.", @@ -188,6 +225,96 @@ def localized_error_for_language( return specific if not wants_english_language(language): return chinese + run_messages = { + '只能通过发布命令创建 Run。': 'Use the Run publication command to create a published Run.', + '只能通过复制 Run 创建分段草稿。': 'Use the Run copy command to create a segmented Run draft.', + '分段草稿须从已发布的 Run 创建。': 'Create a segment draft from a published Run.', + '请先发布 Run 草稿。': 'Publish the Run draft before starting it.', + '计划已发布。请复制为草稿后再修改。': 'This Run is published. Make a draft copy to edit it.', + '计划已发布。请回到草稿后再修改。': 'This Run is published. Return it to draft before editing.', + '请选择可见且未锁定的已发布 Run。': 'Select a visible, unlocked published Run.', + '请先解锁 Run 计划节点。': 'Unlock the Run plan node first.', + '已发布片段须通过 Run 执行。': 'Start the published Run to execute its segments.', + '部署配置已变化,请发布新的 Run。': 'The model deployment configuration changed. Publish a new Run.', + '请选择未发布且未锁定的 Run 草稿。': 'Select an unlocked, visible top-level Run draft.', + '发布 Run 需要可见时间线和未使用的成片节点。': 'A Run needs a visible timeline and an unused output slot.', + '此时间线或成片节点已属于其他 Run。': 'The timeline or output slot belongs to another Run.', + 'Run 时间线须匹配帧率,并配置画面轨与原声音轨。': 'Use a timeline with the source frame rate, a video track, and an original soundtrack track.', + 'Run 原声须覆盖完整交付区间。': 'The original soundtrack must cover the full delivery range.', + '发布前须固定随机种子、清除素材覆盖并等待已有任务结束。': 'Set a sampling seed, clear asset overrides, and wait for existing jobs before publishing.', + '发布 Run 前须固定素材和肖像的引用版本。': 'Pin asset and portrait reference versions before publishing.', + '每个分段须固定一个源视频引用。': 'Pin one source video reference for each segment.', + 'Run 需要可见的片段节点。': 'Make all segment nodes visible before publishing this Run.', + '分段 Run 需要 FastH3 部署。': 'Segmented Runs require a FastH3 deployment.', + 'Run 续接片段需要支持时间线导帧的部署。': 'Continuations require a deployment that supports timeline guides.', + 'Run 帧数或帧率与实际源片不一致。': 'The frame count or frame rate does not match the source video.', + '工程在核对期间已更新,请重新发布 Run。': 'The project changed during validation. Review and publish the Run again.', + '模型配置在核对期间已更新,请重新发布 Run。': 'The model configuration changed during validation. Review and publish the Run again.', + } + if chinese in run_messages: + return run_messages[chinese] + if code == 'invalid_input': + measured = re.fullmatch(r'片段「(.*)」实测输入 (\d+) 帧,请求 (\d+) 帧。.*', chinese, re.DOTALL) + if measured: + name, actual, requested = measured.groups() + return (f'{name}: input {actual} frames, requested {requested} frames. ' + 'Both must match 17k+5 with k >= 6 (at least 107 frames).') + if re.fullmatch(r'片段「.*」无法按 24 FPS 解码数帧。', chinese, re.DOTALL): + return 'The segment input could not be decoded and counted at 24 FPS.' + if code == 'invalid_input' and chinese == '分组片段提交时必须指定来源画布节点(originItemId)。': + return 'Submitting a grouped segment requires its source canvas node (originItemId).' + if code == 'invalid_input' and chinese == '聊天引用超过数量上限,请移除部分引用。': + return 'The chat reference limit was exceeded. Remove some references and retry.' + if code == 'invalid_input' and chinese == '视频裁切需要视频来源节点。': + return 'Select a video canvas node as the source for this trim.' + if code == 'invalid_input' and chinese == '裁切结束时间超出来源视频时长。': + return 'The trim ends after the source video. Choose an end time within the source duration.' + if status == 409 and chinese == '此视频裁切正在进行,请等待结果。': + return 'This trim is already running. Wait for its result.' + if code == 'reference_invalid': + fasth3_image = re.fullmatch(r'FastH3 参考图“(.+)”的两边须为 256–5760 像素,宽高比须为 0.4–2.5。', chinese, re.DOTALL) + if fasth3_image: + return f'Each side of the FastH3 reference image “{fasth3_image[1]}” must be 256–5760 pixels and its aspect ratio must be 0.4–2.5.' + guide_plan_messages = { + '已确认的导帧计划不能取消约束、改换锚点或移除原有片段。': 'A confirmed guide plan must retain its guide requirement, anchor and existing steps.', + 'H3 分段计划必须启用时间线导帧约束。': 'Enable the timeline guide requirement for this H3 segment plan.', + '导帧计划的每个片段都必须绑定视频生成配置。': 'Bind each guide plan step to a video generation configuration.', + '导帧计划中的片段必须使用各自的生成配置。': 'Each guide plan step needs its own generation configuration.', + '已接受任务的导帧部署已变化或不再支持导帧。': 'The deployment captured by this job changed or no longer supports timeline guides.', + } + if chinese in guide_plan_messages: + return guide_plan_messages[chinese] + wrong_step = re.fullmatch(r'必须从计划中的片段节点 ([0-9a-f-]{36}) 提交。', chinese) + if wrong_step: + return f'Submit from the planned segment node {wrong_step[1]}.' + wrong_plan = re.fullmatch(r'片段「(.+)」的导帧计划与冻结任务不一致。', chinese, re.DOTALL) + if wrong_plan: + return f'The guide plan for segment “{wrong_plan[1]}” differs from the frozen job.' + wrong_source = re.fullmatch(r'片段「(.+)」的冻结导帧来源与本次采用的上游结果不一致。', chinese, re.DOTALL) + if wrong_source: + return f'The frozen guide source for segment “{wrong_source[1]}” differs from the adopted upstream result.' + unavailable_guide = re.fullmatch(r'片段「(.+)」的冻结导帧素材无法读取。', chinese, re.DOTALL) + if unavailable_guide: + return f'The frozen guide asset for segment “{unavailable_guide[1]}” could not be read.' + chat_reference = re.fullmatch(r'聊天引用 ([0-9a-f-]+) 的来源或素材版本已失效,请重新选择此引用。', chinese) + if chat_reference: + return f'Chat reference {chat_reference[1]} has a stale source or asset version. Select it again and retry.' + unknown_chat_reference = re.fullmatch(r'聊天引用 ([0-9a-f-]+) 不属于当前对话。', chinese) + if unknown_chat_reference: + return f'Chat reference {unknown_chat_reference[1]} does not belong to the current conversation.' + guide_segment = re.fullmatch(r'片段「(.+)」必须使用有效的 H3 时间线导帧。', chinese, re.DOTALL) + if guide_segment: + return f'Segment “{guide_segment[1]}” requires a valid H3 timeline guide.' + segment = re.fullmatch(r'组装片段「(.+)」的生成任务缺少来源画布节点(originItemId)。', chinese, re.DOTALL) + if segment: + return f'The generation job for assembly segment “{segment[1]}” is missing its source canvas node (originItemId).' + job = re.fullmatch( + r'生成任务「([0-9a-f-]{36})」(规格 ([0-9a-f-]{36}))缺少来源画布节点(originItemId),无法确定对应的组装片段。', + chinese, + ) + if job: + return (f'Generation job {job[1]} (spec {job[2]}) is missing its source canvas node (originItemId). ' + 'The assembly segment could not be identified.') if code == 'tool_model_missing': return missing_tool_model_message(required_capability, english=True) if code == 'model_list_http_error': diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 4085b79d0..b912d224e 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -401,9 +401,20 @@ async function smokeTraceWindows(window, projectId) { .then(response => response.json()).then(({projects}) => projects.find(project => project.id === '${projectId}').path)`); const folder = join(projectPath, 'agent-runs'); mkdirSync(folder, { recursive: true }); - await evaluate("document.querySelector('.cw-chat-button').click()"); + const openedChat = await evaluate(`(() => { + const toggle = document.querySelector('.cw-chat-button'); + if (toggle.getAttribute('aria-expanded') === 'true') return false; + toggle.click(); + return true; + })()`); const editor = ".cw-assistant-composer [contenteditable=true]"; - await waitFor(() => evaluate(`!!document.querySelector(${JSON.stringify(editor)})`), 'Assistant composer did not open'); + await waitFor(() => evaluate(`document.querySelector(${JSON.stringify(editor)})?.checkVisibility()`), 'Assistant composer did not open'); + await waitFor(() => evaluate(`(() => { + const chat = document.querySelector('#canvas-assistant').getBoundingClientRect(); + const canvas = document.querySelector('.cw-canvas-region').getBoundingClientRect(); + const sidebar = document.querySelector('.cw-workspace[data-desktop-sidebar=open] .od-project-sidebar'); + return chat.left >= (sidebar?.getBoundingClientRect().right ?? 0) && chat.right <= canvas.left; + })()`), 'The project sidebar, conversation and canvas overlap'); await evaluate(`document.querySelector(${JSON.stringify(editor)}).focus()`); await window.webContents.insertText('Draft before opening trace'); const draft = () => evaluate(`document.querySelector(${JSON.stringify(editor)})?.textContent`); @@ -433,7 +444,7 @@ async function smokeTraceWindows(window, projectId) { await evaluate(`document.querySelector(${JSON.stringify(editor)}).focus()`); await window.webContents.insertText(' and continued afterward'); await waitFor(async () => (await draft())?.includes('continued afterward'), 'Assistant composer stopped accepting input'); - await evaluate("document.querySelector('.cw-chat-button').click()"); + if (openedChat) await evaluate("document.querySelector('.cw-chat-button').click()"); } async function waitFor(check, message, attempts = 150) { diff --git a/build_backend.py b/build_backend.py index cec3032e6..83a732b92 100644 --- a/build_backend.py +++ b/build_backend.py @@ -23,7 +23,11 @@ def prepare_resources(): if bundled.exists(): shutil.rmtree(bundled) shutil.copytree(ROOT / 'dist', bundled / 'web') - shutil.copytree(ROOT / 'packages/agent/skills', bundled / 'skills') + skill_ignore = shutil.ignore_patterns('__pycache__', '*.pyc', '*.pyo') + shutil.copytree(ROOT / 'packages/agent/skills', bundled / 'skills', ignore=skill_ignore) + h3_skill = ROOT / '.agents/upstream/minimax-h3/skills/h3-prompt-writing' + if (h3_skill / 'SKILL.md').is_file(): + shutil.copytree(h3_skill, bundled / 'skills/h3-prompt-writing', ignore=skill_ignore) npm_package = ROOT / 'node_modules/opencode-ai' metadata = json.loads((npm_package / 'package.json').read_text()) if os.name == 'nt': diff --git a/docs/README.md b/docs/README.md index dff1456cc..8f0bb9455 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,12 +9,14 @@ This directory is the entry point for the repository's shared documentation. The | [Development guidance](../AGENTS.md) | Product direction and enduring principles | Architecture principles or product boundaries change | | [Contributing](../CONTRIBUTING.md) | Label taxonomy, how to pick labels, and what a PR must satisfy | Process, labels, or submission requirements change | | [Unified project architecture](architecture/unified-project.md) | Business objects, shared entry points, and interaction rules | Object responsibilities, commands, persistence, or interaction rules change | +| [Workspace modes RFC (中文)](architecture/workspace-modes-rfc.zh-CN.md) | Chat and canvas creation, first-run selection, docked and floating chat, result editing, and acceptance criteria | The mode design or its acceptance criteria change | | [Desktop architecture](architecture/desktop.md) ([中文](architecture/desktop.zh-CN.md)) | Electron, the Python Host, project storage, and shutdown behavior | Process, request, storage, or lifecycle boundaries change | | [Test contracts](architecture/test-contracts.md) | Test/production boundaries, how to avoid stale assertions and environment-dependent red runs | Test infrastructure, capability gates, or contract ownership change | | [Capability mapping contract](architecture/capability-contract.md) | Evidenced upstream vocabulary, the `(operation, profile) → capability` table, the untranslatable declarations, and how it feeds discovery | Upstream vocabulary, capability ids, or discovery matching change | | [Roadmap](development/roadmap.md) | Capability dependencies and delivery criteria | Scope, dependencies, or acceptance criteria change | | [Validation guide](development/validation.md) | Reproducible checks and evidence requirements | Tools, runtime requirements, or validation entry points change | | [Agent turn timing](development/agent-timing.md) ([中文](development/agent-timing.zh-CN.md)) | Where one agent turn spends its time, and the pre-registered bands that decide the next optimization | The ledger, its reader, or a decision band changes | +| [Agent image latency benchmark](development/agent-image-benchmark.md) | Fixed browser workload and latency measurements for Agent image generation | The workload, timing boundaries, or result checks change | | [CI layer assessment](development/ci-layer-assessment.md) | Timing evidence, critical PR representatives and staged Python classification | Measured evidence or classification decisions change | | [Issue #87 Windows handoff](development/issue-87-windows-handoff.md) ([中文](development/issue-87-windows-handoff.zh-CN.md)) | Native ACL repair and final text acceptance | The shared checkpoint or native validation scope changes | | [Development lessons](development/lessons.md) | Risks identified from recent fixes | New evidence emerges or a lesson no longer applies | @@ -24,6 +26,7 @@ This directory is the entry point for the repository's shared documentation. The | [UI performance design](development/ui-performance.md) | Interaction design principles, latency budgets, and measurement | A UI performance principle, target, or measurement method changes | | [macOS installation validation](development/macos-install-validation.md) | Installation and usage scenarios verified on Apple Silicon | The corresponding acceptance checks are repeated | | [Bilingual interface](development/i18n.md) | Language selection, message organization, and checks | Language policy, message structure, or checks change | +| [H3 conditioning features](development/h3-conditioning-features.md) (中文) | Structure control, latent continuation, masked editing and keyframes for self-hosted H3 models, with measured results | The H3 request shapes or the vLLM-Omni capabilities they rely on change | | [Python installation and packaging](development/packaging.md) | Installation, platform wheel builds, and isolated verification | Packaging, resource paths, or build process changes | | [Business CLI](guides/cli.md) | Querying, editing, and generating through a terminal or Agent Shell | Commands, authorization, or receipt semantics change | | [DeepSeek Harness plugin](../plugins/deepseek-harness/README.md) | Installing the DSH bundle and editing an OpenDirector project from DSH | Plugin setup, tools, or creation workflows change | diff --git a/docs/architecture/agent-runtime.md b/docs/architecture/agent-runtime.md index 1d38e48f7..2be3abacc 100644 --- a/docs/architecture/agent-runtime.md +++ b/docs/architecture/agent-runtime.md @@ -15,11 +15,14 @@ Harness 指承担模型调用、工具执行和上下文管理的 Agent 执行 | JiuwenSwarm | jiuwenswarm-process,优先 PATH,再查找常见 CLI 安装目录,通过 stdin/stdout JSONL 直接调用 | 本机 Jiuwen 模型目录、配置与环境变量 | | DeepSeek Harness | dsh,优先 PATH,再查找常见 CLI 安装目录,以 acp profile 运行标准 JSON-RPC | CLI 原生 profile、模型目录与认证 | | Pi | pi,优先 PATH,再查找 `~/.pi/agent/bin`,每轮一个 `--mode json` 进程读取原生 JSONL 事件流 | 本机 `~/.pi` 的 provider 认证、设置与模型目录 | +| Antigravity | agy,优先 PATH,再查找安装器使用的 `~/.gemini/bin`,每轮一个 `--input-format stream-json --output-format stream-json` 进程,提示从 stdin 输入 | 本机 agy 的账号登录、模型目录与全局设置 | Default 与 OpenCode CLI 分别配置。外部 CLI 不读取 OpenDirector 保存的模型凭证。进程继承服务端环境,包括 PATH 和第三方 API 配置。 Pi 沿用用户自己的 `~/.pi` 认证与设置,因此命令行里不传模型凭证。它以 `--mode json --print` 在一次运行中输出 JSONL 事件,适配层读取 `session`、`message_update`、`message_end` 和 `agent_end`:增量只用于显示,完成的助手消息是正文依据,被重试的失败尝试不结束本轮,只有 `agent_end` 最后一条助手消息的错误才作为失败原因返回。pi 在 print/json 模式下不询问信任,启动时显式传 `--approve`;否则本工程的 `.agents/skills`、`AGENTS.md` 与 `.pi` 设置会被静默跳过。会话写入工程内的 `agent-runs/pi-sessions/native/`,续聊用 `--session-id` 复用同一执行目录,不写入用户全局会话列表。 +Antigravity 沿用本机 agy 的账号登录,命令行里不传模型凭证。`-p` 不读 stdin,而完整的对话回放会超过 Windows 命令行长度上限,所以提示以一条 `{"event":"user"}` 的 stream-json 消息写入 stdin。CLI 没有系统提示参数,新会话把运行说明放在第一条消息里,续聊时不再重复。适配层把 `agent_response` 步骤的 `text_delta` 作为显示增量,以 `result.response` 为正文依据,只补出流里没有显示的部分。`result.status` 不是 `SUCCESS` 时本轮失败;headless 模式下被拒绝的工具会让 CLI 返回 `SUCCESS` 但 `response` 为空,并附带 `denied_actions`,这种情况同样判为失败并列出被拒绝的动作。续聊用 `--conversation` 复用同一执行目录;原生会话固定写在 `~/.gemini/antigravity-cli/conversations/`,被截断的工具输出写在 `~/.gemini/antigravity-cli/brain/<会话>/`;CLI 不提供改到工程目录的参数,因此会出现在用户的 agy 会话列表和全局历史中。续接前检查该会话文件,缺失时保留执行目录并以完整历史重新开始。agy 还会加载用户全局的 Skill、插件与 MCP 配置,CLI 没有按次关闭的参数。 + 会话保存 runtime、模型和推理强度,浏览器偏好用于辅助恢复选择。适配层不指定固定迭代轮数,沿用 harness 的预算和停止机制。 ## 执行链路 @@ -99,6 +102,9 @@ English summary: a Job created by an Agent `generation.submit` records `agentRun | JiuwenSwarm | 明确允许 skill_tool、list_skill、read_file、bash 和业务 CLI | | DeepSeek Harness | 沿用原生工具与权限;Skill 限于本轮快照,业务操作通过 Shell 调用 opendirector,未承接的审批不自动批准 | | Pi | `--approve --tools read,bash,write,edit`:只读、Shell 和文件编辑;Skill 与 `AGENTS.md` 由原生加载器从本轮目录读取,业务操作通过 Shell 调用 opendirector | +| Antigravity | `--settings` 仅本次生效:固定 `agentMode` 为默认模式、开启终端沙箱并使用 `proceed-in-sandbox`,命令在沙箱内自动运行;沙箱会拦截 opendirector 连接本地应用的 socket,因此只允许 `command(opendirector)` 在沙箱外运行。另允许 `read_file(*)` 和写入本轮执行目录,拒绝 `execute_url(*)`、`download_url(*)`;其他命令申请离开沙箱或其余需审批的动作在 headless 模式下自动拒绝,不使用 `--dangerously-skip-permissions`。用户全局设置可能启用 auto 模式(v1.5.7 起默认),该模式会自行判断沙箱外命令,所以按次固定模式。Skill 由原生加载器从本轮目录的 `.agents/skills` 读取,业务操作通过 Shell 调用 opendirector | + +Antigravity 的上述策略只在 macOS 上用已登录的 agy 验证过;Linux 与 Windows 上 agy 是否按该策略执行沙箱尚未验证,目前不承诺这两个平台的支持。 工具允许列表与操作系统沙箱提供不同约束。业务工具独立校验工程范围和输入;原生文件访问权限不授予直接改写工程存储的业务权限。 diff --git a/docs/architecture/assets/workspace-modes/agent-mode.png b/docs/architecture/assets/workspace-modes/agent-mode.png new file mode 100644 index 000000000..f75a3fb07 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/agent-mode.png differ diff --git a/docs/architecture/assets/workspace-modes/canvas-mode.png b/docs/architecture/assets/workspace-modes/canvas-mode.png new file mode 100644 index 000000000..58ddc32d8 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/canvas-mode.png differ diff --git a/docs/architecture/assets/workspace-modes/first-canvas-setup.png b/docs/architecture/assets/workspace-modes/first-canvas-setup.png new file mode 100644 index 000000000..5d6c9d6ec Binary files /dev/null and b/docs/architecture/assets/workspace-modes/first-canvas-setup.png differ diff --git a/docs/architecture/assets/workspace-modes/first-run-mode.png b/docs/architecture/assets/workspace-modes/first-run-mode.png new file mode 100644 index 000000000..8021d309a Binary files /dev/null and b/docs/architecture/assets/workspace-modes/first-run-mode.png differ diff --git a/docs/architecture/assets/workspace-modes/floating-chat.png b/docs/architecture/assets/workspace-modes/floating-chat.png new file mode 100644 index 000000000..f6b1718e4 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/floating-chat.png differ diff --git a/docs/architecture/assets/workspace-modes/right-dock.png b/docs/architecture/assets/workspace-modes/right-dock.png new file mode 100644 index 000000000..f70dd7260 Binary files /dev/null and b/docs/architecture/assets/workspace-modes/right-dock.png differ diff --git a/docs/architecture/workspace-modes-rfc.zh-CN.md b/docs/architecture/workspace-modes-rfc.zh-CN.md new file mode 100644 index 000000000..85321169a --- /dev/null +++ b/docs/architecture/workspace-modes-rfc.zh-CN.md @@ -0,0 +1,255 @@ +# RFC:对话创作与画布创作 + +本提案对应 [#373](https://github.com/ThinkFlowLab/OpenDirector/issues/373) 第 5 项,由 @congw729 于 2026-11-17 提出。[RFC 讨论 #386](https://github.com/ThinkFlowLab/OpenDirector/issues/386) + +2026-11-30 修订。两种创作方式称为“对话创作”和“画布创作”,顶栏简称“对话”和“画布”。首个 PR 保留项目内多会话,统一从聊天标题栏打开会话历史。具体操作见[使用指南](../guides/user-guide.zh-CN.md)。 + +两种创作方式共用同一项目和会话。用户可以在对话中委托 Agent、检查结果,也可以随时打开画布继续编辑。 + +有时候用户只想描述目标,让 Agent 帮忙生成内容,再看结果、提修改意见。有时候又需要自己整理节点、调整引用和编辑时间轴。两种工作方式都应该方便,切换后也应该能接着做刚才的事。 + +## 1. 想改成什么 + +这次改动主要有三点: + +- **对话创作**以会话和结果为主,消息与输入区占据主工作区。 +- **画布创作**默认左侧聊天、右侧画布,按 1:2 分栏。用户可以将聊天固定到右侧、收起聊天或浮在画布上。 +- **随时切换**:两种模式打开同一项目、同一会话。切换时保留草稿、引用、运行中的任务和编辑状态。 + +两种创作方式都支持深色和浅色主题。画布工具栏纵向排列,缩放、撤销等控件位于画布左下角。 + +## 2. 工作区截图 + +以下截图取自同一示例项目,分别展示整页对话、画布分栏和浮动聊天。画面使用仓库内的短片剧照,对话内容由测试替身提供。第 3 节列出从对话查看、编辑和导出结果的设计要求。 + +### 对话创作 + +![对话创作中的项目对话和底部输入框](assets/workspace-modes/agent-mode.png) + +每个项目可以有多个会话。两种创作方式在所有宽度下都从聊天标题栏的“历史会话”按钮打开列表,支持搜索与切换,旁边保留新建会话入口。一次显示当前会话,刷新后恢复其消息、草稿和引用。对话创作占满工作区,桌面端也收起项目侧栏。项目从顶栏切换,回到画布时恢复画布的侧栏偏好。消息与底部输入区对齐,阅读宽度最多 960px。工作区顶栏保留项目选择、保存状态、设置和模式切换。 + +输入框继续保留上传、`@` 引用、Agent、技能和模型选择。这里的操作和当前聊天框一致,用户之前配置的 Agent、模型和会话也继续使用。 + +生成的图片、视频等结果放在回复下面,能直接预览。执行详情默认收起,需要时展开。不要把每一次工具调用都铺满对话,也不要只留一句“已完成”,让用户自己去找文件。 + +**对话创作顶栏不常驻“中文 / EN”。** 语言切换放在现有的“设置 → 通用”中。默认读取已保存的语言;没有设置时,中文浏览器使用中文,其余使用英文。界面语言不会改写用户内容,Agent 仍跟随用户提问的语言回复。 + +### 画布创作 + +![画布创作默认分栏,左侧停靠聊天,右侧画布提供添加节点、资产库和上传入口](assets/workspace-modes/canvas-mode.png) + +宽屏默认按 **1:2** 停靠聊天。把聊天放在左侧,是为了让用户先看到 Agent 和当前对话,同时在右侧留出独立的画布编辑区。拖动分隔线或用左右方向键可以调整停靠宽度,双击分隔线可恢复默认比例。工具栏和底部控件相对画布定位。拖动聊天标题或点击“浮动聊天”可让聊天覆盖在画布上。对话创作顶栏的“在画布中浮动”可直接切到画布并浮起同一会话。浮窗可用鼠标拖动或通过键盘方向键移动。浮窗宽度根据停靠宽度和可用空间计算,高度随工作区适配。聊天标题栏用图标表示停靠方向,鼠标悬停或键盘聚焦时显示“停靠到左侧”或“停靠到右侧”。停靠时可切换到另一侧,浮动时可选择任一侧恢复分栏。浏览器记住停靠侧,切换时保留会话、分栏宽度和画布视口。 + +![点击“停靠到右侧”后,聊天固定在右侧,标题栏提供“停靠到左侧”以切回](assets/workspace-modes/right-dock.png) + +![同一会话浮动在画布右侧,左侧留出空间查看镜头素材](assets/workspace-modes/floating-chat.png) + +画布左侧提供“添加节点”“资产库”和“上传”三个带文字的入口。“添加节点”展开文本、图片、视频、音频、时间线和主体六种类型。空画布中央的“浏览示例画布”打开示例列表,导入时会单独打开一个项目。 + +画布创作保留连线、媒体编辑、历史版本和导出入口。用户可从时间线节点打开编辑器。在对话创作中,项目素材入口和对应的时间线结果也应能直接打开同一个编辑器,关闭后继续原会话。 + +在聊天中点“在画布中查看”,切换后定位到同一个对象。用户在画布上选中内容后,也能继续引用到聊天里,让 Agent 接着处理。 + +## 3. 打开项目后怎么用 + +### 第一次进入 + +首次进入时沿用主仓欢迎页,从“开始设置”连接语言模型。用户可以选择或配置可用的语言模型,也可以连接已就绪且自带模型的本地助手。助手选择成功保存后,显示两种创作方式。 + +- **对话创作**是主要入口,适合没有视频创作经验的用户。先开始对话,图片、视频和音频模型可在创作过程中通过模型设置添加。 +- **画布创作**适合已有视频创作经验的用户。点击后展开画布的开始方式,包括设置媒体任务、直接进入、导入素材和打开示例。首次进入画布前须有至少一个可用的图片或视频生成模型,已有配置可以直接使用。仅配置音频不会解锁画布;选择的具体任务仍需满足各自的模型要求。 + +![语言模型连接后仅展示对话创作和画布创作,画布入口说明首次配置要求](assets/workspace-modes/first-run-mode.png) + +![点击画布创作后的开始方式。尚无图片或视频生成模型时,进入画布、导入素材和示例均不可用](assets/workspace-modes/first-canvas-setup.png) + +先选对话的新用户,下次打开仍可继续聊天。首次从顶栏、浮动聊天或结果卡片进入画布时,同样检查图片或视频模型。取消设置可继续对话。首次画布配置完成后,恢复上次模式;已完成旧版引导的用户沿用原有工作区。之后各项生成按其实际使用的模型检查,已有项目的本地编辑不受影响。 + +项目打开顺序沿用现有逻辑:深链接指定的项目优先,其次是最近项目;没有项目时走原有的默认项目创建流程。选择模式不再额外新建、复制或重新打开项目。项目打开失败时,先显示错误和重试入口。 + +```mermaid +flowchart LR + A[打开项目] --> B{已完成欢迎引导?} + B -->|是| C[恢复模式偏好,缺省为画布创作] + B -->|否| D[开始设置并连接语言模型] + D -->|成功保存| E[选择创作方式] + E -->|对话创作| H[进入对话] + E -->|画布创作| F[打开画布开始方式] + H -->|首次使用画布| V{已有可用的图片或视频生成模型?} + F --> V + V -->|没有| M[配置图片或视频模型] + M --> V + V -->|有| G[进入画布或执行所选任务] + C --> I[恢复对应工作区] +``` + +### 在对话创作里查看和修改结果 + +用户可以直接描述目标,也可以上传素材、用 `@` 引用项目里已有的内容。引用选择器不能只列出当前可见的画布节点;没有展示在画布上的资产也应能通过已有的项目查询找到。 + +对话输入框下方的工具栏提供“项目素材”入口。用户可以搜索并引用没有展示在画布上的素材,也可以导入本地文件、新建时间线或选择已有时间线。在共用编辑器里将项目素材加入轨道后即可剪辑,无需配置生成模型或先给 Agent 发消息。 + +建议结果卡片先支持这些动作: + +| 用户要做的事 | 交互 | +| --- | --- | +| 看清图片或视频 | 点击打开现有大预览,支持播放和下载 | +| 让 Agent 修改 | 把这个结果作为引用继续对话 | +| 手工调整内容 | 打开现有图片、视频或时间轴编辑器,关闭后回到对话 | +| 整理节点或引用关系 | “在画布中查看”,切换模式并定位对象 | +| 检查生成候选 | 标明候选和当前采用结果;预览不会自动采纳 | +| 找到以前的成果 | 从会话历史和项目素材入口查找,不依赖当前消息是否仍在屏幕上 | + +这里建议直接复用现有编辑器。点击卡片先看预览,需要修改时再打开编辑器;整理节点和引用关系时进入画布。 + +结果卡片要能追溯到项目中的资产、结果版本或编辑文档。缩略图地址只负责显示,后续引用、编辑和采纳通过对象 ID 与版本处理。如果对象已经删除或当前版本有变化,显示实际状态,让用户选择下一步。 + +同一素材在多条消息中出现时,继续引用同一份资产。用户在画布中改了内容,回到对话创作也能查到新的项目状态;历史生成记录仍保留当时的输入和结果。 + +### 从对话做到视频 + +可以从“帮我用这些素材做一段短片”开始,让 Agent 准备内容、生成候选、安排时间轴。用户在对话里查看结果,必要时打开编辑器或画布修改,再输出视频。 + +目前 Agent 已有可编辑时间轴包的导出能力。**MP4 输出仍由用户在浏览器中触发**,包括时间轴编辑器内导出,以及最新增加的画布直接输出入口。对话创作应从对应的时间轴结果提供同样的操作,并显示渲染、发布和下载状态;有多个时间轴时让用户选定目标。 + +**留待后续实现**:由 Agent 发起 MP4 渲染,需要定义客户端如何接收渲染请求并返回执行回执。浏览器关闭后仍能继续渲染,还需要独立的后台执行能力,另提需求。首个 PR 的验收以用户在浏览器中发起并完成输出为准。 + +## 4. 模式切换时保留什么 + +用户切换模式,是为了换个角度继续工作。因此这次切换不应产生业务命令,不更换 Agent 或模型,也不重启项目、会话和生成任务。 + +| 切换时正在做什么 | 预期行为 | +| --- | --- | +| 正在输入消息,已经添加素材引用 | 保留文本、引用、上传和当前会话;原先有焦点且仍然可见的输入区保留光标和选区;用键盘切换时让焦点留在切换控件 | +| Agent 正在回复或调用工具 | 继续同一轮执行,另一种模式接着显示结果 | +| 图片或视频正在生成 | 保留原任务,不重新提交;结果仍登记到原对象 | +| 节点参数或媒体编辑器有未保存内容 | 保留草稿、版本基线和编辑器;不强制先保存再切换 | +| 时间轴正在播放、渲染或发布 | 保留播放头、渲染任务和待发布结果 | +| 刚遇到保存失败、锁或版本冲突 | 保留错误与重试入口,切换不自动覆盖或重试 | +| 正在拖拽节点或连线 | 按原交互规则结束临时手势,再切换布局 | +| 画布隐藏后重新显示 | 恢复原来的视口和选中对象;完成容器测量后继续操作 | + +裁剪图片或编辑时间线时,可从编辑器标题栏切换模式,继续当前未保存的编辑。浏览器渲染 MP4 时也可在此切换,完成后在同一编辑器下载或发布。普通模式切换恢复原视口。“在画布中浮动”切换布局并保留会话。“在画布中查看”用于定位某条结果,允许调整视口和选择。对象没有可见画布项时,通过显式的显示操作恢复或创建展示项。 + +模式偏好使用浏览器键 `opendirector.workspaceMode.v1`,值为 `agent` 或 `canvas`。分栏宽度、浮动位置和停靠状态也属于浏览器偏好。项目文件、资产和导出包都不带这些偏好。模式偏好写入失败时,本页面照常切换,并提示偏好未保存。 + +其他标签页修改偏好时,当前页面不突然换布局;重新打开页面时再读取最新选择。模式变化也不进入业务撤销历史。 + +## 5. 聊天停靠后,画布交互如何适配 + +停靠、浮动、收起聊天和窄窗口单区域展示会改变画布的可见范围。交互坐标依据实际画布容器计算。 + +需要一起检查: + +- 节点拖动、框选、连线、素材拖入和双击创建,都按实际画布坐标计算。手动移动聊天浮窗时保持画布视口。 +- 新建节点或显式定位对象时,目标应出现在聊天浮窗以外的可见区域。节点菜单、参数面板、选择工具条和大预览也应可操作。 +- 聊天里的模型、技能、引用和执行详情面板要适应左右两侧的位置,避免展开到窗口外。 +- 画布的复制、删除和输出快捷键只在正确区域生效;在聊天输入框里操作不能误触画布。 +- 画布缩放、适应视图和最小地图使用新的容器尺寸,切换模式不自动重排节点或保存一份错误视口。 +- 对话创作里的对话不能被“折叠聊天”关成空白页;现有双 Shift 快捷键在这个模式里建议改为聚焦输入框。 + +**1:2 是默认停靠比例。** 拖动分隔线可调整宽度,双击恢复默认。收起聊天后,画布占满工作区。可用宽度不超过 700px 时,一次显示聊天或画布,保留项目和模式入口。窗口再次变宽时恢复之前的停靠或浮动布局。 + +## 6. 模型配置、任务与结果的规则 + +两种模式使用相同的模型配置、参数、引用校验和业务命令。对话创作可以把细节收起来,不能因此换掉用户已经选定的值,或减少 Agent 可用的业务能力。 + +首次引导先完成语言模型设置。新用户第一次进入画布还须配置图片或视频生成模型。判断沿用任务页的模型目录规则:已保存的模型支持相应生成能力,且没有已知的不可用状态。设置过程不提交生成任务。首次设置完成后,模型提示按当前任务显示: + +- 用户只是导入素材、编辑时间轴,不要求配置生成模型。 +- 想生成图片时,提示所需的图片能力;生成视频或配音时再检查对应能力。 +- 使用应用内模型的 Agent,需要配置相应语言模型;外部 runtime 使用自己的模型来源时,按该 runtime 的就绪状态处理。 +- 模型存在、服务能连接、模型支持输入、当前请求通过校验,是几个不同的检查。没有连接测试结果时,只显示“已配置”。 + +这部分与 #373 第 1 项共用模型说明和配置入口,沿用现有表单,避免两边写出不同的用途解释。配置完成后回到原任务,保留用户输入,由用户继续提交。 + +任务是否提交、文件是否生成、哪个候选已采用,都按实际回执显示。用户通过预览和反馈判断效果,聊天回复结束后也要能继续检查和修改。用户在生成过程中改了内容或锁了对象,后到的结果也要遵守现有采纳规则。 + +“停止”沿用当前行为:停止 Agent 会结束当前这轮回复和后续编排;已提交的生成任务通过各自的取消操作处理。切换模式或隐藏面板都不调用这些操作。 + +只关闭或刷新页面、后端仍运行时,活动 Agent turn 可以重新连接。退出后端后的恢复取决于各类任务自身的持久化能力,不能承诺原 Agent turn 自动续跑。MP4 的浏览器渲染则需要页面继续打开,渲染完成、发布到项目和下载文件分别反馈。 + +## 7. 实现从哪里改 + +当前代码已经有一个共享的 `Workspace`,项目、编辑器和生成相关状态由它持有。建议继续保留这一层,在里面增加模式状态和布局分支。 + +```mermaid +flowchart TB + W[共享 Workspace] --> P[模式与布局状态] + W --> A[同一个 AssistantPanel] + W --> E[编辑器与时间轴输出] + P --> S[对话创作的对话布局] + P --> C[画布创作的停靠与浮动聊天] + A --> B[现有项目业务服务] + E --> B + C --> B + B --> D[项目、资产、引用、任务与结果] +``` + +### 保持组件和数据的归属 + +`AssistantPanel`、编辑器和时间轴输出 hook 要留在稳定的父组件下。模式切换只改变布局和可见性,不因为换了一棵 React 子树而重新挂载这些组件。画布也保留原有状态,隐藏时暂停无必要的绘制和缩略图播放,恢复时重新测量尺寸。 + +尤其不能直接复用 `installDocument`。它用于安装另一个项目文档,会清理选择、编辑器、本地历史等状态。模式切换只需要更新本地偏好和布局。 + +对话创作从现有消息引用、项目快照和资源索引读取结果。缺少的信息通过只读查询补齐。两种模式共用项目数据和任务订阅,断线恢复后重新读取服务端状态。 + +### 主要代码入口 + +下表列出各项交互对应的代码入口和职责。 + +| 位置 | 改动重点 | +| --- | --- | +| [CanvasWorkspace.tsx](../../src/canvas/CanvasWorkspace.tsx)、[WorkspaceView.tsx](../../src/canvas/workspace/WorkspaceView.tsx) | 保留共享生命周期,加入整页对话布局与画布分栏;共用编辑器宿主 | +| [state.ts](../../src/canvas/workspace/state.ts)、[runtimeTypes.ts](../../src/canvas/workspace/runtimeTypes.ts)、[useWorkspaceChrome.ts](../../src/canvas/workspace/useWorkspaceChrome.ts) | 模式状态、首次选择与欢迎层顺序、焦点和快捷键 | +| [workspaceMode.ts](../../src/canvas/workspaceMode.ts) | 处理 `agent` / `canvas`、偏好读写及默认选择 | +| [AssistantPanel.tsx](../../src/canvas/AssistantPanel.tsx)、[useAssistantLayout.ts](../../src/canvas/useAssistantLayout.ts)、[useFloatingAssistant.ts](../../src/canvas/useFloatingAssistant.ts) | 复用会话和输入组件,处理项目对话、左右停靠、浮窗和可用区域 | +| [TimelineEditor.tsx](../../src/canvas/TimelineEditor.tsx)、[TimelineOutput.tsx](../../src/canvas/TimelineOutput.tsx) | 保留编辑草稿、播放头、渲染与待发布结果;供对话创作复用输出操作 | +| [SettingsDialog.tsx](../../src/canvas/SettingsDialog.tsx)、[locale.ts](../../src/i18n/locale.ts) | 复用语言设置;只移除对话创作顶栏的快捷切换 | +| [双语词条目录](../../src/i18n/messages) | 新增模式名称、选择说明和状态提示,中英文一起交付 | + +当前 `TimelineOutput` 已支持从画布直接生成并发布 MP4,但 hook 卸载时会取消活动渲染、清空待发布结果。拆布局时要把它和 `TimelineEditor` 一起保住。 + +本次先抽取布局真正需要的边界,不顺带重构整个工作区。预期不需要改项目 schema,也不需要在业务命令里增加模式参数。 + +## 8. 怎么拆实现、怎么验收 + +建议分三步做: + +1. **先完成模式和布局。** 接入现有欢迎页,提供对话布局、画布工具栏、可调整的停靠分栏和浮动聊天。验证普通切换、浮动和停靠都保留会话与项目状态。 +2. **再完成对话创作的使用路径。** 接入结果预览、项目素材、引用、共用编辑器和时间轴输出。空项目、已有项目和无需模型的本地素材编辑都要能用。 +3. **最后检查完整交互。** 包括两种语言、窄窗口、快捷键、任务中切换和失败重试,再结合新手使用反馈调整细节。 + +模式和布局可以先做一个 PR。向用户开放对话创作前,先把查看结果、继续修改和输出视频走通。 + +验收优先看这些场景: + +| 场景 | 要检查的结果 | +| --- | --- | +| 首次设置 | 语言模型就绪后可直接对话;点击画布才展示其他开始方式。图片与视频任一生成模型就绪后可进入画布,配置失败、只有音频或仅打开模型编辑器均不能放行 | +| 项目对话 | 在宽屏和窄屏通过顶部按钮新建、搜索和切换会话;关闭列表后继续编辑。切换项目、模式和刷新后仍恢复正确的会话和草稿 | +| 初次打开、已有偏好、直接打开项目链接 | 打开正确项目,不因选择模式多创建项目;再次打开恢复选择 | +| 草稿、引用上传、Agent 回复中来回切换 | 同一会话和 turn,文本与引用不丢,上传继续,不重复提交 | +| 生成中切换,随后结果到达 | 候选归属正确,不覆盖用户后来改过或锁定的内容 | +| 编辑器有草稿、保存失败或版本冲突时切换 | 草稿、版本基线和错误保留,后续仍能正确保存或重试 | +| 时间轴播放、浏览器渲染、待发布阶段切换 | 播放头、输出任务和产物保留;发布冲突按原规则处理 | +| 隐藏画布再打开、拖动分栏、在聊天中输入快捷键 | 节点位置与视口正确,菜单可用,聊天操作不误触画布 | +| 从对话打开浮窗、移动、左右停靠、缩窄后恢复窗口 | 会话与草稿连续,移动浮窗保持视口,定位目标可见,窄窗口的聊天和画布均可访问 | +| 从对话创作定位结果,再回到对话 | 使用同一资产和版本,不复制项目;已有编辑继续可见 | +| 无模型、只有语言模型、外部 Agent runtime | 首次引导要求可用的语言模型;已进入的工作区按操作检查所需能力,导入和本地编辑可继续使用 | +| 做完一段视频,保存并重新打开项目 | 时间轴与素材可继续编辑,下载的 MP4 实际可播放 | +| 切换中英文、键盘导航和窄窗口 | 文案可读,输入和焦点保留,主要操作都能找到 | + +切换前后还要比对项目 ID、对象版本和撤销历史,确认切换本身没有产生业务命令。后台任务在这期间完成的,单独记录它提交的变化。 + +可扩展现有的 `assistant_sessions`、`assistant_run_navigation`、`timeline_workflow`、`structured_editors` 和 MP4 输出浏览器用例。新增用例加入统一 manifest,具体命令按[验证指南](../development/validation.md)执行。模型替身用于重复测试失败和交错场景;真实服务验证另行记录,不把它们混在一起。 + +模式切换沿用[界面性能预算](../development/ui-performance.md):首个反馈 P90 不超过 100ms,可操作中位数不超过 500ms、P90 不超过 1s。空项目、媒体较多的项目、第一次打开与已经加载过的切换分别测量。减少工具栏数量或工具调用次数,本身不能说明视频做得更快;需要观察用户是否更容易完成同一个任务。 + +本节列出交付条件。各阶段实现和验证记录见 [PR #380](https://github.com/ThinkFlowLab/OpenDirector/pull/380)。 + +## 9. 与其他任务的边界 + +#373 的模型说明、教程、样例和人物替换教学继续由各自任务推进。本方案提供相应入口,接入已经可用的内容;不把尚未完成的视频或样例放成空链接。 + +如果创作流程还缺服务或 Agent 入口,应单独列出具体操作和验收要求。 diff --git a/docs/development/agent-image-benchmark.md b/docs/development/agent-image-benchmark.md new file mode 100644 index 000000000..b9acf67a6 --- /dev/null +++ b/docs/development/agent-image-benchmark.md @@ -0,0 +1,47 @@ +# Agent image latency / Agent 图片生成耗时 + +The benchmark sends one fixed text-to-image request through the browser's Default Agent on a fresh empty project. It asks for one 2048×2048 PNG of a red ceramic mug on a pale blue table in soft window light. The runner contains the exact prompt. Keep it fixed across variants. + +基准从浏览器的 Default Agent 向全新空工程发送固定文生图请求,生成一张柔和窗光下、摆在浅蓝色桌面上的红色陶瓷杯,规格为 2048×2048 PNG。完整提示词见运行脚本,所有候选使用同一提示词。 + +| Metric / 指标 | Browser boundary / 浏览器计时边界 | +| --- | --- | +| First canvas change / 画布首次变化 | Send button click to the first animation frame with the image node created for this request visible in the viewport. / 从点击发送到本次请求创建的图片节点在视口可见的首个动画帧。 | +| Image completion / 图片生成完成 | The same click to the first animation frame with the decoded result visible in that node. / 从同一次点击到节点内解码后的生成结果可见的首个动画帧。 | + +Check first canvas change against the 3-second target in [Interaction budgets](ui-performance.md#interaction-budgets). Report image completion separately. + +画布首次变化按[交互预算](ui-performance.md#interaction-budgets)中的 3 秒要求判断是否达标,成图耗时单独报告。 + +After the measurement, the runner verifies that the same turn created one successful job, the project adopted its output, and the displayed image matches the persisted asset bytes. It reports timeouts and invalid results as failures. Each completed sample includes the job's effective generation parameters for comparison. + +计时结束后,脚本核对同一轮对话只发起一个成功任务、工程已采纳其结果,并验证画布图片与持久化素材字节一致。超时与结果校验失败均计为失败。成功样本包含实际生效的生成参数。 + +## Run / 运行 + +Build each compared revision with `npm run build`, and use the same browser, agent model, image model, provider configuration and timeout. Run the model server from its source checkout with an unused, private data directory. The source workspace supplies the two named model connections. Live runs consume model quota. + +用 `npm run build` 构建各对照版本。固定浏览器、Agent 模型、图片模型、供应商配置和超时。从对应源码目录启动服务,使用全新的独立数据目录。原工作区提供两条指定模型连接。真实模型运行消耗额度。 + +```sh +OPENDIRECTOR_ROOT="$(mktemp -d)" \ + PYTHONPATH="$PWD/packages/core/src:$PWD/apps/api/src" \ + python -m scripts.agent_image_benchmark_server \ + --model-root /path/to/configured/workspace \ + --agent-model MiniMax-M3.1-Flash --image-model MiniMax-H3-Image-Highspeed \ + --port 18261 +``` + +```sh +OPENDIRECTOR_API_URL=http://127.0.0.1:18261 npm run preview -- --port 15261 --strictPort +``` + +```sh +CREATION_API_URL=http://127.0.0.1:18261 CREATION_WEB_URL=http://127.0.0.1:15261 \ + AGENT_IMAGE_VARIANT=baseline AGENT_IMAGE_RUNS=5 AGENT_IMAGE_WARMUPS=1 \ + AGENT_IMAGE_TIMEOUT_MS=240000 node tests/browser/agent_image_latency.mjs +``` + +Use the browser dependencies from the [validation guide](validation.md). Save the JSON Lines output along with the Git revision and the candidate diff. When both arms are ready, alternate samples between them with `AGENT_IMAGE_RUNS=1 AGENT_IMAGE_WARMUPS=0` after the initial warmups. Compare success count, effective inputs, median and range for both timings. Keep raw failures in the report. + +浏览器依赖见[验证指南](validation.md)。保存 JSON Lines 输出、Git 版本和候选 diff。双方预热后,使用 `AGENT_IMAGE_RUNS=1 AGENT_IMAGE_WARMUPS=0` 交替采样。比较成功数、实际输入及两项耗时的中位数和范围,并保留原始失败样本。 diff --git a/docs/development/executable-segment-run-research.zh-CN.md b/docs/development/executable-segment-run-research.zh-CN.md new file mode 100644 index 000000000..9c5e7d84a --- /dev/null +++ b/docs/development/executable-segment-run-research.zh-CN.md @@ -0,0 +1,98 @@ +# 分段视频 Run 的导帧与交付范围约束 + +## 建议 + +Run 是发布后只读的可执行单元。用户或 Agent 在草稿中编辑源片版本、提示词、模型参数、续接依赖和交付区间。发布时冻结定义并生成新的 Run ID,后端执行器读取冻结的定义,自行提交生成、等待结果、组装和发布。Agent、CLI 和画布通过同一入口启动或查询执行,后续步骤由执行器推进。 + +| 方案 | 能解决什么 | 取舍 | +| --- | --- | --- | +| 加强 Skill,继续由 Agent 串联命令 | 改善计划内容和操作习惯 | 当前门禁只在已有计划启用导帧时生效。文字规则无法防止漏开导帧或错误发布。 | +| 扩展现有 Run 和共享服务 | 执行依赖、帧覆盖、局部重跑和回执均可验收 | 需要补充计划、组装输入与持久化执行器,能沿用已有生成、引用、裁切和发布服务。推荐。 | +| 引入通用节点运行引擎 | 可表达任意类型的操作依赖和组合 | 需要定义通用节点执行与恢复契约。当前只需视频生成、导帧和组装这组已有业务能力。 | + +## 可借鉴的实现 + +- ComfyUI 的执行列表维护输入依赖,节点在阻塞自己的依赖就绪后才可执行。Goodnight v5 的实际图把 S3 的原始输出帧 116、137 接到 S4 的 0、21 导帧输入,再从 S4 的第 22 帧开始保留。v6 的组装图复用前四段,只重算末段。OpenDirector 可借鉴显式依赖和局部重跑,通过已有的任务回执、采用结果和冻结版本实现。ComfyUI 也分别保存画布布局与服务端执行输入,这支持由同一份已保存计划投影画布和执行步骤的设计。 [ComfyUI 执行图源码](https://github.com/Comfy-Org/ComfyUI/blob/master/comfy_execution/graph.py) · [ComfyUI 画布与执行表示](https://docs.comfy.org/development/api-development/workflow-metadata#embedded-fields) +- OpenTimelineIO 分开记录媒体内的裁切范围和片段在父轨道里的摆放范围,邻接片段用前一段的开区间结束点对齐下一段起点。这里还需要第三个坐标,即该交付段覆盖原片的哪个范围。源片覆盖是 OpenDirector 的交付规则。 [OpenTimelineIO 时间范围](https://github.com/AcademySoftwareFoundation/OpenTimelineIO/blob/main/docs/tutorials/time-ranges.md#clips) + +## 当前实现与缺口 + +- `GroupAssembly` 已保存生成节点及保留窗口,也有组级 `requireTimelineGuides` 和单一豁免节点。现有验证在该开关或片段导帧配置出现后生效,普通参考计划可以两者都不填。新计划要显式记录每段是锚点还是续接,由此派生导帧要求。 [画布契约](../../packages/core/src/opendirector/domain/creation/canvas.py#L192) · [导帧策略](../../packages/core/src/opendirector/domain/creation/validation.py#L57) +- 共享生成服务已解析引用和模型配置,提交前校验必需导帧,FastH3 适配器也会上传两张导帧到 0、21。还需要核对解析出的导帧节点就是计划声明的上游节点。 [生成准入](../../packages/core/src/opendirector/application/creation_generation.py#L431) · [FastH3 表单](../../packages/core/src/opendirector/integrations/vllm_omni.py#L129) +- 当前组装要求每段对应一个已采用的生成任务,并检查冻结导帧来源。渲染器已经检查解码帧数。需要让直接保留的原片区间成为合法组装输入,再用预先冻结的交付范围校验覆盖。当前 `video.trim` 保存源节点、来源引用和秒级裁切参数。帧精确验证应增加明确的帧区间,或直接从冻结的工作源片按帧裁切。 [组装输入](../../packages/core/src/opendirector/application/creation_workflow_assembly.py#L91) · [裁切来源](../../packages/core/src/opendirector/application/creation_video_trim.py#L65) · [渲染校验](../../packages/core/src/opendirector/media/workflow_assembly.py#L94) +- 现有 Skill 的 `validate_frame_plan.py` 已实现半开区间覆盖、原片保留和输出帧数检查,但严格 Run 分支会拒绝原片直通及独立镜头与导帧混用,要求另走混合时间线。可以把已有区间校验和测试用例迁到共享后端,再让 Skill 调用正式回执。 [帧覆盖检查](../../packages/agent/skills/character-replacement/scripts/validate_frame_plan.py#L160) · [严格 Run 的限制](../../packages/agent/skills/character-replacement/scripts/validate_frame_plan.py#L287) +- 画布已能在浏览器中按连线调度分组,并在结果被采用后组装。已发布 Run 改由后端按显式依赖推进,复用已有生成与组装命令。页面读取执行状态并订阅进度。 [现有画布调度](../../src/canvas/workspace/useWorkspaceGeneration.ts#L727) + +## 模板和命令契约 + +有两种可实现的形状。**可编辑执行图**允许调用方定义节点、依赖和裁切,服务端保存时检查合法性,适合自由编排。**固定模板**由产品定义支持的步骤和约束,调用方填写素材、人物映射、分段和允许的配置,服务端生成计划。首版选固定模板,按通用分段换人流程支持原片直通、独立锚点、正向与反向续接。Goodnight 和 Case03 用于验证这一份模板。 + +下列签名是拟议接口。只有发布命令能生成 Run 定义。后端从模板版本和冻结参数派生依赖与交付顺序。 + +```text +发布草稿(draftId, expectedRevision) → runId, planItemId +启动执行(runId, operationId) → executionId +恢复执行(executionId) → 原执行记录 +复制为草稿(runId) → draftId + +生成步骤 = 锚点 | 续接(上游步骤 ID, 两个原始帧索引, 方向) +交付片段 = 原片(源帧区间) | 生成结果(步骤 ID, 源帧区间, 结果裁切) +``` + +启动请求只引用已发布的定义。草稿、已发布 Run 和执行记录分别保存,只有执行器更新执行进度。执行器从 Job 和发布回执读取实际结果。服务端在共享命令入口校验 Run 归属,覆盖 Agent、CLI、画布、批量命令及关联节点编辑。普通节点可复制为新的编辑对象,原 Run 的任务、配置与交付槽继续绑定原定义。现有组装配置写入口、历史恢复和普通时间线发布都要核对同一归属,已发布 Run 的交付记录只能由其执行产生。 [画布写入分发](../../packages/core/src/opendirector/application/creation_canvas.py#L506) + +| 已发生的问题 | 约束位置 | 负向验收 | +| --- | --- | --- | +| 续接省略导帧 | 续接类型必须具备上游关系和取帧规则,发布和提交按同一关系校验 | 降级普通参考、缺帧、错绑上游版本均被拒,FastH3 不收到下游请求。 | +| 重做时自行缩短交付 | 全片范围由后端从固定源片推导,改变范围需对应用户批准 | 559 帧与总长正确但缺一帧、重复一帧的方案均不能发布。 | +| 运行时改配置或变更结果来源 | 已发布定义只读,执行绑定 Run ID、模板版本与素材版本 | 加传提示词覆盖值、改关联节点或用另一份结果冒充本轮产物,操作失败且原定义不变。 | +| 断线后重复提交 | 执行器保存原操作和任务回执 | 重启后恢复同一执行,提交结果不明的步骤停在待核对状态。 | + +## 要保存的数据 + +每个已发布 Run 绑定一份冻结计划。发布回执返回 Run ID 和可见计划节点 ID。画布展示的范围、人物引用、锚点、导帧和裁切都读取该计划。镜头分析和编排理由在草稿阶段编辑,发布时随计划保留。画布自动排布属于展示状态,与执行定义分别保存。 + +| 对象 | 最少需要的信息 | +| --- | --- | +| 交付范围 | 工作源片的素材 ID、版本、指纹,帧率和解码总帧数。全片任务的目标范围由源片推得,部分交付范围来自用户选择或已确认的变更。可变帧率原片先生成固定帧率工作副本并保留来源。 | +| 生成步骤 | 生成节点和配置版本、实际输入的源窗口及处理顺序、已绑定的肖像版本。锚点显式标记。续接记录上游步骤、原始结果的两帧索引和方向。输入窗口引用服务端裁切记录或具备等价校验的帧级来源记录。 | +| 交付片段 | 按成片顺序记录覆盖原片的半开区间。直接保留的段引用工作源片。生成段引用计划步骤和结果保留区间,沿用现有的反转、窗口上限与裁切语义。 | + +例如 Goodnight 可在同一份计划中声明开头插镜直接引用源片,其他段用生成结果,只有长镜头内的续接需要导帧。有硬切的独立镜头可各自成为锚点。Case03 则允许 B 的结果同时供 A 和 C 生成,其中 A 反向执行。组装仍按时间线顺序取用各段。 + +## 发布、执行与改版 + +- **发布**把通过校验的草稿封存为 Run。后端拒绝针对已发布定义的直接编辑、批量更新或经由关联节点修改执行输入。素材、模型参数、提示词、导帧、裁切和组装顺序全都按封存值执行。 +- **执行**为同一 Run 创建独立执行记录,保存任务 ID、状态和结果。继续等待复用原执行记录。主动重跑创建新记录,仍使用原定义。历史执行结果按各自记录保留。 +- **改版**从已有 Run 复制草稿,发布为新 Run 并保留来源 Run ID。变化的输入和依赖决定哪些步骤需要重新生成。符合新计划的既有结果可显式复用,复用关系写入新执行记录。 + +## 后端执行器 + +启动入口接收 Run ID 和操作 ID,校验权限后保存执行记录并立即返回执行 ID。记录固定的 Run 定义、各步骤状态、提交操作 ID、关联 Job ID 和采用结果的素材版本。后端按现有任务机制等待及恢复。有依赖的步骤只在上游选定结果可用后才提交,执行顺序由计划依赖决定。 + +```text +启动已发布 Run + → 保存执行记录 + → 提交就绪步骤 → 等待并读取结果回执 + → 固定导帧来源 → 继续提交下游 + → 验证源帧覆盖 → 组装与发布 → 保存完成回执 +``` + +执行器调用现有的生成、采用、裁切和发布服务,并用业务回执更新进度。浏览器关闭或 Agent 结束后,已授权的执行继续推进。服务重启时先查询原操作回执和已接受的任务,再恢复未完成的步骤。上游失败会阻塞依赖步骤,提交结果不明时保留原身份待核对。需要人工审片时暂停在计划声明的检查点,由用户采用结果后继续执行。 + +## 校验与执行 + +1. **发布 Run 时检查计划是否可执行。** 校验工作源片和输入版本、源帧覆盖、模型导帧能力、依赖节点存在且无环。用已保存的镜头边界声明区分独立锚点与同镜头续接。连续镜头内的拆分需要导帧,模型能力缺失时回执指出受影响的步骤。镜头边界来自已检查的源片帧和保存的计划,由服务端校验声明间的一致性。当前组级单锚点可继续用于单链计划,同一个交付计划有多条链时,按每个步骤的角色派生要求。发布后修改目标范围或依赖须通过草稿发布新 Run。新草稿仍须满足导帧规则。部分交付的批准写入业务回执,由有权修改范围的用户操作产生。 +2. **生成提交时解析并锁定输入。** 依赖结果产生前,计划只记录上游步骤及取帧规则。下游就绪时解析本次明确采用的上游任务、素材版本和指纹,核对两帧在原始输出范围内,再写入冻结任务。提交走现有共享校验。缺帧、来源冲突或授权失效时停止下游,并指出是哪一段。外部提交结果不明时,先按原操作和任务回执核对,保留已完成的生成。 +3. **发布前分别检查来源覆盖与实际输出。** 从目标起点开始,要求各片的源区间起点等于上一片结束点,并最终抵达目标结束点。本流程按正常速度交付,生成结果经过约定的反转和裁切后,保留帧数须等于该段源覆盖长度。直接保留的片段按冻结源版本精确取帧,并在维持帧数的前提下编码为交付分辨率。音轨按同一目标区间取原声,生成片段的音轨保持静音。组装前后重验计划版本、冻结结果和导帧依赖,再原子发布时间线与 MP4。计划绑定的成片槽只接受通过相同校验的发布回执,包括通用时间线发布入口。源帧区间能证明计划覆盖与素材来源,画面中的表演、身份和接缝仍需看片验收。 +4. **重跑按依赖传播。** 沿用已经验收且输入一致的结果。替换上游结果后,仅标记依赖旧导帧版本的后续段待更新,独立节点继续复用。普通渲染重试沿用已生成的素材与原有执行记录。执行器按执行记录恢复,先查询原任务再推进。 + +## 实施顺序与验收 + +| 阶段 | 改动 | 验收 | +| --- | --- | --- | +| 1. 契约与发布 | 扩展现有 Run 的计划和组装输入,发布时冻结范围和依赖,并回传计划节点 ID。组装新增原片输入与覆盖检查。 | try0031 的 559 帧方案报缺 `[0,6)`、`[565,566)`。再构造总数恰好 566 帧但重复一个源区间的计划,仍拒绝发布。直接修改已发布 Run 被拒绝,复制为草稿并发布新 Run 可以保存合法改动。用原始素材补齐时,确认时间线和 MP4 都覆盖 566 帧,原声与目标范围对齐。 | +| 2. 提交与局部重跑 | 从步骤角色派生严格导帧,接入生成准入、任务恢复和组装。 | 用普通两段续接和 Case03 的双向依赖验证。缺导帧时确认项目未新增任务,真实 FastH3 请求收到 0、21 两槽。更换上游采用结果后,旧下游不能混入发布,独立段结果可以复用。 | +| 3. 后端执行器 | 让画布、CLI 和 Agent 共用启动与查询入口,由后端持久化执行状态并调用现有业务服务。三部分共同构成首版。 | 关闭画布并结束 Agent 后,程序仍按依赖推进并发布。模拟提交后断线和服务重启,恢复原任务且不重复提交。 | + +这份调研基于当前工作区实现、两次已记录的 Goodnight 工作流和公开主源。表中的验收是待实现后的检查项。 diff --git a/docs/development/h3-conditioning-features.md b/docs/development/h3-conditioning-features.md new file mode 100644 index 000000000..dc5df7641 --- /dev/null +++ b/docs/development/h3-conditioning-features.md @@ -0,0 +1,141 @@ +# H3 系列模型的条件生成能力:接入方案 + +本文说明如何让 OpenDirector 对所有自部署的 MiniMax-H3 衍生模型开放四项条件生成能力:结构控制(含姿态)、潜空间接续、局部重绘、指定时间点的关键帧。范围限于 `vllm_omni` 协议的视频模型。 + +## 1. 背景 + +vLLM-Omni 已经让每一种 H3 权重都能使用这四项能力(vllm-project/vllm-omni#11078):原版 H3、FastH3 Omni,以及 LightX2V Turbo、Pika Flex Turbo、alibaba-pai Acc 这三类蒸馏适配器。OpenDirector 仍按最初接入时的划分,把能力绑定在两个互不重叠的档案上: + +| 档案(`inputRules.profile`) | 适配器 | 视频模式 | 局部重绘工具 | +| --- | --- | --- | --- | +| `vllm-omni-h3` | `minimax_h3` | 首帧、素材参考、接续 | 可用 | +| `fasth3-omni` | `fasth3` / `fasth3_dual` | 素材参考、结构控制(`fasth3_dual` 另有首尾帧) | 不可用 | + +结果是:用 `fasth3` 请求格式的模型(FastH3 Omni、Pika H3 等 8 步蒸馏模型)用不了接续和局部重绘;用 `minimax_h3` 的原版 H3 用不了结构控制;关键帧在两边都只有「首帧 / 尾帧」两个固定位置。 + +## 2. 实测依据 + +2026-11-27 在 4×B300 上用「原版 H3 Ref2VA + Pika Flex Turbo 8 步 LoRA + Fun ControlNet Union」实测,832×480、124 帧,每项一个提示词、一个种子。 + +- 同一个服务(张量并行 4,启动时带 `--controlnet-model-path`)在不同请求里分别完成了:姿态控制、深度控制、潜空间遮罩重绘、时间线关键帧、`continue_from` 接续。 +- 结构控制与另外三项不能出现在同一个请求里,服务端返回 400:控制 + 关键帧、控制 + 遮罩重绘、控制 + `continue_from`。 +- 按 vLLM-Omni 文档,控制分支只支持张量并行,不支持 Ulysses 序列并行(后者未实测)。张量并行 4 与此前的 Ulysses 4 在这组请求上速度相同,约 3 秒一段。 +- 服务端不做预处理:`control_type=pose` 只读取上传的骨架画面,姿态、边缘、深度图都要由客户端准备。 + +## 3. 设计原则 + +**把「权重能做什么」和「请求怎么采样」分开。** 目前 `videoAdapter` 同时决定了两件事。四项能力属于 H3 这一族,与采样方式无关;采样约定才因权重而异。 + +- **能力**由 H3 族和服务的分区决定,写进输入规则,前端从 `inputRules` 读取,不再按适配器名判断。 +- **采样约定**由适配器决定:步数、引导强度、流偏移、采样器、是否需要 LoRA。 + +分区限制是真实的,需要在规则里表达: + +| 服务分区 | 文生 / 首帧 | 素材参考 | 结构控制 | 接续 | 局部重绘 | 关键帧 | +| --- | --- | --- | --- | --- | --- | --- | +| FL2VA(`--task-type fl2va`) | 是 | 否 | 是(无参考) | 是 | 是 | 是 | +| Ref2VA(`--task-type ref2va`,含 FastH3 Omni) | 否 | 是 | 是(带参考) | 是,衔接较松 | 是,需一张参考图 | 是 | +| 合并服务(两个 DiT) | 是 | 是 | 否 | 是 | 是 | 是 | + +## 4. 分项方案 + +改动量参照结构控制最初接入的那次提交(`51dedd70`,52 个文件、约 840 行,其中包含两个工具)。 + +### 4.1 潜空间接续(改动最小) + +界面上已有「接续」模式和「延长」按钮,`useWorkspaceEditor.ts` 在模型支持接续时会自动把「延长」升级为接续。缺的只是 `fasth3-omni` 档案不声明这个模式,以及它的请求路径不发 `continue_from`。 + +1. `domain/input_rules.py`:给 `fasth3-omni` 的 `videoModes` 加上 `continuation`。 +2. `integrations/fasth3.py` 的 `generation_fields`:接续时写入 `extra['continue_from']`。 +3. `integrations/providers.py`:接续模式下不上传源视频。来源解析沿用 `reference_inputs.continuation_source`。 +4. `domain/creation/generation.py`、`model_availability.py`、`rule_facts.py` 的用例向量:把 `fasth3-omni` 纳入接续的校验与可用性判断。 + +来源必须是同一服务生成且缓存还在的任务,上传的视频不能接续。对上传的视频,「延长」继续走素材参考模式,把该视频作为参考视频(长度仍受参考视频时长上限限制)。Ref2VA 权重对潜变量尾部跟得较松,接缝可能可见,应在模式说明里写明。 + +### 4.2 局部重绘 + +界面(`VideoActionEditor`)、三个工具和后端流程都已存在,只是 `adapter_for` 只在 `vllm-omni-h3` 档案下返回提供 `video.edit` 的适配器。 + +1. `integrations/model_adapters.py`:`adapter_for` 对 `fasth3-omni` 也返回一个编辑适配器。 +2. 该适配器按 Ref2VA 的约定发请求:`task=ref2va`、固定步数与引导强度,并附一张参考图(取源片段的第一帧)。现有的 `VllmOmniVideo.edit_video` 发的是 `task=t2va`,在只有 Ref2VA 的服务上不可用。 +3. `domain/capability_contract.py`:`video_to_video` 档案的必需输入增加参考图的情况。 + +**参考图决定片段的开头。** Ref2VA 模型会让片段开头贴近参考图:重绘区域在开头显示的是参考图在该处的内容,提示词描述的画面要过一段时间才出现。以源片段首帧作参考图时,成片第 0 帧的重绘区域与原片相同(固定种子 9 次中 9 次),修改最早在第 32 帧前后出现,慢的要到片尾。把参考图里的重绘区域涂灰、裁掉,或改写提示词,都不能消除这一点:结果随种子而变,涂灰时开头可能出现灰块,裁剪时可能把参考图里的人物再画一遍。服务端不接受不带参考图的请求。 + +因此框选重绘跑两遍:第一遍以源片段首帧为参考图,到片尾时已是修改后的画面;第二遍以第一遍结果中修改覆盖的最后一帧为参考图,让修改尽量从片头就在。两遍的请求除参考图外完全相同,耗时约为一遍的两倍。这样做提高了修改出现在片头的概率,但并不可靠:早期固定种子实测,同一提示词下 6 次中 5 次从第 0 帧起就是修改后的画面,另 1 次在前约半秒内淡入;2026-12-01 在画布上用另一组素材提交的框选重绘里,也有到第 46 帧(约 1.9 秒)修改才出现的一次(见第 8 节)。整帧的时间段重绘(局部重拍)仍只跑一遍:片段开头是保留的画面,首帧正是要延续的样子;时间段从片头开始时,改取时间段结束后的第一帧。后一种情况固定种子各测 3 次:以首帧为参考图时,要求的修改 2 次完全没有出现、1 次只短暂出现;改取时间段之后的第一帧,3 次都在整个时间段内出现。 + +### 4.3 结构控制的类型 + +现在 `fasth3.control_parameters` 把类型写死为 `depth`,界面没有选择。 + +1. `VideoParameters` 增加 `controlType`(`depth`、`pose`、`canny`、`hed`、`mlsd`)和 `controlScale`,重新生成契约。 +2. `NodeComposer.tsx` 在结构控制模式下增加类型下拉和强度输入,补中英文文案。 +3. 给原版 H3(`vllm-omni-h3`)也开放 `control` 模式:FL2VA 服务上是无参考的 T2VA 请求。合并服务不提供。 +4. 预处理工具:已有「深度动捕」;新增「姿态提取」和「边缘提取」,产出可直接连接为控制视频的素材。边缘可用本地 FFmpeg 完成;姿态需要一个检测模型,可以做成本地工具进程,也可以接一个新的模型协议。 + +### 4.4 指定时间点的关键帧(改动最大) + +现有的首尾帧只存两个节点 ID,引用上没有时间字段,`frame_indices` 只会是 0 或 -1。 + +1. 契约:在引用上增加可选的 `frameTimeMs`(或在 `VideoParameters` 上增加关键帧列表),角色增加 `keyframe`,重新生成契约。 +2. 画布:`NodeComposer.tsx` 的帧槽位从固定两格扩展为列表,每一项选一张已连接的图片并填写时间点;`creationProjection.ts` 负责双向映射。 +3. 后端:`creation_generation.task()` 把时间随 `referenceRoles` 传下去;`reference_inputs.py` 换算成帧号;请求发送 `timeline_guides` 清单、`guide_files` 上传和 `quality=lossless`。 +4. 校验:最多 8 项;时间点落在输出时长内;与结构控制、接续、局部重绘互斥。 + +首帧和尾帧可以统一成时间为 0 和结尾的关键帧,这样 Ref2VA 权重也能有首尾帧,不必依赖 `fasth3_dual` 的第二个 DiT。 + +### 4.5 采样约定与 LoRA + +Pika、LightX2V Turbo、PAI Acc 都要求每个请求带 `lora` 字段,并使用各自固定的步数和流偏移。OpenDirector 现在不发 `lora`,部署时只能在中间加一层转发来补。 + +- 在模型配置上增加可选的采样约定:`steps`、`guidanceScale`、`flowShift`、`lora`(名称、服务端路径、强度)。`fasth3` 这条请求路径读取它们,而不是写死 8 步。 +- 更好的来源是服务自己声明。OpenDirector 已经会查询 `/v1/omni/capabilities`,当前 vLLM-Omni 对它返回 404。等服务端提供该接口后,能力、分区和采样约定都应从那里读取,手工配置只作兜底。 + +## 5. 互斥规则 + +前端在 `rules.ts` 的 `backendBlocker`、后端在 `validate_generation` 中各校验一次: + +- 结构控制不与关键帧、接续、局部重绘同时使用。 +- 关键帧不与接续、局部重绘同时使用。 +- 结构控制模式下输出时长跟随控制视频,现有规则不变。 + +## 6. 实现情况 + +已实现: + +- **潜空间接续(4.1)**:`fasth3-omni` 档案声明 `continuation`;请求发送 `continue_from` 并沿用来源画幅,不上传源视频;服务端已无缓存时给出专门的说明。 +- **局部重绘(4.2)**:`FastH3VideoEdit` 适配器为 `fasth3-omni` 提供 `video.edit`,按 Ref2VA 发请求。框选重绘跑两遍,第二遍以第一遍结果的最后一帧作参考图,让修改尽量从片头就出现(多数情况有效,并不可靠,见 4.2)。请求附带的参考图已计入三个编辑工具的准入检查。 +- **指定帧(4.4)**:引用新增角色 `keyframe` 和字段 `frameTimeMs`,输入规则新增 `maxKeyframes`(两个 H3 档案均为 8);画布设置为 `pinnedFrames`;两条 H3 请求路径都发送 `timeline_guides`。目前只在素材参考模式下提供;规格没有时长时拒绝关键帧,因为时间点无从比较。 + +未实现: + +- **采样约定与 LoRA(4.5)**:OpenDirector 的请求仍固定 8 步、不带 `lora`;现在由随应用启动的视频转发层按模型名补上步数、流偏移和 `lora`(见[视频转发层指南](../guides/video-gateway.zh-CN.md))。模型配置里直接填写采样约定仍未实现。 +- **结构控制的类型(4.3)**:仍固定为深度。用现有的「视频抠像」「深度动捕」「蒙版合成」可以做出只有人物的深度视频,实测比姿态骨架更贴合动作,所以姿态的优先级可以降低。 +- **原版 H3 的结构控制**、**首帧模式下的指定帧**、**用关键帧统一首尾帧**。 +- 复制节点时 `pinnedFrames` 会改指向副本里的图片,图片不在副本里的时间被丢弃;删除或断开图片时同样丢弃。导入画布归档时是否保留未验证;重新从工程加载时按后端引用恢复。 +- 局部重绘工具只支持框选区域和时间段,不支持任意形状的遮罩。 + + +## 7. 界面 + +- **指定帧**:素材参考模式下,每张已连接的图片对应一个时间框;填了时间后,时间框下方提示这次生成按无损质量进行。 +- **潜空间接续**:对同一模型配置生成的视频选择「视频延长」,草稿的模式自动为「接续」;上传的、编辑过的或其他模型生成的视频保持「全能参考」。 +- **局部重绘**:「局部重拍」「视频编辑」「字幕擦除」在 FastH3-Omni 请求格式的模型上可用。 + +截图和操作录屏随合并请求 #541 提供,不放在仓库里。 + +## 8. 实测 + +2026-12-01,在 OpenDirector 里对自部署的「原版 MiniMax-H3 Ref2VA + Pika Flex Turbo 8 步 HD LoRA」服务(FastH3-Omni 请求格式)走完各项能力。素材是用 MiniMax-H3-Image 生成的一张造型图和两张姿势图。每项只跑了一两个种子,没有挑选:能说明功能通不通,不能说明质量高低。 + +| 能力 | 入口 | 结果 | +| --- | --- | --- | +| 指定帧 | 画布上的时间框;命令行 `video create --keyframe` | 钉在 1.25 秒和 4 秒的两帧与指定图片的 SSIM 约为 0.78 和 0.85–0.88,与另一张图片交叉比较约为 0.55 | +| 潜空间接续 | 「视频延长」,草稿为「接续」模式 | 服务端日志记录了 `continue_from` 和上一段的任务 ID,成片带音轨 | +| 视频编辑 | 框选画面上方 30%,重画成夜空 | 与源片段相比,框内 PSNR 约 10–13 dB,框外约 36 dB | +| 局部重拍 | 重拍第 2–4 秒 | 区间内 PSNR 约 17 dB,区间前后约 38 dB | +| 字幕擦除 | 烧入一行字幕的片段,默认的底部区域 | 两次里一次擦除干净,一次在原位置画出了新的乱码文字 | + +- 框选重绘跑两遍后,修改出现的时间仍随种子变化:逐帧看过的几次里,有从第 0 帧起就在的,有从第 2 帧起的,也有到约第 46 帧才出现的。 +- 字幕擦除在这组权重上还不可靠;它与另外两个工具共用同一个适配器,所以一并开放。 +- 结构控制的入口原本就有,这次没有重测。它的输出长度取不超过控制视频的最大 `17n+5` 帧,可能比控制视频短不到 0.7 秒。 diff --git a/docs/development/i18n.md b/docs/development/i18n.md index fc0837253..d022c53cd 100644 --- a/docs/development/i18n.md +++ b/docs/development/i18n.md @@ -1,11 +1,11 @@ # 中英双语界面 -界面语言在 `zh-CN` 与 `en-US` 之间切换。中文是默认语言,也是词条键的基准;英文必须覆盖同一组键。 +界面语言在 `zh-CN` 与 `en-US` 之间切换。中文是词条键的基准;英文必须覆盖同一组键。 ## 语言选择 -- 用户可以在画布左上角的「中文 | EN」开关直接切换,也可以使用「设置 → 界面语言」。 -- 用户在「设置 → 界面语言」保存的选择优先。 +- 两种创作方式都可以在「设置 → 通用 → 语言」切换语言。对话创作的设置入口在顶栏,画布创作的设置入口在左下角。宽窗口下,画布创作也保留左上角的「中文 | EN」开关。 +- 用户保存的语言选择优先,两种创作方式共用这一偏好。 - 没有保存值时,浏览器语言以 `zh` 开头使用 `zh-CN`,以 `en` 开头使用 `en-US`,其他语言使用英文 `en-US`。 - 选择保存在 `localStorage` 的 `opendirector.locale.v1`,并同步到 `` 与 `data-locale`。 - 界面语言不影响 Agent 回复语言。Agent 始终跟随用户最新提问的语言,不参考当前界面语言。 @@ -92,16 +92,17 @@ npm run check:i18n | --- | --- | --- | | 通用、错误 | [common.ts](../../src/i18n/messages/zh-CN/common.ts) | [common.ts](../../src/i18n/messages/en-US/common.ts) | | 设置、主题 | [settings.ts](../../src/i18n/messages/zh-CN/settings.ts) | [settings.ts](../../src/i18n/messages/en-US/settings.ts) | -| 首次设置 | [firstRun.ts](../../src/i18n/messages/zh-CN/firstRun.ts) | [firstRun.ts](../../src/i18n/messages/en-US/firstRun.ts) | +| 首次设置(助手连接、创作经验提示与任务选择) | [firstRun.ts](../../src/i18n/messages/zh-CN/firstRun.ts) | [firstRun.ts](../../src/i18n/messages/en-US/firstRun.ts) | | 画布与项目 | [canvas.ts](../../src/i18n/messages/zh-CN/canvas.ts) | [canvas.ts](../../src/i18n/messages/en-US/canvas.ts) | | 模型与服务 | [models.ts](../../src/i18n/messages/zh-CN/models.ts) | [models.ts](../../src/i18n/messages/en-US/models.ts) | | 画布外壳 | [canvasShell.ts](../../src/i18n/messages/zh-CN/canvasShell.ts) | [canvasShell.ts](../../src/i18n/messages/en-US/canvasShell.ts) | | 画布工作区 | [canvasWorkspace.ts](../../src/i18n/messages/zh-CN/canvasWorkspace.ts) | [canvasWorkspace.ts](../../src/i18n/messages/en-US/canvasWorkspace.ts) | +| 创作方式(引导中的直接入口、顶栏切换与浮窗入口) | [workspaceModes.ts](../../src/i18n/messages/zh-CN/workspaceModes.ts) | [workspaceModes.ts](../../src/i18n/messages/en-US/workspaceModes.ts) | | 生成器 | [generation.ts](../../src/i18n/messages/zh-CN/generation.ts) | [generation.ts](../../src/i18n/messages/en-US/generation.ts) | | 音色库 | [voiceLibrary.ts](../../src/i18n/messages/zh-CN/voiceLibrary.ts) | [voiceLibrary.ts](../../src/i18n/messages/en-US/voiceLibrary.ts) | | 时间线 | [timeline.ts](../../src/i18n/messages/zh-CN/timeline.ts) | [timeline.ts](../../src/i18n/messages/en-US/timeline.ts) | | 素材库 | [library.ts](../../src/i18n/messages/zh-CN/library.ts) | [library.ts](../../src/i18n/messages/en-US/library.ts) | -| 助手 | [assistant.ts](../../src/i18n/messages/zh-CN/assistant.ts) | [assistant.ts](../../src/i18n/messages/en-US/assistant.ts) | +| 助手(顶部会话切换、浮动与左右停靠、结果卡片与操作) | [assistant.ts](../../src/i18n/messages/zh-CN/assistant.ts) | [assistant.ts](../../src/i18n/messages/en-US/assistant.ts) | | 图片、图层、导演台 | [editors.ts](../../src/i18n/messages/zh-CN/editors.ts) | [editors.ts](../../src/i18n/messages/en-US/editors.ts) | | 节点、资产 | [canvasNodes.ts](../../src/i18n/messages/zh-CN/canvasNodes.ts) | [canvasNodes.ts](../../src/i18n/messages/en-US/canvasNodes.ts) | | 错误、状态与后端回执 | [errors.ts](../../src/i18n/messages/zh-CN/errors.ts) | [errors.ts](../../src/i18n/messages/en-US/errors.ts) | diff --git a/docs/development/lessons.md b/docs/development/lessons.md index 20e3ea60f..9b06bfa4f 100644 --- a/docs/development/lessons.md +++ b/docs/development/lessons.md @@ -40,6 +40,13 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u - **Windows CLI follow-up:** In PR #323 validation, the Agent saved Unicode successfully, but PowerShell 5.1 shell readback failed when Python used the Windows code page. A saved-object comparison bypasses CLI stdout. Test write and readback in the actual Agent shell with Python UTF-8 mode disabled in the parent environment, and cover BOM-prefixed JSON files produced by PowerShell 5.1. / **Windows CLI 补充:** PR #323 验收中,Agent 正确保存了 Unicode,但 Python 使用 Windows 代码页时,PowerShell 5.1 中的读回失败。应在父进程关闭 Python UTF-8 模式,用真实 Agent Shell 验证写入和读回,并覆盖 PowerShell 5.1 生成的带 BOM JSON 文件。 +## Asynchronous readiness must preserve newer focus + +- **Trigger:** Opening chat by default or retaining it while changing projects, when its data finishes loading after the user has focused another control. +- **Evidence:** [PR #380](https://github.com/ThinkFlowLab/OpenDirector/pull/380) reproduced delayed assistant reads closing the project picker and ending new-project renaming. Project creation and opening succeeded; the chat's readiness effect moved focus and triggered the other controls' dismissal handlers. +- **Check:** Hold the assistant read until the project picker or name editor is active, then release it and verify that both the control and its focus remain. Preserve focus requested by explicitly opening chat or changing conversations, while respecting a later user focus change. Distinguish a controlled reproduction from proof of the original CI event order. +- In a narrow chat, dismissing the pending canvas references on pointer-down moved a result button before pointer-up. The click landed on the card and never reached the button. Exercise a real pointer click after returning from a selected canvas node and verify that the node becomes visible again. / 窄屏聊天曾在按下鼠标时收起待引用面板,使结果按钮在松开鼠标前移位。回归应从已有选区的画布返回对话,实际点击结果按钮,并检查对应节点是否重新进入视口。 + ## Baseline failures still need tracking - **Trigger:** A relevant test fails and comparison shows that it also fails on the baseline. @@ -68,6 +75,7 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u - Browser checks that inspect a canvas image or video after reopening a project or placing a result should bring the target node into view first. - The subject-library and video-review checks in Nightly run 45572808123 reached their persisted-state assertions before the lazy previews were ready. After fitting the canvas, wait for the target image to load or the video to load metadata, then verify the dimensions or duration. [Nightly run 45572808123](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/45572808123/job/139063347523) +- [Nightly run 46322961844](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/46322961844/job/141535114491) reached a subject image fingerprint check after the element mounted but before its source was ready. Wait for a nonempty source and decode before reading bytes. The same run's history dialog test intercepted a save on a clean canvas. Make a real edit before testing the pending or failed save states, since the save queue skips unchanged content. ## Browser clock pauses must precede short-lived observations @@ -130,6 +138,7 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u - **Evidence:** Media and assistant requests returned storage-lock timeouts on a Windows project with over 800 commits. All the referenced files were present, and reading the committed head resolved the failing media requests. - **Check:** Read current media from the committed head and replay immutable history outside the catalog lock. Before publishing, recheck the head and rerun command validation if it changed. The asset and storage tests cover original bytes and a concurrent head change during replay. - **Rename follow-up:** [PR #544](https://github.com/ThinkFlowLab/OpenDirector/pull/544) reproduced receipt and change-feed reads reporting corruption when a concurrent rename moved a valid commit directory. Resolve the project again after a failed replay and retry when its location or manifest changed. Keep the integrity error when the basis stayed the same. +- In [PR #380](https://github.com/ThinkFlowLab/OpenDirector/pull/380), reading the active conversation during timeline publication returned `409 storage_busy` because the read checked the write lock. Pause a canvas commit after its bundle is written. The active conversation and conversation list must remain readable, and a concurrent draft write must still return `storage_busy`. ## An upstream response and a consumer finishing it are separate facts @@ -155,3 +164,15 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u - **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. + +## Optional fields can change persisted fingerprints + +- **Trigger:** Adding defaulted fields to a model nested inside immutable job inputs or commands. +- **Lesson:** [PR #563](https://github.com/ThinkFlowLab/OpenDirector/pull/563) added video and audio codec facts. Serialization inserted null codec fields into historical job inputs, changing their fingerprints and blocking project reads. +- **Check:** Validate saved snapshots and command receipts from both sides of the schema change. Preserve the distinction between absent fields and explicitly stored nulls when either form is already part of a fingerprint. Verify that changed contents still fail integrity checks. + +## A harness's own sandbox can block the CLI's path back to the app + +- **Trigger:** Adding an external harness whose CLI runs shell commands in its own sandbox. +- **Lesson:** Antigravity CLI turns its terminal sandbox on by default in auto mode. With only permission rules passed, every `opendirector` command that reached the app failed with `Operation not permitted`: the macOS sandbox blocked the local socket outside the execution directory, and executables under `~/Documents`. `opendirector --help` still worked and the reply was a well-formed refusal, so a mocked CLI test and a successful turn status both passed while no project change was possible. +- **Check:** Accept a harness only after a real turn changes the project through `opendirector` and the result is read back. Pin the harness's sandbox and approval mode per run instead of inheriting the user's global settings, and let only `opendirector` leave the sandbox rather than every command. diff --git a/docs/development/macos-dmg-install-guide-proposal.md b/docs/development/macos-dmg-install-guide-proposal.md new file mode 100644 index 000000000..b766635d9 --- /dev/null +++ b/docs/development/macos-dmg-install-guide-proposal.md @@ -0,0 +1,59 @@ +# OpenDirector macOS DMG 安装指引方案 + +调研日期为 2026 年 11 月 23 日。本方案面向 Apple 芯片 Mac,沿用现有的 ad-hoc App 签名。把双语安装步骤画在 DMG 的 Finder 背景上,用户打开安装卷就能看到。 + +## 发布包现状 + +核验了 v0.1.5 的实际发布包。本机下载件的 SHA-256 与 GitHub Release 相同,且带有下载隔离属性。以只读方式挂载后,卷根目录仅有 `OpenDirector.app` 和指向 `/Applications` 的 `Applications` 快捷方式,没有独立安装说明或自定义 Finder 布局。外层 DMG 未签名,内层 App 为 arm64、使用 ad-hoc 签名且没有 Team ID。本次核验覆盖包内容和签名状态,未执行 Finder 首次启动。[v0.1.5 Release](https://github.com/ThinkFlowLab/OpenDirector/releases/tag/v0.1.5) + +发布工作流以 `hdiutil` 制作、挂载 DMG,复制 App 到临时目录,校验签名后直接运行其可执行文件做冒烟测试。浏览器下载、Finder 安装、Gatekeeper 提示和系统设置确认需要补做交互验收。[v0.1.5 打包工作流](https://github.com/ThinkFlowLab/OpenDirector/blob/v0.1.5/.github/workflows/desktop-release.yml#L58-L85) + +## 开源项目怎么做 + +| 项目 | 查到的做法 | 可借鉴之处 | +| --- | --- | --- | +| **NotchIsland v1.4.0** | 只读挂载实物,卷根目录可见 `NotchIsland.app`、`Applications` 和 `Read me first.txt`。外层 DMG 未签名,内层 App 用项目自签证书。包内文档和仓库安装页都写了 **Open Anyway**。 | 参考 **Open Anyway** 的首开文案和网页入口。[发布包](https://github.com/Edwardrem/NotchIsland/releases/tag/v1.4.0) · [包内说明源码](https://github.com/Edwardrem/NotchIsland/blob/562f69ce43f42c80d18b446fe70583b7c726520f/Resources/dmg-readme.txt#L1-L20) | +| **Herbivora** | 打包文档声明 DMG 包含 App、Applications 和 `READ ME FIRST.txt`。它分别记录了在挂载卷内打开与复制到 Applications 后打开的提示,说明从 Applications 启动。 | 把「拖入应用程序,再从那里打开」写成两个明确动作。[打包文档](https://github.com/mariosandovalmx/Herbivora/blob/main/packaging/README.md#signing-and-notarization) | +| **Chandra CIAO 4.18** | 官方安装页展示了 Finder 截图,拖拽箭头与短指引放在背景上,卷根目录另有 `README.txt`。安装对象是科学软件目录。 | 参考把简短动作写在背景、把箭头放在真实图标之间的布局。[官方安装页和 Finder 截图](https://asc.harvard.edu/ciao/download/ciao_dmg.html) · [打包配置](https://github.com/cxcsds/ciao-dmg/blob/1cd37eec2c3b819935c2c2762c478ae983df9b81/CIAO_DMG/dmg_settings.py#L20-L53) | +| **OpenIDEA v0.1.50** | 只读挂载 arm64 实物,卷根目录有 App 和 Applications 两个可见项。App 和 DMG 都使用 Developer ID,DMG 的装订票据校验通过。 | 参考拖拽布局。该版本开箱体验依赖签名和公证。[发布包](https://github.com/l0ng-ai/openidea/releases/tag/v0.1.50) · [公证工作流](https://github.com/l0ng-ai/openidea/blob/83364c5423e3a541afcda84ee9e00ca03e7ec6dd/.github/workflows/release-build.yml#L116-L131) | +| **Strafe** | 在官网两个 macOS DMG 下载按钮上方直接说明 App 未公证,并写出首次打开的 **Open Anyway** 步骤。 | 用户在下包前就能找到指引。[官方下载页](https://strafe.chat/download/) | +| **FileMorrow** | 发布的 DMG/ZIP 使用 ad-hoc 签名且未公证。文档把同一 Release 的校验文件、复制到 Applications、首次打开与系统设置确认串在一起。 | 让下载校验和首开说明在同一条路径上。[GitHub 安装说明](https://github.com/M-Nabeegh/FileMorrow#install-a-github-release) | +| **cix** | 曾随 DMG 放 `READ ME FIRST.txt`,后来把首开步骤移到 Release 正文和文档,理由是弹出 DMG 后用户可能才遇到拦截。 | 在下载入口保留随时可查的步骤。[macOS 打包记录](https://github.com/dvcdsys/code-index/blob/87b6bfff8bca24cb29d9b4439f9ada92188e539f/mac/README.md#L154-L164) | + +Apple 的流程从尝试打开 App 开始。遇到无法验证开发者或无法验证 App 的提示时,若确认来源可信,可以在系统设置的「隐私与安全性/隐私与安全」中选择「仍要打开」。macOS 15 起,Control 点按的旧方法已取消。设备管理策略可能限制手动批准。Apple 对「App 已损坏」和「会损坏你的电脑」另有诊断说明,应分别处理。[Apple 支持](https://support.apple.com/zh-cn/102445) · [macOS 15 Gatekeeper 变更](https://developer.apple.com/news/?id=saqachfa) · [Apple 平台安全](https://support.apple.com/guide/security/gatekeeper-and-runtime-protection-sec5599b66df/web) + +## OpenDirector 怎么落地 + +1. **Finder 首屏**采用图标视图。左侧是可拖拽的 `OpenDirector.app`,右侧是用作拖放目标的 `Applications` 快捷方式,中间的箭头画在背景上。背景上方标明第一步,下方写第二步及验证提示的处理办法。DMG 根目录只保留这两个可见项,双语步骤直接显示在窗口里。 +2. **CI 打包**在 `apps/desktop/installer/macos/` 保存双语背景 PNG(1× 和 2×)和 `dmgbuild` 配置。由 `dmgbuild` 使用已做 ad-hoc 签名的 `.app` 生成 DMG,在 `.DS_Store` 写入图标视图、窗口尺寸、位置和背景引用。构建无需在 CI 中操作 Finder。若双击后系统只挂载磁盘,可在访达侧栏的「位置」打开 `OpenDirector` 卷。[dmgbuild 配置文档](https://dmgbuild.readthedocs.io/en/stable/settings/) · [Apple 磁盘映像打包说明](https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution) +3. **官网和 GitHub Release**在 macOS 下载入口旁注明「此版本未经 Apple 公证」,放上可阅读、可复制的双语文字指引。DMG 无法挂载、Finder 以列表视图打开,或弹出磁盘后遇到拦截时,用户仍有入口。完整指引提供两种系统语言的截图和同版本的 `.sha256`。现有工作流只对 Release 草稿上传资产,第一份带背景指引的公开 DMG 随下一版本发布。[草稿上传检查](https://github.com/ThinkFlowLab/OpenDirector/blob/v0.1.5/.github/workflows/desktop-release.yml#L162-L212) + +### 背景图片文案 + +**1. 拖到「应用程序」 / Drag OpenDirector to Applications.** + +**2. 从「应用程序」打开 OpenDirector / Open OpenDirector from Applications.** + +此版本未经 Apple 公证。若系统提示无法验证 App 或开发者,请先确认安装包来自官方 GitHub Release,再前往「系统设置 → 隐私与安全性 → 仍要打开」。 + +Apple has not notarized this build. If macOS can’t verify the app or its developer, confirm that you downloaded it from the official GitHub release, then go to **System Settings → Privacy & Security → Open Anyway**. + +图片只呈现安装步骤,系统告警和排障细节放在网页。背景与图标标签保留足够对比度和间距,中文与英文采取相同的视觉层级。 + +### 官网排障入口 + +| 遇到的问题 | 指引 | +| --- | --- | +| 双击 DMG 后没有可打开的安装卷,或显示文件已损坏 | 从 GitHub Release 重新下载对应 Apple 芯片版本并核对同版本 SHA-256。仍失败时提供 macOS 版本、文件名及原始提示,交由项目排查。 | +| 从「应用程序」打开时显示无法验证 App 或开发者 | 确认来源并关闭提示。在「系统设置 → 隐私与安全性」(部分版本称「隐私与安全」)找到 OpenDirector,点按「仍要打开」并按提示确认。 | +| 看不到「仍要打开」 | 确认已经从「应用程序」尝试打开一次,并重新进入系统设置。受管设备请联系管理员,其他情况提交原始提示。 | +| 系统识别到恶意软件,或提示 App 会损坏电脑 | 停止启动并向项目反馈。 | + +## 发布验收 + +原型使用 `dmgbuild 2.0.0` 在 Apple 芯片 macOS 27.0.1 上生成。样包带独立命名的占位 App。只读挂载并解析 `.DS_Store`,确认 700 × 410 窗口的背景引用可解析、两枚图标位置符合设计,`Applications` 指向 `/Applications`。预览图为使用同一背景制作的效果图。Finder 自动弹窗和真实 App 的首次打开仍待发版验收。 + +- **自动检查**挂载最终的只读 DMG,确认 `.DS_Store` 和背景文件入包、背景引用可解析,校验两个可见项及 `Applications` 链接目标。保留 App 签名校验、运行时冒烟和最终产物 SHA-256 校验。 +- **Finder 首屏检查**在默认访达设置下双击 DMG,记录系统是否在挂载后自动打开窗口,确认图标位置、箭头和双语步骤完整可见。检查浅色和深色模式及窗口尺寸。将 Finder 切到列表视图时,官网和 Release 的文字指引仍可用。 +- **首次安装检查**在干净、无 OpenDirector 放行记录的 Apple 芯片环境,从实际分发入口用 Safari 下载候选 DMG,确认下载隔离属性存在。覆盖 macOS 15 和项目支持的近期版本,分别使用简体中文和英文系统。按背景提示拖入 Applications,再从 Applications 首开。出现系统拦截时,核对能找到 OpenDirector 的「仍要打开」条目并完成确认。进入应用后弹出 DMG,退出 App 并重新启动。记录发布版本、系统版本、设置页和实际提示。 +- **入口检查**官网的两个语言版本和 Release 都能在下载入口附近找到首次打开说明。模拟无法挂载 DMG 或看不到「仍要打开」时,核对网页能提供下一步操作和反馈入口。 diff --git a/docs/development/model-setup-research.zh-CN.md b/docs/development/model-setup-research.zh-CN.md new file mode 100644 index 000000000..22e6d3850 --- /dev/null +++ b/docs/development/model-setup-research.zh-CN.md @@ -0,0 +1,59 @@ +# OpenDirector 首屏调研:怎么让用户知道模型配到哪就够了? + +调研日期:2026 年 11 月 21 日。依据是用户反馈、OpenDirector 本地代码与用户指南,以及外部论文、设计指南和项目文档。没有跑浏览器、调用模型服务或做用户实验;下文的改版建议和验收指标不是已验证的效果。 + +## 现状:计数回答的是覆盖了几类,不是当前任务能不能做 + +- [首屏](../../src/canvas/WelcomeScreen.tsx#L69)把「配置创作模型」作为主操作;[首屏触发逻辑](../../src/canvas/workspace/useWorkspaceChrome.ts#L31)把模型类别是否齐全作为判断条件之一。虽然能跳过,用户仍得自己判断跳过会失去什么。 +- [配置向导](../../src/canvas/ModelSetup.tsx#L7)按助手、图片、视频、音频四类显示进度。这个计数反映类别配置,不等于已经覆盖用户要用的生成模式,更不代表连接或生成已验证。[模型设置](../../src/canvas/ModelSettings.tsx#L49)已有单独的可用性刷新;[服务表单](../../src/canvas/ModelServiceForm.tsx#L195)中的助手回复测试也是独立操作。 +- 这与实际操作不一致:[用户指南](../guides/user-guide.zh-CN.md#L54)允许使用已有图片,也把配音和助手作为按需能力;[生成规则](../../src/backend/rules.ts#L500)会按视频模式等条件判断能不能提交。**「还有三类没配」和「你现在还缺什么」是两个问题。** + +### 按任务说明最低依赖 + +| 用户现在想做什么 | 最低模型条件 | 当前不必配什么 | +| --- | --- | --- | +| 打开示例,导入已有素材、试画布或剪辑 | 不需要配置生成模型;触发生成时再判断 | 助手、图、视频、音频模型 | +| 从文字生成一张图 | 一个支持文生图的模型,以及该服务需要的连接配置或凭据 | 助手、视频、音频模型 | +| 把已有图片变成视频 | 一张可用的输入图,加一个支持图生视频的模型及其服务配置 | 图片生成、助手、音频模型 | +| 先生成图片,再用它做视频 | 文生图和图生视频两种能力;如果用户选直接文生视频,则按文生视频检查 | 助手和音频,除非任务另外要求 | +| 给已有作品配旁白 | 一个支持文字转语音的模型及其服务配置;音乐模型不能替代语音模型 | 图、视频、助手模型 | +| 只与助手对话 | 一个配置好且可用的助手运行时与对话模型;外部运行时遵循自己的配置和授权要求 | 媒体模型;若委托助手出图等,再检查对应生成能力 | + +表中是模型条件,不替代素材、权限等实际提交校验。不指定供应商品牌,也不把「已配置」写成「已可用」。 + +## 理论和设计指南:各自解决什么问题 + +| 来源 | 对 OpenDirector 的启发 | +| --- | --- | +| [Amershi 等,CHI 2019:Guidelines for Human-AI Interaction](https://www.microsoft.com/en-us/research/wp-content/uploads/2019/01/Guidelines-for-Human-AI-Interaction-camera-ready.pdf) | 起步时先说系统能做什么、能做到什么程度;用户遇到限制时说明原因并给修正途径。首屏讲任务和能力,不要求新用户先理解四类模型。 | +| [Carroll 等:The Minimal Manual](https://doi.org/10.1207/s15327051hci0302_2);[Google PAIR:Mental Models](https://pair.withgoogle.com/chapter/mental-models/) | 让用户用有意义的小任务建立心智模型,在动作发生的地方给帮助。先做一张图或编辑已有素材,比先教完模型分类更贴近这次反馈;这是待验证的设计假设。 | +| [IBM Carbon:Progress bar](https://www.carbondesignsystem.com/building-blocks/core/components/progress-bar/guidelines);[GOV.UK:Error message](https://design-system.service.gov.uk/components/error-message/) | 只给确实可计量的进度。等待供应商且没有可靠进度时,用明确状态而不是假百分比。区分用户能修正的字段错误和服务端问题,出错时保留已填内容。 | + +## 开源项目和可用 skill + +| 参考 | 借什么,不照搬什么 | +| --- | --- | +| [ComfyUI:Workflow Templates](https://github.com/Comfy-Org/docs/blob/main/interface/features/template.mdx) | 按模板/工作流说明依赖,并定位缺失的模型。OpenDirector 可借用「任务决定依赖」,但云端模型不能只用文件存在与否判断可用。 | +| [Open WebUI:连接 OpenAI-compatible 服务](https://docs.openwebui.com/getting-started/quick-start/connect-a-provider/starting-with-openai-compatible/) | 把保存、连接验证和第一次真实对话分开。其连接检查读模型列表;列表可读并不证明指定模型能执行用户的任务。 | +| 本机 `mattpocock-skills:prototype`;[Vercel `web-design-guidelines`](https://github.com/vercel-labs/web-interface-guidelines) | 用前者做可丢弃的交互原型,不先改正式配置流程;用后者检查键盘焦点、异步反馈、错误恢复和状态不只靠颜色。Skill 是设计执行和审查的工具,不负责决定哪些模型必需。 | + +## 下一步:先验证两条路径 + +1. **生成一张图。** 首屏选择后,只要求配置一个支持文生图的模型;已有匹配配置就直接进入。需要设置时保留任务和草稿,保存后返回原处。完整模型管理仍留在设置,不再用 `0/4` 暗示四类都要配。 +2. **打开示例或导入素材。** 明示「不需要配置生成模型」,作为可直接开始的路径,而不是含义模糊的「稍后」。当用户首次发起需要模型的生成操作时,再说明这个动作缺什么。 + +原型对照:用现有首屏作基线;A 版在首屏选择任务,B 版直接进工作区、在首次动作旁提示。A、B 使用相同的任务依赖和状态语义,避免把文案、视觉和规则一起改了却不知道哪项起作用。先不重做四类设置表单,也不扩大到整个创作流程。 + +| 已知状态 | 示例文案和下一步 | +| --- | --- | +| 没有满足任务模式的模型 | 「缺一个支持文生图的模型」 / “Add a text-to-image model”;直接打开对应配置,而非把人送回总览。 | +| 保存成功,未做检查 | 「已保存 · 尚未验证」 / “Saved · Not verified”;允许继续尝试,缺少可选探测不单独拦截合法提交。 | +| 连接检查进行中 / 模型列表检查通过 | 「正在检查连接」 / “Checking connection…”;如果只验证了列表,显示「可读取模型列表」 / “Model list reachable”,不显示「生成已就绪」。 | +| 凭据被拒 / 服务超时 | 只在证据足够时区分;前者引导修改配置,后者提示稍后重试或检查服务。保留输入,不叫用户盲改密钥。 | +| 生成已提交 / 结果已生成 | 分别依据实际回执显示。提交结果未知时查原任务,不自动形成新提交。探测不偷偷发起可能计费的生成。 | + +### 怎么判断改版有没有帮到人 + +- 不教操作,先交给用户两个题目:「用已有素材剪一段,不生成」与「输入一句提示词生成一张图」。观察能否正确说出必需和可选项、独立找到下一步,以及能否导入素材或拿到可编辑的第一张图。记录多配模型、返回设置、放弃和求助;将等待供应商的时间与交互耗时分开。 +- 再覆盖已配对的模型、已配但模式不匹配、无效凭据、服务不可达、保存后恢复输入及提交结果未知。用中英文和键盘各走一次关键流程;状态不能只靠颜色区分。 +- 用模拟响应验证提示和恢复,再用经授权的真实模型验证一次最小出图和实际回执。模拟成功和模型服务成功分别记录;不要拿保存成功或列表可读代替实际出图。 diff --git a/docs/development/openclaw-agent-response-research.zh-CN.md b/docs/development/openclaw-agent-response-research.zh-CN.md new file mode 100644 index 000000000..de8998735 --- /dev/null +++ b/docs/development/openclaw-agent-response-research.zh-CN.md @@ -0,0 +1,32 @@ +# OpenClaw Agent 回复验证调研 + +本次核对 OpenClaw 官方文档及源码快照 `bcf1a95ddffb9f2a3497841591481fc03265c2b5`,重点是如何验证完整回复、工具续跑和用户实际收到的结果。结论来自静态核对,本次未运行 OpenClaw QA。 + +## 模型和消息通道可以独立选择 + +| 配置 | 实际覆盖 | 证据边界 | +| --- | --- | --- | +| `mock-openai` + `qa-channel` | 真实 Gateway 和内嵌 Agent runtime,经本地协议 mock 收取确定性模型输出。可验证流事件、工具执行路径、终态和记录落盘。 | 模型输出由场景控制,消息通道是合成的。 | +| `live-frontier` + `qa-channel` | 真实模型参与选工具、续跑及生成终态回复,QA 通道观察外发消息。 | 结论适用于实际运行的模型、账户和场景,外部消息平台未参与。 | +| `mock-openai` + 真实消息通道 | 以固定模型回复验证消息平台到 Gateway 的往返及可见结果,例如 Telegram 测试服务器。 | 可以复现实平台投递或流式展示问题,模型质量仍需单独观察。 | + +来源:[QA 概览](https://docs.openclaw.ai/concepts/qa-e2e-automation)、[QA 运行器与 Telegram 场景](https://docs.openclaw.ai/help/testing/qa-runners)、[真实通道配本地模型的 Matrix 示例](https://docs.openclaw.ai/concepts/qa-e2e-automation/operator-flow)。 + +`mock-openai` 是 OpenClaw 自己维护的场景驱动 mock。Responses HTTP mock 可以按固定间隔发送文本增量,事件构造器可以在回复中产生工具调用、最终文本及部分输出后失败。另有 `aimock` 用于协议、fixture、录制回放和故障注入实验。各 provider 自己提供模型默认值、启动方式、认证准备及能力标记,suite 通过注册表获取配置。[扩展 QA 栈](https://docs.openclaw.ai/concepts/qa-e2e-automation/extending-the-stack)、[HTTP 流实现](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/extensions/qa-lab/src/providers/mock-openai/mock-openai-responses-http.ts#L10)、[事件构造器](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/extensions/qa-lab/src/providers/mock-openai/mock-openai-events.ts#L289)、[Provider 注册契约](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/extensions/qa-lab/src/providers/README.md)。 + +## 场景怎样证明回复正确 + +- `source-docs-discovery-report` 让 mock 和 live 复用同一场景流程及产物检查,仅在 mock 下检查 provider 日志中的预定工具名。这样既能走同一条业务路径,也能给 mock 增加确定性断言。[共享场景](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/workspace/source-docs-discovery-report.yaml#L38)。 +- `cron-blocked-outcome` 使用专用模型 fixture 覆盖受阻任务的回复,便于固定模型输出并验证系统怎样记录受阻结果。[场景](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/scheduling/cron-blocked-outcome.yaml)、[模型 fixture](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/extensions/qa-lab/src/providers/mock-openai/mock-openai-cron-blocked-outcome.ts)。 +- `session-streaming` 启动真实子 Gateway 和按间隔发送增量的本地 provider。从 Agent RPC 收集流事件,检查 run 和 session 归属、序号严格递增、文本之后只出现一次生命周期终态、增量拼接等于唯一的持久化助手消息。场景还验证该 RPC 未触发通道投递。[场景契约](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/agents/session-streaming.yaml#L10)。 +- `instruction-profile-artifact-followthrough-live` 要求真实模型通过工作区指令找到输入、读取 nonce,再生成字节完全匹配的文件。断言包括 read/write 调用和成功回执一一对应、次序正确、工具完成后只产生一次可见最终回复,以及通道只观察到一次匹配的外发结果。场景配置 `retryCount: 0`,并把输入、工具回执、持久化状态和可见回复联合起来判定。[场景配置](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/agents/instruction-profile-artifact-followthrough-live.yaml#L10)、[工具及回复断言](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/agents/instruction-profile-artifact-followthrough-live.yaml#L219)。 + +`qa suite` 将所选场景写入 `qa-evidence.json`、`qa-suite-summary.json` 和 `qa-suite-report.md`。默认任一场景失败则返回非零。OpenClaw 将 mock parity 和真实通道检查用于不同的 CI 和发布场景。[QA 运行器](https://docs.openclaw.ai/help/testing/qa-runners)。 + +## 对 OpenDirector 的对应关系 + +OpenDirector 的 bundled OpenCode 回归已经用本地 mock 经真实 CLI 检查回复文本、工具结果续跑、请求次数、资产持久化和会话恢复,也区分正常 HTTP 流结束、中断和取消。若需要扩大 Agent 回复的验收,可以沿用这一入口,分别检查运行标识、增量顺序、终态和重开会话后的完整回复。涉及项目改动时,同时检查工具回执与项目实际内容,避免仅凭助手文案判定成功。[OpenDirector 验证指南](validation.md#环境与基本命令)。 + +本仓库视觉验收已有三个可参照的入口,分别用 harness、真实 OpenCode 配模拟 provider,以及 opt-in 真实模型运行视觉输入场景。[视觉输入验收测试](../../tests/test_agent_visual_gate.py)。 + +真实模型验收可以用独立临时项目,通过正常助手入口提交带明确产物要求的任务,检查工具调用与回执的前后关系、实际产物和最终回复。结构化的产物条件可以保留确定性,回复措辞则只检查它与实际结果一致。涉及图片或视频创作质量的任务还需要独立的产物验收。这里是基于 OpenClaw 场景和 OpenDirector 项目约束的建议,尚无本次实跑结果。[OpenClaw 真实模型场景](https://github.com/openclaw/openclaw/blob/bcf1a95ddffb9f2a3497841591481fc03265c2b5/qa/scenarios/agents/instruction-profile-artifact-followthrough-live.yaml#L10)、[统一项目架构](../architecture/unified-project.md)。 diff --git a/docs/development/ui-performance.md b/docs/development/ui-performance.md index e852fbb75..e9a5e8d70 100644 --- a/docs/development/ui-performance.md +++ b/docs/development/ui-performance.md @@ -22,6 +22,10 @@ Use these default budgets for routine UI actions such as opening a panel, naviga Start both timers at the user action. Define the visible feedback and the usable result for each workflow, and calculate P90 using the nearest-rank method. For long-running operations such as generation or export, apply the feedback budget to acknowledging the action and measure completion separately against a workload-specific target. +When the user clicks Send in AI chat with an explicit request to generate one image, the image node created for that request must become visible on the canvas within **3 seconds of the click**. Measure separately from the same click until the generated image is visible in the node. + +用户在 AI 对话中点击发送明确的单图生成请求后,本次请求创建的图片节点必须在 **3 秒内**在画布上可见。成图耗时单独测量,从同一次点击到生成的图片在节点内可见。 + ## Measurement Use browser measurements for user-facing latency. Record first feedback and readiness separately, and split slow paths into client work, request queueing, server time, and rendering. Use comparable builds, fixtures, and interaction sequences. Keep initial load, warm navigation, direct manipulation, and long-running operations separate when setting budgets and reporting results. diff --git a/docs/development/validation.md b/docs/development/validation.md index 9783028d7..1a758b9c2 100644 --- a/docs/development/validation.md +++ b/docs/development/validation.md @@ -244,9 +244,9 @@ The image browser workflow covers pinned, followed and mixed references. With an ## Agent 原生视觉读取 / Agent native visual inspection -发布检查使用真实 Bundled、OpenCode、Codex、Claude Code、JiuwenSwarm 和 DeepSeek Harness CLI 以及本地模型夹具,检查原图和 FFmpeg 抽帧是否以正确顺序作为可解码图片到达模型。Bundled 还检查纯文本模型不会收到图片。CI 安装固定版本的外部 CLI,所需 CLI 缺失即失败。Pi 不在此门禁内:它依赖 release CI 未提供的本机服务商凭证。 +发布检查使用真实 Bundled、OpenCode、Codex、Claude Code、JiuwenSwarm 和 DeepSeek Harness CLI 以及本地模型夹具,检查原图和 FFmpeg 抽帧是否以正确顺序作为可解码图片到达模型。Bundled 还检查纯文本模型不会收到图片。CI 安装固定版本的外部 CLI,所需 CLI 缺失即失败。Pi 和 Antigravity 不在此门禁内:它们依赖 release CI 未提供的本机服务商凭证或账号登录。 -Release checks use the real Bundled, OpenCode, Codex, Claude Code, JiuwenSwarm and DeepSeek Harness CLIs with local model fixtures. They verify that decodable pixels from the still and FFmpeg frame reach the model in order. The Bundled check also verifies that a text-only model receives no pixels. CI installs pinned external CLI versions and fails if a required CLI is unavailable. Pi stays out of this gate: it needs provider credentials that release CI does not provision. +Release checks use the real Bundled, OpenCode, Codex, Claude Code, JiuwenSwarm and DeepSeek Harness CLIs with local model fixtures. They verify that decodable pixels from the still and FFmpeg frame reach the model in order. The Bundled check also verifies that a text-only model receives no pixels. CI installs pinned external CLI versions and fails if a required CLI is unavailable. Pi and Antigravity stay out of this gate: they need provider credentials or an account sign-in that release CI does not provision. ```bash OPENDIRECTOR_HARNESS_CI=1 python -m pytest tests/test_agent_visual_gate.py::test_harness_native_visual_input @@ -618,7 +618,7 @@ CREATION_API_URL=http://127.0.0.1:8019 CREATION_WEB_URL=http://127.0.0.1:5179 no The Python cases check how the shared thinking levels map to GLM reasoning_effort. GLM accepts only low, high and max for reasoning_effort. The auto level omits the parameter so the provider default applies, and an unknown level falls back to high as in the DeepSeek branch. Other hosts and the DeepSeek behavior stay unchanged. -The **New model discovery** case runs on its own with the isolated API and Vite. It verifies that a model absent from the preset appears after an authenticated `GET /models`, can be selected and saved, and remains selectable in the assistant. The **Zhipu model settings feedback** case checks both display languages for missing credentials, request progress, upstream failure, retry, empty responses, manual entry, and audio preset isolation. Both cases use local HTTP fixtures and synthetic keys. Real streaming conversations, tool calls, and thinking levels require a separate run with valid Zhipu credentials. +The **New model discovery** case runs on its own with the isolated API and Vite. It verifies that a model absent from the preset appears after an authenticated `GET /models`, can be selected and saved, and remains selectable in the assistant. The **Zhipu model settings feedback** case checks both display languages for missing credentials, request progress, upstream failure, retry, empty responses, manual entry, and audio preset isolation. Its browser gate also covers saving and reopening settings, reusing saved connections, keeping keys private, and selecting the saved model in the assistant. Both cases use local HTTP fixtures and synthetic keys. Real streaming conversations, tool calls, and thinking levels require a separate run with valid Zhipu credentials. 智谱 BigModel GLM-TTS 接入使用以下检查: diff --git a/docs/guides/assets/opendirector-wechat-group-2.png b/docs/guides/assets/opendirector-wechat-group-2.png deleted file mode 100644 index 1fabe0841..000000000 Binary files a/docs/guides/assets/opendirector-wechat-group-2.png and /dev/null differ diff --git a/docs/guides/assets/opendirector-wechat-group-3.png b/docs/guides/assets/opendirector-wechat-group-3.png new file mode 100644 index 000000000..8808eec77 Binary files /dev/null and b/docs/guides/assets/opendirector-wechat-group-3.png differ diff --git a/docs/guides/cli.md b/docs/guides/cli.md index 87de24eb1..6db650332 100644 --- a/docs/guides/cli.md +++ b/docs/guides/cli.md @@ -23,17 +23,18 @@ opendirector model show MiniMax-H3-Lite opendirector --project PROJECT_UUID asset import ./after.png --kind image opendirector --project PROJECT_UUID canvas add-material --asset ASSET_UUID --x 0 --y 0 opendirector --project PROJECT_UUID video create --model MODEL_CONFIG_UUID --prompt "人物缓缓转头" --duration 5 --first-frame SOURCE_CANVAS_ITEM_UUID +opendirector --project PROJECT_UUID video create --model MODEL_CONFIG_UUID --prompt "人物起舞" --duration 5 --reference-item COSTUME_ITEM_UUID --keyframe POSE_ITEM_UUID@1.25 ``` -`canvas add-material` 和 `video create` 通过必填的 `--x`、`--y` 明确创建位置。Agent 先读取画布对象的位置、尺寸及分组,再安排新元素布局。`video create` 创建可编辑的生成节点与参考关系,返回 `specId` 和 `itemId`。所有画布修改命令以及批量事务通过共用返回层提供 `canvasItems`,包含元素身份、版本、位置、尺寸、父级、坐标系及可见性。位置未变化的操作也返回目标元素的几何信息,供后续布局判断。几何信息读取失败时,回执保留已提交状态并返回 `geometryReadError`。模型可通过配置 UUID 或唯一匹配的完整模型名指定。重名配置返回候选 UUID 和端点,由调用者明确选择。模型的输入模式必须支持所选参数。`--reference-item` 支持重复指定参考节点。提交生成时使用创建回执中的对象版本,后台任务由服务端继续执行。 +`canvas add-material` 和 `video create` 通过必填的 `--x`、`--y` 明确创建位置。`canvas add-material` 新建的节点默认以素材文件名为标题,在画布和时间线素材库中显示;可用 `--title` 另行指定。Agent 先读取画布对象的位置、尺寸及分组,再安排新元素布局。`video create` 创建可编辑的生成节点与参考关系,返回 `specId` 和 `itemId`。所有画布修改命令以及批量事务通过共用返回层提供 `canvasItems`,包含元素身份、版本、位置、尺寸、父级、坐标系及可见性。位置未变化的操作也返回目标元素的几何信息,供后续布局判断。几何信息读取失败时,回执保留已提交状态并返回 `geometryReadError`。模型可通过配置 UUID 或唯一匹配的完整模型名指定。重名配置返回候选 UUID 和端点,由调用者明确选择。模型的输入模式必须支持所选参数。`--reference-item` 支持重复指定参考节点。`--keyframe ITEM_UUID@秒数` 把一张图片节点固定到成片的该时间点,可重复指定;它只用于参考模式,需要模型的 `inputRules.maxKeyframes` 不为空,并且至少同时有一个 `--reference-item`。提交生成时使用创建回执中的对象版本,后台任务由服务端继续执行。 ### 画布坐标与分组 / Canvas coordinates and groups -`canvas.show` 和 `canvas.createGeneration` 接受 `positionSpace: "canvas"`,`canvas.move` 可在每个 `items` 条目中指定它。服务端会减去所有祖先分组的偏移。省略该字段或传 `"parent"` 时,继续使用组内坐标。顶层节点的两种坐标相同。在 `creation batch` 中,使用画布坐标的子节点应排在其父组之后。例如父组在 `(1600, 620)`,子节点用 `"canvas"` 提交 `(1650, 700)`,保存的组内坐标为 `(50, 80)`。 +`canvas.show` 和 `canvas.createGeneration` 接受 `positionSpace: "canvas"`,`canvas.move` 可在每个 `items` 条目中指定它。服务端会减去所有祖先分组的偏移。传 `"parent"` 时使用组内坐标。新建分组子节点必须显式指定坐标空间。顶层节点的两种坐标相同。在 `creation batch` 中,使用画布坐标的子节点应排在其父组之后。例如父组在 `(1600, 620)`,子节点用 `"canvas"` 提交 `(1650, 700)`,保存的组内坐标为 `(50, 80)`。 换组时,用 `canvas.update` 同时提交 `parentId` 和 `preserveCanvasPosition: true`。传 `parentId: null` 可移到顶层。如果需要同时移动节点,则提交 `parentId`、`position` 和所需的 `positionSpace`。显式放置操作的回执通过 `canvasPlacements` 返回父组、保存坐标和最终画布坐标。启用 Run 或 Pipeline 自动布局时,最终位置仍由自动布局决定。 -Set `positionSpace: "canvas"` on `canvas.show` or `canvas.createGeneration`, or on individual `items` entries in `canvas.move`. The server subtracts the offsets of every ancestor group. Omit the field or pass `"parent"` to use parent-relative coordinates. Both spaces match at the canvas root. In `creation batch`, place a group before any child that uses canvas coordinates. For example, canvas position `(1650, 700)` inside a group at `(1600, 620)` is stored as `(50, 80)`. +Set `positionSpace: "canvas"` on `canvas.show` or `canvas.createGeneration`, or on individual `items` entries in `canvas.move`. The server subtracts the offsets of every ancestor group. Pass `"parent"` to use parent-relative coordinates. Creating a new child item in a group requires an explicit coordinate space. Both spaces match at the canvas root. In `creation batch`, place a group before any child that uses canvas coordinates. For example, canvas position `(1650, 700)` inside a group at `(1600, 620)` is stored as `(50, 80)`. To reparent a node in place, send `parentId` and `preserveCanvasPosition: true` in the same `canvas.update`. Use `parentId: null` to move it to the root. To reparent and move the node together, send `parentId`, `position` and the desired `positionSpace`. Explicit placement receipts report the parent, stored position and final canvas position in `canvasPlacements`. Run or Pipeline auto-layout still controls final positions where enabled. @@ -62,15 +63,97 @@ CLI 输出 JSON。修改回执附带对应的 assetId、itemId、specId 及其 读取类查询 `job.get`、`object.get`、`canvas.status` 与 `job.status` 不占用本轮执行锁,因此等待任务不会阻塞同轮其他工具调用。`job.status` 是 `job wait` 使用的批量查询:一次快照读取回答整组任务,并按需等待终态。 -普通终端写入申请独立编辑租约,完成后释放。工程已在其他窗口编辑时会返回占用错误。使用 `--session UUID` 表示沿用已有授权会话,CLI 完成后保留该会话。 +普通终端写入申请独立编辑租约,完成后释放。浏览器窗口打开工程后会一直保留编辑权,关闭标签页也不会释放,此时 CLI 写入会返回占用错误,并提示可改用 `--take-over`。在子命令前加 `--take-over` 会把编辑权从该窗口移到本次命令:原窗口立即转为预览,未完成的保存会被拒绝,之后可用“在此编辑”收回。Agent 使用 `--take-over` 前须先征得用户同意。本次命令持有的编辑权与普通 CLI 写入一样为 60 秒且不自动续期,进程被强行终止也不会长期占用;单条命令(例如上传大文件)超过 60 秒时,写入可能因会话过期被拒,原窗口此时已转为预览,需要重新执行或在窗口中收回。使用 `--session UUID` 时,接管的编辑权留在该会话、命令结束后不释放,仍在 60 秒后过期,除非该会话自行续期。 Agent 的 Shell 通过 PATH 使用同一个 `opendirector`。宿主提供受令牌保护的本轮连接、工程范围、编辑会话和执行目录,文件登记限制在本轮执行目录。每次调用产生业务活动及回执,供聊天与轨迹页展示。 +## 在 Agent 命令中使用聊天引用 + +在 Agent 会话中,`project show` 按消息中的顺序返回 `turnReferences`。选择画布节点时,每项记录节点 ID 和提交时选中的 `AssetRef`。直接上传到聊天的文件只携带 `AssetRef`。创建生成节点时,可重复传入 `--turn-reference` 来固定引用版本。视频裁切需要画布视频节点,会发布一个新节点并在编辑快照中保存来源和裁切时间。 + +```bash +opendirector canvas create-generation --file plan.json --turn-reference IMAGE_REFERENCE_ID +opendirector video trim --turn-reference VIDEO_REFERENCE_ID --start 1.2 --end 1.7 --name clip.mp4 +``` + +### Using chat references in Agent commands + +Inside an Agent turn, `project show` returns `turnReferences` in message order. A selection from the canvas carries its source node ID and the `AssetRef` captured at submission. A file uploaded directly to chat carries only an `AssetRef`. Repeat `--turn-reference` on `canvas create-generation` to pin selected versions. `video trim` requires a video canvas node and publishes a new node with an edit snapshot recording its source and time range. + +## 分段续接的导帧约束 + +用 `group configure-assembly` 保存 H3 分段计划,设置 `requireTimelineGuides: true`。只有 `guideExemptItemId` 指定的起跑节点可以省略导帧。其余片段在 `generation submit` 时指定计划中的 `originItemId`,并提供导帧引用与两个源帧号。修改裁切范围、调整成片顺序或移动节点时,已确认的导帧规则继续生效。恢复使用提交时保存的素材版本,组装也会核对本次采用的上游版本。 + +### Timeline guides for segment continuation + +Save an H3 segment plan with `group configure-assembly` and set `requireTimelineGuides: true`. Only the starting node named by `guideExemptItemId` may omit the guide. Each other step submits with its planned `originItemId`, a guide reference and two source frame indices. Trimming, reordering and moving nodes preserve the confirmed guide policy. Recovery uses the submitted source version, and assembly checks it against the adopted upstream result. + +## 发布与执行分段 Run / Publish and execute a segmented Run + +在顶层分组中准备视频生成节点和时间线。生成节点使用 FastH3 的参考模式,设置随机种子,固定源片和参考图版本。时间线使用工作源片帧率,包含画面轨和一条覆盖整个交付区间的原声音轨。`plan.entries` 按成片顺序覆盖每个源帧,可保留原片,也可引用生成段。每个声明的镜头有一个锚点,续接段指定上游节点和两个取帧索引。`assembly.clips` 保存各生成段反转后的保留区间。计划可以用 `planLocale` 指定中文或英文并用 `planNotes` 补充说明。 + +Prepare the video generation nodes and timeline in a top-level group. Use FastH3 in Reference mode with a sampling seed and pinned source and image versions. Match the timeline to the working source frame rate with a visual track and one original soundtrack covering the delivery range. In playback order, `plan.entries` covers every source frame with retained footage or a generated segment. Each declared shot has one anchor. Continuations name their upstream node and two frame indices. `assembly.clips` supplies the retained ranges after any reversal. Set `planLocale` for the display language and `planNotes` for review notes. + +```bash +opendirector group publish-run --help-field payload +opendirector group publish-run --file run.json --expected-version canvas_item:RUN_ID:REV +opendirector group start-run --group-id RUN_ID +opendirector query run.execution.get --object-id EXECUTION_ID +opendirector group pause-run --group-id RUN_ID +opendirector group resume-run --group-id RUN_ID +opendirector group fork-run --group-id RUN_ID --expected-version canvas_item:RUN_ID:REV +``` + +发布回执中的 `planItemId` 指向画布计划。启动回执的 `runExecutionId` 可用来查询每段任务和成片素材。关闭画布或结束 Agent 会话后,后端仍会继续执行。要在另一分组改版时,复制为草稿,再从 `runDraftId` 对应的新分组读取 `draftRunPlan` 和 `assembly`。调整后用新组 ID 发布。 + +The publication receipt points to the visible plan via `planItemId`. Query `runExecutionId` from the start receipt for segment jobs and the finished asset. The service continues after the canvas or Agent session closes. To revise a Run in a separate group, make a draft copy, read `draftRunPlan` and `assembly` from its `runDraftId`, then publish the edited draft under its new group ID. + +暂停请求会阻止下一段生成或组装。已受理的步骤会先完成,状态从 `pausing` 转为 `paused`。继续时沿用原执行 ID 和已完成步骤。重新打开画布后,也可以用 `opendirector query run.groupExecution.get --object-id RUN_ID` 找到当前执行。 + +Pause stops the Run from starting its next generation or assembly step. An admitted step can finish before the status changes from `pausing` to `paused`. Resume keeps the execution ID and completed steps. Use `opendirector query run.groupExecution.get --object-id RUN_ID` to find the latest execution after reopening the canvas. + +### 单步运行和重新生成 / Step and regenerate + +`group step-run` 放行下一段生成或最后的组装。首次单步可以省略 `--execution-id`。`group restart-run` 从发布的计划创建新一轮运行。`group regenerate-run-step` 基于已保存的执行,只为所选片段生成新版本并等待采用。`group adopt-run-candidate` 选择该版本,沿导帧依赖继续执行。旧成片可从运行历史打开,新成片组装成功后才更新画布上的成片。 + +`group step-run` admits one segment or the final assembly. Omit `--execution-id` for the first step of a new Run. `group restart-run` starts a new execution from the published plan. `group regenerate-run-step` generates one new version of the selected segment and waits for adoption. `group adopt-run-candidate` adopts the selected version and continues through its guide dependencies. Earlier films remain accessible in the execution history. The canvas switches to the new film after assembly succeeds. + +```bash +opendirector group step-run --group-id RUN_ID --execution-id EXECUTION_ID +opendirector group restart-run --group-id RUN_ID --execution-id EXECUTION_ID +opendirector query run.groupExecutions.list --object-id RUN_ID +opendirector group regenerate-run-step --group-id RUN_ID --execution-id BASE_ID --item-id SEGMENT_ID --expected-execution-id CURRENT_ID +opendirector group adopt-run-candidate --group-id RUN_ID --execution-id NEW_ID --job-id CANDIDATE_JOB_ID +``` + +### 核对任务和回到草稿 / Reconcile and return to draft + +Run 显示待核对时,可用 `group reconcile-run` 读取已保存的原任务结果。供应商已确认任务结束或不存在时,会开放重新生成。已暂停或已结束的 Run 可用 `group return-run-to-draft` 回到同一个分组编辑。旧运行记录和成片继续保留,修改后重新发布会生成新的 Run 版本。 + +When a Run needs review, `group reconcile-run` checks the original job receipt. Regeneration becomes available after the provider confirms that the job has ended or no longer exists. Use `group return-run-to-draft` for a paused or completed Run to edit the same group. Previous executions and films remain available, and publishing again creates a new Run version. + +```bash +opendirector group reconcile-run --group-id RUN_ID --execution-id EXECUTION_ID +opendirector group return-run-to-draft --group-id RUN_ID \ + --expected-version canvas_item:RUN_ID:REV --expected-version canvas_item:PLAN_ITEM_ID:PLAN_REV +``` + ## 检查已有生成结果 `job show` / `job wait` 在任务成功后返回 `delivery`:已登记的 AssetRef、当前采用状态及展示该素材的画布项。生成成功不等于质量验收;Agent 应检查现有素材。复制到执行目录做媒体探测、抽帧和审看不需要重新发布,也不应为同一次交付新增画布项。编辑产生的新交付文件才需要登记;独立副本展示应有用户要求。 +## 下载原始素材 + +从 `project show` 获取素材 ID 和版本,用 `asset download` 将指定版本的原始字节写入新文件。下载无需编辑租约,与项目登记分开。Agent Shell 使用当前项目,输出路径须位于本轮执行目录内。 + +```bash +opendirector --project PROJECT_UUID asset download --id ASSET_UUID --revision 1 --output ./source.mp4 +``` + +### Download original assets + +Use `project show` to get the asset ID and revision. `asset download` copies the original bytes of that revision to a new file. This read requires no editing lease or asset registration. In Agent Shell the active project is already selected, and the output path must stay inside the current execution directory. ## 更新生成配置 diff --git a/docs/guides/user-guide.md b/docs/guides/user-guide.md index e65932e51..f82ab04cb 100644 --- a/docs/guides/user-guide.md +++ b/docs/guides/user-guide.md @@ -2,6 +2,20 @@ [English](user-guide.md) · [简体中文](user-guide.zh-CN.md) · [Back to README](../../README.md) +## Choose how to create + +On first launch, select **Get started** and connect a language model or a ready local assistant. Choose **Create with chat** to start with an idea. You can open model settings during the conversation to add image, video, or audio models as needed. Choose **Create on canvas** to see the canvas starting options. Your first canvas requires one image or video generation model. An existing compatible model counts. You can then enter an empty canvas, start selected tasks, import media, or open an example. If you start in chat, you can complete this setup the first time you switch to the canvas. + +- In **Create with chat**, use the composer to describe a goal or attach a reference. Open **Conversation history** from the chat header to search and switch conversations in this project. Desktop chat also uses the full workspace. Switch projects from the top bar. Select **Float on canvas** to keep chatting while you edit. Press `Shift` twice to focus the composer. +- **Create on canvas** opens with chat on the left and the canvas on the right in a 1:2 split. Hover over the docking icon in the chat header or focus it with Tab to see which side it moves chat to. Select it to swap sides. On a wide screen, drag the chat title or select **Float chat** to position it over the canvas. Select either docking icon to return to split view on that side. +- In a narrow window, **Canvas** shows one area at a time. Use **Show canvas** and **Chat with AI** to switch between them. + +Both modes share the same project, conversation, draft and attachments. Switching modes preserves the canvas view and keeps replies and generation tasks running without submitting them again. + +You can switch modes while a reference is uploading. It will appear in the same conversation when the upload finishes. While cropping an image or editing a timeline, use **Chat** or **Canvas** in the editor header to switch and keep your unsaved edits. If an MP4 is rendering, leave the page open. You can switch modes and download or publish the finished video from the same editor. + +Change the interface language in **Settings → General → Language**. In **Chat**, the settings button is in the top bar. In **Canvas**, it is at the bottom left. The assistant's reply language follows your question. + ## Preview the same project in another browser window Open the project menu and select **Open in new tab** next to the project. The preview uses the same workspace and disables editing controls. You can pan the canvas, inspect media, and play a saved timeline while the editing window stays open. Saved changes appear automatically. @@ -12,9 +26,11 @@ Select **Edit in this window** to request edit access. In the editing window, se On the welcome screen, select **Get started**. Set up a language model for the built-in assistant or choose an existing harness. Then check one or more tasks. Each checked task shows its saved models or opens its setup form if you have none. **Start creating** places a node for each checked task on the same canvas. **Import media** opens the file picker. **Open an example canvas** opens an editable example project directly, with download progress in step two. Cancelling keeps your task selections. You can add more models in Settings anytime. -For external agent harnesses (Codex, OpenCode, Claude Code, DeepSeek Harness, JiuwenSwarm and Pi), OpenDirector checks the backend's `PATH` first, then common CLI installation directories. These include user bins, npm/nvm, Bun, Volta, Windows Scoop and Python Scripts, and macOS Homebrew and user Python bins. It also checks Codex desktop installs, OpenCode's `.opencode/bin`, Claude's `.claude/local`, Pi's `~/.pi/agent/bin`, and configured npm, pipx and uv bin directories. It checks known directories without scanning the whole disk. Finding a CLI does not establish authentication or configuration readiness. For other locations, add the CLI directory to the backend's `PATH` and restart the backend. The Default agent continues to use the bundled OpenCode. +For external agent harnesses (Codex, OpenCode, Claude Code, DeepSeek Harness, JiuwenSwarm, Pi and Antigravity), OpenDirector checks the backend's `PATH` first, then common CLI installation directories. These include user bins, npm/nvm, Bun, Volta, Windows Scoop and Python Scripts, and macOS Homebrew and user Python bins. It also checks Codex desktop installs, OpenCode's `.opencode/bin`, Claude's `.claude/local`, Pi's `~/.pi/agent/bin`, Antigravity's `~/.gemini/bin`, and configured npm, pipx and uv bin directories. It checks known directories without scanning the whole disk. Finding a CLI does not establish authentication or configuration readiness. For other locations, add the CLI directory to the backend's `PATH` and restart the backend. The Default agent continues to use the bundled OpenCode. + +Antigravity has been verified on macOS only. On Linux and Windows, whether `agy` applies OpenDirector's sandbox policy is unverified. Antigravity keeps its conversations in the global `agy` history under `~/.gemini/antigravity-cli/`. -Click the gear at the bottom left to open **Settings**, then open **Model connections**. Add models for chat, image, video, or audio generation as needed. +Open **Settings → Model connections**. Add models for chat, image, video, or audio generation as needed. For optional Kling 4.0 and Flash video generation, follow [Generate videos with Kling](kling-video.md). Both support text, first-frame, and image-reference generation. Standard Kling 4.0 also supports first-and-last frames. Adding the service preserves your existing model selection. @@ -47,6 +63,15 @@ example vLLM's 4096 default) rejects every request with HTTP 400. For vLLM-Omni video connections, enter fractional seconds directly, for example `6.583333`. The CLI accepts `opendirector video create --duration 6.583333` together with the other required options. Read `opendirector video create --help` and `opendirector model list` first; `inputRules.fractionalDuration` identifies support, and each output's duration list defines the allowed range. H3 can align output to its supported frame count, so inspect the actual result duration before assembling segments. +Self-hosted H3 models add four ways to condition a video. Continue and keyframes work on native MiniMax-H3 and on models using the FastH3-Omni request shape; the other two are as noted: + +- **Continue**: generate a video with the model, choose **Extend** on it, and the next clip continues from where it ended, picture and sound. This only continues clips this same service generated and still holds; for an uploaded video, **Extend** opens in Universal reference mode with the video as a reference, on models that accept reference videos (the FastH3-Omni request shape does; native MiniMax-H3 does not). +- **Keyframes**: in Universal reference mode, each connected image shows a time box above the prompt. Give an image a time and the video shows that picture at that moment; leave it empty and the image stays an ordinary reference. Up to eight keyframes, each earlier than the end of the video and at least 1/24 second from the others (a keyframe is pinned to one frame), and at least one image or video must stay unpinned. Copying the node together with its pictures keeps the times. The CLI takes `opendirector video create --keyframe ITEM_UUID@SECONDS`. +- **Redraw part of a video**: **Partial reshoot**, **Video edit** and **Subtitle erasure** redraw a time span or a boxed region and keep the rest of the clip. On a model that uses the FastH3-Omni request format, a boxed redraw is generated twice to bring the change to the start of the clip, which takes about twice as long. The change can still arrive up to a couple of seconds into the clip; run the edit again if it does. +- **Structure control**: connect a depth video and choose structure control, as before. This needs a service started with the ControlNet weights and is available on the FastH3-Omni request shape. + +Structure control, continuation and keyframes cannot be combined in one generation. + To use few-step H3 adapters such as Pika Flex Turbo, which need a LoRA and their own step count on every request, or to offer several such variants from one vLLM-Omni server, see the [video gateway](video-gateway.md) that starts with OpenDirector. For detailed video settings, see [Video model capability configuration](video-model-capabilities.md). When no explicit output specification is provided, use **Auto** or **Service default duration**. @@ -80,11 +105,11 @@ The first launch creates an untitled canvas. Later launches can restore the most - Click the project name at the top left to rename it. Press `Enter` or click elsewhere to save, or press `Esc` to cancel. - Click the arrow next to the name to switch projects. Choose **New canvas project** to create one. -- On an empty canvas, click **Configure models** to open **Settings → Model connections**. -- Click **Try image example** or **Try video example** on an empty canvas to import a hosted sample: it downloads with a progress bar, imports as a new project and opens it. A download that is a ZIP around a single `.canvas` file is unwrapped automatically, and a page returned instead of a file is reported rather than imported. The project menu's **Example canvases** row opens the full list, with sizes and a manual-import link for a sample that cannot be downloaded. -- Use the left toolbar or double-click empty canvas space to create text, image, video, audio, timeline, or subject nodes. +- Choose **Add node** in the left toolbar, then pick text, image, video, audio, timeline, or subject. To place the node at a particular spot, double-click that spot on the empty canvas and choose its type. With the canvas focused, press `T` to add a text node directly. +- To explore a complete project, select **Browse example canvases** on an empty canvas or **Example canvases** in the project menu. The list shows sample sizes and download progress, and offers manual download links where available. Importing a sample opens a new project. A ZIP containing one `.canvas` file is unpacked automatically. If a download returns a webpage, the picker reports the error. +- To connect a generation model, open **Settings → Model connections**. - Right-click empty canvas space to create a node, paste, undo, or redo. -- Click **Upload** on the left or drag files onto the canvas to add assets. Use **Asset library** to choose existing assets. +- Click **Upload** on the left or drag files onto the canvas to add assets. Click **Asset library** to choose existing material. - Single-image HEIC and HEIF photos are supported; multi-image files and sequences are rejected. OpenDirector retains the original file and creates an oriented, full-resolution PNG for browser display. Downloads, canvas archives and timeline media packages retain the original. Files must decode successfully and contain at most 25 million pixels. If an original is unavailable, exporting reports an error instead of substituting the display preview. - Double-click a node's name to rename it. Double-click its content to open the appropriate editor or preview. @@ -152,15 +177,25 @@ Codex web search citations appear as numbered source links when the search resul Click a source number to view its full URL in a bordered information card, then choose **Copy link** or **Open link**. Close the card with the button at its top right, by pressing `Esc`, or by clicking outside it. -Click **Chat with AI** at the bottom right, select a chat model, and describe what you want to create. You can upload, drag and drop, or paste assets, or type `@` to reference canvas content. The assistant can save text as requested and call configured generation models to create assets. +Use the chat in either creation mode, select a chat model, and describe what you want to create. If the chat is collapsed in **Canvas**, click **Chat with AI** to reopen it. You can upload, drag and drop, or paste assets, or type `@` to reference canvas content. The assistant can save text as requested and call configured generation models to create assets. + +In **Create with chat**, assets the assistant writes to the project and completed generation results appear beneath the reply that produced them. A job that finishes later adds its card to the original reply. Reopen the conversation to find its results again. + +- Select **Preview** to inspect that version, play video or audio, or download the original file. +- Select **Reference in chat** to add that asset to your current draft. Add your instructions and send when ready. +- Select **Edit media** to open the shared editor for the image, video, or audio on the card. Select **Open timeline** to edit a timeline associated with that asset. If several timelines use it, choose the one you want first. Closing the editor returns you to the conversation. +- Select **View on canvas** to switch to the canvas and select the corresponding node. A hidden node is shown again. If no node displays that version yet, the canvas adds one for the existing asset. Viewing a candidate or earlier version preserves the generation node’s current result. + +For a local edit, open **Project assets** in the toolbar below the chat input. Search for an asset from this project and add it to your draft, or select **Import media** and **New timeline**. In the timeline editor, add the imported media to a track. You can save the edit, render an MP4 in the browser, publish it to the project, or download it. Import and local editing work before you send a message or configure a model. When the latest reply offers next steps, three to five suggested replies appear beneath it and stay visible as you type. Select one to fill the composer or replace the text you have already written. Attachments, references and skills stay in your draft. You can edit the text or undo the replacement. Press **Send** or `Enter` when you are ready. -Use **New conversation** at the top of the panel to start a separate chat. **Conversation history** lets you search and switch between this canvas's conversations. Switching saves your draft and restores the selected conversation's messages, reference attachments, and model choices; the active conversation also survives a page reload. Wait for uploads or replies to finish, or stop the reply, before switching. +Use **New conversation** to start a separate chat. In either mode, select **Conversation history** in the chat header to search and switch conversations. Switching saves your draft and restores the selected conversation's messages, reference attachments, and model choices. The active conversation also survives a page reload. Wait for uploads or replies to finish, or stop the reply, before switching. - Press `Enter` to send, or `Shift+Enter` for a new line. - You can stop the response while it is being generated. -- Click the collapse button at the top right to hide the chat panel. Drag its left edge to resize it. +- In **Canvas**, use **Collapse AI chat** and **Chat with AI** to hide and reopen the panel. When docked, drag the divider between chat and canvas to resize it or double-click the edge to restore the default width. +- To move chat with the keyboard, focus its title and press an arrow key. Hold `Shift` to move farther. Your browser remembers the floating position and restores it when there is enough room. Asset generation may continue after the reply ends. Check its progress in **Generation history**. @@ -178,6 +213,7 @@ Select a node, then choose an action from its toolbar. - **Images**: Crop, rotate, flip, adjust colors, work with layers, add text, shapes, or annotations, and edit selections. - **Video and audio**: Extract frames, trim, extract audio tracks, and process clips. + Use the version button at the top right of a node to apply an earlier version. If a generation job blocks the change, choose **Stop blocking jobs** in the history panel, then apply the version. Previously generated results remain available. When trimming a video, choose WebM (the default) or MP4 under **Output format**. Choose MP4 if your model requires MP4 reference video. - **AI tools**: Extend images, erase content, remove backgrounds, edit images with AI, upscale, and more. Availability depends on the connected models. diff --git a/docs/guides/user-guide.zh-CN.md b/docs/guides/user-guide.zh-CN.md index f6dc6a095..8c595c6b4 100644 --- a/docs/guides/user-guide.zh-CN.md +++ b/docs/guides/user-guide.zh-CN.md @@ -2,6 +2,20 @@ [English](user-guide.md) · [简体中文](user-guide.zh-CN.md) · [返回首页](../../README.zh-CN.md) +## 选择创作方式 + +首次打开时,点“开始设置”,配置语言模型或连接已就绪的本地助手。连接成功后,点“对话创作”就能从一个想法开始;需要生成图片、视频或音频时,可以在对话中打开设置添加模型。点击“画布创作”会打开画布的开始方式。首次进入需要至少一个图片或视频生成模型,已有可用配置会自动识别。之后可以进入空画布、开始所选任务、导入素材或打开示例。先用对话创作的用户,首次切到画布时也可以在提示中完成配置。 + +- 在**对话创作**底部的输入框描述创作目标,或添加参考素材。从聊天顶部打开“历史会话”可以搜索、切换当前项目的对话。桌面端在对话创作中也使用整页聊天,项目从顶栏切换。点击顶栏的“在画布中浮动”,就能边看画布边和助手继续聊。连按两次 `Shift` 可聚焦输入框。 +- **画布创作**默认左边聊天、右边画布,按 1:2 分栏。将鼠标移到聊天标题栏的停靠图标上,或用 Tab 键聚焦它,即可看到目标侧。点击图标可以换边。宽屏下,拖动聊天标题或点击“浮动聊天”可以让对话浮在画布上,再选择左侧或右侧停靠图标恢复分栏。 +- 窗口较窄时,“画布”一次显示一个区域,通过“查看画布”和“与 AI 对话”切换。 + +两种模式共用当前项目、会话、输入草稿和附件。切换会保留画布视角,正在进行的回复和生成任务会继续,不会重新提交。 + +上传参考素材时也可以切换模式,上传完成后素材仍会出现在原对话里。裁剪图片或编辑时间线时,可以点编辑器标题栏的“对话”或“画布”切换,接着修改尚未保存的内容。渲染 MP4 期间请保持页面打开,切换模式后仍可在同一编辑器下载或发布成片。 + +界面语言在“设置 → 通用 → 语言”中切换。对话创作的设置入口在顶栏,画布创作的设置入口在左下角。助手的回复语言跟随你的提问。 + ## 在多个浏览器窗口查看同一项目 打开项目菜单,点项目右侧的「在新标签页打开」。两个窗口使用同一套工作区,预览窗口中的编辑控件会禁用。你可以平移缩放画布、查看素材、播放已保存的时间线。编辑窗口保存后,预览会自动更新。 @@ -12,9 +26,11 @@ 首次打开时,在欢迎页选择「开始设置」。为内置助手配置一个语言模型,或选择已有的 Harness。接着勾选一项或多项任务。每个勾选项可以选用已有模型,缺模型时直接显示对应的配置表单。点击「开始创作」后,画布会为每项任务添加一个节点。点「导入素材」可直接选文件,点「打开示例画布」可直接进入可编辑的示例项目,下载进度在第二步显示。取消时会保留已勾选的任务。之后可随时在设置中添加其他模型。 -选择外部 Agent harness(Codex、OpenCode、Claude Code、DeepSeek Harness、JiuwenSwarm 和 Pi)时,OpenDirector 优先检查后端的 `PATH`,再查找常见 CLI 安装目录,包括用户命令目录、npm/nvm、Bun、Volta、Windows Scoop 与 Python Scripts,以及 macOS Homebrew 和用户 Python 命令目录。同时检查 Codex 桌面版、OpenCode 的 `.opencode/bin`、Claude 的 `.claude/local`,Pi 的 `~/.pi/agent/bin`,以及配置的 npm、pipx 和 uv 命令目录。检测仅访问已知目录,不扫描整个磁盘;找到 CLI 后仍需检查认证与配置是否就绪。其他安装位置可加入后端的 `PATH`,然后重启后端。Default Agent 仍使用应用内置的 OpenCode。 +选择外部 Agent harness(Codex、OpenCode、Claude Code、DeepSeek Harness、JiuwenSwarm、Pi 和 Antigravity)时,OpenDirector 优先检查后端的 `PATH`,再查找常见 CLI 安装目录,包括用户命令目录、npm/nvm、Bun、Volta、Windows Scoop 与 Python Scripts,以及 macOS Homebrew 和用户 Python 命令目录。同时检查 Codex 桌面版、OpenCode 的 `.opencode/bin`、Claude 的 `.claude/local`,Pi 的 `~/.pi/agent/bin`、Antigravity 的 `~/.gemini/bin`,以及配置的 npm、pipx 和 uv 命令目录。检测仅访问已知目录,不扫描整个磁盘;找到 CLI 后仍需检查认证与配置是否就绪。其他安装位置可加入后端的 `PATH`,然后重启后端。Default Agent 仍使用应用内置的 OpenCode。 + +Antigravity 目前只在 macOS 上验证过;在 Linux 与 Windows 上,agy 是否执行 OpenDirector 的沙箱策略尚未验证。Antigravity 的会话保存在 `~/.gemini/antigravity-cli/` 下的 agy 全局历史中。 -点击左下角齿轮进入“设置”,打开“模型接入”,按用途添加对话、图片、视频或音频模型。 +打开“设置 → 模型接入”,按用途添加对话、图片、视频或音频模型。 需要接入可灵 4.0 或 Flash 时,参阅[使用可灵生成视频](kling-video.zh-CN.md)。两个型号均支持文生、首帧和图片参考,标准版 4.0 额外支持首尾帧。添加后保留已有模型选择。 @@ -59,6 +75,15 @@ HTTP 400。 vLLM-Omni 视频连接支持直接输入小数秒,例如 `6.583333`。CLI 可使用 `opendirector video create --duration 6.583333` 并填写其余必需参数。先运行 `opendirector video create --help` 和 `opendirector model list`;`inputRules.fractionalDuration` 表示支持小数秒,各输出规格的时长列表定义允许范围。H3 可能按模型支持的帧数对齐,拼接分段前应核对结果的实际时长。 +自部署的 H3 模型提供四种条件生成方式。接续和关键帧在原版 MiniMax-H3 和使用 FastH3-Omni 请求格式的模型上都可用,另外两种见各条说明: + +- **接续**:用模型生成一段视频后,对它使用「延长」,下一段会从它结束的地方接着生成,画面和声音都连续。只能接续同一个服务生成、且服务仍保留着的片段;对上传的视频,「延长」以全能参考模式打开,把它当作参考视频;这需要模型接受参考视频(FastH3-Omni 请求格式接受,原版 MiniMax-H3 不接受)。 +- **指定帧**:在全能参考模式下,每张已连接的图片在提示词上方都有一个时间框。给图片填一个时间,生成的视频会在那一刻出现这个画面;留空则仍是普通参考。最多 8 个指定帧,时间须早于视频结束、彼此至少相隔 1/24 秒(每个指定帧钉在一帧上),并且至少留一张图片或一段视频不指定时间。连同图片一起复制节点时会保留这些时间。命令行使用 `opendirector video create --keyframe ITEM_UUID@SECONDS`。 +- **重画视频的一部分**:「局部重拍」「视频编辑」「字幕擦除」会重画某个时间段或框选区域,其余部分保持原样。使用 FastH3-Omni 请求格式的模型上,框选重绘会生成两遍,让修改尽量从片头就出现,耗时约为一遍的两倍。修改仍可能在开头一两秒之后才出现,遇到时可再执行一次。 +- **结构控制**:与此前相同,连接一段深度视频并选择结构控制。需要服务启动时加载 ControlNet 权重,适用于 FastH3-Omni 请求格式。 + +结构控制、接续和指定帧不能在同一次生成中同时使用。 + 使用 Pika Flex Turbo 等少步数 H3 适配器(每个请求都需要 LoRA 和对应的步数),或想用一个 vLLM-Omni 服务提供多个这样的变体时,参见随 OpenDirector 一起启动的[视频转发层](video-gateway.zh-CN.md)。 ## 制作第一支短片 @@ -80,9 +105,9 @@ vLLM-Omni 视频连接支持直接输入小数秒,例如 `6.583333`。CLI 可 - 点击左上角项目名称修改名称,按 `Enter` 或点击其他位置保存,按 `Esc` 取消。 - 点击名称右侧的箭头切换项目,选择“新建画布项目”创建项目。 -- 在空白画布点击“配置模型”,可直接打开“设置 → 模型接入”。 -- 在空白画布点击“体验图片示例”或“体验视频示例”可直接导入官方托管示例:下载时显示进度条,完成后导入为新工程并打开。若下载到的是包裹单个 `.canvas` 的 ZIP,会自动解开;若返回的是网页而不是文件,会明确提示而不会导入。项目菜单中的“示例画布”可打开完整列表,含大小信息,以及无法下载时的手动导入链接。 -- 通过左侧工具栏或双击空白画布创建文本、图片、视频、音频、时间线或主体节点。 +- 点击左侧的“添加节点”,再选择文本、图片、视频、音频、时间线或主体。要把节点放在指定位置,双击画布上的空白位置,再选类型。焦点在画布上时,按 `T` 可直接添加文本节点。 +- 想看看完整项目时,点击空画布上的“浏览示例画布”,或从项目菜单打开“示例画布”。列表会显示示例大小和下载进度,部分示例也提供手动下载链接。导入后会打开一个新项目。下载包中若只有一个 `.canvas` 文件,会自动解包。若下载返回网页,列表会提示错误。 +- 要连接生成模型,打开“设置 → 模型接入”。 - 右键空白画布可新建节点、粘贴、撤销或重做。 - 点击左侧“上传”或将文件拖入画布添加素材;“资产库”可选择已有素材。 - 支持单图 HEIC 和 HEIF 照片,不接受多图文件和图像序列。OpenDirector 保留原文件,并生成方向正确、完整分辨率的 PNG 供浏览器显示;下载、画布归档和时间线媒体包均保留原件。文件须能完整解码,且像素总数不超过 2500 万。原件不可用时,导出会报错,不会改用显示预览图。 @@ -152,15 +177,25 @@ Codex 网页检索引用在具有匹配来源时显示为编号链接;复制 点击来源编号可在带边框的信息卡片中查看完整链接,再选择“复制链接”或“打开链接”。可通过卡片右上角的关闭按钮、按 `Esc` 或点击卡片外部关闭。 -点击右下角“与 AI 对话”,选择对话模型后输入创作要求。可上传、拖放、粘贴素材,或输入 `@` 引用画布中的内容。助手可按要求保存文本,并调用已配置的生成模型制作素材。 +两种创作方式都可以使用对话。选择对话模型后输入创作要求。使用画布创作时,若对话框已收起,点击“与 AI 对话”恢复。可上传、拖放、粘贴素材,或输入 `@` 引用画布中的内容。助手可按要求保存文本,并调用已配置的生成模型制作素材。 + +在**对话创作**中,助手写入项目的素材和已完成的生成结果会出现在对应回复下方。生成任务稍后完成时,结果卡片也会补到原回复。打开历史会话可以再次找到这些结果。 + +- 点击**预览**查看该版本的内容。视频和音频可以播放,预览窗口也可下载原文件。 +- 点击**继续引用**把这份素材加入当前草稿。可以接着输入修改要求,准备好后再发送。 +- 点击**编辑媒体**打开卡片上这份图片、视频或音频的共用编辑器。点击**打开时间线**可继续编辑与这份素材关联的时间线。如果有多条,先选择目标。关闭编辑器后回到当前对话。 +- 点击**在画布中查看**切到画布并选中对应节点。隐藏的节点会恢复显示。如果画布上还没有展示这个版本,会为这份素材添加一个节点。查看候选或历史版本时,生成节点仍保留原来采用的结果。 + +要直接剪辑本地素材,从对话输入框下方的工具栏打开**项目素材**。可以搜索本项目已有的素材并加入草稿,也可以点击**导入素材**和**新建时间线**,在编辑器里把素材加入轨道。保存后可在浏览器中渲染 MP4,再发布到项目或下载。导入和本地剪辑都无需先发消息或配置模型。 当助手在最新回复中给出后续建议时,回复下方会显示 3~5 个建议回复按钮,输入时仍可参考。点选一条即可填入输入框,替换已有文字,保留附件、引用和技能。你可以继续编辑或撤销替换,准备好后点击「发送」或按 `Enter`。 -点击对话框顶部“新建”开始独立会话;点击“历史会话”可搜索并切换当前画布的旧会话。切换前会保存草稿,切回后恢复消息、参考附件和模型选择,刷新页面仍保留当前会话。回复或参考上传进行中,请先等待完成或停止回复后再切换。 +点击“新建会话”可开始独立对话。在任一创作方式中,从聊天顶部打开“历史会话”即可搜索和切换当前项目的会话。切换前会保存草稿,切回后恢复消息、参考附件和模型选择,刷新页面仍保留当前会话。回复或参考上传进行中,请先等待完成或停止回复后再切换。 - `Enter` 发送,`Shift+Enter` 换行。 - 回复过程中可停止输出。 -- 点击右上角收起按钮隐藏对话框;拖动左边缘调整宽度。 +- 使用画布创作时,点击“收起 AI 对话”隐藏对话框,点击“与 AI 对话”重新打开。停靠时可拖动聊天和画布之间的分隔线调整宽度,双击边缘恢复默认宽度。 +- 用键盘移动聊天时,将焦点移到聊天标题上,再按方向键。按住 `Shift` 可以加大移动距离。浏览器会记住浮窗位置,窗口变宽后也能恢复。 素材生成可能在回复结束后继续进行,可在“生成历史”查看进度。 @@ -178,6 +213,7 @@ Codex 网页检索引用在具有匹配来源时显示为编号链接;复制 - **图片**:裁剪、旋转、翻转、调色、图层、文字、形状、标注和选区编辑。 - **视频与音频**:取帧、裁剪、音轨提取和片段处理。 + 从节点右上角的历史版本按钮可以应用旧版本。如果生成任务阻塞切换,请先在历史版本面板点击「停止阻塞任务」,再应用版本。之前生成的结果仍可使用。 使用「时长修剪」时,可在「保存格式」中选择 WebM(默认)或 MP4。如果模型要求参考视频为 MP4,请选择 MP4。 - **AI 工具**:扩图、消除、抠图、智能改图、超清等,是否可用取决于已接入模型。 diff --git a/docs/guides/video-model-capabilities.md b/docs/guides/video-model-capabilities.md index 72f436852..87dcc4aba 100644 --- a/docs/guides/video-model-capabilities.md +++ b/docs/guides/video-model-capabilities.md @@ -7,7 +7,7 @@ Generation history shows the requested video duration and the measured result du ## Interface 1. Open "Model connections", add or edit a video model, and fill in the base URL, Model ID and authentication. -2. Expand the collapsed "Video adapter" section for advanced settings. Choose the adapter for the `/videos` API. FastH3 uses eight steps and multi-asset references; each generation draws a new seed, keeps it with the job and reuses it when the job is recovered. FastH3 first/last frames (`fasth3_dual`) offers two generation modes on one model: its reference mode matches FastH3, while first/last-frame mode takes at most one first-frame and one last-frame anchor image, submits `fl2va` with `res_multistep` at 20 steps, and lands on the native 17n+5 frame grid, keeping the tail anchor at the grid's last frame instead of trimming to the requested duration. First/last-frame mode requires both anchors, rejects video and audio references, and is not combined with multi-asset references. Native H3 supports a first frame, asset references and continuation. The generic adapter sends only text and a single first frame, without H3 sampling parameters. When a model uses a custom name, choose the adapter explicitly. +2. Expand the collapsed "Video adapter" section for advanced settings. Choose the adapter for the `/videos` API. FastH3 uses eight steps and multi-asset references; each generation draws a new seed, keeps it with the job and reuses it when the job is recovered. It also continues a clip the same configuration generated, pins up to eight images at chosen times of the output as keyframes in reference mode, and provides the video-edit tools (Partial reshoot, Video edit, Subtitle erasure). FastH3 first/last frames (`fasth3_dual`) offers two generation modes on one model: its reference mode matches FastH3, while first/last-frame mode takes at most one first-frame and one last-frame anchor image, submits `fl2va` with `res_multistep` at 20 steps, and lands on the native 17n+5 frame grid, keeping the tail anchor at the grid's last frame instead of trimming to the requested duration. First/last-frame mode requires both anchors, rejects video and audio references, and is not combined with multi-asset references. Native H3 supports a first frame, asset references with keyframes, and continuation. The generic adapter sends only text and a single first frame, without H3 sampling parameters. When a model uses a custom name, choose the adapter explicitly. 3. Known models offer "Load adapter preset". Models without a declared capability show only "Auto" and "Service default duration". 4. Enable "Custom output specs" and fill in the resolution, supported durations and optional landscape pixel width and height for each tier. Durations accept `4-10,15`, meaning 4 to 10 seconds plus 15 seconds; tiers may declare different duration sets. 5. Set the default resolution, default duration and pixel alignment step, then save. Whether pixel sizes are required depends on the submitted parameters: adapters that send an explicit width and height need sizes, while adapters that send a resolution tier and let the service decide may leave them empty. Known H3 tiers may also use the adapter's built-in sizes. H3 aligns to 32 pixels and existing adapters stay within 4–15 seconds. diff --git a/docs/guides/video-model-capabilities.zh-CN.md b/docs/guides/video-model-capabilities.zh-CN.md index cbaafe47f..ff297edbb 100644 --- a/docs/guides/video-model-capabilities.zh-CN.md +++ b/docs/guides/video-model-capabilities.zh-CN.md @@ -7,7 +7,7 @@ ## 界面操作 1. 打开“模型接入”,添加或编辑视频模型,填写地址、Model ID 和鉴权信息。 -2. 点击默认折叠的“视频适配方式”展开高级配置。对 `/videos` 接口选择适配方式。FastH3 使用八步和多素材参考,每次生成使用新的随机种子并随任务保存,恢复任务时沿用;FastH3 首尾帧(`fasth3_dual`)在同一模型上提供两种生成方式:参考模式与 FastH3 相同,首尾帧模式最多使用首帧、尾帧两张锚点图片,按 `fl2va`、`res_multistep` 采样、20 步提交,帧数落在 17n+5 网格上,尾帧锚点保留原生网格最后一帧、不按所选时长裁剪;首尾帧模式必须同时提供首帧和尾帧,不接受视频或音频参考,也不与多素材参考同时使用。原生 H3 支持首帧、素材参考及接续;通用适配仅发送文本和单张首帧,不携带 H3 专属的采样参数。模型使用自定义名称时,应明确选择适配方式。 +2. 点击默认折叠的“视频适配方式”展开高级配置。对 `/videos` 接口选择适配方式。FastH3 使用八步和多素材参考,每次生成使用新的随机种子并随任务保存,恢复任务时沿用;它还支持接续同一配置生成的片段,在参考模式下把最多八张图片作为关键帧固定到成片的指定时间点,并提供视频编辑工具(局部重拍、视频编辑、字幕擦除);FastH3 首尾帧(`fasth3_dual`)在同一模型上提供两种生成方式:参考模式与 FastH3 相同,首尾帧模式最多使用首帧、尾帧两张锚点图片,按 `fl2va`、`res_multistep` 采样、20 步提交,帧数落在 17n+5 网格上,尾帧锚点保留原生网格最后一帧、不按所选时长裁剪;首尾帧模式必须同时提供首帧和尾帧,不接受视频或音频参考,也不与多素材参考同时使用。原生 H3 支持首帧、素材参考(含关键帧)及接续;通用适配仅发送文本和单张首帧,不携带 H3 专属的采样参数。模型使用自定义名称时,应明确选择适配方式。 3. 已知模型可点击“载入适配预设”。未声明能力的模型只显示“自动”和“服务默认时长”。 4. 开启“自定义输出规格”,每档填写分辨率、支持时长和可选横屏像素宽高。时长支持 `4-10,15`,即 4 至 10 秒以及 15 秒。不同档位可填写不同的时长集合。 5. 设置默认分辨率、默认时长和像素对齐步长,保存。是否需要填写像素尺寸取决于提交参数:发送明确宽高的适配需要配置尺寸;发送分辨率档位、由服务端确定宽高的适配可以留空。已知 H3 档位也可使用适配器内置的尺寸。H3 使用 32 像素对齐,现有适配仍限定 4–15 秒。 diff --git a/feature-assets/agent-perf/execution-record.png b/feature-assets/agent-perf/execution-record.png new file mode 100644 index 000000000..bae49ec7d Binary files /dev/null and b/feature-assets/agent-perf/execution-record.png differ diff --git a/feature-assets/character-replacement/goodnight-try0089-canvas.png b/feature-assets/character-replacement/goodnight-try0089-canvas.png new file mode 100644 index 000000000..e001f7b3a Binary files /dev/null and b/feature-assets/character-replacement/goodnight-try0089-canvas.png differ diff --git a/feature-assets/voice-search/before.png b/feature-assets/voice-search/before.png new file mode 100644 index 000000000..ddcf7dd59 Binary files /dev/null and b/feature-assets/voice-search/before.png differ diff --git a/feature-discussions/desktop-cli-acceptance/feature.md b/feature-discussions/desktop-cli-acceptance/feature.md new file mode 100644 index 000000000..387abaf69 --- /dev/null +++ b/feature-discussions/desktop-cli-acceptance/feature.md @@ -0,0 +1,25 @@ +# [validate] desktop: Verify terminal command installation on macOS and Windows + +Tracks installed-app acceptance for PR #397 under D1 #363 and desktop RFC #362. + +## Goal + +Users can install the terminal command from the packaged app, open a new terminal, and run the CLI bundled with that installation. A previous macOS check ran the bundled CLI directly, but the shell resolved a Conda installation. Windows registration and invocation still need real-machine evidence. + +## References + +- [PR #397](https://github.com/ThinkFlowLab/OpenDirector/pull/397) and [desktop guide](../../docs/development/desktop.md) describe the packaged launcher and terminal registration. +- [OpenDirector CLI guide](../../docs/guides/cli.md) documents command discovery and how an external Agent selects the service and project. +- [VS Code macOS setup](https://code.visualstudio.com/docs/setup/mac) demonstrates installing the terminal command from the app and opening a fresh terminal to verify it. + +## Acceptance criteria + +- [ ] Install a released package on macOS arm64 and Windows x64. In **More → Manage terminal command**, choose **Install** with no existing OpenDirector CLI on PATH. Record the launcher path shown in the app. +- [ ] Open a fresh terminal. Run `command -v opendirector` on macOS and `(Get-Command opendirector).Source` in Windows PowerShell. Verify that the resolved launcher belongs to the tested package. +- [ ] Run `opendirector --help` and confirm successful exit. Run `opendirector desktop` and confirm it opens or focuses the same installation. +- [ ] Repeat with a Conda or pip CLI already on PATH. Check that installation preserves the existing command. If it takes precedence, verify that the documented recovery steps let the user resolve the desktop launcher in a fresh terminal. Check the guidance in English and Chinese. +- [ ] On each platform, have a first-time user without programming experience follow the English or Chinese quick start without maintainer coaching. The guide explains what the terminal command enables, shows where to click, tells the user when to open a new terminal, and provides copyable verification commands, expected results, and recovery steps if another installation takes precedence. +- [ ] Start an external Agent in a fresh shell. Using only the guide, have it discover the installed CLI, read its help, and successfully run `opendirector --url project list` against a configured, authorized OpenDirector service. Use a test project and verify it appears in the result. Explain how the user obtains the service URL and when a standalone service is required. +- [ ] Record the installer version, OS and architecture, shell, resolved path, command output, and pass/fail result for each platform. File separate issues for defects found during acceptance. + +External Agent acceptance uses the documented connection settings. The packaged app’s private Host is outside the connection scope of this test. diff --git a/feature-discussions/desktop-external-copy/feature.md b/feature-discussions/desktop-external-copy/feature.md new file mode 100644 index 000000000..3a40ed43b --- /dev/null +++ b/feature-discussions/desktop-external-copy/feature.md @@ -0,0 +1,36 @@ +# [feat] clipboard: Copy and paste content between OpenDirector and other apps + +Related: Canvas roadmap #262 and desktop clipboard permissions PR #458. + +## Goal and scope + +Provide consistent, bidirectional copy and paste across OpenDirector Web, OpenDirector desktop, and compatible external apps. Use the platform's standard shortcuts in both directions. Paste into OpenDirector as editable project content where applicable, or into an external app as text, an image, or a file according to what the destination accepts. + +## Example scenario + +In OpenDirector on Web or desktop, select an image node and press **Ctrl+C** (**Cmd+C** on macOS). Switch to an email draft, a Codex chat, or a WeChat conversation and press **Ctrl+V** (**Cmd+V** on macOS). The reported behavior is that the image does not appear. The expected behavior is that the selected image appears inline or as an attachment in a composer that accepts pasted images. + +## Proposed behavior + +| Selection | Clipboard content | Example destination | +| --- | --- | --- | +| Text in a chat reply or canvas text node | Plain text preserving Unicode and line breaks | TextEdit or Notepad | +| One image asset | Clipboard image data | Keynote or PowerPoint | +| One video asset | Video file data or a file reference, as supported by the client | Finder or File Explorer | + +- Preserve existing in-app canvas copy and paste. When an image node is selected, the standard Copy shortcut should make the image available to other apps while preserving in-app node paste. Standard text selection keeps the native copy shortcut. +- Resolve media through the existing project asset service. Use browser clipboard formats on Web and platform clipboard support in the desktop app. Validate video paste in a compatible receiver. If the browser cannot write the video to the clipboard, explain the limitation and offer a download. Avoid buffering an entire large video in the renderer. +- Report copy success only after the system clipboard write succeeds. Show actionable English and Chinese errors for unavailable media or clipboard failures. + +- Accept pasted text, images, and video files from external apps through the same canvas import and validation rules on Web and desktop. When copying between OpenDirector clients, preserve editable nodes and resolve their assets in the destination project. + +## Acceptance criteria + +- [ ] Test both directions between compatible external apps and each OpenDirector client, plus Web → desktop and desktop → Web. Use the same shortcuts and samples, and check equivalent pasted content at the same destination. Verify imported assets remain usable after reopening the destination project. Record format limitations and verify the documented fallback where clipboard transfer is unavailable. + +- [ ] From Web and desktop, select an image node and use the platform Copy shortcut. Paste into an email draft, Codex, and WeChat where the composer accepts images. Verify that the selected image appears inline or as an attachment. Record the tested OS, browser or desktop build, and receiving app. + +- [ ] In supported browsers and packaged macOS and Windows builds, paste copied Chinese and English text into a native editor and verify line breaks. +- [ ] Paste a copied image into a compatible slide editor and a video into an app that accepts pasted video files. Verify the download fallback in browsers without video clipboard support. Open the pasted or downloaded video and verify it matches the selected asset. +- [ ] Switch projects before pasting and verify the copied media is still usable. Exercise a large video and verify the app remains responsive. +- [ ] Verify internal canvas copy and paste still works. Exercise missing media and failed clipboard writes in both UI languages. diff --git a/feature-discussions/desktop-linked-media/feature.md b/feature-discussions/desktop-linked-media/feature.md new file mode 100644 index 000000000..8a9d7a890 --- /dev/null +++ b/feature-discussions/desktop-linked-media/feature.md @@ -0,0 +1,44 @@ +# [feat] desktop: Import media by reference + +Related: Desktop RFC #362 and canvas roadmap #262. + +## Example scenario + +A travel vlogger returns with dozens of camera and drone clips stored on an external drive or a mounted NAS share. Individual clips can be as large as 10 GB. Copying the entire batch into each project takes time and consumes extra disk space. The editor selects **Reference in place** for the batch, then browses, seeks, and cuts the clips directly from their existing storage. + +## Goal and scope + +Let desktop users import large local media without duplicating the source file. Offer **Copy into project** and **Reference in place** when importing a local file. Keep copying as the default and retain the browser upload flow. + +## User flow and rules + +- The desktop host obtains read-only access to the file selected by the user. Keep its location and content fingerprint in host-managed storage. The canvas, timeline, and Agent use the same project asset ID. +- If the file moves or a drive disconnects, show the asset as offline and retain its timeline edits and references. Let the user relink a matching file by SHA-256 without changing the asset ID. If the bytes differ, require an explicit replacement and preserve earlier execution records. +- Read the linked source for preview, editing, generation, and export through shared media services. Apply the existing model input limits when submitting generation. +- Let users copy linked media into the project for portable archives. Identify offline files before creating a self-contained archive. Removing a linked asset leaves the original file on disk. + +## Proposed reference structure + +- **Project asset.** Keep the existing asset ID, immutable fingerprint, verified media metadata and provenance. Canvas nodes, timeline clips and Agent operations keep referencing the same project asset. Today the Asset schema requires a project-relative `assets/{id}` path. Extend the storage contract to distinguish managed bytes from a desktop link, and resolve both through the shared media service. +- **Desktop file binding.** Store the authorized file location in a Host-local record keyed by project and asset ID. An authorized root plus a relative path can support batch relinking when a drive letter, mount point or NAS share changes. Keep machine-specific paths and grants out of portable archives. A project opened elsewhere can retain its asset records and ask the user to bind the files again. +- **Availability and identity.** Derive availability from the current binding and access checks. Distinguish an unavailable source from a source whose bytes changed. Use filename, size and folder layout to find candidates. Verify SHA-256 before accepting a candidate as the same asset. Relinking changes the binding only. Replacing different bytes requires explicit adoption of a new immutable asset and preserves existing execution records. +- **Read and export.** Resolve by asset ID under the current project authorization and stream or seek through the Host. Verify source identity at the execution boundary. Operations that require durable inputs, such as accepted generation jobs, need a validated snapshot or must report that the source cannot be safely used. An explicit portable archive copies verified bytes into managed storage and reports unavailable assets before export. + +## References and trade-offs + +- **Final Cut Pro** informs the import choice and the workflow for reconnecting source media. [Apple media management guide](https://support.apple.com/en-mn/guide/final-cut-pro/verd1f9666b/mac) +- **Adobe Premiere** informs one-file and batch relinking when the folder structure is intact. Use these matches to find candidates and verify their content before reconnecting. [Adobe relinking guide](https://helpx.adobe.com/premiere/desktop/organize-media/ingest-proxy-workflow/relink-offline-clips.html) +- **OpenTimelineIO** separates a clip's media reference from its available time range. OpenDirector also needs Host-local authorization and immutable content identity. [OpenTimelineIO schema](https://opentimelineio.readthedocs.io/en/latest/api/python/opentimelineio.schema.html) + +## Decisions to confirm + +- For large batches, propose registering links with an explicit verification state and computing full SHA-256 in the background with bounded concurrency. Decide when unverified files may be previewed and how generation and export wait for verification. Measure first-preview latency and NAS reads using the 10 GB case. +- Start with file selection and an explicit folder selection for batch relinking. Confirm which platform access grants survive restart and how the app requests access again. + +## Acceptance criteria + +- [ ] Import a batch of dozens of clips by reference from an external drive and repeat on a mounted NAS share. Include a 10 GB clip in each run. Verify that the project creates no full-size copies of the source clips. Reopen the project, seek in the large clip, add it to the timeline, and reference it from the Agent. +- [ ] Move the file or disconnect its drive. Verify the offline state, then relink an identical file and confirm the asset ID, nodes, and timeline edits survive. +- [ ] Change the contents at the original path. Verify that the project requires explicit replacement before using the new bytes. +- [ ] Export a timeline that uses linked media. Copy the media into the project, archive it, and verify playback on another machine without access to the source path. +- [ ] Remove a linked asset and verify the source file remains intact. Verify import and recovery flows in English and Chinese. diff --git a/feature.md b/feature.md new file mode 100644 index 000000000..c022282f0 --- /dev/null +++ b/feature.md @@ -0,0 +1,26 @@ +# [feat] voice library: Search voices by name + +## Goal and scope + +**Before:** Finding a voice by name requires paging through the Voice Library. + +![Voice Library before search, showing voice cards and pagination](feature-assets/voice-search/before.png) + +**After:** Type `青年` to find voices such as `青年` and `世界最狂青年音`, even when they are on different pages. + +## User flow + +- Add a search field to the Voice Library. Match partial display names within the active tab: All Voices, My Voices, or Favorites. +- Keep the current query when switching tabs. Changing the query or tab returns to page one. Clearing the query restores browsing in the active tab. +- Show a clear message when no voices match. Matching cards retain the existing preview and selection actions. + +## Implementation notes + +Apply the name filter to the full eligible voice list before paginating. Reuse the existing voice catalog and tab filters. Localize the search label, clear action, and empty state in English and Chinese. + +## Acceptance criteria + +- [ ] A partial Chinese name finds matches across pages, and English names match regardless of case. +- [ ] Switching tabs narrows results to that tab. Pagination reflects only matching voices. +- [ ] Clearing a query restores the voice list, and a matching voice can still be previewed and selected. +- [ ] Search and empty states are usable in both English and Chinese. diff --git a/packages/agent/skills/character-replacement/SKILL.md b/packages/agent/skills/character-replacement/SKILL.md index e3c9e0ae0..b53024845 100644 --- a/packages/agent/skills/character-replacement/SKILL.md +++ b/packages/agent/skills/character-replacement/SKILL.md @@ -1,25 +1,18 @@ --- name: character-replacement -description: Plan MiniMax-H3 character replacement, write per-segment Ref2VA prompts and configure reusable H3-04 ComfyUI workflows for generation and review. +description: Replace people in source footage with H3 in OpenDirector. Plan segments, write Ref2VA prompts, and execute a Pipeline from a visible, verified canvas plan. --- -# Character Replacement +# Character replacement -Make character replacement easy to use: the user supplies source media and a replacement request; the agent derives the segment plan, prompts and workflow parameters. Keep the input boundary as original images, source video and explicit prompts. Work only on the requested deliverable; planning or prompt edits do not start generation, restart services or introduce preprocessing. +> For Chinese requests, read [SKILL.zh.md](SKILL.zh.md) and its linked `.zh.md` guides. -For a simple one-person edit without segmented continuation, reuse the [H3-04 Character Replacement workflow](assets/character-replacement.json). For planned multi-segment work, use the Agentic Continuation template linked below; its example-specific settings must be recalculated for new footage. +**[Governing prompt principle](prompt-writing.md#governing-principle)** — Specify which source person gets which portrait and which features to replace, let the source video determine the performance, camera and scene, and describe a critical existing occlusion in one sentence about what stays in front. Define the source performer and portrait identity as separate Subjects. For every shot, record which assigned source tracks are visible and which are out of frame. At a cut from a group shot to a close-up, inspect the source crop and both frame edges before writing the shot prompt. -1. Create a 24-FPS constant-frame-rate working copy of the source video before visual inspection, segmentation and frame-index calculations, unless the user explicitly requests another FPS. Preserve the original file and playback timing. Read [video-segment.md](video-segment.md) first. Use a vision-capable model to inspect the source video, establish shot boundaries and track when each selected person appears, interacts, becomes occluded and leaves. Produce the segment plan before writing new segment prompts. -2. Read [prompt-writing.md](prompt-writing.md), then write each segment's prompt from its inspected action and explicit source-person-to-picture mappings. -3. For a single-person, single-segment edit, configure the simple workflow linked above. For segmented or multi-person work, configure a task-specific copy of the [H3-04 Agentic Continuation workflow](assets/character-replacement-continuation.json), reusing Global Control, existing nodes and one shared segment-subgraph definition. Follow [workflow.md](workflow.md) for configuration, execution and review. -4. When generation is requested, submit the executable graph through ComfyUI, monitor results, inspect segment previews and deliver the assembled video with remaining quality defects. +## Choose the path -Prompt-format dependency: read the official [MiniMax H3 prompt-writing skill](https://github.com/MiniMax-AI/MiniMax-H3/tree/main/skills/h3-prompt-writing). It can be read directly from the repository; local installation is optional. Before execution, establish the ComfyUI URL, installed node availability, effective Omni deployment settings and task output directory as described in [workflow.md](workflow.md). +- **Reuse an example group.** Read back the example group. Carry over the prompts verbatim, ordered references and asset versions, model parameters, guides, trims, and audio policy. Bind equivalent material in the target project and compare the saved configuration before starting. Surface unsupported fields before execution. +- **Edit or retry part of a group.** Read the target group, the affected segment, and its dependent joins. Follow [review and retry](workflow.md#review-and-retry-a-take) to edit its saved spec or retry a failed Pipeline step and verify the requested change. +- **Plan new footage.** [Check the project and model](workflow.md#1-select-the-project-and-model), [plan source ranges](video-segment.md), then [write Ref2VA prompts](prompt-writing.md). Keep source audio in generation references. -Resolve repository-relative references from this skill directory after resolving any global skill symlink, not from the agent's current working directory. - -Execution boundary: agent → ComfyUI execution API → existing vLLM-Omni nodes → vLLM-Omni video API. The nodes own model requests; the agent does not bypass ComfyUI with a separate generation client. - -For a prompt-only correction to an existing segment, inspect its relevant footage and existing plan; revise the plan only if the observed defect exposes an incorrect boundary or mapping. Do not invent a new segmentation for every wording edit. - -Preserve the user's model, resolution, FPS and fixed seed unless asked to change them. Report written plans and prompts separately from generation and visual acceptance. Keep Markdown paragraphs on single source lines and usage notes brief. +[Save the visible plan and check the Pipeline](workflow.md#save-the-visible-plan-and-check-the-pipeline) before generation. [Execute and review](workflow.md#3-execute-and-review) when authorized. For a plan-only or prompt-only request, stop at that deliverable. Read [failure lessons](pitfall.md) when diagnosing a regression or deciding whether to retry. diff --git a/packages/agent/skills/character-replacement/SKILL.zh.md b/packages/agent/skills/character-replacement/SKILL.zh.md new file mode 100644 index 000000000..1ad0c5a25 --- /dev/null +++ b/packages/agent/skills/character-replacement/SKILL.zh.md @@ -0,0 +1,18 @@ +--- +name: character-replacement +description: 在 OpenDirector 中用 H3 替换源片人物,规划分段、编写 Ref2VA 提示词,并按可见画布计划执行流水线。 +--- + +# 换人 + +> 英文任务请阅读 [SKILL.md](SKILL.md) 及其英文子文档。 + +**[提示词最高原则](prompt-writing.zh.md#最高原则)**:写清哪个源人物对应哪张肖像、要换哪些特征,表演、镜头和场景交给源片,关键遮挡只用一句话说明谁挡在谁前面。 原片人物和肖像目标身份必须分别定义为不同 Subject。逐镜头明确哪些待替换轨迹可见、哪些离画。从多人切到特写时,先查看原片裁切和画面两侧,再写该镜提示词。 + +## 按任务选择路径 + +- **复用示例分组。** 编辑前先读回示例的分组。逐字沿用提示词,保留引用顺序与素材版本、模型参数、导帧、裁切和音轨策略。在目标项目绑定等价素材,启动前回读保存的配置并对照。遇到不支持的字段时,先指出差异。 +- **局部修改或重试分组。** 读取目标分组、目标段及受影响的接缝。按[检查结果与重试](workflow.zh.md#检查结果与重试)修改单段已保存的规格或重试失败步骤,并核验本次要求。 +- **从新素材规划。** [检查项目和模型](workflow.zh.md#1-选择项目和模型),再[规划源片区间](video-segment.zh.md)和[编写 Ref2VA 提示词](prompt-writing.zh.md)。源片段保留原声供生成参考。 + +生成前[保存可见计划并预演流水线](workflow.zh.md#保存可见计划并预演流水线)。获得生成授权后,[启动流水线并检查输出](workflow.zh.md#3-执行并审阅)。只要求计划或提示词时,交付对应内容。排查效果退步或决定是否重试时,读[失败教训](pitfall.zh.md)。 diff --git a/packages/agent/skills/character-replacement/assets/character-replacement-continuation.json b/packages/agent/skills/character-replacement/assets/character-replacement-continuation.json deleted file mode 100644 index 66e4f6959..000000000 --- a/packages/agent/skills/character-replacement/assets/character-replacement-continuation.json +++ /dev/null @@ -1,8134 +0,0 @@ -{ - "id": "001fab76-5b80-4f68-b62f-c1f78760a75c", - "revision": 0, - "last_node_id": 10643, - "last_link_id": 17268, - "nodes": [ - { - "id": 10, - "type": "MarkdownNote", - "pos": [ - -863, - 222 - ], - "size": [ - 771, - 992 - ], - "flags": {}, - "order": 2, - "mode": 0, - "inputs": [], - "outputs": [], - "title": "Character Replacement Guide", - "properties": {}, - "widgets_values": [ - "1. This continuation example is scene-specific, not a universal workflow.\n2. Use the character-replacement skill to inspect new footage, plan segments and update each segment prompt and frame settings.\n3. Configure Global Control, review segment previews, then assemble. Current frame settings assume 24 FPS." - ], - "widgets_values_named": { - "text": "1. Enable the case you want to run; mute the others.\n2. Replace its character images and source video(s).\n3. Update the prompt to say which source person each picture replaces. Keep the existing prompt structure.\n4. In Global Control, set mode, service URL, model, LoRA paths, width, height and fps.\n5. Run and check the preview.\n\nCase03: when changing source clips, update each segment's prompt, duration and guide/trim frames. Its current frame settings use 24 FPS." - }, - "color": "#333", - "bgcolor": "#535353" - }, - { - "id": 10001, - "type": "LoadImage", - "pos": [ - 100, - 2904 - ], - "size": [ - 250, - 314 - ], - "flags": {}, - "order": 8, - "mode": 0, - "inputs": [ - { - "localized_name": "image", - "name": "image", - "type": "COMBO", - "widget": { - "name": "image" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "IMAGE", - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17222, - 17227, - 17228, - 17233, - 17234 - ] - }, - { - "localized_name": "MASK", - "name": "MASK", - "type": "MASK", - "links": [] - } - ], - "title": "Picture1 · center", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "0_jensen_huang.jpeg", - "image" - ], - "widgets_values_named": { - "image": "0_jensen_huang.jpeg", - "upload": "image" - } - }, - { - "id": 10002, - "type": "LoadImage", - "pos": [ - 380, - 2904 - ], - "size": [ - 250, - 314 - ], - "flags": {}, - "order": 9, - "mode": 0, - "inputs": [ - { - "localized_name": "image", - "name": "image", - "type": "COMBO", - "widget": { - "name": "image" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "IMAGE", - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17223, - 17229 - ] - }, - { - "localized_name": "MASK", - "name": "MASK", - "type": "MASK", - "links": [] - } - ], - "title": "Picture2 · right front", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "02_sun_wukong.png", - "image" - ], - "widgets_values_named": { - "image": "02_sun_wukong.png", - "upload": "image" - } - }, - { - "id": 10003, - "type": "LoadImage", - "pos": [ - 660, - 2904 - ], - "size": [ - 250, - 314 - ], - "flags": {}, - "order": 10, - "mode": 0, - "inputs": [ - { - "localized_name": "image", - "name": "image", - "type": "COMBO", - "widget": { - "name": "image" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "IMAGE", - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17224, - 17230 - ] - }, - { - "localized_name": "MASK", - "name": "MASK", - "type": "MASK", - "links": [] - } - ], - "title": "Picture3 · left back", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "03_zhu_bajie.png", - "image" - ], - "widgets_values_named": { - "image": "03_zhu_bajie.png", - "upload": "image" - } - }, - { - "id": 10004, - "type": "LoadImage", - "pos": [ - 940, - 2904 - ], - "size": [ - 250, - 314 - ], - "flags": {}, - "order": 11, - "mode": 0, - "inputs": [ - { - "localized_name": "image", - "name": "image", - "type": "COMBO", - "widget": { - "name": "image" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "IMAGE", - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17225, - 17231 - ] - }, - { - "localized_name": "MASK", - "name": "MASK", - "type": "MASK", - "links": [] - } - ], - "title": "Picture4 · left front", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "04_sha_seng.png", - "image" - ], - "widgets_values_named": { - "image": "04_sha_seng.png", - "upload": "image" - } - }, - { - "id": 10005, - "type": "LoadImage", - "pos": [ - 1220, - 2904 - ], - "size": [ - 250, - 314 - ], - "flags": {}, - "order": 12, - "mode": 0, - "inputs": [ - { - "localized_name": "image", - "name": "image", - "type": "COMBO", - "widget": { - "name": "image" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "IMAGE", - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17226, - 17232 - ] - }, - { - "localized_name": "MASK", - "name": "MASK", - "type": "MASK", - "links": [] - } - ], - "title": "Picture5 · right back", - "properties": { - "Node name for S&R": "LoadImage" - }, - "widgets_values": [ - "05_bai_long_ma (1).png", - "image" - ], - "widgets_values_named": { - "image": "05_bai_long_ma (1).png", - "upload": "image" - } - }, - { - "id": 10006, - "type": "LoadVideo", - "pos": [ - 880, - 3384 - ], - "size": [ - 550, - 460 - ], - "flags": {}, - "order": 13, - "mode": 0, - "inputs": [ - { - "localized_name": "file", - "name": "file", - "type": "COMBO", - "widget": { - "name": "file" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10025 - ] - } - ], - "title": "A · source context", - "properties": { - "Node name for S&R": "LoadVideo" - }, - "widgets_values": [ - "h3-checkpoint3-A-reference.mp4", - "image" - ], - "widgets_values_named": { - "file": "h3-checkpoint3-A-reference.mp4", - "upload": "image" - } - }, - { - "id": 10007, - "type": "LoadVideo", - "pos": [ - 100, - 3384 - ], - "size": [ - 550, - 460 - ], - "flags": {}, - "order": 14, - "mode": 0, - "inputs": [ - { - "localized_name": "file", - "name": "file", - "type": "COMBO", - "widget": { - "name": "file" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10001 - ] - } - ], - "title": "B · source context", - "properties": { - "Node name for S&R": "LoadVideo" - }, - "widgets_values": [ - "h3-checkpoint3-B-reference.mp4", - "image" - ], - "widgets_values_named": { - "file": "h3-checkpoint3-B-reference.mp4", - "upload": "image" - } - }, - { - "id": 10008, - "type": "LoadVideo", - "pos": [ - 1660, - 3384 - ], - "size": [ - 550, - 460 - ], - "flags": {}, - "order": 15, - "mode": 0, - "inputs": [ - { - "localized_name": "file", - "name": "file", - "type": "COMBO", - "widget": { - "name": "file" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10044 - ] - } - ], - "title": "C · source context", - "properties": { - "Node name for S&R": "LoadVideo" - }, - "widgets_values": [ - "h3-checkpoint3-C-reference.mp4", - "image" - ], - "widgets_values_named": { - "file": "h3-checkpoint3-C-reference.mp4", - "upload": "image" - } - }, - { - "id": 10009, - "type": "LoadVideo", - "pos": [ - 2440, - 3384 - ], - "size": [ - 550, - 460 - ], - "flags": {}, - "order": 16, - "mode": 0, - "inputs": [ - { - "localized_name": "file", - "name": "file", - "type": "COMBO", - "widget": { - "name": "file" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10065 - ] - } - ], - "title": "D · source context", - "properties": { - "Node name for S&R": "LoadVideo" - }, - "widgets_values": [ - "h3-checkpoint3-D-reference.mp4", - "image" - ], - "widgets_values_named": { - "file": "h3-checkpoint3-D-reference.mp4", - "upload": "image" - } - }, - { - "id": 10010, - "type": "LoadVideo", - "pos": [ - 3220, - 3384 - ], - "size": [ - 550, - 460 - ], - "flags": {}, - "order": 17, - "mode": 0, - "inputs": [ - { - "localized_name": "file", - "name": "file", - "type": "COMBO", - "widget": { - "name": "file" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "IMAGEUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10082 - ] - } - ], - "title": "E · source context", - "properties": { - "Node name for S&R": "LoadVideo" - }, - "widgets_values": [ - "h3-checkpoint3-E-reference.mp4", - "image" - ], - "widgets_values_named": { - "file": "h3-checkpoint3-E-reference.mp4", - "upload": "image" - } - }, - { - "id": 10016, - "type": "LoadAudio", - "pos": [ - 1550, - 2904 - ], - "size": [ - 440, - 200 - ], - "flags": {}, - "order": 18, - "mode": 0, - "inputs": [ - { - "localized_name": "audio", - "name": "audio", - "type": "COMBO", - "widget": { - "name": "audio" - }, - "link": null - }, - { - "localized_name": "audioUI", - "name": "audioUI", - "type": "AUDIO_UI", - "widget": { - "name": "audioUI" - }, - "link": null - }, - { - "localized_name": "choose file to upload", - "name": "upload", - "type": "AUDIOUPLOAD", - "widget": { - "name": "upload" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "AUDIO", - "name": "AUDIO", - "type": "AUDIO", - "links": [ - 10099 - ] - } - ], - "title": "Original 27s soundtrack", - "properties": { - "Node name for S&R": "LoadAudio" - }, - "widgets_values": [ - "h3-checkpoint3-source.m4a", - "" - ], - "widgets_values_named": { - "audio": "h3-checkpoint3-source.m4a", - "upload": "" - } - }, - { - "id": 10070, - "type": "ConcatenateVideo", - "pos": [ - 1350, - 6114 - ], - "size": [ - 430, - 260 - ], - "flags": {}, - "order": 53, - "mode": 0, - "inputs": [ - { - "localized_name": "video0", - "name": "videos.video0", - "type": "VIDEO", - "link": 10094 - }, - { - "localized_name": "video1", - "name": "videos.video1", - "shape": 7, - "type": "VIDEO", - "link": 10095 - }, - { - "localized_name": "video2", - "name": "videos.video2", - "shape": 7, - "type": "VIDEO", - "link": 10096 - }, - { - "localized_name": "video3", - "name": "videos.video3", - "shape": 7, - "type": "VIDEO", - "link": 10097 - }, - { - "localized_name": "video4", - "name": "videos.video4", - "shape": 7, - "type": "VIDEO", - "link": 10098 - }, - { - "localized_name": "video5", - "name": "videos.video5", - "shape": 7, - "type": "VIDEO", - "link": null - }, - { - "localized_name": "complete_audio", - "name": "complete_audio", - "shape": 7, - "type": "AUDIO", - "link": 10099 - }, - { - "localized_name": "codec", - "name": "codec", - "type": "COMBO", - "widget": { - "name": "codec" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "VIDEO", - "name": "VIDEO", - "type": "VIDEO", - "links": [ - 10100 - ] - } - ], - "properties": { - "Node name for S&R": "ConcatenateVideo" - }, - "widgets_values": [ - "h264" - ], - "widgets_values_named": { - "codec": "h264" - } - }, - { - "id": 10071, - "type": "SaveVideo", - "pos": [ - 1830, - 6114 - ], - "size": [ - 760, - 529 - ], - "flags": {}, - "order": 54, - "mode": 0, - "inputs": [ - { - "localized_name": "video", - "name": "video", - "type": "VIDEO", - "link": 10100 - }, - { - "localized_name": "filename_prefix", - "name": "filename_prefix", - "type": "STRING", - "widget": { - "name": "filename_prefix" - }, - "link": null - }, - { - "localized_name": "format", - "name": "format", - "type": "COMFY_DYNAMICCOMBO_V3", - "widget": { - "name": "format" - }, - "link": null - }, - { - "localized_name": "codec", - "name": "format.codec", - "type": "COMFY_DYNAMICCOMBO_V3", - "widget": { - "name": "format.codec" - }, - "link": null - }, - { - "localized_name": "codec", - "name": "codec", - "shape": 7, - "type": "COMFY_DYNAMICCOMBO_V3", - "widget": { - "name": "codec" - }, - "link": null - } - ], - "outputs": [ - { - "localized_name": "video", - "name": "video", - "type": "VIDEO", - "links": [] - } - ], - "title": "Final · 27s", - "properties": { - "Node name for S&R": "SaveVideo" - }, - "widgets_values": [ - "vllm-omni/MiniMax-H3-Character-Replacement/complete-27s", - "mp4", - "auto", - "auto" - ], - "widgets_values_named": { - "filename_prefix": "vllm-omni/MiniMax-H3-Character-Replacement/complete-27s", - "format": "mp4", - "format.codec": "auto", - "codec": "auto" - }, - "color": "#322", - "bgcolor": "#533" - }, - { - "id": 10078, - "type": "5c86a69e-989e-46c5-88f7-54c95d4da8d3", - "pos": [ - 100, - 4144 - ], - "size": [ - 550, - 1240 - ], - "flags": {}, - "order": 41, - "mode": 0, - "inputs": [ - { - "name": "picture_1", - "shape": 7, - "type": "IMAGE", - "link": 10002 - }, - { - "name": "picture_2", - "shape": 7, - "type": "IMAGE", - "link": 10003 - }, - { - "name": "picture_3", - "shape": 7, - "type": "IMAGE", - "link": 10004 - }, - { - "name": "picture_4", - "shape": 7, - "type": "IMAGE", - "link": 10005 - }, - { - "name": "picture_5", - "shape": 7, - "type": "IMAGE", - "link": 10006 - }, - { - "name": "picture_6", - "shape": 7, - "type": "IMAGE", - "link": null - }, - { - "name": "picture_7", - "shape": 7, - "type": "IMAGE", - "link": null - }, - { - "name": "picture_8", - "shape": 7, - "type": "IMAGE", - "link": null - }, - { - "name": "picture_9", - "shape": 7, - "type": "IMAGE", - "link": null - }, - { - "name": "audio_1", - "shape": 7, - "type": "AUDIO", - "link": null - }, - { - "name": "audio_2", - "shape": 7, - "type": "AUDIO", - "link": null - }, - { - "name": "audio_3", - "shape": 7, - "type": "AUDIO", - "link": null - }, - { - "name": "video_1", - "shape": 7, - "type": "VIDEO", - "link": 10001 - }, - { - "name": "video_2", - "shape": 7, - "type": "VIDEO", - "link": null - }, - { - "name": "video_3", - "shape": 7, - "type": "VIDEO", - "link": null - }, - { - "name": "previous_frames", - "shape": 7, - "type": "IMAGE", - "link": null - }, - { - "name": "url", - "type": "STRING", - "widget": { - "name": "url" - }, - "link": 10007 - }, - { - "name": "model", - "type": "STRING", - "widget": { - "name": "model" - }, - "link": 10008 - }, - { - "name": "prompt", - "type": "STRING", - "widget": { - "name": "prompt" - }, - "link": null - }, - { - "name": "sampling_params", - "shape": 7, - "type": "SAMPLING_PARAMS", - "link": 10011 - }, - { - "name": "model_params", - "shape": 7, - "type": "VIDEO_PARAMS", - "link": 10012 - }, - { - "name": "lora", - "shape": 7, - "type": "REMOTE_LORA", - "link": 10108 - }, - { - "name": "fast_h3", - "shape": 7, - "type": "FASTH3_DEPLOYMENT", - "link": 10109 - }, - { - "name": "use_guides", - "type": "BOOLEAN", - "widget": { - "name": "use_guides" - }, - "link": null - }, - { - "name": "guide_first_frame", - "type": "INT", - "widget": { - "name": "guide_first_frame" - }, - "link": null - }, - { - "name": "guide_last_frame", - "type": "INT", - "widget": { - "name": "guide_last_frame" - }, - "link": null - }, - { - "name": "duration", - "type": "FLOAT", - "widget": { - "name": "duration" - }, - "link": null - }, - { - "name": "raw_frames", - "type": "INT", - "widget": { - "name": "raw_frames" - }, - "link": null - }, - { - "name": "reverse_output", - "type": "BOOLEAN", - "widget": { - "name": "reverse_output" - }, - "link": null - }, - { - "name": "trim_start", - "type": "INT", - "widget": { - "name": "trim_start" - }, - "link": null - }, - { - "name": "keep_frames", - "type": "INT", - "widget": { - "name": "keep_frames" - }, - "link": null - }, - { - "name": "width", - "type": "INT", - "widget": { - "name": "width" - }, - "link": 17250 - }, - { - "name": "height", - "type": "INT", - "widget": { - "name": "height" - }, - "link": 17257 - }, - { - "name": "fps", - "type": "INT", - "widget": { - "name": "fps" - }, - "link": 17264 - } - ], - "outputs": [ - { - "name": "raw_frames", - "type": "IMAGE", - "links": [ - 10020 - ] - }, - { - "name": "frames", - "type": "IMAGE", - "links": [ - 10039 - ] - }, - { - "name": "video", - "type": "VIDEO", - "links": [ - 10118 - ] - } - ], - "properties": { - "Node name for S&R": "5c86a69e-989e-46c5-88f7-54c95d4da8d3", - "previewExposures": [] - }, - "widgets_values": [ - "http://localhost:8000/v1", - "Wan-AI/Wan2.2-T2V-A14B-Diffusers", - "subject_definitions:\n: The person defined by , replacing the central performer originally wearing a pale suit in