im-hub-pro 0.2.29 → 0.2.33
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/CHANGELOG.md +415 -0
- package/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist/cli.js +67 -93
- package/dist/cli.js.map +1 -1
- package/dist/core/approval-bus.d.ts +27 -7
- package/dist/core/approval-bus.d.ts.map +1 -1
- package/dist/core/approval-bus.js +65 -34
- package/dist/core/approval-bus.js.map +1 -1
- package/dist/core/approval-bus.synthetic.test.js +16 -15
- package/dist/core/approval-bus.synthetic.test.js.map +1 -1
- package/dist/core/approval-bus.test.js +39 -35
- package/dist/core/approval-bus.test.js.map +1 -1
- package/dist/core/approval-router.d.ts +7 -1
- package/dist/core/approval-router.d.ts.map +1 -1
- package/dist/core/approval-router.js +24 -27
- package/dist/core/approval-router.js.map +1 -1
- package/dist/core/approval-router.test.js +18 -13
- package/dist/core/approval-router.test.js.map +1 -1
- package/dist/core/commands/agent.d.ts.map +1 -1
- package/dist/core/commands/agent.js +21 -2
- package/dist/core/commands/agent.js.map +1 -1
- package/dist/core/commands/approval.d.ts.map +1 -1
- package/dist/core/commands/approval.js +5 -4
- package/dist/core/commands/approval.js.map +1 -1
- package/dist/core/commands/approval.test.js +9 -6
- package/dist/core/commands/approval.test.js.map +1 -1
- package/dist/core/config-schema.d.ts +2 -0
- package/dist/core/config-schema.d.ts.map +1 -1
- package/dist/core/config-schema.js +15 -3
- package/dist/core/config-schema.js.map +1 -1
- package/dist/core/onboarding.d.ts.map +1 -1
- package/dist/core/onboarding.js +4 -3
- package/dist/core/onboarding.js.map +1 -1
- package/dist/core/router.d.ts +16 -2
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/router.js +56 -15
- package/dist/core/router.js.map +1 -1
- package/dist/core/schedule.d.ts.map +1 -1
- package/dist/core/schedule.js +4 -1
- package/dist/core/schedule.js.map +1 -1
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +245 -212
- package/dist/core/session.js.map +1 -1
- package/dist/plugins/agents/acp/discovery.d.ts.map +1 -1
- package/dist/plugins/agents/acp/discovery.js +2 -0
- package/dist/plugins/agents/acp/discovery.js.map +1 -1
- package/dist/plugins/agents/claude-code/mcp-approval-server.test.js +6 -5
- package/dist/plugins/agents/claude-code/mcp-approval-server.test.js.map +1 -1
- package/dist/plugins/agents/opencode/http-adapter.test.js +6 -4
- package/dist/plugins/agents/opencode/http-adapter.test.js.map +1 -1
- package/dist/plugins/messengers/discord/discord-adapter.test.js +3 -3
- package/dist/plugins/messengers/discord/discord-adapter.test.js.map +1 -1
- package/dist/plugins/messengers/telegram/media-download.d.ts +8 -0
- package/dist/plugins/messengers/telegram/media-download.d.ts.map +1 -1
- package/dist/plugins/messengers/telegram/media-download.js +7 -3
- package/dist/plugins/messengers/telegram/media-download.js.map +1 -1
- package/dist/plugins/messengers/telegram/media-download.test.js +6 -1
- package/dist/plugins/messengers/telegram/media-download.test.js.map +1 -1
- package/dist/web/public/_app.js +5 -5
- package/dist/web/public/index.html +1 -2
- package/dist/web/public/login.html +98 -0
- package/dist/web/public/settings.html +17 -16
- package/dist/web/public/tasks.html +25 -19
- package/dist/web/server.d.ts +1 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +271 -127
- package/dist/web/server.js.map +1 -1
- package/package.json +7 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.2.33] - 2026-05-09
|
|
6
|
+
|
|
7
|
+
### Fixed — audit-fixes-7950 follow-up
|
|
8
|
+
|
|
9
|
+
稳定 0.2.32(v0.2.32 的 10 项审计修复在合入时引入 37 个失败测试 + 一处运行时回归,0.2.33 把这些都修掉,建议直接从 0.2.31 升到 0.2.33)。
|
|
10
|
+
|
|
11
|
+
- **审批总线 composite key 测试同步**:P0 #4 把 `ApprovalBus` 的内部 keying 从裸 threadId 改成 `platform:channelId:threadId`,但单元测试仍然按裸 `'thread-A'` 调 `hasPendingFor` / `resolvePending`,导致 `bun test` 红 37 项。所有相关测试(approval-bus、synthetic、router、approval 命令、mcp-approval、opencode-http、discord)改用 `threadKey()` 显式构造 composite,注释中误导性的 "backward compat" 承诺一并删除。
|
|
12
|
+
- **Claude session 标记顺序回归**:P1 #5 把 `markClaudeSessionPrimed` 从 `routeMessage` 之前挪到了之后;如果 claude 已写出 jsonl 但 run 中途出错,下一轮就会用 `--session-id` 而不是 `--resume`,触发 "session already exists"。0.2.33 把 markPrimed 移回 `onAgentResolved` 内部、紧跟 `setClaudeSessionId`,恢复"先 mark 再调 adapter"的语义。
|
|
13
|
+
- **Cookie 加固**:`web.public_bind_warning` 改在 server 启动时打一次(之前每次登录都打);`Set-Cookie` 在 public bind 或 `X-Forwarded-Proto: https` 时自动附加 `Secure`,纯 localhost dev 不加。
|
|
14
|
+
- **静态页测试改写**:原 `/tasks` 用例还在断言 `IMHUB_TOKEN` 注入到 HTML,改成走真实流程:未登录 302 到 `/login`,POST `/api/auth/login` 拿 cookie 后 200,断言 HTML 中不再含 token。
|
|
15
|
+
- **死代码清理**:`editCardOnThreadResolution` 的 thread-scan fallback 在 composite key 下永远 miss,删掉;签名从 `(threadId, info, decision, by)` 缩为 `(info, decision, by)`。
|
|
16
|
+
- **小项**:`web/server.ts` 删未使用的 `lstat` import;`settings.html` toast 调用末尾被误删的 `;` 补回。
|
|
17
|
+
- **测试 flake 修复**:`test/integration/acp-server.test.ts` 在全套并发下被 `intent.test.ts` 注册的空-yield 子代理污染(router intent fallback 到 opencode → 返回 '')。ACP 测试在 `beforeAll` 重新注册 4 个 profile 名同名 stub 让其也产出内容。
|
|
18
|
+
|
|
19
|
+
### Result
|
|
20
|
+
|
|
21
|
+
- `bun test`:895 / 895 pass(之前 857 / 37)
|
|
22
|
+
- `tsc --noEmit` / `biome` 干净
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [0.2.31] - 2026-05-08
|
|
27
|
+
|
|
28
|
+
### Release
|
|
29
|
+
|
|
30
|
+
- 重新发布生产硬化修复到 npm,确保生产环境通过 `npm install -g im-hub-pro@0.2.31` 可以拿到 v0.2.30 严格代码审查后的全部修复。
|
|
31
|
+
- 包含子任务会话隔离、WebSocket 入站串行化、session 元数据写锁、安全默认值加固、release/CI 门禁收紧,以及 `im-hub-pro --version` 跟随 `package.json` 的修复。
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [0.2.30] - 2026-05-08
|
|
36
|
+
|
|
37
|
+
### Fixed — strict production code review follow-up
|
|
38
|
+
|
|
39
|
+
- **子任务会话隔离**:active subtask 下的普通消息与 `/test` / `/review` / `/diff` 等 agentCommand 现在都会写入 `${threadId}:sub:${jobId}` 子会话,不再把用户消息、assistant 回复、usage 和 adapter-native session id 混写到父会话。
|
|
40
|
+
- **native Agent session 隔离**:Claude Code / OpenCode / Codex 在子任务内使用子会话自己的 `claudeSessionId` / `opencodeSessionId` / `codexSessionId`;避免主会话与子任务在 CLI 原生会话层串线。
|
|
41
|
+
- **WebSocket 入站串行化**:Web Chat 同一浏览器连接上的多条消息按顺序逐条进入 `routeMessage`,降低快速连发时 Agent 子进程并行、历史乱序和流式回复交错风险。
|
|
42
|
+
- **Session 元数据写锁**:`patchSession`、usage roll-up、Claude/OpenCode/Codex session id setters、subtask counter/update、agent switch/reset 等读改写路径纳入 per-key lock;`nextSubtaskId` 并发调用保持唯一递增。
|
|
43
|
+
- **安全默认值**:
|
|
44
|
+
- Web 控制台默认监听 `127.0.0.1`;需要对外暴露时显式设置 `IMHUB_WEB_BIND=0.0.0.0`,建议放在 HTTPS 反代后。
|
|
45
|
+
- `~/.im-hub/config.json` 写入时强制 `0600`,目录创建使用 `0700`。
|
|
46
|
+
- Telegram 媒体下载的 `curl` 保留 `--location` 但加 `--max-redirs 0`,拒绝跟随重定向到任意主机。
|
|
47
|
+
- **CLI 版本号**:`im-hub-pro --version` 改为读取包内 `package.json`,不再硬编码旧值(之前可能输出 `0.2.18`)。
|
|
48
|
+
|
|
49
|
+
### Build / release
|
|
50
|
+
|
|
51
|
+
- Release workflow 中 `npm test` 失败不再 `continue-on-error`,避免测试红仍发布 npm。
|
|
52
|
+
- CI 增加 `npm run lint`;补齐 `@biomejs/biome` devDependency。
|
|
53
|
+
- `lint` 当前只检查相对 `main` 的变更文件,避免仓库既有 Biome 基线问题一次性阻断所有 PR。
|
|
54
|
+
|
|
55
|
+
### Tests
|
|
56
|
+
|
|
57
|
+
- 新增/补齐回归覆盖:active subtask 默认消息与 agentCommand 路由、并发 `nextSubtaskId`、Telegram curl redirect 参数、`config.json` 权限、WebSocket serial queue。
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## [0.2.26] - 2026-05-08
|
|
62
|
+
|
|
63
|
+
### Changed — Rebrand to `im-hub-pro`
|
|
64
|
+
|
|
65
|
+
- **npm 包名**:`im-hub` → `im-hub-pro`(产品化分支)。
|
|
66
|
+
- **CLI 命令**:`im-hub` → `im-hub-pro`(`bin` 字段同步更新)。
|
|
67
|
+
- **仓库 URL**:`package.json.repository.url` 从原作者 `ceociocto/im-hub` 切到当前仓库 `benking007/imhub`,新增 `homepage` / `bugs` / `publishConfig{access:public,provenance:true}` 字段。
|
|
68
|
+
- **Web 控制台品牌**:`/`、`/tasks`、`/settings` 三个静态页的浏览器标题、欢迎语、左上角 logo、Settings 卡里的 `im-hub config wechat` 提示文案,全部改为 `im-hub-pro`。
|
|
69
|
+
- **README + README.zh-CN**:`What's new` / 安装命令 / Quick Start / CLI 命令表 / Project Structure ASCII 树标签,全部改为新品牌;新增「Migrating from `im-hub`」回退指引。
|
|
70
|
+
- **LICENSE 文件**:补齐 MIT 全文(之前 `package.json` 声明 MIT 但根目录无 LICENSE 文件),版权归属保持 `Jerry`。
|
|
71
|
+
- **`THEME_KEY`**:localStorage 主题 key 从 `im-hub-theme` → `im-hub-pro-theme`(用户在升级后第一次访问会丢失主题偏好;其他 localStorage key `im-hub-lang` / `im-hub-history` 保留以保住语言与对话历史)。
|
|
72
|
+
|
|
73
|
+
### Unchanged — drop-in compat
|
|
74
|
+
|
|
75
|
+
为了让老用户 `npm uninstall -g im-hub && npm install -g im-hub-pro` 后零迁移成本运行:
|
|
76
|
+
- **配置目录**:`~/.im-hub/`、`~/.im-hub-workspaces/<agent>/` 路径不变
|
|
77
|
+
- **环境变量**:60+ 处 `IMHUB_*` 前缀不变
|
|
78
|
+
- **HTTP 头**:`X-IM-Hub-Token` / `x-im-hub-token` 不变
|
|
79
|
+
- **Window 全局**:`window.IMHUB_TOKEN` 不变
|
|
80
|
+
- **ACP 服务名**:`im-hub-gateway` 不变(线上 ACP 客户端通过这个名字 discover)
|
|
81
|
+
- **MCP 测试 fixture**:`mcpServers.imhub` 不变
|
|
82
|
+
- **内部 client ID**:`im-hub:${ts}` 格式不变
|
|
83
|
+
|
|
84
|
+
### Notes
|
|
85
|
+
|
|
86
|
+
- 发布走 npm OIDC trusted publishing(`release.yml` 不需要改),首次发布前需在 npmjs.com 上为 `im-hub-pro` 配置 trusted publisher 指向 `benking007/imhub` 仓库 + `release.yml` workflow。
|
|
87
|
+
- 老 `im-hub@0.2.25` 包在 npmjs.com 上保持不动,可继续安装。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## [0.2.23] - 2026-05-07
|
|
92
|
+
|
|
93
|
+
### Added — Web console PR-D
|
|
94
|
+
- **Agent workspace 文件浏览器**:`/tasks` 新增 **Files** tab,只读浏览 `~/.im-hub-workspaces/<agent>/`(CLAUDE.md / AGENTS.md / 临时笔记等)。左侧目录树 + 右侧文件预览,点目录进入、点文件预览,文件 1 MiB 上限 + 二进制(首 8 KB NUL 探测)走 base64。后端 `GET /api/workspace-files?agent=&path=` 双重防 traversal:agent 必须在 `registry.listAgents()` 白名单,路径必须等于或位于 `defaultAgentCwd(agent)` base 之下,否则 400。
|
|
95
|
+
- **Job 批量操作**:Jobs tab 加多选 checkbox + 全选表头 + 隐藏式批量工具栏(Run selected / Cancel selected);选中态跨刷新保留——按可见行 reconcile,不会被 list mutation 抹掉。后端新 `POST /api/jobs/batch-cancel` / `batch-run` 接受 `{ ids: number[] }`(最多 100),per-id 结果不互相阻断。
|
|
96
|
+
|
|
97
|
+
### Changed
|
|
98
|
+
- **Settings 页布局**:header 用 `justify-content: space-between` + 4 个独立 flex 子项导致语言 `<select>` 被拉伸成满屏宽,标题/链接全部换行。重写为 `.brand`(左侧链接 + 标题)+ `.controls`(右侧 lang/theme,`margin-left: auto`)双分组,控件 `width: auto` + `white-space: nowrap`。容器 max-width 720→880,标题字号字距微调,卡片圆角 8→12 + 浅色态加 1px 阴影,header sticky。
|
|
99
|
+
- **修复主题污染**:toast `.success` / `.error` 和 `.btn-danger:hover` 之前用了硬编码深色背景(`#0a2a0a` / `#2a2a0a` / `#1a0a0a`),浅色主题下渲染成近黑色,已改为主题变量。
|
|
100
|
+
|
|
101
|
+
## [0.2.22] - 2026-05-07
|
|
102
|
+
|
|
103
|
+
### Added — Web console PR-C
|
|
104
|
+
- **SSE 实时事件流**:新建 `src/core/event-bus.ts`——进程内 publish/subscribe,4 类事件(`audit` / `approval` / `job` / `metrics`),200 条 ring buffer。新连接 replay 一次避免空白等待。
|
|
105
|
+
- **`GET /events` 端点**:token 走 `?token=...`(EventSource 不支持自定义 header),25s 心跳防 nginx idle close,listener 错误在 `publish()` 内吞掉避免拖坏起源动作。
|
|
106
|
+
- **Dashboard 实时刷新**:`tasks.html` 用 `EventSource('/events?token=...')`,事件触发 `refreshIfVisible(paneId, loader)` 只刷可见 tab;轮询保留作为 fallback。`approval requested` 事件让 Approvals tab 标签闪一下高亮(动态注入的 CSS keyframe)。
|
|
107
|
+
- **Workspace 完整 CRUD UI**:`settings.html` 新增 Workspaces 卡片,列表 + 新增 / 编辑 / 删除表单(id 锁定防误改、default 行不可删)。后端 `GET /api/workspaces?full=1` / `POST` upsert / `PATCH /:id` / `DELETE /:id`,每次 mutation persist 回 `~/.im-hub/config.json`。
|
|
108
|
+
- `WorkspaceRegistry.remove(id)` 拒绝 `'default'`,`listFull()` 返回完整 `WorkspaceConfig[]`(含 member ids)。
|
|
109
|
+
|
|
110
|
+
## [0.2.21] - 2026-05-07
|
|
111
|
+
|
|
112
|
+
### Added — Web console PR-B
|
|
113
|
+
- **Health tab**:`/tasks` 新增 Agent 健康面板,每个 agent 一行展示熔断器状态(closed / open / half-open)、限流余量、p50/p95/p99 延迟、调用次数 / 成功率 / 累计成本、半开冷却。最近 60 次轮询的 p95 延迟用内联 SVG sparkline 画出。
|
|
114
|
+
- **Approvals tab**:列出所有 pending HITL 审批(reqId / threadId / toolName / 等待时长 / 注册时间),支持网页端直接 Allow / Deny / Allow + Auto。后端新 3 路由:`GET /api/agent-health` / `GET /api/approvals` / `POST /api/approvals/:reqId/resolve`。
|
|
115
|
+
- `approval-bus.PendingApproval` 增 `input`(原始入参)+ `registeredAt`,`listPending()` 返回脱敏快照;register / cancel 时 emit `'approval'` 事件,给 SSE 用。
|
|
116
|
+
|
|
117
|
+
## [0.2.20] - 2026-05-07
|
|
118
|
+
|
|
119
|
+
### Added — Web console PR-A
|
|
120
|
+
- **三态主题**:light / dark / system 三档循环切换,按钮在 head 加载完前同步应用 `:root[data-theme]`,避免主题闪烁。`prefers-color-scheme: dark` 仅在 `data-theme` 缺失(system 模式)时生效。语言 + 主题偏好都落在 localStorage。
|
|
121
|
+
- **错误边界**:新建 `src/web/public/_app.js`——`window.imhub` 命名空间提供 `theme` / `i18n` / `api` / `showError`,自动安装 `window.onerror` + `unhandledrejection` 监听,让脚本错误以浮层形式可见,不再静默死掉。
|
|
122
|
+
- **In-chat 审批卡**:`/` 聊天界面收到工具审批请求时弹出 inline 卡片(Allow / Deny / Allow + Auto),点击通过 WS `approval-action` 走回 `approvalBus.resolvePending()`,跟 Telegram inline-button 同一条路径。
|
|
123
|
+
- `approval-router` 默认 `buttonCallbackPlatforms` 加 `'discord'` / `'web'`;新导出 `bindButtonHandlerForPlatform(platform)` 给延迟注册的 messenger(web 是其中之一)调用,避免 install-before-register 时序问题。
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
- `tasks.html` 第二段 `<script>` 顶层 `const T` 与第一段 IIFE 外的 `const T` 冲突("Identifier 'T' has already been declared")。把首段包进 IIFE 隔离作用域。
|
|
127
|
+
- WS `approval-action` 处理路径增日志(每次点击的 receipt + handler-bound 状态),handler 未绑定 / 处理失败时把"approval handler not bound" / "click failed"以聊天错误提示给用户;客户端用 soft-disable,避免服务端报错时按钮卡死。
|
|
128
|
+
|
|
129
|
+
## [0.2.19] - 2026-05-07
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
- **Codex sandbox-mode plan 支持**:codex 接入 `session.planMode`,默认 sandbox 从 `--full-auto` 改为显式的 `-s workspace-write`,关闭 auto-approval。
|
|
133
|
+
- **Dashboard agent 过滤 + Audit tab**:Jobs / Subtasks / Schedules 三个 tab 加 agent 下拉过滤(之前看得到但分不清归属),新增 Audit tab 把 SQLite 审计日志拉到 UI(之前只有 IM `/audit` 命令)。后端配套 `OwnerOpts.agent?` 字段下沉到 `listJobs` / `listSchedules` / `listAllSubtasks`,新 `GET /api/audit?agent=&days=&user=&intent=`。
|
|
134
|
+
|
|
135
|
+
### Docs
|
|
136
|
+
- README "What's new" + Roadmap 补到 v0.2.18。
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## [0.2.18] - 2026-05-07
|
|
141
|
+
|
|
142
|
+
### Fixed
|
|
143
|
+
- **M9 — IM 重连退避**:`src/utils/backoff.ts` 新增 `Backoff` 助手(指数 + ±jitter,参数自钳位,RNG 可注入做确定性测试)。
|
|
144
|
+
- **Telegram** `runPollingLoop`:两个 fixed `setTimeout(2000)` / `setTimeout(5000)` → `Backoff(2_000, 60_000, 0.5)`;新增 `HEALTHY_RUN_THRESHOLD_MS=30_000`,`bot.start()` 跑健康 ≥ 30s 后再失败会重置 backoff,避免长会话第一次错被推到累计尾端。日志带 `attempt` + `delayMs`。
|
|
145
|
+
- **WeChat ilink** `pollLoop`:inline `1000 * Math.pow(2, n-1)` → `Backoff(2_000, 30_000, 0.5)`;保留首次失败"零等待"(`consecutiveFailures > 1` 才生效);`getUpdates` 成功路径加 `backoff.reset()`。
|
|
146
|
+
|
|
147
|
+
### Notes
|
|
148
|
+
- Feishu (Lark SDK) / Discord (discord.js) 的 WebSocket 重连在 SDK 内部,没有 app 层注入点,本次未改。
|
|
149
|
+
- WeChat `tryRefreshSession` 的两次线性 `attempt*5000` 保留原状(套 Backoff 反而扭曲)。
|
|
150
|
+
|
|
151
|
+
### Tests
|
|
152
|
+
- `test/unit/backoff.test.ts` 新建 10 用例:指数调度 / cap / reset / pinned RNG 下 jitter 边界 / 200 随机样本落 `[exp*0.5, exp*1.5]` / 默认值 / `baseMs=0` 边界 / `capMs<baseMs` 自纠正。
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## [0.2.17] - 2026-05-07
|
|
157
|
+
|
|
158
|
+
收尾 P2 + P3,配 `docs/code-review-2026-05-06-main.md` 的 punch list。
|
|
159
|
+
|
|
160
|
+
### Fixed — P2 web/HTTP hardening
|
|
161
|
+
- **M1** 静态页响应头:`X-Frame-Options: DENY` / `X-Content-Type-Options: nosniff` / `Referrer-Policy: no-referrer` / Content-Type 加 `charset=utf-8` / CSP 锁第三方资源(`script-src` / `style-src` 暂留 `'unsafe-inline'`,nonce 化留 P3)。
|
|
162
|
+
- **M2** Prometheus 标签基数白名单:`KNOWN_INTENTS = {default,explicit,fallback,llm,topic,keyword,sticky}`、`KNOWN_PLATFORMS = {telegram,feishu,wechat,discord,web,acp,acp-server,rest,rest-msg}`,命中外的桶到 `'other'`。
|
|
163
|
+
- **M3** WS 连接上限:默认 100,env `IMHUB_MAX_WS_CLIENTS` 覆盖;超限时 `1013 Try Again Later`。
|
|
164
|
+
- **M4** `/api/health` 改为 token gate 之前公开(k8s liveness 友好)。
|
|
165
|
+
- **M11** ACP 测试入口的 `JSON.parse` 包 `try/catch` + endpoint 类型校验,错误 body 落 400 而非 500。
|
|
166
|
+
|
|
167
|
+
### Fixed — P2 observability
|
|
168
|
+
- **M7** audit 30 天修剪失败暴露 `im_hub_audit_prune_failed_total` counter。
|
|
169
|
+
- **M14** approval-bus 五个生命周期 counter(`pending` / `requests_total` / `resolved_total{result=allow|deny|timeout}`),lazy provider 注入避免循环依赖。
|
|
170
|
+
- **M15** intent-llm cache key:候选列表用 sha256 16-hex,prompt 截断到 256 字符,防 100KB prompt × 多 ACP 候选爆 LRU。
|
|
171
|
+
- **bug-fix**:approval result 三类桶做成互斥(timeout / deny / allow),原本 timeout-deny 双计可能让 Prom counter 倒退。
|
|
172
|
+
|
|
173
|
+
### Fixed — P2 IM 文本边界
|
|
174
|
+
- **M10** `splitMessage` 强制 `maxLength` 切分加 `safeSplitPoint`,避免切到 UTF-16 surrogate pair(emoji 半切渲染成 `□`,或破坏 Telegram HTML 解析)。
|
|
175
|
+
- **M12** Telegram `escapeHtml` 补 `'` / `"` —— approval card 模板里的 `<a href="...">` 属性场景必要。
|
|
176
|
+
- **M13** approval auto-allow 前缀指纹 5 → 10:原来 `git s` 同时匹配 `git status`/`git stash`/`git submodule`,太宽。
|
|
177
|
+
|
|
178
|
+
### Fixed — P3 low-priority (10 L items)
|
|
179
|
+
- **L1** WS chunk 循环检查 `bufferedAmount`(4 MiB highwater,50 ms poll,5 s 预算)。
|
|
180
|
+
- **L2** SIGINT 关停链接通 `helper.close()` / `closeAuditDb` / `closeJobBoardDb` / `closeScheduleDb`,WAL 清洁 checkpoint。
|
|
181
|
+
- **L5** `traceId` 12 hex (~2^48) → 16 hex (~2^64)。
|
|
182
|
+
- **L6** WeChat ilink-client 4 处遗漏的 `fetch` 加 `AbortSignal.timeout()`。
|
|
183
|
+
- **L7** Discord adapter `typingIntervals` 配 `AbortController`,`stop()` 先 abort 再 `clearInterval`,避免与 `client.destroy()` 竞速。
|
|
184
|
+
- **L10** approval-bus buffer 溢出改为写 `{v:1,type:"fatal"}` + `socket.end()`,不再静默 destroy。
|
|
185
|
+
- **L12** `classifyIntent` 失败日志带 `err.message` + stack。
|
|
186
|
+
- **L13** 新增 `im_hub_agent_cleanup_failed_total` counter,`plan.cleanup()` catch 计数。
|
|
187
|
+
- **L14** WeChat ilink `cleanupExpiredContextTokens` 搭 1/min 心跳 tick —— 静默用户不再留 30 min 残余。
|
|
188
|
+
- **L15** onboarding `perAgentCache` 注释对齐实际查询顺序。
|
|
189
|
+
|
|
190
|
+
### Build / infra
|
|
191
|
+
- `dist/cli.js` 编译后 `chmod +x`(534fb55)。
|
|
192
|
+
- `package-lock.json` 94 处 `resolved` URL 由 Tencent 内网镜像改回 `https://registry.npmjs.org/`(content-addressed integrity 一致),CI 解锁。
|
|
193
|
+
- `session.ts atomicWrite` 加 ENOENT defense(`mkdir` + 重试一次);同步修了 `session-subtasks.test.ts` 在 fresh runner 上的 0 vs 2 翻车。
|
|
194
|
+
|
|
195
|
+
### Skipped from CR (理由记 PR body)
|
|
196
|
+
- L3 / L4 / L8 / L9 / L11:false positive 或纯 cosmetic 或过度侵入。
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## [0.2.16] - 2026-05-06
|
|
201
|
+
|
|
202
|
+
P0 + P1 安全收口,配 `docs/code-review-2026-05-06-main.md`。
|
|
203
|
+
|
|
204
|
+
### Fixed — P0 hotfix
|
|
205
|
+
- **H1** Web REST/WS token 比较切到 `crypto.timingSafeEqual`,抽 `src/utils/safe-equal.ts` 与 `acp-server.ts` 共用。
|
|
206
|
+
- **H2** `serveIndexHtml` 用 `JSON.stringify(token)` 注入 `window.IMHUB_TOKEN`,防 token 含 `'` / `</script>` 破坏 JS 字面量。
|
|
207
|
+
- **H3** Schedule `notify_url` SSRF 防护:`validateWebhookUrl` 白名单 `http(s)`、黑名单 RFC1918 / loopback / link-local / CGNAT / IPv6 ULA / fe80::;`IMHUB_ALLOW_PRIVATE_WEBHOOKS=1` 显式 opt-in;fetch 加 10s `AbortSignal` + `redirect: 'manual'` + 64 KiB 响应上限;`createSchedule` 与 `fireSchedule` 双层校验。
|
|
208
|
+
- **H8** `settings.html` ACP 测试按钮:原代码 `const res` 重复声明 + 引用未定义 `endpoint`/`auth`,整页脚本 SyntaxError,功能必坏。改读 `agent.endpoint` / `agent.auth`。
|
|
209
|
+
- **H10** Telegram bot token 不再随错误日志泄露:`logger.ts` 加 `redact.paths`(`*.token` / `*.botToken` / `*.apiKey` / `headers.authorization` / `x-im-hub-token` 等);图片 / 语音下载 catch 路径用本地 `scrub()` 把 token 字面量替换 `[REDACTED]`,覆盖 curl stderr 带回 URL 的场景。
|
|
210
|
+
|
|
211
|
+
### Fixed — P1 runtime hardening
|
|
212
|
+
- **H4** `RateLimiter` bucket 无界:`allow()` 内置 `maybeSweep`,每 30 min 机会式触发 cleanup(不引入 `setInterval` timer);新增 `size()` 诊断访问器。
|
|
213
|
+
- **H6** Job result 大小:`resolveMaxResultBytes()` 默认 1 MiB,env `IMHUB_JOB_RESULT_MAX_BYTES` 覆盖;超过 cap 整 chunk 丢弃(边界落在 UTF-8/JSON 事件分隔上),尾部拼 truncation footer,落 warn `event: 'job.result.truncated'`。
|
|
214
|
+
- **H9** WeChat 凭证文件权限:`saveCredentials` 用 `mkdir(.., {mode:0o700})` + `writeFile(.., {mode:0o600})`;`loadCredentials` 读时 `stat`,松权落 warn 提示用户 `chmod 600`(不主动改老文件)。
|
|
215
|
+
- **H11** Approval socket 路径熵 + 权限:`defaultSocketPath` 改用 `randomBytes(16).toString('hex')`(128 位熵),listen 后 `chmod 0o600` + `stat` 验证;防同主机非特权用户预占 socket 的 TOCTOU。
|
|
216
|
+
- **H12** `Session.addMessage` 并发:`SessionManager` 加 `writeQueues<key, Promise>` + `withLock<T>(key, fn)`,per-key 串行化 RMW,跨 thread 仍并行。
|
|
217
|
+
|
|
218
|
+
### Fixed — P1 multi-tenant ACL
|
|
219
|
+
- **H5** `/job` `/schedule` `/audit` 命令补 owner 隔离:`jobs` / `schedules` 表加 `creator_id` / `workspace_id`(幂等 `ALTER TABLE`,老库无痛升级);`createJob` / `createSchedule` 接 `{ creatorId, workspaceId }` 由 handler 注入;查询/取消/删/启停加 `OwnerOpts`,`creator_id = ? OR creator_id = ''`(老库 `''` 对所有 owner 可见,避免升级当天列表看似消失);`/audit user=<other>` 强制 overwrite 到 `ctx.userId`,结果末尾追加忽略提示。
|
|
220
|
+
- **H7** Job 表 retention:`resolveRetentionDays()` 默认 30 天,env `IM_HUB_JOB_RETENTION_DAYS` 覆盖;`pruneOldJobs()` 删 `completed`/`failed`/`cancelled` 超期行,`pending`/`running` 永不修剪;启动跑一次 + 每 6h `setInterval(..unref())`;新增 `idx_jobs_created` / `idx_jobs_creator` / `idx_jobs_status_created` 索引。
|
|
221
|
+
- **M6** Workspace 白名单从路由层下沉到命令层:`/job create <agent>` 与 `/schedule create <agent>` 在 `createJob` / `createSchedule` 之前调 `workspaceRegistry.resolve(ctx.userId).hasAgent(agent.name)`。
|
|
222
|
+
|
|
223
|
+
### Tests
|
|
224
|
+
- `test/unit/schedule-webhook.test.ts` 新增 22 用例锁定 SSRF 防护行为。
|
|
225
|
+
- `test/unit/rate-limiter.test.ts` +4 用例:size 计数、强制清空、刚活跃 bucket spare、连续 allow 不误触发 sweep。
|
|
226
|
+
- `test/unit/session-real.test.ts` +1 用例:50 个并发 `addMessage` 同 key,JSONL 行数与 in-memory messages 严格 = N,content 集合无丢失。
|
|
227
|
+
|
|
228
|
+
### Notes
|
|
229
|
+
- 历史 `/job list`(无 `ctx.userId` 注入)仍能看全部,REST `/api/jobs` 同。
|
|
230
|
+
- 历史调用方(无 `OwnerOpts`)TS 仍可编译通过。
|
|
231
|
+
- M5(cron 时钟跳变)经复核当前 `dueSchedules → fireSchedule` 路径不会双触发,留到后续 UTC 重构一并处理。
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## [0.2.15] - 2026-05-01
|
|
236
|
+
|
|
237
|
+
### Added
|
|
238
|
+
- **Discord messenger adapter** — full IM bridge for Discord (Gateway WebSocket via `discord.js`)
|
|
239
|
+
- `im-hub config discord` interactive setup wizard
|
|
240
|
+
- Typing indicator (10s TTL, 8s refresh)
|
|
241
|
+
- Markdown → Discord-flavored format conversion
|
|
242
|
+
- Guild / Channel whitelist filtering
|
|
243
|
+
- Setup guide: [`docs/discord-setup.md`](docs/discord-setup.md)
|
|
244
|
+
- **Tasks dashboard upgrades** — `/tasks` page now surfaces background work
|
|
245
|
+
- **Background tab**: lists `~/.claude/bgjobs` + `~/.config/opencode/bgjobs` jobs (override via `IMHUB_BGJOB_ROOTS`); per-root selector, 5s auto-refresh, detail modal with `cmd` / `workdir` / `log_tail`
|
|
246
|
+
- **Subtasks tab**: flattens every subtask in every session file, with parent platform / threadId / agent attached
|
|
247
|
+
- Bilingual labels (EN + ZH)
|
|
248
|
+
- **REST endpoints (read-only)**:
|
|
249
|
+
- `GET /api/bgjobs[?root=ID]` / `GET /api/bgjobs/:id[?root=ID&tail=N]`
|
|
250
|
+
- `GET /api/subtasks`
|
|
251
|
+
|
|
252
|
+
### Changed
|
|
253
|
+
- Web Chat / Tasks `index.html` served with `Cache-Control: no-cache, must-revalidate` so dashboard updates land without a hard refresh.
|
|
254
|
+
- **Feishu adapter** dedupes `message_id` in a 10-min TTL set — WebSocket long-poll was replaying the same event on reconnect and double-firing Claude runs.
|
|
255
|
+
|
|
256
|
+
### Tests
|
|
257
|
+
- 26 new tests: bgjob-reader (15), session subtasks (2), web server integration (9)
|
|
258
|
+
- Discord adapter: mock-client driven offline e2e (sendMessage, messageCreate, whitelist / bot filtering, message splitting)
|
|
259
|
+
- IM approval ↔ Discord end-to-end loop (sidecar → ApprovalBus → approval-router → Discord channel → reply → decision back)
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## [0.2.14] - 2026-05-01
|
|
264
|
+
|
|
265
|
+
### Added
|
|
266
|
+
- **Human-in-the-loop tool approval** for IM-launched Claude runs.
|
|
267
|
+
- Replaces the legacy `--permission-mode dontAsk + blanket-allow PreToolUse hook` shortcut with a real approval flow over IM.
|
|
268
|
+
- Architecture:
|
|
269
|
+
```
|
|
270
|
+
claude --permission-prompt-tool mcp__imhub__request --mcp-config <tmp>
|
|
271
|
+
└─> MCP sidecar (mcp-approval-server.ts) ── unix socket ──> im-hub
|
|
272
|
+
└─> approval-bus
|
|
273
|
+
└─> approval-router → messenger.sendMessage
|
|
274
|
+
↑
|
|
275
|
+
user replies y / n / 批准 / 拒绝 in the same IM thread
|
|
276
|
+
```
|
|
277
|
+
- cli intercepts approval replies *before* the agent router; unrecognized replies during a pending request auto-deny so the sidecar (and Claude) don't hang.
|
|
278
|
+
- Per-spawn state lives in the `SpawnPlan` returned by `AgentBase.prepareCommand` (closure-local, not `this.*`) — fixes a singleton race where parallel IM threads running claude clobbered each other's `mcp-config` and the second run died with *MCP config file not found*.
|
|
279
|
+
- Graceful fallbacks: `IMHUB_APPROVAL_DISABLED=1`, missing IM context, approval-bus not started, or `mkdtemp/writeFile` failure all degrade to the legacy `--permission-mode dontAsk` path.
|
|
280
|
+
|
|
281
|
+
### Notes
|
|
282
|
+
- Approvals are platform-agnostic — the same chain works for WeChat / Telegram / Feishu / Discord with no per-platform changes.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## [0.2.13] - 2026-04-30
|
|
287
|
+
|
|
288
|
+
A large multi-phase release: structured logging, observability, multi-tenant routing, persistent jobs, ACP server-mode, and a Web tasks panel. Versioned together because the wiring is interdependent.
|
|
289
|
+
|
|
290
|
+
### Phase 1 — Foundations (security, logging, schema, agent base)
|
|
291
|
+
|
|
292
|
+
#### Added
|
|
293
|
+
- **Structured logging** with `pino` and request-scoped `traceId` propagated through every layer (router → agent → audit). Pretty in TTY, JSON in production. ADR: [`docs/adr/0002-structured-logging-trace-id.md`](docs/adr/0002-structured-logging-trace-id.md).
|
|
294
|
+
- **Zod config schema validation** at startup and PUT `/api/config` — invalid configs reject with a useful error instead of crashing the bridge mid-run.
|
|
295
|
+
- **`AgentBase` abstraction** for CLI-based adapters (claude-code / codex / copilot / opencode) — shared spawn-stream, abort/timeout, line buffer, error formatting, healthCheck. ADR: [`docs/adr/0001-agent-base-abstraction.md`](docs/adr/0001-agent-base-abstraction.md).
|
|
296
|
+
- **Agent availability TTL cache** on top of `healthCheck` — avoids spawning a probe process on every `/<agent>` switch.
|
|
297
|
+
- **Audit log** with SQLite (`~/.im-hub/audit.db`, 30-day retention) + `/audit [n]` chat command.
|
|
298
|
+
|
|
299
|
+
#### Fixed
|
|
300
|
+
- P0 batch: WebSocket auth, nested config-mask leaks, timeout coercion, `/api/notify` token validation, agent-name prefix collisions, session path traversal (ADR [`0003`](docs/adr/0003-session-path-safety.md)).
|
|
301
|
+
|
|
302
|
+
### Phase 2 — Routing & resilience
|
|
303
|
+
|
|
304
|
+
#### Added
|
|
305
|
+
- **Intent classifier** (`src/core/intent.ts`) — topic regex (CJK + ASCII), per-agent keyword profile, sticky-session bias, optional LLM judge fallback with LRU cache. `/router status|policy|explain|reset` for inspection.
|
|
306
|
+
- **Circuit breaker** for agent invocations (3 failures → 5-minute cool-down).
|
|
307
|
+
- **Per-user token-bucket rate limiter**, applied before every agent dispatch.
|
|
308
|
+
|
|
309
|
+
#### Fixed
|
|
310
|
+
- Workspace whitelist now applies to both `/<agent>` *and* default routing.
|
|
311
|
+
- `workspace.rateLimit` actually enforced (was inert before).
|
|
312
|
+
- Intent classifier matches CJK keywords (was `\b` regex, all dead).
|
|
313
|
+
- Profile-less ACP custom agents participate via a `DEFAULT_WEIGHT` floor.
|
|
314
|
+
|
|
315
|
+
### Phase 3 — ACP server, workspaces, persistent jobs
|
|
316
|
+
|
|
317
|
+
#### Added
|
|
318
|
+
- **ACP server mode** — im-hub itself is now an ACP-compatible agent at `POST /tasks` (sync + SSE) with timing-safe auth and a 1 MiB body cap.
|
|
319
|
+
- **`/.well-known/acp` discovery** for ACP custom agents (A-1).
|
|
320
|
+
- **Multi-tenant workspace registry** (`src/core/workspace.ts`) with per-workspace agent whitelist + rate limits + member lists.
|
|
321
|
+
- **Persistent Job Board** with SQLite (`~/.im-hub/jobs.db`) and `/job` chat commands — survives restarts; ACP-server tasks become durable jobs.
|
|
322
|
+
- **Subtask sessions** + `/task` aliases for backward compatibility.
|
|
323
|
+
- **`AbortController` signal** plumbed through job board for real cancellation (Phase 3.5).
|
|
324
|
+
- **Cron scheduler** (`src/core/schedule.ts`) — 30-second tick, fires registered job specs.
|
|
325
|
+
|
|
326
|
+
### Phase 4 — Observability & Web (W-1)
|
|
327
|
+
|
|
328
|
+
#### Added
|
|
329
|
+
- **Web `/tasks` panel** for jobs, schedules, workspaces.
|
|
330
|
+
- **REST jobs API** (`/api/jobs`, `/api/schedules`, `/api/workspaces`).
|
|
331
|
+
- **Prometheus metrics** at `/api/metrics` (pure quickselect quantiles, no extra dep).
|
|
332
|
+
- Deployment guide: [`docs/deployment.md`](docs/deployment.md).
|
|
333
|
+
|
|
334
|
+
### Restored / overhauled commands
|
|
335
|
+
- `/model`, `/models`, `/think`, `/stats`, `/sessions` — all returned and overhauled. Session model selection now persists across restarts.
|
|
336
|
+
|
|
337
|
+
### Performance
|
|
338
|
+
- LRU cache for LLM intent judge.
|
|
339
|
+
- Shared SQLite helper (single `prepare`-cache, single PRAGMA bootstrap).
|
|
340
|
+
- LineBuffer indexOf walk (avoids quadratic scans on long stdout chunks).
|
|
341
|
+
- Metrics quickselect quantiles (no `.sort()` per scrape).
|
|
342
|
+
- Cron `nextOccurrence` field-level fast-forward (skip-ahead instead of minute-loop).
|
|
343
|
+
|
|
344
|
+
### Stability fixes (CR round)
|
|
345
|
+
- 11 follow-up findings from the code-review pass (see [`docs/code-review-2026-04-30-main.md`](docs/code-review-2026-04-30-main.md)).
|
|
346
|
+
- WeChat `getUpdates` now has a `FETCH_TIMEOUT` to prevent event-loop blocking.
|
|
347
|
+
- `AgentBase.sendPrompt` is true streaming with multi-byte UTF-8 safety.
|
|
348
|
+
- `session.addMessage` is append-only JSONL (was full rewrite per turn).
|
|
349
|
+
|
|
350
|
+
### Architecture docs
|
|
351
|
+
- [`docs/architecture/current.md`](docs/architecture/current.md) — system overview at v0.2.13.
|
|
352
|
+
- [`docs/architecture/target.md`](docs/architecture/target.md) — multi-tenant target.
|
|
353
|
+
- ADRs 0001 / 0002 / 0003.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## [0.2.7] - 2026-03-27
|
|
358
|
+
|
|
359
|
+
### Added
|
|
360
|
+
- **Conversation history support** — agents now remember context across messages
|
|
361
|
+
- Session stores message history (`ChatMessage[]`)
|
|
362
|
+
- History is passed to agents with each prompt for context awareness
|
|
363
|
+
- `/new` command to start a fresh conversation (clears history)
|
|
364
|
+
- **ChatMessage type** — `{ role: 'user' | 'assistant', content: string, timestamp: Date }`
|
|
365
|
+
- **Session history management** in SessionManager:
|
|
366
|
+
- `addMessage()` — add message to conversation history
|
|
367
|
+
- `resetConversation()` — clear history, start new session
|
|
368
|
+
- `getSessionWithHistory()` — retrieve session with messages
|
|
369
|
+
|
|
370
|
+
### Changed
|
|
371
|
+
- **AgentAdapter interface** — `sendPrompt()` now accepts optional `history?: ChatMessage[]`
|
|
372
|
+
- **All agent adapters** (claude-code, codex, copilot, opencode) now:
|
|
373
|
+
- Accept conversation history
|
|
374
|
+
- Build contextual prompts with previous messages
|
|
375
|
+
- **Router** — automatically saves user messages and agent responses to history
|
|
376
|
+
- **Help text** — updated to include `/new` command
|
|
377
|
+
|
|
378
|
+
### Fixed
|
|
379
|
+
- Context loss issue in channel-based conversations — agents now maintain conversation memory
|
|
380
|
+
|
|
381
|
+
## [0.2.2.0] - 2026-03-27
|
|
382
|
+
|
|
383
|
+
### Added
|
|
384
|
+
- **Onboarding module** (`src/core/onboarding.ts`) with friendly first-run experience
|
|
385
|
+
- `checkMessengerConfig()` — detect if messengers are configured
|
|
386
|
+
- `checkAgentAvailability()` — async check with session-level caching
|
|
387
|
+
- `runMessengerOnboarding()` — interactive messenger setup wizard
|
|
388
|
+
- `formatAgentInstallHint()` — friendly install messages for missing agents
|
|
389
|
+
- `formatAgentNotAvailableError()` — chat-friendly runtime error messages
|
|
390
|
+
- `formatMessengerStartError()` — actionable hints for startup failures
|
|
391
|
+
|
|
392
|
+
### Changed
|
|
393
|
+
- **CLI start command** now runs onboarding checks before starting messengers
|
|
394
|
+
- Detects unconfigured messengers and launches interactive setup
|
|
395
|
+
- Warns about missing agents with install instructions
|
|
396
|
+
- Shows friendly error messages instead of stack traces
|
|
397
|
+
- **Router** now checks agent availability at runtime
|
|
398
|
+
- Returns helpful chat message if requested agent isn't installed
|
|
399
|
+
- Uses cached availability check to avoid repeated process spawns
|
|
400
|
+
|
|
401
|
+
### Fixed
|
|
402
|
+
- Critical bug where onboarding never triggered because `config.messengers` was auto-filled with default
|
|
403
|
+
- Ugly stack traces shown to users when messenger fails to start
|
|
404
|
+
|
|
405
|
+
## [0.0.1.0] - 2026-03-25
|
|
406
|
+
|
|
407
|
+
### Added
|
|
408
|
+
- Initial project scaffold with TypeScript + Bun
|
|
409
|
+
- Core types: `Message`, `ParsedMessage`, `Session`, `MessengerAdapter`, `AgentAdapter`
|
|
410
|
+
- Plugin registry for static imports
|
|
411
|
+
- Message router with command parsing (`/status`, `/help`, `/agents`, `/<agent>`)
|
|
412
|
+
- Session manager with file-based persistence
|
|
413
|
+
- WeChat adapter stub (wechaty-puppet-wechat)
|
|
414
|
+
- Claude Code adapter stub (stream-json mode)
|
|
415
|
+
- CLI commands: `start`, `config`, `agents`, `messengers`
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> Productized fork of the original [`im-hub`](https://www.npmjs.com/package/im-hub). On-disk config (`~/.im-hub/`), env vars (`IMHUB_*`), and HTTP headers (`X-IM-Hub-Token`) are unchanged — drop-in compatible. See [Migrating from `im-hub`](#migrating-from-im-hub) below.
|
|
8
8
|
|
|
9
|
-
## What's new in v0.2.13 → v0.2.
|
|
9
|
+
## What's new in v0.2.13 → v0.2.30
|
|
10
10
|
|
|
11
11
|
- **Discord adapter** (Gateway WebSocket via `discord.js`)
|
|
12
12
|
- **Human-in-the-loop tool approval** — Claude pauses on tool calls; you reply `y`/`n` in the same IM thread, **or click an in-page card from the web chat**
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
- **v0.2.21 — Web console PR-B**: Health tab (per-agent breaker / rate-limiter / latency p50/95/99 / sparkline) + Approvals tab (browse and resolve every pending HITL approval from the dashboard)
|
|
26
26
|
- **v0.2.22 — Web console PR-C**: SSE event stream (`/events`) replaces polling for audit / approval / job / metrics events; full Workspace CRUD UI in /settings
|
|
27
27
|
- **v0.2.23 — Web console PR-D**: Files tab — read-only browser of `~/.im-hub-workspaces/<agent>/`; Jobs tab gains multi-select + batch cancel / run; settings page header / container restyled
|
|
28
|
+
- **v0.2.30 — Production hardening**: active subtask turns now use isolated sub-sessions and native agent sessions; WebSocket chat ingress is serialized per browser connection; session metadata writes use per-key locking; Web UI defaults to loopback binding; config files are written `0600`; Telegram media downloads reject redirects; `im-hub-pro --version` reads the package version
|
|
28
29
|
|
|
29
30
|
See [CHANGELOG.md](CHANGELOG.md) and [docs/code-review-2026-05-06-main.md](docs/code-review-2026-05-06-main.md) for the full list.
|
|
30
31
|
|
package/README.zh-CN.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> 原 [`im-hub`](https://www.npmjs.com/package/im-hub) 包的产品化分支。落盘配置(`~/.im-hub/`)、环境变量(`IMHUB_*`)、HTTP 头(`X-IM-Hub-Token`)保持不变 —— 老部署可以无缝切换,详见下方[迁移指南](#从-im-hub-迁移)。
|
|
8
8
|
|
|
9
|
-
## 0.2.13 → 0.2.
|
|
9
|
+
## 0.2.13 → 0.2.30 主要升级
|
|
10
10
|
|
|
11
11
|
- **Discord 适配器**(基于 `discord.js` 的 Gateway WebSocket)
|
|
12
12
|
- **工具调用人审(HITL)** — Claude 调工具时自动暂停,IM 同一会话回复 `y`/`n` 即可,**或在 Web 对话界面点弹出的审批卡**
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
- **v0.2.21 — Web 控制台 PR-B**:Health tab(每个 agent 的 breaker / 限流余量 / p50/95/99 / sparkline)+ Approvals tab(浏览并解决所有 pending HITL 审批)
|
|
26
26
|
- **v0.2.22 — Web 控制台 PR-C**:SSE 事件流(`/events`)替代轮询,audit / approval / job / metrics 实时推送;Settings 页加 Workspace 完整 CRUD UI
|
|
27
27
|
- **v0.2.23 — Web 控制台 PR-D**:Files tab 只读浏览 `~/.im-hub-workspaces/<agent>/`;Jobs tab 多选 + 批量取消/重跑;Settings 页 header / 容器重新调整布局
|
|
28
|
+
- **v0.2.30 — 生产硬化**:active subtask 普通消息与 agentCommand 都进入独立子会话和独立原生 Agent session;WebSocket 对话入口按浏览器连接串行处理;session 元数据写入加 per-key 锁;Web 控制台默认回环监听;配置文件强制 `0600`;Telegram 媒体下载拒绝重定向;`im-hub-pro --version` 跟随包版本
|
|
28
29
|
|
|
29
30
|
完整变更见 [CHANGELOG.md](CHANGELOG.md)。
|
|
30
31
|
|