cs-bots 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cs-bots contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,165 @@
1
- # Temporary Holding Version
1
+ # cs-bots
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **DSH 多智能体协作平台**——一个自足的插件:装上它,你就有了跨会话任务板、房间群聊、分层记忆、可独立工作目录的 Bot 注册表。
4
+
5
+ > **零第三方运行时依赖**:不依赖 `my-free-model` / `dsh-memory-evolve` / `cs-bot-bea` / `ds-bot` 等任何其他插件。
6
+ > 只依赖 DSH 本体自带的官方包(随 DSH 安装,不算第三方)。
7
+
8
+ ---
9
+
10
+ ## 安装
11
+
12
+ ### 通道 1:npm(推荐,稳定)
13
+
14
+ ```bash
15
+ dsh plugin --profile web add cs-bots
16
+ ```
17
+
18
+ ### 通道 2:git(github)
19
+
20
+ ```bash
21
+ dsh plugin --profile web add github:7358716/cs-bots#v0.1.0
22
+ ```
23
+
24
+ > ⚠️ **已知环境事实**:`github.com:443` 在某些网络下**间歇不可达**(DNS 正常、TCP 超时)。
25
+ > 若 git 通道失败:先重试一次,仍失败则改用 npm 通道。
26
+
27
+ ### 一条命令装 + 自检(强烈建议)
28
+
29
+ ```bash
30
+ bash install.sh --channel npm # 或 --channel git
31
+ ```
32
+
33
+ **自检为什么必要**:`link:` 断链或 bundle 未进 `dsh.profile.bundles` 时,DSH **只打一行
34
+ `skipping profile bundle` 就静默跳过**——页面照常 HTTP 200,功能全失效。
35
+ `install.sh` 用 `dsh --profile <p> --dump-config` 验证**装配树里真有本插件的行**,
36
+ 并检查 `agent-team.maxMembers` 是否已解封、状态目录是否可写。
37
+
38
+ 退出码:`0`=装好且自检通过;`1`=安装失败;**`2`=装了但自检不通过**(最危险,必须处理)。
39
+
40
+ #### ⚠️ 一个必踩的坑:**bundle 层序**
41
+
42
+ `dsh plugin add` 只往 `dsh.profile.bundles` **末尾追加**。而 bundle patch 按 **bundles 顺序**依次应用,
43
+ 之后才是 profile 自己的 patch。
44
+
45
+ ⇒ **本插件必须排在 `@deepseek-ai/dsh-experimental-agent-team-profile` 之后**,
46
+ 否则我们对 `agent-team.maxMembers` 的**覆盖会在目标行还不存在时执行 → 被静默跳过**(`entry not found`)。
47
+
48
+ **实测复现**(2026-11-02):先装 `cs-bots`、后装 `agent-team-profile` → `maxMembers` 仍是 `8`。
49
+
50
+ `install.sh` 会**检测并自动重排**(备份为 `package.json.bak-cs-bots-order`),
51
+ 然后以 **exit=2** 提示「需重启 DSH 后重跑自检」。
52
+
53
+ 手动安装时请**先启用 agent-team,再装本插件**;或装完跑一次 `install.sh --check-only` 让它修正。
54
+
55
+ #### 另一个坑:**不要用 npm 装 agent-team-profile**
56
+
57
+ `dsh plugin add @deepseek-ai/dsh-experimental-agent-team-profile` 会从 registry 拉到**另一个版本**
58
+ (实测拉到 `0.1.5-alpha.2`,而 dsh 自带的是 `0.2.1-rc.2`)。
59
+ 正确做法:**只在 `dsh.profile.bundles` 里按名引用**(不装包),它会从 dsh 安装目录解析,版本天然对齐。
60
+
61
+ ---
62
+
63
+ ## 装好后你得到什么
64
+
65
+ **16 个模型可见工具**(`bot_` 前缀,避免与其他插件撞名):
66
+
67
+ ### 任务板(跨会话)
68
+ | 工具 | 用途 |
69
+ |---|---|
70
+ | `bot_task_create` | 建任务(支持依赖 DAG、优先级、`sourceSeq` 幂等) |
71
+ | `bot_task_list` | 列任务 |
72
+ | `bot_task_ready` | **就绪任务**(依赖全完成的 pending),领活用 |
73
+ | `bot_task_update` | CAS 推进:`claim`/`heartbeat`/`release`/`complete`/`reopen`/`block`/`unblock`/`delete`/`set` |
74
+ | `bot_task_accept` | 验收(`pass`/`reject`)——官方**没有**这个动作 |
75
+
76
+ ### 唤醒桥
77
+ | 工具 | 用途 |
78
+ |---|---|
79
+ | `bot_wake` | 定向唤醒会话(`dedupKey` 去重,防唤醒风暴) |
80
+
81
+ ### Bot 注册表(**独立工作目录**)
82
+ | 工具 | 用途 |
83
+ |---|---|
84
+ | `bot_roster_create` | 建持久 Bot(`cwd` 独立,**cwd 同时是它的写入边界**) |
85
+ | `bot_roster_list` | 列出(可选含已退役) |
86
+ | `bot_roster_manage` | `rename`/`retire`/`setCwd`/`claim`/`release`/`heartbeat` |
87
+
88
+ ### 房间群聊
89
+ | 工具 | 用途 |
90
+ |---|---|
91
+ | `bot_room_create` | 建房间 |
92
+ | `bot_room_post` | 发言(**确定性写入**:直接落盘,不经模型转手) |
93
+ | `bot_room_read` | 读消息(带 `seq` 游标,可断点续传) |
94
+ | `bot_room_body` | 取长正文全文(长消息自动落旁路文件) |
95
+
96
+ ### 分层记忆
97
+ | 工具 | 用途 |
98
+ |---|---|
99
+ | `bot_memory_add` | 写入(L0–L5 六层;`explicit:true` 受保护) |
100
+ | `bot_memory_search` | 检索(FTS5 trigram,缺则退化字面匹配) |
101
+ | `bot_memory_context` | 取常驻注入文本(L0–L3) |
102
+
103
+ ---
104
+
105
+ ## 设计要点(为什么这样)
106
+
107
+ ### 1. 为什么持久 Bot 不走官方 `spawn_teammate`
108
+
109
+ **实测硬事实**:官方 `SpawnTeammateRequest` 只有 6 个字段(`name`/`description`/`prompt`/`context`/`provider`/`signal`)——**没有 `cwd`**;
110
+ 子会话由 `childSessionMeta()` 强制继承父会话 cwd;而 **cwd 同时就是 fs 写入边界**。
111
+ ⇒ 一支官方 Team 的全体成员共享同一目录、会互相覆盖文件。
112
+
113
+ **本平台的解法**:持久 Bot 走 `ctx.agents.create({ meta: { cwd } })`(官方唯一能指定目录的路径),
114
+ 拿独立写入边界;`spawnTeammate` 只用于同目录的轻量分工。
115
+
116
+ ### 2. 为什么自建任务板
117
+
118
+ 官方 Agent Teams 的任务板 **`TeamId = SessionId`**(每会话一块),且 roster 是 **flat immutable**
119
+ (无改名、无删除、名字永不复用)。⇒ 跨会话统一任务板与可维护的 Bot 注册表都必须自建。
120
+
121
+ ### 3. 为什么禁 `ask_user_question`
122
+
123
+ 在多智能体结构里,**同步等用户的提问工具会堵死整条投递链**
124
+ (依据:`ds-bot` 源码注释 —— *"every message from another Bot or a group round queues behind it"*)。
125
+ 本平台对 Bot 会话双层移除:`tools.guard` 同步闸门 + `agent/created` 时 `restrict({deny})`。
126
+
127
+ ---
128
+
129
+ ## 开发
130
+
131
+ ```bash
132
+ bash test/run-all.sh # 单入口:零依赖 CI + 全部单测,任一失败退出码非 0
133
+ bash test/ci-zero-dep.sh # 只跑零依赖 CI(4 项机械检查)
134
+ ```
135
+
136
+ **零依赖 CI 四项检查**(防止依赖悄悄长回来):
137
+ 1. `src/` 下除 `kernel.js` 外,任何文件不得**真实 import** `@deepseek-ai/*`(注释里的字面量不算)
138
+ 2. `package.json` 的 `dependencies` 必须不存在或为空
139
+ 3. `cordis.patch.yml` 每个 `name` 只能是本包或官方包
140
+ 4. 覆盖官方行时必须列全 `config` 字段(漏字段会让整个 profile 起不来)
141
+
142
+ ---
143
+
144
+ ## 状态目录
145
+
146
+ ```
147
+ $DSH_HOME/cs-bots/
148
+ ├── board.jsonl 任务板事件流(真相源)
149
+ ├── board.snap.json 任务板快照
150
+ ├── roster.jsonl Bot 注册表事件流
151
+ ├── roster.snap.json
152
+ ├── wakes.jsonl 唤醒审计(终态记录)
153
+ ├── rooms/<roomId>/log.jsonl 房间消息(不截断)
154
+ ├── rooms/<roomId>/bodies/*.txt 长正文旁路
155
+ ├── memory.jsonl 记忆事件流
156
+ ├── memory.snap.json
157
+ └── memory-fts.db FTS5 检索索引(派生缓存,可重建)
158
+ ```
159
+
160
+ ---
161
+
162
+ ## 许可
163
+
164
+ MIT。设计上借鉴了 `ds-bot`(Apache-2.0)的 work 树/投递漏斗、`cs-bot-bea`(MIT)的惰性获取/
165
+ 原子写/ErrorBoundary 等工程做法,均为**思路与模式借鉴**,未复制其运行时代码。
@@ -0,0 +1,31 @@
1
+ # cs-bots 可选增强 patch —— 解除官方 Agent Teams 的 8 人上限
2
+ #
3
+ # ⚠️ **本文件默认不生效**。它不在 `dsh.bundle.patch` 里,需要显式并入 profile 的
4
+ # cordis.patch.yml(或由 install.sh --with-agent-team-override 自动并入)。
5
+ #
6
+ # 为什么单独拆出来:覆盖官方行的 `config` 是**整体替换**(逐 key),必须重述全部
7
+ # 4 个字段。若目标 DSH 版本 schema 少任何一个字段 → config 校验失败 →
8
+ # **整个 profile 起不来**("重启报错、必须禁用插件"的典型故障)。
9
+ # 我们在 0.2.1-rc.2 上验证过;rc1/rc5 未验证,故默认不启用。
10
+ #
11
+ # 前置条件(三条缺一不可):
12
+ # 1. profile 已启用 @deepseek-ai/dsh-experimental-agent-team-profile
13
+ # 2. 本 bundle(cs-bots)在 dsh.profile.bundles 中**排在 agent-team-profile 之后**
14
+ # (bundle patch 按 bundles 顺序应用;排在前面时目标行还不存在 → 被静默跳过)
15
+ # 3. 目标版本的 agent-team config **确实**是这 4 个字段
16
+ #
17
+ # 用法:
18
+ # bash install.sh --check-only # 会检查层序并自动修正
19
+ #
20
+ # 官方依据(0.2.1-rc.2 实测):
21
+ # · dsh-experimental-agent-team/lib/index.js:1420 const DEFAULT_MAX_MEMBERS = 16
22
+ # · 同文件 :1439 maxMembers: z.number().step(1).min(1).default(DEFAULT_MAX_MEMBERS)
23
+ # → 默认 16、无上限;本机看到 8 是 agent-team-profile 的 patch 主动压下去的
24
+
25
+ - id: agent-team
26
+ name: '@deepseek-ai/dsh-experimental-agent-team'
27
+ config:
28
+ maxMembers: 32
29
+ maxTasks: 256
30
+ maxMessageBytes: 65536
31
+ disposalTimeoutMs: 5000
@@ -0,0 +1,30 @@
1
+ # cs-bots bundle patch —— **只 insert 自己,绝不动官方行**(默认最安全)。
2
+ #
3
+ # 安装:dsh plugin --profile web add git+ssh://git@github.com/7358716/cs-bots.git#v0.1.1
4
+ # 本 patch 由 bundle 机制自动应用,**不要**再往 profile 的 cordis.patch.yml 手动
5
+ # insert 同一 id(重复 loader entry id 会让加载失败)。
6
+ #
7
+ # ─────────────────────────────────────────────────────────────────────────────
8
+ # 【2026-11-03 重要变更】原来的「覆盖 agent-team.maxMembers」已**移出默认 patch**
9
+ #
10
+ # 原因(真实风险,非理论):覆盖官方行的 `config` 是**整体替换**(逐 key),
11
+ # 所以我们必须重述 agent-team 的全部 4 个字段(maxMembers / maxTasks /
12
+ # maxMessageBytes / disposalTimeoutMs)。**若目标 DSH 版本的 schema 少了其中任何
13
+ # 一个字段 → config 校验失败 → 整个 profile 起不来** ——
14
+ # 这正是「重启 DSH 报错、必须禁用插件才能打开」那一类故障。
15
+ #
16
+ # 我们在 0.2.1-rc.2 上实测过该 schema,但主管环境是 rc1(可升 rc5),
17
+ # 版本面不同 → 为不拿宿主启动冒险,**默认不覆盖**。
18
+ #
19
+ # ⇒ 想要「解除官方 Team 的 8 人上限」,用显式开关:
20
+ # bash install.sh --channel git --with-agent-team-override
21
+ # 或手动把同目录的 `cordis.patch.agent-team.yml` 内容并入 profile 的
22
+ # cordis.patch.yml(并确认本 bundle 排在 agent-team-profile **之后**)。
23
+ #
24
+ # 注:**不覆盖也不影响本平台核心能力** —— 本平台的 Bot 注册表(RosterService)
25
+ # 走 root agent + 独立 cwd,**不受官方 maxMembers 约束**。覆盖只是让"官方 Team
26
+ # 也能超过 8 人",属锦上添花。
27
+
28
+ - insert:
29
+ - id: cs-bots
30
+ name: 'cs-bots'
package/install.sh ADDED
@@ -0,0 +1,218 @@
1
+ #!/usr/bin/env bash
2
+ # cs-bots 安装器 —— 装 + **自检**(一条命令完成)。
3
+ #
4
+ # 为什么必须有自检(硬约束 E4'):
5
+ # `link:` 断链 / 版本错位 / bundle 未进 `dsh.profile.bundles` 时,DSH **只打一行
6
+ # `skipping profile bundle` 就静默跳过** —— 页面照常 HTTP 200,功能全失效。
7
+ # ⇒ 「页面能打开」不等于「插件装好了」。本脚本用 `--dump-config` 验证**装配树里真有我们的行**。
8
+ #
9
+ # 用法:
10
+ # bash install.sh # 默认:npm 通道,profile=web
11
+ # bash install.sh --channel git # github:7358716/cs-bots#<ref>
12
+ # bash install.sh --profile desktop # 换 profile
13
+ # bash install.sh --check-only # 只自检,不安装
14
+ # bash install.sh --ref v0.1.0 # 指定 git tag(默认 main)
15
+ # bash install.sh --with-agent-team-override # 可选:解除官方 Team 8 人上限
16
+ # (会改 agent-team 的 config,旧版本有 schema 风险)
17
+ #
18
+ # 退出码:0 = 安装且自检通过;1 = 安装失败;2 = 装了但**自检不通过**(最危险,必须显式暴露)
19
+ set -uo pipefail
20
+
21
+ PKG_NAME="cs-bots"
22
+ BUNDLE_ID="cs-bots"
23
+ REPO="7358716/cs-bots"
24
+
25
+ CHANNEL="npm"
26
+ PROFILE="web"
27
+ REF="main"
28
+ CHECK_ONLY=0
29
+ NEED_RESTART=0
30
+ WITH_TEAM_OVERRIDE=0
31
+
32
+ while [ $# -gt 0 ]; do
33
+ case "$1" in
34
+ --channel) CHANNEL="${2:-}"; shift 2 ;;
35
+ --profile) PROFILE="${2:-}"; shift 2 ;;
36
+ --ref) REF="${2:-}"; shift 2 ;;
37
+ --check-only) CHECK_ONLY=1; shift ;;
38
+ --with-agent-team-override) WITH_TEAM_OVERRIDE=1; shift ;;
39
+ -h|--help) sed -n '2,20p' "$0"; exit 0 ;;
40
+ *) echo "未知参数: $1" >&2; exit 1 ;;
41
+ esac
42
+ done
43
+
44
+ say() { printf '%s\n' "$*"; }
45
+ die() { printf '❌ %s\n' "$*" >&2; exit 1; }
46
+
47
+ # ── 0. 前置检查 ──────────────────────────────────────────────────────────────
48
+ say "════════ cs-bots 安装器 ════════"
49
+ say " 通道 : $CHANNEL"
50
+ say " profile : $PROFILE"
51
+ [ "$CHECK_ONLY" -eq 1 ] || say " 版本 : $REF"
52
+
53
+ command -v dsh >/dev/null 2>&1 || die "找不到 dsh 命令(请先装 DeepSeek Harness 并在 PATH 里)"
54
+
55
+ # ── 1. 安装 ──────────────────────────────────────────────────────────────────
56
+ if [ "$CHECK_ONLY" -eq 0 ]; then
57
+ case "$CHANNEL" in
58
+ npm)
59
+ # 首选通道:npmmirror 稳定(实测 200)。dsh plugin 转发 pnpm。
60
+ say ""
61
+ say "▶ 安装(npm)..."
62
+ if ! dsh plugin --profile "$PROFILE" add "$PKG_NAME"; then
63
+ die "npm 安装失败。兜底:改用 --channel git(需 github.com 可达)或本地 tarball。"
64
+ fi
65
+ ;;
66
+ git)
67
+ # 次选:github.com **间歇可达**(实测曾 3/3 成功、也曾 0/5 超时)
68
+ say ""
69
+ say "▶ 安装(git: github:$REPO#$REF)..."
70
+ if ! dsh plugin --profile "$PROFILE" add "github:$REPO#$REF"; then
71
+ cat >&2 <<'EOF'
72
+ ❌ git 通道失败。
73
+
74
+ 已知事实(本机实测):github.com:443 **间歇不可达**(DNS 正常、TCP 超时),
75
+ 而 api.github.com / codeload.github.com 稳定;本机**无私钥**故 SSH 必失败。
76
+
77
+ 处置顺序:
78
+ 1) 重试一次(间歇性)
79
+ 2) 换 npm 通道:bash install.sh --channel npm
80
+ 3) 走 tarball:先下载再 add ./cs-bots-<ver>.tgz
81
+ EOF
82
+ exit 1
83
+ fi
84
+ ;;
85
+ *) die "未知通道: $CHANNEL(支持 npm | git)" ;;
86
+ esac
87
+ fi
88
+
89
+ # ── 1.5 可选:并入 agent-team 覆盖(默认不做,见 cordis.patch.yml 顶部说明)──
90
+ if [ "$WITH_TEAM_OVERRIDE" -eq 1 ]; then
91
+ say ""
92
+ say "▶ 启用可选覆盖:解除官方 Team 8 人上限"
93
+ PROFILE="$PROFILE" BUNDLE_ID="$BUNDLE_ID" python3 - <<'PY2'
94
+ import json, os, shutil
95
+ prof = os.path.expanduser(f"~/.dsh/profiles/{os.environ['PROFILE']}")
96
+ pkg = os.path.join(prof, "package.json")
97
+ shutil.copyfile(pkg, pkg + ".bak-cs-bots-override")
98
+ d = json.load(open(pkg, encoding="utf-8"))
99
+ b = d.get("dsh", {}).get("profile", {}).get("bundles", [])
100
+ me = os.environ["BUNDLE_ID"]
101
+ if me in b: # 确保本包最后(覆盖要在 agent-team 行之后执行)
102
+ b[:] = [x for x in b if x != me] + [me]
103
+ json.dump(d, open(pkg, "w", encoding="utf-8"), indent=2, ensure_ascii=False)
104
+ open(pkg, "a", encoding="utf-8").write("\n")
105
+ print(" 已确保层序:", b)
106
+ print(" 提示:请把 cordis.patch.agent-team.yml 的内容并入 profile 的 cordis.patch.yml")
107
+ print(" (profile 自己的 patch 在所有 bundle 之后应用,能确保覆盖到 agent-team 行)")
108
+ PY2
109
+ NEED_RESTART=1
110
+ fi
111
+
112
+ # ── 2. 自检(**这一步才是关键**)─────────────────────────────────────────────
113
+ say ""
114
+ say "▶ 自检:验证装配树里真有我们的行(不是只看页面能不能打开)..."
115
+
116
+ DUMP="$(dsh --profile "$PROFILE" --dump-config 2>/dev/null)"
117
+ if [ -z "$DUMP" ]; then
118
+ say "⚠️ --dump-config 无输出 → 无法自检(DSH 版本过旧?)"
119
+ say " 手工确认:dsh --profile $PROFILE --dump-config | grep -n '$BUNDLE_ID'"
120
+ exit 2
121
+ fi
122
+
123
+ # 判据 1:我们的 bundle 行在装配树里
124
+ if printf '%s\n' "$DUMP" | grep -qE "id:[[:space:]]*$BUNDLE_ID\b"; then
125
+ say " ✅ bundle 行已进入装配树(id: $BUNDLE_ID)"
126
+ else
127
+ say " ❌ **装配树里没有 $BUNDLE_ID** —— 插件没真正挂上"
128
+ say " 常见原因:只在 dependencies、没进 dsh.profile.bundles(DSH 会静默跳过)"
129
+ exit 2
130
+ fi
131
+
132
+ # 判据 2:**层序** —— 本包必须在 agent-team-profile 之后(否则覆盖静默失效)
133
+ # 实测(2026-11-02):`dsh plugin add` 只往 bundles **末尾追加**;若先装本插件、
134
+ # 后装 agent-team-profile,本包的覆盖 patch 会在 agent-team 行还不存在时执行 →
135
+ # 被 warn 跳过 → maxMembers 仍是 8。
136
+ ORDER_OK="$(PROFILE="$PROFILE" BUNDLE_ID="$BUNDLE_ID" python3 - <<'PY'
137
+ import json, os
138
+ p = os.path.expanduser(f"~/.dsh/profiles/{os.environ['PROFILE']}/package.json")
139
+ try:
140
+ d = json.load(open(p, encoding="utf-8"))
141
+ except Exception:
142
+ print("UNKNOWN"); raise SystemExit(0)
143
+ b = d.get("dsh", {}).get("profile", {}).get("bundles", [])
144
+ me = os.environ["BUNDLE_ID"]
145
+ tm = "@deepseek-ai/dsh-experimental-agent-team-profile"
146
+ if me not in b or tm not in b:
147
+ print("SKIP"); raise SystemExit(0)
148
+ print("OK" if b.index(me) > b.index(tm) else "REORDER")
149
+ PY
150
+ )"
151
+
152
+ case "$ORDER_OK" in
153
+ OK)
154
+ say " ✅ 层序正确($BUNDLE_ID 在 agent-team-profile 之后)"
155
+ ;;
156
+ REORDER)
157
+ say " ⚠️ 层序错误:$BUNDLE_ID 排在 agent-team-profile **之前** → 覆盖会静默失效"
158
+ say " 正在自动修正(把 $BUNDLE_ID 移到 bundles 末尾)..."
159
+ PROFILE="$PROFILE" BUNDLE_ID="$BUNDLE_ID" python3 - <<'PY'
160
+ import json, os, shutil
161
+ p = os.path.expanduser(f"~/.dsh/profiles/{os.environ['PROFILE']}/package.json")
162
+ shutil.copyfile(p, p + ".bak-cs-bots-order")
163
+ d = json.load(open(p, encoding="utf-8"))
164
+ b = d["dsh"]["profile"]["bundles"]
165
+ me = os.environ["BUNDLE_ID"]
166
+ b[:] = [x for x in b if x != me] + [me]
167
+ json.dump(d, open(p, "w", encoding="utf-8"), indent=2, ensure_ascii=False)
168
+ open(p, "a", encoding="utf-8").write("\n")
169
+ print(f" 已重排:{b}")
170
+ PY
171
+ say " (原文件已备份为 package.json.bak-cs-bots-order)"
172
+ NEED_RESTART=1
173
+ ;;
174
+ SKIP)
175
+ say " ⚠️ 目标 profile 未启用 agent-team-profile → 层序无关(平台降级运行)"
176
+ ;;
177
+ *)
178
+ say " ⚠️ 无法判定层序(profile package.json 读取失败)"
179
+ ;;
180
+ esac
181
+
182
+ # 判据 3:我们覆盖的 maxMembers 真的生效(P1 路径 A 的验收点)
183
+ MM="$(printf '%s\n' "$DUMP" | grep -A 12 "id:[[:space:]]*agent-team$" | grep -oE "maxMembers:[[:space:]]*[0-9]+" | head -1 | grep -oE '[0-9]+')"
184
+ if [ -n "$MM" ]; then
185
+ if [ "$MM" -ge 32 ]; then
186
+ say " ✅ agent-team.maxMembers = $MM(可选覆盖已生效,官方默认 16)"
187
+ else
188
+ say " ℹ️ agent-team.maxMembers = $MM(未覆盖 —— **这是默认状态,不影响平台核心能力**)"
189
+ say " 本平台的 Bot 注册表走 root agent + 独立 cwd,不受官方上限约束。"
190
+ say " 想让官方 Team 也超过 8 人:bash install.sh --with-agent-team-override"
191
+ fi
192
+ else
193
+ say " ⚠️ 未找到 agent-team 行 → 目标 profile 未启用实验性 Agent Teams"
194
+ say " 平台将降级为「仅内建域服务」(符合缺服务不阻塞的纪律)"
195
+ fi
196
+
197
+ # 判据 3:状态目录可写(不然任务板/记忆全是内存态,重启即丢)
198
+ DSH_HOME_DIR="${DSH_HOME:-$HOME/.dsh}"
199
+ STATE_DIR="$DSH_HOME_DIR/$BUNDLE_ID"
200
+ if mkdir -p "$STATE_DIR" 2>/dev/null && [ -w "$STATE_DIR" ]; then
201
+ say " ✅ 状态目录可写:$STATE_DIR"
202
+ else
203
+ say " ❌ 状态目录不可写:$STATE_DIR(任务板/记忆无法落盘)"
204
+ exit 2
205
+ fi
206
+
207
+ say ""
208
+ if [ "$NEED_RESTART" -eq 1 ]; then
209
+ say "⚠️ 已安装,但**层序刚被修正,需重启 DSH 才生效**。"
210
+ say " 请:① 重启 DSH ② 重跑 bash install.sh --check-only --profile $PROFILE"
211
+ say " 在此之前 agent-team.maxMembers 仍是旧值(平台可用,但官方 Team 仍受旧上限约束)。"
212
+ exit 2
213
+ fi
214
+
215
+ say "✅ 安装并自检通过。"
216
+ say " 下一步:重启 DSH 后,在会话里应能看到 bot_* 工具(bot_task_create 等)。"
217
+ say " 若看不到工具:检查 tools 服务是否可用(本平台缺它时只 warn 不崩)。"
218
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "cs-bots",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "cs-bots — DSH 多智能体协作平台:跨会话任务板 / 房间群聊 / 分层记忆 / Bot 注册表(独立工作目录),零第三方运行时依赖",
6
+ "main": "src/index.js",
7
+ "exports": {
8
+ ".": "./src/index.js",
9
+ "./client": "./src/client.js",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "src",
14
+ "cordis.patch.yml",
15
+ "cordis.patch.agent-team.yml",
16
+ "install.sh",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "dsh": {
21
+ "bundle": {
22
+ "patch": "./cordis.patch.yml"
23
+ },
24
+ "client": {
25
+ "platform": "web"
26
+ }
27
+ },
28
+ "engines": {
29
+ "node": ">=22.5"
30
+ },
31
+ "scripts": {
32
+ "test": "bash test/run-all.sh",
33
+ "ci": "bash test/ci-zero-dep.sh",
34
+ "install:check": "bash install.sh --check-only"
35
+ },
36
+ "keywords": [
37
+ "dsh-plugin",
38
+ "deepseek-harness",
39
+ "dsh",
40
+ "multi-agent",
41
+ "agents",
42
+ "agent-teams",
43
+ "task-board",
44
+ "collaboration"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/7358716/cs-bots.git"
49
+ },
50
+ "homepage": "https://github.com/7358716/cs-bots#readme",
51
+ "bugs": {
52
+ "url": "https://github.com/7358716/cs-bots/issues"
53
+ },
54
+ "license": "MIT",
55
+ "publishConfig": {
56
+ "access": "public",
57
+ "registry": "https://registry.npmjs.org"
58
+ }
59
+ }