@aurigax-ai/wire

中文文档
0.1.15发布于 2026/10/19FSL-1.1-MITTypeScriptES Module构建来源已验证近 30 天下载 3697

A state graph interpreter for long external activities: agents, humans and commands, with a journal and reattach

原始使用文档
文档目录8 节
  1. Install
  2. The command
  3. The Graph Runtime
  4. A graph
  5. Triggers
  6. Connectors
  7. As a library
  8. License

@aurigax-ai/wire

A state graph interpreter for long activities that happen outside the process: coding agents, questions for a human, commands and waits. A graph is a YAML file of nodes, edges and a typed state. Every step is written to a journal, so a run survives a restart: a node that was waiting is picked up again, and a node that was cut off starts again or waits for a human's choice.

It is the engine behind the Graphs feature of Ostia, and it runs on its own as a command or a library. Up to 0.1.1 it was published as @aurigax-ai/graph.

Install

pnpm add @aurigax-ai/wire

Node 22 or later.

The command

wire validate review.yaml
wire explain review.yaml
wire dry-run review.yaml --input task="fix the total" --mock review='{"verdict":"pass"}'
wire run review.yaml --input task="fix the total"
wire show <run> --data .wire/runs

schema prints the graph file's JSON Schema and nodes lists the node kinds the headless host runs. run keeps its runs under .wire/runs in the current folder (--data <dir> to change it), and show reads them with --data. The headless host runs command, router, wait and notify nodes; nodes that need an agent or a human are for a host that has them.

The Graph Runtime

wire runtime is one long-running process per user, shown as wire-runtime, that clients reach over a Unix socket (JSON-RPC 2.0 with Content-Length framing; the methods, rights and errors are in CONTRACT.md). Its data is in $XDG_STATE_HOME/wire (macOS ~/Library/Application Support/wire) and its socket in $XDG_RUNTIME_DIR/wire; one runs per data folder.

wire runtime start            # runs while a client is open, then exits 60 s after the last one leaves
wire runtime start --daemon   # keeps running with no client until it is stopped
wire runtime status           # whether it runs, its pid, version and mode
wire runtime stop             # lets started steps reach their next journal line, then exits
wire runtime tokens revoke <client>

In a folder, wire list shows the graphs the runtime holds for it, wire start <name> starts an enabled graph whose manual trigger says agents: true, wire runs lists the folder's runs and wire show <run> prints one node by node; each starts the runtime when none runs. A folder is the runtime's scope (dir:<real path>), whichever client registered it. The CLI never enables a graph: that right belongs to a host that provisioned its own token and asks its human, and a change to a graph outside ui disables it again.

A host such as Ostia writes its own token file with provisionToken before it starts or connects to the runtime (nothing pairs over the socket, so an agent holding the CLI's token cannot raise its rights) and serves as a worker for the node kinds that need it: agents, approvals, notices, connectors, and commands in the folders it serves. serveKinds from @aurigax-ai/wire answers the runtime's worker.task requests with ordinary node kinds. A step whose kind has no worker connected waits as pending without its timeout running, and starts when a worker registers; a step whose worker goes away is reattached through the next one.

The runtime fires every enabled graph's triggers itself: schedules, files changed in the folder, and the command and agent events its host pushes, once each however many clients are connected.

To keep it running across logins, install one of the documented files after putting your own two paths in it, the Node it runs on (command -v node) and the package's dist/cli/bin.js (node -p "require.resolve('@aurigax-ai/wire/package.json').replace('package.json', 'dist/cli/bin.js')" from where it is installed); a version manager's shim is not enough, since a service has no shell: docs/systemd/wire-runtime.service into ~/.config/systemd/user/ (systemctl --user enable --now wire-runtime), or docs/launchd/com.aurigax.wire-runtime.plist into ~/Library/LaunchAgents/ (launchctl load). Both run wire runtime start --daemon --foreground and restart it when it fails. What the runtime trusts, and what it does not defend against, is in SECURITY.md.

A graph

version: 1
description: Run the tests, and ask before opening the pull request.
on: [{ manual: {} }]
start: test
state:
  exit: { type: integer, default: -1 }
nodes:
  - { id: test, kind: command, timeout: 10m, with: { run: [pnpm, test] }, out: { exit: exit } }
  - { id: ask, kind: approval, with: { question: "Tests passed. Open the pull request?" } }
  - { id: open, kind: command, with: { run: [gh, pr, create, --fill] } }
edges:
  - from: test
    when: [{ if: "state.exit == 0", to: ask }]
    else: end
  - { from: ask, to: open }

Conditions are a small subset of CEL (state.exit == 0, 'bug' in state.labels, run.visits.fix >= 3), parsed and checked against the declared state; they are never evaluated as code. Templates ({{state.task}}) are filled from the state the same way. fixtures/ holds three complete examples.

Triggers

A graph starts from the triggers under on: manual, schedule (every: 15m or a five-field cron, with catchUp to run once for times missed while the host was down), files (globs relative to the workspace folder), command (a command that ended, by exit) and agent (an agent that stopped or is waiting). The engine reads them: TriggerScheduler keeps the schedules on the host's clock, firedBy tells which trigger an event fires and with what payload (trigger.* in the graph), and PathBatch collects file changes made within a second into one event. The host watches the files, commands and agents; concurrency: skip or queue decides what happens when a run is still active. The headless command runs manual only.

Connectors

A connector node calls something outside: use: mcp:<server>/<tool> calls a tool of an MCP server the host has set up, and use: <connector>.<operation> calls a native connector. Its outputs are ok and data (for MCP, text and, when the tool returns it, structured); a failure raises ConnectorFailed. A graph names a connection by name only: the host keeps the connection's fields and secrets and hands them to the connector for one call, so the file never holds a secret.

The one native connector is http. Its connection holds the base URL (with no user name or password in it) and the auth (bearer, header or basic); a node gives method, path, query and a JSON body. The path stays under the base URL: a .. segment, raw or percent-encoded, an encoded slash or a backslash is refused, and so is a redirect to another origin or outside the base path. A response over 1 MiB fails the node and a call stops after 30 s. A field or secret with a control character is refused before anything is sent, and a failure is reported with a fixed message (http: timeout after 30 s, http: connection refused, http: request failed, …), never the network library's own text, so a secret can't reach the run's journal through an error. GET is a read and every other method a write (connectorUses tells a host which, for its approval view). connectorProblems checks a graph against the host's connectors and connections, and connectorCatalog lists them without a URL or secret.

As a library

A host gives the engine its node kinds, a clock and a way to notify; the engine keeps the runs.

import { Engine, FileJournalStore, commandNode, readGraphFile, realClock } from '@aurigax-ai/wire'

const engine = new Engine({
  host: { name: 'my-host', contract: 1, kinds: [commandNode(runner)], triggers: ['manual'],
    clock: realClock, notify: (notice) => console.log(notice.title) },
  store: new FileJournalStore('runs', () => Date.now()),
  changed: () => {},
})

A node kind returns done with its output or waiting with what it waits for; the wait is stored, and resume completes it when the event arrives, also after a restart. @aurigax-ai/wire/testing has a fake clock, fake agent and approval kinds, and contractFailures, the suite a host's kinds must pass.

Runs are kept by a JournalStore, whose every method returns a promise: FileJournalStore (one folder per run, each line written and synced before the run goes on) and MemoryJournalStore (tests). A run's line is in the store before the step it records starts. Another store passes journalStoreFailures from @aurigax-ai/wire/testing when it returns no failures; give it tear and break when the store can lose a line's tail or refuse a write, so those are checked too. engine.start answers once the run is in the store (journal-failed when it cannot be created); engine.recover and engine.summaries return promises too.

License

FSL-1.1-MIT: source available now, MIT two years after each release.

版本与发布记录

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

版本发布日期距今
0.1.15latest2026/10/1919 天前
0.1.142026/10/1622 天前
0.1.132026/10/1622 天前
0.1.112026/10/1622 天前
0.1.102026/10/1622 天前
0.1.92026/10/1622 天前

关于 @aurigax-ai/wire 的常见问题

@aurigax-ai/wire 是什么?

A state graph interpreter for long external activities: agents, humans and commands, with a journal and reattach

如何安装 @aurigax-ai/wire?

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

@aurigax-ai/wire 支持 TypeScript 吗?

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

@aurigax-ai/wire 支持 ESM 还是 CommonJS?

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

@aurigax-ai/wire 需要什么版本的 Node.js?

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

@aurigax-ai/wire 可以商用吗?

@aurigax-ai/wire 使用 FSL-1.1-MIT 许可。声明的许可为 FSL-1.1-MIT,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@aurigax-ai/wire 的下载量有多少?

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

@aurigax-ai/wire 还在维护吗?

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