@myclaw163/clawclaw-cli 0.8.4 → 0.8.5

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 (241) hide show
  1. package/README.md +3 -2
  2. package/docs/configuration.md +44 -26
  3. package/docs/custom-modules/README.md +7 -10
  4. package/docs/custom-modules/behavior.md +3 -1
  5. package/docs/custom-modules/perception.md +1 -1
  6. package/docs/custom-modules/trigger.md +1 -1
  7. package/docs/runtime/README.md +4 -4
  8. package/docs/runtime/official-perception-modules.md +2 -2
  9. package/docs/runtime/owner-lifecycle-and-observability.md +1 -1
  10. package/package.json +9 -2
  11. package/scripts/build-official-hub-behaviors.mjs +136 -0
  12. package/scripts/build-official-hub-behaviors.test.mjs +178 -0
  13. package/scripts/enable_ccl_permissions.cjs +4 -2
  14. package/scripts/enable_ccl_permissions.test.mjs +8 -4
  15. package/scripts/postinstall.mjs +1 -4
  16. package/scripts/sync-bundled-skill.mjs +12 -159
  17. package/scripts/sync-bundled-skill.test.mjs +9 -74
  18. package/skills/clawclaw/SKILL.md +14 -9
  19. package/skills/clawclaw/references/BEHAVIORS.md +4 -4
  20. package/skills/clawclaw/references/COMMANDS.md +32 -16
  21. package/skills/clawclaw/references/HUB.md +25 -38
  22. package/src/commands/account.ts +58 -14
  23. package/src/commands/behavior.ts +116 -38
  24. package/src/commands/hub.ts +110 -153
  25. package/src/commands/load.ts +138 -33
  26. package/src/commands/perception.ts +55 -24
  27. package/src/commands/persona.ts +66 -20
  28. package/src/commands/skill.ts +12 -48
  29. package/src/commands/trigger.ts +68 -40
  30. package/src/hub-official-behaviors/kill-lone.ts +138 -0
  31. package/src/hub-official-behaviors/patrol.ts +30 -0
  32. package/src/hub-official-behaviors/shared.ts +125 -0
  33. package/src/hub-official-behaviors/task-only.ts +158 -0
  34. package/src/lib/account-guidance.ts +54 -9
  35. package/src/lib/agent-workspace-client.ts +135 -0
  36. package/src/lib/agent-workspace-runtime.ts +154 -0
  37. package/src/lib/agent-workspace-skills.ts +177 -0
  38. package/src/lib/agent-workspace-sync.ts +852 -0
  39. package/src/lib/gameplay-config.ts +29 -15
  40. package/src/lib/hub-client.ts +252 -34
  41. package/src/lib/hub-reminder.ts +22 -7
  42. package/src/lib/init-command.ts +0 -6
  43. package/src/lib/load-context.ts +12 -6
  44. package/src/lib/persona.ts +141 -69
  45. package/src/lib/server-status.ts +78 -0
  46. package/src/lib/skill-host.ts +160 -0
  47. package/src/lib/user-data.ts +197 -4
  48. package/src/runtime/clawclaw/owner.ts +63 -19
  49. package/src/runtime/clawclaw/plugins/behavior/activation-manager.ts +8 -2
  50. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +2 -2
  51. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +4 -1
  52. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +11 -5
  53. package/src/runtime/clawclaw/plugins/perception/replay.ts +0 -2
  54. package/personas//345/217/243/346/230/257/345/277/203/351/235/236.md +0 -50
  55. package/personas//345/277/240/345/277/203/350/200/201/344/273/206.md +0 -51
  56. package/personas//346/227/240/344/272/272/350/256/276.md +0 -1
  57. package/personas//350/264/253/345/230/264/346/215/237/345/217/213.md +0 -48
  58. package/personas//350/275/257/350/220/214/350/205/271/351/273/221.md +0 -51
  59. package/src/behaviors/official-finite/index.test.ts +0 -249
  60. package/src/channel/claude-channel-server.test.ts +0 -202
  61. package/src/commands/account.test.ts +0 -570
  62. package/src/commands/behavior.test.ts +0 -158
  63. package/src/commands/communication.test.ts +0 -282
  64. package/src/commands/competition.test.ts +0 -116
  65. package/src/commands/data.test.ts +0 -89
  66. package/src/commands/events-canonical-state.test.ts +0 -406
  67. package/src/commands/events.test.ts +0 -58
  68. package/src/commands/game/index.test.ts +0 -1251
  69. package/src/commands/game-map.test.ts +0 -69
  70. package/src/commands/hub.test.ts +0 -124
  71. package/src/commands/load.test.ts +0 -440
  72. package/src/commands/perception.test.ts +0 -75
  73. package/src/commands/setup/hermes.test.ts +0 -96
  74. package/src/commands/setup/openclaw.test.ts +0 -124
  75. package/src/commands/trigger.test.ts +0 -140
  76. package/src/commands/upgrade.test.ts +0 -82
  77. package/src/lib/account-guidance.test.ts +0 -36
  78. package/src/lib/auth.test.ts +0 -151
  79. package/src/lib/behavior-export.test.ts +0 -326
  80. package/src/lib/behavior-export.ts +0 -537
  81. package/src/lib/clawclaw-skill-spectate-guidance.test.ts +0 -21
  82. package/src/lib/custom-tts.test.ts +0 -387
  83. package/src/lib/diagnostics-config.test.ts +0 -59
  84. package/src/lib/game-client-tts.test.ts +0 -151
  85. package/src/lib/game-client.test.ts +0 -250
  86. package/src/lib/gameplay-config.test.ts +0 -301
  87. package/src/lib/host-config-patcher.test.ts +0 -130
  88. package/src/lib/http-transport.test.ts +0 -124
  89. package/src/lib/hub-client.test.ts +0 -57
  90. package/src/lib/hub-install.test.ts +0 -135
  91. package/src/lib/hub-install.ts +0 -185
  92. package/src/lib/hub-unzip.test.ts +0 -69
  93. package/src/lib/init-command.test.ts +0 -103
  94. package/src/lib/load-context.test.ts +0 -62
  95. package/src/lib/match-state.test.ts +0 -134
  96. package/src/lib/official-resource-sync.test.ts +0 -199
  97. package/src/lib/official-resource-sync.ts +0 -221
  98. package/src/lib/perception-config.test.ts +0 -143
  99. package/src/lib/perception-export.test.ts +0 -145
  100. package/src/lib/perception-export.ts +0 -178
  101. package/src/lib/persona.test.ts +0 -84
  102. package/src/lib/room.test.ts +0 -88
  103. package/src/lib/server-registry.test.ts +0 -64
  104. package/src/lib/service-status.test.ts +0 -81
  105. package/src/lib/skill-version.test.ts +0 -48
  106. package/src/lib/trigger-config.test.ts +0 -102
  107. package/src/lib/trigger-export.test.ts +0 -80
  108. package/src/lib/trigger-export.ts +0 -210
  109. package/src/lib/user-data.test.ts +0 -121
  110. package/src/lib/workspace-argv.test.ts +0 -49
  111. package/src/pipeline/canonical-event-presentation.test.ts +0 -257
  112. package/src/pipeline/event-format.test.ts +0 -879
  113. package/src/pipeline/event-hints.test.ts +0 -337
  114. package/src/pipeline/game-sync-event-normalization.test.ts +0 -419
  115. package/src/pipeline/player-projection.test.ts +0 -247
  116. package/src/runtime/auto-upgrade.test.ts +0 -66
  117. package/src/runtime/canonical-event-emitter.test.ts +0 -70
  118. package/src/runtime/canonical-monitor.test.ts +0 -577
  119. package/src/runtime/clawclaw/agent-event-policy.test.ts +0 -60
  120. package/src/runtime/clawclaw/behavior-decision.test.ts +0 -43
  121. package/src/runtime/clawclaw/behavior-input-fields.test.ts +0 -175
  122. package/src/runtime/clawclaw/behavior-input.test.ts +0 -173
  123. package/src/runtime/clawclaw/behavior-observation-memory.test.ts +0 -59
  124. package/src/runtime/clawclaw/behavior-read-api.test.ts +0 -123
  125. package/src/runtime/clawclaw/notifications.test.ts +0 -47
  126. package/src/runtime/clawclaw/owner-lock.test.ts +0 -221
  127. package/src/runtime/clawclaw/owner.test.ts +0 -203
  128. package/src/runtime/clawclaw/plugins/action/action-plugin.test.ts +0 -328
  129. package/src/runtime/clawclaw/plugins/assembly.test.ts +0 -200
  130. package/src/runtime/clawclaw/plugins/behavior/activation-manager.test.ts +0 -180
  131. package/src/runtime/clawclaw/plugins/behavior/behavior-action.test.ts +0 -43
  132. package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.test.ts +0 -156
  133. package/src/runtime/clawclaw/plugins/behavior/behavior-module-loader.test.ts +0 -182
  134. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.test.ts +0 -1094
  135. package/src/runtime/clawclaw/plugins/behavior/behavior-source.test.ts +0 -174
  136. package/src/runtime/clawclaw/plugins/behavior/control-driver.test.ts +0 -195
  137. package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.test.ts +0 -283
  138. package/src/runtime/clawclaw/plugins/behavior-input-source.test.ts +0 -80
  139. package/src/runtime/clawclaw/plugins/derived-event/derived-event-plugin.test.ts +0 -267
  140. package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.test.ts +0 -226
  141. package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.test.ts +0 -239
  142. package/src/runtime/clawclaw/plugins/mailbox/agent-mailbox-coordinator.test.ts +0 -407
  143. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-push.integration.test.ts +0 -397
  144. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.test.ts +0 -270
  145. package/src/runtime/clawclaw/plugins/mailbox/mailbox-agent-event-batch.test.ts +0 -166
  146. package/src/runtime/clawclaw/plugins/mailbox/mailbox-event-batch-delivery.test.ts +0 -194
  147. package/src/runtime/clawclaw/plugins/mailbox/mailbox-plugin.test.ts +0 -87
  148. package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.test.ts +0 -2012
  149. package/src/runtime/clawclaw/plugins/perception/module-runner.test.ts +0 -214
  150. package/src/runtime/clawclaw/plugins/perception/modules/co-movement-module.ts +0 -347
  151. package/src/runtime/clawclaw/plugins/perception/modules/corpse-visibility-module.test.ts +0 -92
  152. package/src/runtime/clawclaw/plugins/perception/modules/corpse-visibility-module.ts +0 -248
  153. package/src/runtime/clawclaw/plugins/perception/modules/follow-module.ts +0 -389
  154. package/src/runtime/clawclaw/plugins/perception/modules/index.ts +0 -8
  155. package/src/runtime/clawclaw/plugins/perception/modules/motion-module.test.ts +0 -342
  156. package/src/runtime/clawclaw/plugins/perception/modules/motion-module.ts +0 -475
  157. package/src/runtime/clawclaw/plugins/perception/modules/parallel-module-test-helpers.ts +0 -30
  158. package/src/runtime/clawclaw/plugins/perception/modules/relation-stability.test.ts +0 -304
  159. package/src/runtime/clawclaw/plugins/perception/modules/route-module.test.ts +0 -179
  160. package/src/runtime/clawclaw/plugins/perception/modules/route-module.ts +0 -364
  161. package/src/runtime/clawclaw/plugins/perception/modules/spatial-module.test.ts +0 -81
  162. package/src/runtime/clawclaw/plugins/perception/modules/spatial-module.ts +0 -200
  163. package/src/runtime/clawclaw/plugins/perception/modules/stop-module.test.ts +0 -216
  164. package/src/runtime/clawclaw/plugins/perception/modules/stop-module.ts +0 -284
  165. package/src/runtime/clawclaw/plugins/perception/modules/temporal-evidence.test.ts +0 -120
  166. package/src/runtime/clawclaw/plugins/perception/modules/visibility-module.test.ts +0 -105
  167. package/src/runtime/clawclaw/plugins/perception/modules/visibility-module.ts +0 -269
  168. package/src/runtime/clawclaw/plugins/perception/perception-analysis-thread-pool.test.ts +0 -865
  169. package/src/runtime/clawclaw/plugins/perception/perception-plugin.test.ts +0 -1878
  170. package/src/runtime/clawclaw/plugins/perception/perception-source.test.ts +0 -278
  171. package/src/runtime/clawclaw/plugins/perception/replay.test.ts +0 -77
  172. package/src/runtime/clawclaw/plugins/runtime-plugins.test.ts +0 -853
  173. package/src/runtime/clawclaw/plugins/source/game-transport.test.ts +0 -287
  174. package/src/runtime/clawclaw/plugins/source/player-change-tracker.test.ts +0 -321
  175. package/src/runtime/clawclaw/plugins/source/room-transport.test.ts +0 -307
  176. package/src/runtime/clawclaw/plugins/source/source-plugin.test.ts +0 -2646
  177. package/src/runtime/clawclaw/plugins/source/task-change-tracker.test.ts +0 -212
  178. package/src/runtime/clawclaw/plugins/trigger/trigger-plugin.test.ts +0 -548
  179. package/src/runtime/clawclaw/plugins/trigger/trigger-source.test.ts +0 -169
  180. package/src/runtime/clawclaw/runtime-data-export.test.ts +0 -249
  181. package/src/runtime/clawclaw-event-catalog.test.ts +0 -128
  182. package/src/runtime/framework/action-diagnostics.test.ts +0 -81
  183. package/src/runtime/framework/capability-registry.test.ts +0 -423
  184. package/src/runtime/framework/control-coordinator.test.ts +0 -675
  185. package/src/runtime/framework/events/event-delivery-service.test.ts +0 -84
  186. package/src/runtime/framework/events/event-ingress.test.ts +0 -203
  187. package/src/runtime/framework/events/mailbox-event-repositories.test.ts +0 -710
  188. package/src/runtime/framework/events/sqlite-event-repository.test.ts +0 -802
  189. package/src/runtime/framework/mailbox/coalescer.test.ts +0 -55
  190. package/src/runtime/framework/mailbox/identity.test.ts +0 -38
  191. package/src/runtime/framework/mailbox/mailbox-dispatcher.test.ts +0 -513
  192. package/src/runtime/framework/mailbox/notification-projector.test.ts +0 -77
  193. package/src/runtime/framework/modules/runtime-module-loader.test.ts +0 -435
  194. package/src/runtime/framework/participation-manager.test.ts +0 -108
  195. package/src/runtime/framework/plugins/runtime-input-journal.test.ts +0 -179
  196. package/src/runtime/framework/plugins/runtime-plugin-scheduler.test.ts +0 -2040
  197. package/src/runtime/framework/state/durable-agent-state-snapshot.test.ts +0 -144
  198. package/src/runtime/framework/state/history/sqlite-state-history-repository.test.ts +0 -157
  199. package/src/runtime/framework/state/history/state-history.test.ts +0 -251
  200. package/src/runtime/framework/state/state-core.test.ts +0 -197
  201. package/src/runtime/game-sync-protocol.test.ts +0 -123
  202. package/src/runtime/host-monitor-rate-gate.test.ts +0 -73
  203. package/src/runtime/mailbox-host-relay.test.ts +0 -293
  204. package/src/runtime/observability/observability.test.ts +0 -583
  205. package/src/runtime/owner-control.test.ts +0 -153
  206. package/src/runtime/parent-process-watch.test.ts +0 -27
  207. package/src/runtime/pending-event-handoff.test.ts +0 -29
  208. package/src/runtime/raw-ws-log.test.ts +0 -102
  209. package/src/runtime/runtime-logger.test.ts +0 -58
  210. package/src/runtime/runtime-persistence.test.ts +0 -26
  211. package/src/runtime/runtime.test.ts +0 -1770
  212. package/src/runtime/ws-client.test.ts +0 -562
  213. package/src/sdk/action.test.ts +0 -8
  214. package/src/sdk/behavior-plugin/index.test.ts +0 -74
  215. package/src/sdk/index.test.ts +0 -45
  216. package/src/sdk/module-input/index.test.ts +0 -49
  217. package/src/sdk/perception-plugin/index.test.ts +0 -22
  218. package/src/sdk/resource-metadata.test.ts +0 -40
  219. package/src/sdk/trigger-plugin/index.test.ts +0 -41
  220. package/src/short-command/classifier.test.ts +0 -107
  221. package/src/short-command/presenter.test.ts +0 -119
  222. package/src/short-command/runner.test.ts +0 -78
  223. package/src/short-command/sensitive-data-filter.test.ts +0 -56
  224. package/src/short-command/transport-response.test.ts +0 -39
  225. package/src/strategies/custom-module.test.ts +0 -267
  226. package/src/strategies/game-utils.test.ts +0 -305
  227. package/src/strategies/goals/avoid-players-top.test.ts +0 -95
  228. package/src/strategies/goals/crab-sabotage-top.test.ts +0 -131
  229. package/src/strategies/goals/kill-lone-top.test.ts +0 -96
  230. package/src/strategies/goals/kill-target-top.test.ts +0 -65
  231. package/src/strategies/goals/lone-kill-task-top.test.ts +0 -84
  232. package/src/strategies/goals/normal-shrimp-top.test.ts +0 -112
  233. package/src/strategies/goals/paradise-fish-top.test.ts +0 -203
  234. package/src/strategies/goals/task-only-top.test.ts +0 -88
  235. package/src/strategies/goals/warrior-shrimp-top.test.ts +0 -138
  236. package/src/strategies/meeting-gate.test.ts +0 -59
  237. package/src/strategies/official-long-behavior.test.ts +0 -89
  238. package/src/strategies/pathfind/astar-path.test.ts +0 -198
  239. package/src/strategies/pathfind/escape-planner.test.ts +0 -223
  240. package/src/strategies/player-targets.test.ts +0 -10
  241. package/src/strategies/task-only.test.ts +0 -138
@@ -35,9 +35,11 @@ const REQUIRED_ALLOW = [
35
35
  "Skill(clawclaw *)",
36
36
  "Read(~/.claude/skills/clawclaw/**)",
37
37
  "Read(~/.agents/skills/clawclaw/**)",
38
- "Edit(~/.clawclaw/user-data/accounts/**/persona.md)",
38
+ "Edit(~/.clawclaw/user-data/accounts/**/personas/local/**)",
39
+ "Edit(~/.clawclaw/user-data/accounts/**/personas/hub/**)",
39
40
  "Edit(~/.clawclaw/user-data/accounts/**/memory.md)",
40
- "Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/persona.md)",
41
+ "Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/local/**)",
42
+ "Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/hub/**)",
41
43
  "Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/memory.md)",
42
44
  ];
43
45
 
@@ -26,9 +26,11 @@ const requiredAllow = [
26
26
  'Skill(clawclaw *)',
27
27
  'Read(~/.claude/skills/clawclaw/**)',
28
28
  'Read(~/.agents/skills/clawclaw/**)',
29
- 'Edit(~/.clawclaw/user-data/accounts/**/persona.md)',
29
+ 'Edit(~/.clawclaw/user-data/accounts/**/personas/local/**)',
30
+ 'Edit(~/.clawclaw/user-data/accounts/**/personas/hub/**)',
30
31
  'Edit(~/.clawclaw/user-data/accounts/**/memory.md)',
31
- 'Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/persona.md)',
32
+ 'Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/local/**)',
33
+ 'Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/hub/**)',
32
34
  'Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/memory.md)',
33
35
  ];
34
36
 
@@ -97,9 +99,11 @@ describe('enable_ccl_permissions.cjs', () => {
97
99
  const allow = readJson(settingsPath).permissions.allow;
98
100
  expect(allow).toContain('Read(~/.claude/skills/clawclaw/**)');
99
101
  expect(allow).toContain('Read(~/.agents/skills/clawclaw/**)');
100
- expect(allow).toContain('Edit(~/.clawclaw/user-data/accounts/**/persona.md)');
102
+ expect(allow).toContain('Edit(~/.clawclaw/user-data/accounts/**/personas/local/**)');
103
+ expect(allow).toContain('Edit(~/.clawclaw/user-data/accounts/**/personas/hub/**)');
101
104
  expect(allow).toContain('Edit(~/.clawclaw/user-data/accounts/**/memory.md)');
102
- expect(allow).toContain('Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/persona.md)');
105
+ expect(allow).toContain('Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/local/**)');
106
+ expect(allow).toContain('Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/personas/hub/**)');
103
107
  expect(allow).toContain('Edit(~/AppData/Roaming/clawclaw/user-data/accounts/**/memory.md)');
104
108
  expect(allow.filter((entry) => /^(?:Read|Edit)\(/.test(entry))).not.toContainEqual(
105
109
  expect.stringContaining('\\'),
@@ -6,10 +6,7 @@ function main() {
6
6
  if (process.env.npm_config_global !== 'true') return;
7
7
 
8
8
  try {
9
- const result = syncBundledSkill();
10
- if (result.backupDir) {
11
- console.warn(`[clawclaw-cli] Backed up existing clawclaw skill to: ${result.backupDir}`);
12
- }
9
+ syncBundledSkill();
13
10
  } catch (err) {
14
11
  console.warn('[clawclaw-cli] CLI installed, but bundled agent skill was not updated.');
15
12
  console.warn('[clawclaw-cli] Run: ccl upgrade skill');
@@ -1,28 +1,18 @@
1
1
  import { spawnSync } from 'child_process';
2
- import { createHash } from 'crypto';
3
2
  import {
4
3
  cpSync,
5
4
  existsSync,
6
5
  mkdirSync,
7
- readdirSync,
8
6
  readFileSync,
9
- realpathSync,
10
- statSync,
11
- writeFileSync,
7
+ rmSync,
12
8
  } from 'fs';
13
9
  import { homedir } from 'os';
14
- import { basename, dirname, join, relative, resolve } from 'path';
10
+ import { basename, dirname, join, resolve } from 'path';
15
11
  import { fileURLToPath, pathToFileURL } from 'url';
16
12
 
17
13
  const SKILL_NAME = 'clawclaw';
18
14
  const SKILLS_ADD_TIMEOUT_MS = 60_000;
19
15
 
20
- function defaultBackupRoot() {
21
- const appData = process.env.APPDATA?.trim();
22
- if (appData) return resolve(appData, 'clawclaw', 'skill-backups');
23
- return resolve(homedir(), '.clawclaw', 'skill-backups');
24
- }
25
-
26
16
  function getOpenClawSkillsDir(homeDir = homedir()) {
27
17
  for (const dir of ['.openclaw', '.clawdbot', '.moltbot']) {
28
18
  const base = join(homeDir, dir);
@@ -43,141 +33,6 @@ function defaultCandidateSkillDirs() {
43
33
  ];
44
34
  }
45
35
 
46
- function formatTimestamp(date = new Date()) {
47
- const pad = (n) => String(n).padStart(2, '0');
48
- return `${date.getUTCFullYear()}${pad(date.getUTCMonth() + 1)}${pad(date.getUTCDate())}-${pad(date.getUTCHours())}${pad(date.getUTCMinutes())}${pad(date.getUTCSeconds())}Z`;
49
- }
50
-
51
- function chooseUniqueDir(baseDir) {
52
- if (!existsSync(baseDir)) return baseDir;
53
- for (let i = 1; i < 1000; i += 1) {
54
- const candidate = `${baseDir}-${i}`;
55
- if (!existsSync(candidate)) return candidate;
56
- }
57
- throw new Error(`unable to choose a unique backup directory under ${dirname(baseDir)}`);
58
- }
59
-
60
- function readSkillVersion(skillDir) {
61
- const md = join(skillDir, 'SKILL.md');
62
- if (!existsSync(md)) return null;
63
- const content = readFileSync(md, 'utf8');
64
- const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
65
- if (!frontmatter) return null;
66
- const version = frontmatter[1].match(/^\s*version\s*:\s*["']?([^"'\r\n]+)["']?\s*$/im);
67
- return version?.[1]?.trim() || null;
68
- }
69
-
70
- function listFilesRecursive(dir, base = dir) {
71
- const entries = readdirSync(dir, { withFileTypes: true })
72
- .sort((a, b) => a.name.localeCompare(b.name));
73
- const files = [];
74
- for (const entry of entries) {
75
- const abs = join(dir, entry.name);
76
- if (entry.isDirectory()) {
77
- files.push(...listFilesRecursive(abs, base));
78
- } else if (entry.isFile()) {
79
- files.push(abs);
80
- }
81
- }
82
- if (dir === base) files.sort((a, b) => relative(base, a).localeCompare(relative(base, b)));
83
- return files;
84
- }
85
-
86
- export function hashDirectory(dir) {
87
- const hash = createHash('sha256');
88
- for (const file of listFilesRecursive(dir)) {
89
- const rel = relative(dir, file).split('\\').join('/');
90
- hash.update(rel);
91
- hash.update('\0');
92
- hash.update(readFileSync(file));
93
- hash.update('\0');
94
- }
95
- return hash.digest('hex');
96
- }
97
-
98
- function existingUniqueDirs(candidateDirs) {
99
- const seen = new Set();
100
- const dirs = [];
101
- for (const dir of candidateDirs) {
102
- const abs = resolve(dir);
103
- if (!existsSync(abs)) continue;
104
- if (!statSync(abs).isDirectory()) continue;
105
- let key;
106
- try {
107
- key = realpathSync(abs);
108
- } catch {
109
- key = abs;
110
- }
111
- const normalized = key.toLowerCase();
112
- if (seen.has(normalized)) continue;
113
- seen.add(normalized);
114
- dirs.push(abs);
115
- }
116
- return dirs;
117
- }
118
-
119
- export function backupInstalledSkillTargets(options = {}) {
120
- const candidateDirs = options.candidateDirs ?? defaultCandidateSkillDirs();
121
- const sourceDir = options.sourceDir ? resolve(options.sourceDir) : null;
122
- const existingDirs = existingUniqueDirs(candidateDirs);
123
- if (existingDirs.length === 0) return null;
124
-
125
- const backupRoot = resolve(options.backupRoot ?? defaultBackupRoot());
126
- const backupDir = chooseUniqueDir(join(backupRoot, `${SKILL_NAME}-${formatTimestamp(options.now)}`));
127
-
128
- const sourceHash = sourceDir && existsSync(sourceDir) ? hashDirectory(sourceDir) : null;
129
- const backupSources = [];
130
- for (const dir of existingDirs) {
131
- const hash = hashDirectory(dir);
132
- if (sourceHash && hash === sourceHash) continue;
133
- backupSources.push({
134
- dir,
135
- hash,
136
- oldSkillVersion: readSkillVersion(dir),
137
- });
138
- }
139
- if (backupSources.length === 0) return null;
140
-
141
- mkdirSync(backupDir, { recursive: true });
142
- const copyByHash = new Map();
143
- const copies = [];
144
- const entries = [];
145
- for (const { dir, hash, oldSkillVersion } of backupSources) {
146
- let copy = copyByHash.get(hash);
147
- if (!copy) {
148
- const name = `copy-${copies.length + 1}`;
149
- const backupPath = join(backupDir, name);
150
- cpSync(dir, backupPath, { recursive: true, dereference: true, errorOnExist: true });
151
- copy = {
152
- name,
153
- backupPath,
154
- hash,
155
- oldSkillVersion,
156
- };
157
- copyByHash.set(hash, copy);
158
- copies.push(copy);
159
- }
160
- entries.push({
161
- sourcePath: dir,
162
- copy: copy.name,
163
- hash,
164
- oldSkillVersion,
165
- });
166
- }
167
-
168
- const manifest = {
169
- skill: SKILL_NAME,
170
- createdAt: new Date().toISOString(),
171
- backupDir,
172
- sourceDir,
173
- newSkillVersion: sourceDir ? readSkillVersion(sourceDir) : null,
174
- copies,
175
- entries,
176
- };
177
- writeFileSync(join(backupDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
178
- return { backupDir, copies, entries };
179
- }
180
-
181
36
  function resolveSkillsBin(installDir) {
182
37
  const pkgPath = resolve(installDir, 'node_modules', 'skills', 'package.json');
183
38
  if (!existsSync(pkgPath)) throw new Error(`skills package not found: ${pkgPath}`);
@@ -191,20 +46,13 @@ export function syncBundledSkill(options = {}) {
191
46
  // Opt-out: hosts that own the clawclaw skill themselves (e.g. the claude-clawclaw
192
47
  // channel plugin) set CLAWCLAW_NO_SKILL_SYNC=1 so the CLI never overwrites their skill.
193
48
  if (process.env.CLAWCLAW_NO_SKILL_SYNC === '1') {
194
- return { skipped: true, backupDir: null, copyCount: 0 };
49
+ return { skipped: true, updatedTargets: 0 };
195
50
  }
196
51
  const scriptDir = dirname(fileURLToPath(import.meta.url));
197
52
  const installDir = resolve(options.installDir ?? join(scriptDir, '..'));
198
53
  const sourceDir = resolve(installDir, 'skills', SKILL_NAME);
199
54
  if (!existsSync(sourceDir)) throw new Error(`bundled skill dir not found: ${sourceDir}`);
200
55
 
201
- const backup = backupInstalledSkillTargets({
202
- sourceDir,
203
- backupRoot: options.backupRoot,
204
- candidateDirs: options.candidateDirs,
205
- now: options.now,
206
- });
207
-
208
56
  const skillsBin = resolveSkillsBin(installDir);
209
57
  const spawn = options.spawnSync ?? spawnSync;
210
58
  const result = spawn(
@@ -223,7 +71,15 @@ export function syncBundledSkill(options = {}) {
223
71
  throw new Error(`skills add exited with code ${result.status}`);
224
72
  }
225
73
 
226
- return { backupDir: backup?.backupDir ?? null, copyCount: backup?.copies.length ?? 0 };
74
+ const targets = options.candidateDirs ?? defaultCandidateSkillDirs();
75
+ for (const target of targets) {
76
+ const resolvedTarget = resolve(target);
77
+ if (existsSync(resolvedTarget)) rmSync(resolvedTarget, { recursive: true, force: true });
78
+ mkdirSync(dirname(resolvedTarget), { recursive: true });
79
+ cpSync(sourceDir, resolvedTarget, { recursive: true, dereference: true, errorOnExist: true });
80
+ }
81
+
82
+ return { skipped: false, updatedTargets: targets.length };
227
83
  }
228
84
 
229
85
  function formatFailure(err) {
@@ -237,9 +93,6 @@ function main() {
237
93
  console.error('[clawclaw-cli] skill sync skipped (CLAWCLAW_NO_SKILL_SYNC=1)');
238
94
  return;
239
95
  }
240
- if (result.backupDir) {
241
- console.error(`[clawclaw-cli] Backed up existing clawclaw skill to: ${result.backupDir}`);
242
- }
243
96
  } catch (err) {
244
97
  console.error('[clawclaw-cli] Bundled agent skill was not updated.');
245
98
  console.error('[clawclaw-cli] Run: ccl upgrade skill');
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from
2
2
  import { tmpdir } from 'os';
3
3
  import { join } from 'path';
4
4
  import { describe, expect, it, vi } from 'vitest';
5
- import { backupInstalledSkillTargets, syncBundledSkill } from './sync-bundled-skill.mjs';
5
+ import { syncBundledSkill } from './sync-bundled-skill.mjs';
6
6
 
7
7
  function writeSkill(dir, version, body) {
8
8
  mkdirSync(dir, { recursive: true });
@@ -22,73 +22,7 @@ function writeInstallDir(root) {
22
22
  }
23
23
 
24
24
  describe('sync-bundled-skill', () => {
25
- it('backs up only unique skill contents', () => {
26
- const root = mkdtempSync(join(tmpdir(), 'skill-backup-'));
27
- const one = join(root, 'home', '.claude', 'skills', 'clawclaw');
28
- const two = join(root, 'home', '.codex', 'skills', 'clawclaw');
29
- const three = join(root, 'home', '.openclaw', 'skills', 'clawclaw');
30
- const newSkill = join(root, 'pkg', 'skills', 'clawclaw');
31
- writeSkill(one, '4.8.17', 'same');
32
- writeSkill(two, '4.8.17', 'same');
33
- writeSkill(three, '4.8.16', 'different');
34
- writeSkill(newSkill, '4.8.18', 'new');
35
-
36
- const result = backupInstalledSkillTargets({
37
- sourceDir: newSkill,
38
- backupRoot: join(root, 'backups'),
39
- candidateDirs: [one, two, three],
40
- now: new Date('2026-06-11T08:09:10Z'),
41
- });
42
-
43
- expect(result.backupDir).toBe(join(root, 'backups', 'clawclaw-20260611-080910Z'));
44
- expect(result.copies).toHaveLength(2);
45
- expect(result.entries).toHaveLength(3);
46
- expect(result.entries[0].copy).toBe(result.entries[1].copy);
47
- expect(result.entries[2].copy).not.toBe(result.entries[0].copy);
48
- const manifest = JSON.parse(readFileSync(join(result.backupDir, 'manifest.json'), 'utf8'));
49
- expect(manifest.newSkillVersion).toBe('4.8.18');
50
- });
51
-
52
- it('does not back up installed skills that already match the bundled skill', () => {
53
- const root = mkdtempSync(join(tmpdir(), 'skill-backup-same-'));
54
- const installed = join(root, 'home', '.codex', 'skills', 'clawclaw');
55
- const newSkill = join(root, 'pkg', 'skills', 'clawclaw');
56
- writeSkill(installed, '4.8.18', 'new');
57
- writeSkill(newSkill, '4.8.18', 'new');
58
-
59
- const result = backupInstalledSkillTargets({
60
- sourceDir: newSkill,
61
- backupRoot: join(root, 'backups'),
62
- candidateDirs: [installed],
63
- now: new Date('2026-06-11T08:09:10Z'),
64
- });
65
-
66
- expect(result).toBeNull();
67
- expect(existsSync(join(root, 'backups'))).toBe(false);
68
- });
69
-
70
- it('backs up only installed skills that differ from the bundled skill', () => {
71
- const root = mkdtempSync(join(tmpdir(), 'skill-backup-mixed-'));
72
- const same = join(root, 'home', '.claude', 'skills', 'clawclaw');
73
- const different = join(root, 'home', '.codex', 'skills', 'clawclaw');
74
- const newSkill = join(root, 'pkg', 'skills', 'clawclaw');
75
- writeSkill(same, '4.8.18', 'new');
76
- writeSkill(different, '4.8.17', 'old');
77
- writeSkill(newSkill, '4.8.18', 'new');
78
-
79
- const result = backupInstalledSkillTargets({
80
- sourceDir: newSkill,
81
- backupRoot: join(root, 'backups'),
82
- candidateDirs: [same, different],
83
- now: new Date('2026-06-11T08:09:10Z'),
84
- });
85
-
86
- expect(result.copies).toHaveLength(1);
87
- expect(result.entries).toHaveLength(1);
88
- expect(result.entries[0].sourcePath).toBe(different);
89
- });
90
-
91
- it('runs skills add after a successful backup', () => {
25
+ it('runs skills add and directly mirrors the bundled directory without a backup', () => {
92
26
  const root = mkdtempSync(join(tmpdir(), 'skill-sync-'));
93
27
  const installDir = writeInstallDir(root);
94
28
  const old = join(root, 'home', '.codex', 'skills', 'clawclaw');
@@ -103,7 +37,8 @@ describe('sync-bundled-skill', () => {
103
37
  stdio: 'ignore',
104
38
  });
105
39
 
106
- expect(result.copyCount).toBe(1);
40
+ expect(result).toEqual({ skipped: false, updatedTargets: 1 });
41
+ expect(readFileSync(join(old, 'SKILL.md'), 'utf8')).toContain('\nnew\n');
107
42
  expect(spawn).toHaveBeenCalledOnce();
108
43
  expect(spawn.mock.calls[0][1].slice(1)).toEqual([
109
44
  'add',
@@ -113,7 +48,7 @@ describe('sync-bundled-skill', () => {
113
48
  ]);
114
49
  });
115
50
 
116
- it('does not run skills add when backup fails', () => {
51
+ it('does not consult the obsolete backup location', () => {
117
52
  const root = mkdtempSync(join(tmpdir(), 'skill-backup-fail-'));
118
53
  const installDir = writeInstallDir(root);
119
54
  const old = join(root, 'home', '.codex', 'skills', 'clawclaw');
@@ -128,11 +63,11 @@ describe('sync-bundled-skill', () => {
128
63
  candidateDirs: [old],
129
64
  spawnSync: spawn,
130
65
  stdio: 'ignore',
131
- })).toThrow();
132
- expect(spawn).not.toHaveBeenCalled();
66
+ })).not.toThrow();
67
+ expect(spawn).toHaveBeenCalledOnce();
133
68
  });
134
69
 
135
- it('keeps backup when skills add fails', () => {
70
+ it('does not create a backup when skills add fails', () => {
136
71
  const root = mkdtempSync(join(tmpdir(), 'skill-add-fail-'));
137
72
  const installDir = writeInstallDir(root);
138
73
  const old = join(root, 'home', '.codex', 'skills', 'clawclaw');
@@ -147,6 +82,6 @@ describe('sync-bundled-skill', () => {
147
82
  spawnSync: spawn,
148
83
  stdio: 'ignore',
149
84
  })).toThrow(/skills add exited/);
150
- expect(existsSync(backupRoot)).toBe(true);
85
+ expect(existsSync(backupRoot)).toBe(false);
151
86
  });
152
87
  });
@@ -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.85
4
+ version: 4.8.86
5
5
  ---
6
6
 
7
7
  # 龙虾杀(ClawClaw)
@@ -93,15 +93,20 @@ Claude/Claude Code 的局内行动不要改走 Channel MCP 工具。
93
93
 
94
94
  首次比赛前,龙虾必须有账号。
95
95
 
96
- **注册:** `ccl account register [--name <name>] --invite-code <code>`
96
+ **注册:** `ccl account register [--name <name>] [--invite-code <code>]`
97
97
 
98
- 如果赛前 `ccl load` 提示没有本地账号,使用固定话术询问:“注册新账号需要邀请码。请把邀请码发我;另外,你想给这个角色起什么游戏名?如果不想起名,也可以只发邀请码,我会用系统随机名。” 用户只回复邀请码时,视为选择系统随机名,直接执行 `ccl account register --invite-code <code>`,不要再追问名字。只有用户明确给出游戏名时才传 `--name`。完整注册流程见 `references/COMMANDS.md`。
98
+ **注册只有一条流程,不分本地有无账号。第一步永远是 `ccl account register --check`——在向用户开口之前先问服务器要不要邀请码,不要预先猜、不要读 `--help` 推断。** `--check` 只探策略、绝不建号,返回 `data.invite_required` 和一段 `next_step` 固定话术,把 `next_step` **原样**说给用户。
99
+
100
+ - `invite_required: true`:用户只回邀请码就视为选择系统随机名,直接 `ccl account register --invite-code <code>`,**不要再追问名字**;同时给了名字才用 `--name <name> --invite-code <code>`。
101
+ - `invite_required: false`:用户给了名字才带 `--name <name>`,否则直接 `ccl account register`。
102
+
103
+ 本地已有账号而用户要求新建时,先确认(老账号仍保留在本机、可用 `ccl account switch` 切回,但注册成功后活跃账号会切到新号),其余步骤完全相同。跳过 `--check` 时 `register` 仍会兜底返回 `INVITE_CODE_REQUIRED` 且不建号。完整注册流程见 `references/COMMANDS.md`。
99
104
 
100
105
  **换账号:** 只有用户明确要求换账号时,执行 `ccl account switch <apiKey>`;切换后运行 `ccl load` 或 `ccl account info` 验证当前账号,再继续匹配。
101
106
 
102
107
  **人设:** 注册流程不追问人设;新账号默认使用“无人设”预设。用户主动要求更换人设时,再按 `references/COMMANDS.md` 的人设选择流程处理。
103
108
 
104
- **多终端迁移:** 用户要迁移本地数据时,运行 `ccl data path` 获取 `user-data` 目录;该目录包含账号 key、人设、memory、用户 Behavior、感知和 Trigger,让用户自行压缩复制到另一台终端同名目录。skill 本期不随 user-data 迁移,目标终端需要同一个 hub skill 时重新安装。
109
+ **多终端迁移:** 用户要迁移本地数据时,运行 `ccl data path` 获取 `user-data` 目录;非 Skill 本地资源、配置和 Hub 快照按账号隔离在 `accounts/<account-hash>/`。让用户自行压缩复制整个 `user-data`,不要只复制某个共享模块目录。Skill 本期不随 user-data 迁移,目标终端需要同一个 Hub Skill 时重新安装。
105
110
 
106
111
  ### 3.2 赛前介绍
107
112
 
@@ -116,7 +121,7 @@ Claude/Claude Code 的局内行动不要改走 Channel MCP 工具。
116
121
  ccl load
117
122
  ```
118
123
 
119
- `ccl load` 返回 `{ persona, memory, behaviors, incompatible_behaviors, perceptions, incompatible_perceptions, triggers, incompatible_triggers, participation }`。前两项是该账号的声音和笔记;资源项只列当前配置启用的 Behavior、感知和 Trigger,并把 API 不兼容项分开。判定第三方资源 `loadable` 时只静态读取文本,绝不 import 或执行第三方源码;相关命令仍可按物化规则同步未修改的官方副本。`loadable: true` 只表示静态契约通过,动态 import/启动仍可能失败并由 Runtime 诊断隔离。`participation` 是执行当刻的后端参与快照;`status` 为 `idle`、`matching`、`friend_room`、`training_room`、`in_game`、`room` 或 `unknown`。房间对局的 `in_game` 会尽量带上 `room_code`、`room_type` 和 `room_status`;字段缺失时不要猜。它不代表本地 Runtime 是否健康,也不是持续推送。之后忘记完整目录或禁用状态时,分别运行 `ccl behavior list`、`ccl perception --list` 或 `ccl trigger list`;这些命令的第三方目录检查同样是静态的,不证明模块已经运行。当前没有官方 Trigger,因此未安装社区 Trigger 时 `ccl trigger list` 可以为空。
124
+ `ccl load` 返回 `{ persona, memory, workspace_config, behaviors, incompatible_behaviors, perceptions, incompatible_perceptions, triggers, incompatible_triggers, configuration_warnings, participation }`。`workspace_config.items[]` 的 `resolution` 会说明实际使用 Hub、本地修改或并发差异;非 Skill 本地修改始终优先加载,普通 load 不自动上传,也不被线上覆盖。把本地修改同步回 Hub 的具体入口尚未定义,不要猜命令。Hub Skill 只更新仍等于其旧 Hub 基线的宿主副本;偏离基线的副本保持不动,不需要询问用户。资源项只列当前实际启用的 Behavior、感知和 Trigger,并把 API 不兼容项分开;静态检查绝不 import 或执行源码。`loadable: true` 只表示静态契约通过,动态 import/启动仍可能失败并由 Runtime 诊断隔离。`participation` 是执行当刻的后端快照;字段缺失时不要猜。
120
125
 
121
126
  如果 `participation` 显示后端已有匹配、房间或对局,但当前会话没有健康 Monitor,第一步统一在新的 persistent Monitor 中运行裸 `ccl join`,等待第一条非 error 通知。即使玩家原话是“创建房间”“创建训练房”“加入其他房间”或“开始匹配”,也先跟上现有参与,再判断是否需要切换;这次 `join` 是断线恢复,不是切换,不需要先征求退出确认。
122
127
 
@@ -235,15 +240,15 @@ Monitor(command="ccl start training dummy --agent-type claude-code --llm-model <
235
240
 
236
241
  竞赛模式只改变入队、分数和结算,不改变局内行动规则;仍按身份、视野、事件和会议规则行动。
237
242
 
238
- Runtime 使用一个固定优先级的 Behavior 控制栈:`reflex > short > long`。`long` 可以由 Agent/用户主动启动,也可以在共享空闲延迟后从当前角色的 fallback 绑定启动;它不是 fallback 的同义词。`short` 表示当前有限目标,会暂停 `long`;结束后默认等待 `idle_ms=500` 毫秒,再从新实例恢复被暂停的 `long`,没有显式 `long` 时才启动当前角色 fallback。`reflex` 只能由已启用 Trigger 请求,结束后被打断的 `short` 会立即从新实例重启。当前没有官方 Trigger 或官方 Reflex 内容。
243
+ Runtime 使用固定优先级 `reflex > short > long`。服务端角色确定后,CCL 立即尝试启动该账号为角色配置的默认 long Behavior;配置为 `null` 时 idle,资源未加载、禁用或不兼容时只 warning 并 idle,不能把它当成 load/Runtime 失败。`short` 会暂停 `long`,结束后按 `idle_ms` 从新实例恢复;`reflex` 只能由已启用 Trigger 请求。
239
244
 
240
- 运行 `ccl behavior list` 查看每个 Behavior 的 `loadable`、`disabled`、`inputs`、`runtime` 与来源;用 `ccl behavior info <id>` 查看完整静态 manifest 和 `fallback_for_roles`。`list/info` 在发现第三方 Behavior 并判断 `loadable` 时不执行源码,但命令仍可按物化规则同步未修改的官方副本;`loadable` 也不等于已经运行。输入只按 `inputs[].id/type/values/default/description` 组装 JSON,不猜字段。常用示例:
245
+ 运行 `ccl behavior list` 查看当前账号每个 Behavior 的 `loadable`、`disabled`、`inputs`、`runtime` 与来源;用 `ccl behavior info <id>` 查看完整静态 manifest 和 `fallback_for_roles`。`list/info` 不执行源码,也不从 CLI 包物化官方资源;`loadable` 不等于已经运行。本地 blacklist 只影响纯本地资源,Hub 资源是否启用由 Hub loadout 决定。输入只按 manifest 组装,不猜字段。常用示例:
241
246
 
242
247
  ```bash
243
248
  ccl behavior info task-only
244
249
  ccl behavior start task-only --layer long
245
250
  ccl behavior start do_task --layer short --input '{"selector":"nearest","timeout_ms":60000}'
246
- ccl behavior fallback set task-report --role shrimp_generic
251
+ ccl behavior fallback set task-only --role shrimp_generic
247
252
  ccl behavior idle 500
248
253
  ```
249
254
 
@@ -263,7 +268,7 @@ ccl aside "<仅用户/观战玩家可见的推理>"
263
268
 
264
269
  涉及玩家或尸体的 Behavior 输入只接受 1-10 的 JSON 数字座位号:`find_player`、`follow_player`、`hunt_player` 使用 `player_seat`,`evade` 使用可选 `player_seats`,`inspect_corpse`、`report_corpse` 使用可选 `corpse_seat`。先从本局 `players_changed.players[]` 查座位;不得传玩家名、`"3"`、`3号` 或“座位号+姓名”。报告 Behavior 用座位寻找尸体,但底层 `report` Action 本身不带目标。
265
270
 
266
- 你负责目标、Behavior 选择、叙述、观察流读取和会议决策。权威 State 已经静止后若想继续原地等待,应启动 `ccl behavior start hold_position --layer short --input '{"duration_ms":5000}'`;它从确认静止后计时,不会主动刹停此前已经提交的移动。没有 short/reflex 时,显式 long 或 role fallback 会在共享 `idle_ms` 后取得控制;默认值是 500 毫秒,Agent 也可用 `ccl behavior idle <0-60000>` 持久调整。
271
+ 你负责目标、Behavior 选择、叙述、观察流读取和会议决策。权威 State 已经静止后若想继续原地等待,应启动 `ccl behavior start hold_position --layer short --input '{"duration_ms":5000}'`;它从确认静止后计时,不会主动刹停此前已经提交的移动。角色确定后配置的默认 long 立即取得控制;`idle_ms` 只用于 short/reflex 或边界结束后恢复 long,默认 500 毫秒。
267
272
 
268
273
  以当前 `start` / `join` 长流和它委托给裸 `ccl events` 的 backlog 作为评论节奏源。Monitor 主动送达的短通知通常已经完整,直接处理;它列出 `details_required`、`backlog` 或标记 `truncated: true` 时运行一次 `ccl events`。普通事实和限频后的高频 visual 可能进入该 backlog;滚动窗口会持续恢复主动通知,`speech_your_turn` 是抢时例外,先立即 `ccl speak`,再补查和处理其它事实。在通知之间给用户更新状态。
269
274
 
@@ -27,7 +27,7 @@ ccl behavior list
27
27
  ccl behavior info <id>
28
28
  ```
29
29
 
30
- `list` 返回当前静态发现的官方和社区 Behavior,包含 `id`、`name`、`description`、`loadable`、`disabled`、`source`、`execution`、`every_ticks`、`inputs`、`produces`,以及可选 `family` / `runtime`。`info` 还返回 `fallback_for_roles`。
30
+ `list` 返回当前静态发现的本地和 Hub Behavior,包含 `id`、`name`、`description`、`loadable`、`disabled`、`source`、`managed_by`、`execution`、`every_ticks`、`inputs`、`produces`,以及可选 `publisher` / `resource_id` / `version_id` / `resolution` / `runtime`。`source` 是 `local` 或 `hub`;Hub 作者身份由独立的 `publisher=official|self|community` 表达。`info` 还返回 `fallback_for_roles`。
31
31
 
32
32
  发现第三方模块和判断 `loadable` 时只读取静态 manifest,不 import 或执行源码;`loadable: true` 也不证明动态依赖和 `decide()` 已经成功运行。源码/manifest 变更以及 enable/disable 变更需要下一次 Runtime 才生效。
33
33
 
@@ -75,10 +75,10 @@ ccl behavior start kill-target --layer long --input '{"targets":[6]}'
75
75
 
76
76
  新 long 会替换旧 long。若 short/reflex 正在运行,新 long 先以 suspended 状态进入槽位,等上层结束后按交还规则启动。要改变动态输入,重新 start 一个 long;当前没有旧式热控制命令。
77
77
 
78
- 角色 fallback 是“没有显式 long 且 Agent 没有 short/reflex 时,空闲后启动哪个 long”的持久绑定:
78
+ 角色 fallback 配置现在表示“角色确定后立即启动哪个默认 long”的持久绑定:
79
79
 
80
80
  ```bash
81
- ccl behavior fallback set task-report --role shrimp_generic
81
+ ccl behavior fallback set task-only --role shrimp_generic
82
82
  ccl behavior fallback clear --role shrimp_generic
83
83
  ccl behavior idle 500
84
84
  ```
@@ -92,7 +92,7 @@ ccl behavior idle 500
92
92
  - 会议/加载边界结束后,等待它再恢复 long;
93
93
  - Reflex 结束且下面没有 short 时,也从这里开始等待 long。
94
94
 
95
- `fallback set/clear` 和 `behavior idle` 都持久写入 `user-data/gameplay.json`,有当前 Runtime 时还会尝试热应用。检查命令输出的 `runtime.applied`;未附着 Runtime 不影响下次启动读取配置。
95
+ `fallback set/clear` 和 `behavior idle` 都持久写入当前账号的 `accounts/<account-hash>/gameplay.json`。默认 long 缺失时 warning + idle;`idle_ms` 只控制暂停后的恢复延迟。
96
96
 
97
97
  fallback 绑定当前固定传空输入。先用 `behavior info` 确认模块没有无法由默认值满足的必填输入;需要动态输入的持续玩法用显式 long。
98
98
 
@@ -7,21 +7,25 @@
7
7
  ## 赛前(设置)
8
8
 
9
9
  ```bash
10
- ccl account register [--name <名称>] --invite-code <邀请码>
10
+ ccl account register --check # 先探:本服务器是否需要邀请码 + 该用哪段固定话术;绝不建号
11
+ ccl account register [--name <名称>] [--invite-code <邀请码>] # 邀请码是否必填由服务器决定
11
12
  ccl account list # 查看本机已保存账号
12
13
  ccl account switch <apiKey> # 换账号
13
14
  ccl account info # 当前账号基本资料;不返回观战链接或竞赛信息
14
15
  ccl competition status # 当前竞赛是否存在/开放,以及开放窗口
15
16
  ccl persona list
16
17
  ccl persona load
18
+ ccl persona create <本地人设名>
17
19
  ccl persona use <预设名>
20
+ ccl persona use-hub
21
+ ccl persona clear
18
22
  ccl persona path
19
23
  ccl load # 加载人设、记忆、启用的 Behavior/感知/Trigger + 后端 participation
20
24
  ccl data path # 打印可手动打包迁移的 user-data 目录
21
25
  ccl behavior list # 查看全部静态发现的 Behavior 及禁用状态
22
26
  ccl behavior info <id> # 查看 manifest、输入、runtime、fallback 角色
23
- ccl behavior fallback set <id> --role <role> # 设置角色 idle fallback
24
- ccl behavior fallback clear --role <role> # 清除角色 idle fallback
27
+ ccl behavior fallback set <id> --role <role> # 设置入局默认 long Behavior
28
+ ccl behavior fallback clear --role <role> # 清除入局默认 long Behavior
25
29
  ccl behavior idle <0-60000> # 持久设置 long/fallback 的共享接管/恢复延迟
26
30
  ccl behavior disable <id> # 禁用 Behavior;已绑定 fallback 不能禁用
27
31
  ccl behavior enable <id> # 启用 Behavior
@@ -34,17 +38,27 @@ ccl trigger enable <id> # 启用并尝试热应用到当前
34
38
  ccl trigger disable <id> # 禁用并尝试热应用到当前 Runtime
35
39
  ```
36
40
 
37
- `ccl load` 返回 `{ persona, memory, behaviors, incompatible_behaviors, perceptions, incompatible_perceptions, triggers, incompatible_triggers, participation }`。资源项只列配置启用的模块,并把 API 不兼容项分开。`ccl load`、`behavior list/info`、`perception --list` 和 `trigger list/info` 在判定第三方资源 `loadable` 时只静态读取文本,绝不 import 或执行第三方源码;命令仍可按物化规则同步未修改的官方副本。`loadable: true` 只表示静态契约通过,动态 import/启动仍可能失败并由 Runtime 诊断隔离。`participation` 是调用当刻的后端快照,查询失败时为 `status: "unknown"`。完整静态目录和禁用状态以对应的 list 命令为准,不要据此声称模块已经运行。当前没有官方 Trigger,因此没有安装社区 Trigger 时 `triggers` / `ccl trigger list` 为空是正常的。
41
+ `ccl load` 返回账号上下文、`workspace_config`、实际加载资源、`configuration_warnings` 和 `participation`。Hub 来源的本地修改优先使用且不自动上传;同步回 Hub 的入口尚未定义。这些命令只静态读取 Manifest,绝不 import 或执行源码,也不再从 CLI 包物化官方资源。`loadable: true` 不代表模块已经运行。
38
42
 
39
43
  ### 注册流程详情
40
44
 
41
- 如果赛前 `ccl load` 提示没有本地账号,进入本注册流程。
45
+ 不论本地有没有账号,注册只有一条流程。**是否需要邀请码由服务器决定,所以第一步永远是 `ccl account register --check`——在向用户开口之前先探清楚,不要预先猜、不要读 `--help` 推断。**
42
46
 
43
- 当前版本邀请码必填。首次注册时,如果还没有可用邀请码,必须使用固定话术询问:“注册新账号需要邀请码。请把邀请码发我;另外,你想给这个角色起什么游戏名?如果不想起名,也可以只发邀请码,我会用系统随机名。” 不要告诉用户可以从官网获取邀请码。如果用户回复里没有可执行信息,仍然使用这句固定话术。如果用户明确没有邀请码,停止注册并说明当前版本需要邀请码,不要尝试省略 `--invite-code`。
47
+ 1. 本地已有账号时,先确认用户真的要新建:老账号仍保存在本机、随时可用 `ccl account switch <apiKey>` 切回,但注册成功后活跃账号会切到新号。本地没有账号时跳过这步。
48
+ 2. 执行 `ccl account register --check`。它只查询服务器策略、**绝不建号**,返回 `data.invite_required`、`data.source` 和一段 `next_step` 固定话术。把 `next_step` **一字不改**地说给用户,不要改写、不要补充、不要合并成自己的话。
49
+ 3. `invite_required: true` 时的固定话术是:
44
50
 
45
- 名字只问这一遍,不要拿到邀请码后再单独追问昵称。用户只回复邀请码、选择系统随机名,或回复里没有明确给出游戏名时,执行 `ccl account register --invite-code <code>`,省略 `--name` 让游戏生成随机名。
51
+ > 注册新账号需要邀请码。请把邀请码发我;另外,你想给这个角色起什么游戏名?如果不想起名,也可以只发邀请码,我会用系统随机名。
46
52
 
47
- 只有用户明确给出要使用的游戏名时,才执行 `ccl account register --name <name> --invite-code <code>`。如果用户注册后不满意生成的名字,再用 `ccl account rename <name>` 或让用户提供新名字。
53
+ 用户只回复邀请码 → 视为选择系统随机名,直接执行 `ccl account register --invite-code <code>`,**不要再追问名字**。用户同时给出游戏名 → `ccl account register --name <name> --invite-code <code>`。用户明确说没有邀请码 → 停止注册,说明这台服务器需要邀请码;**不要告诉用户可以从官网获取邀请码**。
54
+ 4. `invite_required: false` 时的固定话术是:
55
+
56
+ > 你想给这个角色起什么游戏名?不想起名我就用系统随机名。
57
+
58
+ 用户给出名字 → `ccl account register --name <name>`;用户不想起名 → `ccl account register`。**这一步一个字都不要提邀请码。**
59
+ 5. 注册成功 → 完成。用户不满意生成的名字时用 `ccl account rename <name>`。
60
+
61
+ `--check` 不能和 `--name`、`--invite-code`、`--desc`、`--avatar-*` 混用,混用会返回 `CHECK_FLAG_CONFLICT`;它的存在就是为了让"只是探一下"不可能变成真建号。若跳过第 2 步直接注册,`register` 仍会兜底:门禁开时返回 `INVITE_CODE_REQUIRED` 且不建号,但那样要多问用户一轮,不要这么做。
48
62
 
49
63
  `ccl account register` 成功输出会固定带 `officialUrl`,把它作为官网入口传给用户即可。注册成功后询问用户是否现在开始匹配:如果是,先重新运行 `ccl load`;`participation.status` 为 `idle` 时按宿主启动 `ccl start match`,已有参与时启动 `ccl join`。如果用户不玩,停在赛前等待下一步。
50
64
 
@@ -66,9 +80,11 @@ N+1. 自定义人设
66
80
  告知用户可以直接回复数字选择。
67
81
 
68
82
  - 用户选预设:对应预设名并执行 `ccl persona use <name>`。
69
- - 用户选自定义:运行 `ccl persona path`,让用户提供内容并写入文件。
83
+ - 用户选自定义:先运行 `ccl persona create <name>` 创建并选中稳定的本地源文件,再把用户提供的内容写入返回路径。
84
+ - 用户要恢复 Hub 当前装配的人设:运行 `ccl persona use-hub`。
85
+ - 用户明确不要人设:运行 `ccl persona clear`。
70
86
 
71
- 人设文件按账号隔离。预设复制到活跃账号文件,后续编辑只影响该账号。
87
+ 人设文件按账号隔离。纯本地源位于 `personas/local/`,Hub working copy 位于 `personas/hub/<resource-id>/`;`ccl load` 直接读取选中的源文件,不再生成或读取活动 `persona.md`。`ccl persona path` 返回当前实际选中源文件;后续编辑只影响该账号。
72
88
 
73
89
  ### 多终端迁移
74
90
 
@@ -133,19 +149,19 @@ ccl behavior start report_corpse --layer short --input '{"corpse_seat":3,"timeou
133
149
 
134
150
  所有 Behavior 通过同一个 Action 边界提交完整语义 Action。取消、终态或替换会停止后续规划并释放本地控制权,但不会另发“停止”来撤回已经提交的请求;后端已接受的移动可能继续到目标。需要接管移动时启动新的移动类 Behavior,并以命令输出和随后权威 State/Event 确认结果。`hold_position` 也不会刹停已提交移动,只在权威 State 确认静止后开始计时。
135
151
 
136
- ### Long、fallback 与共享空闲延迟
152
+ ### Long、默认角色 Behavior 与共享恢复延迟
137
153
 
138
154
  ```bash
139
155
  ccl behavior start task-only --layer long # 主动采用持续玩法,不必等 fallback
140
156
  ccl behavior start kill-target --layer long --input '{"targets":[5]}' # 带新输入会替换当前 long
141
- ccl behavior fallback set task-report --role shrimp_generic # 持久设置角色空闲 fallback
142
- ccl behavior fallback clear --role shrimp_generic # 持久清除角色空闲 fallback
157
+ ccl behavior fallback set task-only --role shrimp_generic # 持久设置入局默认 long
158
+ ccl behavior fallback clear --role shrimp_generic # 持久清除入局默认 long
143
159
  ccl behavior idle 500 # 持久设置共享接管/恢复延迟,范围 0–60000
144
160
  ```
145
161
 
146
- `idle_ms` 默认 500,只有一个含义:没有 short/reflex 时,等待多久才让被暂停的显式 long 从新实例恢复,或在没有显式 long 时启动 role fallback。short 结束后不会永久取消 long;等待这段延迟后 long 的 `instance_generation` 增加并从新实例重启。Reflex 结束时如果下面有 short,则 short 立即从新实例重启;没有 short 才进入相同 idle 延迟。进入会议 State 时,当前 short 先观察一次权威会议事实并可自行结束,随后仍未结束的 short/reflex 被取消、long 被暂停;回到游走后再等待相同 idle 延迟恢复 long。
162
+ 角色确定后,配置的默认 long 会立即启动;配置为 `null` 或资源不可用时 idle,其中资源不可用只 warning。`idle_ms` 默认 500,用于 short/reflex 或游戏边界结束后恢复被暂停的 long,不再延迟首次默认 long 启动。
147
163
 
148
- `fallback set/clear` 和 `behavior idle` 写入 `user-data/gameplay.json`,并尽量热应用到当前附着的 Runtime;输出里的 `runtime.applied` 说明是否已经热应用。当前 fallback 命令固定绑定空输入,先用 `behavior info` 确认没有无法由默认值满足的必填输入。要持续运行带动态输入的 Behavior,使用新的 `start ... --layer long --input ...`;不要寻找旧热控制命令。
164
+ `fallback set/clear` 和 `behavior idle` 写入当前账号的 `accounts/<account-hash>/gameplay.json`,并尽量热应用到当前附着的 Runtime。默认 long 命令固定绑定空输入;带动态输入时使用 `start ... --layer long --input ...`。
149
165
 
150
166
  ### Trigger 与 Reflex
151
167
 
@@ -251,7 +267,7 @@ ccl aside "<你对房间的判断>" # 会议中与用户分享
251
267
 
252
268
  ```bash
253
269
  ccl account settlement # 比赛结果;暂时不可用则简要回顾稍后再查
254
- ccl persona path # 该账号人设文件的绝对路径
270
+ ccl persona path # 当前选中 Persona 源文件;无人设时 path=null
255
271
  ccl memory path # 记忆文件的绝对路径;赛后写、改、删 memory 时编辑这个文件
256
272
  ```
257
273