Skip to content

Commit 1b0cc45

Browse files
沐梵尼沐梵尼
authored andcommitted
Update OpenFilm MiniApp to OpenFilm 0.3.0
- Pin the npm fallback to openfilm@0.3.0 and start Studio by calling upstream's startStudio from the local clone instead of `openfilm open` (that path reuses a machine-wide Studio and can launch an incomplete Electron app). - Let the OS pick the Studio port (port: 0) and read the real origin and film origin back from the run.json it writes; a fixed port collided. - Spawn the worker with ELECTRON_RUN_AS_NODE: the panel runs inside Electron, so process.execPath is the helper binary, not node. - Merge the panel's own project list with the user's instead of overwriting it. - Register the 0.3.0 IPC additions (chat:undo with turnId, agents:refresh) and pass upstream's trash into the chat handler. - Restrict local agent starts to project folders. - Fail visibly when the spawned Studio dies; kill only the process we started. - Resolve the npm fallback asynchronously; update README/NOTICE/SKILL for 0.3.0. - Acceptance script: 49 checks.
1 parent 513895a commit 1b0cc45

7 files changed

Lines changed: 326 additions & 122 deletions

File tree

‎plugins/cristinamadureira353-svg/openfilm/README.md‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The panel is the OpenFilm desktop page itself. The native bridge the desktop app
2121
## Requirements
2222

2323
- MiniMax Code **3.1.2 or newer** on macOS (the Host's loopback credential guards the panel's port).
24-
- Node.js 22+ and `npx` (the panel starts OpenFilm with `npx -y openfilm@0.2.5`).
24+
- Node.js 22+ and `npx` (only needed as a fallback when there is no local OpenFilm clone).
2525
- **Desktop mode only:** a local clone of [openfilm/openfilm](https://github.com/openfilm/openfilm) and one shell build. `@openfilm/desktop` is not published to npm, so the desktop handlers can only come from the repository.
2626

2727
```sh
@@ -44,34 +44,36 @@ Edit `miniapp.config.json` in the plugin directory. Put machine-specific overrid
4444

4545
| Key | Default | Meaning |
4646
|---|---|---|
47-
| `openfilmBin` / `openfilmArgs` | `npx -y openfilm@0.2.5` (pinned) | Which OpenFilm to start (first run downloads it from npm). |
4847
| `flavor` | `release` | Which project list to show: `release` (`~/.openfilm`, `~/Movies/OpenFilm/Projects`) or `dev` (`~/.openfilm-dev`). |
4948
| `desktopMode` | `true` | Desktop interface + chat + local agents. `false` = plain web Studio. |
5049
| `openfilmRepo` | `~/Developer/openfilm` | Where the OpenFilm clone is (also `OPENFILM_REPO` env). Needed for desktop mode. |
5150
| `shellDist` | `<repo>/apps/desktop/shell/dist` | The built desktop page. |
5251
| `desktopApp` | auto-detected (fixed) | The app the `POST /miniapp/open-desktop` endpoint launches: repo dev runtimes first, then `/Applications/OpenFilm.app`. Not configurable. |
53-
| `studioHome` / `studioPort` | `context.dataDir/openfilm-studio` / `4823` | The panel's own Studio home/port. `studioHome` may be overridden for an existing state directory (documented exception); `studioPort` for isolated tests. |
52+
| `studioHome` | `context.dataDir/openfilm-studio` | The panel's own Studio home. May be overridden for an existing state directory (documented exception). There is no port setting: Studio asks the OS for a free one (`port: 0`) and its real origin and film origin are read back from the `run.json` it writes there. |
53+
54+
There is no configurable executable or argument list either: the OpenFilm version is pinned in code (`PINNED_OPENFILM_VERSION` in `miniapp/node/server.mjs`).
5455

5556
## Data & access
5657

5758
**Processes started by this package**
5859

59-
- `npx -y openfilm@0.2.5 open` — starts the Studio (`openfilmBin`/`openfilmArgs` are pinned to this; the first run downloads OpenFilm from `registry.npmjs.org`).
60+
- The Studio is started by calling upstream's `startStudio` directly (`node --input-type=module -e 'import { startStudio } ...'`) from the local clone's `packages/openfilm/studio/server/server.mjs`, with `port: 0` (the OS picks a free port, and the real origin and film origin are read back from the `run.json` it writes), `advertise: true` and no browser opener. It does **not** run `openfilm open` (that path reuses a machine-wide Studio and can launch other apps). When no clone is present, the pinned `openfilm@0.3.0` from npm is used instead (first run downloads it from `registry.npmjs.org`).
6061
- `open -n <app>` / `open -a <app>` (macOS) — only for the fixed app locations in `desktopCandidates()` (dev runtimes under `<openfilmRepo>/apps/desktop/.dev/runtime`, then `/Applications/OpenFilm.app` and `~/Applications/OpenFilm.app`; the dev candidates depend on `openfilmRepo` / `OPENFILM_REPO`).
6162
- `open -R <path>` — reveals a project path in Finder (restricted to project folders).
6263
- `ps -ax -o command=` — to check whether that app is already running.
6364
- `pbcopy` — only for the chat's "copy diagnostic report".
6465

6566
**Network**
6667

67-
- `registry.npmjs.org` (first `npx` run).
68+
- `registry.npmjs.org` (only for the npm fallback, when no local clone exists).
6869
- Loopback only for the panel itself and Studio (`127.0.0.1`/`localhost`). Agents you invoke use their own accounts/network as usual.
6970

7071
**Files read**
7172

7273
- `~/.openfilm/studio.json` (or `~/.openfilm-dev/studio.json` when `flavor` is `dev`): which projects exist (read-only).
7374
- Each listed project's `.film/id` (read-only), to address the project.
7475
- `<openfilmRepo>/apps/desktop/src/*.mjs` — the desktop handlers, imported and run (the documented desktop-mode requirement).
76+
- `<openfilmRepo>/packages/openfilm/studio/server/trash.mjs` — upstream's `moveToTrash`, used by the chat's "undo a turn" (it puts a file the turn added into the system trash).
7577
- `<openfilmRepo>/apps/desktop/.dev/runtime/*` — to find a dev app to launch.
7678
- `<openfilmRepo>/apps/desktop/shell/dist/*` — the desktop page served.
7779
- Agents' own config/session records, via the desktop handlers in `<openfilmRepo>/apps/desktop/src`:
@@ -86,6 +88,7 @@ Edit `miniapp.config.json` in the plugin directory. Put machine-specific overrid
8688
**Files written**
8789

8890
- Only under `context.dataDir` (`openfilm-studio/`): Studio home, preferences, caches, logs, the BYOK master key and sealed BYOK keys.
91+
- `studio.json` **in that same Studio home** is written from the project list read in your own OpenFilm home (`recent` and `folders`). The bundled Studio reads its own `studio.json`, and the two have to agree or the editor answers "no such project". Your own `~/.openfilm/studio.json` is only read, never written.
8992
- Project data is written through OpenFilm's own API/handlers (chat records under `.film/`, agent sessions in project folders), exactly as the desktop app does — not by the panel itself.
9093
- A legacy `studioHome` override (`miniapp.config.local.json`) may point the Studio home elsewhere (this machine's original `~/.minimax/openfilm-studio`). It is an explicit, documented exception for an existing state directory, not a general writable path.
9194

@@ -94,9 +97,9 @@ Edit `miniapp.config.json` in the plugin directory. Put machine-specific overrid
9497

9598
- **Loopback authentication is done by the Host** (MiniMax Code 3.1.2+): every `node:http` server in the MiniApp process requires the per-run credential, including direct local connections and WebSocket upgrades. This package implements no token logic of its own.
9699
- **No secrets in pages, client JavaScript, logs, or error responses.** `/miniapp/studio` no longer returns the Studio key, and no iframe URL contains `/open?key=`; both web and desktop editors are served same-origin with the key attached only on the server side.
97-
- **Bounded proxies.** `/api/*` allows only the route prefixes the editor uses (`/api/health`, `/api/projects`, `/api/files`, `/api/doctor`, `/api/library`, `/api/saved`, `/api/skills`, `/api/prefs`, `/api/examples`, `/api/fonts`, `/api/page-links`, `/api/exports`, `/api/look`) and forwards only `accept`, `content-type`, `range`. `/p/*` is read-only GET/HEAD. WebSocket upgrades are limited to `/api/events` and `/api/projects/<id>/events`, with only the handshake headers plus the Studio key.
100+
- **Bounded proxies.** `/api/*` allows only the route prefixes and methods the editor uses (`/api/health`, `/api/version`, `/api/projects`, `/api/files`, `/api/page-links`, `/api/exports`, `/api/look`, `/api/doctor`, `/api/diagnostics`, `/api/library`, `/api/canvas`, `/api/canvas-templates`, `/api/canvas-characters`, `/api/kept`, `/api/local-models`, `/api/saved`, `/api/skills`, `/api/prefs`, `/api/examples`, `/api/fonts`, `/api/browse`, `/api/locations`, `/api/pick-folder`, `/api/pick-files`) and forwards only `accept`, `content-type`, `range`. `/api/get` (generates media, may cost) and `/api/providers` (your service keys) are not proxied. `/p/*` is read-only GET/HEAD. WebSocket upgrades are limited to `/api/events` and `/api/projects/<id>/events`, with only the handshake headers plus the Studio key.
98101
- **IPC allowlist with payload validation** (`IPC_RULES` in `server.mjs`): installer, sign-in and `automatic` flows are not registered at all (they return 403), and every other channel has a parameter check. `desktop:reveal` is limited to project folders. As in the desktop app, the page can also answer a local agent's permission prompts on your behalf (`desktop:local-agents:permission`) — that is how the chat's permission cards work, and it is your own UI.
99-
- **Fixed process launches.** `open-desktop` only opens the auto-detected OpenFilm app bundles; `openfilmBin`/`openfilmArgs` are pinned to `npx -y openfilm@0.2.5` with a minimal environment (`PATH`, `HOME`, `LANG`, `TMPDIR`, `OPENFILM_*`).
102+
- **Fixed process launches.** `open-desktop` only opens the auto-detected OpenFilm app bundles. Studio is started with upstream's `startStudio` (OS-assigned port, no browser) using a minimal environment (`PATH`, `HOME`, `LANG`, `TMPDIR`, `OPENFILM_*`); the npm fallback is pinned to `openfilm@0.3.0`.
100103
- **State lives in `context.dataDir`** (`openfilm-studio/`). Nothing durable is written into the plugin directory.
101104
- BYOK keys saved through the panel are sealed with AES-256-GCM using a local `0600` master key in that state directory (the desktop app uses the OS keychain instead; the two do not share key storage). This is obfuscation for at-rest files, not keychain-grade protection — the master key sits in the same directory, and a legacy `raw:` (plaintext) value is also accepted for compatibility.
102105

@@ -107,24 +110,25 @@ Edit `miniapp.config.json` in the plugin directory. Put machine-specific overrid
107110
- Agent **installer, sign-in and `automatic` flows are not offered in the panel** (use the desktop app for those).
108111
- Native file/folder pickers and screen capture return `null` (no native dialogs in a browser).
109112
- Desktop mode needs the OpenFilm clone + shell build (see Requirements).
110-
- The API proxy intentionally excludes admin routes (`/api/quit`, `/api/update`, `/api/open`, `/api/keys`); actions that need them are unavailable in the panel.
113+
- The API proxy is limited to the routes and methods the editor actually uses, and excludes admin routes (`/api/quit`, `/api/update`, `/api/open`, `/api/desktop`).
114+
- **`/api/get` and `/api/providers` are not proxied**: generating media with a service (voice, music, images, video) and connecting a service (its keys) are not available in the panel — use the desktop app for those. The canvas (⌘E), the assets library and the rest of the editor work in the panel.
111115
- Tested on macOS only. Windows/Linux are untested (some code paths use `open`, `pbcopy`, `ps`).
112116

113117

114118
## Tested environment
115119

116-
- MiniMax Code desktop 3.1.2+ on macOS (Apple Silicon), Node 22, OpenFilm 0.2.5.
117-
- Desktop page renders with chat column and real conversation history; project switching works.
120+
- MiniMax Code desktop 3.1.2+ on macOS (Apple Silicon), Node 22, OpenFilm 0.3.0.
121+
- Desktop page renders with the chat column and real conversation history.
118122
- `chat:load` returns real sessions; agent roster lists 11 agents; Codex ACP probe starts a session; Claude Code correctly reports not-installed.
119-
- Acceptance script: 44 checks covering boot, tree, desktop IPC, roster, SSE, web fallback, missing-shell error, concurrent boot (one Studio only), dispose with open SSE streams, the review hardening assertions (no key to the page, route/IPC allowlists, payload validation, reveal restriction), and the preview path (film page proxied, editor origin rewritten, bridge allowed same-origin, media served).
123+
- Acceptance script: 49 checks (the few project-specific ones are skipped, and said so, on a machine with no OpenFilm projects) covering boot, tree, desktop IPC, roster, SSE, web fallback, missing-shell error, concurrent boot (one Studio only), dispose with open SSE streams, the review hardening assertions (no key to the page, route/IPC allowlists, payload validation, reveal restriction), and the preview path (film page proxied, editor origin rewritten, bridge allowed same-origin, media served).
120124

121125
Run the acceptance yourself:
122126

123127
```sh
124128
node test/accept-miniapp.mjs # SKIP_PROBE=1 to skip the Codex ACP probe
125129
```
126130

127-
It uses temporary homes and ports 4900–4903 and cleans up after itself; it never touches your running panel or writes your projects. Desktop-mode checks need the OpenFilm clone + shell build (see Requirements). After installing, also open the panel once and check Settings → Agents.
131+
It uses temporary homes and OS-assigned ports and cleans up after itself; it never touches your running panel or writes your projects. Desktop-mode checks need the OpenFilm clone + shell build (see Requirements). After installing, also open the panel once and check Settings → Agents.
128132

129133
## License
130134

0 commit comments

Comments
 (0)