mio-agent-runtime 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -7
- package/bin/mio.js +2931 -2562
- package/package.json +1 -1
- package/server/llm-client.js +102 -10
- package/server/mio-intelligence-mcp/index.js +3 -0
- package/server/observer-store.js +18 -9
package/README.md
CHANGED
|
@@ -19,6 +19,10 @@ npm install -g mio-agent-runtime
|
|
|
19
19
|
|
|
20
20
|
```text
|
|
21
21
|
mio init Initialize MIO_HOME
|
|
22
|
+
mio config show Show effective settings and where each value comes from
|
|
23
|
+
mio config llm --url U --model M [--key K] Store LLM endpoint/key/model in config.json
|
|
24
|
+
mio config llm --clear Remove the stored LLM config (env vars still apply)
|
|
25
|
+
mio config path Print the config.json path
|
|
22
26
|
mio mcp Start Mio MCP server (stdio)
|
|
23
27
|
mio install <host> Install Mio into a host (codex|opencode|workbuddy|hermes|claude)
|
|
24
28
|
mio status Show runtime and adapter status
|
|
@@ -54,9 +58,12 @@ mio creativity generate Generate hypotheses from 2+ --source "name|content"
|
|
|
54
58
|
mio creativity ferment Review and refine active hypotheses (calls an LLM)
|
|
55
59
|
mio insight status Insight counts: total, reported, unreported, high-value (needs @akemi-mio/insight)
|
|
56
60
|
mio insight list List insights (--unreported, --min-score N, --detector X, --limit N)
|
|
61
|
+
mio insight generate Generate insights from context (--memory "kind|content"/--summary "text"; calls an LLM)
|
|
57
62
|
mio insight mark-reported Mark insights as reported (--ids a,b)
|
|
58
63
|
mio observer <view> Observer research pipeline views (research pipeline, not the observe daemon):
|
|
59
64
|
status|world-model|trends|research|insights|essays|dag (--base-dir DIR)
|
|
65
|
+
mio observer collect Fetch from the configured sources (--sources a,b/--keywords k1,k2/--limit N)
|
|
66
|
+
mio observer ferment Run the fermentation engine (--session morning|afternoon|night)
|
|
60
67
|
mio observer ingest --trace-id T --event-type E Record a trace event (--payload JSON/--outcome)
|
|
61
68
|
mio observer subscribe --event-types a,b Subscribe to events (--yes to apply; previews by default)
|
|
62
69
|
mio observer digest New events since the last digest (advances the cursor)
|
|
@@ -215,7 +222,7 @@ packages/mio-cli
|
|
|
215
222
|
└── package.json
|
|
216
223
|
```
|
|
217
224
|
|
|
218
|
-
`server/memory-store.js` 是记忆查询/记录排序(Latin token + CJK bigram 打分、project/global 作用域分层、复用证据加权)的唯一实现。MCP 服务端(`mio.memory.query` / `mio.memory.record`)与 CLI(`mio recall` / `mio remember`)都经过它,因此各入口的排序结果完全一致。同一个模块还实现了卫生操作——`analyze` / `archive` / `merge` / `migrate`——所以 `mio.memory.analyze` 与 `mio memory analyze` 不可能各自漂移。`server/experience-store.js` 与 `server/policy-store.js` 对 `mio.experience.*` 与 `mio.policy.check` 遵循同样的模式;策略存储复用了记忆存储的分词器,因此策略风险证据与相关记忆排序在构造上就与 `mio.memory.query` 一致。`server/creativity-engine.js` 是 `mio.creativity.*` 背后的共享实现——CLI 的 `mio creativity status`/`list` 与 MCP 工具调用的是同一个 `CreativityEngine`,因此假设计数在入口间不会漂移。`server/agent-store.js` 是 `mio.agent.list` / `register` / `report` 背后的共享实现;CLI 的 `mio agents list`/`report` 与 MCP 工具读取的是同一个存储,因此被观察 agent 的遥测数据在任何地方都相同。`server/llm-client.js` 是 `chatJson` 的唯一实现,MCP 服务端(创意引擎 + insight)与 CLI(`mio creativity generate`/`ferment
|
|
225
|
+
`server/memory-store.js` 是记忆查询/记录排序(Latin token + CJK bigram 打分、project/global 作用域分层、复用证据加权)的唯一实现。MCP 服务端(`mio.memory.query` / `mio.memory.record`)与 CLI(`mio recall` / `mio remember`)都经过它,因此各入口的排序结果完全一致。同一个模块还实现了卫生操作——`analyze` / `archive` / `merge` / `migrate`——所以 `mio.memory.analyze` 与 `mio memory analyze` 不可能各自漂移。`server/experience-store.js` 与 `server/policy-store.js` 对 `mio.experience.*` 与 `mio.policy.check` 遵循同样的模式;策略存储复用了记忆存储的分词器,因此策略风险证据与相关记忆排序在构造上就与 `mio.memory.query` 一致。`server/creativity-engine.js` 是 `mio.creativity.*` 背后的共享实现——CLI 的 `mio creativity status`/`list` 与 MCP 工具调用的是同一个 `CreativityEngine`,因此假设计数在入口间不会漂移。`server/agent-store.js` 是 `mio.agent.list` / `register` / `report` 背后的共享实现;CLI 的 `mio agents list`/`report` 与 MCP 工具读取的是同一个存储,因此被观察 agent 的遥测数据在任何地方都相同。`server/llm-client.js` 是 `chatJson` 的唯一实现,MCP 服务端(创意引擎 + insight)与 CLI(`mio creativity generate`/`ferment`)共用,因此两边调用的是同一个模型与同一份配置(环境变量 > `MIO_HOME/config.json` 的 `llm` 块 > 内置默认,见「LLM 配置」)。`server/query-log.js` 是 `queries.jsonl` 的唯一读写实现——记忆存储在 `queryMemory` 时记录查询,任务存储在 auto-claim 时消费它把 `task_outcome` 归因到先前的查询;两者**不能互相引用**(会成环),所以日志自成一模块、由调用方把同一个实例交给两个 store。`server/digest.js` 把 traces/memory/reuse 聚合成可执行报告(同样以 `mio.digest.generate` 暴露),`server/retention.js` 驱动 `mio prune`(按年龄/过期裁剪并备份;没有显式的 `--memory --yes` 绝不触碰 `memory.jsonl`)。
|
|
219
226
|
|
|
220
227
|
## 记忆卫生
|
|
221
228
|
|
|
@@ -386,7 +393,33 @@ mio creativity ferment --limit 3
|
|
|
386
393
|
|
|
387
394
|
#### LLM 配置
|
|
388
395
|
|
|
389
|
-
|
|
396
|
+
只有 4 条命令会调用大模型:`mio creativity generate` / `ferment`、
|
|
397
|
+
`mio insight generate`、`mio observer ferment`。它们共用
|
|
398
|
+
`server/llm-client.js` 这一份实现,配置也共用同一套解析顺序:
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
环境变量 > MIO_HOME/config.json 的 llm 块 > 内置默认值
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**写入配置文件**(换机器/换终端不必重设):
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
mio config llm --url http://localhost:11434/v1/chat/completions \
|
|
408
|
+
--model qwen2.5:14b
|
|
409
|
+
# 需要鉴权时再加 --key <token>;清空用 --clear
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**查看当前生效值及其来源**:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
mio config show
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
`show` 会逐字段标注该值来自环境变量、`config.json` 还是内置默认,
|
|
419
|
+
并在环境变量遮挡了文件配置时明确警告——只报值不报来源,正是
|
|
420
|
+
「改了 `config.json` 却毫无变化」的常见成因。
|
|
421
|
+
|
|
422
|
+
**也可以用环境变量**(优先级更高,便于单次覆盖):
|
|
390
423
|
|
|
391
424
|
| 变量 | 说明 |
|
|
392
425
|
|---|---|
|
|
@@ -394,14 +427,12 @@ mio creativity ferment --limit 3
|
|
|
394
427
|
| `LLM_KEY` | Bearer token;留空表示无需鉴权(本地 Ollama 常见) |
|
|
395
428
|
| `LLM_CHAT_MODEL` | 模型 id,回退到 `LLM_MODEL` |
|
|
396
429
|
|
|
397
|
-
本机跑 Ollama 时可以这样指过去:
|
|
398
|
-
|
|
399
430
|
```bash
|
|
400
431
|
LLM_API_URL=http://localhost:11434/v1/chat/completions mio creativity ferment
|
|
401
432
|
```
|
|
402
433
|
|
|
403
|
-
|
|
404
|
-
|
|
434
|
+
未配置任何 LLM 时,命令会**先提示**它将要调用默认端点,再继续——
|
|
435
|
+
不会静默地把请求发到你没配的地方。
|
|
405
436
|
|
|
406
437
|
## 洞察自省与观察管线
|
|
407
438
|
|
|
@@ -412,6 +443,7 @@ LLM_API_URL=http://localhost:11434/v1/chat/completions mio creativity ferment
|
|
|
412
443
|
mio insight status
|
|
413
444
|
mio insight list --unreported --min-score 0.7
|
|
414
445
|
mio insight mark-reported --ids ins_1,ins_2
|
|
446
|
+
mio insight generate --memory "decision|把记忆解析抽到共享 store" --summary "刚发了 0.7.0"
|
|
415
447
|
|
|
416
448
|
# 观察研究管线(纯文件读取,不依赖可选包)
|
|
417
449
|
mio observer status
|
|
@@ -427,7 +459,16 @@ mio observer trends --base-dir /path/to/.local/observer
|
|
|
427
459
|
说明:
|
|
428
460
|
|
|
429
461
|
- **两者都委托给与 MCP 服务端完全相同的共享实现** —— `server/insight-store.js` 与 `server/observer-store.js`。这是 `memory-store.js` / `experience-store.js` / `policy-store.js` / `creativity-engine.js` / `agent-store.js` 一路沿用的同一个模式:一份实现、两个入口,因此不可能各自漂移。
|
|
430
|
-
-
|
|
462
|
+
- **只有 `insight generate` 仍是 MCP 专有**(`mio.insight.generate`):它要调 LLM,CLI 把它当作未知子命令拒绝。`observer collect` / `observer ferment` 此前也被一起挡在 CLI 之外,理由是「它们属于 daemon」——这个理由不成立:`observe/observer.js` 那条 daemon 只 tail WorkBuddy 的 transcript,从不调用这两者。现在它们有了终端入口,默认走全部已配置源:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
mio observer collect # 全部已配置源
|
|
466
|
+
mio observer collect --sources rss,github --limit 20 # 指定源
|
|
467
|
+
mio observer collect --sources rss --keywords mcp,cli # 关键词 OR 过滤
|
|
468
|
+
mio observer ferment --session morning # morning|afternoon|night
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
两者都依赖可选包 `@akemi-mio/observer`(未安装时提示 `not installed`,不是空结果)。`collect` 会**联网**抓取,`ferment` 需要 LLM;它们**不做预览**,因为预览意味着把数据抓两遍。单个源失败不会中断整次运行——该源会以 `errors: ...` 出现在输出里,其余源照常统计。
|
|
431
472
|
- **`mio observer ingest` 记录任意 trace 事件**(`tool_call` / `error` / `retry` / `task_outcome`):
|
|
432
473
|
|
|
433
474
|
```bash
|