@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,316 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import {
3
- CLAWCLAW_BACKEND_AGENT_EVENT_TYPES,
4
- CLAWCLAW_LOCAL_AGENT_EVENT_TYPES,
5
- } from '../runtime/clawclaw-event-catalog.js';
6
- import {
7
- BACKEND_EVENT_HINT_FORMATTERS,
8
- DERIVED_EVENT_HINT_FORMATTERS,
9
- formatCanonicalEventHint,
10
- LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS,
11
- } from './event-hints.js';
12
-
13
- describe('Mailbox-owned Event hint registries', () => {
14
- it('keeps 30 backend hint formatters and classifies 15 Agent Events as unregistered', () => {
15
- const unregistered = CLAWCLAW_BACKEND_AGENT_EVENT_TYPES.filter((type) => (
16
- BACKEND_EVENT_HINT_FORMATTERS[type] === undefined
17
- ));
18
-
19
- expect(Object.keys(BACKEND_EVENT_HINT_FORMATTERS)).toHaveLength(30);
20
- expect(unregistered).toEqual([
21
- 'task_completed',
22
- 'task_sabotaged',
23
- 'death_speech',
24
- 'wandering_speech',
25
- 'speech',
26
- 'room.member_joined',
27
- 'room.member_status_changed',
28
- 'room.member_left',
29
- 'room.owner_changed',
30
- 'room.full',
31
- 'room.type_changed',
32
- 'room.chat',
33
- 'room.game_starting',
34
- 'room.game_start_failed',
35
- 'room.cooldown',
36
- ]);
37
- });
38
-
39
- it('tells the Agent when maintenance permits or blocks Lobby operations', () => {
40
- const maintenance = {
41
- starts_at: '2026-08-05T01:00:00+00:00',
42
- ends_at: '2026-08-05T03:00:00+00:00',
43
- description: '本次维护将升级匹配服务。',
44
- };
45
- expect(formatCanonicalEventHint(
46
- { producer: 'backend_push' },
47
- { type: 'service_status', service_status: 'maintenance_upcoming', maintenance },
48
- )).toContain('current request succeeded');
49
- expect(formatCanonicalEventHint(
50
- { producer: 'backend_push' },
51
- { type: 'service_status', service_status: 'maintenance_upcoming', maintenance },
52
- )).toContain(maintenance.description);
53
- expect(formatCanonicalEventHint(
54
- { producer: 'backend_push' },
55
- { type: 'service_status', service_status: 'maintenance_active', maintenance },
56
- )).toContain('Do not retry matchmaking');
57
- });
58
-
59
- it('classifies Source and Derived lifecycle Events with list changes factual-only', () => {
60
- const excluded = new Set(['robot_speak_rule', 'strategy_alert']);
61
- const sourceTypes = CLAWCLAW_LOCAL_AGENT_EVENT_TYPES.filter((type) => (
62
- type !== 'room_ready_to_start' && !excluded.has(type)
63
- ));
64
- const unregistered = sourceTypes.filter((type) => (
65
- LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS[type] === undefined
66
- ));
67
-
68
- expect(Object.keys(LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS)).toHaveLength(19);
69
- expect(Object.keys(DERIVED_EVENT_HINT_FORMATTERS)).toEqual(['room_ready_to_start']);
70
- expect(unregistered).toEqual([
71
- 'session_resumed',
72
- 'session_recovered',
73
- 'session_left',
74
- 'quit_failed',
75
- 'room_attached',
76
- 'room_ping_timeout',
77
- 'behavior.started',
78
- 'behavior.suspended',
79
- 'behavior.restarted',
80
- 'behavior.completed',
81
- 'behavior.failed',
82
- 'behavior.cancelled',
83
- 'behavior.replaced',
84
- 'players_changed',
85
- 'tasks_changed',
86
- 'emergency_countdown_warning',
87
- 'ability.ready',
88
- 'ability.remaining_uses_changed',
89
- 'ability.exhausted',
90
- ]);
91
- });
92
-
93
- it('adds actionable guidance for room idle warning and destruction', () => {
94
- expect(formatCanonicalEventHint(
95
- { producer: 'backend_push' },
96
- { type: 'room.idle_warning', seconds_remaining: 119 },
97
- )).toContain('pings do not extend');
98
- expect(formatCanonicalEventHint(
99
- { producer: 'local_synth' },
100
- { type: 'room_destroyed', reason: 'idle_timeout' },
101
- )).toContain('do not create or join another room');
102
- });
103
-
104
- it('routes training readiness to the dedicated start command', () => {
105
- expect(formatCanonicalEventHint(
106
- { producer: 'local_synth', producerPluginId: 'clawclaw.derived-event' },
107
- { type: 'room_ready_to_start', room_type: 'training_dummy' },
108
- )).toContain('ccl game training start');
109
- });
110
-
111
- it('applies instance conditions without emitting null or a default hint', () => {
112
- expect(formatCanonicalEventHint(
113
- { producer: 'local_synth' },
114
- { type: 'joined' },
115
- )).toBeUndefined();
116
- expect(formatCanonicalEventHint(
117
- { producer: 'local_synth' },
118
- { type: 'poll_error', retrying: false },
119
- )).toBeUndefined();
120
- expect(formatCanonicalEventHint(
121
- { producer: 'backend_push' },
122
- { type: 'meeting_briefing' },
123
- )).toBeUndefined();
124
- expect(formatCanonicalEventHint(
125
- { producer: 'backend_push' },
126
- { type: 'unknown' },
127
- )).toBeUndefined();
128
- });
129
-
130
- it('does not present a self-killer murder_witnessed anomaly as witness evidence', () => {
131
- const event = {
132
- type: 'murder_witnessed',
133
- killer_name: 'self',
134
- killer_seat: 1,
135
- target_name: 'target',
136
- target_seat: 2,
137
- };
138
- const downgraded = formatCanonicalEventHint(
139
- { producer: 'backend_push' },
140
- event,
141
- { summary: { you: { player: { name: 'self', seat: 1 } } } },
142
- );
143
- expect(downgraded).toContain('IGNORE AS WITNESS EVIDENCE');
144
- expect(downgraded).toContain('Do not infer any witness or observer');
145
- expect(downgraded).not.toContain('You saw');
146
-
147
- expect(formatCanonicalEventHint(
148
- { producer: 'backend_push' },
149
- event,
150
- { summary: { you: { player: { name: 'observer', seat: 3 } } } },
151
- )).toContain('You saw self kill target');
152
- });
153
-
154
- it('uses producerPluginId to exclude Behavior, Perception, and unknown local plugins', () => {
155
- const event = { type: 'match_timeout', waited_secs: 300 };
156
-
157
- expect(formatCanonicalEventHint({ producer: 'local_synth' }, event)).toContain('300s');
158
- expect(formatCanonicalEventHint({
159
- producer: 'local_synth',
160
- producerPluginId: 'clawclaw.source',
161
- }, event)).toContain('300s');
162
- expect(formatCanonicalEventHint({
163
- producer: 'local_synth',
164
- producerPluginId: 'clawclaw.behavior',
165
- }, event)).toBeUndefined();
166
- expect(formatCanonicalEventHint({
167
- producer: 'local_synth',
168
- producerPluginId: 'clawclaw.perception',
169
- }, event)).toBeUndefined();
170
- expect(formatCanonicalEventHint({
171
- producer: 'local_synth',
172
- producerPluginId: 'third-party.plugin',
173
- }, event)).toBeUndefined();
174
- });
175
-
176
- it('keeps room.full factual and gives start advice only to the authorized Derived Event', () => {
177
- expect(formatCanonicalEventHint(
178
- { producer: 'backend_push' },
179
- { type: 'room.full' },
180
- )).toBeUndefined();
181
- expect(formatCanonicalEventHint({
182
- producer: 'local_synth',
183
- producerPluginId: 'clawclaw.derived-event',
184
- }, {
185
- type: 'room_ready_to_start',
186
- ready_to_start: true,
187
- })).toContain('you are the owner');
188
- });
189
-
190
- it('preserves npm competition failure guidance by error code', () => {
191
- const origin = {
192
- producer: 'local_synth',
193
- producerPluginId: 'clawclaw.source',
194
- };
195
-
196
- expect(formatCanonicalEventHint(origin, {
197
- type: 'game_start_failed',
198
- game_mode: 'competition',
199
- error: { code: 'NO_ACTIVE_COMPETITION' },
200
- })).toContain('no active competition');
201
- expect(formatCanonicalEventHint(origin, {
202
- type: 'game_start_failed',
203
- game_mode: 'competition',
204
- error: { code: 'COMPETITION_NOT_OPEN' },
205
- })).toContain('competition.daily_windows');
206
- expect(formatCanonicalEventHint(origin, {
207
- type: 'game_start_failed',
208
- game_mode: 'competition',
209
- error: { code: 'ALREADY_IN_GAME' },
210
- })).toContain('`ccl join`');
211
- expect(formatCanonicalEventHint(origin, {
212
- type: 'game_start_failed',
213
- game_mode: 'competition',
214
- error: { code: 'REQUEST_FAILED' },
215
- })).toContain('Do not start normal matchmaking');
216
- });
217
-
218
- it('uses top-level start and join commands for lifecycle recovery guidance', () => {
219
- const notInQueue = LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS.not_in_queue({}, {});
220
- const matchTimeout = LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS.match_timeout({
221
- waited_secs: 300,
222
- }, {});
223
- const roomRecovery = LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS.room_lobby_reconnect_failed({}, {});
224
- const existingGame = LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS.game_start_failed({
225
- game_mode: 'competition',
226
- error: { code: 'ALREADY_IN_GAME' },
227
- }, {});
228
-
229
- expect(notInQueue).toContain('`ccl start match`');
230
- expect(matchTimeout).toContain('`ccl start match`');
231
- expect(roomRecovery).toContain('`ccl load`');
232
- expect(roomRecovery).toContain('`ccl join`');
233
- expect(existingGame).toContain('`ccl load`');
234
- expect(existingGame).toContain('`ccl join`');
235
- expect([notInQueue, matchTimeout, roomRecovery, existingGame].join('\n'))
236
- .not.toContain('`ccl game start`');
237
- });
238
-
239
- it('preserves the useful incremental semantics from npm batch next_step routes', () => {
240
- expect(BACKEND_EVENT_HINT_FORMATTERS.game_started({}, {})).toContain('do not relaunch');
241
-
242
- const normalGameOver = BACKEND_EVENT_HINT_FORMATTERS.game_over({
243
- winner: 'lobster',
244
- }, {});
245
- expect(normalGameOver).toContain('runtime is ending automatically');
246
- expect(normalGameOver).toContain('only if the user asks');
247
- expect(BACKEND_EVENT_HINT_FORMATTERS.game_over({
248
- winner: 'lobster',
249
- game_mode: 'match',
250
- }, { summary: { game_mode: 'room' } })).toContain('runtime is ending automatically');
251
- expect(BACKEND_EVENT_HINT_FORMATTERS.game_over({
252
- winner: 'lobster',
253
- game_mode: 'room',
254
- }, { summary: { game_mode: 'match' } })).toContain('room lifecycle');
255
- expect(BACKEND_EVENT_HINT_FORMATTERS.exile_game_over({
256
- winner: 'lobster',
257
- game_mode: 'room',
258
- }, {})).toContain('room lifecycle');
259
- });
260
-
261
- it('keeps backend prose and player speech in facts instead of the CCL-owned hint', () => {
262
- const roleHint = formatCanonicalEventHint(
263
- { producer: 'backend_push' },
264
- {
265
- type: 'role_assigned',
266
- role_display_name: 'Shrimp',
267
- faction: 'lobster',
268
- role_description: '后端角色描述',
269
- fake_task_briefing: '后端假任务说明',
270
- },
271
- );
272
-
273
- expect(roleHint).toBe('You are Shrimp (lobster). Read `references/GAME-MECHANICS.md` for the exact rules, then tell your user your role, faction, win condition, and first plan.');
274
- expect(roleHint).not.toMatch(/[一-鿿]/);
275
- expect(formatCanonicalEventHint(
276
- { producer: 'backend_push' },
277
- { type: 'death_speech', text: '我在厨房。' },
278
- )).toBeUndefined();
279
- expect(formatCanonicalEventHint(
280
- { producer: 'backend_push' },
281
- { type: 'wandering_speech', text: '跟我走。' },
282
- )).toBeUndefined();
283
- });
284
-
285
- it('keeps every CCL-authored hint template in English', () => {
286
- const sample = {
287
- actor_name: 'Alice',
288
- target_name: 'Bob',
289
- killer_name: 'Alice',
290
- corpse_name: 'Bob',
291
- winner_name: 'Alice',
292
- current_speaker: 'Alice',
293
- meeting_caller_name: 'Alice',
294
- reported_corpses: [{ name: 'Bob', seat: 2 }],
295
- nearby_players: [{ name: 'Bob', seat: 2 }],
296
- crab_teammates: [{ name: 'Bob', seat: 2 }],
297
- task_name: 'Repair',
298
- room: 'Engine Room',
299
- winner: 'lobster',
300
- blocked_winner: 'lobster',
301
- text: 'hello',
302
- url: 'https://example.test/game',
303
- spectate_url: 'https://example.test/room',
304
- retrying: true,
305
- waited_secs: 300,
306
- };
307
- const hints = [
308
- ...Object.values(BACKEND_EVENT_HINT_FORMATTERS).map((formatter) => formatter(sample, {})),
309
- ...Object.values(LOCAL_LIFECYCLE_EVENT_HINT_FORMATTERS).map((formatter) => formatter(sample, {})),
310
- ...Object.values(DERIVED_EVENT_HINT_FORMATTERS).map((formatter) => formatter(sample, {})),
311
- ].filter((hint): hint is string => typeof hint === 'string');
312
-
313
- expect(hints).toHaveLength(50);
314
- for (const hint of hints) expect(hint).not.toMatch(/[一-鿿]/);
315
- });
316
- });
@@ -1,371 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import type { CanonicalEvent } from '../runtime/framework/events/index.js';
3
- import { presentCanonicalEvent } from './canonical-event-presentation.js';
4
- import {
5
- normalizeGameSyncEvent,
6
- normalizeGameSyncEvents,
7
- normalizeGameSyncEventsSafely,
8
- } from './game-sync-event-normalization.js';
9
-
10
- function canonical(event: Record<string, any>): CanonicalEvent {
11
- const { type, ...payload } = event;
12
- return {
13
- eventId: 'canonical-1',
14
- sessionId: 'session-1',
15
- segmentId: 'segment-1',
16
- producer: 'backend_push',
17
- sourceId: 'game-sync',
18
- sourceEventId: event.event_id,
19
- type,
20
- occurredAt: '2026-07-28T00:00:00.000Z',
21
- receivedAt: '2026-07-28T00:00:00.001Z',
22
- payload,
23
- deliveryClass: 'monitor_and_events',
24
- commitSeq: 1,
25
- replayed: false,
26
- };
27
- }
28
-
29
- describe('GameSync v2 Event normalization', () => {
30
- it('enriches a task completion with its same-frame newly assigned task', () => {
31
- const normalized = normalizeGameSyncEvents([{
32
- event_id: 'completed-1',
33
- tick: 42,
34
- type: 'task_completed',
35
- actor: { seat: 1, name: 'self' },
36
- task_name: '擦拭酒瓶',
37
- }, {
38
- event_id: 'assigned-1',
39
- tick: 42,
40
- type: 'task_assigned',
41
- actor: { seat: 1, name: 'self' },
42
- task_name: '消毒淋浴器',
43
- room: '制氧舱',
44
- x: 123,
45
- y: 456,
46
- is_fake_shrimp: false,
47
- }]);
48
-
49
- expect(normalized[0]).toMatchObject({
50
- type: 'task_completed',
51
- task_name: '擦拭酒瓶',
52
- newly_assigned_task: {
53
- name: '消毒淋浴器',
54
- room: '制氧舱',
55
- x: 123,
56
- y: 456,
57
- is_fake_shrimp: false,
58
- },
59
- });
60
- expect(normalized[1]).toMatchObject({
61
- type: 'task_assigned',
62
- task_name: '消毒淋浴器',
63
- });
64
- });
65
-
66
- it('does not enrich a task completion without a same-tick assignment for the same player', () => {
67
- const normalized = normalizeGameSyncEvents([{
68
- event_id: 'completed-1',
69
- tick: 42,
70
- type: 'task_completed',
71
- actor: { seat: 1, name: 'self' },
72
- task_name: '擦拭酒瓶',
73
- }, {
74
- event_id: 'assigned-other',
75
- tick: 43,
76
- type: 'task_assigned',
77
- actor: { seat: 1, name: 'self' },
78
- task_name: '消毒淋浴器',
79
- }]);
80
-
81
- expect(normalized[0]).not.toHaveProperty('newly_assigned_task');
82
- });
83
-
84
- it('isolates malformed Events while preserving original indexes and same-frame enrichment', () => {
85
- const result = normalizeGameSyncEventsSafely([{
86
- event_id: 'completed-1',
87
- tick: 42,
88
- type: 'task_completed',
89
- actor: { seat: 1, name: 'self' },
90
- task_name: '擦拭酒瓶',
91
- }, {
92
- event_id: 'malformed-killed',
93
- tick: 42,
94
- type: 'killed',
95
- actor: { seat: 4, name: 'victim' },
96
- killer: { kind: 'player', player: { seat: 2 } },
97
- }, {
98
- event_id: 'assigned-1',
99
- tick: 42,
100
- type: 'task_assigned',
101
- actor: { seat: 1, name: 'self' },
102
- task_name: '消毒淋浴器',
103
- room: '制氧舱',
104
- }]);
105
-
106
- expect(result.rejected).toHaveLength(1);
107
- expect(result.rejected[0]).toMatchObject({ index: 1 });
108
- expect(result.rejected[0]?.error).toBeInstanceOf(TypeError);
109
- expect(result.events.map(({ index }) => index)).toEqual([0, 2]);
110
- expect(result.events[0]?.event).toMatchObject({
111
- type: 'task_completed',
112
- newly_assigned_task: { name: '消毒淋浴器', room: '制氧舱' },
113
- });
114
- });
115
-
116
- it('projects actor and target PlayerRefs to the established canonical fields', () => {
117
- const wire = {
118
- event_id: '68a339d7-c5f6-4eef-8f40-b8779ca8bfcc',
119
- tick: 1281,
120
- type: 'kill',
121
- actor: { seat: 2, name: 'agent_2' },
122
- target: { seat: 5, name: 'agent_5' },
123
- room: 'engine',
124
- hint: 'presentation only',
125
- };
126
-
127
- expect(normalizeGameSyncEvent(wire)).toEqual({
128
- tick: 1281,
129
- type: 'kill',
130
- room: 'engine',
131
- hint: 'presentation only',
132
- actor_name: 'agent_2',
133
- actor_seat: 2,
134
- target_name: 'agent_5',
135
- target_seat: 5,
136
- });
137
- expect(normalizeGameSyncEvent(wire)).not.toHaveProperty('event_id');
138
- expect(wire.actor).toEqual({ seat: 2, name: 'agent_2' });
139
- expect(wire.target).toEqual({ seat: 5, name: 'agent_5' });
140
- });
141
-
142
- it('projects every semantic single-player field without retaining wire objects', () => {
143
- const normalized = normalizeGameSyncEvent({
144
- event_id: '6e1ec10d-77a3-4632-935d-b12e8a894fef',
145
- tick: 22,
146
- type: 'synthetic_contract_fixture',
147
- caller: { seat: 1, name: 'caller' },
148
- killer: { kind: 'player', player: { seat: 2, name: 'killer' } },
149
- resolver: { seat: 3, name: 'resolver' },
150
- speaker: { seat: 4, name: 'speaker' },
151
- current_speaker: { seat: 5, name: 'current' },
152
- result_target: { seat: 6, name: 'exiled' },
153
- winner: { seat: 7, name: 'winner' },
154
- });
155
-
156
- expect(normalized).toMatchObject({
157
- meeting_caller_name: 'caller',
158
- meeting_caller_seat: 1,
159
- killer_kind: 'player',
160
- killer_name: 'killer',
161
- killer_seat: 2,
162
- resolver_name: 'resolver',
163
- resolver_seat: 3,
164
- speaker_name: 'speaker',
165
- speaker_seat: 4,
166
- current_speaker: 'current',
167
- current_speaker_seat: 5,
168
- result_target: 'exiled',
169
- result_target_seat: 6,
170
- winner_name: 'winner',
171
- winner_seat: 7,
172
- });
173
- for (const field of ['caller', 'killer', 'resolver', 'speaker']) {
174
- expect(normalized).not.toHaveProperty(field);
175
- }
176
- });
177
-
178
- it('projects structured player and system killers for Agent presentation', () => {
179
- const playerKilled = normalizeGameSyncEvent({
180
- event_id: 'player-killed',
181
- tick: 41,
182
- type: 'killed',
183
- actor: { seat: 4, name: 'victim' },
184
- killer: { kind: 'player', player: { seat: 2, name: 'killer' } },
185
- room: 'engine',
186
- });
187
- expect(playerKilled).toMatchObject({
188
- actor_name: 'victim',
189
- actor_seat: 4,
190
- killer_kind: 'player',
191
- killer_name: 'killer',
192
- killer_seat: 2,
193
- });
194
- expect(playerKilled).not.toHaveProperty('killer');
195
- expect(presentCanonicalEvent(canonical(playerKilled), null).hint)
196
- .toBe('YOU ARE DEAD: seat 2 killer removed you from play.');
197
-
198
- const systemKilled = normalizeGameSyncEvent({
199
- event_id: 'system-killed',
200
- tick: 42,
201
- type: 'killed',
202
- actor: { seat: 4, name: 'victim' },
203
- killer: { kind: 'system', name: 'Shrimp God' },
204
- room: 'engine',
205
- });
206
- expect(systemKilled).toMatchObject({
207
- actor_name: 'victim',
208
- actor_seat: 4,
209
- killer_kind: 'system',
210
- killer_name: 'Shrimp God',
211
- });
212
- expect(systemKilled).not.toHaveProperty('killer');
213
- expect(systemKilled).not.toHaveProperty('killer_seat');
214
- expect(presentCanonicalEvent(canonical(systemKilled), null).hint)
215
- .toBe('YOU ARE DEAD: Shrimp God removed you from play.');
216
- });
217
-
218
- it('rejects malformed structured killers', () => {
219
- expect(() => normalizeGameSyncEvent({
220
- type: 'killed', killer: { kind: 'player', player: { seat: 2 } },
221
- })).toThrow('killer.player.name must be a string');
222
- expect(() => normalizeGameSyncEvent({
223
- type: 'killed', killer: { kind: 'system', name: 'GM', seat: 0 },
224
- })).toThrow('killer contains unsupported fields: seat');
225
- expect(() => normalizeGameSyncEvent({
226
- type: 'killed', killer: { kind: 'npc', name: 'GM' },
227
- })).toThrow("killer.kind must be 'player' or 'system'");
228
- });
229
-
230
- it('preserves a faction winner scalar and projects a neutral winner PlayerRef', () => {
231
- expect(normalizeGameSyncEvent({
232
- event_id: 'faction-event', tick: 1, type: 'game_over', winner: 'lobster',
233
- })).toMatchObject({ winner: 'lobster' });
234
- expect(normalizeGameSyncEvent({
235
- event_id: 'neutral-event', tick: 2, type: 'octopus_time_win', winner: { seat: 8, name: 'octopus' },
236
- })).toMatchObject({ winner_name: 'octopus', winner_seat: 8 });
237
- });
238
-
239
- it('keeps PlayerRef collections structured and gives teammates one canonical field', () => {
240
- const normalized = normalizeGameSyncEvent({
241
- event_id: 'meeting-event',
242
- tick: 30,
243
- type: 'meeting_briefing',
244
- caller: { seat: 1, name: 'caller' },
245
- reported_corpses: [{ seat: 9, name: 'dead' }],
246
- speech_order: [{ seat: 1, name: 'caller' }, { seat: 2, name: 'next' }],
247
- dead_players: [{ seat: 9, name: 'dead' }],
248
- crab_teammates: [{ seat: 3, name: 'crab' }],
249
- });
250
-
251
- expect(normalized.reported_corpses).toEqual([{ name: 'dead', seat: 9 }]);
252
- expect(normalized.speech_order).toEqual([
253
- { name: 'caller', seat: 1 },
254
- { name: 'next', seat: 2 },
255
- ]);
256
- expect(normalized.dead_players).toEqual([{ name: 'dead', seat: 9 }]);
257
- expect(normalized.crab_teammates).toEqual([{ name: 'crab', seat: 3 }]);
258
-
259
- const presented = presentCanonicalEvent(canonical(normalized), null);
260
- expect(presented.speech_order).toEqual(normalized.speech_order);
261
- expect(presented.hint).not.toContain('[object Object]');
262
- });
263
-
264
- it('accepts the current origin/dev meeting and setup event wire shapes', () => {
265
- const briefing = normalizeGameSyncEvent({
266
- event_id: 'meeting-current-dev',
267
- tick: 30,
268
- type: 'meeting_briefing',
269
- meeting_caller_name: 'caller',
270
- meeting_caller_seat: 1,
271
- speech_order: 'caller, next',
272
- reported_corpses: [{ seat: 9, name: 'dead' }],
273
- dead_players: [{ seat: 9, name: 'dead' }],
274
- crab_teammates: [{ seat: 3, name: 'crab' }],
275
- });
276
- expect(briefing).toMatchObject({
277
- speech_order: 'caller, next',
278
- reported_corpses: [{ name: 'dead', seat: 9 }],
279
- dead_players: [{ name: 'dead', seat: 9 }],
280
- crab_teammates: [{ name: 'crab', seat: 3 }],
281
- });
282
-
283
- expect(normalizeGameSyncEvent({
284
- event_id: 'next-speaker-current-dev',
285
- tick: 31,
286
- type: 'speech_next_turn',
287
- actor: { seat: 2, name: 'next' },
288
- current_speaker: 'caller',
289
- })).toMatchObject({
290
- actor_name: 'next',
291
- actor_seat: 2,
292
- current_speaker: 'caller',
293
- });
294
- });
295
-
296
- it('keeps the private self-repair marker and anonymizes every other emergency resolution', () => {
297
- const selfRepair = normalizeGameSyncEvent({
298
- event_id: 'self-repair',
299
- tick: 42,
300
- type: 'emergency_resolved',
301
- actor: { seat: 1, name: 'self' },
302
- task_name: 'repair oxygen',
303
- reason: 'player_fixed',
304
- resolved_by_self: true,
305
- });
306
- expect(selfRepair).toMatchObject({
307
- type: 'emergency_resolved',
308
- actor_name: 'self',
309
- actor_seat: 1,
310
- resolved_by_self: true,
311
- });
312
-
313
- const anonymous = normalizeGameSyncEvent({
314
- event_id: 'legacy-global-repair',
315
- tick: 42,
316
- type: 'emergency_resolved',
317
- actor: { seat: 1, name: 'repairer' },
318
- resolver: { seat: 1, name: 'repairer' },
319
- task_name: 'repair oxygen',
320
- reason: 'player_fixed',
321
- });
322
- expect(anonymous).not.toHaveProperty('actor_name');
323
- expect(anonymous).not.toHaveProperty('actor_seat');
324
- expect(anonymous).not.toHaveProperty('resolver_name');
325
- expect(anonymous).not.toHaveProperty('resolver_seat');
326
- expect(anonymous).not.toHaveProperty('resolved_by_self');
327
- expect(() => normalizeGameSyncEvent({
328
- type: 'emergency_resolved', resolved_by_self: 'yes',
329
- })).toThrow('resolved_by_self must be a boolean');
330
- });
331
-
332
- it('accepts the current dev move_interrupted nearby player shape without leaking extras', () => {
333
- expect(normalizeGameSyncEvent({
334
- type: 'move_interrupted',
335
- event_id: 'move-1',
336
- tick: 17,
337
- nearby_players: [{
338
- name: '甲',
339
- room: '导航仓',
340
- x: 12.5,
341
- y: 23.5,
342
- internal_role: 'must-not-leak',
343
- }],
344
- })).toMatchObject({
345
- nearby_players: [{ name: '甲', room: '导航仓', x: 12.5, y: 23.5 }],
346
- });
347
- });
348
-
349
- it('never derives a missing killer from hint text or the victim actor', () => {
350
- const normalized = normalizeGameSyncEvent({
351
- event_id: 'killed-event',
352
- tick: 41,
353
- type: 'killed',
354
- actor: { seat: 4, name: 'victim' },
355
- hint: 'YOU ARE DEAD: hidden-killer removed you from play.',
356
- });
357
-
358
- expect(normalized).toMatchObject({ actor_name: 'victim', actor_seat: 4 });
359
- expect(normalized).not.toHaveProperty('killer_name');
360
- expect(normalized).not.toHaveProperty('killer_seat');
361
- });
362
-
363
- it('rejects old scalar actor fields and malformed PlayerRefs', () => {
364
- expect(() => normalizeGameSyncEvent({ type: 'speech', actor: 'agent_1' }))
365
- .toThrow('actor must be a PlayerRef object');
366
- expect(() => normalizeGameSyncEvent({
367
- type: 'speech',
368
- actor: { seat: 1, name: 'agent_1', faction: 'crab' },
369
- })).toThrow('unsupported PlayerRef fields');
370
- });
371
- });