Skip to content

Add Learn Workbench Mini App - #173

Open
meisijiya wants to merge 4 commits into
MiniMax-AI:mainfrom
meisijiya:add-learn-workbench
Open

meisijiya wants to merge 4 commits into
MiniMax-AI:mainfrom
meisijiya:add-learn-workbench

Conversation

@meisijiya

@meisijiya meisijiya commented Nov 27, 2026 •

Copy link
Copy Markdown

Update (rev 4)

The blocking sandbox issue and the path/write-scope points are addressed in bcd8fbd.

  • Lesson sandbox: the frame no longer carries allow-same-origin. The page is fetched and injected through srcdoc, with the local stylesheet and lesson-bridge.js inlined, so a lesson script cannot read the parent DOM or storage; connect-src 'none' and the opaque origin keep it away from /api/*. Checked in the running app: contentDocument === null, the lesson keeps its own styles, and the font-size control still works over postMessage.
  • Paths: resolveInside resolves the nearest existing ancestor with realpath, so a symlink inside the workspace cannot read or write outside it (checked with a junction). /api/fs/list refuses non-local (UNC) paths; the folder picker keeps browsing local drives.
  • Write scope: the main session now asks before writing a file the workbench does not own instead of allowing it automatically.
  • Tests and icon: npm test runs test/selftest.mjs (10 checks covering tags, path scope, lesson ownership and note naming); the default hello-miniapp icon is replaced with a plugin-specific one.

Not covered: macOS/Linux, external links opening in a tab, theme switching, and real drag-selection inside the lesson frame (the in-app browser tools cannot drive single elements of a cross-origin frame).
Add Learn Workbench, a teach-method learning workbench for MiniMax Code. Pick a learning folder, let the Agent write the mission and curriculum, and give every lesson its own branch conversation. It also annotates lessons, distils notes, and opens file links at the matching lines in an in-app panel.

Tested environment

  • MiniMax Code 3.1.19 on Windows 11 (10.0.26200).
  • Tested: setup; curriculum generation and regeneration (lesson titles, claimed files and statuses preserved); lesson generation; per-lesson rewrite; clean-then-regenerate; annotations and highlights; note extraction; the code-link panel; workspace create, import and remove.
  • Not verified: macOS, Linux, clients older than 3.1.19, and very long conversations.

Checks

  • node scripts/validate.mjs: plugins/meisijiya/learn-workbench: OK, examples/hello-miniapp: OK, repository: OK (0 errors, 0 warnings).
  • npm test: 94 pass, 2 fail. Both failures are the repository's own symlink tests in test/files.test.mjs, which fail with EPERM on Windows because creating symlinks requires Developer Mode or administrator rights. They are unrelated to this package and should pass on macOS/Linux.

Access

Declares agentAccess: ["session.run"], agentConcurrency: 4 and surface.window; minimum client MiniMax Code 3.1.2. No MCP endpoints, no device access, no host-navigation read. File access is limited to the learning folder the user picks; details are in the package README under "Data & access".

Written with MiniMax Code

A teach-method learning workbench: mission and curriculum written by the main conversation, a branch conversation per lesson that writes one self-contained HTML lesson, text-selection annotations with highlights, note extraction into Markdown, a floating code panel for file links such as main.py:608, and workspace management (create/import/remove, per-lesson regenerate, clean artifacts, model switch). The package is self-contained (no build step, no node_modules) and is the same code published at https://github.com/meisijiya/learn-workbench-miniapp.


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

@MyPrototypeWhat MyPrototypeWhat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Learn Workbench PR. We re-checked on 7e56fde8. This isn't ready to merge yet.

The blocking issue is the lesson iframe. Lessons are served same-origin from /w/... and loaded with sandbox="allow-scripts allow-same-origin allow-popups allow-modals" in app.js. LESSON_CSP sets connect-src 'none', which only blocks fetches made by the iframe itself. With allow-scripts and allow-same-origin together, a script in a lesson page can reach the parent page — its DOM, storage, and parent.fetch. We independently confirmed that code setup. A review run also showed that a lesson script could change the parent title, write the parent's localStorage and cookies, inject a script into the parent, and call /api/bootstrap (which includes home and drives) and /api/fs/list?path=/ through parent.fetch and get a 200. Dropping allow-same-origin turned those accesses into SecurityError. Lesson HTML is generated from web research and is allowed to run its own scripts, so this isn't just theoretical.

A few related points, not all of them blockers in the same way:

  • /api/fs/list will list any absolute directory. That fits the folder picker, but combined with the iframe issue, a lesson script can browse outside the workspace.
  • resolveInside (and the create path) only do lexical path.resolve / path.relative. They do not realpath, so a symlink inside the workspace can be read, and create can follow a link past the home-directory / drive-root string checks.
  • The main session automatically allowOnces writes to workspace files classified as other (neverProtect). If someone imports an existing project, that can touch non-workbench files. We did not run this through the Host to a disk write.
  • The icon is the default hello-miniapp bar-chart graphic. It is a real, recognizable image, so we are not blocking on that alone, but it is not specific to this plugin.
  • There are no package tests, and the PR body has no hosted screenshots or video of the product UI.

Please tighten the lesson sandbox so a lesson page cannot reach the parent page or its APIs, and look at the path and write-scope issues above. Happy to re-review once that's in.

- Notes: regenerate, delete and rename; optional refinement prompt; AI-written and manual tags

- Lessons: font size control, component library, teacher styles, note templates

- Shell: collapsible rail, compact top bar, reasoning effort, pause and resume
- The lesson frame drops allow-same-origin: markup is fetched and injected through srcdoc, so a lesson script cannot reach the parent page or its API

- Local stylesheets and the bridge are inlined; a cross-origin stylesheet is not applied in an opaque-origin frame

- Font size and theme travel over postMessage; external links are handed to the host to open in a tab
- resolveInside resolves symlinks, so a link inside the workspace cannot reach outside it

- /api/fs/list refuses non-local paths; the folder picker keeps browsing local drives

- The main session asks before writing files the workbench does not own

- test/selftest.mjs (npm test) covers tags, path scope and note naming; the default hello-miniapp icon is replaced
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.

2 participants