@ai-matrx/coding-sessions

中文文档
0.3.637发布于 2026/10/30MITTypeScriptESM + CJS近 30 天下载 13万

Drive the user's own Claude Code and Codex — on their own subscription logins, no API keys — from AI Matrx, and take over chats they started elsewhere. The engine wraps Paperclip's MIT driver packages with every fix the 2026-09-27 spike found (clean envir

原始使用文档
文档目录5 节
  1. Run the screen
  2. Use the engine directly
  3. Mount the screen in your own app
  4. What it deliberately does not do
  5. License

@ai-matrx/coding-sessions

Drive the person's own Claude Code and Codex — on their own subscription logins, with no API keys — from AI Matrx, and take over chats they started anywhere else. A clean screen, no terminal.

  • ./engine (Node) — start, follow up, stop and take over coding sessions. Wraps Paperclip's MIT driver packages (@paperclipai/adapter-claude-local, @paperclipai/adapter-codex-local, @paperclipai/adapter-utils) with every fix our 2026-09-27 spike found built in.
  • ./server (Node) — the local host: HTTP + WebSocket on 127.0.0.1 only, behind a per-launch random token. Serves the screen and bridges it to the engine.
  • ./react — the screen: Running · Recent · Your other chats, a live transcript rendered by @ai-matrx/chat (markdown answers, collapsible tool cards, streaming), a composer, and a New session flow. Light and dark.
  • . — the pure half: the types, the provider normalizers, the projection into chat messages, and the WebSocket transport.

Run the screen

npx coding-sessions host start --port 4789
# CODING_SESSIONS_URL=http://127.0.0.1:4789/?token=…

Open the printed URL. The token is read once, kept for that tab only, and removed from the address bar. The host refuses any socket without the token or from another origin.

Use the engine directly

import { createCodingSessionsEngine } from "@ai-matrx/coding-sessions/engine";

const engine = await createCodingSessionsEngine();
engine.subscribe((event) => console.log(event)); // session · run · item (normalized, both providers)

const providers = await engine.providers();       // installed, version, signed in, subscription vs API
const others = await engine.discoverSessions();    // existing Claude Code + Codex chats on this computer

const { session, run } = await engine.start({ provider: "claude", cwd: "/path/to/repo", prompt: "Fix the flaky test" });
await engine.send(session.id, "Now add a regression test"); // queues if a run is live
await engine.stop(run!.runId);

const taken = await engine.takeover({ provider: "codex", providerSessionId: others[0].providerSessionId, cwd: others[0].cwd! });
await engine.send(taken.id, "Pick up where we left off");

Transcripts stay in the providers' own files (~/.claude/projects, ~/.codex/sessions); the engine keeps only a small index of sessions and runs in ~/.matrx/coding-sessions/index.json.

Accounts and limits. With the host's accounts port, each account keeps its own health and usage (Claude Code: from its runs' rate_limit_event; Codex: its usage probe), so a limit on one account never blocks another. When a session's account is limited and another signed-in account of the same app is free, providers() names it (continueOn) and the screen offers "Continue on "; engine.continueOnAccount(sessionId, accountId) copies the chat into that account's home, resumes it there and re-sends the stopped turn. The host's knob is the engine option switchAccount: "off" | "offer" (default "offer").

Mount the screen in your own app

import { createWebSocketTransport } from "@ai-matrx/coding-sessions";
import { CodingSessionsApp } from "@ai-matrx/coding-sessions/react";

<CodingSessionsApp transport={createWebSocketTransport({ url: "ws://127.0.0.1:4789/ws", token })} />;

A desktop shell replaces the WebSocket with IPC by implementing CodingSessionsTransport on the UI side and calling createHostBridge(engine).handle(method, args) on the other — the UI and the engine never change.

Styling: the screen uses the design system's semantic Tailwind classes. A Tailwind v4 host imports @ai-matrx/design-system/theme.css, the chat package's tokens.css and styles.css, and adds this package's dist as an @source. The page served by ./server ships all of it compiled.

What it deliberately does not do

  • Tool-permission approvals. Runs bypass them (the driver default for Claude; Codex runs in its own workspace-write sandbox with network). Approvals are a later feature.
  • Copy transcripts. Reading a chat reads the provider's own file; nothing is duplicated.

License

MIT. Loads Paperclip AI's MIT-licensed driver packages at run time — see NOTICE.

版本与发布记录

@ai-matrx/coding-sessions 共发布 728 个版本,首次发布于 2026/09/29;过去 12 个月发布了 728 个版本。

版本发布日期距今
0.3.637latest2026/10/306 天前
0.3.6362026/10/297 天前
0.3.6352026/10/298 天前
0.3.6342026/10/298 天前
0.3.6332026/10/288 天前
0.3.6322026/10/289 天前

关于 @ai-matrx/coding-sessions 的常见问题

@ai-matrx/coding-sessions 是什么?

Drive the user's own Claude Code and Codex — on their own subscription logins, no API keys — from AI Matrx, and take over chats they started elsewhere. The engine wraps Paperclip's MIT driver packages with every fix the 2026-09-27 spike found (clean envir

如何安装 @ai-matrx/coding-sessions?

在项目目录运行 npm install @ai-matrx/coding-sessions,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 coding-sessions,可以用 npx coding-sessions 直接运行。

@ai-matrx/coding-sessions 支持 TypeScript 吗?

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

@ai-matrx/coding-sessions 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ai-matrx/coding-sessions 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ai-matrx/coding-sessions 可以商用吗?

@ai-matrx/coding-sessions 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ai-matrx/coding-sessions 的下载量有多少?

根据 npm 官方下载统计,@ai-matrx/coding-sessions 在 2026/10/05 – 2026/11/03 这 30 天内被下载 130,198 次,日均约 4,340 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ai-matrx/coding-sessions 还在维护吗?

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