diff --git a/.codex-plugin/onboarding/SKILL.md b/.codex-plugin/onboarding/SKILL.md
index 7760e193e..7dd8a3e79 100644
--- a/.codex-plugin/onboarding/SKILL.md
+++ b/.codex-plugin/onboarding/SKILL.md
@@ -7,6 +7,14 @@ description: Welcome the user after OpenMotion plugin setup and open its templat
Read [the installation-success contract](../../docs/install.md#installation-success-reply) and follow it in this conversation. Reuse the installed connection and data directory; setup is already complete, so do not reinstall.
+For an automatic installation callback, read its exact event file, verify that its thread matches this chat, and use `event.onboarding` directly. Preserve `event.appRoot` and `event.dataDirectory`. Never rerun setup or schedule another callback. The queue acknowledgment is not a displayed welcome; this turn must perform and verify the actual presentation below.
+
+Use the installation's existing onboarding result when setup returned one. When the desktop plugin callback has no result yet, run the installed application's `node --experimental-strip-types scripts/install-onboarding.mjs` from its plugin root, preserving the connection's `MOTION_DATA_DIR` and setting `OPENMOTION_ONBOARDING_LANGUAGE` from the latest request. This invokes the same default flow as source and CLI setup, without reinstalling, requiring user flags or creating a project. Resolve the workspace from the installed connection; never substitute another workspace.
+
+If this host has an inline HTML renderer, the default flow returns `inlinePresentation` (under `onboarding` for npm setup). The runtime document is not automatically readable by the chat. First run the installed `scripts/inline-onboarding.mjs --publish-from PATH --sha256 SHA256 --host-directory DIRECTORY` using its prepared path/hash and this chat's explicitly permitted visualization directory. Never infer that directory from application/data write access or guess another chat's root. If no host-readable directory is available, report that limitation instead of emitting a runtime path. Visibly open the real template-library preview, then emit the publisher's exact content reference once. This preserves the installed production welcome and three verified videos without waiting for native MCP discovery. Recreate retains the copyable brief; never submit it automatically. Preserve `directAccess` and its environment when supplied. Do not require a restart or repeat setup. Preparation/publication and `awaiting_host_delivery` are not proof of displayed content.
+
For CLI setup, resolve the contract's `hostHandoff` before native presentation. A registration result, queued refresh or independent MCP probe is insufficient. Keep a requested complete onboarding pending when this chat cannot discover the presentation tool; report the actual host-action requirement instead of silently declaring the library-only fallback complete.
+Source setup returns a concise `onboardingStatus` and `detailsFile` rather than printing the full success examples. Read the details only when needed. `host_action_required` and `refresh_requested` forbid a library-only success reply in Codex. If this host has the inline renderer, generate the presentation from the existing application as described in the contract and complete that route without a restart. If neither route is available, present the prepared library while reporting the specific presentation limitation; do not reinstall or create another chat. Resume in this workspace after supported host recovery.
+
Open the template library in the calling chat's right panel using the returned preview handoff, then call the natively discovered presentation tool with `onboarding: true` and `language` matching the latest user request (or their explicit requested output language), never the host interface language. Use `zh`, `en`, `ja`, `ko`, `fr`, `es` or `pt`; use `en` for unsupported languages. The component displays the persistent welcome and three cards; send no separate welcome, duplicated template descriptions or trailing status reply. Verify the actual opening result and use the matching welcome example from the contract. Keep project creation and export pending until the user submits a creation request.
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 3a0d2d2a8..53e54d8fb 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -2,7 +2,7 @@
"name": "openmotion",
"version": "0.0.1",
"description": "Plan, create, animate, edit, preview, and export motion graphics and motion videos in OpenMotion, including original videos on a user-supplied topic, template-based creation and reference video recreation. 使用 OpenMotion 构思和制作视频、动效视频、动画、赛事回顾、科普讲解和参考视频复刻。",
- "skills": "./skills/",
+ "skills": ["./skills/", "./.codex-plugin/onboarding/"],
"mcpServers": "./.mcp.json",
"requires_local_executor": true,
"extensions": {
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 53462356f..bf685077b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -274,7 +274,7 @@ jobs:
node --experimental-strip-types --test tests/tracking.test.ts tests/tracking-device.test.ts tests/studio-tracking.test.ts tests/mcp-tracking-host.test.ts
- name: Validate standalone installation and packaging
if: steps.scope.outputs.full == 'true'
- run: node --experimental-strip-types --test tests/mcp-template-recommendations.test.ts tests/template-cards-ui.test.ts tests/diagnostics.test.ts tests/install.test.ts tests/npm-installer.test.ts tests/native-runtime.test.ts tests/npm-package.test.ts tests/test-package.test.ts tests/source-install.test.ts tests/bootstrap.test.ts tests/byok.test.ts tests/provider-settings.test.ts tests/local-agents.test.ts tests/mcp-registry.test.ts tests/public-names.test.ts tests/mcp-runtime.test.ts tests/mcp-upgrade.test.ts tests/preview.test.ts tests/editor-urls.test.ts tests/workspace-studio.test.ts tests/sync.test.ts tests/phase1.test.ts tests/webmcp.test.ts tests/preview-handoff.test.ts tests/adapters.test.ts tests/package.test.ts tests/library-install.test.mjs tests/recreate-measure.test.ts tests/workflow.test.ts tests/catalog.test.ts tests/prism-templates.test.ts tests/inline-video.test.ts tests/extension-boundary.test.ts tests/connections.test.ts tests/install-guide.test.ts tests/readme-resources.test.ts tests/motion-design-remix.test.ts tests/motion-package.test.ts
+ run: node --experimental-strip-types --test tests/mcp-template-recommendations.test.ts tests/template-cards-ui.test.ts tests/diagnostics.test.ts tests/install.test.ts tests/npm-installer.test.ts tests/native-runtime.test.ts tests/npm-package.test.ts tests/test-package.test.ts tests/source-install.test.ts tests/bootstrap.test.ts tests/bundled-npm-runtime.test.ts tests/inline-onboarding.test.ts tests/npm-distribution-selection.test.ts tests/onboarding-callback.test.ts tests/onboarding-workspace.test.ts tests/prebuilt-bootstrap.test.ts tests/source-marketplace.test.ts tests/byok.test.ts tests/provider-settings.test.ts tests/local-agents.test.ts tests/mcp-registry.test.ts tests/public-names.test.ts tests/mcp-runtime.test.ts tests/mcp-upgrade.test.ts tests/preview.test.ts tests/editor-urls.test.ts tests/workspace-studio.test.ts tests/sync.test.ts tests/phase1.test.ts tests/webmcp.test.ts tests/preview-handoff.test.ts tests/adapters.test.ts tests/package.test.ts tests/library-install.test.mjs tests/recreate-measure.test.ts tests/workflow.test.ts tests/catalog.test.ts tests/prism-templates.test.ts tests/inline-video.test.ts tests/extension-boundary.test.ts tests/connections.test.ts tests/install-guide.test.ts tests/readme-resources.test.ts tests/motion-design-remix.test.ts tests/motion-package.test.ts
- name: Repository template runtime regression
if: steps.scope.outputs.full == 'true'
run: node --test tests/repository-template-runtime.test.ts
diff --git a/docs/install.md b/docs/install.md
index ffafb4556..6c866cc62 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -19,7 +19,19 @@ For npm network failures, automatically try `https://registry.npmjs.org` then `h
Every successful Agent-led OpenMotion installation opens the editor's template library in the current conversation. Do not ask whether to experience a recommended template or wait for a yes/no reply before opening the library. Respect an explicit request not to open it, or a previous refusal/deferment. If the user already explicitly requested creation with an exact template, continue that authorized task directly.
-Codex plugin setup reaches this same contract through the packaged `extensions.com.openai.onboardingSkill` entry. Reuse the installed connection; onboarding does not run setup again.
+For Codex, the requested onboarding outcome is the persistent welcome, all three native template cards and the visibly opened library. `host_action_required` and `refresh_requested` take precedence over every library-only fallback below: those states are incomplete, even if CLI setup exits zero and the library works. Report installed files separately from incomplete onboarding, give the exact host action and resume the same installation after recovery. Do not end with the library-only success welcome merely because native tools have not loaded.
+
+### Codex inline document presentation without host hot reload
+
+Agent-led source and npm installation schedule a follow-up through the public `codex queue` command when a calling thread is available and the library/cards are ready. The event records the exact application, workspace and prepared presentation; repeated setup of the same version and language in that chat reuses the existing queue intent. `callback_queued` is not delivery confirmation. End the installation turn promptly so the queued onboarding turn can run; do not duplicate its welcome or manually present another copy. The callback reads the packaged onboarding Skill and delivers the recorded result without reinstalling. This uses no `--resume`, new daemon, restart or listener/security change. A CLI without a calling chat cannot use this path. Plain `codex plugin add` still depends on its host invoking the plugin's setup callback; queue delivery from source/npm does not prove that separate entry works.
+
+Source setup, npm setup and the desktop plugin setup Skill use the same default `prepareInstallationFlow`. Codex setup prepares a verified welcome/cards fragment under the selected data directory's `onboarding/` folder without user presentation flags. `--onboarding-output` is an optional npm path override for hosts that need a particular readable artifact directory. The plugin Skill invokes `node --experimental-strip-types scripts/install-onboarding.mjs` from the installed root only when no setup result was provided; it preserves the connection's workspace and never reinstalls. Use this fragment only when the actual host supports inline HTML references; preparing a file does not add that capability or trigger a host callback. It does not reload, restart or alter host security settings.
+
+Setup returns `onboarding.inlinePresentation` with the prepared path/hash and `publicationRequired: true`, not a visualization reference to its runtime/data path. The active host publishes it with `node scripts/inline-onboarding.mjs --publish-from PATH --sha256 SHA256 --host-directory DIRECTORY`, selecting this chat's explicitly permitted visualization directory. The publisher verifies the hash and copies identical bytes without overwriting another document. Filesystem write permission alone does not prove that the chat can read a path. Open and verify the real library on the right, then emit the publisher's content reference once. The component and full videos remain unchanged; preserve the native route when already loaded and never present both. Neither preparation, publication nor a printed reference proves actual rendering.
+
+The inline document context has no negotiated composer extension, so Recreate uses the production component's existing selectable brief fallback. It does not send a task. The user copies/edits and submits the brief before creation. Continue operations through this installation's `directAccess`, including its selected profile environment when supplied. Do not require a host restart or reconnect to use this mode. The native pending-state rules below continue to apply when neither a working native tool nor an actual inline renderer is available.
+
+Codex plugin setup reaches this same contract through the packaged `extensions.com.openai.onboardingSkill` entry. Its directory must also appear in the plugin's `skills` roots: a shipped file and an extension declaration alone return `onboardingSkill: null` from Codex's `plugin/read`. The additional setup root stays outside the five production Skill folders. Reuse the installed connection; onboarding does not run setup again. The desktop controls whether it offers or starts setup; Skill discovery alone does not prove automatic presentation after the Install button.
### CLI installation: attach the calling chat before presentation
diff --git a/docs/npm-installation.md b/docs/npm-installation.md
index 9e397df50..0508e3a1b 100644
--- a/docs/npm-installation.md
+++ b/docs/npm-installation.md
@@ -1,9 +1,13 @@
# Motion application npm package
+For a download-once cold installation, build on the target machine with `node --experimental-strip-types scripts/package-npm.mjs OUTPUT_DIR --bundle-runtime`. This option installs locked production npm dependencies at build time and embeds them in an XZ application archive, omitting `.map` debug sidecars while retaining application sources, executable modules, declarations and licenses. The manifest pins OS/CPU and dependency lock SHA256. Setup rejects another target before changing installation state, verifies the embedded marker, lock and direct package versions, then skips dependency downloads. Select the exact reviewed artifact for the machine; this is not a universal package. Lightweight builds retain target-machine npm installation. Frontend libraries compiled into Studio are development dependencies; editing/export dependencies remain production dependencies. No browser/media binaries are added, and packaging does not publish anything.
+
The npm tgz contains the installer, a prebuilt Motion application archive and its pinned release manifest. One `setup` installs the application, eleven public MCP Tools and five Skills for the selected host. No adjacent application archive or `--manifest` is needed. The application runs from a managed, writable directory, never from the npx cache; projects remain outside application/cache directories.
After successful host registration, setup starts/reuses the headless local service and returns `onboarding.preview` with a project-free template-library URL and host presentation handoff. The Agent opens that page immediately, using `openmotion_open_preview({target:"templates"})` when loaded or the returned URL before current-chat MCP discovery. Setup itself does not launch an OS browser. Preparing or browsing the library never initializes/selects a native project; Open and edit creates a copy only after user selection. A page-start failure is reported as `onboarding.preview.status=unavailable` without rolling back a successful installation or creating a fallback project. Browser-less hosts receive the actual link. Published packages keep the behavior embedded in their own source version.
+Codex setup now prepares the production welcome/cards document by default through the same flow as source setup and the desktop plugin setup Skill. No presentation flag is required. `--onboarding-output /absolute/chat-readable/openmotion-onboarding.html` remains an optional path override. The selected workspace contains the default document under `onboarding/`; the active host must publish the verified document into its explicitly permitted chat visualization directory, then deliver the published content reference and real template-library handoff. Preparation alone is not automatic visible delivery, and CLI registration does not run the desktop plugin callback. The renderer checks approved MP4s and source fingerprints, requires no development dependencies, and preserves the copyable-brief fallback. See the [shared presentation contract](install.md#codex-inline-document-presentation-without-host-hot-reload).
+
`@openmotion/app@0.6.4-test.6` is available from npm through the `test` channel. It was published separately after authorization; ordinary CI still does not publish packages. Its anonymous registry download, isolated macOS Codex setup, repeat setup, eleven MCP Tools and five Skills have been verified. Use the exact version for reproduction. See the [delivery record and known limitations](release-guide.md#published-test-candidate-064-test6), including the production template catalog and the registry's unexpected `latest` tag.
Source `package.json` is the development baseline; the published artifact can have a different version. For example, source `0.6.3` can produce `0.6.4-test.6` without a stable `0.6.4` release. Packaging changes output identities only. Manual [candidate builds](release-workflows.md#1-build) accept an empty version and automatically generate the next patch plus a short `test.N` workflow counter (with an attempt suffix on reruns); publication keeps the exact accepted version.
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index 8f56da655..9fbe08c6c 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -138,7 +138,7 @@ Agents reconstruct external references after analyzing their video or source; a
## 核心用户流程
1. The user creates a blank project or opens an existing one from the sidebar, asks an external Agent to create a project, or chooses a template in the editor. Bundled templates create independent project copies; external references require Agent reconstruction.
-2. Successful Agent-led installation opens the editor template library in the current conversation without creating a project. Codex plugin setup invokes a packaged onboarding Skill through `extensions.com.openai.onboardingSkill`; that entry reads the same installation-success contract as npm/source setup, opens the calling chat’s right panel and uses the welcome copy matching the observed library/cards. The onboarding entry lives outside the five production Skills and does not change their discovery or routing. `openmotion_open_preview({target:"templates"})` returns a project-free page handoff; when the current chat has not loaded MCP, setup's `onboarding.preview` provides the same page URL and handoff after preparing the headless local service. The host presents and observes the library, or provides the actual link when browser/panel capability is unavailable. The library prepares the current saved project's scoped editor behind its modal; closing the library removes the templates query in place and reveals the same editor without document navigation or remounting. The legacy first-run placeholder defers native initialization until dismissal, so browsing alone still does not create a project. Preparation does not switch the workspace's active project or download template project source. Only the user's Open and edit action or explicit Agent creation request selects an exact template and creates an independent copy; Agent continuation reuses a GUI-created project. Preview startup failure does not undo successful registration or create fallback work. Registration and a prepared/queued URL do not prove active-chat loading or visible presentation. No invitation telemetry/state service is introduced. See [installation replies](../install.md#installation-success-reply) and [first-run defaults](../../skills/openmotion-production/references/templates.md#first-run-experience-defaults). When native discovery is missing or stale, setup returns direct installed MCP commands that let the same chat continue without a new chat or restart. The client reads the selected host configuration and enforces ownership, enabled/tool policy, version and workspace before public calls; it preserves request deduplication and revision/version guards and does not claim to reload native discovery. User recovery instructions appear only when permitted access paths fail.
+2. Successful Agent-led installation opens the editor template library in the current conversation without creating a project. Codex plugin setup invokes a packaged onboarding Skill through `extensions.com.openai.onboardingSkill`; that entry reads the same installation-success contract as npm/source setup, opens the calling chat’s right panel and uses the welcome copy matching the observed library/cards. The onboarding entry lives outside the five production Skill folders and is separately included in the Codex manifest’s Skill roots; otherwise the host resolves its onboarding metadata to null even though the document ships. The five production routes stay unchanged. The desktop’s setup offer/start is a separate host action; registered onboarding metadata is not proof of automatic display after Install. `openmotion_open_preview({target:"templates"})` returns a project-free page handoff; when the current chat has not loaded MCP, setup's `onboarding.preview` provides the same page URL and handoff after preparing the headless local service. The host presents and observes the library, or provides the actual link when browser/panel capability is unavailable. The library prepares the current saved project's scoped editor behind its modal; closing the library removes the templates query in place and reveals the same editor without document navigation or remounting. The legacy first-run placeholder defers native initialization until dismissal, so browsing alone still does not create a project. Preparation does not switch the workspace's active project or download template project source. Only the user's Open and edit action or explicit Agent creation request selects an exact template and creates an independent copy; Agent continuation reuses a GUI-created project. Preview startup failure does not undo successful registration or create fallback work. Registration and a prepared/queued URL do not prove active-chat loading or visible presentation. No invitation telemetry/state service is introduced. See [installation replies](../install.md#installation-success-reply) and [first-run defaults](../../skills/openmotion-production/references/templates.md#first-run-experience-defaults). When native discovery is missing or stale, setup returns direct installed MCP commands that let the same chat continue without a new chat or restart. The client reads the selected host configuration and enforces ownership, enabled/tool policy, version and workspace before public calls; it preserves request deduplication and revision/version guards and does not claim to reload native discovery. User recovery instructions appear only when permitted access paths fail.
For catalog discovery requests (browse, compare or recommend), the template route prepares `openmotion_open_preview({target: "templates"})` and follows its page handoff in the same turn, respecting explicit text-only/no-opening preferences. The host must verify the visible library; prepared/queued URLs are not display success. Browsing preserves project content and selection and does not authorize template-source downloads, creation or export. Candidate recommendations use the current connection's catalog. Only a request to use a selected template enters creation. See the shared [browsing policy](../../skills/openmotion-production/references/templates.md#browsing-and-recommendations).
Native MCP Apps connections can additionally present three approved builtin template previews with the optional read-only `openmotion_show_template_recommendations` adapter extension. It is available only after explicit per-connection MIME negotiation and local resource verification; the domain API and non-UI discovery remain exactly twelve tools. Cards use bundled complete MP4s, muted looping playback and an immutable content-hashed resource with a Blob-only media policy, without a shared-backend call, template download or render. Cards remain in a compact three-column layout. The Agent passes the latest user request’s language (or explicit output-language preference) as `language`; a single seven-language dictionary covers the welcome, descriptions, controls and unsent brief, overriding host locale while preserving canonical template identities and media. An explicit `onboarding: true` presentation mode includes the persistent welcome above the cards; ordinary calls omit the flag. This keeps onboarding content outside host-collapsed Agent progress messages. The component omits duplicated template descriptions and the Agent adds no trailing verification/status paragraph after a successful onboarding presentation. The Recreate template action appends the exact template title/ID and an editable brief to the active composer using the negotiated OpenAI message extension with send=false. It does not submit a task; unsupported hosts show a copyable prompt. Only the user-sent brief enters the existing template Skill and request-deduplicated creation/export path, honoring user requirements and attachments instead of legacy frozen sample defaults. Presentation never creates/selects a project, and redisplaying cards never authorizes a duplicate copy. When the current chat has not natively discovered the extension, the library and text path above remains usable; CLI direct access cannot substitute for native UI mounting. Host menus and display timing are outside the component's control.
@@ -332,10 +332,24 @@ The following product measures still require agreed observation windows and vali
Codex CLI installation has an explicit post-registration host handoff. An existing app-server control connection is checked for the calling chat before requesting the supported MCP configuration reload; native tool discovery and a workspace read use that same chat. A queued refresh, missing control endpoint, unrelated daemon, policy rejection or workspace mismatch leaves onboarding pending with a concrete host action. The installer never starts a separate app-server as evidence of current-chat loading. Native welcome/card presentation remains a host action with a separate visible acceptance result. The source-plugin and npm adapters share this boundary; other hosts keep their existing installation behavior.
+For a calling Codex host that already supports inline HTML documents, npm setup also accepts an explicit chat-readable `--onboarding-output` path. This mounts the existing verified production welcome and card component through that renderer, paired with the real template-library handoff. No host restart, new MCP discovery or additional project is required; domain operations use the registered CLI transport until native tools are available. Without a negotiated composer bridge, cards expose their existing copyable brief and do not submit a task. Native and inline presentation are alternative host adapters, with preparation, actual visibility and playback kept distinct. Lightweight npm packaging selects its positive file list before requiring optional showcase media; full bundles still require their complete media list.
+
+Source installation is a single measured bootstrap: command-local LFS filters preserve optional pointers even with a broken global LFS setup; a read-only source check runs before dependency work. A verified uninstalled local OpenMotion marketplace can be rebound transactionally, while active and foreign sources are preserved. Local phase timings and full onboarding details are saved under `.artifacts/install/`; terminal output leads with installed/pending status and the exact handoff. Codex pending states never authorize the library-only success welcome. Source download remains network-bound; the 120-second target is not an unconditional cold-install guarantee or native onboarding acceptance.
+
Native template recommendation assets are required core presentation files on the same positive distribution list: the manifest, browser bundle/CSS, three complete MP4s, posters and notices. The browser App SDK is an exact build dependency; the installed runtime serves prebuilt bytes and keeps existing production/native dependency identities. Asset/source fingerprints are verified without Git. Source packaging also verifies a stable build identity over browser TypeScript/CSS/types/configuration, the build script, the exact SDK/Vite identities and generated JS/CSS hashes; direct package calls reject stale or missing output before producing artifacts. Installed MCP reads prebuilt resources and does not require those development source files or import Vite. The final resource response has a 1.5 MiB build budget. Missing UI assets during source development disable only optional presentation; distributable packages require the complete validated asset set. Release metadata lists the UI extension separately from the twelve domain tools. `OPENMOTION_TEMPLATE_CARDS=0` disables it for new connections without restarting the authority, changing user data or stopping active exports. Existing mounted cards and old connections retain their immutable bytes. Native discovery, real playback and a usable display latency remain separate acceptance gates.
The `@openmotion/app` npm tgz contains installer scripts, the prebuilt application archive and its pinned default manifest. Setup needs only that tgz, stages the checked application into a managed writable directory, installs production npm dependencies from its lock and registers the selected host's MCP Tools and production Skills. The application server and projects never run in the npx cache. Node/Agent remain user-provided. After successful setup, a detached worker prepares pinned FFmpeg, ffprobe and browser assets concurrently. MCP and the local editor backend start without waiting for native downloads. Installers and running apps share platform/hash cache locks and atomic component status; Studio polls readiness and displays measured download bytes, percentage and a remaining-time estimate when transfer size and speed are available inside the Export panel. Retry stays available during preparation. Downloads use a five-minute inactivity timeout and retry transient failures up to three attempts before reporting the cause; completed components remain reusable. The header Export action opens that panel while dependencies are unavailable; readiness updates without reloading. Media import checks the media components before applying work; automated capture and export require the full local runtime because captured compositions may contain media. Selected Studio imports are retained in memory for explicit retry in the same project; preparation does not create or replay exports. Explicit prepare remains a blocking wait/retry, completed assets are reused across app versions sharing the cache, and interrupted transfers restart only the incomplete asset. Existing plugin and complete platform ZIP channels remain available.
+Agent-led source and npm installations can enqueue a single workspace-bound onboarding event through public `codex queue` after preparing the real library/cards. The event is deduplicated by calling thread, application/version, workspace and presentation language/resource. The callback reuses that result and the installed setup Skill; queue acknowledgment remains distinct from host display. No additional daemon or restart is used. CLI without a calling thread and plain plugin registration retain separate host-trigger requirements.
+
+When a missing source checkout prevents Codex plugin inventory reads, source preflight uses a bounded, short-lived stdio `config/read` process to inspect that profile's effective marketplace/plugin configuration. Only a missing local source with no configured plugins, including disabled entries, can be rebound. Unknown state, foreign sources and installed plugins remain protected. This read does not connect to the desktop host, refresh native discovery or establish onboarding delivery. Terminal summaries retain the pending reason and publication action even when inline content is already prepared; locale tags normalize to the supported presentation languages, with English as the fallback.
+
+Prepared inline onboarding is a runtime artifact, not an authorized host content reference. The active host publishes its verified bytes into its explicitly permitted chat visualization directory before emitting a reference. The publisher preserves the component/media and rejects changed hashes or conflicting files. This separates runtime write permission from chat read permission and avoids invalid visualization read requests.
+
+Source and npm setup share `prepareInstallationFlow`; the desktop plugin setup Skill invokes the same installed entry when no result is available. Codex preparation generates its verified welcome/cards fragment in the selected workspace without user presentation flags, alongside the real library handoff. Its state remains `awaiting_host_delivery` until a capable host actually presents it. This does not make standalone CLI installation run the desktop callback, or add a display API to a host without one.
+
+Optional `--bundle-runtime` npm builds include the locked production dependencies in an XZ application archive for the build machine OS/CPU. Setup checks the target before changes and validates the embedded lock/marker and direct package versions before skipping npm downloads. The application hash covers these dependencies; lightweight universal builds retain the existing installation path. This mode includes no browser/media runtime and changes no publication workflow. Studio-only libraries are build dependencies rather than target-machine runtime downloads.
+
Explicit test/DEV and stable/prod builds produce publishable artifact metadata with candidate/stage defaults; source manifests, unversioned builds and channel/environment mismatches stay private. New public test versions use DEV template routing; catalog access still depends on service network/authentication. No private catalog payloads or credentials are bundled. Existing versions retain their original defaults. Packaging does not publish, update users, move main or rename the repository. DEV packages embed their template source, default to a separate installation home and refuse cross-environment reuse. Application, project data, host configuration and dependency cache retain distinct ownership. See [installation](../npm-installation.md) and [test/stable acceptance](../release-guide.md).
Mac arm64 installation and complete-bundle startup impose no additional macOS version floor. Platform/CPU matching and native executable checks still apply; the target machine must run its Node.js and pinned browser/media tools. Build/test OS versions are evidence for those runs, not installation minimums or acceptance of every older macOS version. Windows x64 retains its Windows 11 requirement.
diff --git a/install.md b/install.md
index 37ad33957..65547d94a 100644
--- a/install.md
+++ b/install.md
@@ -1,20 +1,49 @@
-# Install OpenMotion from source
+# Install OpenMotion
-For the local agent reading this guide: install and connect the public repository's `main` branch on this machine, then open its local template library. Use the same checkout for Studio and MCP.
+For the local agent reading this guide: ordinary product installation uses a reviewed prebuilt package; source checkout is an explicit development route. Open the real template library and the complete welcome/cards presentation in the calling chat. Studio and Agent operations must use the same installation and workspace.
-## Clone and start
+## Codex: prebuilt installation
+
+To avoid dependency downloads during setup, select an artifact with prebuilt npm dependencies matching this machine. Lightweight packages still download dependencies during setup. See [target-specific package builds](docs/npm-installation.md).
+
+Use the exact package specification and, for a candidate URL/file, SHA256 from its accepted installation guide or manifest. Do not guess an unpublished version or apply new installer flags to an older published package. This branch's local candidate is not a public release. A package containing `--onboarding-output` can use the current chat's existing inline renderer without MCP hot reload:
+
+```sh
+bash install.sh --package EXACT_PACKAGE_SPEC
+```
+
+`EXACT_PACKAGE_SPEC` is a pinned `@openmotion/app@VERSION`, a reviewed HTTPS candidate, or an absolute candidate `.tgz`; replace it from the actual artifact record. URL/file candidates additionally require `OPENMOTION_INSTALLER_SHA256` from that record. The remote entry verifies candidates before executing them. It downloads the prebuilt application rather than cloning or compiling the repository. Preserve a selected home/data/Skills root through the ordinary setup options; for acceptance use separate empty application, data, host configuration and npm cache directories.
+
+Set `OPENMOTION_ONBOARDING_LANGUAGE` from the latest user request. Supported presentation languages are `zh`, `en`, `ja`, `ko`, `fr`, `es` and `pt`; locale tags use their lowercase primary language, and other languages fall back to `en`. The result reports the effective language. Codex setup prepares the welcome/cards document by default. Use `--onboarding-output` only as an optional path override when this host needs a specific readable artifact directory. On success, publish the prepared path/hash into this chat's explicitly permitted visualization directory using the installed inline-onboarding script. Open and verify the actual library, then emit the publisher's content reference once; never emit an application/data path directly. The installed production component owns the welcome and three complete video cards; no separate welcome, placeholder project, host restart or tool hot reload is needed. Its Recreate button uses the existing copyable brief when the inline context has no composer bridge. Use `directAccess` and its environment for subsequent domain operations.
+
+## Source development: one installation command
+
+For an explicitly selected source installation in Codex, collect platform/Node/host facts once, then run the source installer below. It downloads one shallow snapshot, installs locked dependencies, builds Studio once, registers the plugin, probes MCP and prepares the library. Do not separately run `npm start`, reinstall dependencies or inspect unrelated repositories/installed applications. Read this checkout's `AGENTS.md` before repository changes.
+
+```sh
+curl -fsSL https://raw.githubusercontent.com/nexu-io/openmotion/main/install.sh -o /tmp/openmotion-source-install.sh
+bash /tmp/openmotion-source-install.sh
+```
+
+`OPENMOTION_INSTALL_DIR` selects a persistent empty destination. If the intended checkout already exists, verify its origin, version and local changes, then run its `bash scripts/install-motion.command` instead of cloning another copy. Never overwrite or update an unrelated checkout. The installer reuses a built Studio, checks source conflicts before dependency work, and can rebind a verified old `openmotion-local` source only when no plugin from it is installed. An active source is preserved and reported for an explicit upgrade decision.
+
+An unregistered marketplace normally returns empty `installed` and `available` arrays and can be added. If listing fails, source preflight can read the selected host's effective configuration through the public `config/read` protocol in a short-lived stdio process. It recovers only a missing local `openmotion-local` root with no configured plugins in that marketplace, including disabled entries. This process never connects to or reloads the desktop host. Installed/cached entries remain protected. `OPENMOTION_INVENTORY_UNAVAILABLE` or `OPENMOTION_INVENTORY_INVALID` stops before configuration changes and gives the exact retry command; restore the old source or update the CLI when safe recovery cannot be established. Read failures and malformed output are never silently treated as an empty inventory.
+
+Source download depends on network throughput and is measured separately; installation time is not guaranteed. The installer emits phase durations and saves local timings plus a concise onboarding result under `.artifacts/install/`; read that result once. Use bounded process waits instead of repeated status polls and guide/source reads. A prebuilt published application avoids source build/download work but is a separate, exact-version installation route; never silently substitute it for the requested main source.
+
+## Other hosts: clone and start
Use Git, npm and Node.js 26.11.1, the version pinned for source validation. Choose a persistent parent directory for the checkout and run:
```sh
-git clone --depth 1 --single-branch --branch main https://github.com/nexu-io/openmotion.git
+git -c filter.lfs.process= -c filter.lfs.smudge= -c filter.lfs.required=false clone --depth 1 --single-branch --branch main https://github.com/nexu-io/openmotion.git
cd openmotion
npm ci
npm run build:studio
npm start
```
-`--depth 1` downloads only the latest snapshot and `--single-branch --branch main` selects main. Optional reference videos and template archives stay excluded by default; download them only when needed. See [clone size and optional media](docs/repository-storage.md).
+`--depth 1` downloads only the latest snapshot and `--single-branch --branch main` selects main. Command-local LFS overrides keep optional reference videos and template archives as pointers, including on machines with stale global LFS configuration; no global Git setting changes. Download optional media only when needed. See [clone size and optional media](docs/repository-storage.md).
If the destination already exists, check its remote and local changes before reusing it, or choose another directory. Preserve existing work. Keep user projects and credentials outside the checkout, and preserve an existing `MOTION_DATA_DIR`. Studio and MCP must use the same data directory. Source preview and export use local Chrome/Chromium and FFmpeg/FFprobe; see [runtime setup](README.md#technical-guide) for requirements.
@@ -22,7 +51,7 @@ Use the actual `studioUrl` or `previewUrl` printed by startup. Keep this checkou
## Connect the current agent
-Read the checkout's `AGENTS.md`, then follow the existing [source plugin setup](README.md#agent-setup) for Codex or [manual MCP configuration](README.md#manual-mcp) for another local stdio client. The [agent connection guide](docs/agent-adapters.md) describes other host integrations. Connect this checkout's `mcp.ts` and the same data directory as Studio; configure only the current host and preserve unrelated MCP servers, Skills and credentials.
+The Codex command above already registers this checkout and returns the connection handoff; do not run a second setup from the README. For another local stdio client, use [manual MCP configuration](README.md#manual-mcp). The [agent connection guide](docs/agent-adapters.md) describes other host integrations. Connect this checkout's `mcp.ts` and the same data directory as Studio; configure only the current host and preserve unrelated MCP servers, Skills and credentials.
Discover the OpenMotion tools and call `openmotion_get_project` to verify the workspace. Registration alone does not prove that this chat is connected; report any actual connection limitation honestly.
@@ -30,4 +59,6 @@ Discover the OpenMotion tools and call `openmotion_get_project` to verify the wo
Open the startup URL and choose **Template library**, or call `openmotion_open_preview` with `{"target":"templates"}` when MCP is available.
-Follow the [installation-success contract](docs/install.md#installation-success-reply): open the template library in the calling chat's right panel, use native recommendations with `onboarding: true` when available so the component owns the persistent welcome, and otherwise use the library-only welcome copy. That section is the shared first-run contract; the npm setup commands and release placeholders elsewhere in that document apply to published applications. A card button fills an unsent draft; wait for the user's submitted requirements before creating a project.
+Follow the [installation-success contract](docs/install.md#installation-success-reply): open the template library in the calling chat's right panel, then use the prepared inline presentation above, or the natively discovered recommendations with `onboarding: true` and the user's language. The component owns the persistent Agent welcome and three cards. **For Codex, `host_action_required` or `refresh_requested` means native onboarding is incomplete; use the supported inline route when available. Do not replace complete onboarding with a library-only success reply.** If neither presentation route is available, report that exact limitation and preserve this same chat/workspace for resumption. Reuse this installation rather than running setup again.
+
+Library-only welcome copy is reserved for hosts without native presentation support, not an unfinished Codex handoff. The shared contract is authoritative; npm setup commands and release placeholders elsewhere in that document apply to published applications. A card button fills an unsent draft; wait for the user's submitted requirements before creating a project.
diff --git a/install.sh b/install.sh
index 76f92c0f0..f042a37fc 100644
--- a/install.sh
+++ b/install.sh
@@ -2,7 +2,45 @@
# Remote entry point: download the source, then use the repository installer.
set -euo pipefail
+install_prebuilt() {
+ [ "$#" -ge 2 ] || { echo 'Usage: install.sh --package EXACT_SPEC [setup options]' >&2; exit 1; }
+ local motion_package="$2" motion_started=$SECONDS motion_download_dir=''
+ shift 2
+ for motion_command in node npm codex; do
+ command -v "$motion_command" >/dev/null || { echo "缺少 $motion_command,请先安装后重试。" >&2; exit 1; }
+ done
+ node -e 'const [major,minor]=process.versions.node.split(".").map(Number);if(major<22||(major===22&&minor<18)){console.error("需要 Node.js 22.18+");process.exit(1)}'
+ node --input-type=module - "$motion_package" <<'JS'
+import assert from 'node:assert/strict';
+const spec = process.argv[2];
+if (spec.startsWith('@')) assert(/^@openmotion\/app@\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(spec), 'Pin an exact OpenMotion package version');
+else if (/^https?:/.test(spec)) {
+ const url = new URL(spec);
+ assert(!url.username && !url.password && (url.protocol === 'https:' || ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname)), 'Use HTTPS; HTTP is limited to a loopback acceptance server');
+}
+else assert(spec.startsWith('/') && spec.endsWith('.tgz'), 'Use an exact npm version, HTTPS candidate or absolute local tgz');
+JS
+ if [[ "$motion_package" != @openmotion/app@* ]]; then
+ [[ "${OPENMOTION_INSTALLER_SHA256:-}" =~ ^[a-f0-9]{64}$ ]] || { echo 'Candidate input requires OPENMOTION_INSTALLER_SHA256 from its reviewed manifest.' >&2; exit 1; }
+ if [[ "$motion_package" == http* ]]; then
+ motion_download_dir="$(mktemp -d)"
+ trap "rm -f -- $(printf '%q' "$motion_download_dir/openmotion.tgz"); rmdir -- $(printf '%q' "$motion_download_dir")" EXIT
+ curl -fLsS -o "$motion_download_dir/openmotion.tgz" -- "$motion_package"
+ motion_package="$motion_download_dir/openmotion.tgz"
+ fi
+ node --input-type=module - "$motion_package" "$OPENMOTION_INSTALLER_SHA256" <<'JS'
+import assert from 'node:assert/strict';
+import {createHash} from 'node:crypto';
+import {readFileSync} from 'node:fs';
+assert.equal(createHash('sha256').update(readFileSync(process.argv[2])).digest('hex'), process.argv[3], 'Installer SHA256 mismatch; no code was executed');
+JS
+ fi
+ npm exec --yes --package "$motion_package" -- openmotion setup --host codex "$@"
+ printf '[OpenMotion] prebuilt-install-total: %s seconds (download included)\n' "$((SECONDS - motion_started))"
+}
+
main() {
+ if [ "${1:-}" = '--package' ]; then install_prebuilt "$@"; return; fi
local motion_repo='https://github.com/nexu-io/openmotion.git'
local motion_ref="${OPENMOTION_REF:-main}"
local motion_destination="${OPENMOTION_INSTALL_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/open-motion}"
@@ -25,7 +63,13 @@ main() {
mkdir -p "$(dirname -- "$motion_destination")"
echo "下载 OpenMotion ($motion_ref) 到 $motion_destination"
- git clone --depth 1 --branch "$motion_ref" -- "$motion_repo" "$motion_destination"
+ local motion_download_started=$SECONDS
+ # Optional media remain LFS pointers. Ignore stale global LFS filters even when
+ # git-lfs was uninstalled; this affects this clone only, never global settings.
+ git -c filter.lfs.process= -c filter.lfs.smudge= -c filter.lfs.required=false \
+ clone --depth 1 --single-branch --branch "$motion_ref" -- "$motion_repo" "$motion_destination"
+ export OPENMOTION_SOURCE_DOWNLOAD_SECONDS=$((SECONDS - motion_download_started))
+ echo "[OpenMotion] source-download: $OPENMOTION_SOURCE_DOWNLOAD_SECONDS seconds"
bash "$motion_destination/scripts/install-motion.command"
}
diff --git a/mcp-ui/template-recommendations/inline.fragment.html b/mcp-ui/template-recommendations/inline.fragment.html
new file mode 100644
index 000000000..b292767cd
--- /dev/null
+++ b/mcp-ui/template-recommendations/inline.fragment.html
@@ -0,0 +1,23 @@
+
+
+
+
diff --git a/package-lock.json b/package-lock.json
index 07e4620ef..0506e83c7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,19 @@
"name": "openmotion",
"version": "0.0.1",
"dependencies": {
+ "@hyperframes/core": "0.9.7",
+ "@hyperframes/parsers": "0.9.7",
+ "@hyperframes/player": "0.9.7",
+ "@hyperframes/sdk": "0.9.7",
+ "@hyperframes/shader-transitions": "0.9.7",
+ "@hyperframes/studio-server": "0.9.7",
+ "acorn": "8.19.0",
+ "fontkit": "2.0.4",
+ "gsap": "3.15.0",
+ "hyperframes": "0.9.7",
+ "puppeteer-core": "25.16.0"
+ },
+ "devDependencies": {
"@base-ui/react": "1.7.0",
"@codemirror/autocomplete": "6.20.4",
"@codemirror/commands": "6.11.1",
@@ -19,43 +32,30 @@
"@codemirror/search": "6.7.2",
"@codemirror/state": "6.7.6",
"@codemirror/view": "6.40.0",
- "@hyperframes/core": "0.9.7",
- "@hyperframes/parsers": "0.9.7",
- "@hyperframes/player": "0.9.7",
- "@hyperframes/sdk": "0.9.7",
- "@hyperframes/shader-transitions": "0.9.7",
- "@hyperframes/studio-server": "0.9.7",
"@lezer/highlight": "1.2.5",
"@mcp-b/global": "5.0.1",
- "@phosphor-icons/react": "2.1.10",
- "@tanstack/react-virtual": "3.14.25",
- "acorn": "8.19.0",
- "cn": "0.2.4",
- "dockview-react": "8.3.1",
- "fontkit": "2.0.4",
- "gsap": "3.15.0",
- "hyperframes": "0.9.7",
- "mediabunny": "1.45.3",
- "puppeteer-core": "25.16.0",
- "react": "19.2.9",
- "react-dom": "19.2.9",
- "zustand": "5.0.11"
- },
- "devDependencies": {
"@modelcontextprotocol/ext-apps": "2.0.4",
+ "@phosphor-icons/react": "2.1.10",
"@tailwindcss/vite": "4.3.3",
+ "@tanstack/react-virtual": "3.14.25",
"@types/node": "22.19.1",
"@types/react": "19.2.7",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "4.7.0",
+ "cn": "0.2.4",
+ "dockview-react": "8.3.1",
"esbuild": "0.28.2",
"fake-indexeddb": "6.2.5",
"happy-dom": "21.0.4",
"jsdom": "30.1.3",
+ "mediabunny": "1.45.3",
+ "react": "19.2.9",
+ "react-dom": "19.2.9",
"tailwindcss": "4.3.3",
"typescript": "5.9.3",
"vite": "6.4.5",
- "vitest": "4.1.12"
+ "vitest": "4.1.12",
+ "zustand": "5.0.11"
},
"engines": {
"node": ">=22.18.0"
@@ -369,6 +369,7 @@
"version": "7.29.10",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz",
"integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -425,6 +426,7 @@
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@base-ui/react/-/react-1.7.0.tgz",
"integrity": "sha512-j+8QjX44C32jrXD/qyEAGpFr70FRpGL2CY61mQd9nBPWN737CK0xxD1ceJ055rW4RtdvFDT1e7otzdlfxvsYug==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.29.2",
@@ -463,6 +465,7 @@
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/@base-ui/utils/-/utils-0.3.2.tgz",
"integrity": "sha512-oWy1aq/I2GmYjpl4PhEAhzflF8VPGKgZeq0xAWTbfD5KBWyxcN0ZP2+WHSUm/5Z6lVMBDLReLcoXwSYoRc/zNQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.29.2",
@@ -504,6 +507,7 @@
"version": "6.20.4",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.4.tgz",
"integrity": "sha512-yF8RhOf2SXlg00+qtupzLhrglcas61boqaONiNcbPIebHCpJocpqTBA6dyrtUrQO47hqyTdeob/3XnYilT7TaQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
@@ -516,6 +520,7 @@
"version": "6.11.1",
"resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.11.1.tgz",
"integrity": "sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
@@ -528,6 +533,7 @@
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.3.1.tgz",
"integrity": "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
@@ -541,6 +547,7 @@
"version": "6.4.12",
"resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.12.tgz",
"integrity": "sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
@@ -558,6 +565,7 @@
"version": "6.2.5",
"resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.5.tgz",
"integrity": "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
@@ -573,6 +581,7 @@
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.5.2.tgz",
"integrity": "sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.7.1",
@@ -588,6 +597,7 @@
"version": "6.13.1",
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.13.1.tgz",
"integrity": "sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
@@ -603,6 +613,7 @@
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.7.tgz",
"integrity": "sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
@@ -614,6 +625,7 @@
"version": "6.43.15",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.43.15.tgz",
"integrity": "sha512-HHsfpqFeHyXLs983pSRe38Xajs0vFWZQ2BuX0m7Ki8w3jZ5iD8cuR3lBz2/5/X53Dhf32SBHKh6rtSTB6tKeGw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.7.0",
@@ -626,6 +638,7 @@
"version": "6.7.2",
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.7.2.tgz",
"integrity": "sha512-gUYkYhT2+n/+VGZ+8EzE5WFkYZUZYm1VOKDudIsNqh42uRVQJ0a6Yss9sdKT3MeOYfuL1N6AZA57oza0Oyr0LA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
@@ -637,6 +650,7 @@
"version": "6.7.6",
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.7.6.tgz",
"integrity": "sha512-kAz+AncRtKuIknedxT1bq4XwXv4UowhbkHU1myPrtVb/jZtImWuV5BXzv5vK6i3kYACsdiZiQKFQQ5Mq7elW8w==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@marijn/find-cluster-break": "^1.0.0"
@@ -646,12 +660,14 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@codemirror/streamparser/-/streamparser-6.0.0.tgz",
"integrity": "sha512-JTFPF6xrfjt0mnfGPgzcLiMwYmvIyNaoizp8BYzv8FE8KrT6GBGDZ190rtt+O7Wke3gG/MFHyiY9YGNeimof4w==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@codemirror/view": {
"version": "6.40.0",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.40.0.tgz",
"integrity": "sha512-WA0zdU7xfF10+5I3HhUUq3kqOx3KjqmtQ9lqZjfK7jtYk4G72YW9rezcSywpaUMCWOMlq+6E0pO1IWg1TNIhtg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.6.0",
@@ -1248,6 +1264,7 @@
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz",
"integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@floating-ui/utils": "^0.2.12"
@@ -1257,6 +1274,7 @@
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz",
"integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@floating-ui/core": "^1.8.0",
@@ -1267,6 +1285,7 @@
"version": "2.1.9",
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz",
"integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@floating-ui/dom": "^1.8.0"
@@ -1280,6 +1299,7 @@
"version": "0.2.12",
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz",
"integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@hono/node-server": {
@@ -1984,12 +2004,14 @@
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.5.tgz",
"integrity": "sha512-Pw7PVCndruF1pb3ebCxpSVpkMHSDjwRCLcTRw+RizUKco5QbWylwq2g4lnG/RYN7yTTQDXE9F77MwtkAyphrjg==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@lezer/css": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.3.9.tgz",
"integrity": "sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.2.0",
@@ -2001,6 +2023,7 @@
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.5.tgz",
"integrity": "sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.3.0"
@@ -2010,6 +2033,7 @@
"version": "1.3.13",
"resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.13.tgz",
"integrity": "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.2.0",
@@ -2021,6 +2045,7 @@
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.5.6.tgz",
"integrity": "sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.2.0",
@@ -2032,6 +2057,7 @@
"version": "1.4.12",
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.12.tgz",
"integrity": "sha512-On9HU4oMMiHPMkQDgoTnGahjgG5n/MkN38CgG77sMraKLL+3JBbeQNi1FcCXV9QRqwF9/BUXP3caHyJC1fBOTQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.0.0"
@@ -2041,6 +2067,7 @@
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/@lezer/markdown/-/markdown-1.8.1.tgz",
"integrity": "sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.5.0",
@@ -2051,12 +2078,14 @@
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz",
"integrity": "sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@mcp-b/global": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@mcp-b/global/-/global-5.0.1.tgz",
"integrity": "sha512-Wca64tan5xaz1yyT8xeZj/3CLhN2vSjUUYmiZIBSw0XkgqDfezLc8EoLqAWIBgtbddDMpAHI3WDd+RhgJViQbg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@mcp-b/transports": "5.0.1",
@@ -2073,6 +2102,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@mcp-b/transports/-/transports-5.0.1.tgz",
"integrity": "sha512-qgFns3DJ8I2LWDPx6CItQdGIHIammYTcVo6LqdcjC1pURhJyJRUCBc8Q2dNjNEK2gp3dALPmvk5S7OOe5iyA7w==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/core": "2.0.0",
@@ -2087,6 +2117,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@mcp-b/webmcp-polyfill/-/webmcp-polyfill-5.0.1.tgz",
"integrity": "sha512-xw/7f0bu4dsqWaGCE4RbB5/nkkbczeIP6NNeatE61Yxfpfp3r2E7pdgHmtYKb3oZ2BxROiM/yWkgiM3Ol0nkjA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@mcp-b/webmcp-types": "5.0.1",
@@ -2100,6 +2131,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@mcp-b/webmcp-ts-sdk/-/webmcp-ts-sdk-5.0.1.tgz",
"integrity": "sha512-0o/mtUCjJSLw6l/81Yexnd6pXTYw1tZN2a7/e5zaMM5UWp/97vXhh5ktwfbodwu//L8/Rag7n69++rnhhE8zxw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@mcp-b/webmcp-polyfill": "5.0.1",
@@ -2114,6 +2146,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@mcp-b/webmcp-types/-/webmcp-types-5.0.1.tgz",
"integrity": "sha512-UN7GsTrudXoMWxTL6n6451C19r5nsBzU4WLovRC6YVFnOJk3N5qYwmQySAISEi/0fcWkRDcT3OqAee7/jrl1iA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/server": "2.0.0"
@@ -2160,6 +2193,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.0.0.tgz",
"integrity": "sha512-pJCEwGG7Lfr/+PQp9ZTwKXNeO5wzbfKL7H3MYpCorM4oFBoQrdjnBgEoqG+RjhsvS1FKrDbKux+M1HhlnGWqcA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"zod": "^4.2.0"
@@ -2207,6 +2241,7 @@
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.4.0.tgz",
"integrity": "sha512-rgR9yxSaAJ+bcsi/XroT/S2AfPiIWloXAnrdfYSCms9ivVju0ishu/wW0J21Ho6+ZOR1r7RyeRbjiRuF87ix5Q==",
+ "dev": true,
"license": "Apache-2.0",
"dependencies": {
"@modelcontextprotocol/core": "2.4.0",
@@ -2220,6 +2255,7 @@
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz",
"integrity": "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==",
+ "dev": true,
"license": "Apache-2.0",
"dependencies": {
"zod": "^4.2.0"
@@ -2252,6 +2288,7 @@
"version": "2.1.10",
"resolved": "https://registry.npmjs.org/@phosphor-icons/react/-/react-2.1.10.tgz",
"integrity": "sha512-vt8Tvq8GLjheAZZYa+YG/pW7HDbov8El/MANW8pOAz4eGxrwhnbfrQZq0Cp4q8zBEu8NIhHdnr+r8thnfRSNYA==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
@@ -2703,6 +2740,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@swc/helpers": {
@@ -3068,6 +3106,7 @@
"version": "3.14.25",
"resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.14.25.tgz",
"integrity": "sha512-LYNLaogi8NZUqjPgJ0byKQrXprkDJsZLd94u0i1UpYtXz2fgvbP4KrHygM4MSgSAvEaqykQofYdJ1Vuf7XIz/Q==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@tanstack/virtual-core": "3.19.10"
@@ -3085,6 +3124,7 @@
"version": "3.19.10",
"resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.19.10.tgz",
"integrity": "sha512-/ltpH0qUCs5XQYE7fIhgA+aqgC5NzSfLTDQkC+N1wOOdvIYx1FH/kz2LGfSeanNbekqy3WBu6mNIbqXhxE/pew==",
+ "dev": true,
"license": "MIT",
"funding": {
"type": "github",
@@ -3151,6 +3191,7 @@
"version": "0.0.326",
"resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.326.tgz",
"integrity": "sha512-WS7jKf3ZRZFHOX7dATCZwqNJgdfiSF0qBRFxaO0LhIOvTNBrfkab26bsZwp6EBpYtqp8loMHJTnD6vDTLWPKYw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@types/filesystem": "*",
@@ -3168,6 +3209,7 @@
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.12.tgz",
"integrity": "sha512-d7/QsLRwF864A5mgIM/YrfiglHoYn7zgCcAoJgW404r+2DwnNr7EBbLnCWpmOMgH8y0te73L1AV6H1bmauaWFw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@types/dom-webcodecs": "*"
@@ -3177,6 +3219,7 @@
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",
"integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@types/estree": {
@@ -3190,6 +3233,7 @@
"version": "0.0.36",
"resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",
"integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"@types/filewriter": "*"
@@ -3199,12 +3243,14 @@
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",
"integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@types/har-format": {
"version": "1.2.16",
"resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",
"integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",
+ "dev": true,
"license": "MIT"
},
"node_modules/@types/node": {
@@ -3221,7 +3267,7 @@
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
- "devOptional": true,
+ "dev": true,
"license": "MIT",
"dependencies": {
"csstype": "^3.2.2"
@@ -3706,6 +3752,7 @@
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/cn/-/cn-0.2.4.tgz",
"integrity": "sha512-SzQvoh5FwizWtQg9+JueKdjWhlfCZMdu5DqNHm9q1wUlRVmKb9WXlepR9bTTbPwzEOyX1ujJ6lcCppmn3bNUCg==",
+ "dev": true,
"license": "MIT",
"bin": {
"cn": "bin/cn.mjs"
@@ -3731,6 +3778,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.7.tgz",
"integrity": "sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==",
+ "dev": true,
"license": "MIT"
},
"node_modules/cross-spawn": {
@@ -3908,7 +3956,7 @@
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
- "devOptional": true,
+ "dev": true,
"license": "MIT"
},
"node_modules/data-urls": {
@@ -4025,6 +4073,7 @@
"version": "8.8.3",
"resolved": "https://registry.npmjs.org/dockview/-/dockview-8.8.3.tgz",
"integrity": "sha512-hTb5X4Z74k0+5wtOlx1gNsx/q5ve1p0JQ6s7Ovl24YhdkaR9AhfWFlq1dQYwXjXIoWm8RFW6aTZMhCTiEv94EA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"dockview-core": "^8.8.3"
@@ -4034,12 +4083,14 @@
"version": "8.8.3",
"resolved": "https://registry.npmjs.org/dockview-core/-/dockview-core-8.8.3.tgz",
"integrity": "sha512-B9v+ibiXnZ5qgFJ7VEqMcNxpG0S5Y7Yx7uuGqqSyEFSC3bRZktUoXWo3HCrFp+QTdFmA1dJD1ye/gI4yL3hU2g==",
+ "dev": true,
"license": "MIT"
},
"node_modules/dockview-react": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/dockview-react/-/dockview-react-8.3.1.tgz",
"integrity": "sha512-siezdOZ5izcdEn7TSYeWc+mC3hPgyW6rK6QHd6+L6PCRUKdB0WkGABtLtHmLn4Dr3VCm6C2+cv1qSCqJBeiFyA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"dockview": "^8.3.1"
@@ -5016,6 +5067,7 @@
"version": "1.45.3",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.45.3.tgz",
"integrity": "sha512-GUCPYjR+5olLM7DRmupCXCmZkkSrKHVl1gyW2RztpObqLfrix19kWGf/9WgWzDW0g49DvfGXpl+zfArCx5HDMQ==",
+ "dev": true,
"license": "MPL-2.0",
"workspaces": [
".",
@@ -5285,6 +5337,7 @@
"version": "19.2.9",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.9.tgz",
"integrity": "sha512-RuLdAokXv3sRmZa2/N8QH0KmTBIgDKC+buRUikGqow31+mGSGidLCX2o4XFq8OV+xBFWfhM9DVgTq1PPHADH4w==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@@ -5294,6 +5347,7 @@
"version": "19.2.9",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.9.tgz",
"integrity": "sha512-YceU74W21fXEHszKBLj16MY0CmvpFKOs60iVrIyW/cCgOPsZJNaB6GVJEtIUqt6AG6EjzKLui5lPRrxAeS328Q==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"scheduler": "^0.27.0"
@@ -5342,6 +5396,7 @@
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.3.0.tgz",
"integrity": "sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg==",
+ "dev": true,
"license": "MIT"
},
"node_modules/restructure": {
@@ -5426,6 +5481,7 @@
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
+ "dev": true,
"license": "MIT"
},
"node_modules/semver": {
@@ -5590,6 +5646,7 @@
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.4.tgz",
"integrity": "sha512-XXWIQt633/EpAFx8aZDOTjBzrCaGmhvEQlQo6MVPfa2OzO2cWo+4hV9h+6UkHYlXGfy+ODXKUdP7Pthmcu5ATw==",
+ "dev": true,
"license": "MIT"
},
"node_modules/tailwindcss": {
@@ -5827,6 +5884,7 @@
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz",
"integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==",
+ "dev": true,
"license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -6500,6 +6558,7 @@
"version": "2.2.8",
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
+ "dev": true,
"license": "MIT"
},
"node_modules/w3c-xmlserializer": {
@@ -6757,6 +6816,7 @@
"version": "5.0.11",
"resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.11.tgz",
"integrity": "sha512-fdZY+dk7zn/vbWNCYmzZULHRrss0jx5pPFiOuMZ/5HJN6Yv3u+1Wswy/4MpZEkEGhtNH+pwxZB8OKgUBPzYAGg==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=12.20.0"
diff --git a/package.json b/package.json
index 1dfb4f646..ad3d7fb76 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,23 @@
"build:template-cards": "npm run typecheck:template-cards && node --experimental-strip-types scripts/build-template-cards.mjs"
},
"dependencies": {
+ "@hyperframes/core": "0.9.7",
+ "@hyperframes/parsers": "0.9.7",
+ "@hyperframes/player": "0.9.7",
+ "@hyperframes/sdk": "0.9.7",
+ "@hyperframes/shader-transitions": "0.9.7",
+ "@hyperframes/studio-server": "0.9.7",
+ "acorn": "8.19.0",
+ "fontkit": "2.0.4",
+ "gsap": "3.15.0",
+ "hyperframes": "0.9.7",
+ "puppeteer-core": "25.16.0"
+ },
+ "overrides": {
+ "undici": "7.30.1",
+ "@modelcontextprotocol/server": "2.4.0"
+ },
+ "devDependencies": {
"@base-ui/react": "1.7.0",
"@codemirror/autocomplete": "6.20.4",
"@codemirror/commands": "6.11.1",
@@ -54,46 +71,29 @@
"@codemirror/search": "6.7.2",
"@codemirror/state": "6.7.6",
"@codemirror/view": "6.40.0",
- "@hyperframes/core": "0.9.7",
- "@hyperframes/parsers": "0.9.7",
- "@hyperframes/player": "0.9.7",
- "@hyperframes/sdk": "0.9.7",
- "@hyperframes/shader-transitions": "0.9.7",
- "@hyperframes/studio-server": "0.9.7",
"@lezer/highlight": "1.2.5",
"@mcp-b/global": "5.0.1",
- "@phosphor-icons/react": "2.1.10",
- "@tanstack/react-virtual": "3.14.25",
- "acorn": "8.19.0",
- "cn": "0.2.4",
- "dockview-react": "8.3.1",
- "fontkit": "2.0.4",
- "gsap": "3.15.0",
- "hyperframes": "0.9.7",
- "mediabunny": "1.45.3",
- "puppeteer-core": "25.16.0",
- "react": "19.2.9",
- "react-dom": "19.2.9",
- "zustand": "5.0.11"
- },
- "overrides": {
- "undici": "7.30.1",
- "@modelcontextprotocol/server": "2.4.0"
- },
- "devDependencies": {
"@modelcontextprotocol/ext-apps": "2.0.4",
+ "@phosphor-icons/react": "2.1.10",
"@tailwindcss/vite": "4.3.3",
+ "@tanstack/react-virtual": "3.14.25",
"@types/node": "22.19.1",
"@types/react": "19.2.7",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "4.7.0",
+ "cn": "0.2.4",
+ "dockview-react": "8.3.1",
"esbuild": "0.28.2",
"fake-indexeddb": "6.2.5",
"happy-dom": "21.0.4",
"jsdom": "30.1.3",
+ "mediabunny": "1.45.3",
+ "react": "19.2.9",
+ "react-dom": "19.2.9",
"tailwindcss": "4.3.3",
"typescript": "5.9.3",
"vite": "6.4.5",
- "vitest": "4.1.12"
+ "vitest": "4.1.12",
+ "zustand": "5.0.11"
}
}
diff --git a/scripts/check.ts b/scripts/check.ts
index 784eb4456..01e8e6d34 100644
--- a/scripts/check.ts
+++ b/scripts/check.ts
@@ -28,7 +28,7 @@ export async function check() {
const manifest = JSON.parse(await readFile(path.join(root, '.codex-plugin/plugin.json'), 'utf8'));
const marketplace = JSON.parse(await readFile(path.join(root, 'marketplace.example.json'), 'utf8'));
assert.equal(manifest.name, marketplace.plugins[0].name);
- assert.equal(manifest.skills, './skills/');
+ assert.deepEqual(manifest.skills, ['./skills/', './.codex-plugin/onboarding/']);
const pkg = JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8'));
const lock = JSON.parse(await readFile(path.join(root, 'package-lock.json'), 'utf8'));
assert.equal(pkg.version, manifest.version);
diff --git a/scripts/distribution.ts b/scripts/distribution.ts
index 977c649ea..bae5337ef 100644
--- a/scripts/distribution.ts
+++ b/scripts/distribution.ts
@@ -555,7 +555,7 @@ export const distributionDocuments = [
'docs/skills.md', 'docs/template-catalog.md', 'docs/template-repository.md', 'docs/repository-storage.md', 'docs/test-packages.md', 'docs/templates/requirement.md',
];
-export async function distributionFiles(profile: string): Promise {
+export async function distributionFiles(profile: string, include: (file: string) => boolean = () => true): Promise {
if (!['phase1', 'legacy'].includes(profile)) throw new Error('Unknown distribution profile: ' + profile);
const files = [
...designSystemRuntimeFiles.map(file => 'packages/design-system/' + file),
@@ -566,14 +566,14 @@ export async function distributionFiles(profile: string): Promise {
'template-catalog.ts', 'prism-templates.ts', 'editor-server.ts',
'scripts/runtime-assets.mjs', 'scripts/npm-runtime.mjs', 'scripts/runtime-lock.json', 'scripts/lint-project.mjs',
'scripts/npm-installer.mjs', 'scripts/npm-hosts.mjs', 'scripts/check-installed-mcp.mjs', 'scripts/mcp-client.mjs',
- 'scripts/install-onboarding.mjs', 'scripts/codex-host-handoff.mjs', 'scripts/onboarding-catalog.ts', 'scripts/open-template-library.ts', 'scripts/install-library-skill.mjs',
+ 'scripts/install-onboarding.mjs', 'scripts/inline-onboarding.mjs', 'scripts/onboarding-callback.mjs', 'scripts/codex-host-handoff.mjs', 'scripts/onboarding-catalog.ts', 'scripts/open-template-library.ts', 'scripts/install-library-skill.mjs',
'scripts/diagnostics.mjs', 'scripts/diagnostic-redaction.mjs', 'scripts/zip.mjs',
'scripts/verify-export.ts', 'scripts/export-adapters.ts', 'scripts/package.ts', 'scripts/distribution.ts',
'scripts/repository-media.ts', 'scripts/build-template-cards.mjs',
'shared/workflow-entry.js', 'shared/inline-video-result.js', 'shared/provider-registry-LICENSE.txt', 'shared/provider-registry-NOTICE.md', 'studio/LICENSE', 'studio/README.md', 'template-library/LICENSE', 'shared/editor-launch.pl',
'tracking/core.ts', 'tracking/node.ts', 'tracking/browser.ts', 'tracking/events.ts', 'tracking/studio-events.ts', 'tracking/studio-properties.ts', 'tracking/host.ts', 'tracking/device.ts',
// Required, reviewed native MCP presentation assets; do not widen media globs.
- 'mcp-ui/template-recommendations/manifest.json',
+ 'mcp-ui/template-recommendations/manifest.json', 'mcp-ui/template-recommendations/inline.fragment.html',
'mcp-ui/template-recommendations/LICENSE', 'mcp-ui/template-recommendations/NOTICE.md',
'mcp-ui/template-recommendations/build/app.js', 'mcp-ui/template-recommendations/build/app.css',
'mcp-ui/template-recommendations/build/identity.json',
@@ -600,14 +600,17 @@ export async function distributionFiles(profile: string): Promise {
for (const skill of packagedSkills) await walk('skills/' + skill, /\.(?:md|mjs|ts|py|json|ya?ml)$/);
await walk('studio/build', /\.(?:html|js|css|json|svg|png|jpg|webp|woff2?|ttf|txt)$/);
await walk('studio/public', /\.(?:html|js|css|json|svg|png|jpg|webp|woff2?|ttf|txt)$/);
- for (const file of files) {
+ // A lightweight application must not require optional showcase bytes that its
+ // caller intentionally excludes. Full bundles still validate the whole list.
+ const selected = [...new Set(files)].filter(include).sort();
+ for (const file of selected) {
const info = await lstat(path.join(root, file)).catch(error => {
if (error.code === 'ENOENT' && /\.(?:mp4|motion|gif|png|jpe?g|webp)$/i.test(file)) throw new Error(`Optional media is missing: ${file}. Run npm run media:pull for transferred files, or the scoped LFS pull in docs/repository-storage.md.`);
throw error;
});
if (!info.isFile()) throw new Error('Distribution requires a regular file: ' + file);
}
- return [...new Set(files)].sort();
+ return selected;
}
// Complete bundles must never turn unresolved LFS pointers into installed media.
diff --git a/scripts/inline-onboarding.mjs b/scripts/inline-onboarding.mjs
new file mode 100644
index 000000000..aeb3ee256
--- /dev/null
+++ b/scripts/inline-onboarding.mjs
@@ -0,0 +1,87 @@
+import assert from 'node:assert/strict';
+import { randomUUID, createHash } from 'node:crypto';
+import { readFile, lstat, mkdir, writeFile } from 'node:fs/promises';
+import { realpathSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { parseArgs } from 'node:util';
+import { runFile } from './runtime-assets.mjs';
+
+// A current host can render this read-only production view without loading a
+// new MCP tool. Domain work continues through the installation's existing CLI.
+export async function prepareInlineOnboarding({ appRoot, output, language = 'en' }) {
+ assert(path.isAbsolute(output) && output.endsWith('.html'), 'Inline onboarding requires an absolute HTML output path supplied by the calling host');
+ return JSON.parse(await runFile(process.execPath, ['--experimental-strip-types', path.join(appRoot, 'scripts/inline-onboarding.mjs'),
+ '--output', output, '--language', language], { cwd: appRoot }));
+}
+
+export async function renderInlineOnboarding({ appRoot, output, language = 'en' }) {
+ language = typeof language === 'string' ? language.trim().toLowerCase().split(/[-_]/)[0] : 'en';
+ if (!['zh', 'en', 'ja', 'ko', 'fr', 'es', 'pt'].includes(language)) language = 'en';
+ const { loadTemplatePresentation, showTemplateRecommendations } = await import('../shared/mcp-template-recommendations.ts');
+ const directory = path.join(appRoot, 'mcp-ui/template-recommendations');
+ const presentation = loadTemplatePresentation({ applicationRoot: appRoot, directory });
+ const match = presentation.content.text.match(/window\.__OPENMOTION_TEMPLATE_CARDS__=(.*?);<\/script>/s);
+ assert(match, 'Verified production bootstrap is missing');
+ const bootstrap = JSON.parse(match[1]);
+ const recommendation = showTemplateRecommendations(presentation, {
+ templateIds: ['product-promo', 'nyt-graph', 'decision-tree'], onboarding: true, language,
+ });
+ let fragment = await readFile(path.join(directory, 'inline.fragment.html'), 'utf8');
+ const json = value => JSON.stringify(value).replaceAll('<', '\\u003c');
+ const parts = {
+ '__OPENMOTION_INLINE_ROOT__': 'openmotion-onboarding-' + randomUUID(),
+ '/*__OPENMOTION_INLINE_STYLE__*/': (await readFile(path.join(directory, 'build/app.css'), 'utf8')).replace(/<\/style/gi, '<\\/style'),
+ '/*__OPENMOTION_INLINE_APP__*/': (await readFile(path.join(directory, 'build/app.js'), 'utf8')).replace(/<\/script/gi, '<\\/script'),
+ '/*__OPENMOTION_INLINE_BOOTSTRAP__*/': json(bootstrap),
+ '/*__OPENMOTION_INLINE_RECOMMENDATION__*/': json(recommendation),
+ };
+ for (const [marker, value] of Object.entries(parts)) {
+ assert(fragment.includes(marker), 'Inline template marker is missing: ' + marker);
+ fragment = fragment.replaceAll(marker, () => value);
+ }
+ assert(!fragment.includes('__OPENMOTION_INLINE_'), 'Inline template contains unresolved markers');
+ const bytes = Buffer.byteLength(fragment);
+ assert(bytes < 1_000_000, 'Inline onboarding exceeds the host document budget');
+ await mkdir(path.dirname(output), { recursive: true });
+ await writeFile(output, fragment, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
+ return { status: 'prepared', mode: 'inline-document', path: output, bytes,
+ sha256: createHash('sha256').update(fragment).digest('hex'), resourceVersion: presentation.resourceVersion,
+ templateIds: recommendation.cards.map(card => card.templateId), language,
+ publicationRequired: true,
+ draftBehavior: 'copyable-brief; no task submission', nativeMcpSessionVerified: false,
+ instructions: 'This is a prepared runtime document, not a host-readable content reference. In the active chat, publish it with this script --publish-from PATH --sha256 SHA256 --host-directory DIRECTORY, using that chat\'s explicitly permitted visualization directory. Never infer host readability from installation/data write access. After visibly opening the real template library, emit the published contentReference once. Preserve the production welcome/cards and verified full MP4s. Do not duplicate the welcome, restart the host or claim native MCP discovery. Recreate retains the copyable brief; no task is submitted. Preparation or publication alone does not prove visible delivery.' };
+}
+
+export async function publishInlineOnboarding({ source, expectedSHA256, hostDirectory }) {
+ assert(typeof source === 'string' && path.isAbsolute(source) && source.endsWith('.html'), 'Pass an absolute prepared HTML source');
+ assert(typeof hostDirectory === 'string' && path.isAbsolute(hostDirectory), 'Pass the active chat\'s explicitly permitted visualization directory');
+ assert(/^[a-f0-9]{64}$/.test(expectedSHA256), 'Publication requires the prepared SHA256');
+ const fragment = await readFile(source);
+ assert(fragment.length < 1_000_000, 'Inline onboarding exceeds the host document budget');
+ const sha256 = createHash('sha256').update(fragment).digest('hex');
+ assert.equal(sha256, expectedSHA256, 'Prepared onboarding SHA256 mismatch');
+ await mkdir(hostDirectory, { recursive: true });
+ const output = path.join(hostDirectory, path.basename(source));
+ try { await writeFile(output, fragment, { flag: 'wx', mode: 0o600 }); }
+ catch (error) {
+ if (error.code !== 'EEXIST') throw error;
+ assert((await lstat(output)).isFile(), 'Refusing a non-regular host document');
+ assert.equal(createHash('sha256').update(await readFile(output)).digest('hex'), sha256, 'Refusing to overwrite a different host document');
+ }
+ return { status: 'published', path: output, sha256, bytes: fragment.length,
+ publicationRequired: false, nativeMcpSessionVerified: false,
+ contentReference: 'visualize' + JSON.stringify({ path: output }) + '' };
+}
+
+if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
+ const { values } = parseArgs({ options: { output: { type: 'string' }, language: { type: 'string' },
+ 'publish-from': { type: 'string' }, sha256: { type: 'string' }, 'host-directory': { type: 'string' } } });
+ if (values['publish-from']) {
+ console.log(JSON.stringify(await publishInlineOnboarding({ source: values['publish-from'], expectedSHA256: values.sha256,
+ hostDirectory: values['host-directory'] }), null, 2));
+ } else {
+ assert(values.output && path.isAbsolute(values.output) && values.output.endsWith('.html'), 'Pass --output with an absolute .html path');
+ console.log(JSON.stringify(await renderInlineOnboarding({ appRoot: fileURLToPath(new URL('../', import.meta.url)), output: values.output, language: values.language }), null, 2));
+ }
+}
diff --git a/scripts/install-motion.command b/scripts/install-motion.command
index 996c07232..f08df3f03 100644
--- a/scripts/install-motion.command
+++ b/scripts/install-motion.command
@@ -12,6 +12,21 @@ node -e 'const [major,minor]=process.versions.node.split(".").map(Number);if(maj
codex plugin add --help >/dev/null || { echo '当前 Codex CLI 不支持插件安装,请升级后重试。'; exit 1; }
mkdir -p "$openmotion_root/.agents/plugins" "$openmotion_logs"
+openmotion_started=$SECONDS
+openmotion_run_id="$(date -u +%Y%m%dT%H%M%SZ)-$$"
+if [[ "${OPENMOTION_SOURCE_DOWNLOAD_SECONDS:-}" =~ ^[0-9]+$ ]]; then
+ printf '{"runId":"%s","phase":"source-download","seconds":%s,"exitCode":0}\n' "$openmotion_run_id" "$OPENMOTION_SOURCE_DOWNLOAD_SECONDS" >> "$openmotion_logs/timings.jsonl"
+fi
+openmotion_stage() {
+ local phase="$1" started=$SECONDS
+ shift
+ local stage_status=0
+ "$@" || stage_status=$?
+ local elapsed=$((SECONDS - started))
+ printf '{"runId":"%s","phase":"%s","seconds":%s,"exitCode":%s}\n' "$openmotion_run_id" "$phase" "$elapsed" "$stage_status" >> "$openmotion_logs/timings.jsonl"
+ printf '[OpenMotion] %s: %s seconds (exit %s)\n' "$phase" "$elapsed" "$stage_status"
+ return "$stage_status"
+}
openmotion_catalog="$openmotion_root/.agents/plugins/marketplace.json"
if [ -e "$openmotion_catalog" ]; then
node --input-type=module - "$openmotion_catalog" <<'JS'
@@ -25,13 +40,16 @@ else
cp "$openmotion_root/marketplace.example.json" "$openmotion_catalog"
fi
+# Read only: detect an active/foreign source conflict before downloading dependencies.
+openmotion_stage source-preflight node "$openmotion_root/scripts/source-marketplace.mjs" "$openmotion_root" --check
+
# Git checkouts omit studio/build; release ZIPs already contain the editor.
if [ ! -f "$openmotion_root/studio/build/index.html" ]; then
echo '首次从源码安装:下载锁定依赖并构建编辑器。'
(
cd "$openmotion_root"
- npm ci --include=dev
- npm run build:studio
+ openmotion_stage dependencies npm ci --include=dev
+ openmotion_stage studio-build npm run build:studio
)
fi
@@ -39,10 +57,10 @@ fi
node --experimental-strip-types "$openmotion_root/scripts/install-onboarding.mjs" "$openmotion_root" --check-contract
echo '只注册 openmotion-local 并安装 OpenMotion,不升级或移除其他插件。'
-codex plugin marketplace add "$openmotion_root"
-codex plugin add openmotion@openmotion-local
+openmotion_stage marketplace node "$openmotion_root/scripts/source-marketplace.mjs" "$openmotion_root"
+openmotion_stage plugin codex plugin add openmotion@openmotion-local
codex plugin list --marketplace openmotion-local
-node "$openmotion_root/scripts/check-installed-mcp.mjs"
+openmotion_stage mcp-preflight node "$openmotion_root/scripts/check-installed-mcp.mjs"
-openmotion_onboarding="$(node --experimental-strip-types "$openmotion_root/scripts/install-onboarding.mjs" "$openmotion_root")"
-printf '%s\n' 'OpenMotion registration and independent MCP preflight succeeded. Check hostHandoff before reporting current-chat connection or onboarding success.' "$openmotion_onboarding"
+openmotion_stage onboarding node --experimental-strip-types "$openmotion_root/scripts/install-onboarding.mjs" "$openmotion_root" --summary
+printf '[OpenMotion] local-install-total: %s seconds (source download: %s seconds)\n' "$((SECONDS - openmotion_started))" "${OPENMOTION_SOURCE_DOWNLOAD_SECONDS:-not-measured}"
diff --git a/scripts/install-onboarding.mjs b/scripts/install-onboarding.mjs
index 2924e6182..805a4921c 100644
--- a/scripts/install-onboarding.mjs
+++ b/scripts/install-onboarding.mjs
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict';
import { realpathSync } from 'node:fs';
-import { access, readFile, readdir } from 'node:fs/promises';
+import { randomUUID } from 'node:crypto';
+import { access, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { runFile } from './runtime-assets.mjs';
@@ -41,9 +42,22 @@ export async function bundledOnboardingTemplates(appRoot) {
return templates.sort((a, b) => a.templateId.localeCompare(b.templateId));
}
-export async function prepareInstallationOnboarding({ appRoot, dataDirectory, templateEnvironment }) {
+export async function prepareInstallationOnboarding({ appRoot, dataDirectory, templateEnvironment, host = 'codex', onboardingOutput,
+ language = process.env.OPENMOTION_ONBOARDING_LANGUAGE || 'en' }) {
// A missing canonical contract fails before host registration.
const instructions = await installationInstructions(appRoot);
+ const inline = (async () => {
+ if (host !== 'codex') return undefined;
+ try {
+ if (!dataDirectory) {
+ const { WorkspaceStore } = await import('../workspace.ts');
+ dataDirectory = new WorkspaceStore().directory;
+ }
+ const { prepareInlineOnboarding } = await import('./inline-onboarding.mjs');
+ return await prepareInlineOnboarding({ appRoot, language,
+ output: onboardingOutput || path.join(dataDirectory, 'onboarding', `welcome-${randomUUID()}.html`) });
+ } catch (error) { return { status: 'unavailable', warning: error.message }; }
+ })();
const bundled = await bundledOnboardingTemplates(appRoot);
let catalog;
try {
@@ -58,7 +72,9 @@ export async function prepareInstallationOnboarding({ appRoot, dataDirectory, te
catalogTotal: null, included: bundled.length, truncated: false, stale: false,
warning: 'Remote catalog unavailable; using verified bundled examples only.', templates: bundled };
}
- return { hostSessionVerified: false, instructions, catalog };
+ const inlinePresentation = await inline;
+ return { hostSessionVerified: false, instructions, catalog,
+ ...(inlinePresentation ? { inlinePresentation } : {}) };
}
export async function prepareInstallationPreview({ appRoot, dataDirectory }) {
@@ -78,6 +94,55 @@ export async function prepareInstallationPreview({ appRoot, dataDirectory }) {
}
}
+// Shared by packaged setup, source setup and the plugin's setup Skill. A ready
+// artifact is an installation handoff, never proof of visible host delivery.
+export async function prepareInstallationFlow(options) {
+ if (!options.dataDirectory) {
+ let configuration;
+ try { configuration = JSON.parse(await readFile(path.join(options.appRoot, '.mcp.json'), 'utf8')); }
+ catch (error) { if (error.code !== 'ENOENT') throw error; }
+ const server = configuration?.mcpServers?.openmotion;
+ const declared = server?.env?.MOTION_DATA_DIR;
+ if (declared !== undefined && declared !== '') {
+ const expand = value => {
+ assert(typeof value === 'string', 'Invalid installed connection environment value');
+ const result = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, key) => {
+ if (key === 'PLUGIN_ROOT' || key === 'CLAUDE_PLUGIN_ROOT') return options.appRoot;
+ assert(process.env[key] !== undefined, 'Resolve the installed connection environment before onboarding');
+ return process.env[key];
+ });
+ assert(!result.includes('${'), 'Resolve the installed connection environment before onboarding');
+ return result;
+ };
+ const resolved = expand(declared);
+ const cwd = path.isAbsolute(resolved) ? '.' : expand(server.cwd || '.');
+ if (resolved) options = { ...options, dataDirectory: path.isAbsolute(resolved) ? path.resolve(resolved) : path.resolve(options.appRoot, cwd, resolved) };
+ else {
+ const { WorkspaceStore } = await import('../workspace.ts');
+ options = { ...options, dataDirectory: new WorkspaceStore().directory };
+ }
+ } else {
+ const { WorkspaceStore } = await import('../workspace.ts');
+ options = { ...options, dataDirectory: new WorkspaceStore().directory };
+ }
+ }
+ const [onboarding, preview] = await Promise.all([
+ prepareInstallationOnboarding(options), prepareInstallationPreview(options),
+ ]);
+ let hostHandoff;
+ if ((options.host || 'codex') === 'codex' && onboarding.inlinePresentation?.status !== 'prepared') {
+ hostHandoff = await prepareCodexHostHandoff({ dataDirectory: options.dataDirectory,
+ expectedVersion: options.expectedVersion || JSON.parse(await readFile(path.join(options.appRoot, 'package.json'), 'utf8')).version,
+ codex: options.codex });
+ }
+ return { ...onboarding, installationStatus: 'installed', applicationRoot: options.appRoot,
+ dataDirectory: options.dataDirectory, preview,
+ ...(hostHandoff ? { hostHandoff } : {}),
+ onboardingStatus: preview.status !== 'ready' ? 'preview_unavailable'
+ : onboarding.inlinePresentation?.status === 'prepared' ? 'awaiting_host_delivery' : hostHandoff?.status || 'awaiting_host_delivery',
+ onboardingComplete: false, hostSessionVerified: hostHandoff?.hostSessionVerified || false };
+}
+
if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
const appRoot = path.resolve(process.argv[2] || fileURLToPath(new URL('../', import.meta.url)));
if (process.argv[3] === '--check-contract') {
@@ -85,11 +150,29 @@ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToP
} else {
const defaults = JSON.parse(await readFile(path.join(appRoot, 'shared/template-config.json'), 'utf8'));
const options = { appRoot, dataDirectory: process.env.MOTION_DATA_DIR, templateEnvironment: process.env.MOTION_TEMPLATE_ENV || defaults.environment };
- const onboarding = await prepareInstallationOnboarding(options);
- const { WorkspaceStore } = await import('../workspace.ts');
- const hostHandoff = await prepareCodexHostHandoff({ dataDirectory: options.dataDirectory || new WorkspaceStore().directory,
- expectedVersion: JSON.parse(await readFile(path.join(appRoot, 'package.json'), 'utf8')).version });
- console.log(JSON.stringify({ ...onboarding, hostSessionVerified: hostHandoff.hostSessionVerified,
- hostHandoff, preview: await prepareInstallationPreview(options) }, null, 2));
+ const result = await prepareInstallationFlow(options);
+ if (process.argv.includes('--summary') && result.inlinePresentation?.status === 'prepared' && result.preview.status === 'ready') {
+ const { scheduleInstallationOnboarding } = await import('./onboarding-callback.mjs');
+ result.callback = await scheduleInstallationOnboarding({ appRoot, dataDirectory: result.dataDirectory,
+ version: JSON.parse(await readFile(path.join(appRoot, 'package.json'), 'utf8')).version,
+ onboarding: result, entry: 'source' });
+ if (result.callback.status === 'queued') result.onboardingStatus = 'callback_queued';
+ }
+ const { hostHandoff, preview } = result;
+ // Keep the decision and handoff visible instead of burying them after a long
+ // quoted success contract. The full contract remains available for the Agent.
+ if (process.argv.includes('--summary')) {
+ const detailsFile = path.join(appRoot, '.artifacts/install', `onboarding-${Date.now()}-${process.pid}.json`);
+ await mkdir(path.dirname(detailsFile), { recursive: true });
+ await writeFile(detailsFile, JSON.stringify(result, null, 2) + '\n', { mode: 0o600, flag: 'wx' });
+ if (!result.onboardingComplete) console.error('ONBOARDING_PENDING: ' + (result.callback?.reason || hostHandoff?.reason || result.callback?.status || result.onboardingStatus)
+ + '. Installation is registered; welcome/cards delivery remains unverified. '
+ + (result.inlinePresentation?.status === 'prepared'
+ ? 'The active callback must publish the verified document into this chat\'s permitted visualization directory, visibly open the template library and emit the published reference. '
+ : 'Open the library and report the required host action. ')
+ + 'Do not send a library-only success welcome or schedule a duplicate callback.');
+ if (preview.status !== 'ready') console.error('ONBOARDING_PENDING: ' + preview.warning);
+ console.log(JSON.stringify({ ...result, instructions: undefined, catalog: undefined, detailsFile }, null, 2));
+ } else console.log(JSON.stringify(result, null, 2));
}
}
diff --git a/scripts/npm-installer.mjs b/scripts/npm-installer.mjs
index 028135704..9a8540a6f 100644
--- a/scripts/npm-installer.mjs
+++ b/scripts/npm-installer.mjs
@@ -1,12 +1,12 @@
#!/usr/bin/env node
import assert from 'node:assert/strict';
-import { mkdir, mkdtemp, readFile, rename, rm } from 'node:fs/promises';
+import { lstat, mkdir, mkdtemp, readFile, rename, rm } from 'node:fs/promises';
import path from 'node:path';
import os from 'node:os';
import { realpathSync } from 'node:fs';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { parseArgs } from 'node:util';
-import { canonical, extractArchive, nativeComponents, obtainAsset, readJSON, relativePath, runFile, withLock, writeAtomic, writeJSON } from './runtime-assets.mjs';
+import { canonical, extractArchive, nativeComponents, obtainAsset, readJSON, relativePath, runFile, sha256, withLock, writeAtomic, writeJSON } from './runtime-assets.mjs';
import { ensureNativeRuntime, startNativePreparation } from './npm-runtime.mjs';
import { hosts, hostPlan, skillTargets, obsoleteSkills, checkSkillOwner, copyHostSkills } from './npm-hosts.mjs';
import { installedTool } from './mcp-client.mjs';
@@ -38,6 +38,7 @@ Setup options:
--dsh FILE Harness executable (macOS Desktop CLI is detected automatically)
--profile NAME Harness profile (default: web); use the selected host profile
--manifest FILE Explicit release manifest for controlled local installations
+ --onboarding-output FILE Optional host-readable HTML path override; Codex welcome/cards are prepared by default
Setup starts native preparation in the background; editing does not wait for it.
Use prepare to wait explicitly for every video component or retry failed preparation.
@@ -75,7 +76,14 @@ export async function localManifest(filename) {
}
export async function setup(options) {
+ if (options.onboardingOutput) {
+ assert((options.host || 'codex') === 'codex', 'Inline onboarding is selected by the Codex host only');
+ assert(path.isAbsolute(options.onboardingOutput) && options.onboardingOutput.endsWith('.html'), 'Use an absolute .html path readable by the calling host');
+ const present = await lstat(options.onboardingOutput).catch(error => { if (error.code !== 'ENOENT') throw error; return null; });
+ assert(!present, 'Refusing to overwrite an existing onboarding document');
+ }
const manifest = await localManifest(options.manifest || bundledManifest);
+ checkBundledDependencyTarget(manifest.bundledDependencies);
if (!options.manifest) assert.equal(manifest.version, (await readJSON(new URL('../package.json', import.meta.url))).version, 'Bundled application must match the npm package version');
const templateEnvironment = manifest.templateEnvironment ?? 'prod';
assert(['dev', 'prod'].includes(templateEnvironment), 'Invalid template environment');
@@ -113,8 +121,13 @@ export async function setup(options) {
for (const file of ['mcp.ts', 'scripts/npm-runtime.mjs', 'studio/build/index.html', 'skills/openmotion-production/SKILL.md']) await readFile(path.join(temporary, file));
assert(!contains(temporary, process.execPath), 'Node must remain external to the lightweight application');
const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');
- console.error('OpenMotion: installing locked npm runtime (no native media/browser download).');
- await runFile(process.execPath, [npm, 'ci', '--omit=dev', '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: temporary });
+ if (manifest.bundledDependencies) {
+ await verifyBundledDependencies(temporary, manifest.bundledDependencies);
+ console.error('OpenMotion: verified prebuilt npm runtime; no dependency download required.');
+ } else {
+ console.error('OpenMotion: installing locked npm runtime (no native media/browser download).');
+ await runFile(process.execPath, [npm, 'ci', '--omit=dev', '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: temporary });
+ }
await writeJSON(path.join(temporary, '.npm-install.json'), { schemaVersion: 1, applicationSHA256: manifest.application.sha256, installHome: home, commit: manifest.commit,
cacheDirectory: path.join(home, 'cache/native'), runtime: manifest.runtime, allowLocalAssets: true });
await rename(temporary, appRoot);
@@ -123,8 +136,8 @@ export async function setup(options) {
const installed = await readJSON(path.join(appRoot, '.npm-install.json'));
assert.equal(installed.applicationSHA256, manifest.application.sha256, 'Installed application identity mismatch');
assert.equal(JSON.stringify(installed.runtime), JSON.stringify(manifest.runtime), 'Native manifest changed for the same application; rebuild the application release');
- const { prepareInstallationOnboarding, prepareInstallationPreview } = await import(pathToFileURL(path.join(appRoot, 'scripts/install-onboarding.mjs')).href);
- const onboarding = await prepareInstallationOnboarding({ appRoot, dataDirectory, templateEnvironment });
+ const { prepareInstallationFlow, installationInstructions } = await import(pathToFileURL(path.join(appRoot, 'scripts/install-onboarding.mjs')).href);
+ await installationInstructions(appRoot);
const targets = await skillTargets(plan, appRoot), directories = [];
for (const target of targets) directories.push({ target, existed: await checkSkillOwner(target, home, plan.host, plan.layout), movedOld: false, movedNew: false });
for (const target of await obsoleteSkills(plan, home, targets)) directories.push({ target, existed: true, removeOnly: true, movedOld: false, movedNew: false });
@@ -150,13 +163,16 @@ export async function setup(options) {
await plan.register();
for (const item of directories) await rm(item.backup, { recursive: true, force: true }).catch(error => console.error('Old instruction backup retained: ' + error.message));
await startNativePreparation(appRoot).catch(error => console.error('OpenMotion: background preparation could not start; retry in Studio or run prepare. ' + error.message));
- if (plan.host === 'codex') {
- const { prepareCodexHostHandoff } = await import(pathToFileURL(path.join(appRoot, 'scripts/codex-host-handoff.mjs')).href);
- onboarding.hostHandoff = await prepareCodexHostHandoff({ dataDirectory, expectedVersion: manifest.version, codex: options.codex });
- onboarding.hostSessionVerified = onboarding.hostHandoff.hostSessionVerified;
+ const onboarding = await prepareInstallationFlow({ appRoot, dataDirectory, templateEnvironment,
+ host: plan.host, onboardingOutput: options.onboardingOutput, codex: options.codex, expectedVersion: manifest.version });
+ onboarding.directAccess = directAccess(home, plan.host, appRoot, options);
+ if (plan.host === 'codex' && onboarding.inlinePresentation?.status === 'prepared' && onboarding.preview.status === 'ready') {
+ const { scheduleInstallationOnboarding } = await import(pathToFileURL(path.join(appRoot, 'scripts/onboarding-callback.mjs')).href);
+ onboarding.callback = await scheduleInstallationOnboarding({ appRoot, dataDirectory, version: manifest.version,
+ onboarding, entry: 'npm', codex: options.codex });
+ if (onboarding.callback.status === 'queued') onboarding.onboardingStatus = 'callback_queued';
}
- onboarding.preview = await prepareInstallationPreview({ appRoot, dataDirectory });
- return { ...state, host: plan.host, hostInstallation: plan.metadata, nativeDependencies: 'background-preparation; status and retry available in Studio', onboarding: { ...onboarding, directAccess: directAccess(home, plan.host, appRoot, options) } };
+ return { ...state, host: plan.host, hostInstallation: plan.metadata, nativeDependencies: 'background-preparation; status and retry available in Studio', onboarding };
} catch (error) {
if (wroteLauncher && !previous) await rm(launcher, { force: true });
if (wroteState) { if (previous) await writeJSON(stateFile, previous); else await rm(stateFile, { force: true }); }
@@ -170,11 +186,30 @@ export async function setup(options) {
});
}
+export function checkBundledDependencyTarget(info) {
+ if (!info) return;
+ assert(info.platform === process.platform && info.arch === process.arch,
+ 'Prebuilt npm runtime targets ' + info.platform + '/' + info.arch + '; select the package for this machine');
+ assert(/^[a-f0-9]{64}$/.test(info.lockSHA256), 'Prebuilt npm runtime requires its dependency lock SHA256');
+}
+
+export async function verifyBundledDependencies(directory, info) {
+ checkBundledDependencyTarget(info);
+ assert.deepEqual(await readJSON(path.join(directory, '.bundled-dependencies.json')), info, 'Prebuilt npm runtime identity mismatch');
+ assert.equal(await sha256(path.join(directory, 'package-lock.json')), info.lockSHA256, 'Prebuilt npm runtime dependency lock mismatch');
+ const pkg = await readJSON(path.join(directory, 'package.json'));
+ for (const [name, version] of Object.entries(pkg.dependencies || {})) {
+ assert.equal((await readJSON(path.join(directory, 'node_modules', name, 'package.json')))?.version, version,
+ 'Prebuilt npm runtime is incomplete or stale: ' + name);
+ }
+}
+
export function directAccess(home, host, appRoot, options = {}) {
const flags = ['--home', home, '--host', host];
for (const key of ['codex', 'claude', 'dsh', 'profile']) if (options[key]) flags.push('--' + key, options[key]);
const cli = path.join(appRoot, 'scripts/npm-installer.mjs');
return { command: process.execPath, toolsArgs: [cli, 'tools', ...flags],
+ ...(host === 'codex' && process.env.CODEX_HOME ? { environment: { CODEX_HOME: process.env.CODEX_HOME } } : {}),
callArgs: [cli, 'call', 'TOOL', '--args-file', 'FILE.json', ...flags],
instructions: 'Use working native tools for this installation first. Otherwise execute toolsArgs with command in this same chat, read the returned inputSchema, then execute callArgs after replacing TOOL and FILE.json. Write arguments as a JSON object in a local file, without shell interpolation. Reuse the chosen template, project and request IDs; revision/version guards still apply. This is direct installed MCP access, not native host discovery or reconnection. Do not ask the user to restart or open a new chat to use it. Do not bypass disabled tools, permission denials or host policy. If shell execution is unavailable, use supported host recovery; ask for user action only when no permitted path works.' };
}
@@ -221,7 +256,7 @@ export async function diagnose(options) {
async function main() {
const { positionals, values } = parseArgs({ allowPositionals: true, options: {
manifest: { type: 'string' }, home: { type: 'string' }, 'data-dir': { type: 'string' }, 'skills-dir': { type: 'string' }, host: { type: 'string' }, codex: { type: 'string' }, claude: { type: 'string' }, dsh: { type: 'string' }, profile: { type: 'string' },
- help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' }, output: { type: 'string' }, 'args-file': { type: 'string' },
+ help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' }, output: { type: 'string' }, 'args-file': { type: 'string' }, 'onboarding-output': { type: 'string' },
} });
if (values.help) { console.log(usage); return; }
if (values.version) { console.log((await readJSON(new URL('../package.json', import.meta.url))).version); return; }
@@ -229,7 +264,7 @@ async function main() {
assert(positionals.length === (command === 'call' ? 2 : 1), usage);
if (command === 'setup') {
try {
- console.log(JSON.stringify(await setup({ manifest: values.manifest, home: values.home, dataDirectory: values['data-dir'], skillsDirectory: values['skills-dir'], host: values.host, codex: values.codex, claude: values.claude, dsh: values.dsh, profile: values.profile }), null, 2));
+ console.log(JSON.stringify(await setup({ manifest: values.manifest, home: values.home, dataDirectory: values['data-dir'], skillsDirectory: values['skills-dir'], host: values.host, codex: values.codex, claude: values.claude, dsh: values.dsh, profile: values.profile, onboardingOutput: values['onboarding-output'] }), null, 2));
} catch (error) {
const environment = (await readJSON(bundledManifest).catch(() => null))?.templateEnvironment;
await recordDiagnostic(values.home || defaultHome(environment), { kind: 'installation_failed', message: error.message });
diff --git a/scripts/onboarding-callback.mjs b/scripts/onboarding-callback.mjs
new file mode 100644
index 000000000..eed4909c4
--- /dev/null
+++ b/scripts/onboarding-callback.mjs
@@ -0,0 +1,57 @@
+import assert from 'node:assert/strict';
+import { createHash } from 'node:crypto';
+import { mkdir } from 'node:fs/promises';
+import path from 'node:path';
+import { canonical, readJSON, runFile, sha256, withLock, writeJSON } from './runtime-assets.mjs';
+
+// Public Codex queue API only. It targets the installation's calling chat and
+// never resumes a different daemon, restarts a host or treats an ack as display.
+export async function scheduleInstallationOnboarding({ appRoot, dataDirectory, version, onboarding, entry,
+ codex = 'codex', threadId = process.env.CODEX_THREAD_ID || process.env.CODEX_SESSION_ID }) {
+ const unavailable = reason => ({ status: 'unavailable', reason, presentationVerified: false });
+ if (!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(threadId || '')) return unavailable('CURRENT_CHAT_UNKNOWN');
+ threadId = threadId.toLowerCase();
+ const presentation = onboarding?.inlinePresentation;
+ if (onboarding?.preview?.status !== 'ready' || presentation?.status !== 'prepared') return unavailable('PRESENTATION_NOT_READY');
+ try {
+ appRoot = await canonical(appRoot); dataDirectory = await canonical(dataDirectory);
+ assert.equal(await sha256(presentation.path), presentation.sha256, 'Onboarding document changed before scheduling');
+ const key = createHash('sha256').update(JSON.stringify({ threadId, appRoot, dataDirectory, version,
+ resourceVersion: presentation.resourceVersion, language: presentation.language })).digest('hex');
+ const directory = path.join(dataDirectory, 'onboarding', 'callbacks', key);
+ await mkdir(directory, { recursive: true });
+ return await withLock(path.join(directory, 'schedule.lock'), async () => {
+ const stateFile = path.join(directory, 'callback.json'), previous = await readJSON(stateFile);
+ // An uncertain CLI outcome may already have persisted a message. Retain
+ // it for reconciliation instead of creating duplicate welcome turns.
+ if (previous) return previous;
+ const eventFile = path.join(directory, 'event.json');
+ await writeJSON(eventFile, { schemaVersion: 1, kind: 'openmotion.installation.onboarding',
+ entry, appRoot, dataDirectory, version, threadId, createdAt: new Date().toISOString(), onboarding });
+ const intent = { status: 'scheduling', eventFile, threadId, presentationVerified: false };
+ await writeJSON(stateFile, intent);
+ const message = 'OpenMotion installation completed (automatic onboarding callback). Event file: '
+ + JSON.stringify(eventFile) + '. Read that event and the installed .codex-plugin/onboarding/SKILL.md. '
+ + 'Reuse this exact installation and workspace. Complete the already-authorized welcome, three full video cards and template-library presentation in this chat. '
+ + 'This is a callback, not a request to reinstall, enqueue another callback, create a project or export. '
+ + 'When the actual host supports inline HTML, publish the verified runtime document into this chat\'s explicitly permitted visualization directory using scripts/inline-onboarding.mjs --publish-from PATH --sha256 SHA256 --host-directory DIRECTORY. '
+ + 'Do not emit a runtime/data path as a visualization reference. Open the event\'s real preview on the right and emit the published production content reference once. '
+ + 'Otherwise use working native presentation. Queue acknowledgment is not visible delivery; report a real host failure honestly.';
+ const args = ['queue', '--thread', threadId, '--message', message];
+ try {
+ const output = /\.[cm]?js$/i.test(codex)
+ ? await runFile(process.execPath, [codex, ...args], { timeout: 10_000 })
+ : await runFile(codex, args, { timeout: 10_000 });
+ const match = output.match(/Queued message ([a-f0-9-]+) for thread ([a-f0-9-]+)\./i);
+ assert(match && match[2] === threadId, 'No matching queue acknowledgment');
+ const result = { ...intent, status: 'queued', queuedMessageId: match[1], queuedAt: new Date().toISOString() };
+ await writeJSON(stateFile, result);
+ return result;
+ } catch {
+ const result = { ...intent, status: 'uncertain', reason: 'QUEUE_FAILED_OR_ACK_UNCONFIRMED' };
+ await writeJSON(stateFile, result);
+ return result;
+ }
+ });
+ } catch (error) { return unavailable(error.message); }
+}
diff --git a/scripts/package-npm.mjs b/scripts/package-npm.mjs
index 05fdcc43d..ca1de69b9 100644
--- a/scripts/package-npm.mjs
+++ b/scripts/package-npm.mjs
@@ -20,6 +20,14 @@ function isShowcaseAsset(file) {
return file === 'scripts/install-library-skill.mjs' || /^(?:examples|library)\//.test(file) || file.startsWith('docs/readme/');
}
+async function removeDependencySourceMaps(directory) {
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
+ const file = path.join(directory, entry.name);
+ if (entry.isDirectory()) await removeDependencySourceMaps(file);
+ else if (entry.isFile() && entry.name.endsWith('.map')) await rm(file);
+ }
+}
+
function rewriteGuideLinks(text, file, commit, localPaths = new Set()) {
const directory = path.posix.dirname(file);
const link = (target, image = false) => {
@@ -60,7 +68,7 @@ export function checkReleaseLocks(pkg, lockfile, runtime) {
}
}
-export async function packageNpm(output = path.join(root, 'dist/npm-local'), version, templateEnvironment) {
+export async function packageNpm(output = path.join(root, 'dist/npm-local'), version, templateEnvironment, { bundleRuntime = false } = {}) {
output = path.resolve(output);
const explicitVersion = version !== undefined;
if (explicitVersion) checkReleaseVersion(version);
@@ -84,7 +92,7 @@ export async function packageNpm(output = path.join(root, 'dist/npm-local'), ver
const application = path.join(temporary, 'application'), installer = path.join(temporary, 'installer');
await mkdir(application); await mkdir(path.join(installer, 'scripts'), { recursive: true });
const commit = (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim();
- const files = (await distributionFiles(releaseProfile)).filter(file => !isShowcaseAsset(file));
+ const files = await distributionFiles(releaseProfile, file => !isShowcaseAsset(file) && (!bundleRuntime || !file.endsWith('.map')));
const localPaths = new Set(files);
for (const file of files) {
let directory = path.posix.dirname(file);
@@ -120,14 +128,26 @@ export async function packageNpm(output = path.join(root, 'dist/npm-local'), ver
pkg.version = version; lockfile.version = version; lockfile.packages[''].version = version;
await writeJSON(path.join(application, 'package.json'), pkg);
await writeJSON(path.join(application, 'package-lock.json'), lockfile);
+ let bundledDependencies;
+ if (bundleRuntime) {
+ assert(Object.values(runtime.targets).some(target => target.platform === process.platform && target.arch === process.arch),
+ 'Build prebuilt npm dependencies on a supported target machine');
+ const npm = process.env.npm_execpath || path.join(path.dirname(process.execPath), process.platform === 'win32' ? 'node_modules/npm/bin/npm-cli.js' : '../lib/node_modules/npm/bin/npm-cli.js');
+ await runFile(process.execPath, [npm, 'ci', '--omit=dev', '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: application });
+ await removeDependencySourceMaps(path.join(application, 'node_modules'));
+ bundledDependencies = { platform: process.platform, arch: process.arch,
+ lockSHA256: await sha256(path.join(application, 'package-lock.json')) };
+ await writeJSON(path.join(application, '.bundled-dependencies.json'), bundledDependencies);
+ }
const plugin = JSON.parse(await readFile(path.join(application, '.codex-plugin/plugin.json'), 'utf8'));
plugin.version = version;
await writeJSON(path.join(application, '.codex-plugin/plugin.json'), plugin);
- const archive = path.join(output, `openmotion-application-${pkg.version}${templateConfig.environment === 'dev' ? '-dev' : ''}.tar.gz`);
- await runFile(process.platform === 'win32' ? path.join(process.env.SystemRoot, 'System32/tar.exe') : 'tar', ['-czf', archive, '-C', application, '.'], { env: { ...process.env, COPYFILE_DISABLE: '1' } });
+ const archive = path.join(output, `openmotion-application-${pkg.version}${templateConfig.environment === 'dev' ? '-dev' : ''}.tar.${bundleRuntime ? 'xz' : 'gz'}`);
+ await runFile(process.platform === 'win32' ? path.join(process.env.SystemRoot, 'System32/tar.exe') : 'tar', [bundleRuntime ? '-cJf' : '-czf', archive, '-C', application, '.'], { env: { ...process.env, COPYFILE_DISABLE: '1' } });
const manifest = { schemaVersion: 1, version: pkg.version, format: 'npm', templateEnvironment: templateConfig.environment,
commit, run: process.env.GITHUB_RUN_ID || null, attempt: process.env.GITHUB_RUN_ATTEMPT || '1',
application: { url: './' + path.basename(archive), sha256: await sha256(archive) },
+ ...(bundledDependencies ? { bundledDependencies } : {}),
locks: { npm: await sha256(path.join(application, 'package-lock.json')), native: await sha256(path.join(root, 'scripts/runtime-lock.json')) },
mcp: { profile: registry.profile, tools: registry.tools.map(tool => tool.name),
optionalExtensions: registry.profile === 'phase1' ? [{ name: 'openmotion_show_template_recommendations',
@@ -148,6 +168,6 @@ export async function packageNpm(output = path.join(root, 'dist/npm-local'), ver
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const args = process.argv.slice(2), flag = args.find(arg => arg.startsWith('--template-env='));
- const positional = args.filter(arg => arg !== flag);
- console.log(JSON.stringify(await packageNpm(positional[0], positional[1], flag?.split('=')[1]), null, 2));
+ const positional = args.filter(arg => arg !== flag && arg !== '--bundle-runtime');
+ console.log(JSON.stringify(await packageNpm(positional[0], positional[1], flag?.split('=')[1], { bundleRuntime: args.includes('--bundle-runtime') }), null, 2));
}
diff --git a/scripts/source-marketplace.mjs b/scripts/source-marketplace.mjs
new file mode 100644
index 000000000..e8c2c5048
--- /dev/null
+++ b/scripts/source-marketplace.mjs
@@ -0,0 +1,133 @@
+// Source-only installer helper; never shipped as part of the npm application.
+import assert from 'node:assert/strict';
+import { execFileSync, spawn } from 'node:child_process';
+import { createInterface } from 'node:readline';
+import { readFileSync, realpathSync, statSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+// Read the effective configuration through Codex's public protocol, including
+// disabled plugin entries. This short-lived stdio process never controls the
+// desktop host, reloads MCP, creates a chat or performs an installation.
+async function readMarketplaceState(codex) {
+ const child = spawn(codex, ['app-server', '--stdio'], { stdio: ['pipe', 'pipe', 'ignore'] });
+ const lines = createInterface({ input: child.stdout });
+ let timer;
+ try {
+ return await new Promise((resolve, reject) => {
+ timer = setTimeout(() => reject(new Error('Configuration read timed out')), 3000);
+ child.on('error', reject); child.stdin.on('error', reject);
+ child.on('exit', () => reject(new Error('Configuration reader closed')));
+ let bytes = 0;
+ const send = (id, method, params) => child.stdin.write(JSON.stringify({ id, method, params }) + '\n');
+ lines.on('line', line => {
+ try {
+ bytes += Buffer.byteLength(line);
+ assert(bytes < 4 * 1024 * 1024, 'Configuration response too large');
+ const message = JSON.parse(line);
+ if (message.error) throw new Error('Configuration read rejected');
+ if (message.id === 1) send(2, 'config/read', { includeLayers: false });
+ if (message.id !== 2) return;
+ const config = message.result?.config;
+ assert(config?.marketplaces && typeof config.marketplaces === 'object' && !Array.isArray(config.marketplaces)
+ && config.plugins && typeof config.plugins === 'object' && !Array.isArray(config.plugins));
+ resolve({ marketplace: config.marketplaces['openmotion-local'],
+ pluginIds: Object.keys(config.plugins).filter(id => id.endsWith('@openmotion-local')) });
+ } catch (error) { reject(error); }
+ });
+ send(1, 'initialize', { clientInfo: { name: 'openmotion_marketplace_preflight', version: '1' }, capabilities: { experimentalApi: true } });
+ });
+ } finally { clearTimeout(timer); lines.close(); child.stdin.end(); child.kill(); }
+}
+
+function staleSourcePlan(codex) {
+ const state = JSON.parse(execFileSync(process.execPath, [fileURLToPath(import.meta.url), '--read-marketplace-state', codex],
+ { encoding: 'utf8', timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'] }));
+ const source = state.marketplace;
+ assert(source?.source_type === 'local' && typeof source.source === 'string' && path.isAbsolute(source.source));
+ assert(Array.isArray(state.pluginIds));
+ assert(!state.pluginIds.length, 'OPENMOTION_SOURCE_IN_USE: cached or disabled plugins still use this marketplace; no configuration was changed.');
+ assert(!existingDirectory(source.source), 'The configured source still exists');
+ return { action: 'replace_uninstalled_source', previous: source.source };
+}
+
+// A checkout can disappear while its installed plugin remains in the host cache.
+// Filesystem absence never overrides the inventory's installed-plugin guard.
+function existingDirectory(value) {
+ try {
+ const resolved = realpathSync(value);
+ return statSync(resolved).isDirectory() ? resolved : null;
+ } catch (error) {
+ if (error.code === 'ENOENT' || error.code === 'ENOTDIR') return null;
+ throw error;
+ }
+}
+
+export function sourceMarketplacePlan(root, inventory) {
+ assert(Array.isArray(inventory.installed) && Array.isArray(inventory.available), 'Invalid Codex plugin inventory');
+ const entries = [...inventory.installed, ...inventory.available];
+ if (!entries.length) return { action: 'add' };
+ assert(entries.every(item => item.pluginId === 'openmotion@openmotion-local'), 'Refusing to replace a marketplace containing unrelated plugins');
+ const sources = [...new Set(entries.map(item => item.marketplaceSource?.source))];
+ assert(sources.length === 1 && entries.every(item => item.marketplaceSource?.sourceType === 'local' && typeof item.marketplaceSource.source === 'string' && item.marketplaceSource.source),
+ 'Refusing a non-local or ambiguous OpenMotion source');
+ const previous = existingDirectory(sources[0]);
+ if (previous && previous === realpathSync(root)) return { action: 'reuse' };
+ assert(!inventory.installed.length, 'OPENMOTION_SOURCE_IN_USE: another source is installed. Reuse that installation or explicitly select its upgrade; no configuration was changed.');
+ // Rebind a vanished source only when the host positively reported no install.
+ if (!previous) return { action: 'replace_uninstalled_source', previous: sources[0] };
+ const catalog = JSON.parse(readFileSync(path.join(previous, '.agents/plugins/marketplace.json'), 'utf8'));
+ const manifest = JSON.parse(readFileSync(path.join(previous, '.codex-plugin/plugin.json'), 'utf8'));
+ assert(catalog.name === 'openmotion-local' && catalog.plugins?.length === 1
+ && catalog.plugins[0].name === 'openmotion' && catalog.plugins[0].source?.source === 'local'
+ && catalog.plugins[0].source.path === './' && manifest.name === 'openmotion', 'Refusing to replace an unrecognized OpenMotion marketplace');
+ return { action: 'replace_uninstalled_source', previous };
+}
+
+export function registerSourceMarketplace(root, { checkOnly = false, codex = 'codex' } = {}) {
+ const run = args => execFileSync(codex, args, { encoding: 'utf8', timeout: 30_000, stdio: ['ignore', 'pipe', 'pipe'] });
+ const inventoryArgs = ['plugin', 'list', '--marketplace', 'openmotion-local', '--available', '--json'];
+ const retry = 'Retry `codex ' + inventoryArgs.join(' ') + '`. No host configuration was changed.';
+ let output, inventory;
+ try { output = run(inventoryArgs); }
+ catch {
+ let recovered;
+ try { recovered = staleSourcePlan(codex); }
+ catch (error) {
+ if (error.message.includes('OPENMOTION_SOURCE_IN_USE')) throw error;
+ throw new Error('OPENMOTION_INVENTORY_UNAVAILABLE: Codex could not read the plugin inventory or verify an unused missing local source. Restore any moved/deleted configured marketplace source, or check CLI compatibility and permissions. ' + retry);
+ }
+ if (checkOnly) return recovered;
+ run(['plugin', 'marketplace', 'remove', 'openmotion-local']);
+ run(['plugin', 'marketplace', 'add', root]);
+ return recovered;
+ }
+ try {
+ inventory = JSON.parse(output);
+ assert(inventory && Array.isArray(inventory.installed) && Array.isArray(inventory.available));
+ } catch {
+ throw new Error('OPENMOTION_INVENTORY_INVALID: Codex must return JSON with installed and available arrays. Use a compatible Codex CLI. ' + retry);
+ }
+ const plan = sourceMarketplacePlan(root, inventory);
+ if (checkOnly || plan.action === 'reuse') return plan;
+ if (plan.previous) run(['plugin', 'marketplace', 'remove', 'openmotion-local']);
+ try { run(['plugin', 'marketplace', 'add', root]); }
+ catch (error) {
+ if (plan.previous && existingDirectory(plan.previous)) {
+ try { run(['plugin', 'marketplace', 'add', plan.previous]); }
+ catch { throw new Error('Marketplace registration and rollback failed; restore the previous OpenMotion source: ' + plan.previous); }
+ }
+ throw error;
+ }
+ return plan;
+}
+
+if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
+ try {
+ const result = process.argv[2] === '--read-marketplace-state'
+ ? await readMarketplaceState(process.argv[3])
+ : registerSourceMarketplace(path.resolve(process.argv[2]), { checkOnly: process.argv.includes('--check') });
+ console.log(JSON.stringify(result));
+ }
+ catch (error) { console.error(error.message); process.exitCode = 1; }
+}
diff --git a/studio/src/i18n/mcp-ui.json b/studio/src/i18n/mcp-ui.json
index 36e50064d..b78289b79 100644
--- a/studio/src/i18n/mcp-ui.json
+++ b/studio/src/i18n/mcp-ui.json
@@ -194,6 +194,8 @@
"Can I continue with another Agent?": "可以换一个 Agent 继续做吗?",
"Yes. Connect a compatible Agent to the same workspace and ask it to read the saved project before editing. Projects and assets can be reused; provide any conversation context it needs separately.": "可以。将兼容的 Agent 接入同一工作区,让它读取已保存的工程再继续编辑。工程和素材可以复用,需要的聊天上下文请另行提供。",
"Copy this instruction to your Agent to install and connect OpenMotion.": "复制指令发给 Agent,让它帮你安装并接入 OpenMotion。",
- "Tell your Agent what you want to make. Start with an idea, your material or a template.": "告诉 Agent 想做什么,从想法、素材或模板开始。"
+ "Tell your Agent what you want to make. Start with an idea, your material or a template.": "告诉 Agent 想做什么,从想法、素材或模板开始。",
+ "Clients that negotiate MCP Apps can discover optional template cards and the final-video player. Codex installation callbacks can also show the welcome and three video cards through a supported inline renderer while opening the template library. This does not verify native MCP discovery. Other clients use the local library, editor and video links; host support varies.": "协商 MCP Apps 的客户端可发现可选模板卡片和成片播放器。Codex 安装回调也可通过宿主支持的内联渲染器展示欢迎与三张视频卡片,同时打开模板库。这不代表原生 MCP 工具已被发现。其他客户端使用本地模板库、编辑器和视频链接;具体取决于宿主支持。",
+ "Codex inline onboarding or MCP Apps; final video requires MCP Apps": "Codex 内联欢迎流程或 MCP Apps;成片播放器需要 MCP Apps"
}
}
diff --git a/studio/src/motion/mcpCapabilities.ts b/studio/src/motion/mcpCapabilities.ts
index 759abba64..082a78950 100644
--- a/studio/src/motion/mcpCapabilities.ts
+++ b/studio/src/motion/mcpCapabilities.ts
@@ -31,7 +31,7 @@ export const mcpFaq = [
['Can ChatGPT cloud connect to this workspace?', 'This installation exposes local stdio, not a public HTTPS MCP endpoint. Use a local Agent or compatible desktop MCP client. The editor URL is not an MCP server URL.'],
['Can I recreate a reference video?', 'Yes. Give your Agent the reference and your brand. The recreation Skill analyses and rebuilds the film as editable source. Access to the reference, media understanding and fidelity depend on the host and supplied material.'],
['Where do I find my finished work?', 'Projects, source files, assets and versions stay in your local OpenMotion workspace. Open the project in Studio or ask a connected Agent to read it and continue. Completed exports provide the MP4.'],
- ['Can I see templates and videos inside my Agent?', 'Clients that negotiate MCP Apps can discover optional template recommendation cards and the final-video player. Other clients use the same local template library, editor and video links. Host support varies.'],
+ ['Can I see templates and videos inside my Agent?', 'Clients that negotiate MCP Apps can discover optional template cards and the final-video player. Codex installation callbacks can also show the welcome and three video cards through a supported inline renderer while opening the template library. This does not verify native MCP discovery. Other clients use the local library, editor and video links; host support varies.'],
['How do I disconnect an Agent?', 'Remove the OpenMotion MCP entry or plugin in that Agent. This does not delete projects. Remove provider credentials separately in Model providers if you no longer want generation access.'],
['Does connecting start generation or spend credits?', 'No. Copying setup instructions, browsing templates and checking a connection do not start media generation. Provider requests may incur charges; ask your Agent to confirm the model, scope and cost first.'],
] as const;
@@ -57,5 +57,5 @@ export const mcpClientComparison = [
['Local material', 'Explicit local file paths', 'Host file access required', 'Not available'],
['Version history and restoration', 'Supported', 'Requires tools and resource support', 'Not available'],
['Preview and MP4 export', 'Local Studio and export links', 'Local Studio and export links', 'Not available'],
- ['Inline template cards and final video', 'Requires MCP Apps negotiation', 'Requires MCP Apps negotiation', 'Not available'],
+ ['Inline template cards and final video', 'Codex inline onboarding or MCP Apps; final video requires MCP Apps', 'Requires MCP Apps negotiation', 'Not available'],
] as const;
diff --git a/tests/bootstrap.test.ts b/tests/bootstrap.test.ts
index 92c2abd4d..8e3badd13 100644
--- a/tests/bootstrap.test.ts
+++ b/tests/bootstrap.test.ts
@@ -17,7 +17,7 @@ async function fixture(run: (context: { directory: string; destination: string;
const destination = path.join(directory, 'new user', 'open-motion');
const log = path.join(directory, 'commands.log');
await mkdir(bin);
- for (const file of ['scripts/install-motion.command', 'scripts/install-onboarding.mjs', 'scripts/codex-host-handoff.mjs', 'scripts/runtime-assets.mjs',
+ for (const file of ['scripts/install-motion.command', 'scripts/source-marketplace.mjs', 'scripts/install-onboarding.mjs', 'scripts/codex-host-handoff.mjs', 'scripts/runtime-assets.mjs',
'docs/install.md', 'shared/template-config.json', 'marketplace.example.json']) {
await mkdir(path.dirname(path.join(source, file)), { recursive: true });
await copyFile(path.join(root, file), path.join(source, file));
@@ -27,9 +27,9 @@ async function fixture(run: (context: { directory: string; destination: string;
await writeFile(path.join(source, 'package.json'), JSON.stringify({ type: 'module', version: '0.0.1' }));
// No remote catalog or template assets in this isolated checkout: exercise the bundled fallback.
const commands = {
- git: 'echo "git $*" >> "$MOTION_TEST_LOG"\n[ "${MOTION_TEST_DOWNLOAD_FAIL:-0}" = 0 ] || exit 8\n[ "$1" = clone ] || exit 0\nfor destination; do :; done\nmkdir -p "$destination"\ncp -R "$MOTION_TEST_SOURCE/." "$destination/"',
+ git: 'echo "git $*" >> "$MOTION_TEST_LOG"\n[ "${MOTION_TEST_DOWNLOAD_FAIL:-0}" = 0 ] || exit 8\nwhile [ "$1" = -c ]; do shift 2; done\n[ "$1" = clone ] || exit 0\nfor destination; do :; done\nmkdir -p "$destination"\ncp -R "$MOTION_TEST_SOURCE/." "$destination/"',
npm: 'echo "npm $*" >> "$MOTION_TEST_LOG"\nif [ "$1" = ci ]; then [ "${MOTION_TEST_DEPENDENCY_FAIL:-0}" = 0 ] || exit 9; fi\nif [ "$*" = "run build:studio" ]; then [ "${MOTION_TEST_BUILD_FAIL:-0}" = 0 ] || exit 9; mkdir -p studio/build; touch studio/build/index.html; fi',
- codex: 'echo "codex $*" >> "$MOTION_TEST_LOG"\n[ "${MOTION_TEST_OLD_CODEX:-0}" = 0 ] || exit 10',
+ codex: '[ "$*" != "plugin list --marketplace openmotion-local --available --json" ] || { printf \'{"installed":[],"available":[]}\\n\'; exit 0; }\n' + 'echo "codex $*" >> "$MOTION_TEST_LOG"\n[ "${MOTION_TEST_OLD_CODEX:-0}" = 0 ] || exit 10',
node: 'case "${1:-}" in\n */check-installed-mcp.mjs) echo "MCP check" >> "$MOTION_TEST_LOG"; exit "${MOTION_TEST_MCP_FAIL:-0}" ;;\nesac\nexec "$MOTION_TEST_NODE" "$@"',
};
for (const [name, command] of Object.entries(commands)) {
@@ -37,6 +37,9 @@ async function fixture(run: (context: { directory: string; destination: string;
}
await run({ directory, destination, log, env: { ...process.env, PATH: bin + path.delimiter + process.env.PATH,
OPENMOTION_INSTALL_DIR: destination, OPENMOTION_REF: 'test-ref', MOTION_TEST_SOURCE: source,
+ // Exercise a known calling chat without inheriting a developer's real
+ // session or relying on CI to provide one. The control socket is absent.
+ CODEX_THREAD_ID: '11111111-1111-4111-8111-111111111111', CODEX_SESSION_ID: '',
OPENMOTION_CODEX_SOCKET: path.join(directory, 'absent-host.sock'),
MOTION_TEST_NODE: process.execPath, MOTION_TEST_LOG: log } });
} finally { await rm(directory, { recursive: true, force: true }); }
@@ -48,22 +51,66 @@ test('remote entry point builds a fresh checkout before registering and checking
assert.equal(result.status, 0, result.stderr);
await access(path.join(destination, 'studio/build/index.html'));
const commands = await readFile(log, 'utf8');
- assert.match(commands, /git clone --depth 1 --branch test-ref -- https:\/\/github\.com\/nexu-io\/openmotion\.git/);
+ assert.match(commands, /git .*clone --depth 1 --single-branch --branch test-ref -- https:\/\/github\.com\/nexu-io\/openmotion\.git/);
assert.ok(commands.indexOf('npm ci --include=dev') < commands.indexOf('npm run build:studio'));
assert.ok(commands.indexOf('npm run build:studio') < commands.indexOf('codex plugin marketplace add'));
assert.match(commands, /codex plugin add openmotion@openmotion-local\ncodex plugin list --marketplace openmotion-local\nMCP check/);
- assert.match(result.stdout, /OpenMotion registration and independent MCP preflight succeeded/);
- const onboarding = JSON.parse(result.stdout.slice(result.stdout.indexOf('\n{') + 1));
+ assert.match(result.stderr, /ONBOARDING_PENDING.*HOST_CONTROL_UNAVAILABLE/);
+ const onboarding = JSON.parse(result.stdout.slice(result.stdout.indexOf('\n{\n') + 1).split('\n[OpenMotion]')[0]);
assert.equal(onboarding.hostSessionVerified, false);
assert.equal(onboarding.hostHandoff.status, 'host_action_required');
assert.equal(onboarding.hostHandoff.presentationVerified, false);
- assert.match(onboarding.instructions, /OpenMotion 安装好啦/);
- assert.equal(onboarding.catalog.source, 'bundled');
+ assert.equal(onboarding.installationStatus, 'installed');
+ assert.equal(onboarding.onboardingStatus, 'host_action_required');
+ assert.equal(onboarding.instructions, undefined);
+ assert.match(await readFile(onboarding.detailsFile, 'utf8'), /Installation-success reply/);
+ assert.equal(JSON.parse(await readFile(onboarding.detailsFile, 'utf8')).catalog.source, 'bundled');
assert.equal(onboarding.preview.status, 'ready');
+ assert.ok(result.stdout.length < 7000, 'terminal summary must not include the full success contract');
+ const phases = (await readFile(path.join(destination, '.artifacts/install/timings.jsonl'), 'utf8'))
+ .trim().split('\n').map(line => JSON.parse(line));
+ assert.deepEqual(phases.map(phase => phase.phase), ['source-download', 'source-preflight', 'dependencies', 'studio-build', 'marketplace', 'plugin', 'mcp-preflight', 'onboarding']);
+ assert(phases.every(phase => Number.isInteger(phase.seconds) && phase.seconds >= 0));
assert.ok(commands.indexOf('MCP check') < commands.indexOf('Template library prepared'));
});
});
+test('source setup without a calling chat reports that boundary without invoking host control', async () => {
+ await fixture(async ({ log, env }) => {
+ const result = spawnSync('bash', [path.join(root, 'install.sh')], {
+ env: { ...env, CODEX_THREAD_ID: '', CODEX_SESSION_ID: '' }, encoding: 'utf8',
+ });
+ assert.equal(result.status, 0, result.stderr);
+ assert.match(result.stderr, /ONBOARDING_PENDING.*CURRENT_CHAT_UNKNOWN/);
+ const onboarding = JSON.parse(result.stdout.slice(result.stdout.indexOf('\n{\n') + 1).split('\n[OpenMotion]')[0]);
+ assert.equal(onboarding.installationStatus, 'installed');
+ assert.equal(onboarding.hostHandoff.reason, 'CURRENT_CHAT_UNKNOWN');
+ assert.equal(onboarding.hostHandoff.hostSessionVerified, false);
+ assert.equal(onboarding.hostHandoff.presentationVerified, false);
+ assert.doesNotMatch(await readFile(log, 'utf8'), /codex (?:queue|app-server)/);
+ });
+});
+
+test('prepared inline cards without a calling chat still lead with pending and publication instructions', async () => {
+ await fixture(async ({ log, env }) => {
+ await copyFile(path.join(root, 'scripts/onboarding-callback.mjs'), path.join(env.MOTION_TEST_SOURCE!, 'scripts/onboarding-callback.mjs'));
+ // Exercise the prepared-but-undelivered protocol without rendering a widget,
+ // starting a real preview or sending any message to the developer's chat.
+ await writeFile(path.join(env.MOTION_TEST_SOURCE!, 'scripts/inline-onboarding.mjs'), `export async function prepareInlineOnboarding({output, language}) { return {status:'prepared', path:output, sha256:'0'.repeat(64), language}; }`);
+ const result = spawnSync('bash', [path.join(root, 'install.sh')], {
+ env: { ...env, CODEX_THREAD_ID: '', CODEX_SESSION_ID: '' }, encoding: 'utf8',
+ });
+ assert.equal(result.status, 0, result.stderr);
+ assert.match(result.stderr, /ONBOARDING_PENDING.*CURRENT_CHAT_UNKNOWN/);
+ assert.match(result.stderr, /publish.*permitted visualization directory/);
+ const onboarding = JSON.parse(result.stdout.slice(result.stdout.indexOf('\n{\n') + 1).split('\n[OpenMotion]')[0]);
+ assert.equal(onboarding.inlinePresentation.status, 'prepared');
+ assert.equal(onboarding.onboardingComplete, false);
+ assert.equal(onboarding.callback.reason, 'CURRENT_CHAT_UNKNOWN');
+ assert.doesNotMatch(await readFile(log, 'utf8'), /codex queue/);
+ });
+});
+
for (const kind of ['directory', 'symlink']) {
test(`existing ${kind} is protected without downloading or registering`, async () => {
await fixture(async ({ directory, destination, log, env }) => {
@@ -95,6 +142,22 @@ test('a prebuilt distribution skips dependency installation and editor build', a
});
});
+test('repeat source setup reuses the build and preserves earlier diagnostic evidence', async () => {
+ await fixture(async ({ destination, log, env }) => {
+ const first = spawnSync('bash', [path.join(root, 'install.sh')], { env, encoding: 'utf8' });
+ assert.equal(first.status, 0, first.stderr);
+ const directory = path.join(destination, '.artifacts/install');
+ const before = await readFile(path.join(directory, 'timings.jsonl'), 'utf8');
+ const summary = JSON.parse(first.stdout.slice(first.stdout.indexOf('\n{\n') + 1).split('\n[OpenMotion]')[0]);
+ const originalDetails = await readFile(summary.detailsFile, 'utf8');
+ const second = spawnSync('bash', [path.join(destination, 'scripts/install-motion.command')], { env, encoding: 'utf8' });
+ assert.equal(second.status, 0, second.stderr);
+ assert.equal((await readFile(log, 'utf8')).match(/npm ci/g)?.length, 1);
+ assert((await readFile(path.join(directory, 'timings.jsonl'), 'utf8')).startsWith(before));
+ assert.equal(await readFile(summary.detailsFile, 'utf8'), originalDetails);
+ });
+});
+
for (const [failure, expected] of [
['MOTION_TEST_OLD_CODEX', /不支持插件安装/],
['MOTION_TEST_DOWNLOAD_FAIL', null],
@@ -118,6 +181,10 @@ test('MCP verification failure is reported even after plugin registration', asyn
assert.notEqual(result.status, 0);
assert.match(await readFile(log, 'utf8'), /plugin add openmotion@openmotion-local/);
assert.doesNotMatch(result.stdout, /preflight succeeded|Installation-success reply/);
+ const phases = (await readFile(path.join(env.OPENMOTION_INSTALL_DIR!, '.artifacts/install/timings.jsonl'), 'utf8'))
+ .trim().split('\n').map(line => JSON.parse(line));
+ assert.equal(phases.at(-1).phase, 'mcp-preflight');
+ assert.equal(phases.at(-1).exitCode, 1, 'a failed phase must retain its actual failure status');
});
});
@@ -144,3 +211,17 @@ test('the onboarding entry runs through a symlinked checkout path', async () =>
assert.equal(onboarding.catalog.source, 'bundled');
});
});
+
+
+test('the source entry overrides broken global LFS filters without downloading optional media', async () => {
+ await fixture(async ({ log, env }) => {
+ const git = path.join(env.PATH!.split(path.delimiter)[0], 'git');
+ const original = await readFile(git, 'utf8');
+ await writeFile(git, original.replace('while [ "$1" = -c ]; do shift 2; done',
+ '[ "$1" = -c ] || { echo "git-lfs: command not found" >&2; exit 128; }\nwhile [ "$1" = -c ]; do shift 2; done\nwhile [ "$1" = -c ]; do shift 2; done\n[ "$1" = clone ] || exit 0'));
+ const result = spawnSync('bash', [path.join(root, 'install.sh')], { env, encoding: 'utf8' });
+ assert.equal(result.status, 0, result.stderr);
+ assert.match(await readFile(log, 'utf8'), /filter\.lfs\.process= .*filter\.lfs\.required=false/);
+ assert.match(result.stdout, /source-download.*seconds/);
+ });
+});
diff --git a/tests/bundled-npm-runtime.test.ts b/tests/bundled-npm-runtime.test.ts
new file mode 100644
index 000000000..0b9de10b8
--- /dev/null
+++ b/tests/bundled-npm-runtime.test.ts
@@ -0,0 +1,23 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { checkBundledDependencyTarget, verifyBundledDependencies } from '../scripts/npm-installer.mjs';
+import { sha256, writeJSON } from '../scripts/runtime-assets.mjs';
+
+test('prebuilt dependency verification rejects incompatible machines, modified locks and incomplete bundles', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'motion-prebuilt-deps-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ await writeFile(path.join(directory, 'package-lock.json'), '{"lockfileVersion":3}');
+ await writeJSON(path.join(directory, 'package.json'), { dependencies: { fixture: '1.2.3' } });
+ const info = { platform: process.platform, arch: process.arch, lockSHA256: await sha256(path.join(directory, 'package-lock.json')) };
+ await writeJSON(path.join(directory, '.bundled-dependencies.json'), info);
+ assert.throws(() => checkBundledDependencyTarget({ ...info, arch: 'incompatible' }), /select the package/);
+ await assert.rejects(verifyBundledDependencies(directory, info), /incomplete or stale/);
+ await mkdir(path.join(directory, 'node_modules/fixture'), { recursive: true });
+ await writeJSON(path.join(directory, 'node_modules/fixture/package.json'), { version: '1.2.3' });
+ await verifyBundledDependencies(directory, info);
+ await writeFile(path.join(directory, 'package-lock.json'), 'modified');
+ await assert.rejects(verifyBundledDependencies(directory, info), /dependency lock mismatch/);
+});
diff --git a/tests/fixtures/account-cli.mjs b/tests/fixtures/account-cli.mjs
index fd2ae1ecb..c9e16b1ff 100755
--- a/tests/fixtures/account-cli.mjs
+++ b/tests/fixtures/account-cli.mjs
@@ -1,6 +1,6 @@
#!/usr/bin/env node
// Synthetic account connector. Never contacts an account service or reads user credentials.
-import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
import path from 'node:path';
const home = process.env.AMR_HOME;
if (!home || !home.includes('motion-')) throw new Error('Use an isolated OpenMotion fixture directory');
@@ -12,7 +12,11 @@ if (args[0] === 'login') {
const timer = setInterval(() => {
if (!existsSync(path.join(home, 'authorize'))) return;
clearInterval(timer);
- writeFileSync(path.join(home, 'config.json'), JSON.stringify({ profiles: { prod: { runtimeKey: 'synthetic-private-account-key', user: { name: 'Fixture user', email: 'fixture@example.test' } } } }), { mode: 0o600 });
+ // Polling readers must see either absent/old credentials or the complete
+ // new JSON, never the truncate/write interval of a direct overwrite.
+ const target = path.join(home, 'config.json'), temporary = target + '.' + process.pid + '.tmp';
+ writeFileSync(temporary, JSON.stringify({ profiles: { prod: { runtimeKey: 'synthetic-private-account-key', user: { name: 'Fixture user', email: 'fixture@example.test' } } } }), { mode: 0o600 });
+ renameSync(temporary, target);
console.log('OPEN_DESIGN_AMR_AUTH_COMPLETION\tcredentials_persisted');
}, 20);
process.stdin.on('data', data => { if (String(data).includes('credentials_accepted')) process.exit(0); else process.exit(1); });
diff --git a/tests/inline-onboarding.test.ts b/tests/inline-onboarding.test.ts
new file mode 100644
index 000000000..c2ed2f19b
--- /dev/null
+++ b/tests/inline-onboarding.test.ts
@@ -0,0 +1,89 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { Window } from 'happy-dom';
+import { renderInlineOnboarding, prepareInlineOnboarding, publishInlineOnboarding } from '../scripts/inline-onboarding.mjs';
+import { prepareInstallationOnboarding } from '../scripts/install-onboarding.mjs';
+
+const appRoot = fileURLToPath(new URL('../', import.meta.url));
+test('onboarding locale tags normalize to a supported language and other languages fall back to English', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-onboarding-language-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ for (const [language, expected] of [['zh-CN', 'zh'], ['FR-ca', 'fr'], ['ja_JP', 'ja'], ['de', 'en'], ['it', 'en']]) {
+ const result = await prepareInlineOnboarding({ appRoot, output: path.join(directory, language + '.html'), language });
+ assert.equal(result.status, 'prepared');
+ assert.equal(result.language, expected);
+ assert.deepEqual(result.templateIds, ['product-promo', 'nyt-graph', 'decision-tree']);
+ }
+});
+test('default installation prepares all three production cards in its own workspace without presentation flags', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-default-onboarding-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ const result = await prepareInstallationOnboarding({ appRoot, dataDirectory: directory, templateEnvironment: 'prod', language: 'zh' });
+ assert.equal(result.inlinePresentation?.status, 'prepared');
+ assert.deepEqual(result.inlinePresentation.templateIds, ['product-promo', 'nyt-graph', 'decision-tree']);
+ assert.equal(result.inlinePresentation.language, 'zh');
+ assert(path.resolve(result.inlinePresentation.path).startsWith(directory + path.sep));
+ assert.equal((await stat(result.inlinePresentation.path)).size, result.inlinePresentation.bytes);
+ assert.equal(result.hostSessionVerified, false, 'Preparing content is not a host delivery acknowledgment');
+});
+test('the inline renderer mounts the production welcome and three real media cards without an MCP connection', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-inline-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ const output = path.join(directory, 'welcome.html');
+ const result = await renderInlineOnboarding({ appRoot, output, language: 'zh' });
+ assert.equal(result.nativeMcpSessionVerified, false);
+ assert.deepEqual(result.templateIds, ['product-promo', 'nyt-graph', 'decision-tree']);
+ assert(result.bytes < 1_000_000);
+ const fragment = await readFile(output, 'utf8');
+ assert.doesNotMatch(fragment, /]|]|]/i);
+ assert.doesNotMatch(fragment, /__OPENMOTION_INLINE_/);
+ const window = new Window();
+ t.after(() => window.happyDOM.abort());
+ window.URL.createObjectURL = () => 'blob:verified-template';
+ window.URL.revokeObjectURL = () => {};
+ window.document.body.innerHTML = fragment;
+ for (const script of window.document.querySelectorAll('script')) window.eval(script.textContent!);
+ assert.equal(window.document.querySelectorAll('.omtc-card').length, 3);
+ assert.match(window.document.querySelector('.omtc-welcome')!.textContent!, /我是你的开源视频创作搭档/);
+ assert.equal(window.document.querySelectorAll('.omtc-card video[src^="blob:"]').length, 3);
+ (window.document.querySelector('.omtc-card .omtc-clone') as any).click();
+ const draft = window.document.querySelector('textarea')!;
+ assert.match(draft.value, /product-promo/);
+ assert.match(draft.value, /我的要求/);
+ assert.equal(draft.readOnly, true, 'an unsupported composer bridge must expose the copyable brief');
+ await assert.rejects(renderInlineOnboarding({ appRoot, output, language: 'zh' }), /EEXIST/);
+ assert.equal(await readFile(output, 'utf8'), fragment);
+});
+
+test('the Node CLI renderer works from the installed runtime without development dependencies', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-inline-cli-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ const output = path.join(directory, 'welcome.html');
+ const result = await prepareInlineOnboarding({ appRoot, output, language: 'fr' });
+ assert.equal(result.status, 'prepared'); assert.equal(result.language, 'fr');
+ assert.equal(result.publicationRequired, true);
+ assert.equal(result.contentReference, undefined, 'A runtime path is not a host-authorized visualization reference');
+ assert.equal((await stat(output)).size, result.bytes);
+});
+
+test('host publication verifies and copies the real component to an explicitly supplied readable directory', async t => {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-publish-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ const prepared = await renderInlineOnboarding({ appRoot, output: path.join(directory, 'runtime/welcome.html'), language: 'zh' });
+ const hostDirectory = path.join(directory, 'host-thread-visualizations');
+ const published = await publishInlineOnboarding({ source: prepared.path, expectedSHA256: prepared.sha256, hostDirectory });
+ assert.equal(published.status, 'published');
+ assert.equal(published.sha256, prepared.sha256);
+ assert.match(published.contentReference, /visualize/);
+ assert.equal(JSON.parse(published.contentReference.split('\ue202')[1].split('\ue201')[0]).path, published.path);
+ assert(published.path.startsWith(hostDirectory + path.sep));
+ assert.equal(await readFile(published.path, 'utf8'), await readFile(prepared.path, 'utf8'));
+ await assert.rejects(publishInlineOnboarding({ source: prepared.path, expectedSHA256: '0'.repeat(64), hostDirectory }), /SHA256/);
+ await writeFile(published.path, 'existing unrelated content');
+ await assert.rejects(publishInlineOnboarding({ source: prepared.path, expectedSHA256: prepared.sha256, hostDirectory }), /Refusing to overwrite/);
+ assert.equal(await readFile(published.path, 'utf8'), 'existing unrelated content');
+});
diff --git a/tests/npm-distribution-selection.test.ts b/tests/npm-distribution-selection.test.ts
new file mode 100644
index 000000000..ef76fe28d
--- /dev/null
+++ b/tests/npm-distribution-selection.test.ts
@@ -0,0 +1,11 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { distributionFiles } from '../scripts/distribution.ts';
+
+test('application selection validates only its selected positive-list files', async () => {
+ assert.deepEqual(await distributionFiles('phase1', file => file === '.codex-plugin/plugin.json'), ['.codex-plugin/plugin.json']);
+});
+
+test('an empty application selection does not require optional showcase downloads', async () => {
+ assert.deepEqual(await distributionFiles('phase1', () => false), []);
+});
diff --git a/tests/npm-package.test.ts b/tests/npm-package.test.ts
index f7e44df07..e1ec603f0 100644
--- a/tests/npm-package.test.ts
+++ b/tests/npm-package.test.ts
@@ -122,6 +122,15 @@ test('test npm artifacts contain their application, locked manifest and no bundl
assert.equal(await readFile(path.join(application, filename), 'utf8'), await readFile(filename, 'utf8'));
}
assert.equal((await json(path.join(application, 'package-lock.json'))).packages[''].version, version);
+ const installedLock = await json(path.join(application, 'package-lock.json'));
+ for (const name of ['@phosphor-icons/react', '@base-ui/react', '@codemirror/view', 'dockview-react', 'mediabunny']) {
+ assert.equal(installedLock.packages['node_modules/' + name].dev, true,
+ 'Prebuilt Studio must not redownload its build-only dependency at setup: ' + name);
+ }
+ for (const name of ['hyperframes', '@hyperframes/core', '@hyperframes/studio-server', 'gsap', 'puppeteer-core', 'fontkit']) {
+ assert.notEqual(installedLock.packages['node_modules/' + name].dev, true,
+ 'Editing/export runtime must remain installable in production: ' + name);
+ }
assert.equal((await json(path.join(installer, 'package/package.json'))).version, version);
assert.equal((await json(path.join(installer, 'package/package.json'))).private, false);
const bundled = path.join(installer, 'package/payload');
@@ -136,6 +145,7 @@ test('test npm artifacts contain their application, locked manifest and no bundl
const cli = path.join(installer, 'package', metadata.bin.openmotion);
assert.equal((await runFile(process.execPath, [cli, '--version'])).trim(), version);
const help = await runFile(process.execPath, [cli, 'setup', '--help']);
+ assert(help.includes('--onboarding-output'), 'The prebuilt installer must expose the no-reload presentation route');
for (const host of ['codex', 'claude', 'deepseek', 'workbuddy']) assert(help.includes(host), host);
await readFile(path.join(installer, 'package/LICENSE'));
assert.deepEqual((await readdir(path.join(application, 'skills'))).sort(), [...packagedSkills].sort());
@@ -157,6 +167,8 @@ test('test npm artifacts contain their application, locked manifest and no bundl
assert(entries.includes('skills/openmotion-recreate/scripts/measure_frame.mjs'));
assert(entries.includes('skills/openmotion-recreate/references/verify.md'));
assert(entries.includes('studio/build/index.html'));
+ assert(entries.includes('scripts/inline-onboarding.mjs'));
+ assert(entries.includes('mcp-ui/template-recommendations/inline.fragment.html'));
assert(entries.includes('shared/editor-launch.pl'), 'macOS shared editor launcher must ship');
for (const script of ['lint-project.mjs', 'npm-installer.mjs', 'npm-hosts.mjs', 'check-installed-mcp.mjs', 'mcp-client.mjs', 'diagnostics.mjs', 'zip.mjs', 'diagnostic-redaction.mjs', 'install-onboarding.mjs', 'onboarding-catalog.ts', 'open-template-library.ts']) assert(entries.includes('scripts/' + script), 'Runtime diagnostic and lint entry must ship: ' + script);
await readFile(path.join(installer, 'package/scripts/check-installed-mcp.mjs'));
diff --git a/tests/onboarding-callback.test.ts b/tests/onboarding-callback.test.ts
new file mode 100644
index 000000000..862173b4b
--- /dev/null
+++ b/tests/onboarding-callback.test.ts
@@ -0,0 +1,44 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdtemp, readFile, realpath, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { createHash } from 'node:crypto';
+import { scheduleInstallationOnboarding } from '../scripts/onboarding-callback.mjs';
+
+test('installation queues one workspace-bound callback in the calling chat without starting another host', async t => {
+ const dataDirectory = await mkdtemp(path.join(tmpdir(), 'motion-callback-'));
+ t.after(() => rm(dataDirectory, { recursive: true, force: true }));
+ const log = path.join(dataDirectory, 'queue.jsonl'), codex = path.join(dataDirectory, 'codex.mjs');
+ await writeFile(codex, `import fs from 'node:fs'; fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify(process.argv.slice(2))+'\\n'); console.log('Queued message 11111111-1111-1111-1111-111111111111 for thread 22222222-2222-2222-2222-222222222222.');`);
+ const fragment = path.join(dataDirectory, 'welcome.html');
+ await writeFile(fragment, 'verified production fixture');
+ const onboarding = { preview: { status: 'ready', previewUrl: 'http://127.0.0.1:4173/?templates=1' }, inlinePresentation: {
+ status: 'prepared', path: fragment, sha256: createHash('sha256').update('verified production fixture').digest('hex'),
+ resourceVersion: 'fixed', language: 'zh', templateIds: ['product-promo', 'nyt-graph', 'decision-tree'],
+ } };
+ const options = { appRoot: dataDirectory, dataDirectory, version: '1.2.3', entry: 'npm', codex,
+ threadId: '22222222-2222-2222-2222-222222222222', onboarding };
+ const first = await scheduleInstallationOnboarding(options);
+ assert.equal(first.status, 'queued');
+ assert.equal(first.presentationVerified, false);
+ const event = JSON.parse(await readFile(first.eventFile, 'utf8'));
+ assert.equal(event.dataDirectory, await realpath(dataDirectory));
+ assert.equal(event.appRoot, await realpath(dataDirectory));
+ assert.equal(event.version, '1.2.3');
+ const second = await scheduleInstallationOnboarding(options);
+ assert.equal(second.status, 'queued');
+ assert.equal(second.eventFile, first.eventFile);
+ const calls = (await readFile(log, 'utf8')).trim().split('\n').map(JSON.parse);
+ assert.equal(calls.length, 1);
+ assert.deepEqual(calls[0].slice(0, 3), ['queue', '--thread', options.threadId]);
+ assert(!calls[0].includes('--resume') && !calls[0].includes('app-server'));
+ assert(calls[0][4].includes(first.eventFile));
+});
+
+test('an unknown chat or incomplete presentation cannot enqueue an onboarding callback', async () => {
+ const missing = await scheduleInstallationOnboarding({ threadId: '', onboarding: {} });
+ assert.equal(missing.status, 'unavailable');
+ const incomplete = await scheduleInstallationOnboarding({ threadId: '22222222-2222-2222-2222-222222222222', onboarding: { preview: { status: 'unavailable' } } });
+ assert.equal(incomplete.status, 'unavailable');
+});
diff --git a/tests/onboarding-workspace.test.ts b/tests/onboarding-workspace.test.ts
new file mode 100644
index 000000000..fff3d1b7a
--- /dev/null
+++ b/tests/onboarding-workspace.test.ts
@@ -0,0 +1,22 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { prepareInstallationFlow } from '../scripts/install-onboarding.mjs';
+
+test('plugin preparation uses its declared MCP workspace instead of silently selecting the host default', async t => {
+ const appRoot = await mkdtemp(path.join(tmpdir(), 'motion-plugin-workspace-'));
+ t.after(() => rm(appRoot, { recursive: true, force: true }));
+ const dataDirectory = path.join(appRoot, 'selected-data');
+ await mkdir(path.join(appRoot, 'docs')); await mkdir(path.join(appRoot, 'scripts'));
+ await writeFile(path.join(appRoot, 'docs/install.md'), 'Reuse the connection workspace.');
+ await writeFile(path.join(appRoot, '.mcp.json'), JSON.stringify({ mcpServers: { openmotion: { cwd: '.', env: { MOTION_DATA_DIR: dataDirectory } } } }));
+ await writeFile(path.join(appRoot, 'scripts/open-template-library.ts'), `if(process.env.MOTION_DATA_DIR!==${JSON.stringify(dataDirectory)}) throw new Error('Wrong workspace'); console.log(JSON.stringify({target:'templates',projectCreated:false,previewUrl:'http://127.0.0.1:4173/?templates=1'}));`);
+ // This seam tests the workspace/preview protocol without contacting a native
+ // host or enqueueing messages in the developer's current chat.
+ const result = await prepareInstallationFlow({ appRoot, host: 'workbuddy', templateEnvironment: 'prod' });
+ assert.equal(result.dataDirectory, dataDirectory);
+ assert.equal(result.preview.status, 'ready');
+ assert.equal(result.onboardingComplete, false);
+});
diff --git a/tests/package.test.ts b/tests/package.test.ts
index 8c81a1d09..e8b4ae988 100644
--- a/tests/package.test.ts
+++ b/tests/package.test.ts
@@ -7,6 +7,15 @@ import { designSystemDocuments, designSystemRuntimeFiles } from '../packages/des
import { readFile } from 'node:fs/promises';
import path from 'node:path';
+test('onboarding Skill is discoverable from the registered plugin roots', async () => {
+ const manifest = JSON.parse(await readFile(new URL('../.codex-plugin/plugin.json', import.meta.url), 'utf8'));
+ const entry = manifest.extensions['com.openai'].onboardingSkill.replace(/^\.\//, '');
+ const skillRoots = (Array.isArray(manifest.skills) ? manifest.skills : [manifest.skills])
+ .map((root: string) => root.replace(/^\.\//, '').replace(/\/$/, ''));
+ assert(skillRoots.some((root: string) => entry === root || entry.startsWith(root + '/')),
+ 'Codex plugin/read returns no onboardingSkill unless its entry is inside a registered Skill root');
+});
+
test('plugin onboarding entry and its shared contract resolve inside every distribution', async () => {
const manifest = JSON.parse(await readFile(new URL('../.codex-plugin/plugin.json', import.meta.url), 'utf8'));
const entry = manifest.extensions['com.openai'].onboardingSkill.replace(/^\.\//, '');
diff --git a/tests/prebuilt-bootstrap.test.ts b/tests/prebuilt-bootstrap.test.ts
new file mode 100644
index 000000000..3b9f87fe9
--- /dev/null
+++ b/tests/prebuilt-bootstrap.test.ts
@@ -0,0 +1,54 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdtemp, mkdir, writeFile, readFile, rm, access } from 'node:fs/promises';
+import { createHash } from 'node:crypto';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { spawnSync } from 'node:child_process';
+
+const entry = fileURLToPath(new URL('../install.sh', import.meta.url));
+async function fixture(t: any) {
+ const directory = await mkdtemp(path.join(tmpdir(), 'om-prebuilt-'));
+ t.after(() => rm(directory, { recursive: true, force: true }));
+ const bin = path.join(directory, 'bin'), log = path.join(directory, 'npm.json'), payload = path.join(directory, 'candidate.tgz');
+ await mkdir(bin); await writeFile(payload, 'candidate fixture');
+ await writeFile(path.join(bin, 'codex'), '#!/bin/sh\nexit 0\n', { mode: 0o755 });
+ await writeFile(path.join(bin, 'npm'), `#!${process.execPath}
+require('node:fs').writeFileSync(process.env.OM_TEST_LOG, JSON.stringify(process.argv.slice(2)));
+`, { mode: 0o755 });
+ await writeFile(path.join(bin, 'curl'), `#!${process.execPath}
+const fs=require('node:fs'),args=process.argv.slice(2);
+if(args.indexOf('-o')<0 || args.indexOf('-o')>args.indexOf('--')) process.exit(9);
+fs.copyFileSync(process.env.OM_TEST_PAYLOAD,args[args.indexOf('-o')+1]);
+`, { mode: 0o755 });
+ const env = { ...process.env, PATH: bin + path.delimiter + process.env.PATH, OM_TEST_LOG: log,
+ OM_TEST_PAYLOAD: payload, OPENMOTION_INSTALLER_SHA256: createHash('sha256').update('candidate fixture').digest('hex') };
+ return { directory, payload, log, env };
+}
+
+test('the prebuilt entry pins the npm version and forwards inline setup without a Git checkout', async t => {
+ const { log, env } = await fixture(t);
+ const result = spawnSync('bash', [entry, '--package', '@openmotion/app@1.2.3', '--onboarding-output', '/chat/welcome.html'], { env, encoding: 'utf8' });
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(JSON.parse(await readFile(log, 'utf8')), ['exec', '--yes', '--package', '@openmotion/app@1.2.3', '--', 'openmotion', 'setup', '--host', 'codex', '--onboarding-output', '/chat/welcome.html']);
+ assert.match(result.stdout, /download included/);
+});
+
+test('URL candidates are verified before execution and only the owned download is cleaned up', async t => {
+ const { log, env, payload } = await fixture(t);
+ const result = spawnSync('bash', [entry, '--package', 'http://127.0.0.1:1234/candidate.tgz'], { env, encoding: 'utf8' });
+ assert.equal(result.status, 0, result.stderr);
+ const args = JSON.parse(await readFile(log, 'utf8'));
+ await assert.rejects(access(args[3]), { code: 'ENOENT' });
+ assert.equal(await readFile(payload, 'utf8'), 'candidate fixture');
+});
+
+test('floating versions and failed candidate hashes stop before executing any package', async t => {
+ const { log, env, payload } = await fixture(t);
+ for (const spec of ['@openmotion/app@latest', payload]) {
+ const result = spawnSync('bash', [entry, '--package', spec], { env: { ...env, OPENMOTION_INSTALLER_SHA256: '0'.repeat(64) }, encoding: 'utf8' });
+ assert.notEqual(result.status, 0);
+ await assert.rejects(access(log), { code: 'ENOENT' });
+ }
+});
diff --git a/tests/provider-settings.test.ts b/tests/provider-settings.test.ts
index 8bdb2e6e7..23285d2c5 100644
--- a/tests/provider-settings.test.ts
+++ b/tests/provider-settings.test.ts
@@ -1,6 +1,7 @@
import test from 'node:test';
import assert from 'node:assert/strict';
-import { chmod, readFile, stat, writeFile } from 'node:fs/promises';
+import { access, chmod, readFile, stat, writeFile } from 'node:fs/promises';
+import { spawn, type SpawnOptions } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { setTimeout as delay } from 'node:timers/promises';
@@ -152,6 +153,39 @@ test('cancelling after credentials arrive cannot restore a session through a lat
assert.deepEqual(JSON.parse(await readFile(path.join(store.directory, 'account', 'models.json'), 'utf8')), []);
}));
+test('account fixture publishes complete credentials while sign-in is being polled', t => fixture(async store => {
+ await chmod(binary, 0o755);
+ const started = path.join(store.directory, 'credential-write-started');
+ const release = path.join(store.directory, 'allow-credential-publication');
+ const preload = path.join(store.directory, 'pause-credential-write.mjs');
+ await writeFile(preload, `import fs from 'node:fs';
+import { syncBuiltinESMExports } from 'node:module';
+const write = fs.writeFileSync;
+fs.writeFileSync = (file, ...args) => {
+ if (String(file).includes('config.json')) {
+ write(file, '', args[1]);
+ write(${JSON.stringify(started)}, 'ready');
+ const deadline = Date.now() + 5000;
+ while (!fs.existsSync(${JSON.stringify(release)})) {
+ if (Date.now() > deadline) throw new Error('Credential publication fixture timed out');
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
+ }
+ }
+ return write(file, ...args);
+};
+syncBuiltinESMExports();`);
+ const spawnFixture = ((_command: string, args: readonly string[], options: SpawnOptions) =>
+ spawn(process.execPath, ['--import', preload, binary, ...args], options)) as typeof spawn;
+ const account = new OpenDesignAccount(store.directory, { binary, spawn: spawnFixture });
+ t.after(() => account.close());
+ await account.login(); await until(async () => Boolean((await account.summary()).authorizationUrl));
+ await writeFile(path.join(account.home, 'authorize'), 'yes');
+ await until(async () => access(started).then(() => true, () => false));
+ try { assert.equal((await account.summary()).state, 'authorizing'); }
+ finally { await writeFile(release, 'continue'); }
+ await until(async () => (await account.summary()).state === 'signed-in');
+}));
+
test('an in-flight billing refresh cannot report an old account after sign-out', t => fixture(async store => {
const account = new OpenDesignAccount(store.directory, { binary }); t.after(() => account.close());
await signIn(account); await account.summary(true);
diff --git a/tests/source-install.test.ts b/tests/source-install.test.ts
index 1420b5faf..259a90727 100644
--- a/tests/source-install.test.ts
+++ b/tests/source-install.test.ts
@@ -39,7 +39,7 @@ const fs = require('node:fs');
const path = require('node:path');
const args = process.argv.slice(2);
fs.appendFileSync(process.env.MOTION_GIT_LOG, JSON.stringify(args) + '\\n');
-if (args[0] === 'clone') {
+if (args.includes('clone')) {
const scripts = path.join(args.at(-1), 'scripts');
fs.mkdirSync(scripts, { recursive: true });
fs.writeFileSync(path.join(scripts, 'install-motion.command'), '#!/bin/sh\\necho nested-motion-installer\\n');
@@ -53,7 +53,7 @@ if (args[0] === 'clone') {
assert.equal(result.status, 0, result.stderr);
assert.match(result.stdout, /nested-motion-installer/);
const calls = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
- assert.deepEqual(calls[0], ['clone', '--depth', '1', '--branch', ref || 'main', '--', 'https://github.com/nexu-io/openmotion.git', destination]);
+ assert.deepEqual(calls[0], ['-c', 'filter.lfs.process=', '-c', 'filter.lfs.smudge=', '-c', 'filter.lfs.required=false', 'clone', '--depth', '1', '--single-branch', '--branch', ref || 'main', '--', 'https://github.com/nexu-io/openmotion.git', destination]);
assert.equal(calls.length, 1);
} finally { await rm(directory, { recursive: true, force: true }); }
});
diff --git a/tests/source-marketplace.test.ts b/tests/source-marketplace.test.ts
new file mode 100644
index 000000000..fa7fee816
--- /dev/null
+++ b/tests/source-marketplace.test.ts
@@ -0,0 +1,150 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { mkdtemp, mkdir, writeFile, readFile, rm, realpath } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { registerSourceMarketplace, sourceMarketplacePlan } from '../scripts/source-marketplace.mjs';
+
+async function fixture(t: any) {
+ const temporary = await mkdtemp(path.join(tmpdir(), 'om-marketplace-'));
+ t.after(() => rm(temporary, { recursive: true, force: true }));
+ const directory = await realpath(temporary), previous = path.join(directory, 'previous'), root = path.join(directory, 'new');
+ for (const source of [previous, root]) {
+ await mkdir(path.join(source, '.agents/plugins'), { recursive: true });
+ await mkdir(path.join(source, '.codex-plugin'));
+ await writeFile(path.join(source, '.codex-plugin/plugin.json'), JSON.stringify({ name: 'openmotion' }));
+ await writeFile(path.join(source, '.agents/plugins/marketplace.json'), JSON.stringify({ name: 'openmotion-local',
+ plugins: [{ name: 'openmotion', source: { source: 'local', path: './' } }] }));
+ }
+ const entry = { pluginId: 'openmotion@openmotion-local', marketplaceSource: { sourceType: 'local', source: previous } };
+ return { directory, previous, root, entry };
+}
+
+test('an uninstalled, verified local source can be rebound while an installed source is preserved', async t => {
+ const { previous, root, entry } = await fixture(t);
+ assert.deepEqual(sourceMarketplacePlan(root, { installed: [], available: [entry] }), { action: 'replace_uninstalled_source', previous });
+ assert.throws(() => sourceMarketplacePlan(root, { installed: [entry], available: [] }), /OPENMOTION_SOURCE_IN_USE/);
+ assert.deepEqual(sourceMarketplacePlan(previous, { installed: [entry], available: [] }), { action: 'reuse' });
+});
+
+test('a vanished or non-directory previous source is rebound instead of aborting preflight', async t => {
+ const { previous, root, entry } = await fixture(t);
+ await rm(previous, { recursive: true, force: true });
+ assert.deepEqual(sourceMarketplacePlan(root, { installed: [], available: [entry] }), { action: 'replace_uninstalled_source', previous });
+ assert.throws(() => sourceMarketplacePlan(root, { installed: [entry], available: [] }), /OPENMOTION_SOURCE_IN_USE/,
+ 'installed cached plugins remain protected even after their source disappears');
+ await writeFile(previous, 'moved elsewhere');
+ assert.deepEqual(sourceMarketplacePlan(root, { installed: [], available: [entry] }), { action: 'replace_uninstalled_source', previous });
+ assert.throws(() => sourceMarketplacePlan(root, { installed: [entry], available: [] }), /OPENMOTION_SOURCE_IN_USE/);
+});
+
+for (const failure of ['command', 'json', 'shape']) test(`unreadable ${failure} inventory stops without any host mutation and gives a recovery action`, async t => {
+ const { directory, root } = await fixture(t);
+ const codex = path.join(directory, 'codex'), log = path.join(directory, 'inventory-calls.jsonl');
+ await writeFile(codex, `#!${process.execPath}
+import fs from 'node:fs';
+fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify(process.argv.slice(2)) + '\\n');
+if (${JSON.stringify(failure)} === 'command') process.exit(2);
+console.log(${JSON.stringify(failure === 'json' ? 'not-json' : '{"installed":[]}')});
+`, { mode: 0o755 });
+ for (const checkOnly of [true, false]) {
+ assert.throws(() => registerSourceMarketplace(root, { checkOnly, codex }), error => {
+ assert.match(String(error), failure === 'command' ? /OPENMOTION_INVENTORY_UNAVAILABLE/ : /OPENMOTION_INVENTORY_INVALID/);
+ assert.match(String(error), /codex plugin list/);
+ assert.match(String(error), /No host configuration was changed/);
+ return true;
+ });
+ }
+ const calls = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
+ const inventoryReads = calls.filter(args => args[0] === 'plugin');
+ assert.equal(inventoryReads.length, 2);
+ assert(inventoryReads.every(args => args.join(' ') === 'plugin list --marketplace openmotion-local --available --json'));
+ assert(calls.filter(args => args[0] !== 'plugin').every(args => args.join(' ') === 'app-server --stdio'));
+});
+
+for (const kind of ['unused', 'installed', 'disabled', 'foreign', 'present']) test(`failed inventory recovery preserves the ${kind} source boundary`, async t => {
+ const { directory, previous, root } = await fixture(t);
+ if (kind !== 'present') await rm(previous, { recursive: true });
+ const codex = path.join(directory, 'codex'), log = path.join(directory, 'recovery.jsonl');
+ const config = { marketplaces: { 'openmotion-local': { source_type: kind === 'foreign' ? 'git' : 'local', source: previous } },
+ plugins: ['installed', 'disabled'].includes(kind) ? { 'openmotion@openmotion-local': { enabled: kind === 'installed' } } : {} };
+ await writeFile(codex, `#!${process.execPath}
+import fs from 'node:fs';
+import readline from 'node:readline';
+const args = process.argv.slice(2);
+fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify(args) + '\\n');
+if (args[0] === 'app-server') {
+ readline.createInterface({input: process.stdin}).on('line', line => {
+ const message = JSON.parse(line);
+ if (!['initialize', 'config/read'].includes(message.method)) process.exit(9);
+ console.log(JSON.stringify({id: message.id, result: message.method === 'config/read' ? {config: ${JSON.stringify(config)}} : {}}));
+ });
+} else if (args[1] === 'list') process.exit(2);
+`, { mode: 0o755 });
+ if (kind === 'unused') {
+ assert.deepEqual(registerSourceMarketplace(root, { checkOnly: true, codex }), { action: 'replace_uninstalled_source', previous });
+ let calls = (await readFile(log, 'utf8')).trim().split('\n').map(JSON.parse);
+ assert(!calls.some(args => ['remove', 'add'].includes(args[2])), 'recovery preflight must remain read-only');
+ registerSourceMarketplace(root, { codex });
+ calls = (await readFile(log, 'utf8')).trim().split('\n').map(JSON.parse);
+ assert.deepEqual(calls.filter(args => ['remove', 'add'].includes(args[2])), [
+ ['plugin', 'marketplace', 'remove', 'openmotion-local'], ['plugin', 'marketplace', 'add', root],
+ ]);
+ } else {
+ assert.throws(() => registerSourceMarketplace(root, { codex }), /OPENMOTION_(?:SOURCE_IN_USE|INVENTORY_UNAVAILABLE)/);
+ const calls = (await readFile(log, 'utf8')).trim().split('\n').map(JSON.parse);
+ assert(!calls.some(args => ['remove', 'add'].includes(args[2])));
+ }
+});
+
+test('a vanished previous registration is removed and never restored', async t => {
+ const { directory, previous, root, entry } = await fixture(t);
+ const codex = path.join(directory, 'codex'), log = path.join(directory, 'calls.jsonl');
+ await writeFile(codex, `#!${process.execPath}
+import fs from 'node:fs';
+const args = process.argv.slice(2);
+fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify(args) + '\\n');
+if (args[1] === 'list') console.log(${JSON.stringify(JSON.stringify({ installed: [], available: [entry] }))});
+if (args[2] === 'add' && args[3] === ${JSON.stringify(root)}) process.exit(2);
+`, { mode: 0o755 });
+ await rm(previous, { recursive: true, force: true });
+ assert.equal(registerSourceMarketplace(root, { checkOnly: true, codex }).action, 'replace_uninstalled_source');
+ assert.throws(() => registerSourceMarketplace(root, { codex }));
+ const calls = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
+ assert.deepEqual(calls.filter(args => args[1] !== 'list'), [['plugin', 'marketplace', 'remove', 'openmotion-local'], ['plugin', 'marketplace', 'add', root]],
+ 'a source that no longer exists must not be restored after a failed add');
+});
+
+test('foreign entries, unknown sources and unrecognized catalogs are never replaced', async t => {
+ const { previous, root, entry } = await fixture(t);
+ for (const changed of [
+ { ...entry, pluginId: 'someone-else@openmotion-local' },
+ { ...entry, marketplaceSource: { sourceType: 'git', source: previous } },
+ ]) assert.throws(() => sourceMarketplacePlan(root, { installed: [], available: [changed] }), /Refusing/);
+ await writeFile(path.join(previous, '.agents/plugins/marketplace.json'), JSON.stringify({ name: 'other', plugins: [] }));
+ assert.throws(() => sourceMarketplacePlan(root, { installed: [], available: [entry] }), /unrecognized/);
+});
+
+for (const fail of [false, true]) test(`registration ${fail ? 'restores the previous source after an add failure' : 'rebinds only the uninstalled OpenMotion source'}`, async t => {
+ const { directory, previous, root, entry } = await fixture(t);
+ const codex = path.join(directory, 'codex'), log = path.join(directory, 'calls.jsonl');
+ await writeFile(codex, `#!${process.execPath}
+import fs from 'node:fs';
+const args = process.argv.slice(2);
+fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify(args) + '\\n');
+if (args[1] === 'list') console.log(${JSON.stringify(JSON.stringify({ installed: [], available: [entry] }))});
+if (${fail} && args[2] === 'add' && args[3] === ${JSON.stringify(root)}) process.exit(2);
+`, { mode: 0o755 });
+ assert.equal(registerSourceMarketplace(root, { checkOnly: true, codex }).action, 'replace_uninstalled_source');
+ let calls = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
+ assert.equal(calls.length, 1, 'preflight must not modify host configuration');
+ if (fail) assert.throws(() => registerSourceMarketplace(root, { codex }));
+ else assert.equal(registerSourceMarketplace(root, { codex }).action, 'replace_uninstalled_source');
+ calls = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line));
+ assert.deepEqual(calls.slice(2), [
+ ['plugin', 'marketplace', 'remove', 'openmotion-local'],
+ ['plugin', 'marketplace', 'add', root],
+ ...(fail ? [['plugin', 'marketplace', 'add', previous]] : []),
+ ]);
+ assert.equal(calls.some(args => args.includes('uninstall')), false);
+});