@myclaw163/clawclaw-cli 0.9.1 → 0.10.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.
- package/QUICKSTART_OTHER.md +5 -5
- package/README.md +7 -8
- package/bin/clawclaw-channel.mjs +2 -2
- package/bin/clawclaw-cli.mjs +2 -2
- package/docs/configuration.md +25 -99
- package/docs/custom-modules/README.md +27 -40
- package/docs/custom-modules/api-reference.md +132 -273
- package/docs/custom-modules/behavior.md +185 -75
- package/docs/custom-modules/examples/auto-escape.ts +41 -0
- package/docs/custom-modules/examples/go-to-point.ts +11 -11
- package/docs/custom-modules/examples/nearby-reflex.ts +22 -0
- package/docs/custom-modules/examples/task-reminder.ts +4 -5
- package/docs/custom-modules/perception.md +46 -806
- package/docs/custom-modules/skill.md +1 -1
- package/docs/desktop-event-push.md +3 -3
- package/docs/runtime/README.md +18 -19
- package/docs/runtime/agent-notifications.md +31 -12
- package/docs/runtime/behavior-runtime.md +54 -48
- package/docs/runtime/components-and-boundaries.md +87 -137
- package/docs/runtime/events-and-state.md +52 -17
- package/docs/runtime/framework-package.md +73 -0
- package/docs/runtime/official-perception-modules.md +5 -5
- package/docs/runtime/owner-lifecycle-and-observability.md +6 -6
- package/docs/runtime/short-commands-and-capabilities.md +8 -9
- package/docs/user-guide/README.md +12 -9
- package/docs/user-guide/api-reference.md +132 -180
- package/docs/user-guide/behavior.md +175 -65
- package/docs/user-guide/installation.md +7 -7
- package/docs/user-guide/perception.md +46 -789
- package/docs/user-guide/skill.md +1 -1
- package/package.json +24 -9
- package/scripts/check-framework-boundaries.mjs +27 -0
- package/scripts/check-skill-command-surface.mjs +9 -14
- package/scripts/install-local-runtime.mjs +35 -0
- package/scripts/qa-install.mjs +105 -0
- package/skills/clawclaw/SKILL.md +50 -48
- package/skills/clawclaw/references/BEHAVIORS.md +45 -65
- package/skills/clawclaw/references/CHANNELS.md +2 -2
- package/skills/clawclaw/references/COMMANDS.md +65 -87
- package/skills/clawclaw/references/CUSTOM-BEHAVIOR-DEVELOPMENT.md +185 -75
- package/skills/clawclaw/references/CUSTOM-MODULE-API.md +145 -198
- package/skills/clawclaw/references/CUSTOM-MODULES.md +28 -29
- package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +46 -811
- package/skills/clawclaw/references/CUSTOM-SKILL-DEVELOPMENT.md +1 -1
- package/skills/clawclaw/references/HUB.md +1 -1
- package/skills/clawclaw/references/STREAM.md +8 -8
- package/skills/clawclaw/references/TACTICS.md +1 -1
- package/src/channel/claude-channel-ipc-server.ts +1 -0
- package/src/cli.ts +4 -2
- package/src/commands/behavior.ts +49 -104
- package/src/commands/capability.ts +3 -3
- package/src/commands/load.ts +18 -25
- package/src/commands/module-runtime-control.ts +113 -0
- package/src/commands/perception.ts +23 -4
- package/src/commands/strategy.ts +2 -0
- package/src/commands/trigger.ts +1 -1
- package/src/lib/capability-load-diagnostics.ts +3 -3
- package/src/lib/perception-config.ts +18 -6
- package/src/lib/runtime-cadence-config.ts +16 -0
- package/src/lib/workspace-runtime-lock.ts +3 -46
- package/src/pipeline/canonical-event-presentation.ts +23 -124
- package/src/pipeline/event-format.ts +12 -21
- package/src/pipeline/event-hints.ts +6 -6
- package/src/pipeline/game-sync-event-normalization.ts +57 -63
- package/src/runtime/clawclaw/behavior-decision.ts +7 -3
- package/src/runtime/clawclaw/behavior-input.ts +8 -4
- package/src/runtime/clawclaw/behavior-observation-memory.ts +3 -2
- package/src/runtime/clawclaw/behavior-read-api.ts +4 -0
- package/src/runtime/clawclaw/behavior-reflex-control.ts +74 -0
- package/src/runtime/clawclaw/notification-policy.ts +42 -0
- package/src/runtime/clawclaw/notification-turn.ts +19 -0
- package/src/runtime/clawclaw/observation-frame-projector.ts +3 -3
- package/src/runtime/clawclaw/owner.ts +67 -8
- package/src/runtime/clawclaw/perception-module-manifest.ts +22 -8
- package/src/runtime/clawclaw/perception-strategy-names.ts +17 -0
- package/src/runtime/clawclaw/persistence-compatibility.ts +36 -0
- package/src/runtime/clawclaw/plugins/action/action-plugin.ts +3 -3
- package/src/runtime/clawclaw/plugins/assembly.ts +29 -41
- package/src/runtime/clawclaw/plugins/behavior/activation-manager.ts +1 -482
- package/src/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.ts +17 -186
- package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.ts +2 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-instance-snapshot.ts +1 -123
- package/src/runtime/clawclaw/plugins/behavior/behavior-normalization.ts +3 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +126 -1707
- package/src/runtime/clawclaw/plugins/behavior/behavior-runner.ts +13 -271
- package/src/runtime/clawclaw/plugins/behavior/behavior-source.ts +2 -2
- package/src/runtime/clawclaw/plugins/behavior/behavior-worker-bridge.ts +8 -0
- package/src/runtime/clawclaw/plugins/behavior/control-driver.ts +3 -180
- package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.ts +13 -960
- package/src/runtime/clawclaw/plugins/derived-event/derived-event-plugin.ts +9 -107
- package/src/runtime/clawclaw/plugins/derived-event/derived-event-rules.ts +5 -4
- package/src/runtime/clawclaw/plugins/derived-event/reminder-plugin.ts +27 -17
- package/src/runtime/clawclaw/plugins/derived-event/reminder-runner.ts +1 -0
- package/src/runtime/clawclaw/plugins/derived-event/state-change-rules.ts +84 -0
- package/src/runtime/clawclaw/plugins/derived-event/task-change-tracker.ts +1 -0
- package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.ts +4 -4
- package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.ts +9 -97
- package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-socket.ts +8 -343
- package/src/runtime/clawclaw/plugins/mailbox/agent-mailbox-coordinator.ts +60 -572
- package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.ts +6 -434
- package/src/runtime/clawclaw/plugins/mailbox/mailbox-event-batch-delivery.ts +1 -266
- package/src/runtime/clawclaw/plugins/mailbox/mailbox-plugin.ts +6 -161
- package/src/runtime/clawclaw/plugins/mailbox/mailbox-presentation.ts +4 -23
- package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.ts +49 -752
- package/src/runtime/clawclaw/plugins/perception/map-concurrent.ts +1 -0
- package/src/runtime/clawclaw/plugins/perception/notification-content.ts +60 -0
- package/src/runtime/clawclaw/plugins/perception/perception-module-plugin.ts +136 -0
- package/src/runtime/clawclaw/plugins/perception/perception-module-runner.ts +13 -0
- package/src/runtime/clawclaw/plugins/perception/perception-module-worker.ts +13 -24
- package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +19 -8
- package/src/runtime/clawclaw/plugins/perception/perception-source.ts +23 -15
- package/src/runtime/clawclaw/plugins/perception/task-baseline.ts +29 -0
- package/src/runtime/clawclaw/plugins/source/source-plugin.ts +8 -103
- package/src/runtime/clawclaw/plugins/system-perception/rule-runner.ts +107 -0
- package/src/runtime/clawclaw/plugins/system-perception/system-perceptions.ts +107 -0
- package/src/runtime/clawclaw/plugins/trigger/contracts.ts +3 -1
- package/src/runtime/clawclaw/plugins/trigger/trigger-module-loader.ts +5 -2
- package/src/runtime/clawclaw/plugins/trigger/trigger-plugin.ts +69 -13
- package/src/runtime/clawclaw/plugins/trigger/trigger-thread-pool.ts +13 -1
- package/src/runtime/clawclaw/plugins/trigger/trigger-thread-worker.ts +4 -0
- package/src/runtime/clawclaw/reaction-behavior-resolution.ts +1 -23
- package/src/runtime/clawclaw/reaction-manifest.ts +18 -12
- package/src/runtime/clawclaw/reminder-manifest.ts +5 -2
- package/src/runtime/clawclaw/runtime-cadence.ts +24 -0
- package/src/runtime/clawclaw/runtime-state.ts +12 -1
- package/src/runtime/clawclaw/runtime.ts +11 -3
- package/src/runtime/clawclaw/strategy-memory-rpc.ts +1 -0
- package/src/runtime/clawclaw/strategy-memory.ts +1 -0
- package/src/runtime/clawclaw-event-catalog.ts +17 -17
- package/src/runtime/framework/action-diagnostics.ts +3 -83
- package/src/runtime/framework/capability-registry.ts +2 -395
- package/src/runtime/framework/contracts.ts +2 -144
- package/src/runtime/framework/control/control-scheduler.ts +2 -1268
- package/src/runtime/framework/control/domain-set.ts +2 -81
- package/src/runtime/framework/control/index.ts +1 -3
- package/src/runtime/framework/control/types.ts +2 -191
- package/src/runtime/framework/control-coordinator.ts +2 -11
- package/src/runtime/framework/events/event-catalog.ts +2 -74
- package/src/runtime/framework/events/event-delivery-service.ts +2 -200
- package/src/runtime/framework/events/event-ingress.ts +2 -99
- package/src/runtime/framework/events/event-repository.ts +2 -82
- package/src/runtime/framework/events/index.ts +2 -7
- package/src/runtime/framework/events/memory-event-repository.ts +2 -1100
- package/src/runtime/framework/events/runtime-resume.ts +2 -20
- package/src/runtime/framework/events/sqlite-event-repository.ts +5 -2280
- package/src/runtime/framework/events/test-helpers.ts +1 -1
- package/src/runtime/framework/events/types.ts +2 -312
- package/src/runtime/framework/index.ts +3 -7
- package/src/runtime/framework/load-node-sqlite.ts +2 -17
- package/src/runtime/framework/mailbox/coalescer.ts +2 -83
- package/src/runtime/framework/mailbox/host-notification-sink.ts +2 -44
- package/src/runtime/framework/mailbox/identity.ts +2 -38
- package/src/runtime/framework/mailbox/index.ts +1 -7
- package/src/runtime/framework/mailbox/mailbox-dispatcher.ts +2 -282
- package/src/runtime/framework/mailbox/mailbox-repository.ts +2 -44
- package/src/runtime/framework/mailbox/notification-projector.ts +2 -65
- package/src/runtime/framework/mailbox/types.ts +2 -145
- package/src/runtime/framework/modules/runtime-module-loader-hooks.mjs +2 -154
- package/src/runtime/framework/modules/runtime-module-loader.ts +7 -51
- package/src/runtime/framework/modules/runtime-module-output.ts +2 -24
- package/src/runtime/framework/modules/runtime-module-worker-bootstrap.mjs +3 -23
- package/src/runtime/framework/participation-manager.ts +2 -253
- package/src/runtime/framework/persistence/async-sqlite-persistence-worker.ts +2 -77
- package/src/runtime/framework/persistence/memory-first-persistence.ts +4 -489
- package/src/runtime/framework/plugins/contracts.ts +2 -388
- package/src/runtime/framework/plugins/index.ts +1 -4
- package/src/runtime/framework/plugins/runtime-event-identity.ts +2 -17
- package/src/runtime/framework/plugins/runtime-input-journal.ts +2 -866
- package/src/runtime/framework/plugins/runtime-plugin-scheduler.ts +2 -2060
- package/src/runtime/framework/runtime.ts +5 -1843
- package/src/runtime/framework/serial-task-queue.ts +2 -14
- package/src/runtime/framework/state/contracts.ts +2 -49
- package/src/runtime/framework/state/current-state-store.ts +2 -184
- package/src/runtime/framework/state/durable-agent-state-snapshot.ts +2 -209
- package/src/runtime/framework/state/freshness.ts +2 -72
- package/src/runtime/framework/state/history/contracts.ts +2 -158
- package/src/runtime/framework/state/history/history-writer.ts +2 -194
- package/src/runtime/framework/state/history/memory-state-history-repository.ts +2 -230
- package/src/runtime/framework/state/history/sqlite-state-history-repository.ts +2 -648
- package/src/runtime/framework/state/history/trajectory-projector.ts +2 -209
- package/src/runtime/framework/state/index.ts +1 -13
- package/src/runtime/framework/state/state-ingress.ts +2 -95
- package/src/runtime/framework/state/state-provider.ts +2 -62
- package/src/runtime/framework/state/types.ts +2 -155
- package/src/runtime/host-monitor-rate-gate.ts +1 -123
- package/src/runtime/mailbox-host-relay.ts +1 -326
- package/src/runtime/observability/detail-capture.ts +4 -108
- package/src/runtime/observability/process-timing.ts +2 -59
- package/src/runtime/observability/recorder.ts +2 -238
- package/src/runtime/observability/redaction.ts +2 -181
- package/src/runtime/observability/reporter.ts +2 -154
- package/src/runtime/observability/sinks.ts +2 -135
- package/src/runtime/observability/types.ts +2 -92
- package/src/runtime/owner-control.ts +45 -315
- package/src/runtime/parent-process-watch.ts +1 -51
- package/src/runtime/process-identity.ts +1 -72
- package/src/sdk/behavior-plugin/index.ts +13 -4
- package/src/sdk/index.ts +44 -3
- package/src/sdk/module-input/index.ts +5 -0
- package/src/sdk/perception-plugin/index.ts +9 -5
- package/src/sdk/perception-plugin/module.ts +25 -6
- package/src/sdk/perception-plugin/reaction.ts +1 -1
- package/src/sdk/perception-plugin/reminder-rules.ts +8 -42
- package/src/sdk/perception-plugin/reminder.ts +2 -1
- package/src/{runtime/clawclaw/plugins/source → sdk/perception-plugin}/task-change-tracker.ts +1 -2
- package/src/sdk/strategy-memory.ts +1 -0
- package/src/sdk/strategy-plugin/index.ts +36 -0
- package/src/sdk/trigger-plugin/index.ts +4 -3
- package/docs/custom-modules/examples/nearby-escape.ts +0 -56
- package/docs/custom-modules/examples/nearby-notice.ts +0 -36
- package/docs/custom-modules/trigger.md +0 -295
- package/src/runtime/clawclaw/behavior-activation-capability.ts +0 -21
- package/src/runtime/clawclaw/plugins/perception/reaction-plugin.ts +0 -233
- package/src/runtime/clawclaw/plugins/perception/reaction-runner.ts +0 -49
- package/src/runtime/clawclaw/plugins/perception/reaction-worker.ts +0 -26
- /package/src/runtime/clawclaw/plugins/{source → derived-event}/player-change-tracker.ts +0 -0
|
@@ -1,144 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { StoredStateFrame } from './state/history/contracts.js';
|
|
4
|
-
|
|
5
|
-
export interface ScopeRef {
|
|
6
|
-
adapterId: string;
|
|
7
|
-
accountId: string;
|
|
8
|
-
sessionId: string;
|
|
9
|
-
segmentId: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ObservationResult<T> {
|
|
13
|
-
scope: ScopeRef;
|
|
14
|
-
capability: string;
|
|
15
|
-
observedAt?: string;
|
|
16
|
-
receivedAt: string;
|
|
17
|
-
freshness: 'fresh' | 'stale' | 'unknown';
|
|
18
|
-
value: T;
|
|
19
|
-
provenance?: Record<string, unknown>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ObservationQueryContext {
|
|
23
|
-
/** Present when one Epoch Plugin calls another capability while processing E. */
|
|
24
|
-
epochSeq?: number;
|
|
25
|
-
/** Exact accepted Runtime State frame for E; never a later mutable provider snapshot. */
|
|
26
|
-
stateFrame?: Readonly<StoredStateFrame<Record<string, unknown>>>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Runtime-owned control layer for one unified Behavior activation. */
|
|
30
|
-
export type BehaviorControlLayer = 'long' | 'short' | 'reflex';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Pull-only information such as a full map, inventory, object detail, or a
|
|
34
|
-
* bounded history page. Querying a provider does not implicitly create an
|
|
35
|
-
* Event.
|
|
36
|
-
*/
|
|
37
|
-
export interface ObservationProvider<Q = unknown, R = unknown> {
|
|
38
|
-
readonly capability: string;
|
|
39
|
-
query(
|
|
40
|
-
request: Q,
|
|
41
|
-
scope: ScopeRef,
|
|
42
|
-
context: ObservationQueryContext,
|
|
43
|
-
): Promise<ObservationResult<R>>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type ActionCaller =
|
|
47
|
-
| { kind: 'agent'; id?: string }
|
|
48
|
-
| {
|
|
49
|
-
kind: 'behavior';
|
|
50
|
-
/** Unique logical activation; module ids are deliberately not controller ids. */
|
|
51
|
-
activationId: string;
|
|
52
|
-
layer: BehaviorControlLayer;
|
|
53
|
-
/** Fresh module instance created when a suspended activation restarts. */
|
|
54
|
-
activationGeneration: number;
|
|
55
|
-
}
|
|
56
|
-
| { kind: 'user'; id?: string }
|
|
57
|
-
| { kind: 'system'; id: string };
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Logical control domains required atomically by an Action. Actions in
|
|
61
|
-
* unrelated domains can be controlled independently. `*` is a real wildcard;
|
|
62
|
-
* services that omit a descriptor are conservatively treated as `*`.
|
|
63
|
-
*/
|
|
64
|
-
export interface ActionControlDescriptor {
|
|
65
|
-
domains: string[];
|
|
66
|
-
/** Adapter policy for a direct Agent's inactivity hold on these domains. */
|
|
67
|
-
agentLeaseMs?: number;
|
|
68
|
-
/** Maximum time a takeover may wait for an already-submitted lower action. */
|
|
69
|
-
handoffTimeoutMs?: number;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ActionResult<T = unknown> {
|
|
73
|
-
scope: ScopeRef;
|
|
74
|
-
actionId: string;
|
|
75
|
-
/** `deferred` is local control scheduling, never a backend rejection. */
|
|
76
|
-
status: 'success' | 'partial' | 'deferred' | 'failure';
|
|
77
|
-
/** Which boundary produced this result; backend payloads remain unwrapped in `error`. */
|
|
78
|
-
source?: 'backend' | 'transport' | 'protocol' | 'local';
|
|
79
|
-
/** Whether the gameplay Action endpoint definitely handled this attempt. */
|
|
80
|
-
actionOutcome?: 'confirmed' | 'not_submitted' | 'unknown';
|
|
81
|
-
value?: T;
|
|
82
|
-
error?: unknown;
|
|
83
|
-
effects?: Array<Record<string, unknown>>;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* A provider-owned asynchronous Action submission.
|
|
88
|
-
*
|
|
89
|
-
* `receipt` transfers ownership to the provider without claiming that the
|
|
90
|
-
* gameplay endpoint has acknowledged the Action. `settled` retains the real
|
|
91
|
-
* HTTP/ACK result inside the provider boundary. The Runtime releases the
|
|
92
|
-
* controller's submission fence at `receipt`; providers that accept ordered
|
|
93
|
-
* automated Decisions must preserve their endpoint-start FIFO internally.
|
|
94
|
-
* Runtime keeps shutdown drain ownership until `settled` completes.
|
|
95
|
-
*/
|
|
96
|
-
export interface ActionDispatch<T = unknown> {
|
|
97
|
-
receipt: ActionResult<T>;
|
|
98
|
-
settled: Promise<ActionResult<T>>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export type ActionServiceResult<T = unknown> = ActionResult<T> | ActionDispatch<T>;
|
|
102
|
-
|
|
103
|
-
export type ActionExecutionRevalidation =
|
|
104
|
-
| { status: 'authorized' }
|
|
105
|
-
| {
|
|
106
|
-
status: 'deferred';
|
|
107
|
-
/** Registry-owned local result; it is never a rewritten backend error. */
|
|
108
|
-
result: ActionResult<never>;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export interface LatestAcceptedRuntimeState {
|
|
112
|
-
readonly epochSeq: number;
|
|
113
|
-
readonly state: Readonly<Record<string, unknown>>;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface ActionExecutionContext {
|
|
117
|
-
/** Aborted when the owning runtime is stopping. */
|
|
118
|
-
signal: AbortSignal;
|
|
119
|
-
/**
|
|
120
|
-
* Recheck the exact admitted worker/controller/scope after asynchronous,
|
|
121
|
-
* reversible preparation and immediately before an irreversible game call.
|
|
122
|
-
*/
|
|
123
|
-
revalidate(): ActionExecutionRevalidation;
|
|
124
|
-
/**
|
|
125
|
-
* Latest raw State accepted for this scope, independent of plugin progress.
|
|
126
|
-
* Adapter Action providers use it only for final local safety admission.
|
|
127
|
-
*/
|
|
128
|
-
latestAcceptedState(): LatestAcceptedRuntimeState | null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** Behavior automation, legacy automation, and direct Agent tools share this boundary. */
|
|
132
|
-
export interface ActionService<A = unknown, R = unknown> {
|
|
133
|
-
describeControl?(
|
|
134
|
-
action: A,
|
|
135
|
-
scope: ScopeRef,
|
|
136
|
-
caller: ActionCaller,
|
|
137
|
-
): ActionControlDescriptor;
|
|
138
|
-
perform(
|
|
139
|
-
action: A,
|
|
140
|
-
scope: ScopeRef,
|
|
141
|
-
caller: ActionCaller,
|
|
142
|
-
context: ActionExecutionContext,
|
|
143
|
-
): ActionServiceResult<R> | Promise<ActionServiceResult<R>>;
|
|
144
|
-
}
|
|
1
|
+
// Compatibility facade; implementation lives in the game-neutral runtime package.
|
|
2
|
+
export * from '@myclaw163/game-agent-runtime/framework/contracts.js';
|