@myclaw163/clawclaw-cli 0.8.3 → 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 (264) hide show
  1. package/README.md +4 -3
  2. package/docs/configuration.md +44 -26
  3. package/docs/custom-modules/README.md +7 -10
  4. package/docs/custom-modules/api-reference.md +3 -7
  5. package/docs/custom-modules/behavior.md +6 -4
  6. package/docs/custom-modules/perception.md +1 -1
  7. package/docs/custom-modules/trigger.md +1 -1
  8. package/docs/runtime/README.md +4 -4
  9. package/docs/runtime/official-perception-modules.md +2 -2
  10. package/docs/runtime/owner-lifecycle-and-observability.md +1 -1
  11. package/package.json +9 -2
  12. package/scripts/build-official-hub-behaviors.mjs +136 -0
  13. package/scripts/build-official-hub-behaviors.test.mjs +178 -0
  14. package/scripts/enable_ccl_permissions.cjs +4 -2
  15. package/scripts/enable_ccl_permissions.test.mjs +8 -4
  16. package/scripts/postinstall.mjs +1 -4
  17. package/scripts/sync-bundled-skill.mjs +12 -159
  18. package/scripts/sync-bundled-skill.test.mjs +9 -74
  19. package/skills/clawclaw/SKILL.md +18 -13
  20. package/skills/clawclaw/references/BEHAVIORS.md +4 -4
  21. package/skills/clawclaw/references/COMMANDS.md +33 -18
  22. package/skills/clawclaw/references/GAME-MECHANICS.md +16 -18
  23. package/skills/clawclaw/references/HUB.md +25 -38
  24. package/skills/clawclaw/references/STREAM.md +9 -11
  25. package/src/behaviors/official-finite/do-task.ts +70 -0
  26. package/src/behaviors/official-finite/index.ts +0 -3
  27. package/src/commands/account.ts +58 -14
  28. package/src/commands/behavior.ts +116 -38
  29. package/src/commands/hub.ts +110 -153
  30. package/src/commands/load.ts +138 -33
  31. package/src/commands/perception.ts +55 -24
  32. package/src/commands/persona.ts +66 -20
  33. package/src/commands/skill.ts +12 -48
  34. package/src/commands/trigger.ts +68 -40
  35. package/src/hub-official-behaviors/kill-lone.ts +138 -0
  36. package/src/hub-official-behaviors/patrol.ts +30 -0
  37. package/src/hub-official-behaviors/shared.ts +125 -0
  38. package/src/hub-official-behaviors/task-only.ts +158 -0
  39. package/src/lib/account-guidance.ts +54 -9
  40. package/src/lib/agent-workspace-client.ts +135 -0
  41. package/src/lib/agent-workspace-runtime.ts +154 -0
  42. package/src/lib/agent-workspace-skills.ts +177 -0
  43. package/src/lib/agent-workspace-sync.ts +852 -0
  44. package/src/lib/gameplay-config.ts +29 -15
  45. package/src/lib/hub-client.ts +252 -34
  46. package/src/lib/hub-reminder.ts +22 -7
  47. package/src/lib/init-command.ts +0 -6
  48. package/src/lib/load-context.ts +12 -6
  49. package/src/lib/persona.ts +141 -69
  50. package/src/lib/server-status.ts +78 -0
  51. package/src/lib/skill-host.ts +160 -0
  52. package/src/lib/user-data.ts +197 -4
  53. package/src/pipeline/event-format.ts +20 -4
  54. package/src/pipeline/event-hints.ts +20 -6
  55. package/src/pipeline/game-sync-event-normalization.ts +9 -0
  56. package/src/pipeline/role-display.ts +22 -0
  57. package/src/runtime/clawclaw/agent-ability-state.ts +1 -21
  58. package/src/runtime/clawclaw/agent-event-policy.ts +1 -0
  59. package/src/runtime/clawclaw/owner.ts +63 -19
  60. package/src/runtime/clawclaw/plugins/action/action-plugin.ts +8 -1
  61. package/src/runtime/clawclaw/plugins/action/automated-action-normalization.ts +0 -1
  62. package/src/runtime/clawclaw/plugins/behavior/activation-manager.ts +8 -2
  63. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +2 -2
  64. package/src/runtime/clawclaw/plugins/behavior/official-goal-behavior.ts +0 -9
  65. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +4 -1
  66. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +11 -5
  67. package/src/runtime/clawclaw/plugins/perception/replay.ts +0 -2
  68. package/src/runtime/clawclaw-event-catalog.ts +2 -0
  69. package/src/runtime/framework/action-diagnostics.ts +1 -0
  70. package/src/runtime/framework/modules/runtime-module-loader.ts +0 -1
  71. package/src/sdk/action.ts +8 -6
  72. package/src/sdk/behavior-plugin/index.ts +1 -2
  73. package/src/sdk/behavior-toolkit/model.ts +2 -0
  74. package/src/sdk/module-input/index.ts +0 -2
  75. package/src/strategies/goals/crab-sabotage-top.ts +5 -61
  76. package/src/strategies/types.ts +0 -6
  77. package/personas//345/217/243/346/230/257/345/277/203/351/235/236.md +0 -50
  78. package/personas//345/277/240/345/277/203/350/200/201/344/273/206.md +0 -51
  79. package/personas//346/227/240/344/272/272/350/256/276.md +0 -1
  80. package/personas//350/264/253/345/230/264/346/215/237/345/217/213.md +0 -48
  81. package/personas//350/275/257/350/220/214/350/205/271/351/273/221.md +0 -51
  82. package/src/behaviors/official-finite/index.test.ts +0 -202
  83. package/src/behaviors/official-finite/trigger-alarm.ts +0 -53
  84. package/src/channel/claude-channel-server.test.ts +0 -202
  85. package/src/commands/account.test.ts +0 -570
  86. package/src/commands/behavior.test.ts +0 -158
  87. package/src/commands/communication.test.ts +0 -282
  88. package/src/commands/competition.test.ts +0 -116
  89. package/src/commands/data.test.ts +0 -89
  90. package/src/commands/events-canonical-state.test.ts +0 -406
  91. package/src/commands/events.test.ts +0 -58
  92. package/src/commands/game/index.test.ts +0 -1251
  93. package/src/commands/game-map.test.ts +0 -69
  94. package/src/commands/hub.test.ts +0 -124
  95. package/src/commands/load.test.ts +0 -440
  96. package/src/commands/perception.test.ts +0 -75
  97. package/src/commands/setup/hermes.test.ts +0 -96
  98. package/src/commands/setup/openclaw.test.ts +0 -124
  99. package/src/commands/trigger.test.ts +0 -140
  100. package/src/commands/upgrade.test.ts +0 -82
  101. package/src/lib/account-guidance.test.ts +0 -36
  102. package/src/lib/auth.test.ts +0 -151
  103. package/src/lib/behavior-export.test.ts +0 -282
  104. package/src/lib/behavior-export.ts +0 -514
  105. package/src/lib/clawclaw-skill-spectate-guidance.test.ts +0 -21
  106. package/src/lib/custom-tts.test.ts +0 -387
  107. package/src/lib/diagnostics-config.test.ts +0 -59
  108. package/src/lib/game-client-tts.test.ts +0 -151
  109. package/src/lib/game-client.test.ts +0 -250
  110. package/src/lib/gameplay-config.test.ts +0 -301
  111. package/src/lib/host-config-patcher.test.ts +0 -130
  112. package/src/lib/http-transport.test.ts +0 -124
  113. package/src/lib/hub-client.test.ts +0 -57
  114. package/src/lib/hub-install.test.ts +0 -135
  115. package/src/lib/hub-install.ts +0 -185
  116. package/src/lib/hub-unzip.test.ts +0 -69
  117. package/src/lib/init-command.test.ts +0 -103
  118. package/src/lib/load-context.test.ts +0 -62
  119. package/src/lib/match-state.test.ts +0 -134
  120. package/src/lib/official-resource-sync.test.ts +0 -199
  121. package/src/lib/official-resource-sync.ts +0 -221
  122. package/src/lib/perception-config.test.ts +0 -143
  123. package/src/lib/perception-export.test.ts +0 -145
  124. package/src/lib/perception-export.ts +0 -178
  125. package/src/lib/persona.test.ts +0 -84
  126. package/src/lib/room.test.ts +0 -88
  127. package/src/lib/server-registry.test.ts +0 -64
  128. package/src/lib/service-status.test.ts +0 -81
  129. package/src/lib/skill-version.test.ts +0 -48
  130. package/src/lib/trigger-config.test.ts +0 -102
  131. package/src/lib/trigger-export.test.ts +0 -80
  132. package/src/lib/trigger-export.ts +0 -210
  133. package/src/lib/user-data.test.ts +0 -121
  134. package/src/lib/workspace-argv.test.ts +0 -49
  135. package/src/pipeline/canonical-event-presentation.test.ts +0 -255
  136. package/src/pipeline/event-format.test.ts +0 -828
  137. package/src/pipeline/event-hints.test.ts +0 -316
  138. package/src/pipeline/game-sync-event-normalization.test.ts +0 -371
  139. package/src/pipeline/player-projection.test.ts +0 -247
  140. package/src/runtime/auto-upgrade.test.ts +0 -66
  141. package/src/runtime/canonical-event-emitter.test.ts +0 -70
  142. package/src/runtime/canonical-monitor.test.ts +0 -577
  143. package/src/runtime/clawclaw/agent-event-policy.test.ts +0 -58
  144. package/src/runtime/clawclaw/behavior-decision.test.ts +0 -43
  145. package/src/runtime/clawclaw/behavior-input-fields.test.ts +0 -175
  146. package/src/runtime/clawclaw/behavior-input.test.ts +0 -173
  147. package/src/runtime/clawclaw/behavior-observation-memory.test.ts +0 -59
  148. package/src/runtime/clawclaw/behavior-read-api.test.ts +0 -123
  149. package/src/runtime/clawclaw/notifications.test.ts +0 -47
  150. package/src/runtime/clawclaw/owner-lock.test.ts +0 -221
  151. package/src/runtime/clawclaw/owner.test.ts +0 -203
  152. package/src/runtime/clawclaw/plugins/action/action-plugin.test.ts +0 -304
  153. package/src/runtime/clawclaw/plugins/assembly.test.ts +0 -200
  154. package/src/runtime/clawclaw/plugins/behavior/activation-manager.test.ts +0 -180
  155. package/src/runtime/clawclaw/plugins/behavior/behavior-action.test.ts +0 -40
  156. package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.test.ts +0 -156
  157. package/src/runtime/clawclaw/plugins/behavior/behavior-module-loader.test.ts +0 -182
  158. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.test.ts +0 -1094
  159. package/src/runtime/clawclaw/plugins/behavior/behavior-source.test.ts +0 -174
  160. package/src/runtime/clawclaw/plugins/behavior/control-driver.test.ts +0 -195
  161. package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.test.ts +0 -283
  162. package/src/runtime/clawclaw/plugins/behavior-input-source.test.ts +0 -80
  163. package/src/runtime/clawclaw/plugins/derived-event/derived-event-plugin.test.ts +0 -267
  164. package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.test.ts +0 -226
  165. package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.test.ts +0 -239
  166. package/src/runtime/clawclaw/plugins/mailbox/agent-mailbox-coordinator.test.ts +0 -407
  167. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-push.integration.test.ts +0 -397
  168. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.test.ts +0 -270
  169. package/src/runtime/clawclaw/plugins/mailbox/mailbox-agent-event-batch.test.ts +0 -166
  170. package/src/runtime/clawclaw/plugins/mailbox/mailbox-event-batch-delivery.test.ts +0 -194
  171. package/src/runtime/clawclaw/plugins/mailbox/mailbox-plugin.test.ts +0 -87
  172. package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.test.ts +0 -2012
  173. package/src/runtime/clawclaw/plugins/perception/module-runner.test.ts +0 -214
  174. package/src/runtime/clawclaw/plugins/perception/modules/co-movement-module.ts +0 -347
  175. package/src/runtime/clawclaw/plugins/perception/modules/corpse-visibility-module.test.ts +0 -92
  176. package/src/runtime/clawclaw/plugins/perception/modules/corpse-visibility-module.ts +0 -248
  177. package/src/runtime/clawclaw/plugins/perception/modules/follow-module.ts +0 -389
  178. package/src/runtime/clawclaw/plugins/perception/modules/index.ts +0 -8
  179. package/src/runtime/clawclaw/plugins/perception/modules/motion-module.test.ts +0 -342
  180. package/src/runtime/clawclaw/plugins/perception/modules/motion-module.ts +0 -475
  181. package/src/runtime/clawclaw/plugins/perception/modules/parallel-module-test-helpers.ts +0 -30
  182. package/src/runtime/clawclaw/plugins/perception/modules/relation-stability.test.ts +0 -304
  183. package/src/runtime/clawclaw/plugins/perception/modules/route-module.test.ts +0 -179
  184. package/src/runtime/clawclaw/plugins/perception/modules/route-module.ts +0 -364
  185. package/src/runtime/clawclaw/plugins/perception/modules/spatial-module.test.ts +0 -81
  186. package/src/runtime/clawclaw/plugins/perception/modules/spatial-module.ts +0 -200
  187. package/src/runtime/clawclaw/plugins/perception/modules/stop-module.test.ts +0 -216
  188. package/src/runtime/clawclaw/plugins/perception/modules/stop-module.ts +0 -284
  189. package/src/runtime/clawclaw/plugins/perception/modules/temporal-evidence.test.ts +0 -120
  190. package/src/runtime/clawclaw/plugins/perception/modules/visibility-module.test.ts +0 -105
  191. package/src/runtime/clawclaw/plugins/perception/modules/visibility-module.ts +0 -269
  192. package/src/runtime/clawclaw/plugins/perception/perception-analysis-thread-pool.test.ts +0 -865
  193. package/src/runtime/clawclaw/plugins/perception/perception-plugin.test.ts +0 -1878
  194. package/src/runtime/clawclaw/plugins/perception/perception-source.test.ts +0 -278
  195. package/src/runtime/clawclaw/plugins/perception/replay.test.ts +0 -77
  196. package/src/runtime/clawclaw/plugins/runtime-plugins.test.ts +0 -854
  197. package/src/runtime/clawclaw/plugins/source/game-transport.test.ts +0 -287
  198. package/src/runtime/clawclaw/plugins/source/player-change-tracker.test.ts +0 -321
  199. package/src/runtime/clawclaw/plugins/source/room-transport.test.ts +0 -307
  200. package/src/runtime/clawclaw/plugins/source/source-plugin.test.ts +0 -2646
  201. package/src/runtime/clawclaw/plugins/source/task-change-tracker.test.ts +0 -212
  202. package/src/runtime/clawclaw/plugins/trigger/trigger-plugin.test.ts +0 -548
  203. package/src/runtime/clawclaw/plugins/trigger/trigger-source.test.ts +0 -169
  204. package/src/runtime/clawclaw/runtime-data-export.test.ts +0 -249
  205. package/src/runtime/clawclaw-event-catalog.test.ts +0 -126
  206. package/src/runtime/framework/action-diagnostics.test.ts +0 -81
  207. package/src/runtime/framework/capability-registry.test.ts +0 -423
  208. package/src/runtime/framework/control-coordinator.test.ts +0 -675
  209. package/src/runtime/framework/events/event-delivery-service.test.ts +0 -84
  210. package/src/runtime/framework/events/event-ingress.test.ts +0 -203
  211. package/src/runtime/framework/events/mailbox-event-repositories.test.ts +0 -710
  212. package/src/runtime/framework/events/sqlite-event-repository.test.ts +0 -802
  213. package/src/runtime/framework/mailbox/coalescer.test.ts +0 -55
  214. package/src/runtime/framework/mailbox/identity.test.ts +0 -38
  215. package/src/runtime/framework/mailbox/mailbox-dispatcher.test.ts +0 -513
  216. package/src/runtime/framework/mailbox/notification-projector.test.ts +0 -77
  217. package/src/runtime/framework/modules/runtime-module-loader.test.ts +0 -435
  218. package/src/runtime/framework/participation-manager.test.ts +0 -108
  219. package/src/runtime/framework/plugins/runtime-input-journal.test.ts +0 -179
  220. package/src/runtime/framework/plugins/runtime-plugin-scheduler.test.ts +0 -2040
  221. package/src/runtime/framework/state/durable-agent-state-snapshot.test.ts +0 -144
  222. package/src/runtime/framework/state/history/sqlite-state-history-repository.test.ts +0 -157
  223. package/src/runtime/framework/state/history/state-history.test.ts +0 -251
  224. package/src/runtime/framework/state/state-core.test.ts +0 -197
  225. package/src/runtime/game-sync-protocol.test.ts +0 -123
  226. package/src/runtime/host-monitor-rate-gate.test.ts +0 -73
  227. package/src/runtime/mailbox-host-relay.test.ts +0 -293
  228. package/src/runtime/observability/observability.test.ts +0 -583
  229. package/src/runtime/owner-control.test.ts +0 -153
  230. package/src/runtime/parent-process-watch.test.ts +0 -27
  231. package/src/runtime/pending-event-handoff.test.ts +0 -29
  232. package/src/runtime/raw-ws-log.test.ts +0 -102
  233. package/src/runtime/runtime-logger.test.ts +0 -58
  234. package/src/runtime/runtime-persistence.test.ts +0 -26
  235. package/src/runtime/runtime.test.ts +0 -1770
  236. package/src/runtime/ws-client.test.ts +0 -562
  237. package/src/sdk/behavior-plugin/index.test.ts +0 -74
  238. package/src/sdk/index.test.ts +0 -45
  239. package/src/sdk/module-input/index.test.ts +0 -49
  240. package/src/sdk/perception-plugin/index.test.ts +0 -22
  241. package/src/sdk/resource-metadata.test.ts +0 -40
  242. package/src/sdk/trigger-plugin/index.test.ts +0 -41
  243. package/src/short-command/classifier.test.ts +0 -107
  244. package/src/short-command/presenter.test.ts +0 -119
  245. package/src/short-command/runner.test.ts +0 -78
  246. package/src/short-command/sensitive-data-filter.test.ts +0 -56
  247. package/src/short-command/transport-response.test.ts +0 -39
  248. package/src/strategies/custom-module.test.ts +0 -268
  249. package/src/strategies/game-utils.test.ts +0 -306
  250. package/src/strategies/goals/avoid-players-top.test.ts +0 -96
  251. package/src/strategies/goals/crab-sabotage-top.test.ts +0 -145
  252. package/src/strategies/goals/kill-lone-top.test.ts +0 -97
  253. package/src/strategies/goals/kill-target-top.test.ts +0 -66
  254. package/src/strategies/goals/lone-kill-task-top.test.ts +0 -85
  255. package/src/strategies/goals/normal-shrimp-top.test.ts +0 -113
  256. package/src/strategies/goals/paradise-fish-top.test.ts +0 -204
  257. package/src/strategies/goals/task-only-top.test.ts +0 -89
  258. package/src/strategies/goals/warrior-shrimp-top.test.ts +0 -139
  259. package/src/strategies/meeting-gate.test.ts +0 -59
  260. package/src/strategies/official-long-behavior.test.ts +0 -89
  261. package/src/strategies/pathfind/astar-path.test.ts +0 -198
  262. package/src/strategies/pathfind/escape-planner.test.ts +0 -223
  263. package/src/strategies/player-targets.test.ts +0 -10
  264. package/src/strategies/task-only.test.ts +0 -138
@@ -1,16 +1,7 @@
1
- // src/commands/hub.ts
2
1
  import { Command } from 'commander';
3
- import { spawnSync } from 'child_process';
4
- import { existsSync, readdirSync, statSync } from 'fs';
5
- import { join } from 'path';
6
- import { createRequire } from 'module';
7
2
  import { ApiError, formatApiError } from '../lib/http-transport.js';
8
3
  import { HubClient, parseResourceRef } from '../lib/hub-client.js';
9
- import type { ListOptions } from '../lib/hub-client.js';
10
- import { installResource, uninstallResource, listInstalled, readLockfile } from '../lib/hub-install.js';
11
- import { getWorkspaceDir } from '../lib/init-command.js';
12
-
13
- const require = createRequire(import.meta.url);
4
+ import type { ListOptions, ResourceType } from '../lib/hub-client.js';
14
5
 
15
6
  export interface HubCommandDeps {
16
7
  clientFactory?: () => HubClient;
@@ -32,57 +23,23 @@ function handleError(err: unknown): never {
32
23
  fail({ error: 'hub_error', message: (err as any)?.message ?? String(err) });
33
24
  }
34
25
 
35
- /** Find the real skill root: if SKILL.md is not at root but a single subdirectory contains it, use that. */
36
- function findSkillRoot(absPath: string): string {
37
- if (existsSync(join(absPath, 'SKILL.md'))) return absPath;
38
- let entries: string[];
39
- try { entries = readdirSync(absPath); } catch { return absPath; }
40
- const dirs = entries.filter(e => {
41
- try { return statSync(join(absPath, e)).isDirectory() && !e.startsWith('.'); } catch { return false; }
42
- });
43
- if (dirs.length === 1 && existsSync(join(absPath, dirs[0], 'SKILL.md'))) {
44
- return join(absPath, dirs[0]);
45
- }
46
- return absPath;
47
- }
48
-
49
- /** Best-effort skill registration via the skills CLI. Returns true on success; false means manual ccl skill install is needed. */
50
- async function registerSkill(absPath: string): Promise<boolean> {
51
- try {
52
- const root = findSkillRoot(absPath);
53
- // Guard against a hub skill overwriting the built-in clawclaw skill.
54
- const { readSkillName } = await import('./skill.js');
55
- if (readSkillName(root) === 'clawclaw') {
56
- console.error('warning: this skill is named "clawclaw" which would overwrite the built-in clawclaw skill; install manually if intended.');
57
- return false;
58
- }
59
- const bin = require.resolve('skills/bin/cli.mjs');
60
- const result = spawnSync(process.execPath, [bin, 'add', root, '-y', '-g'], {
61
- stdio: 'pipe',
62
- timeout: 30_000,
63
- });
64
- // Forward CLI output to stderr so --json stdout stays clean.
65
- if (result.stdout?.length) process.stderr.write(result.stdout);
66
- if (result.stderr?.length) process.stderr.write(result.stderr);
67
- return result.status === 0 && !result.error;
68
- } catch {
69
- return false;
26
+ function typeOption(value: string): ResourceType {
27
+ if (!['skill', 'strategy', 'persona', 'perception'].includes(value)) {
28
+ throw new Error('type must be skill, strategy, persona, or perception');
70
29
  }
30
+ return value as ResourceType;
71
31
  }
72
32
 
73
33
  export function createHubCommand(deps: HubCommandDeps = {}): Command {
74
- const hub = new Command('hub').description('Browse ClawClawHub packages and install compatible skills or personas');
75
- const legacyStrategyMessage =
76
- 'Legacy Hub strategy packages are not compatible with Behavior API v3. '
77
- + 'Install a reviewed Behavior module in user-data/behaviors/; Hub Behavior distribution is not available yet.';
34
+ const hub = new Command('hub')
35
+ .description('Browse Hub resources and manage the active account workspace');
78
36
 
79
- // search
80
37
  hub.command('search [query]')
81
- .description('Search/browse the hub (no query = top packages)')
82
- .option('--type <type>', 'skill | strategy | persona')
83
- .option('--sort <sort>', 'latest | downloads | stars', 'latest')
38
+ .description('Search or browse public Hub resources')
39
+ .option('--type <type>', 'skill | strategy | persona | perception', typeOption)
40
+ .option('--sort <sort>', 'latest | likes | comments', 'latest')
84
41
  .option('--limit <n>', 'max results', '20')
85
- .option('--page <n>', 'page number', '1')
42
+ .option('--cursor <cursor>', 'cursor from the previous response')
86
43
  .option('--json', 'machine-readable output')
87
44
  .action(async (query: string | undefined, opts: any) => {
88
45
  try {
@@ -91,142 +48,142 @@ export function createHubCommand(deps: HubCommandDeps = {}): Command {
91
48
  type: opts.type,
92
49
  sort: opts.sort,
93
50
  limit: Number(opts.limit),
94
- page: Number(opts.page),
51
+ cursor: opts.cursor,
95
52
  };
96
- const res = await getClient(deps).list(search);
53
+ const result = await getClient(deps).list(search);
97
54
  if (opts.json) {
98
- console.log(JSON.stringify(res, null, 2));
55
+ console.log(JSON.stringify(result, null, 2));
99
56
  return;
100
57
  }
101
- if (res.items.length === 0) {
102
- console.log('No packages found.');
58
+ if (result.items.length === 0) {
59
+ console.log('No Hub resources found.');
103
60
  return;
104
61
  }
105
- for (const p of res.items) {
106
- const isStrategy = p.type === 'strategy';
107
- const code = isStrategy ? ' ⚠legacy-incompatible-code' : '';
108
- console.log(p.type + '/' + p.id + ' [' + p.type + code + '] ↓' + p.stats.downloadCount + ' ★' + p.stats.starCount);
109
- console.log(' ' + p.title + ' — ' + p.description);
110
- if (p.creatorDisplayName) console.log(' by ' + p.creatorDisplayName + ' (' + p.creator + ')');
62
+ for (const item of result.items) {
63
+ const installed = item.isInstalled ? ' installed' : '';
64
+ console.log(`${item.type}/${item.id} [${item.type}${installed}] installs:${item.stats.downloadCount} likes:${item.stats.starCount}`);
65
+ console.log(` ${item.title} — ${item.description}`);
66
+ if (item.creatorDisplayName) console.log(` by ${item.creatorDisplayName}`);
111
67
  }
112
- console.log('\n' + res.items.length + ' of ' + res.total + '. Compatible skill/persona: ccl hub install <type>/<id>');
113
- } catch (err) { handleError(err); }
68
+ if (result.pagination.hasMore && result.pagination.nextCursor) {
69
+ console.log(`\nMore: --cursor ${result.pagination.nextCursor}`);
70
+ }
71
+ console.log('\nInstall to workspace: ccl hub install <type>/<id>');
72
+ } catch (err) {
73
+ handleError(err);
74
+ }
114
75
  });
115
76
 
116
- // info
117
77
  hub.command('info <type/id>')
118
- .description('Show package detail and the install command')
78
+ .description('Show one Hub resource')
119
79
  .option('--json', 'machine-readable output')
120
80
  .action(async (ref: string, opts: any) => {
121
81
  try {
122
82
  const { type, id } = parseResourceRef(ref);
123
- const d = await getClient(deps).getResource(type, id);
83
+ const detail = await getClient(deps).getResource(type, id);
124
84
  if (opts.json) {
125
- console.log(JSON.stringify(d, null, 2));
85
+ console.log(JSON.stringify(detail, null, 2));
126
86
  return;
127
87
  }
128
- const codeStr = d.type === 'strategy' ? ' ⚠code' : '';
129
- console.log(d.type + '/' + d.id + ' [' + d.type + codeStr + '] ↓' + d.stats.downloadCount + ' ★' + d.stats.starCount);
130
- console.log(d.title);
131
- console.log(d.description);
132
- if (d.creatorDisplayName) console.log('by ' + d.creatorDisplayName + ' (' + d.creator + ')');
133
- if (d.fileName) console.log('file: ' + d.fileName);
134
- if (d.type === 'strategy') {
135
- console.log('⚠ contains legacy executable code — source: ' + (d.creatorDisplayName || d.creator));
136
- console.log(legacyStrategyMessage);
137
- } else {
138
- console.log('\nInstall: ccl hub install ' + d.type + '/' + d.id);
139
- }
140
- } catch (err) { handleError(err); }
88
+ console.log(`${detail.type}/${detail.id} [${detail.type}] installs:${detail.stats.downloadCount} likes:${detail.stats.starCount}`);
89
+ console.log(detail.title);
90
+ console.log(detail.description);
91
+ if (detail.creatorDisplayName) console.log(`by ${detail.creatorDisplayName}`);
92
+ if (detail.fileName) console.log(`file: ${detail.fileName}`);
93
+ console.log(detail.isInstalled
94
+ ? '\nAlready installed in this account workspace.'
95
+ : `\nInstall: ccl hub install ${detail.type}/${detail.id}`);
96
+ } catch (err) {
97
+ handleError(err);
98
+ }
141
99
  });
142
100
 
143
- // install
144
101
  hub.command('install <type/id>')
145
- .description('Download and install a compatible skill or persona package')
146
- .option('--force', 'overwrite an existing untracked file/dir')
102
+ .description('Install a published Hub resource into the active account workspace')
147
103
  .option('--json', 'machine-readable output')
148
104
  .action(async (raw: string, opts: any) => {
149
105
  try {
150
- const { type, id } = parseResourceRef(raw);
151
- if (type === 'strategy') throw new Error(legacyStrategyMessage);
152
- const client = getClient(deps);
153
- const detail = await client.getResource(type, id);
154
- const artifact = await client.downloadArtifact(type, id);
155
- const res = installResource(detail, artifact, { force: opts.force });
156
-
157
- // For skills: auto-register with the agent via `ccl skill install`.
158
- let skillRegistered = false;
159
- if (res.type === 'skill') {
160
- skillRegistered = await registerSkill(res.installedPath);
161
- }
162
-
163
- // For personas: extract the preset name (filename minus .md) for the ccl persona use hint.
164
- let personaSlug: string | undefined;
165
- if (res.type === 'persona') {
166
- const m = res.installedPath.match(/(?:^|[\\/])personas[\\/]([^/\\]+)\.md$/);
167
- personaSlug = m ? m[1] : undefined;
106
+ const ref = parseResourceRef(raw);
107
+ const result = await getClient(deps).installResource(ref.id);
108
+ const output = { ref: raw, ...result, message: 'Installed in workspace. Select it in the Hub loadout before ccl load applies it.' };
109
+ if (opts.json) {
110
+ console.log(JSON.stringify(output, null, 2));
111
+ return;
168
112
  }
113
+ console.log(`${result.created ? 'Installed' : 'Already installed'} ${raw} in the active account workspace.`);
114
+ console.log('Select it in the Hub loadout; ccl load applies the selected revision before play.');
115
+ } catch (err) {
116
+ handleError(err);
117
+ }
118
+ });
169
119
 
120
+ hub.command('installed')
121
+ .description('List resources in the active account workspace')
122
+ .option('--type <type>', 'skill | strategy | persona | perception', typeOption)
123
+ .option('--cursor <cursor>', 'cursor from the previous response')
124
+ .option('--json', 'machine-readable output')
125
+ .action(async (opts: any) => {
126
+ try {
127
+ const result = await getClient(deps).listWorkspace({
128
+ type: opts.type,
129
+ cursor: opts.cursor,
130
+ limit: 100,
131
+ });
170
132
  if (opts.json) {
171
- console.log(JSON.stringify({ ...res, skillRegistered, personaSlug: personaSlug ?? null }, null, 2));
133
+ console.log(JSON.stringify(result, null, 2));
172
134
  return;
173
135
  }
174
- console.log('Installed ' + res.ref + ' "' + res.title + '" [' + res.type + ']');
175
- console.log(' → ' + res.installedPath);
176
- if (skillRegistered) {
177
- console.log('Skill registered with agent.');
178
- } else if (res.type === 'skill') {
179
- console.log('Register manually: ccl skill install ' + res.installedPath);
136
+ if (result.items.length === 0) {
137
+ console.log('No Hub resources installed in the active account workspace.');
138
+ return;
180
139
  }
181
- if (personaSlug) {
182
- console.log('Apply with: ccl persona use ' + personaSlug);
140
+ for (const item of result.items) {
141
+ console.log(`${item.resourceType}/${item.resourceId} "${item.title}"${item.equipped ? ' [equipped]' : ''}${item.hasUpdate ? ' [update available]' : ''}`);
183
142
  }
184
- } catch (err) { handleError(err); }
143
+ } catch (err) {
144
+ handleError(err);
145
+ }
185
146
  });
186
147
 
187
- // uninstall
188
- hub.command('uninstall <type/id>')
189
- .description('Remove a hub-installed package')
190
- .action(async (ref: string) => {
148
+ hub.command('sync <type/id>')
149
+ .description('Update one installed workspace item to the current published version')
150
+ .option('--json', 'machine-readable output')
151
+ .action(async (raw: string, opts: any) => {
191
152
  try {
192
- // For skills: auto-unregister from the agent before deleting files.
193
- const { type } = parseResourceRef(ref);
194
- if (type === 'skill') {
195
- const lock = readLockfile();
196
- const entry = lock[ref];
197
- if (entry) {
198
- const { readSkillName } = await import('./skill.js');
199
- const skillDir = join(getWorkspaceDir(), entry.path);
200
- const name = readSkillName(skillDir);
201
- if (name) {
202
- const bin = require.resolve('skills/bin/cli.mjs');
203
- const r2 = spawnSync(process.execPath, [bin, 'remove', name, '-y', '-g'], { timeout: 30_000 });
204
- if (r2.status !== 0 || r2.error) {
205
- console.error('warning: skills remove failed (status=' + (r2.status ?? 'error') + '); files will still be deleted');
206
- }
207
- }
208
- }
209
- }
210
-
211
- const r = uninstallResource(ref);
212
- if (!r.removed) { console.log(ref + ' is not installed.'); return; }
213
- console.log('Removed ' + ref + '\n → ' + r.path);
214
- } catch (err) { handleError(err); }
153
+ const { type, id } = parseResourceRef(raw);
154
+ const client = getClient(deps);
155
+ const item = await client.findWorkspaceItem(type, id);
156
+ if (!item) throw new Error(`${raw} is not installed in the active account workspace`);
157
+ const result = await client.syncWorkspaceItem(item.workspaceItemId);
158
+ const output = { ref: raw, workspaceItemId: item.workspaceItemId, ...result };
159
+ if (opts.json) console.log(JSON.stringify(output, null, 2));
160
+ else console.log(result.updated ? `Updated ${raw}.` : `${raw} is already current.`);
161
+ } catch (err) {
162
+ handleError(err);
163
+ }
215
164
  });
216
165
 
217
- // installed
218
- hub.command('installed')
219
- .description('List locally installed hub packages')
220
- .option('--type <type>', 'filter: skill | strategy | persona')
166
+ hub.command('uninstall <type/id>', { hidden: true })
167
+ .description('Remove an unequipped resource from the active account workspace')
221
168
  .option('--json', 'machine-readable output')
222
- .action(async (opts: any) => {
169
+ .action(async (raw: string, opts: any) => {
223
170
  try {
224
- let items = listInstalled();
225
- if (opts.type) items = items.filter(e => e.type === opts.type);
226
- if (opts.json) { console.log(JSON.stringify({ items }, null, 2)); return; }
227
- if (items.length === 0) { console.log('No hub packages installed' + (opts.type ? ' for type "' + opts.type + '"' : '') + '.'); return; }
228
- for (const e of items) console.log(e.type + '/' + e.id + ' "' + e.title + '" [' + e.type + '] ' + e.path);
229
- } catch (err) { handleError(err); }
171
+ const { type, id } = parseResourceRef(raw);
172
+ const client = getClient(deps);
173
+ const item = await client.findWorkspaceItem(type, id);
174
+ if (!item) {
175
+ const output = { ref: raw, removed: false };
176
+ if (opts.json) console.log(JSON.stringify(output, null, 2));
177
+ else console.log(`${raw} is not installed.`);
178
+ return;
179
+ }
180
+ await client.deleteWorkspaceItem(item.workspaceItemId);
181
+ const output = { ref: raw, workspaceItemId: item.workspaceItemId, removed: true };
182
+ if (opts.json) console.log(JSON.stringify(output, null, 2));
183
+ else console.log(`Removed ${raw} from the active account workspace.`);
184
+ } catch (err) {
185
+ handleError(err);
186
+ }
230
187
  });
231
188
 
232
189
  return hub;
@@ -1,21 +1,22 @@
1
1
  import { Command } from 'commander';
2
2
  import { loadContext } from '../lib/load-context.js';
3
+ import { AuthStore } from '../lib/auth.js';
3
4
  import { noAccountMessage } from '../lib/account-guidance.js';
4
5
  import { runAutoUpgradeOnLoad } from '../runtime/auto-upgrade.js';
5
6
  import { CLAWCLAW_ROLE_IDS, readGameplayConfig } from '../lib/gameplay-config.js';
7
+ import { getWorkspaceDir } from '../lib/init-command.js';
6
8
  import {
7
- listWorkspaceClawclawBehaviorSources,
8
- syncOfficialBehaviors,
9
- } from '../lib/behavior-export.js';
10
- import { syncOfficialPerceptions } from '../lib/perception-export.js';
9
+ ensureAccountUserDataLayout,
10
+ getUserDataAccountBehaviorsDir,
11
+ getUserDataAccountPerceptionsDir,
12
+ getUserDataAccountTriggersDir,
13
+ } from '../lib/user-data.js';
14
+ import { listClawclawPerceptionSourcesInDirectory } from '../runtime/clawclaw/plugins/perception/perception-source.js';
11
15
  import {
12
- listWorkspaceClawclawTriggerSources,
13
- syncOfficialTriggers,
14
- } from '../lib/trigger-export.js';
15
- import { getWorkspaceDir } from '../lib/init-command.js';
16
- import { ensureUserDataLayout } from '../lib/user-data.js';
17
- import { listClawclawPerceptionSources } from '../runtime/clawclaw/plugins/perception/index.js';
18
- import { behaviorSourceCompatibilityError } from '../runtime/clawclaw/plugins/behavior/behavior-source.js';
16
+ behaviorSourceCompatibilityError,
17
+ listClawclawBehaviorSources,
18
+ } from '../runtime/clawclaw/plugins/behavior/behavior-source.js';
19
+ import { listClawclawTriggerSources } from '../runtime/clawclaw/plugins/trigger/trigger-source.js';
19
20
  import { GameClient } from '../lib/game-client.js';
20
21
  import {
21
22
  GAME_STATUS_SCHEMA,
@@ -26,9 +27,25 @@ import { BEHAVIOR_PLUGIN_API_VERSION } from '../sdk/behavior-plugin/index.js';
26
27
  import { TRIGGER_PLUGIN_API_VERSION } from '../sdk/trigger-plugin/index.js';
27
28
  import { PERCEPTION_PLUGIN_API_VERSION } from '../sdk/perception-plugin/index.js';
28
29
  import { pluginApiVersionStatus } from '../runtime/clawclaw/plugins/plugin-api-version.js';
30
+ import {
31
+ readLocalAgentWorkspaceSnapshot,
32
+ resolveLocalAgentWorkspaceSnapshot,
33
+ syncAgentWorkspaceConfig,
34
+ type AgentWorkspaceSyncResult,
35
+ } from '../lib/agent-workspace-sync.js';
36
+ import { syncAgentWorkspaceSkills } from '../lib/agent-workspace-skills.js';
37
+ import {
38
+ listAgentWorkspaceBehaviorSources,
39
+ listAgentWorkspacePerceptionSources,
40
+ mergeAgentWorkspaceBehaviorSources,
41
+ mergeAgentWorkspacePerceptionSources,
42
+ } from '../lib/agent-workspace-runtime.js';
29
43
 
30
44
  export interface LoadCommandDependencies {
31
45
  clientFactory?: () => ParticipationStatusClient;
46
+ authStore?: AuthStore;
47
+ workspaceSync?: typeof syncAgentWorkspaceConfig;
48
+ skillSync?: typeof syncAgentWorkspaceSkills;
32
49
  }
33
50
 
34
51
  export function createLoadCommand(dependencies: LoadCommandDependencies = {}): Command {
@@ -36,24 +53,51 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
36
53
  .description('Read active account context, configured gameplay resources, and backend participation')
37
54
  .action(async () => {
38
55
  runAutoUpgradeOnLoad({ notify: (message) => console.error(message) });
56
+ const workspaceDir = getWorkspaceDir();
57
+ const authStore = dependencies.authStore ?? new AuthStore();
58
+ const profile = authStore.getActive();
59
+ if (!profile) throw new Error(noAccountMessage('load'));
60
+ ensureAccountUserDataLayout(workspaceDir, profile);
61
+
62
+ let workspaceResult: AgentWorkspaceSyncResult | undefined;
63
+ const storedWorkspace = readLocalAgentWorkspaceSnapshot(workspaceDir, profile);
64
+ let activeWorkspace = storedWorkspace
65
+ ? resolveLocalAgentWorkspaceSnapshot(workspaceDir, profile, storedWorkspace)
66
+ : undefined;
67
+ let workspaceSyncStatus: 'updated' | 'unchanged' | 'local_overrides' | 'stale_fallback' | 'unavailable';
68
+ let workspaceSyncError: string | undefined;
69
+ try {
70
+ workspaceResult = await (dependencies.workspaceSync ?? syncAgentWorkspaceConfig)(workspaceDir, profile);
71
+ activeWorkspace = workspaceResult.snapshot;
72
+ workspaceSyncStatus = workspaceResult.status;
73
+ } catch (error) {
74
+ workspaceSyncStatus = activeWorkspace ? 'stale_fallback' : 'unavailable';
75
+ workspaceSyncError = error instanceof Error ? error.message : String(error);
76
+ console.error(`[clawclaw-cli] Agent workspace sync unavailable: ${workspaceSyncError}`);
77
+ }
78
+
39
79
  let snapshot;
40
80
  try {
41
- snapshot = loadContext();
42
- } catch (err) {
43
- if (err instanceof Error && err.message === 'Not logged in.') {
81
+ snapshot = loadContext(authStore);
82
+ } catch (error) {
83
+ if (error instanceof Error && error.message === 'Not logged in.') {
44
84
  throw new Error(noAccountMessage('load'));
45
85
  }
46
- throw err;
86
+ throw error;
47
87
  }
48
- const workspaceDir = getWorkspaceDir();
49
- await syncOfficialBehaviors({ workspaceDir });
50
- await syncOfficialPerceptions({ workspaceDir });
51
- await syncOfficialTriggers({ workspaceDir });
52
- ensureUserDataLayout(workspaceDir);
53
- const gameplay = readGameplayConfig(workspaceDir);
88
+
89
+ const gameplay = readGameplayConfig(workspaceDir, profile);
54
90
  const disabledBehaviors = new Set(gameplay.disabled_behaviors);
55
- const enabledBehaviors = listWorkspaceClawclawBehaviorSources(workspaceDir)
56
- .filter(({ id }) => !disabledBehaviors.has(id));
91
+ const hubBehaviors = activeWorkspace
92
+ ? listAgentWorkspaceBehaviorSources(workspaceDir, profile, activeWorkspace)
93
+ : [];
94
+ const localBehaviors = listClawclawBehaviorSources(
95
+ getUserDataAccountBehaviorsDir(workspaceDir, profile),
96
+ ).filter(({ id }) => !disabledBehaviors.has(id));
97
+ const enabledBehaviors = mergeAgentWorkspaceBehaviorSources(
98
+ localBehaviors,
99
+ hubBehaviors,
100
+ );
57
101
  const behaviorEntry = (source: typeof enabledBehaviors[number]) => {
58
102
  const compatibilityError = behaviorSourceCompatibilityError(source);
59
103
  const versionCompatible = source.apiVersion === BEHAVIOR_PLUGIN_API_VERSION;
@@ -70,30 +114,47 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
70
114
  ? compatibilityError
71
115
  : `behavior_api_version_unsupported:expected=${BEHAVIOR_PLUGIN_API_VERSION}:received=${source.apiVersion ?? 'missing'}`,
72
116
  }),
73
- source: source.provenance?.kind === 'official' ? 'official' : 'community',
74
- ...(source.provenance?.kind === 'official' ? { family: source.provenance.family } : {}),
117
+ source: source.management.source,
118
+ managed_by: source.management.managedBy,
119
+ ...(source.management.publisher ? { publisher: source.management.publisher } : {}),
120
+ ...(source.management.resourceId ? { resource_id: source.management.resourceId } : {}),
121
+ ...(source.management.versionId ? { version_id: source.management.versionId } : {}),
122
+ ...(source.management.resolution ? { resolution: source.management.resolution } : {}),
75
123
  };
76
124
  };
77
125
  const behaviorEntries = enabledBehaviors.map(behaviorEntry);
78
126
  const behaviors = behaviorEntries.filter(({ loadable }) => loadable);
79
127
  const incompatibleBehaviors = behaviorEntries.filter(({ loadable }) => !loadable);
128
+ const configurationWarnings: Array<Record<string, unknown>> = [];
80
129
  for (const role of CLAWCLAW_ROLE_IDS) {
81
130
  const fallback = gameplay.fallback_behaviors[role];
82
131
  if (fallback === null) continue;
83
- if (disabledBehaviors.has(fallback)) {
84
- throw new Error(`Fallback Behavior '${fallback}' for role '${role}' is disabled.`);
85
- }
86
132
  if (!behaviors.some(({ id }) => id === fallback)) {
87
- throw new Error(`Fallback Behavior '${fallback}' for role '${role}' is not loadable.`);
133
+ configurationWarnings.push({
134
+ code: 'DEFAULT_LONG_BEHAVIOR_UNAVAILABLE',
135
+ role,
136
+ behavior_id: fallback,
137
+ reason: disabledBehaviors.has(fallback) ? 'local_disabled_or_unselected' : 'not_loaded',
138
+ });
88
139
  }
89
140
  }
90
141
  const disabledPerceptions = new Set(gameplay.disabled_perception_modules);
91
- const enabledPerceptions = listClawclawPerceptionSources(workspaceDir)
92
- .filter(({ id }) => !disabledPerceptions.has(id));
142
+ const hubPerceptions = activeWorkspace
143
+ ? listAgentWorkspacePerceptionSources(workspaceDir, profile, activeWorkspace)
144
+ : [];
145
+ const hubPerceptionIds = new Set(hubPerceptions.map(({ id }) => id));
146
+ const localPerceptions = listClawclawPerceptionSourcesInDirectory(
147
+ getUserDataAccountPerceptionsDir(workspaceDir, profile),
148
+ ).filter(({ id }) => !disabledPerceptions.has(id));
149
+ const enabledPerceptions = mergeAgentWorkspacePerceptionSources(
150
+ localPerceptions,
151
+ hubPerceptions,
152
+ );
93
153
  const perceptionEntry = (source: typeof enabledPerceptions[number]) => ({
94
154
  id: source.id,
95
155
  name: source.name,
96
156
  description: source.description,
157
+ source: hubPerceptionIds.has(source.id) ? 'hub' : 'workspace',
97
158
  ...pluginApiVersionStatus('perception', PERCEPTION_PLUGIN_API_VERSION, source.apiVersion),
98
159
  });
99
160
  const perceptions = enabledPerceptions
@@ -102,7 +163,9 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
102
163
  const incompatiblePerceptions = enabledPerceptions
103
164
  .filter(({ apiVersion }) => apiVersion !== PERCEPTION_PLUGIN_API_VERSION)
104
165
  .map(perceptionEntry);
105
- const triggerSources = listWorkspaceClawclawTriggerSources(workspaceDir);
166
+ const triggerSources = listClawclawTriggerSources(
167
+ getUserDataAccountTriggersDir(workspaceDir, profile),
168
+ );
106
169
  const enabledTriggers = triggerSources.filter((source) => (
107
170
  gameplay.triggers[source.id]?.enabled === true
108
171
  ));
@@ -118,12 +181,22 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
118
181
  ...(loadable ? {} : {
119
182
  compatibility_error: `trigger_api_version_unsupported:expected=${TRIGGER_PLUGIN_API_VERSION}:received=${source.apiVersion}`,
120
183
  }),
121
- source: source.provenance?.kind === 'official' ? 'official' : 'community',
184
+ source: 'local',
122
185
  };
123
186
  };
124
187
  const triggerEntries = enabledTriggers.map(triggerEntry);
125
188
  const triggers = triggerEntries.filter(({ loadable }) => loadable);
126
189
  const incompatibleTriggers = triggerEntries.filter(({ loadable }) => !loadable);
190
+
191
+ // Mutate Agent-facing Skill/Persona targets only after every non-Skill
192
+ // source has been parsed and Hub/local identity conflicts have passed.
193
+ const skillChanges = activeWorkspace
194
+ ? (dependencies.skillSync ?? syncAgentWorkspaceSkills)(workspaceDir, profile, activeWorkspace)
195
+ : {
196
+ added: [], updated: [], removed: [], unchanged: [], failed: [],
197
+ preservedModified: [],
198
+ requiresUserConfirmation: false,
199
+ };
127
200
  let participation;
128
201
  try {
129
202
  const client = (dependencies.clientFactory ?? (() => GameClient.fromAuth()))();
@@ -139,12 +212,44 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
139
212
  }
140
213
  console.log(JSON.stringify({
141
214
  ...snapshot,
215
+ workspace_config: {
216
+ sync: {
217
+ status: workspaceSyncStatus,
218
+ revision: activeWorkspace?.revision ?? null,
219
+ ...(workspaceResult?.previous
220
+ ? { previous_revision: workspaceResult.previous.revision }
221
+ : {}),
222
+ ...(workspaceSyncError ? { error: workspaceSyncError } : {}),
223
+ },
224
+ items: activeWorkspace
225
+ ? Object.fromEntries(Object.entries(activeWorkspace.items).map(([type, items]) => [
226
+ type,
227
+ items.map((item) => ({
228
+ resource_id: item.resourceId,
229
+ version_id: item.versionId,
230
+ content_digest: item.contentDigest,
231
+ resolution: item.resolution ?? 'hub',
232
+ ...(item.localContentDigest ? { local_content_digest: item.localContentDigest } : {}),
233
+ })),
234
+ ]))
235
+ : { skill: [], strategy: [], persona: [], perception: [] },
236
+ skill_changes: skillChanges,
237
+ persona: {
238
+ source: snapshot.persona.source ?? 'none',
239
+ path: snapshot.persona.path,
240
+ exists: snapshot.persona.exists,
241
+ ...(snapshot.persona.id ? { id: snapshot.persona.id } : {}),
242
+ ...(snapshot.persona.resource_id ? { resource_id: snapshot.persona.resource_id } : {}),
243
+ },
244
+ requires_user_confirmation: skillChanges.requiresUserConfirmation,
245
+ },
142
246
  behaviors,
143
247
  incompatible_behaviors: incompatibleBehaviors,
144
248
  perceptions,
145
249
  incompatible_perceptions: incompatiblePerceptions,
146
250
  triggers,
147
251
  incompatible_triggers: incompatibleTriggers,
252
+ configuration_warnings: configurationWarnings,
148
253
  participation,
149
254
  }, null, 2));
150
255
  });