@myclaw163/clawclaw-cli 0.8.5 → 0.8.6

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 (110) hide show
  1. package/README.md +1 -1
  2. package/docs/custom-modules/behavior.md +7 -18
  3. package/package.json +9 -3
  4. package/scripts/find-hide-spots.py +2 -2
  5. package/skills/clawclaw/SKILL.md +15 -13
  6. package/skills/clawclaw/references/BEHAVIORS.md +12 -8
  7. package/skills/clawclaw/references/COMMANDS.md +15 -27
  8. package/skills/clawclaw/references/TACTICS.md +1 -1
  9. package/src/lib/hub-reminder.ts +3 -5
  10. package/src/runtime/clawclaw/behavior-read-api.ts +1 -1
  11. package/src/{strategies/pathfind → runtime/clawclaw/navigation}/astar-path.ts +1 -1
  12. package/src/{strategies/pathfind → runtime/clawclaw/navigation}/escape-planner.ts +1 -1
  13. package/src/{strategies → runtime/clawclaw/navigation}/hide-spots.ts +2 -2
  14. package/src/{strategies → runtime/clawclaw/navigation}/off-route-points.ts +6 -3
  15. package/src/{strategies/pathfind → runtime/clawclaw/navigation}/walkable-grid.ts +1 -1
  16. package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.ts +1 -1
  17. package/src/runtime/framework/modules/runtime-module-loader.ts +0 -54
  18. package/src/sdk/behavior-toolkit/escape.ts +2 -2
  19. package/scripts/build-official-hub-behaviors.mjs +0 -136
  20. package/scripts/build-official-hub-behaviors.test.mjs +0 -178
  21. package/scripts/compare-perception-replays.test.ts +0 -188
  22. package/scripts/enable_ccl_permissions.test.mjs +0 -167
  23. package/scripts/enable_monitor.test.mjs +0 -201
  24. package/scripts/sync-bundled-skill.test.mjs +0 -87
  25. package/scripts/watch-perception-events.test.ts +0 -43
  26. package/src/behaviors/official-finite/do-task.ts +0 -211
  27. package/src/behaviors/official-finite/evade.ts +0 -78
  28. package/src/behaviors/official-finite/find-player.ts +0 -50
  29. package/src/behaviors/official-finite/follow-player.ts +0 -70
  30. package/src/behaviors/official-finite/go-to.ts +0 -69
  31. package/src/behaviors/official-finite/hide-temporarily.ts +0 -77
  32. package/src/behaviors/official-finite/hold-position.ts +0 -48
  33. package/src/behaviors/official-finite/hunt-player.ts +0 -47
  34. package/src/behaviors/official-finite/index.ts +0 -44
  35. package/src/behaviors/official-finite/inspect-corpse.ts +0 -64
  36. package/src/behaviors/official-finite/patrol-area.ts +0 -80
  37. package/src/behaviors/official-finite/report-corpse.ts +0 -73
  38. package/src/behaviors/official-finite/seek-kill-opportunity.ts +0 -152
  39. package/src/behaviors/official-finite/shared.ts +0 -27
  40. package/src/hub-official-behaviors/kill-lone.ts +0 -138
  41. package/src/hub-official-behaviors/patrol.ts +0 -30
  42. package/src/hub-official-behaviors/shared.ts +0 -125
  43. package/src/hub-official-behaviors/task-only.ts +0 -158
  44. package/src/runtime/clawclaw/plugins/behavior/official-goal-behavior.ts +0 -757
  45. package/src/strategies/avoid-lone.ts +0 -32
  46. package/src/strategies/avoid-players.ts +0 -43
  47. package/src/strategies/corpse-patrol.ts +0 -50
  48. package/src/strategies/crab-sabotage.ts +0 -48
  49. package/src/strategies/find-player.ts +0 -49
  50. package/src/strategies/game-utils.ts +0 -927
  51. package/src/strategies/goals/anchor-linger.ts +0 -77
  52. package/src/strategies/goals/avoid-lone-top.ts +0 -189
  53. package/src/strategies/goals/avoid-players-top.ts +0 -122
  54. package/src/strategies/goals/conversation-goal.ts +0 -51
  55. package/src/strategies/goals/corpse-patrol-top.ts +0 -120
  56. package/src/strategies/goals/crab-octopus-reflexes.ts +0 -109
  57. package/src/strategies/goals/crab-sabotage-top.ts +0 -139
  58. package/src/strategies/goals/emergency-hunt-goal.ts +0 -40
  59. package/src/strategies/goals/find-player-top.ts +0 -136
  60. package/src/strategies/goals/flee-players-goal.ts +0 -55
  61. package/src/strategies/goals/follow-companion-goal.ts +0 -130
  62. package/src/strategies/goals/goal-manager.ts +0 -41
  63. package/src/strategies/goals/goal-root-strategy.ts +0 -49
  64. package/src/strategies/goals/goal.ts +0 -28
  65. package/src/strategies/goals/hide-top.ts +0 -240
  66. package/src/strategies/goals/keep-away-goal.ts +0 -243
  67. package/src/strategies/goals/kill-frenzy-top.ts +0 -90
  68. package/src/strategies/goals/kill-lone-top.ts +0 -166
  69. package/src/strategies/goals/kill-target-goal.ts +0 -69
  70. package/src/strategies/goals/kill-target-top.ts +0 -121
  71. package/src/strategies/goals/leaf-goal.ts +0 -27
  72. package/src/strategies/goals/linger-corpse-goal.ts +0 -43
  73. package/src/strategies/goals/lone-kill-core.ts +0 -86
  74. package/src/strategies/goals/lone-kill-goal.ts +0 -24
  75. package/src/strategies/goals/lone-kill-task-top.ts +0 -133
  76. package/src/strategies/goals/move-room-goal.ts +0 -102
  77. package/src/strategies/goals/normal-shrimp-top.ts +0 -248
  78. package/src/strategies/goals/paradise-fish-top.ts +0 -234
  79. package/src/strategies/goals/patrol-top.ts +0 -68
  80. package/src/strategies/goals/report-patrol-top.ts +0 -97
  81. package/src/strategies/goals/safe-task-goal.ts +0 -130
  82. package/src/strategies/goals/social-task-top.ts +0 -192
  83. package/src/strategies/goals/task-kill-report-top.ts +0 -187
  84. package/src/strategies/goals/task-only-top.ts +0 -64
  85. package/src/strategies/goals/task-or-patrol-goal.ts +0 -59
  86. package/src/strategies/goals/task-report-top.ts +0 -57
  87. package/src/strategies/goals/wander-task-goal.ts +0 -33
  88. package/src/strategies/goals/warrior-shrimp-top.ts +0 -293
  89. package/src/strategies/greeting.ts +0 -60
  90. package/src/strategies/hide.ts +0 -51
  91. package/src/strategies/kill-frenzy.ts +0 -32
  92. package/src/strategies/kill-lone.ts +0 -52
  93. package/src/strategies/kill-target.ts +0 -48
  94. package/src/strategies/lone-kill-task.ts +0 -48
  95. package/src/strategies/meeting-gate.ts +0 -28
  96. package/src/strategies/move-room.ts +0 -46
  97. package/src/strategies/paradise-fish.ts +0 -70
  98. package/src/strategies/patrol.ts +0 -32
  99. package/src/strategies/player-targets.ts +0 -18
  100. package/src/strategies/report-patrol.ts +0 -32
  101. package/src/strategies/shrimp-memory.ts +0 -87
  102. package/src/strategies/social-task.ts +0 -67
  103. package/src/strategies/speech-module.ts +0 -123
  104. package/src/strategies/task-kill-report.ts +0 -49
  105. package/src/strategies/task-only.ts +0 -34
  106. package/src/strategies/task-report.ts +0 -50
  107. package/src/strategies/types.ts +0 -116
  108. package/src/strategies/warrior-memory.ts +0 -54
  109. /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/clawclaw-walkable.bin +0 -0
  110. /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/distance-field.ts +0 -0
@@ -1,34 +0,0 @@
1
- import {
2
- type BehaviorDecision,
3
- type BehaviorInput,
4
- type BehaviorReadApi,
5
- ClawclawBehavior,
6
- } from '../sdk/behavior-plugin/index.js';
7
- import { OfficialGoalBehavior } from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
8
- import { GoalRootStrategy } from './goals/goal-root-strategy.js';
9
- import { TaskOnlyTop } from './goals/task-only-top.js';
10
-
11
- export default class TaskOnlyStrategy extends ClawclawBehavior {
12
- static readonly manifest = {
13
- apiVersion: 3,
14
- id: 'task-only',
15
- name: '纯任务',
16
- description: '专心做任务。紧急任务出现时优先处理,其次按顺序完成普通任务,如果是蟹,则蟹的伪装任务也会做。没有尸体报告和战斗行为。',
17
- execution: 'serial',
18
- produces: ['strategy_alert', 'robot_speak_rule'],
19
- inputs: [],
20
- } as const;
21
-
22
- private readonly goal = new OfficialGoalBehavior({
23
- id: 'task-only',
24
- requiresTasks: true,
25
- requiresMap: false,
26
- create: () => new GoalRootStrategy('task-only', () => new TaskOnlyTop(), {
27
- resetOnMeetingResume: false,
28
- }),
29
- });
30
-
31
- override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
32
- return this.goal.decide(input, api);
33
- }
34
- }
@@ -1,50 +0,0 @@
1
- import {
2
- type BehaviorDecision,
3
- type BehaviorInput,
4
- type BehaviorReadApi,
5
- ClawclawBehavior,
6
- } from '../sdk/behavior-plugin/index.js';
7
- import {
8
- OfficialGoalBehavior,
9
- clawclawStrategyStringList,
10
- } from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
11
- import { GoalRootStrategy } from './goals/goal-root-strategy.js';
12
- import { TaskReportTop } from './goals/task-report-top.js';
13
- import { parseGreetingArgs } from './greeting.js';
14
-
15
- class TaskReportStrategy extends GoalRootStrategy {
16
- constructor(greetingPhrases: string[]) {
17
- super('task-report', () => new TaskReportTop(greetingPhrases), { resetOnMeetingResume: false });
18
- }
19
- }
20
-
21
- export default class TaskReportGoalStrategy extends ClawclawBehavior {
22
- static readonly manifest = {
23
- apiVersion: 3,
24
- id: 'task-report',
25
- name: '尽责虾',
26
- description: '遇尸体最优先:达到报告距离立刻报告,没达到距离就靠近准备报告。紧急任务出现时优先处理,其次按顺序完成普通任务。greetings 控制可配置最多3条打招呼话术;视野内出现人时随机发送一条,之后120秒内不再发言。',
27
- execution: 'serial',
28
- produces: ['strategy_alert', 'robot_speak_rule'],
29
- inputs: [{
30
- id: 'greetings',
31
- type: 'string_list',
32
- description: '可选的打招呼话术列表。',
33
- default: [],
34
- maxItems: 3,
35
- }],
36
- } as const;
37
-
38
- private readonly goal = new OfficialGoalBehavior({
39
- id: 'task-report',
40
- requiresTasks: true,
41
- sidecarSpeech: true,
42
- create: (values) => new TaskReportStrategy(
43
- parseGreetingArgs(clawclawStrategyStringList(values, 'greetings'), 'task-report'),
44
- ),
45
- });
46
-
47
- override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
48
- return this.goal.decide(input, api);
49
- }
50
- }
@@ -1,116 +0,0 @@
1
- import type { GameState, TaskInfo, TaskLocation, EmergencyInfo, CorpseInfo } from '../sdk/types.js';
2
- import type { Action } from '../sdk/action.js';
3
- import type { RouteEvidence } from './pathfind/escape-planner.js';
4
-
5
- /**
6
- * Minimal interface for custom modules (built-in and strategy-registered).
7
- * Strategy authors implement this to inject custom analysis modules
8
- * (e.g. CoMovementTracker, VisibilityTracker, SpeechAnalyzer) via ctx.customModules.
9
- * OfficialGoalBehavior manages lifecycle through these hooks:
10
- * - processEvents: called every tick with new events, tick number, and current game state
11
- * - afterDecide: called after strategy.decide(), can filter/modify decisions (chained by registration order)
12
- * - onMeetingResume: called after each meeting (decay or full reset)
13
- * - onMapLoaded: called when fresh map data is available
14
- */
15
- export interface CustomModule {
16
- processEvents(events: any[], tick: number, state: GameState): void;
17
- afterDecide?(decisions: BehaviorDecision[], state: GameState, ctx: StrategyContext): BehaviorDecision[];
18
- onMeetingResume?(): void;
19
- onMapLoaded?(rawRooms: any[]): void;
20
- }
21
-
22
- export type StrategyIntentActivity = 'idle' | 'moving' | 'doing_task' | 'waiting' | 'acting';
23
-
24
- /** Agent-facing description of what a strategy is trying to accomplish. */
25
- export interface StrategyIntent {
26
- activity: StrategyIntentActivity;
27
- summary: string;
28
- room?: string;
29
- task?: string;
30
- targetPlayer?: string;
31
- }
32
-
33
- export interface BehaviorDecision {
34
- action: Action;
35
- /** Semantic purpose of this action. Never use path nodes or coordinates here. */
36
- intent?: StrategyIntent;
37
- }
38
-
39
- export interface CorpseTarget {
40
- x: number;
41
- y: number;
42
- name?: string;
43
- room?: string;
44
- }
45
-
46
- export interface Strategy {
47
- readonly name: string;
48
- decide(state: GameState, ctx: StrategyContext): BehaviorDecision[];
49
- /** Called when wandering resumes after a meeting pause. */
50
- onMeetingResume?(): void;
51
- /** Called by OfficialGoalBehavior when authoritative role state changes. */
52
- updateRole?(role: string): void;
53
- /** Return custom analysis modules. Called once during setup, before the main loop. */
54
- customModules?(): CustomModule[];
55
- }
56
-
57
- export interface RoomTarget {
58
- name: string;
59
- x: number;
60
- y: number;
61
- }
62
-
63
- export interface StrategyContext {
64
- /** Current semantic intent, including deliberate no-action states such as hiding or waiting. */
65
- intent?: StrategyIntent;
66
- taskData: TaskInfo[];
67
- /** Current-frame A* route projection computed by the parallel analyzer. */
68
- routeEvidence?: Readonly<RouteEvidence> | null;
69
- /**
70
- * 全局任务站点(map 的 all_task_locations),OfficialGoalBehavior 首次加载地图后写入。与 taskData(仅自己被
71
- * 分配、带 status)不同:这是地图上所有任务点的位置,开局固定。用于「同伴停在任务点附近 → 在真实
72
- * 任务点假装做任务」这类定点行为。首次地图加载前可能为空/未设置。
73
- */
74
- taskLocations?: TaskLocation[];
75
- emergency: EmergencyInfo | null;
76
- taskLocalBlockedUntil: number;
77
- reportCorpseTarget: CorpseTarget | null;
78
- reportBlockedUntil: number;
79
- /**
80
- * 章鱼时间(剩 3 人,服务端禁用会议/报尸,report 会被 `cannot_report_during_octopus_time` 拒绝)进行中。
81
- * OfficialGoalBehavior 见到 `octopus_time_start` 事件即置 true;每局
82
- * 进程独立初始化为 false,会议恢复时一并清 false(章鱼时间不会开会,纯防御)。为 true 时所有报尸决策
83
- * (reportCorpseDecision / ReportPatrolTop.tryReport / 经前者的 corpseReportWithNonTeammate)直接放弃,改生存优先。
84
- */
85
- octopusTimeActive?: boolean;
86
- notifications: string[];
87
- lastProgressNotifyAt: number;
88
- teammates: Set<string>;
89
- rooms: RoomTarget[];
90
- playerNamesBySeat: Record<string, string>;
91
- /** Set by the Goal strategy host when a move target is repeatedly unreachable. */
92
- forcePatrolAdvance: boolean;
93
- blockedMoveTarget: { x: number; y: number } | null;
94
- /** Own seat number, used by speech module for initiation arbitration. */
95
- mySeat: number;
96
- /** Speech-module notifications, flushed by OfficialGoalBehavior as robot_speak_rule events. */
97
- speechNotifications: string[];
98
- /**
99
- * Strategy → agent real-time briefings, flushed by OfficialGoalBehavior as `strategy_alert`
100
- * events (notable → surfaced live by Monitor, unlike `notifications` which only
101
- * land in the log as `type:'auto'`). Push **sparingly**, only on a decisive autonomous
102
- * move the agent must account for when it next speaks/votes (e.g. the bot reported a
103
- * corpse — possibly its own kill — to deflect). NOT for per-tick progress.
104
- */
105
- agentAlerts: string[];
106
- /**
107
- * 跨 tick 的已知尸体记忆,由 OfficialGoalBehavior 每次运行用中心 CorpseMemory 写入:尸体从出现一直存在到
108
- * 开会才清空(会议恢复时清空)。是 `state.corpses`(仅当前视野)的严格超集,含已离开
109
- * 视野、之前看见过的尸体。策略应统一读它做尸体检测/接近/任务回避/死亡确认,而非只看 `state.corpses`。
110
- * 通过 hasKnownCorpse / nearestKnownCorpse / firstAvailableTask 的 avoidCorpses 参数消费。
111
- */
112
- knownCorpses?: CorpseInfo[];
113
- recentlyKilledTargets?: Map<string, number>;
114
- /** Strategy-registered modules. OfficialGoalBehavior calls processEvents, afterDecide, onMeetingResume and onMapLoaded. */
115
- customModules?: CustomModule[];
116
- }
@@ -1,54 +0,0 @@
1
- import {
2
- type BehaviorDecision,
3
- type BehaviorInput,
4
- type BehaviorReadApi,
5
- ClawclawBehavior,
6
- } from '../sdk/behavior-plugin/index.js';
7
- import {
8
- OfficialGoalBehavior,
9
- } from '../runtime/clawclaw/plugins/behavior/official-goal-behavior.js';
10
- import { GoalRootStrategy } from './goals/goal-root-strategy.js';
11
- import { WarriorShrimpTop } from './goals/warrior-shrimp-top.js';
12
- import { strategySeatList } from './player-targets.js';
13
-
14
- export default class WarriorMemoryStrategy extends ClawclawBehavior {
15
- static readonly manifest = {
16
- apiVersion: 3,
17
- id: 'warrior-memory',
18
- name: '武士虾',
19
- description: '带刀虾·进阶版(武士虾/枪虾通用)。只对 huntTargets 指定的玩家出刀,其他非 trustedTargets 玩家只回避。发现尸体优先报警;无危险时优先紧急任务,否则做任务或巡逻。枪虾会尊重剩余出刀次数。',
20
- execution: 'serial',
21
- produces: ['strategy_alert', 'robot_speak_rule'],
22
- inputs: [
23
- {
24
- id: 'huntTargets',
25
- type: 'player_seats',
26
- description: '主动猎杀的玩家座位号列表。',
27
- default: [],
28
- },
29
- {
30
- id: 'trustedTargets',
31
- type: 'player_seats',
32
- description: '可信、永不击杀的玩家座位号列表;与 huntTargets 重叠时保护优先。',
33
- default: [],
34
- },
35
- ],
36
- } as const;
37
-
38
- private readonly goal = new OfficialGoalBehavior({
39
- id: 'warrior-memory',
40
- requiresTasks: true,
41
- routeEvidenceTargets: ['tasks'],
42
- create: (values) => {
43
- const huntTargets = strategySeatList(values, 'huntTargets');
44
- const trustedTargets = strategySeatList(values, 'trustedTargets');
45
- return new GoalRootStrategy('warrior-memory', () => new WarriorShrimpTop(huntTargets, trustedTargets), {
46
- resetOnMeetingResume: false,
47
- });
48
- },
49
- });
50
-
51
- override decide(input: BehaviorInput, api: BehaviorReadApi): Promise<BehaviorDecision> {
52
- return this.goal.decide(input, api);
53
- }
54
- }