From ae2e3d3c0615b6e616ee9ec8525462d3d1b6e8ca Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 18:14:19 +0800 Subject: [PATCH 01/31] [feat] desktop: add a bundled application and project sidebar Signed-off-by: Weiming Liao --- .github/workflows/desktop.yml | 21 + .gitignore | 2 + apps/api/src/opendirector_api/agent.py | 5 +- apps/api/src/opendirector_api/desktop.py | 176 + apps/api/src/opendirector_api/localization.py | 1 + apps/api/src/opendirector_api/main.py | 12 +- apps/desktop/package-lock.json | 3599 +++++++++++++++++ apps/desktop/package.json | 57 + apps/desktop/scripts/prepare-runtime.mjs | 49 + apps/desktop/scripts/smoke.mjs | 26 + apps/desktop/src/command.mjs | 24 + apps/desktop/src/host.mjs | 115 + apps/desktop/src/locale.mjs | 23 + apps/desktop/src/main.mjs | 301 ++ apps/desktop/src/preload.cjs | 19 + apps/desktop/tests/host.test.mjs | 80 + apps/desktop/tests/packaged-host.test.mjs | 59 + docs/README.md | 1 + docs/development/desktop.md | 33 + docs/development/desktop.zh-CN.md | 33 + packages/core/src/opendirector/cli.py | 9 + src/backend/api.ts | 1 + src/canvas/desktop-chrome.css | 201 + src/canvas/timelineRender.ts | 3 + src/canvas/workspace/DesktopSidebar.tsx | 40 + src/canvas/workspace/WorkspaceView.tsx | 43 +- src/desktop.ts | 23 + src/i18n/I18nProvider.tsx | 2 + src/i18n/messages/en-US/canvasShell.ts | 2 + src/i18n/messages/zh-CN/canvasShell.ts | 2 + tests/desktop.test.ts | 19 + tests/test_desktop_host.py | 60 + 32 files changed, 5023 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/desktop.yml create mode 100644 apps/api/src/opendirector_api/desktop.py create mode 100644 apps/desktop/package-lock.json create mode 100644 apps/desktop/package.json create mode 100644 apps/desktop/scripts/prepare-runtime.mjs create mode 100644 apps/desktop/scripts/smoke.mjs create mode 100644 apps/desktop/src/command.mjs create mode 100644 apps/desktop/src/host.mjs create mode 100644 apps/desktop/src/locale.mjs create mode 100644 apps/desktop/src/main.mjs create mode 100644 apps/desktop/src/preload.cjs create mode 100644 apps/desktop/tests/host.test.mjs create mode 100644 apps/desktop/tests/packaged-host.test.mjs create mode 100644 docs/development/desktop.md create mode 100644 docs/development/desktop.zh-CN.md create mode 100644 src/canvas/desktop-chrome.css create mode 100644 src/canvas/workspace/DesktopSidebar.tsx create mode 100644 src/desktop.ts create mode 100644 tests/desktop.test.ts create mode 100644 tests/test_desktop_host.py diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml new file mode 100644 index 000000000..766a48fb3 --- /dev/null +++ b/.github/workflows/desktop.yml @@ -0,0 +1,21 @@ +name: Desktop checks +on: + pull_request: + paths: + - 'apps/desktop/**' + - 'apps/api/src/opendirector_api/desktop.py' + - 'tests/test_desktop_host.py' + - '.github/workflows/desktop.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + shell: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: .nvmrc + - run: npm ci --ignore-scripts --prefix apps/desktop + - run: npm test --prefix apps/desktop diff --git a/.gitignore b/.gitignore index e6904708a..791b20f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,5 @@ __pycache__/ /build/ /packages/core/src/opendirector/_bundled/ +/apps/desktop/runtime/ +/apps/desktop/build/ diff --git a/apps/api/src/opendirector_api/agent.py b/apps/api/src/opendirector_api/agent.py index 7ef36a60b..a3187a197 100644 --- a/apps/api/src/opendirector_api/agent.py +++ b/apps/api/src/opendirector_api/agent.py @@ -232,7 +232,7 @@ async def follow(self): await self.changed.wait() -def agent_routes(projects, generation, configs, provider=None) -> APIRouter: +def agent_routes(projects, generation, configs, provider=None, *, active=None) -> APIRouter: router = APIRouter(prefix='/api/creation/projects/{project_id}/assistant') conversations = Conversations(projects) runtimes = AgentRuntimes(projects, generation, configs, provider) @@ -257,7 +257,8 @@ def trace(project_id: UUID, turn_id: UUID, raise ProjectError('轨迹文件不存在。', 404) return FileResponse(file, media_type='text/plain', headers={'Cache-Control': 'no-store'}) - active: dict[UUID, tuple[UUID, asyncio.Task, RunEvents]] = {} + if active is None: + active = {} admission: dict[UUID, asyncio.Lock] = {} @router.get('') diff --git a/apps/api/src/opendirector_api/desktop.py b/apps/api/src/opendirector_api/desktop.py new file mode 100644 index 000000000..41ca054a1 --- /dev/null +++ b/apps/api/src/opendirector_api/desktop.py @@ -0,0 +1,176 @@ +"""Private parent-controlled API host for the desktop application.""" +import asyncio +from contextlib import redirect_stdout +import json +import logging +import os +import secrets +import shutil +import socket +import subprocess +import sys +import threading +from typing import Annotated, Literal +from uuid import UUID + +from pydantic import BaseModel, ConfigDict, Field, TypeAdapter +import uvicorn +from starlette.responses import JSONResponse +from starlette.types import ASGIApp, Scope, Receive, Send +from starlette.requests import Request + +from opendirector_api.localization import localized_error + +from opendirector.infrastructure.local_projects import LocalProjects +from opendirector.installation import data_root +from opendirector_api.main import create_app +from opendirector_api.server import logging_config + + +class DesktopAuthentication: + """Protect every HTTP resource, including media and the application document.""" + + def __init__(self, app: ASGIApp, *, token: str) -> None: + self.app = app + self.token = token + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + headers = dict(scope.get('headers', [])) + supplied = headers.get(b'x-opendirector-desktop', b'') + if not secrets.compare_digest(supplied, self.token.encode('ascii')): + if scope['type'] == 'websocket': + await send({'type': 'websocket.close', 'code': 1008}) + elif scope['type'] == 'http': + await JSONResponse({'detail': localized_error(Request(scope), chinese='桌面连接已失效,请重新打开应用。', status=403, code='desktop_auth_required')}, status_code=403)(scope, receive, send) + else: + await self.app(scope, receive, send) + return + await self.app(scope, receive, send) + + +class Initialize(BaseModel): + model_config = ConfigDict(extra='forbid') + type: Literal['initialize'] + version: Literal[1] + token: str = Field(min_length=64, max_length=64, pattern=r'^[a-f0-9]+$') + + +class Control(BaseModel): + model_config = ConfigDict(extra='forbid') + type: Literal['inspect', 'shutdown'] + requestId: int = Field(ge=1) + + +class SessionRegistration(BaseModel): + model_config = ConfigDict(extra='forbid') + type: Literal['session'] + sessionId: UUID + + +CONTROL = TypeAdapter(Annotated[Control | SessionRegistration, Field(discriminator='type')]) + + +def runtime_check() -> dict[str, str]: + from opendirector.agent.native import executable + from opendirector.installation import web_root + if not (web_root() / 'index.html').is_file(): + raise RuntimeError('Web resources are missing.') + commands = {'agent': executable('default'), 'ffmpeg': shutil.which('ffmpeg'), 'ffprobe': shutil.which('ffprobe')} + versions = {'python': sys.version.split()[0]} + for name, path in commands.items(): + if not path: + raise RuntimeError(f'{name} is missing from the bundled runtime.') + result = subprocess.run([path, '--version' if name == 'agent' else '-version'], + capture_output=True, text=True, timeout=20, check=True) + versions[name] = result.stdout.splitlines()[0] + return versions + + +async def serve(token: str) -> None: + output = sys.stdout + + def emit(event: dict[str, object]) -> None: + output.write(json.dumps(event) + '\n') + output.flush() + + emit({'type': 'starting', 'version': 1}) + with redirect_stdout(sys.stderr): + versions = await asyncio.to_thread(runtime_check) + store = LocalProjects(data_root()) + app = create_app(store) + app.add_middleware(DesktopAuthentication, token=token) + listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + listener.bind(('127.0.0.1', 0)) + listener.listen(128) + port = listener.getsockname()[1] + os.environ['OPENDIRECTOR_API_URL'] = f'http://127.0.0.1:{port}' + sessions: set[str] = set() + commands: asyncio.Queue[str] = asyncio.Queue() + loop = asyncio.get_running_loop() + + def read_controls() -> None: + while line := sys.stdin.readline(65537): + if len(line) > 65536: + loop.call_soon_threadsafe(commands.put_nowait, 'invalid\n') + return + loop.call_soon_threadsafe(commands.put_nowait, line) + loop.call_soon_threadsafe(commands.put_nowait, '') + + class DesktopServer(uvicorn.Server): + async def startup(self, sockets: list[socket.socket] | None = None) -> None: + await super().startup(sockets) + if not self.should_exit: + emit({'type': 'ready', 'version': 1, 'url': f'http://127.0.0.1:{port}', 'runtime': versions}) + + server = DesktopServer(uvicorn.Config(app, log_config=logging_config(), access_log=False, + timeout_graceful_shutdown=15)) + + async def control() -> None: + while True: + line = await commands.get() + if not line: + server.should_exit = True + return + message = CONTROL.validate_json(line) + if message.type == 'session': + sessions.add(str(message.sessionId)) + continue + if message.type == 'shutdown': + server.should_exit = True + return + emit({'type': 'inspection', 'requestId': message.requestId, **app.state.desktop_activity()}) + + threading.Thread(target=read_controls, name='desktop-parent', daemon=True).start() + reader = asyncio.create_task(control()) + try: + serving = asyncio.create_task(server.serve(sockets=[listener])) + done, _ = await asyncio.wait([reader, serving], return_when=asyncio.FIRST_COMPLETED) + if reader in done and not reader.cancelled() and reader.exception(): + server.should_exit = True + await serving + raise reader.exception() + await serving + finally: + reader.cancel() + await asyncio.gather(reader, return_exceptions=True) + listener.close() + for session_id in sessions: + await asyncio.to_thread(store.release, session_id) + emit({'type': 'shutdown-complete'}) + + +def main() -> None: + try: + message = Initialize.model_validate_json(sys.stdin.readline(65537)) + asyncio.run(serve(message.token)) + except ValueError: + print(json.dumps({'type': 'fatal', 'version': 1, 'message': 'Invalid desktop control message.'}), flush=True) + raise SystemExit(1) from None + except (OSError, RuntimeError, subprocess.SubprocessError) as error: + logging.getLogger(__name__).exception('Desktop Host failed') + print(json.dumps({'type': 'fatal', 'version': 1, 'message': str(error)}), flush=True) + raise SystemExit(1) from error + + +if __name__ == '__main__': + main() diff --git a/apps/api/src/opendirector_api/localization.py b/apps/api/src/opendirector_api/localization.py index 070df2a2a..a25252126 100644 --- a/apps/api/src/opendirector_api/localization.py +++ b/apps/api/src/opendirector_api/localization.py @@ -12,6 +12,7 @@ from opendirector.domain.creation.commands import CommandReceipt ENGLISH_BY_CODE = { + "desktop_auth_required": "The desktop connection has expired. Reopen the application.", '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.', diff --git a/apps/api/src/opendirector_api/main.py b/apps/api/src/opendirector_api/main.py index bb31390d3..d92e6347f 100644 --- a/apps/api/src/opendirector_api/main.py +++ b/apps/api/src/opendirector_api/main.py @@ -53,6 +53,8 @@ def create_app(store: LocalProjects | None = None, chat_provider=None, generatio creation_tools = ToolTasks(store, model_configs, CreationToolAssets(creation_projects), projects=creation_projects) catalog = ModelCatalog(model_configs, chat_provider or ChatCompletions()) + active_agents = {} + @asynccontextmanager async def lifespan(app): await creation_generation.start() @@ -60,6 +62,10 @@ async def lifespan(app): await creation_tools.start() yield finally: + agents = [entry[1] for entry in list(active_agents.values())] + for agent in agents: + agent.cancel() + await asyncio.gather(*agents, return_exceptions=True) try: await creation_tools.close() finally: @@ -67,9 +73,13 @@ async def lifespan(app): app = FastAPI(title="OpenDirector Local API", version="0.1.4", lifespan=lifespan) app.include_router(creation_routes(creation_projects, creation_generation)) - app.include_router(agent_routes(creation_projects, creation_generation, model_configs, chat_provider)) + app.include_router(agent_routes(creation_projects, creation_generation, model_configs, chat_provider, active=active_agents)) app.include_router(library_routes(creation_projects)) app.include_router(voice_routes(creation_generation.voices)) + app.state.desktop_activity = lambda: dict( + agents=len(active_agents), generations=sum(not job.future.done() for job in creation_generation.jobs.values()), + tools=sum(not job.done() for job in creation_tools.jobs.values())) + @app.exception_handler(RequestValidationError) async def invalid_request(request, error): diff --git a/apps/desktop/package-lock.json b/apps/desktop/package-lock.json new file mode 100644 index 000000000..d6b64b6aa --- /dev/null +++ b/apps/desktop/package-lock.json @@ -0,0 +1,3599 @@ +{ + "name": "@opendirector/desktop", + "version": "0.1.4", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@opendirector/desktop", + "version": "0.1.4", + "dependencies": { + "zod": "4.4.3" + }, + "devDependencies": { + "electron": "45.3.3", + "electron-builder": "26.18.0" + } + }, + "node_modules/@electron-internal/extract-zip": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/@electron-internal/extract-zip/-/extract-zip-1.0.8.tgz", + "integrity": "sha512-8iajeLFbzNwM0m3AsQZSZgYREWglAImyGvvFSWU34FgMW8sHlzdwj9QKvv9dgN7jMP591EFUF/sLOC3Jl9YIjQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/@electron/asar": { + "version": "3.4.1", + "resolved": "https://registry.npmmirror.com/@electron/asar/-/asar-3.4.1.tgz", + "integrity": "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^5.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.4" + }, + "bin": { + "asar": "bin/asar.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/@electron/asar/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@electron/asar/node_modules/brace-expansion": { + "version": "1.1.22", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@electron/asar/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@electron/fuses": { + "version": "1.8.0", + "resolved": "https://registry.npmmirror.com/@electron/fuses/-/fuses-1.8.0.tgz", + "integrity": "sha512-zx0EIq78WlY/lBb1uXlziZmDZI4ubcCXIMJ4uGjXzZW0nS19TjSPeXPAjzzTmKQlJUZm0SbmZhPKP7tuQ1SsEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.1", + "fs-extra": "^9.0.1", + "minimist": "^1.2.5" + }, + "bin": { + "electron-fuses": "dist/bin.js" + } + }, + "node_modules/@electron/fuses/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/get": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/@electron/get/-/get-5.1.0.tgz", + "integrity": "sha512-3kSBtG8ObcTVfXanm5vVJ6UnBLEVmVsRk1M+vGqCuMBV+XLCbJYuWQful+yIy0GQDsSlK0kHEriEHn7SPk4EnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "env-paths": "^3.0.0", + "graceful-fs": "^4.2.11", + "progress": "^2.0.3", + "semver": "^7.6.3", + "sumchecker": "^3.0.1" + }, + "engines": { + "node": ">=22.12.0" + }, + "optionalDependencies": { + "undici": "^7.24.4" + } + }, + "node_modules/@electron/notarize": { + "version": "2.5.0", + "resolved": "https://registry.npmmirror.com/@electron/notarize/-/notarize-2.5.0.tgz", + "integrity": "sha512-jNT8nwH1f9X5GEITXaQ8IF/KdskvIkOFfB2CvwumsveVidzpSc+mvhhTMdAGSYF3O+Nq49lJ7y+ssODRXu06+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/notarize/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/osx-sign": { + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/@electron/osx-sign/-/osx-sign-1.3.3.tgz", + "integrity": "sha512-KZ8mhXvWv2rIEgMbWZ4y33bDHyUKMXnx4M0sTyPNK/vcB81ImdeY9Ggdqy0SWbMDgmbqyQ+phgejh6V3R2QuSg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "compare-version": "^0.1.2", + "debug": "^4.3.4", + "fs-extra": "^10.0.0", + "isbinaryfile": "^4.0.8", + "minimist": "^1.2.6", + "plist": "^3.0.5" + }, + "bin": { + "electron-osx-flat": "bin/electron-osx-flat.js", + "electron-osx-sign": "bin/electron-osx-sign.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@electron/osx-sign/node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmmirror.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/@electron/rebuild": { + "version": "4.2.1", + "resolved": "https://registry.npmmirror.com/@electron/rebuild/-/rebuild-4.2.1.tgz", + "integrity": "sha512-IS4pG3BysRrCLJ8xTAfvg+IQDbiUoAzdJy2SfjcYKnLDy5DpCdjnPdhS5Zf5UMfrkB24xu0KC+TqcOxg+eG+6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@malept/cross-spawn-promise": "^2.0.0", + "debug": "^4.1.1", + "node-abi": "^4.2.0", + "node-api-version": "^0.2.1", + "node-gyp": "^12.2.0", + "read-binary-file-arch": "^1.0.6" + }, + "bin": { + "electron-rebuild": "lib/cli.js" + }, + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/@electron/universal": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/@electron/universal/-/universal-2.0.3.tgz", + "integrity": "sha512-Wn9sPYIVFRFl5HmwMJkARCCf7rqK/EurkfQ/rJZ14mHP3iYTjZSIOSVonEAnhWeAXwtw7zOekGRlc6yTtZ0t+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron/asar": "^3.3.1", + "@malept/cross-spawn-promise": "^2.0.0", + "debug": "^4.3.1", + "dir-compare": "^4.2.0", + "fs-extra": "^11.1.1", + "minimatch": "^9.0.3", + "plist": "^3.1.0" + }, + "engines": { + "node": ">=16.4" + } + }, + "node_modules/@electron/universal/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@electron/universal/node_modules/brace-expansion": { + "version": "2.1.8", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@electron/universal/node_modules/fs-extra": { + "version": "11.4.1", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-11.4.1.tgz", + "integrity": "sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@electron/universal/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@electron/windows-sign": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/@electron/windows-sign/-/windows-sign-1.2.2.tgz", + "integrity": "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "dependencies": { + "cross-dirname": "^0.1.0", + "debug": "^4.3.4", + "fs-extra": "^11.1.1", + "minimist": "^1.2.8", + "postject": "^1.0.0-alpha.6" + }, + "bin": { + "electron-windows-sign": "bin/electron-windows-sign.js" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@electron/windows-sign/node_modules/fs-extra": { + "version": "11.4.1", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-11.4.1.tgz", + "integrity": "sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@malept/cross-spawn-promise": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz", + "integrity": "sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/malept" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" + } + ], + "license": "Apache-2.0", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/@malept/flatpak-bundler": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/@malept/flatpak-bundler/-/flatpak-bundler-0.4.0.tgz", + "integrity": "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.0", + "lodash": "^4.17.15", + "tmp-promise": "^3.0.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@peculiar/asn1-schema": { + "version": "2.11.1", + "resolved": "https://registry.npmmirror.com/@peculiar/asn1-schema/-/asn1-schema-2.11.1.tgz", + "integrity": "sha512-jaU9OaCcbZUdyXx9hMETZB9xoNmxTGjOGFqd3cOwKFkpKnyKd9WxF3uqj4PvX4cyOMP9bSdHg5YyML2qtx/d/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@peculiar/utils": "^2.0.2", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@peculiar/json-schema": { + "version": "1.1.12", + "resolved": "https://registry.npmmirror.com/@peculiar/json-schema/-/json-schema-1.1.12.tgz", + "integrity": "sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@peculiar/utils": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/@peculiar/utils/-/utils-2.0.3.tgz", + "integrity": "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.8.1" + } + }, + "node_modules/@peculiar/webcrypto": { + "version": "1.7.2", + "resolved": "https://registry.npmmirror.com/@peculiar/webcrypto/-/webcrypto-1.7.2.tgz", + "integrity": "sha512-ktTSACRJ5WdpfjHjFT2EWJQQPacGv1cPCDfEbdmpAHOxdFiYqPe4lfnXGA3D8Dg9/0kHPYSvyRlgujIOVlTdvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.7.0", + "@peculiar/json-schema": "^1.1.12", + "@peculiar/utils": "^2.0.2", + "tslib": "^2.8.1", + "webcrypto-core": "^1.9.2" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmmirror.com/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmmirror.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmmirror.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmmirror.com/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/fs-extra": { + "version": "9.0.13", + "resolved": "https://registry.npmmirror.com/@types/fs-extra/-/fs-extra-9.0.13.tgz", + "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmmirror.com/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.19.2", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-24.19.2.tgz", + "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@types/responselike/-/responselike-1.0.3.tgz", + "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.15", + "resolved": "https://registry.npmmirror.com/@xmldom/xmldom/-/xmldom-0.8.15.tgz", + "integrity": "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/abbrev": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-4.0.0.tgz", + "integrity": "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/app-builder-lib": { + "version": "26.18.0", + "resolved": "https://registry.npmmirror.com/app-builder-lib/-/app-builder-lib-26.18.0.tgz", + "integrity": "sha512-lx+KkuCSZHcbECf4R3IAcC9VOFk0+cMUwljO63s5y8yqS1Lw0sRGmjPaWsPwP3zv3ohZYbMhUvjXeiQXXZhJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron/asar": "3.4.1", + "@electron/fuses": "^1.8.0", + "@electron/get": "^3.0.0", + "@electron/notarize": "2.5.0", + "@electron/osx-sign": "1.3.3", + "@electron/rebuild": "^4.2.1", + "@electron/universal": "2.0.3", + "@malept/flatpak-bundler": "^0.4.0", + "@noble/hashes": "^1.8.0", + "@peculiar/webcrypto": "^1.7.1", + "@types/fs-extra": "9.0.13", + "ajv": "^8.18.0", + "asn1js": "^3.0.10", + "async-exit-hook": "^2.0.1", + "builder-util": "26.16.0", + "builder-util-runtime": "9.7.0", + "chromium-pickle-js": "^0.2.0", + "ci-info": "4.3.1", + "debug": "^4.3.4", + "dotenv": "^16.4.5", + "dotenv-expand": "^11.0.6", + "ejs": "^3.1.8", + "electron-publish": "26.18.0", + "fs-extra": "^10.1.0", + "hosted-git-info": "^4.1.0", + "isbinaryfile": "^5.0.0", + "jiti": "^2.4.2", + "js-yaml": "^4.1.0", + "json5": "^2.2.3", + "lazy-val": "^1.0.5", + "minimatch": "^10.2.5", + "pkijs": "^3.4.0", + "plist": "3.1.0", + "proper-lockfile": "^4.1.2", + "resedit": "^1.7.0", + "semver": "~7.7.3", + "tar": "^7.5.7", + "temp-file": "^3.4.0", + "tiny-async-pool": "1.3.0", + "unzipper": "^0.12.3", + "which": "^5.0.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "dmg-builder": "26.18.0", + "electron-builder-squirrel-windows": "26.18.0" + } + }, + "node_modules/app-builder-lib/node_modules/@electron/get": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/@electron/get/-/get-3.1.0.tgz", + "integrity": "sha512-F+nKc0xW+kVbBRhFzaMgPy3KwmuNTYX1fx6+FxxoSnNgwYX6LD7AKBTWkU0MQ6IBoe7dz069CNkR673sPAgkCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "got": "^11.8.5", + "progress": "^2.0.3", + "semver": "^6.2.0", + "sumchecker": "^3.0.1" + }, + "engines": { + "node": ">=14" + }, + "optionalDependencies": { + "global-agent": "^3.0.0" + } + }, + "node_modules/app-builder-lib/node_modules/@electron/get/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/app-builder-lib/node_modules/@electron/get/node_modules/semver": { + "version": "6.3.2", + "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/app-builder-lib/node_modules/ci-info": { + "version": "4.3.1", + "resolved": "https://registry.npmmirror.com/ci-info/-/ci-info-4.3.1.tgz", + "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/app-builder-lib/node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/app-builder-lib/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/app-builder-lib/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/app-builder-lib/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/asn1js": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/asn1js/-/asn1js-3.1.0.tgz", + "integrity": "sha512-HWYi1THkOqguCiO+vwj09ZkQFD2kKEsejYHAYCtX0D80WVdoDnvRc9IukXX/jeb0T9NRWJnRtqwdbHltnFjwXA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "pvtsutils": "^1.3.6", + "pvutils": "^1.2.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, + "node_modules/async-exit-hook": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/async-exit-hook/-/async-exit-hook-2.0.1.tgz", + "integrity": "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/aws4": { + "version": "1.13.2", + "resolved": "https://registry.npmmirror.com/aws4/-/aws4-1.13.2.tgz", + "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", + "dev": true, + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/brace-expansion": { + "version": "5.0.13", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-5.0.13.tgz", + "integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/builder-util": { + "version": "26.16.0", + "resolved": "https://registry.npmmirror.com/builder-util/-/builder-util-26.16.0.tgz", + "integrity": "sha512-RLyJhB7Si3YkzKR9ubQslWuXW3Vhs3CGe1i+SeixBZ0qTd1mk3XBmssvY22TlB6CS5blyko8Gu1JzpYk8UkYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/debug": "^4.1.6", + "builder-util-runtime": "9.7.0", + "chalk": "^4.1.2", + "cross-spawn": "^7.0.6", + "debug": "^4.3.4", + "fs-extra": "^10.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "js-yaml": "^4.1.0", + "sanitize-filename": "^1.6.3", + "source-map-support": "^0.5.19", + "stat-mode": "^1.0.0", + "temp-file": "^3.4.0", + "tiny-async-pool": "1.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/builder-util-runtime": { + "version": "9.7.0", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.7.0.tgz", + "integrity": "sha512-g/kR520giAFYkSXTzcmF3kqQq7wi8F6N6SzeDgZrqTBN+VHdmgWOyTdD1yD7AATDId/yXLvuP34CxW46/BwCdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/bytestreamjs": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/bytestreamjs/-/bytestreamjs-2.0.1.tgz", + "integrity": "sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmmirror.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmmirror.com/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/chromium-pickle-js": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha512-1R5Fho+jBq0DDydt+/vHWj5KJNJCKdARKOCwZUen84I5BreWoLqRLANH1U87eJy1tiASPtMnGqJJq0ZsLoRPOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ci-info": { + "version": "4.5.0", + "resolved": "https://registry.npmmirror.com/ci-info/-/ci-info-4.5.0.tgz", + "integrity": "sha512-d1uM8k5UZEyPza1n/MG3ko8nKupKN0KJpFsipgPcgaCCvV+IqIfJ+NzTjetlLM+UcXZx3+cLrNr76+eAO7G1Mw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmmirror.com/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/compare-version": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/compare-version/-/compare-version-0.1.2.tgz", + "integrity": "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-dirname": { + "version": "0.1.0", + "resolved": "https://registry.npmmirror.com/cross-dirname/-/cross-dirname-0.1.0.tgz", + "integrity": "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/dir-compare": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/dir-compare/-/dir-compare-4.2.0.tgz", + "integrity": "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimatch": "^3.0.5", + "p-limit": "^3.1.0 " + } + }, + "node_modules/dir-compare/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/dir-compare/node_modules/brace-expansion": { + "version": "1.1.22", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/dir-compare/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/dmg-builder": { + "version": "26.18.0", + "resolved": "https://registry.npmmirror.com/dmg-builder/-/dmg-builder-26.18.0.tgz", + "integrity": "sha512-ozCGC54wi2C1RkS2v69y9lQxvoQ1Coh+iT8CmWiyY8y1ZuOKVvuNson2Hd+HEOs9+EZNNsOBbzKgQZ4SNqWd0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "26.18.0", + "builder-util": "26.16.0", + "fs-extra": "^10.1.0", + "js-yaml": "^4.1.0" + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-expand": { + "version": "11.0.7", + "resolved": "https://registry.npmmirror.com/dotenv-expand/-/dotenv-expand-11.0.7.tgz", + "integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dotenv": "^16.4.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmmirror.com/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmmirror.com/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron": { + "version": "45.3.3", + "resolved": "https://registry.npmmirror.com/electron/-/electron-45.3.3.tgz", + "integrity": "sha512-YS01j/AMWGbPAfbXijkLOUJGFhmrIg6pf9An8+LzY1PIc5sjwqEcSMsEBXgUQiWw1lSfPCP7RpxbvkN1JQRD8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron-internal/extract-zip": "^1.0.1", + "@electron/get": "^5.0.0", + "@types/node": "^24.9.0" + }, + "bin": { + "electron": "cli.js", + "install-electron": "install.js" + }, + "engines": { + "node": ">= 22.12.0" + } + }, + "node_modules/electron-builder": { + "version": "26.18.0", + "resolved": "https://registry.npmmirror.com/electron-builder/-/electron-builder-26.18.0.tgz", + "integrity": "sha512-ASgIuQnOq4RuD8jMhS9hI0LS3EMRT1I/M5R6utqifB/BHN80IcCjBdt+DED+NmNPvmBgEtrlExXZitNdA7kXOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "app-builder-lib": "26.18.0", + "builder-util": "26.16.0", + "builder-util-runtime": "9.7.0", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "dmg-builder": "26.18.0", + "fs-extra": "^10.1.0", + "lazy-val": "^1.0.5", + "simple-update-notifier": "2.0.0", + "yargs": "^17.6.2" + }, + "bin": { + "electron-builder": "cli.js", + "install-app-deps": "install-app-deps.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/electron-builder-squirrel-windows": { + "version": "26.18.0", + "resolved": "https://registry.npmmirror.com/electron-builder-squirrel-windows/-/electron-builder-squirrel-windows-26.18.0.tgz", + "integrity": "sha512-a2elgTipboXNIsxqS1HOmHMGp4Pd3LJgIZOdIFTOskBSawvxKyZWYWQ1d7KKA4CtINSchYCYEKzhxRqiKZev9Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "app-builder-lib": "26.18.0", + "builder-util": "26.16.0", + "electron-winstaller": "5.4.0" + } + }, + "node_modules/electron-publish": { + "version": "26.18.0", + "resolved": "https://registry.npmmirror.com/electron-publish/-/electron-publish-26.18.0.tgz", + "integrity": "sha512-MagnqaZSALSWjcdKu5HEVhYUZD/2BDL3q7XzrqWwub6gf/UfD3ItMgmthVDv9w5y9E0gH1C3JWqKaXwf6f4ROg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/fs-extra": "^9.0.11", + "aws4": "^1.13.2", + "builder-util": "26.16.0", + "builder-util-runtime": "9.7.0", + "chalk": "^4.1.2", + "form-data": "^4.0.5", + "fs-extra": "^10.1.0", + "lazy-val": "^1.0.5", + "mime": "^2.5.2" + } + }, + "node_modules/electron-winstaller": { + "version": "5.4.0", + "resolved": "https://registry.npmmirror.com/electron-winstaller/-/electron-winstaller-5.4.0.tgz", + "integrity": "sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@electron/asar": "^3.2.1", + "debug": "^4.1.1", + "fs-extra": "^7.0.1", + "lodash": "^4.17.21", + "temp": "^0.9.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "optionalDependencies": { + "@electron/windows-sign": "^1.1.2" + } + }, + "node_modules/electron-winstaller/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/electron-winstaller/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/electron-winstaller/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/env-paths/-/env-paths-3.0.0.tgz", + "integrity": "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/exponential-backoff": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/exponential-backoff/-/exponential-backoff-3.1.3.tgz", + "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "resolved": "https://registry.npmmirror.com/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/filelist": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.6.tgz", + "integrity": "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.1.8", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.9", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.9.tgz", + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmmirror.com/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.22", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/global-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/global-agent/-/global-agent-3.0.0.tgz", + "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "es6-error": "^4.1.1", + "matcher": "^3.0.0", + "roarr": "^2.15.3", + "semver": "^7.3.2", + "serialize-error": "^7.0.1" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmmirror.com/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.12", + "resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/http-cache-semantics/-/http-cache-semantics-4.3.0.tgz", + "integrity": "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isbinaryfile": { + "version": "5.0.7", + "resolved": "https://registry.npmmirror.com/isbinaryfile/-/isbinaryfile-5.0.7.tgz", + "integrity": "sha512-gnWD14Jh3FzS3CPhF0AxNOJ8CxqeblPTADzI38r0wt8ZyQl5edpy75myt08EG2oKvpyiqSqsx+Wkz9vtkbTqYQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, + "node_modules/isexe": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/isexe/-/isexe-3.1.5.tgz", + "integrity": "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/jake": { + "version": "10.9.4", + "resolved": "https://registry.npmmirror.com/jake/-/jake-10.9.4.tgz", + "integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "async": "^3.2.6", + "filelist": "^1.0.4", + "picocolors": "^1.1.1" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmmirror.com/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/lazy-val": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/lazy-val/-/lazy-val-1.0.5.tgz", + "integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/matcher": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/matcher/-/matcher-3.0.0.tgz", + "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmmirror.com/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "4.40.0", + "resolved": "https://registry.npmmirror.com/node-abi/-/node-abi-4.40.0.tgz", + "integrity": "sha512-GuvqvtrOk+AC27RidBxBsMzVNkwNl7PjHgc4NXbmdvSVLgIUjpaqcG1FjNRYnt2Yn9Ytq+Ln37XsBaglUcte/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.6.3" + }, + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/node-api-version": { + "version": "0.2.1", + "resolved": "https://registry.npmmirror.com/node-api-version/-/node-api-version-0.2.1.tgz", + "integrity": "sha512-2xP/IGGMmmSQpI1+O/k72jF/ykvZ89JeuKX3TLJAYPDVLUalrshrLHkeVcCCZqG/eEa635cr8IBYzgnDvM2O8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + } + }, + "node_modules/node-gyp": { + "version": "12.4.0", + "resolved": "https://registry.npmmirror.com/node-gyp/-/node-gyp-12.4.0.tgz", + "integrity": "sha512-OMcPNvqTCFUnNaBlmdgq+lfNqY7gTiSmNRDjY3uAXRyudeKZEZxu3CLtjMQrx4zZxCX2b/mpNqTtwuCJgXhHkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "graceful-fs": "^4.2.6", + "nopt": "^9.0.0", + "proc-log": "^6.0.0", + "semver": "^7.3.5", + "tar": "^7.5.4", + "tinyglobby": "^0.2.12", + "undici": "^6.25.0", + "which": "^6.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/node-gyp/node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/node-gyp/node_modules/isexe": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=20" + } + }, + "node_modules/node-gyp/node_modules/undici": { + "version": "6.29.1", + "resolved": "https://registry.npmmirror.com/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/node-gyp/node_modules/which": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/which/-/which-6.0.1.tgz", + "integrity": "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^4.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nopt": { + "version": "9.0.0", + "resolved": "https://registry.npmmirror.com/nopt/-/nopt-9.0.0.tgz", + "integrity": "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "^4.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmmirror.com/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pe-library": { + "version": "0.4.1", + "resolved": "https://registry.npmmirror.com/pe-library/-/pe-library-0.4.1.tgz", + "integrity": "sha512-eRWB5LBz7PpDu4PUlwT0PhnQfTQJlDDdPa35urV4Osrm0t0AqQFGn+UIkU3klZvwJ8KPO3VbBFsXquA6p6kqZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jet2jet" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkijs": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/pkijs/-/pkijs-3.4.3.tgz", + "integrity": "sha512-V9kOzaItwDgqlryhXysQsAXUEKi5O7kqWUaP3dXI7MLvkPqWWMb4wVb1QAtmEDCKI+XIAINsZoNKMFF7sZb1eg==", + "dev": true, + "license": "BSD-3-Clause", + "workspaces": [ + "website" + ], + "dependencies": { + "@noble/hashes": "1.8.0", + "asn1js": "^3.0.6", + "bytestreamjs": "^2.0.1", + "pvtsutils": "^1.3.6", + "pvutils": "^1.1.3", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/plist": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.8.8", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/postject": { + "version": "1.0.0-alpha.6", + "resolved": "https://registry.npmmirror.com/postject/-/postject-1.0.0-alpha.6.tgz", + "integrity": "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "commander": "^9.4.0" + }, + "bin": { + "postject": "dist/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/postject/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmmirror.com/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/proc-log": { + "version": "6.1.0", + "resolved": "https://registry.npmmirror.com/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmmirror.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pvtsutils": { + "version": "1.3.6", + "resolved": "https://registry.npmmirror.com/pvtsutils/-/pvtsutils-1.3.6.tgz", + "integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.8.1" + } + }, + "node_modules/pvutils": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/pvutils/-/pvutils-1.2.0.tgz", + "integrity": "sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmmirror.com/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-binary-file-arch": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/read-binary-file-arch/-/read-binary-file-arch-1.0.6.tgz", + "integrity": "sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "bin": { + "read-binary-file-arch": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resedit": { + "version": "1.7.2", + "resolved": "https://registry.npmmirror.com/resedit/-/resedit-1.7.2.tgz", + "integrity": "sha512-vHjcY2MlAITJhC0eRD/Vv8Vlgmu9Sd3LX9zZvtGzU5ZImdTN3+d6e/4mnTyV8vEbyf1sgNIrWxhWlrys52OkEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pe-library": "^0.4.1" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jet2jet" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmmirror.com/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/roarr": { + "version": "2.15.4", + "resolved": "https://registry.npmmirror.com/roarr/-/roarr-2.15.4.tgz", + "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "boolean": "^3.0.1", + "detect-node": "^2.0.4", + "globalthis": "^1.0.1", + "json-stringify-safe": "^5.0.1", + "semver-compare": "^1.0.0", + "sprintf-js": "^1.1.2" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/sanitize-filename": { + "version": "1.6.5", + "resolved": "https://registry.npmmirror.com/sanitize-filename/-/sanitize-filename-1.6.5.tgz", + "integrity": "sha512-+dVApt46/oAFWRP0KBSnYNLRw1peY7o/b12tmpllPNFpjfwkPuZut1+DiKaD9zYx5r2SHwc+XMLSBaDiyUJw3g==", + "dev": true, + "license": "WTFPL OR ISC", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmmirror.com/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/serialize-error": { + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "type-fest": "^0.13.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/stat-mode": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/stat-mode/-/stat-mode-1.0.0.tgz", + "integrity": "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sumchecker": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/sumchecker/-/sumchecker-3.0.1.tgz", + "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "7.5.23", + "resolved": "https://registry.npmmirror.com/tar/-/tar-7.5.23.tgz", + "integrity": "sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/temp": { + "version": "0.9.4", + "resolved": "https://registry.npmmirror.com/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "mkdirp": "^0.5.1", + "rimraf": "~2.6.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/temp-file": { + "version": "3.4.0", + "resolved": "https://registry.npmmirror.com/temp-file/-/temp-file-3.4.0.tgz", + "integrity": "sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-exit-hook": "^2.0.1", + "fs-extra": "^10.0.0" + } + }, + "node_modules/tiny-async-pool": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/tiny-async-pool/-/tiny-async-pool-1.3.0.tgz", + "integrity": "sha512-01EAw5EDrcVrdgyCLgoSPvqznC0sVxDSVeiOz09FUpjh71G79VCqneOr+xvt7T1r76CF6ZZfPjHorN2+d+3mqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^5.5.0" + } + }, + "node_modules/tiny-async-pool/node_modules/semver": { + "version": "5.7.3", + "resolved": "https://registry.npmmirror.com/semver/-/semver-5.7.3.tgz", + "integrity": "sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tmp": { + "version": "0.2.7", + "resolved": "https://registry.npmmirror.com/tmp/-/tmp-0.2.7.tgz", + "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tmp": "^0.2.0" + } + }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "dev": true, + "license": "WTFPL", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD" + }, + "node_modules/type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmmirror.com/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/undici": { + "version": "7.30.2", + "resolved": "https://registry.npmmirror.com/undici/-/undici-7.30.2.tgz", + "integrity": "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/unzipper": { + "version": "0.12.5", + "resolved": "https://registry.npmmirror.com/unzipper/-/unzipper-0.12.5.tgz", + "integrity": "sha512-tXYOi9R57Uj/2Z25SOs5RRSzq886MBQj2gY8dPL+xl/kv6s6SvByoKfAtvfVeEuhntWDgjd2o9p2lb4TVPAz0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "bluebird": "~3.7.2", + "duplexer2": "~0.1.4", + "fs-extra": "11.3.1", + "graceful-fs": "^4.2.2", + "node-int64": "^0.4.0" + } + }, + "node_modules/unzipper/node_modules/fs-extra": { + "version": "11.3.1", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-11.3.1.tgz", + "integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/utf8-byte-length": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", + "integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==", + "dev": true, + "license": "(WTFPL OR MIT)" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/webcrypto-core": { + "version": "1.9.2", + "resolved": "https://registry.npmmirror.com/webcrypto-core/-/webcrypto-core-1.9.2.tgz", + "integrity": "sha512-gsXecm82UQNlTBURJGuqOWy1Ww08S3kZUcr3aOJS02Pk0xLtkfeUAVC0u0xhgdonFme80edSJUIJyuvL/7250Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.7.0", + "@peculiar/json-schema": "^1.1.12", + "@peculiar/utils": "^2.0.2", + "asn1js": "^3.0.10", + "tslib": "^2.8.1" + } + }, + "node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmmirror.com/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/apps/desktop/package.json b/apps/desktop/package.json new file mode 100644 index 000000000..5d00130af --- /dev/null +++ b/apps/desktop/package.json @@ -0,0 +1,57 @@ +{ + "name": "@opendirector/desktop", + "version": "0.1.4", + "private": true, + "type": "module", + "main": "src/main.mjs", + "scripts": { + "start": "electron .", + "test": "node --test tests/*.test.mjs", + "prepare:runtime": "node scripts/prepare-runtime.mjs", + "pack": "electron-builder --dir", + "smoke": "node scripts/smoke.mjs" + }, + "dependencies": { + "zod": "4.4.3" + }, + "devDependencies": { + "electron": "45.3.3", + "electron-builder": "26.18.0" + }, + "build": { + "appId": "org.opendirector.desktop", + "productName": "OpenDirector", + "asar": true, + "directories": { + "output": "build" + }, + "files": [ + "src/**", + "package.json" + ], + "extraResources": [ + { + "from": "runtime", + "to": "runtime" + } + ], + "mac": { + "category": "public.app-category.video", + "target": "dir" + }, + "win": { + "target": "dir" + }, + "linux": { + "target": "dir", + "category": "AudioVideo" + }, + "icon": "../../src/assets/open_director_logo.png" + }, + "allowScripts": { + "electron@45.3.3": true, + "electron-winstaller@5.4.0": true + }, + "description": "OpenDirector desktop shell and private Python Host", + "author": "OpenDirector contributors" +} diff --git a/apps/desktop/scripts/prepare-runtime.mjs b/apps/desktop/scripts/prepare-runtime.mjs new file mode 100644 index 000000000..fb66ed9fb --- /dev/null +++ b/apps/desktop/scripts/prepare-runtime.mjs @@ -0,0 +1,49 @@ +/** Build-host prerequisites: uv, Node/npm and a standalone FFmpeg/ffprobe directory. */ +import { spawnSync } from 'node:child_process'; +import { chmodSync, copyFileSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { dirname, join, resolve, relative } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const desktop = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +const root = resolve(desktop, '../..'); +const runtime = join(desktop, 'runtime'); +const media = process.env.OPENDIRECTOR_FFMPEG_DIR; +if (!media) throw new Error('Set OPENDIRECTOR_FFMPEG_DIR to standalone ffmpeg and ffprobe binaries for this target.'); +function run(command, args, cwd = root) { + const result = spawnSync(command, args, { cwd, stdio: 'inherit' }); + if (result.error) throw result.error; + if (result.status !== 0) throw new Error(`${command} exited ${result.status}`); +} +mkdirSync(join(runtime, 'bin'), { recursive: true }); +run('uv', ['python', 'install', '3.12', '--install-dir', join(runtime, 'python'), '--no-bin']); +const distribution = readdirSync(join(runtime, 'python')).find(name => name.startsWith('cpython-3.12') && name.includes(process.arch === 'arm64' ? 'aarch64' : 'x86_64')); +if (!distribution) throw new Error('Missing standalone Python distribution'); +const python = join(runtime, 'python', distribution, process.platform === 'win32' ? 'python.exe' : 'bin/python3'); +const wheels = join(root, 'build/desktop-wheel'); +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)]); +for (const name of ['ffmpeg', 'ffprobe']) { + const executable = name + (process.platform === 'win32' ? '.exe' : ''); + copyFileSync(join(media, executable), join(runtime, 'bin', executable)); + chmodSync(join(runtime, 'bin', executable), 0o755); + if (process.platform === 'darwin') { + const target = spawnSync('file', [join(runtime, 'bin', executable)], { encoding: 'utf8' }); + if (target.status !== 0 || !target.stdout.includes(process.arch === 'arm64' ? 'arm64' : 'x86_64')) throw new Error(`${name} does not match the target architecture`); + } + const license = spawnSync(join(runtime, 'bin', executable), ['-L'], { encoding: 'utf8' }); + if (license.status !== 0) throw new Error(`${name} license inspection failed`); + writeFileSync(join(runtime, 'bin', `LICENSE.${name}.txt`), license.stdout + license.stderr); + run(join(runtime, 'bin', executable), ['-version']); +} +const pythonRelative = relative(runtime, python); +const desktopExecutable = process.platform === 'darwin' ? '../../MacOS/OpenDirector' : process.platform === 'win32' ? '../../OpenDirector.exe' : '../../opendirector-desktop'; +const workspace = process.platform === 'darwin' ? '$HOME/Library/Application Support/OpenDirector/workspace' : '${XDG_CONFIG_HOME:-$HOME/.config}/OpenDirector/workspace'; +const unix = `#!/bin/sh\nset -eu\nSCRIPT="$0"\nwhile [ -L "$SCRIPT" ]; do\n BASE=$(CDPATH= cd -- "$(dirname -- "$SCRIPT")" && pwd)\n LINK=$(readlink "$SCRIPT")\n case "$LINK" in /*) SCRIPT="$LINK" ;; *) SCRIPT="$BASE/$LINK" ;; esac\ndone\nRUNTIME=$(CDPATH= cd -- "$(dirname -- "$SCRIPT")/.." && pwd)\nexport PATH="$RUNTIME/bin:$PATH"\nexport OPENDIRECTOR_ROOT="\${OPENDIRECTOR_ROOT:-${workspace}}"\nexport OPENDIRECTOR_DESKTOP_EXECUTABLE="$RUNTIME/${desktopExecutable}"\nexec "$RUNTIME/${pythonRelative}" -I -m opendirector.cli "$@"\n`; +if (process.platform === 'win32') writeFileSync(join(runtime, 'bin/opendirector.cmd'), `@echo off\r\nset "PATH=%~dp0;%PATH%"\r\nif not defined OPENDIRECTOR_ROOT set "OPENDIRECTOR_ROOT=%APPDATA%\\OpenDirector\\workspace"\r\nset "OPENDIRECTOR_DESKTOP_EXECUTABLE=%~dp0..\\${desktopExecutable}"\r\n"%~dp0..\\${pythonRelative}" -I -m opendirector.cli %*\r\n`); +else { writeFileSync(join(runtime, 'bin/opendirector'), unix); chmodSync(join(runtime, 'bin/opendirector'), 0o755); } +run(python, ['-I', '-m', 'opendirector.cli', '--help']); +writeFileSync(join(runtime, 'manifest.json'), JSON.stringify({ version: 1, platform: process.platform, arch: process.arch, + python: pythonRelative, application: JSON.parse(readFileSync(join(root, 'package.json'))).version }, null, 2)); diff --git a/apps/desktop/scripts/smoke.mjs b/apps/desktop/scripts/smoke.mjs new file mode 100644 index 000000000..7f2a49359 --- /dev/null +++ b/apps/desktop/scripts/smoke.mjs @@ -0,0 +1,26 @@ +import { mkdtemp, readFile, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { spawn } from 'node:child_process'; + +const binary = process.argv[2]; +if (!binary) throw new Error('Usage: node scripts/smoke.mjs /path/to/packaged/OpenDirector'); +const directory = await mkdtemp(join(tmpdir(), 'opendirector-desktop-')); +let previous; +try { + for (let attempt = 0; attempt < 2; attempt++) { + const child = spawn(binary, ['--smoke'], { env: { ...process.env, OPENDIRECTOR_DESKTOP_DATA: directory }, stdio: 'inherit' }); + const timeout = setTimeout(() => child.kill('SIGKILL'), 90_000); + const result = await new Promise((resolve, reject) => { + child.once('error', reject); + child.once('close', resolve); + }).finally(() => clearTimeout(timeout)); + const log = await readFile(join(directory, 'logs/desktop.log'), 'utf8'); + if (result !== 0 || !log.includes('"health":{"status":"ok"}')) throw new Error(`Packaged desktop smoke failed (${result}):\n${log}`); + const latest = log.split('\n').filter(line => line.startsWith('smoke ')).at(-1); + const current = JSON.parse(latest.slice(6)).projectIds; + if (previous && JSON.stringify(previous) !== JSON.stringify(current)) throw new Error('Reopening changed the project identities'); + previous = current; + } + process.stdout.write('Packaged canvas, authenticated API, isolation, both locales, hidden-window Host and reopen: passed\n'); +} finally { await rm(directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); } diff --git a/apps/desktop/src/command.mjs b/apps/desktop/src/command.mjs new file mode 100644 index 000000000..9289e0588 --- /dev/null +++ b/apps/desktop/src/command.mjs @@ -0,0 +1,24 @@ +import { lstat, readFile, readlink, mkdir, symlink, unlink, writeFile, rename } from 'node:fs/promises'; +import { randomUUID } from 'node:crypto'; +import { dirname, join } from 'node:path'; + +export async function registerCommand({ destination, launcher, previousLauncher, remove = false }) { + await mkdir(dirname(destination), { recursive: true }); + const existing = await lstat(destination).catch(error => { if (error.code !== 'ENOENT') throw error; return null; }); + if (existing) { + const targets = [launcher, previousLauncher].filter(Boolean); + const owned = existing.isSymbolicLink() ? targets.includes(await readlink(destination)) + : await readFile(destination, 'utf8').then(value => targets.some(target => value === `@"${target}" %*\r\n`)); + if (!owned) throw new Error('command_collision'); + if (remove) { await unlink(destination); return; } + } + if (remove) return; + const temporary = destination + '.' + randomUUID(); + try { + if (process.platform === 'win32') await writeFile(temporary, `@"${launcher}" %*\r\n`, { flag: 'wx' }); + else await symlink(launcher, temporary); + await rename(temporary, destination); + } finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); } +} + +export const commandPath = home => join(home, '.local', 'bin', process.platform === 'win32' ? 'opendirector.cmd' : 'opendirector'); diff --git a/apps/desktop/src/host.mjs b/apps/desktop/src/host.mjs new file mode 100644 index 000000000..7fe699452 --- /dev/null +++ b/apps/desktop/src/host.mjs @@ -0,0 +1,115 @@ +import { spawn } from 'node:child_process'; +import { randomBytes } from 'node:crypto'; +import { createInterface } from 'node:readline'; +import { z } from 'zod'; + +export const eventSchema = z.discriminatedUnion('type', [ + z.object({ type: z.literal('starting'), version: z.literal(1) }), + z.object({ type: z.literal('ready'), version: z.literal(1), url: z.url().refine(value => { + const url = new URL(value); + return url.protocol === 'http:' && url.hostname === '127.0.0.1' && url.port !== '' && + url.pathname === '/' && !url.username && !url.password && !url.search && !url.hash; + }), runtime: z.record(z.string(), z.string()) }), + z.object({ type: z.literal('fatal'), version: z.literal(1), message: z.string() }), + z.object({ type: z.literal('inspection'), requestId: z.number().int().positive(), + agents: z.number().int().nonnegative(), generations: z.number().int().nonnegative(), tools: z.number().int().nonnegative() }), + z.object({ type: z.literal('shutdown-complete') }), +]); + +export class Host { + token = randomBytes(32).toString('hex'); + url; + pending = new Map(); + nextId = 0; + stopping = false; + + constructor({ python, env, directory, log, onExit }) { + this.child = spawn(python, ['-I', '-m', 'opendirector_api.desktop'], { + cwd: directory, env, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true, + }); + this.child.stderr.pipe(log, { end: false }); + this.closed = new Promise(resolve => this.child.once('close', resolve)); + this.ready = new Promise((resolve, reject) => { + const deadline = setTimeout(() => reject(new Error('Host startup timed out')), 60_000); + const input = createInterface({ input: this.child.stdout }); + input.on('line', line => { + try { + if (line.length > 65536) throw new Error('Host message exceeds the control limit'); + const event = eventSchema.parse(JSON.parse(line)); + if (event.type === 'ready') { + this.url = event.url; + clearTimeout(deadline); + resolve(event); + } else if (event.type === 'fatal') { + clearTimeout(deadline); + reject(new Error(event.message)); + } else if (event.type === 'inspection') { + this.pending.get(event.requestId)?.(event); + this.pending.delete(event.requestId); + } + } catch (error) { + clearTimeout(deadline); + reject(error); + this.child.kill(); + } + }); + this.child.once('error', error => { clearTimeout(deadline); reject(error); }); + this.child.once('close', code => { + clearTimeout(deadline); + reject(new Error(`Host exited (${code})`)); + for (const resolve of this.pending.values()) resolve(null); + this.pending.clear(); + if (this.url && !this.stopping) onExit(code); + }); + }); + this.child.stdin.on('error', () => {}); // Exit is reported by the child close event. + this.child.stdin.write(JSON.stringify({ type: 'initialize', version: 1, token: this.token }) + '\n'); + } + + registerSession(sessionId) { + this.child.stdin.write(JSON.stringify({ type: 'session', sessionId }) + '\n'); + } + + async inspect() { + if (!this.url || this.child.exitCode !== null) return null; + const requestId = ++this.nextId; + return new Promise(resolve => { + const timeout = setTimeout(() => { this.pending.delete(requestId); resolve(null); }, 2000); + this.pending.set(requestId, event => { clearTimeout(timeout); resolve(event); }); + this.child.stdin.write(JSON.stringify({ type: 'inspect', requestId }) + '\n'); + }); + } + + async stop() { + this.stopping = true; + if (this.child.exitCode !== null) return; + this.child.stdin.end(JSON.stringify({ type: 'shutdown', requestId: ++this.nextId }) + '\n'); + const timeout = setTimeout(() => this.child.kill('SIGKILL'), 20_000); + try { await this.closed; } finally { clearTimeout(timeout); } + } +} + +export function ownedURL(value) { + const url = new URL(value); + return url.protocol === 'opendirector:' && url.hostname === 'app' && !url.port && !url.username && !url.password; +} + +export async function proxyRequest(request, host, fetcher) { + if (!ownedURL(request.url) || !host.url) return new Response(null, { status: 403 }); + const incoming = new URL(request.url); + const target = new URL(incoming.pathname + incoming.search, host.url); + if (target.origin !== new URL(host.url).origin) return new Response(null, { status: 403 }); + const headers = new Headers(request.headers); + for (const name of ['host', 'origin', 'cookie', 'authorization', 'connection', 'content-length', 'x-opendirector-desktop']) headers.delete(name); + headers.set('X-OpenDirector-Desktop', host.token); + const response = await fetcher(target.href, { + method: request.method, headers, redirect: 'manual', credentials: 'omit', signal: request.signal, + ...(request.method === 'GET' || request.method === 'HEAD' ? {} : { body: await request.arrayBuffer() }), + }); + if (response.status >= 300 && response.status < 400 && response.status !== 304) return new Response(null, { status: 502 }); + const outgoing = new Headers(response.headers); + for (const name of ['connection', 'transfer-encoding', 'keep-alive', 'set-cookie', 'content-encoding', 'content-length']) outgoing.delete(name); + outgoing.set('Cache-Control', 'no-store'); + outgoing.set('Content-Security-Policy', "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; media-src 'self' blob:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-src 'none'"); + return new Response(response.body, { status: response.status, statusText: response.statusText, headers: outgoing }); +} diff --git a/apps/desktop/src/locale.mjs b/apps/desktop/src/locale.mjs new file mode 100644 index 000000000..d48f083e1 --- /dev/null +++ b/apps/desktop/src/locale.mjs @@ -0,0 +1,23 @@ +export const messages = { + 'en-US': { + app: 'OpenDirector', startup: 'OpenDirector could not start', retry: 'Retry', quit: 'Quit', cancel: 'Cancel', + interrupted: 'The local service stopped. Restart OpenDirector to reconnect. Existing remote jobs are not automatically cancelled.', + running: 'Agent, generation or export work is active, or its status could not be checked. Quitting interrupts local work. Remote jobs may continue and incur charges. Quit now?', + edit: 'Edit', view: 'View', undo: 'Undo', redo: 'Redo', cut: 'Cut', copy: 'Copy', paste: 'Paste', selectAll: 'Select all', fullscreen: 'Toggle fullscreen', devtools: 'Developer tools', + menu: 'File', logs: 'Open diagnostics folder', data: 'Open data folder', command: 'Manage terminal command', + install: 'Install / Repair', remove: 'Remove', commandDone: 'Terminal command updated. Open a new terminal to use it.', + collision: 'Another command already exists. Remove it explicitly before registering this installation.', + failed: 'Operation failed', close: 'Close', save: 'Save file', + }, + 'zh-CN': { + app: 'OpenDirector', startup: 'OpenDirector 无法启动', retry: '重试', quit: '退出', cancel: '取消', + interrupted: '本地服务已停止,请重启 OpenDirector 重新连接。已有远端任务不会自动取消。', + running: 'Agent、生成或导出任务仍在运行,或无法确认任务状态。退出会中断本地工作;远端任务可能继续运行并产生费用。是否退出?', + edit: '编辑', view: '视图', undo: '撤销', redo: '重做', cut: '剪切', copy: '复制', paste: '粘贴', selectAll: '全选', fullscreen: '切换全屏', devtools: '开发者工具', + menu: '文件', logs: '打开诊断目录', data: '打开数据目录', command: '管理终端命令', + install: '安装/修复', remove: '移除', commandDone: '终端命令已更新,请打开新终端使用。', + collision: '已有其他终端命令,请明确移除后再注册此安装。', + failed: '操作失败', close: '关闭', save: '保存文件', + }, +}; +export const localeFor = value => value?.startsWith('zh') ? 'zh-CN' : 'en-US'; diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs new file mode 100644 index 000000000..973871bcf --- /dev/null +++ b/apps/desktop/src/main.mjs @@ -0,0 +1,301 @@ +import { z } from 'zod'; +import { app, BrowserWindow, dialog, ipcMain, Menu, net, protocol, session, shell, nativeTheme } from 'electron'; +import { createWriteStream, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { homedir } from 'node:os'; +import { Host, ownedURL, proxyRequest } from './host.mjs'; +import { messages, localeFor } from './locale.mjs'; +import { registerCommand, commandPath } from './command.mjs'; + +app.setName('OpenDirector'); +const here = dirname(fileURLToPath(import.meta.url)); +const runtime = app.isPackaged ? join(process.resourcesPath, 'runtime') : join(here, '..', 'runtime'); +const isolated = process.env.OPENDIRECTOR_DESKTOP_DATA; +if (isolated) app.setPath('userData', isolated); +protocol.registerSchemesAsPrivileged([{ scheme: 'opendirector', privileges: { + standard: true, secure: true, supportFetchAPI: true, stream: true, corsEnabled: true, +} }]); +let host; +let window; +let exporting = false; +let quitting = false; +let quitPending = false; +let locale = localeFor(app.getLocale()); +const text = () => messages[locale]; +const userData = app.getPath('userData'); +const logs = join(userData, 'logs'); +const workspace = join(userData, 'workspace'); +mkdirSync(logs, { recursive: true }); +mkdirSync(workspace, { recursive: true }); +const logFile = join(logs, 'desktop.log'); +const log = createWriteStream(logFile, { flags: 'a', mode: 0o600 }); +try { locale = localeFor(readFileSync(join(userData, 'locale'), 'utf8')); } +catch (error) { if (error.code !== 'ENOENT') log.write(`Locale read failed: ${error.message}\n`); } + +if (!app.requestSingleInstanceLock()) app.quit(); +else { + app.on('second-instance', () => { window?.show(); window?.focus(); }); + app.whenReady().then(start).catch(fatal); +} + +function trusted(event) { + return event.sender === window?.webContents && event.senderFrame === window.webContents.mainFrame && ownedURL(event.senderFrame.url); +} +ipcMain.on('desktop:locale', (event, value) => { + if (!trusted(event) || !['en-US', 'zh-CN'].includes(value)) return; + locale = value; + writeFileSync(join(userData, 'locale'), value, { mode: 0o600 }); + menu(); +}); +ipcMain.on('desktop:theme', (event, value) => { + if (trusted(event) && ['light', 'dark'].includes(value)) { nativeTheme.themeSource = value; applyBackdrop(); } +}); +ipcMain.on('desktop:session', (event, value) => { + const parsed = z.uuid().safeParse(value); + if (trusted(event) && parsed.success) host.registerSession(parsed.data); +}); +ipcMain.on('desktop:exporting', (event, value) => { + if (trusted(event) && typeof value === 'boolean') exporting = value; +}); + +function menu() { + Menu.setApplicationMenu(Menu.buildFromTemplate([ + { label: text().app, submenu: [ + { role: 'about', label: text().app }, + { label: text().logs, click: () => shell.openPath(logs) }, + { label: text().data, click: () => shell.openPath(workspace) }, + { label: text().command, click: manageCommand }, + { type: 'separator' }, { label: text().quit, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }, + ] }, + { label: text().edit, submenu: ['undo', 'redo', 'cut', 'copy', 'paste', 'selectAll'].map(role => ({ role, label: text()[role] })) }, + { label: text().view, submenu: [ + { role: 'togglefullscreen', label: text().fullscreen }, { role: 'toggleDevTools', label: text().devtools }, + ] }, + ])); +} + +async function manageCommand() { + const destination = commandPath(homedir()); + const { response } = await dialog.showMessageBox(window, { message: text().command, detail: destination, + buttons: [text().install, text().remove, text().cancel], cancelId: 2 }); + if (response === 2) return; + try { + const receipt = join(userData, 'command-registration.json'); + let previousLauncher; + try { + const previous = JSON.parse(readFileSync(receipt, 'utf8')); + if (previous.destination === destination && typeof previous.launcher === 'string') previousLauncher = previous.launcher; + } catch (error) { if (error.code !== 'ENOENT') throw error; } + const launcher = join(runtime, 'bin', process.platform === 'win32' ? 'opendirector.cmd' : 'opendirector'); + await registerCommand({ destination, previousLauncher, launcher, remove: response === 1 }); + writeFileSync(receipt, JSON.stringify({ destination, launcher }), { mode: 0o600 }); + await dialog.showMessageBox(window, { message: text().commandDone, detail: destination }); + } catch (error) { + await dialog.showMessageBox(window, { type: 'error', message: text().failed, + detail: error.message === 'command_collision' ? text().collision : error.message }); + } +} + +async function start() { + menu(); + const manifest = JSON.parse(readFileSync(join(runtime, 'manifest.json'), 'utf8')); + if (typeof manifest.python !== 'string' || manifest.python.startsWith('/') || manifest.python.split(/[\\/]/).includes('..')) throw new Error('Invalid runtime Python path'); + if (manifest.version !== 1 || manifest.platform !== process.platform || manifest.arch !== process.arch) throw new Error('Runtime platform does not match this application'); + host = new Host({ python: join(runtime, manifest.python), directory: workspace, log, + env: { ...process.env, OPENDIRECTOR_ROOT: workspace, + PATH: join(runtime, 'bin') + (process.platform === 'win32' ? ';' : ':') + process.env.PATH }, + onExit: () => { if (!quitting) void fatal(new Error(text().interrupted)); }, + }); + await host.ready; + const ownedSession = session.fromPartition('persist:opendirector'); + ownedSession.setPermissionRequestHandler((_contents, _permission, callback) => callback(false)); + ownedSession.protocol.handle('opendirector', request => proxyRequest(request, host, async (url, options) => { + const response = await net.fetch(url, options); + if (response.status >= 400) log.write(`Host request ${options.method} ${new URL(url).pathname}: ${response.status}\n`); + return response; + })); + ownedSession.on('will-download', (_event, item) => item.setSaveDialogOptions({ title: text().save })); + window = new BrowserWindow({ width: 1440, height: 960, minWidth: 800, minHeight: 600, show: false, title: 'OpenDirector', + ...(process.platform === 'darwin' ? { titleBarStyle: 'hiddenInset', trafficLightPosition: { x: 18, y: 18 }, + vibrancy: 'sidebar', visualEffectState: 'active', backgroundColor: '#00000000' } : {}), + webPreferences: { session: ownedSession, preload: join(here, 'preload.cjs'), nodeIntegration: false, + contextIsolation: true, sandbox: true, webSecurity: true }, + }); + if (process.platform === 'darwin') { + const fullscreen = () => window.webContents.send('desktop:fullscreen', window.isFullScreen()); + window.on('enter-full-screen', fullscreen); + window.on('leave-full-screen', fullscreen); + window.webContents.on('did-finish-load', fullscreen); + for (const event of ['minimize', 'hide', 'restore', 'show']) window.on(event, applyBackdrop); + } + window.webContents.setWindowOpenHandler(({ url }) => { + if (new URL(url).protocol === 'https:') void shell.openExternal(url); + return { action: 'deny' }; + }); + window.webContents.on('will-navigate', (event, url) => { if (!ownedURL(url)) event.preventDefault(); }); + window.webContents.on('render-process-gone', () => { exporting = false; }); + window.on('close', event => { if (!quitting) { event.preventDefault(); window.hide(); } }); + app.on('activate', () => { window?.show(); window?.focus(); }); + await window.loadURL('opendirector://app/'); + window.show(); + if (process.argv.includes('--smoke')) { + try { + const result = await window.webContents.executeJavaScript(`(async () => { + const r = await fetch('/api/health', {headers: {'X-OpenDirector-Request': '1'}}); + const health = await r.json(); + const projects = await fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}); + return {health, projects: projects.status, isolated: typeof require === 'undefined', bridge: !!window.opendirectorDesktop}; + })()`); + if (result.health.status !== 'ok' || result.projects !== 200 || !result.isolated || !result.bridge) throw new Error('Desktop smoke failed'); + let rendered = false; + for (let attempt = 0; attempt < 150; attempt++) { + if (await window.webContents.executeJavaScript('document.querySelectorAll("button").length > 2')) { rendered = true; break; } + await new Promise(resolve => setTimeout(resolve, 100)); + } + if (!rendered) throw new Error('Workbench did not become interactive'); + await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); + let canvasReady = false; + for (let attempt = 0; attempt < 150; attempt++) { + if (await window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")')) { canvasReady = true; break; } + await new Promise(resolve => setTimeout(resolve, 100)); + } + if (!canvasReady) throw new Error('Canvas did not open'); + for (let attempt = 0; attempt < 150; attempt++) { + result.projectIds = await window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}).then(r => r.json()).then(value => value.projects.map(project => project.id).sort())`); + if (result.projectIds.length) break; + await new Promise(resolve => setTimeout(resolve, 100)); + } + if (!result.projectIds.length) throw new Error('Canvas project was not persisted'); + await new Promise(resolve => setTimeout(resolve, 500)); + await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); + await new Promise(resolve => setTimeout(resolve, 300)); + if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); + const evidence = process.env.OPENDIRECTOR_DESKTOP_EVIDENCE; + for (const language of ['en-US', 'zh-CN']) { + await window.webContents.executeJavaScript(`window.dispatchEvent(new StorageEvent('storage', { key: 'opendirector.locale.v1', newValue: '${language}' }))`); + await new Promise(resolve => setTimeout(resolve, 500)); + const current = await window.webContents.executeJavaScript('document.documentElement.lang'); + if (current !== language || locale !== language) throw new Error('Desktop locale synchronization failed'); + if (!(await window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")'))) throw new Error('Canvas was lost during language switching'); + if (evidence) { + mkdirSync(evidence, { recursive: true }); + writeFileSync(join(evidence, `desktop-${language}.png`), (await window.webContents.capturePage()).toPNG()); + for (const state of ['expanded', 'collapsed']) { + if (state === 'collapsed') { + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await new Promise(resolve => setTimeout(resolve, 500)); + } + const placements = await window.webContents.executeJavaScript(`(() => { + const open = document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'; + return { open, create: document.querySelectorAll(open ? '.od-sidebar-create' : '.od-caption-actions button').length }; + })()`); + if (placements.open !== (state === 'expanded') || placements.create !== (state === 'expanded' ? 1 : 2)) throw new Error('New project button placement failed'); + const layout = await window.webContents.executeJavaScript(`(() => { + const elements = ['.cw-topbar', '.cw-top-actions', '.cw-language-toggle']; + return { width: innerWidth, elements: elements.map(selector => { const e = document.querySelector(selector); const r = e.getBoundingClientRect(); return {selector, left:r.left, right:r.right, width:r.width, transform:getComputedStyle(e).transform}; }) }; + })()`); + writeFileSync(join(evidence, `layout-${state}-${language}.json`), JSON.stringify(layout)); + window.webContents.invalidate(); + await new Promise(resolve => setTimeout(resolve, 200)); + writeFileSync(join(evidence, `sidebar-${state}-${language}.png`), (await window.webContents.capturePage()).toPNG()); + } + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await new Promise(resolve => setTimeout(resolve, 500)); + } + } + if (process.platform === 'darwin') { + const chrome = await window.webContents.executeJavaScript(`(() => { + const header = document.querySelector('.cw-topbar'); + return { top: header.getBoundingClientRect().top, + canvasTop: document.querySelector('.react-flow').getBoundingClientRect().top, + padding: getComputedStyle(header).paddingLeft, + drag: getComputedStyle(header).getPropertyValue('-webkit-app-region') }; + })()`); + if (chrome.top !== 0 || chrome.canvasTop !== 48 || chrome.padding !== '20px' || chrome.drag !== 'drag') throw new Error('Desktop chrome layout failed: ' + JSON.stringify(chrome)); + app.focus({ steal: true }); + window.show(); + window.focus(); + await new Promise(resolve => setTimeout(resolve, 500)); + for (const fullscreen of [true, false]) { + window.setFullScreen(fullscreen); + let synchronized = false; + for (let attempt = 0; attempt < 100; attempt++) { + synchronized = await window.webContents.executeJavaScript(`document.documentElement.hasAttribute('data-desktop-fullscreen') === ${fullscreen}`); + if (synchronized) break; + await new Promise(resolve => setTimeout(resolve, 100)); + } + if (!synchronized) throw new Error('Fullscreen chrome synchronization failed: target=' + fullscreen + ', native=' + window.isFullScreen()); + } + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await new Promise(resolve => setTimeout(resolve, 500)); + const bounds = window.getBounds(); + window.setSize(800, 600); + await new Promise(resolve => setTimeout(resolve, 200)); + const fits = await window.webContents.executeJavaScript(`(() => { + const language = document.querySelector('.cw-topbar .cw-language-toggle').getBoundingClientRect(); + const title = document.querySelector('.cw-topbar .cw-project-selector').getBoundingClientRect(); + const actions = document.querySelector('.cw-top-actions').getBoundingClientRect(); + return title.right <= language.left && language.right <= actions.left && actions.right <= innerWidth; + })()`); + if (!fits) throw new Error('Desktop controls overlap in a narrow window'); + window.setBounds(bounds); + await new Promise(resolve => setTimeout(resolve, 200)); + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await new Promise(resolve => setTimeout(resolve, 500)); + result.chrome = chrome; + + } + await window.webContents.executeJavaScript('window.opendirectorDesktop.setExporting(true)'); + await new Promise(resolve => setTimeout(resolve, 50)); + window.close(); + if (window.isVisible() || !(await host.inspect())) throw new Error('Closing a window stopped the Host'); + log.write(`smoke ${JSON.stringify(result)}\n`); + quitting = true; + window.destroy(); + await host.stop(); + app.exit(0); + } catch (error) { log.write(`smoke failed ${error.message}\n`); quitting = true; window?.destroy(); await host.stop(); app.exit(1); } + } +} + +function applyBackdrop() { + if (process.platform !== 'darwin' || !window || window.isDestroyed()) return; + if (window.isMinimized() || !window.isVisible()) { + window.setVibrancy(null); + window.setBackgroundColor(nativeTheme.shouldUseDarkColors ? '#202022' : '#eeeef1'); + } else { + window.setVibrancy('sidebar'); + window.setBackgroundColor('#00000000'); + } +} + +async function fatal(error) { + log.write(`Host failure: ${error.message}\n`); + await host?.stop(); + if (process.argv.includes('--smoke')) { app.exit(1); return; } + await dialog.showMessageBox({ type: 'error', message: text().startup, detail: `${error.message}\n${logFile}`, buttons: [text().close] }); + quitting = true; + app.quit(); +} + +app.on('before-quit', event => { + if (quitting) return; + event.preventDefault(); + if (quitPending) return; + quitPending = true; + void (async () => { + try { + const state = await host?.inspect(); + if (exporting || state === null || state && (state.agents || state.generations || state.tools)) { + const { response } = await dialog.showMessageBox({ type: 'warning', message: text().running, + buttons: [text().cancel, text().quit], defaultId: 0, cancelId: 0 }); + if (response !== 1) return; + } + quitting = true; + window?.destroy(); + await host?.stop(); + app.quit(); + } finally { quitPending = false; } + })(); +}); diff --git a/apps/desktop/src/preload.cjs b/apps/desktop/src/preload.cjs new file mode 100644 index 000000000..83c599044 --- /dev/null +++ b/apps/desktop/src/preload.cjs @@ -0,0 +1,19 @@ +const { contextBridge, ipcRenderer } = require('electron'); +contextBridge.exposeInMainWorld('opendirectorDesktop', { + registerSession: id => ipcRenderer.send('desktop:session', id), + setLocale: locale => ipcRenderer.send('desktop:locale', locale), + setExporting: active => ipcRenderer.send('desktop:exporting', active), +}); + +function markDesktop() { + document.documentElement.dataset.desktopPlatform = process.platform; + const theme = () => ipcRenderer.send('desktop:theme', document.documentElement.dataset.theme === 'light' ? 'light' : 'dark'); + theme(); + new MutationObserver(theme).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] }); +} +if (document.documentElement) markDesktop(); +else window.addEventListener('DOMContentLoaded', markDesktop, { once: true }); +ipcRenderer.on('desktop:fullscreen', (_event, fullscreen) => { + if (fullscreen) document.documentElement.dataset.desktopFullscreen = 'true'; + else delete document.documentElement.dataset.desktopFullscreen; +}); diff --git a/apps/desktop/tests/host.test.mjs b/apps/desktop/tests/host.test.mjs new file mode 100644 index 000000000..621147fe1 --- /dev/null +++ b/apps/desktop/tests/host.test.mjs @@ -0,0 +1,80 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { eventSchema, proxyRequest } from '../src/host.mjs'; +import { messages } from '../src/locale.mjs'; +import { registerCommand } from '../src/command.mjs'; +import { mkdtemp, readlink, rm, writeFile, lstat } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; + +test('Host readiness rejects foreign origins and malformed control messages', () => { + const ready = { type: 'ready', version: 1, runtime: {} }; + for (const url of ['https://evil.test', 'http://localhost:80', 'http://127.0.0.1:42/?token=x', 'http://u:p@127.0.0.1:42']) { + assert.equal(eventSchema.safeParse({ ...ready, url }).success, false); + } + assert.equal(eventSchema.safeParse({ ...ready, url: 'http://127.0.0.1:23456' }).success, true); +}); + +test('Proxy authenticates only the owned Host and streams media range responses', async () => { + const host = { url: 'http://127.0.0.1:23456', token: 'private-token' }; + let calls = 0; + const fetcher = async (url, options) => { + calls += 1; + assert.equal(url, host.url + '/api/media'); + assert.equal(options.headers.get('x-opendirector-desktop'), host.token); + assert.equal(options.headers.get('range'), 'bytes=2-4'); + assert.equal(options.headers.has('cookie'), false); + assert.equal(options.redirect, 'manual'); + return new Response('abc', { status: 206, headers: { 'content-range': 'bytes 2-4/10', 'set-cookie': 'secret=x', 'connection': 'close' } }); + }; + const response = await proxyRequest(new Request('opendirector://app/api/media', { headers: { range: 'bytes=2-4', cookie: 'x=y' } }), host, fetcher); + assert.equal(response.status, 206); + assert.equal(response.headers.get('content-range'), 'bytes 2-4/10'); + assert.equal(response.headers.has('set-cookie'), false); + assert.equal(await response.text(), 'abc'); + assert.equal((await proxyRequest(new Request('opendirector://other/api/media'), host, fetcher)).status, 403); + assert.equal((await proxyRequest(new Request('opendirector://app//other.test/media'), host, fetcher)).status, 403); + assert.equal(calls, 1); +}); + +test('Native dialogs have matching bilingual keys', () => { + assert.deepEqual(Object.keys(messages['en-US']).sort(), Object.keys(messages['zh-CN']).sort()); +}); + +test('Command registration refuses collisions and only removes its own launcher', async () => { + const directory = await mkdtemp(join(tmpdir(), 'od-command-')); + const destination = join(directory, 'opendirector'); + const launcher = join(directory, 'launcher'); + try { + await writeFile(destination, 'another installation'); + await assert.rejects(registerCommand({ destination, launcher }), /command_collision/); + await assert.rejects(registerCommand({ destination, launcher, remove: true }), /command_collision/); + await rm(destination); + await registerCommand({ destination, launcher }); + if (process.platform !== 'win32') assert.equal(await readlink(destination), launcher); + await registerCommand({ destination, launcher }); + await registerCommand({ destination, launcher, remove: true }); + await assert.rejects(lstat(destination), { code: 'ENOENT' }); + } finally { await rm(directory, { recursive: true, force: true }); } +}); + +test('Proxy never follows redirects carrying the desktop credential', async () => { + const response = await proxyRequest(new Request('opendirector://app/api/test'), + { url: 'http://127.0.0.1:23456', token: 'private' }, + async () => new Response(null, { status: 302, headers: { location: 'https://other.test' } })); + assert.equal(response.status, 502); +}); + +test('Command repair after moving the app only replaces the recorded launcher', async () => { + const directory = await mkdtemp(join(tmpdir(), 'od-command-move-')); + const destination = join(directory, 'opendirector'); + const previousLauncher = join(directory, 'old-app'); + const launcher = join(directory, 'new-app'); + try { + await registerCommand({ destination, launcher: previousLauncher }); + await assert.rejects(registerCommand({ destination, launcher }), /command_collision/); + await registerCommand({ destination, launcher, previousLauncher }); + if (process.platform !== 'win32') assert.equal(await readlink(destination), launcher); + await registerCommand({ destination, launcher, remove: true }); + } finally { await rm(directory, { recursive: true, force: true }); } +}); diff --git a/apps/desktop/tests/packaged-host.test.mjs b/apps/desktop/tests/packaged-host.test.mjs new file mode 100644 index 000000000..df4a85f14 --- /dev/null +++ b/apps/desktop/tests/packaged-host.test.mjs @@ -0,0 +1,59 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp, readFile, rm, open } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join, resolve } from 'node:path'; +import { randomUUID } from 'node:crypto'; +import { spawnSync } from 'node:child_process'; +import { Host } from '../src/host.mjs'; + +const runtime = process.env.OPENDIRECTOR_DESKTOP_RUNTIME; +test('Packaged Python starts privately, inspects work, rejects unauthenticated media and stops on EOF', { skip: !runtime }, async () => { + const root = resolve(runtime); + const manifest = JSON.parse(await readFile(join(root, 'manifest.json'), 'utf8')); + const directory = await mkdtemp(join(tmpdir(), 'od-host-')); + const file = await open(join(directory, 'host.log'), 'w'); + const log = file.createWriteStream({ autoClose: false }); + let host; + try { + host = new Host({ python: join(root, manifest.python), directory, + env: { ...process.env, OPENDIRECTOR_ROOT: directory, PATH: join(root, 'bin') }, log, + onExit: () => {} }); + const ready = await host.ready; + assert.equal(ready.runtime.agent, '1.19.5'); + for (const path of ['/', '/api/health']) assert.equal((await fetch(host.url + path)).status, 403); + const response = await fetch(host.url + '/api/health', { headers: { + 'X-OpenDirector-Desktop': host.token, 'X-OpenDirector-Request': '1' } }); + assert.deepEqual(await response.json(), { status: 'ok' }); + const ownSession = randomUUID(); + const otherSession = randomUUID(); + host.registerSession(ownSession); + for (const [session, name] of [[ownSession, 'Owned'], [otherSession, 'Other']]) { + const projectId = randomUUID(); + const headers = { 'X-OpenDirector-Desktop': host.token, 'X-OpenDirector-Request': '1', + 'X-OpenDirector-Session': session, 'Content-Type': 'application/json' }; + const response = await fetch(host.url + `/api/creation/projects/${projectId}/commands`, { + method: 'POST', headers, body: JSON.stringify({ commandId: randomUUID(), projectId, + type: 'project.create', expectedVersions: [], payload: { name } }), + }); + assert.equal(response.status, 200, await response.text()); + assert.equal((await fetch(host.url + `/api/creation/projects/${projectId}/open`, { method: 'POST', headers })).status, 200); + } + const work = await host.inspect(); + assert.equal(work.agents + work.generations + work.tools, 0); + host.stopping = true; + host.child.stdin.end(); + const deadline = setTimeout(() => host.child.kill('SIGKILL'), 20_000); + try { assert.equal(await host.closed, 0); } finally { clearTimeout(deadline); } + const inspection = spawnSync(join(root, manifest.python), ['-I', '-c', "import sqlite3,sys,json; db=sqlite3.connect(sys.argv[1]); print(json.dumps([r[0] for r in db.execute('SELECT id FROM sessions')]))", join(directory, '.opendirector/catalog.sqlite3')], { encoding: 'utf8' }); + assert.equal(inspection.status, 0, inspection.stderr); + const sessions = JSON.parse(inspection.stdout); + assert.equal(sessions.includes(ownSession), false); + assert.equal(sessions.includes(otherSession), true); + } finally { + await host?.stop(); + log.end(); + await file.close(); + await rm(directory, { force: true, recursive: true }); + } +}); diff --git a/docs/README.md b/docs/README.md index cc14c4725..dcb9fbef9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -30,6 +30,7 @@ This directory is the entry point for the repository's shared documentation. The | [BigModel video](guides/bigmodel-video.md) ([中文](guides/bigmodel-video.zh-CN.md)) | CogVideoX-3 text, single-image and first/last-frame generation, task recovery and adoption | BigModel protocol, inputs, output sizes or recovery behavior change | | [BigModel GLM-Image](guides/bigmodel-image.md) ([中文](guides/bigmodel-image.zh-CN.md)) | Account setup, text-to-image generation, adoption and recovery | BigModel integration fields or behavior change | | [GLM-Image validation](development/glm-image-validation.md) | Real provider workflow screenshots and automated checks | GLM-Image acceptance is repeated | +| [Desktop application](development/desktop.md) ([中文](development/desktop.zh-CN.md)) | Desktop Host, bundled runtime, build and acceptance boundaries | Desktop lifecycle or packaging contract changes | | [Agent runtime](architecture/agent-runtime.md) | Agent runtime architecture | Runtime architecture changes | The root [README](../README.md) introduces the product and examples and links to quick-start and documentation. See [installation and updates](guides/installation.md) ([中文](guides/installation.zh-CN.md)) for installation, and the [user guide](guides/user-guide.md) ([中文](guides/user-guide.zh-CN.md)) for configuration, creation, and troubleshooting. The README does not contain the full manual, implementation architecture, development tests, research sources, or iteration history. Source code and generated contracts describe the implementation; architecture and roadmap documents describe goals and do not establish that a capability is already available. diff --git a/docs/development/desktop.md b/docs/development/desktop.md new file mode 100644 index 000000000..48e7e4baf --- /dev/null +++ b/docs/development/desktop.md @@ -0,0 +1,33 @@ +# Desktop application + +[中文](desktop.zh-CN.md) + +The desktop application reuses the Web UI and Python services. Electron owns one Python Host, started on an OS-assigned loopback port through a private JSON-lines control channel. Each launch has a fresh credential; only the main process forwards authenticated requests. The renderer uses `opendirector://app`, has no Node access, and has a narrow bridge for registering its edit-session identity and reporting language and export activity. + +Application resources are read-only. Electron user data contains `workspace/` (projects and configuration), `logs/` and a locale cache. Existing source or pip workspaces are not moved or overwritten. File inputs use native dialogs; downloads use the native save dialog. Closing the window hides it and keeps exports alive. Quit checks local Agent, generation, tool and renderer export activity, asks before interruption, then stops the Host and releases only edit sessions registered by its own window. The same cleanup runs when the parent control pipe closes. Remote jobs may continue and incur charges; shutdown does not claim remote cancellation. + +## Build and check + +Build on the target OS and architecture. Build prerequisites are Node.js from `.nvmrc`, npm, uv, and standalone FFmpeg/ffprobe binaries. End users do not need those development tools. + +```bash +npm ci --prefix apps/desktop +npm test --prefix apps/desktop +OPENDIRECTOR_FFMPEG_DIR=/absolute/path/to/standalone-media npm run prepare:runtime --prefix apps/desktop +npm run pack --prefix apps/desktop +node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector +``` + +The runtime preparation builds the Python wheel using the existing build backend, including Web assets, skills and the actual OpenCode executable. It installs the wheel and dependencies into a private standalone Python distribution, validates CLI help and both media binaries, and records the target in `runtime/manifest.json`. It never modifies system Python. Supply media binaries with their redistribution licenses for the target; system package-manager binaries with external shared-library dependencies are not portable. + +The smoke check launches the actual packaged executable with isolated temporary data, opens the canvas, checks authenticated health and project queries, verifies renderer isolation and both locales, hides the window without stopping the Host, and reopens the same project after quitting. It makes no provider calls. It does not establish Agent-assisted creation, export quality, signing, or support on an untested platform. + +## Terminal command + +Use **Manage terminal command** in the application menu to install, repair or remove the launcher in `~/.local/bin`. Add that directory to PATH if needed. Existing unrelated commands are never overwritten. `opendirector desktop` opens this installation; `opendirector serve` runs the ordinary standalone API. Business CLI commands retain their existing `--url`, project, session and revision rules. Automatic attachment of an external CLI to the private desktop Host is not available. + +## Delivery boundary + +This is the shared application for #363. Platform installers, signing and distribution are #364–#366; automatic updates are #367. Browser rendering still requires the application process. Closing the application cannot finish a browser export in the background. Microphone access is not enabled in this initial shell. + +Before release, run the complete clean-machine acceptance in #363 on each declared platform: Agent-assisted creation and tool use, editing, export, reopen, failure recovery, duplicate launch and locks. A successful smoke check alone is insufficient. OS/architecture support and signing status must be recorded with each platform's acceptance evidence. diff --git a/docs/development/desktop.zh-CN.md b/docs/development/desktop.zh-CN.md new file mode 100644 index 000000000..52e7aa26b --- /dev/null +++ b/docs/development/desktop.zh-CN.md @@ -0,0 +1,33 @@ +# 桌面应用 + +[English](desktop.md) + +桌面应用复用 Web UI 与 Python 业务服务。Electron 通过私有 JSON 行控制管道启动一个 Python Host,由系统分配本地端口。每次启动生成独立凭证,仅主进程转发带鉴权的请求。渲染进程使用 `opendirector://app`,没有 Node 权限,仅通过有限 IPC 登记自身编辑会话及同步语言和导出状态。 + +应用资源只读。Electron 用户数据目录保存 `workspace/`(工程和配置)、`logs/` 与语言缓存,不搬迁或覆盖已有源码、pip 工作区。文件输入使用原生选择器,下载使用原生保存对话框。关闭窗口会隐藏窗口并保留导出;退出前检查 Agent、生成、工具和浏览器导出任务,说明中断影响后停止 Host,并仅释放本窗口登记的编辑会话;父控制管道断开时也执行相同清理。远端任务可能继续执行并产生费用,停止应用不代表已取消远端任务。 + +## 构建与检查 + +在目标系统和架构上构建,需要 `.nvmrc` 指定的 Node.js、npm、uv 和独立 FFmpeg/ffprobe 二进制。最终用户无需准备这些开发工具。 + +```bash +npm ci --prefix apps/desktop +npm test --prefix apps/desktop +OPENDIRECTOR_FFMPEG_DIR=/absolute/path/to/standalone-media npm run prepare:runtime --prefix apps/desktop +npm run pack --prefix apps/desktop +node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector +``` + +运行时准备复用现有构建后端生成 Python wheel,包含前端、技能和实际 OpenCode 可执行文件;将 wheel 和依赖安装到私有独立 Python,验证 CLI 帮助及两个媒体程序,并将平台写入 `runtime/manifest.json`。不会修改系统 Python。提供对应平台可分发的媒体程序及许可证;依赖包管理器外部动态库的系统二进制不能直接作为便携运行时。 + +冒烟检查使用临时数据目录启动实际打包程序,进入画布,检查鉴权健康接口和工程查询,验证渲染隔离及中英文切换,隐藏窗口并确认 Host 保留,退出后重开同一工程,不调用模型服务。该检查不代表已完成 Agent 辅助创作、导出质量、签名或未测试平台的验收。 + +## 终端命令 + +通过应用菜单的“管理终端命令”在 `~/.local/bin` 安装、修复或移除启动器,必要时将该目录加入 PATH。不会覆盖其他安装。`opendirector desktop` 打开此安装的桌面应用;`opendirector serve` 运行独立 API。业务命令沿用 `--url`、工程、会话和版本规则,目前不支持外部 CLI 自动连接桌面私有 Host。 + +## 交付边界 + +本模块对应 #363 的共用应用。平台安装、签名和分发由 #364–#366 负责,自动更新由 #367 负责。浏览器导出仍需应用进程参与,退出应用后不能在后台完成;首版壳未开放麦克风权限。 + +发布前须按 #363 在各声明平台完成干净环境验收:Agent 辅助创作与工具调用、编辑、导出、重开、故障恢复、重复启动和工程锁。冒烟通过不能替代完整验收;操作系统、架构和签名状态随平台验收证据记录。 diff --git a/packages/core/src/opendirector/cli.py b/packages/core/src/opendirector/cli.py index 72771a219..a3619478d 100644 --- a/packages/core/src/opendirector/cli.py +++ b/packages/core/src/opendirector/cli.py @@ -9,6 +9,7 @@ import re import socket import shlex +import subprocess import sys from typing import Annotated, Literal from urllib.parse import quote @@ -299,6 +300,14 @@ class LogLevel(str, Enum): WebPortOption = Annotated[int, typer.Option(min=1, max=65535, help="Vite development port.")] +@app.command("desktop", help="Open the desktop application installed with this terminal command. / 打开此终端命令所属的桌面应用。") +def desktop(): + executable = os.environ.get('OPENDIRECTOR_DESKTOP_EXECUTABLE') + if not executable or not Path(executable).is_file(): + raise typer.BadParameter('Install the command from the desktop application menu. / 请从桌面应用菜单安装终端命令。') + subprocess.Popen([executable], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + @app.command("serve", help="Start the API and serve the built application.") def serve(port: PortOption = 8000, web_port: WebPortOption = 5173, log_level: LogLevel = LogLevel.info): from opendirector.launcher import start diff --git a/src/backend/api.ts b/src/backend/api.ts index 4d63e7dd5..3995a908f 100644 --- a/src/backend/api.ts +++ b/src/backend/api.ts @@ -4,6 +4,7 @@ import type { Locale } from "../i18n/types.ts"; import { tNow } from "../i18n/messages.ts"; export const sessionId = crypto.randomUUID(); +globalThis.window?.opendirectorDesktop?.registerSession(sessionId); const SESSION_KEY = "opendirector.session.v1"; const lockName = (id: string) => `opendirector.session.${id}`; diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css new file mode 100644 index 000000000..c301bfcf2 --- /dev/null +++ b/src/canvas/desktop-chrome.css @@ -0,0 +1,201 @@ +/* Desktop chrome shares the existing project toolbar; the canvas stays opaque. */ +html[data-desktop-platform="darwin"], +html[data-desktop-platform="darwin"] body, +html[data-desktop-platform="darwin"] #root, +html[data-desktop-platform="darwin"] .cw-workspace { + background: transparent; +} +html[data-desktop-platform="darwin"] { + --desktop-toolbar-height: 48px; + --desktop-toolbar-tint: rgb(36 38 44 / 26%); +} +html[data-desktop-platform="darwin"][data-theme="light"] { + --desktop-toolbar-tint: rgb(248 249 252 / 55%); +} +html[data-desktop-platform="darwin"] .cw-workspace .react-flow { + top: var(--desktop-toolbar-height); + background: #0d0d0d; +} +html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .react-flow { + background: #f7f8fa; +} +html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar { + height: var(--desktop-toolbar-height); + padding: 7px 16px 7px 104px; + background: var(--desktop-toolbar-tint); + border-bottom: 1px solid rgb(128 128 140 / 10%); + pointer-events: auto; + -webkit-app-region: drag; +} +html[data-desktop-platform="darwin"] .cw-topbar > *, +html[data-desktop-platform="darwin"] .cw-topbar :is(button, input, select, a, [role="button"]) { + -webkit-app-region: no-drag; +} +html[data-desktop-platform="darwin"][data-desktop-fullscreen] .cw-workspace .cw-topbar { + padding-left: 20px; +} +@media (max-width: 900px) { + html[data-desktop-platform="darwin"] .cw-topbar .cw-save-status { + display: none; + } +} +@media (prefers-reduced-transparency: reduce) { + html[data-desktop-platform="darwin"] { + --desktop-toolbar-tint: #202022; + } + html[data-desktop-platform="darwin"][data-theme="light"] { + --desktop-toolbar-tint: #eeeef1; + } +} + +html[data-desktop-platform="darwin"] .cw-topbar .cw-brand { + display: none; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading { + flex: 1; + gap: 6px; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-selector { + order: 0; + max-width: min(32vw, 330px); +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-title { + font-size: 13px; + font-weight: 600; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-save-status { + order: 1; + color: #92969f; + font-size: 11px; + margin-left: 10px; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle { + order: 3; + margin-left: auto; + border: 0; + padding: 0; + background: transparent; + gap: 0; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle button { + padding: 7px; + background: transparent; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle button.is-active { + font-weight: 600; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions { + gap: 2px; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions button { + width: 30px; + height: 30px; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions svg { + width: 18px; + height: 18px; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-dropdown { + left: 0; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading { + -webkit-app-region: drag; +} +html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading > * { + -webkit-app-region: no-drag; +} +.od-desktop-navigation { display: none; } +html[data-desktop-platform="darwin"] .od-desktop-navigation { display: contents; } +html[data-desktop-platform="darwin"] .cw-workspace { + --od-sidebar-width: 0px; +} +html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] { + --od-sidebar-width: 240px; +} +html[data-desktop-platform="darwin"] .cw-workspace .react-flow { + left: var(--od-sidebar-width); + transition: left 200ms ease; +} +html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar { + left: var(--od-sidebar-width); + padding-left: 172px; + background: #141414; + transition: left 200ms ease, padding-left 200ms ease; +} +html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-topbar { + padding-left: 20px; +} +html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .cw-topbar { background: #f7f8fa; } +.od-caption-actions { + position: absolute; + z-index: 45; + top: 8px; + left: 91px; + display: flex; + gap: 4px; + -webkit-app-region: no-drag; + transition: left 200ms ease; +} +[data-desktop-sidebar="open"] .od-caption-actions { left: 196px; } +.od-caption-actions button { + display: grid; + place-items: center; + width: 30px; + height: 32px; + padding: 0; + border: 0; + border-radius: 6px; + background: transparent; + color: #b8bac4; + cursor: pointer; +} +.od-caption-actions button:hover { background: #ffffff12; color: #fff; } +.od-project-sidebar { + position: absolute; + z-index: 40; + inset: 0 auto 0 0; + width: 240px; + display: flex; + flex-direction: column; + padding: 64px 12px 14px; + background: linear-gradient(155deg, #6665a726, #263a5620), #20212b66; + border-right: 1px solid #ffffff0d; + color: #eceef2; + transform: translateX(-100%); + visibility: hidden; + transition: transform 200ms ease, visibility 200ms; + -webkit-app-region: drag; +} +[data-desktop-sidebar="open"] .od-project-sidebar { transform: translateX(0); visibility: visible; } +.od-project-sidebar button, .od-project-sidebar nav { -webkit-app-region: no-drag; } +.od-sidebar-brand { display: flex; align-items: center; gap: 9px; padding: 8px 10px 26px; font-size: 19px; font-weight: 650; letter-spacing: -.5px; } +.od-sidebar-brand img { width: 29px; height: 29px; border-radius: 7px; } +.od-project-sidebar .od-sidebar-create { display: flex; align-items: center; justify-content: center; gap: 9px; height: 40px; flex-shrink: 0; margin-bottom: 28px; border: 1px solid #ffffff20; border-radius: 9px; background: #ffffff13; color: inherit; font-size: 13px; } +.od-sidebar-create span { font-size: 21px; line-height: 1; font-weight: 300; } +.od-sidebar-label { padding: 0 10px 10px; font-size: 11px; color: #a1a3b4; } +.od-project-sidebar nav { flex: 1; overflow: auto; min-height: 0; } +.od-project-sidebar nav button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; margin-bottom: 3px; border: 0; border-radius: 7px; background: transparent; color: #d5d7e1; text-align: left; font-size: 12px; } +.od-project-sidebar nav button svg { flex-shrink: 0; color: #9daed4; } +.od-project-sidebar nav button span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } +.od-project-sidebar nav button[aria-current="page"] { background: #ffffff12; color: #fff; } +.od-project-sidebar button:hover { background: #ffffff19; } +.od-project-sidebar button:focus-visible, .od-caption-actions button:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 2px; } +.od-project-sidebar .od-sidebar-settings { padding: 10px; text-align: left; font-size: 12px; background: transparent; border: 0; color: #b8bac7; } +.od-sidebar-error { color: #e7a4a4; font-size: 11px; overflow-wrap: anywhere; } +html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-bottom-left { left: 260px; } +html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-settings-control { visibility: hidden; } +html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar { background: linear-gradient(155deg, #8e8dda20, #98afcd18), #f4f4f780; color: #282b33; } +html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar nav button { color: #3c414d; } +html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar nav button[aria-current="page"] { background: #484e7010; } +html[data-desktop-platform="darwin"][data-desktop-fullscreen] .od-caption-actions { left: 12px; } +html[data-desktop-platform="darwin"][data-desktop-fullscreen] [data-desktop-sidebar="open"] .od-caption-actions { left: 196px; } +html[data-desktop-platform="darwin"][data-desktop-fullscreen] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } +@media (prefers-reduced-motion: reduce) { + .od-project-sidebar, .od-caption-actions, + html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar, + html[data-desktop-platform="darwin"] .cw-workspace .react-flow { transition: none; } +} +@media (prefers-reduced-transparency: reduce) { .od-project-sidebar { background: #272735; } } +html[data-desktop-platform="darwin"] .cw-workspace .cw-rail-shell { left: var(--od-sidebar-width); transition: left 200ms ease; } +html[data-desktop-platform="darwin"] .cw-workspace .cw-empty { left: calc(50% + var(--od-sidebar-width) / 2); width: min(calc(80vw - var(--od-sidebar-width)), 600px); } +html[data-desktop-platform="darwin"] .cw-workspace:not([data-assistant-open="true"]) .cw-top-actions { transform: none; } diff --git a/src/canvas/timelineRender.ts b/src/canvas/timelineRender.ts index a16ed810c..76f8cdf36 100644 --- a/src/canvas/timelineRender.ts +++ b/src/canvas/timelineRender.ts @@ -1,3 +1,4 @@ +import { desktopExportStarted } from "../desktop.ts"; import { AudioBufferSink, BlobSource, @@ -49,6 +50,7 @@ export async function renderTimelineMp4( const disposeInputs = () => inputs.forEach((input) => input.dispose()); signal.addEventListener("abort", disposeInputs, { once: true }); let fonts: TimelineFontSession | undefined; + const exportFinished = desktopExportStarted(); try { fonts = await prepareTimelineFonts(timeline, signal); for (const segment of segments) { @@ -261,6 +263,7 @@ export async function renderTimelineMp4( : {}), }); } finally { + exportFinished(); fonts?.dispose(); signal.removeEventListener("abort", disposeInputs); disposeInputs(); diff --git a/src/canvas/workspace/DesktopSidebar.tsx b/src/canvas/workspace/DesktopSidebar.tsx new file mode 100644 index 000000000..209036dff --- /dev/null +++ b/src/canvas/workspace/DesktopSidebar.tsx @@ -0,0 +1,40 @@ +import { useEffect, useState } from "react"; +import { listWorkspaceProjects, type WorkspaceProject } from "../../backend/workspace"; +import { errorMessage } from "../../backend/api"; +import { useT } from "../../i18n/I18nProvider"; +import logo from "../../assets/open_director_logo.png"; + +export function DesktopSidebar({ open, currentId, disabled, onToggle, onCreate, onSelect, onSettings }: { + open: boolean; currentId: string; disabled: boolean; onToggle: () => void; + onCreate: () => void; onSelect: (project: WorkspaceProject) => Promise; onSettings: () => void; +}) { + const t = useT(); + const [projects, setProjects] = useState([]); + const [error, setError] = useState(""); + useEffect(() => { + if (!open) return; + let active = true; + void listWorkspaceProjects().then(result => { + if (active) { setProjects(result.projects); setError(result.warnings.join("\n")); } + }).catch(error => { if (active) setError(errorMessage(error)); }); + return () => { active = false; }; + }, [open, currentId]); + return
+
+ + {!open && } +
+ +
; +} diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index 73ca99a34..90d74d4a0 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -1,7 +1,8 @@ +import { DesktopSidebar } from "./DesktopSidebar"; import { Background, BackgroundVariant, MiniMap, SelectionMode, ViewportPortal } from "@xyflow/react"; import "@xyflow/react/dist/style.css"; -import { Suspense, useEffect, type CSSProperties } from "react"; +import { Suspense, useEffect, useState, type CSSProperties } from "react"; import { createNode } from "../model.ts"; import { NodeVersionHistory } from "../NodeVersionHistory"; @@ -91,6 +92,7 @@ import { TooltipButton } from "../TooltipButton"; import { VideoActionEditor } from "../VideoActionEditor"; import { captureVideoEndpoint, extractVideoAudio } from "../videoActionRuntime"; import "../workspace.css"; +import "../desktop-chrome.css"; import type { WorkspaceRuntime } from "./runtimeTypes.ts"; import { DirectorStage, IconButton, helpShortcuts, nodeTypes, edgeTypes, referenceSideKeys, incomingNodes } from "./workspaceChrome.tsx"; @@ -334,6 +336,23 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { rt.revealCreatedNodes.current([output], doc.nodes.some((node) => node.id === output.id) ? doc.nodes : [...doc.nodes, output]); }, [outputState?.output.id]); + const desktop = !!window.opendirectorDesktop; + const [desktopSidebarOpen, setDesktopSidebarOpen] = useState(true); + const createDesktopProject = () => { + const id = crypto.randomUUID(); + void switchDocument(async () => { + const { projects } = await listWorkspaceProjects(); + const names = new Set(projects.map(project => project.name)); + const base = t("canvas.project.defaultName"); + let name = base; + for (let suffix = 2; names.has(name); suffix++) name = `${base} ${suffix}`; + const project = await createWorkspaceProject(name, id); + const document = await openWorkspaceProject(project); + await saveWorkspaceDocument(document); + return document; + }).then(success => { if (success) setEditProjectNameId(id); }); + }; + const workspace = (
)} + {desktop && setDesktopSidebarOpen(value => !value)} + onCreate={createDesktopProject} + onSelect={project => switchDocument(() => openWorkspaceProject(project))} + onSettings={() => setSettingsOpen(true)} />}
switchDocument(() => openWorkspaceProject(project)) } - onCreate={() => { - const id = crypto.randomUUID(); - void switchDocument(async () => { - const { projects } = await listWorkspaceProjects(); - const names = new Set(projects.map(project => project.name)); - const base = t("canvas.project.defaultName"); - let name = base; - for (let suffix = 2; names.has(name); suffix++) name = `${base} ${suffix}`; - const project = await createWorkspaceProject(name, id); - const document = await openWorkspaceProject(project); - await saveWorkspaceDocument(document); - return document; - }).then(success => { if (success) setEditProjectNameId(id); }); - }} + onCreate={createDesktopProject} onRename={renameCurrentProject} onRenameProject={renameProject} onDeleteProject={deleteProject} diff --git a/src/desktop.ts b/src/desktop.ts new file mode 100644 index 000000000..175ee40a5 --- /dev/null +++ b/src/desktop.ts @@ -0,0 +1,23 @@ +/** Desktop lifecycle signals; business commands stay on the shared API. */ +export interface DesktopBridge { + registerSession(id: string): void; + setLocale(locale: "zh-CN" | "en-US"): void; + setExporting(active: boolean): void; +} + +declare global { + interface Window { opendirectorDesktop?: DesktopBridge } +} + +let exportsInProgress = 0; +export function desktopExportStarted(): () => void { + exportsInProgress += 1; + globalThis.window?.opendirectorDesktop?.setExporting(true); + let finished = false; + return () => { + if (finished) return; + finished = true; + exportsInProgress -= 1; + globalThis.window?.opendirectorDesktop?.setExporting(exportsInProgress > 0); + }; +} diff --git a/src/i18n/I18nProvider.tsx b/src/i18n/I18nProvider.tsx index 9cc133d7c..0773c6902 100644 --- a/src/i18n/I18nProvider.tsx +++ b/src/i18n/I18nProvider.tsx @@ -1,3 +1,4 @@ +import "../desktop.ts"; /** React binding for the locale catalog. */ import { createContext, @@ -58,6 +59,7 @@ export function I18nProvider({ children }: { children: ReactNode }) { }, [locale]); useEffect(() => { + window.opendirectorDesktop?.setLocale(locale); document.title = translate(locale, "app.title"); const description = document.querySelector( 'meta[name="description"]', diff --git a/src/i18n/messages/en-US/canvasShell.ts b/src/i18n/messages/en-US/canvasShell.ts index ff6ce1035..9c11277e0 100644 --- a/src/i18n/messages/en-US/canvasShell.ts +++ b/src/i18n/messages/en-US/canvasShell.ts @@ -1,4 +1,6 @@ export const canvasShell = { + "desktop.sidebar.toggle": "Toggle project sidebar", + "desktop.sidebar.projects": "Projects", "canvas.project.search": "Search projects", "canvas.project.clearSearch": "Clear search", "canvas.project.noSearchResults": "No matching projects", diff --git a/src/i18n/messages/zh-CN/canvasShell.ts b/src/i18n/messages/zh-CN/canvasShell.ts index 6ac08b69a..53ecaff61 100644 --- a/src/i18n/messages/zh-CN/canvasShell.ts +++ b/src/i18n/messages/zh-CN/canvasShell.ts @@ -1,5 +1,7 @@ /** Canvas search, notifications, project switching and selection toolbars. */ export const canvasShell = { + "desktop.sidebar.toggle": "展开或收起项目侧栏", + "desktop.sidebar.projects": "项目", "canvas.project.search": "搜索项目", "canvas.project.clearSearch": "清空搜索", "canvas.project.noSearchResults": "没有匹配的项目", diff --git a/tests/desktop.test.ts b/tests/desktop.test.ts new file mode 100644 index 000000000..76b7457d9 --- /dev/null +++ b/tests/desktop.test.ts @@ -0,0 +1,19 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { desktopExportStarted, type DesktopBridge } from "../src/desktop.ts"; + +test("overlapping exports keep desktop shutdown protection until the last export finishes", () => { + const states: boolean[] = []; + const previous = Object.getOwnPropertyDescriptor(globalThis, "window"); + const bridge: DesktopBridge = { registerSession: () => {}, setLocale: () => {}, setExporting: value => states.push(value) }; + Object.defineProperty(globalThis, "window", { configurable: true, value: { opendirectorDesktop: bridge } }); + try { + const first = desktopExportStarted(); + const second = desktopExportStarted(); + first(); first(); second(); + assert.deepEqual(states, [true, true, true, false]); + } finally { + if (previous) Object.defineProperty(globalThis, "window", previous); + else Reflect.deleteProperty(globalThis, "window"); + } +}); diff --git a/tests/test_desktop_host.py b/tests/test_desktop_host.py new file mode 100644 index 000000000..f90f342e3 --- /dev/null +++ b/tests/test_desktop_host.py @@ -0,0 +1,60 @@ +import asyncio +import json +import os +import subprocess +import sys + +from fastapi.testclient import TestClient +import pytest + +from opendirector_api.desktop import DesktopAuthentication, Initialize +from opendirector_api.main import create_app +from opendirector.infrastructure.local_projects import LocalProjects + + +def test_desktop_auth_protects_api_and_static_without_changing_browser_mode(tmp_path): + app = create_app(LocalProjects(tmp_path)) + app.add_middleware(DesktopAuthentication, token='a' * 64) + with TestClient(app) as client: + for path in ['/', '/api/health', '/api/creation/projects']: + assert client.get(path, headers={'X-OpenDirector-Request': '1'}).status_code == 403 + assert client.get('/api/health', headers=[(b'x-opendirector-desktop', b'\xff')]).status_code == 403 + for language, expected in [('en-US', 'Reopen'), ('zh-CN', '重新打开')]: + assert expected in client.get('/api/health', headers={'Accept-Language': language}).json()['detail'] + headers = {'X-OpenDirector-Desktop': 'a' * 64, 'X-OpenDirector-Request': '1'} + assert client.get('/api/health', headers=headers).json() == {'status': 'ok'} + assert client.get('/api/creation/projects', headers=headers).status_code == 200 + with TestClient(create_app(LocalProjects(tmp_path))) as client: + assert client.get('/api/health', headers={'X-OpenDirector-Request': '1'}).status_code == 200 + + +def test_desktop_initialize_rejects_wrong_version_and_short_credentials(): + for value in [dict(type='initialize', version=2, token='a' * 64), dict(type='initialize', version=1, token='short')]: + with pytest.raises(ValueError): + Initialize.model_validate(value) + + +def test_desktop_rejects_bad_parent_handshake_without_starting(tmp_path): + process = subprocess.run([sys.executable, '-m', 'opendirector_api.desktop'], + input='{"type":"initialize","version":1,"token":"short"}\n', + capture_output=True, text=True, timeout=20, env={**os.environ, 'OPENDIRECTOR_ROOT': str(tmp_path)}) + assert process.returncode == 1 + assert json.loads(process.stdout)['type'] == 'fatal' + assert not list(tmp_path.iterdir()) + + +def test_desktop_auth_rejects_websocket_without_accepting_it(): + events = [] + + async def application(scope, receive, send): + pytest.fail('Unauthenticated WebSocket reached the application') + + async def receive(): + return {'type': 'websocket.connect'} + + async def send(event): + events.append(event) + + asyncio.run(DesktopAuthentication(application, token='a' * 64)( + {'type': 'websocket', 'headers': []}, receive, send)) + assert events == [{'type': 'websocket.close', 'code': 1008}] From b58ae3685133414c4a17036219ef30a2943464eb Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 19:33:33 +0800 Subject: [PATCH 02/31] [ci] desktop: attach verified DMG to draft releases Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 103 ++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/desktop-release.yml diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml new file mode 100644 index 000000000..87bd2bfc0 --- /dev/null +++ b/.github/workflows/desktop-release.yml @@ -0,0 +1,103 @@ +name: Desktop release + +on: + push: + tags: ['v*'] + workflow_dispatch: + inputs: + tag: + description: Existing release tag (for example, v0.1.4) + required: true + type: string + +permissions: + contents: read + +concurrency: + group: desktop-release-${{ inputs.tag || github.ref_name }} + cancel-in-progress: false + +env: + RELEASE_TAG: ${{ inputs.tag || github.ref_name }} + +jobs: + build: + runs-on: macos-15 + timeout-minutes: 45 + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + ref: refs/tags/${{ env.RELEASE_TAG }} + persist-credentials: false + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: .nvmrc + - name: Check release version and architecture + run: | + test "$RELEASE_TAG" = "v$(node -p 'require("./apps/desktop/package.json").version')" + test "$(uname -m)" = arm64 + - name: Prepare build tools + run: | + brew install uv + media="$RUNNER_TEMP/desktop-media" + mkdir -p "$media" + for tool in ffmpeg ffprobe; do + curl --fail --silent --show-error --location --retry 3 \ + "https://github.com/descriptinc/ffmpeg-ffprobe-static/releases/download/b6.1.2-rc.1/${tool}-darwin-arm64" \ + --output "$media/$tool" + chmod +x "$media/$tool" + "$media/$tool" -version + done + echo "OPENDIRECTOR_FFMPEG_DIR=$media" >> "$GITHUB_ENV" + - name: Build desktop application + env: + CSC_IDENTITY_AUTO_DISCOVERY: 'false' + run: | + npm ci --prefix apps/desktop + npm run prepare:runtime --prefix apps/desktop + npm run pack --prefix apps/desktop + - name: Build and smoke-test DMG + run: | + staging="$RUNNER_TEMP/desktop-dmg" + mount="$RUNNER_TEMP/desktop-mount" + mkdir -p "$staging" "$mount" release-assets + ditto apps/desktop/build/mac-arm64/OpenDirector.app "$staging/OpenDirector.app" + ln -s /Applications "$staging/Applications" + dmg="OpenDirector-${RELEASE_TAG}-mac-arm64-unsigned.dmg" + hdiutil create -volname OpenDirector -srcfolder "$staging" -format UDZO "release-assets/$dmg" + hdiutil attach "release-assets/$dmg" -readonly -nobrowse -mountpoint "$mount" + trap 'hdiutil detach "$mount"' EXIT + node apps/desktop/scripts/smoke.mjs "$mount/OpenDirector.app/Contents/MacOS/OpenDirector" + cd release-assets + shasum -a 256 "$dmg" > "${dmg}.sha256" + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: desktop-dmg + path: release-assets/ + compression-level: 0 + if-no-files-found: error + + release: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: desktop-dmg + path: release-assets + - name: Attach verified DMG to draft release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + set -euo pipefail + draft=$(gh api --paginate "repos/$GH_REPO/releases" \ + --jq ".[] | select(.tag_name == \"$RELEASE_TAG\") | .draft") + case "$draft" in + true) ;; + '') gh release create "$RELEASE_TAG" --verify-tag --draft --generate-notes ;; + *) echo "::error::Release $RELEASE_TAG is already published"; exit 1 ;; + esac + gh release upload "$RELEASE_TAG" release-assets/* --clobber From 5ec4d34eca86ae0d91869763d1620c5ec8c9812b Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 19:47:09 +0800 Subject: [PATCH 03/31] [fix] desktop: register terminal commands without overwriting files Signed-off-by: Weiming Liao --- apps/desktop/src/command.mjs | 33 ++++++++++++++--------------- apps/desktop/src/locale.mjs | 12 +++++++---- apps/desktop/src/main.mjs | 17 +++++++-------- apps/desktop/tests/host.test.mjs | 35 +++++++++++++++++-------------- docs/development/desktop.md | 2 +- docs/development/desktop.zh-CN.md | 2 +- 6 files changed, 52 insertions(+), 49 deletions(-) diff --git a/apps/desktop/src/command.mjs b/apps/desktop/src/command.mjs index 9289e0588..b086c756b 100644 --- a/apps/desktop/src/command.mjs +++ b/apps/desktop/src/command.mjs @@ -1,24 +1,23 @@ -import { lstat, readFile, readlink, mkdir, symlink, unlink, writeFile, rename } from 'node:fs/promises'; -import { randomUUID } from 'node:crypto'; +import { readFile, readlink, mkdir, symlink, writeFile } from 'node:fs/promises'; import { dirname, join } from 'node:path'; -export async function registerCommand({ destination, launcher, previousLauncher, remove = false }) { +export async function registerCommand({ destination, launcher }) { await mkdir(dirname(destination), { recursive: true }); - const existing = await lstat(destination).catch(error => { if (error.code !== 'ENOENT') throw error; return null; }); - if (existing) { - const targets = [launcher, previousLauncher].filter(Boolean); - const owned = existing.isSymbolicLink() ? targets.includes(await readlink(destination)) - : await readFile(destination, 'utf8').then(value => targets.some(target => value === `@"${target}" %*\r\n`)); - if (!owned) throw new Error('command_collision'); - if (remove) { await unlink(destination); return; } - } - if (remove) return; - const temporary = destination + '.' + randomUUID(); + const windows = process.platform === 'win32'; + const script = `@"${launcher}" %*\r\n`; try { - if (process.platform === 'win32') await writeFile(temporary, `@"${launcher}" %*\r\n`, { flag: 'wx' }); - else await symlink(launcher, temporary); - await rename(temporary, destination); - } finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); } + if (windows) await writeFile(destination, script, { flag: 'wx' }); + else await symlink(launcher, destination); + return 'installed'; + } catch (error) { + if (error.code !== 'EEXIST') throw error; + } + + const matches = windows + ? await readFile(destination, 'utf8').then(value => value === script, () => false) + : await readlink(destination).then(value => value === launcher, () => false); + if (matches) return 'already_installed'; + throw new Error('command_collision'); } export const commandPath = home => join(home, '.local', 'bin', process.platform === 'win32' ? 'opendirector.cmd' : 'opendirector'); diff --git a/apps/desktop/src/locale.mjs b/apps/desktop/src/locale.mjs index d48f083e1..c68b12b00 100644 --- a/apps/desktop/src/locale.mjs +++ b/apps/desktop/src/locale.mjs @@ -5,8 +5,10 @@ export const messages = { running: 'Agent, generation or export work is active, or its status could not be checked. Quitting interrupts local work. Remote jobs may continue and incur charges. Quit now?', edit: 'Edit', view: 'View', undo: 'Undo', redo: 'Redo', cut: 'Cut', copy: 'Copy', paste: 'Paste', selectAll: 'Select all', fullscreen: 'Toggle fullscreen', devtools: 'Developer tools', menu: 'File', logs: 'Open diagnostics folder', data: 'Open data folder', command: 'Manage terminal command', - install: 'Install / Repair', remove: 'Remove', commandDone: 'Terminal command updated. Open a new terminal to use it.', - collision: 'Another command already exists. Remove it explicitly before registering this installation.', + install: 'Install', remove: 'Removal instructions', commandDone: 'Terminal command installed. Open a new terminal to use it.', + commandAlreadyInstalled: 'The terminal command is already installed.', + commandRemoveHelp: 'To uninstall the command, inspect the entry at this path and remove it manually if it belongs to OpenDirector.', + collision: 'This path is already in use. To repair a previous OpenDirector installation, inspect and manually remove its old entry before installing again.', failed: 'Operation failed', close: 'Close', save: 'Save file', }, 'zh-CN': { @@ -15,8 +17,10 @@ export const messages = { running: 'Agent、生成或导出任务仍在运行,或无法确认任务状态。退出会中断本地工作;远端任务可能继续运行并产生费用。是否退出?', edit: '编辑', view: '视图', undo: '撤销', redo: '重做', cut: '剪切', copy: '复制', paste: '粘贴', selectAll: '全选', fullscreen: '切换全屏', devtools: '开发者工具', menu: '文件', logs: '打开诊断目录', data: '打开数据目录', command: '管理终端命令', - install: '安装/修复', remove: '移除', commandDone: '终端命令已更新,请打开新终端使用。', - collision: '已有其他终端命令,请明确移除后再注册此安装。', + install: '安装', remove: '移除说明', commandDone: '终端命令已安装,请打开新终端使用。', + commandAlreadyInstalled: '终端命令已安装。', + commandRemoveHelp: '如需卸载终端命令,请检查此路径下的入口,确认它属于 OpenDirector 后手动移除。', + collision: '此路径已被占用。如需修复旧版 OpenDirector 的终端命令,请检查并手动移除旧入口,再重新安装。', failed: '操作失败', close: '关闭', save: '保存文件', }, }; diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index 973871bcf..e7884f6dc 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -80,20 +80,17 @@ async function manageCommand() { const { response } = await dialog.showMessageBox(window, { message: text().command, detail: destination, buttons: [text().install, text().remove, text().cancel], cancelId: 2 }); if (response === 2) return; + if (response === 1) { + await dialog.showMessageBox(window, { message: text().commandRemoveHelp, detail: destination }); + return; + } try { - const receipt = join(userData, 'command-registration.json'); - let previousLauncher; - try { - const previous = JSON.parse(readFileSync(receipt, 'utf8')); - if (previous.destination === destination && typeof previous.launcher === 'string') previousLauncher = previous.launcher; - } catch (error) { if (error.code !== 'ENOENT') throw error; } const launcher = join(runtime, 'bin', process.platform === 'win32' ? 'opendirector.cmd' : 'opendirector'); - await registerCommand({ destination, previousLauncher, launcher, remove: response === 1 }); - writeFileSync(receipt, JSON.stringify({ destination, launcher }), { mode: 0o600 }); - await dialog.showMessageBox(window, { message: text().commandDone, detail: destination }); + const result = await registerCommand({ destination, launcher }); + await dialog.showMessageBox(window, { message: text()[result === 'installed' ? 'commandDone' : 'commandAlreadyInstalled'], detail: destination }); } catch (error) { await dialog.showMessageBox(window, { type: 'error', message: text().failed, - detail: error.message === 'command_collision' ? text().collision : error.message }); + detail: error.message === 'command_collision' ? [text().collision, destination].join('\n') : error.message }); } } diff --git a/apps/desktop/tests/host.test.mjs b/apps/desktop/tests/host.test.mjs index 621147fe1..27b56c8f8 100644 --- a/apps/desktop/tests/host.test.mjs +++ b/apps/desktop/tests/host.test.mjs @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { eventSchema, proxyRequest } from '../src/host.mjs'; import { messages } from '../src/locale.mjs'; import { registerCommand } from '../src/command.mjs'; -import { mkdtemp, readlink, rm, writeFile, lstat } from 'node:fs/promises'; +import { mkdtemp, readlink, rm, writeFile, readFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; @@ -41,20 +41,18 @@ test('Native dialogs have matching bilingual keys', () => { assert.deepEqual(Object.keys(messages['en-US']).sort(), Object.keys(messages['zh-CN']).sort()); }); -test('Command registration refuses collisions and only removes its own launcher', async () => { +test('Command registration preserves existing files and supports repeated installation', async () => { const directory = await mkdtemp(join(tmpdir(), 'od-command-')); const destination = join(directory, 'opendirector'); const launcher = join(directory, 'launcher'); try { await writeFile(destination, 'another installation'); await assert.rejects(registerCommand({ destination, launcher }), /command_collision/); - await assert.rejects(registerCommand({ destination, launcher, remove: true }), /command_collision/); + assert.equal(await readFile(destination, 'utf8'), 'another installation'); await rm(destination); - await registerCommand({ destination, launcher }); + assert.equal(await registerCommand({ destination, launcher }), 'installed'); if (process.platform !== 'win32') assert.equal(await readlink(destination), launcher); - await registerCommand({ destination, launcher }); - await registerCommand({ destination, launcher, remove: true }); - await assert.rejects(lstat(destination), { code: 'ENOENT' }); + assert.equal(await registerCommand({ destination, launcher }), 'already_installed'); } finally { await rm(directory, { recursive: true, force: true }); } }); @@ -65,16 +63,21 @@ test('Proxy never follows redirects carrying the desktop credential', async () = assert.equal(response.status, 502); }); -test('Command repair after moving the app only replaces the recorded launcher', async () => { - const directory = await mkdtemp(join(tmpdir(), 'od-command-move-')); +test('Concurrent command installs preserve the winning launcher', async () => { + const directory = await mkdtemp(join(tmpdir(), 'od-command-race-')); const destination = join(directory, 'opendirector'); - const previousLauncher = join(directory, 'old-app'); - const launcher = join(directory, 'new-app'); + const launchers = ['first', 'second'].map(name => join(directory, name)); try { - await registerCommand({ destination, launcher: previousLauncher }); - await assert.rejects(registerCommand({ destination, launcher }), /command_collision/); - await registerCommand({ destination, launcher, previousLauncher }); - if (process.platform !== 'win32') assert.equal(await readlink(destination), launcher); - await registerCommand({ destination, launcher, remove: true }); + const results = await Promise.allSettled(launchers.map(launcher => + registerCommand({ destination, launcher }))); + const winner = results.findIndex(result => result.status === 'fulfilled'); + assert.notEqual(winner, -1); + assert.deepEqual(results[winner], { status: 'fulfilled', value: 'installed' }); + assert.match(results[1 - winner].reason?.message ?? '', /^command_collision$/); + if (process.platform === 'win32') { + assert.equal(await readFile(destination, 'utf8'), `@"${launchers[winner]}" %*\r\n`); + } else { + assert.equal(await readlink(destination), launchers[winner]); + } } finally { await rm(directory, { recursive: true, force: true }); } }); diff --git a/docs/development/desktop.md b/docs/development/desktop.md index 48e7e4baf..6599b09e1 100644 --- a/docs/development/desktop.md +++ b/docs/development/desktop.md @@ -24,7 +24,7 @@ The smoke check launches the actual packaged executable with isolated temporary ## Terminal command -Use **Manage terminal command** in the application menu to install, repair or remove the launcher in `~/.local/bin`. Add that directory to PATH if needed. Existing unrelated commands are never overwritten. `opendirector desktop` opens this installation; `opendirector serve` runs the ordinary standalone API. Business CLI commands retain their existing `--url`, project, session and revision rules. Automatic attachment of an external CLI to the private desktop Host is not available. +Use **Manage terminal command** in the application menu to install the launcher in `~/.local/bin`. Add that directory to PATH if needed. The app preserves existing entries. To uninstall or repair an old installation, check the path shown in the app and manually remove the OpenDirector entry. To repair it, run Install again. `opendirector desktop` opens this installation; `opendirector serve` runs the ordinary standalone API. Business CLI commands retain their existing `--url`, project, session and revision rules. Automatic attachment of an external CLI to the private desktop Host is not available. ## Delivery boundary diff --git a/docs/development/desktop.zh-CN.md b/docs/development/desktop.zh-CN.md index 52e7aa26b..c9ffd1486 100644 --- a/docs/development/desktop.zh-CN.md +++ b/docs/development/desktop.zh-CN.md @@ -24,7 +24,7 @@ node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector ## 终端命令 -通过应用菜单的“管理终端命令”在 `~/.local/bin` 安装、修复或移除启动器,必要时将该目录加入 PATH。不会覆盖其他安装。`opendirector desktop` 打开此安装的桌面应用;`opendirector serve` 运行独立 API。业务命令沿用 `--url`、工程、会话和版本规则,目前不支持外部 CLI 自动连接桌面私有 Host。 +通过应用菜单的“管理终端命令”在 `~/.local/bin` 安装启动器,必要时将该目录加入 PATH。应用会保留已有入口。如需卸载或修复旧安装,请检查应用显示的路径,确认入口属于 OpenDirector 后手动移除。修复时再点一次安装。`opendirector desktop` 打开此安装的桌面应用;`opendirector serve` 运行独立 API。业务命令沿用 `--url`、工程、会话和版本规则,目前不支持外部 CLI 自动连接桌面私有 Host。 ## 交付边界 From 61ced83808e99dd81e6be7a5b00506b18a9f8e7c Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 22:32:35 +0800 Subject: [PATCH 04/31] [ci] desktop: build and verify a Windows x64 installer Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 86 +++++++++++++++++++++++++-- apps/desktop/package.json | 5 ++ build_backend.py | 7 ++- docs/development/desktop.md | 4 ++ docs/development/desktop.zh-CN.md | 4 ++ 5 files changed, 101 insertions(+), 5 deletions(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 87bd2bfc0..c32babe69 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -3,6 +3,11 @@ name: Desktop release on: push: tags: ['v*'] + pull_request: + paths: + - '.github/workflows/desktop-release.yml' + - 'apps/desktop/**' + - 'build_backend.py' workflow_dispatch: inputs: tag: @@ -21,7 +26,8 @@ env: RELEASE_TAG: ${{ inputs.tag || github.ref_name }} jobs: - build: + macos: + if: github.event_name != 'pull_request' runs-on: macos-15 timeout-minutes: 45 steps: @@ -77,17 +83,89 @@ jobs: compression-level: 0 if-no-files-found: error + windows: + env: + RELEASE_TAG: ${{ github.event_name != 'pull_request' && (inputs.tag || github.ref_name) || '' }} + runs-on: windows-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + ref: ${{ env.RELEASE_TAG != '' && format('refs/tags/{0}', env.RELEASE_TAG) || github.sha }} + persist-credentials: false + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: .nvmrc + - name: Check release version and architecture + run: | + $version = node -p 'require("./apps/desktop/package.json").version' + if ($env:GITHUB_EVENT_NAME -eq 'pull_request') { + "RELEASE_TAG=v$version" >> $env:GITHUB_ENV + $env:RELEASE_TAG = "v$version" + } + if ($env:RELEASE_TAG -ne "v$version" -or (node -p process.arch) -ne 'x64') { + throw 'Expected a matching release tag and Windows x64' + } + - name: Prepare build tools + run: | + choco install uv --yes --no-progress + if ($LASTEXITCODE -ne 0) { throw 'uv installation failed' } + $media = Join-Path $env:RUNNER_TEMP 'desktop-media' + New-Item -ItemType Directory -Path $media | Out-Null + foreach ($tool in 'ffmpeg', 'ffprobe') { + curl.exe --fail --silent --show-error --location --retry 3 ` + "https://github.com/descriptinc/ffmpeg-ffprobe-static/releases/download/b6.1.2-rc.1/${tool}-win32-x64" ` + --output (Join-Path $media "$tool.exe") + if ($LASTEXITCODE -ne 0) { throw "Failed to download $tool" } + } + "OPENDIRECTOR_FFMPEG_DIR=$media" >> $env:GITHUB_ENV + - name: Build Windows installer + env: + CSC_IDENTITY_AUTO_DISCOVERY: 'false' + run: | + npm ci --prefix apps/desktop + if ($LASTEXITCODE -ne 0) { throw 'Desktop dependency installation failed' } + npm run prepare:runtime --prefix apps/desktop + if ($LASTEXITCODE -ne 0) { throw 'Runtime preparation failed' } + npm run pack:windows --prefix apps/desktop + if ($LASTEXITCODE -ne 0) { throw 'Windows packaging failed' } + - name: Smoke-test installed application + run: | + $name = "OpenDirector-$env:RELEASE_TAG-win-x64-unsigned.exe" + $installer = Get-Item "apps/desktop/build/$name" + $install = Join-Path $env:RUNNER_TEMP 'OpenDirector' + $setup = Start-Process -FilePath $installer.FullName -ArgumentList "/S /D=$install" -Wait -PassThru + if ($setup.ExitCode -ne 0) { throw "Installer failed: $($setup.ExitCode)" } + node apps/desktop/scripts/smoke.mjs (Join-Path $install 'OpenDirector.exe') + if ($LASTEXITCODE -ne 0) { throw 'Installed application smoke test failed' } + $uninstaller = Get-Item (Join-Path $install 'Uninstall OpenDirector.exe') + $removal = Start-Process -FilePath $uninstaller.FullName -ArgumentList '/S' -Wait -PassThru + if ($removal.ExitCode -ne 0 -or (Test-Path (Join-Path $install 'OpenDirector.exe'))) { + throw 'Uninstall failed' + } + New-Item -ItemType Directory -Path release-assets | Out-Null + Copy-Item $installer.FullName release-assets + $hash = (Get-FileHash -Algorithm SHA256 $installer.FullName).Hash.ToLowerInvariant() + "$hash $name" | Set-Content -Encoding ascii "release-assets/$name.sha256" + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: desktop-windows + path: release-assets/ + compression-level: 0 + if-no-files-found: error + release: - needs: build + needs: [macos, windows] runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: - name: desktop-dmg + pattern: desktop-* + merge-multiple: true path: release-assets - - name: Attach verified DMG to draft release + - name: Attach verified installers to draft release env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 5d00130af..708da7ec4 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -9,6 +9,7 @@ "test": "node --test tests/*.test.mjs", "prepare:runtime": "node scripts/prepare-runtime.mjs", "pack": "electron-builder --dir", + "pack:windows": "electron-builder --win nsis --x64", "smoke": "node scripts/smoke.mjs" }, "dependencies": { @@ -42,6 +43,10 @@ "win": { "target": "dir" }, + "nsis": { + "artifactName": "OpenDirector-v${version}-win-${arch}-unsigned.${ext}", + "deleteAppDataOnUninstall": false + }, "linux": { "target": "dir", "category": "AudioVideo" diff --git a/build_backend.py b/build_backend.py index 3120b042a..cec3032e6 100644 --- a/build_backend.py +++ b/build_backend.py @@ -1,5 +1,6 @@ """PEP 517/660 backend: build web and native resources for both pip install modes.""" import os +import platform import json from pathlib import Path import shutil @@ -25,7 +26,11 @@ def prepare_resources(): shutil.copytree(ROOT / 'packages/agent/skills', bundled / 'skills') npm_package = ROOT / 'node_modules/opencode-ai' metadata = json.loads((npm_package / 'package.json').read_text()) - executable = npm_package / metadata['bin']['opencode'] + if os.name == 'nt': + arch = {'AMD64': 'x64', 'ARM64': 'arm64'}[platform.machine().upper()] + executable = npm_package.parent / f'opencode-windows-{arch}' / 'bin/opencode.exe' + else: + executable = npm_package / metadata['bin']['opencode'] subprocess.run([str(executable), '--version'], check=True, cwd=ROOT) (bundled / 'bin').mkdir() shutil.copy2(executable.resolve(), bundled / 'bin' / ('opencode.exe' if os.name == 'nt' else 'opencode')) diff --git a/docs/development/desktop.md b/docs/development/desktop.md index 6599b09e1..3ef71867a 100644 --- a/docs/development/desktop.md +++ b/docs/development/desktop.md @@ -31,3 +31,7 @@ Use **Manage terminal command** in the application menu to install the launcher This is the shared application for #363. Platform installers, signing and distribution are #364–#366; automatic updates are #367. Browser rendering still requires the application process. Closing the application cannot finish a browser export in the background. Microphone access is not enabled in this initial shell. Before release, run the complete clean-machine acceptance in #363 on each declared platform: Agent-assisted creation and tool use, editing, export, reopen, failure recovery, duplicate launch and locks. A successful smoke check alone is insufficient. OS/architecture support and signing status must be recorded with each platform's acceptance evidence. + +## Release packages + +The desktop release workflow builds an unsigned Apple Silicon DMG and an unsigned Windows x64 NSIS installer. It checks both packages on their native runners before attaching them and their SHA-256 files to the same draft release. Windows changes also run the installer smoke check on pull requests that touch desktop packaging. diff --git a/docs/development/desktop.zh-CN.md b/docs/development/desktop.zh-CN.md index c9ffd1486..b5ea1f265 100644 --- a/docs/development/desktop.zh-CN.md +++ b/docs/development/desktop.zh-CN.md @@ -31,3 +31,7 @@ node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector 本模块对应 #363 的共用应用。平台安装、签名和分发由 #364–#366 负责,自动更新由 #367 负责。浏览器导出仍需应用进程参与,退出应用后不能在后台完成;首版壳未开放麦克风权限。 发布前须按 #363 在各声明平台完成干净环境验收:Agent 辅助创作与工具调用、编辑、导出、重开、故障恢复、重复启动和工程锁。冒烟通过不能替代完整验收;操作系统、架构和签名状态随平台验收证据记录。 + +## 发布安装包 + +桌面发布工作流构建未签名的 Apple Silicon DMG 和 Windows x64 NSIS 安装包。两端在原生运行器验证通过后,将安装包和 SHA-256 校验文件上传到同一个草稿 Release。涉及桌面打包的 PR 也会运行 Windows 安装验证。 From 79f71d1af9d89aed4ea0288cce6b512f6ba4046a Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 22:36:55 +0800 Subject: [PATCH 05/31] [fix] desktop: use UTF-8 for bundled CLI output Signed-off-by: Weiming Liao --- apps/desktop/scripts/prepare-runtime.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/desktop/scripts/prepare-runtime.mjs b/apps/desktop/scripts/prepare-runtime.mjs index fb66ed9fb..b5a977b96 100644 --- a/apps/desktop/scripts/prepare-runtime.mjs +++ b/apps/desktop/scripts/prepare-runtime.mjs @@ -42,8 +42,8 @@ const pythonRelative = relative(runtime, python); const desktopExecutable = process.platform === 'darwin' ? '../../MacOS/OpenDirector' : process.platform === 'win32' ? '../../OpenDirector.exe' : '../../opendirector-desktop'; const workspace = process.platform === 'darwin' ? '$HOME/Library/Application Support/OpenDirector/workspace' : '${XDG_CONFIG_HOME:-$HOME/.config}/OpenDirector/workspace'; const unix = `#!/bin/sh\nset -eu\nSCRIPT="$0"\nwhile [ -L "$SCRIPT" ]; do\n BASE=$(CDPATH= cd -- "$(dirname -- "$SCRIPT")" && pwd)\n LINK=$(readlink "$SCRIPT")\n case "$LINK" in /*) SCRIPT="$LINK" ;; *) SCRIPT="$BASE/$LINK" ;; esac\ndone\nRUNTIME=$(CDPATH= cd -- "$(dirname -- "$SCRIPT")/.." && pwd)\nexport PATH="$RUNTIME/bin:$PATH"\nexport OPENDIRECTOR_ROOT="\${OPENDIRECTOR_ROOT:-${workspace}}"\nexport OPENDIRECTOR_DESKTOP_EXECUTABLE="$RUNTIME/${desktopExecutable}"\nexec "$RUNTIME/${pythonRelative}" -I -m opendirector.cli "$@"\n`; -if (process.platform === 'win32') writeFileSync(join(runtime, 'bin/opendirector.cmd'), `@echo off\r\nset "PATH=%~dp0;%PATH%"\r\nif not defined OPENDIRECTOR_ROOT set "OPENDIRECTOR_ROOT=%APPDATA%\\OpenDirector\\workspace"\r\nset "OPENDIRECTOR_DESKTOP_EXECUTABLE=%~dp0..\\${desktopExecutable}"\r\n"%~dp0..\\${pythonRelative}" -I -m opendirector.cli %*\r\n`); +if (process.platform === 'win32') writeFileSync(join(runtime, 'bin/opendirector.cmd'), `@echo off\r\nset "PATH=%~dp0;%PATH%"\r\nif not defined OPENDIRECTOR_ROOT set "OPENDIRECTOR_ROOT=%APPDATA%\\OpenDirector\\workspace"\r\nset "OPENDIRECTOR_DESKTOP_EXECUTABLE=%~dp0..\\${desktopExecutable}"\r\n"%~dp0..\\${pythonRelative}" -I -X utf8 -m opendirector.cli %*\r\n`); else { writeFileSync(join(runtime, 'bin/opendirector'), unix); chmodSync(join(runtime, 'bin/opendirector'), 0o755); } -run(python, ['-I', '-m', 'opendirector.cli', '--help']); +run(python, ['-I', '-X', 'utf8', '-m', 'opendirector.cli', '--help']); writeFileSync(join(runtime, 'manifest.json'), JSON.stringify({ version: 1, platform: process.platform, arch: process.arch, python: pythonRelative, application: JSON.parse(readFileSync(join(root, 'package.json'))).version }, null, 2)); From 633df209cb2f171124a2f8b3b232085e721bb55e Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 22:42:41 +0800 Subject: [PATCH 06/31] [ci] desktop: use the latest macOS runner Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index c32babe69..8adde48c7 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -28,7 +28,7 @@ env: jobs: macos: if: github.event_name != 'pull_request' - runs-on: macos-15 + runs-on: macos-latest timeout-minutes: 45 steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 From e2bf259c78f79eacc0326fe4a8124ed5f04e26bf Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 22:44:50 +0800 Subject: [PATCH 07/31] [fix] desktop: wait for onboarding during installer smoke tests Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke.mjs | 10 +++++++--- apps/desktop/src/main.mjs | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/desktop/scripts/smoke.mjs b/apps/desktop/scripts/smoke.mjs index 7f2a49359..25a64ca8a 100644 --- a/apps/desktop/scripts/smoke.mjs +++ b/apps/desktop/scripts/smoke.mjs @@ -6,6 +6,8 @@ import { spawn } from 'node:child_process'; const binary = process.argv[2]; if (!binary) throw new Error('Usage: node scripts/smoke.mjs /path/to/packaged/OpenDirector'); const directory = await mkdtemp(join(tmpdir(), 'opendirector-desktop-')); +const logPath = join(directory, 'logs/desktop.log'); +let logOffset = 0; let previous; try { for (let attempt = 0; attempt < 2; attempt++) { @@ -15,9 +17,11 @@ try { child.once('error', reject); child.once('close', resolve); }).finally(() => clearTimeout(timeout)); - const log = await readFile(join(directory, 'logs/desktop.log'), 'utf8'); - if (result !== 0 || !log.includes('"health":{"status":"ok"}')) throw new Error(`Packaged desktop smoke failed (${result}):\n${log}`); - const latest = log.split('\n').filter(line => line.startsWith('smoke ')).at(-1); + const log = await readFile(logPath, 'utf8'); + const currentLog = log.slice(logOffset); + logOffset = log.length; + const latest = currentLog.split('\n').findLast(line => line.startsWith('smoke {')); + if (result !== 0 || !latest) throw new Error(`Packaged desktop smoke failed on launch ${attempt + 1} (${result}):\n${currentLog}`); const current = JSON.parse(latest.slice(6)).projectIds; if (previous && JSON.stringify(previous) !== JSON.stringify(current)) throw new Error('Reopening changed the project identities'); previous = current; diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index e7884f6dc..c506f377c 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -145,19 +145,24 @@ async function start() { return {health, projects: projects.status, isolated: typeof require === 'undefined', bridge: !!window.opendirectorDesktop}; })()`); if (result.health.status !== 'ok' || result.projects !== 200 || !result.isolated || !result.bridge) throw new Error('Desktop smoke failed'); - let rendered = false; - for (let attempt = 0; attempt < 150; attempt++) { - if (await window.webContents.executeJavaScript('document.querySelectorAll("button").length > 2')) { rendered = true; break; } - await new Promise(resolve => setTimeout(resolve, 100)); - } - if (!rendered) throw new Error('Workbench did not become interactive'); - await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); let canvasReady = false; - for (let attempt = 0; attempt < 150; attempt++) { - if (await window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")')) { canvasReady = true; break; } + for (let attempt = 0; attempt < 300; attempt++) { + canvasReady = await window.webContents.executeJavaScript(`(() => { + const skip = document.querySelector('.cw-welcome-secondary'); + if (skip && !skip.disabled) skip.click(); + return !!document.querySelector('.react-flow') && !!document.querySelector('.cw-save-status i.saved'); + })()`); + if (canvasReady) break; await new Promise(resolve => setTimeout(resolve, 100)); } - if (!canvasReady) throw new Error('Canvas did not open'); + if (!canvasReady) { + const state = await window.webContents.executeJavaScript(`JSON.stringify({ + canvas: !!document.querySelector('.react-flow'), + save: document.querySelector('.cw-save-status')?.textContent, + text: document.body.innerText.slice(0, 800), + })`); + throw new Error(`Canvas did not open: ${state}`); + } for (let attempt = 0; attempt < 150; attempt++) { result.projectIds = await window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}).then(r => r.json()).then(value => value.projects.map(project => project.id).sort())`); if (result.projectIds.length) break; From e0d0a0dd95bf66fed175c0f205d609a58f70ec27 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 22:55:29 +0800 Subject: [PATCH 08/31] [test] desktop: verify Host shutdown before reopening Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke.mjs | 2 +- apps/desktop/src/host.mjs | 8 +++++++- apps/desktop/src/main.mjs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/desktop/scripts/smoke.mjs b/apps/desktop/scripts/smoke.mjs index 25a64ca8a..aecaa2498 100644 --- a/apps/desktop/scripts/smoke.mjs +++ b/apps/desktop/scripts/smoke.mjs @@ -21,7 +21,7 @@ try { const currentLog = log.slice(logOffset); logOffset = log.length; const latest = currentLog.split('\n').findLast(line => line.startsWith('smoke {')); - if (result !== 0 || !latest) throw new Error(`Packaged desktop smoke failed on launch ${attempt + 1} (${result}):\n${currentLog}`); + if (result !== 0 || !latest) throw new Error(`Packaged desktop smoke failed on launch ${attempt + 1} (${result}):\n${log}`); const current = JSON.parse(latest.slice(6)).projectIds; if (previous && JSON.stringify(previous) !== JSON.stringify(current)) throw new Error('Reopening changed the project identities'); previous = current; diff --git a/apps/desktop/src/host.mjs b/apps/desktop/src/host.mjs index 7fe699452..95adeaa8a 100644 --- a/apps/desktop/src/host.mjs +++ b/apps/desktop/src/host.mjs @@ -22,6 +22,7 @@ export class Host { pending = new Map(); nextId = 0; stopping = false; + shutdownComplete = false; constructor({ python, env, directory, log, onExit }) { this.child = spawn(python, ['-I', '-m', 'opendirector_api.desktop'], { @@ -43,6 +44,8 @@ export class Host { } else if (event.type === 'fatal') { clearTimeout(deadline); reject(new Error(event.message)); + } else if (event.type === 'shutdown-complete') { + this.shutdownComplete = true; } else if (event.type === 'inspection') { this.pending.get(event.requestId)?.(event); this.pending.delete(event.requestId); @@ -85,7 +88,10 @@ export class Host { if (this.child.exitCode !== null) return; this.child.stdin.end(JSON.stringify({ type: 'shutdown', requestId: ++this.nextId }) + '\n'); const timeout = setTimeout(() => this.child.kill('SIGKILL'), 20_000); - try { await this.closed; } finally { clearTimeout(timeout); } + try { + const code = await this.closed; + return code === 0 && this.shutdownComplete; + } finally { clearTimeout(timeout); } } } diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index c506f377c..c3063d255 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -252,10 +252,10 @@ async function start() { await new Promise(resolve => setTimeout(resolve, 50)); window.close(); if (window.isVisible() || !(await host.inspect())) throw new Error('Closing a window stopped the Host'); - log.write(`smoke ${JSON.stringify(result)}\n`); quitting = true; window.destroy(); - await host.stop(); + if (!(await host.stop())) throw new Error('Host exited without confirming session cleanup'); + log.write(`smoke ${JSON.stringify(result)}\n`); app.exit(0); } catch (error) { log.write(`smoke failed ${error.message}\n`); quitting = true; window?.destroy(); await host.stop(); app.exit(1); } } From 908d73cfc3846d7eeb76ee9bbd4ec923937e533d Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 23:00:54 +0800 Subject: [PATCH 09/31] [fix] desktop: wait for Host cleanup before Electron exits Signed-off-by: Weiming Liao --- apps/desktop/src/main.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index c3063d255..d3a382aca 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -281,6 +281,9 @@ async function fatal(error) { app.quit(); } +// Keep Electron alive until the explicit quit path finishes stopping the Host. +app.on('window-all-closed', () => {}); + app.on('before-quit', event => { if (quitting) return; event.preventDefault(); From 8b609e00023251133c3bddcc80949f08008aa3d2 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 23:02:27 +0800 Subject: [PATCH 10/31] [feat] desktop: allow choosing the Windows install directory Signed-off-by: Weiming Liao --- apps/desktop/package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 708da7ec4..bb3c93166 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -45,7 +45,11 @@ }, "nsis": { "artifactName": "OpenDirector-v${version}-win-${arch}-unsigned.${ext}", - "deleteAppDataOnUninstall": false + "deleteAppDataOnUninstall": false, + "oneClick": false, + "perMachine": false, + "allowElevation": false, + "allowToChangeInstallationDirectory": true }, "linux": { "target": "dir", From bf1bcceefdc77301dc4e8eb8adc7b1d8fffff712 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 23:19:38 +0800 Subject: [PATCH 11/31] [fix] ci: write portable Windows release checksums Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 8adde48c7..0da55fb8c 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -146,7 +146,7 @@ jobs: New-Item -ItemType Directory -Path release-assets | Out-Null Copy-Item $installer.FullName release-assets $hash = (Get-FileHash -Algorithm SHA256 $installer.FullName).Hash.ToLowerInvariant() - "$hash $name" | Set-Content -Encoding ascii "release-assets/$name.sha256" + [IO.File]::WriteAllText((Join-Path (Get-Location) "release-assets/$name.sha256"), "$hash $name`n") - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: desktop-windows From c9e0310fbfc829e7b353d9cdf75d1ae99f34a302 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Wed, 18 Nov 2026 23:45:30 +0800 Subject: [PATCH 12/31] [feat] desktop: share project navigation across macOS and Windows Signed-off-by: Weiming Liao --- apps/desktop/package.json | 1 + apps/desktop/scripts/smoke-window.mjs | 199 +++++++++++++++ apps/desktop/scripts/smoke.mjs | 22 +- apps/desktop/src/main.mjs | 177 ++++--------- apps/desktop/src/preload.cjs | 2 + src/canvas/CanvasIcon.tsx | 1 + src/canvas/desktop-chrome.css | 233 ++++++++++++------ src/canvas/workspace/DesktopSidebar.tsx | 131 +++++++++- src/canvas/workspace/WorkspaceView.tsx | 25 +- .../workspace/useWorkspaceInteraction.tsx | 2 +- src/desktop.ts | 1 + src/i18n/messages/en-US/canvasShell.ts | 2 + src/i18n/messages/zh-CN/canvasShell.ts | 2 + 13 files changed, 566 insertions(+), 232 deletions(-) create mode 100644 apps/desktop/scripts/smoke-window.mjs diff --git a/apps/desktop/package.json b/apps/desktop/package.json index bb3c93166..1781669c7 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -28,6 +28,7 @@ }, "files": [ "src/**", + "scripts/smoke-window.mjs", "package.json" ], "extraResources": [ diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs new file mode 100644 index 000000000..7a2e28a7b --- /dev/null +++ b/apps/desktop/scripts/smoke-window.mjs @@ -0,0 +1,199 @@ +import { app } from 'electron'; +import { mkdirSync, writeFileSync } from 'node:fs'; +import { join } from 'node:path'; +import { setTimeout as delay } from 'node:timers/promises'; + +export async function smokeWindow({ window, host, getLocale }) { + const result = await window.webContents.executeJavaScript(`(async () => { + const r = await fetch('/api/health', {headers: {'X-OpenDirector-Request': '1'}}); + const health = await r.json(); + const projects = await fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}); + return {health, projects: projects.status, isolated: typeof require === 'undefined', bridge: !!window.opendirectorDesktop}; + })()`); + if (result.health.status !== 'ok' || result.projects !== 200 || !result.isolated || !result.bridge) throw new Error('Desktop smoke failed'); + await waitFor(() => window.webContents.executeJavaScript('document.querySelectorAll("button").length > 2'), 'Workbench did not become interactive'); + await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); + await waitFor(() => window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")'), 'Canvas did not open'); + result.projectIds = await waitFor(() => window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}) + .then(r => r.json()).then(value => value.projects.length ? value.projects.map(project => project.id).sort() : null)`), 'Canvas project was not persisted'); + await delay(500); + await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); + await delay(300); + if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); + if (process.platform === 'win32') { + if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); + await waitFor(() => window.webContents.executeJavaScript(`(() => { + const overlay = navigator.windowControlsOverlay; + const actions = document.querySelector('.cw-top-actions'); + return overlay?.visible && actions && actions.getBoundingClientRect().right <= overlay.getTitlebarAreaRect().right; + })()`), 'Window controls overlap the workspace toolbar'); + } + result.sidebarInitiallyOpen = await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"); + if (!result.sidebarInitiallyOpen) { + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await waitFor(() => window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"), 'Sidebar did not expand'); + } + if (result.projectIds.length === 1) { + await window.webContents.executeJavaScript("window.dispatchEvent(new KeyboardEvent('keydown', { key: 'n', metaKey: navigator.platform.startsWith('Mac'), ctrlKey: !navigator.platform.startsWith('Mac'), bubbles: true }))"); + result.projectIds = await waitFor(() => window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}) + .then(r => r.json()).then(value => value.projects.length === 2 ? value.projects.map(project => project.id).sort() : null)`), 'New project shortcut did not persist a project'); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-project-name-editor input')"), 'New project name did not become editable'); + await window.webContents.executeJavaScript("document.querySelector('.cw-project-name-editor input').dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }))"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-save-status i.saved')"), 'New project did not finish saving'); + } + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.od-project-sidebar nav button')"), 'Sidebar projects did not load'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search-toggle').click()"); + await waitFor(() => window.webContents.executeJavaScript("document.activeElement === document.querySelector('.od-sidebar-search')"), 'Project search did not take focus'); + const firstProject = await window.webContents.executeJavaScript("document.querySelector('.od-project-sidebar nav button span').textContent"); + for (const query of ['__no_matching_project__', ` ${firstProject.toLocaleUpperCase()} `, '']) { + await window.webContents.executeJavaScript(`(() => { + const input = document.querySelector('.od-sidebar-search'); + Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set.call(input, ${JSON.stringify(query)}); + input.dispatchEvent(new Event('input', { bubbles: true })); + })()`); + await waitFor(() => window.webContents.executeJavaScript(query === '__no_matching_project__' ? "!!document.querySelector('.od-sidebar-empty') && !document.querySelector('.od-project-sidebar nav button')" : "!!document.querySelector('.od-project-sidebar nav button') && !document.querySelector('.od-sidebar-empty')"), 'Sidebar project search failed'); + } + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search-close').click()"); + await waitFor(() => window.webContents.executeJavaScript("!document.querySelector('.od-sidebar-search') && document.activeElement === document.querySelector('.od-sidebar-search-toggle')"), 'Closing search did not restore focus'); + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await delay(200); + await window.webContents.executeJavaScript("window.dispatchEvent(new KeyboardEvent('keydown', { key: 'k', metaKey: navigator.platform.startsWith('Mac'), ctrlKey: !navigator.platform.startsWith('Mac'), bubbles: true }))"); + await waitFor(() => window.webContents.executeJavaScript("document.activeElement === document.querySelector('.od-sidebar-search')"), 'Project search shortcut failed'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search').dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))"); + await waitFor(() => window.webContents.executeJavaScript("!document.querySelector('.od-sidebar-search')"), 'Escape did not close project search'); + const captionInteractive = await window.webContents.executeJavaScript("[...document.querySelectorAll('.od-caption-actions button, .od-caption-actions svg')].every(element => getComputedStyle(element).getPropertyValue('-webkit-app-region') === 'no-drag')"); + if (!captionInteractive) throw new Error('Caption buttons overlap native drag regions'); + const evidence = process.env.OPENDIRECTOR_DESKTOP_EVIDENCE; + for (const language of ['en-US', 'zh-CN']) { + await window.webContents.executeJavaScript(`window.dispatchEvent(new StorageEvent('storage', { key: 'opendirector.locale.v1', newValue: '${language}' }))`); + await delay(500); + const current = await window.webContents.executeJavaScript('document.documentElement.lang'); + if (current !== language || getLocale() !== language) throw new Error('Desktop locale synchronization failed'); + if (!(await window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")'))) throw new Error('Canvas was lost during language switching'); + const settingsStyle = await window.webContents.executeJavaScript(`(() => { + const button = document.querySelector('.od-sidebar-settings .cw-icon-button'); + return button && getComputedStyle(button).visibility === 'visible' && button.querySelector('svg') && !button.textContent.trim(); + })()`); + if (!settingsStyle) throw new Error('Sidebar settings did not reuse the canvas icon button'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-settings .cw-icon-button').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-settings-dialog[open]')"), 'Sidebar settings did not open'); + await window.webContents.executeJavaScript("document.querySelector('.cw-settings-close').click()"); + await waitFor(() => window.webContents.executeJavaScript("!document.querySelector('.cw-settings-dialog[open]')"), 'Settings did not close'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-project-more').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.od-sidebar-project-menu [role=menuitem]')"), 'Project menu did not open'); + const deleteLabel = await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-project-menu').textContent"); + if (!deleteLabel.includes(language === 'en-US' ? 'Delete' : '删除')) throw new Error('Project delete action was not localized'); + if (evidence) { + mkdirSync(evidence, { recursive: true }); + writeFileSync(join(evidence, `project-menu-${language}.png`), (await window.webContents.capturePage()).toPNG()); + } + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-project-menu button').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('dialog[open] .cw-project-dialog-actions')"), 'Delete confirmation did not open'); + await window.webContents.executeJavaScript("document.querySelector('dialog[open] .cw-project-dialog-actions button').click()"); + await waitFor(() => window.webContents.executeJavaScript("!document.querySelector('dialog[open]')"), 'Delete cancellation did not close confirmation'); + if (evidence) { + mkdirSync(evidence, { recursive: true }); + const button = await window.webContents.executeJavaScript("(() => { const r = document.querySelector('.od-sidebar-create').getBoundingClientRect(); return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2) }; })()"); + window.webContents.sendInputEvent({ type: 'mouseMove', ...button }); + await waitFor(() => window.webContents.executeJavaScript("getComputedStyle(document.querySelector('.od-sidebar-create-shortcut')).opacity === '1'"), 'New project hover shortcut was not visible'); + writeFileSync(join(evidence, `new-project-hover-${language}.png`), (await window.webContents.capturePage()).toPNG()); + window.webContents.sendInputEvent({ type: 'mouseMove', x: 300, y: 100 }); + await waitFor(() => window.webContents.executeJavaScript("getComputedStyle(document.querySelector('.od-sidebar-create-shortcut')).opacity === '0'"), 'New project shortcut stayed visible after hover'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search-toggle').click()"); + await delay(200); + writeFileSync(join(evidence, `search-open-${language}.png`), (await window.webContents.capturePage()).toPNG()); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search-close').click()"); + await delay(200); + for (const state of ['expanded', 'collapsed']) { + if (state === 'collapsed') { + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await delay(500); + } + const placements = await window.webContents.executeJavaScript(`(() => { + const open = document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'; + return { open, create: document.querySelectorAll(open ? '.od-sidebar-create' : '.od-caption-actions button').length }; + })()`); + if (placements.open !== (state === 'expanded') || placements.create !== (state === 'expanded' ? 1 : 2)) throw new Error('New project button placement failed'); + window.webContents.invalidate(); + await delay(200); + writeFileSync(join(evidence, `sidebar-${state}-${language}.png`), (await window.webContents.capturePage()).toPNG()); + } + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await delay(500); + } + } + if (process.platform === 'darwin') { + const chrome = await window.webContents.executeJavaScript(`(() => { + const header = document.querySelector('.cw-topbar'); + return { top: header.getBoundingClientRect().top, + canvasTop: document.querySelector('.react-flow').getBoundingClientRect().top, + padding: getComputedStyle(header).paddingLeft, + drag: getComputedStyle(header).getPropertyValue('-webkit-app-region') }; + })()`); + if (chrome.top !== 0 || chrome.canvasTop !== 48 || chrome.padding !== '20px' || chrome.drag !== 'drag') throw new Error('Desktop chrome layout failed: ' + JSON.stringify(chrome)); + app.focus({ steal: true }); + window.show(); + window.focus(); + await delay(500); + for (const fullscreen of [true, false]) { + window.setFullScreen(fullscreen); + await waitFor(() => window.webContents.executeJavaScript(`document.documentElement.hasAttribute('data-desktop-fullscreen') === ${fullscreen}`), + `Fullscreen chrome synchronization failed: target=${fullscreen}`, 100); + } + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await delay(500); + const bounds = window.getBounds(); + window.setSize(800, 600); + await delay(200); + const fits = await window.webContents.executeJavaScript(`(() => { + const language = document.querySelector('.cw-topbar .cw-language-toggle').getBoundingClientRect(); + const title = document.querySelector('.cw-topbar .cw-project-selector').getBoundingClientRect(); + const actions = document.querySelector('.cw-top-actions').getBoundingClientRect(); + return title.right <= language.left && language.right <= actions.left && actions.right <= innerWidth; + })()`); + if (!fits) throw new Error('Desktop controls overlap in a narrow window'); + window.setBounds(bounds); + await delay(200); + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + await delay(500); + result.chrome = chrome; + } + if (process.env.OPENDIRECTOR_DESKTOP_SMOKE_DELETE === '1') { + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-create').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-project-name-editor input')"), 'Deletion test project was not created'); + await window.webContents.executeJavaScript("document.querySelector('.cw-project-name-editor input').dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }))"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-save-status i.saved') && !document.querySelector('.cw-project-name-editor input')"), 'Deletion test project was not saved'); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.od-sidebar-project-select[aria-current=page]')"), 'New project row did not load'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-project-select[aria-current=page]').parentElement.querySelector('.od-sidebar-project-more').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.od-sidebar-project-menu button')"), 'Delete test menu did not open'); + await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-project-menu button').click()"); + await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('dialog[open] button[type=submit]')"), 'Delete test confirmation did not open'); + await window.webContents.executeJavaScript("document.querySelector('dialog[open] button[type=submit]').click()"); + await waitFor(() => window.webContents.executeJavaScript(`(async () => { + const response = await fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}); + const value = await response.json(); + return !document.querySelector('dialog[open]') && !!document.querySelector('.cw-save-status i.saved') && + JSON.stringify(value.projects.map(p => p.id).sort()) === '${JSON.stringify(result.projectIds)}'; + })()`), 'Deleting the open test project did not restore the remaining projects'); + result.projectDeletion = true; + } + result.sidebarFinallyOpen = process.env.OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR === 'open'; + if (await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'") !== result.sidebarFinallyOpen) { + await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); + } + await waitFor(() => window.webContents.executeJavaScript(`localStorage.getItem('opendirector.desktop.sidebar.v1') === '${result.sidebarFinallyOpen ? 'open' : 'closed'}'`), 'Sidebar preference was not saved'); + await window.webContents.executeJavaScript('window.opendirectorDesktop.setExporting(true)'); + await delay(50); + window.close(); + if (window.isVisible() || !(await host.inspect())) throw new Error('Closing a window stopped the Host'); + return result; +} + +async function waitFor(check, message, attempts = 150) { + for (let attempt = 0; attempt < attempts; attempt++) { + const value = await check(); + if (value) return value; + await delay(100); + } + throw new Error(message); +} diff --git a/apps/desktop/scripts/smoke.mjs b/apps/desktop/scripts/smoke.mjs index aecaa2498..0fa227f13 100644 --- a/apps/desktop/scripts/smoke.mjs +++ b/apps/desktop/scripts/smoke.mjs @@ -1,30 +1,32 @@ -import { mkdtemp, readFile, rm } from 'node:fs/promises'; +import { mkdtemp, readFile, realpath, rm } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { spawn } from 'node:child_process'; const binary = process.argv[2]; if (!binary) throw new Error('Usage: node scripts/smoke.mjs /path/to/packaged/OpenDirector'); -const directory = await mkdtemp(join(tmpdir(), 'opendirector-desktop-')); -const logPath = join(directory, 'logs/desktop.log'); +const directory = await realpath(await mkdtemp(join(tmpdir(), 'opendirector-desktop-'))); let logOffset = 0; let previous; +let sidebarOpen = false; try { - for (let attempt = 0; attempt < 2; attempt++) { - const child = spawn(binary, ['--smoke'], { env: { ...process.env, OPENDIRECTOR_DESKTOP_DATA: directory }, stdio: 'inherit' }); + for (let attempt = 0; attempt < 3; attempt++) { + const child = spawn(binary, ['--smoke'], { env: { ...process.env, OPENDIRECTOR_DESKTOP_DATA: directory, OPENDIRECTOR_DESKTOP_SMOKE_DELETE: attempt === 2 ? '1' : '', OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR: attempt === 0 ? 'open' : 'closed' }, stdio: 'inherit' }); const timeout = setTimeout(() => child.kill('SIGKILL'), 90_000); const result = await new Promise((resolve, reject) => { child.once('error', reject); child.once('close', resolve); }).finally(() => clearTimeout(timeout)); - const log = await readFile(logPath, 'utf8'); - const currentLog = log.slice(logOffset); + const log = await readFile(join(directory, 'logs/desktop.log'), 'utf8'); + const latest = log.slice(logOffset).split('\n').findLast(line => line.startsWith('smoke {')); logOffset = log.length; - const latest = currentLog.split('\n').findLast(line => line.startsWith('smoke {')); if (result !== 0 || !latest) throw new Error(`Packaged desktop smoke failed on launch ${attempt + 1} (${result}):\n${log}`); - const current = JSON.parse(latest.slice(6)).projectIds; + const receipt = JSON.parse(latest.slice(6)); + if (receipt.sidebarInitiallyOpen !== sidebarOpen) throw new Error('Sidebar default or restored state is incorrect'); + sidebarOpen = receipt.sidebarFinallyOpen; + const current = receipt.projectIds; if (previous && JSON.stringify(previous) !== JSON.stringify(current)) throw new Error('Reopening changed the project identities'); previous = current; } - process.stdout.write('Packaged canvas, authenticated API, isolation, both locales, hidden-window Host and reopen: passed\n'); + process.stdout.write('Packaged canvas, authenticated API, isolation, both locales, hidden-window Host, reopen and sidebar preferences: passed\n'); } finally { await rm(directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); } diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index d3a382aca..269d1258c 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -9,6 +9,8 @@ import { messages, localeFor } from './locale.mjs'; import { registerCommand, commandPath } from './command.mjs'; app.setName('OpenDirector'); +const desktopChrome = ['darwin', 'win32'].includes(process.platform); +const captionHeight = 48; const here = dirname(fileURLToPath(import.meta.url)); const runtime = app.isPackaged ? join(process.resourcesPath, 'runtime') : join(here, '..', 'runtime'); const isolated = process.env.OPENDIRECTOR_DESKTOP_DATA; @@ -49,7 +51,9 @@ ipcMain.on('desktop:locale', (event, value) => { menu(); }); ipcMain.on('desktop:theme', (event, value) => { - if (trusted(event) && ['light', 'dark'].includes(value)) { nativeTheme.themeSource = value; applyBackdrop(); } + if (trusted(event) && ['light', 'dark'].includes(value)) { nativeTheme.themeSource = value; + if (process.platform === 'win32') window.setTitleBarOverlay(windowsCaption()); + applyBackdrop(); } }); ipcMain.on('desktop:session', (event, value) => { const parsed = z.uuid().safeParse(value); @@ -59,19 +63,42 @@ ipcMain.on('desktop:exporting', (event, value) => { if (trusted(event) && typeof value === 'boolean') exporting = value; }); +function desktopActions() { + return [ + { label: text().command, click: manageCommand }, + { label: text().data, click: () => shell.openPath(workspace) }, + { label: text().logs, click: () => shell.openPath(logs) }, + ]; +} + +ipcMain.on('desktop:more', event => { + if (trusted(event) && desktopChrome) Menu.buildFromTemplate(desktopActions()).popup({ window }); +}); + +function windowsCaption() { + const dark = nativeTheme.shouldUseDarkColors; + return { height: captionHeight, color: dark ? '#141414' : '#f7f8fa', symbolColor: dark ? '#eceef2' : '#30343c' }; +} + function menu() { - Menu.setApplicationMenu(Menu.buildFromTemplate([ - { label: text().app, submenu: [ - { role: 'about', label: text().app }, - { label: text().logs, click: () => shell.openPath(logs) }, - { label: text().data, click: () => shell.openPath(workspace) }, - { label: text().command, click: manageCommand }, - { type: 'separator' }, { label: text().quit, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }, - ] }, - { label: text().edit, submenu: ['undo', 'redo', 'cut', 'copy', 'paste', 'selectAll'].map(role => ({ role, label: text()[role] })) }, - { label: text().view, submenu: [ - { role: 'togglefullscreen', label: text().fullscreen }, { role: 'toggleDevTools', label: text().devtools }, - ] }, + const editing = ['undo', 'redo', 'cut', 'copy', 'paste', 'selectAll'].map(role => ({ role, label: text()[role] })); + const view = [ + { role: 'togglefullscreen', label: text().fullscreen }, + { role: 'toggleDevTools', label: text().devtools }, + ]; + const quit = { label: text().quit, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }; + const shortcuts = [...editing, ...view, quit].map(item => ({ ...item, visible: false, acceleratorWorksWhenHidden: true })); + if (process.platform === 'win32') { + Menu.setApplicationMenu(Menu.buildFromTemplate(shortcuts)); + return; + } + const about = { role: 'about', label: text().app }; + Menu.setApplicationMenu(Menu.buildFromTemplate(process.platform === 'darwin' ? [ + { label: text().app, submenu: [about, quit, ...shortcuts.slice(0, -1)] }, + ] : [ + { label: text().app, submenu: [about, ...desktopActions(), quit] }, + { label: text().edit, submenu: editing }, + { label: text().view, submenu: view }, ])); } @@ -116,15 +143,19 @@ async function start() { window = new BrowserWindow({ width: 1440, height: 960, minWidth: 800, minHeight: 600, show: false, title: 'OpenDirector', ...(process.platform === 'darwin' ? { titleBarStyle: 'hiddenInset', trafficLightPosition: { x: 18, y: 18 }, vibrancy: 'sidebar', visualEffectState: 'active', backgroundColor: '#00000000' } : {}), + ...(process.platform === 'win32' ? { titleBarStyle: 'hidden', titleBarOverlay: windowsCaption() } : {}), webPreferences: { session: ownedSession, preload: join(here, 'preload.cjs'), nodeIntegration: false, contextIsolation: true, sandbox: true, webSecurity: true }, }); - if (process.platform === 'darwin') { + if (process.platform === 'win32') window.setMenuBarVisibility(false); + if (desktopChrome) { const fullscreen = () => window.webContents.send('desktop:fullscreen', window.isFullScreen()); window.on('enter-full-screen', fullscreen); window.on('leave-full-screen', fullscreen); window.webContents.on('did-finish-load', fullscreen); - for (const event of ['minimize', 'hide', 'restore', 'show']) window.on(event, applyBackdrop); + if (process.platform === 'darwin') { + for (const event of ['minimize', 'hide', 'restore', 'show']) window.on(event, applyBackdrop); + } } window.webContents.setWindowOpenHandler(({ url }) => { if (new URL(url).protocol === 'https:') void shell.openExternal(url); @@ -138,120 +169,8 @@ async function start() { window.show(); if (process.argv.includes('--smoke')) { try { - const result = await window.webContents.executeJavaScript(`(async () => { - const r = await fetch('/api/health', {headers: {'X-OpenDirector-Request': '1'}}); - const health = await r.json(); - const projects = await fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}); - return {health, projects: projects.status, isolated: typeof require === 'undefined', bridge: !!window.opendirectorDesktop}; - })()`); - if (result.health.status !== 'ok' || result.projects !== 200 || !result.isolated || !result.bridge) throw new Error('Desktop smoke failed'); - let canvasReady = false; - for (let attempt = 0; attempt < 300; attempt++) { - canvasReady = await window.webContents.executeJavaScript(`(() => { - const skip = document.querySelector('.cw-welcome-secondary'); - if (skip && !skip.disabled) skip.click(); - return !!document.querySelector('.react-flow') && !!document.querySelector('.cw-save-status i.saved'); - })()`); - if (canvasReady) break; - await new Promise(resolve => setTimeout(resolve, 100)); - } - if (!canvasReady) { - const state = await window.webContents.executeJavaScript(`JSON.stringify({ - canvas: !!document.querySelector('.react-flow'), - save: document.querySelector('.cw-save-status')?.textContent, - text: document.body.innerText.slice(0, 800), - })`); - throw new Error(`Canvas did not open: ${state}`); - } - for (let attempt = 0; attempt < 150; attempt++) { - result.projectIds = await window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}).then(r => r.json()).then(value => value.projects.map(project => project.id).sort())`); - if (result.projectIds.length) break; - await new Promise(resolve => setTimeout(resolve, 100)); - } - if (!result.projectIds.length) throw new Error('Canvas project was not persisted'); - await new Promise(resolve => setTimeout(resolve, 500)); - await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); - await new Promise(resolve => setTimeout(resolve, 300)); - if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); - const evidence = process.env.OPENDIRECTOR_DESKTOP_EVIDENCE; - for (const language of ['en-US', 'zh-CN']) { - await window.webContents.executeJavaScript(`window.dispatchEvent(new StorageEvent('storage', { key: 'opendirector.locale.v1', newValue: '${language}' }))`); - await new Promise(resolve => setTimeout(resolve, 500)); - const current = await window.webContents.executeJavaScript('document.documentElement.lang'); - if (current !== language || locale !== language) throw new Error('Desktop locale synchronization failed'); - if (!(await window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")'))) throw new Error('Canvas was lost during language switching'); - if (evidence) { - mkdirSync(evidence, { recursive: true }); - writeFileSync(join(evidence, `desktop-${language}.png`), (await window.webContents.capturePage()).toPNG()); - for (const state of ['expanded', 'collapsed']) { - if (state === 'collapsed') { - await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); - await new Promise(resolve => setTimeout(resolve, 500)); - } - const placements = await window.webContents.executeJavaScript(`(() => { - const open = document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'; - return { open, create: document.querySelectorAll(open ? '.od-sidebar-create' : '.od-caption-actions button').length }; - })()`); - if (placements.open !== (state === 'expanded') || placements.create !== (state === 'expanded' ? 1 : 2)) throw new Error('New project button placement failed'); - const layout = await window.webContents.executeJavaScript(`(() => { - const elements = ['.cw-topbar', '.cw-top-actions', '.cw-language-toggle']; - return { width: innerWidth, elements: elements.map(selector => { const e = document.querySelector(selector); const r = e.getBoundingClientRect(); return {selector, left:r.left, right:r.right, width:r.width, transform:getComputedStyle(e).transform}; }) }; - })()`); - writeFileSync(join(evidence, `layout-${state}-${language}.json`), JSON.stringify(layout)); - window.webContents.invalidate(); - await new Promise(resolve => setTimeout(resolve, 200)); - writeFileSync(join(evidence, `sidebar-${state}-${language}.png`), (await window.webContents.capturePage()).toPNG()); - } - await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); - await new Promise(resolve => setTimeout(resolve, 500)); - } - } - if (process.platform === 'darwin') { - const chrome = await window.webContents.executeJavaScript(`(() => { - const header = document.querySelector('.cw-topbar'); - return { top: header.getBoundingClientRect().top, - canvasTop: document.querySelector('.react-flow').getBoundingClientRect().top, - padding: getComputedStyle(header).paddingLeft, - drag: getComputedStyle(header).getPropertyValue('-webkit-app-region') }; - })()`); - if (chrome.top !== 0 || chrome.canvasTop !== 48 || chrome.padding !== '20px' || chrome.drag !== 'drag') throw new Error('Desktop chrome layout failed: ' + JSON.stringify(chrome)); - app.focus({ steal: true }); - window.show(); - window.focus(); - await new Promise(resolve => setTimeout(resolve, 500)); - for (const fullscreen of [true, false]) { - window.setFullScreen(fullscreen); - let synchronized = false; - for (let attempt = 0; attempt < 100; attempt++) { - synchronized = await window.webContents.executeJavaScript(`document.documentElement.hasAttribute('data-desktop-fullscreen') === ${fullscreen}`); - if (synchronized) break; - await new Promise(resolve => setTimeout(resolve, 100)); - } - if (!synchronized) throw new Error('Fullscreen chrome synchronization failed: target=' + fullscreen + ', native=' + window.isFullScreen()); - } - await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); - await new Promise(resolve => setTimeout(resolve, 500)); - const bounds = window.getBounds(); - window.setSize(800, 600); - await new Promise(resolve => setTimeout(resolve, 200)); - const fits = await window.webContents.executeJavaScript(`(() => { - const language = document.querySelector('.cw-topbar .cw-language-toggle').getBoundingClientRect(); - const title = document.querySelector('.cw-topbar .cw-project-selector').getBoundingClientRect(); - const actions = document.querySelector('.cw-top-actions').getBoundingClientRect(); - return title.right <= language.left && language.right <= actions.left && actions.right <= innerWidth; - })()`); - if (!fits) throw new Error('Desktop controls overlap in a narrow window'); - window.setBounds(bounds); - await new Promise(resolve => setTimeout(resolve, 200)); - await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); - await new Promise(resolve => setTimeout(resolve, 500)); - result.chrome = chrome; - - } - await window.webContents.executeJavaScript('window.opendirectorDesktop.setExporting(true)'); - await new Promise(resolve => setTimeout(resolve, 50)); - window.close(); - if (window.isVisible() || !(await host.inspect())) throw new Error('Closing a window stopped the Host'); + const { smokeWindow } = await import('../scripts/smoke-window.mjs'); + const result = await smokeWindow({ window, host, getLocale: () => locale }); quitting = true; window.destroy(); if (!(await host.stop())) throw new Error('Host exited without confirming session cleanup'); diff --git a/apps/desktop/src/preload.cjs b/apps/desktop/src/preload.cjs index 83c599044..5bc5597e7 100644 --- a/apps/desktop/src/preload.cjs +++ b/apps/desktop/src/preload.cjs @@ -2,11 +2,13 @@ const { contextBridge, ipcRenderer } = require('electron'); contextBridge.exposeInMainWorld('opendirectorDesktop', { registerSession: id => ipcRenderer.send('desktop:session', id), setLocale: locale => ipcRenderer.send('desktop:locale', locale), + ...(['darwin', 'win32'].includes(process.platform) ? { showMore: () => ipcRenderer.send('desktop:more') } : {}), setExporting: active => ipcRenderer.send('desktop:exporting', active), }); function markDesktop() { document.documentElement.dataset.desktopPlatform = process.platform; + if (['darwin', 'win32'].includes(process.platform)) document.documentElement.dataset.desktopChrome = ''; const theme = () => ipcRenderer.send('desktop:theme', document.documentElement.dataset.theme === 'light' ? 'light' : 'dark'); theme(); new MutationObserver(theme).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] }); diff --git a/src/canvas/CanvasIcon.tsx b/src/canvas/CanvasIcon.tsx index fd98bb2e2..2180452c1 100644 --- a/src/canvas/CanvasIcon.tsx +++ b/src/canvas/CanvasIcon.tsx @@ -130,6 +130,7 @@ const icons: Record = { ), + newProject: <>, close: , check: , pencil: ( diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css index c301bfcf2..cdfa1df64 100644 --- a/src/canvas/desktop-chrome.css +++ b/src/canvas/desktop-chrome.css @@ -5,71 +5,64 @@ html[data-desktop-platform="darwin"] #root, html[data-desktop-platform="darwin"] .cw-workspace { background: transparent; } -html[data-desktop-platform="darwin"] { +html[data-desktop-chrome] { --desktop-toolbar-height: 48px; - --desktop-toolbar-tint: rgb(36 38 44 / 26%); } -html[data-desktop-platform="darwin"][data-theme="light"] { - --desktop-toolbar-tint: rgb(248 249 252 / 55%); -} -html[data-desktop-platform="darwin"] .cw-workspace .react-flow { +html[data-desktop-chrome] .cw-workspace .react-flow { top: var(--desktop-toolbar-height); background: #0d0d0d; + left: var(--od-sidebar-width); + transition: left 200ms ease; } -html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .react-flow { +html[data-desktop-chrome][data-theme="light"] .cw-workspace .react-flow { background: #f7f8fa; } -html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar { +html[data-desktop-chrome] .cw-workspace .cw-topbar { height: var(--desktop-toolbar-height); - padding: 7px 16px 7px 104px; - background: var(--desktop-toolbar-tint); + padding: 7px 16px 7px 172px; border-bottom: 1px solid rgb(128 128 140 / 10%); pointer-events: auto; -webkit-app-region: drag; + left: var(--od-sidebar-width); + background: #141414; + transition: left 200ms ease, padding-left 200ms ease; } -html[data-desktop-platform="darwin"] .cw-topbar > *, -html[data-desktop-platform="darwin"] .cw-topbar :is(button, input, select, a, [role="button"]) { +html[data-desktop-chrome] .cw-topbar > *, +html[data-desktop-chrome] .cw-topbar :is(button, input, select, a, [role="button"]) { -webkit-app-region: no-drag; } -html[data-desktop-platform="darwin"][data-desktop-fullscreen] .cw-workspace .cw-topbar { +html[data-desktop-chrome][data-desktop-fullscreen] .cw-workspace .cw-topbar { padding-left: 20px; } @media (max-width: 900px) { - html[data-desktop-platform="darwin"] .cw-topbar .cw-save-status { + html[data-desktop-chrome] .cw-topbar .cw-save-status { display: none; } } -@media (prefers-reduced-transparency: reduce) { - html[data-desktop-platform="darwin"] { - --desktop-toolbar-tint: #202022; - } - html[data-desktop-platform="darwin"][data-theme="light"] { - --desktop-toolbar-tint: #eeeef1; - } -} -html[data-desktop-platform="darwin"] .cw-topbar .cw-brand { +html[data-desktop-chrome] .cw-topbar .cw-brand { display: none; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading { +html[data-desktop-chrome] .cw-topbar .cw-project-heading { flex: 1; gap: 6px; + -webkit-app-region: drag; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-selector { +html[data-desktop-chrome] .cw-topbar .cw-project-selector { order: 0; max-width: min(32vw, 330px); } -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-title { +html[data-desktop-chrome] .cw-topbar .cw-project-title { font-size: 13px; font-weight: 600; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-save-status { +html[data-desktop-chrome] .cw-topbar .cw-save-status { order: 1; color: #92969f; font-size: 11px; margin-left: 10px; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle { +html[data-desktop-chrome] .cw-topbar .cw-language-toggle { order: 3; margin-left: auto; border: 0; @@ -77,55 +70,42 @@ html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle { background: transparent; gap: 0; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle button { +html[data-desktop-chrome] .cw-topbar .cw-language-toggle button { padding: 7px; background: transparent; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-language-toggle button.is-active { +html[data-desktop-chrome] .cw-topbar .cw-language-toggle button.is-active { font-weight: 600; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions { +html[data-desktop-chrome] .cw-topbar .cw-top-actions { gap: 2px; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions button { +html[data-desktop-chrome] .cw-topbar .cw-top-actions button { width: 30px; height: 30px; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-top-actions svg { +html[data-desktop-chrome] .cw-topbar .cw-top-actions svg { width: 18px; height: 18px; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-dropdown { +html[data-desktop-chrome] .cw-topbar .cw-project-dropdown { left: 0; } -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading { - -webkit-app-region: drag; -} -html[data-desktop-platform="darwin"] .cw-topbar .cw-project-heading > * { +html[data-desktop-chrome] .cw-topbar .cw-project-heading > * { -webkit-app-region: no-drag; } .od-desktop-navigation { display: none; } -html[data-desktop-platform="darwin"] .od-desktop-navigation { display: contents; } -html[data-desktop-platform="darwin"] .cw-workspace { +html[data-desktop-chrome] .od-desktop-navigation { display: contents; } +html[data-desktop-chrome] .cw-workspace { --od-sidebar-width: 0px; } -html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] { +html[data-desktop-chrome] .cw-workspace[data-desktop-sidebar="open"] { --od-sidebar-width: 240px; } -html[data-desktop-platform="darwin"] .cw-workspace .react-flow { - left: var(--od-sidebar-width); - transition: left 200ms ease; -} -html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar { - left: var(--od-sidebar-width); - padding-left: 172px; - background: #141414; - transition: left 200ms ease, padding-left 200ms ease; -} -html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-topbar { +html[data-desktop-chrome] .cw-workspace[data-desktop-sidebar="open"] .cw-topbar { padding-left: 20px; } -html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .cw-topbar { background: #f7f8fa; } +html[data-desktop-chrome][data-theme="light"] .cw-workspace .cw-topbar { background: #f7f8fa; } .od-caption-actions { position: absolute; z-index: 45; @@ -133,9 +113,9 @@ html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .cw-topba left: 91px; display: flex; gap: 4px; - -webkit-app-region: no-drag; transition: left 200ms ease; } +.od-caption-actions, .od-caption-actions * { -webkit-app-region: no-drag; } [data-desktop-sidebar="open"] .od-caption-actions { left: 196px; } .od-caption-actions button { display: grid; @@ -167,12 +147,48 @@ html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .cw-topba -webkit-app-region: drag; } [data-desktop-sidebar="open"] .od-project-sidebar { transform: translateX(0); visibility: visible; } -.od-project-sidebar button, .od-project-sidebar nav { -webkit-app-region: no-drag; } +.od-project-sidebar button, .od-project-sidebar input, .od-project-sidebar nav { -webkit-app-region: no-drag; } .od-sidebar-brand { display: flex; align-items: center; gap: 9px; padding: 8px 10px 26px; font-size: 19px; font-weight: 650; letter-spacing: -.5px; } .od-sidebar-brand img { width: 29px; height: 29px; border-radius: 7px; } -.od-project-sidebar .od-sidebar-create { display: flex; align-items: center; justify-content: center; gap: 9px; height: 40px; flex-shrink: 0; margin-bottom: 28px; border: 1px solid #ffffff20; border-radius: 9px; background: #ffffff13; color: inherit; font-size: 13px; } -.od-sidebar-create span { font-size: 21px; line-height: 1; font-weight: 300; } -.od-sidebar-label { padding: 0 10px 10px; font-size: 11px; color: #a1a3b4; } +.od-project-sidebar .od-sidebar-create { + position: relative; + display: flex; + align-items: center; + justify-content: center; + height: 38px; + flex-shrink: 0; + margin-bottom: 28px; + padding: 8px 12px; + border: 0.5px solid #ffffff30; + border-radius: 8px; + background: #ffffff26; + color: inherit; + font-size: 14px; + font-weight: 500; + line-height: 22px; + cursor: pointer; +} +.od-sidebar-create-label { display: flex; align-items: center; justify-content: center; gap: 6px; } +.od-sidebar-create-label svg { flex-shrink: 0; } +.od-sidebar-create-shortcut { + position: absolute; + right: 12px; + display: inline-flex; + gap: 4px; + opacity: 0; + color: #b8bac7; + pointer-events: none; +} +.od-sidebar-create-shortcut kbd { font: inherit; font-size: 11px; font-weight: 400; } +.od-sidebar-create:focus-visible .od-sidebar-create-shortcut { opacity: 1; } +@media (hover: hover) { + .od-project-sidebar .od-sidebar-create:hover { background: #ffffff33; } + .od-sidebar-create:hover .od-sidebar-create-shortcut { opacity: 1; } +} +html[data-desktop-chrome][data-theme="light"] .od-sidebar-create { background: #ffffff8c; border-color: #484e7030; } +html[data-desktop-chrome][data-theme="light"] .od-sidebar-create:hover { background: #ffffff4d; } +html[data-desktop-chrome][data-theme="light"] .od-sidebar-create-shortcut { color: #6d7280; } +.od-sidebar-label { padding: 0 10px; font-size: 11px; color: #a1a3b4; } .od-project-sidebar nav { flex: 1; overflow: auto; min-height: 0; } .od-project-sidebar nav button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; margin-bottom: 3px; border: 0; border-radius: 7px; background: transparent; color: #d5d7e1; text-align: left; font-size: 12px; } .od-project-sidebar nav button svg { flex-shrink: 0; color: #9daed4; } @@ -180,22 +196,95 @@ html[data-desktop-platform="darwin"][data-theme="light"] .cw-workspace .cw-topba .od-project-sidebar nav button[aria-current="page"] { background: #ffffff12; color: #fff; } .od-project-sidebar button:hover { background: #ffffff19; } .od-project-sidebar button:focus-visible, .od-caption-actions button:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 2px; } -.od-project-sidebar .od-sidebar-settings { padding: 10px; text-align: left; font-size: 12px; background: transparent; border: 0; color: #b8bac7; } +.od-project-sidebar .od-sidebar-settings { align-self: flex-start; margin-left: 8px; background: transparent; box-shadow: none; } .od-sidebar-error { color: #e7a4a4; font-size: 11px; overflow-wrap: anywhere; } -html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-bottom-left { left: 260px; } -html[data-desktop-platform="darwin"] .cw-workspace[data-desktop-sidebar="open"] .cw-settings-control { visibility: hidden; } -html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar { background: linear-gradient(155deg, #8e8dda20, #98afcd18), #f4f4f780; color: #282b33; } -html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar nav button { color: #3c414d; } -html[data-desktop-platform="darwin"][data-theme="light"] .od-project-sidebar nav button[aria-current="page"] { background: #484e7010; } -html[data-desktop-platform="darwin"][data-desktop-fullscreen] .od-caption-actions { left: 12px; } -html[data-desktop-platform="darwin"][data-desktop-fullscreen] [data-desktop-sidebar="open"] .od-caption-actions { left: 196px; } -html[data-desktop-platform="darwin"][data-desktop-fullscreen] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } +html[data-desktop-chrome] .cw-workspace[data-desktop-sidebar="open"] .cw-bottom-left { left: 260px; } +html[data-desktop-chrome] .cw-workspace[data-desktop-sidebar="open"] .cw-bottom-left > .cw-settings-control { visibility: hidden; } +html[data-desktop-chrome][data-theme="light"] .od-project-sidebar { background: linear-gradient(155deg, #8e8dda20, #98afcd18), #f4f4f780; color: #282b33; } +html[data-desktop-chrome][data-theme="light"] .od-project-sidebar nav button { color: #3c414d; } +html[data-desktop-chrome][data-theme="light"] .od-project-sidebar nav button[aria-current="page"] { background: #484e7010; } +html[data-desktop-chrome][data-desktop-fullscreen] .od-caption-actions { left: 12px; } +html[data-desktop-chrome][data-desktop-fullscreen] [data-desktop-sidebar="open"] .od-caption-actions { left: 196px; } +html[data-desktop-chrome][data-desktop-fullscreen] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } @media (prefers-reduced-motion: reduce) { .od-project-sidebar, .od-caption-actions, - html[data-desktop-platform="darwin"] .cw-workspace .cw-topbar, - html[data-desktop-platform="darwin"] .cw-workspace .react-flow { transition: none; } + html[data-desktop-chrome] .cw-workspace .cw-topbar, + html[data-desktop-chrome] .cw-workspace .react-flow { transition: none; } } @media (prefers-reduced-transparency: reduce) { .od-project-sidebar { background: #272735; } } -html[data-desktop-platform="darwin"] .cw-workspace .cw-rail-shell { left: var(--od-sidebar-width); transition: left 200ms ease; } -html[data-desktop-platform="darwin"] .cw-workspace .cw-empty { left: calc(50% + var(--od-sidebar-width) / 2); width: min(calc(80vw - var(--od-sidebar-width)), 600px); } -html[data-desktop-platform="darwin"] .cw-workspace:not([data-assistant-open="true"]) .cw-top-actions { transform: none; } +html[data-desktop-chrome] .cw-workspace .cw-rail-shell { left: var(--od-sidebar-width); transition: left 200ms ease; } +html[data-desktop-chrome] .cw-workspace .cw-empty { left: calc(50% + var(--od-sidebar-width) / 2); width: min(calc(80vw - var(--od-sidebar-width)), 600px); } +html[data-desktop-chrome] .cw-workspace:not([data-assistant-open="true"]) .cw-top-actions { transform: none; } + +.od-sidebar-heading { + display: flex; + align-items: center; + justify-content: space-between; + height: 32px; + margin-bottom: 10px; + -webkit-app-region: no-drag; +} +.od-sidebar-search-field { + display: flex; + align-items: center; + width: 100%; + height: 32px; + border: 0.5px solid #ffffff30; + border-radius: 8px; + color: #b8bac7; +} +.od-sidebar-search-field:focus-within { border-color: #ffffff50; } +.od-sidebar-search-field > svg { flex-shrink: 0; margin: 0 7px 0 9px; } +.od-project-sidebar .od-sidebar-search { + flex: 1; + width: 0; + min-width: 0; + height: 30px; + padding: 0; + border: 0; + outline: none; + border-radius: 0; + background: transparent; + color: inherit; + font: inherit; + font-size: 13px; + -webkit-app-region: no-drag; +} +.od-sidebar-search::placeholder { color: #a1a3b4; } +.od-sidebar-search::-webkit-search-cancel-button { display: none; } +.od-project-sidebar :is(.od-sidebar-search-toggle, .od-sidebar-search-close) { + display: grid; + place-items: center; + flex-shrink: 0; + width: 28px; + height: 28px; + padding: 0; + border: 0; + border-radius: 6px; + background: transparent; + color: #b8bac7; +} +.od-project-sidebar .od-sidebar-search-close { width: 24px; height: 24px; margin-right: 3px; } +.od-sidebar-empty { padding: 8px 10px; color: #a1a3b4; font-size: 12px; } +html[data-desktop-chrome][data-theme="light"] .od-sidebar-search-field { border-color: #484e7030; color: #3c414d; } +html[data-desktop-chrome][data-theme="light"] .od-sidebar-search::placeholder { color: #6d7280; } + +.od-sidebar-project-row { position: relative; } +.od-project-sidebar nav .od-sidebar-project-select { padding-right: 38px; } +.od-project-sidebar nav .od-sidebar-project-more { position: absolute; right: 5px; top: 5px; width: 28px; height: 28px; padding: 6px; margin: 0; opacity: 0; justify-content: center; } +.od-sidebar-project-row:hover .od-sidebar-project-more, .od-sidebar-project-row:focus-within .od-sidebar-project-more, .od-project-sidebar nav .od-sidebar-project-more[aria-expanded="true"] { opacity: 1; } +.od-project-sidebar nav .od-sidebar-project-more:hover { background: #ffffff14; } +.od-sidebar-project-menu { position: fixed; z-index: 100; width: 160px; padding: 4px; border: 1px solid #ffffff20; border-radius: 8px; background: var(--panel-bg, #29292d); box-shadow: 0 4px 14px #0003; } +.od-project-sidebar nav .od-sidebar-project-menu button { color: #ed8585; margin: 0; padding: 8px; } +.od-project-sidebar nav .od-sidebar-project-menu button svg { color: inherit; } +.od-project-sidebar nav .od-sidebar-project-menu button:hover { background: #ffffff0d; } + + +html[data-desktop-platform="win32"] .cw-topbar { + padding-right: calc(12px + 100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)); +} +html[data-desktop-platform="win32"][data-desktop-fullscreen] .cw-topbar { padding-right: 16px; } +html[data-desktop-platform="win32"] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } +html[data-desktop-platform="win32"] .cw-workspace[data-desktop-sidebar="closed"] .od-caption-actions { left: 12px; } +html[data-desktop-platform="win32"] .od-project-sidebar { background-color: #272735; } +html[data-desktop-platform="win32"][data-theme="light"] .od-project-sidebar { background-color: #f0f1f5; } diff --git a/src/canvas/workspace/DesktopSidebar.tsx b/src/canvas/workspace/DesktopSidebar.tsx index 209036dff..cfca7cc4d 100644 --- a/src/canvas/workspace/DesktopSidebar.tsx +++ b/src/canvas/workspace/DesktopSidebar.tsx @@ -1,40 +1,145 @@ -import { useEffect, useState } from "react"; -import { listWorkspaceProjects, type WorkspaceProject } from "../../backend/workspace"; +import { useEffect, useRef, useState } from "react"; +import { listWorkspaceProjects, projectDeleteMode, type WorkspaceProject } from "../../backend/workspace"; import { errorMessage } from "../../backend/api"; import { useT } from "../../i18n/I18nProvider"; +import { IconButton } from "./workspaceChrome"; +import { CanvasIcon } from "../CanvasIcon"; +import { ProjectDeleteDialog } from "../ProjectDeleteDialog"; import logo from "../../assets/open_director_logo.png"; -export function DesktopSidebar({ open, currentId, disabled, onToggle, onCreate, onSelect, onSettings }: { +export function DesktopSidebar({ open, currentId, disabled, onToggle, onCreate, onSelect, onDelete, onSettings }: { open: boolean; currentId: string; disabled: boolean; onToggle: () => void; + onDelete: (project: WorkspaceProject) => Promise; onCreate: () => void; onSelect: (project: WorkspaceProject) => Promise; onSettings: () => void; }) { const t = useT(); + const mac = document.documentElement.dataset.desktopPlatform === "darwin"; + const modifier = mac ? "⌘" : "Ctrl+"; const [projects, setProjects] = useState([]); + const [actions, setActions] = useState<{ id: string; top: number; left: number } | null>(null); + const [deleteTarget, setDeleteTarget] = useState(null); + const [recycleBin, setRecycleBin] = useState(false); + const menuRoot = useRef(null); + useEffect(() => { + if (!actions) return; + const dismiss = (event: PointerEvent) => { + if (event.target instanceof Node && !menuRoot.current?.contains(event.target)) setActions(null); + }; + document.addEventListener("pointerdown", dismiss); + return () => document.removeEventListener("pointerdown", dismiss); + }, [actions]); + useEffect(() => { if (!open) setActions(null); }, [open]); const [error, setError] = useState(""); + const [query, setQuery] = useState(""); + const [searching, setSearching] = useState(false); + const searchInput = useRef(null); + const searchButton = useRef(null); + const searchRoot = useRef(null); + const createProject = () => { + setQuery(""); + setSearching(false); + onCreate(); + }; + const closeSearch = () => { + setQuery(""); + setSearching(false); + requestAnimationFrame(() => searchButton.current?.focus()); + }; + useEffect(() => { + if (!open || !searching) return; + // The search field can mount while the sidebar is still sliding into view. + const timer = window.setTimeout(() => searchInput.current?.focus({ preventScroll: true }), 200); + return () => window.clearTimeout(timer); + }, [open, searching]); + useEffect(() => { + if (!document.documentElement.hasAttribute("data-desktop-chrome")) return; + const keydown = (event: KeyboardEvent) => { + if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.isComposing || document.querySelector("dialog[open]")) return; + const key = event.key.toLowerCase(); + if (key === "n") { + event.preventDefault(); + if (!disabled && !event.repeat) createProject(); + return; + } + if (key !== "k") return; + event.preventDefault(); + if (!open) onToggle(); + setSearching(true); + searchInput.current?.focus({ preventScroll: true }); + }; + window.addEventListener("keydown", keydown); + return () => window.removeEventListener("keydown", keydown); + }, [open, onToggle, onCreate, disabled]); + useEffect(() => { + if (!searching || query.trim()) return; + const dismiss = (event: PointerEvent) => { + if (event.target instanceof Node && !searchRoot.current?.contains(event.target)) setSearching(false); + }; + document.addEventListener("pointerdown", dismiss); + return () => document.removeEventListener("pointerdown", dismiss); + }, [searching, query]); + const filteredProjects = projects.filter(project => project.name.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())); useEffect(() => { if (!open) return; let active = true; + void projectDeleteMode().then(mode => { + if (active) setRecycleBin(mode.projectDelete === "recycle_bin"); + }).catch(() => { if (active) setRecycleBin(false); }); void listWorkspaceProjects().then(result => { if (active) { setProjects(result.projects); setError(result.warnings.join("\n")); } }).catch(error => { if (active) setError(errorMessage(error)); }); return () => { active = false; }; }, [open, currentId]); return
-
- - {!open && } -
+ {deleteTarget && setDeleteTarget(null)} onSubmit={async () => { + await onDelete(deleteTarget); + setProjects(items => items.filter(item => item.id !== deleteTarget.id)); + }} />} +
+ + {!open && } +
; } diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index 90d74d4a0..d5df7fbb2 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -337,7 +337,15 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { }, [outputState?.output.id]); const desktop = !!window.opendirectorDesktop; - const [desktopSidebarOpen, setDesktopSidebarOpen] = useState(true); + const [desktopSidebarOpen, setDesktopSidebarOpen] = useState(() => { + try { return desktop && localStorage.getItem("opendirector.desktop.sidebar.v1") === "open"; } + catch { return false; } + }); + useEffect(() => { + if (!desktop) return; + try { localStorage.setItem("opendirector.desktop.sidebar.v1", desktopSidebarOpen ? "open" : "closed"); } + catch { notify(t("desktop.sidebar.saveFailed")); } + }, [desktop, desktopSidebarOpen]); const createDesktopProject = () => { const id = crypto.randomUUID(); void switchDocument(async () => { @@ -835,12 +843,6 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { }} /> )} - {desktop && setDesktopSidebarOpen(value => !value)} - onCreate={createDesktopProject} - onSelect={project => switchDocument(() => openWorkspaceProject(project))} - onSettings={() => setSettingsOpen(true)} />}
+ {desktop && window.opendirectorDesktop?.showMore && window.opendirectorDesktop?.showMore?.()} />}
+ {desktop && setDesktopSidebarOpen(value => !value)} + onCreate={createDesktopProject} + onDelete={deleteProject} + onSelect={project => switchDocument(() => openWorkspaceProject(project))} + onSettings={() => setSettingsOpen(true)} />} Date: Wed, 18 Nov 2026 23:57:41 +0800 Subject: [PATCH 13/31] [fix] desktop: reserve space for Windows caption controls [skip ci] Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke-window.mjs | 22 +++++++++++++++++----- src/canvas/desktop-chrome.css | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 7a2e28a7b..5058f6896 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -22,11 +22,23 @@ export async function smokeWindow({ window, host, getLocale }) { if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); if (process.platform === 'win32') { if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); - await waitFor(() => window.webContents.executeJavaScript(`(() => { - const overlay = navigator.windowControlsOverlay; - const actions = document.querySelector('.cw-top-actions'); - return overlay?.visible && actions && actions.getBoundingClientRect().right <= overlay.getTitlebarAreaRect().right; - })()`), 'Window controls overlap the workspace toolbar'); + let bounds; + try { + await waitFor(async () => { + bounds = await window.webContents.executeJavaScript(`(() => { + const overlay = navigator.windowControlsOverlay; + const actions = document.querySelector('.cw-top-actions'); + return { + visible: overlay?.visible, + titlebarRight: overlay?.getTitlebarAreaRect().right, + toolbarRight: actions?.getBoundingClientRect().right, + }; + })()`); + return bounds.visible && bounds.toolbarRight <= bounds.titlebarRight; + }, 'Window controls overlap the workspace toolbar'); + } catch (error) { + throw new Error(`${error.message}: ${JSON.stringify(bounds)}`, { cause: error }); + } } result.sidebarInitiallyOpen = await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"); if (!result.sidebarInitiallyOpen) { diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css index cdfa1df64..6f6069816 100644 --- a/src/canvas/desktop-chrome.css +++ b/src/canvas/desktop-chrome.css @@ -280,10 +280,10 @@ html[data-desktop-chrome][data-theme="light"] .od-sidebar-search::placeholder { .od-project-sidebar nav .od-sidebar-project-menu button:hover { background: #ffffff0d; } -html[data-desktop-platform="win32"] .cw-topbar { +html[data-desktop-platform="win32"] .cw-workspace .cw-topbar { padding-right: calc(12px + 100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)); } -html[data-desktop-platform="win32"][data-desktop-fullscreen] .cw-topbar { padding-right: 16px; } +html[data-desktop-platform="win32"][data-desktop-fullscreen] .cw-workspace .cw-topbar { padding-right: 16px; } html[data-desktop-platform="win32"] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } html[data-desktop-platform="win32"] .cw-workspace[data-desktop-sidebar="closed"] .od-caption-actions { left: 12px; } html[data-desktop-platform="win32"] .od-project-sidebar { background-color: #272735; } From 24eea37a9729a7a8f26f205fddc6d01b236227c6 Mon Sep 17 00:00:00 2001 From: FayeSpica Date: Wed, 18 Nov 2026 23:50:15 +0800 Subject: [PATCH 14/31] [fix] desktop: keep one Python runtime in the Windows package ## summary - Delete uv's version-less Python alias (a junction on Windows) before packaging. electron-builder dereferences that link for a Windows target, so the archive carried the whole runtime twice. - Prepare each runtime from an empty python directory and point the manifest at the concrete distribution, rejecting an ambiguous layout instead of taking whichever directory readdir happened to return first. - The installer payload falls from 1,336.7 MiB and 11,837 files to 969.6 MiB and 5,958 files; the unsigned installer falls from 403.2 MiB to 293.7 MiB. ## validation - npm ci --prefix apps/desktop, npm run prepare:runtime, and npm run pack:windows produced one python directory under resources/runtime and the installer above. - node apps/desktop/scripts/smoke.mjs against win-unpacked: passed. - npm test --prefix apps/desktop: 6 passed, 1 skipped (the packaged-host test needs OPENDIRECTOR_DESKTOP_RUNTIME). - 7z extraction of the installer: 46.7 s and 11,837 files before, 25.0 s and 5,958 files after. --- apps/desktop/scripts/prepare-runtime.mjs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/desktop/scripts/prepare-runtime.mjs b/apps/desktop/scripts/prepare-runtime.mjs index b5a977b96..2c1b46bc6 100644 --- a/apps/desktop/scripts/prepare-runtime.mjs +++ b/apps/desktop/scripts/prepare-runtime.mjs @@ -1,6 +1,6 @@ /** Build-host prerequisites: uv, Node/npm and a standalone FFmpeg/ffprobe directory. */ import { spawnSync } from 'node:child_process'; -import { chmodSync, copyFileSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { chmodSync, copyFileSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { dirname, join, resolve, relative } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -14,11 +14,23 @@ function run(command, args, cwd = root) { if (result.error) throw result.error; if (result.status !== 0) throw new Error(`${command} exited ${result.status}`); } +// runtime/ is a generated artifact: start from a clean distribution so a Python build from an earlier +// run cannot be packaged beside the one this run installs. +const pythonDirectory = join(runtime, 'python'); +rmSync(pythonDirectory, { recursive: true, force: true }); mkdirSync(join(runtime, 'bin'), { recursive: true }); -run('uv', ['python', 'install', '3.12', '--install-dir', join(runtime, 'python'), '--no-bin']); -const distribution = readdirSync(join(runtime, 'python')).find(name => name.startsWith('cpython-3.12') && name.includes(process.arch === 'arm64' ? 'aarch64' : 'x86_64')); -if (!distribution) throw new Error('Missing standalone Python distribution'); -const python = join(runtime, 'python', distribution, process.platform === 'win32' ? 'python.exe' : 'bin/python3'); +run('uv', ['python', 'install', '3.12', '--install-dir', pythonDirectory, '--no-bin']); +const architecture = process.arch === 'arm64' ? 'aarch64' : 'x86_64'; +const installations = readdirSync(pythonDirectory, { withFileTypes: true }); +// uv leaves a version-less alias beside the concrete distribution (a symlink on POSIX, a junction on +// Windows). A Windows-target package dereferences that link while archiving, so keeping it would copy +// the whole runtime twice and roughly double the installer size and install time. +for (const entry of installations) if (entry.isSymbolicLink()) rmSync(join(pythonDirectory, entry.name)); +const distributions = installations.filter(entry => entry.isDirectory() && !entry.isSymbolicLink() && + entry.name.startsWith('cpython-3.12') && entry.name.includes(architecture)); +if (distributions.length !== 1) throw new Error(`Expected exactly one standalone Python distribution, found ${distributions.length}`); +const distribution = distributions[0].name; +const python = join(pythonDirectory, distribution, process.platform === 'win32' ? 'python.exe' : 'bin/python3'); const wheels = join(root, 'build/desktop-wheel'); mkdirSync(wheels, { recursive: true }); run('uv', ['build', '--wheel', '--out-dir', wheels]); From 5b90cdfe36cf25a457cba9cb8faf50cac96d0957 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 00:39:57 +0800 Subject: [PATCH 15/31] [fix] desktop: isolate releases and repair window behavior Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 63 +++++++++++++---- apps/desktop/scripts/smoke-window.mjs | 98 +++++++++++++++++++++------ apps/desktop/src/main.mjs | 23 ++++++- src/canvas/desktop-chrome.css | 3 +- 4 files changed, 150 insertions(+), 37 deletions(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 0da55fb8c..059a3f132 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -40,7 +40,13 @@ jobs: node-version-file: .nvmrc - name: Check release version and architecture run: | - test "$RELEASE_TAG" = "v$(node -p 'require("./apps/desktop/package.json").version')" + version=$(node -p 'require("./apps/desktop/package.json").version') + if [[ "$GITHUB_REPOSITORY" == "ThinkFlowLab/OpenDirector" ]]; then + test "$RELEASE_TAG" = "v$version" + else + [[ "$RELEASE_TAG" = "v$version" || "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-desktop-test\.[0-9]+$ && "${RELEASE_TAG%-desktop-test.*}" = "v$version" ]] + fi + echo "DESKTOP_VERSION=$version" >> "$GITHUB_ENV" test "$(uname -m)" = arm64 - name: Prepare build tools run: | @@ -69,7 +75,7 @@ jobs: mkdir -p "$staging" "$mount" release-assets ditto apps/desktop/build/mac-arm64/OpenDirector.app "$staging/OpenDirector.app" ln -s /Applications "$staging/Applications" - dmg="OpenDirector-${RELEASE_TAG}-mac-arm64-unsigned.dmg" + dmg="OpenDirector-v${DESKTOP_VERSION}-mac-arm64-unsigned.dmg" hdiutil create -volname OpenDirector -srcfolder "$staging" -format UDZO "release-assets/$dmg" hdiutil attach "release-assets/$dmg" -readonly -nobrowse -mountpoint "$mount" trap 'hdiutil detach "$mount"' EXIT @@ -103,9 +109,14 @@ jobs: "RELEASE_TAG=v$version" >> $env:GITHUB_ENV $env:RELEASE_TAG = "v$version" } - if ($env:RELEASE_TAG -ne "v$version" -or (node -p process.arch) -ne 'x64') { + $tagPattern = '^v' + [regex]::Escape($version) + '$' + if ($env:GITHUB_REPOSITORY -ne 'ThinkFlowLab/OpenDirector') { + $tagPattern = '^v' + [regex]::Escape($version) + '(-desktop-test\.[0-9]+)?$' + } + if ($env:RELEASE_TAG -cnotmatch $tagPattern -or (node -p process.arch) -ne 'x64') { throw 'Expected a matching release tag and Windows x64' } + "DESKTOP_VERSION=$version" >> $env:GITHUB_ENV - name: Prepare build tools run: | choco install uv --yes --no-progress @@ -131,7 +142,7 @@ jobs: if ($LASTEXITCODE -ne 0) { throw 'Windows packaging failed' } - name: Smoke-test installed application run: | - $name = "OpenDirector-$env:RELEASE_TAG-win-x64-unsigned.exe" + $name = "OpenDirector-v$env:DESKTOP_VERSION-win-x64-unsigned.exe" $installer = Get-Item "apps/desktop/build/$name" $install = Join-Path $env:RUNNER_TEMP 'OpenDirector' $setup = Start-Process -FilePath $installer.FullName -ArgumentList "/S /D=$install" -Wait -PassThru @@ -154,18 +165,13 @@ jobs: compression-level: 0 if-no-files-found: error - release: - needs: [macos, windows] + prepare-release: + if: github.event_name != 'pull_request' runs-on: ubuntu-latest permissions: contents: write steps: - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - pattern: desktop-* - merge-multiple: true - path: release-assets - - name: Attach verified installers to draft release + - name: Find or create draft release env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} @@ -178,4 +184,35 @@ jobs: '') gh release create "$RELEASE_TAG" --verify-tag --draft --generate-notes ;; *) echo "::error::Release $RELEASE_TAG is already published"; exit 1 ;; esac - gh release upload "$RELEASE_TAG" release-assets/* --clobber + + release-macos: + needs: [prepare-release, macos] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: desktop-dmg + path: release-assets + - name: Attach verified installer to draft release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: gh release upload "$RELEASE_TAG" release-assets/* --clobber + + release-windows: + needs: [prepare-release, windows] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: desktop-windows + path: release-assets + - name: Attach verified installer to draft release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: gh release upload "$RELEASE_TAG" release-assets/* --clobber diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 5058f6896..89337c777 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -1,5 +1,5 @@ -import { app } from 'electron'; -import { mkdirSync, writeFileSync } from 'node:fs'; +import { app, BrowserWindow } from 'electron'; +import { appendFileSync, mkdirSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { setTimeout as delay } from 'node:timers/promises'; @@ -20,31 +20,23 @@ export async function smokeWindow({ window, host, getLocale }) { await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); await delay(300); if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); - if (process.platform === 'win32') { - if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); - let bounds; - try { - await waitFor(async () => { - bounds = await window.webContents.executeJavaScript(`(() => { - const overlay = navigator.windowControlsOverlay; - const actions = document.querySelector('.cw-top-actions'); - return { - visible: overlay?.visible, - titlebarRight: overlay?.getTitlebarAreaRect().right, - toolbarRight: actions?.getBoundingClientRect().right, - }; - })()`); - return bounds.visible && bounds.toolbarRight <= bounds.titlebarRight; - }, 'Window controls overlap the workspace toolbar'); - } catch (error) { - throw new Error(`${error.message}: ${JSON.stringify(bounds)}`, { cause: error }); - } - } + if (process.platform === 'win32') await checkWindowsCaption(window); + if (result.projectIds.length === 1) await smokeTraceWindows(window, result.projectIds[0]); result.sidebarInitiallyOpen = await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"); if (!result.sidebarInitiallyOpen) { await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); await waitFor(() => window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"), 'Sidebar did not expand'); } + if (process.platform === 'win32') { + const bounds = window.getBounds(); + try { + window.setSize(800, bounds.height); + await waitFor(() => window.webContents.executeJavaScript('innerWidth <= 800'), 'Windows test window did not resize'); + await checkWindowsCaption(window); + } finally { + window.setBounds(bounds); + } + } if (result.projectIds.length === 1) { await window.webContents.executeJavaScript("window.dispatchEvent(new KeyboardEvent('keydown', { key: 'n', metaKey: navigator.platform.startsWith('Mac'), ctrlKey: !navigator.platform.startsWith('Mac'), bubbles: true }))"); result.projectIds = await waitFor(() => window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}) @@ -201,6 +193,68 @@ export async function smokeWindow({ window, host, getLocale }) { return result; } +async function checkWindowsCaption(window) { + if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); + let bounds; + try { + await waitFor(async () => { + bounds = await window.webContents.executeJavaScript(`(() => { + const overlay = navigator.windowControlsOverlay; + const actions = document.querySelector('.cw-top-actions'); + return { + visible: overlay?.visible, + titlebarRight: overlay?.getTitlebarAreaRect().right, + toolbarRight: actions?.getBoundingClientRect().right, + }; + })()`); + return bounds.visible && bounds.toolbarRight <= bounds.titlebarRight; + }, 'Window controls overlap the workspace toolbar'); + } catch (error) { + throw new Error(`${error.message}: ${JSON.stringify(bounds)}`, { cause: error }); + } +} + +async function smokeTraceWindows(window, projectId) { + const evaluate = code => window.webContents.executeJavaScript(code); + const projectPath = await evaluate(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}) + .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 editor = ".cw-assistant-composer [contenteditable=true]"; + await waitFor(() => evaluate(`!!document.querySelector(${JSON.stringify(editor)})`), 'Assistant composer did not open'); + 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`); + await waitFor(async () => (await draft())?.includes('Draft before opening trace'), 'Assistant draft input was not accepted'); + + for (const live of [false, true]) { + const turn = live ? '00000000-0000-4000-8000-000000000002' : '00000000-0000-4000-8000-000000000001'; + const file = join(folder, `${turn}.opencode.jsonl`); + const event = text => JSON.stringify({ type: 'model.reasoning', text }) + '\n'; + const first = live ? 'Live trace begins' : 'Historical trace'; + writeFileSync(file, event(first)); + const query = new URLSearchParams({ traceProject: projectId, turn, runtime: 'opencode', ...(live ? { live: '1' } : {}) }); + await evaluate(`window.open('/?${query}', '_blank', 'noopener,noreferrer'); undefined`); + const child = await waitFor(() => BrowserWindow.getAllWindows().find(item => + item.getParentWindow() === window && item.webContents.getURL().includes(turn)), 'Desktop trace did not open in its own window'); + const contains = text => child.webContents.executeJavaScript( + `document.querySelector('.cw-trace-page')?.innerText.includes(${JSON.stringify(text)})`); + await waitFor(() => contains(first), 'Trace window did not read the stored trace'); + appendFileSync(file, event('Trace file updated')); + if (live) await waitFor(() => contains('Trace file updated'), 'Live trace did not refresh'); + else if (await contains('Trace file updated')) throw new Error('Historical trace unexpectedly refreshed'); + child.close(); + await waitFor(() => child.isDestroyed(), 'Trace window did not close'); + if (!(await draft())?.includes('Draft before opening trace')) throw new Error('Closing the trace lost the assistant draft'); + } + window.focus(); + 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()"); +} + async function waitFor(check, message, attempts = 150) { for (let attempt = 0; attempt < attempts; attempt++) { const value = await check(); diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index 269d1258c..7abd92be6 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -157,8 +157,29 @@ async function start() { for (const event of ['minimize', 'hide', 'restore', 'show']) window.on(event, applyBackdrop); } } + const traceURL = url => { + const target = new URL(url); + return ownedURL(url) && target.pathname === '/' && target.searchParams.has('traceProject'); + }; window.webContents.setWindowOpenHandler(({ url }) => { - if (new URL(url).protocol === 'https:') void shell.openExternal(url); + if (traceURL(url)) { + const trace = new BrowserWindow({ + parent: window, width: 1100, height: 760, + webPreferences: { session: ownedSession, nodeIntegration: false, + contextIsolation: true, sandbox: true, webSecurity: true }, + }); + if (process.platform !== 'darwin') trace.removeMenu(); + trace.webContents.setWindowOpenHandler(() => ({ action: 'deny' })); + trace.webContents.on('will-navigate', (event, target) => { + if (!traceURL(target)) event.preventDefault(); + }); + void trace.loadURL(url).catch(error => { + log.write(`Trace window failed: ${error.message}\n`); + if (!trace.isDestroyed()) trace.destroy(); + }); + } else if (new URL(url).protocol === 'https:') { + void shell.openExternal(url); + } return { action: 'deny' }; }); window.webContents.on('will-navigate', (event, url) => { if (!ownedURL(url)) event.preventDefault(); }); diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css index 6f6069816..89480547c 100644 --- a/src/canvas/desktop-chrome.css +++ b/src/canvas/desktop-chrome.css @@ -281,7 +281,8 @@ html[data-desktop-chrome][data-theme="light"] .od-sidebar-search::placeholder { html[data-desktop-platform="win32"] .cw-workspace .cw-topbar { - padding-right: calc(12px + 100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)); + /* Reserve space before Electron publishes the overlay geometry. */ + padding-right: max(156px, calc(12px + 100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px))); } html[data-desktop-platform="win32"][data-desktop-fullscreen] .cw-workspace .cw-topbar { padding-right: 16px; } html[data-desktop-platform="win32"] .cw-workspace[data-desktop-sidebar="closed"] .cw-topbar { padding-left: 92px; } From 53a34e5fa72fe2d2c16f75ded58dd10b127b1697 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 00:46:29 +0800 Subject: [PATCH 16/31] [ci] desktop: run packaging only for releases Signed-off-by: Weiming Liao --- .github/workflows/desktop-release.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 059a3f132..03dedf4f3 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -3,11 +3,6 @@ name: Desktop release on: push: tags: ['v*'] - pull_request: - paths: - - '.github/workflows/desktop-release.yml' - - 'apps/desktop/**' - - 'build_backend.py' workflow_dispatch: inputs: tag: @@ -27,7 +22,6 @@ env: jobs: macos: - if: github.event_name != 'pull_request' runs-on: macos-latest timeout-minutes: 45 steps: @@ -90,14 +84,12 @@ jobs: if-no-files-found: error windows: - env: - RELEASE_TAG: ${{ github.event_name != 'pull_request' && (inputs.tag || github.ref_name) || '' }} runs-on: windows-latest timeout-minutes: 45 steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - ref: ${{ env.RELEASE_TAG != '' && format('refs/tags/{0}', env.RELEASE_TAG) || github.sha }} + ref: refs/tags/${{ env.RELEASE_TAG }} persist-credentials: false - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: @@ -105,10 +97,6 @@ jobs: - name: Check release version and architecture run: | $version = node -p 'require("./apps/desktop/package.json").version' - if ($env:GITHUB_EVENT_NAME -eq 'pull_request') { - "RELEASE_TAG=v$version" >> $env:GITHUB_ENV - $env:RELEASE_TAG = "v$version" - } $tagPattern = '^v' + [regex]::Escape($version) + '$' if ($env:GITHUB_REPOSITORY -ne 'ThinkFlowLab/OpenDirector') { $tagPattern = '^v' + [regex]::Escape($version) + '(-desktop-test\.[0-9]+)?$' @@ -166,7 +154,6 @@ jobs: if-no-files-found: error prepare-release: - if: github.event_name != 'pull_request' runs-on: ubuntu-latest permissions: contents: write From b4099ea0c3e1046c7cb1a15ad07b2fd64cc5bae2 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 01:31:39 +0800 Subject: [PATCH 17/31] [fix] assistant: keep composer controls on one row Signed-off-by: Weiming Liao --- src/canvas/assistant-experience.css | 7 ------- src/canvas/assistant-panel.css | 13 +++++++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/canvas/assistant-experience.css b/src/canvas/assistant-experience.css index b4f713889..579727913 100644 --- a/src/canvas/assistant-experience.css +++ b/src/canvas/assistant-experience.css @@ -167,19 +167,12 @@ .cw-chat-message-actions button:hover { color: var(--chat-text); } -.cw-assistant-toolbar { - flex-wrap: wrap; - row-gap: 8px; -} .cw-assistant-composer .cw-chat-reference-editor { min-height: 78px; } .cw-assistant-panel .cw-assistant-composer .cw-chat-reference-editor { min-height: 78px; } -.cw-assistant-toolbar .cw-assistant-send { - margin-left: auto; -} .cw-chat-markdown strong { font-weight: 600; } diff --git a/src/canvas/assistant-panel.css b/src/canvas/assistant-panel.css index 1678f628e..aecc065b2 100644 --- a/src/canvas/assistant-panel.css +++ b/src/canvas/assistant-panel.css @@ -466,13 +466,16 @@ display: flex; align-items: center; gap: 4px; - max-width: 155px; + max-width: min(100%, 155px); padding: 5px; border-radius: 6px; color: var(--chat-muted); font-size: 11px; white-space: nowrap; } +.cw-assistant-toolbar > .chat-picker { + min-width: 38px; +} .cw-assistant-panel .chat-picker-trigger:hover:not(:disabled) { background: var(--chat-hover); color: var(--chat-text); @@ -482,6 +485,7 @@ text-overflow: ellipsis; } .cw-assistant-panel .chat-picker-trigger > svg { + flex-shrink: 0; width: 14px; height: 14px; } @@ -742,7 +746,7 @@ font-size: 18px; } .cw-assistant-panel .chat-picker-trigger { - max-width: 110px; + max-width: min(100%, 110px); } .cw-assistant-panel .chat-picker:not(.model-picker) @@ -771,7 +775,7 @@ } @container (max-width: 400px) { .cw-assistant-panel .chat-picker-trigger { - max-width: 100px; + max-width: min(100%, 100px); } .cw-assistant-panel .chat-picker:not(.model-picker) @@ -779,9 +783,6 @@ > span { display: none; } - .cw-assistant-toolbar { - flex-wrap: wrap; - } .cw-assistant-welcome h1 { font-size: 18px; } From b02f3dc34a5735e50b7ac556dabca842b1fc43a9 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 01:37:29 +0800 Subject: [PATCH 18/31] [fix] desktop: keep chat clear of the top bar Signed-off-by: Weiming Liao --- src/canvas/desktop-chrome.css | 3 +++ src/canvas/useAssistantLayout.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css index 89480547c..df5a4d005 100644 --- a/src/canvas/desktop-chrome.css +++ b/src/canvas/desktop-chrome.css @@ -215,6 +215,9 @@ html[data-desktop-chrome][data-desktop-fullscreen] .cw-workspace[data-desktop-si html[data-desktop-chrome] .cw-workspace .cw-rail-shell { left: var(--od-sidebar-width); transition: left 200ms ease; } html[data-desktop-chrome] .cw-workspace .cw-empty { left: calc(50% + var(--od-sidebar-width) / 2); width: min(calc(80vw - var(--od-sidebar-width)), 600px); } html[data-desktop-chrome] .cw-workspace:not([data-assistant-open="true"]) .cw-top-actions { transform: none; } +html[data-desktop-chrome] .cw-workspace .cw-assistant-panel { + top: calc(var(--desktop-toolbar-height) + 14px); +} .od-sidebar-heading { display: flex; diff --git a/src/canvas/useAssistantLayout.ts b/src/canvas/useAssistantLayout.ts index d7ac398d1..54b2a9c3a 100644 --- a/src/canvas/useAssistantLayout.ts +++ b/src/canvas/useAssistantLayout.ts @@ -10,6 +10,7 @@ import { const KEY = "opendirector.assistant-layout.v1"; const DEFAULT_WIDTH = 420; +const DESKTOP_MIN_WIDTH = 320; const MAX_WIDTH = 720; const COLLAPSE_AT = 200; @@ -44,12 +45,15 @@ export function useAssistantLayout( ); const mobile = bounds.viewport <= 700; const headerSpace = bounds.viewport - bounds.heading - bounds.actions - 72; - const belowHeader = mobile || headerSpace <= COLLAPSE_AT; + const desktop = Boolean(window.opendirectorDesktop); + const belowHeader = desktop || mobile || headerSpace <= COLLAPSE_AT; const maxWidth = Math.min( MAX_WIDTH, belowHeader ? bounds.viewport - (mobile ? 20 : 28) : headerSpace, ); - const width = mobile ? maxWidth : Math.min(preferredWidth, maxWidth); + const width = mobile + ? maxWidth + : Math.min(Math.max(preferredWidth, desktop ? DESKTOP_MIN_WIDTH : COLLAPSE_AT), maxWidth); const stop = () => { drag.current = null; From c09baa7f9665faedb1e177c1b6eb1a2ff1f34d80 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 02:01:47 +0800 Subject: [PATCH 19/31] [bugfix] desktop: cancel stale canvas subscriptions Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke-window.mjs | 11 +++++++++++ apps/desktop/src/main.mjs | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 89337c777..875284660 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -181,6 +181,17 @@ export async function smokeWindow({ window, host, getLocale }) { })()`), 'Deleting the open test project did not restore the remaining projects'); result.projectDeletion = true; } + for (let attempt = 0; attempt < 8; attempt++) { + const name = await window.webContents.executeJavaScript(`(() => { + const target = document.querySelector('.od-sidebar-project-select:not([aria-current]):not(:disabled)'); + for (let click = 0; click < 5; click++) target.click(); + return target.textContent; + })()`); + await waitFor(() => window.webContents.executeJavaScript(`( + document.querySelector('.cw-workspace[aria-busy="false"]') && + document.querySelector('.od-sidebar-project-select[aria-current="page"]')?.textContent === ${JSON.stringify(name)} + )`), 'Rapid project switching did not settle'); + } result.sidebarFinallyOpen = process.env.OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR === 'open'; if (await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'") !== result.sidebarFinallyOpen) { await window.webContents.executeJavaScript("document.querySelector('.od-caption-actions button').click()"); diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index 7abd92be6..c91f73cff 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -134,7 +134,15 @@ async function start() { await host.ready; const ownedSession = session.fromPartition('persist:opendirector'); ownedSession.setPermissionRequestHandler((_contents, _permission, callback) => callback(false)); + let projectSubscription; ownedSession.protocol.handle('opendirector', request => proxyRequest(request, host, async (url, options) => { + const pathname = new URL(url).pathname; + if (options.method === 'GET' && /^\/api\/creation\/projects\/[^/]+\/subscribe$/.test(pathname)) { + // Chromium can leave the upstream stream open after the renderer switches projects. + projectSubscription?.abort(); + projectSubscription = new AbortController(); + options.signal = AbortSignal.any([options.signal, projectSubscription.signal]); + } const response = await net.fetch(url, options); if (response.status >= 400) log.write(`Host request ${options.method} ${new URL(url).pathname}: ${response.status}\n`); return response; From abf0833fe663f9b37badb0219e73d6b11afc2349 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 02:08:13 +0800 Subject: [PATCH 20/31] [bugfix] desktop: keep canvas visible during project switches Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke-window.mjs | 20 ++++++++++++++------ src/canvas/workspace/DesktopSidebar.tsx | 8 ++++---- src/canvas/workspace/WorkspaceView.tsx | 20 +++++++++++++++++--- src/canvas/workspace/useWorkspaceDocument.ts | 16 +++++++++------- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 875284660..e6fce5ccd 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -182,15 +182,23 @@ export async function smokeWindow({ window, host, getLocale }) { result.projectDeletion = true; } for (let attempt = 0; attempt < 8; attempt++) { - const name = await window.webContents.executeJavaScript(`(() => { + const switched = await window.webContents.executeJavaScript(`(async () => { const target = document.querySelector('.od-sidebar-project-select:not([aria-current]):not(:disabled)'); + const canvas = document.querySelector('.react-flow'); for (let click = 0; click < 5; click++) target.click(); - return target.textContent; + const deadline = performance.now() + 5000; + do { + await new Promise(requestAnimationFrame); + if (document.querySelector('.canvas-loading-screen') || + document.querySelector('.react-flow') !== canvas) { + throw new Error('Project switch obscured or replaced the canvas surface'); + } + if (target.matches('[aria-current="page"]') && + document.querySelector('.cw-workspace[aria-busy="false"]')) return true; + } while (performance.now() < deadline); + return false; })()`); - await waitFor(() => window.webContents.executeJavaScript(`( - document.querySelector('.cw-workspace[aria-busy="false"]') && - document.querySelector('.od-sidebar-project-select[aria-current="page"]')?.textContent === ${JSON.stringify(name)} - )`), 'Rapid project switching did not settle'); + if (!switched) throw new Error('Rapid project switching did not settle'); } result.sidebarFinallyOpen = process.env.OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR === 'open'; if (await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'") !== result.sidebarFinallyOpen) { diff --git a/src/canvas/workspace/DesktopSidebar.tsx b/src/canvas/workspace/DesktopSidebar.tsx index cfca7cc4d..082862c95 100644 --- a/src/canvas/workspace/DesktopSidebar.tsx +++ b/src/canvas/workspace/DesktopSidebar.tsx @@ -7,8 +7,8 @@ import { CanvasIcon } from "../CanvasIcon"; import { ProjectDeleteDialog } from "../ProjectDeleteDialog"; import logo from "../../assets/open_director_logo.png"; -export function DesktopSidebar({ open, currentId, disabled, onToggle, onCreate, onSelect, onDelete, onSettings }: { - open: boolean; currentId: string; disabled: boolean; onToggle: () => void; +export function DesktopSidebar({ open, currentId, switchingStatus, disabled, onToggle, onCreate, onSelect, onDelete, onSettings }: { + open: boolean; currentId: string; switchingStatus: string; disabled: boolean; onToggle: () => void; onDelete: (project: WorkspaceProject) => Promise; onCreate: () => void; onSelect: (project: WorkspaceProject) => Promise; onSettings: () => void; }) { @@ -98,7 +98,7 @@ export function DesktopSidebar({ open, currentId, disabled, onToggle, onCreate,
- {searching ?
+ {searching && !switchingStatus ?
: <> - {t("desktop.sidebar.projects")} + {switchingStatus || t("desktop.sidebar.projects")} } diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index d5df7fbb2..581299c72 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -361,6 +361,19 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { }).then(success => { if (success) setEditProjectNameId(id); }); }; + const [showSwitching, setShowSwitching] = useState(false); + useEffect(() => { + if (!switching) { + setShowSwitching(false); + return; + } + const timer = window.setTimeout(() => setShowSwitching(true), 200); + return () => window.clearTimeout(timer); + }, [switching]); + const switchingStatus = switching && showSwitching + ? t("canvas.workspace.loading.switching") + : ""; + const workspace = (
- {saveStatusText} + {desktop && desktopSidebarOpen ? saveStatusText : switchingStatus || saveStatusText} {saveStatus.state === "failed" && (
@@ -972,6 +985,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
{desktop && setDesktopSidebarOpen(value => !value)} onCreate={createDesktopProject} @@ -2836,7 +2850,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { onInsert={insertLibraryItems} /> )} - {(!ready || switching) && ( + {!ready && (
{initializationError ? (
@@ -2847,7 +2861,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { ) : ( )}
diff --git a/src/canvas/workspace/useWorkspaceDocument.ts b/src/canvas/workspace/useWorkspaceDocument.ts index 61f5b78fe..ab552fb00 100644 --- a/src/canvas/workspace/useWorkspaceDocument.ts +++ b/src/canvas/workspace/useWorkspaceDocument.ts @@ -295,14 +295,16 @@ export function useWorkspaceDocument(rt: WorkspaceRuntime) { const fitAll = fit || (next.viewPersisted === false && next.nodes.length > 0); - requestAnimationFrame(() => { + if (flow.viewportInitialized) { void flow.setViewport(next.viewport); - if (fitAll) - requestAnimationFrame( - () => - void flow.fitView({ padding: 0.25, maxZoom: 1, duration: 250 }), - ); - }); + } else { + requestAnimationFrame(() => void flow.setViewport(next.viewport)); + } + if (fitAll) { + requestAnimationFrame(() => + void flow.fitView({ padding: 0.25, maxZoom: 1, duration: 250 }), + ); + } }, [flow], ); From 4dde851e8e12a94f240635cad664aaa6a310c835 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 02:13:48 +0800 Subject: [PATCH 21/31] [bugfix] desktop: keep project sidebar stable during switches Signed-off-by: Weiming Liao --- src/backend/workspace.ts | 17 ++++++++++--- src/canvas/desktop-chrome.css | 8 ++++++ src/canvas/workspace/DesktopSidebar.tsx | 33 ++++++++++++++++++------- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/backend/workspace.ts b/src/backend/workspace.ts index 90f936570..746d3146e 100644 --- a/src/backend/workspace.ts +++ b/src/backend/workspace.ts @@ -59,6 +59,17 @@ export interface WorkspaceCleanupResult { const lastKey = "opendirector.lastUnifiedFilesystemProject"; /** The project selector opens and closes often; the list is cheap to reuse. */ const PROJECTS_KEY = "workspace:projects"; +const projectCatalogChanges = new EventTarget(); + +export function subscribeWorkspaceProjects(onChange: () => void) { + projectCatalogChanges.addEventListener("change", onChange); + return () => projectCatalogChanges.removeEventListener("change", onChange); +} + +function invalidateWorkspaceProjects() { + invalidateCached(PROJECTS_KEY); + projectCatalogChanges.dispatchEvent(new Event("change")); +} export const listWorkspaceProjects = (read: { fresh?: boolean } = {}) => cachedRequest( @@ -120,7 +131,7 @@ export async function saveWorkspaceDocument( export async function createWorkspaceProject(name: string, id: string) { // Unified creation does not acquire a lease; projection.open does that. await creationClient(id).command("project.create", { name }); - invalidateCached(PROJECTS_KEY); + invalidateWorkspaceProjects(); return (await listWorkspaceProjects()).projects.find( (project) => project.id === id, )!; @@ -291,7 +302,7 @@ export async function renameWorkspaceProject( } finally { if (current) await openBackendProject(project.id, name).catch(() => {}); } - invalidateCached(PROJECTS_KEY); + invalidateWorkspaceProjects(); return (await listWorkspaceProjects()).projects.find( (item) => item.id === project.id, )!; @@ -348,5 +359,5 @@ export async function trashWorkspaceProject( } creationClient(project.id).close(); projections.delete(project.id); - invalidateCached(PROJECTS_KEY); + invalidateWorkspaceProjects(); } diff --git a/src/canvas/desktop-chrome.css b/src/canvas/desktop-chrome.css index df5a4d005..800c1ca8f 100644 --- a/src/canvas/desktop-chrome.css +++ b/src/canvas/desktop-chrome.css @@ -188,6 +188,14 @@ html[data-desktop-chrome][data-theme="light"] .cw-workspace .cw-topbar { backgro html[data-desktop-chrome][data-theme="light"] .od-sidebar-create { background: #ffffff8c; border-color: #484e7030; } html[data-desktop-chrome][data-theme="light"] .od-sidebar-create:hover { background: #ffffff4d; } html[data-desktop-chrome][data-theme="light"] .od-sidebar-create-shortcut { color: #6d7280; } +.od-sidebar-switch-status { + position: absolute; + right: 22px; + bottom: 24px; + font-size: 11px; + color: inherit; + pointer-events: none; +} .od-sidebar-label { padding: 0 10px; font-size: 11px; color: #a1a3b4; } .od-project-sidebar nav { flex: 1; overflow: auto; min-height: 0; } .od-project-sidebar nav button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; margin-bottom: 3px; border: 0; border-radius: 7px; background: transparent; color: #d5d7e1; text-align: left; font-size: 12px; } diff --git a/src/canvas/workspace/DesktopSidebar.tsx b/src/canvas/workspace/DesktopSidebar.tsx index 082862c95..59140f564 100644 --- a/src/canvas/workspace/DesktopSidebar.tsx +++ b/src/canvas/workspace/DesktopSidebar.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from "react"; -import { listWorkspaceProjects, projectDeleteMode, type WorkspaceProject } from "../../backend/workspace"; +import { listWorkspaceProjects, peekWorkspaceProjects, projectDeleteMode, subscribeWorkspaceProjects, type WorkspaceProject } from "../../backend/workspace"; import { errorMessage } from "../../backend/api"; import { useT } from "../../i18n/I18nProvider"; import { IconButton } from "./workspaceChrome"; @@ -15,7 +15,7 @@ export function DesktopSidebar({ open, currentId, switchingStatus, disabled, onT const t = useT(); const mac = document.documentElement.dataset.desktopPlatform === "darwin"; const modifier = mac ? "⌘" : "Ctrl+"; - const [projects, setProjects] = useState([]); + const [projects, setProjects] = useState(() => peekWorkspaceProjects()?.projects ?? []); const [actions, setActions] = useState<{ id: string; top: number; left: number } | null>(null); const [deleteTarget, setDeleteTarget] = useState(null); const [recycleBin, setRecycleBin] = useState(false); @@ -85,11 +85,25 @@ export function DesktopSidebar({ open, currentId, switchingStatus, disabled, onT void projectDeleteMode().then(mode => { if (active) setRecycleBin(mode.projectDelete === "recycle_bin"); }).catch(() => { if (active) setRecycleBin(false); }); - void listWorkspaceProjects().then(result => { - if (active) { setProjects(result.projects); setError(result.warnings.join("\n")); } - }).catch(error => { if (active) setError(errorMessage(error)); }); - return () => { active = false; }; - }, [open, currentId]); + let latestRead = 0; + const refreshProjects = () => { + const read = ++latestRead; + void listWorkspaceProjects().then(result => { + if (active && read === latestRead) { + setProjects(result.projects); + setError(result.warnings.join("\n")); + } + }).catch(error => { + if (active && read === latestRead) setError(errorMessage(error)); + }); + }; + const unsubscribe = subscribeWorkspaceProjects(refreshProjects); + refreshProjects(); + return () => { + active = false; + unsubscribe(); + }; + }, [open]); return
- {deleteTarget && setDeleteTarget(null)} onSubmit={async () => { await onDelete(deleteTarget); setProjects(items => items.filter(item => item.id !== deleteTarget.id)); diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index 01953389d..8a3de2a0e 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -1,3 +1,4 @@ +import { projectDisplayName } from "../projectDisplayName"; import { DesktopSidebar } from "./DesktopSidebar"; import { Background, BackgroundVariant, MiniMap, SelectionMode, ViewportPortal } from "@xyflow/react"; @@ -923,7 +924,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { switchDocument(() => openWorkspaceProject(project)) @@ -2412,7 +2413,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { ({ ...document, ...projectFields }); + const document = withProjectName(historyRef.current.present); // Project metadata must stay consistent across canvas undo/redo. setHistory((current) => ({ ...current, - present: { ...current.present, title: renamed.name }, - past: current.past.map((item) => ({ ...item, title: renamed.name })), - future: current.future.map((item) => ({ - ...item, - title: renamed.name, - })), - transaction: current.transaction - ? { ...current.transaction, title: renamed.name } - : null, + present: withProjectName(current.present), + past: current.past.map(withProjectName), + future: current.future.map(withProjectName), + transaction: current.transaction ? withProjectName(current.transaction) : null, })); await saveWorkspaceDocument(document); } finally { diff --git a/src/contracts/creation.schema.json b/src/contracts/creation.schema.json index aa9856710..520831a3c 100644 --- a/src/contracts/creation.schema.json +++ b/src/contracts/creation.schema.json @@ -9224,6 +9224,20 @@ "pattern": "\\S", "title": "Name", "type": "string" + }, + "defaultNameIndex": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index of the automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ @@ -9243,6 +9257,20 @@ "pattern": "\\S", "title": "Name", "type": "string" + }, + "defaultNameIndex": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index for an automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ @@ -24744,6 +24772,20 @@ "pattern": "\\S", "title": "Name", "type": "string" + }, + "defaultNameIndex": { + "anyOf": [ + { + "minimum": 1, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index of the automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ @@ -24764,6 +24806,20 @@ "pattern": "\\S", "title": "Name", "type": "string" + }, + "defaultNameIndex": { + "anyOf": [ + { + "exclusiveMinimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Index for an automatically named initial project.", + "title": "Defaultnameindex" } }, "required": [ diff --git a/src/contracts/generated.ts b/src/contracts/generated.ts index 8cf9b8972..b6da01f14 100644 --- a/src/contracts/generated.ts +++ b/src/contracts/generated.ts @@ -930,10 +930,12 @@ export interface ProjectInput extends ContractInput { readonly id: string; readonly revision?: number; readonly name: string; + readonly defaultNameIndex?: number | null; } export interface ProjectCreateInput extends ContractInput { readonly name: string; + readonly defaultNameIndex?: number | null; } export interface ProjectCreateCommandInput extends CommandBaseInput { @@ -961,7 +963,8 @@ export interface ProjectQueryInput extends QueryBaseInput { readonly type: "project.get"; } -export interface ProjectRenameInput extends ProjectCreateInput { +export interface ProjectRenameInput extends ContractInput { + readonly name: string; } export interface ProjectRenameCommandInput extends CommandBaseInput { @@ -2509,10 +2512,12 @@ export interface Project extends Contract { readonly id: string; readonly revision: number; readonly name: string; + readonly defaultNameIndex?: number | null; } export interface ProjectCreate extends Contract { readonly name: string; + readonly defaultNameIndex?: number | null; } export interface ProjectCreateCommand extends CommandBase { @@ -2540,7 +2545,8 @@ export interface ProjectQuery extends QueryBase { readonly type: "project.get"; } -export interface ProjectRename extends ProjectCreate { +export interface ProjectRename extends Contract { + readonly name: string; } export interface ProjectRenameCommand extends CommandBase { diff --git a/src/i18n/messages/en-US/canvasShell.ts b/src/i18n/messages/en-US/canvasShell.ts index ddb9dbf20..3b86829c8 100644 --- a/src/i18n/messages/en-US/canvasShell.ts +++ b/src/i18n/messages/en-US/canvasShell.ts @@ -8,6 +8,7 @@ export const canvasShell = { "canvas.project.noSearchResults": "No matching projects", "canvas.project.defaultName": "Untitled project", + "canvas.project.defaultNameIndexed": "Untitled project ({index})", "canvas.search.label": "Search nodes", "canvas.search.placeholder": "Search names, prompts or text", "canvas.search.clear": "Clear search", diff --git a/src/i18n/messages/zh-CN/canvasShell.ts b/src/i18n/messages/zh-CN/canvasShell.ts index c90e00ce4..fb168d0a3 100644 --- a/src/i18n/messages/zh-CN/canvasShell.ts +++ b/src/i18n/messages/zh-CN/canvasShell.ts @@ -9,6 +9,7 @@ export const canvasShell = { "canvas.project.noSearchResults": "没有匹配的项目", "canvas.project.defaultName": "未命名项目", + "canvas.project.defaultNameIndexed": "未命名项目({index})", "canvas.search.label": "搜索节点", "canvas.search.placeholder": "搜索名称、提示词或文本", "canvas.search.clear": "清空搜索", diff --git a/tests/browser/bilingual_defaults.mjs b/tests/browser/bilingual_defaults.mjs new file mode 100644 index 000000000..b387a2e55 --- /dev/null +++ b/tests/browser/bilingual_defaults.mjs @@ -0,0 +1,91 @@ +import assert from "node:assert/strict"; +import { launchBrowser } from "./engine.mjs"; + +const base = process.env.CREATION_WEB_URL ?? "http://127.0.0.1:5180"; +const health = await fetch(base + "/api/creation-test-health", { + headers: { "X-OpenDirector-Request": "1" }, +}); +assert.ok(health.ok); +const { isolated, assistantFixture } = await health.json(); +assert.ok(isolated && assistantFixture, "Requires an isolated --assistant-fixture server"); +const browser = await launchBrowser(); +try { + const page = await browser.newPage({ locale: "zh-CN", viewport: { width: 1440, height: 1000 } }); + const opening = page.waitForRequest(request => new URL(request.url()).pathname.endsWith("/open-canvas")); + await page.goto(base + "/?setup=welcome"); + const request = await opening; + const project = new URL(request.url()).pathname.replace(/\/open-canvas$/, ""); + const session = request.headers()["x-opendirector-session"]; + assert.ok(session, "The browser must acquire the editing session"); + const projectName = page.locator(".cw-project-name"); + const welcome = page.locator("#welcome-language"); + await projectName.filter({ hasText: /^未命名项目$/ }).waitFor(); + await welcome.selectOption("en-US"); + await page.locator(".cw-welcome-secondary").click(); + await projectName.filter({ hasText: /^Untitled project$/ }).waitFor(); + + const switchLanguage = async (label, locale) => { + await page.locator(".cw-language-toggle").getByRole("button", { name: label, exact: true }).click(); + await page.locator(`html[lang="${locale}"]`).waitFor({ state: "attached" }); + }; + const showChat = () => page.locator(".cw-chat-button").click(); + const heading = page.locator(".cw-assistant-header h2"); + const checkHistoryTitle = async (title) => { + await page.locator("[data-session-history]").click(); + await page.locator(".cw-assistant-session-row strong") + .filter({ hasText: new RegExp(`^${title}$`) }).waitFor(); + await page.keyboard.press("Escape"); + await page.locator(".cw-assistant-session-row").waitFor({ state: "detached" }); + }; + await showChat(); + await heading.filter({ hasText: /^New conversation$/ }).waitFor(); + await checkHistoryTitle("New conversation"); + await switchLanguage("中文", "zh-CN"); + await projectName.filter({ hasText: /^未命名项目$/ }).waitFor(); + await heading.filter({ hasText: /^新会话$/ }).waitFor(); + await checkHistoryTitle("新会话"); + await switchLanguage("EN", "en-US"); + await projectName.filter({ hasText: /^Untitled project$/ }).waitFor(); + await heading.filter({ hasText: /^New conversation$/ }).waitFor(); + await checkHistoryTitle("New conversation"); + + // Rename to the literal Chinese default. The explicit rename must override the automatic name. + await projectName.click(); + const nameInput = page.locator(".cw-project-name-editor input"); + await nameInput.fill("未命名项目"); + await nameInput.press("Enter"); + await projectName.filter({ hasText: /^未命名项目$/ }).waitFor(); + + const api = project + "/assistant"; + const headers = { "X-OpenDirector-Request": "1", "X-OpenDirector-Session": session }; + const conversation = await page.request.get(base + api, { headers }); + assert.ok(conversation.ok(), await conversation.text()); + const { conversationId } = await conversation.json(); + for (const [title, runtimeModel] of [["新会话", null], ["Second prompt", "CLI 默认模型"]]) { + const response = await page.request.post(base + api + "/turns", { + headers, + data: { id: crypto.randomUUID(), conversationId, text: title, runtime: "codex", runtimeModel }, + }); + assert.ok(response.ok(), await response.text()); + assert.match(await response.text(), /"type"\s*:\s*"end"/); + } + await page.goto(base); + await projectName.filter({ hasText: /^未命名项目$/ }).waitFor(); + await showChat(); + const models = page.locator(".cw-assistant-message-heading small"); + const checkNamedConversation = async (defaultModel) => { + await heading.filter({ hasText: /^新会话$/ }).waitFor(); + await checkHistoryTitle("新会话"); + await models.first().filter({ hasText: defaultModel }).waitFor(); + assert.deepEqual(await models.allTextContents(), [defaultModel, "CLI 默认模型"]); + assert.equal(await projectName.textContent(), "未命名项目"); + }; + await checkNamedConversation("CLI default model"); + await switchLanguage("中文", "zh-CN"); + await checkNamedConversation("CLI 默认模型"); + await switchLanguage("EN", "en-US"); + await checkNamedConversation("CLI default model"); + console.log("Browser bilingual defaults and custom names passed"); +} finally { + await browser.close(); +} diff --git a/tests/browser/creation_server.py b/tests/browser/creation_server.py index 63df50662..329614767 100644 --- a/tests/browser/creation_server.py +++ b/tests/browser/creation_server.py @@ -134,7 +134,7 @@ async def fixture_agent(self, run): yield {'type': 'delta', 'text': '这是隔离测试回复。'} agent.AgentRuntimes.stream = fixture_agent - agent.runtime_available = lambda runtime: runtime == 'default' + agent.runtime_available = lambda runtime: runtime in {'default', 'codex'} tool_gate = asyncio.Event() tool_gate.set() tool_calls = [] diff --git a/tests/browser/manifest.json b/tests/browser/manifest.json index c75fabdcf..fc2298bb1 100644 --- a/tests/browser/manifest.json +++ b/tests/browser/manifest.json @@ -57,6 +57,13 @@ ], "note": "Needs --assistant-fixture services." }, + { + "file": "bilingual_defaults.mjs", + "fixture": true, + "previewSafe": true, + "lanes": ["gate"], + "note": "Requires a fresh isolated assistant fixture workspace." + }, { "file": "canvas_crop.mjs", "previewSafe": true, diff --git a/tests/test_assistant_conversations.py b/tests/test_assistant_conversations.py index 8480e1619..a8817b961 100644 --- a/tests/test_assistant_conversations.py +++ b/tests/test_assistant_conversations.py @@ -127,7 +127,7 @@ def test_create_reuses_an_empty_active_session_instead_of_accumulating(assistant listing = client.get(path + '/conversations').json() assert listing['activeId'] == first_id assert listing['items'] == [ - {'id': first_id, 'title': '新会话', 'messageCount': 0, 'hasDraft': False}, + {'id': first_id, 'title': None, 'messageCount': 0, 'hasDraft': False}, ] # Whitespace-only draft is still an empty session and must be reused. assert client.put(path + '/draft', json={'conversationId': first_id, @@ -346,7 +346,7 @@ def test_history_identifies_unsent_drafts_and_replays_creation_without_duplicate assert client.post(path + '/conversations', json={'id': second}).json() == created items = client.get(path + '/conversations').json()['items'] assert items == [ - {'id': second, 'title': '新会话', 'messageCount': 0, 'hasDraft': False}, + {'id': second, 'title': None, 'messageCount': 0, 'hasDraft': False}, {'id': first, 'title': '海边短片草稿', 'messageCount': 0, 'hasDraft': True}, ] restored = client.post(path + f'/conversations/{first}/activate').json() From 7a2dd600b6e71f980a843eafb474d1df1b88ead8 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 11:42:04 +0800 Subject: [PATCH 26/31] [docs] desktop: explain the desktop architecture Signed-off-by: Weiming Liao --- docs/README.md | 3 ++- docs/architecture/desktop.md | 33 ++++++++++++++++++++++++++++++ docs/architecture/desktop.zh-CN.md | 33 ++++++++++++++++++++++++++++++ docs/development/desktop.md | 6 ++---- docs/development/desktop.zh-CN.md | 6 ++---- 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 docs/architecture/desktop.md create mode 100644 docs/architecture/desktop.zh-CN.md diff --git a/docs/README.md b/docs/README.md index d6d89d2a9..3341db937 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,6 +9,7 @@ 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 | +| [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 | @@ -30,7 +31,7 @@ This directory is the entry point for the repository's shared documentation. The | [BigModel video](guides/bigmodel-video.md) ([中文](guides/bigmodel-video.zh-CN.md)) | CogVideoX-3 text, single-image and first/last-frame generation, task recovery and adoption | BigModel protocol, inputs, output sizes or recovery behavior change | | [BigModel GLM-Image](guides/bigmodel-image.md) ([中文](guides/bigmodel-image.zh-CN.md)) | Account setup, text-to-image generation, adoption and recovery | BigModel integration fields or behavior change | | [GLM-Image validation](development/glm-image-validation.md) | Real provider workflow screenshots and automated checks | GLM-Image acceptance is repeated | -| [Desktop application](development/desktop.md) ([中文](development/desktop.zh-CN.md)) | Desktop Host, bundled runtime, build and acceptance boundaries | Desktop lifecycle or packaging contract changes | +| [Desktop application](development/desktop.md) ([中文](development/desktop.zh-CN.md)) | Desktop build, CLI registration, and release checks | Build, CLI registration, or release checks change | | [Agent runtime](architecture/agent-runtime.md) | Agent runtime architecture | Runtime architecture changes | The root [README](../README.md) introduces the product and examples and links to quick-start and documentation. See [installation and updates](guides/installation.md) ([中文](guides/installation.zh-CN.md)) for installation, and the [user guide](guides/user-guide.md) ([中文](guides/user-guide.zh-CN.md)) for configuration, creation, and troubleshooting. The README does not contain the full manual, implementation architecture, development tests, research sources, or iteration history. Source code and generated contracts describe the implementation; architecture and roadmap documents describe goals and do not establish that a capability is already available. diff --git a/docs/architecture/desktop.md b/docs/architecture/desktop.md new file mode 100644 index 000000000..158c81d66 --- /dev/null +++ b/docs/architecture/desktop.md @@ -0,0 +1,33 @@ +# Desktop architecture + +[中文](desktop.zh-CN.md) + +The desktop application runs the shared Web UI and Python API on the same machine. Electron manages native windows and starts the Python Host. The Host runs the [unified project services](unified-project.md) and the [Agent runtime](agent-runtime.md). + +```mermaid +flowchart LR + Renderer["Web renderer"] -->|"opendirector://app"| Main["Electron main process"] + Main -->|"Authenticated HTTP on loopback"| Host["Python Host"] + Main -.->|"Control over private stdio pipes"| Host + Host --> Store["Project storage"] +``` + +## Electron owns the connection to the Host + +The main process starts the bundled Python runtime and gives the Host a fresh credential over the control pipe. The Host binds to an OS-assigned port on `127.0.0.1` and reports its address when ready. The main process opens the Web UI after the Host is ready. + +The renderer requests application pages, media, and API resources through `opendirector://app`. The main process forwards those requests to the Host with the launch credential. The Host checks the credential before it serves the request. The renderer runs with Node integration off and context isolation on. A preload bridge exposes specific desktop operations, including edit-session registration and language and export status updates. + +## The Host owns project state + +The Host uses the same project storage, command validation, and edit-session rules as the standalone API. The desktop shell handles window behavior and opens native dialogs for file input and downloads. + +The installed application supplies the Web UI, Python runtime, and bundled tools as application resources. The Host writes project and configuration data to `workspace/` under Electron's user data directory. The same user data directory also holds desktop logs and the cached language preference. Existing source and pip workspaces stay in their original locations. + +## Closing a window keeps the Host running + +Closing the main window hides it so work in progress can continue. Quitting the application checks local Agent runs, generation jobs, tool tasks, and renderer export activity before it stops the Host. The main process asks the user before interrupting active work. The Host releases edit sessions registered by this desktop instance during shutdown. Loss of the parent control pipe also starts Host cleanup. + +A provider can continue running a submitted job and charge for it after the local application quits. Browser export requires the renderer process. + +See [Desktop application development](../development/desktop.md) for build commands, CLI registration, and release checks. diff --git a/docs/architecture/desktop.zh-CN.md b/docs/architecture/desktop.zh-CN.md new file mode 100644 index 000000000..8caf00124 --- /dev/null +++ b/docs/architecture/desktop.zh-CN.md @@ -0,0 +1,33 @@ +# 桌面架构 + +[English](desktop.md) + +桌面应用在同一台机器上运行共用的 Web UI 和 Python API。Electron 管理原生窗口并启动 Python Host。Host 运行[统一项目服务](unified-project.md)和 [Agent Runtime](agent-runtime.md)。 + +```mermaid +flowchart LR + Renderer["Web 渲染进程"] -->|"opendirector://app"| Main["Electron 主进程"] + Main -->|"带凭证的回环 HTTP 请求"| Host["Python Host"] + Main -.->|"私有标准输入输出控制管道"| Host + Host --> Store["工程存储"] +``` + +## Electron 管理到 Host 的连接 + +主进程启动随包提供的 Python,通过控制管道把本次启动的凭证交给 Host。Host 在 `127.0.0.1` 上绑定系统分配的端口,就绪后报告地址。主进程收到就绪消息后打开 Web UI。 + +渲染进程通过 `opendirector://app` 请求应用页面、媒体和 API 资源。主进程转发请求时附带启动凭证,Host 验证凭证后处理请求。渲染进程关闭 Node 集成并开启上下文隔离。预加载脚本提供有限的桌面接口,包括登记编辑会话、同步语言和导出状态。 + +## Host 管理工程状态 + +Host 与独立 API 共用工程存储、命令校验和编辑会话规则。桌面壳管理窗口,并通过原生对话框选择文件和保存下载。 + +安装包提供 Web UI、Python 运行时和内置工具。Host 将工程和配置写入 Electron 用户数据目录下的 `workspace/`。该用户数据目录也保存桌面日志和语言缓存。源码版和 pip 安装版已有的工作区保留在原位置。 + +## 关窗后 Host 继续运行 + +关闭主窗口会隐藏界面,正在进行的工作可以继续。退出应用时,主进程先检查本地 Agent 运行、生成任务、工具任务和渲染进程的导出状态,再停止 Host。中断正在进行的工作前,主进程会请用户确认。Host 在停止时释放由该桌面实例登记的编辑会话。父进程的控制管道断开后,Host 也会开始清理。 + +退出本机应用后,供应商可能继续执行已提交的任务并产生费用。浏览器导出需要渲染进程保持运行。 + +构建命令、CLI 注册和发布检查见[桌面应用开发指南](../development/desktop.zh-CN.md)。 diff --git a/docs/development/desktop.md b/docs/development/desktop.md index 3ef71867a..b3c37f805 100644 --- a/docs/development/desktop.md +++ b/docs/development/desktop.md @@ -2,9 +2,7 @@ [中文](desktop.zh-CN.md) -The desktop application reuses the Web UI and Python services. Electron owns one Python Host, started on an OS-assigned loopback port through a private JSON-lines control channel. Each launch has a fresh credential; only the main process forwards authenticated requests. The renderer uses `opendirector://app`, has no Node access, and has a narrow bridge for registering its edit-session identity and reporting language and export activity. - -Application resources are read-only. Electron user data contains `workspace/` (projects and configuration), `logs/` and a locale cache. Existing source or pip workspaces are not moved or overwritten. File inputs use native dialogs; downloads use the native save dialog. Closing the window hides it and keeps exports alive. Quit checks local Agent, generation, tool and renderer export activity, asks before interruption, then stops the Host and releases only edit sessions registered by its own window. The same cleanup runs when the parent control pipe closes. Remote jobs may continue and incur charges; shutdown does not claim remote cancellation. +See [Desktop architecture](../architecture/desktop.md) for the processes, project storage, and shutdown behavior. ## Build and check @@ -34,4 +32,4 @@ Before release, run the complete clean-machine acceptance in #363 on each declar ## Release packages -The desktop release workflow builds an unsigned Apple Silicon DMG and an unsigned Windows x64 NSIS installer. It checks both packages on their native runners before attaching them and their SHA-256 files to the same draft release. Windows changes also run the installer smoke check on pull requests that touch desktop packaging. +The desktop release workflow builds an Apple Silicon DMG with an ad-hoc signed App and an unsigned Windows x64 NSIS installer. Each platform uploads its installer and SHA-256 file to the shared draft release after its native checks pass. The macOS job verifies the installed App signature before and after the smoke test. diff --git a/docs/development/desktop.zh-CN.md b/docs/development/desktop.zh-CN.md index b5ea1f265..291b453f0 100644 --- a/docs/development/desktop.zh-CN.md +++ b/docs/development/desktop.zh-CN.md @@ -2,9 +2,7 @@ [English](desktop.md) -桌面应用复用 Web UI 与 Python 业务服务。Electron 通过私有 JSON 行控制管道启动一个 Python Host,由系统分配本地端口。每次启动生成独立凭证,仅主进程转发带鉴权的请求。渲染进程使用 `opendirector://app`,没有 Node 权限,仅通过有限 IPC 登记自身编辑会话及同步语言和导出状态。 - -应用资源只读。Electron 用户数据目录保存 `workspace/`(工程和配置)、`logs/` 与语言缓存,不搬迁或覆盖已有源码、pip 工作区。文件输入使用原生选择器,下载使用原生保存对话框。关闭窗口会隐藏窗口并保留导出;退出前检查 Agent、生成、工具和浏览器导出任务,说明中断影响后停止 Host,并仅释放本窗口登记的编辑会话;父控制管道断开时也执行相同清理。远端任务可能继续执行并产生费用,停止应用不代表已取消远端任务。 +进程职责、工程存储和退出行为见[桌面架构](../architecture/desktop.zh-CN.md)。 ## 构建与检查 @@ -34,4 +32,4 @@ node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector ## 发布安装包 -桌面发布工作流构建未签名的 Apple Silicon DMG 和 Windows x64 NSIS 安装包。两端在原生运行器验证通过后,将安装包和 SHA-256 校验文件上传到同一个草稿 Release。涉及桌面打包的 PR 也会运行 Windows 安装验证。 +桌面发布工作流构建 Apple Silicon DMG 和未签名的 Windows x64 NSIS 安装包。DMG 内的 App 使用 ad-hoc 签名。每个平台通过原生验证后,将安装包和 SHA-256 校验文件上传到同一个草稿 Release。macOS 任务在冒烟测试前后校验已安装 App 的签名。 From 77c88b2f69f99775f79fb3969366e5413c4d0e6c Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 12:42:24 +0800 Subject: [PATCH 27/31] [bugfix] Download example canvases through the local Host Signed-off-by: Weiming Liao --- MANIFEST.in | 1 + .../opendirector_api}/example-canvases.json | 0 apps/api/src/opendirector_api/examples.py | 79 +++++++++++++++++++ apps/api/src/opendirector_api/main.py | 2 + pyproject.toml | 2 +- requirements.txt | 2 + setup.py | 2 +- .../workspace/example/exampleCatalog.ts | 2 +- .../workspace/example/exampleDownload.ts | 11 ++- tests/exampleDownload.test.ts | 8 +- 10 files changed, 98 insertions(+), 11 deletions(-) rename {src/canvas/workspace/example => apps/api/src/opendirector_api}/example-canvases.json (100%) create mode 100644 apps/api/src/opendirector_api/examples.py diff --git a/MANIFEST.in b/MANIFEST.in index f29dfedc8..5c087363e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include package.json package-lock.json index.html tsconfig.json vite.config.ts . recursive-include src * recursive-include packages/core/src *.py recursive-include apps/api/src *.py +include apps/api/src/opendirector_api/example-canvases.json recursive-include packages/agent/skills * prune packages/core/src/opendirector/_bundled prune node_modules diff --git a/src/canvas/workspace/example/example-canvases.json b/apps/api/src/opendirector_api/example-canvases.json similarity index 100% rename from src/canvas/workspace/example/example-canvases.json rename to apps/api/src/opendirector_api/example-canvases.json diff --git a/apps/api/src/opendirector_api/examples.py b/apps/api/src/opendirector_api/examples.py new file mode 100644 index 000000000..2b0744a99 --- /dev/null +++ b/apps/api/src/opendirector_api/examples.py @@ -0,0 +1,79 @@ +"""Download bundled example canvases through the local Host.""" + +import json +from importlib.resources import files + +import httpx +from fastapi import APIRouter +from fastapi.responses import Response, StreamingResponse +from starlette.background import BackgroundTask + +router = APIRouter() +_catalog = json.loads(files(__package__).joinpath("example-canvases.json").read_text(encoding="utf-8")) +_urls = {item["id"]: item["url"] for item in _catalog["items"]} +_hosts = {"lz.qaiu.top", "zip3.webgetstore.com"} +_max_bytes = 256 * 1024 * 1024 + + +@router.get("/api/example-canvases/{example_id}/download") +async def download_example(example_id: str): + source = _urls.get(example_id) + if source is None: + return Response(status_code=404) + + client = httpx.AsyncClient(timeout=20) + upstream = None + + async def close(): + try: + if upstream is not None: + await upstream.aclose() + finally: + await client.aclose() + + try: + url = httpx.URL(source) + for _ in range(5): + if (url.scheme != "https" or url.host not in _hosts or url.userinfo + or url.port not in (None, 443)): + raise ValueError("Invalid example download destination") + request = client.build_request("GET", url, headers={"Accept-Encoding": "identity"}) + upstream = await client.send(request, stream=True) + if not upstream.is_redirect: + break + url = url.join(upstream.headers["location"]) + await upstream.aclose() + else: + raise ValueError("Too many example download redirects") + + upstream.raise_for_status() + if upstream.headers.get("content-encoding", "identity").lower() != "identity": + raise ValueError("Unexpected example archive encoding") + length = upstream.headers.get("content-length") + if length is not None and not 0 < int(length) <= _max_bytes: + raise ValueError("Invalid example archive size") + except (httpx.HTTPError, ValueError, KeyError): + await close() + return Response(status_code=502) + except BaseException: + await close() + raise + + async def body(): + total = 0 + try: + async for chunk in upstream.aiter_raw(): + total += len(chunk) + if total > _max_bytes: + raise ValueError("Example archive exceeds download limit") + yield chunk + finally: + await close() + + headers = {"Cache-Control": "no-store"} + if length is not None: + headers["Content-Length"] = length + # Electron strips Content-Length when it reconstructs the streamed response. + headers["X-OpenDirector-Archive-Bytes"] = length + return StreamingResponse(body(), media_type="application/octet-stream", headers=headers, + background=BackgroundTask(close)) diff --git a/apps/api/src/opendirector_api/main.py b/apps/api/src/opendirector_api/main.py index d92e6347f..73c6db6e2 100644 --- a/apps/api/src/opendirector_api/main.py +++ b/apps/api/src/opendirector_api/main.py @@ -27,6 +27,7 @@ from opendirector_api.agent import agent_routes from opendirector_api.library import library_routes from opendirector_api.voices import voice_routes +from opendirector_api.examples import router as example_routes from opendirector_api.localization import localized_error from opendirector_api.models import (ModelConfigInput, ModelConfigPublic, AgentModelTest, ModelCapabilityRequest, ModelDiscoveryRequest, ModelBatchInput, @@ -76,6 +77,7 @@ async def lifespan(app): app.include_router(agent_routes(creation_projects, creation_generation, model_configs, chat_provider, active=active_agents)) app.include_router(library_routes(creation_projects)) app.include_router(voice_routes(creation_generation.voices)) + app.include_router(example_routes) app.state.desktop_activity = lambda: dict( agents=len(active_agents), generations=sum(not job.future.done() for job in creation_generation.jobs.values()), tools=sum(not job.done() for job in creation_tools.jobs.values())) diff --git a/pyproject.toml b/pyproject.toml index ebe2f2f9c..c25fa211d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ description = "Local video creation workspace and agent CLI" readme = "README.md" requires-python = ">=3.11" dependencies = [ - "PyYAML>=6,<7", "filelock>=3.16,<4", "httpx>=0.27,<1", "anyio>=4,<5", + "PyYAML>=6,<7", "filelock>=3.16,<4", "httpx[socks]>=0.27,<1", "anyio>=4,<5", "pydantic>=2.12,<3", "typer>=0.27.3,<0.28", "Pillow>=12,<14", "pillow-heif>=1.8.1,<2", "fonttools==4.68.0", "fastapi>=0.115,<1", "uvicorn>=0.30,<1", "starlette>=1.8,<2", "python-multipart>=0.0.33,<1", diff --git a/requirements.txt b/requirements.txt index 90cd62a6f..ee26fc8c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -88,6 +88,8 @@ rich==15.0.0 # typer shellingham==1.5.4 # via typer +socksio==1.0.0 + # via httpx starlette==1.8.0 # via # opendirector (pyproject.toml) diff --git a/setup.py b/setup.py index ec0e4eb53..f1c2c8a12 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ def get_tag(self): packages=find_packages('packages/core/src') + find_packages('apps/api/src'), package_dir={'opendirector': 'packages/core/src/opendirector', 'opendirector_api': 'apps/api/src/opendirector_api'}, - package_data={'opendirector': ['_bundled/**/*']}, + package_data={'opendirector': ['_bundled/**/*'], 'opendirector_api': ['example-canvases.json']}, include_package_data=True, distclass=BundledDistribution, cmdclass={'bdist_wheel': PlatformWheel}, diff --git a/src/canvas/workspace/example/exampleCatalog.ts b/src/canvas/workspace/example/exampleCatalog.ts index 8ab1ac263..843ce9ebb 100644 --- a/src/canvas/workspace/example/exampleCatalog.ts +++ b/src/canvas/workspace/example/exampleCatalog.ts @@ -6,7 +6,7 @@ * offline. `public/` is not an option here — the packaged server only mounts * `/assets` and `/fonts`. */ -import bundledCatalog from "./example-canvases.json" with { type: "json" }; +import bundledCatalog from "../../../../apps/api/src/opendirector_api/example-canvases.json" with { type: "json" }; export interface ExampleText { "zh-CN": string; diff --git a/src/canvas/workspace/example/exampleDownload.ts b/src/canvas/workspace/example/exampleDownload.ts index e092417a3..cbe52f09d 100644 --- a/src/canvas/workspace/example/exampleDownload.ts +++ b/src/canvas/workspace/example/exampleDownload.ts @@ -134,7 +134,7 @@ async function readLimited( maxBytes: number, onProgress?: (received: number, total: number | null) => void, ): Promise { - const declared = Number(response.headers.get("content-length") ?? ""); + const declared = Number(response.headers.get("X-OpenDirector-Archive-Bytes") ?? response.headers.get("content-length") ?? ""); const total = Number.isFinite(declared) && declared > 0 ? declared : null; if (!response.body) { const buffer = await response.arrayBuffer(); @@ -184,12 +184,11 @@ export async function fetchExampleBytes( try { let response: Response; try { - response = await fetchImpl(entry.url, { + response = await fetchImpl(`/api/example-canvases/${encodeURIComponent(entry.id)}/download`, { method: "GET", mode: "cors", - // Never send cookies to a third-party origin; the hosted copy is public. - credentials: "omit", - redirect: "follow", + redirect: "error", + headers: { "X-OpenDirector-Request": "1" }, // The link resolves to a short-lived CDN path; a cached body would rot. cache: "no-store", signal: deadline.signal, @@ -199,7 +198,7 @@ export async function fetchExampleBytes( } if (!response.ok) throw new ExampleError("http", `status ${response.status}`, response.status); - const declared = Number(response.headers.get("content-length") ?? ""); + const declared = Number(response.headers.get("X-OpenDirector-Archive-Bytes") ?? response.headers.get("content-length") ?? ""); if (Number.isFinite(declared) && declared > maxBytes) throw new ExampleError("tooLarge"); let bytes: Uint8Array; diff --git a/tests/exampleDownload.test.ts b/tests/exampleDownload.test.ts index 12e01ba32..460dcfc8f 100644 --- a/tests/exampleDownload.test.ts +++ b/tests/exampleDownload.test.ts @@ -135,7 +135,11 @@ function respond( test("the shipped shape downloads end to end", async () => { const outer = await wrappedArchive(); const result = await fetchExampleCanvas(entry(), { - fetchImpl: (async () => respond(outer)()) as typeof fetch, + fetchImpl: async (url, options) => { + assert.equal(url, `/api/example-canvases/${entry().id}/download`); + assert.equal(new Headers(options?.headers).get("X-OpenDirector-Request"), "1"); + return respond(outer)(); + }, }); assert.equal(result.kind, "zip-wrapper"); assert.equal(result.innerEntry, "图像创作示例画布.canvas"); @@ -240,7 +244,7 @@ test("progress reports received bytes against the declared total", async () => { const response = { ok: true, status: 200, - headers: new Headers({ "content-length": String(bytes.byteLength) }), + headers: new Headers({ "X-OpenDirector-Archive-Bytes": String(bytes.byteLength) }), body: new Blob([bytes]).stream(), } as unknown as Response; const events: [number, number | null][] = []; From 834df857efca10e4e575a3f92f09f0d7a11ba2dd Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 13:09:13 +0800 Subject: [PATCH 28/31] [test] Fix isolated example canvas and H3 browser checks ## summary - Mock example downloads at the local Host endpoint. - Use distinct images for the H3 first and last frame uploads. Signed-off-by: Weiming Liao --- tests/browser/example_canvas_picker.mjs | 15 ++++----------- tests/browser/minimax_h3.mjs | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/tests/browser/example_canvas_picker.mjs b/tests/browser/example_canvas_picker.mjs index 99a938fc4..acd92fcf6 100644 --- a/tests/browser/example_canvas_picker.mjs +++ b/tests/browser/example_canvas_picker.mjs @@ -3,9 +3,8 @@ * directly with a progress bar, the project menu still opens the full picker, * and a blocked page is reported instead of imported. * - * The catalog ships inside the app, so the check intercepts the sample URLs - * themselves; the fixture is a ZIP around one `.canvas`, like the real hosts - * serve, and the failure case returns HTML like a blocked share link does. + * The download route returns either a ZIP around one `.canvas` or an HTML + * page like a blocked share link does. */ import assert from "node:assert/strict"; import { buildCanvasArchive } from "../../src/canvas/canvasArchive.ts"; @@ -48,16 +47,10 @@ const wrapper = await createZip([ ]); const wrapperBytes = Buffer.from(await wrapper.arrayBuffer()); -// The bundled catalog points the two buttons at these hosts. -const samplePattern = /^https:\/\/lz\.qaiu\.top\//; -const downloadHeaders = { - // A cross-origin route still needs CORS headers: the app fetches, not navigates. - "access-control-allow-origin": "*", - "content-disposition": `attachment; filename="${document.title}.zip"`, -}; +const samplePattern = "**/api/example-canvases/image-canvas/download"; const served = (contentType = "application/octet-stream") => ({ status: 200, - headers: { ...downloadHeaders, "content-type": contentType }, + contentType, body: contentType === "text/html" ? "请登录" : wrapperBytes, }); diff --git a/tests/browser/minimax_h3.mjs b/tests/browser/minimax_h3.mjs index 184bb754c..cd2d7b8d0 100644 --- a/tests/browser/minimax_h3.mjs +++ b/tests/browser/minimax_h3.mjs @@ -47,13 +47,15 @@ try { }); await page.goto(`${base}/ai-tool/ai-canvas/${projectId}?creation=unified`); await page.getByText("Saved on this device", { exact: true }).waitFor(); - const png = await page.evaluate(() => { - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = 256; - canvas.getContext("2d").fillRect(0, 0, 256, 256); - return canvas.toDataURL("image/png").split(",")[1]; - }); - for (const name of ["first.png", "last.png"]) { + for (const [index, name] of ["first.png", "last.png"].entries()) { + const png = await page.evaluate((color) => { + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = 256; + const context = canvas.getContext("2d"); + context.fillStyle = color; + context.fillRect(0, 0, 256, 256); + return canvas.toDataURL("image/png").split(",")[1]; + }, index === 0 ? "black" : "white"); await page .getByLabel("Choose local asset files", { exact: true }) .setInputFiles({ @@ -61,11 +63,14 @@ try { mimeType: "image/png", buffer: Buffer.from(png, "base64"), }); - const count = name === "first.png" ? 1 : 2; + const count = index + 1; for (let attempt = 0; attempt < 150; attempt++) { const current = await call(`/api/creation/projects/${projectId}`); if (current.canvasItems.length === count) break; - if (attempt === 149) throw Error(await page.locator("body").innerText()); + if (attempt === 149) { + const body = await page.locator("body").innerText(); + throw new Error(`Upload ${name}: expected ${count} canvas items, found ${current.canvasItems.length}\n${body}`); + } await new Promise((resolve) => setTimeout(resolve, 100)); } } From d3adb7004ebba870759d069736cdc2780fa8d86b Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 16:07:52 +0800 Subject: [PATCH 29/31] [bugfix] Restore route and docs after conflict resolution Signed-off-by: Weiming Liao --- apps/api/src/opendirector_api/agent.py | 233 +++++++++++++++++++++++++ docs/README.md | 29 +++ 2 files changed, 262 insertions(+) diff --git a/apps/api/src/opendirector_api/agent.py b/apps/api/src/opendirector_api/agent.py index cc579f2da..ac2b19481 100644 --- a/apps/api/src/opendirector_api/agent.py +++ b/apps/api/src/opendirector_api/agent.py @@ -284,3 +284,236 @@ def turn_jobs(project_id: UUID, turn_id: UUID): if active is None: active = {} + admission: dict[UUID, asyncio.Lock] = {} + + @router.get('') + async def conversation(project_id: UUID): + value = await asyncio.to_thread(conversations.update, project_id) + running = active.get(project_id) + # A streaming message without an active turn was interrupted (for + # example by a restart); with one, the client can attach to it. + if running and not running[1].done(): + value = {**value, 'activeTurnId': str(running[0])} + return value + + @router.get('/conversations') + async def list_conversations(project_id: UUID): + return await asyncio.to_thread(conversations.list, project_id) + + async def change_conversation(project_id: UUID, conversation_id: UUID, session: UUID, *, create=False): + async with admission.setdefault(project_id, asyncio.Lock()): + if project_id in active: + raise ProjectError('请先停止或等待当前回复结束,再切换对话。', 409) + return await asyncio.to_thread(conversations.activate, project_id, conversation_id, str(session), create=create) + + @router.post('/conversations') + async def new_conversation(project_id: UUID, value: ConversationCreate, x_opendirector_session: UUID = Header()): + return await change_conversation(project_id, value.id, x_opendirector_session, create=True) + + @router.post('/conversations/{conversation_id}/activate') + async def activate_conversation(project_id: UUID, conversation_id: UUID, x_opendirector_session: UUID = Header()): + return await change_conversation(project_id, conversation_id, x_opendirector_session) + + @router.put('/draft') + async def draft(project_id: UUID, value: Draft, x_opendirector_session: UUID = Header()): + return await asyncio.to_thread(conversations.update, project_id, str(x_opendirector_session), draft=value) + + @router.get('/runtimes') + async def available_runtimes(project_id: UUID, probe: bool = True): + await asyncio.to_thread(conversations.path, project_id) + if probe: + return await configured_runtimes() + return [{**item, 'status': await runtime_status(item['id'], probe=False)} + for item in runtime_catalog()] + + @router.get('/runtimes/{runtime}/status') + async def runtime_detail(project_id: UUID, runtime: Runtime): + await asyncio.to_thread(conversations.path, project_id) + item = next(item for item in runtime_catalog() if item['id'] == 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'], 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 + return await deepseek_models(selected) + return await model_choices(runtime) + + @router.get('/skills') + async def catalog(project_id: UUID): + directory = await asyncio.to_thread(conversations.path, project_id) + found = await skills(projects.local.repository, directory) + return [{key: item[key] for key in ('name', 'description', 'source')} for item in found] + + @router.post('/turns/{turn_id}/stop') + async def stop(project_id: UUID, turn_id: UUID, x_opendirector_session: UUID = Header()): + await asyncio.to_thread(conversations.path, project_id, str(x_opendirector_session)) + running = active.get(project_id) + if running and running[0] == turn_id: + with CancelScope(shield=True): + if not running[1].cancelling(): + running[1].cancel() + with suppress(asyncio.CancelledError): + await running[1] + return {'ok': True} + + @router.get('/turns/{turn_id}/events') + async def turn_events(project_id: UUID, turn_id: UUID): + await asyncio.to_thread(conversations.path, project_id) + running = active.get(project_id) + if not running or running[0] != turn_id: + raise ProjectError('这轮回复已结束,请重新读取对话。', 404) + return StreamingResponse(running[2].follow(), media_type='text/event-stream') + + @router.post('/turns') + async def turn(project_id: UUID, value: Turn, x_opendirector_session: UUID = Header(), + accept_language: str | None = Header(default=None, alias='Accept-Language')): + async with admission.setdefault(project_id, asyncio.Lock()): + if project_id in active: + raise ProjectError('当前工程已有回复正在执行。', 409) + session = str(x_opendirector_session) + directory = await asyncio.to_thread(conversations.path, project_id, session) + if not runtime_available(value.runtime): + raise ProjectError(f'{value.runtime} 未安装,请安装 CLI 并登录。', 503) + spec = runtime_spec(value.runtime) + if not spec.supportsSkills and value.skills: + raise ProjectError(f'{spec.label} 不支持技能,请移除技能后发送。', 409) + if value.runtime == 'jiuwenswarm' and value.thinking != 'auto': + raise ProjectError('JiuwenSwarm 当前使用原生默认推理强度。', 409) + config = await asyncio.to_thread(configs.resolve, str(value.modelId), 'agent') if spec.modelSource == 'settings' else None + if config is not None: + prepared = await asyncio.to_thread(generation.availability.prepare, config) + current = await asyncio.to_thread(configs.resolve, str(value.modelId), 'agent') + generation.availability.require(current, _assistant_request(current), prepared) + config = current + available = await skills(projects.local.repository, directory) if spec.supportsSkills else [] + if set(value.skills) - {item['name'] for item in available}: + 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) + model = config['modelId'] if config else value.runtimeModel + model_is_cli_default = spec.modelSource == 'cli' and not model + model_selections = dict(value.modelSelections) + model_names = {row['id']: row['modelId'] for row in configs.list()} + preferences = {kind: {'modelConfigId': model_id, 'modelName': model_names.get(model_id)} + for kind, model_id in model_selections.items() if model_id} + events = RunEvents() + def validate_connection(): + if config is not None: + current = configs.resolve(str(value.modelId), 'agent') + generation.availability.require(current, _assistant_request(current), prepared) + async def produce() -> None: + text, status, error, accepted = '', 'complete', None, False + activities = [] + sources = {} + previous_sources = {} + plan = None + try: + user = {'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)], + 'skills': value.skills, 'runtime': value.runtime, 'runtimeModel': value.runtimeModel, + 'modelSelections': dict(value.modelSelections), + 'model': model, 'modelIsCliDefault': model_is_cli_default, 'status': 'complete'} + saved = await asyncio.to_thread(conversations.update, project_id, session, begin=user, + conversation_id=value.conversationId, before_begin=validate_connection) + accepted = True + events.put({'type': 'start', 'conversation': saved}) + previous_sources = {source['id']: source for message in saved['messages'][:-2] + for source in message.get('sources', [])} + context = [] + for message in saved['messages'][:-1]: + content = message['text'] or '(empty reply)' + references = [] + for attachment in message.get('assets', []): + asset = assets.get(attachment['id']) + if asset is not None: + references.append({'id': str(asset.id), 'name': attachment['name'], + 'kind': asset.kind, 'path': str((directory / asset.path).resolve()), + 'metadata': asset.metadata.model_dump(mode='json', exclude_none=True)}) + if references: + content += '\nReferenced project assets: ' + json.dumps(references, ensure_ascii=False) + content += '\nThese are asset references, not visual observations. Inspect media with available tools before describing its contents.' + context.append({'role': message['role'], 'content': content}) + if preferences: + context[-1]['content'] += '\nUser model preferences for this turn: ' + json.dumps(preferences, ensure_ascii=False) + context[-1]['content'] += '\nUse these models for new generation unless the user explicitly requests another. If unavailable or unsuitable, explain and ask before substituting. Keep existing nodes on their configured models unless the user requests a change.' + run = RunContext(runtime=value.runtime, project_id=project_id, turn_id=value.id, + session=session, directory=directory, config=config, messages=context, + selected_skills=value.skills, thinking=value.thinking, model_selections=model_selections, + runtime_model=value.runtimeModel, skills=available, conversation_id=UUID(saved['conversationId'])) + async with aclosing(runtimes.stream(run)) as stream: + async for event in stream: + if event['type'] == 'delta': + text += event['text'] + inherited = ([source for source in referenced_sources(text, previous_sources) + if source['id'] not in sources] + if previous_sources and '\ue201' in event['text'] else []) + if inherited: + sources.update({source['id']: source for source in inherited}) + events.put({'type': 'sources', 'sources': inherited}) + if event['type'] == 'sources': + for source in event['sources']: + sources.setdefault(source['id'], source) + if event['type'] == 'plan': + plan = event['entries'] + if event['type'] == 'tool': + previous = next((item for item in activities if item['id'] == event['id']), None) + activity = {**{key: item for key, item in event.items() if key != 'type'}, + 'textOffset': previous['textOffset'] if previous else len(text)} + if previous is None: + activities.append(activity) + else: + activities[activities.index(previous)] = activity + event = {'type': 'tool', **activity} + events.put(event) + except asyncio.CancelledError: + status = 'stopped' + raise + except Exception as failure: + # Persist partial output even when an integration fails unexpectedly. + status = 'interrupted' + if isinstance(failure, ProjectError): + error = localized_error_for_language( + accept_language, chinese=str(failure), + status=failure.status, code=failure.code) + else: + error = localized_error_for_language( + accept_language, + chinese='Agent 执行失败,请检查后端日志。', + status=500, code='operation_rejected') + logger.exception(f'agent.turn.failed project_id={project_id} turn_id={value.id}') + finally: + if accepted: + for activity in activities: + if activity['status'] == 'running': + activity['status'] = 'interrupted' + saved = await asyncio.to_thread(conversations.update, project_id, finish={ + 'id': str(uuid5(value.id, 'assistant')), 'role': 'assistant', 'text': text, 'status': status, + 'model': model, 'modelIsCliDefault': model_is_cli_default, + 'runtime': value.runtime, 'thinking': value.thinking, 'tools': activities, + 'sources': list(sources.values()), + **({'plan': plan} if plan is not None else {})}, conversation_id=value.conversationId) + else: + saved = None + events.put({'type': 'end', 'conversation': saved, 'error': error}) + + if project_id in active: + raise ProjectError('当前工程已有回复正在执行。', 409) + task = asyncio.create_task(produce()) + active[project_id] = (value.id, task, events) + def release(completed: asyncio.Task) -> None: + running = active.get(project_id) + if running and running[0] == value.id and running[1] is completed: + active.pop(project_id) + task.add_done_callback(release) + # Closing this stream (switching projects, reloading) only detaches + # the viewer; the run continues and can be attached again. + return StreamingResponse(events.follow(), media_type='text/event-stream') + + return router diff --git a/docs/README.md b/docs/README.md index 42b620253..310bb3cd3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,3 +34,32 @@ This directory is the entry point for the repository's shared documentation. The | [GLM-Image validation](development/glm-image-validation.md) | Real provider workflow screenshots and automated checks | GLM-Image acceptance is repeated | | [Desktop application](development/desktop.md) ([中文](development/desktop.zh-CN.md)) | Desktop build, CLI registration, and release checks | Build, CLI registration, or release checks change | | [Agent runtime](architecture/agent-runtime.md) | Agent runtime architecture and Job origin tracing | Runtime architecture or Job origin semantics change | + +The root [README](../README.md) introduces the product and examples and links to quick-start and documentation. See [installation and updates](guides/installation.md) ([中文](guides/installation.zh-CN.md)) for installation, and the [user guide](guides/user-guide.md) ([中文](guides/user-guide.zh-CN.md)) for configuration, creation, and troubleshooting. The README does not contain the full manual, implementation architecture, development tests, research sources, or iteration history. Source code and generated contracts describe the implementation; architecture and roadmap documents describe goals and do not establish that a capability is already available. + +## Directory conventions + +```text +AGENTS.md Long-term development guidance +README.md Product and getting-started entry point +docs/ + README.md Documentation index and maintenance rules + architecture/ Architecture, business semantics, and design decisions + development/ Roadmap, development process, and validation + guides/ Instructions for users and integrators +``` + +Historical material and temporary artifacts do not automatically become official documentation. Ignore rules reserve the root of `docs/` for local historical files; put new shared documents in the maintained subdirectories above and explicitly add them to Git. Do not restore all old directories or delete local material merely to tidy the index. + +## Maintenance rules + +1. **Give each fact one primary home.** Put enduring principles in the development guidance, architecture semantics in architecture documentation, and operational instructions in guides. Link from other documents to avoid divergent copies. +2. **Separate goals, plans, and facts.** Architecture documents do not track progress; the roadmap records dependencies and gates. Prefer issues, PRs, and commit descriptions for task status, defects, and validation results. +3. **Add focused records when needed.** Document the context, decision, alternatives, and impact of important design choices. Standalone validation records should include the code version, environment, commands, results, and limitations. Create them when there is substantive content, not as empty templates or placeholder lists. +4. **Make explanations self-contained.** Describe designs and capabilities directly, without using another product's name as a substitute for business rules or relying on chat context, neighboring directories, or untracked files. +5. **Update documentation with capability changes.** Changes to objects, APIs, model parameters, or save and recovery semantics should update the relevant documents in the same change. Do not leave outdated conclusions presented as current behavior. +6. **Ship link targets with the repository.** Local targets should already be tracked or included in the same commit. Include needed images and examples; do not link to temporary files on a developer's machine. +7. **Keep records precise.** Distinguish test doubles from real services and intended designs from verified behavior. A historical regression result does not guarantee later versions. +8. **Stage explicit files.** Review the actual diff and stage the required documents rather than adding whole directories that may contain local history. + +For documentation changes, check relative links, code and command paths, formatting, and tracking scope. Documentation-only changes do not require unrelated model, media, or browser tests. From 2935f47452600839a6ba5e2f5a494d238903e8c0 Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 20:17:46 +0800 Subject: [PATCH 30/31] [bugfix] desktop: stream uploads and fix image annotations ## summary - Stream asset uploads to the shared Host API and clean up cancelled uploads. - Decode annotation data locally and verify saved media in desktop and browser regressions. Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke-window.mjs | 61 ++++++++++++++++++++++++++- apps/desktop/scripts/smoke.mjs | 27 ++++++++++-- apps/desktop/src/host.mjs | 17 ++++++-- apps/desktop/src/main.mjs | 4 +- apps/desktop/tests/host.test.mjs | 35 +++++++++++++++ docs/development/desktop.md | 2 +- docs/development/desktop.zh-CN.md | 2 +- src/backend/creationClient.ts | 22 +++++++--- src/backend/tools.ts | 8 +++- tests/browser/tool_drafts.mjs | 22 +++++++++- tests/creationClient.test.ts | 31 ++++++++++++++ 11 files changed, 211 insertions(+), 20 deletions(-) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index e1d6f373f..d8fb7399d 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -1,5 +1,6 @@ import { app, BrowserWindow } from 'electron'; -import { appendFileSync, mkdirSync, writeFileSync } from 'node:fs'; +import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { createHash } from 'node:crypto'; import { join } from 'node:path'; import { setTimeout as delay } from 'node:timers/promises'; @@ -21,6 +22,28 @@ export async function smokeWindow({ window, host, getLocale }) { await delay(300); if (await window.webContents.executeJavaScript('!!document.querySelector("dialog[open]")')) throw new Error('A dialog obscures the canvas'); if (process.platform === 'win32') await checkWindowsCaption(window); + if (process.env.OPENDIRECTOR_DESKTOP_DATA) { + const projectId = result.projectIds.length === 1 + ? result.projectIds[0] + : process.env.OPENDIRECTOR_DESKTOP_SMOKE_MEDIA_PROJECT; + if (result.projectIds.length === 1) await dropMedia(window); + const fingerprints = Object.fromEntries( + Object.entries({ image: 'png', video: 'mp4', audio: 'wav' }).map(([kind, extension]) => { + const bytes = readFileSync(join(process.env.OPENDIRECTOR_DESKTOP_DATA, `desktop-drop.${extension}`)); + return [kind, 'sha256:' + createHash('sha256').update(bytes).digest('hex')]; + }), + ); + let state; + try { + await waitFor(async () => { + state = await droppedMediaState(window, projectId, fingerprints); + return state.saved; + }, 'Dropped video, image and audio were not saved'); + } catch (error) { + throw new Error(`${error.message}: ${JSON.stringify(state)}`, { cause: error }); + } + result.mediaDrop = projectId; + } if (result.projectIds.length === 1) await smokeTraceWindows(window, result.projectIds[0]); result.sidebarInitiallyOpen = await window.webContents.executeJavaScript("document.querySelector('.cw-workspace').dataset.desktopSidebar === 'open'"); if (!result.sidebarInitiallyOpen) { @@ -219,6 +242,42 @@ export async function smokeWindow({ window, host, getLocale }) { return result; } +async function dropMedia(window) { + const { webContents } = window; + const { x, y } = await webContents.executeJavaScript(`(() => { + const bounds = document.querySelector('.react-flow').getBoundingClientRect(); + return { x: Math.round(bounds.left + bounds.width / 2), y: Math.round(bounds.top + bounds.height / 2) }; + })()`); + const files = ['mp4', 'wav', 'png'].map(extension => + join(process.env.OPENDIRECTOR_DESKTOP_DATA, `desktop-drop.${extension}`)); + const data = { items: [], files, dragOperationsMask: 1 }; + const debuggerSession = webContents.debugger; + debuggerSession.attach(); + try { + for (const type of ['dragEnter', 'dragOver', 'drop']) { + await debuggerSession.sendCommand('Input.dispatchDragEvent', { type, x, y, data }); + } + } finally { + debuggerSession.detach(); + } +} + +async function droppedMediaState(window, projectId, fingerprints) { + return window.webContents.executeJavaScript(`(async () => { + const response = await fetch('/api/creation/projects/' + ${JSON.stringify(projectId)}, { + headers: { 'X-OpenDirector-Request': '1' }, + }); + if (!response.ok) return { status: response.status }; + const { canvasItems, assets } = await response.json(); + const saved = Object.entries(${JSON.stringify(fingerprints)}).every(([kind, fingerprint]) => + canvasItems.some(item => item.kind === kind && item.binding.role === 'material' && + assets.some(asset => asset.id === item.binding.objectRef.assetId && asset.kind === kind && + asset.provenance.source === 'upload' && asset.fingerprint === fingerprint))); + return { saved, nodes: canvasItems.map(item => item.kind), assets: assets.map(asset => asset.name), + notice: document.querySelector('.cw-toast [role="status"]')?.textContent }; + })()`); +} + async function checkWindowsCaption(window) { if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); let bounds; diff --git a/apps/desktop/scripts/smoke.mjs b/apps/desktop/scripts/smoke.mjs index 0fa227f13..721591b83 100644 --- a/apps/desktop/scripts/smoke.mjs +++ b/apps/desktop/scripts/smoke.mjs @@ -1,6 +1,7 @@ -import { mkdtemp, readFile, realpath, rm } from 'node:fs/promises'; +import { copyFile, mkdtemp, readFile, realpath, rm } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; import { spawn } from 'node:child_process'; const binary = process.argv[2]; @@ -8,10 +9,28 @@ if (!binary) throw new Error('Usage: node scripts/smoke.mjs /path/to/packaged/Op const directory = await realpath(await mkdtemp(join(tmpdir(), 'opendirector-desktop-'))); let logOffset = 0; let previous; +let mediaProject; let sidebarOpen = false; try { + const fixtures = [ + ['desktop-drop.mp4', '../../../tests/fixtures/timeline-text/visual-a.mp4'], + ['desktop-drop.wav', '../../../tests/fixtures/timeline-text/audio-a.wav'], + ['desktop-drop.png', '../../../src/assets/open_director_logo.png'], + ]; + for (const [name, source] of fixtures) { + await copyFile(fileURLToPath(new URL(source, import.meta.url)), join(directory, name)); + } for (let attempt = 0; attempt < 3; attempt++) { - const child = spawn(binary, ['--smoke'], { env: { ...process.env, OPENDIRECTOR_DESKTOP_DATA: directory, OPENDIRECTOR_DESKTOP_SMOKE_DELETE: attempt === 2 ? '1' : '', OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR: attempt === 0 ? 'open' : 'closed' }, stdio: 'inherit' }); + const child = spawn(binary, ['--smoke'], { + env: { + ...process.env, + OPENDIRECTOR_DESKTOP_DATA: directory, + OPENDIRECTOR_DESKTOP_SMOKE_MEDIA_PROJECT: mediaProject ?? '', + OPENDIRECTOR_DESKTOP_SMOKE_DELETE: attempt === 2 ? '1' : '', + OPENDIRECTOR_DESKTOP_SMOKE_SIDEBAR: attempt === 0 ? 'open' : 'closed', + }, + stdio: 'inherit', + }); const timeout = setTimeout(() => child.kill('SIGKILL'), 90_000); const result = await new Promise((resolve, reject) => { child.once('error', reject); @@ -22,11 +41,13 @@ try { logOffset = log.length; if (result !== 0 || !latest) throw new Error(`Packaged desktop smoke failed on launch ${attempt + 1} (${result}):\n${log}`); const receipt = JSON.parse(latest.slice(6)); + if (!receipt.mediaDrop || (mediaProject && receipt.mediaDrop !== mediaProject)) throw new Error('Desktop media drop was not verified'); + mediaProject = receipt.mediaDrop; if (receipt.sidebarInitiallyOpen !== sidebarOpen) throw new Error('Sidebar default or restored state is incorrect'); sidebarOpen = receipt.sidebarFinallyOpen; const current = receipt.projectIds; if (previous && JSON.stringify(previous) !== JSON.stringify(current)) throw new Error('Reopening changed the project identities'); previous = current; } - process.stdout.write('Packaged canvas, authenticated API, isolation, both locales, hidden-window Host, reopen and sidebar preferences: passed\n'); + process.stdout.write('Packaged canvas, media drag-and-drop, authenticated API, isolation, both locales, hidden-window Host, reopen and sidebar preferences: passed\n'); } finally { await rm(directory, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); } diff --git a/apps/desktop/src/host.mjs b/apps/desktop/src/host.mjs index 8c393f367..555a96e06 100644 --- a/apps/desktop/src/host.mjs +++ b/apps/desktop/src/host.mjs @@ -108,14 +108,23 @@ export async function proxyRequest(request, host, fetcher) { const headers = new Headers(request.headers); for (const name of ['host', 'origin', 'cookie', 'authorization', 'connection', 'content-length', 'x-opendirector-desktop']) headers.delete(name); headers.set('X-OpenDirector-Desktop', host.token); - const response = await fetcher(target.href, { + const upload = request.method === 'PUT' && /^\/api\/creation\/projects\/[^/]+\/uploads\/[^/]+$/.test(incoming.pathname); + const options = { method: request.method, headers, redirect: 'manual', credentials: 'omit', signal: request.signal, - ...(request.method === 'GET' || request.method === 'HEAD' ? {} : { body: await request.arrayBuffer() }), - }); + }; + if (request.body) { + if (upload) { + options.body = request.body; + options.duplex = 'half'; + } else { + options.body = await request.arrayBuffer(); + } + } + const response = await fetcher(target.href, options); if (response.status >= 300 && response.status < 400 && response.status !== 304) return new Response(null, { status: 502 }); const outgoing = new Headers(response.headers); for (const name of ['connection', 'transfer-encoding', 'keep-alive', 'set-cookie', 'content-encoding', 'content-length']) outgoing.delete(name); outgoing.set('Cache-Control', 'no-store'); - outgoing.set('Content-Security-Policy', "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; media-src 'self' blob:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-src 'none'"); + outgoing.set('Content-Security-Policy', "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; media-src 'self' blob: data:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-src 'none'"); return new Response(response.body, { status: response.status, statusText: response.statusText, headers: outgoing }); } diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index b7ef75124..ea1517171 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -143,7 +143,9 @@ async function start() { projectSubscription = new AbortController(); options.signal = AbortSignal.any([options.signal, projectSubscription.signal]); } - const response = await net.fetch(url, options); + // Electron net.fetch buffers request streams internally. The private Host + // upload uses Node fetch to send the body incrementally over loopback. + const response = await (options.duplex ? fetch(url, options) : net.fetch(url, options)); if (response.status >= 400) log.write(`Host request ${options.method} ${new URL(url).pathname}: ${response.status}\n`); return response; })); diff --git a/apps/desktop/tests/host.test.mjs b/apps/desktop/tests/host.test.mjs index 27b56c8f8..9e9590700 100644 --- a/apps/desktop/tests/host.test.mjs +++ b/apps/desktop/tests/host.test.mjs @@ -81,3 +81,38 @@ test('Concurrent command installs preserve the winning launcher', async () => { } } finally { await rm(directory, { recursive: true, force: true }); } }); + +test('Proxy can forward the first upload chunk before the producer finishes', async () => { + let producer; + const body = new ReadableStream({ start(controller) { producer = controller; } }); + const cancellation = new AbortController(); + const request = new Request('opendirector://app/api/creation/projects/project/uploads/handle', { + method: 'PUT', body, duplex: 'half', signal: cancellation.signal, + headers: { 'x-asset-name': 'video.mp4' }, + }); + producer.enqueue(Uint8Array.of(1, 2, 3)); + + let firstChunk; + const forwarded = proxyRequest(request, { url: 'http://127.0.0.1:12345', token: 'private' }, + async (_url, options) => { + assert.equal(options.method, 'PUT'); + assert.equal(options.duplex, 'half'); + assert.equal(options.headers.get('x-asset-name'), 'video.mp4'); + const reader = options.body.getReader(); + firstChunk = await reader.read(); + assert.equal(options.signal.aborted, false); + await new Promise(resolve => options.signal.addEventListener('abort', resolve, { once: true })); + await reader.cancel(); + return new Response(null, { status: 204 }); + }); + + try { + // Allow both the proxy and stream reader to advance without closing the source. + await new Promise(resolve => setImmediate(resolve)); + assert.deepEqual(firstChunk, { value: Uint8Array.of(1, 2, 3), done: false }); + } finally { + producer.close(); + cancellation.abort(); + await forwarded; + } +}); diff --git a/docs/development/desktop.md b/docs/development/desktop.md index b3c37f805..263597304 100644 --- a/docs/development/desktop.md +++ b/docs/development/desktop.md @@ -18,7 +18,7 @@ node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector The runtime preparation builds the Python wheel using the existing build backend, including Web assets, skills and the actual OpenCode executable. It installs the wheel and dependencies into a private standalone Python distribution, validates CLI help and both media binaries, and records the target in `runtime/manifest.json`. It never modifies system Python. Supply media binaries with their redistribution licenses for the target; system package-manager binaries with external shared-library dependencies are not portable. -The smoke check launches the actual packaged executable with isolated temporary data, opens the canvas, checks authenticated health and project queries, verifies renderer isolation and both locales, hides the window without stopping the Host, and reopens the same project after quitting. It makes no provider calls. It does not establish Agent-assisted creation, export quality, signing, or support on an untested platform. +The smoke check launches the actual packaged executable with isolated temporary data, opens the canvas, drops local MP4, PNG, and WAV files and verifies their assets and nodes persist across launches, checks authenticated health and project queries, verifies renderer isolation and both locales, hides the window without stopping the Host, and reopens the same project after quitting. It makes no provider calls. It does not establish Agent-assisted creation, export quality, signing, or support on an untested platform. ## Terminal command diff --git a/docs/development/desktop.zh-CN.md b/docs/development/desktop.zh-CN.md index 291b453f0..e4efab4ac 100644 --- a/docs/development/desktop.zh-CN.md +++ b/docs/development/desktop.zh-CN.md @@ -18,7 +18,7 @@ node apps/desktop/scripts/smoke.mjs /absolute/path/to/packaged/OpenDirector 运行时准备复用现有构建后端生成 Python wheel,包含前端、技能和实际 OpenCode 可执行文件;将 wheel 和依赖安装到私有独立 Python,验证 CLI 帮助及两个媒体程序,并将平台写入 `runtime/manifest.json`。不会修改系统 Python。提供对应平台可分发的媒体程序及许可证;依赖包管理器外部动态库的系统二进制不能直接作为便携运行时。 -冒烟检查使用临时数据目录启动实际打包程序,进入画布,检查鉴权健康接口和工程查询,验证渲染隔离及中英文切换,隐藏窗口并确认 Host 保留,退出后重开同一工程,不调用模型服务。该检查不代表已完成 Agent 辅助创作、导出质量、签名或未测试平台的验收。 +冒烟检查使用临时数据目录启动实际打包程序,进入画布,拖入本地 MP4、PNG 和 WAV 文件并确认重启后素材和节点仍在,检查鉴权健康接口和工程查询,验证渲染隔离及中英文切换,隐藏窗口并确认 Host 保留,退出后重开同一工程,不调用模型服务。该检查不代表已完成 Agent 辅助创作、导出质量、签名或未测试平台的验收。 ## 终端命令 diff --git a/src/backend/creationClient.ts b/src/backend/creationClient.ts index f2985dcea..56e05c494 100644 --- a/src/backend/creationClient.ts +++ b/src/backend/creationClient.ts @@ -464,10 +464,12 @@ export class CreationClient { kind: Asset["kind"], handle: string = crypto.randomUUID(), importedFrom?: "generated" | "edited", + signal?: AbortSignal, ) { - const response = await fetch( - `/api${creationPath(this.id)}/uploads/${handle}`, - { + signal?.throwIfAborted(); + const path = `${creationPath(this.id)}/uploads/${handle}`; + try { + const response = await fetch(`/api${path}`, { method: "PUT", headers: { ...headers, @@ -475,9 +477,17 @@ export class CreationClient { "X-Asset-Kind": kind, }, body: blob, - }, - ); - if (!response.ok) throw await responseError(response); + signal, + }); + if (!response.ok) throw await responseError(response); + signal?.throwIfAborted(); + } catch (error) { + if (signal?.aborted) { + // A cancelled client may race a completed staging write. + await storageRequest(path, { method: "DELETE" }).catch(() => undefined); + } + throw error; + } return this.registerUpload(handle, name, kind, importedFrom); } /** Copies another project's asset on the server; no bytes pass through the page. */ diff --git a/src/backend/tools.ts b/src/backend/tools.ts index f5770a1de..6ae2cb5b7 100644 --- a/src/backend/tools.ts +++ b/src/backend/tools.ts @@ -7,6 +7,7 @@ import type { ToolField, ToolParameters, } from "../canvas/toolCatalog.ts"; +import { dataUrlToBlob } from "../canvas/downloadAssets.ts"; import { CANVAS_TOOLS } from "../canvas/toolCatalog.ts"; import { ApiError, errorMessage, json, request } from "./api.ts"; import { creationClient } from "./creationClient.ts"; @@ -243,6 +244,9 @@ export async function uploadAsset( : blob.type.startsWith("audio/") ? "audio" : "image", + undefined, + undefined, + signal, ) ).assetId ); @@ -296,7 +300,7 @@ export async function submitToolTask(value: ToolRequest, signal: AbortSignal) { : value.maskDataUrl ? await uploadAsset( projectId, - await (await fetch(value.maskDataUrl, { signal })).blob(), + dataUrlToBlob(value.maskDataUrl), tNow("errors.tools.selectionAsset"), signal, ) @@ -304,7 +308,7 @@ export async function submitToolTask(value: ToolRequest, signal: AbortSignal) { const annotationAssetId = value.annotatedDataUrl ? await uploadAsset( projectId, - await (await fetch(value.annotatedDataUrl, { signal })).blob(), + dataUrlToBlob(value.annotatedDataUrl), tNow("errors.tools.annotationAsset"), signal, ) diff --git a/tests/browser/tool_drafts.mjs b/tests/browser/tool_drafts.mjs index f2239bfab..b1f05d973 100644 --- a/tests/browser/tool_drafts.mjs +++ b/tests/browser/tool_drafts.mjs @@ -279,6 +279,13 @@ try { .locator(".iae-segment") .getByRole("button", { name: "标记", exact: true }) .click(); + const annotation = page.locator("canvas.iae-ink"); + await annotation.waitFor(); + const mark = await annotation.boundingBox(); + await page.mouse.move(mark.x + mark.width * 0.35, mark.y + mark.height * 0.45); + await page.mouse.down(); + await page.mouse.move(mark.x + mark.width * 0.55, mark.y + mark.height * 0.55, { steps: 6 }); + await page.mouse.up(); await page.locator(".iae-generate").click(); await until(async () => lookupLost, Boolean, "lost task lookup"); await page.reload(); @@ -290,6 +297,19 @@ try { rows.length === 2 && rows.every((row) => row.status === "succeeded"), "accepted original attempt", ); + const annotationId = sent[0].annotationAssetId; + assert.ok(annotationId, "painted annotation was uploaded before submission"); + const annotationAsset = (await state()).assets.find((asset) => asset.id === annotationId); + assert.equal(annotationAsset?.metadata.mimeType, "image/png"); + const annotationResponse = await fetch( + `${api}/api/creation/projects/${projectId}/assets/${annotationId}/content`, + { headers: { "X-OpenDirector-Request": "1" } }, + ); + assert.ok(annotationResponse.ok); + const bytes = await annotationResponse.arrayBuffer(); + assert.equal(bytes.byteLength, annotationAsset.metadata.size); + const digest = Buffer.from(await crypto.subtle.digest("SHA-256", bytes)).toString("hex"); + assert.equal(annotationAsset.fingerprint, `sha256:${digest}`); assert.equal(sent[0].maskAssetId, continuedMaskId); await open(output.canvasItemId); await prompt().fill("New edits must not replace the unknown request"); @@ -314,7 +334,7 @@ try { await page.unroute(path); assert.deepEqual(errors, []); console.log( - "PASS tool draft: real painted mask, saved parameters, reload, frozen input, source provenance, adopted output, independent continued editing and unknown submission replay after reload.", + "PASS tool draft: real painted mask and annotation upload, saved parameters, reload, frozen input, source provenance, adopted output, independent continued editing and unknown submission replay after reload.", ); } finally { await browser.close(); diff --git a/tests/creationClient.test.ts b/tests/creationClient.test.ts index bf764cec4..1d8dda12c 100644 --- a/tests/creationClient.test.ts +++ b/tests/creationClient.test.ts @@ -1492,3 +1492,34 @@ test("a no-op save skips command batches and unchanged view writes", async () => globalThis.fetch = original; } }); + +test("cancelling a staged Blob upload deletes the handle before registering an asset", async () => { + const snapshot = empty(); + const client = new CreationClient(snapshot.project.id); + client.install(snapshot); + const signal = new AbortController(); + const handle = crypto.randomUUID(); + const path = `/api/creation/projects/${snapshot.project.id}/uploads/${handle}`; + const calls: [string, string][] = []; + const fetch = globalThis.fetch; + globalThis.fetch = async (url, options) => { + const method = options?.method ?? "GET"; + calls.push([String(url), method]); + if (method === "PUT") { + assert.equal(options?.signal, signal.signal); + signal.abort(); + } else { + assert.equal(options?.signal?.aborted ?? false, false); + } + return Response.json({}); + }; + try { + await assert.rejects( + client.importBlob(new Blob(["image"]), "image.png", "image", handle, undefined, signal.signal), + { name: "AbortError" }, + ); + assert.deepEqual(calls, [[path, "PUT"], [path, "DELETE"]]); + } finally { + globalThis.fetch = fetch; + } +}); From 92e24cb4c6b16da88f29caa9b7e15f748e6cdffb Mon Sep 17 00:00:00 2001 From: Weiming Liao Date: Thu, 19 Nov 2026 20:56:49 +0800 Subject: [PATCH 31/31] [test] Focus desktop window before checking sidebar search Signed-off-by: Weiming Liao --- apps/desktop/scripts/smoke-window.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index d8fb7399d..2b5f9fb77 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -69,6 +69,13 @@ export async function smokeWindow({ window, host, getLocale }) { await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.cw-save-status i.saved')"), 'New project did not finish saving'); } await waitFor(() => window.webContents.executeJavaScript("!!document.querySelector('.od-project-sidebar nav button')"), 'Sidebar projects did not load'); + // Opening a trace window can leave the native focus on its closing child. + // Finish the project rename and focus the main window before testing keyboard focus. + await waitFor(() => window.webContents.executeJavaScript("!document.querySelector('.cw-project-name-editor input')"), 'Project rename did not finish'); + if (process.platform === 'darwin') app.focus({ steal: true }); + window.focus(); + window.webContents.focus(); + await waitFor(() => window.isFocused(), 'Desktop window could not take focus before search'); await window.webContents.executeJavaScript("document.querySelector('.od-sidebar-search-toggle').click()"); await waitFor(() => window.webContents.executeJavaScript("document.activeElement === document.querySelector('.od-sidebar-search')"), 'Project search did not take focus'); const firstProject = await window.webContents.executeJavaScript("document.querySelector('.od-project-sidebar nav button span').textContent");