Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/desktop/scripts/prepare-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ mkdirSync(wheels, { recursive: true });
run('uv', ['build', '--wheel', '--out-dir', wheels]);
const wheel = readdirSync(wheels).find(name => name.startsWith('opendirector-') && name.endsWith('.whl'));
if (!wheel) throw new Error('OpenDirector wheel was not produced');
run('uv', ['pip', 'install', '--break-system-packages', '--reinstall-package', 'opendirector', '--python', python, join(wheels, wheel)]);
const constraints = join(wheels, 'runtime-constraints.txt');
const lockedRequirements = readFileSync(join(root, 'requirements.txt'), 'utf8');
writeFileSync(constraints, lockedRequirements.replace(/^-e[ \t]+\.[ \t]*(?:\r?\n|$)/m, ''));
run('uv', [
'pip', 'install', '--break-system-packages', '--reinstall-package', 'opendirector',
'--python', python, '--constraint', constraints, join(wheels, wheel),
]);
for (const name of ['ffmpeg', 'ffprobe']) {
const executable = name + (process.platform === 'win32' ? '.exe' : '');
copyFileSync(join(media, executable), join(runtime, 'bin', executable));
Expand Down
8 changes: 8 additions & 0 deletions docs/development/ci-failures.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ The OpenCode hang tracked as #162 is unrelated and was not verified here.

以上用例已于 2026-11-07 登记 watchlist,由 nightly 观测波动率;修复后从 watchlist 与本表移除。

## Canvas pointer tests at reduced zoom

The toolbar top-bar test timed out on both main and PR #689 at 50% zoom. The center of the fixture node was behind the left rail, so the drag pressed Add Text. Use an exposed point on the node and check its hit target before sending pointer input. [Main run](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/47344640055/job/145081431931) · [PR run](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/47378835105/job/145201585744)

## Packaged runtime dependency resolution

A Windows installer rerun and the independent Linux wheel check resolved FastAPI 0.165.1 with OpenTelemetry API 1.46.0. FastAPI passed positional arguments that the newer logging API accepts only as keywords, so HTTP requests returned 500. The wheel declares the compatible OpenTelemetry range until FastAPI supports the new API. Desktop packaging also constrains wheel dependencies to the repository lock. Verify fresh wheel installation and both desktop builds when changing these constraints. [Windows run](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/47382086691/job/145228863573) · [Linux run](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/47389658023/job/145239847848)

## 历史注记

- 2026-11-07 前,Release checks 为单 job 顺序执行:Python 套件失败会静默跳过后续的契约检查、生产构建、wheel 验证与浏览器阶段(#158 之前,run 42224427798 印证)。现各步骤独立运行,失败不再互相掩盖。
Expand Down
1 change: 1 addition & 0 deletions docs/guides/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ The first launch creates an untitled canvas. Later launches can restore the most
- 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.
- To copy nodes between tabs in the same browser profile, select them and press `Ctrl+C` (`⌘C` on Mac). Wait for the copy confirmation, then focus the destination canvas and press `Ctrl+V` (`⌘V` on Mac). If the shortcut is unavailable, right-click the destination canvas and choose **Paste**.
- 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.
Expand Down
1 change: 1 addition & 0 deletions docs/guides/user-guide.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ vLLM-Omni 视频连接支持直接输入小数秒,例如 `6.583333`。CLI 可
- 想看看完整项目时,点击空画布上的“浏览示例画布”,或从项目菜单打开“示例画布”。列表会显示示例大小和下载进度,部分示例也提供手动下载链接。导入后会打开一个新项目。下载包中若只有一个 `.canvas` 文件,会自动解包。若下载返回网页,列表会提示错误。
- 要连接生成模型,打开“设置 → 模型接入”。
- 右键空白画布可新建节点、粘贴、撤销或重做。
- 在同一浏览器配置文件的两个标签页间复制节点时,先选中节点,按 `Ctrl+C`(Mac 上为 `⌘C`)。看到复制提示后,点击目标画布并按 `Ctrl+V`(Mac 上为 `⌘V`)。如果快捷键不可用,可右键点击目标画布并选择“粘贴”。
- 点击左侧“上传”或将文件拖入画布添加素材;“资产库”可选择已有素材。
- 支持单图 HEIC 和 HEIF 照片,不接受多图文件和图像序列。OpenDirector 保留原文件,并生成方向正确、完整分辨率的 PNG 供浏览器显示;下载、画布归档和时间线媒体包均保留原件。文件须能完整解码,且像素总数不超过 2500 万。原件不可用时,导出会报错,不会改用显示预览图。
- 双击节点名称重命名;双击节点内容进入相应编辑或预览界面。
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ mdurl==0.1.2
numpy==2.5.5
# via opendirector (pyproject.toml)
opentelemetry-api==1.45.1
# via fastapi
# via
# opendirector (pyproject.toml)
# fastapi
packaging==26.3
# via pytest
pillow==13.0.0
Expand Down
1 change: 1 addition & 0 deletions scripts/check-browser-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const KNOWN_LANES = new Set(["gate", "extended", ...FIXTURE_LANES, "production",
const welcomeExempt = new Set([
"assistant_activity.mjs",
"bilingual_defaults.mjs",
"canvas_clipboard_order.mjs",
"first_run.mjs",
"model_editor_hosts.mjs",
]);
Expand Down
1 change: 1 addition & 0 deletions src/canvas/clipboardMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export async function transferClipboardMedia(
}
}
}
if (media.projectId === targetProjectId) return copy;
const materialized = new Set<string>();
for (const node of copy.nodes)
if (
Expand Down
130 changes: 130 additions & 0 deletions src/canvas/sharedCanvasClipboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { tNow } from "../i18n/messages.ts";
import type { ClipboardMedia } from "./clipboardMedia.ts";
import type { CanvasFragment } from "./operations.ts";

const DATABASE = "opendirector.canvasClipboard.v1";
const STORE = "clipboard";
const LATEST = "latest";
const CANVAS_CLIPBOARD_TYPE = "application/x-opendirector-canvas";

export interface SharedCanvasClipboard {
id: string;
fragment: CanvasFragment;
media: ClipboardMedia;
}

interface StoredCanvasClipboard
extends Pick<SharedCanvasClipboard, "id" | "fragment"> {
projectId: ClipboardMedia["projectId"];
sources: ClipboardMedia["sources"];
blobs: Map<string, Blob | null>;
}

function withClipboardLock<T>(id: string, operation: () => Promise<T>): Promise<T> {
return navigator.locks
? navigator.locks.request(`${DATABASE}.${id}`, operation)
: operation();
}

async function accessClipboard<T>(
mode: IDBTransactionMode,
access: (store: IDBObjectStore) => IDBRequest<T> | undefined,
): Promise<T | undefined> {
const database = await new Promise<IDBDatabase>((resolve, reject) => {
const request = indexedDB.open(DATABASE, 1);
request.onupgradeneeded = () => request.result.createObjectStore(STORE);
request.onsuccess = () => resolve(request.result);
request.onerror = () => reject(request.error);
});
try {
return await new Promise<T | undefined>((resolve, reject) => {
const transaction = database.transaction(STORE, mode);
const request = access(transaction.objectStore(STORE));
transaction.oncomplete = () => resolve(request?.result);
transaction.onabort = () => reject(transaction.error);
});
} finally {
database.close();
}
}

export function sharedCanvasClipboardId(): string | null {
try {
return localStorage.getItem(DATABASE);
} catch {
return null;
}
}

export function markCanvasClipboard(id: string): void {
const write = (event: ClipboardEvent) => {
if (!event.clipboardData) return;
event.clipboardData.setData(CANVAS_CLIPBOARD_TYPE, id);
event.preventDefault();
};
document.addEventListener("copy", write);
try {
document.execCommand("copy");
} catch {
} finally {
document.removeEventListener("copy", write);
}
}

export function isCanvasClipboard(data: DataTransfer | null): boolean {
const id = data?.getData(CANVAS_CLIPBOARD_TYPE);
return Boolean(id && id === sharedCanvasClipboardId());
}

export async function writeSharedCanvasClipboard({
id,
fragment,
media,
}: SharedCanvasClipboard): Promise<boolean> {
localStorage.setItem(DATABASE, id);
return withClipboardLock(id, async () => {
const blobs = await Promise.all(Array.from(
media.blobs,
async ([src, pending]): Promise<[string, Blob | null]> =>
[src, await pending.catch(() => null)],
));
const stored: StoredCanvasClipboard = {
id,
fragment,
projectId: media.projectId,
sources: media.sources,
blobs: new Map(blobs),
};
const written = await accessClipboard("readwrite", (store) => {
if (sharedCanvasClipboardId() === id) return store.put(stored, LATEST);
});
return written !== undefined;
});
}

export async function readSharedCanvasClipboard(id: string): Promise<SharedCanvasClipboard | null> {
return withClipboardLock(id, async () => {
const stored = await accessClipboard<StoredCanvasClipboard | undefined>(
"readonly",
(store) => store.get(LATEST),
);
if (stored?.id !== id) return null;
return {
id: stored.id,
fragment: stored.fragment,
media: {
projectId: stored.projectId,
blobs: new Map(Array.from(stored.blobs, ([src, blob]) => {
if (blob) return [src, Promise.resolve(blob)];
const unavailable = Promise.reject(new Error(
tNow("errors.files.clipboardRead"),
));
void unavailable.catch(() => {});
return [src, unavailable];
})),
sources: stored.sources,
registered: new Map(),
},
};
});
}
3 changes: 2 additions & 1 deletion src/canvas/workspace/WorkspaceView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import { TextNodeComposer } from "../TextNodeComposer";
import "../themes.css";
import { TimelineEditor } from "../TimelineEditor";
import { TimelineOutputShortcut, useTimelineOutput } from "../TimelineOutput";
import { sharedCanvasClipboardId } from "../sharedCanvasClipboard.ts";
import { CANVAS_TOOLS, createCanvasToolTask, initialToolParameters } from "../toolCatalog";
import { imagePresetsFromFields } from "../promptSkill.ts";

Expand Down Expand Up @@ -2178,7 +2179,7 @@ export function WorkspaceView({ rt, editingState, editSession }: {
x={menu.x}
y={menu.y}
mode={menu.mode ?? "context"}
canPaste={Boolean(clipboard.current?.nodes.length)}
canPaste={Boolean(clipboard.current || sharedCanvasClipboardId())}
canUndo={businessHistory.undo && !historyReplaying}
canRedo={businessHistory.redo && !historyReplaying}
onCreate={(kind) => addNode(kind, menu.world)}
Expand Down
7 changes: 2 additions & 5 deletions src/canvas/workspace/useWorkspaceRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { validateNodeActionSource, type ResultSource } from "../linkedResults";
import { newNodeGenerationSettings } from "../modelResolution.ts";
import { preferredMediaModel } from "../agentPreferences.ts";
import { type CanvasDocument, type CanvasNode, type CanvasNodeData, type CanvasNodeKind, type Point } from "../model";
import { type CanvasFragment } from "../operations";
import { type ClipboardMedia } from "../clipboardMedia.ts";
import type { SharedCanvasClipboard } from "../sharedCanvasClipboard.ts";

import { CanvasPointerGesture } from "../pointerGesture";
import { type SubjectMediaSlot } from "../subjectMedia.ts";
Expand Down Expand Up @@ -213,8 +212,7 @@ export function useWorkspaceRuntime(): WorkspaceRuntime {
),
[activeGenerations, doc.id, doc.nodes, jobs],
);
const clipboard = useRef<CanvasFragment | null>(null);
const clipboardMedia = useRef<ClipboardMedia | null>(null);
const clipboard = useRef<SharedCanvasClipboard | null>(null);
const pasting = useRef(false);
const pasteCount = useRef(0);
const fileInput = useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -371,7 +369,6 @@ export function useWorkspaceRuntime(): WorkspaceRuntime {
runtime.serviceRuns = serviceRuns;
runtime.generationByNode = generationByNode;
runtime.clipboard = clipboard;
runtime.clipboardMedia = clipboardMedia;
runtime.pasting = pasting;
runtime.pasteCount = pasteCount;
runtime.fileInput = fileInput;
Expand Down
Loading
Loading