@myclaw163/clawclaw-cli 0.8.13 → 0.8.14

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 (39) hide show
  1. package/package.json +1 -1
  2. package/skills/clawclaw/SKILL.md +3 -3
  3. package/skills/clawclaw/references/CHANNELS.md +1 -1
  4. package/skills/clawclaw/references/COMMANDS.md +2 -2
  5. package/skills/clawclaw/references/STREAM.md +4 -2
  6. package/src/lib/game-client.ts +12 -4
  7. package/src/pipeline/event-format.ts +5 -0
  8. package/src/pipeline/event-hints.ts +10 -0
  9. package/src/runtime/clawclaw/agent-event-policy.ts +2 -0
  10. package/src/runtime/clawclaw/behavior-input.ts +5 -0
  11. package/src/runtime/clawclaw/plugins/action/action-plugin.ts +150 -18
  12. package/src/runtime/clawclaw/plugins/behavior/behavior-action.ts +8 -0
  13. package/src/runtime/clawclaw/plugins/behavior/behavior-decision-history.ts +88 -0
  14. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +173 -11
  15. package/src/runtime/clawclaw/plugins/behavior/behavior-runner.ts +6 -0
  16. package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.ts +3 -1
  17. package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.ts +5 -1
  18. package/src/runtime/clawclaw/plugins/perception/perception-analysis-thread-worker.ts +5 -5
  19. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +213 -6
  20. package/src/runtime/clawclaw/plugins/source/game-transport.ts +29 -4
  21. package/src/runtime/clawclaw/plugins/source/source-plugin.ts +153 -0
  22. package/src/runtime/clawclaw/plugins/source/types.ts +1 -0
  23. package/src/runtime/clawclaw/runtime.ts +31 -3
  24. package/src/runtime/clawclaw-event-catalog.ts +2 -0
  25. package/src/runtime/framework/events/event-repository.ts +1 -1
  26. package/src/runtime/framework/events/memory-event-repository.ts +59 -1
  27. package/src/runtime/framework/events/sqlite-event-repository.ts +23 -1
  28. package/src/runtime/framework/mailbox/types.ts +2 -0
  29. package/src/runtime/framework/persistence/async-sqlite-persistence-worker.ts +58 -0
  30. package/src/runtime/framework/persistence/memory-first-persistence.ts +380 -0
  31. package/src/runtime/framework/plugins/contracts.ts +2 -2
  32. package/src/runtime/framework/plugins/runtime-input-journal.ts +173 -17
  33. package/src/runtime/framework/plugins/runtime-plugin-scheduler.ts +23 -11
  34. package/src/runtime/framework/runtime.ts +57 -4
  35. package/src/runtime/framework/state/history/contracts.ts +9 -1
  36. package/src/runtime/framework/state/history/memory-state-history-repository.ts +49 -7
  37. package/src/runtime/framework/state/history/sqlite-state-history-repository.ts +16 -0
  38. package/src/sdk/behavior-plugin/index.ts +5 -24
  39. package/src/sdk/module-input/index.ts +47 -0
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  BehaviorInput,
3
+ BehaviorDecisionAction,
3
4
  Position,
4
5
  } from '../module-input/index.js';
5
6
  import type { ClawclawResourceLocalizations } from '../resource-metadata.js';
@@ -19,6 +20,9 @@ export type {
19
20
 
20
21
  export type {
21
22
  BehaviorContinuation,
23
+ BehaviorDecisionAction,
24
+ BehaviorDecisionFrame,
25
+ BehaviorDecisionFrameStatus,
22
26
  BehaviorDelegatedBehaviorResult,
23
27
  BehaviorInput,
24
28
  BehaviorScope,
@@ -180,31 +184,8 @@ export interface BehaviorReadApi {
180
184
  };
181
185
  }
182
186
 
183
- interface GameActionBase {
184
- readonly thinking_content?: string;
185
- }
186
-
187
187
  /** The one typed Action union accepted from finite and continuous Behaviors. */
188
- export type GameAction =
189
- | (GameActionBase & {
190
- readonly action: 'move';
191
- readonly target: string;
192
- readonly target_x?: never;
193
- readonly target_y?: never;
194
- readonly stop_on_player?: boolean;
195
- })
196
- | (GameActionBase & {
197
- readonly action: 'move';
198
- readonly target?: never;
199
- readonly target_x: number;
200
- readonly target_y: number;
201
- readonly stop_on_player?: boolean;
202
- })
203
- | (GameActionBase & { readonly action: 'kill'; readonly target_seat: number })
204
- | (GameActionBase & { readonly action: 'speech'; readonly text: string })
205
- | (GameActionBase & { readonly action: 'task'; readonly task_name?: string })
206
- | (GameActionBase & { readonly action: 'report' })
207
- | (GameActionBase & { readonly action: 'think' });
188
+ export type GameAction = BehaviorDecisionAction;
208
189
 
209
190
  /** Module status published beside Game State; it never patches authoritative Game State. */
210
191
  export interface BehaviorStatus {
@@ -227,6 +227,48 @@ export interface BehaviorContinuation {
227
227
  readonly delegatedBehavior: Readonly<BehaviorDelegatedBehaviorResult>;
228
228
  }
229
229
 
230
+ interface BehaviorDecisionActionBase {
231
+ readonly thinking_content?: string;
232
+ }
233
+
234
+ /** One credential-free Action proposed by a Behavior Decision. */
235
+ export type BehaviorDecisionAction =
236
+ | (BehaviorDecisionActionBase & {
237
+ readonly action: 'move';
238
+ readonly target: string;
239
+ readonly target_x?: never;
240
+ readonly target_y?: never;
241
+ readonly stop_on_player?: boolean;
242
+ })
243
+ | (BehaviorDecisionActionBase & {
244
+ readonly action: 'move';
245
+ readonly target?: never;
246
+ readonly target_x: number;
247
+ readonly target_y: number;
248
+ readonly stop_on_player?: boolean;
249
+ })
250
+ | (BehaviorDecisionActionBase & { readonly action: 'kill'; readonly target_seat: number })
251
+ | (BehaviorDecisionActionBase & { readonly action: 'speech'; readonly text: string })
252
+ | (BehaviorDecisionActionBase & { readonly action: 'task'; readonly task_name?: string })
253
+ | (BehaviorDecisionActionBase & { readonly action: 'report' })
254
+ | (BehaviorDecisionActionBase & { readonly action: 'think' });
255
+
256
+ export type BehaviorDecisionFrameStatus = 'pending' | 'completed' | 'not_computed' | 'failed';
257
+
258
+ /**
259
+ * One activation-local Runtime frame and the Decision result known so far.
260
+ * `actions` is an array for a completed Decision (including an empty array)
261
+ * and null when no Decision result exists.
262
+ */
263
+ export interface BehaviorDecisionFrame {
264
+ readonly epochId: number;
265
+ readonly tick: number;
266
+ readonly instanceGeneration: number;
267
+ readonly status: BehaviorDecisionFrameStatus;
268
+ readonly actions: readonly Readonly<BehaviorDecisionAction>[] | null;
269
+ readonly reason?: string;
270
+ }
271
+
230
272
  /** The input envelope shared by finite and continuous Behaviors. */
231
273
  export interface BehaviorInput<
232
274
  TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,
@@ -238,6 +280,11 @@ export interface BehaviorInput<
238
280
  readonly gameState: Readonly<GameState>;
239
281
  readonly events: readonly Readonly<GameEvent>[];
240
282
  readonly input: Readonly<TInput>;
283
+ /**
284
+ * One immutable snapshot of the current Activation's latest 100 Decision frames.
285
+ * Current Runtime owners always provide it; optional keeps older author test fixtures source-compatible.
286
+ */
287
+ readonly decisionHistory?: readonly Readonly<BehaviorDecisionFrame>[];
241
288
  /** Present for the first committed decision after delegated short work ends. */
242
289
  readonly continuation?: Readonly<BehaviorContinuation>;
243
290
  }