@chanlerdev/scorel 0.0.1 → 0.0.2

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.
Files changed (43) hide show
  1. package/README.md +356 -69
  2. package/dist/index.js +4237 -1759
  3. package/dist/index.js.map +4 -4
  4. package/docs/CHANGELOG.md +62 -0
  5. package/docs/ROADMAP.md +93 -9
  6. package/docs/SHIP.md +9 -3
  7. package/docs/spec/channels.md +97 -100
  8. package/docs/spec/client.md +11 -5
  9. package/docs/spec/extensions.md +115 -43
  10. package/docs/spec/ship/S0062-npm-package-and-release-workflow.md +3 -0
  11. package/docs/spec/ship/S0063-ai-release-notes.md +129 -0
  12. package/docs/spec/ship/S0064-gui-product-intent-and-boundary.md +79 -0
  13. package/docs/spec/ship/S0065-gui-electron-shell-and-embedded-host.md +73 -0
  14. package/docs/spec/ship/S0066-gui-local-project-workspace.md +79 -0
  15. package/docs/spec/ship/S0067-gui-relay-device-and-remote-project-selection.md +97 -0
  16. package/docs/spec/ship/S0068-gui-codex-app-polish-and-e2e.md +102 -0
  17. package/docs/spec/ship/S0068-gui-e2e-verification.md +50 -0
  18. package/docs/spec/ship/S0069-gui-codex-ui-refactor.md +371 -0
  19. package/docs/spec/ship/S0070-gui-streaming-and-tool-blocks.md +202 -0
  20. package/docs/spec/ship/S0071-gui-visual-fidelity-and-settings-shell.md +360 -0
  21. package/docs/spec/ship/S0072-gui-glass-sidebar-and-picker-anchoring.md +116 -0
  22. package/docs/spec/ship/S0073-provider-model-profile-contract.md +241 -0
  23. package/docs/spec/ship/S0074-gui-model-provider-settings-split.md +113 -0
  24. package/docs/spec/ship/S0075-provider-catalog-model-cards.md +93 -0
  25. package/docs/spec/ship/S0076-provider-modal-search-and-direct-key.md +70 -0
  26. package/docs/spec/ship/S0077-auxiliary-session-title-generation.md +95 -0
  27. package/docs/spec/ship/S0078-gui-provider-settings-forward-config-and-simplification.md +150 -0
  28. package/docs/spec/ship/S0079-gui-sidebar-layout-controls.md +49 -0
  29. package/docs/spec/ship/S0080-session-title-hook-and-gui-markdown-dark-code.md +58 -0
  30. package/docs/spec/ship/S0081-automatic-memory.md +117 -0
  31. package/docs/spec/ship/S0082-memory-journal-tool-and-idle-dream.md +107 -0
  32. package/docs/spec/ship/S0083-extension-manifest-and-im-channel-runtime.md +338 -0
  33. package/docs/spec/ship/S0084-built-in-telegram-im-extension.md +188 -0
  34. package/docs/spec/ship/S0085-gui-im-extension-settings.md +47 -0
  35. package/docs/spec/ship/S0086-auto-compact-and-session-memory.md +124 -0
  36. package/extensions/builtin/loopback/adapter.js +13 -0
  37. package/extensions/builtin/loopback/scorel.extension.json +7 -0
  38. package/extensions/builtin/loopback/skills/loopback/SKILL.md +7 -0
  39. package/extensions/builtin/telegram/adapter.d.ts +43 -0
  40. package/extensions/builtin/telegram/adapter.js +252 -0
  41. package/extensions/builtin/telegram/scorel.extension.json +7 -0
  42. package/extensions/builtin/telegram/skills/telegram/SKILL.md +9 -0
  43. package/package.json +6 -2
package/docs/CHANGELOG.md CHANGED
@@ -2,6 +2,68 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.0.2 - 2026-06-11
6
+
7
+ ### Highlights
8
+
9
+ - Auto context compaction and session memory maintenance now keep sessions within model context limits.
10
+ - New GUI Electron shell with embedded local Host enables project management and chat locally.
11
+ - GUI now supports Relay device pairing, remote directory browsing, and explicit remote project selection.
12
+ - Streaming cursor, RAF-based event batching, and seven specialized tool blocks deliver a smoother, more informative chat experience.
13
+ - AI-powered release notes generation with DeepSeek now runs by default during releases.
14
+
15
+ ### Changes
16
+
17
+ - Added auto context compaction and session memory maintenance (configurable threshold and async per-session memory files).
18
+ - Added built-in Telegram IM extension with long polling, Bot API integration, and GUI settings.
19
+ - Added extension manifest and IM channel runtime (loopback extension validates end-to-end flow).
20
+ - Added AppendDaily tool for agent-owned journal entries with delayed idle dream consolidation (configurable dreamIdleMinutes).
21
+ - Implemented automatic memory system with context injection, daily notes, dream consolidation, and GUI settings.
22
+ - Introduced provider-model profile contract: multi-layered config with primary/standard/auxiliary roles, GUI model picker, and auxiliary session title generation.
23
+ - GUI now has a three-pane layout (project list, session list, chat workspace) with local project registration.
24
+ - GUI settings now include Session Memory toggle and Auto Compact threshold selector.
25
+ - GUI sidebar uses macOS vibrancy glass effect, project picker anchored to trigger, and removed unimplemented placeholders.
26
+ - Redesigned settings page with macOS-style navigation sidebar, cards, toggles, selects, and link controls.
27
+ - Add streaming cursor, RAF-based event batching, and seven specialized tool blocks (Read, Glob, Grep, Edit, Write, Bash, TodoWrite) with unified diff viewer.
28
+ - Release workflow now creates GitHub Release and uploads npm tarball as asset (--no-github-release flag to skip).
29
+ - AI release notes generation runs by default during release (DeepSeek V4 Flash, fallback to minimal changelog with --no-generate-notes).
30
+ - Simplified GUI Provider and Model settings to user-facing fields with auto-save, model test button, and model config modal.
31
+ - Release workflow now removes generated diffs (e.g. dist, source maps) from AI changelog context.
32
+
33
+ ### Fixes
34
+
35
+ - Install ripgrep in release action to fix Glob/Grep tests before publish.
36
+ - AI changelog collection now skips generated diffs before reading patches.
37
+ - Move session title generation to post-user-message hook and fix GUI dark code theme (now uses github-dark-default).
38
+ - Improve GUI sidebar layout with title truncation, resizing, and collapse/expand controls.
39
+
40
+ ### Breaking Changes
41
+
42
+ - Old single [model] config section is replaced; existing .scorel/config.toml files with [model] must be migrated to new provider-model profile structure.
43
+ - Old [model] and [models.*] configurations are no longer compatible and will produce schema errors.
44
+
45
+ ### Verification
46
+
47
+ - Core session tests verify compact parsing and barrier context behavior.
48
+ - Config tests validate new schema, reject legacy sections, preserve direct API keys on merge, and redact secrets.
49
+ - Daemon tests prove auto compact appends compact event and session memory maintained asynchronously.
50
+ - GUI rendering tests confirm new settings controls, sidebar behavior, and tool block rendering.
51
+ - Integration tests cover loopback IM extension, Relay device pairing, and remote project management.
52
+ - Release workflow tests cover AI note generation, GitHub Release creation, and asset upload.
53
+ - Full pnpm typecheck && pnpm test passes across all packages.
54
+
55
+ ### Internal
56
+
57
+ - Add specification for GUI visual fidelity and settings macOS shell (S0071).
58
+ - The commit only adds documentation files; no code changes are included.
59
+ - Specify GUI streaming UX and specialized tool blocks (S0070 spec and roadmap update).
60
+ - Add spec for GUI Codex App UI refactor (S0069) and roadmap entry.
61
+ - Define GUI product boundary and Milestone 9 roadmap with SHIP specs.
62
+
63
+ - **release**: Generate changelog notes by default from commit summaries using DeepSeek V4 Flash, with a local preview command and an explicit `--no-generate-notes` escape hatch.
64
+ - **release**: Make AI changelog collection skip generated diffs before reading patches, preventing release Actions from failing on bundled `dist` or source-map changes.
65
+ - **release**: Install `ripgrep` in the manual release Action so the repo-level Glob/Grep tests run in CI before publishing.
66
+
5
67
  ## 0.0.1 - 2026-06-06
6
68
 
7
69
  - **release**: Add public `scorel` package build, npm pack smoke, local release command, and manual GitHub Actions release workflow.
package/docs/ROADMAP.md CHANGED
@@ -514,9 +514,9 @@ M5 WebUI 的正式产品方向记录在 [`S0030`](spec/ship/S0030-webui-product-
514
514
 
515
515
  ---
516
516
 
517
- ## M8 Follow-up: Hosted Defaults And CLI Command Surface
517
+ ## M8 Follow-up: Hosted Defaults, CLI Command Surface, And Release Transparency
518
518
 
519
- **Goal**: 把已经部署的 hosted WebUI / Relay 路径变成默认用户路径,并把 CLI 命令从实现名词收敛到产品名词:`scorel` 是正常项目交互入口,`scorel host serve` 启动并注册本机 Host,`scorel pair <code>` 默认走官方 Relay
519
+ **Goal**: 把已经部署的 hosted WebUI / Relay 路径变成默认用户路径,并把 CLI 命令从实现名词收敛到产品名词:`scorel` 是正常项目交互入口,`scorel host serve` 启动并注册本机 Host,`scorel pair <code>` 默认走官方 Relay。同时让 release changelog 从 commits 自动生成透明、用户可读的更新说明。
520
520
 
521
521
  **Steps**:
522
522
 
@@ -524,6 +524,7 @@ M5 WebUI 的正式产品方向记录在 [`S0030`](spec/ship/S0030-webui-product-
524
524
  |---|---|---|---|
525
525
  | M8.F1 | [`S0061`](spec/ship/S0061-hosted-defaults-and-cli-command-surface.md) | hosted defaults、`host serve`、默认 `pair`、`scorel` 交互入口和 Relay operator 命令收口 | Done |
526
526
  | M8.F2 | [`S0062`](spec/ship/S0062-npm-package-and-release-workflow.md) | 单 public `scorel` npm 包、本地 release 命令和手动 GitHub Actions 发布入口 | Done |
527
+ | M8.F3 | [`S0063`](spec/ship/S0063-ai-release-notes.md) | release 默认使用 DeepSeek 从 commits 生成结构化 changelog notes,本地和 GitHub Actions 共用同一路径 | Done |
527
528
 
528
529
  **Status**: Done
529
530
 
@@ -531,15 +532,73 @@ M5 WebUI 的正式产品方向记录在 [`S0030`](spec/ship/S0030-webui-product-
531
532
 
532
533
  ## M9: GUI
533
534
 
534
- **Goal**: 提供 Project-first desktop GUI,统一管理本地、Relay 和远程 Device 上的 Project。
535
+ **Goal**: 提供 Project-first desktop GUI。GUI 是独立桌面 app,不是 hosted WebUI wrapper:本地通过 embedded Host 管理全部本机 Project,远程首版只通过 Relay 添加 Device,并且只有用户在 GUI 中显式选择过的远程 Project 才进入主 Project list
535
536
 
536
- **Candidate scope**:
537
+ **Done when**:
538
+
539
+ - `apps/gui` 成为独立 Electron workspace app;GUI 不进入 public `@chanlerdev/scorel` npm CLI 包。
540
+ - GUI main process 通过 embedded Host 管理本机 Project / Session;renderer 不直接持有 Runtime 或写 JSONL。
541
+ - 本地 Host Registry 中的全部 Project 自动显示在 GUI Project list。
542
+ - Settings 可以通过 Relay 添加 Device;首版不做 SSH 或 direct WS + token。
543
+ - Add Project 可以选择 local 或 Relay Device,并通过目标 Host 的目录浏览注册 Project。
544
+ - 远程 Project 只有被 GUI 显式选择后才显示;GUI 不像 WebUI 一样展示远程 Host Registry 全集。
545
+ - 主界面采用 Codex App 风格的 Project-first 工作台:Project list、Session/chat surface、Settings/Device management。
546
+ - 本地 Project 和 Relay Project 都通过真实 Host、真实 Relay transport、真实 JSONL session 和真实 provider 完成端到端验证。
547
+
548
+ **Steps**:
549
+
550
+ | Step | Spec | Goal | Status |
551
+ |---|---|---|---|
552
+ | M9.1 | [`S0064`](spec/ship/S0064-gui-product-intent-and-boundary.md) | 锁定 GUI 产品模型、Electron 分发边界、Project-first 信息架构和 Relay-only remote scope | Done |
553
+ | M9.2 | [`S0065`](spec/ship/S0065-gui-electron-shell-and-embedded-host.md) | 建立 `apps/gui` Electron shell、main/renderer 边界和 embedded local Host 连接 | Done |
554
+ | M9.3 | [`S0066`](spec/ship/S0066-gui-local-project-workspace.md) | 实现本地 Project-first workspace:本地 Project 全量展示、Session 列表、新建会话和 chat surface | Done |
555
+ | M9.4 | [`S0067`](spec/ship/S0067-gui-relay-device-and-remote-project-selection.md) | Settings 添加 Relay Device,并让 Add Project 显式选择远程 Project 后加入 GUI Project list | Done |
556
+ | M9.5 | [`S0068`](spec/ship/S0068-gui-codex-app-polish-and-e2e.md) | 对齐 Codex App 风格与交互质量,并完成 local + Relay 真实端到端验证 | Done |
557
+
558
+ **Not in M9**:
559
+
560
+ - SSH Remote Device、SSH stdio proxy、远端安装或启动 Scorel Host。
561
+ - Direct WS + token 作为 GUI 首版用户路径。
562
+ - 账号系统、OAuth、细粒度 ACL。
563
+ - 把 GUI 打进 `@chanlerdev/scorel` npm CLI 包或让 `pnpm scorel` 启动 GUI。
564
+
565
+ **Status**: Done
566
+
567
+ ---
537
568
 
538
- - 本地 Project 添加和 Session 管理。
539
- - Relay Device 添加。
540
- - 远程 Device 添加。
541
- - Project-first sidebar。
542
- - desktop main 管理本地 Host 和远程连接。
569
+ ## M9 Follow-up: GUI Codex App UI Refactor
570
+
571
+ **Goal**: 把 M9 跑通的 GUI 升级到 Codex App 视觉与交互质量。一刀重构 `apps/gui/src/renderer.tsx`,改为模块化 renderer 树:三段式 sidebar(project 内联展开 sessions)、composer pill + project picker pill 弹层、独立 Add Remote Project modal、独立 Settings view。建立完整 Markdown / streaming / 工具块渲染基础;工具块走 `@scorel/protocol` event-driven 注册表,新工具登记不动主路径。GUI 独立完整实现,后续可考虑 webui 反向复用 GUI 组件(本阶段不动 webui)。
572
+
573
+ **Steps**:
574
+
575
+ | Step | Spec | Goal | Status |
576
+ |---|---|---|---|
577
+ | M9.F1.1 | [`S0069`](spec/ship/S0069-gui-codex-ui-refactor.md) | renderer 骨架 + tokens + lucide icon + 三段式 sidebar + composer pill + project picker + Add Remote Project modal + 独立 Settings view + 基础 markdown(react-markdown + GFM + sanitize + shiki)+ 工具块注册表 + 流式 IPC channel | Done |
578
+ | M9.F1.2 | [`S0070`](spec/ship/S0070-gui-streaming-and-tool-blocks.md) | streaming 光标 + RAF batcher + IntersectionObserver autoscroll + jump-to-bottom + 7 个特化工具块(Read/Glob/Grep/Edit/Write/Bash/TodoWrite)+ unified diff viewer + 真实 provider local + Relay e2e | Done |
579
+ | M9.F1.3 | [`S0071`](spec/ship/S0071-gui-visual-fidelity-and-settings-shell.md) | 视觉打底:tokens 重置 + sidebar/composer/empty/picker/modal/transcript/工具块 chip 化 + Settings macOS 风重构(nav 三段分组 + header + card row + Toggle/Select/LinkAccent + 9 section 含 Config / General 真实) | Done |
580
+ | M9.F1.4 | [`S0072`](spec/ship/S0072-gui-glass-sidebar-and-picker-anchoring.md) | GUI glass sidebar + 删除未实现入口 + 空态文案修正 + project picker 跟随触发 pill | Done |
581
+ | M9.F1.5 | [`S0073`](spec/ship/S0073-provider-model-profile-contract.md) | Provider/model profile 合同:pi-ai provider config、available models、primary/standard/auxiliary 三角色与 GUI model picker | Done |
582
+ | M9.F1.6 | [`S0074`](spec/ship/S0074-gui-model-provider-settings-split.md) | GUI Settings 拆分模型页和 Provider 页,让三工作模型、available models、provider source 管理分层清楚 | Done |
583
+ | M9.F1.7 | [`S0075`](spec/ship/S0075-provider-catalog-model-cards.md) | Provider 页支持 /models 获取、折叠模型卡片和选用状态 | Done |
584
+ | M9.F1.8 | [`S0076`](spec/ship/S0076-provider-modal-search-and-direct-key.md) | Provider 新建 modal、catalog 搜索、provider 名称归一和直接 API key | Done |
585
+ | M9.F1.9 | [`S0077`](spec/ship/S0077-auxiliary-session-title-generation.md) | 第一条 chat 后用 auxiliary model 生成持久 session title | Done |
586
+ | M9.F1.10 | [`S0078`](spec/ship/S0078-gui-provider-settings-forward-config-and-simplification.md) | GUI Settings 使用前向 provider/model profile,并简化 Provider/Model 表单为用户可理解字段 | Done |
587
+ | M9.F1.11 | [`S0079`](spec/ship/S0079-gui-sidebar-layout-controls.md) | GUI sidebar 标题截断、宽度拖拽和收起/展开控制 | Done |
588
+ | M9.F1.12 | [`S0080`](spec/ship/S0080-session-title-hook-and-gui-markdown-dark-code.md) | Session title 生成改为 after-user-message hook,并修复 GUI Markdown 深色代码块 | Done |
589
+ | M9.F1.13 | [`S0081`](spec/ship/S0081-automatic-memory.md) | 自动 memory context、daily、dream consolidation、GUI Settings 与 Command+, 设置入口 | Done |
590
+ | M9.F1.14 | [`S0082`](spec/ship/S0082-memory-journal-tool-and-idle-dream.md) | Daily 改为 agent 主循环 AppendDaily 工具,dream 改为项目 idle 后延迟整合 project/root memory | Done |
591
+ | M9.F1.15 | [`S0086`](spec/ship/S0086-auto-compact-and-session-memory.md) | 80% auto compact、compact replay barrier 和每轮 session memory 维护 | Done |
592
+
593
+ **Not in M9 Follow-up**:
594
+
595
+ - empty-state plugin recommendation cards(用户明确不做)。
596
+ - 全局 `对话` 历史分组。
597
+ - composer review banner(变更审查 UI)。
598
+ - "不使用项目" picker 选项(GUI 是 Project-first,与 S0064 冲突)。
599
+ - 语音/`完全访问`真实切换(灰按钮占位)。
600
+ - WebUI 反向复用 GUI 组件(产品方向,本阶段不做)。
601
+ - SSH / direct WS + token / HTTP API。
543
602
 
544
603
  **Status**: Planned
545
604
 
@@ -590,6 +649,12 @@ HTTP adapter 必须映射已有 Host use cases,不复制领域逻辑。
590
649
 
591
650
  **Status**: Planned
592
651
 
652
+ | Item | Spec | Scope | Status |
653
+ |---|---|---|---|
654
+ | M12.1 | [`S0083`](spec/ship/S0083-extension-manifest-and-im-channel-runtime.md) | Extension manifest、IM channel bridge、fixed session、default workspace、source reminder、SendChannelMessage、loopback IM | Done |
655
+ | M12.2 | [`S0084`](spec/ship/S0084-built-in-telegram-im-extension.md) | Built-in Telegram IM extension、Bot API long polling、DM/group mention、local HTTP stub coverage | Done |
656
+ | M12.3 | [`S0085`](spec/ship/S0085-gui-im-extension-settings.md) | GUI IM settings、Telegram toggle、extension config IPC、built-in package discovery | Done |
657
+
593
658
  ---
594
659
 
595
660
  ## Active Specs
@@ -658,6 +723,25 @@ HTTP adapter 必须映射已有 Host use cases,不复制领域逻辑。
658
723
  | [`S0060`](spec/ship/S0060-relay-hosted-webui-e2e-validation.md) | Relay hosted WebUI real e2e validation | Done |
659
724
  | [`S0061`](spec/ship/S0061-hosted-defaults-and-cli-command-surface.md) | Hosted defaults and CLI command surface | Done |
660
725
  | [`S0062`](spec/ship/S0062-npm-package-and-release-workflow.md) | Npm package and release workflow | Done |
726
+ | [`S0063`](spec/ship/S0063-ai-release-notes.md) | AI release notes from commit summaries | Done |
727
+ | [`S0064`](spec/ship/S0064-gui-product-intent-and-boundary.md) | GUI product intent and Electron boundary | Done |
728
+ | [`S0065`](spec/ship/S0065-gui-electron-shell-and-embedded-host.md) | GUI Electron shell and embedded local Host | Done |
729
+ | [`S0066`](spec/ship/S0066-gui-local-project-workspace.md) | GUI local Project-first workspace | Done |
730
+ | [`S0067`](spec/ship/S0067-gui-relay-device-and-remote-project-selection.md) | GUI Relay Device and explicit remote Project selection | Done |
731
+ | [`S0068`](spec/ship/S0068-gui-codex-app-polish-and-e2e.md) | GUI Codex App polish and local + Relay e2e | Done |
732
+ | [`S0069`](spec/ship/S0069-gui-codex-ui-refactor.md) | GUI Codex 风一刀重构:模块化 renderer + sidebar inline sessions + project picker + Add Remote modal + Settings view + markdown + 工具块注册表 + 流式 IPC channel | Done |
733
+ | [`S0070`](spec/ship/S0070-gui-streaming-and-tool-blocks.md) | GUI streaming UX + 7 个特化工具块 + unified diff + 真实 provider local + Relay e2e | Done |
734
+ | [`S0071`](spec/ship/S0071-gui-visual-fidelity-and-settings-shell.md) | GUI 视觉打底 + Settings macOS 风重构 | Done |
735
+ | [`S0072`](spec/ship/S0072-gui-glass-sidebar-and-picker-anchoring.md) | GUI glass sidebar + 删除未实现入口 + 空态文案修正 + project picker 跟随触发 pill | Done |
736
+ | [`S0073`](spec/ship/S0073-provider-model-profile-contract.md) | Provider/model profile、available models、三角色模型选择与 GUI model picker | Done |
737
+ | [`S0074`](spec/ship/S0074-gui-model-provider-settings-split.md) | GUI Settings 模型页和 Provider 页拆分 | Done |
738
+ | [`S0075`](spec/ship/S0075-provider-catalog-model-cards.md) | Provider 页 /models catalog 获取和模型卡片选择 | Done |
739
+ | [`S0076`](spec/ship/S0076-provider-modal-search-and-direct-key.md) | Provider 新建 modal、catalog 搜索、provider 名称归一和直接 API key | Done |
740
+ | [`S0077`](spec/ship/S0077-auxiliary-session-title-generation.md) | 第一条 chat 后用 auxiliary model 生成持久 session title | Done |
741
+ | [`S0078`](spec/ship/S0078-gui-provider-settings-forward-config-and-simplification.md) | GUI Settings 前向 provider/model profile 和 Provider/Model 表单简化 | Done |
742
+ | [`S0083`](spec/ship/S0083-extension-manifest-and-im-channel-runtime.md) | Extension manifest、IM channel bridge、fixed session、source reminder 与 SendChannelMessage | Done |
743
+ | [`S0084`](spec/ship/S0084-built-in-telegram-im-extension.md) | Built-in Telegram IM extension with Bot API long polling | Done |
744
+ | [`S0085`](spec/ship/S0085-gui-im-extension-settings.md) | GUI IM extension settings and Telegram toggle | Done |
661
745
 
662
746
  ---
663
747
 
package/docs/SHIP.md CHANGED
@@ -197,6 +197,7 @@ pnpm release patch --dry-run
197
197
  pnpm release patch
198
198
  pnpm release minor
199
199
  pnpm release major
200
+ pnpm release patch --no-generate-notes
200
201
  ```
201
202
 
202
203
  正式 release 脚本职责包括:
@@ -207,13 +208,18 @@ pnpm release major
207
208
  - 构建 public `scorel` npm package
208
209
  - 执行 `npm pack` 安装烟雾测试
209
210
  - bump 所有 package version
210
- - 更新 changelog
211
+ - 默认用 DeepSeek V4 Flash 从上一个 `v*` tag 之后的 commits 生成 changelog notes
212
+ - 更新 changelog;只有显式 `--no-generate-notes` 时才写入最小版本标题
211
213
  - commit `release: vX.Y.Z`
212
214
  - tag `vX.Y.Z`
213
- - push branch + tag
214
215
  - publish root `scorel` package to npm
216
+ - push branch + tag
217
+ - create GitHub Release from the same generated changelog notes
218
+ - upload the same-version `npm pack` tarball as the only GitHub Release asset
219
+
220
+ Release notes 使用 `DEEPSEEK_API_KEY` 调用 DeepSeek 官方 API,默认 endpoint 为 `https://api.deepseek.com/v1`,默认模型为 `deepseek-v4-flash`。Dry-run 在缺少 key 或 API 失败时可打印 deterministic fallback preview;正式 release 默认要求 AI notes 成功,除非显式传入 `--no-generate-notes`。
215
221
 
216
- GitHub Actions 提供手动触发入口,默认执行 `patch` dry-run。正式 publish 需要仓库 secret `NPM_TOKEN`,对应 npm 账号当前为 `chanlerdev`。
222
+ GitHub Actions 提供手动触发入口,默认执行 `patch` dry-run。正式 release 使用 `GITHUB_TOKEN` 创建 GitHub Release;正式 publish 需要仓库 secret `NPM_TOKEN`,对应 npm 账号当前为 `chanlerdev`。AI release notes 需要仓库 secret `DEEPSEEK_API_KEY`。
217
223
 
218
224
  ---
219
225
 
@@ -1,156 +1,153 @@
1
- # Channel — Daemon 内部的消息注入适配器
1
+ # Channel — Extension-Backed IM Bridge
2
2
 
3
- > 上游:`architecture.md`、`spec/daemon.md`
4
- > 主题:把 IM 消息、cron 触发等外部输入归一为 Daemon 内部的 `AgentMessage` 注入。
3
+ > 上游:`architecture.md`、`spec/daemon.md`、`spec/extensions.md`
4
+ > 当前落地:S0083 Extension Manifest And IM Channel Runtime
5
5
 
6
6
  ---
7
7
 
8
- ## 1. 设计目标
8
+ ## 1. 定位
9
9
 
10
- Channel **Daemon 内部的子模块**,负责将非交互式的外部输入(IM、cron、webhook)转化为标准的 `AgentMessage` 注入 Runtime。
10
+ Channel 是外部消息入口。S0083 后,IM Channel 通过 Extension manifest 接入 Host:
11
11
 
12
- **不再是**:Entry 的统一入口(Entry 通过 DaemonClient 协议直连 Daemon)。
12
+ ```text
13
+ IM Adapter -> Channel Bridge -> ScorelHost -> ScorelRuntime -> SendChannelMessage -> IM Adapter
14
+ ```
15
+
16
+ Channel 不拥有 Runtime、Session、queue、memory 或 replay。它只把外部 IM 消息转成现有 Host turn,并把模型通过 `SendChannelMessage` 发出的文本送回当前 IM 会话。
13
17
 
14
- Channel 只处理那些"不是人坐在终端前打字"的输入源。CLI / GUI / WebUI 这些交互式 Entry 直接通过 DaemonClient 协议发送指令,不经过 Channel。
18
+ CLI / GUI / WebUI 仍然直接通过 DaemonClient / Host application service 操作 Host,不经过 Channel。
15
19
 
16
20
  ---
17
21
 
18
- ## 2. Channel 与 Entry 的区别
22
+ ## 2. Extension Manifest
23
+
24
+ IM channel 由 extension 提供:
25
+
26
+ ```json
27
+ {
28
+ "id": "telegram",
29
+ "kind": "im",
30
+ "displayName": "Telegram",
31
+ "adapter": "./adapter.js",
32
+ "skills": ["./skills"]
33
+ }
34
+ ```
19
35
 
20
- | | Entry(交互式) | Channel(非交互式) |
21
- |---|---|---|
22
- | 例子 | CLI / GUI / WebUI | Telegram Bot / cron / webhook |
23
- | 连接方式 | DaemonClient 协议 | Daemon 内部模块 |
24
- | 生命周期 | 用户主动连接/断开 | Daemon 启动时加载,持续运行 |
25
- | 双向通信 | ✅ 收发 event | ❌ 只注入消息,不接收实时事件流 |
26
- | 输出回传 | DaemonClient event stream | Channel 自行轮询或 hook 回调 |
36
+ `id` 同时是 extension id channel id。启用 extension 后,其 `skills` 目录进入现有 Skill index。
27
37
 
28
38
  ---
29
39
 
30
- ## 3. ChannelAdapter 接口
40
+ ## 3. Adapter Contract
41
+
42
+ Adapter 只处理平台 IO:
31
43
 
32
44
  ```typescript
33
- interface ChannelAdapter {
34
- readonly id: string; // 'telegram' | 'wechat' | 'cron' | 'webhook'
35
- start(ctx: ChannelContext): Promise<void>;
45
+ interface ImAdapter {
46
+ start(ctx: ImAdapterContext): Promise<void>;
36
47
  stop(): Promise<void>;
48
+ sendMessage(target: ImTarget, message: ImOutgoingMessage): Promise<void>;
49
+ setTyping?(target: ImTarget, typing: boolean): Promise<void>;
37
50
  }
38
51
 
39
- interface ChannelContext {
40
- inject: MessageInjector;
41
- subscribe: (cb: (event: ScorelEvent) => void) => () => void;
42
- config: ChannelConfig;
52
+ interface ImAdapterContext {
53
+ onMessage(message: ImIncomingMessage): Promise<void>;
54
+ logger: Logger;
43
55
  }
44
-
45
- type MessageInjector = (msg: AgentMessage) => Promise<void>;
46
56
  ```
47
57
 
48
- Channel 职责:
49
- 1. 从外部源接收消息
50
- 2. 调 `inject(msg)` 注入 Daemon
51
- 3. 可选:订阅 event 流用于回传结果(如 Telegram bot 需要把 assistant 回复发回群里)
58
+ Adapter 不创建 session,不写 JSONL,不实现 follow-up / steer,不读写 memory。
52
59
 
53
60
  ---
54
61
 
55
- ## 4. Injector:Daemon 内部路由
62
+ ## 4. Channel Bridge
56
63
 
57
- ```typescript
58
- // Daemon 内部实现
59
- function createInjector(daemon: Daemon): MessageInjector {
60
- return async (msg) => {
61
- // session lane 串行化,与 DaemonClient.prompt() 同等待遇
62
- await daemon.enqueue({ method: "prompt", params: { text: msg } });
63
- };
64
- }
65
- ```
64
+ Host 内部 bridge 负责:
65
+
66
+ - `(extensionId, externalConversationId) -> sessionId` 固定绑定;
67
+ - 创建 / 注册默认 workspace:`~/.scorel/workspace`;
68
+ - 通过现有 `send_message` 路径提交用户消息;
69
+ - 注入 channel source `harness_item kind="channel_context"`;
70
+ - 为当前 channel turn 暴露 `SendChannelMessage` tool。
66
71
 
67
- Channel 注入的消息和 DaemonClient 发来的 prompt **走同一条路径**,享受同样的并发控制和事件广播。
72
+ Binding 持久化在:
73
+
74
+ ```text
75
+ ~/.scorel/channels/im-bindings.json
76
+ ```
68
77
 
69
78
  ---
70
79
 
71
- ## 5. 消息载体:`<system_reminder>` 包裹
80
+ ## 5. Runtime Semantics
72
81
 
73
- 非交互式 Channel 注入时,用 `<system_reminder>` XML 包裹,让 LLM 区分来源:
82
+ IM 消息复用现有 runtime 行为:
74
83
 
75
- ```typescript
76
- await inject({
77
- role: 'user',
78
- content: `<system_reminder source="telegram" from="${msg.from}">
79
- ${msg.content}
80
- </system_reminder>`,
81
- timestamp: Date.now(),
82
- });
84
+ ```text
85
+ idle session -> ordinary user_message
86
+ running default -> follow_up queue
87
+ /steer message -> steer queue
88
+ /interrupt msg -> steer queue
83
89
  ```
84
90
 
91
+ 不新增 IM runtime,不新增 IM queue。
92
+
85
93
  ---
86
94
 
87
- ## 6. 初期落地的 Channel
95
+ ## 6. Source Reminder
88
96
 
89
- | Channel | 形态 | 阶段 |
90
- |---------|------|------|
91
- | `telegram` | Bot API,收到 mention/DM 时注入 | 后期 |
92
- | `wechat` | WeCom / 非官方桥 | 后期 |
93
- | `cron` | 定时任务触发(`node-cron`) | 后期 |
94
- | `webhook` | HTTP POST 触发注入 | 后期 |
97
+ 每个 IM turn 会在用户消息前注入 hidden channel reminder:
95
98
 
96
- **初期不需要任何 Channel**。CLI/GUI 通过 DaemonClient 直连 Daemon,Channel 是 IM/自动化场景的补充。
99
+ ```xml
100
+ <system-reminder>
101
+ This message came from an IM channel.
102
+
103
+ channel: telegram
104
+ conversation_type: group
105
+ sender_display_name: Chanler
106
+ mentioned_bot: true
107
+
108
+ Use SendChannelMessage to reply to the current conversation when needed.
109
+ </system-reminder>
110
+ ```
111
+
112
+ 模型可见的是来源语义,不是 raw platform id。raw chat id / open id 只作为 routing data 保存在 bridge/adapter context。
97
113
 
98
114
  ---
99
115
 
100
- ## 7. Channel 输出回传
116
+ ## 7. Reply Tool
101
117
 
102
- IM Bot 需要把 agent 回复发回对话。两种方式:
118
+ 当前已落地的回复工具:
103
119
 
104
- **方式 A:subscribe event stream(推荐)**
105
120
  ```typescript
106
- class TelegramChannel implements ChannelAdapter {
107
- async start(ctx: ChannelContext) {
108
- // 订阅 assistant 消息,发回 Telegram
109
- ctx.subscribe((event) => {
110
- if (event.type === "message_end" && event.message.role === "assistant") {
111
- this.sendToTelegram(event.message);
112
- }
113
- });
114
- // 监听 Telegram 消息,注入 Daemon
115
- this.bot.on("message", (msg) => ctx.inject(wrapMessage(msg)));
116
- }
117
- }
121
+ SendChannelMessage({ text: string })
118
122
  ```
119
123
 
120
- **方式 B:afterTurn hook(简单场景)**
121
- ```typescript
122
- // 作为 Extension 实现,在每轮结束后回传
123
- onEvent: async (event) => {
124
- if (event.type === "turn_end") { ... }
125
- }
126
- ```
124
+ 规则:
125
+
126
+ - 默认目标是当前 IM conversation;
127
+ - 模型不填写 Telegram chat id、飞书 open id、Slack channel id 等 raw id;
128
+ - channel context 时返回 `no_channel_context`;
129
+ - adapter send 失败时返回 tool error 并写 diagnostics。
127
130
 
128
131
  ---
129
132
 
130
- ## 8. Daemon 的关系
133
+ ## 8. Built-In Channels
131
134
 
132
- ```
133
- Daemon
134
- ├── DaemonServer(处理 client 连接:CLI/GUI/WebUI)
135
- ├── ChannelManager(管理非交互式输入源)
136
- │ ├── TelegramChannel
137
- │ ├── CronChannel
138
- │ └── WebhookChannel
139
- ├── SessionManager
140
- └── ScorelRuntime
141
- ```
135
+ 当前 foundation 提供 built-in `loopback` IM extension,用于真实 Host/JSONL/tool 链路验证。
136
+
137
+ 后续真实 provider:
142
138
 
143
- Channel Daemon 的可选模块。纯本地 embedded 模式下不加载任何 Channel。
139
+ - S0084: Telegram Bot API long polling;
140
+ - Feishu;
141
+ - Slack 或 Discord;
142
+ - WeCom,而不是微信个人号优先。
144
143
 
145
144
  ---
146
145
 
147
146
  ## 9. 延后项
148
147
 
149
- - IM Channel 具体实现(Telegram、企业微信、Slack)
150
- - cron Channel 调度模型
151
- - Channel 级别的消息去重/防抖(IM 群消息风暴)
152
- - Channel 权限(哪些群/用户能触发 agent)
153
-
154
- ---
155
-
156
- *Channel 从"所有输入的统一入口"收窄为"Daemon 内部的非交互式消息源适配器"。交互式 Entry 通过 DaemonClient 协议直连,不经过 Channel。*
148
+ - Telegram webhook mode;
149
+ - GUI extension management;
150
+ - extension marketplace / signing / sandbox;
151
+ - extension MCP server startup;
152
+ - proactive cross-conversation send;
153
+ - cron / webhook channel。
@@ -137,7 +137,7 @@ GUI 和 WebUI 的添加流程统一为:
137
137
  4. 调用 `registerProject(workDir)`。
138
138
  5. Host canonicalize 路径并返回 Project。
139
139
 
140
- 本地和远程使用同一套协议。远程 GUI 通过 SSH proxy 接入时,目录浏览仍由远端 Host 完成。
140
+ 本地和远程使用同一套 Host API。M9 GUI 远程路径只使用 Relay;M10 SSH proxy 接入时,目录浏览仍由远端 Host 完成。
141
141
 
142
142
  ### 2.3 Trusted Full Access
143
143
 
@@ -231,7 +231,7 @@ const transport = new WsTransport({ url, token });
231
231
  // Hosted WebUI / Relay device routing
232
232
  const transport = new RelayTransport({ relayUrl, deviceId, clientId });
233
233
 
234
- // GUI-managed remote device
234
+ // M10 GUI-managed SSH remote device
235
235
  const transport = await createSshProxyTransport(sshConfig);
236
236
 
237
237
  // Pure HTTP integration
@@ -241,8 +241,8 @@ const client = new HttpScorelClient({ baseUrl, token });
241
241
  规则:
242
242
 
243
243
  - Embedded 和 WebSocket 是当前已实现 transport。
244
- - RelayTransport 是后续 hosted WebUI / generic WebUI 的默认远程路径:Entry 和 Host 都连接 Relay,Relay 根据 `deviceId -> clientId` 授权关系转发现有 daemon wire payload。
245
- - GUI 默认通过 SSH 启动或连接远端 Scorel,再使用 stdio proxy 转发协议。
244
+ - RelayTransport hosted WebUI M9 GUI 的默认远程路径:Entry 和 Host 都连接 Relay,Relay 根据 `deviceId -> clientId` 授权关系转发现有 daemon wire payload。
245
+ - SSH 启动或连接远端 Scorel 属于 M10,通过 stdio proxy 转发协议。
246
246
  - 已经部署好的 Host 可作为高级入口直接使用 WS URL + token。
247
247
  - HTTP API 是独立 adapter:命令走 HTTP request,事件走 SSE。它映射同一 Host use cases,不复制业务逻辑。
248
248
  - 不恢复 Unix socket transport;S0043 已删除该产品路径。
@@ -303,11 +303,17 @@ GUI 同时管理本地和远程环境,采用 Project-first:
303
303
  ```text
304
304
  Project
305
305
  ├── Local Device
306
- └── Remote Device
306
+ └── Relay Device
307
307
  ```
308
308
 
309
309
  两种视图都只使用同一组 Host API。区别只是入口和信息架构,不是后端模型分叉。
310
310
 
311
+ GUI 的远程 Project 可见性不同于 WebUI:
312
+
313
+ - Local Projects:展示 local Host Registry 全集。
314
+ - Relay Projects:只展示用户在 GUI 中显式选择过的 `deviceId + projectId`。
315
+ - GUI 不把远程 Host Registry 全集自动映射成主 Project list。
316
+
311
317
  ---
312
318
 
313
319
  ## 7. Pre-1.0 切换规则