{"_id":"@antlegion/bus","_rev":"5-27b00740be51510683ccb2776d7544ce","name":"@antlegion/bus","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@antlegion/bus","version":"0.1.0","keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","mcp"],"author":{"name":"Carter.Yang"},"license":"MIT","_id":"@antlegion/bus@0.1.0","maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"homepage":"https://github.com/YangKGcsdms/antlegion-platform#readme","bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"bin":{"bus":"dist/index.js","alctl":"dist/bin.js","antlegion":"dist/index.js","antlegion-mcp":"dist/mcp.js"},"dist":{"shasum":"f76ce05bbc49f450b7818de8b542fa10b30315bb","tarball":"https://registry.npmjs.org/@antlegion/bus/-/bus-0.1.0.tgz","fileCount":60,"integrity":"sha512-9hX5iZia+woCNWwc8Ni/b7LzM75o8fpkKnZVYuhjvLdz50RVQD+pMDDOK+/OwKuHV+YHiyDBqHonWFadcviIdA==","signatures":[{"sig":"MEYCIQCI+/3wls/vuf2Yc1IzJf42UBaWCdMZATwyfj/Dw3rGEwIhAKsucEHPIpNvwPDFbALYhCJza/UNNObPJzre5gV8AI68","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":143839},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./bus":"./dist/bus.js","./fold":"./dist/fold.js","./types":"./dist/types.js","./client":"./dist/client.js","./server":"./dist/server.js","./package.json":"./package.json"},"gitHead":"cc4a71cdde749ba86da626ff8782603bf0b6cdba","scripts":{"dev":"tsx src/index.ts","mcp":"node dist/mcp.js","test":"vitest run","bench":"tsx src/bench.ts","build":"tsc","start":"node dist/index.js","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"yang9295","email":"929588562@qq.com"},"repository":{"url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","type":"git","directory":"antlegion-bus"},"_npmVersion":"10.9.4","description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK, alctl CLI, and MCP adapter included.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"hono":"^4.7.0","@hono/node-server":"^1.14.0","@modelcontextprotocol/sdk":"^1.29.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^3.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bus_0.1.0_1786504762990_0.2321411903537256","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@antlegion/bus","version":"0.3.0","keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","mcp"],"author":{"name":"Carter.Yang"},"license":"MIT","_id":"@antlegion/bus@0.3.0","maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"homepage":"https://github.com/YangKGcsdms/antlegion-platform#readme","bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"bin":{"bus":"dist/index.js","alctl":"dist/bin.js","antlegion":"dist/index.js","antlegion-mcp":"dist/mcp.js"},"dist":{"shasum":"6707af0728f9844dd225a5c581729290d828f440","tarball":"https://registry.npmjs.org/@antlegion/bus/-/bus-0.3.0.tgz","fileCount":70,"integrity":"sha512-O+p5Dt8xAC70esAKGbLRMT0dHtFjHJGpkIwI8yJemt7ePfEJuy8mjPEIkoqSTh13xmc3f3NIsrmp7milzA7axg==","signatures":[{"sig":"MEUCIEbGIbun3BtIPufppK4JPjBLXQ2Z6TGC6jLwKQLr730bAiEA6BnE93v9zlzkuwcQrx4vBt++QNce/5j3COjbiDHoYVQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":243721},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./bus":"./dist/bus.js","./fold":"./dist/fold.js","./types":"./dist/types.js","./client":"./dist/client.js","./server":"./dist/server.js","./package.json":"./package.json"},"gitHead":"476f6b7dc24d010ff374f4c17def11fa7c984e52","scripts":{"dev":"tsx src/index.ts","mcp":"node dist/mcp.js","test":"vitest run","bench":"tsx src/bench.ts","build":"tsc","start":"node dist/index.js","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"yang9295","email":"929588562@qq.com"},"repository":{"url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","type":"git","directory":"antlegion-bus"},"_npmVersion":"10.9.4","description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK, alctl CLI, and MCP adapter included.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"hono":"^4.7.0","@hono/node-server":"^1.14.0","@modelcontextprotocol/sdk":"^1.29.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^3.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bus_0.3.0_1786520895825_0.43896442815919823","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@antlegion/bus","version":"0.4.0","keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","cli"],"author":{"name":"Carter.Yang"},"license":"MIT","_id":"@antlegion/bus@0.4.0","maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"homepage":"https://antlegion.dev","bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"bin":{"bus":"dist/index.js","alctl":"dist/bin.js","antlegion":"dist/index.js"},"dist":{"shasum":"ab8360d9284600de72ce595d3a79ebdd165eb3f6","tarball":"https://registry.npmjs.org/@antlegion/bus/-/bus-0.4.0.tgz","fileCount":71,"integrity":"sha512-CJWAB7jlj68kaTGHWoTKeWnpPaa9yp5rseFr+c2Zf1h9O2m06R+Xr2bwlCDL1zLTwAF4B2ZXV5xD1Psx3FDsOg==","signatures":[{"sig":"MEQCICUfBf01or5fL6ubPUGI73vcsN0aMvMhFuh6MalCjDegAiB9huItPh0/854SSFGqM+0rz/uDVLAOq+gsn3FQIO1t1g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":332983},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./bus":"./dist/bus.js","./fold":"./dist/fold.js","./types":"./dist/types.js","./client":"./dist/client.js","./server":"./dist/server.js","./package.json":"./package.json"},"gitHead":"a0447586ad96f17d0488798172b8200ed767fda9","scripts":{"dev":"tsx src/index.ts","test":"vitest run","bench":"tsx src/bench.ts","build":"tsc","start":"node dist/index.js","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"yang9295","email":"929588562@qq.com"},"repository":{"url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","type":"git","directory":"antlegion-bus"},"_npmVersion":"10.9.4","description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK + alctl CLI (the sanctioned agent interface) included.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"hono":"^4.7.0","@hono/node-server":"^1.14.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^3.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bus_0.4.0_1786585965871_0.6900256651760248","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@antlegion/bus","version":"0.4.1","keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","cli"],"author":{"name":"Carter.Yang"},"license":"MIT","_id":"@antlegion/bus@0.4.1","maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"homepage":"https://antlegion.dev","bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"bin":{"bus":"dist/index.js","alctl":"dist/bin.js","antlegion":"dist/index.js"},"dist":{"shasum":"ad14944018f2a7c044ad861d87ed7851de2262ff","tarball":"https://registry.npmjs.org/@antlegion/bus/-/bus-0.4.1.tgz","fileCount":75,"integrity":"sha512-Pyco1nmoybgNhUVzADEZDFwu1s27aV49T9pypE5rf6xl296yh7uSCH6uB1tNYDkcohnE5H6pSdn0bU9kh258Hw==","signatures":[{"sig":"MEYCIQClEpjisoZuCi2c8ClmUXlp4Ic4us0T80vWjALB+W90BQIhAJrRoQ/xA6QMtKK3LRtAWhESZJcmxL7BaK5WcAC3Qc4I","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":344254},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./bus":"./dist/bus.js","./fold":"./dist/fold.js","./types":"./dist/types.js","./client":"./dist/client.js","./server":"./dist/server.js","./package.json":"./package.json"},"gitHead":"04ac43f0664caa32edf525678cba6e4f4e1c6314","scripts":{"dev":"tsx src/index.ts","test":"vitest run","bench":"tsx src/bench.ts","build":"tsc","start":"node dist/index.js","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"yang9295","email":"929588562@qq.com"},"repository":{"url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","type":"git","directory":"antlegion-bus"},"_npmVersion":"10.9.4","description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK + alctl CLI (the sanctioned agent interface) included.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"hono":"^4.7.0","@hono/node-server":"^1.14.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^3.1.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bus_0.4.1_1786591215485_0.2208741601013653","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@antlegion/bus","version":"0.5.0","description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK + alctl CLI (the sanctioned agent interface) included.","type":"module","main":"dist/index.js","exports":{".":"./dist/index.js","./client":"./dist/client.js","./bus":"./dist/bus.js","./fold":"./dist/fold.js","./server":"./dist/server.js","./types":"./dist/types.js","./package.json":"./package.json"},"bin":{"bus":"dist/index.js","antlegion":"dist/index.js","alctl":"dist/bin.js"},"scripts":{"build":"tsc","start":"node dist/index.js","dev":"tsx src/index.ts","bench":"tsx src/bench.ts","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","cli"],"repository":{"type":"git","url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","directory":"antlegion-bus"},"homepage":"https://antlegion.dev","bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"engines":{"node":">=20"},"publishConfig":{"access":"public"},"author":{"name":"Carter.Yang"},"license":"MIT","dependencies":{"@hono/node-server":"^1.14.0","hono":"^4.7.0"},"devDependencies":{"@types/node":"^22.0.0","tsx":"^4.19.0","typescript":"^5.7.0","vitest":"^3.1.0"},"_id":"@antlegion/bus@0.5.0","gitHead":"a20670eb7345b4f17a71a5754bc1db99b611871d","types":"./dist/index.d.ts","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-oY2WoDuQo4piLKrPM/mYNPEz4+0MBQfZa0TchdJBAxtA1owdc5bKtIcRvU/QDqoVhD492ejEX0cK/uoH3B/z5Q==","shasum":"fb8b6e8350ba6787293954b6dae34e9b19036f2c","tarball":"https://registry.npmjs.org/@antlegion/bus/-/bus-0.5.0.tgz","fileCount":75,"unpackedSize":367633,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDMUASu8ZF9PpDH8rV+0W1WIzjy1sm6Ugo06KWnFmOwKwIgUSlKszfeTyxeJhApIHJb8MLACpl7xSIT80IlrMKdwdM="}]},"_npmUser":{"name":"yang9295","email":"929588562@qq.com"},"directories":{},"maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bus_0.5.0_1787555892804_0.6878777947024686"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T03:19:22.761Z","modified":"2026-08-24T07:18:13.449Z","0.1.0":"2026-08-12T03:19:23.131Z","0.3.0":"2026-08-12T07:48:15.993Z","0.4.0":"2026-08-13T01:52:46.079Z","0.4.1":"2026-08-13T03:20:15.646Z","0.5.0":"2026-08-24T07:18:12.939Z"},"bugs":{"url":"https://github.com/YangKGcsdms/antlegion-platform/issues"},"author":{"name":"Carter.Yang"},"license":"MIT","homepage":"https://antlegion.dev","keywords":["agents","multi-agent","ai-agents","coordination","fact-bus","blackboard","stigmergy","tuple-space","append-only","event-log","content-addressed","cli"],"repository":{"type":"git","url":"git+https://github.com/YangKGcsdms/antlegion-platform.git","directory":"antlegion-bus"},"description":"Append-only fact bus for autonomous agents — facts, not commands. Stateless trusted core, single total order, coordination as reader-side folds; SDK + alctl CLI (the sanctioned agent interface) included.","maintainers":[{"name":"yang9295","email":"929588562@qq.com"}],"readme":"<div align=\"center\">\n\n[English](README.md) · 🌐 **简体中文**\n\n</div>\n\n# @antlegion/bus\n\n自治智能体的只追加**事实总线**——*事实，而非命令*。\nAgent 发布、读取、认领、解决不可变的内容寻址事实，从不互相寻址。\n协调（恰好一次的认领、信任、取代、因果）从单一全序中涌现，\n以纯**读者折叠**在客户端计算——总线本身保持无状态。\n\n本包是完整实现：可信内核（HTTP 服务器）、折叠 SDK、`alctl` CLI。\n\n## 快速上手\n\n**1. 起一条总线**（五秒钟，零配置）：\n\n```bash\nnpx @antlegion/bus        # → http://localhost:28090\n```\n\n**2. 把你的 agent 指向总线**（Claude Code、Cursor、Codex CLI……）。agent 通过\n`alctl` CLI 驱动总线——每个动词对应一次折叠调用：\n\n```bash\nexport ANTLEGION_BUS_URL=http://localhost:28090    # 另加 ANTLEGION_AUTHOR=my-agent\nnpx -p @antlegion/bus alctl read --type 'task.*'   # 再 claim / resolve\n```\n\n两个驱动 `alctl` 的 agent 仅通过事实流即可协作：一个发布 `task.todo` 事实，\n另一个认领并解决——恰好一次，没有编排器。完整 agent 指南见\n[`../docs/AGENT-CLI.md`](../docs/AGENT-CLI.zh-CN.md)。\n\n**3. 用 `alctl` 从终端操作**：\n\n```bash\nnpx -p @antlegion/bus alctl publish task.todo '{\"title\":\"hello\"}'\nnpx -p @antlegion/bus alctl tail --follow\nnpx -p @antlegion/bus alctl info\n```\n\n**4. 真正跑起来**——守护进程或 Docker：\n\n```bash\nantlegion start && antlegion status    # redis-server 式（pidfile+日志随数据目录）\n# 或：\ndocker run -d -p 28090:28090 -v antlegion-data:/data ghcr.io/yangkgcsdms/antlegion\n```\n\n**5. 盯着它跑**——总线自带两个只读页面：`/dashboard`（演示看板）和 **`/console`**（运维控制台：带过滤的事实流 `tail -f` + INFO 健康视图）。\n\n```bash\n# 启动时会打印：\n# dashboard → http://127.0.0.1:28090/dashboard · console → http://127.0.0.1:28090/console\n```\n\n## 从源码运行\n\n```bash\nnpm install\nnpm run dev          # tsx src/index.ts → http://localhost:28090 (fsync=everysec)\nnpm run build && npm run start\n```\n\n```bash\ncurl http://localhost:28090/health\n# {\"status\":\"ok\",\"protocol\":\"2.0\",\"head_seq\":0}\n\ncurl http://localhost:28090/info | jq\n# head_seq, facts, log_bytes, fsync, dedup_hits, sig_failures, max_depth, uptime_seconds\n\ncurl \"http://localhost:28090/facts?since=0\" | jq\n\nnode dist/bin.js info          # alctl CLI（需先 build）\nnpm run bench                  # 吞吐 benchmark（进程内约 16 万 append/s）\n```\n\n## 环境变量\n\n| 变量 | 默认值 | 用途 |\n|---|---|---|\n| `PORT` | `28090` | HTTP 监听端口 |\n| `HOST` | `127.0.0.1` | 监听地址。总线信任它的调用方（与 Redis 同款安全模型）——只有在信任边界内（如 docker 网络）才设 `0.0.0.0` |\n| `ANTLEGION_DATA_DIR` | `.data-v2` | 只追加日志目录（内含 `facts-v2.jsonl`） |\n| `ANTLEGION_FSYNC` | `everysec` | `always` · `everysec` · `no`——对应 Redis `appendfsync` |\n| `ANTLEGION_BUS_SECRET` | 每次启动随机生成 | HMAC 签名密钥；**设为稳定值**以便重启后签名仍可验证 |\n| `ANTLEGION_MAX_DEPTH` | `64` | 因果链深度上限（§5 安全规则） |\n\n客户端（`alctl` CLI、SDK）：\n\n| 变量 | 默认值 | 用途 |\n|---|---|---|\n| `ANTLEGION_BUS_URL` | `http://localhost:28090` | CLI / SDK 连接的总线地址 |\n| `ANTLEGION_AUTHOR` | `<系统用户名>@<主机名>` | CLI 身份；`--author <名字>` 可按命令覆盖 |\n\n`alctl` 在 stdout 输出机器可读的 JSON（如 `{\"id\":…,\"seq\":…,\"deduped\":…}`、\n`{\"won\":…,\"winner\":…}`、`{\"state\":…,\"owner\":…}`），人类可读的错误走 stderr 并以\n非零码退出——包括当你不是认领胜者时的 `resolve`。`tail` 打印一次当前流即退出；\n`tail --follow` 持续轮询实时输出。子路径导入（`antlegion-bus/client`、\n`antlegion-bus/bus`、`antlegion-bus/fold` 等）已在 `package.json` 的 `exports` 中映射。\n\n## 测试\n\n```bash\nnpm test           # vitest run（147）\nnpm run test:watch # vitest watch\n```\n\n## 一致性向量\n\n```bash\nnpx tsx conformance/generate.ts  # 重新生成 vectors.json——仅在有意的协议变更时执行\npython3 conformance/verify.py    # 独立 Python 重新实现；0 失败 = 跨语言证明\n```\n\n## 技术栈\n\nNode.js ≥ 18、TypeScript 5.x、Hono、`@hono/node-server`、Vitest。\n\n## 许可证\n\nMIT。\n","readmeFilename":"README.zh-CN.md"}