Skip to content

Add Mini App: Live Stream Recorder - #216

Open
charlesnty612 wants to merge 10 commits into
MiniMax-AI:mainfrom
charlesnty612:add-live-stream-recorder
Open

charlesnty612 wants to merge 10 commits into
MiniMax-AI:mainfrom
charlesnty612:add-live-stream-recorder

Conversation

@charlesnty612

@charlesnty612 charlesnty612 commented Dec 6, 2026 •

Copy link
Copy Markdown

Live Stream Recorder is a native MiniMax Code Mini App that turns a recording engine into a desktop-style workbench: monitor multiple livestream rooms, record them with danmaku capture, replay and clip recordings, back up short videos, and manage relay tasks -- all inside the chat client. The package ships the workbench only. The recording engine is not bundled; the Mini App detects that it is missing, asks whether to download it, and installs it only after you agree.

This contribution adds the complete, self-contained package under plugins/charlesnty612/live-stream-recorder/ and one row at the top of each root README, with no executable, shared library or native module of any kind.

On-demand recording engine

  • The engine is downloaded from this project's own GitHub Release over HTTPS: https://github.com/charlesnty612/live-stream-recorder/releases/download/engine-v1.1.3/engine-windows-x64.exe, pinned to version engine-v1.1.3, 100,927,488 bytes, SHA-256 1a4f9ee255b396b84991a9ea3088f66909d6199916bcdbee546fbfdfc1945c20.
  • Nothing is downloaded until the user chooses to: the first-run prompt offers download / later / manual install, and the same action is available from the engine panel in Settings. A re-download over an existing engine requires an explicit confirmation. There is no update check, because there is a single pinned version and no version manifest.
  • Install order: download to a .part file, verify SHA-256, atomically replace, restart the engine. If the digest does not match, the previous engine is kept and the .part file is deleted. Download is offered only on Windows x64 and only when free space covers the engine plus a reserve.
  • This is the only outbound request the package can make besides talking to the engine the user runs. There is no telemetry, update check or analytics.

Tested environment and results

  • MiniMax Code 3.1.23 (exe 3.1.23.240) on Windows 11 (build 26200) x64. The package declares engines.mcode: ">=3.1.20" and permissions.device: ["notifications"], both first available in 3.1.20.
  • Client acceptance (2026-12-05, FilePanel Browser, publish -> inspect -> open) exercised: cold start and readiness in 400-465 ms with no READINESS_TIMEOUT; Host-reserved /__mavis/ returning 401 with no SPA fallback; private-route 404 interception; loopback-only network activity with zero external requests; the 584 px narrow-screen layout and both themes; Settings diagnostics and the notification permission controls. One defect found during acceptance (a missing mcpServers: [] manifest field that blocked publish) was fixed and re-verified. The browser console showed 0 errors.
  • Host-side engine download (2026-12-06, same client build, real UI): clicking "Redownload" in the Settings engine panel and confirming the dialog downloaded 100,927,488 bytes, the on-disk SHA-256 matched the pinned constant, the engine was replaced and restarted automatically (the engine process id changed without clicking "Restart engine"), and the status returned to ready with no error. The Host refused deletion of the replaced engine's backup; the package kept the backup, stayed ready, and showed a notice containing the backup path.
  • Source-repository checks on master (2026-12-06, after the last change in this PR): node --test npm/tests/*.test.cjs 14/14 (EXIT=0); npm run typecheck (EXIT=0); node scripts/build-miniapp.mjs (EXIT=0, structure self-check and clean-source gate OK); node scripts/gates.mjs --full 14/14 (EXIT=0). No Rust compilation was run for this PR; cargo build / cargo test were not executed.
  • Community repository npm run check (EXIT=0): this package reports 0 errors, 2 warnings (both explained below). Tests: 115 total, 113 pass, 0 fail, 2 skipped (case-insensitive filesystem checks, skipped on this machine's filesystem).
  • Sensitive-information scan of the contribution copy: no credentials, local paths, private IPs, or personal data.

Behavior not verified at runtime

  • Real recording and danmaku capture with a live stream, in both sidecar and remote modes.
  • Process-tree teardown with a live engine (the two-second dispose path is implemented, but no engine process existed to terminate).
  • Multi-session and sleep/wake recovery; remote-mode 401 handling; large-file range playback and download; local-file open routing through fileHandlers.
  • Actual delivery of system notifications on livestream events (the permission prompt was exercised, not event delivery).
  • In the Host: the first-run path (engine missing -> prompt -> download). Only the re-download path over an existing engine was exercised there. Cancel / resume, checksum-mismatch rollback and insufficient-space refusal are covered by the source repository's package tests, not by a Host run.

Known issues (not fixed in this PR)

  • One hint element in the light theme (.tile-hint) measures 1.63-3.03:1 contrast, below WCAG AA.
  • The Settings engine panel's "process PID" field does not refresh by itself after an automatic engine restart; it updates when "Refresh status" is clicked.
  • When the Host refuses deletion of a replaced engine's backup, the backup stays in the data directory and the panel shows a notice with its path.

npm run check warnings (explained, not fixed)

  1. NODE_RESERVED_ROUTE in miniapp/node/proxy.mjs. The code mentions /__mavis/ only to explicitly return 404 for that prefix so the workbench never registers a route there or SPA-falls-back onto a Host-reserved path. Acceptance confirmed the Host guard returned 401, not the plugin. The warning is triggered by the defensive mention and is intentional.
  2. NODE_UNGUARDED_SERVER in miniapp/node/sidecar.mjs. The net and tls imports are used for outbound WebSocket passthrough (net.connect / tls.connect) to the upstream engine and for a short-lived net.createServer() on 127.0.0.1:0 that only selects a free port and is immediately closed. The package's only listener is node:http in server.mjs, bound to context.listen, so the Host loopback guard applies. No unguarded server serves context.listen.port.

Declared access

  • permissions.device: ["notifications"] -- the Settings page reads Notification.permission and calls Notification.requestPermission() only when the user clicks "Enable system notifications". Nothing else is granted: no agent, session, tool, connector, host, microphone, or camera access; apps, mcpServers, and skills are empty.
  • fileHandlers: .flv, .mp4, .mkv, .webm, .xml. The Host delivers a file path, Node registers it as an opaque in-memory token (10-minute TTL), and the page reads it by token only; the path is never echoed back.
  • Network: the Node entry listens only on the Host-assigned loopback context.listen. Sidecar mode connects to http://127.0.0.1:<free-port>; remote mode connects to the user-configured baseUrl. Outbound traffic goes to that one engine: a reverse proxy for /v1/, /bili/, /static/, WebSocket /v1/ws/*, and a three-second /v1/activity-events poll. The only other destination is the engine download URL above, and only after the user asks for it. No third-party host is contacted from the page.
  • Files: context.dataDir/miniapp-config.json is created and written when configuration changes (mode 0600 where supported), holding the connection mode, optional engine and media-tool paths, and remote settings; secret fields are blanked in API responses and replaced with has* flags. A downloaded engine is installed as <dataDir>/bin/ under its original filename; a replaced engine is kept as a uniquely named backup. Pages read only their own static assets and tokenized recordings.
  • State location: durable state is context.dataDir. When the Host provides no data directory (standalone start), it falls back to .data/ inside the package directory. No environment variable can redirect either location; the source repository has a regression test that starts the package with the former plugin-root environment variable pointed at another directory and asserts the data directory does not move.
  • Spawned processes: the recording-engine binary is started as a sidecar on a loopback bind, with a startup --help capability probe, a PATH lookup by executable name, and a process-tree termination only as a shutdown fallback. Any media tooling the engine needs is launched by the engine itself, not by this package.
  • Agent interaction: no turn runs automatically. Two optional buttons call window.miniapp.host.composer.append to place redacted diagnostics or a clip-plan prompt into the chat input for the user to review and send. The clip-plan prompt mentions MCP tool names, but this package declares no MCP servers and calls no tools itself. No conversation is read.
Written by MiniMax-M4

Package layout and size

.minimax-plugin/plugin.json   identity, icon, empty apps/mcpServers/skills
package.json                  mcode.schemaVersion 2 -> ./miniapp/miniapp.json
miniapp/miniapp.json          runtime process/on-demand; surface /app; fileHandlers; engine >=3.1.20
miniapp/client/               built static page (bundled output, no build step at install time)
miniapp/node/                 six ESM modules: server, proxy, sidecar, config, events, engine (downloader)
icon.png                      plugin icon
README.md / README.zh-CN.md   English and Chinese docs with Tested environment and Data & access
LICENSE                       MIT, copyright holder charlesnty612
NOTICE / licenses/            third-party attribution and license texts preserved verbatim

92 files, 1,287,692 bytes (about 1.23 MiB), zero executables. No node_modules, VCS metadata, caches, logs, PID files, temporary files, OS metadata, or Host runtime state.

Third-party components and redistribution

No precompiled binary is included. The recording engine is downloaded on demand from this project's GitHub Release and is not redistributed in this package. The built client bundles open-source front-end dependencies into minified JavaScript; NOTICE and licenses/ carry their attribution and license texts, including licenses/frontend/ with a manifest that maps each bundled dependency to its license file. The engine that is downloaded links the third-party components listed in the package README's References section; their license texts ship under licenses/. No copyleft (GPL/AGPL) component is bundled in this package.

Sensitive-information scan of the copied package

Every text file in the contribution directory was read and searched for credentials, private endpoints, personal data, and real business data. Findings, all benign and none changed:

  • Credential-shaped identifiers (token, authorization, cookie, secret, desktopToken, appPassword) appear only as variable names, redaction regexes, and comments in the Node modules. No value is present; secrets are generated at runtime or supplied by the user.
  • FORBIDDEN literal scan: one hit in proxy.mjs, '/v1/' + 'membership', which is a concatenation-style 404 interceptor for private routes, not a private endpoint. No external private domain in the payload.
  • 169.254.0.0/16 in config.mjs is a cloud-metadata SSRF guard, not an internal network address in use.
  • Bundled third-party notice files contain public email addresses of upstream open-source authors in verbatim license texts; these are required attribution and were left unchanged.
  • No BEGIN ... PRIVATE KEY, no token-shaped string (sk-, ghp_, github_pat, etc.), no /Users/ or user-specific absolute path, no personal name or real business record, no log or screenshot in the package.

Consistency checks

  • The Node modules in the copy are byte-identical to the source repository (verified with diff).
  • miniapp/miniapp.json declares exactly the access the code uses: the only browser-permission call is the Notification API, and it is covered by permissions.device: ["notifications"]. npm run check reported no ACCESS_UNDECLARED.
  • The package is the built miniapp/client output plus source Node modules; it needs no build step at install time and works on its own without other repository directories.

Scope of this PR

Only plugins/charlesnty612/live-stream-recorder/ and one row at the top of README.md and README.zh-CN.md are added. No existing plugin, check, or script is modified. The branch is based on current main with linear history and no merge commits.


Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sync source worktree build output: engine download module, local install APIs, first-run dialog, engine panel, banner and disabled recording entries.

Payload stays 69 files / 1,239,095 bytes (+18,664 bytes vs previous copy), no prebuilt engine. Community check: 0 errors; source build and package SHA-256 match file by file.

TODO: Release URL/SHA/version remain placeholders until authorized; PR body maintained by Bunny.
Update bundled engine.mjs and client assets with the published Release URL, SHA-256, size and version; enable the user-triggered download button.

Payload 69 files / 1,239,060 bytes; SHA-256 matches source build; community check 0 errors.
- Rebuild client bundle from source commit f66e6bc: ready-state redownload
  action replaces the fake update-check button; engine.mjs gains force download
  with atomic replace + rollback; proxy.mjs gains POST /miniapp/engine/redownload.
- Drop 32 stale hashed client assets from the previous build and add the new
  ones; package stays 69 files / 1,240,598 bytes. All 59 payload files match
  dist-miniapp byte-for-byte (SHA-256), zero stale.
- README.md: state --fast 11/11 and --full 14/14 separately instead of a single
  gate figure.

Community check: 0 errors, 2 pre-existing warnings (NODE_RESERVED_ROUTE for
the Host-reserved /__mavis/ prefix; NODE_UNGUARDED_SERVER for sidecar.mjs
net.createServer used only by freePort; actual listen is node:http in server.mjs).
No push, no PR, no community publish.
- README.md: add ## References at the end; README.zh-CN.md: add the matching
  ## 引用. Both list only the third-party components whose license files are
  actually present in this package, copied verbatim from NOTICE/licenses.
- State the on-demand engine model in the wording supplied for this change:
  no engine binary is bundled, download runs only on user choice via this
  project's HTTPS Release, and installation is checked against a fixed hash.
- No other section, manifest, code, icon, or package file was touched.

npm run check: package 0 errors, 2 pre-existing warnings; suite 113 pass /
0 fail / 2 skipped. No push, no fork, no PR.
- Fix the opening sentence of both reference sections: the named components
  are linked by the on-demand engine; only their license texts and notices
  ship with this package. No code or resource file for them is in the payload.
- Component entries and the closing engine paragraph stay byte-identical.
- No other section or file was touched.

npm run check: package 0 errors, 2 pre-existing warnings; suite 113 pass /
0 fail / 2 skipped. No push, no fork, no PR.
…ontend license audit\n\n- engine: unique .old-<ts> backup; only two renames are critical; cleanup best-effort with visible notice; ready keeps error text; injectable unlink/rename for tests\n- tests: 2 new EPERM cases + strengthened hash-mismatch assertion; mutation verified (2 fail when fix reverted)\n- ui: downloader/settings labels neutralized (values/keys/env untouched); engine panel shows notice and ready-state error\n- licenses: audit 22 bundled frontend packages; add licenses/frontend + NOTICE section 7; @juggle/resize-observer 3.4.0 is Apache-2.0 (non-MIT) with its text\n- community check: 0 errors, 2 pre-existing warnings; 115 tests, 113 pass, 0 fail, 2 skipped
…play names\n\n- README.md / README.zh-CN.md: engine product name and Microsoft in user-visible prose replaced with neutral wording; config keys, values, path-resolution facts and References section untouched\n- rebuilt client: SettingsView label "biliup-cli path" -> neutral "engine CLI path (read-only)"; field and readonly attribute unchanged\n- verification: web typecheck 0, gates fast 11/11 0, build-miniapp 0, community check 0 errors (115 tests, 113 pass, 0 fail, 2 skipped)\n- mutation re-run with current 12-case test file: defective 9 pass/3 fail exit 1 (two EPERM cases red), restored 12 pass/0 fail exit 0; assertions unchanged
- 根 README.md / README.zh-CN.md:Live Stream Recorder 表格行改为「引擎在你同意后
  按需下载」,不含第三方引擎产品名;其余行列一字未动。
- 包内 README.md / README.zh-CN.md 的 State location:写明持久配置在宿主 dataDir,
  独立启动落到包内 .data/,且无环境变量可改写这两处位置。
- 包内 miniapp/node/server.mjs(构建产物副本):与源同步,去掉 AMOEBA_PLUGIN_ROOT
  覆盖,逐字节一致。

社区 npm run check:本包 0 errors / 2 warnings(即约定保留的 /__mavis/ 404 守卫与
net 探端口两条);全局 tests 115 / pass 113 / fail 0 / skipped 2。
仅本地提交,未推送、未建 PR、未 rebase/merge main。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant