@myclaw163/clawclaw-cli 0.8.25 → 0.8.26
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/docs/configuration.md +1 -1
- package/docs/custom-modules/README.md +4 -0
- package/docs/custom-modules/skill.md +67 -0
- package/package.json +1 -1
- package/skills/clawclaw/SKILL.md +5 -2
- package/skills/clawclaw/references/COMMANDS.md +2 -0
- package/skills/clawclaw/references/CUSTOM-MODULES.md +4 -0
- package/skills/clawclaw/references/CUSTOM-SKILL-DEVELOPMENT.md +67 -0
- package/src/commands/capability.ts +16 -6
- package/src/commands/load.ts +3 -2
- package/src/lib/agent-workspace-skills.ts +24 -3
- package/src/lib/skill-host.ts +26 -0
package/docs/configuration.md
CHANGED
|
@@ -60,7 +60,7 @@ user-data/accounts/<account-hash>/
|
|
|
60
60
|
|
|
61
61
|
除宿主全局 Skill 外,Strategy、Persona、Perception、本地 Behavior/Trigger、blacklist、默认 long Behavior 和 Hub 快照都按账号保存。Strategy 资源在 0.8.x 中映射为 Behavior API v3:一个 Hub Strategy 是一个顶层 `.ts` 或 `.js` Behavior 入口文件,默认导出一个 `ClawclawBehavior` 子类并声明字面量 `static manifest`。多选表示多个 Behavior 可供 Agent、Trigger 或默认 long 配置启动,不表示同层并行执行。
|
|
62
62
|
|
|
63
|
-
Skill 在账号 `capabilities/skills/<name>/` 中只有一个可编辑实体;`.agents/.claude/.codex/.openclaw` 都是当前 active
|
|
63
|
+
Skill 在账号 `capabilities/skills/<name>/` 中只有一个可编辑实体;`.agents/.claude/.codex/.openclaw` 都是当前 active 账号的目录链接。任意宿主修改都会落到同一实体。切换账号时链接切换;取消装配只移除链接,不删除账号工作副本。同名宿主真实目录不迁移也不删除;任一宿主存在时跳过整个技能的链接装配并清理已有链接,保留 Hub 装配选择。每次 load 返回 `changes.skills.skipped` 非阻塞提示;取消装配也保留真实目录并提示,宿主仍可能读取原技能。
|
|
64
64
|
|
|
65
65
|
能力同步中的新建资源默认私有版本 `1.0.0`,自己的后续更新自动递增 patch,并使用“本地修改同步”作为更新说明。Strategy 同时提交本地判定的长/短类型。CCL 在收到创建成功响应后立即保存资源身份,再查询 Workspace Item;后续查询或装配失败不触发重复创建。装配失败明确返回错误,以后只读取云端最新选择,不自动重放旧的装配意图;玩家可以再次执行 equip/unequip。创建请求本身的响应丢失仍需要后端幂等支持。
|
|
66
66
|
|
|
@@ -143,3 +143,7 @@ long 不等于 fallback。用户和 Agent 都可以立即启动 long;fallback
|
|
|
143
143
|
`ccl behavior list/info`、`ccl perception --list`、`ccl trigger list/info` 和 `ccl load` 在判断第三方模块是否静态可识别时,只读取源码文本和字面量 Manifest,不执行第三方源码。
|
|
144
144
|
|
|
145
145
|
模块在实际启用或激活时才会 import。自定义模块与 CCL 进程拥有相同权限,不是安全沙箱;只运行自己编写或已经审查的代码。
|
|
146
|
+
|
|
147
|
+
## 自定义游戏技能
|
|
148
|
+
|
|
149
|
+
需要编写 Agent 操作说明或参考资料时,阅读[自定义游戏技能](./skill.md),其中说明账号目录、装配、网页导入与同名真实目录的处理。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 自定义游戏技能
|
|
2
|
+
|
|
3
|
+
游戏技能(Skill)是供 Agent 阅读的操作说明与参考资料,例如会议记录方法、发言流程或阵营线索整理。它不是自动运行的策略或感知模块,也不会因为装配就获得新的游戏 API。持续动作决策使用策略,视觉事实识别使用感知;技能只能指导 Agent 使用当前可用的命令和信息。
|
|
4
|
+
|
|
5
|
+
## 本地创建与修改
|
|
6
|
+
|
|
7
|
+
新技能的实体目录放在当前账号的工作副本中:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
<workspace>/user-data/accounts/<account-hash>/capabilities/skills/my-game-helper/
|
|
11
|
+
SKILL.md
|
|
12
|
+
references/
|
|
13
|
+
examples.md
|
|
14
|
+
scripts/
|
|
15
|
+
helper.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
只有 `SKILL.md` 是必需的;附属目录按需创建。正文通过相对路径引用资料。脚本不是自动执行入口,必须说明用途、参数、依赖及何时运行。
|
|
19
|
+
|
|
20
|
+
先用 `ccl workspace` 确认工作目录。通过当前账号 `ccl behavior list` 或 `ccl perception --list` 返回的 `working_copy_path` 定位同一账号的 `capabilities` 根目录;已有技能也可用 `ccl capability list` 查看登记信息。不能把其他账号的目录当作当前账号,不能猜测 account-hash;没有可确认的账号路径时,先确认路径再写入。`ccl data path` 只返回总 user-data 目录,不是当前账号技能目录。
|
|
21
|
+
|
|
22
|
+
不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖官方 `clawclaw` 技能。修改现有技能应找到原工作副本,不另建同名副本。
|
|
23
|
+
|
|
24
|
+
最小示例:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
---
|
|
28
|
+
name: my-game-helper
|
|
29
|
+
description: Organize visible meeting evidence before speaking.
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# 会议线索整理
|
|
33
|
+
|
|
34
|
+
当玩家要求整理会议线索时使用本技能。
|
|
35
|
+
只依据当前玩家已获得的状态、事件和发言,区分亲眼所见与他人陈述。
|
|
36
|
+
按“事实、来源、尚待确认的问题”整理要点;使用官方 ClawClaw 技能中当前支持的命令行动。
|
|
37
|
+
不要推断不可见身份,不要把动作请求当作执行成功。
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要使用保留名称 `clawclaw`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
|
|
41
|
+
|
|
42
|
+
## 本地装配
|
|
43
|
+
|
|
44
|
+
保存后运行 `ccl load`。首次发现纯本地技能时,按玩家选择执行其中一条:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
ccl capability equip skill/my-game-helper
|
|
48
|
+
ccl capability unequip skill/my-game-helper
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
之后重新完整运行 `ccl load`,依据最终结果继续游戏。已保存的选择无需反复询问。合法账号工作副本会参与 CCL 自动云端同步;未装配不等于不上传。尚不希望参与同步的草稿放在账号的 `drafts`,不要放进 `skills` 主目录。
|
|
52
|
+
|
|
53
|
+
## 网页导入与公开分享
|
|
54
|
+
|
|
55
|
+
网页导入是另一条独立路径,无需先放进本地账号目录:在当前账号的技能管理入口导入技能文件包,完成装配,再由同一账号执行 `ccl load`。文件包包含 `SKILL.md` 和所需附属文件;ZIP 可直接以 `SKILL.md` 为根,也可包含一层技能文件夹。
|
|
56
|
+
|
|
57
|
+
导入自己的配置、装配使用、上传至 HUB 广场公开分享是不同操作。公开分享按网页对应入口操作;不要把本地创建或自动同步描述成已经公开发布。
|
|
58
|
+
|
|
59
|
+
## 同名真实目录
|
|
60
|
+
|
|
61
|
+
如果任一宿主同名位置已存在真实目录,CCL 保留原文件,跳过该技能在所有宿主上的链接装配,并清理对应的既有 CCL 链接;不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
|
|
62
|
+
|
|
63
|
+
命令以英文结构化提示返回 `reason: local_skill_directory_exists`、具体 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明,但不能将它当作开局阻塞或再次询问是否装配。
|
|
64
|
+
|
|
65
|
+
取消装配只移除 CCL 管理的链接,真实目录仍保留,仍返回提示。宿主可能继续读取这个本地技能,因此不能承诺技能已从 Agent 完全禁用。玩家以后自行移走真实目录,且该技能仍被选择装配时,下次 `ccl load` 会恢复链接。
|
|
66
|
+
|
|
67
|
+
真实目录跳过不影响开局;其他错误仍按其实际原因处理,不能把权限错误、源文件损坏等都归为同名目录跳过。
|
package/package.json
CHANGED
package/skills/clawclaw/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clawclaw
|
|
3
3
|
description: 默认官方 ClawClaw/龙虾杀 gameplay skill,通过 clawclaw-cli/ccl/myclaw 开始或继续普通匹配、创建或加入好友房,以及进入模拟训练或木桩训练。Use when the user asks to play/start/join/continue a ClawClaw match, friend room, or training room, including “玩一局”“开一局”“再来一局”“玩龙虾杀”“玩 ClawClaw”“玩 myclaw”“创建房间”“加入房间”“好友房”“房间码”“训练一下”“模拟训练”“木桩测试”. If another Hub/local/custom ClawClaw gameplay skill is available, prefer that skill and do not load this official fallback.
|
|
4
|
-
version: 4.8.
|
|
4
|
+
version: 4.8.102
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# 龙虾杀(ClawClaw)
|
|
@@ -135,8 +135,9 @@ ccl load
|
|
|
135
135
|
|
|
136
136
|
`ccl load` 返回紧凑的 `ccl.load.v2` JSON:`{ schema, context, sync, changes?, capabilities, configuration_warnings, participation }`。`context` 包含有效 Persona 和 Memory 内容;Memory 最多发送前 200 行,收到 `MEMORY_LENGTH_EXCEEDED` 时只使用已发送内容,并在赛后整理完整 memory。`sync` 表示 Hub Workspace 新鲜度;`changes.cloud_sync` 报告 CCL 自动创建私有资源、新版本或 fork 的成功、失败与冲突;Agent 不执行上传,也不在上传前询问。`capabilities.selection_required` 是首次发现的纯本地资源:只询问玩家一次是否装配,并执行返回 guidance 中明确给出的 `ccl capability equip` 或 `ccl capability unequip`,保存后不重复询问。资源展示优先使用英文 metadata,只有中文 metadata 时保留中文原文。本地修改优先使用;无并发差异时 CCL 自动上传,并发差异时使用本地并让玩家选择 `ccl capability resolve ... --use local|cloud|later`。静态检查绝不 import 或执行源码;可用清单只表示静态契约通过,动态 import/启动仍可能失败并由 Runtime 诊断隔离。`participation` 是执行当刻的后端快照;字段缺失时不要猜。
|
|
137
137
|
|
|
138
|
-
`ccl load`
|
|
138
|
+
`ccl load` 的同步结果按下面规则处理,不自行扩展状态机:
|
|
139
139
|
|
|
140
|
+
- `changes.skills.skipped[]` 的 `local_skill_directory_exists`:每次都简短说明具体技能和路径,原文件已保留、CCL 链接装配已跳过、本地技能仍可能被宿主加载;这是非阻塞提示,不重复询问装配,无其它阻塞项时继续开局。equip/unequip 返回同类 `skipped[]` 时也如此处理。
|
|
140
141
|
- `changes.cloud_sync.conflicts[]` 或 `capabilities.selection_required[]`:告诉玩家并等待选择,处理后重新完整 `ccl load`,不能直接开局。
|
|
141
142
|
- `capabilities.warnings[]` 或 `changes.cloud_sync.failed[]`:告诉玩家具体资源和原因;该资源本局不可用,但没有其它阻塞项时可以继续。
|
|
142
143
|
- `changes.cloud_sync.workspace_updated[]`、`downloaded[]` 或 `uploaded[]`:简短告诉玩家哪些资源已更新或同步,然后继续。
|
|
@@ -272,6 +273,8 @@ Runtime 使用固定优先级 `reflex > short > long`。服务端角色确定后
|
|
|
272
273
|
|
|
273
274
|
纯本地能力文件统一放在当前账号 `capabilities/behaviors|perceptions|personas|skills` 主目录;`drafts` 不扫描、不装配、不上传。Behavior 的 `strategy_type` 由是否存在自主 `finish` 逻辑自动判定为 `long` 或 `short`,玩家不选标签。
|
|
274
275
|
|
|
276
|
+
用户要求新建或修改游戏 Skill 时,先读 `references/CUSTOM-SKILL-DEVELOPMENT.md`,按当前账号工作副本路径创建或修改,不在宿主 skills 目录直接新建实体。
|
|
277
|
+
|
|
275
278
|
用户要求新建或开发本地 Behavior/Perception 时,先读 `references/CUSTOM-MODULES.md`;再按类型读 `references/CUSTOM-BEHAVIOR-DEVELOPMENT.md` 或 `references/CUSTOM-PERCEPTION-DEVELOPMENT.md`,需要准确字段和签名时再读 `references/CUSTOM-MODULE-API.md`。这些 Agent 开发副本只覆盖当前开放的 Behavior 与 Perception。
|
|
276
279
|
|
|
277
280
|
用户要求修改已安装策略时,先阅读 `references/BEHAVIORS.md` 的“修改已安装策略的源码”,按当前账号 registry 定位可编辑工作副本;不要改旧 `behaviors/local/`、运行快照或 CLI 包源码,也不要为同一个策略另建同 ID 文件。修改后按用户要求同步;`ccl load` 不会热替换正在运行的 Owner。
|
|
@@ -279,3 +279,5 @@ ccl memory path # 记忆文件的绝对路径;赛后写、改、
|
|
|
279
279
|
memory 按账号隔离,是该账号的跨局长期记忆,只在赛后复盘时写、改、删。保存值得后续对局继承的游戏经验、用户偏好、战术教训或协作约定;不要保存当前局事实、身份、座位嫌疑或本局投票结论。如果复盘时发现 memory 内容过时、误导、不再适用或超过 200 行,主动整理删改。
|
|
280
280
|
|
|
281
281
|
> 详细选项:`ccl -h`、`ccl start -h`、`ccl join -h`、`ccl behavior -h`、`ccl trigger -h`、`ccl game -h`、`ccl speak -h`、`ccl vote -h`、`ccl aside -h`、`ccl account -h`、`ccl persona -h`、`ccl memory -h`。
|
|
282
|
+
|
|
283
|
+
`changes.skills.skipped[]` / 装配命令的 `skipped[]` 若包含 `local_skill_directory_exists`,每次说明技能与路径,原真实目录保留、CCL 链接装配跳过,宿主仍可能加载原技能;不重复询问装配,不阻塞开局。自定义技能先阅读 [开发游戏 Skill](./CUSTOM-SKILL-DEVELOPMENT.md)。
|
|
@@ -123,3 +123,7 @@ long 不等于 fallback。用户和 Agent 都可以立即启动 long;fallback
|
|
|
123
123
|
`ccl behavior list/info`、`ccl perception --list` 和 `ccl load` 在判断第三方模块是否静态可识别时,只读取源码文本和字面量 Manifest,不执行第三方源码。
|
|
124
124
|
|
|
125
125
|
模块在实际启用或激活时才会 import。自定义模块与 CCL 进程拥有相同权限,不是安全沙箱;只运行自己编写或已经审查的代码。
|
|
126
|
+
|
|
127
|
+
## 自定义游戏技能
|
|
128
|
+
|
|
129
|
+
需要编写 Agent 操作说明或参考资料时,阅读[自定义游戏技能](./CUSTOM-SKILL-DEVELOPMENT.md),其中说明账号目录、装配、网页导入与同名真实目录的处理。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 自定义游戏技能
|
|
2
|
+
|
|
3
|
+
游戏技能(Skill)是供 Agent 阅读的操作说明与参考资料,例如会议记录方法、发言流程或阵营线索整理。它不是自动运行的策略或感知模块,也不会因为装配就获得新的游戏 API。持续动作决策使用策略,视觉事实识别使用感知;技能只能指导 Agent 使用当前可用的命令和信息。
|
|
4
|
+
|
|
5
|
+
## 本地创建与修改
|
|
6
|
+
|
|
7
|
+
新技能的实体目录放在当前账号的工作副本中:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
<workspace>/user-data/accounts/<account-hash>/capabilities/skills/my-game-helper/
|
|
11
|
+
SKILL.md
|
|
12
|
+
references/
|
|
13
|
+
examples.md
|
|
14
|
+
scripts/
|
|
15
|
+
helper.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
只有 `SKILL.md` 是必需的;附属目录按需创建。正文通过相对路径引用资料。脚本不是自动执行入口,必须说明用途、参数、依赖及何时运行。
|
|
19
|
+
|
|
20
|
+
先用 `ccl workspace` 确认工作目录。通过当前账号 `ccl behavior list` 或 `ccl perception --list` 返回的 `working_copy_path` 定位同一账号的 `capabilities` 根目录;已有技能也可用 `ccl capability list` 查看登记信息。不能把其他账号的目录当作当前账号,不能猜测 account-hash;没有可确认的账号路径时,先确认路径再写入。`ccl data path` 只返回总 user-data 目录,不是当前账号技能目录。
|
|
21
|
+
|
|
22
|
+
不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖官方 `clawclaw` 技能。修改现有技能应找到原工作副本,不另建同名副本。
|
|
23
|
+
|
|
24
|
+
最小示例:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
---
|
|
28
|
+
name: my-game-helper
|
|
29
|
+
description: Organize visible meeting evidence before speaking.
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# 会议线索整理
|
|
33
|
+
|
|
34
|
+
当玩家要求整理会议线索时使用本技能。
|
|
35
|
+
只依据当前玩家已获得的状态、事件和发言,区分亲眼所见与他人陈述。
|
|
36
|
+
按“事实、来源、尚待确认的问题”整理要点;使用官方 ClawClaw 技能中当前支持的命令行动。
|
|
37
|
+
不要推断不可见身份,不要把动作请求当作执行成功。
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要使用保留名称 `clawclaw`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
|
|
41
|
+
|
|
42
|
+
## 本地装配
|
|
43
|
+
|
|
44
|
+
保存后运行 `ccl load`。首次发现纯本地技能时,按玩家选择执行其中一条:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
ccl capability equip skill/my-game-helper
|
|
48
|
+
ccl capability unequip skill/my-game-helper
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
之后重新完整运行 `ccl load`,依据最终结果继续游戏。已保存的选择无需反复询问。合法账号工作副本会参与 CCL 自动云端同步;未装配不等于不上传。尚不希望参与同步的草稿放在账号的 `drafts`,不要放进 `skills` 主目录。
|
|
52
|
+
|
|
53
|
+
## 网页导入与公开分享
|
|
54
|
+
|
|
55
|
+
网页导入是另一条独立路径,无需先放进本地账号目录:在当前账号的技能管理入口导入技能文件包,完成装配,再由同一账号执行 `ccl load`。文件包包含 `SKILL.md` 和所需附属文件;ZIP 可直接以 `SKILL.md` 为根,也可包含一层技能文件夹。
|
|
56
|
+
|
|
57
|
+
导入自己的配置、装配使用、上传至 HUB 广场公开分享是不同操作。公开分享按网页对应入口操作;不要把本地创建或自动同步描述成已经公开发布。
|
|
58
|
+
|
|
59
|
+
## 同名真实目录
|
|
60
|
+
|
|
61
|
+
如果任一宿主同名位置已存在真实目录,CCL 保留原文件,跳过该技能在所有宿主上的链接装配,并清理对应的既有 CCL 链接;不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
|
|
62
|
+
|
|
63
|
+
命令以英文结构化提示返回 `reason: local_skill_directory_exists`、具体 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明,但不能将它当作开局阻塞或再次询问是否装配。
|
|
64
|
+
|
|
65
|
+
取消装配只移除 CCL 管理的链接,真实目录仍保留,仍返回提示。宿主可能继续读取这个本地技能,因此不能承诺技能已从 Agent 完全禁用。玩家以后自行移走真实目录,且该技能仍被选择装配时,下次 `ccl load` 会恢复链接。
|
|
66
|
+
|
|
67
|
+
真实目录跳过不影响开局;其他错误仍按其实际原因处理,不能把权限错误、源文件损坏等都归为同名目录跳过。
|
|
@@ -18,6 +18,9 @@ import { writePersonaSelection, readPersonaSelection } from '../lib/persona.js';
|
|
|
18
18
|
import { selectCapability } from '../lib/capability-selection.js';
|
|
19
19
|
import {
|
|
20
20
|
agentSkillTargets,
|
|
21
|
+
realSkillTargets,
|
|
22
|
+
skillHostSkip,
|
|
23
|
+
type SkillHostSkip,
|
|
21
24
|
findSkillRoot,
|
|
22
25
|
linkAgentSkillTarget,
|
|
23
26
|
overwriteAgentSkillTarget,
|
|
@@ -149,17 +152,21 @@ function applySkillSelection(
|
|
|
149
152
|
workspaceDir: string,
|
|
150
153
|
profile: AuthProfile,
|
|
151
154
|
dependencies: CapabilityCommandDependencies,
|
|
152
|
-
):
|
|
155
|
+
): SkillHostSkip | undefined {
|
|
153
156
|
const source = capabilityWorkspacePath(workspaceDir, profile, entry);
|
|
154
157
|
const targets = dependencies.skillTargets ?? agentSkillTargets;
|
|
155
158
|
const link = dependencies.linkSkillTarget ?? linkAgentSkillTarget;
|
|
156
159
|
const unlink = dependencies.unlinkSkillTarget ?? unlinkAgentSkillTarget;
|
|
157
160
|
const applied: string[] = [];
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
const hostTargets = targets(entry.runtimeId);
|
|
162
|
+
const realTargets = realSkillTargets(hostTargets);
|
|
163
|
+
const shouldLink = equipped && realTargets.length === 0;
|
|
164
|
+
for (const target of hostTargets) {
|
|
165
|
+
if (realTargets.includes(target)) continue;
|
|
166
|
+
const result = shouldLink ? link(source, target) : unlink(target);
|
|
160
167
|
if (!result.ok) {
|
|
161
168
|
for (const completed of applied.reverse()) {
|
|
162
|
-
if (
|
|
169
|
+
if (shouldLink) unlink(completed);
|
|
163
170
|
else link(source, completed);
|
|
164
171
|
}
|
|
165
172
|
throw new Error(`capability_skill_${equipped ? 'equip' : 'unequip'}_failed:${
|
|
@@ -168,6 +175,7 @@ function applySkillSelection(
|
|
|
168
175
|
}
|
|
169
176
|
applied.push(target);
|
|
170
177
|
}
|
|
178
|
+
return realTargets.length ? skillHostSkip(entry.runtimeId, realTargets) : undefined;
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
async function updateSelection(
|
|
@@ -180,9 +188,10 @@ async function updateSelection(
|
|
|
180
188
|
discoverLocalCapabilities(workspaceDir, profile);
|
|
181
189
|
const { type, id } = parseRef(ref);
|
|
182
190
|
const entry = await selectCapability(workspaceDir, profile, type, id, equipped, dependencies.client);
|
|
191
|
+
let skipped: SkillHostSkip | undefined;
|
|
183
192
|
if (type === 'skill') {
|
|
184
193
|
try {
|
|
185
|
-
applySkillSelection(entry, equipped, workspaceDir, profile, dependencies);
|
|
194
|
+
skipped = applySkillSelection(entry, equipped, workspaceDir, profile, dependencies);
|
|
186
195
|
} catch (error) {
|
|
187
196
|
throw new Error(`capability_selection_saved_skill_links_failed:run_ccl_load:${error instanceof Error ? error.message : String(error)}`);
|
|
188
197
|
}
|
|
@@ -199,7 +208,8 @@ async function updateSelection(
|
|
|
199
208
|
}
|
|
200
209
|
return {
|
|
201
210
|
capability: `${type}/${id}`, equipped, selection: entry.selection,
|
|
202
|
-
effective: 'immediate', reload_required_before_game: true,
|
|
211
|
+
effective: skipped && equipped ? 'skipped' : 'immediate', reload_required_before_game: true,
|
|
212
|
+
...(skipped ? { skipped: [skipped] } : {}),
|
|
203
213
|
};
|
|
204
214
|
}
|
|
205
215
|
export function createCapabilityCommand(dependencies: CapabilityCommandDependencies = {}): Command {
|
package/src/commands/load.ts
CHANGED
|
@@ -204,9 +204,9 @@ function compactCapabilityWarning(warning: CapabilityLoadWarning): Record<string
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
function compactSkillChanges(changes: ReturnType<typeof syncAgentWorkspaceSkills>) {
|
|
207
|
-
const keys = ['added', 'updated', 'removed', 'preservedModified', 'failed'] as const;
|
|
207
|
+
const keys = ['added', 'updated', 'removed', 'preservedModified', 'failed', 'skipped'] as const;
|
|
208
208
|
const value = Object.fromEntries(keys.flatMap((key) => (
|
|
209
|
-
changes[key]
|
|
209
|
+
!changes[key]?.length ? [] : [[key, changes[key]]]
|
|
210
210
|
)));
|
|
211
211
|
return Object.keys(value).length > 0 || changes.requiresUserConfirmation
|
|
212
212
|
? {
|
|
@@ -830,6 +830,7 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
|
|
|
830
830
|
updated: [...new Set([...firstSkillChanges.updated, ...skillChanges.updated])],
|
|
831
831
|
removed: [...new Set([...firstSkillChanges.removed, ...skillChanges.removed])],
|
|
832
832
|
failed: [...firstSkillChanges.failed, ...skillChanges.failed],
|
|
833
|
+
skipped: skillChanges.skipped,
|
|
833
834
|
} : skillChanges);
|
|
834
835
|
const cloudConflicts = [...cloudRefreshChanges.conflicts, ...(cloudChanges?.conflicts ?? [])]
|
|
835
836
|
.filter((value, index, values) => values.findIndex((candidate) => (
|
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
} from './user-data.js';
|
|
28
28
|
import {
|
|
29
29
|
agentSkillTargets,
|
|
30
|
+
realSkillTargets,
|
|
31
|
+
skillHostSkip,
|
|
32
|
+
type SkillHostSkip,
|
|
30
33
|
hashAgentSkillDirectory,
|
|
31
34
|
linkAgentSkillTarget,
|
|
32
35
|
overwriteAgentSkillTarget,
|
|
@@ -66,6 +69,7 @@ export interface AgentWorkspaceSkillChanges {
|
|
|
66
69
|
unchanged: string[];
|
|
67
70
|
preservedModified: string[];
|
|
68
71
|
failed: Array<{ name: string; action: 'add' | 'update' | 'remove'; error: string }>;
|
|
72
|
+
skipped?: SkillHostSkip[];
|
|
69
73
|
requiresUserConfirmation: boolean;
|
|
70
74
|
prompt?: string;
|
|
71
75
|
}
|
|
@@ -240,6 +244,7 @@ export function syncAgentWorkspaceSkills(
|
|
|
240
244
|
const current = readManifest(workspaceDir, profile);
|
|
241
245
|
const next: ActiveSkillManifest = { format: 2, entries: {} };
|
|
242
246
|
const failed: AgentWorkspaceSkillChanges['failed'] = [];
|
|
247
|
+
const skipped: SkillHostSkip[] = [];
|
|
243
248
|
const hashDirectory = dependencies.hashDirectory ?? hashAgentSkillDirectory;
|
|
244
249
|
const overwriteTarget = dependencies.overwriteTarget ?? overwriteAgentSkillTarget;
|
|
245
250
|
const linkTarget = dependencies.linkTarget ?? linkAgentSkillTarget;
|
|
@@ -393,8 +398,12 @@ export function syncAgentWorkspaceSkills(
|
|
|
393
398
|
continue;
|
|
394
399
|
}
|
|
395
400
|
let linkFailed = false;
|
|
396
|
-
|
|
397
|
-
|
|
401
|
+
const hostTargets = targets(name);
|
|
402
|
+
const realTargets = realSkillTargets(hostTargets);
|
|
403
|
+
if (realTargets.length) skipped.push(skillHostSkip(name, realTargets));
|
|
404
|
+
for (const target of hostTargets) {
|
|
405
|
+
if (realTargets.includes(target)) continue;
|
|
406
|
+
const result = realTargets.length ? unlinkTarget(target) : linkTarget(canonical, target);
|
|
398
407
|
if (!result.ok) {
|
|
399
408
|
linkFailed = true;
|
|
400
409
|
failed.push({ name, action: previous ? 'update' : 'add', error: resultError(result) });
|
|
@@ -471,7 +480,10 @@ export function syncAgentWorkspaceSkills(
|
|
|
471
480
|
for (const [name] of Object.entries(current.entries)) {
|
|
472
481
|
if (name === 'clawclaw' || desired.has(name)) continue;
|
|
473
482
|
let failedRemoval = false;
|
|
483
|
+
const realTargets = realSkillTargets(targets(name));
|
|
484
|
+
if (realTargets.length) skipped.push(skillHostSkip(name, realTargets));
|
|
474
485
|
for (const target of targets(name)) {
|
|
486
|
+
if (realTargets.includes(target)) continue;
|
|
475
487
|
const result = unlinkTarget(target);
|
|
476
488
|
if (!result.ok) {
|
|
477
489
|
failedRemoval = true;
|
|
@@ -479,9 +491,17 @@ export function syncAgentWorkspaceSkills(
|
|
|
479
491
|
}
|
|
480
492
|
}
|
|
481
493
|
if (!failedRemoval) removed.push(name);
|
|
482
|
-
|
|
494
|
+
if (failedRemoval) next.entries[name] = current.entries[name]!;
|
|
483
495
|
}
|
|
484
496
|
|
|
497
|
+
// Unequipping may happen before a first successful load created a manifest.
|
|
498
|
+
// Keep reporting host-owned paths even in that case, without reopening selection.
|
|
499
|
+
for (const entry of Object.values(readCapabilityWorkspaceRegistry(workspaceDir, profile).entries)) {
|
|
500
|
+
if (entry.type !== 'skill' || entry.runtimeId === 'clawclaw'
|
|
501
|
+
|| desired.has(entry.runtimeId) || current.entries[entry.runtimeId]) continue;
|
|
502
|
+
const realTargets = realSkillTargets(targets(entry.runtimeId));
|
|
503
|
+
if (realTargets.length) skipped.push(skillHostSkip(entry.runtimeId, realTargets));
|
|
504
|
+
}
|
|
485
505
|
writeManifest(workspaceDir, profile, next);
|
|
486
506
|
return {
|
|
487
507
|
added,
|
|
@@ -490,6 +510,7 @@ export function syncAgentWorkspaceSkills(
|
|
|
490
510
|
unchanged,
|
|
491
511
|
preservedModified,
|
|
492
512
|
failed,
|
|
513
|
+
skipped,
|
|
493
514
|
requiresUserConfirmation: false,
|
|
494
515
|
};
|
|
495
516
|
}
|
package/src/lib/skill-host.ts
CHANGED
|
@@ -221,3 +221,29 @@ export function unlinkAgentSkillTarget(targetPath: string): SkillHostMutationRes
|
|
|
221
221
|
export function unregisterAgentSkill(name: string): SkillHostMutationResult {
|
|
222
222
|
return runSkillsCli(['remove', name, '-g', '-y']);
|
|
223
223
|
}
|
|
224
|
+
|
|
225
|
+
/** A host-owned real directory is never overwritten or removed by CCL. */
|
|
226
|
+
export function realSkillTargets(targets: readonly string[]): string[] {
|
|
227
|
+
return targets.filter(target => {
|
|
228
|
+
try { return !lstatSync(target).isSymbolicLink(); }
|
|
229
|
+
catch (error) {
|
|
230
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false;
|
|
231
|
+
throw error;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface SkillHostSkip {
|
|
237
|
+
name: string;
|
|
238
|
+
reason: 'local_skill_directory_exists';
|
|
239
|
+
paths: string[];
|
|
240
|
+
blocking: false;
|
|
241
|
+
message: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function skillHostSkip(name: string, paths: string[]): SkillHostSkip {
|
|
245
|
+
return {
|
|
246
|
+
name, reason: 'local_skill_directory_exists', paths, blocking: false,
|
|
247
|
+
message: 'Same-name local Skill paths were preserved. CCL Skill linking was skipped; gameplay may continue. The Agent host may still load the local Skill.',
|
|
248
|
+
};
|
|
249
|
+
}
|