Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/update-visual-baselines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
persist-credentials: true
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 9.12.0
version: 10.34.9
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
fi
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 9.12.0
version: 10.34.9
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
registry=https://registry.npmjs.org/
node-linker=hoisted
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Plugins and Mini Apps can depend on platform capabilities, additional setup, or

## Build from source

You need Git, a supported Node.js version, and **pnpm 9.12.0**. On Windows, keep the checkout on a local NTFS volume outside cloud-synced folders.
You need Git, a supported Node.js version, and **pnpm 10.34.9**. On Windows, keep the checkout on a local NTFS volume outside cloud-synced folders.

```bash
git clone https://github.com/mcode-webui/minimax-code.git
Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ npm uninstall --global @minimax-webui/minimax-code

## 从源码构建

需要 Git、支持的 Node.js 版本以及 **pnpm 9.12.0**。Windows 上请把仓库放在本地 NTFS 卷中,并避开云同步目录。
需要 Git、支持的 Node.js 版本以及 **pnpm 10.34.9**。Windows 上请把仓库放在本地 NTFS 卷中,并避开云同步目录。

```bash
git clone https://github.com/mcode-webui/minimax-code.git
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ For npm, use the command in the README: it explicitly selects the public registr

This guide builds the 0.6.3 source preview. Workspace/local build manifests remain `private: true` to prevent accidental publishing. A source checkout may contain additional reviewed distribution changes; matching version strings alone do not establish byte-for-byte or build-provenance equivalence with the official npm tarball. Use the committed source revision and release receipt to identify a source build.

For a source build, you need Git, Node.js 22.19+ (22.x), 24.2+ (24.x), 25, or 26, and pnpm 9.12.0. Regular CI uses Node.js 24 across Linux and macOS. The weekly and manual compatibility matrix covers Node.js 22.19.0, 24.2.0, 25, and 26 on both platforms. Windows CI and source-candidate validation are temporarily paused while their checks are made reliable. Initial installation and build require access to public npm.
For a source build, you need Git, Node.js 22.19+ (22.x), 24.2+ (24.x), 25, or 26, and pnpm 10.34.9. Regular CI uses Node.js 24 across Linux and macOS. The weekly and manual compatibility matrix covers Node.js 22.19.0, 24.2.0, 25, and 26 on both platforms. Windows CI and source-candidate validation are temporarily paused while their checks are made reliable. Initial installation and build require access to public npm.

On Windows, check out this repository on a local NTFS volume before running `pnpm install`. The repository uses pnpm workspace links for vendored packages, and those links require NTFS junctions. FAT32/exFAT volumes, network shares, and other non-local Windows volumes cannot create the required junctions. The preflight command below verifies the volume and stops with a clear message before pnpm creates workspace links; run it immediately before `pnpm install`. It queries structured volume properties through Windows PowerShell and CIM, without requiring an elevated shell or parsing localized `fsutil` output. If PowerShell or CIM is unavailable or blocked, verification fails with the query error. A local NTFS volume can still contain a cloud-synced folder, which the preflight cannot identify reliably; keep the checkout outside OneDrive, Google Drive, Dropbox, and similar synced folders.

Expand All @@ -49,7 +49,7 @@ Node 24.0 and 24.1 are unsupported: their bundled libuv can return inconsistent
git clone https://github.com/MiniMax-AI/minimax-code.git
cd minimax-code
corepack enable
corepack prepare pnpm@9.12.0 --activate
corepack prepare pnpm@10.34.9 --activate
node scripts/check-windows-source-location.mjs
pnpm install --frozen-lockfile
pnpm build
Expand Down
25 changes: 3 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"description": "Standalone MiniMax Code TUI with managed accounts, BYOK models, cloud tools, plugins and ACP.",
"packageManager": "pnpm@9.12.0",
"packageManager": "pnpm@10.34.9",
"engines": {
"node": ">=22.19 <23 || >=24.2 <27"
},
Expand Down Expand Up @@ -61,8 +61,8 @@
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-prettier": "5.5.6",
"prettier": "3.9.9",
"eslint-plugin-prettier": "5.5.7",
"prettier": "3.10.1",
"shx": "^0.4.0",
"tar": "7.5.22",
"tsx": "4.23.15",
Expand All @@ -71,24 +71,5 @@
"vitest": "4.1.11",
"yaml": "2.9.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"better-sqlite3",
"esbuild",
"node-pty"
],
"overrides": {
"react": "18.3.1",
"react-dom": "18.3.1",
"@modelcontextprotocol/sdk>@hono/node-server": "2.0.12",
"minimatch@>=10.2.5>brace-expansion": "5.0.9",
"ajv>fast-uri": "3.1.6",
"express-rate-limit>ip-address": "10.4.0",
"vitest": "4.1.11",
"@vitest/coverage-v8": "4.1.11",
"vite": "7.3.6",
"hono": "4.13.5"
}
},
"license": "MIT"
}
6 changes: 3 additions & 3 deletions packages/local-runtime-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
"@modelcontextprotocol/sdk": "^1.30.0",
"@types/node": "^20",
"@types/proper-lockfile": "^4",
"dependency-cruiser": "18.4.0",
"jscpd": "^5.3.3",
"knip": "^6.38.0",
"dependency-cruiser": "18.7.2",
"jscpd": "^5.4.3",
"knip": "^6.45.1",
"typescript": "^5",
"vitest": "^2"
},
Expand Down
20 changes: 14 additions & 6 deletions packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ async function pluginDataDir(): Promise<string> {
return dir;
}

async function acquire(dir: string, client = 'webui'): Promise<MiniAppOwnerAcquisition> {
async function acquire(dir: string, client = 'webui', pluginId = 'fixture.miniapp'): Promise<MiniAppOwnerAcquisition> {
const acquisition = await acquireMiniAppOwner({
pluginDataDir: dir,
pluginId: 'fixture.miniapp',
pluginId,
identity: { client },
});
if (acquisition.kind === 'acquired') held.push(acquisition);
Expand Down Expand Up @@ -92,18 +92,26 @@ describe('Mini App ownership', () => {
const second = await pluginDataDir();

expect((await acquire(first)).kind).toBe('acquired');
expect((await acquire(second)).kind).toBe('acquired');
expect((await acquire(second, 'webui', 'fixture.second-miniapp')).kind).toBe('acquired');
});

it('names the endpoint after the plugin data directory, not a global path', async () => {
const first = await pluginDataDir();
const second = await pluginDataDir();

expect(resolveMiniAppOwnerEndpoint(first, 'fixture.miniapp')).not.toBe(
resolveMiniAppOwnerEndpoint(second, 'fixture.miniapp'),
expect(resolveMiniAppOwnerEndpoint(first, 'fixture.miniapp', 'linux')).not.toBe(
resolveMiniAppOwnerEndpoint(second, 'fixture.miniapp', 'linux'),
);
expect(resolveMiniAppOwnerEndpoint(first, 'fixture.miniapp', 'win32')).toMatch(
});

it('names the Windows pipe after the plugin ID', async () => {
const first = await pluginDataDir();
const second = await pluginDataDir();
const endpoint = resolveMiniAppOwnerEndpoint(first, 'fixture.miniapp', 'win32');
expect(endpoint).toMatch(
/^\\\\\.\\pipe\\mcode-miniapp-owner-[a-f0-9]{16}$/u,
);
expect(resolveMiniAppOwnerEndpoint(second, 'fixture.miniapp', 'win32')).toBe(endpoint);
expect(resolveMiniAppOwnerEndpoint(first, 'fixture.second-miniapp', 'win32')).not.toBe(endpoint);
});
});
2 changes: 1 addition & 1 deletion packages/tui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/node": "^20",
"@types/ws": "^8.18.1",
"ghostty-web": "^0.4.0",
"knip": "^6.38.0",
"knip": "^6.45.1",
"node-pty": "^1.0.0",
"typescript": "^5",
"vitest": "^2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ An absent session is reported as `none`; no session lookup or ended-session noti
A runtime that stops while the tab is open clears the view and reports the stop reason; it does not
restart the Mini App, because the tab may be unattended and a retry would start work the user did not
ask for. A retry is a user action.
A failed start leaves an actionable “not opened” state in the mounted view, alongside the
attempt's error toast. Dismissing the toast does not remove the state or its explicit retry
control. Only an `OWNED_ELSEWHERE` refusal tells the user to close the other client's app;
a generic preparation failure does not establish ownership. Retry uses the normal open
operation, never a takeover, and polling does not restart a failed presentation. If
another tab holds the presentation lease, the failed inline view only reads until the
lease releases, then reveals the retry control. Stop or lease failures do not create
this failed-start state.


### The standalone presentation is a lease

Expand Down
12 changes: 12 additions & 0 deletions packages/webui/docs/client/composer.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ text preserves the target draft. Synchronous subscribers can edit the committed
later transfer write replacing their changes. Conflicts publish nothing and keep the retained source;
the notice shows a transfer error beside its action so the user can select another destination and retry.

## Workspace folder selection

For a locally launched Windows WebUI with a native directory-picker grant, opening
`选择新项目` offers `选择此电脑上的文件夹` and `添加文件夹`. The add action opens the
native Windows directory chooser; confirming a folder changes the next session's work
directory. Cancelling the system chooser, dismissing the WebUI dialog or failing to
open the chooser does not change the current workspace.

Remote browsers and launches without the local grant use the existing server
directory browser instead. Its paths refer to the machine running WebUI, not
to the browser's device. The native entry also offers this fallback explicitly.

## Where the pieces live

- The surface is `client/features/composer/ui/WebuiComposer.tsx`, with the editor staging, menus,
Expand Down
2 changes: 1 addition & 1 deletion packages/webui/docs/runtime/boot.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ session transfer · the terminal process manager (one per service) · the six sl

| Entry | Path | Notes |
| --- | --- | --- |
| Development server | `scripts/run-webui-server.mjs` via `pnpm --filter @mavis/webui dev:server` | Spawns itself under `tsx` with the repository's `tsconfig.standalone.json`; assembles the host, constructs `new WebuiService(...)` with the registry and the terminal manager, calls `service.start()`, and closes the service on SIGINT/SIGTERM or an authenticated `POST /webui-shutdown`. The HTTP route acknowledges the request before the same bounded process cleanup starts. Serves the built client from `dist-webui/client/`. `WEBUI_SERVER_PORT` overrides 2233. `WEBUI_HOST` overrides the bind address (`127.0.0.1` by default); a wider bind prints the LAN URLs and the per-start credential, and a request that did not arrive over loopback presents that credential (ADR 0031). |
| Development server | `scripts/run-webui-server.mjs` via `pnpm --filter @mavis/webui dev:server` | Spawns itself under `tsx` with the repository's `tsconfig.standalone.json`; assembles the host, constructs `new WebuiService(...)` with the registry and the terminal manager, calls `service.start()`, and closes the service on SIGINT/SIGTERM or an authenticated `POST /webui-shutdown`. The HTTP route acknowledges the request before the same bounded process cleanup starts. The menu treats only the route's affirmative receipt as acceptance; a missing or invalid reply leaves the outcome unconfirmed and offers a manual retry. The browser's receipt timeout does not cancel server cleanup. Serves the built client from `dist-webui/client/`. `WEBUI_SERVER_PORT` overrides 2233. `WEBUI_HOST` overrides the bind address (`127.0.0.1` by default); a wider bind prints the LAN URLs and the per-start credential, and a request that did not arrive over loopback presents that credential (ADR 0031). |
| Packaged service | `runtime/index.ts` + `server/index.ts` | The runtime's public entry and the server build entry. `scripts/build-webui.mjs` bundles both. |
| npm preview package | `release/webui-npm/` | See [`../releasing.md`](../releasing.md). |

Expand Down
6 changes: 3 additions & 3 deletions packages/webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/ws": "8.18.1",
"autoprefixer": "10.4.20",
"postcss": "8.5.28",
"autoprefixer": "10.6.2",
"postcss": "8.5.32",
"postcss-import": "15.1.0",
"tailwindcss": "3.4.17",
"tsx": "4.23.13",
"tsx": "4.23.15",
"typescript": "5.9.3",
"vite": "7.3.6",
"vitest": "4.1.11"
Expand Down
5 changes: 5 additions & 0 deletions packages/webui/src/client/bindings/browser-capabilities.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { createContext, useContext, type ReactNode } from "react";
import { EMPTY_WEBUI_BROWSER_DOM, type WebuiBrowserDom } from "../platform/browser-dom.js";
import type { NativeWorkspaceDirectoryResult } from "../platform/native-directory-picker.js";
import { createWebuiBrowserStorage, type WebuiBrowserStorage } from "../platform/storage.js";

export interface WebuiBrowserCapabilities {
readonly dom: WebuiBrowserDom;
readonly storage: WebuiBrowserStorage;
readonly nativeDirectoryPicker?: {
readonly available: () => boolean;
readonly choose: (signal: AbortSignal) => Promise<NativeWorkspaceDirectoryResult>;
};
/**
* The runtime's data directory, when the host served the page with one.
*
Expand Down
34 changes: 32 additions & 2 deletions packages/webui/src/client/bindings/use-webui-shutdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ import { useCallback } from "react";

import { requestWebuiShutdown } from "../platform/webui-shutdown.js";

export function useWebuiShutdown(): () => Promise<void> {
return useCallback(() => requestWebuiShutdown(), []);
type WebuiShutdownOutcome =
| { readonly kind: "accepted" }
| { readonly kind: "unconfirmed" | "refused"; readonly message: string };

const unconfirmed: WebuiShutdownOutcome = {
kind: "unconfirmed",
message: "未收到关闭确认,无法确定服务是否已停止。你可以关闭此提示,或手动重试。",
};

export function useWebuiShutdown(): () => Promise<WebuiShutdownOutcome> {
return useCallback(async (): Promise<WebuiShutdownOutcome> => {
try {
const receipt = await requestWebuiShutdown();
switch (receipt.kind) {
case "accepted":
return { kind: "accepted" };
case "not-connected":
return { kind: "refused", message: "当前 WebUI 未连接运行时,无法关闭服务。" };
case "refused":
return {
kind: "refused",
message: receipt.status === 404
? "当前 WebUI 不支持关闭服务。"
: `关闭服务失败(HTTP ${receipt.status})。`,
};
case "unknown":
return unconfirmed;
}
} catch {
return unconfirmed;
}
}, []);
}
13 changes: 7 additions & 6 deletions packages/webui/src/client/features/account/ui/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ export function UserMenu({
setShutdownBusy(true);
setShutdownError(undefined);
try {
await shutdown();
// The service answers before it stops, so the page is still alive here;
// the connection drop is what tells the person the server is gone.
setShutdownOpen(false);
} catch (error: unknown) {
setShutdownError(error instanceof Error ? error.message : String(error));
const outcome = await shutdown();
if (outcome.kind === "accepted") {
// The host accepted the request, not necessarily stopped already.
setShutdownOpen(false);
} else {
setShutdownError(outcome.message);
}
} finally {
setShutdownBusy(false);
}
Expand Down
Loading
Loading