@alwith/module-computer

中文文档
0.6.3发布于 2026/11/06SEE LICENSE IN LICENSETypeScriptES Module零依赖构建来源已验证近 30 天下载 2615

Computer access using cmux-cua 0.7.1, pinned to commit e0f738807dbff2f35fe67d7fbcc99c7082cffc23 with the private alwith-cmux-host-v2 contract on macOS ARM64, Windows x64 and Linux x64. macOS uses the Codex profile; Windows and Linux use the native win

原始使用文档

Computer module

Computer access using cmux-cua 0.7.1, pinned to commit e0f738807dbff2f35fe67d7fbcc99c7082cffc23 with the private alwith-cmux-host-v2 contract on macOS ARM64, Windows x64 and Linux x64. macOS uses the Codex profile; Windows and Linux use the native window profile. The TypeScript entry composes MCP descriptors from native authority without storing conversations. Its stable attachment descriptor is independent of Driver readiness and application execution authority. New, resumed and forked threads receive the same discoverable tool contract; the application grant is checked only when a computer tool executes.

The Rust host owns one embedded Driver child and a private transport. Its logical lease key is chosen by the consumer: U uses one application lease shared by every conversation. Individual thread cancellation or window hiding does not revoke this lease. Disabling computer use stops the child and revokes every native execution connection while leaving MCP discovery available. Hosts must shut down on application exit and connection loss. Launch directly from the signed application for macOS permission attribution.

macOS uses a Unix socket and requires Accessibility and Screen Recording. Windows uses authenticated local named pipes; Linux uses a private Unix socket and requires an interactive desktop session. Actual capture and accessibility evidence gate readiness on every platform. Linux window preview uses X11/XWayland; native Wayland window previews depend on compositor support and may be unavailable. Permission covers the local desktop, not an application allowlist. Elevated Windows apps may require OS privileges the ordinary driver does not have. No UIAccess helper is installed.

./artifacts supplies pinned download URLs or package-relative bundled paths, with SHA-256 digests. Apple Silicon macOS uses the archive in artifacts/ with cmux Codex profile and embedded-host patch; Windows/Linux use the same patched source with their native backend. All driver archives are bundled and checksum-pinned. Resolve bundled paths relative to the ./artifacts module and verify the archive before extracting it. Stage the executable, distribute licenses/, and sign it with the application. Patch sources and the rebuild script live in this repository under driver-patches/ and are excluded from the npm package. The MCP proxy uses an explicit embedded endpoint and cannot start a standalone daemon after revocation.

Run bun run test, bun run build, and bun run test:rust in this directory.

The gateway binds an MCP connection token to the returned session ID. It serializes tool access with a FIFO lease held until Runtime turn completion. Cancellation drains an outstanding native action before handoff; transport failure requires the host to stop the Driver before releasing native execution ownership. Consumers must forward Runtime run-state snapshots, including sessions awaiting input. Codex may restart an MCP process with its existing session descriptor. The gateway drains any dispatched action and closes the previous transport before accepting the replacement, which must discover its tools again. Transport failures and unknown action outcomes require explicit host recovery; actions are never replayed.

proxy/stdio.mjs runs with Bun and bridges MCP over authenticated loopback TCP. Stage it as an application resource. The preview independently captures the owned window as a bounded JPEG without changing the Driver's grounding cache. Consumers scope subscriptions to visible windows and discard stale target revisions. Frames are ephemeral and are not a video recording or conversation storage.

Startup verifies the driver's screenshot and accessibility-tree path against a visible host window before publishing a connection. Keep a host window open during recovery. Tool replies have a 150-second deadline (the driver's maximum 120-second tool budget plus transport headroom); protocol discovery has a 20-second deadline. Notifications do not extend these deadlines. A timed-out action has an unknown outcome: stop the Driver before resetting the gateway, reconnect, and observe rather than replaying it. Driver stderr and content-free tool timing records are kept in bounded in-memory buffers for the current application session only. Raw stderr may contain driver error details; it is never automatically persisted or uploaded.

On Windows/Linux, the gateway declares its host-owned Driver session before each session-bound tool call. Driver start_session is idempotent while active and explicitly revives an ended session, so a long-lived MCP connection cannot remain stuck on a tombstone. A failed declaration prevents the requested tool from being dispatched. User tool failures are returned unchanged and are never replayed. Application reconnection replaces the Driver generation and its execution connections while retaining MCP attachment identity.

On macOS, the agent receives the ten app-oriented cmux tools unchanged. Observe with get_app_state, use its grounded indices or coordinates, then refresh after layout changes, modal transitions, or errors. Actions report dispatch only. The cmux MCP proxy owns connection lifecycle; no per-action start_session call is injected. Host readiness/focus calls use a separate authenticated native endpoint and never expand the public MCP catalog. The cursor feed is read only for the current gateway owner and never enters the action request queue.

Every platform uses separate socket and host credentials, private state paths, forced MCP proxy routing, and a parent-lifetime pipe. Metadata validates the exact version, contract, profile, PID and host identity. Host-only operations are limited to readiness and focus and do not become agent tools. Embedded Windows daemons use the default local pipe ACL, reject remote clients and do not start a UIAccess worker. Embedded mode never exposes the optional unauthenticated HTTP transport. Legacy .cua-theme files are not applied; the driver uses its own native cursor.

Before packaging, build all three driver candidates using driver-patches/build.ts on their native OS and verify driver-patches/verify.ts. Only completed builds appear in src/artifacts.lock.json; a missing target fails staging and blocks packaging, with no fallback to another driver. The candidate workflow builds and tests without publishing. Unit tests and cross-compilation do not replace real Windows/Linux desktop capture, input and permission-revocation verification.

Tauri plugin

alwith-computer owns the host, gateway, fault recovery and preview:

.plugin(alwith_computer::init(Config { development_directory, proxy: Some(proxy), observer: Some(observer), ..Default::default() }))

Grant alwith-computer:default (or the settings, session and preview sets) to the windows that show computer UI, and call commands through @alwith/module-computer/commands. The application forwards Runtime run states with Computer::sync_running, calls Computer::release when Runtime or Codex exits, awaits Computer::shutdown in its exit sequence and calls Computer::kill_on_exit last.

Conversation-independent MCP attachments

The application grant defaults to disabled. Every conversation can attach the same computer MCP contract while execution is disabled. Attachment identity lasts for the MCP conversation attachment; Driver generations and their private credentials are internal to the native gateway. Opening, replaying, or sending a conversation must not wait for computer permission checks or Driver readiness.

The gateway answers discovery without a running control daemon. macOS uses the Driver's permission-free Codex bootstrap registry; Windows x64 and Linux x64 use its pure dump-docs --type mcp registry export. Tool names, descriptions, schemas, and action annotations come from that executable rather than application copies. Metadata discovery neither captures the desktop nor starts a control daemon.

Only computer calls acquire desktop ownership, check the current application grant and system permissions, and open an execution transport for the current Driver. Disabling access revokes execution admission before stopping every native Driver connection. Reconnection replaces those internal transports and credentials without closing the agent-facing MCP attachment. Failed calls return MCP tool errors; they do not fail conversation admission or replay. Unknown action outcomes are never replayed. A new observation is required after recovery.

版本与发布记录

@alwith/module-computer 共发布 17 个版本,首次发布于 2026/10/19;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.6.3latest2026/11/061 天前
0.6.22026/11/062 天前
0.6.12026/11/043 天前
0.6.02026/11/034 天前
0.5.22026/11/025 天前
0.5.12026/10/308 天前

关于 @alwith/module-computer 的常见问题

@alwith/module-computer 是什么?

Computer access using cmux-cua 0.7.1, pinned to commit e0f738807dbff2f35fe67d7fbcc99c7082cffc23 with the private alwith-cmux-host-v2 contract on macOS ARM64, Windows x64 and Linux x64. macOS uses the Codex profile; Windows and Linux use the native win

如何安装 @alwith/module-computer?

在项目目录运行 npm install @alwith/module-computer,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@tauri-apps/api(^3.0.0-alpha.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@alwith/module-computer 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@alwith/module-computer 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alwith/module-computer 可以商用吗?

@alwith/module-computer 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@alwith/module-computer 的下载量有多少?

根据 npm 官方下载统计,@alwith/module-computer 在 2026/10/06 – 2026/11/04 这 30 天内被下载 2,615 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alwith/module-computer 还在维护吗?

最新版本 0.6.3 发布于 2026/11/06(1 天前);至今共发布 17 个版本,其中过去 12 个月发布了 17 个;首次发布于 2026/10/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。