@myclaw163/clawclaw-cli 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/configuration.md +2 -1
- package/docs/custom-modules/behavior.md +7 -18
- package/docs/custom-modules/trigger.md +3 -4
- package/docs/runtime/short-commands-and-capabilities.md +1 -1
- package/package.json +9 -3
- package/scripts/find-hide-spots.py +2 -2
- package/skills/clawclaw/SKILL.md +17 -13
- package/skills/clawclaw/references/BEHAVIORS.md +13 -9
- package/skills/clawclaw/references/COMMANDS.md +17 -29
- package/skills/clawclaw/references/TACTICS.md +1 -1
- package/src/commands/load.ts +245 -14
- package/src/commands/trigger.ts +22 -13
- package/src/lib/capability-load-diagnostics.ts +182 -0
- package/src/lib/gameplay-config.ts +10 -0
- package/src/lib/hub-reminder.ts +3 -5
- package/src/lib/trigger-config.ts +2 -10
- package/src/runtime/clawclaw/behavior-read-api.ts +1 -1
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/astar-path.ts +1 -1
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/escape-planner.ts +1 -1
- package/src/{strategies → runtime/clawclaw/navigation}/hide-spots.ts +2 -2
- package/src/{strategies → runtime/clawclaw/navigation}/off-route-points.ts +6 -3
- package/src/{strategies/pathfind → runtime/clawclaw/navigation}/walkable-grid.ts +1 -1
- package/src/runtime/clawclaw/owner.ts +4 -6
- package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.ts +1 -1
- package/src/runtime/framework/modules/runtime-module-loader.ts +0 -54
- package/src/sdk/behavior-toolkit/escape.ts +2 -2
- package/scripts/build-official-hub-behaviors.mjs +0 -136
- package/scripts/build-official-hub-behaviors.test.mjs +0 -178
- package/scripts/compare-perception-replays.test.ts +0 -188
- package/scripts/enable_ccl_permissions.test.mjs +0 -167
- package/scripts/enable_monitor.test.mjs +0 -201
- package/scripts/sync-bundled-skill.test.mjs +0 -87
- package/scripts/watch-perception-events.test.ts +0 -43
- package/src/behaviors/official-finite/do-task.ts +0 -211
- package/src/behaviors/official-finite/evade.ts +0 -78
- package/src/behaviors/official-finite/find-player.ts +0 -50
- package/src/behaviors/official-finite/follow-player.ts +0 -70
- package/src/behaviors/official-finite/go-to.ts +0 -69
- package/src/behaviors/official-finite/hide-temporarily.ts +0 -77
- package/src/behaviors/official-finite/hold-position.ts +0 -48
- package/src/behaviors/official-finite/hunt-player.ts +0 -47
- package/src/behaviors/official-finite/index.ts +0 -44
- package/src/behaviors/official-finite/inspect-corpse.ts +0 -64
- package/src/behaviors/official-finite/patrol-area.ts +0 -80
- package/src/behaviors/official-finite/report-corpse.ts +0 -73
- package/src/behaviors/official-finite/seek-kill-opportunity.ts +0 -152
- package/src/behaviors/official-finite/shared.ts +0 -27
- package/src/hub-official-behaviors/kill-lone.ts +0 -138
- package/src/hub-official-behaviors/patrol.ts +0 -30
- package/src/hub-official-behaviors/shared.ts +0 -125
- package/src/hub-official-behaviors/task-only.ts +0 -158
- package/src/runtime/clawclaw/plugins/behavior/official-goal-behavior.ts +0 -757
- package/src/strategies/avoid-lone.ts +0 -32
- package/src/strategies/avoid-players.ts +0 -43
- package/src/strategies/corpse-patrol.ts +0 -50
- package/src/strategies/crab-sabotage.ts +0 -48
- package/src/strategies/find-player.ts +0 -49
- package/src/strategies/game-utils.ts +0 -927
- package/src/strategies/goals/anchor-linger.ts +0 -77
- package/src/strategies/goals/avoid-lone-top.ts +0 -189
- package/src/strategies/goals/avoid-players-top.ts +0 -122
- package/src/strategies/goals/conversation-goal.ts +0 -51
- package/src/strategies/goals/corpse-patrol-top.ts +0 -120
- package/src/strategies/goals/crab-octopus-reflexes.ts +0 -109
- package/src/strategies/goals/crab-sabotage-top.ts +0 -139
- package/src/strategies/goals/emergency-hunt-goal.ts +0 -40
- package/src/strategies/goals/find-player-top.ts +0 -136
- package/src/strategies/goals/flee-players-goal.ts +0 -55
- package/src/strategies/goals/follow-companion-goal.ts +0 -130
- package/src/strategies/goals/goal-manager.ts +0 -41
- package/src/strategies/goals/goal-root-strategy.ts +0 -49
- package/src/strategies/goals/goal.ts +0 -28
- package/src/strategies/goals/hide-top.ts +0 -240
- package/src/strategies/goals/keep-away-goal.ts +0 -243
- package/src/strategies/goals/kill-frenzy-top.ts +0 -90
- package/src/strategies/goals/kill-lone-top.ts +0 -166
- package/src/strategies/goals/kill-target-goal.ts +0 -69
- package/src/strategies/goals/kill-target-top.ts +0 -121
- package/src/strategies/goals/leaf-goal.ts +0 -27
- package/src/strategies/goals/linger-corpse-goal.ts +0 -43
- package/src/strategies/goals/lone-kill-core.ts +0 -86
- package/src/strategies/goals/lone-kill-goal.ts +0 -24
- package/src/strategies/goals/lone-kill-task-top.ts +0 -133
- package/src/strategies/goals/move-room-goal.ts +0 -102
- package/src/strategies/goals/normal-shrimp-top.ts +0 -248
- package/src/strategies/goals/paradise-fish-top.ts +0 -234
- package/src/strategies/goals/patrol-top.ts +0 -68
- package/src/strategies/goals/report-patrol-top.ts +0 -97
- package/src/strategies/goals/safe-task-goal.ts +0 -130
- package/src/strategies/goals/social-task-top.ts +0 -192
- package/src/strategies/goals/task-kill-report-top.ts +0 -187
- package/src/strategies/goals/task-only-top.ts +0 -64
- package/src/strategies/goals/task-or-patrol-goal.ts +0 -59
- package/src/strategies/goals/task-report-top.ts +0 -57
- package/src/strategies/goals/wander-task-goal.ts +0 -33
- package/src/strategies/goals/warrior-shrimp-top.ts +0 -293
- package/src/strategies/greeting.ts +0 -60
- package/src/strategies/hide.ts +0 -51
- package/src/strategies/kill-frenzy.ts +0 -32
- package/src/strategies/kill-lone.ts +0 -52
- package/src/strategies/kill-target.ts +0 -48
- package/src/strategies/lone-kill-task.ts +0 -48
- package/src/strategies/meeting-gate.ts +0 -28
- package/src/strategies/move-room.ts +0 -46
- package/src/strategies/paradise-fish.ts +0 -70
- package/src/strategies/patrol.ts +0 -32
- package/src/strategies/player-targets.ts +0 -18
- package/src/strategies/report-patrol.ts +0 -32
- package/src/strategies/shrimp-memory.ts +0 -87
- package/src/strategies/social-task.ts +0 -67
- package/src/strategies/speech-module.ts +0 -123
- package/src/strategies/task-kill-report.ts +0 -49
- package/src/strategies/task-only.ts +0 -34
- package/src/strategies/task-report.ts +0 -50
- package/src/strategies/types.ts +0 -116
- package/src/strategies/warrior-memory.ts +0 -54
- /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/clawclaw-walkable.bin +0 -0
- /package/src/{strategies/pathfind → runtime/clawclaw/navigation}/distance-field.ts +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
behaviorEventMentionsTarget,
|
|
10
|
-
behaviorSelf,
|
|
11
|
-
behaviorTaskAvailable,
|
|
12
|
-
behaviorTasks,
|
|
13
|
-
normalizedBehaviorLabel,
|
|
14
|
-
SemanticMoveGate,
|
|
15
|
-
type BehaviorTaskPoint,
|
|
16
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
17
|
-
import { finished, running } from './shared.js';
|
|
18
|
-
|
|
19
|
-
type TaskSelector = 'nearest' | 'any';
|
|
20
|
-
type DoTaskInput = Readonly<Record<string, unknown>> & {
|
|
21
|
-
readonly task?: string;
|
|
22
|
-
readonly selector?: TaskSelector;
|
|
23
|
-
readonly timeout_ms?: number;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function matchingTaskEvent(
|
|
27
|
-
input: Readonly<BehaviorInput>,
|
|
28
|
-
type: string,
|
|
29
|
-
taskId?: string,
|
|
30
|
-
taskName?: string,
|
|
31
|
-
): Readonly<Record<string, unknown>> | undefined {
|
|
32
|
-
return input.events.find((event) => {
|
|
33
|
-
if (event.type !== type) return false;
|
|
34
|
-
const payload = event.payload;
|
|
35
|
-
const candidates = [payload.task_id, payload.task_name, payload.task]
|
|
36
|
-
.filter((value): value is string => typeof value === 'string' && value.length > 0)
|
|
37
|
-
.map(normalizedBehaviorLabel);
|
|
38
|
-
return [taskId, taskName]
|
|
39
|
-
.filter((value): value is string => typeof value === 'string' && value.length > 0)
|
|
40
|
-
.map(normalizedBehaviorLabel)
|
|
41
|
-
.some((value) => candidates.includes(value));
|
|
42
|
-
})?.payload;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function cooldownSummary(gameState: Readonly<BehaviorInput['gameState']>): string {
|
|
46
|
-
const remaining = gameState.crab_sabotage?.cooldown_remaining_secs;
|
|
47
|
-
return typeof remaining === 'number' && Number.isFinite(remaining)
|
|
48
|
-
? `,共享冷却剩余${remaining}秒`
|
|
49
|
-
: '';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default class DoTaskBehavior extends ClawclawBehavior<DoTaskInput> {
|
|
53
|
-
static override readonly manifest = {
|
|
54
|
-
apiVersion: 3,
|
|
55
|
-
id: 'do_task',
|
|
56
|
-
name: 'Do Task',
|
|
57
|
-
description: 'Navigate to and submit one currently available task.',
|
|
58
|
-
localizations: { 'zh-CN': { name: '执行任务', description: '前往并提交一个当前可用任务。' } },
|
|
59
|
-
inputs: [
|
|
60
|
-
{ id: 'task', type: 'string', description: 'Exact task id or name. Mutually exclusive with selector.' },
|
|
61
|
-
{ id: 'selector', type: 'enum', description: 'Task selector. Mutually exclusive with task.', values: ['nearest', 'any'] },
|
|
62
|
-
],
|
|
63
|
-
execution: 'serial',
|
|
64
|
-
runtime: { defaultMs: 60_000, deadlineOutcome: 'failed' },
|
|
65
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
66
|
-
|
|
67
|
-
private readonly move = new SemanticMoveGate();
|
|
68
|
-
private selectedTaskId?: string;
|
|
69
|
-
private selectedTaskName?: string;
|
|
70
|
-
private submittedAtMs?: number;
|
|
71
|
-
|
|
72
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): DoTaskInput {
|
|
73
|
-
const task = api.optionalString(input.task, 'task');
|
|
74
|
-
const selector = input.selector === undefined
|
|
75
|
-
? undefined
|
|
76
|
-
: api.choice(input.selector, 'task_selection', ['nearest', 'any'] as const);
|
|
77
|
-
if (!!task === !!selector) throw new Error('behavior_task_selection_invalid');
|
|
78
|
-
return { ...api.timing(input), ...(task ? { task } : { selector }) };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
override async decide(input: Readonly<BehaviorInput<DoTaskInput>>, api: BehaviorReadApi) {
|
|
82
|
-
if (this.submittedAtMs !== undefined && this.selectedTaskName) {
|
|
83
|
-
const selected = behaviorTasks(input).find((task) => (
|
|
84
|
-
(this.selectedTaskId && task.id === this.selectedTaskId)
|
|
85
|
-
|| task.name === this.selectedTaskName
|
|
86
|
-
));
|
|
87
|
-
if (
|
|
88
|
-
selected?.status === 'completed'
|
|
89
|
-
|| behaviorEventMentionsTarget(input.events, ['task_completed'], this.selectedTaskName)
|
|
90
|
-
) return finished('completed', 'task_completed', `任务“${this.selectedTaskName}”已完成。`);
|
|
91
|
-
if (matchingTaskEvent(input, 'task_interrupted', this.selectedTaskId, this.selectedTaskName)) {
|
|
92
|
-
return finished(
|
|
93
|
-
'failed',
|
|
94
|
-
'task_interrupted',
|
|
95
|
-
`破坏任务“${this.selectedTaskName}”被紧急任务打断,任务未消耗${cooldownSummary(input.gameState)}。`,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (selected && this.isCrabSabotage(input, selected)) {
|
|
99
|
-
const blocked = this.sabotageBlocked(input);
|
|
100
|
-
if (blocked) return blocked;
|
|
101
|
-
}
|
|
102
|
-
if (!selected && input.nowMs - this.submittedAtMs > 1_000) {
|
|
103
|
-
return finished('failed', 'task_unavailable', `任务“${this.selectedTaskName}”不再可用。`);
|
|
104
|
-
}
|
|
105
|
-
return running(`等待任务“${this.selectedTaskName}”的权威完成状态;不会重复提交。`, 'doing_task', [], { task: this.selectedTaskName });
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const selected = await this.selectTask(input, api);
|
|
109
|
-
if (!selected) {
|
|
110
|
-
return finished('failed', 'task_unavailable', input.input.task
|
|
111
|
-
? `任务“${input.input.task}”已经不可执行。`
|
|
112
|
-
: '当前没有符合选择条件的可执行任务。');
|
|
113
|
-
}
|
|
114
|
-
if (this.isCrabSabotage(input, selected.task)) {
|
|
115
|
-
const blocked = this.sabotageBlocked(input);
|
|
116
|
-
if (blocked) return blocked;
|
|
117
|
-
}
|
|
118
|
-
if (selected.distance > 12) {
|
|
119
|
-
const summary = `正在前往${selected.task.room ?? '任务点'}执行“${selected.task.name}”。`;
|
|
120
|
-
const action = this.move.propose(input, selected.task, false, summary);
|
|
121
|
-
return running(summary, 'moving', action ? [action] : [], {
|
|
122
|
-
task: selected.task.name,
|
|
123
|
-
...(selected.task.room ? { room: selected.task.room } : {}),
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
this.selectedTaskId = selected.task.id;
|
|
127
|
-
this.selectedTaskName = selected.task.name;
|
|
128
|
-
this.submittedAtMs = input.nowMs;
|
|
129
|
-
const summary = `正在提交任务“${selected.task.name}”并等待权威结果。`;
|
|
130
|
-
return running(summary, 'doing_task', [{ action: 'task', task_name: selected.task.name, thinking_content: summary }], { task: selected.task.name });
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
private isCrabSabotage(
|
|
134
|
-
input: Readonly<BehaviorInput<DoTaskInput>>,
|
|
135
|
-
task: Readonly<BehaviorTaskPoint>,
|
|
136
|
-
): boolean {
|
|
137
|
-
return input.gameState.you?.faction === 'crab' && task.isFakeShrimp === false;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private sabotageBlocked(
|
|
141
|
-
input: Readonly<BehaviorInput<DoTaskInput>>,
|
|
142
|
-
): ReturnType<typeof finished> | undefined {
|
|
143
|
-
const status = input.gameState.crab_sabotage?.status;
|
|
144
|
-
if (status === 'ready') return undefined;
|
|
145
|
-
if (status === 'cooldown_charged') {
|
|
146
|
-
return finished(
|
|
147
|
-
'failed',
|
|
148
|
-
'sabotage_on_cooldown',
|
|
149
|
-
`蟹破坏任务仍在共享冷却中${cooldownSummary(input.gameState)}。`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
if (status === 'emergency_active') {
|
|
153
|
-
return finished(
|
|
154
|
-
'failed',
|
|
155
|
-
'sabotage_blocked_during_emergency',
|
|
156
|
-
'紧急任务进行中,不能开始或继续新的蟹破坏任务。',
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
return finished('failed', 'sabotage_state_unavailable', '当前没有可确认的蟹破坏任务准入状态。');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private async selectTask(
|
|
163
|
-
input: Readonly<BehaviorInput<DoTaskInput>>,
|
|
164
|
-
api: BehaviorReadApi,
|
|
165
|
-
): Promise<{ task: BehaviorTaskPoint; distance: number } | undefined> {
|
|
166
|
-
const tasks = behaviorTasks(input);
|
|
167
|
-
if (this.selectedTaskName) {
|
|
168
|
-
const existing = tasks.find((task) => (
|
|
169
|
-
(this.selectedTaskId && task.id === this.selectedTaskId)
|
|
170
|
-
|| task.name === this.selectedTaskName
|
|
171
|
-
));
|
|
172
|
-
if (existing && behaviorTaskAvailable(existing)) {
|
|
173
|
-
const distance = await this.distance(input, api, existing);
|
|
174
|
-
return distance === null ? undefined : { task: existing, distance };
|
|
175
|
-
}
|
|
176
|
-
if (input.input.task) return undefined;
|
|
177
|
-
this.selectedTaskId = undefined;
|
|
178
|
-
this.selectedTaskName = undefined;
|
|
179
|
-
}
|
|
180
|
-
const candidates = tasks.filter(behaviorTaskAvailable);
|
|
181
|
-
const exact = input.input.task
|
|
182
|
-
? candidates.find((task) => (
|
|
183
|
-
normalizedBehaviorLabel(task.name) === normalizedBehaviorLabel(input.input.task!)
|
|
184
|
-
|| (!!task.id && normalizedBehaviorLabel(task.id) === normalizedBehaviorLabel(input.input.task!))
|
|
185
|
-
))
|
|
186
|
-
: undefined;
|
|
187
|
-
if (input.input.task && !exact) return undefined;
|
|
188
|
-
const considered = exact ? [exact] : candidates;
|
|
189
|
-
const self = behaviorSelf(input);
|
|
190
|
-
if (!self || considered.length === 0) return undefined;
|
|
191
|
-
const distances = await api.navigation.pathDistances(considered.map((to) => ({ from: self, to })));
|
|
192
|
-
const reachable = considered
|
|
193
|
-
.map((task, index) => ({ task, distance: distances[index] }))
|
|
194
|
-
.filter((entry): entry is { task: BehaviorTaskPoint; distance: number } => entry.distance !== null)
|
|
195
|
-
.sort((left, right) => left.distance - right.distance);
|
|
196
|
-
const selected = reachable[0];
|
|
197
|
-
if (!selected) return undefined;
|
|
198
|
-
this.selectedTaskId = selected.task.id;
|
|
199
|
-
this.selectedTaskName = selected.task.name;
|
|
200
|
-
return selected;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private async distance(
|
|
204
|
-
input: Readonly<BehaviorInput>,
|
|
205
|
-
api: BehaviorReadApi,
|
|
206
|
-
task: Readonly<BehaviorTaskPoint>,
|
|
207
|
-
): Promise<number | null> {
|
|
208
|
-
const self = behaviorSelf(input);
|
|
209
|
-
return self ? api.navigation.pathDistance(self, task) : null;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
type Position,
|
|
8
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
9
|
-
import {
|
|
10
|
-
behaviorDistance,
|
|
11
|
-
behaviorSelf,
|
|
12
|
-
behaviorTeammateSeats,
|
|
13
|
-
behaviorVisiblePlayers,
|
|
14
|
-
planBehaviorEscape,
|
|
15
|
-
SemanticMoveGate,
|
|
16
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
17
|
-
import { finished, running } from './shared.js';
|
|
18
|
-
|
|
19
|
-
type EvadeInput = Readonly<Record<string, unknown>> & {
|
|
20
|
-
readonly player_seats?: readonly number[];
|
|
21
|
-
readonly duration_ms?: number;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default class EvadeBehavior extends ClawclawBehavior<EvadeInput> {
|
|
25
|
-
static override readonly manifest = {
|
|
26
|
-
apiVersion: 3,
|
|
27
|
-
id: 'evade',
|
|
28
|
-
name: 'Evade',
|
|
29
|
-
description: 'Keep distance from selected or nearby threats for a bounded duration.',
|
|
30
|
-
localizations: { 'zh-CN': { name: '躲避', description: '在有限时长内远离指定或附近威胁。' } },
|
|
31
|
-
inputs: [{ id: 'player_seats', type: 'player_seats', description: 'Optional authoritative player seats to evade (1-10).', maxItems: 8 }],
|
|
32
|
-
execution: 'serial',
|
|
33
|
-
runtime: { defaultMs: 15_000, deadlineOutcome: 'completed' },
|
|
34
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
35
|
-
|
|
36
|
-
private readonly move = new SemanticMoveGate();
|
|
37
|
-
private escapeTarget?: Position;
|
|
38
|
-
private plannedAtMs = 0;
|
|
39
|
-
|
|
40
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): EvadeInput {
|
|
41
|
-
const seats = input.player_seats === undefined ? [] : input.player_seats as readonly number[];
|
|
42
|
-
return { ...api.timing(input), ...(seats.length ? { player_seats: seats } : {}) };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
override decide(input: Readonly<BehaviorInput<EvadeInput>>, api: BehaviorReadApi) {
|
|
46
|
-
const self = behaviorSelf(input);
|
|
47
|
-
if (!self) return finished('failed', 'self_position_unavailable', '当前无法取得自身位置。');
|
|
48
|
-
const selected = input.input.player_seats ?? [];
|
|
49
|
-
const teammates = behaviorTeammateSeats(input);
|
|
50
|
-
let threats = behaviorVisiblePlayers(input).filter((player) => (
|
|
51
|
-
player.isAlive !== false
|
|
52
|
-
&& (selected.length ? selected.includes(player.seat) : !teammates.has(player.seat))
|
|
53
|
-
));
|
|
54
|
-
if (threats.length === 0 && selected.length) {
|
|
55
|
-
threats = selected.flatMap((seat) => {
|
|
56
|
-
const seen = api.observation.lastSeenPlayer(seat, 5_000);
|
|
57
|
-
return seen ? [{ ...seen, isAlive: seen.isAlive }] : [];
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (threats.length === 0) {
|
|
61
|
-
return finished('completed', 'threat_out_of_sight', selected.length
|
|
62
|
-
? '已在有限时间内持续躲避,当前看不到指定玩家;这不代表威胁已经解除。'
|
|
63
|
-
: '当前没有可见威胁,本次有限躲避结束。');
|
|
64
|
-
}
|
|
65
|
-
if (!this.escapeTarget || behaviorDistance(self, this.escapeTarget) <= 70 || this.plannedAtMs + 1_600 <= input.nowMs) {
|
|
66
|
-
const plan = planBehaviorEscape(self, threats);
|
|
67
|
-
if (plan.caught && plan.survivedSteps === 0) return finished('failed', 'no_escape_route', '当前没有可确认的逃生路线。');
|
|
68
|
-
this.escapeTarget = plan.target;
|
|
69
|
-
this.plannedAtMs = input.nowMs;
|
|
70
|
-
}
|
|
71
|
-
const visibleSeats = new Set(behaviorVisiblePlayers(input).map((player) => player.seat));
|
|
72
|
-
const summary = threats.some((threat) => visibleSeats.has(threat.seat))
|
|
73
|
-
? `正在远离${threats.map((threat) => threat.name).join('、')}。`
|
|
74
|
-
: '指定玩家暂时离开视野,正在根据最后目击位置继续有限拉开距离。';
|
|
75
|
-
const action = this.move.propose(input, this.escapeTarget, false, summary);
|
|
76
|
-
return running(summary, 'moving', action ? [action] : []);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
FinitePlayerSearch,
|
|
10
|
-
SemanticMoveGate,
|
|
11
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
12
|
-
import { finished, running } from './shared.js';
|
|
13
|
-
|
|
14
|
-
type FindPlayerInput = Readonly<Record<string, unknown>> & {
|
|
15
|
-
readonly player_seat: number;
|
|
16
|
-
readonly timeout_ms?: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default class FindPlayerBehavior extends ClawclawBehavior<FindPlayerInput> {
|
|
20
|
-
static override readonly manifest = {
|
|
21
|
-
apiVersion: 3,
|
|
22
|
-
id: 'find_player',
|
|
23
|
-
name: 'Find Player',
|
|
24
|
-
description: 'Search a finite route for one known player.',
|
|
25
|
-
localizations: { 'zh-CN': { name: '寻找玩家', description: '沿有限路线寻找一名已知玩家。' } },
|
|
26
|
-
inputs: [{ id: 'player_seat', type: 'player_seat', description: 'Authoritative seat of the player to find (1-10).', required: true }],
|
|
27
|
-
execution: 'serial',
|
|
28
|
-
runtime: { defaultMs: 45_000, deadlineOutcome: 'failed' },
|
|
29
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
30
|
-
|
|
31
|
-
private readonly search = new FinitePlayerSearch();
|
|
32
|
-
private readonly move = new SemanticMoveGate();
|
|
33
|
-
|
|
34
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): FindPlayerInput {
|
|
35
|
-
return {
|
|
36
|
-
player_seat: api.number(input.player_seat, 'player_seat', { integer: true, min: 1, max: 10 }),
|
|
37
|
-
...api.timing(input),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
override async decide(input: Readonly<BehaviorInput<FindPlayerInput>>, api: BehaviorReadApi) {
|
|
42
|
-
const result = await this.search.step(input, api, input.input.player_seat);
|
|
43
|
-
if (result.kind === 'visible') {
|
|
44
|
-
return finished('completed', 'player_found', `已在${result.player.room ?? '当前区域'}看到${result.player.name}。`);
|
|
45
|
-
}
|
|
46
|
-
if (result.kind === 'failed') return finished('failed', result.reason, result.summary);
|
|
47
|
-
const action = this.move.propose(input, result.target, false, result.summary);
|
|
48
|
-
return running(result.summary, 'moving', action ? [action] : []);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
behaviorDistance,
|
|
10
|
-
behaviorSelf,
|
|
11
|
-
FinitePlayerSearch,
|
|
12
|
-
SemanticMoveGate,
|
|
13
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
14
|
-
import { finished, running } from './shared.js';
|
|
15
|
-
|
|
16
|
-
type FollowPlayerInput = Readonly<Record<string, unknown>> & {
|
|
17
|
-
readonly player_seat: number;
|
|
18
|
-
readonly distance: number;
|
|
19
|
-
readonly duration_ms?: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default class FollowPlayerBehavior extends ClawclawBehavior<FollowPlayerInput> {
|
|
23
|
-
static override readonly manifest = {
|
|
24
|
-
apiVersion: 3,
|
|
25
|
-
id: 'follow_player',
|
|
26
|
-
name: 'Follow Player',
|
|
27
|
-
description: 'Follow one known player at a bounded distance.',
|
|
28
|
-
localizations: { 'zh-CN': { name: '跟随玩家', description: '在有限距离内跟随一名已知玩家。' } },
|
|
29
|
-
inputs: [
|
|
30
|
-
{ id: 'player_seat', type: 'player_seat', description: 'Authoritative seat of the player to follow (1-10).', required: true },
|
|
31
|
-
{ id: 'distance', type: 'number', description: 'Preferred following distance in pixels.', min: 20, max: 500, default: 90 },
|
|
32
|
-
],
|
|
33
|
-
execution: 'serial',
|
|
34
|
-
runtime: { defaultMs: 30_000, deadlineOutcome: 'completed' },
|
|
35
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
36
|
-
|
|
37
|
-
private readonly search = new FinitePlayerSearch();
|
|
38
|
-
private readonly move = new SemanticMoveGate();
|
|
39
|
-
|
|
40
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): FollowPlayerInput {
|
|
41
|
-
return {
|
|
42
|
-
player_seat: api.number(input.player_seat, 'player_seat', { integer: true, min: 1, max: 10 }),
|
|
43
|
-
distance: api.number(input.distance, 'follow_distance', { min: 20, max: 500 }),
|
|
44
|
-
...api.timing(input),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override async decide(input: Readonly<BehaviorInput<FollowPlayerInput>>, api: BehaviorReadApi) {
|
|
49
|
-
const result = await this.search.step(input, api, input.input.player_seat);
|
|
50
|
-
if (result.kind === 'failed') return finished('failed', result.reason, result.summary);
|
|
51
|
-
if (result.kind === 'move') {
|
|
52
|
-
const action = this.move.propose(input, result.target, false, result.summary);
|
|
53
|
-
return running(result.summary, 'moving', action ? [action] : []);
|
|
54
|
-
}
|
|
55
|
-
const self = behaviorSelf(input);
|
|
56
|
-
if (!self) return finished('failed', 'self_position_unavailable', '当前无法取得自身位置。');
|
|
57
|
-
const distance = behaviorDistance(self, result.player);
|
|
58
|
-
if (distance <= input.input.distance * 1.15) {
|
|
59
|
-
return running(`正在与${result.player.name}保持约${Math.round(distance)}距离。`, 'waiting', [], { targetPlayer: result.player.name });
|
|
60
|
-
}
|
|
61
|
-
const travel = Math.max(0, distance - input.input.distance);
|
|
62
|
-
const target = {
|
|
63
|
-
x: self.x + ((result.player.x - self.x) * travel) / distance,
|
|
64
|
-
y: self.y + ((result.player.y - self.y) * travel) / distance,
|
|
65
|
-
};
|
|
66
|
-
const summary = `正在跟随${result.player.name}并保持距离。`;
|
|
67
|
-
const action = this.move.propose(input, target, false, summary);
|
|
68
|
-
return running(summary, 'moving', action ? [action] : [], { targetPlayer: result.player.name });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
behaviorSelf,
|
|
10
|
-
behaviorTasks,
|
|
11
|
-
findBehaviorRoom,
|
|
12
|
-
normalizedBehaviorLabel,
|
|
13
|
-
SemanticMoveGate,
|
|
14
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
15
|
-
import { finished, running } from './shared.js';
|
|
16
|
-
|
|
17
|
-
type GoToInput = Readonly<Record<string, unknown>> & {
|
|
18
|
-
readonly destination: string;
|
|
19
|
-
readonly timeout_ms?: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default class GoToBehavior extends ClawclawBehavior<GoToInput> {
|
|
23
|
-
static override readonly manifest = {
|
|
24
|
-
apiVersion: 3,
|
|
25
|
-
id: 'go_to',
|
|
26
|
-
name: 'Go To',
|
|
27
|
-
description: 'Navigate to one semantic room or task destination.',
|
|
28
|
-
localizations: { 'zh-CN': { name: '前往', description: '前往一个语义房间或任务地点。' } },
|
|
29
|
-
inputs: [{
|
|
30
|
-
id: 'destination',
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'Known room name or exact current task id or name.',
|
|
33
|
-
required: true,
|
|
34
|
-
}],
|
|
35
|
-
execution: 'serial',
|
|
36
|
-
runtime: { defaultMs: 45_000, deadlineOutcome: 'failed' },
|
|
37
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
38
|
-
|
|
39
|
-
private readonly move = new SemanticMoveGate();
|
|
40
|
-
|
|
41
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): GoToInput {
|
|
42
|
-
return {
|
|
43
|
-
destination: api.string(input.destination, 'destination'),
|
|
44
|
-
...api.timing(input),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override async decide(input: Readonly<BehaviorInput<GoToInput>>, api: BehaviorReadApi) {
|
|
49
|
-
const room = findBehaviorRoom(api, input.input.destination);
|
|
50
|
-
const task = behaviorTasks(input).find((candidate) => (
|
|
51
|
-
normalizedBehaviorLabel(candidate.name) === normalizedBehaviorLabel(input.input.destination)
|
|
52
|
-
|| (!!candidate.id && normalizedBehaviorLabel(candidate.id) === normalizedBehaviorLabel(input.input.destination))
|
|
53
|
-
));
|
|
54
|
-
const target = task ?? room;
|
|
55
|
-
const label = room?.name ?? task?.name ?? input.input.destination;
|
|
56
|
-
if (!target) return finished('failed', 'destination_unknown', `找不到语义目标“${input.input.destination}”。`);
|
|
57
|
-
if (room && input.gameState.you?.room === room.name) {
|
|
58
|
-
return finished('completed', 'arrived', `已到达${label}。`);
|
|
59
|
-
}
|
|
60
|
-
const self = behaviorSelf(input);
|
|
61
|
-
if (!self) return finished('failed', 'self_position_unavailable', '当前无法取得自身位置。');
|
|
62
|
-
const distance = await api.navigation.pathDistance(self, target);
|
|
63
|
-
if (distance === null) return finished('failed', 'destination_unreachable', `当前没有到达${label}的可用路径。`);
|
|
64
|
-
if (distance <= 70) return finished('completed', 'arrived', `已到达${label}。`);
|
|
65
|
-
const summary = `正在前往${label}。`;
|
|
66
|
-
const action = this.move.propose(input, target, false, summary);
|
|
67
|
-
return running(summary, 'moving', action ? [action] : [], room ? { room: room.name } : task ? { task: task.name } : {});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
behaviorDistance,
|
|
10
|
-
behaviorHideSpots,
|
|
11
|
-
behaviorSelf,
|
|
12
|
-
behaviorTeammateSeats,
|
|
13
|
-
behaviorVisiblePlayers,
|
|
14
|
-
nearestBehaviorHideSpot,
|
|
15
|
-
normalizedBehaviorLabel,
|
|
16
|
-
planBehaviorEscape,
|
|
17
|
-
SemanticMoveGate,
|
|
18
|
-
type HideSpot,
|
|
19
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
20
|
-
import { finished, running } from './shared.js';
|
|
21
|
-
|
|
22
|
-
type HideInput = Readonly<Record<string, unknown>> & {
|
|
23
|
-
readonly area?: string;
|
|
24
|
-
readonly duration_ms?: number;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default class HideTemporarilyBehavior extends ClawclawBehavior<HideInput> {
|
|
28
|
-
static override readonly manifest = {
|
|
29
|
-
apiVersion: 3,
|
|
30
|
-
id: 'hide_temporarily',
|
|
31
|
-
name: 'Hide Temporarily',
|
|
32
|
-
description: 'Move to and remain near a bounded hide point.',
|
|
33
|
-
localizations: { 'zh-CN': { name: '短暂隐藏', description: '移动到一个隐藏点并在附近有限停留。' } },
|
|
34
|
-
inputs: [{ id: 'area', type: 'string', description: 'Optional preferred room name.' }],
|
|
35
|
-
execution: 'serial',
|
|
36
|
-
runtime: { defaultMs: 20_000, deadlineOutcome: 'completed' },
|
|
37
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
38
|
-
|
|
39
|
-
private readonly move = new SemanticMoveGate();
|
|
40
|
-
private hideTarget?: HideSpot;
|
|
41
|
-
private escapeTarget?: Readonly<{ x: number; y: number }>;
|
|
42
|
-
|
|
43
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): HideInput {
|
|
44
|
-
const area = api.optionalString(input.area, 'area');
|
|
45
|
-
return { ...api.timing(input), ...(area ? { area } : {}) };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override decide(input: Readonly<BehaviorInput<HideInput>>, _api: BehaviorReadApi) {
|
|
49
|
-
const self = behaviorSelf(input);
|
|
50
|
-
if (!self) return finished('failed', 'self_position_unavailable', '当前无法取得自身位置。');
|
|
51
|
-
const teammates = behaviorTeammateSeats(input);
|
|
52
|
-
const threats = behaviorVisiblePlayers(input).filter((player) => (
|
|
53
|
-
player.isAlive !== false && !teammates.has(player.seat)
|
|
54
|
-
));
|
|
55
|
-
if (threats.some((threat) => behaviorDistance(self, threat) <= 420)) {
|
|
56
|
-
const plan = planBehaviorEscape(self, threats);
|
|
57
|
-
if (plan.caught && plan.survivedSteps === 0) return finished('failed', 'no_escape_route', '当前没有可确认的逃生路线。');
|
|
58
|
-
this.escapeTarget = plan.target;
|
|
59
|
-
const summary = `威胁过近,正在先远离${threats.map((threat) => threat.name).join('、')}。`;
|
|
60
|
-
const action = this.move.propose(input, this.escapeTarget, false, summary);
|
|
61
|
-
return running(summary, 'moving', action ? [action] : []);
|
|
62
|
-
}
|
|
63
|
-
const preferred = input.input.area
|
|
64
|
-
? behaviorHideSpots()
|
|
65
|
-
.filter((spot) => normalizedBehaviorLabel(spot.room) === normalizedBehaviorLabel(input.input.area!))
|
|
66
|
-
.sort((left, right) => behaviorDistance(self, left) - behaviorDistance(self, right))[0]
|
|
67
|
-
: undefined;
|
|
68
|
-
this.hideTarget = preferred ?? nearestBehaviorHideSpot(self, threats, this.hideTarget) ?? undefined;
|
|
69
|
-
if (!this.hideTarget) return finished('failed', 'hide_spot_unavailable', '没有可用的隐藏点。');
|
|
70
|
-
if (behaviorDistance(self, this.hideTarget) <= 35) {
|
|
71
|
-
return running(`正在${this.hideTarget.room}隐蔽等待。`, 'waiting', [], { room: this.hideTarget.room });
|
|
72
|
-
}
|
|
73
|
-
const summary = `正在前往${this.hideTarget.room}的隐藏点。`;
|
|
74
|
-
const action = this.move.propose(input, this.hideTarget, false, summary);
|
|
75
|
-
return running(summary, 'moving', action ? [action] : [], { room: this.hideTarget.room });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type ClawclawBehaviorManifest,
|
|
6
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
7
|
-
import { finished, running } from './shared.js';
|
|
8
|
-
|
|
9
|
-
type HoldInput = Readonly<Record<string, unknown>> & {
|
|
10
|
-
readonly duration_ms?: number;
|
|
11
|
-
readonly timeout_ms?: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default class HoldPositionBehavior extends ClawclawBehavior<HoldInput> {
|
|
15
|
-
static override readonly manifest = {
|
|
16
|
-
apiVersion: 3,
|
|
17
|
-
id: 'hold_position',
|
|
18
|
-
name: 'Hold Position',
|
|
19
|
-
description: 'Stop planning movement and wait in place for a finite duration.',
|
|
20
|
-
localizations: { 'zh-CN': { name: '原地等待', description: '停止规划移动,并在原地等待有限时长。' } },
|
|
21
|
-
inputs: [],
|
|
22
|
-
execution: 'serial',
|
|
23
|
-
runtime: { defaultMs: 5_000, deadlineOutcome: 'failed', controlGraceMs: 11_000 },
|
|
24
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
25
|
-
|
|
26
|
-
private startedAtMs?: number;
|
|
27
|
-
private holdUntilMs?: number;
|
|
28
|
-
|
|
29
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): HoldInput {
|
|
30
|
-
return { ...api.timing(input) };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
override decide(input: Readonly<BehaviorInput<HoldInput>>) {
|
|
34
|
-
this.startedAtMs ??= input.nowMs;
|
|
35
|
-
if (input.gameState.you?.activity?.kind === 'moving') {
|
|
36
|
-
if (input.nowMs - this.startedAtMs >= 10_000) {
|
|
37
|
-
return finished('failed', 'motion_did_not_stop', '底层已有移动未在等待预算内结束,无法开始原地等待。');
|
|
38
|
-
}
|
|
39
|
-
return running('已停止规划新移动,等待底层现有移动结束后原地等待。', 'waiting');
|
|
40
|
-
}
|
|
41
|
-
const duration = input.input.duration_ms ?? input.input.timeout_ms ?? 5_000;
|
|
42
|
-
this.holdUntilMs ??= input.nowMs + duration;
|
|
43
|
-
if (input.nowMs >= this.holdUntilMs) {
|
|
44
|
-
return finished('completed', 'duration_elapsed', '已完成明确的原地有限等待。');
|
|
45
|
-
}
|
|
46
|
-
return running(`正在原地有限等待,剩余约${Math.max(0, Math.ceil((this.holdUntilMs - input.nowMs) / 1_000))}秒。`, 'waiting');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawclawBehavior,
|
|
3
|
-
type BehaviorInput,
|
|
4
|
-
type BehaviorNormalizationApi,
|
|
5
|
-
type BehaviorReadApi,
|
|
6
|
-
type ClawclawBehaviorManifest,
|
|
7
|
-
} from '../../sdk/behavior-plugin/index.js';
|
|
8
|
-
import {
|
|
9
|
-
AuthoritativeKillFlow,
|
|
10
|
-
type AfterKillBehavior,
|
|
11
|
-
} from '../../sdk/behavior-toolkit/index.js';
|
|
12
|
-
|
|
13
|
-
type HuntInput = Readonly<Record<string, unknown>> & {
|
|
14
|
-
readonly player_seat: number;
|
|
15
|
-
readonly after_kill: AfterKillBehavior;
|
|
16
|
-
readonly timeout_ms?: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default class HuntPlayerBehavior extends ClawclawBehavior<HuntInput> {
|
|
20
|
-
static override readonly manifest = {
|
|
21
|
-
apiVersion: 3,
|
|
22
|
-
id: 'hunt_player',
|
|
23
|
-
name: 'Hunt Player',
|
|
24
|
-
description: 'Find and attempt one authoritative kill against a player seat.',
|
|
25
|
-
localizations: { 'zh-CN': { name: '追猎玩家', description: '寻找指定玩家并尝试一次由权威状态确认的击杀。' } },
|
|
26
|
-
inputs: [
|
|
27
|
-
{ id: 'player_seat', type: 'player_seat', description: 'Authoritative seat of the player to hunt (1-10).', required: true },
|
|
28
|
-
{ id: 'after_kill', type: 'enum', description: 'Follow-up after a confirmed kill.', values: ['escape', 'hold', 'report', 'replan'], default: 'escape' },
|
|
29
|
-
],
|
|
30
|
-
execution: 'serial',
|
|
31
|
-
runtime: { defaultMs: 60_000, deadlineOutcome: 'failed' },
|
|
32
|
-
} as const satisfies ClawclawBehaviorManifest;
|
|
33
|
-
|
|
34
|
-
private readonly kill = new AuthoritativeKillFlow();
|
|
35
|
-
|
|
36
|
-
override normalize(input: Readonly<Record<string, unknown>>, api: BehaviorNormalizationApi): HuntInput {
|
|
37
|
-
return {
|
|
38
|
-
player_seat: api.number(input.player_seat, 'player_seat', { integer: true, min: 1, max: 10 }),
|
|
39
|
-
after_kill: api.choice(input.after_kill, 'after_kill', ['escape', 'hold', 'report', 'replan'] as const),
|
|
40
|
-
...api.timing(input),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override decide(input: Readonly<BehaviorInput<HuntInput>>, api: BehaviorReadApi) {
|
|
45
|
-
return this.kill.step(input, api, input.input.player_seat, input.input.after_kill);
|
|
46
|
-
}
|
|
47
|
-
}
|