@myclaw163/clawclaw-cli 0.9.0 → 0.9.1

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/README.md +5 -3
  2. package/docs/custom-modules/README.md +12 -16
  3. package/docs/custom-modules/api-reference.md +18 -3
  4. package/docs/custom-modules/examples/first-sighting-v3.ts +29 -0
  5. package/docs/custom-modules/perception.md +139 -58
  6. package/docs/custom-modules/trigger.md +2 -0
  7. package/docs/runtime/README.md +17 -8
  8. package/docs/runtime/agent-notifications.md +32 -15
  9. package/docs/runtime/behavior-runtime.md +28 -21
  10. package/docs/runtime/components-and-boundaries.md +57 -17
  11. package/docs/runtime/events-and-state.md +42 -2
  12. package/docs/runtime/owner-lifecycle-and-observability.md +5 -3
  13. package/docs/user-guide/api-reference.md +15 -0
  14. package/docs/user-guide/perception.md +138 -57
  15. package/package.json +1 -1
  16. package/skills/clawclaw/SKILL.md +3 -3
  17. package/skills/clawclaw/references/BEHAVIORS.md +2 -0
  18. package/skills/clawclaw/references/CUSTOM-MODULE-API.md +18 -3
  19. package/skills/clawclaw/references/CUSTOM-MODULES.md +12 -16
  20. package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +139 -58
  21. package/src/commands/load.ts +13 -11
  22. package/src/commands/perception.ts +2 -2
  23. package/src/commands/trigger.ts +1 -1
  24. package/src/lib/agent-workspace-sync.ts +2 -2
  25. package/src/runtime/clawclaw/owner.ts +3 -2
  26. package/src/runtime/clawclaw/perception-module-manifest.ts +27 -0
  27. package/src/runtime/clawclaw/plugins/assembly.ts +17 -5
  28. package/src/runtime/clawclaw/plugins/perception/perception-module-worker.ts +28 -0
  29. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +1 -1
  30. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +21 -0
  31. package/src/runtime/clawclaw/plugins/perception/reaction-plugin.ts +47 -12
  32. package/src/runtime/clawclaw/plugins/perception/reaction-runner.ts +2 -2
  33. package/src/runtime/clawclaw-event-catalog.ts +5 -2
  34. package/src/sdk/index.ts +2 -0
  35. package/src/sdk/perception-plugin/index.ts +25 -8
  36. package/src/sdk/perception-plugin/module.ts +46 -0
  37. package/src/sdk/perception-plugin/reaction.ts +1 -0
  38. package/src/sdk/perception-plugin/reminder.ts +1 -0
  39. package/src/sdk/trigger-plugin/index.ts +1 -0
@@ -0,0 +1,46 @@
1
+ import type { GameState, ObservationFrame } from '../module-input/index.js';
2
+ import type { BehaviorInputFieldSpec } from '../behavior-plugin/index.js';
3
+ import type { ClawclawResourceLocalizations } from '../resource-metadata.js';
4
+ import type { ReactionBehaviorBinding, ReactionActivation } from './reaction.js';
5
+ import type { ReminderFact, ReminderTaskChange } from './reminder.js';
6
+
7
+ /** Unified authoring contract; v2 visual/reminder/reaction scripts remain supported. */
8
+ export const PERCEPTION_MODULE_API_VERSION = 3 as const;
9
+ export interface PerceptionModuleManifest {
10
+ readonly apiVersion: typeof PERCEPTION_MODULE_API_VERSION;
11
+ readonly id: string;
12
+ readonly name?: string;
13
+ readonly description: string;
14
+ readonly localizations?: ClawclawResourceLocalizations;
15
+ readonly consumes?: readonly string[];
16
+ readonly produces?: readonly string[];
17
+ readonly behaviors?: Readonly<Record<string, ReactionBehaviorBinding>>;
18
+ readonly inputs?: readonly BehaviorInputFieldSpec[];
19
+ readonly config?: Readonly<Record<string, unknown>>;
20
+ }
21
+ export interface PerceptionModuleInput {
22
+ readonly moduleId: string;
23
+ readonly scope: Readonly<{ sessionId: string; segmentId: string }>;
24
+ readonly gameState: Readonly<GameState> | null;
25
+ readonly frame: Readonly<ObservationFrame> | null;
26
+ /** Source/backend and system-derived facts only; never another perception's output. */
27
+ readonly events: readonly Readonly<ReminderFact>[];
28
+ readonly taskChanges: readonly ReminderTaskChange[];
29
+ readonly boundary: 'initial' | 'recovery' | null;
30
+ readonly nowMs: number;
31
+ readonly config: Readonly<Record<string, unknown>>;
32
+ readonly state: unknown;
33
+ readonly availableBehaviors: readonly string[];
34
+ }
35
+ export interface PerceptionModuleEvent {
36
+ readonly type: string;
37
+ readonly key: string;
38
+ /** false retains the event for a later wake; omit the event to produce no notification. */
39
+ readonly wakeAgent?: boolean;
40
+ readonly payload: Readonly<Record<string, unknown>>;
41
+ }
42
+ export interface PerceptionModuleResult {
43
+ readonly state?: unknown;
44
+ readonly events?: readonly PerceptionModuleEvent[];
45
+ readonly activations?: readonly ReactionActivation[];
46
+ }
@@ -72,6 +72,7 @@ export interface ReactionResult {
72
72
  }
73
73
 
74
74
  /** A perception resource that can notify the Agent and request fixed Behaviors. */
75
+ /** @deprecated API v2 compatibility; future support may end. New scripts use ClawclawPerception API v3. */
75
76
  export abstract class ClawclawReaction {
76
77
  static readonly manifest?: ClawclawReactionManifest;
77
78
  abstract evaluate(input: Readonly<ReactionInput>): ReactionResult | Promise<ReactionResult>;
@@ -60,6 +60,7 @@ export interface ClawclawReminderManifest {
60
60
  readonly config?: Readonly<Record<string, unknown>>;
61
61
  }
62
62
  /** Non-visual perception rule. Runtime supplies durable state and bounds the Worker. */
63
+ /** @deprecated API v2 compatibility; future support may end. New scripts use ClawclawPerception API v3. */
63
64
  export abstract class ClawclawReminder {
64
65
  static readonly manifest?: ClawclawReminderManifest;
65
66
  abstract update(input: Readonly<ReminderInput>): ReminderResult | Promise<ReminderResult>;
@@ -106,6 +106,7 @@ export interface TriggerMatch {
106
106
  }
107
107
 
108
108
  /** Public authoring surface for one read-only rule module. */
109
+ /** @deprecated Compatibility API; may be unsupported in a future release. Use unified Perception API v3 for new rules. */
109
110
  export abstract class ClawclawTrigger<
110
111
  TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,
111
112
  > {