Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
98f65b8
feat(cli): 大输出落盘原语——exec --out <文件>、batch --out-dir <目录>
corolin Nov 26, 2026
f23a0da
docs: REQ-0004 三层架构设计(interface / middle / core,0.3.0)
corolin Nov 26, 2026
bb9853e
feat(daemon): 线协议版本握手——客户端遇旧 Daemon 明确拒绝,不再交给旧代码执行
corolin Nov 26, 2026
6735f0b
refactor(middle): RuntimeStack、层表读取、会话归属迁入 src/operations/(REQ-0004 M1a)
corolin Nov 26, 2026
6c4a634
refactor(middle): 操作集从工具集提出来,工具集变成薄适配器(REQ-0004 M1b)
corolin Nov 26, 2026
c1a2319
feat(daemon,cli): Daemon 改为中层的薄转发;CLI 全面改走中层(REQ-0004 M2+M3)
corolin Nov 26, 2026
317a0e8
feat(mcp): filaxis-mcp 缺省经 Daemon,没有在跑就自动启动(REQ-0004 M4)
corolin Nov 26, 2026
76d0b10
feat(gate): 分层门禁——三层依赖方向由 check:boundaries 在提交前强制(REQ-0004 M5)
corolin Nov 26, 2026
af0c5f5
test(middle): 中层同构用例集——30 条声明式用例,三种宿主同参同果(REQ-0004 M6)
corolin Nov 26, 2026
e9816f7
fix(local): 本机层的工作目录不存在时直说原因,不再报成找不到 bash
corolin Nov 26, 2026
66accc4
docs: REQ-0004 修订为与实现一致;SKILL、包说明书、CHANGELOG 按 0.3.0 更新(REQ-0004 M7)
corolin Nov 26, 2026
48c6178
fix(mcp): 进程内形态的 filaxis-mcp 在客户端断开后即退出,不再连同 ssh 一起滞留
corolin Nov 26, 2026
d2eb41d
docs: REQ-0004 回填提交号与验收结果(AC-01 – AC-08 全部满足)
corolin Nov 26, 2026
615d27a
fix(build): 打包的类型声明一步改用项目配置,bun run build 恢复零错误退出
corolin Nov 26, 2026
721c1af
fix(mcp): 经 Daemon 的 filaxis-mcp 在握手完成前遇 stdin 关闭时不再滞留
corolin Nov 27, 2026
70d205a
refactor(src): src/ 按层划分目录——core / middle / interface / shared,目录就是分层…
corolin Nov 27, 2026
ced9eaa
docs: REQ-0004 回填 M8 提交号与最终全量结果;门禁头注释里 R3b 的表述与实现对齐
corolin Nov 27, 2026
5466edf
docs(skill): SKILL 中英文标注 0.2.13 → 0.3.0 升级要点;MCP 代理滞留的起始版本更正为 0.2.12
corolin Nov 27, 2026
5851e41
fix(ci): 边界检查脚本在 Node 下能启动——相对导入写真实扩展名
corolin Nov 27, 2026
e939293
fix(gate): 动态导入后面跟方法调用或 default 的是取值,门禁不再放行
corolin Nov 27, 2026
680e5d7
fix(daemon): RPC 参数是数组时原样交给操作——经 Daemon 的 connectSshBatch 恢复可用
corolin Nov 27, 2026
1622ce4
fix(mcp): 多个 filaxis-mcp 客户端同时冷启动时都接得上 Daemon
corolin Nov 27, 2026
a256ef5
fix(mcp): 代理每次重连前先过线协议握手——Daemon 换了版本就拒绝接入
corolin Nov 27, 2026
6ce61d6
fix(middle): openStream 支持调用方指定工作目录——stream open 不再落在 Daemon 的目录
corolin Nov 27, 2026
8ba8a9f
fix(cli): 本机层上的路径补前缀但不折叠——符号链接后面的 .. 按内核语义解析
corolin Nov 27, 2026
3c4d9d2
docs: CHANGELOG 与 REQ-0004 补记外部审查(GPT)七处的修复与最终全量结果
corolin Nov 27, 2026
01b60fc
fix(gate): 动态导入是否只取类型改按所处位置判定
corolin Nov 27, 2026
8e55e9b
fix(middle): openStream 的工作目录交给所选驱动处理,不再另建驱动
corolin Nov 27, 2026
e379bec
fix(mcp): 握手没答上来不开连接;握手在途时 stdin 关闭后不再开连接
corolin Nov 27, 2026
f40574e
fix(cli): 调用方机器上的路径一律只补前缀不折叠——put / get 的本机侧、批次的 commandFile、落盘输出、SSH 密钥
corolin Nov 27, 2026
98fc064
docs: CHANGELOG 与 REQ-0004 补记第二轮外部审查(GPT)四处的修复与最终全量结果
corolin Nov 27, 2026
a7386ef
fix(gate): 冒号是否算类型标注改按所在语句判定——表达式里的冒号不再放行动态取值
corolin Nov 27, 2026
b342699
fix(mcp): 线协议握手请求有硬性期限,并随代理收尾一起中止
corolin Nov 27, 2026
97362e6
fix(transfer): 下载的本地临时文件名不再折叠路径——目标目录在也报 ENOENT 的下载恢复
corolin Nov 27, 2026
4bec662
fix(cli): 已存本机层的相对 cwd 按调用方目录锚定——同一个层上 exec 与 cat 不再读到不同文件
corolin Nov 27, 2026
e86ebcd
fix(daemon): 控制面请求(/status、/health、/shutdown)一律按硬性期限——探测不被滴数据的对端拖住
corolin Nov 27, 2026
5c68fa9
fix(daemon): 请求到点或被中止后,连接上的「结束」不再算作应答——半截应答不被当成完整结果
corolin Nov 27, 2026
93b56f5
fix(gate): 参数默认值表达式里的动态导入不再被当成类型——按参数表逐段判定
corolin Nov 27, 2026
7d63724
fix(transfer): 下载临时名的分隔符按平台认——POSIX 上含反斜杠的长文件名恢复可下载
corolin Nov 27, 2026
700c9ed
fix(cli): 已存本机层交给中层时一律带上明确的 cwd——不写 cwd 的层也以调用方目录为基准
corolin Nov 27, 2026
a2eee5a
docs: CHANGELOG 与 REQ-0004 补记第三、四轮外部审查(GPT)的修复与最终全量结果
corolin Nov 27, 2026
f326bbf
fix(mcp): 经 Daemon 的 MCP 以客户端的工作目录为基准——与进程内形态同参同果
corolin Nov 27, 2026
78c972a
fix(core): `~` 展开与 tmux 窗格锁不再折叠调用方给的路径
corolin Nov 27, 2026
3466fd9
fix(daemon): 有命令或后台会话在途时 `daemon stop` 也停得下——本机驱动销毁时收掉自己起的东西
corolin Nov 27, 2026
ad86625
fix(daemon): bun 运行时下停机不等在途请求——连接逐个销毁,close 回调加兜底
corolin Nov 27, 2026
dfce11b
fix(gate): 类成员与带泛型的返回类型不再误拦;补 58 条动态导入对抗语料
corolin Nov 27, 2026
342dfca
fix(daemon): 多个 `filaxis daemon start` 同时冷启动,输家被告知「已在运行」而非「提前退出」
corolin Nov 27, 2026
d030131
fix: 调用方断开后,经 Daemon 的在途命令真的停掉——信号贯通、整棵进程树收割、请求体读而不完结
corolin Nov 27, 2026
63bcba7
docs: CHANGELOG 回填自挖第 1-5 轮
corolin Nov 27, 2026
a7c37d8
Prepare Filaxis 0.3.0 release
corolin Nov 27, 2026
9abce4d
Update Filaxis 0.3.0 README in Chinese and English
corolin Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
node-version: 24
Expand All @@ -32,7 +32,7 @@ jobs:
else
echo "dist-tag=latest" >> "$GITHUB_OUTPUT"
fi
- run: bun install
- run: bun install --frozen-lockfile
- run: bun run typecheck
- run: bun run check:boundaries
# 真机环境(sshd 自环——必须先于 bun test,集成用例依赖免密 localhost)
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- **观察流(Stream)**:独立 SSH channel 的真流式 tail——观察是廉价的,连接是稀缺的(自动复用主连接)。
- **观察窗(Stream Window)**:远端拉模式流反转为**本地推模式滚动窗**——帧号 per-window 单调递增(断连续编不归零)、peek 三模式全非破坏、多消费者游标互不干扰、stale 窗帧保留重连续编、关窗收割流进程。窗是滚动缓冲不是无限历史(完整历史查落盘日志)。
- **两个身份键,两个职责**:连接拓扑指纹管「复用哪条连接」;环境身份键管「这台环境是什么」(同落点经不同跳板路径=同一环境)。
- **一份操作,三种宿主**:CLI、MCP、SDK 调用的是同一组中层操作。`createMiddle()` 在进程内建一个实例,`connectRemoteMiddle(client)` 经本机 Daemon 使用,两者接口相同、方法签名一致。`filaxis-mcp` 缺省经 Daemon 执行,没有在跑就自动启动,所以两个 MCP 客户端之间、CLI 与 MCP 之间共享同一份层、连接、转发与观察窗;客户端与 Daemon 线协议版本不一致时直接拒绝执行(升级后先 `filaxis daemon stop` 再启动)。SDK 示例里的内核级 API(`RuntimeStack`、`editFile` 等)仍然可用。

## 核心不变量(执行语义的宪法)

Expand Down
53 changes: 53 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

63 changes: 52 additions & 11 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,45 @@

[简体中文](https://github.com/corolin/filaxis/blob/main/README.md) · English

**A headless multi-screen ops workbench for AI agents.**\
**Connect · Execute · Observe · Reattach**

Filaxis is a TypeScript runtime for remote execution by AI agents and automation. It supports local execution, multi-hop SSH, persistent sessions, and streaming observation on Windows and Linux. The CLI (`filaxis`), SDK (`RuntimeStack` and `createAgentToolkit`), and MCP server (`filaxis-mcp`) share the same execution semantics. CI runs the full Bun suite and loopback SSH integration tests on Ubuntu. The Node LTS job checks types and runtime boundaries and runs the compiled CLI.
Filaxis is a zero-dependency TypeScript runtime for remote execution by AI agents and automation (by Syrkos). It runs on Bun and Node LTS across Windows and Linux. Its **CLI (`filaxis`), MCP server (`filaxis-mcp`), and SDK (`createMiddle`, `RuntimeStack`, `createAgentToolkit`)** share the same middle-layer operations. MCP uses the local Daemon by default, the CLI can reuse a running Daemon, and SDK callers can join the shared workspace with `connectRemoteMiddle`.

## Why give AI agents their own "screens"?

> Human ops engineers work with multiple terminal windows, multiple monitors, and a persistent workspace.
>
> Why does an ordinary AI agent have to re-describe how to reach a target (`ssh -> ssh -> docker exec ...`) on every single command?
>
> **Why not give the agent a set of switchable "screens"?**

Filaxis is not trying to reinvent SSH. Instead, it turns the multi-window terminal workbench that human engineers take for granted into addressable, persistent, on-demand execution contexts for AI agents (where a "screen" is not a physical monitor, but a live runtime context the agent can switch into and inspect at will):

- **Human ops engineer**: Engineer + monitors + N persistent SSH windows — named tabs, `Alt + Tab` to switch context, and `tail -f` running on a side screen to glance at when needed.
- **Ordinary AI agent**: Stateless `ssh -> ssh -> ...` from scratch on every tool call, nested shell-quoting traps across hops, and `tail -f` commands that either hang the tool call or flood the context window.
- **Filaxis**: Named layers (virtual terminal tabs), rolling stream windows (virtual side screens), and a local Daemon (persistent workbench) — connect once, then switch layers and peek at streams across turns and clients.

| Human Ops Workbench | Filaxis (MCP / CLI / SDK) |
|---|---|
| Open an SSH client (single host, `-J` jump, or batch) | `connect_layer` / `filaxis layer save` / `stack.addLayer` |
| Enter a container or inner host from a server | `connect_layer(enter_cmd)` / `--enter` / `stack.layerInto` |
| Name a terminal tab | Named Layer |
| See which terminal windows are open | `manage_layers(list)` / `filaxis layer list` |
| `Alt + Tab` between windows | Target by `layer` or switch default via `manage_layers(activate)` |
| Keep the workbench open between commands | **Local Daemon** (persists layers, connections, forwards, and stream windows across CLI & MCP clients) |
| Leave `tail -f` running on a side monitor | **Observation Window** (`observe_stream` / `filaxis stream open`) |
| Scroll back through recent terminal output | **Local rolling buffer + cursor-based `peek`** (consult existing log files for full history) |
| Watch and act across many terminals in parallel | Concurrent stream windows + `run_batch` / `filaxis batch` (with `"web-*"` wildcard fan-out) |
| Open a local tunnel into an inner environment | Dynamic port forwarding (`manage_layers(forward_add)` / `filaxis forward add`) |
| Close a window when finished | `manage_layers(remove)` / `close_stream` |

This design directly resolves two fundamental tensions in agentic operations:

1. **Humans don't close their entire terminal workbench and reconnect every window after typing a single command.** The local **Daemon** maintains the workspace lifecycle — starting in `0.3.0`, `filaxis-mcp` connects to (or auto-starts) the local Daemon by default so multiple MCP clients and the CLI share the same live layers, SSH connections, port forwards, and observation windows.
2. **Keeping a screen open doesn't mean staring at it nonstop; keeping an observation window running doesn't mean burning tokens nonstop.** Unlike humans, an agent isn't bound by physical monitor space or visual attention. It can keep dozens of stream windows open simultaneously while output buffers locally, reading incremental frames by cursor only when needed.

## Quick start (SDK)

```ts
import { RuntimeStack } from "@syrkos/filaxis";
Expand All @@ -37,19 +73,22 @@ if (stop.status === "unknown") {
}
```

See [docs/skills/SKILL.en.md](./docs/skills/SKILL.en.md) for complete recipes covering named layers, container entry (`layerInto`), CAS file edits, multi-layer `runBatch`, and `createAgentToolkit`.

## Capabilities

| Capability | What Filaxis provides |
|---|---|
| Runtime layers | Built-in local, SSH, and tmux drivers. Register custom drivers with `registerDriver()` or connect to environments such as Docker, Kubernetes, and Teleport through `launchCmd`. |
| Command execution | The default non-interactive channel keeps stdout and stderr separate and applies the layer's working directory, environment variables, and replayable entry steps. The PTY channel inherits interactive shell state. |
| Long-running sessions | `execSession` returns immediately. Output is recorded in separate `.out` and `.err` files and is available through a recent-output buffer, line watchers, and readiness checks. |
| Streaming observation | A separate SSH channel streams live output. It can share the SSH master connection through ControlMaster where available. |
| Persistent sessions | The tmux backend can reattach across processes by `terminalId` and restore the working directory. |
| File transfer and editing | `putFile` and `getFile` report the verification level, using size and SHA-256 when available. `editFile` uses compare-and-swap (CAS) to check the file version before writing, and reports the lock protection and write mode. |
| Environment discovery | Discover installed tools and GPU capabilities, select suitable layers with `matchLayers({ needs })`, and flag saved results when fingerprints drift. |
| Connection management | Reuse connections by topology fingerprint. Filaxis reconnects with backoff and tracks degraded layers. |
| SSH host verification | Trust on first use by default, with explicit strict mode and a configurable `known_hosts` file. The SDK accepts private-key paths. |
| Runtime layers | Built-in `local`, `ssh`, and `tmux` drivers. Register custom drivers with `registerDriver()` or derive inner layers (Docker, Kubernetes, bastion hops) through entry pipelines (`layerInto` / `--enter`). |
| Shared workspace & middle layer | Three-layer architecture (`interface / middle / core`): CLI, MCP, and SDK (`createMiddle` / `connectRemoteMiddle`) share the same 26 stateful operations, persisting layers, connections, forwards, and stream windows via the local Daemon with wire-protocol version handshakes. |
| Command execution | The default non-interactive channel keeps stdout and stderr separate and replays the layer's working directory, environment variables, and entry pipeline. The PTY channel inherits interactive shell state. |
| Cross-layer batching | `runBatch` / `run_batch` / `filaxis batch` fan out across layer arrays and `*` / `?` wildcards with `after` dependency ordering, `stopOnFail: false` fleet inspections, and CLI batch output files (`--out-dir`). |
| Long-running sessions | `execSession` returns immediately. Output is recorded in separate `.out` and `.err` files with a hot recent-output window, backtrack-aware `ready()` checks (`evictedCount`), and line watchers. Stop reports `exited / stopped / unknown`, and `verifySession` checks session state. |
| Streaming & observation windows | Dedicated SSH channels stream live output (reusing `ControlMaster` where available) into local rolling windows with monotonic frame numbers, non-destructive multi-consumer cursors, and automatic stream reaping on close. |
| Persistent sessions & port forwards | The `tmux` backend reattaches across processes by `terminalId` and restores working directories. Dynamic SSH `-L`, `-R`, and SOCKS forwards work across replayable inner layers. |
| File transfer and editing | `putFile` and `getFile` (plus optional `sftp` fast path) report verification levels using size and SHA-256 across GNU/BSD/BusyBox dialects. `editFile` uses compare-and-swap (CAS) to verify file versions before writing and reports lock protection and write mode. |
| Discovery & connection governance | Probe installed tools and GPU capabilities, select layers via `matchLayers({ needs })`, flag stale fingerprints, reuse connections by topology fingerprint, and reconnect with backoff. |
| SSH host verification | Trust on first use (`tofu`) by default, with explicit `strict` mode and configurable `known_hosts`. Private keys are passed by path only and never exposed in logs or rendered output. |

## Installation and system requirements

Expand All @@ -59,7 +98,7 @@ bun add @syrkos/filaxis
npm install @syrkos/filaxis
```

- The SDK runs on Bun 1.x and Node LTS with zero runtime npm dependencies.
- Runs on Bun 1.x and Node LTS with **zero runtime npm dependencies** (CI runs the full Bun test suite and loopback SSH integration tests on Ubuntu, plus Node LTS typechecking, architecture boundary gates, build, and compiled CLI smoke tests).
- SSH requires `ssh`. OpenSSH 7.3 or later supports the `-J` jump-host option. Persistent terminals require `tmux`, and the optional fast transfer path requires `sftp`.
- `await stack.features()` checks tools where Filaxis runs. If the agent runs in a container, this reports the container's tools. Check target-side capabilities through the target layer.

Expand All @@ -86,6 +125,8 @@ Or launch it directly with `npx` in your MCP client configuration:
}
```

Starting in `0.3.0`, `filaxis-mcp` runs through the local Daemon by default (auto-starting it if none is running), so multiple MCP clients and the CLI share layers, SSH connections, port forwards, and observation windows. Target-binding flags (`--host`, `--enter`, `--docker`, `--layer`) or `--no-daemon` run an isolated in-process server instead. After upgrading Filaxis, stop any older running Daemon first with `filaxis daemon stop` so the protocol handshake does not reject mismatched versions (see [0.3.0 upgrade notes](./docs/skills/SKILL.en.md)).

Exposed MCP tools (12 tools):

- **Execution & batching**: `run_command`, `run_batch`
Expand Down
Loading