diff --git a/.github/workflows/update-visual-baselines.yml b/.github/workflows/update-visual-baselines.yml index 6410f95ed..d10309d16 100644 --- a/.github/workflows/update-visual-baselines.yml +++ b/.github/workflows/update-visual-baselines.yml @@ -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" diff --git a/.github/workflows/webui-ci.yml b/.github/workflows/webui-ci.yml index 0d0d026bb..22c290c1d 100644 --- a/.github/workflows/webui-ci.yml +++ b/.github/workflows/webui-ci.yml @@ -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" diff --git a/.npmrc b/.npmrc index 3d4e2c0f3..214c29d13 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1 @@ registry=https://registry.npmjs.org/ -node-linker=hoisted diff --git a/README.md b/README.md index 78c34f39c..dd63c0999 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README_ZH.md b/README_ZH.md index d60cebcb8..b2b6e9d27 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -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 diff --git a/docs/installation.md b/docs/installation.md index eaa64b2af..99337660b 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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. @@ -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 diff --git a/package.json b/package.json index 08b098b7e..0b2a76294 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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", @@ -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" } diff --git a/packages/local-runtime-v2/package.json b/packages/local-runtime-v2/package.json index 0ceb44949..efff57c45 100644 --- a/packages/local-runtime-v2/package.json +++ b/packages/local-runtime-v2/package.json @@ -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" }, diff --git a/packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts b/packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts index b0ca2fb24..ccd372a4a 100644 --- a/packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts +++ b/packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts @@ -28,10 +28,10 @@ async function pluginDataDir(): Promise { return dir; } -async function acquire(dir: string, client = 'webui'): Promise { +async function acquire(dir: string, client = 'webui', pluginId = 'fixture.miniapp'): Promise { const acquisition = await acquireMiniAppOwner({ pluginDataDir: dir, - pluginId: 'fixture.miniapp', + pluginId, identity: { client }, }); if (acquisition.kind === 'acquired') held.push(acquisition); @@ -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); }); }); diff --git a/packages/tui/package.json b/packages/tui/package.json index fc7a84b85..c860ffb2b 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -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" diff --git a/packages/webui/docs/adr/0020-webui-miniapp-view-and-runtime-seams.md b/packages/webui/docs/adr/0020-webui-miniapp-view-and-runtime-seams.md index 326e9dddb..f9dbdea6d 100644 --- a/packages/webui/docs/adr/0020-webui-miniapp-view-and-runtime-seams.md +++ b/packages/webui/docs/adr/0020-webui-miniapp-view-and-runtime-seams.md @@ -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 diff --git a/packages/webui/docs/client/composer.md b/packages/webui/docs/client/composer.md index 74767cc65..692da66db 100644 --- a/packages/webui/docs/client/composer.md +++ b/packages/webui/docs/client/composer.md @@ -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, diff --git a/packages/webui/docs/runtime/boot.md b/packages/webui/docs/runtime/boot.md index 7bb3e7954..ae5863eff 100644 --- a/packages/webui/docs/runtime/boot.md +++ b/packages/webui/docs/runtime/boot.md @@ -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). | diff --git a/packages/webui/package.json b/packages/webui/package.json index 0966c11bc..b7249fb95 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -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" diff --git a/packages/webui/src/client/bindings/browser-capabilities.tsx b/packages/webui/src/client/bindings/browser-capabilities.tsx index 889dea434..06b52a040 100644 --- a/packages/webui/src/client/bindings/browser-capabilities.tsx +++ b/packages/webui/src/client/bindings/browser-capabilities.tsx @@ -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; + }; /** * The runtime's data directory, when the host served the page with one. * diff --git a/packages/webui/src/client/bindings/use-webui-shutdown.ts b/packages/webui/src/client/bindings/use-webui-shutdown.ts index ed8fef5a8..b1d4f6e68 100644 --- a/packages/webui/src/client/bindings/use-webui-shutdown.ts +++ b/packages/webui/src/client/bindings/use-webui-shutdown.ts @@ -12,6 +12,36 @@ import { useCallback } from "react"; import { requestWebuiShutdown } from "../platform/webui-shutdown.js"; -export function useWebuiShutdown(): () => Promise { - 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 { + return useCallback(async (): Promise => { + 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; + } + }, []); } diff --git a/packages/webui/src/client/features/account/ui/UserMenu.tsx b/packages/webui/src/client/features/account/ui/UserMenu.tsx index c478a1313..b5a1957e0 100644 --- a/packages/webui/src/client/features/account/ui/UserMenu.tsx +++ b/packages/webui/src/client/features/account/ui/UserMenu.tsx @@ -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); } diff --git a/packages/webui/src/client/features/composer/ui/ComposerProjectRow.tsx b/packages/webui/src/client/features/composer/ui/ComposerProjectRow.tsx index ce9996484..625d6df29 100644 --- a/packages/webui/src/client/features/composer/ui/ComposerProjectRow.tsx +++ b/packages/webui/src/client/features/composer/ui/ComposerProjectRow.tsx @@ -15,11 +15,12 @@ // a layer of its own, so the coordinator dismisses it and it keeps no listener. // The menu's open state stays a prop because the shell owns it. -import { useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { WebuiDropdown } from "../../../ui/Dropdown.js"; import { WebuiButton } from "../../../ui/button.js"; import { WebuiDialog } from "../../../ui/dialog.js"; +import { useWebuiToastError } from "../../../ui/toast.js"; import { useWebuiBrowserCapabilities } from "../../../bindings/browser-capabilities.js"; import { workspaceProjectName } from "../../../features/workspace/projection/workspace-name.public.js"; import { WebuiWorkspaceDirectoryBrowser } from "../../../features/workspace/ui/WebuiWorkspaceDirectoryBrowser.public.js"; @@ -44,8 +45,63 @@ export function WebuiComposerProjectRow({ onMenuOpenChange, onSelectProject, }: WebuiComposerProjectRowProps) { + const { dom, nativeDirectoryPicker } = useWebuiBrowserCapabilities(); const [browserOpen, setBrowserOpen] = useState(false); - const { dom } = useWebuiBrowserCapabilities(); + const [nativeMode, setNativeMode] = useState(false); + const [nativePending, setNativePending] = useState(false); + const [nativeError, setNativeError] = useState(""); + useWebuiToastError(nativeError); + const request = useRef(null); + const nativeAddButton = useRef(null); + useEffect(() => () => { + request.current?.abort(); + request.current = null; + }, []); + + function closeBrowser() { + request.current?.abort(); + request.current = null; + setNativePending(false); + setNativeError(""); + setBrowserOpen(false); + } + + function showServerBrowser() { + request.current?.abort(); + request.current = null; + setNativePending(false); + setNativeError(""); + setNativeMode(false); + } + + async function addFolder() { + if (!nativeDirectoryPicker || request.current) return; + const current = new AbortController(); + request.current = current; + setNativePending(true); + setNativeError(""); + try { + const result = await nativeDirectoryPicker.choose(current.signal); + if (request.current !== current) return; + if (result.kind === "selected") { + closeBrowser(); + onSelectProject(result.directory); + } else if (result.kind === "unavailable") { + showServerBrowser(); + } + } catch (error) { + if (request.current === current) { + setNativeError(error instanceof Error && !(error instanceof TypeError) + ? error.message + : "无法打开系统目录选择,请重试或选择服务端目录。"); + } + } finally { + if (request.current === current) { + request.current = null; + setNativePending(false); + } + } + } return (
@@ -125,6 +181,7 @@ export function WebuiComposerProjectRow({ className="webui-workspace-option" onClick={() => { onMenuOpenChange(false); + setNativeMode(nativeDirectoryPicker?.available() ?? false); setBrowserOpen(true); }} > @@ -150,25 +207,41 @@ export function WebuiComposerProjectRow({ setBrowserOpen(false)} + initialFocusRef={nativeMode ? nativeAddButton : undefined} + onClose={closeBrowser} dismissOnEscape dismissOnBackdrop testId="webui-workspace-browser-dialog" dataAttributes={{ "data-webui-workspace-browser-dialog": "true" }} bodyClassName="webui-workspace-browser-dialog-body" > - { - setBrowserOpen(false); - onSelectProject(dir); - }} - onCancel={() => setBrowserOpen(false)} - /> + {nativeMode ? ( +
+
+ void addFolder()}> + {nativePending ? "正在等待系统选择窗口…" : "+ 添加文件夹"} + + + 浏览服务端目录 + +
+
+ ) : ( + { + closeBrowser(); + onSelectProject(dir); + }} + onCancel={closeBrowser} + /> + )}
diff --git a/packages/webui/src/client/features/miniapp/application/miniapp-workflows.ts b/packages/webui/src/client/features/miniapp/application/miniapp-workflows.ts index 07831a6da..9319aef50 100644 --- a/packages/webui/src/client/features/miniapp/application/miniapp-workflows.ts +++ b/packages/webui/src/client/features/miniapp/application/miniapp-workflows.ts @@ -81,10 +81,12 @@ const MINIAPP_PRESENTATION_RECONNECT_GRACE_MS = 300; * `open` carries the proxy's view URL and nothing else — not the Mini App's * origin, not its surface path, not the credential its guard demands. `stopped` * is a cleared view that remembers why, which is what the panel renders instead - * of a dead frame. + * of a dead frame. `failed` retains an unsuccessful start until the person + * retries; a stop or lease failure cannot create that state. */ export type WebuiMiniAppPresentation = | { readonly kind: "opening" } + | { readonly kind: "failed"; readonly refusal: WebuiMiniAppRefusal } | { readonly kind: "open"; readonly viewUrl: string; @@ -221,9 +223,13 @@ function refusalOf(error: unknown): WebuiMiniAppRefusal { error && typeof error === "object" && typeof (error as { code?: unknown }).code === "string" ? ((error as { code: string }).code) : "harness_error"; + const message = error instanceof Error ? error.message : String(error); + const reasonCode = code === "MINIAPP_PREPARATION_FAILED" && error instanceof Error + ? (error as { reasonCode?: unknown }).reasonCode + : undefined; return { - code, - message: error instanceof Error ? error.message : String(error), + code: reasonCode === "OWNED_ELSEWHERE" ? reasonCode : code, + message: typeof reasonCode === "string" ? `${message} (${reasonCode})` : message, }; } @@ -663,13 +669,16 @@ export function createWebuiMiniAppWorkflows(deps: { } catch (error) { if (!isCurrent()) return false; const refusal = refusalOf(error); - setPresentation(pluginId, undefined); + setPresentation(pluginId, { kind: "failed", refusal }); setRefusal(pluginId, refusal); // The runtime refused to start, so the row it refused about is stale: a // capacity refusal names the running apps, and those names come from here. await loadListing(true); if (!isCurrent()) return false; setRefusal(pluginId, refusal); + // An explicit retry does not run inside the observer. Restart the + // read-only clock if this fresh catalogue reported a detached lease. + scheduleObservation(); return false; } finally { if (currentOperation(pluginId, revision) && !isInterested() && state.presentations[pluginId]?.kind === "opening") @@ -873,7 +882,7 @@ export function createWebuiMiniAppWorkflows(deps: { const existing = current.presentations[pluginId]; if (existing?.kind === "opening") return "presented"; // A cleared presentation or a refusal is the person's to retry, never a timer's. - if (existing?.kind === "stopped" || current.refusals[pluginId] !== undefined) return "blocked"; + if (existing?.kind === "stopped" || existing?.kind === "failed" || current.refusals[pluginId] !== undefined) return "blocked"; let catalogue: WebuiMiniAppCatalogue | undefined; try { catalogue = observed ? observed.catalogue : await readCatalogue(); @@ -1245,9 +1254,14 @@ export function createWebuiMiniAppWorkflows(deps: { }); // One clock for interested readers. A slow read never overlaps the next tick. - const needsClock = (): boolean => [...presentationInterests.keys()].some((pluginId) => { + const needsClock = (): boolean => [...presentationInterests].some(([pluginId, interest]) => { const presentation = state.presentations[pluginId]; - return presentation?.kind === "open" || + // A failed inline start can race with another document taking the lease. + // Keep reading while that document owns the view so its departure can + // reveal the manual retry. The observer never opens a failed presentation. + const waitingForDetachedLease = presentation?.kind === "failed" && !interest.standalone && + state.listing.rows.some((row) => row.pluginId === pluginId && row.detached); + return presentation?.kind === "open" || waitingForDetachedLease || (presentation === undefined && state.refusals[pluginId] === undefined); }) || [...listingInterests.values()].some((kind) => kind === "launcher"); diff --git a/packages/webui/src/client/features/miniapp/ui/MiniAppView.public.tsx b/packages/webui/src/client/features/miniapp/ui/MiniAppView.public.tsx index 27f0621be..904ff2fed 100644 --- a/packages/webui/src/client/features/miniapp/ui/MiniAppView.public.tsx +++ b/packages/webui/src/client/features/miniapp/ui/MiniAppView.public.tsx @@ -80,7 +80,7 @@ import { import { sessionHash } from "../../../projection/common/router.js"; import { FeedbackLiveRegion } from "../../../ui/feedback.js"; import { useWebuiToastError } from "../../../ui/toast.js"; -import { WebuiIconButton } from "../../../ui/button.js"; +import { WebuiButton, WebuiIconButton } from "../../../ui/button.js"; import { WebuiSkeletonProjection } from "../../../ui/page.js"; import { FeedbackEmpty } from "../../../ui/feedback.js"; import { @@ -164,8 +164,8 @@ export function MiniAppView({ * so reporting itself as "open elsewhere" would be the one wrong answer. */ const detached = !standalone && row?.detached === true; - /* The app that stopped and the start that was refused are events, not - * states: each is said once, and the view keeps the surface it has. */ + /* The toasts report individual operations. A failed start separately + * keeps an explicit recovery action in the view. */ useWebuiToastError( presentation?.kind === "stopped" && !detached ? presentation.reason : undefined, { testId: "miniapp-view-stopped" }, @@ -739,6 +739,23 @@ export function MiniAppView({ ) : null} + {presentation?.kind === "failed" && !detached ? ( + // The toast reports the attempt; this state remains until another + // explicit open succeeds. Polling must never restart a failed app. +
+ workflows?.open(pluginId)} + >重试打开应用} + /> +
+ ) : null} {detached ? (
{ + const target = readWebuiSessionTransferTarget(); + if (!launch || !target?.token || target.origin !== launch.origin) return { kind: "unavailable" }; + const response = await globalThis.fetch(`${launch.origin}/native-directory-picker`, { + method: "POST", credentials: "same-origin", signal, + headers: { "X-Webui-Native-Grant": launch.grant, "X-Webui-Token": target.token }, + }); + if ([401, 403, 404].includes(response.status)) { launch = undefined; return { kind: "unavailable" }; } + if (!response.ok) throw new Error(response.status === 409 ? "已有系统目录选择窗口,请先完成或取消。" : "系统目录选择失败,请重试或选择服务端目录。"); + const result: unknown = await response.json(); + if (result && typeof result === "object" && "kind" in result) { + if (result.kind === "cancelled") return { kind: "cancelled" }; + if (result.kind === "selected" && "directory" in result && typeof result.directory === "string" && result.directory.length > 0) + return { kind: "selected", directory: result.directory }; + } + throw new Error("系统目录选择返回了无效结果。"); +} diff --git a/packages/webui/src/client/platform/webui-shutdown.ts b/packages/webui/src/client/platform/webui-shutdown.ts index 3155e8be4..60232163b 100644 --- a/packages/webui/src/client/platform/webui-shutdown.ts +++ b/packages/webui/src/client/platform/webui-shutdown.ts @@ -18,14 +18,19 @@ export interface WebuiShutdownOptions { readonly token?: string; } -/** The server refused the request, or the server could not be reached. */ -export class WebuiShutdownRefused extends Error { - override readonly name = "WebuiShutdownRefused"; -} +export type WebuiShutdownReceipt = + | { readonly kind: "accepted" } + | { readonly kind: "refused"; readonly status: number } + | { readonly kind: "not-connected" } + | { readonly kind: "unknown" }; + +// This bounds how long the confirmation stays busy, not how long the +// server may take to stop. Aborting cannot revoke an already sent request. +const SHUTDOWN_RECEIPT_TIMEOUT_MS = 5_000; export async function requestWebuiShutdown( options: WebuiShutdownOptions = {}, -): Promise { +): Promise { // Presence is checked, not truthiness: an injected empty token is a valid // dev target, and falling back to the global for it would silently ignore // the caller's origin. @@ -33,21 +38,40 @@ export async function requestWebuiShutdown( options.origin !== undefined && options.token !== undefined ? { origin: options.origin, token: options.token } : readWebuiSessionTransferTarget(); - if (!target) { - throw new WebuiShutdownRefused("当前 WebUI 未连接运行时,无法关闭服务。"); - } + if (!target) return { kind: "not-connected" }; const query = new URLSearchParams({ token: target.token }); const doFetch = options.fetchImpl ?? globalThis.fetch; - const response = await doFetch( - `${target.origin}/webui-shutdown?${query.toString()}`, - { method: "POST" }, - ); - if (!response.ok) { - throw new WebuiShutdownRefused( - response.status === 404 - ? "当前 WebUI 不支持关闭服务。" - : `关闭服务失败(HTTP ${response.status})。`, + try { + const response = await doFetch( + `${target.origin}/webui-shutdown?${query.toString()}`, + { + method: "POST", + redirect: "error", + signal: AbortSignal.timeout(SHUTDOWN_RECEIPT_TIMEOUT_MS), + }, ); + if (!response.ok) { + // A gateway failure or timeout can happen after the origin received + // the POST. Only an explicit client rejection is definitive. + return response.status >= 400 && response.status < 500 && response.status !== 408 + ? { kind: "refused", status: response.status } + : { kind: "unknown" }; + } + + // A proxy or stale page can answer 200 without accepting the request. + // The host's receipt also does not claim the process has stopped yet. + const body: unknown = await response.json(); + if ( + typeof body === "object" && body !== null && + "ok" in body && body.ok === true && + "closing" in body && body.closing === true + ) { + return { kind: "accepted" }; + } + } catch { + // A network failure, timeout or unreadable reply proves neither that + // the request was rejected nor that the service stopped. No auto-retry. } + return { kind: "unknown" }; } diff --git a/packages/webui/src/client/platform/wire.ts b/packages/webui/src/client/platform/wire.ts index 23775b5b9..f2db1af49 100644 --- a/packages/webui/src/client/platform/wire.ts +++ b/packages/webui/src/client/platform/wire.ts @@ -467,7 +467,7 @@ export function createWebuiWire({ // stable code intact instead of turning every refusal into one shape. fail( session, - new WebuiWireError(frame.code, frame.message, frame.requestId), + new WebuiWireError(frame.code, frame.message, frame.requestId, frame.reasonCode), ); return; } diff --git a/packages/webui/src/server/http/native-directory.ts b/packages/webui/src/server/http/native-directory.ts new file mode 100644 index 000000000..3fe8f37e5 --- /dev/null +++ b/packages/webui/src/server/http/native-directory.ts @@ -0,0 +1,107 @@ +// Desktop capability supplied only by an interactive local launcher. General +// WebUI credentials alone never authorize opening native desktop UI. +import type { IncomingMessage, ServerResponse } from "node:http"; +import { timingSafeEqual } from "node:crypto"; +import { credentialPresented, type WebuiCredential } from "../credentials.js"; +import { stat } from "node:fs/promises"; +import { isAbsolute } from "node:path"; +import { rejectHttp } from "./responses.js"; + +export interface WebuiNativeDirectoryPicker { + readonly grant: string; + /** Abort must close the owned dialog and settle after its process exits. */ + choose(signal: AbortSignal): Promise<{ readonly kind: "selected"; readonly directory: string } | { readonly kind: "cancelled" }>; + dispose(): Promise; +} +interface Admission { + readonly host: string; + readonly port?: number; + readonly fullAccess?: boolean; + readonly credential: WebuiCredential; +} +const loopback = (value: string | undefined) => value === "127.0.0.1" || value === "::1" || value === "::ffff:127.0.0.1"; +function equalSecret(value: string | string[] | undefined, expected: string): boolean { + if (typeof value !== "string" || !expected) return false; + const a = Buffer.from(value); const b = Buffer.from(expected); + return a.length === b.length && timingSafeEqual(a, b); +} +/** Same absolute/existing-directory semantics as the operation validator, + * but never block the HTTP event loop on a disconnected Windows share. The OS + * stat itself is not cancellable; its late result is ignored after the bound. */ +export async function validateNativeDirectory( + directory: string, + timeoutMs = 3_000, + inspect: (path: string) => Promise<{ isDirectory(): boolean }> = stat, +): Promise { + if (typeof directory !== "string" || !isAbsolute(directory)) return false; + let timer: ReturnType | undefined; + try { + return await Promise.race([ + Promise.resolve().then(() => inspect(directory)).then(value => value.isDirectory(), () => false), + new Promise(resolve => { timer = setTimeout(() => resolve(false), timeoutMs); }), + ]); + } finally { clearTimeout(timer); } +} +export function createNativeDirectoryRoute(picker: WebuiNativeDirectoryPicker, timeoutMs = 120_000) { + let active: { controller: AbortController; settled: Promise } | undefined; + let closed = false; + return { + async handle(request: IncomingMessage, response: ServerResponse, context: Admission): Promise { + response.setHeader("Cache-Control", "no-store"); + const authority = context.host === "::1" ? `[::1]:${context.port}` : `${context.host}:${context.port}`; + if (closed || context.fullAccess || !loopback(context.host) || !loopback(request.socket.remoteAddress) || + !context.port || request.headers.host !== authority || request.headers.origin !== `http://${authority}` || + request.headers["sec-fetch-site"] !== "same-origin" || + Object.keys(request.headers).some((key) => key === "forwarded" || key.startsWith("x-forwarded-")) || + !equalSecret(request.headers["x-webui-native-grant"], picker.grant)) { + rejectHttp(response, 403, "Native directory selection unavailable"); return; + } + if (!credentialPresented(context.credential, + typeof request.headers["x-webui-token"] === "string" ? request.headers["x-webui-token"] : undefined, + request.headers.cookie)) { + rejectHttp(response, 401, "Unauthorized"); return; + } + // This command takes no client path, command or options. Empty POST only. + if ((request.headers["content-length"] !== undefined && request.headers["content-length"] !== "0") || + request.headers["transfer-encoding"] !== undefined) { + rejectHttp(response, 400, "Native directory selection accepts no body"); return; + } + if (active) { rejectHttp(response, 409, "A directory chooser is already open"); return; } + const controller = new AbortController(); + const abort = () => { if (!response.writableEnded) controller.abort(); }; + request.once("aborted", abort); response.once("close", abort); + const timer = setTimeout(() => controller.abort(), timeoutMs); + // Defer choose so the singleton exists even if a provider throws synchronously. + const settled = Promise.resolve().then(() => picker.choose(controller.signal)); + active = { controller, settled }; + try { + const result = await settled; + if (response.destroyed) return; + if (controller.signal.aborted || result.kind === "cancelled") { + response.setHeader("Content-Type", "application/json"); response.end(JSON.stringify({ kind: "cancelled" })); return; + } + const valid = await validateNativeDirectory(result.directory); + if (response.destroyed) return; + if (controller.signal.aborted) { + response.setHeader("Content-Type", "application/json"); response.end(JSON.stringify({ kind: "cancelled" })); return; + } + if (!valid) { rejectHttp(response, 422, "The selected directory is no longer available"); return; } + response.setHeader("Content-Type", "application/json"); + response.end(JSON.stringify({ kind: "selected", directory: result.directory })); + } catch { + if (!response.destroyed) { + // An abort request is not proof that the native window closed. Only + // the provider's settled cancellation result establishes that. + rejectHttp(response, 503, "Native directory selection failed"); + } + } finally { + clearTimeout(timer); request.off("aborted", abort); response.off("close", abort); active = undefined; + } + }, + async dispose(): Promise { + closed = true; active?.controller.abort(); + await picker.dispose(); + await active?.settled.catch(() => undefined); + }, + }; +} diff --git a/packages/webui/src/server/http/router.ts b/packages/webui/src/server/http/router.ts index 260dd80f8..ff18b1056 100644 --- a/packages/webui/src/server/http/router.ts +++ b/packages/webui/src/server/http/router.ts @@ -1,3 +1,4 @@ +import type { createNativeDirectoryRoute } from "./native-directory.js"; // HTTP router for the loopback service: dispatch one admitted request to the // session-transfer, workspace-file or static client-asset route. Split from // `service.ts` with no behaviour change — the admission order, route order, @@ -26,6 +27,7 @@ import type { WebuiBrowserExtensionPackage } from "../browser-bridge/extension-p export interface WebuiHttpRouterContext { readonly host: string; + readonly nativeDirectoryRoute?: ReturnType; /** The TCP port the kernel allocated, once `start()` has resolved. */ readonly boundTcpPort: () => number | undefined; /** The configured TCP port, used as the client-asset fallback before bind. */ @@ -97,6 +99,16 @@ export async function serveHttpRequest( await serveDesignAsset(request, response, url, context.port); return; } + if (url.pathname === "/native-directory-picker") { + if (request.method !== "POST" || url.search || !context.nativeDirectoryRoute) { + rejectHttp(response, 404, "Not Found"); return; + } + await context.nativeDirectoryRoute.handle(request, response, { + host: context.host, port: context.boundTcpPort(), credential: context.credential, + fullAccess: context.fullAccess, + }); + return; + } if (request.method === "GET" && url.pathname === "/session-transfer") { await handleSessionTransfer(url, response, context.port); return; diff --git a/packages/webui/src/server/index.ts b/packages/webui/src/server/index.ts index 9ee152b7a..953424533 100644 --- a/packages/webui/src/server/index.ts +++ b/packages/webui/src/server/index.ts @@ -130,3 +130,5 @@ export type { WebuiPermissionDecision, } from "../shared/contracts/interactions.js"; export type { WebuiModelEntry } from "../shared/contracts/models.js"; + +export type { WebuiNativeDirectoryPicker } from "./http/native-directory.js"; diff --git a/packages/webui/src/server/operation/operation-dispatch.ts b/packages/webui/src/server/operation/operation-dispatch.ts index 8ca728e00..bfe0c0663 100644 --- a/packages/webui/src/server/operation/operation-dispatch.ts +++ b/packages/webui/src/server/operation/operation-dispatch.ts @@ -9,6 +9,7 @@ import { type WebuiWireErrorCode, } from "../../shared/envelope.js"; import type { WebuiOperationRegistryEntry } from "./operations.js"; +import { OPEN_MINI_APP_OPERATION_NAME } from "../../shared/operation-names.js"; /** * The stable code a thrown failure carries, if it names one. @@ -150,11 +151,23 @@ export async function dispatchWebuiFrame( sendFrame(ws, responseFrame(parsed.requestId, result.body)); } catch (error) { const message = error instanceof Error ? error.message : String(error); + const code = stableCodeOf(error); + const miniAppPreparationFailed = parsed.operation === OPEN_MINI_APP_OPERATION_NAME && + code === "MINIAPP_PREPARATION_FAILED"; + let reasonCode: string | undefined; + if (miniAppPreparationFailed) { + const reason = (error as { reasonCode?: unknown }).reasonCode ?? + (error instanceof Error ? stableCodeOf(error.cause) : undefined); + if (typeof reason === "string" && /^[A-Z][A-Z0-9_]{0,63}$/u.test(reason)) { + reasonCode = reason; + } + console.warn("[webui] Mini App publication preparation failed", { code, reasonCode }); + } // The capability's own stable code is preserved; only a failure that names // no code at all becomes `harness_error`. sendFrame( ws, - errorFrame(parsed.requestId, stableCodeOf(error), message), + errorFrame(parsed.requestId, code, message, reasonCode), ); } } @@ -201,6 +214,7 @@ export function errorFrame( requestId: string, code: string, message: string, + reasonCode?: string, ): WebuiErrorFrame { return { protocolVersion: WEBUI_PROTOCOL_VERSION, @@ -208,5 +222,6 @@ export function errorFrame( requestId, code, message, + ...(reasonCode !== undefined ? { reasonCode } : {}), }; } diff --git a/packages/webui/src/server/service.ts b/packages/webui/src/server/service.ts index 0b2a9d016..d1cf511dc 100644 --- a/packages/webui/src/server/service.ts +++ b/packages/webui/src/server/service.ts @@ -18,6 +18,8 @@ // Shutdown order is the close order `../docs/runtime/boot.md` states: stop accepting // new operations, then close every connection, then close the harness. +import { createNativeDirectoryRoute, type WebuiNativeDirectoryPicker } from "./http/native-directory.js"; + import type { IncomingMessage, Server, ServerResponse } from "node:http"; import type { WebuiOperationRegistryEntry } from "./operation/operations.js"; @@ -152,6 +154,7 @@ export interface WebuiServiceOptions { * it. Absent when the host has none. */ readonly requestShutdown?: () => void; + readonly nativeDirectoryPicker?: WebuiNativeDirectoryPicker; /** Optional server factory; tests inject an HTTP server without listening. */ readonly httpServerFactory?: () => Server; /** @@ -279,6 +282,7 @@ export class WebuiService { ...(this.browserBridge ? { browserBridge: this.browserBridge } : {}), }); this.httpContext = { + ...(options.nativeDirectoryPicker ? { nativeDirectoryRoute: createNativeDirectoryRoute(options.nativeDirectoryPicker) } : {}), host: this.host, boundTcpPort: () => this.bound?.info.tcpPort, configuredTcpPort: this.tcpPort, @@ -367,6 +371,9 @@ export class WebuiService { }; this.accepting = false; + if (this.httpContext.nativeDirectoryRoute) { + await attempt("native-directory-picker", () => this.httpContext.nativeDirectoryRoute!.dispose()); + } await attempt("terminal", () => this.terminal?.disposeBySession()); // Terminate sockets before waiting for their listener to close. await attempt("websocket-connections", () => this.wsServer.closeConnections()); diff --git a/packages/webui/src/shared/envelope.ts b/packages/webui/src/shared/envelope.ts index 7fe6c977e..ece8507bb 100644 --- a/packages/webui/src/shared/envelope.ts +++ b/packages/webui/src/shared/envelope.ts @@ -49,6 +49,7 @@ export interface WebuiErrorFrame { readonly requestId: string; readonly code: string; readonly message: string; + readonly reasonCode?: string; } export interface WebuiEventFrame { @@ -218,6 +219,7 @@ export function decodeWebuiServerFrame(text: string): WebuiFrameDecode { requestId: candidate.requestId, code: candidate.code, message: candidate.message, + ...(typeof candidate.reasonCode === "string" ? { reasonCode: candidate.reasonCode } : {}), }, }; } @@ -245,16 +247,19 @@ export class WebuiWireError extends Error { readonly code: WebuiWireErrorCode; /** The request this refusal answers, or {@link WEBUI_ANONYMOUS_REQUEST_ID} for one that could not be attributed. */ readonly requestId: string; + readonly reasonCode: string | undefined; constructor( code: WebuiWireErrorCode, message: string, requestId: string = WEBUI_ANONYMOUS_REQUEST_ID, + reasonCode?: string, ) { super(message); this.name = "WebuiWireError"; this.code = code; this.requestId = requestId; + this.reasonCode = reasonCode; } } diff --git a/packages/webui/test/browser/composer.spec.mjs b/packages/webui/test/browser/composer.spec.mjs index 2c576a901..7a2e90070 100644 --- a/packages/webui/test/browser/composer.spec.mjs +++ b/packages/webui/test/browser/composer.spec.mjs @@ -543,6 +543,84 @@ test("the workspace picker opens above its row, inside the viewport", async ({ p expect(box.bottom).toBeLessThanOrEqual(box.height); }); +test("native workspace picker preserves selection on cancel and accepts a drive path", async ({ page }) => { + const grant = "12345678-1234-1234-1234-123456789abc"; + const folder = "E:\\Games\\OtherProject"; + let calls = 0; + await page.route("**/native-directory-picker", async (route) => { + expect(route.request().method()).toBe("POST"); + expect(route.request().headers()["x-webui-native-grant"]).toBe(grant); + expect(route.request().headers()["x-webui-token"]).toBe("synthetic-token"); + calls += 1; + await route.fulfill({ json: calls === 1 + ? { kind: "cancelled" } + : { kind: "selected", directory: folder } }); + }); + await openApp(page, `#nativeDirectoryGrant=${grant}`); + expect(new URL(page.url()).hash).not.toContain(grant); + const row = page.locator('[data-webui-workspace-picker="true"]').first(); + const previous = await row.innerText(); + await row.click(); + await page.getByRole("option", { name: "选择新项目" }).click(); + const dialog = page.getByRole("dialog", { name: "选择新项目" }); + await expect(dialog.getByText("选择此电脑上的文件夹")).toBeVisible(); + const add = dialog.getByRole("button", { name: "添加文件夹" }); + await add.click(); + await expect.poll(() => calls).toBe(1); + await expect(add).toBeEnabled(); + await expect(row).toHaveText(previous); + await add.click(); + await expect(dialog).toBeHidden(); + await expect(row).toHaveText("OtherProject"); +}); + +test("dismissing the WebUI dialog aborts the pending native workspace picker", async ({ page }) => { + const grant = "12345678-1234-1234-1234-123456789abc"; + await configureFixture(page, () => { + const fetch = window.fetch.bind(window); + window.fetch = (url, options) => { + if (!String(url).endsWith("/native-directory-picker")) return fetch(url, options); + window.__nativeDirectoryRequest = { aborted: false }; + options.signal.addEventListener("abort", () => { + window.__nativeDirectoryRequest.aborted = true; + }); + return new Promise((resolve) => { + window.__completeNativeDirectoryRequest = () => resolve(new Response(JSON.stringify({ + kind: "selected", directory: "E:/VanishedProject", + }))); + }); + }; + }); + await openApp(page, `#nativeDirectoryGrant=${grant}`); + const row = page.locator('[data-webui-workspace-picker="true"]').first(); + const previous = await row.innerText(); + await row.click(); + await page.getByRole("option", { name: "选择新项目" }).click(); + const dialog = page.getByRole("dialog", { name: "选择新项目" }); + await dialog.getByRole("button", { name: "添加文件夹" }).click(); + await expect(dialog.getByRole("button", { name: "正在等待系统选择窗口" })).toBeDisabled(); + await page.keyboard.press("Escape"); + await expect(dialog).toBeHidden(); + expect(await page.evaluate(() => window.__nativeDirectoryRequest.aborted)).toBe(true); + await page.evaluate(() => window.__completeNativeDirectoryRequest()); + await expect(row).toHaveText(previous); +}); + +test("ordinary WebUI clients use the server directory browser", async ({ page }) => { + let nativeCalls = 0; + await page.route("**/native-directory-picker", async (route) => { + nativeCalls += 1; + await route.abort(); + }); + await openApp(page, "#"); + await page.locator('[data-webui-workspace-picker="true"]').first().click(); + await page.getByRole("option", { name: "选择新项目" }).click(); + const dialog = page.getByRole("dialog", { name: "选择项目目录" }); + await expect(dialog.getByText("选择运行 WebUI 的主机上用于新会话的工作目录")).toBeVisible(); + await expect(dialog.getByRole("button", { name: "添加文件夹" })).toHaveCount(0); + expect(nativeCalls).toBe(0); +}); + test("↑ recalls committed inputs; a manual edit exits the browse", async ({ page }) => { await openApp(page, "#session=A"); diff --git a/packages/webui/test/browser/miniapp-standalone-tab.spec.mjs b/packages/webui/test/browser/miniapp-standalone-tab.spec.mjs index 027dc5f98..a59464dc7 100644 --- a/packages/webui/test/browser/miniapp-standalone-tab.spec.mjs +++ b/packages/webui/test/browser/miniapp-standalone-tab.spec.mjs @@ -38,11 +38,12 @@ function catalogueRow(detached, presentationRevision) { } /** Install the fixture answers in every document this test opens. */ -async function configureDocuments(page) { +async function configureDocuments(page, refusal) { await page.context().addInitScript({ content: ` window.__WEBUI_FIXTURE_SETUP__ ??= []; window.__WEBUI_FIXTURE_SETUP__.push(() => { + ${refusal ? `window.__fixture.refuseOperation("openMiniApp", ${JSON.stringify(refusal.code)}, ${JSON.stringify(refusal.message)});` : ""} window.__fixture.setResponse("listMiniApps", { miniApps: [${JSON.stringify(catalogueRow(false, 0))}], }); @@ -191,3 +192,49 @@ test("a deep link naming a session that has ended still shows the Mini App", asy // Still no way back inline. await expect(page.getByTestId("miniapp-switch-standalone")).toHaveCount(0); }); + +for (const [code, message] of [ + ["MINIAPP_PREPARATION_FAILED", "Mini App publication preparation failed"], + ["OWNED_ELSEWHERE", "Mini App is running in another client"], +]) { + test(`a standalone start refusal stays actionable and an explicit retry recovers (${code})`, async ({ page }) => { + await configureDocuments(page, { code, message }); + await page.goto(`/miniapp?token=synthetic-token&plugin=${PLUGIN}`); + const failed = page.getByTestId("miniapp-view-start-failed"); + await expect(failed).toBeVisible(); + await expect(failed).toContainText("应用尚未打开"); + if (code === "OWNED_ELSEWHERE") { + await expect(failed).toContainText("请先在其他客户端关闭该应用,再重试。"); + } else { + await expect(failed).toContainText(message); + await expect(failed).not.toContainText("请先在其他客户端关闭"); + } + await expect(page.getByTestId("miniapp-view-frame")).toHaveCount(0); + await page.getByTestId("miniapp-view-refusal").getByRole("button", { name: "关闭", exact: true }).click(); + await expect(failed).toBeVisible(); + // A repeated refusal keeps the recovery control instead of erasing the page. + const retry = page.getByRole("button", { name: "重试打开应用" }); + await retry.click(); + await expect(failed).toBeVisible(); + await expect.poll(() => page.evaluate(() => window.__fixture.requests.filter( + (request) => request.operation === "openMiniApp", + ).length)).toBe(2); + await page.evaluate(() => { + window.__fixture.allowOperation("openMiniApp"); + window.__fixture.delayNext("openMiniApp", {}); + }); + await retry.click(); + await expect(page.getByTestId("miniapp-view-opening")).toBeVisible(); + await expect(retry).toHaveCount(0); + await expect(failed).toHaveCount(0); + await page.evaluate(({ pluginId, path }) => window.__fixture.resolve("openMiniApp", {}, { + pluginId, viewUrl: window.location.origin + path, + }), { pluginId: PLUGIN, path: STANDALONE_STUB }); + await expect(page.getByTestId("miniapp-view-frame")).toBeVisible(); + await expect(failed).toHaveCount(0); + await expect(retry).toHaveCount(0); + expect(await page.evaluate(() => window.__fixture.requests.filter( + (request) => request.operation === "openMiniApp", + ).length)).toBe(3); + }); +} diff --git a/packages/webui/test/browser/native-design-tasks.spec.mjs b/packages/webui/test/browser/native-design-tasks.spec.mjs index da0ed5f72..43e00ae82 100644 --- a/packages/webui/test/browser/native-design-tasks.spec.mjs +++ b/packages/webui/test/browser/native-design-tasks.spec.mjs @@ -2,7 +2,7 @@ import { execFileSync, fork } from "node:child_process"; import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs"; import { once } from "node:events"; import path from "node:path"; -import { fileURLToPath, pathToFileURL } from "node:url"; +import { fileURLToPath } from "node:url"; import { expect } from "@playwright/test"; import { test, attachJsonEvidence } from "./harness.mjs"; @@ -11,7 +11,7 @@ let host, ready; let logs = ""; test.beforeAll(async () => { host = fork(path.join(root, "packages/webui/test/browser/support/native-design-browser-host.ts"), [], { - execArgv: ["--import", pathToFileURL(path.join(root, "packages/webui/node_modules/tsx/dist/loader.mjs")).href], + execArgv: ["--import", import.meta.resolve("tsx")], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), WEBUI_DESIGN_BROWSER_DATA_DIR: process.env.WEBUI_DESIGN_BROWSER_DATA_DIR ?? path.join(test.info().project.outputDir, "native-design-task-host") }, stdio: ["ignore", "pipe", "pipe", "ipc"], }); diff --git a/packages/webui/test/browser/native-design.spec.mjs b/packages/webui/test/browser/native-design.spec.mjs index 87a334bb1..a8027312c 100644 --- a/packages/webui/test/browser/native-design.spec.mjs +++ b/packages/webui/test/browser/native-design.spec.mjs @@ -2,7 +2,7 @@ import { execFileSync, fork } from "node:child_process"; import { once } from "node:events"; import { readFileSync } from "node:fs"; import path from "node:path"; -import { fileURLToPath, pathToFileURL } from "node:url"; +import { fileURLToPath } from "node:url"; import { expect } from "@playwright/test"; import { test, attachJsonEvidence } from "./harness.mjs"; @@ -18,12 +18,7 @@ test.beforeAll(async () => { ), [], { - execArgv: [ - "--import", - pathToFileURL( - path.join(root, "packages/webui/node_modules/tsx/dist/loader.mjs"), - ).href, - ], + execArgv: ["--import", import.meta.resolve("tsx")], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), diff --git a/packages/webui/test/browser/native-runtime.spec.mjs b/packages/webui/test/browser/native-runtime.spec.mjs index a4199147b..89a6e3e22 100644 --- a/packages/webui/test/browser/native-runtime.spec.mjs +++ b/packages/webui/test/browser/native-runtime.spec.mjs @@ -1,7 +1,7 @@ import { fork } from "node:child_process"; import { once } from "node:events"; import path from "node:path"; -import { fileURLToPath, pathToFileURL } from "node:url"; +import { fileURLToPath } from "node:url"; import { expect } from "@playwright/test"; import { test } from "./harness.mjs"; @@ -32,7 +32,7 @@ let ready; let logs = ""; test.beforeAll(async () => { child = fork(path.join(root, "packages/webui/test/browser/support/native-browser-host.ts"), [], { - execArgv: ["--import", pathToFileURL(path.join(root, "packages/webui/node_modules/tsx/dist/loader.mjs")).href], + execArgv: ["--import", import.meta.resolve("tsx")], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), SHELL: process.platform === "win32" ? "powershell.exe" : "/bin/sh" }, stdio: ["ignore", "pipe", "pipe", "ipc"], }); diff --git a/packages/webui/test/browser/user-menu-shutdown.spec.mjs b/packages/webui/test/browser/user-menu-shutdown.spec.mjs index b5c859141..ec4b76237 100644 --- a/packages/webui/test/browser/user-menu-shutdown.spec.mjs +++ b/packages/webui/test/browser/user-menu-shutdown.spec.mjs @@ -71,3 +71,67 @@ test("a refused shutdown can be dismissed by clicking outside after the error", await page.locator('[data-webui-dialog-scrim="true"]').click({ position: { x: 8, y: 8 } }); await expect(dialog).toHaveCount(0); }); + +test("a failed shutdown transport is unconfirmed even when the backend is still up; retry is manual", async ({ page }) => { + let posts = 0; + await page.route("**/webui-shutdown?*", (route) => { + expect(route.request().method()).toBe("POST"); + posts += 1; + return posts === 1 + ? route.abort("connectionrefused") + : route.fulfill({ json: { ok: true, closing: true } }); + }); + await openApp(page); + await page.locator('[data-testid="sidebar-user-menu-trigger"], [data-testid="sidebar-user-menu-trigger-rail"]').first().click(); + await page.getByTestId("user-menu-shutdown").click(); + const dialog = page.getByRole("alertdialog"); + const confirm = dialog.getByRole("button", { name: "关闭服务", exact: true }); + await confirm.click(); + + await expect(dialog).toContainText("未收到关闭确认,无法确定服务是否已停止。"); + await expect(confirm).toBeEnabled(); + const health = await page.request.get("/health"); + expect(health.ok()).toBe(true); + expect((await health.json()).status).toBe("ok"); + expect(posts).toBe(1); + + await confirm.click(); + await expect(dialog).toHaveCount(0); + expect(posts).toBe(2); +}); + +for (const [label, status] of [["2xx without the receipt", 200], ["gateway timeout", 504]]) { + test(`${label} cannot dismiss the confirmation`, async ({ page }) => { + await page.route("**/webui-shutdown?*", (route) => route.fulfill({ + status, json: { ok: true, closing: false }, + })); + await openApp(page); + await page.locator('[data-testid="sidebar-user-menu-trigger"], [data-testid="sidebar-user-menu-trigger-rail"]').first().click(); + await page.getByTestId("user-menu-shutdown").click(); + const dialog = page.getByRole("alertdialog"); + await dialog.getByRole("button", { name: "关闭服务", exact: true }).click(); + await expect(dialog).toContainText("未收到关闭确认,无法确定服务是否已停止。"); + }); +} + +test("no shutdown response releases the dialog at the receipt deadline", async ({ page }) => { + let release; + const pending = new Promise((resolve) => { release = resolve; }); + await page.route("**/webui-shutdown?*", async (route) => { + await pending; + await route.abort().catch(() => {}); + }); + try { + await openApp(page); + await page.locator('[data-testid="sidebar-user-menu-trigger"], [data-testid="sidebar-user-menu-trigger-rail"]').first().click(); + await page.getByTestId("user-menu-shutdown").click(); + const dialog = page.getByRole("alertdialog"); + const confirm = dialog.getByRole("button", { name: "关闭服务", exact: true }); + await confirm.click(); + await expect(confirm).toBeDisabled(); + await expect(dialog).toContainText("未收到关闭确认,无法确定服务是否已停止。", { timeout: 10_000 }); + await expect(confirm).toBeEnabled(); + } finally { + release(); + } +}); diff --git a/packages/webui/test/gates/fixtures/path-metadata-f00.json b/packages/webui/test/gates/fixtures/path-metadata-f00.json index 1a0880f59..ee6c6203a 100644 --- a/packages/webui/test/gates/fixtures/path-metadata-f00.json +++ b/packages/webui/test/gates/fixtures/path-metadata-f00.json @@ -2,7 +2,7 @@ "baseline": "f00b1268c28ad15054a8882620c3fb08beb86d58", "sourceSha256": "46b86b658adc1611f3531d8dc9844612f7e9ee3de0eec4a532aeec44b5de0a12", "nativeDesignDelta": "Adds the native Design feature across its existing application, binding, contract, projection and UI roles, with runtime-owned storage and execution, server adapters, and shared DTOs. Layer rules, role rules and the frozen direction matrix are unchanged.", - "declaredDelta": "Public marker preserves the original layer and adds only the published- role prefix; publication legality has separate positive/negative fixtures. Post-baseline additions: conversation/pagination remains a mechanism, platform/transport-origin remains infrastructure, runtime/ssh/authentication remains outside the client, bindings/use-webui-shutdown remains a binding, platform/webui-shutdown remains infrastructure, server/http/shutdown remains outside the client, and client/styles/brand-font remains a stylesheet.", + "declaredDelta": "Public marker preserves the original layer and adds only the published- role prefix; publication legality has separate positive/negative fixtures. Post-baseline additions: platform/native-directory-picker remains infrastructure, server/http/native-directory remains outside the client, conversation/pagination remains a mechanism, platform/transport-origin remains infrastructure, runtime/ssh/authentication remains outside the client, bindings/use-webui-shutdown remains a binding, platform/webui-shutdown remains infrastructure, server/http/shutdown remains outside the client, and client/styles/brand-font remains a stylesheet.", "cases": [ { "path": "client/features/design/application/design-owner.ts", "layers": ["application"], "role": "feature-application", "business": "design", "home": "target" }, { "path": "client/features/design/bindings/use-design.ts", "layers": ["bindings"], "role": "feature-bindings", "business": "design", "home": "target" }, @@ -25,6 +25,20 @@ { "path": "server/operation/design.ts", "layers": ["server"], "role": "outside", "business": null, "home": "outside" }, { "path": "shared/contracts/design.ts", "layers": ["shared"], "role": "outside", "business": null, "home": "outside" }, { "path": "shared/design-input.ts", "layers": ["shared"], "role": "outside", "business": null, "home": "outside" }, + { + "path": "client/platform/native-directory-picker.ts", + "layers": ["infrastructure"], + "role": "platform", + "business": null, + "home": "target" + }, + { + "path": "server/http/native-directory.ts", + "layers": ["server"], + "role": "outside", + "business": null, + "home": "outside" + }, { "path": "runtime/native-pty.ts", "layers": ["runtime"], diff --git a/packages/webui/test/integration/design-loopback.test.ts b/packages/webui/test/integration/design-loopback.test.ts index 7d7bb2e1e..d63e254f7 100644 --- a/packages/webui/test/integration/design-loopback.test.ts +++ b/packages/webui/test/integration/design-loopback.test.ts @@ -30,7 +30,7 @@ import { acquireWebuiStorageLock } from ${JSON.stringify(pathToFileURL(path.join const service = await createWebuiDesignService(process.env.DESIGN_WORKER_DIR); let release; process.on('message', async ({id,operation,input}) => { try { const result = operation === 'lock' ? (release = await acquireWebuiStorageLock(input), true) : operation === 'unlock' ? (release(), true) : await service.apply(input); process.send({id,result}); } catch(error) {process.send({id,error:{code:error.code,message:error.message}});} }); process.send({ready:true});`); - const child = fork(script, [], { execArgv: ["--import", pathToFileURL(path.join(root, "packages/webui/node_modules/tsx/dist/loader.mjs")).href], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), DESIGN_WORKER_DIR: dataDir }, stdio: ["ignore", "pipe", "pipe", "ipc"] }); + const child = fork(script, [], { execArgv: ["--import", import.meta.resolve("tsx")], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), DESIGN_WORKER_DIR: dataDir }, stdio: ["ignore", "pipe", "pipe", "ipc"] }); children.push(child); const [ready] = await once(child, "message"); expect(ready).toEqual({ ready: true }); return { child, request(operation: string, input: unknown): Promise<{ result?: unknown; error?: { code: string } }> { const id = Math.random(); return new Promise((resolve) => { const listener = (message: { id: number; result?: unknown; error?: { code: string } }) => { if (message.id === id) { child.off("message", listener); resolve(message); } }; child.on("message", listener); child.send({ id, operation, input }); }); } }; @@ -38,7 +38,7 @@ process.send({ready:true});`); describe("native Design real boundaries", () => { it("executes the registered Design tool in a real production turn with only a local model endpoint substituted", async () => { const dataDir = await directory(); - const child = fork(path.join(root, "packages/webui/test/browser/support/native-design-browser-host.ts"), [], { execArgv: ["--import", pathToFileURL(path.join(root, "packages/webui/node_modules/tsx/dist/loader.mjs")).href], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), WEBUI_DESIGN_BROWSER_DATA_DIR: dataDir }, stdio: ["ignore", "pipe", "pipe", "ipc"] }); + const child = fork(path.join(root, "packages/webui/test/browser/support/native-design-browser-host.ts"), [], { execArgv: ["--import", import.meta.resolve("tsx")], env: { ...process.env, TSX_TSCONFIG_PATH: path.join(root, "tsconfig.standalone.json"), WEBUI_DESIGN_BROWSER_DATA_DIR: dataDir }, stdio: ["ignore", "pipe", "pipe", "ipc"] }); children.push(child); let logs = ""; child.stderr!.on("data", (bytes) => { logs += String(bytes); }); const ready = await Promise.race([once(child, "message").then(([value]) => value as { sessionId: string }), once(child, "exit").then(() => { throw new Error(logs); })]); const response = once(child, "message"); child.send({ requestId: "registered-open", input: { action: "open" } }); diff --git a/packages/webui/test/integration/miniapp-real-flow.test.ts b/packages/webui/test/integration/miniapp-real-flow.test.ts index 17d28ff11..33f906e4b 100644 --- a/packages/webui/test/integration/miniapp-real-flow.test.ts +++ b/packages/webui/test/integration/miniapp-real-flow.test.ts @@ -32,6 +32,10 @@ // is `miniapp-ui-flow.test.ts`. The data directory is a temporary one, so a // run can never reach the operator's own `~/.minimax`. +import { spawn } from "node:child_process"; +import { once } from "node:events"; +import { mkdir } from "node:fs/promises"; +import { join } from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { @@ -135,6 +139,88 @@ describe("the Mini App business flow against the real host", () => { expect(rowsOf(await client.call("listMiniApps"))).toEqual([]); }, 60_000); + it("reports ownership held by a separate desktop-labelled process and opens after its release", async () => { + const host = await bootRealHost(); + const client = await connect(host.url); + const name = "ownership-flow.miniapp"; + await publishLocalPackage(host.dataDir, name); + expectAnswered(await client.call("pluginManagement", { + action: "enablePlugin", + input: { pluginName: name, source: LOCAL_SOURCE }, + })); + const pluginDataDir = join(host.dataDir, "v2", "plugin-data", "liveboards", name); + await mkdir(pluginDataDir, { recursive: true }); + // A separate process exercises the production OS lease endpoint, not an + // in-memory owner. It only stands in for Desktop's ownership capability, + // so this is not an acceptance run against the Desktop application. + const leaseModule = new URL( + "../../../local-runtime-v2/src/service/miniapp/process/node-runtime/owner-lease.ts", + import.meta.url, + ).href; + const contender = spawn(process.execPath, [ + "--import", "tsx", "--input-type=module", "-e", ` + const [leaseModule, pluginDataDir, pluginId] = process.argv.slice(1); + const { acquireMiniAppOwner } = await import(leaseModule); + const owner = await acquireMiniAppOwner({ + pluginDataDir, + pluginId, + identity: { client: "desktop" }, + }); + if (owner.kind !== "acquired") throw new Error("Expected to acquire the fixture lease"); + process.once("message", async (message) => { + if (message !== "release") throw new Error("Unexpected fixture command"); + await owner.release(); + process.disconnect(); + }); + process.send({ ownerPid: process.pid }); + `, leaseModule, pluginDataDir, name, + ], { stdio: ["ignore", "ignore", "pipe", "ipc"] }); + let stderr = ""; + contender.stderr?.setEncoding("utf8"); + contender.stderr?.on("data", (chunk: string) => { stderr = (stderr + chunk).slice(-4_096); }); + const closed = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { + contender.once("close", (code, signal) => resolve({ code, signal })); + }); + try { + const [ready] = await Promise.race([ + once(contender, "message", { signal: AbortSignal.timeout(10_000) }), + closed.then((outcome) => { + throw new Error(`Lease contender exited before acquiring: ${JSON.stringify(outcome)} — ${stderr}`); + }), + ]); + expect(ready).toEqual({ ownerPid: contender.pid }); + expect(contender.pid).not.toBe(process.pid); + const refused = await client.call("openMiniApp", { pluginId: name }); + expect(refused).toMatchObject({ + kind: "error", + code: "MINIAPP_PREPARATION_FAILED", + reasonCode: "OWNED_ELSEWHERE", + }); + await new Promise((resolve, reject) => { + contender.send("release", (error) => error ? reject(error) : resolve()); + }); + let exitDeadline: ReturnType | undefined; + try { + await expect(Promise.race([ + closed, + new Promise((_, reject) => { + exitDeadline = setTimeout(() => reject(new Error(`Lease contender did not exit after release — ${stderr}`)), 10_000); + }), + ])).resolves.toEqual({ code: 0, signal: null }); + } finally { + clearTimeout(exitDeadline); + } + } finally { + if (contender.exitCode === null && contender.signalCode === null) contender.kill("SIGKILL"); + await closed; + } + const opened = await client.call("openMiniApp", { pluginId: name }); + expectAnswered(opened); + const page = await fetch(String(bodyOf(opened).viewUrl)); + expect(page.status).toBe(200); + expect(await page.text()).toContain(PAGE_MARKER); + }, 120_000); + it("keeps a Mini App that failed to start out of the running set", async () => { const host = await bootRealHost(); const client = await connect(host.url); @@ -161,6 +247,7 @@ describe("the Mini App business flow against the real host", () => { // person has to act on: the entry refused to start. const cause = await openCause(host, name); expect(cause.join(" <- ")).toContain("RUNNER_START_FAILED"); + expect(opened.reasonCode, cause.join(" <- ")).toBe("RUNNER_START_FAILED"); // And the Mini App is not left claiming to be running: the row says the // start failed, and names the reason, instead of reading as a Mini App diff --git a/packages/webui/test/unit/miniapp-client-state.test.ts b/packages/webui/test/unit/miniapp-client-state.test.ts index 7c2aedd7a..cc58de4d7 100644 --- a/packages/webui/test/unit/miniapp-client-state.test.ts +++ b/packages/webui/test/unit/miniapp-client-state.test.ts @@ -360,33 +360,104 @@ describe("the Mini App business", () => { expect(workflows.getSnapshot().presentations.fourth?.kind).toBe("open"); }); - it("reports an app another client owns, naming that client, in both surfaces' state", async () => { - const port = scriptedPort({ - miniApps: [miniApp("shared-app", "stopped")], - open: async () => { - throw Object.assign( - new Error("Mini App shared-app is already running in electron (pid 4242)"), - { code: "OWNED_ELSEWHERE" }, - ); - }, - }); - const workflows = createWebuiMiniAppWorkflows({ port }); - await workflows.loadListing(); - expect(await workflows.open("shared-app")).toBe(false); - - const snapshot = workflows.getSnapshot(); - const refusal = snapshot.refusals["shared-app"]; - expect(refusal?.code).toBe("OWNED_ELSEWHERE"); - const text = webuiMiniAppRefusalText({ - code: refusal!.code, - message: refusal!.message, - rows: snapshot.listing.rows, - }); - // Keep diagnostics while presenting a neutral client name. - expect(text).not.toContain("electron"); - expect(text).toContain("4242"); - expect(snapshot.presentations["shared-app"]).toBeUndefined(); - }); + it.each(["OWNED_ELSEWHERE", "MINIAPP_PREPARATION_FAILED"])( + "reports an app another client owns when the runtime returns %s", + async (code) => { + const wrapped = code === "MINIAPP_PREPARATION_FAILED"; + const port = scriptedPort({ + miniApps: [miniApp("shared-app", "stopped")], + open: async () => { + throw Object.assign( + new Error(wrapped + ? "Mini App publication preparation failed" + : "Mini App shared-app is already running in electron (pid 4242)"), + { code, ...(wrapped ? { reasonCode: "OWNED_ELSEWHERE" } : {}) }, + ); + }, + }); + const workflows = createWebuiMiniAppWorkflows({ port }); + await workflows.loadListing(); + expect(await workflows.open("shared-app")).toBe(false); + + const snapshot = workflows.getSnapshot(); + const refusal = snapshot.refusals["shared-app"]; + expect(refusal?.code).toBe("OWNED_ELSEWHERE"); + const text = webuiMiniAppRefusalText({ + code: refusal!.code, + message: refusal!.message, + rows: snapshot.listing.rows, + }); + expect(text).not.toContain("electron"); + expect(text).toContain(wrapped ? "OWNED_ELSEWHERE" : "4242"); + expect(snapshot.presentations["shared-app"]).toEqual({ kind: "failed", refusal }); + }, + ); + + it.each(["observer", "explicit"] as const)( + "observes a detached lease after a failed inline start via %s without opening again", + async (entry) => { + vi.useFakeTimers(); + let detached = false; + let refuse = true; + let takeLease = entry === "observer"; + const pluginId = "shared-app"; + const attempts = vi.fn(async () => { + if (refuse) { + // Another browser document took the lease while the inline start was pending. + detached = takeLease; + throw Object.assign(new Error("Mini App publication preparation failed"), { + code: "MINIAPP_PREPARATION_FAILED", + }); + } + return { pluginId, viewUrl: "http://127.0.0.1:49152" }; + }); + const list = vi.fn(async () => ({ + miniApps: [miniApp(pluginId, "running", { detached, presentationRevision: 1 })], + })); + const workflows = createWebuiMiniAppWorkflows({ + port: { + openMiniApp: attempts, + listMiniApps: list, + stopMiniApp: async () => ({ success: true }), + }, + }); + let release: (() => void) | undefined; + try { + if (entry === "explicit") { + // A retained previous failure does not start or poll again on mount. + expect(await workflows.open(pluginId)).toBe(false); + release = workflows.acquirePresentation(pluginId, false); + takeLease = true; + expect(await workflows.open(pluginId)).toBe(false); + } else { + release = workflows.acquirePresentation(pluginId, false); + await vi.advanceTimersByTimeAsync(0); + } + const attemptsBeforeRelease = entry === "explicit" ? 2 : 1; + expect(workflows.getSnapshot().presentations[pluginId]?.kind).toBe("failed"); + expect(workflows.getSnapshot().listing.rows[0]?.detached).toBe(true); + expect(attempts).toHaveBeenCalledTimes(attemptsBeforeRelease); + + detached = false; + await vi.advanceTimersByTimeAsync(2_000); + expect(workflows.getSnapshot().listing.rows[0]?.detached).toBe(false); + expect(workflows.getSnapshot().presentations[pluginId]?.kind).toBe("failed"); + expect(attempts).toHaveBeenCalledTimes(attemptsBeforeRelease); + const readsAfterRelease = list.mock.calls.length; + await vi.advanceTimersByTimeAsync(4_000); + expect(list).toHaveBeenCalledTimes(readsAfterRelease); + + refuse = false; + expect(await workflows.open(pluginId)).toBe(true); + expect(workflows.getSnapshot().presentations[pluginId]?.kind).toBe("open"); + expect(attempts).toHaveBeenCalledTimes(attemptsBeforeRelease + 1); + } finally { + release?.(); + workflows.dispose(); + vi.useRealTimers(); + } + }, + ); it("offers to stop a Mini App another client is running", () => { const rows = webuiMiniAppRows([ diff --git a/packages/webui/test/unit/miniapp-surfaces.test.tsx b/packages/webui/test/unit/miniapp-surfaces.test.tsx index 8d758317f..2201f899a 100644 --- a/packages/webui/test/unit/miniapp-surfaces.test.tsx +++ b/packages/webui/test/unit/miniapp-surfaces.test.tsx @@ -11,8 +11,9 @@ // The failures and the confirmations are said through the shared toast (ADR // 0030), which is raised in an effect and drawn over the page: a server render // never sees it. So what a case pins about a failure here is that the layout -// does not carry it — and, from the surfaces' own sources, that it is still -// reported at all. +// does not carry transient errors — and, from the surfaces' own sources, that +// they are still reported at all. A failed start additionally leaves a persistent +// not-opened state with an explicit recovery control. // // The registry half is real: an actual upstream `http.Server`, an actual listener, // and a close that has to free its port — because the whole reason it exists is @@ -439,7 +440,7 @@ describe("the Mini App view the panel frames", () => { expect(opens).toBe(1); }); - it("reports the refusal through the toast, and shows no frame", async () => { + it("keeps an actionable state after another client refuses the start", async () => { const workflows = createWebuiMiniAppWorkflows({ port: port({ miniApps: [summary("shared", "stopped")], @@ -456,14 +457,59 @@ describe("the Mini App view the panel frames", () => { createElement(MiniAppView, { pluginId: "shared", sessionId: "session-1" }), workflows, ); - // The refusal is an event, not a state: it is said once, through the shared - // toast (ADR 0030). A server render never sees it. + // The toast reports the attempt; the retained state gives a safe next step + // without repeating the other process's details. expect(markup).not.toContain("pid 99"); expect(markup).not.toContain("electron"); expect(markup).not.toContain("miniapp-view-frame"); // The view itself still renders, so there is a surface to look at. expect(markup).toContain('data-testid="miniapp-view"'); - expect(markup).toContain('data-state="idle"'); + expect(markup).toContain("应用尚未打开"); + expect(markup).toContain("请先在其他客户端关闭该应用,再重试。"); + expect(markup).toContain("重试打开应用"); + }); + + it("does not offer a start retry for a refused stop without a presentation", async () => { + const workflows = createWebuiMiniAppWorkflows({ + port: port({ + miniApps: [summary("shared", "running")], + stop: async () => { throw new Error("Stop was refused"); }, + }), + }); + await workflows.stop("shared"); + const markup = render(createElement(MiniAppView, { pluginId: "shared" }), workflows); + expect(workflows.getSnapshot().refusals.shared?.message).toBe("Stop was refused"); + expect(markup).not.toContain("应用尚未打开"); + expect(markup).not.toContain("重试打开应用"); + }); + + it("retains a preparation failure until an explicit retry succeeds", async () => { + let succeeds = false; + const workflows = createWebuiMiniAppWorkflows({ + port: port({ + miniApps: [summary("shared", "stopped")], + open: async () => { + if (!succeeds) throw Object.assign(new Error("Mini App publication preparation failed"), { + code: "MINIAPP_PREPARATION_FAILED", + }); + return { pluginId: "shared", viewUrl: "http://127.0.0.1:49152" }; + }, + }), + }); + await workflows.open("shared"); + const view = createElement(MiniAppView, { pluginId: "shared", surface: "standalone" }); + const failed = render(view, workflows); + expect(failed).toContain("应用尚未打开"); + expect(failed).toContain("Mini App publication preparation failed"); + expect(failed).toContain("重试打开应用"); + expect(failed).not.toContain("请先在其他客户端关闭"); + expect(failed).not.toContain("miniapp-view-frame"); + succeeds = true; + await workflows.open("shared"); + const recovered = render(view, workflows); + expect(recovered).toContain("miniapp-view-frame"); + expect(recovered).not.toContain("应用尚未打开"); + expect(recovered).not.toContain("重试打开应用"); }); }); diff --git a/packages/webui/test/unit/native-directory-picker.test.ts b/packages/webui/test/unit/native-directory-picker.test.ts new file mode 100644 index 000000000..f58a20a13 --- /dev/null +++ b/packages/webui/test/unit/native-directory-picker.test.ts @@ -0,0 +1,147 @@ +import { EventEmitter } from "node:events"; +import { tmpdir } from "node:os"; +import { createServer, type IncomingMessage, type ServerResponse } from "node:http"; +import { once } from "node:events"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { createNativeDirectoryRoute, validateNativeDirectory } from "../../src/server/http/native-directory.js"; +import { captureNativeDirectoryLaunchGrant, canPickNativeWorkspaceDirectory, pickNativeWorkspaceDirectory } from "../../src/client/platform/native-directory-picker.js"; + +const grant = "11111111-2222-3333-4444-555555555555"; +const context = { host: "127.0.0.1", port: 2233, credential: { token: "test-token" }, fullAccess: false }; +function request(headers: Record = {}, address = "127.0.0.1") { + return Object.assign(new EventEmitter(), { headers: { + host: "127.0.0.1:2233", origin: "http://127.0.0.1:2233", "sec-fetch-site": "same-origin", + "x-webui-native-grant": grant, "x-webui-token": "test-token", ...headers, + }, socket: { remoteAddress: address } }) as unknown as IncomingMessage; +} +function response() { + const value = Object.assign(new EventEmitter(), { + statusCode: 200, body: "", destroyed: false, writableEnded: false, + setHeader: vi.fn(), writeHead(status: number) { this.statusCode = status; }, end(body: string) { this.body = body; this.writableEnded = true; }, + }); + return value; +} +const asResponse = (value: ReturnType) => value as unknown as ServerResponse; +afterEach(() => { vi.unstubAllGlobals(); vi.restoreAllMocks(); }); + +describe("native directory HTTP desktop capability", () => { + it("bounds returned-directory inspection without blocking on an unavailable share", async () => { + const inspect = vi.fn(() => new Promise<{ isDirectory(): boolean }>(() => {})); + expect(await validateNativeDirectory(tmpdir(), 5, inspect)).toBe(false); + expect(inspect).toHaveBeenCalledTimes(1); + expect(await validateNativeDirectory("relative", 5, inspect)).toBe(false); + expect(inspect).toHaveBeenCalledTimes(1); + expect(await validateNativeDirectory(tmpdir(), 5, async () => ({ isDirectory: () => false }))).toBe(false); + }); + it("serves a real authenticated loopback POST without query credentials", async () => { + const choose = vi.fn(async () => ({ kind: "selected" as const, directory: tmpdir() })); + const route = createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }); + const server = createServer((req, res) => { + const address = server.address(); + void route.handle(req, res, { ...context, port: typeof address === "object" && address ? address.port : 0 }); + }); + server.listen(0, "127.0.0.1"); await once(server, "listening"); + const address = server.address(); if (!address || typeof address === "string") throw new Error("Missing TCP address"); + const origin = `http://127.0.0.1:${address.port}`; + try { + const response = await fetch(`${origin}/native-directory-picker`, { method: "POST", headers: { + Origin: origin, "Sec-Fetch-Site": "same-origin", "X-Webui-Native-Grant": grant, "X-Webui-Token": "test-token", + } }); + expect(response.status).toBe(200); expect(await response.json()).toEqual({ kind: "selected", directory: tmpdir() }); + expect(choose).toHaveBeenCalledTimes(1); + } finally { + await route.dispose(); server.closeAllConnections(); await new Promise(resolve => server.close(() => resolve())); + } + }); + it.each>([ + { origin: "" }, { origin: "null" }, { origin: "http://evil.example:2233" }, + { origin: "https://127.0.0.1:2233" }, { host: "localhost:2233" }, + { "sec-fetch-site": "cross-site" }, { forwarded: "for=127.0.0.1" }, + { "x-forwarded-host": "example.test" }, { "x-webui-native-grant": "wrong" }, + ])("denies unsafe request %j without invoking provider", async (headers) => { + const choose = vi.fn(); const route = createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }); + const res = response(); await route.handle(request(headers), asResponse(res), context); + expect(res.statusCode).toBe(403); expect(choose).not.toHaveBeenCalled(); + }); + it.each([{ ...context, fullAccess: true }, { ...context, host: "0.0.0.0" }])("denies deployment %j", async (admission) => { + const choose = vi.fn(); const res = response(); + await createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }).handle(request(), asResponse(res), admission); + expect(res.statusCode).toBe(403); expect(choose).not.toHaveBeenCalled(); + }); + it("requires credential even in a locally admitted service and refuses remote sockets", async () => { + const choose = vi.fn(); const route = createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }); + const missing = response(); await route.handle(request({ "x-webui-token": "" }), asResponse(missing), context); + expect(missing.statusCode).toBe(401); + const remote = response(); await route.handle(request({}, "192.0.2.1"), asResponse(remote), context); + expect(remote.statusCode).toBe(403); expect(choose).not.toHaveBeenCalled(); + }); + it("accepts no request body or client-selected path", async () => { + const choose = vi.fn(); const res = response(); + await createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }).handle(request({ "content-length": "10" }), asResponse(res), context); + expect(res.statusCode).toBe(400); expect(choose).not.toHaveBeenCalled(); + }); + it.each([ + [{ kind: "selected", directory: tmpdir() }, 200], + [{ kind: "selected", directory: "relative-directory" }, 422], + [{ kind: "cancelled" }, 200], + ] as const)("validates native result %j", async (result, status) => { + const res = response(); + await createNativeDirectoryRoute({ grant, choose: async () => result, dispose: async () => {} }).handle(request(), asResponse(res), context); + expect(res.statusCode).toBe(status); + if (status === 200) expect(JSON.parse(res.body)).toEqual(result); + }); + it("holds one dialog, aborts on disconnect, and permits another after settlement", async () => { + let signal!: AbortSignal; + const choose = vi.fn((value: AbortSignal) => { signal = value; return new Promise<{ kind: "cancelled" }>(resolve => value.addEventListener("abort", () => resolve({ kind: "cancelled" }))); }); + const route = createNativeDirectoryRoute({ grant, choose, dispose: async () => {} }); + const first = response(); const pending = route.handle(request(), asResponse(first), context); + await Promise.resolve(); + const second = response(); await route.handle(request(), asResponse(second), context); + expect(second.statusCode).toBe(409); expect(choose).toHaveBeenCalledTimes(1); + first.destroyed = true; first.emit("close"); await pending; expect(signal.aborted).toBe(true); + const third = response(); const again = route.handle(request(), asResponse(third), context); + await Promise.resolve(); await route.dispose(); await again; + expect(choose).toHaveBeenCalledTimes(2); expect(signal.aborted).toBe(true); + }); + it("times out by cancelling the owned provider and sanitizes provider failures", async () => { + const res = response(); + const route = createNativeDirectoryRoute({ grant, choose: signal => new Promise(resolve => signal.addEventListener("abort", () => resolve({ kind: "cancelled" }))), dispose: async () => {} }, 5); + await route.handle(request(), asResponse(res), context); expect(JSON.parse(res.body)).toEqual({ kind: "cancelled" }); + const failure = response(); + await createNativeDirectoryRoute({ grant, choose: async () => { throw new Error("private details"); }, dispose: async () => {} }).handle(request(), asResponse(failure), context); + expect(failure.statusCode).toBe(503); expect(failure.body).not.toContain("private"); + }); +}); + +function browser(url = `http://127.0.0.1:2233/#nativeDirectoryGrant=${grant}&session=A`) { + vi.stubGlobal("location", new URL(url)); + const replaceState = vi.fn(); vi.stubGlobal("history", { state: null, replaceState }); + vi.stubGlobal("__WEBUI_CONFIG__", { websocketUrl: "ws://127.0.0.1:2233", token: "test-token" }); + captureNativeDirectoryLaunchGrant(); return replaceState; +} +describe("native directory launch grant transport", () => { + it("strips fragment immediately, preserves session, and sends secrets only in same-origin headers", async () => { + const replace = browser(); expect(replace.mock.calls[0]?.[2]).toBe("http://127.0.0.1:2233/#session=A"); + expect(canPickNativeWorkspaceDirectory()).toBe(true); + const fetch = vi.fn(async () => new Response(JSON.stringify({ kind: "selected", directory: "C:\\Work" }))); + vi.stubGlobal("fetch", fetch); const signal = new AbortController().signal; + expect(await pickNativeWorkspaceDirectory(signal)).toEqual({ kind: "selected", directory: "C:\\Work" }); + expect(fetch).toHaveBeenCalledWith("http://127.0.0.1:2233/native-directory-picker", { + method: "POST", credentials: "same-origin", signal, headers: { "X-Webui-Native-Grant": grant, "X-Webui-Token": "test-token" }, + }); + }); + it("does not grant a refreshed, remote or mismatched-runtime page native access", async () => { + for (const url of ["http://127.0.0.1:2233/", `http://example.test/#nativeDirectoryGrant=${grant}`]) { + browser(url); expect(canPickNativeWorkspaceDirectory()).toBe(false); + } + browser(); vi.stubGlobal("__WEBUI_CONFIG__", { websocketUrl: "ws://127.0.0.1:9999", token: "test-token" }); + expect(await pickNativeWorkspaceDirectory(new AbortController().signal)).toEqual({ kind: "unavailable" }); + }); + it("reports cancel and revokes unsupported grants instead of selecting a path", async () => { + browser(); vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ kind: "cancelled" })))); + expect(await pickNativeWorkspaceDirectory(new AbortController().signal)).toEqual({ kind: "cancelled" }); + vi.stubGlobal("fetch", vi.fn(async () => new Response("", { status: 403 }))); + expect(await pickNativeWorkspaceDirectory(new AbortController().signal)).toEqual({ kind: "unavailable" }); + expect(canPickNativeWorkspaceDirectory()).toBe(false); + }); +}); diff --git a/packages/webui/test/unit/webui-service.test.ts b/packages/webui/test/unit/webui-service.test.ts index 12535e636..315b89066 100644 --- a/packages/webui/test/unit/webui-service.test.ts +++ b/packages/webui/test/unit/webui-service.test.ts @@ -1149,6 +1149,25 @@ describe("WebUI service", () => { }; } + it("routes native desktop selection only with both launch grant and credential, including dev mode", async () => { + const grant = "11111111-2222-3333-4444-555555555555"; + const choose = vi.fn(async () => ({ kind: "selected" as const, directory: os.tmpdir() })); + const dispose = vi.fn(async () => {}); + service = new WebuiService({ port, operations: createOperationRegistry(port), dev: true, + nativeDirectoryPicker: { grant, choose, dispose } }); + const info = await service.start(); + const origin = `http://127.0.0.1:${info.tcpPort}`; + const headers = { Origin: origin, "Sec-Fetch-Site": "same-origin", "X-Webui-Native-Grant": grant }; + const denied = await fetch(`${origin}/native-directory-picker`, { method: "POST", headers }); + expect(denied.status).toBe(401); expect(choose).not.toHaveBeenCalled(); + const accepted = await fetch(`${origin}/native-directory-picker`, { method: "POST", headers: { + ...headers, "X-Webui-Token": info.credential.token, + } }); + expect(accepted.status).toBe(200); + expect(await accepted.json()).toEqual({ kind: "selected", directory: os.tmpdir() }); + await service.close(); expect(dispose).toHaveBeenCalledTimes(1); + }); + // Awaits the upgrade promise and asserts the rejection carries the // expected guard. The promise is consumed on every refusal path, so the // `ws` library's refused-handshake rejection never escapes as an diff --git a/packages/webui/test/unit/webui-transport-wire.test.ts b/packages/webui/test/unit/webui-transport-wire.test.ts index 4935a9159..53731d5eb 100644 --- a/packages/webui/test/unit/webui-transport-wire.test.ts +++ b/packages/webui/test/unit/webui-transport-wire.test.ts @@ -664,6 +664,26 @@ describe("an inbound frame is judged before it is believed", () => { ); }); + it("carries the Mini App preparation reason to the request caller", async () => { + const transport = transportWith(ControllableSocket); + const pending = transport.openMiniApp!({ pluginId: "fixture" }); + const refused = expect(pending).rejects.toMatchObject({ + code: "MINIAPP_PREPARATION_FAILED", + reasonCode: "OWNED_ELSEWHERE", + }); + await tick(); + const socket = ControllableSocket.latest!; + socket.deliver({ + protocolVersion: 1, + kind: "error", + requestId: socket.request.requestId, + code: "MINIAPP_PREPARATION_FAILED", + message: "Mini App publication preparation failed", + reasonCode: "OWNED_ELSEWHERE", + }); + await refused; + }); + it("refuses a frame from a different protocol version instead of reading it as an answer", async () => { // The client used to `JSON.parse(...) as WireFrame` and check nothing else, // so a frame from a service speaking another version was accepted as though diff --git a/packages/webui/test/unit/webui-wire-envelope.test.ts b/packages/webui/test/unit/webui-wire-envelope.test.ts index f658637f3..ea22ba1e6 100644 --- a/packages/webui/test/unit/webui-wire-envelope.test.ts +++ b/packages/webui/test/unit/webui-wire-envelope.test.ts @@ -34,6 +34,26 @@ function socket(): { readyState: number; OPEN: number; sent: string[]; send(payl } describe("the service judges an inbound frame", () => { + it("preserves the reason of a Mini App publication refusal", async () => { + const ws = socket(); + const entry = { + operation: { validate: () => ({ ok: true, body: {} }) }, + handle: async () => { + throw Object.assign(new Error("Mini App publication preparation failed"), { + code: "MINIAPP_PREPARATION_FAILED", + reasonCode: "OWNED_ELSEWHERE", + }); + }, + } as unknown as WebuiOperationRegistryEntry; + await dispatchWebuiFrame(ws as unknown as WebSocket, + { protocolVersion: 1, kind: "request", requestId: "open", operation: "openMiniApp", body: {} }, + new Map([["openMiniApp", entry]]), true, () => undefined); + expect(JSON.parse(ws.sent[0]!)).toMatchObject({ + code: "MINIAPP_PREPARATION_FAILED", + reasonCode: "OWNED_ELSEWHERE", + }); + }); + it("observes a rejecting finalizer once when abort interrupts a parked pull", async () => { const ws = socket(); const controller = new AbortController(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 438c19983..9ca142c2e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,11 +60,11 @@ importers: specifier: 2.32.0 version: 2.32.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.9.3))(eslint@8.57.1) eslint-plugin-prettier: - specifier: 5.5.6 - version: 5.5.6(eslint-config-prettier@10.1.8(eslint@8.57.1))(eslint@8.57.1)(prettier@3.9.9) + specifier: 5.5.7 + version: 5.5.7(eslint-config-prettier@10.1.8(eslint@8.57.1))(eslint@8.57.1)(prettier@3.10.1) prettier: - specifier: 3.9.9 - version: 3.9.9 + specifier: 3.10.1 + version: 3.10.1 shx: specifier: ^0.4.0 version: 0.4.0 @@ -632,10 +632,6 @@ importers: zod: specifier: ^3 version: 3.25.76 - optionalDependencies: - '@larksuiteoapi/node-sdk': - specifier: ^1.60.0 - version: 1.73.3 devDependencies: '@types/js-yaml': specifier: ^4 @@ -658,6 +654,10 @@ importers: vitest: specifier: 4.1.11 version: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) + optionalDependencies: + '@larksuiteoapi/node-sdk': + specifier: ^1.60.0 + version: 1.73.3 packages/local-runtime-v2: dependencies: @@ -765,14 +765,14 @@ importers: specifier: ^4 version: 4.1.4 dependency-cruiser: - specifier: 18.4.0 - version: 18.4.0 + specifier: 18.7.2 + version: 18.7.2 jscpd: - specifier: ^5.3.3 - version: 5.3.3 + specifier: ^5.4.3 + version: 5.4.3 knip: - specifier: ^6.38.0 - version: 6.38.0 + specifier: ^6.45.1 + version: 6.47.0 typescript: specifier: ^5 version: 5.9.3 @@ -886,10 +886,6 @@ importers: ws: specifier: ^8.20.0 version: 8.21.3 - optionalDependencies: - '@mariozechner/clipboard': - specifier: 0.3.9 - version: 0.3.9 devDependencies: '@earendil-works/pi-ai': specifier: workspace:* @@ -907,8 +903,8 @@ importers: specifier: ^0.4.0 version: 0.4.0 knip: - specifier: ^6.38.0 - version: 6.38.0 + specifier: ^6.45.1 + version: 6.47.0 node-pty: specifier: ^1.0.0 version: 1.1.0 @@ -918,6 +914,10 @@ importers: vitest: specifier: 4.1.11 version: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) + optionalDependencies: + '@mariozechner/clipboard': + specifier: 0.3.9 + version: 0.3.9 packages/webui: dependencies: @@ -1016,29 +1016,29 @@ importers: specifier: 8.18.1 version: 8.18.1 autoprefixer: - specifier: 10.4.20 - version: 10.4.20(postcss@8.5.28) + specifier: 10.6.2 + version: 10.6.2(postcss@8.5.32) postcss: - specifier: 8.5.28 - version: 8.5.28 + specifier: 8.5.32 + version: 8.5.32 postcss-import: specifier: 15.1.0 - version: 15.1.0(postcss@8.5.28) + version: 15.1.0(postcss@8.5.32) tailwindcss: specifier: 3.4.17 version: 3.4.17 tsx: - specifier: 4.23.13 - version: 4.23.13 + specifier: 4.23.15 + version: 4.23.15 typescript: specifier: 5.9.3 version: 5.9.3 vite: specifier: 7.3.6 - version: 7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1) + version: 7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) vitest: specifier: 4.1.11 - version: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1)) + version: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) third_party/pi-mono/packages/agent: dependencies: @@ -1080,8 +1080,8 @@ importers: specifier: 1.52.0 version: 1.52.0(@modelcontextprotocol/sdk@1.30.0(zod@3.25.76)) '@mistralai/mistralai': - specifier: 2.7.0 - version: 2.7.0(@opentelemetry/api@1.9.0) + specifier: 3.5.0 + version: 3.5.0(@opentelemetry/api@1.9.0) '@opentelemetry/api': specifier: 1.9.0 version: 1.9.0 @@ -1089,8 +1089,8 @@ importers: specifier: 4.7.3 version: 4.7.3 http-proxy-agent: - specifier: 7.0.2 - version: 7.0.2 + specifier: 9.1.0 + version: 9.1.0 https-proxy-agent: specifier: 7.0.6 version: 7.0.6 @@ -1167,10 +1167,6 @@ importers: yaml: specifier: 2.9.0 version: 2.9.0 - optionalDependencies: - '@mariozechner/clipboard': - specifier: 0.3.9 - version: 0.3.9 devDependencies: '@types/cross-spawn': specifier: 6.0.6 @@ -1199,6 +1195,10 @@ importers: vitest: specifier: 4.1.11 version: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@24.12.4)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@24.12.4)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)) + optionalDependencies: + '@mariozechner/clipboard': + specifier: 0.3.9 + version: 0.3.9 third_party/pi-mono/packages/tui: dependencies: @@ -1432,6 +1432,9 @@ packages: peerDependencies: react: 18.3.1 + '@dual-bundle/import-meta-resolve@4.2.1': + resolution: {integrity: sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==} + '@emnapi/core@1.11.2': resolution: {integrity: sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==} @@ -1691,30 +1694,35 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] '@mariozechner/clipboard-linux-arm64-musl@0.3.9': resolution: {integrity: sha512-AGuJdgKsmJdm4Pych7kv3sqe591ERRaAHW3xjLooiFzn8J+PxUyof++7YZrB5Y5tpnTO+K18Og3taj2NpluCRQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] '@mariozechner/clipboard-linux-riscv64-gnu@0.3.9': resolution: {integrity: sha512-DXBEAiuMpk7dhS1a9NzNxVAFi1vaKoPu7rQNgY8LIDLGrK3lnIp3nT10DUum+PKVJoJppIP+NAA8IZe4DMNDPw==} engines: {node: '>= 10'} cpu: [riscv64] os: [linux] + libc: [glibc] '@mariozechner/clipboard-linux-x64-gnu@0.3.9': resolution: {integrity: sha512-WORrMLd6EpElEME7JRKfSaY34nW1P5LbdgK5YNCS1ncG2LqmITsSMEJ8nh2mpvxb3TxqbOOKgY7k9eMJYlW9Mw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] '@mariozechner/clipboard-linux-x64-musl@0.3.9': resolution: {integrity: sha512-/DHn+1DrfL6oRaPPWXaOKvonFFrni666fxd+zFqiQEfvBH0tsHVWjq9iqBk0oDp0qaPA72lIMy5BptxISBEhZQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] '@mariozechner/clipboard-win32-arm64-msvc@0.3.9': resolution: {integrity: sha512-O5FHD3ErkMwMhNzAfu3ggy0ug4z7btZuoQgwwxlzPrwV2bxlD6WDpqBY4NCgICAgZdDKdp+loUEKVAVt8aYnhQ==} @@ -1736,14 +1744,36 @@ packages: resolution: {integrity: sha512-j37dj/h6p6pots1L7pLPPNuABEEu9WP4OYg9pW1g+nYG331j0+3canE9OagtYdytYvdSAMG+2fKU5cxep6LgjA==} engines: {node: '>=22.12.0'} - '@mistralai/mistralai@2.7.0': - resolution: {integrity: sha512-zCrx6MtNpcz+EL/Nqvg55QubSgmfwJfBmd3d3wSYfJGfnvlNnWcJYlxEW5xQpS3KR6A5qK9KUyRBwMDIWnyVGA==} + '@mistralai/mistralai@3.5.0': + resolution: {integrity: sha512-8nwJc1lySdkEWETw1Y4jOCAfFkzWQecZ12L3DYs+87G0/KcG+k/+r/CWLHPj8zL2vNigj8SCZQDRM9/ZoUaD0g==} peerDependencies: + '@aws-sdk/client-s3': ^3.300.0 + '@azure/identity': ^4.0.0 + '@azure/storage-blob': ^12.24.0 + '@google-cloud/storage': ^7.0.0 || ^8.0.0 + '@hpcc-js/wasm-zstd': ^1.16.0 + '@livekit/rtc-node': ^0.13.28 + '@msgpack/msgpack': ^3.0.0 '@opentelemetry/api': ^1.9.0 '@opentelemetry/exporter-trace-otlp-http': ^0.220.0 '@opentelemetry/resources': ^2.9.0 '@opentelemetry/sdk-trace-base': ^2.9.0 + livekit-client: ^2.19.0 peerDependenciesMeta: + '@aws-sdk/client-s3': + optional: true + '@azure/identity': + optional: true + '@azure/storage-blob': + optional: true + '@google-cloud/storage': + optional: true + '@hpcc-js/wasm-zstd': + optional: true + '@livekit/rtc-node': + optional: true + '@msgpack/msgpack': + optional: true '@opentelemetry/api': optional: true '@opentelemetry/exporter-trace-otlp-http': @@ -1752,6 +1782,8 @@ packages: optional: true '@opentelemetry/sdk-trace-base': optional: true + livekit-client: + optional: true '@modelcontextprotocol/sdk@1.30.0': resolution: {integrity: sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==} @@ -1768,6 +1800,7 @@ packages: engines: {node: ^22.20 || ^24.12 || >=25} cpu: [x64] os: [linux] + libc: [glibc] '@napi-rs/wasm-runtime@1.2.4': resolution: {integrity: sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==} @@ -1796,122 +1829,130 @@ packages: resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==} engines: {node: '>=14'} - '@oxc-parser/binding-android-arm-eabi@0.150.0': - resolution: {integrity: sha512-oQef2Zu4Prz1KLKznz3HqZzU9uVoA5PMoDZuuLmqms7hKmKSAPzlaMnLllJq3t+rgKmfJJ2siPrpZfFrW06btw==} + '@oxc-parser/binding-android-arm-eabi@0.156.0': + resolution: {integrity: sha512-RMq7DKNzEp1T51QKNLTn0NryNEt2IYfh7mZBlIdi2Ju52ltOEDMeIXv0XBpA6dL7j7ChjlcovtGcc1Jv4qMipg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxc-parser/binding-android-arm64@0.150.0': - resolution: {integrity: sha512-B6ofpoFiAUwIZ0MJ2IgHPvZK8FAtL4qzSZRwOkAKIfxEobE1mQC8nDdiFZj7pUaJiVUVCsfkMsBJKedzO8rZvA==} + '@oxc-parser/binding-android-arm64@0.156.0': + resolution: {integrity: sha512-mwkWKhOBpmh8fWc3m4MiLsmEAtx0YuHmvyo9ff557cnb3QZ2kt2eauSz75wCGIpiZG3gUsJ4WwzEjm4R4/BHig==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxc-parser/binding-darwin-arm64@0.150.0': - resolution: {integrity: sha512-J+9IHKzx/bSz1JetOfD4zKXSK9sOm4/a7+0qomJODcTL6JsRXGeV/ZdkAPSIDydfFmWzYCraMlQEosSZEyBYkQ==} + '@oxc-parser/binding-darwin-arm64@0.156.0': + resolution: {integrity: sha512-6pGR5fUszM9M4eBBapqpGjCRJolFwuCldx8bRQjqXyM09cQysBTWVF2Ttg4UNJVxYSaw5RRINbveCOOCrsuGvA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxc-parser/binding-darwin-x64@0.150.0': - resolution: {integrity: sha512-v6IPfcAcSYrBWXV5Tce1DmxDMXLhEYpIIWiRFPJopgCVscZdLaV4MRQOUxvL3usQlw+yrwYOjBFB9IwBx+jUiQ==} + '@oxc-parser/binding-darwin-x64@0.156.0': + resolution: {integrity: sha512-M9QghL7uCAqMKjYJv1rDGblfEvkeQu3QzTPd7Uwo16gG3uO7m9ikVQ9OL8FZTnKzU4vbCEby6kTlEkqN+JeEMA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxc-parser/binding-freebsd-x64@0.150.0': - resolution: {integrity: sha512-AoR/4jD02HET0KO0yNT4nbTE+XJUxiO9jB1X/ycEjUE3WrIJ3IjV/Vf+gskhWLcqqeXfvNnkDtBR7epllAm88A==} + '@oxc-parser/binding-freebsd-x64@0.156.0': + resolution: {integrity: sha512-lX0ANxSwAOrpOT7NHB+YsrBqDJ8sOVon5m7GS9eQtkuUeNzQMMGpFsJLsStawTbrdwOF5KDVxgPWcKmt/DIZUQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxc-parser/binding-linux-arm-gnueabihf@0.150.0': - resolution: {integrity: sha512-A/hycCFjLUrCmLoL5O/vBp40ohlaXO1Ta3v5hqYZxicYFs129wZmgZJggcW4mYGYbZebQLhup+N8JjeQl8qwyw==} + '@oxc-parser/binding-linux-arm-gnueabihf@0.156.0': + resolution: {integrity: sha512-iPgYpasRcqk7X3TGncQg7B+6RotDvG8weug0UrgF+FXLf4KmaNDyT91BKONlqbHcNgK9Nryp7AEZGuQn32fP6g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-parser/binding-linux-arm-musleabihf@0.150.0': - resolution: {integrity: sha512-pbqahg1Pkz7J4RKmXm30s/iQu99hv64ayXCu8P4p75HcEH5azOdR4eGqiB6lFGkFR3mMpzaYsSKLkS8oJbjmeQ==} + '@oxc-parser/binding-linux-arm-musleabihf@0.156.0': + resolution: {integrity: sha512-sJqJDEZevtkEfoxrXfaRTkSt6Itckr549cIfBbs11UgXv8bFyqQsXTQa6iKm8mTiWYmCDDFJf7TLnqxcbqzPOw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxc-parser/binding-linux-arm64-gnu@0.150.0': - resolution: {integrity: sha512-HV11aRbBQGwqv8bEo+K/6qr88uB4fEe1mhXncMhlVCrj+WpBSraxrUzHaPVmeQRU6x6x8v/3DuCbbo93rpp+fw==} + '@oxc-parser/binding-linux-arm64-gnu@0.156.0': + resolution: {integrity: sha512-mrQs5OdRiqKskRuWEORPKT6YGIFhrpVvCvL9hqVaIh60EzgR4qjPvSsV6hWZcOfyWHBTbdEvfnDJPh/eQlxPRQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] - '@oxc-parser/binding-linux-arm64-musl@0.150.0': - resolution: {integrity: sha512-k6pVkJqALwtEuP4zukVhGRhdIy4+ofChUIUUsAHHyqDZlNsknmel3JjbggrJiWGaes6h/dIcWmEXsKW4SmK9oQ==} + '@oxc-parser/binding-linux-arm64-musl@0.156.0': + resolution: {integrity: sha512-ZtPqgCU3+wpU7dvX7YbaEiw71r0UdguzuPhcx4PIEZSs4XFqc6F5wXCtNdb6M7m3DMErlxrwosryoXrzYOY/Gg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] - '@oxc-parser/binding-linux-ppc64-gnu@0.150.0': - resolution: {integrity: sha512-tEFg39mw/rHO5n8GK2DR4ZMFfsPQZtnQIPbsIpjoQRomJc/2tRfsCSmCT6gNit+NZGoeJG5aH9ATDH5bf0WnoQ==} + '@oxc-parser/binding-linux-ppc64-gnu@0.156.0': + resolution: {integrity: sha512-ZuGRT/adReZZJn3PYNneb1HQIOH0iIZ2fzFgC1/XJYpMQ5KsRKmWIEzy3wEFsUwIOTomCmnmTZ/zbFYo9z9VeA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] + libc: [glibc] - '@oxc-parser/binding-linux-riscv64-gnu@0.150.0': - resolution: {integrity: sha512-0JO7IFkoek6HqV589Menx3hJySNXi6quRhO4tq2P7kpEHKEXoDATnoPVUpn5B7gDH2KLkdo751N0uIrGJFCTCw==} + '@oxc-parser/binding-linux-riscv64-gnu@0.156.0': + resolution: {integrity: sha512-T+iWCeAOoEAJpHqr6/pogHIv98g9p8Ctccysm/h962hG4ayX5OL2c0Ih4oYe+JuFndLXy/OASvwMlTPe76sIiw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] + libc: [glibc] - '@oxc-parser/binding-linux-riscv64-musl@0.150.0': - resolution: {integrity: sha512-7XPzREnyAS5wHU9aB+49Uaqgoo1gVCklHc3DRlc3fJy2tXD/eAJFN1QFz/crj+Ulup5P1+axNREF+/RGaB/IRA==} + '@oxc-parser/binding-linux-riscv64-musl@0.156.0': + resolution: {integrity: sha512-wL55bI2kVKfwdxScbw60zVgzAqbQbmE5zpSPWPZoZ9RSG8egm6ITE/UWE5mDWlglxz1QElJCcUbpaJCtHD11BQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] + libc: [musl] - '@oxc-parser/binding-linux-s390x-gnu@0.150.0': - resolution: {integrity: sha512-7n7ZxcbRWDFaTdyj8M8p0O9OfzoMKm8O6syBAIgcSutbOALq0Bb9G52Me+XH0anMLZV+NgXc726gqgG2q39vcQ==} + '@oxc-parser/binding-linux-s390x-gnu@0.156.0': + resolution: {integrity: sha512-+D+JilhLqwrDLODYEl4qtovVwgxKALb23FkAWBiPvgmUWYgjCV83KKuwwxZJM8GCdKlNA1vt3iKtow8HUFjXtg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] + libc: [glibc] - '@oxc-parser/binding-linux-x64-gnu@0.150.0': - resolution: {integrity: sha512-Vx0GSA9ZCRTUiczoEQnIIyXkMvtEY8uc6IiwLQtMe5ci2sXPqjrry0Ek5fsPP1k2kCzkML3ow9UOOEgnEDi7Bw==} + '@oxc-parser/binding-linux-x64-gnu@0.156.0': + resolution: {integrity: sha512-jRfwpN4xKrsEpC+SgrUPY5k0mINYZn7aLrt22I3uQFoumiSgHgsLYgS9f84ntbkvSydH4HiwGuDa2b1XCHaJzw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] - '@oxc-parser/binding-linux-x64-musl@0.150.0': - resolution: {integrity: sha512-ii4/9m3viDLssMnfXU7/Pni/3nYplApuGayceX4qsVGaqqQJCx3tHIH9M/HWIeSty5i8LjS21zPYT6lVIkwLxw==} + '@oxc-parser/binding-linux-x64-musl@0.156.0': + resolution: {integrity: sha512-P/ajnypgLmxmuRRyCIZcp2o4lOwmCaXYH5+eqDTcCW+MCTI+csKSw/Zc6GB67jZoVa4ey3q1jXEt7S60adBEMQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] - '@oxc-parser/binding-openharmony-arm64@0.150.0': - resolution: {integrity: sha512-ZtoxX5rez36ZWkwtiEhjkCPnlTPoQ2I7lIL0IYZ1yjxMYohbvoOjBmUIZzrf9W/HouONq0omIfTeCWEY+R380w==} + '@oxc-parser/binding-openharmony-arm64@0.156.0': + resolution: {integrity: sha512-WSN6rQZZc9KqgZ4lMfjVDvqKhVOCjey/YEZIPisGXmwBqwgWOzru207dyiH50LHcf1n9LO2oceGk/id6RL9v0g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxc-parser/binding-win32-arm64-msvc@0.150.0': - resolution: {integrity: sha512-VqeRb5JX/bKYBrff7TUDvJyKY0914UzuCkuXIGxJS4FUmvMNfqkCbc7Sq90iMz9DlmAtlggwaBYQ9eg3h3ltiw==} + '@oxc-parser/binding-win32-arm64-msvc@0.156.0': + resolution: {integrity: sha512-l21Tz6tjraGBC3JefVeJZ9pojD0fCiB62PydAv+i9nrqJX7z/pDmyDNYLamDr/PRcQ4UQbFwkSnz7NKBB9UMLw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxc-parser/binding-win32-ia32-msvc@0.150.0': - resolution: {integrity: sha512-EPqJfeZ4Pgg2BJSsCV8GozxV0FDltRzpVtGVa1r2noJu1iu+opOw3gtBWXwIo9odCT/MdFfyHxdy0/CRqs3OqA==} + '@oxc-parser/binding-win32-ia32-msvc@0.156.0': + resolution: {integrity: sha512-CUq0ZFl/RODqPiIgfNNSamkpTj5x8AjBTkR/y1DNVIQiTGnmWqjHcn3o08ZW3q/LgkI4g9G9g6UirmmQFvuOZw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxc-parser/binding-win32-x64-msvc@0.150.0': - resolution: {integrity: sha512-n5YMzbqwPQqozbkrexi0lNZrUz5cnPHalYpFWe6Dau7AmKIWNo+y24IwzDuZEQtEdUHuKhXmMMih/MPjOI+CMw==} + '@oxc-parser/binding-win32-x64-msvc@0.156.0': + resolution: {integrity: sha512-dcpx5Y1x2v/cs7U/q3SZMvmxfyXjVvqC86jMuw2ZZUbHDd7W2cW7uSMQfg3GLVaE68Su3H9xd/Pc4v6QNyeSRg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] - '@oxc-project/types@0.150.0': - resolution: {integrity: sha512-rDS5/31E9HfPl/CIzGrn0DOlvBbXFseQ5URJ9sYMfstbKLD/c6Gm9vmRzRGDdAXyOIL4zmO37lc9RIwYqVruZw==} + '@oxc-project/types@0.156.0': + resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} '@oxc-resolver/binding-android-arm-eabi@11.24.2': resolution: {integrity: sha512-y09e0L0SRI2OA2tUIrjBgoV3eH5hvUKXNkJqXmNo5V2WxIjyC7I7aJfRLMEVpA8yi95f90gFDvO0VMgrDw+vwA==} @@ -1952,41 +1993,49 @@ packages: resolution: {integrity: sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA==} cpu: [arm64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-arm64-musl@11.24.2': resolution: {integrity: sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw==} cpu: [arm64] os: [linux] + libc: [musl] '@oxc-resolver/binding-linux-ppc64-gnu@11.24.2': resolution: {integrity: sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA==} cpu: [ppc64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-riscv64-gnu@11.24.2': resolution: {integrity: sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw==} cpu: [riscv64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-riscv64-musl@11.24.2': resolution: {integrity: sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w==} cpu: [riscv64] os: [linux] + libc: [musl] '@oxc-resolver/binding-linux-s390x-gnu@11.24.2': resolution: {integrity: sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ==} cpu: [s390x] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-x64-gnu@11.24.2': resolution: {integrity: sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg==} cpu: [x64] os: [linux] + libc: [glibc] '@oxc-resolver/binding-linux-x64-musl@11.24.2': resolution: {integrity: sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw==} cpu: [x64] os: [linux] + libc: [musl] '@oxc-resolver/binding-openharmony-arm64@11.24.2': resolution: {integrity: sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg==} @@ -2084,66 +2133,79 @@ packages: resolution: {integrity: sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.63.1': resolution: {integrity: sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.63.1': resolution: {integrity: sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.63.1': resolution: {integrity: sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.63.1': resolution: {integrity: sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.63.1': resolution: {integrity: sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==} cpu: [loong64] os: [linux] + libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.63.1': resolution: {integrity: sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.63.1': resolution: {integrity: sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==} cpu: [ppc64] os: [linux] + libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.63.1': resolution: {integrity: sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.63.1': resolution: {integrity: sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.63.1': resolution: {integrity: sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.63.1': resolution: {integrity: sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.63.1': resolution: {integrity: sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openbsd-x64@4.63.1': resolution: {integrity: sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==} @@ -2661,6 +2723,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.19.0: + resolution: {integrity: sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==} + engines: {node: '>=0.4.0'} + hasBin: true + agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} @@ -2669,6 +2736,10 @@ packages: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} + agent-base@9.0.0: + resolution: {integrity: sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==} + engines: {node: '>= 20'} + ajv-formats@3.0.1: resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} peerDependencies: @@ -2759,8 +2830,8 @@ packages: resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} engines: {node: '>=8.0.0'} - autoprefixer@10.4.20: - resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==} + autoprefixer@10.6.2: + resolution: {integrity: sha512-VOw9/yGTGwPPgzFcODtcv6zhEPIeIWkRSe10L2ri2f5vZ7ID7lCt6jZzRF5/ubgOZ+szYydmEF5AYsA5jxX1tA==} engines: {node: ^10 || ^12 || >=14} hasBin: true peerDependencies: @@ -3230,8 +3301,8 @@ packages: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} engines: {node: '>= 0.8'} - dependency-cruiser@18.4.0: - resolution: {integrity: sha512-LLBYQ2XYmOCMG+liUWI2ReRYnnFXIbnzvCGHTohXAViSkawXr3T35fF/FV2cxpmB661pfkJ3ZXn95jhcEQ9GqA==} + dependency-cruiser@18.7.2: + resolution: {integrity: sha512-3Pkco0Kx3GI8tG6DTUDfl9RSZVOXMqD+lvili8m0qw2+zhGFcZMyPspUgb7Crqps1UkL23SFXslpj7a9hj11+A==} engines: {node: ^22||^24||>=26} hasBin: true @@ -3382,8 +3453,8 @@ packages: end-of-stream@1.4.5: resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} - enhanced-resolve@5.25.1: - resolution: {integrity: sha512-nGXts5znJzmWPu+mIE9izCOzdg63oJca2mDzGWWTth7sr4aCToKcoyFVBQwN75Ij5Pf6p510EwkTqViTRzDV+w==} + enhanced-resolve@5.26.0: + resolution: {integrity: sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==} engines: {node: '>=10.13.0'} es-abstract-get@1.0.0: @@ -3487,8 +3558,8 @@ packages: '@typescript-eslint/parser': optional: true - eslint-plugin-prettier@5.5.6: - resolution: {integrity: sha512-ifetmTcxWfz+4qRW3pH/ujdTq2jQIj59AxJMIN26K5avYgU8dxycUETQonWiW+wPrYXA0j3Try0l1CnwVQtDqQ==} + eslint-plugin-prettier@5.5.7: + resolution: {integrity: sha512-WjHyn3GrFd+ZR0rzsLiM4zJZ35PZMOE0SUIxzGmnWNG0126yNfJKJzObmmkYDwHJfGlkz3PSlzyG9ez/LJntwg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: '@types/eslint': '>=8.0.0' @@ -3670,9 +3741,9 @@ packages: resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==} engines: {node: '>= 6'} - formatly@0.7.1: - resolution: {integrity: sha512-ESuCEJE0SGgabl9q+zABI8LhJDmF+8nhpuqDzuM48HfJ9QTD5o6PqFJDFZY7w6f8xsh5lixuj5nJsQNvYOWvKQ==} - engines: {node: '>=18.3.0'} + formatly@0.11.4: + resolution: {integrity: sha512-TeCC10lP8KCgoX+Fe5lryILIT0/Dy+nP0OSVnsuB5CwXoLuOdqxCYlPFF1inR8S/zTy1ec7TjhS2TeRKWzzImA==} + engines: {node: '>=18.14.0'} hasBin: true formdata-polyfill@4.0.10: @@ -3683,8 +3754,8 @@ packages: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} - fraction.js@4.3.7: - resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} + fraction.js@5.3.4: + resolution: {integrity: sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==} fresh@2.0.0: resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} @@ -3865,9 +3936,9 @@ packages: resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} engines: {node: '>= 0.8'} - http-proxy-agent@7.0.2: - resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} - engines: {node: '>= 14'} + http-proxy-agent@9.1.0: + resolution: {integrity: sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig==} + engines: {node: '>= 20'} https-proxy-agent@5.0.1: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} @@ -3892,12 +3963,12 @@ packages: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} - ignore@7.0.5: - resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + ignore@7.0.14: + resolution: {integrity: sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==} engines: {node: '>= 4'} - ignore@7.0.9: - resolution: {integrity: sha512-brTTsvFRt5C1gGHtPst/281UjPD5t9fBqbgoMPlVWy11ZLTPfu7HxK4ZYqO9H7o/yC9rSTCI85EaQ4OoY12qYw==} + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} engines: {node: '>= 4'} immediate@3.0.6: @@ -4015,8 +4086,8 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-installed-globally@1.0.0: - resolution: {integrity: sha512-K55T22lfpQ63N4KEN57jZUAaAYqYHEe8veb/TycJRk9DdSCLLcovXz/mL6mOnhQaZsQGwPhuFopdQIlqGSEjiQ==} + is-installed-globally@1.0.1: + resolution: {integrity: sha512-li88H4QGRoNMX27jEmY8nR515oJVspAgC/WFMlhHfFV8RJ4QyGpHhXnwAe9gH5RIgKmdYRUmrOhQobcgEjIdSw==} engines: {node: '>=18'} is-map@2.0.3: @@ -4135,48 +4206,52 @@ packages: resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==} hasBin: true - jscpd-darwin-arm64@5.3.3: - resolution: {integrity: sha512-fjjfjNf5p9jhEwFvgRyOteGPV7TYwPZ/bFhPiITs2KgvirDMOv7d5lgVSmS3BUHSBMyNwzxjyrAvvvSsE2LdXA==} + jscpd-darwin-arm64@5.4.3: + resolution: {integrity: sha512-2Zu6FrML6exhznj4hryUrnfVRM6dmfH0N7nldeY09cs7fA2TRQD+xzo5wA7SIqzhRDaUo0CBPBNVJz/XFmUEbg==} cpu: [arm64] os: [darwin] - jscpd-darwin-x64@5.3.3: - resolution: {integrity: sha512-MnVxRZX0IWDHP+ze6cMNTQuRsyBy/UB58fgZm/+R8fyktYVScOtYEQw+6AOz2ng6EjzYaCxGJwzlni94yfEZkA==} + jscpd-darwin-x64@5.4.3: + resolution: {integrity: sha512-Y4KykQqxMtVEV3pdjtfYbzONCmLOEgAyX8d2fUbwLW+uH/IZqUVCIwB3LrgCVv4Y+b/7mbOsdrGuIragTGpC/Q==} cpu: [x64] os: [darwin] - jscpd-linux-arm64-gnu@5.3.3: - resolution: {integrity: sha512-sowSw71vQguhEGvM78tNECWCD3ZSSL8T2SE68GKEe89cux0ZjUXx3CRbcarladZ6Pzobpq7Koe4vtRVKHAdBEA==} + jscpd-linux-arm64-gnu@5.4.3: + resolution: {integrity: sha512-08d2DKt9BELglfZj0ZfhEs7I4gxiAk9Iflgjnsd0z4pB1OjWA4+DGDbfWmGOf6W2sVMDpwkVoa5Q5DWaOMPyoA==} cpu: [arm64] os: [linux] + libc: [glibc] - jscpd-linux-arm64-musl@5.3.3: - resolution: {integrity: sha512-pPSPdzRZD3NNHi/5y3ud9z2E3SjIAYh7VWyGrIs0DVzwI7n/0paRFkQ0W6VCdWfPCK6Tnb1yeMgX/vOrygV0sg==} + jscpd-linux-arm64-musl@5.4.3: + resolution: {integrity: sha512-YbgJ7tQzztL441UCKX6UVN6n8zXc7eEwuJ4MHCdFtTf5w6EGpfFDi7+lgBi+MtwampG2k1PoltCYYiRZyPg4/g==} cpu: [arm64] os: [linux] + libc: [musl] - jscpd-linux-x64-gnu@5.3.3: - resolution: {integrity: sha512-FwB2UrrGk5HWXPLlGnGBJJgTgE/f6zhE+MJYpkl2KZvMuj8y6bZqYTW+vgBy82aTqdgokKgEf6aScBeAqR63Fg==} + jscpd-linux-x64-gnu@5.4.3: + resolution: {integrity: sha512-BbL0HypadbjpxNfK/KY4CfpD4sCd2zf9HpFnGwwOjdryjdTG098isft/95BiS/XvZjVT3p6lwLf5ToI97OoqCg==} cpu: [x64] os: [linux] + libc: [glibc] - jscpd-linux-x64-musl@5.3.3: - resolution: {integrity: sha512-J4lN8yc6VieD1Hh/TvtOcRm7bZ3D20idaoy6VZb0iWEa9Ui5M5vJa+hOLK1ye6i6Lyn8CkkSBFCqS9jqsTiF9A==} + jscpd-linux-x64-musl@5.4.3: + resolution: {integrity: sha512-0DlkzVDuuZ83JRZMOc4Fd2tBFKIrtXDHkHvxdF6d4HK+b954PZxuKhwBMArg76CtVSOQcuiICd/zxU9HtdT+mg==} cpu: [x64] os: [linux] + libc: [musl] - jscpd-windows-arm64-msvc@5.3.3: - resolution: {integrity: sha512-mvvHaMrtEkiFdt09RWxbIvlgGfTH0Q7pBecUU4d4nYsz2+6Fs/7KKgWwiMQV80PPGRqCLvOkzpgBDnz9aAgbtA==} + jscpd-windows-arm64-msvc@5.4.3: + resolution: {integrity: sha512-BUD8kCzLyXUomw3vWRDbaBcIPByX6yU3VyqsKSf7/sjzr8y9ZmTRcn0cwmCV2WChrzD5JF4HeQl+hZlb7+s8lg==} cpu: [arm64] os: [win32] - jscpd-windows-x64-msvc@5.3.3: - resolution: {integrity: sha512-4kinkEmmOfmv6glGbjihtmmoJoeR4Czg6dVoR/NNT88jKTnGWZdaSc83je4AEIdznyE9FHKPbg/WpqE9zNJFmQ==} + jscpd-windows-x64-msvc@5.4.3: + resolution: {integrity: sha512-qYSVGZE2WP0NNdZU1S8DsfcCDpjwKSExvsUd86c4Vx9eWwZdw1i+V7h/9FWazo3PxEa+FzPLsCD5YjVawaarRA==} cpu: [x64] os: [win32] - jscpd@5.3.3: - resolution: {integrity: sha512-BLSHnjrByjRCFENUOCPY/xYcPVOxSINTdybjUHuEAbEROmamD+BCQOTy2eLjxuyBWcR34ARV7q1O0/OOiJzxQg==} + jscpd@5.4.3: + resolution: {integrity: sha512-2Ult/j407sgAx4Z8kW4nOB3wfGwvtyKyPN9XE+tbvNEP/QemBN8pijKtG6zC+8nfMuIiiWjNcez7VZo5ZjJRtA==} engines: {node: '>=18'} hasBin: true @@ -4234,8 +4309,8 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - knip@6.38.0: - resolution: {integrity: sha512-umytiMCaZf02MV9SOO1FEDgbDf6h20VZk3ruJE0kh52kkGjYZFRUAXHJWYoLhvhoHGINO/7GXVJmQ2vxTBvl6A==} + knip@6.47.0: + resolution: {integrity: sha512-nYmQnk0YqDXIJrYViJz88c8xw3tBDkpuAmofo58EkVPnKr6DnRKYtf6oIqcGVHZvXDE+gtmFuYx277/QsWng+A==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -4393,6 +4468,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + nanoid@3.3.20: + resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + napi-build-utils@2.0.0: resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==} @@ -4444,10 +4524,6 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} - normalize-range@0.1.2: - resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} - engines: {node: '>=0.10.0'} - npm-run-path@2.0.2: resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} engines: {node: '>=4'} @@ -4523,8 +4599,8 @@ packages: resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==} engines: {node: '>= 0.4'} - oxc-parser@0.150.0: - resolution: {integrity: sha512-zwajKw1GUa57IOdafIS7/yOObGF2NihwIfZfs5yJTRprMSkiwhWOc/k+n8bwnUPbHr2/XsjfBO8KyTPaW3VpWg==} + oxc-parser@0.156.0: + resolution: {integrity: sha512-7JhjgOfZjrIFJH5TlHrpRua864Si5GvwrPr5+eIRCY2sszhKXo6pyhP0HQKOGTtfO4UowwZ72XTGba0+lZphOQ==} engines: {node: ^20.19.0 || >=22.12.0} oxc-resolver@11.24.2: @@ -4546,9 +4622,6 @@ packages: resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==} engines: {node: '>=8'} - package-manager-detector@1.8.0: - resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==} - package-manager-detector@1.9.0: resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==} @@ -4715,6 +4788,10 @@ packages: resolution: {integrity: sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==} engines: {node: ^10 || ^12 || >=14} + postcss@8.5.32: + resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==} + engines: {node: ^10 || ^12 || >=14} + prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} @@ -4729,8 +4806,8 @@ packages: resolution: {integrity: sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==} engines: {node: '>=6.0.0'} - prettier@3.9.9: - resolution: {integrity: sha512-Z/CJHIkdujO/OtN7nXUii0Rf3VT5SRuhjBA82Xvu2XhBUgX3nhP67T0LHceBdQLex7OOFGTox+Q5Yg8Jk2Qivg==} + prettier@3.10.1: + resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==} engines: {node: '>=14'} hasBin: true @@ -4759,6 +4836,15 @@ packages: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} + proxy-agent-negotiate@1.1.0: + resolution: {integrity: sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ==} + engines: {node: '>= 20'} + peerDependencies: + kerberos: ^2.0.0 + peerDependenciesMeta: + kerberos: + optional: true + proxy-from-env@2.1.0: resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==} engines: {node: '>=10'} @@ -4965,6 +5051,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.8.6: + resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==} + engines: {node: '>=10'} + hasBin: true + send@1.2.1: resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} engines: {node: '>= 18'} @@ -5060,8 +5151,8 @@ packages: resolution: {integrity: sha512-PPlsspAZ4jbMBu5DMFhfUGDQLu/vrL4SyBROVS37x8ynnVmFIs1VPBz1Co8Xks3TvpIaZXmU85y4DrQ+UyVFoQ==} engines: {node: '>= 18'} - smol-toml@1.9.0: - resolution: {integrity: sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==} + smol-toml@1.9.1: + resolution: {integrity: sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ==} engines: {node: '>= 18'} sonic-boom@4.2.1: @@ -5071,6 +5162,10 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + source-map-js@1.2.4: + resolution: {integrity: sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==} + engines: {node: '>=6.0.0'} + source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} @@ -5155,8 +5250,8 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - synckit@0.11.13: - resolution: {integrity: sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==} + synckit@0.12.3: + resolution: {integrity: sha512-U+/AXT6LWsxnj2vz9HeUuPWBNgdWxjyIEjEPdbJARC9txmgPzo2VEdqnFo4hHaNyMPtycyVJrSaQYeQv/PoyyA==} engines: {node: ^14.18.0 || >=16.0.0} tailwindcss@3.4.17: @@ -5246,11 +5341,6 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - tsx@4.23.13: - resolution: {integrity: sha512-BL5MGkRln6aDYhb0xbQlEAGw743BaZYWdbWtdJOBriYJboKgUUYCadFp2/FpBBZquBC/ezNBn7wMMPx7FDZUDw==} - engines: {node: '>=18.0.0'} - hasBin: true - tsx@4.23.15: resolution: {integrity: sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==} engines: {node: '>=18.0.0'} @@ -5300,8 +5390,8 @@ packages: engines: {node: '>=0.8.0'} hasBin: true - unbash@4.0.12: - resolution: {integrity: sha512-PnKvRX+Fbxl/usVlTr/31tXIOVAH+8OdC9qaxUQcvurwEnoc3Vk/ipi2Ce8IjMxzK9byfSGdsUBjqqJGc1o5lw==} + unbash@6.0.4: + resolution: {integrity: sha512-t3OptUArewg9OpYGDskTSlxhyLDahfmZ4d36hE44Efb1y3HRLLpzsVqwH+AwBVymP4t7pP71xN+nnduudn2awA==} engines: {node: '>=14'} unbox-primitive@1.1.0: @@ -5842,6 +5932,8 @@ snapshots: react: 18.3.1 tslib: 2.8.1 + '@dual-bundle/import-meta-resolve@4.2.1': {} + '@emnapi/core@1.11.2': dependencies: '@emnapi/wasi-threads': 1.2.2 @@ -6078,8 +6170,9 @@ snapshots: dependencies: '@chevrotain/types': 13.2.0 - '@mistralai/mistralai@2.7.0(@opentelemetry/api@1.9.0)': + '@mistralai/mistralai@3.5.0(@opentelemetry/api@1.9.0)': dependencies: + '@modelcontextprotocol/sdk': 1.30.0(zod@3.25.76) '@opentelemetry/semantic-conventions': 1.43.0 ws: 8.21.3 zod: 3.25.76 @@ -6087,7 +6180,9 @@ snapshots: optionalDependencies: '@opentelemetry/api': 1.9.0 transitivePeerDependencies: + - '@cfworker/json-schema' - bufferutil + - supports-color - utf-8-validate '@modelcontextprotocol/sdk@1.30.0(zod@3.25.76)': @@ -6160,64 +6255,64 @@ snapshots: '@opentelemetry/semantic-conventions@1.43.0': {} - '@oxc-parser/binding-android-arm-eabi@0.150.0': + '@oxc-parser/binding-android-arm-eabi@0.156.0': optional: true - '@oxc-parser/binding-android-arm64@0.150.0': + '@oxc-parser/binding-android-arm64@0.156.0': optional: true - '@oxc-parser/binding-darwin-arm64@0.150.0': + '@oxc-parser/binding-darwin-arm64@0.156.0': optional: true - '@oxc-parser/binding-darwin-x64@0.150.0': + '@oxc-parser/binding-darwin-x64@0.156.0': optional: true - '@oxc-parser/binding-freebsd-x64@0.150.0': + '@oxc-parser/binding-freebsd-x64@0.156.0': optional: true - '@oxc-parser/binding-linux-arm-gnueabihf@0.150.0': + '@oxc-parser/binding-linux-arm-gnueabihf@0.156.0': optional: true - '@oxc-parser/binding-linux-arm-musleabihf@0.150.0': + '@oxc-parser/binding-linux-arm-musleabihf@0.156.0': optional: true - '@oxc-parser/binding-linux-arm64-gnu@0.150.0': + '@oxc-parser/binding-linux-arm64-gnu@0.156.0': optional: true - '@oxc-parser/binding-linux-arm64-musl@0.150.0': + '@oxc-parser/binding-linux-arm64-musl@0.156.0': optional: true - '@oxc-parser/binding-linux-ppc64-gnu@0.150.0': + '@oxc-parser/binding-linux-ppc64-gnu@0.156.0': optional: true - '@oxc-parser/binding-linux-riscv64-gnu@0.150.0': + '@oxc-parser/binding-linux-riscv64-gnu@0.156.0': optional: true - '@oxc-parser/binding-linux-riscv64-musl@0.150.0': + '@oxc-parser/binding-linux-riscv64-musl@0.156.0': optional: true - '@oxc-parser/binding-linux-s390x-gnu@0.150.0': + '@oxc-parser/binding-linux-s390x-gnu@0.156.0': optional: true - '@oxc-parser/binding-linux-x64-gnu@0.150.0': + '@oxc-parser/binding-linux-x64-gnu@0.156.0': optional: true - '@oxc-parser/binding-linux-x64-musl@0.150.0': + '@oxc-parser/binding-linux-x64-musl@0.156.0': optional: true - '@oxc-parser/binding-openharmony-arm64@0.150.0': + '@oxc-parser/binding-openharmony-arm64@0.156.0': optional: true - '@oxc-parser/binding-win32-arm64-msvc@0.150.0': + '@oxc-parser/binding-win32-arm64-msvc@0.156.0': optional: true - '@oxc-parser/binding-win32-ia32-msvc@0.150.0': + '@oxc-parser/binding-win32-ia32-msvc@0.156.0': optional: true - '@oxc-parser/binding-win32-x64-msvc@0.150.0': + '@oxc-parser/binding-win32-x64-msvc@0.156.0': optional: true - '@oxc-project/types@0.150.0': {} + '@oxc-project/types@0.156.0': {} '@oxc-resolver/binding-android-arm-eabi@11.24.2': optional: true @@ -6784,7 +6879,7 @@ snapshots: obug: 2.2.1 std-env: 4.2.0 tinyrainbow: 3.1.1 - vitest: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1)) + vitest: 4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) '@vitest/expect@4.1.11': dependencies: @@ -6795,14 +6890,6 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.1.1 - '@vitest/mocker@4.1.11(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1))': - dependencies: - '@vitest/spy': 4.1.11 - estree-walker: 3.0.3 - magic-string: 0.30.21 - optionalDependencies: - vite: 7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1) - '@vitest/mocker@4.1.11(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0))': dependencies: '@vitest/spy': 4.1.11 @@ -6931,16 +7018,22 @@ snapshots: dependencies: acorn: 8.18.0 + acorn-jsx@5.3.2(acorn@8.19.0): + dependencies: + acorn: 8.19.0 + acorn-loose@8.5.2: dependencies: - acorn: 8.18.0 + acorn: 8.19.0 acorn-walk@8.3.5: dependencies: - acorn: 8.18.0 + acorn: 8.19.0 acorn@8.18.0: {} + acorn@8.19.0: {} + agent-base@6.0.2: dependencies: debug: 4.4.3 @@ -6950,6 +7043,8 @@ snapshots: agent-base@7.1.4: {} + agent-base@9.0.0: {} + ajv-formats@3.0.1(ajv@8.18.0): optionalDependencies: ajv: 8.18.0 @@ -7056,14 +7151,13 @@ snapshots: atomic-sleep@1.0.0: {} - autoprefixer@10.4.20(postcss@8.5.28): + autoprefixer@10.6.2(postcss@8.5.32): dependencies: browserslist: 4.29.1 caniuse-lite: 1.0.30001812 - fraction.js: 4.3.7 - normalize-range: 0.1.2 + fraction.js: 5.3.4 picocolors: 1.1.1 - postcss: 8.5.28 + postcss: 8.5.32 postcss-value-parser: 4.2.0 available-typed-arrays@1.0.7: @@ -7561,24 +7655,24 @@ snapshots: depd@2.0.0: {} - dependency-cruiser@18.4.0: + dependency-cruiser@18.7.2: dependencies: - acorn: 8.18.0 - acorn-jsx: 5.3.2(acorn@8.18.0) + acorn: 8.19.0 + acorn-jsx: 5.3.2(acorn@8.19.0) acorn-jsx-walk: 2.0.0 acorn-loose: 8.5.2 acorn-walk: 8.3.5 commander: 15.0.0 - enhanced-resolve: 5.25.1 - ignore: 7.0.9 + enhanced-resolve: 5.26.0 + ignore: 7.0.14 interpret: 3.1.1 - is-installed-globally: 1.0.0 + is-installed-globally: 1.0.1 json5: 2.2.3 picomatch: 4.0.7 prompts: 2.4.2 rechoir: 0.8.0 safe-regex: 2.1.1 - semver: 7.8.5 + semver: 7.8.6 tsconfig-paths-webpack-plugin: 4.2.0 watskeburt: 6.0.0 @@ -7635,7 +7729,7 @@ snapshots: dependencies: once: 1.4.0 - enhanced-resolve@5.25.1: + enhanced-resolve@5.26.0: dependencies: graceful-fs: 4.2.11 tapable: 2.3.3 @@ -7831,12 +7925,12 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-prettier@5.5.6(eslint-config-prettier@10.1.8(eslint@8.57.1))(eslint@8.57.1)(prettier@3.9.9): + eslint-plugin-prettier@5.5.7(eslint-config-prettier@10.1.8(eslint@8.57.1))(eslint@8.57.1)(prettier@3.10.1): dependencies: eslint: 8.57.1 - prettier: 3.9.9 + prettier: 3.10.1 prettier-linter-helpers: 1.0.1 - synckit: 0.11.13 + synckit: 0.12.3 optionalDependencies: eslint-config-prettier: 10.1.8(eslint@8.57.1) @@ -8070,10 +8164,10 @@ snapshots: mime-types: 2.1.35 optional: true - formatly@0.7.1: + formatly@0.11.4: dependencies: fd-package-json: 2.0.0 - package-manager-detector: 1.8.0 + package-manager-detector: 1.9.0 formdata-polyfill@4.0.10: dependencies: @@ -8081,7 +8175,7 @@ snapshots: forwarded@0.2.0: {} - fraction.js@4.3.7: {} + fraction.js@5.3.4: {} fresh@2.0.0: {} @@ -8285,11 +8379,13 @@ snapshots: statuses: 2.0.2 toidentifier: 1.0.1 - http-proxy-agent@7.0.2: + http-proxy-agent@9.1.0: dependencies: - agent-base: 7.1.4 + agent-base: 9.0.0 debug: 4.4.3 + proxy-agent-negotiate: 1.1.0 transitivePeerDependencies: + - kerberos - supports-color https-proxy-agent@5.0.1: @@ -8319,9 +8415,9 @@ snapshots: ignore@5.3.2: {} - ignore@7.0.5: {} + ignore@7.0.14: {} - ignore@7.0.9: {} + ignore@7.0.5: {} immediate@3.0.6: {} @@ -8431,7 +8527,7 @@ snapshots: dependencies: is-extglob: 2.1.1 - is-installed-globally@1.0.0: + is-installed-globally@1.0.1: dependencies: global-directory: 4.0.1 is-path-inside: 4.0.0 @@ -8531,40 +8627,40 @@ snapshots: dependencies: argparse: 2.0.1 - jscpd-darwin-arm64@5.3.3: + jscpd-darwin-arm64@5.4.3: optional: true - jscpd-darwin-x64@5.3.3: + jscpd-darwin-x64@5.4.3: optional: true - jscpd-linux-arm64-gnu@5.3.3: + jscpd-linux-arm64-gnu@5.4.3: optional: true - jscpd-linux-arm64-musl@5.3.3: + jscpd-linux-arm64-musl@5.4.3: optional: true - jscpd-linux-x64-gnu@5.3.3: + jscpd-linux-x64-gnu@5.4.3: optional: true - jscpd-linux-x64-musl@5.3.3: + jscpd-linux-x64-musl@5.4.3: optional: true - jscpd-windows-arm64-msvc@5.3.3: + jscpd-windows-arm64-msvc@5.4.3: optional: true - jscpd-windows-x64-msvc@5.3.3: + jscpd-windows-x64-msvc@5.4.3: optional: true - jscpd@5.3.3: + jscpd@5.4.3: optionalDependencies: - jscpd-darwin-arm64: 5.3.3 - jscpd-darwin-x64: 5.3.3 - jscpd-linux-arm64-gnu: 5.3.3 - jscpd-linux-arm64-musl: 5.3.3 - jscpd-linux-x64-gnu: 5.3.3 - jscpd-linux-x64-musl: 5.3.3 - jscpd-windows-arm64-msvc: 5.3.3 - jscpd-windows-x64-msvc: 5.3.3 + jscpd-darwin-arm64: 5.4.3 + jscpd-darwin-x64: 5.4.3 + jscpd-linux-arm64-gnu: 5.4.3 + jscpd-linux-arm64-musl: 5.4.3 + jscpd-linux-x64-gnu: 5.4.3 + jscpd-linux-x64-musl: 5.4.3 + jscpd-windows-arm64-msvc: 5.4.3 + jscpd-windows-x64-msvc: 5.4.3 json-bigint@1.0.0: dependencies: @@ -8621,21 +8717,19 @@ snapshots: kleur@3.0.3: {} - knip@6.38.0: + knip@6.47.0: dependencies: - fdir: 6.5.0(picomatch@4.0.7) - formatly: 0.7.1 + formatly: 0.11.4 get-tsconfig: 4.14.3 jiti: 2.7.0 - oxc-parser: 0.150.0 + oxc-parser: 0.156.0 oxc-resolver: 11.24.2 picomatch: 4.0.7 - smol-toml: 1.9.0 + smol-toml: 1.9.1 strip-json-comments: 5.0.3 tinyglobby: 0.2.17 - unbash: 4.0.12 + unbash: 6.0.4 yaml: 2.9.1 - zod: 4.6.5 layout-base@1.0.2: {} @@ -8786,6 +8880,8 @@ snapshots: nanoid@3.3.19: {} + nanoid@3.3.20: {} + napi-build-utils@2.0.0: {} natural-compare@1.4.0: {} @@ -8829,8 +8925,6 @@ snapshots: normalize-path@3.0.0: {} - normalize-range@0.1.2: {} - npm-run-path@2.0.2: dependencies: path-key: 2.0.1 @@ -8912,29 +9006,29 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 - oxc-parser@0.150.0: + oxc-parser@0.156.0: dependencies: - '@oxc-project/types': 0.150.0 + '@oxc-project/types': 0.156.0 optionalDependencies: - '@oxc-parser/binding-android-arm-eabi': 0.150.0 - '@oxc-parser/binding-android-arm64': 0.150.0 - '@oxc-parser/binding-darwin-arm64': 0.150.0 - '@oxc-parser/binding-darwin-x64': 0.150.0 - '@oxc-parser/binding-freebsd-x64': 0.150.0 - '@oxc-parser/binding-linux-arm-gnueabihf': 0.150.0 - '@oxc-parser/binding-linux-arm-musleabihf': 0.150.0 - '@oxc-parser/binding-linux-arm64-gnu': 0.150.0 - '@oxc-parser/binding-linux-arm64-musl': 0.150.0 - '@oxc-parser/binding-linux-ppc64-gnu': 0.150.0 - '@oxc-parser/binding-linux-riscv64-gnu': 0.150.0 - '@oxc-parser/binding-linux-riscv64-musl': 0.150.0 - '@oxc-parser/binding-linux-s390x-gnu': 0.150.0 - '@oxc-parser/binding-linux-x64-gnu': 0.150.0 - '@oxc-parser/binding-linux-x64-musl': 0.150.0 - '@oxc-parser/binding-openharmony-arm64': 0.150.0 - '@oxc-parser/binding-win32-arm64-msvc': 0.150.0 - '@oxc-parser/binding-win32-ia32-msvc': 0.150.0 - '@oxc-parser/binding-win32-x64-msvc': 0.150.0 + '@oxc-parser/binding-android-arm-eabi': 0.156.0 + '@oxc-parser/binding-android-arm64': 0.156.0 + '@oxc-parser/binding-darwin-arm64': 0.156.0 + '@oxc-parser/binding-darwin-x64': 0.156.0 + '@oxc-parser/binding-freebsd-x64': 0.156.0 + '@oxc-parser/binding-linux-arm-gnueabihf': 0.156.0 + '@oxc-parser/binding-linux-arm-musleabihf': 0.156.0 + '@oxc-parser/binding-linux-arm64-gnu': 0.156.0 + '@oxc-parser/binding-linux-arm64-musl': 0.156.0 + '@oxc-parser/binding-linux-ppc64-gnu': 0.156.0 + '@oxc-parser/binding-linux-riscv64-gnu': 0.156.0 + '@oxc-parser/binding-linux-riscv64-musl': 0.156.0 + '@oxc-parser/binding-linux-s390x-gnu': 0.156.0 + '@oxc-parser/binding-linux-x64-gnu': 0.156.0 + '@oxc-parser/binding-linux-x64-musl': 0.156.0 + '@oxc-parser/binding-openharmony-arm64': 0.156.0 + '@oxc-parser/binding-win32-arm64-msvc': 0.156.0 + '@oxc-parser/binding-win32-ia32-msvc': 0.156.0 + '@oxc-parser/binding-win32-x64-msvc': 0.156.0 oxc-resolver@11.24.2: optionalDependencies: @@ -8973,8 +9067,6 @@ snapshots: '@types/retry': 0.12.0 retry: 0.13.1 - package-manager-detector@1.8.0: {} - package-manager-detector@1.9.0: {} pako@1.0.11: {} @@ -9088,28 +9180,28 @@ snapshots: possible-typed-array-names@1.1.0: {} - postcss-import@15.1.0(postcss@8.5.28): + postcss-import@15.1.0(postcss@8.5.32): dependencies: - postcss: 8.5.28 + postcss: 8.5.32 postcss-value-parser: 4.2.0 read-cache: 1.0.2 resolve: 1.22.12 - postcss-js@4.1.0(postcss@8.5.28): + postcss-js@4.1.0(postcss@8.5.32): dependencies: camelcase-css: 2.0.1 - postcss: 8.5.28 + postcss: 8.5.32 - postcss-load-config@4.0.2(postcss@8.5.28): + postcss-load-config@4.0.2(postcss@8.5.32): dependencies: lilconfig: 3.1.3 yaml: 2.9.0 optionalDependencies: - postcss: 8.5.28 + postcss: 8.5.32 - postcss-nested@6.2.0(postcss@8.5.28): + postcss-nested@6.2.0(postcss@8.5.32): dependencies: - postcss: 8.5.28 + postcss: 8.5.32 postcss-selector-parser: 6.1.4 postcss-selector-parser@6.1.4: @@ -9125,6 +9217,12 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + postcss@8.5.32: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.2.4 + prebuild-install@7.1.3: dependencies: detect-libc: 2.1.2 @@ -9146,7 +9244,7 @@ snapshots: dependencies: fast-diff: 1.3.0 - prettier@3.9.9: {} + prettier@3.10.1: {} process-nextick-args@2.0.1: {} @@ -9184,6 +9282,8 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 + proxy-agent-negotiate@1.1.0: {} + proxy-from-env@2.1.0: optional: true @@ -9435,6 +9535,8 @@ snapshots: semver@7.8.5: {} + semver@7.8.6: {} + send@1.2.1: dependencies: debug: 4.4.3 @@ -9558,7 +9660,7 @@ snapshots: smol-toml@1.7.1: {} - smol-toml@1.9.0: {} + smol-toml@1.9.1: {} sonic-boom@4.2.1: dependencies: @@ -9566,6 +9668,8 @@ snapshots: source-map-js@1.2.1: {} + source-map-js@1.2.4: {} + source-map@0.6.1: {} split2@4.2.0: {} @@ -9651,8 +9755,9 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - synckit@0.11.13: + synckit@0.12.3: dependencies: + '@dual-bundle/import-meta-resolve': 4.2.1 '@pkgr/core': 0.3.6 tailwindcss@3.4.17: @@ -9671,11 +9776,11 @@ snapshots: normalize-path: 3.0.0 object-hash: 3.0.0 picocolors: 1.1.1 - postcss: 8.5.28 - postcss-import: 15.1.0(postcss@8.5.28) - postcss-js: 4.1.0(postcss@8.5.28) - postcss-load-config: 4.0.2(postcss@8.5.28) - postcss-nested: 6.2.0(postcss@8.5.28) + postcss: 8.5.32 + postcss-import: 15.1.0(postcss@8.5.32) + postcss-js: 4.1.0(postcss@8.5.32) + postcss-load-config: 4.0.2(postcss@8.5.32) + postcss-nested: 6.2.0(postcss@8.5.32) postcss-selector-parser: 6.1.4 resolve: 1.22.12 sucrase: 3.35.1 @@ -9751,7 +9856,7 @@ snapshots: tsconfig-paths-webpack-plugin@4.2.0: dependencies: chalk: 4.1.2 - enhanced-resolve: 5.25.1 + enhanced-resolve: 5.26.0 tapable: 2.3.3 tsconfig-paths: 4.2.0 @@ -9770,12 +9875,6 @@ snapshots: tslib@2.8.1: {} - tsx@4.23.13: - dependencies: - esbuild: 0.28.2 - optionalDependencies: - fsevents: 2.3.3 - tsx@4.23.15: dependencies: esbuild: 0.28.2 @@ -9837,7 +9936,7 @@ snapshots: uglify-js@3.19.3: optional: true - unbash@4.0.12: {} + unbash@6.0.4: {} unbox-primitive@1.1.0: dependencies: @@ -9870,21 +9969,6 @@ snapshots: vary@1.1.2: {} - vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1): - dependencies: - esbuild: 0.28.2 - fdir: 6.5.0(picomatch@4.0.7) - picomatch: 4.0.7 - postcss: 8.5.28 - rollup: 4.63.1 - tinyglobby: 0.2.17 - optionalDependencies: - '@types/node': 20.19.43 - fsevents: 2.3.3 - jiti: 2.7.0 - tsx: 4.23.13 - yaml: 2.9.1 - vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0): dependencies: esbuild: 0.28.2 @@ -9945,35 +10029,6 @@ snapshots: tsx: 4.23.15 yaml: 2.9.1 - vitest@4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1)): - dependencies: - '@vitest/expect': 4.1.11 - '@vitest/mocker': 4.1.11(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1)) - '@vitest/pretty-format': 4.1.11 - '@vitest/runner': 4.1.11 - '@vitest/snapshot': 4.1.11 - '@vitest/spy': 4.1.11 - '@vitest/utils': 4.1.11 - es-module-lexer: 2.3.2 - expect-type: 1.4.0 - magic-string: 0.30.21 - obug: 2.2.1 - pathe: 2.0.3 - picomatch: 4.0.7 - std-env: 4.2.0 - tinybench: 2.9.0 - tinyexec: 1.3.1 - tinyglobby: 0.2.17 - tinyrainbow: 3.1.1 - vite: 7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.13)(yaml@2.9.1) - why-is-node-running: 2.3.0 - optionalDependencies: - '@opentelemetry/api': 1.9.0 - '@types/node': 20.19.43 - '@vitest/coverage-v8': 4.1.11(vitest@4.1.11) - transitivePeerDependencies: - - msw - vitest@4.1.11(@opentelemetry/api@1.9.0)(@types/node@20.19.43)(@vitest/coverage-v8@4.1.11)(vite@7.3.6(@types/node@20.19.43)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.0)): dependencies: '@vitest/expect': 4.1.11 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d5fa7ce10..b02f4680d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -32,3 +32,25 @@ packages: - packages/oauth-core - packages/oauth-lease-protocol - packages/mcode-tools-host + +nodeLinker: hoisted + +allowBuilds: + '@google/genai': false + better-sqlite3: true + canvas: false + esbuild: true + node-pty: true + protobufjs: false + +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 diff --git a/release/public-source.json b/release/public-source.json index 340e9b5c6..994420cfb 100644 --- a/release/public-source.json +++ b/release/public-source.json @@ -4417,6 +4417,7 @@ "packages/webui/src/client/platform/connection-health.ts", "packages/webui/src/client/platform/event-channel.ts", "packages/webui/src/client/platform/miniapp-frame-url.ts", + "packages/webui/src/client/platform/native-directory-picker.ts", "packages/webui/src/client/platform/no-project.ts", "packages/webui/src/client/platform/page-host.ts", "packages/webui/src/client/platform/session-import.ts", @@ -4656,6 +4657,7 @@ "packages/webui/src/server/http/browser-extension.ts", "packages/webui/src/server/http/client-assets.ts", "packages/webui/src/server/http/design-assets.ts", + "packages/webui/src/server/http/native-directory.ts", "packages/webui/src/server/http/responses.ts", "packages/webui/src/server/http/router.ts", "packages/webui/src/server/http/session-transfer.ts", @@ -5099,6 +5101,7 @@ "packages/webui/test/unit/models-catalogue-retention.test.ts", "packages/webui/test/unit/models-provider-intent.test.ts", "packages/webui/test/unit/models-workflows.test.ts", + "packages/webui/test/unit/native-directory-picker.test.ts", "packages/webui/test/unit/observation-scheduler.test.ts", "packages/webui/test/unit/output-error.test.tsx", "packages/webui/test/unit/outside-close.test.ts", @@ -5282,6 +5285,8 @@ "release/public-source.json", "release/webui-npm/README.md", "release/webui-npm/bin/mcode-webui.mjs", + "release/webui-npm/bin/native-directory-picker.mjs", + "release/webui-npm/bin/native-directory-picker.ps1", "release/webui-npm/package.json", "schemas/plugins/app-v1.schema.json", "schemas/plugins/host-binding-v1.schema.json", diff --git a/release/webui-npm/bin/mcode-webui.mjs b/release/webui-npm/bin/mcode-webui.mjs index 66a43b6af..59d90568d 100644 --- a/release/webui-npm/bin/mcode-webui.mjs +++ b/release/webui-npm/bin/mcode-webui.mjs @@ -256,7 +256,15 @@ const terminal = new WebuiTerminalManager(); // The bridge's pairings follow the switches, so the persisted authorization has // to reach them before the service starts serving. await browser.initialize(); +// Kept out of help/version and disabled for unattended, remote and full-access runs. +const { nativeDirectoryPickerEligible, createWindowsDirectoryPicker, nativeDirectoryLaunchUrl } = + await import("./native-directory-picker.mjs"); +const nativeDirectoryPicker = nativeDirectoryPickerEligible({ + platform: process.platform, tty: Boolean(process.stdout.isTTY), bindHost, + fullAccess: args["full-access"], browserSetting: process.env.WEBUI_OPEN_BROWSER, +}) ? createWindowsDirectoryPicker() : undefined; const service = new WebuiService({ + nativeDirectoryPicker, port, operations: createOperationRegistry(port, terminal, browser.port, browserBridge, miniappProxies, miniAppPresenter), terminal, @@ -289,9 +297,12 @@ const service = new WebuiService({ let closing; const close = () => { closing ??= (async () => { - await service.close(); - await browser.close(); - await assembled.host.apiHost.close(); + try { + await service.close(); + } finally { + try { await browser.close(); } + finally { await assembled.host.apiHost.close(); } + } })(); return closing; }; @@ -314,7 +325,8 @@ try { `[mcode-webui] Mini App port: ${miniappPort} — forward it, or a Mini App loads blank`, ); printAccess(info, bindHost); - openBrowser(browserUrl); + // Only the automatically opened local tab receives this separate ephemeral grant. + openBrowser(nativeDirectoryPicker ? nativeDirectoryLaunchUrl(browserUrl, nativeDirectoryPicker.grant) : browserUrl, browserUrl); console.log("Press Ctrl+C to stop the server."); process.once("SIGINT", () => void close().finally(() => process.exit(0))); process.once("SIGTERM", () => void close().finally(() => process.exit(0))); @@ -398,7 +410,7 @@ function lanAddresses() { * The server is already serving by this point, and failing the run because a * browser could not start would turn a convenience into an outage. */ -function openBrowser(url) { +function openBrowser(url, printableUrl = url) { const setting = process.env.WEBUI_OPEN_BROWSER?.trim().toLowerCase(); const disabled = setting === "0" || setting === "false" || setting === "no" || setting === "off" || setting === "never"; const enabled = setting === undefined || setting === "" ? Boolean(process.stdout.isTTY) : !disabled; @@ -415,14 +427,14 @@ function openBrowser(url) { try { const child = spawn(command, args, { stdio: "ignore", detached: true }); child.on("error", (error) => { - console.warn(`[mcode-webui] could not open a browser (${command}): ${error.message}`); - console.warn(`[mcode-webui] open ${url} yourself, or set WEBUI_OPEN_BROWSER=0 to stop this attempt.`); + console.warn(`[mcode-webui] could not open a browser (${command})`); + console.warn(`[mcode-webui] open ${printableUrl} yourself, or set WEBUI_OPEN_BROWSER=0 to stop this attempt.`); }); // Detached so the browser is not a child of this server: closing the page // must not signal the process, and stopping the server must not close the // page the person is still reading. child.unref(); } catch (error) { - console.warn(`[mcode-webui] could not open a browser (${command}): ${error.message}`); + console.warn(`[mcode-webui] could not open a browser (${command})`); } } diff --git a/release/webui-npm/bin/native-directory-picker.mjs b/release/webui-npm/bin/native-directory-picker.mjs new file mode 100644 index 000000000..791d6d865 --- /dev/null +++ b/release/webui-npm/bin/native-directory-picker.mjs @@ -0,0 +1,106 @@ +import { spawn } from 'node:child_process'; +import { randomUUID } from 'node:crypto'; +import { readFile } from 'node:fs/promises'; +import path from 'node:path'; + +export function nativeDirectoryPickerEligible({ platform, tty, bindHost, fullAccess, browserSetting }) { + const setting = browserSetting?.trim().toLowerCase(); + return platform === 'win32' && tty === true && !fullAccess + && ['127.0.0.1', '::1'].includes(bindHost) + && !['0', 'false', 'no', 'off', 'never'].includes(setting); +} + +export function nativeDirectoryLaunchUrl(url, grant) { + const result = new URL(url); + result.hash = new URLSearchParams({ nativeDirectoryGrant: grant }).toString(); + return result.href; +} + +// A narrow launcher-owned provider, never a shell/command execution endpoint. +export function createWindowsDirectoryPicker({ + spawnProcess = spawn, readScript = () => readFile(new URL('./native-directory-picker.ps1', import.meta.url), 'utf8'), + windowsRoot = process.env.SystemRoot, architecture = process.arch, +} = {}) { + let active; + let disposed = false; + const unavailable = () => new Error('Native folder selection is unavailable'); + return { + grant: randomUUID(), + async choose(signal) { + if (disposed || active || signal.aborted || !windowsRoot || !path.win32.isAbsolute(windowsRoot)) throw unavailable(); + let script; + try { script = await readScript(); } catch { throw unavailable(); } + if (disposed || active || signal.aborted) throw unavailable(); + // A 32-bit launcher must reach 64-bit Windows PowerShell, not its redirected SysWOW64 copy. + const system = architecture === 'ia32' ? 'Sysnative' : 'System32'; + const executable = path.win32.join(windowsRoot, system, 'WindowsPowerShell', 'v1.0', 'powershell.exe'); + return new Promise((resolve, reject) => { + let child; + let output = ''; + let settled = false; + let aborting = false; + let killWatchdog; + let markClosed; + const closed = new Promise((resolveClosed) => { markClosed = resolveClosed; }); + const finish = (error, result) => { + if (settled) return; + settled = true; + clearTimeout(timer); + clearTimeout(killWatchdog); + signal.removeEventListener('abort', abort); + if (error) reject(unavailable()); else resolve(result); + }; + const abort = () => { + if (aborting || settled) return; + aborting = true; + try { child?.kill('SIGKILL'); } catch { /* Never disclose process arguments. */ } + // Do not release the HTTP flight until the process actually closes. + // If termination cannot be confirmed, fail closed for this launcher's lifetime. + if (!settled) killWatchdog = setTimeout(() => { disposed = true; finish(unavailable()); }, 1000); + }; + // Independent bound also covers callers other than the HTTP service. + const timer = setTimeout(abort, 120_000); + try { + child = spawnProcess(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-STA', '-EncodedCommand', + Buffer.from(script, 'utf16le').toString('base64')], { windowsHide: true, shell: false, stdio: ['ignore', 'pipe', 'ignore'] }); + active = { abort, closed }; + signal.addEventListener('abort', abort, { once: true }); + if (signal.aborted) abort(); + child.stdout.setEncoding('utf8'); + child.stdout.on('data', (chunk) => { + output += chunk.toString('utf8'); + if (Buffer.byteLength(output) > 32768) abort(); + }); + child.once('error', () => { + if (!child.pid) { active = undefined; markClosed(); } + finish(unavailable()); + }); + child.once('close', (code) => { + active = undefined; + markClosed(); + if (aborting || code !== 0) { finish(unavailable()); return; } + try { + const result = JSON.parse(output.replace(/^\uFEFF/, '').trim()); + if (result.kind === 'cancelled') finish(null, { kind: 'cancelled' }); + else if (result.kind === 'selected' && typeof result.directory === 'string' + && path.win32.isAbsolute(result.directory) && !/[\0\r\n]/.test(result.directory)) { + finish(null, { kind: 'selected', directory: result.directory }); + } else finish(unavailable()); + } catch { finish(unavailable()); } + }); + } catch { active = undefined; finish(unavailable()); } + }); + }, + async dispose() { + disposed = true; + const pending = active; + if (!pending) return; + pending.abort(); + // A stuck child cannot indefinitely block service shutdown. No later choose is admitted. + await new Promise((resolve, reject) => { + const timer = setTimeout(() => reject(unavailable()), 1000); + pending.closed.then(() => { clearTimeout(timer); resolve(); }); + }); + }, + }; +} diff --git a/release/webui-npm/bin/native-directory-picker.ps1 b/release/webui-npm/bin/native-directory-picker.ps1 new file mode 100644 index 000000000..e8f8c886d --- /dev/null +++ b/release/webui-npm/bin/native-directory-picker.ps1 @@ -0,0 +1,64 @@ +# Fixed launcher-owned program. No request text is accepted as code or arguments. +$ErrorActionPreference = 'Stop' +[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false) +if (-not [Environment]::UserInteractive -or [Diagnostics.Process]::GetCurrentProcess().SessionId -eq 0) { exit 3 } +Add-Type -TypeDefinition @' +using System; +using System.Runtime.InteropServices; +namespace WebuiFolderPicker { + [ComImport, Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")] class FileOpenDialog {} + [ComImport, Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IFileDialog { + [PreserveSig] int Show(IntPtr owner); + void SetFileTypes(uint count, IntPtr filters); + void SetFileTypeIndex(uint index); + void GetFileTypeIndex(out uint index); + void Advise(IntPtr events, out uint cookie); + void Unadvise(uint cookie); + void SetOptions(uint options); + void GetOptions(out uint options); + void SetDefaultFolder(IShellItem item); + void SetFolder(IShellItem item); + void GetFolder(out IShellItem item); + void GetCurrentSelection(out IShellItem item); + void SetFileName([MarshalAs(UnmanagedType.LPWStr)] string name); + void GetFileName(out IntPtr name); + void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string title); + void SetOkButtonLabel([MarshalAs(UnmanagedType.LPWStr)] string label); + void SetFileNameLabel([MarshalAs(UnmanagedType.LPWStr)] string label); + void GetResult(out IShellItem item); + } + [ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface IShellItem { + void BindToHandler(IntPtr context, ref Guid handler, ref Guid iid, out IntPtr result); + void GetParent(out IShellItem parent); + void GetDisplayName(uint name, out IntPtr result); + void GetAttributes(uint mask, out uint attributes); + void Compare(IShellItem other, uint hint, out int order); + } + public static class Picker { + public static string Choose() { + object instance = new FileOpenDialog(); IShellItem item = null; IntPtr name = IntPtr.Zero; + try { + var dialog = (IFileDialog)instance; + uint flags; dialog.GetOptions(out flags); + // PICKFOLDERS | FORCEFILESYSTEM | PATHMUSTEXIST | DONTADDTORECENT. + dialog.SetOptions(flags | 0x20u | 0x40u | 0x800u | 0x2000000u); + int result = dialog.Show(IntPtr.Zero); + if (result == unchecked((int)0x800704C7)) return null; + Marshal.ThrowExceptionForHR(result); + dialog.GetResult(out item); item.GetDisplayName(0x80058000u, out name); + return Marshal.PtrToStringUni(name); + } finally { + if (name != IntPtr.Zero) Marshal.FreeCoTaskMem(name); + if (item != null) Marshal.FinalReleaseComObject(item); + Marshal.FinalReleaseComObject(instance); + } + } + } +'@ +try { + $directory = [WebuiFolderPicker.Picker]::Choose() + if ($null -eq $directory) { '{"kind":"cancelled"}' } + else { @{kind='selected';directory=$directory} | ConvertTo-Json -Compress } +} catch { exit 3 } diff --git a/scripts/lib/webui-presentation-inventory.json b/scripts/lib/webui-presentation-inventory.json index 0277d7b29..637f33383 100644 --- a/scripts/lib/webui-presentation-inventory.json +++ b/scripts/lib/webui-presentation-inventory.json @@ -213,7 +213,7 @@ "features/miniapp/ui/MiniAppPicker.public.tsx": "7b631ebd095435d5", "features/miniapp/ui/MiniAppStandalone.public.tsx": "cb4684d8ffa3f32f", "features/miniapp/ui/MiniAppToolApprovals.public.tsx": "a123d341198a1b26", - "features/miniapp/ui/MiniAppView.public.tsx": "7245af70ea92ed94", + "features/miniapp/ui/MiniAppView.public.tsx": "92707a60570eba49", "features/models/ui/ModelEffortSlider.tsx": "4b36ea2127bcc1c3", "features/models/ui/ModelListPanel.tsx": "9be8a8e124de5e7e", "features/models/ui/ModelPanel.tsx": "8f68051cc0c54706", diff --git a/test/source-sync.test.mjs b/test/source-sync.test.mjs index 244ccde23..c6ca158f4 100644 --- a/test/source-sync.test.mjs +++ b/test/source-sync.test.mjs @@ -1587,3 +1587,112 @@ test('the desktop version the marketplace is filtered by is declared in exactly ); assert.deepEqual(offenders, [], 'the declared desktop version is written in the shared module only'); }); + +test('native folder launcher grant is restricted to authenticated interactive Windows loopback', async () => { + const { nativeDirectoryPickerEligible: eligible, nativeDirectoryLaunchUrl } = await import('../release/webui-npm/bin/native-directory-picker.mjs'); + const local = { platform: 'win32', tty: true, bindHost: '127.0.0.1', fullAccess: false }; + assert.equal(eligible(local), true); + for (const change of [{ platform: 'linux' }, { platform: 'darwin' }, { tty: false }, { fullAccess: true }, { bindHost: '0.0.0.0' }, { bindHost: '192.168.1.1' }, { browserSetting: 'off' }]) { + assert.equal(eligible({ ...local, ...change }), false); + } + assert.equal(eligible({ ...local, tty: false, browserSetting: '1' }), false); + const plain = 'http://127.0.0.1:2233/?token=fixture'; + const granted = nativeDirectoryLaunchUrl(plain, 'synthetic-native-grant'); + assert.equal(granted.split('#')[0], plain); + assert.equal(new URLSearchParams(new URL(granted).hash.slice(1)).get('nativeDirectoryGrant'), 'synthetic-native-grant'); + const launcher = readFileSync(new URL('../release/webui-npm/bin/mcode-webui.mjs', import.meta.url), 'utf8'); + assert.match(launcher, /openBrowser\(nativeDirectoryPicker \? nativeDirectoryLaunchUrl\(browserUrl, nativeDirectoryPicker.grant\) : browserUrl, browserUrl\)/); + assert.doesNotMatch(launcher, /console\.(?:log|warn|error)\([^\n]*(?:nativeDirectoryPicker.grant|\$\{url\}|error.message)/); +}); + +test('native folder chooser uses a fixed STA program and narrow selected/cancel results', async () => { + const { EventEmitter } = await import('node:events'); + const { PassThrough } = await import('node:stream'); + const { createWindowsDirectoryPicker } = await import('../release/webui-npm/bin/native-directory-picker.mjs'); + let child; let invocation; + const picker = createWindowsDirectoryPicker({ windowsRoot: 'C:\\Windows', architecture: 'ia32', readScript: async () => 'fixed script', spawnProcess: (...args) => { + invocation = args; child = new EventEmitter(); child.stdout = new PassThrough(); child.kill = () => true; return child; + } }); + const selected = picker.choose(new AbortController().signal); + await Promise.resolve(); + assert.match(invocation[0], /Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe$/); + assert.deepEqual(invocation[1].slice(0, 5), ['-NoLogo', '-NoProfile', '-NonInteractive', '-STA', '-EncodedCommand']); + assert.equal(Buffer.from(invocation[1][5], 'base64').toString('utf16le'), 'fixed script'); + assert.equal(invocation[2].shell, false); + child.stdout.write(JSON.stringify({ kind: 'selected', directory: 'D:\\项目\\work' })); child.emit('close', 0); + assert.deepEqual(await selected, { kind: 'selected', directory: 'D:\\项目\\work' }); + const cancelled = picker.choose(new AbortController().signal); await Promise.resolve(); + child.stdout.write('{"kind":"cancelled"}'); child.emit('close', 0); + assert.deepEqual(await cancelled, { kind: 'cancelled' }); + await picker.dispose(); + await assert.rejects(picker.choose(new AbortController().signal), /unavailable/); + const script = readFileSync(new URL('../release/webui-npm/bin/native-directory-picker.ps1', import.meta.url), 'utf8'); + assert.match(script, /UserInteractive/); assert.match(script, /SessionId -eq 0/); + assert.match(script, /0x20u \| 0x40u \| 0x800u \| 0x2000000u/); + assert.match(script, /0x800704C7/); assert.match(script, /dialog.Show\(IntPtr.Zero\)/); + assert.doesNotMatch(script, /\$args|Invoke-Expression|Start-Process/); +}); + +test('native folder abort kills its child and keeps it busy until close; failures disclose no output', async () => { + const { EventEmitter } = await import('node:events'); + const { PassThrough } = await import('node:stream'); + const { createWindowsDirectoryPicker } = await import('../release/webui-npm/bin/native-directory-picker.mjs'); + let child; let killed = 0; + const picker = createWindowsDirectoryPicker({ windowsRoot: 'C:\\Windows', readScript: async () => 'fixed', spawnProcess: () => { + child = new EventEmitter(); child.stdout = new PassThrough(); child.kill = () => { killed++; return true; }; return child; + } }); + const controller = new AbortController(); const pending = picker.choose(controller.signal); await Promise.resolve(); + let settled = false; + pending.then(() => { settled = true; }, () => { settled = true; }); + const rejection = assert.rejects(pending, /^Error: Native folder selection is unavailable$/); + controller.abort(); + assert.equal(killed, 1); + await Promise.resolve(); assert.equal(settled, false); + await assert.rejects(picker.choose(new AbortController().signal), /unavailable/); + child.emit('close', 1); await rejection; + const malformed = picker.choose(new AbortController().signal); await Promise.resolve(); + child.stdout.write('private-path-or-error'); child.emit('close', 0); + await assert.rejects(malformed, /^Error: Native folder selection is unavailable$/); + await picker.dispose(); +}); + +test('native folder chooser rejects pre-abort and malformed output and waits for disposal close', async () => { + const { EventEmitter } = await import('node:events'); + const { PassThrough } = await import('node:stream'); + const { createWindowsDirectoryPicker } = await import('../release/webui-npm/bin/native-directory-picker.mjs'); + let child; let launches = 0; + const picker = createWindowsDirectoryPicker({ windowsRoot: 'C:\\Windows', readScript: async () => 'fixed', spawnProcess: () => { + launches++; child = new EventEmitter(); child.stdout = new PassThrough(); child.kill = () => true; return child; + } }); + const aborted = new AbortController(); aborted.abort(); + await assert.rejects(picker.choose(aborted.signal), /unavailable/); assert.equal(launches, 0); + for (const output of ['{"kind":"selected","directory":"relative"}', '{"kind":"unexpected"}']) { + const pending = picker.choose(new AbortController().signal); await Promise.resolve(); + child.stdout.write(output); child.emit('close', 0); + await assert.rejects(pending, /unavailable/); + } + const pending = picker.choose(new AbortController().signal); await Promise.resolve(); + const rejected = assert.rejects(pending, /unavailable/); + let disposed = false; + const disposal = picker.dispose().then(() => { disposed = true; }); + await Promise.resolve(); assert.equal(disposed, false); + child.emit('close', 1); await rejected; await disposal; assert.equal(disposed, true); +}); + +test('native folder termination watchdog permanently fails closed if the process does not exit', async () => { + const { EventEmitter } = await import('node:events'); + const { PassThrough } = await import('node:stream'); + const { createWindowsDirectoryPicker } = await import('../release/webui-npm/bin/native-directory-picker.mjs'); + let child; let kills = 0; + const picker = createWindowsDirectoryPicker({ windowsRoot: 'C:\\Windows', readScript: async () => 'fixed', spawnProcess: () => { + child = new EventEmitter(); child.stdout = new PassThrough(); child.kill = () => { kills++; return false; }; return child; + } }); + const controller = new AbortController(); + const pending = picker.choose(controller.signal); await Promise.resolve(); + const rejected = assert.rejects(pending, /unavailable/); + controller.abort(); await rejected; + assert.equal(kills, 1); + child.emit('close', 1); + await assert.rejects(picker.choose(new AbortController().signal), /unavailable/); + await picker.dispose(); +}); diff --git a/test/vitest-suites.json b/test/vitest-suites.json index 53fb3305b..71ac29939 100644 --- a/test/vitest-suites.json +++ b/test/vitest-suites.json @@ -533,6 +533,7 @@ "packages/webui/test/unit/webui-workspace-file-tree.test.tsx", "packages/webui/test/unit/webui-workspace-html-preview.test.tsx", "packages/webui/test/unit/webui-workspace-media-preview.test.tsx", + "packages/webui/test/unit/native-directory-picker.test.ts", "packages/webui/test/unit/workspace-directory-browser.test.ts", "packages/webui/test/unit/workspace-panel-state.test.ts", "packages/webui/test/unit/workspace-queries.test.ts", diff --git a/third_party/pi-mono/packages/ai/package.json b/third_party/pi-mono/packages/ai/package.json index 12cab719c..eb4bcc3a8 100644 --- a/third_party/pi-mono/packages/ai/package.json +++ b/third_party/pi-mono/packages/ai/package.json @@ -59,10 +59,10 @@ "@anthropic-ai/sdk": "0.91.1", "@aws-sdk/client-bedrock-runtime": "3.1048.0", "@google/genai": "1.52.0", - "@mistralai/mistralai": "2.7.0", + "@mistralai/mistralai": "3.5.0", "@opentelemetry/api": "1.9.0", "@smithy/node-http-handler": "4.7.3", - "http-proxy-agent": "7.0.2", + "http-proxy-agent": "9.1.0", "https-proxy-agent": "7.0.6", "openai": "6.26.0", "partial-json": "0.1.7", diff --git a/third_party/pi-mono/packages/ai/src/providers/mistral.ts b/third_party/pi-mono/packages/ai/src/providers/mistral.ts index 1c9c3265a..18db27224 100644 --- a/third_party/pi-mono/packages/ai/src/providers/mistral.ts +++ b/third_party/pi-mono/packages/ai/src/providers/mistral.ts @@ -1,4 +1,5 @@ -import { Mistral } from "@mistralai/mistralai"; +import { MistralCore } from "@mistralai/mistralai/core.js"; +import { chatStream } from "@mistralai/mistralai/funcs/chatStream.js"; import type { ChatCompletionStreamRequest, ChatCompletionStreamRequestMessage, @@ -63,7 +64,7 @@ export const streamMistral: StreamFunction<"mistral-conversations", MistralOptio } // Intentionally per-request: avoids shared SDK mutable state across concurrent consumers. - const mistral = new Mistral({ + const mistral = new MistralCore({ apiKey, serverURL: model.baseUrl, }); @@ -76,9 +77,10 @@ export const streamMistral: StreamFunction<"mistral-conversations", MistralOptio if (nextPayload !== undefined) { payload = nextPayload as ChatCompletionStreamRequest; } - const mistralStream = await mistral.chat.stream(payload, buildRequestOptions(model, options)); + const result = await chatStream(mistral, payload, buildRequestOptions(model, options)); + if (!result.ok) throw result.error; stream.push({ type: "start", partial: output }); - await consumeChatStream(model, output, stream, mistralStream); + await consumeChatStream(model, output, stream, result.value); if (options?.signal?.aborted) { throw new Error("Request was aborted");