@myclaw163/clawclaw-cli 0.10.11 → 0.10.13
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/bin/clawclaw-cli.mjs +15 -6
- package/bin/startup-trace.d.mts +9 -0
- package/bin/startup-trace.mjs +100 -0
- package/cli-runtime/assets/clawclaw-map.json +1782 -0
- package/cli-runtime/assets/clawclaw-spatial-facts.json +1383 -0
- package/cli-runtime/assets/clawclaw-spatial-model.txt +142 -0
- package/cli-runtime/channel/claude-channel-ipc-server.js +220 -0
- package/cli-runtime/channel/claude-channel-ipc.js +135 -0
- package/cli-runtime/channel/claude-channel-server.js +209 -0
- package/cli-runtime/cli.js +81 -0
- package/cli-runtime/commands/_schema.js +60 -0
- package/cli-runtime/commands/account.js +577 -0
- package/cli-runtime/commands/auth.js +140 -0
- package/cli-runtime/commands/behavior.js +422 -0
- package/cli-runtime/commands/capability.js +327 -0
- package/cli-runtime/commands/communication.js +339 -0
- package/cli-runtime/commands/competition.js +55 -0
- package/cli-runtime/commands/config.js +28 -0
- package/cli-runtime/commands/data.js +78 -0
- package/cli-runtime/commands/events.js +339 -0
- package/cli-runtime/commands/game/index.js +646 -0
- package/cli-runtime/commands/hub.js +152 -0
- package/cli-runtime/commands/load.js +22 -0
- package/cli-runtime/commands/memory.js +30 -0
- package/cli-runtime/commands/module-runtime-control.js +110 -0
- package/cli-runtime/commands/peek.js +38 -0
- package/cli-runtime/commands/perception.js +146 -0
- package/cli-runtime/commands/persona.js +165 -0
- package/cli-runtime/commands/prepare.js +878 -0
- package/cli-runtime/commands/setup/codex.js +244 -0
- package/cli-runtime/commands/setup/hermes.js +55 -0
- package/cli-runtime/commands/setup/index.js +15 -0
- package/cli-runtime/commands/setup/openclaw.js +103 -0
- package/cli-runtime/commands/skill.js +76 -0
- package/cli-runtime/commands/strategy.js +4 -0
- package/cli-runtime/commands/trigger.js +271 -0
- package/cli-runtime/commands/upgrade.js +112 -0
- package/cli-runtime/lib/account-guidance.js +97 -0
- package/cli-runtime/lib/agent-workspace-client.js +66 -0
- package/cli-runtime/lib/agent-workspace-runtime.js +174 -0
- package/cli-runtime/lib/agent-workspace-skills.js +453 -0
- package/cli-runtime/lib/agent-workspace-sync.js +812 -0
- package/cli-runtime/lib/auth.js +210 -0
- package/cli-runtime/lib/capability-cloud-presence.js +134 -0
- package/cli-runtime/lib/capability-cloud-refresh.js +263 -0
- package/cli-runtime/lib/capability-cloud-sync.js +385 -0
- package/cli-runtime/lib/capability-discovery.js +94 -0
- package/cli-runtime/lib/capability-load-diagnostics.js +121 -0
- package/cli-runtime/lib/capability-operation-name.js +24 -0
- package/cli-runtime/lib/capability-operation-rename.js +120 -0
- package/cli-runtime/lib/capability-selection.js +69 -0
- package/cli-runtime/lib/capability-workspace.js +214 -0
- package/cli-runtime/lib/command-error.js +25 -0
- package/cli-runtime/lib/command-meta.js +13 -0
- package/cli-runtime/lib/competition.js +77 -0
- package/cli-runtime/lib/custom-tts.js +363 -0
- package/cli-runtime/lib/desktop-auth.js +44 -0
- package/cli-runtime/lib/desktop-mode.js +12 -0
- package/cli-runtime/lib/diagnostics-config.js +82 -0
- package/cli-runtime/lib/game-client.js +602 -0
- package/cli-runtime/lib/game-context.js +117 -0
- package/cli-runtime/lib/gameplay-config.js +232 -0
- package/cli-runtime/lib/host-config-patcher.js +101 -0
- package/cli-runtime/lib/http-keepalive.js +15 -0
- package/cli-runtime/lib/http-transport.js +163 -0
- package/cli-runtime/lib/hub-client.js +292 -0
- package/cli-runtime/lib/hub-errors.js +51 -0
- package/cli-runtime/lib/hub-reminder.js +65 -0
- package/cli-runtime/lib/hub-unzip.js +52 -0
- package/cli-runtime/lib/init-command.js +160 -0
- package/cli-runtime/lib/load-context.js +97 -0
- package/cli-runtime/lib/load-startup-context.js +59 -0
- package/cli-runtime/lib/load-startup.js +23 -0
- package/cli-runtime/lib/lobby-host-context.js +70 -0
- package/cli-runtime/lib/match-state.js +61 -0
- package/cli-runtime/lib/normalize.js +28 -0
- package/cli-runtime/lib/package-skills.js +15 -0
- package/cli-runtime/lib/participation-leave.js +54 -0
- package/cli-runtime/lib/participation-status.js +73 -0
- package/cli-runtime/lib/perception-config.js +85 -0
- package/cli-runtime/lib/persona.js +157 -0
- package/cli-runtime/lib/room.js +108 -0
- package/cli-runtime/lib/runtime-cadence-config.js +18 -0
- package/cli-runtime/lib/server-registry.js +155 -0
- package/cli-runtime/lib/server-status.js +44 -0
- package/cli-runtime/lib/service-status.js +88 -0
- package/cli-runtime/lib/skill-host.js +246 -0
- package/cli-runtime/lib/skill-name-conflicts.js +89 -0
- package/cli-runtime/lib/skill-version.js +20 -0
- package/cli-runtime/lib/training-role.js +23 -0
- package/cli-runtime/lib/trigger-config.js +138 -0
- package/cli-runtime/lib/user-data.js +336 -0
- package/cli-runtime/lib/workspace-argv.js +35 -0
- package/cli-runtime/lib/workspace-runtime-lock.js +6 -0
- package/cli-runtime/lib/zip-store.js +78 -0
- package/cli-runtime/pipeline/canonical-event-presentation.js +32 -0
- package/cli-runtime/pipeline/event-format.js +921 -0
- package/cli-runtime/pipeline/event-hints.js +235 -0
- package/cli-runtime/pipeline/game-sync-event-normalization.js +228 -0
- package/cli-runtime/pipeline/player-projection.js +272 -0
- package/cli-runtime/pipeline/role-display.js +22 -0
- package/cli-runtime/runtime/auto-upgrade.js +30 -0
- package/cli-runtime/runtime/canonical-event-emitter.js +58 -0
- package/cli-runtime/runtime/canonical-monitor.js +332 -0
- package/cli-runtime/runtime/clawclaw/agent-ability-state.js +41 -0
- package/cli-runtime/runtime/clawclaw/agent-event-policy.js +58 -0
- package/cli-runtime/runtime/clawclaw/behavior-decision.js +84 -0
- package/cli-runtime/runtime/clawclaw/behavior-input-fields.js +212 -0
- package/cli-runtime/runtime/clawclaw/behavior-input.js +54 -0
- package/cli-runtime/runtime/clawclaw/behavior-observation-memory.js +106 -0
- package/cli-runtime/runtime/clawclaw/behavior-read-api.js +110 -0
- package/cli-runtime/runtime/clawclaw/behavior-reflex-control.js +97 -0
- package/cli-runtime/runtime/clawclaw/behavior-start-control.js +159 -0
- package/cli-runtime/runtime/clawclaw/index.js +3 -0
- package/cli-runtime/runtime/clawclaw/navigation/astar-path.js +244 -0
- package/cli-runtime/runtime/clawclaw/navigation/clawclaw-walkable.bin +0 -0
- package/cli-runtime/runtime/clawclaw/navigation/distance-field.js +136 -0
- package/cli-runtime/runtime/clawclaw/navigation/escape-planner.js +273 -0
- package/cli-runtime/runtime/clawclaw/navigation/hide-spots.js +31 -0
- package/cli-runtime/runtime/clawclaw/navigation/off-route-points.js +64 -0
- package/cli-runtime/runtime/clawclaw/navigation/walkable-grid.js +85 -0
- package/cli-runtime/runtime/clawclaw/notification-policy.js +59 -0
- package/cli-runtime/runtime/clawclaw/notification-turn.js +28 -0
- package/cli-runtime/runtime/clawclaw/notifications.js +65 -0
- package/cli-runtime/runtime/clawclaw/observation-frame-projector.js +94 -0
- package/cli-runtime/runtime/clawclaw/owner-lock-error.js +17 -0
- package/cli-runtime/runtime/clawclaw/owner-lock.js +219 -0
- package/cli-runtime/runtime/clawclaw/owner.js +1257 -0
- package/cli-runtime/runtime/clawclaw/perception-module-manifest.js +67 -0
- package/cli-runtime/runtime/clawclaw/perception-strategy-names.js +12 -0
- package/cli-runtime/runtime/clawclaw/persistence-compatibility.js +38 -0
- package/cli-runtime/runtime/clawclaw/plugins/action/action-plugin.js +604 -0
- package/cli-runtime/runtime/clawclaw/plugins/action/automated-action-normalization.js +67 -0
- package/cli-runtime/runtime/clawclaw/plugins/action/index.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/assembly.js +134 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/activation-manager.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-action.js +26 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.js +21 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.ts +25 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-catalog.js +90 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-decision-history.js +60 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-instance-snapshot.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-manifest.js +136 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-module-loader.js +230 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-normalization.js +92 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-plugin.js +162 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-runner.js +20 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-source.js +493 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/behavior-worker-bridge.js +28 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/control-driver.js +5 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/index.js +11 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior/thread-behavior-executor.js +18 -0
- package/cli-runtime/runtime/clawclaw/plugins/behavior-input-source.js +233 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/derived-event-plugin.js +25 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/derived-event-rules.js +289 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/index.js +2 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/player-change-tracker.js +162 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/reminder-plugin.js +182 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/reminder-rules.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/reminder-runner.js +83 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/reminder-worker.js +35 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/reminder-worker.ts +33 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/state-change-rules.js +111 -0
- package/cli-runtime/runtime/clawclaw/plugins/derived-event/task-change-tracker.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/game-query/context-capabilities.js +10 -0
- package/cli-runtime/runtime/clawclaw/plugins/game-query/game-query-plugin.js +196 -0
- package/cli-runtime/runtime/clawclaw/plugins/game-query/index.js +2 -0
- package/cli-runtime/runtime/clawclaw/plugins/index.js +9 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.js +24 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-socket.js +21 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/adapters/game-sync-perception-report-adapter.js +84 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/adapters/game-sync-runtime-report-adapter.js +54 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/agent-mailbox-coordinator.js +61 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/consumer-ids.js +10 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/desktop-event-socket.js +45 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/index.js +11 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/mailbox-event-batch-delivery.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/mailbox-plugin.js +13 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/mailbox-presentation.js +99 -0
- package/cli-runtime/runtime/clawclaw/plugins/mailbox/mailbox-service.js +84 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/contracts.js +14 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/index.js +11 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/map-concurrent.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/module-input-boundary.js +64 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/module-runner.js +182 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/notification-content.js +47 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/official-module-ids.js +13 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-analysis-thread-pool.js +684 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-analysis-thread-worker.js +145 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-analysis-thread-worker.ts +252 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-loader.js +78 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-output.js +15 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-plugin.js +144 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-runner.js +22 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-worker.js +18 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-module-worker.ts +19 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-plugin.js +1343 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-reducer-thread-pool.js +522 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-reducer-thread-worker.js +161 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-reducer-thread-worker.ts +262 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-source.js +489 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/perception-test-fixtures.js +31 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/replay.js +56 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/report-content.js +39 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/shared/math.js +1 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/spatial-facts.js +103 -0
- package/cli-runtime/runtime/clawclaw/plugins/perception/task-baseline.js +29 -0
- package/cli-runtime/runtime/clawclaw/plugins/plugin-api-version.js +89 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/game-transport.js +204 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/index.js +5 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/room-transport.js +399 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/source-plugin.js +2003 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/source-transports.js +26 -0
- package/cli-runtime/runtime/clawclaw/plugins/source/types.js +0 -0
- package/cli-runtime/runtime/clawclaw/plugins/system-perception/rule-runner.js +90 -0
- package/cli-runtime/runtime/clawclaw/plugins/system-perception/sabotage-availability-rule.js +59 -0
- package/cli-runtime/runtime/clawclaw/plugins/system-perception/system-perceptions.js +241 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/contracts.js +12 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/index.js +4 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-module-loader.js +105 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-plugin.js +741 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-source.js +372 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-thread-pool.js +378 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-thread-worker.js +118 -0
- package/cli-runtime/runtime/clawclaw/plugins/trigger/trigger-thread-worker.ts +168 -0
- package/cli-runtime/runtime/clawclaw/reaction-behavior-resolution.js +1 -0
- package/cli-runtime/runtime/clawclaw/reaction-manifest.js +62 -0
- package/cli-runtime/runtime/clawclaw/reminder-manifest.js +39 -0
- package/cli-runtime/runtime/clawclaw/runtime-cadence.js +28 -0
- package/cli-runtime/runtime/clawclaw/runtime-data-export.js +321 -0
- package/cli-runtime/runtime/clawclaw/runtime-state.js +51 -0
- package/cli-runtime/runtime/clawclaw/runtime.js +132 -0
- package/cli-runtime/runtime/clawclaw/spatial-api.js +48 -0
- package/cli-runtime/runtime/clawclaw/starting-owner-control.js +24 -0
- package/cli-runtime/runtime/clawclaw/strategy-memory-rpc.js +1 -0
- package/cli-runtime/runtime/clawclaw/strategy-memory.js +6 -0
- package/cli-runtime/runtime/clawclaw/task-choice-projection.js +72 -0
- package/cli-runtime/runtime/clawclaw-event-catalog.js +284 -0
- package/cli-runtime/runtime/clawclaw-position.js +0 -0
- package/cli-runtime/runtime/clawclaw-room-state.js +38 -0
- package/cli-runtime/runtime/framework/action-diagnostics.js +69 -0
- package/cli-runtime/runtime/framework/capability-registry.js +1 -0
- package/cli-runtime/runtime/framework/contracts.js +1 -0
- package/cli-runtime/runtime/framework/control/control-scheduler.js +1 -0
- package/cli-runtime/runtime/framework/control/domain-set.js +1 -0
- package/cli-runtime/runtime/framework/control/index.js +1 -0
- package/cli-runtime/runtime/framework/control/types.js +1 -0
- package/cli-runtime/runtime/framework/control-coordinator.js +1 -0
- package/cli-runtime/runtime/framework/events/event-catalog.js +1 -0
- package/cli-runtime/runtime/framework/events/event-delivery-service.js +1 -0
- package/cli-runtime/runtime/framework/events/event-ingress.js +1 -0
- package/cli-runtime/runtime/framework/events/event-repository.js +1 -0
- package/cli-runtime/runtime/framework/events/index.js +5 -0
- package/cli-runtime/runtime/framework/events/memory-event-repository.js +1 -0
- package/cli-runtime/runtime/framework/events/runtime-resume.js +1 -0
- package/cli-runtime/runtime/framework/events/sqlite-event-repository.js +6 -0
- package/cli-runtime/runtime/framework/events/test-helpers.js +56 -0
- package/cli-runtime/runtime/framework/events/types.js +1 -0
- package/cli-runtime/runtime/framework/index.js +7 -0
- package/cli-runtime/runtime/framework/load-node-sqlite.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/coalescer.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/host-notification-sink.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/identity.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/index.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/mailbox-dispatcher.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/mailbox-repository.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/notification-projector.js +1 -0
- package/cli-runtime/runtime/framework/mailbox/types.js +1 -0
- package/cli-runtime/runtime/framework/modules/runtime-module-loader-hooks.mjs +2 -0
- package/cli-runtime/runtime/framework/modules/runtime-module-loader.js +31 -0
- package/cli-runtime/runtime/framework/modules/runtime-module-output.js +1 -0
- package/cli-runtime/runtime/framework/modules/runtime-module-worker-bootstrap.mjs +3 -0
- package/cli-runtime/runtime/framework/participation-manager.js +1 -0
- package/cli-runtime/runtime/framework/persistence/async-sqlite-persistence-worker.js +1 -0
- package/cli-runtime/runtime/framework/persistence/async-sqlite-persistence-worker.ts +2 -0
- package/cli-runtime/runtime/framework/persistence/memory-first-persistence.js +9 -0
- package/cli-runtime/runtime/framework/plugins/contracts.js +1 -0
- package/cli-runtime/runtime/framework/plugins/index.js +1 -0
- package/cli-runtime/runtime/framework/plugins/runtime-event-identity.js +1 -0
- package/cli-runtime/runtime/framework/plugins/runtime-input-journal.js +1 -0
- package/cli-runtime/runtime/framework/plugins/runtime-plugin-scheduler.js +1 -0
- package/cli-runtime/runtime/framework/runtime.js +12 -0
- package/cli-runtime/runtime/framework/serial-task-queue.js +1 -0
- package/cli-runtime/runtime/framework/state/contracts.js +1 -0
- package/cli-runtime/runtime/framework/state/current-state-store.js +1 -0
- package/cli-runtime/runtime/framework/state/durable-agent-state-snapshot.js +1 -0
- package/cli-runtime/runtime/framework/state/freshness.js +1 -0
- package/cli-runtime/runtime/framework/state/history/contracts.js +1 -0
- package/cli-runtime/runtime/framework/state/history/history-writer.js +1 -0
- package/cli-runtime/runtime/framework/state/history/memory-state-history-repository.js +1 -0
- package/cli-runtime/runtime/framework/state/history/sqlite-state-history-repository.js +1 -0
- package/cli-runtime/runtime/framework/state/history/trajectory-projector.js +1 -0
- package/cli-runtime/runtime/framework/state/index.js +1 -0
- package/cli-runtime/runtime/framework/state/state-ingress.js +1 -0
- package/cli-runtime/runtime/framework/state/state-provider.js +1 -0
- package/cli-runtime/runtime/framework/state/types.js +1 -0
- package/cli-runtime/runtime/game-sync-ingress-protocol.js +0 -0
- package/cli-runtime/runtime/game-sync-ingress-worker.js +310 -0
- package/cli-runtime/runtime/game-sync-ingress-worker.ts +274 -0
- package/cli-runtime/runtime/game-sync-protocol.js +278 -0
- package/cli-runtime/runtime/host-monitor-rate-gate.js +1 -0
- package/cli-runtime/runtime/mailbox-host-relay.js +1 -0
- package/cli-runtime/runtime/observability/detail-capture.js +35 -0
- package/cli-runtime/runtime/observability/factory.js +137 -0
- package/cli-runtime/runtime/observability/index.js +6 -0
- package/cli-runtime/runtime/observability/process-timing.js +1 -0
- package/cli-runtime/runtime/observability/recorder.js +1 -0
- package/cli-runtime/runtime/observability/redaction.js +1 -0
- package/cli-runtime/runtime/observability/reporter.js +1 -0
- package/cli-runtime/runtime/observability/sinks.js +1 -0
- package/cli-runtime/runtime/observability/types.js +1 -0
- package/cli-runtime/runtime/owner-control.js +59 -0
- package/cli-runtime/runtime/parent-process-watch.js +1 -0
- package/cli-runtime/runtime/pending-event-handoff.js +48 -0
- package/cli-runtime/runtime/process-identity.js +45 -0
- package/cli-runtime/runtime/raw-ws-log.js +181 -0
- package/cli-runtime/runtime/runtime-logger.js +79 -0
- package/cli-runtime/runtime/threaded-ws-client.js +263 -0
- package/cli-runtime/runtime/ws-client.js +563 -0
- package/cli-runtime/sdk/action.js +133 -0
- package/cli-runtime/sdk/action.ts +160 -0
- package/cli-runtime/sdk/behavior-plugin/index.js +23 -0
- package/cli-runtime/sdk/behavior-plugin/index.ts +341 -0
- package/cli-runtime/sdk/behavior-toolkit/corpse-search.js +56 -0
- package/cli-runtime/sdk/behavior-toolkit/corpse-search.ts +87 -0
- package/cli-runtime/sdk/behavior-toolkit/escape.js +25 -0
- package/cli-runtime/sdk/behavior-toolkit/escape.ts +40 -0
- package/cli-runtime/sdk/behavior-toolkit/index.js +7 -0
- package/cli-runtime/sdk/behavior-toolkit/index.ts +7 -0
- package/cli-runtime/sdk/behavior-toolkit/kill-flow.js +239 -0
- package/cli-runtime/sdk/behavior-toolkit/kill-flow.ts +299 -0
- package/cli-runtime/sdk/behavior-toolkit/model.js +183 -0
- package/cli-runtime/sdk/behavior-toolkit/model.ts +265 -0
- package/cli-runtime/sdk/behavior-toolkit/move-gate.js +30 -0
- package/cli-runtime/sdk/behavior-toolkit/move-gate.ts +52 -0
- package/cli-runtime/sdk/behavior-toolkit/patrol.js +39 -0
- package/cli-runtime/sdk/behavior-toolkit/patrol.ts +53 -0
- package/cli-runtime/sdk/behavior-toolkit/search.js +81 -0
- package/cli-runtime/sdk/behavior-toolkit/search.ts +102 -0
- package/cli-runtime/sdk/index.js +78 -0
- package/cli-runtime/sdk/index.ts +136 -0
- package/cli-runtime/sdk/module-input/index.js +0 -0
- package/cli-runtime/sdk/module-input/index.ts +310 -0
- package/cli-runtime/sdk/perception-plugin/index.js +79 -0
- package/cli-runtime/sdk/perception-plugin/index.ts +251 -0
- package/cli-runtime/sdk/perception-plugin/lifecycle.js +18 -0
- package/cli-runtime/sdk/perception-plugin/lifecycle.ts +15 -0
- package/cli-runtime/sdk/perception-plugin/math.js +99 -0
- package/cli-runtime/sdk/perception-plugin/math.ts +107 -0
- package/cli-runtime/sdk/perception-plugin/module.js +4 -0
- package/cli-runtime/sdk/perception-plugin/module.ts +80 -0
- package/cli-runtime/sdk/perception-plugin/reaction.js +6 -0
- package/cli-runtime/sdk/perception-plugin/reaction.ts +79 -0
- package/cli-runtime/sdk/perception-plugin/reminder-rules.js +131 -0
- package/cli-runtime/sdk/perception-plugin/reminder-rules.ts +89 -0
- package/cli-runtime/sdk/perception-plugin/reminder.js +8 -0
- package/cli-runtime/sdk/perception-plugin/reminder.ts +68 -0
- package/cli-runtime/sdk/perception-plugin/task-change-tracker.js +150 -0
- package/cli-runtime/sdk/perception-plugin/task-change-tracker.ts +258 -0
- package/cli-runtime/sdk/resource-metadata.js +27 -0
- package/cli-runtime/sdk/resource-metadata.ts +66 -0
- package/cli-runtime/sdk/strategy-memory.js +1 -0
- package/cli-runtime/sdk/strategy-memory.ts +1 -0
- package/cli-runtime/sdk/strategy-plugin/index.js +6 -0
- package/cli-runtime/sdk/strategy-plugin/index.ts +36 -0
- package/cli-runtime/sdk/task-availability.js +56 -0
- package/cli-runtime/sdk/task-availability.ts +70 -0
- package/cli-runtime/sdk/trigger-plugin/index.js +16 -0
- package/cli-runtime/sdk/trigger-plugin/index.ts +130 -0
- package/cli-runtime/sdk/types.js +25 -0
- package/cli-runtime/sdk/types.ts +165 -0
- package/cli-runtime/short-command/classifier.js +129 -0
- package/cli-runtime/short-command/index.js +7 -0
- package/cli-runtime/short-command/presenter.js +225 -0
- package/cli-runtime/short-command/process-io.js +13 -0
- package/cli-runtime/short-command/response-contract.js +24 -0
- package/cli-runtime/short-command/runner.js +94 -0
- package/cli-runtime/short-command/sensitive-data-filter.js +92 -0
- package/cli-runtime/short-command/transport-response.js +57 -0
- package/cli-runtime/short-command/types.js +0 -0
- package/dist/strategy-worker/runtime/clawclaw/plugins/behavior/host.js +21 -29
- package/dist/strategy-worker/runtime/clawclaw/plugins/behavior/sdk-sdk.js +76 -6
- package/docs/configuration.md +13 -0
- package/package.json +7 -4
- package/scripts/build-cli.mjs +34 -0
- package/skills/clawclaw/SKILL.md +1 -1
- package/skills/clawclaw/references/STREAM.md +1 -0
- package/skills/clawclaw-start/SKILL.md +1 -0
- package/skills/clawclaw-start/references/STARTUP.md +1 -0
- package/src/cli.ts +75 -77
- package/src/commands/auth.ts +3 -2
- package/src/commands/game/index.ts +33 -9
- package/src/commands/prepare.ts +34 -18
- package/src/lib/agent-workspace-client.ts +12 -9
- package/src/lib/game-client.ts +1 -1
- package/src/lib/http-transport.ts +17 -2
- package/src/lib/hub-client.ts +10 -7
- package/src/pipeline/event-format.ts +2 -0
- package/src/pipeline/event-hints.ts +6 -0
- package/src/runtime/clawclaw/notification-policy.ts +1 -1
- package/src/runtime/clawclaw/owner-lock.ts +3 -2
- package/src/runtime/clawclaw/owner.ts +36 -10
- package/src/runtime/clawclaw/plugins/behavior/behavior-worker-bridge.ts +1 -1
- package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.ts +19 -0
- package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.ts +1 -0
- package/src/runtime/clawclaw/plugins/source/source-plugin.ts +33 -9
- package/src/runtime/clawclaw-event-catalog.ts +1 -0
- package/src/runtime/framework/modules/runtime-module-loader.ts +24 -29
- package/src/runtime/process-identity.ts +44 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const TICK_MS = 100;
|
|
2
|
+
const MOVE_MIN_PX = 18;
|
|
3
|
+
const STEP_MOVE_MIN_PX = 4;
|
|
4
|
+
const STILL_STEP_MAX_PX = 3;
|
|
5
|
+
function vector(from, to) {
|
|
6
|
+
return { x: to.x - from.x, y: to.y - from.y };
|
|
7
|
+
}
|
|
8
|
+
function length(value) {
|
|
9
|
+
return Math.hypot(value.x, value.y);
|
|
10
|
+
}
|
|
11
|
+
function distance(a, b) {
|
|
12
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
13
|
+
}
|
|
14
|
+
function dot(a, b) {
|
|
15
|
+
return a.x * b.x + a.y * b.y;
|
|
16
|
+
}
|
|
17
|
+
function cross(a, b) {
|
|
18
|
+
return a.x * b.y - a.y * b.x;
|
|
19
|
+
}
|
|
20
|
+
function unit(value) {
|
|
21
|
+
const magnitude = length(value);
|
|
22
|
+
return magnitude <= 0 ? { x: 0, y: 0 } : { x: value.x / magnitude, y: value.y / magnitude };
|
|
23
|
+
}
|
|
24
|
+
function cosine(a, b) {
|
|
25
|
+
const denominator = length(a) * length(b);
|
|
26
|
+
return denominator <= 0 ? 0 : dot(a, b) / denominator;
|
|
27
|
+
}
|
|
28
|
+
function angleDegrees(a, b) {
|
|
29
|
+
return Math.acos(Math.max(-1, Math.min(1, cosine(a, b)))) * (180 / Math.PI);
|
|
30
|
+
}
|
|
31
|
+
function direction(from, to, minimum = MOVE_MIN_PX) {
|
|
32
|
+
const dx = to.x - from.x;
|
|
33
|
+
const dy = to.y - from.y;
|
|
34
|
+
if (Math.hypot(dx, dy) < minimum) return "\u539F\u5730";
|
|
35
|
+
const horizontal = Math.abs(dx) >= minimum / 2 ? dx > 0 ? "\u53F3" : "\u5DE6" : "";
|
|
36
|
+
const vertical = Math.abs(dy) >= minimum / 2 ? dy > 0 ? "\u4E0B" : "\u4E0A" : "";
|
|
37
|
+
return `${horizontal}${vertical}` || "\u539F\u5730";
|
|
38
|
+
}
|
|
39
|
+
function headingDirection(from, to, minimum = MOVE_MIN_PX) {
|
|
40
|
+
const dx = to.x - from.x;
|
|
41
|
+
const dy = to.y - from.y;
|
|
42
|
+
if (Math.hypot(dx, dy) < minimum) return "\u539F\u5730";
|
|
43
|
+
const octant = Math.round(Math.atan2(dy, dx) / (Math.PI / 4));
|
|
44
|
+
const directions = [
|
|
45
|
+
"\u53F3",
|
|
46
|
+
"\u53F3\u4E0B",
|
|
47
|
+
"\u4E0B",
|
|
48
|
+
"\u5DE6\u4E0B",
|
|
49
|
+
"\u5DE6",
|
|
50
|
+
"\u5DE6\u4E0A",
|
|
51
|
+
"\u4E0A",
|
|
52
|
+
"\u53F3\u4E0A"
|
|
53
|
+
];
|
|
54
|
+
return directions[(octant + directions.length) % directions.length];
|
|
55
|
+
}
|
|
56
|
+
function actorLabel(actor) {
|
|
57
|
+
if (actor.observer) return "\u4F60";
|
|
58
|
+
if (actor.seat !== void 0) return `${actor.seat}\u53F7`;
|
|
59
|
+
return actor.name ?? actor.id;
|
|
60
|
+
}
|
|
61
|
+
function actorValue(actor) {
|
|
62
|
+
return actor.seat ?? actor.id;
|
|
63
|
+
}
|
|
64
|
+
function timeRange(fromTick, toTick) {
|
|
65
|
+
const format = (tick) => {
|
|
66
|
+
const total = Math.max(0, Math.floor(tick * TICK_MS / 1e3));
|
|
67
|
+
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
68
|
+
};
|
|
69
|
+
const from = format(fromTick);
|
|
70
|
+
const to = format(toTick);
|
|
71
|
+
return from === to ? from : `${from}-${to}`;
|
|
72
|
+
}
|
|
73
|
+
function round1(value) {
|
|
74
|
+
return Math.round(value * 10) / 10;
|
|
75
|
+
}
|
|
76
|
+
function positionCopy(position) {
|
|
77
|
+
return { x: position.x, y: position.y, room: position.room };
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
MOVE_MIN_PX,
|
|
81
|
+
STEP_MOVE_MIN_PX,
|
|
82
|
+
STILL_STEP_MAX_PX,
|
|
83
|
+
TICK_MS,
|
|
84
|
+
actorLabel,
|
|
85
|
+
actorValue,
|
|
86
|
+
angleDegrees,
|
|
87
|
+
cosine,
|
|
88
|
+
cross,
|
|
89
|
+
direction,
|
|
90
|
+
distance,
|
|
91
|
+
dot,
|
|
92
|
+
headingDirection,
|
|
93
|
+
length,
|
|
94
|
+
positionCopy,
|
|
95
|
+
round1,
|
|
96
|
+
timeRange,
|
|
97
|
+
unit,
|
|
98
|
+
vector
|
|
99
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { VisualPosition } from './index.js';
|
|
2
|
+
|
|
3
|
+
export const TICK_MS = 100;
|
|
4
|
+
export const MOVE_MIN_PX = 18;
|
|
5
|
+
export const STEP_MOVE_MIN_PX = 4;
|
|
6
|
+
export const STILL_STEP_MAX_PX = 3;
|
|
7
|
+
|
|
8
|
+
export interface Vec {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function vector(from: Vec, to: Vec): Vec {
|
|
14
|
+
return { x: to.x - from.x, y: to.y - from.y };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function length(value: Vec): number {
|
|
18
|
+
return Math.hypot(value.x, value.y);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function distance(a: Vec, b: Vec): number {
|
|
22
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function dot(a: Vec, b: Vec): number {
|
|
26
|
+
return a.x * b.x + a.y * b.y;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function cross(a: Vec, b: Vec): number {
|
|
30
|
+
return a.x * b.y - a.y * b.x;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function unit(value: Vec): Vec {
|
|
34
|
+
const magnitude = length(value);
|
|
35
|
+
return magnitude <= 0 ? { x: 0, y: 0 } : { x: value.x / magnitude, y: value.y / magnitude };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function cosine(a: Vec, b: Vec): number {
|
|
39
|
+
const denominator = length(a) * length(b);
|
|
40
|
+
return denominator <= 0 ? 0 : dot(a, b) / denominator;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function angleDegrees(a: Vec, b: Vec): number {
|
|
44
|
+
return Math.acos(Math.max(-1, Math.min(1, cosine(a, b)))) * (180 / Math.PI);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type Direction = '左' | '右' | '上' | '下' | '左上' | '左下' | '右上' | '右下' | '原地';
|
|
48
|
+
|
|
49
|
+
export function direction(from: Vec, to: Vec, minimum = MOVE_MIN_PX): Direction {
|
|
50
|
+
const dx = to.x - from.x;
|
|
51
|
+
const dy = to.y - from.y;
|
|
52
|
+
if (Math.hypot(dx, dy) < minimum) return '原地';
|
|
53
|
+
const horizontal = Math.abs(dx) >= minimum / 2 ? (dx > 0 ? '右' : '左') : '';
|
|
54
|
+
const vertical = Math.abs(dy) >= minimum / 2 ? (dy > 0 ? '下' : '上') : '';
|
|
55
|
+
return `${horizontal}${vertical}` as Direction || '原地';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Quantizes a displacement by its heading rather than by absolute component
|
|
60
|
+
* sizes. Unlike direction(), this label does not change merely because the
|
|
61
|
+
* same straight trajectory is measured over a shorter or longer window.
|
|
62
|
+
*/
|
|
63
|
+
export function headingDirection(from: Vec, to: Vec, minimum = MOVE_MIN_PX): Direction {
|
|
64
|
+
const dx = to.x - from.x;
|
|
65
|
+
const dy = to.y - from.y;
|
|
66
|
+
if (Math.hypot(dx, dy) < minimum) return '原地';
|
|
67
|
+
const octant = Math.round(Math.atan2(dy, dx) / (Math.PI / 4));
|
|
68
|
+
const directions: readonly Direction[] = [
|
|
69
|
+
'右',
|
|
70
|
+
'右下',
|
|
71
|
+
'下',
|
|
72
|
+
'左下',
|
|
73
|
+
'左',
|
|
74
|
+
'左上',
|
|
75
|
+
'上',
|
|
76
|
+
'右上',
|
|
77
|
+
];
|
|
78
|
+
return directions[(octant + directions.length) % directions.length];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function actorLabel(actor: { observer: boolean; seat?: number; name?: string; id: string }): string {
|
|
82
|
+
if (actor.observer) return '你';
|
|
83
|
+
if (actor.seat !== undefined) return `${actor.seat}号`;
|
|
84
|
+
return actor.name ?? actor.id;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function actorValue(actor: { observer: boolean; seat?: number; id: string }): number | string {
|
|
88
|
+
return actor.seat ?? actor.id;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function timeRange(fromTick: number, toTick: number): string {
|
|
92
|
+
const format = (tick: number): string => {
|
|
93
|
+
const total = Math.max(0, Math.floor((tick * TICK_MS) / 1000));
|
|
94
|
+
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, '0')}`;
|
|
95
|
+
};
|
|
96
|
+
const from = format(fromTick);
|
|
97
|
+
const to = format(toTick);
|
|
98
|
+
return from === to ? from : `${from}-${to}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function round1(value: number): number {
|
|
102
|
+
return Math.round(value * 10) / 10;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function positionCopy(position: VisualPosition): VisualPosition {
|
|
106
|
+
return { x: position.x, y: position.y, room: position.room };
|
|
107
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { ReminderFact, ReminderTaskChange } from './reminder.js';
|
|
5
|
+
import type { ReactionActivation, ReactionBehaviorBinding } from './reaction.js';
|
|
6
|
+
import type { StrategyMemory } from '../strategy-memory.js';
|
|
7
|
+
|
|
8
|
+
/** Unified perception contract with optional fixed Reflex bindings. */
|
|
9
|
+
export const PERCEPTION_MODULE_API_VERSION = 3 as const;
|
|
10
|
+
export type PerceptionStrategyBinding = ReactionBehaviorBinding;
|
|
11
|
+
export interface PerceptionStrategyActivation {
|
|
12
|
+
readonly strategy: string;
|
|
13
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
14
|
+
readonly reason?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PerceptionModuleManifest {
|
|
17
|
+
readonly apiVersion: typeof PERCEPTION_MODULE_API_VERSION;
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly name?: string;
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly localizations?: ClawclawResourceLocalizations;
|
|
22
|
+
readonly consumes?: readonly string[];
|
|
23
|
+
readonly produces?: readonly string[];
|
|
24
|
+
readonly inputs?: readonly BehaviorInputFieldSpec[];
|
|
25
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
26
|
+
readonly strategies?: Readonly<Record<string, PerceptionStrategyBinding>>;
|
|
27
|
+
readonly behaviors?: Readonly<Record<string, ReactionBehaviorBinding>>;
|
|
28
|
+
}
|
|
29
|
+
export interface PerceptionModuleInput {
|
|
30
|
+
readonly source?: Readonly<{ epochId: number; frameSeq: number; connectionId: string; backendTick?: number; receivedAtMs: number; observedAtMs?: number }>;
|
|
31
|
+
/** Explicit boundaries; the host does not erase module state on a phase change. */
|
|
32
|
+
readonly lifecycle?: readonly PerceptionLifecycleChange[];
|
|
33
|
+
readonly roomState?: Readonly<Record<string, unknown>> | null;
|
|
34
|
+
readonly queueState?: Readonly<Record<string, unknown>> | null;
|
|
35
|
+
/** Source facts keep their own accepted State boundary, distinct from gameState. */
|
|
36
|
+
readonly eventStates?: Readonly<Record<string, Readonly<Record<string, unknown>> | null>>;
|
|
37
|
+
readonly cycle?: import('../module-input/index.js').ProcessingCycleInfo;
|
|
38
|
+
readonly moduleId: string;
|
|
39
|
+
readonly scope: Readonly<{ sessionId: string; segmentId: string }>;
|
|
40
|
+
readonly gameState: Readonly<GameState> | null;
|
|
41
|
+
readonly frame: Readonly<ObservationFrame> | null;
|
|
42
|
+
/** Original Source/backend facts only; never another perception's output or a forwarded copy. */
|
|
43
|
+
readonly events: readonly Readonly<ReminderFact>[];
|
|
44
|
+
/** Compared independently against this module's own durable task baseline. */
|
|
45
|
+
readonly taskChanges: readonly ReminderTaskChange[];
|
|
46
|
+
readonly boundary: 'initial' | 'recovery' | null;
|
|
47
|
+
readonly nowMs: number;
|
|
48
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
49
|
+
readonly state: unknown;
|
|
50
|
+
/** Equipped, loadable dependencies; independent of the automatic-activation switch. */
|
|
51
|
+
readonly availableBindings?: readonly string[];
|
|
52
|
+
readonly availableBehaviors?: readonly string[];
|
|
53
|
+
readonly availableStrategies?: readonly string[];
|
|
54
|
+
readonly enabledBindings?: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
export interface PerceptionModuleApi {
|
|
57
|
+
readonly spatial?: import('../behavior-plugin/index.js').SpatialApi;
|
|
58
|
+
/** Shared with a unique explicitly bound strategy; otherwise module-private. */
|
|
59
|
+
readonly memory: StrategyMemory;
|
|
60
|
+
}
|
|
61
|
+
export interface PerceptionModuleEvent {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
readonly key: string;
|
|
64
|
+
/** false retains the event for a later wake; omit the event to produce no notification. */
|
|
65
|
+
readonly wakeAgent?: boolean;
|
|
66
|
+
readonly payload: Readonly<Record<string, unknown>>;
|
|
67
|
+
readonly occurredAt?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface PerceptionModuleResult {
|
|
70
|
+
readonly state?: unknown;
|
|
71
|
+
readonly events?: readonly PerceptionModuleEvent[];
|
|
72
|
+
/** Requires host registration authority; user manifests cannot grant it. */
|
|
73
|
+
readonly forwards?: readonly { readonly eventId: string }[];
|
|
74
|
+
/** Keys in manifest.behaviors; never arbitrary strategy names or executable Actions. */
|
|
75
|
+
readonly activations?: readonly (PerceptionStrategyActivation | ReactionActivation)[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type PerceptionLifecycleChange =
|
|
79
|
+
| Readonly<{ kind: 'initial' | 'recovery' | 'observation_gap' | 'observer_died' | 'segment_ending' | 'snapshot_requested' }>
|
|
80
|
+
| Readonly<{ kind: 'phase_changed'; from: string; to: string }>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { GameEvent, 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
|
+
|
|
5
|
+
/** A fixed dependency, resolved against this account's equipped, loadable Behaviors. */
|
|
6
|
+
export interface ReactionBehaviorBinding {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
/** Preferred Hub identity. A missing match falls back to name and its duplicate aliases. */
|
|
9
|
+
readonly resourceId?: string;
|
|
10
|
+
readonly layer?: 'reflex';
|
|
11
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly reflexPriority?: number;
|
|
13
|
+
readonly cooldownMs?: number;
|
|
14
|
+
readonly rearm?: 'after_clear' | 'after_cooldown';
|
|
15
|
+
readonly maxRuntimeMs?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ClawclawReactionManifest {
|
|
19
|
+
readonly apiVersion: 2;
|
|
20
|
+
readonly kind: 'reaction';
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name?: string;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly localizations?: ClawclawResourceLocalizations;
|
|
25
|
+
/** Backend, derived and visual Events. Reaction outputs cannot feed reactions. */
|
|
26
|
+
readonly consumes: readonly string[];
|
|
27
|
+
/** Own Agent-visible notices, named reaction.<name>. */
|
|
28
|
+
readonly produces: readonly string[];
|
|
29
|
+
readonly behaviors?: Readonly<Record<string, ReactionBehaviorBinding>>;
|
|
30
|
+
readonly inputs?: readonly BehaviorInputFieldSpec[];
|
|
31
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ReactionFact extends GameEvent {
|
|
35
|
+
readonly wakeAgent?: boolean;
|
|
36
|
+
readonly replayed: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ReactionInput {
|
|
40
|
+
readonly moduleId: string;
|
|
41
|
+
readonly scope: Readonly<{ sessionId: string; segmentId: string }>;
|
|
42
|
+
readonly gameState: Readonly<GameState> | null;
|
|
43
|
+
readonly frame: Readonly<ObservationFrame> | null;
|
|
44
|
+
readonly events: readonly ReactionFact[];
|
|
45
|
+
readonly nowMs: number;
|
|
46
|
+
/** JSON data returned by the previous evaluate; do not keep state in class fields. */
|
|
47
|
+
readonly state: unknown;
|
|
48
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
49
|
+
readonly availableBehaviors: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ReactionEvent {
|
|
53
|
+
readonly type: string;
|
|
54
|
+
/** Stable identity for this occurrence, not a new key on every frame. */
|
|
55
|
+
readonly key: string;
|
|
56
|
+
readonly wakeAgent?: boolean;
|
|
57
|
+
readonly payload: Readonly<Record<string, unknown>> & { readonly text: string };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ReactionActivation {
|
|
61
|
+
/** Key in manifest.behaviors; never an arbitrary executable command. */
|
|
62
|
+
readonly behavior: string;
|
|
63
|
+
readonly input?: Readonly<Record<string, unknown>>;
|
|
64
|
+
readonly reason?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ReactionResult {
|
|
68
|
+
readonly state?: unknown;
|
|
69
|
+
readonly events?: readonly ReactionEvent[];
|
|
70
|
+
/** Return while the condition holds. Omitting a binding clears its after_clear latch. */
|
|
71
|
+
readonly activations?: readonly ReactionActivation[];
|
|
72
|
+
}
|
|
73
|
+
|
|
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. */
|
|
76
|
+
export abstract class ClawclawReaction {
|
|
77
|
+
static readonly manifest?: ClawclawReactionManifest;
|
|
78
|
+
abstract evaluate(input: Readonly<ReactionInput>): ReactionResult | Promise<ReactionResult>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const TASK_LIFECYCLE_FACT_TYPES = [
|
|
2
|
+
"task_started",
|
|
3
|
+
"task_progress",
|
|
4
|
+
"task_assigned",
|
|
5
|
+
"task_completed",
|
|
6
|
+
"task_interrupted",
|
|
7
|
+
"task_sabotaged"
|
|
8
|
+
];
|
|
9
|
+
const TASK_REMINDER_FACT_TYPES = [
|
|
10
|
+
...TASK_LIFECYCLE_FACT_TYPES,
|
|
11
|
+
"role_assigned",
|
|
12
|
+
"emergency_started",
|
|
13
|
+
"emergency_resolved",
|
|
14
|
+
"emergency_interrupted",
|
|
15
|
+
"meeting_briefing"
|
|
16
|
+
];
|
|
17
|
+
const REMINDER_FACT_TYPES_BY_TOPIC = {
|
|
18
|
+
tasks: TASK_REMINDER_FACT_TYPES,
|
|
19
|
+
speech: ["wandering_speech"]
|
|
20
|
+
};
|
|
21
|
+
const REMINDER_EVENT_TYPE_BY_TOPIC = { tasks: "reminder.task", speech: "reminder.speech" };
|
|
22
|
+
const REMINDER_FACT_TYPES = [...TASK_REMINDER_FACT_TYPES, "wandering_speech"];
|
|
23
|
+
const REMINDER_EVENT_TYPES = ["reminder.task", "reminder.speech"];
|
|
24
|
+
const REMINDER_TOPICS = ["tasks", "speech"];
|
|
25
|
+
function isReminderMode(value) {
|
|
26
|
+
return value === "wake" || value === "silent" || value === "state_only";
|
|
27
|
+
}
|
|
28
|
+
function defaultConfig(topic) {
|
|
29
|
+
if (topic !== "tasks") throw new Error("Unsupported reminder topic; countdown and ability notifications are owned by CCL.");
|
|
30
|
+
return {
|
|
31
|
+
started: "state_only",
|
|
32
|
+
progress: "state_only",
|
|
33
|
+
added: "silent",
|
|
34
|
+
completed: "silent",
|
|
35
|
+
interrupted: "wake",
|
|
36
|
+
sabotaged: "wake",
|
|
37
|
+
removed: "silent",
|
|
38
|
+
updated: "silent"
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function validateDefaultConfig(topic, input) {
|
|
42
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error("Reminder config must be an object.");
|
|
43
|
+
const defaults = defaultConfig(topic);
|
|
44
|
+
for (const key of Object.keys(input)) if (!Object.hasOwn(defaults, key)) throw new Error("Unknown reminder option: " + key);
|
|
45
|
+
const value = { ...defaults, ...input };
|
|
46
|
+
if (!Object.values(value).every(isReminderMode)) throw new Error("Reminder mode must be wake, silent, or state_only.");
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
const kinds = {
|
|
50
|
+
task_started: "started",
|
|
51
|
+
task_progress: "progress",
|
|
52
|
+
task_assigned: "added",
|
|
53
|
+
task_completed: "completed",
|
|
54
|
+
task_interrupted: "interrupted",
|
|
55
|
+
task_sabotaged: "sabotaged"
|
|
56
|
+
};
|
|
57
|
+
const labels = {
|
|
58
|
+
started: "\u5F00\u59CB\u4EFB\u52A1",
|
|
59
|
+
progress: "\u4EFB\u52A1\u8FDB\u5EA6\u53D8\u5316",
|
|
60
|
+
added: "\u65B0\u589E\u4EFB\u52A1",
|
|
61
|
+
completed: "\u4EFB\u52A1\u5B8C\u6210",
|
|
62
|
+
interrupted: "\u4EFB\u52A1\u4E2D\u65AD",
|
|
63
|
+
sabotaged: "\u7834\u574F\u4EFB\u52A1\u5B8C\u6210",
|
|
64
|
+
removed: "\u4EFB\u52A1\u4E0D\u518D\u51FA\u73B0\u5728\u5217\u8868",
|
|
65
|
+
updated: "\u4EFB\u52A1\u4FE1\u606F\u53D8\u5316"
|
|
66
|
+
};
|
|
67
|
+
function record(value) {
|
|
68
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
69
|
+
}
|
|
70
|
+
function speechReminder(input) {
|
|
71
|
+
if (Object.keys(input.config).some((key) => key !== "receive") || input.config.receive !== void 0 && typeof input.config.receive !== "boolean") {
|
|
72
|
+
throw new Error("Speech reminder config must contain only a boolean receive.");
|
|
73
|
+
}
|
|
74
|
+
if (input.config.receive === false) return { events: [] };
|
|
75
|
+
const self = input.gameState?.you?.player;
|
|
76
|
+
return { events: input.facts.flatMap((fact) => {
|
|
77
|
+
if (fact.type !== "wandering_speech" || fact.replayed) return [];
|
|
78
|
+
const actor = record(fact.payload.actor);
|
|
79
|
+
const seat = actor.seat ?? fact.payload.actor_seat;
|
|
80
|
+
const name = actor.name ?? fact.payload.actor_name;
|
|
81
|
+
const own = seat !== void 0 && self?.seat !== void 0 ? seat === self.seat : typeof name === "string" && self?.name !== void 0 && name === self.name;
|
|
82
|
+
if (own || typeof fact.payload.text !== "string" || !fact.payload.text.trim()) return [];
|
|
83
|
+
return [{
|
|
84
|
+
type: "reminder.speech",
|
|
85
|
+
key: `fact:${fact.eventId}`,
|
|
86
|
+
wakeAgent: true,
|
|
87
|
+
payload: { ...fact.payload, text: fact.payload.text, source_event_id: fact.eventId }
|
|
88
|
+
}];
|
|
89
|
+
}) };
|
|
90
|
+
}
|
|
91
|
+
function defaultReminder(topic, input) {
|
|
92
|
+
if (topic === "speech") return speechReminder(input);
|
|
93
|
+
const config = validateDefaultConfig(topic, input.config);
|
|
94
|
+
const events = [];
|
|
95
|
+
if (input.boundary) return { events };
|
|
96
|
+
const emit = (kind, key, data, eventId) => {
|
|
97
|
+
const mode = config[kind];
|
|
98
|
+
if (mode === "state_only") return;
|
|
99
|
+
const { tasks: _tasks, delta: _delta, newly_assigned_task: _assigned, ...detail } = data;
|
|
100
|
+
const name = String(detail.task_name ?? detail.name ?? "");
|
|
101
|
+
const actor = record(detail.actor);
|
|
102
|
+
const seat = actor.seat ?? detail.actor_seat;
|
|
103
|
+
const who = seat !== void 0 && seat !== input.gameState?.you?.player?.seat ? `${seat}\u53F7\u73A9\u5BB6\uFF1A` : "";
|
|
104
|
+
const room = detail.room ? `\uFF08${String(detail.room)}\uFF09` : "";
|
|
105
|
+
events.push({
|
|
106
|
+
type: "reminder.task",
|
|
107
|
+
key,
|
|
108
|
+
wakeAgent: mode === "wake",
|
|
109
|
+
payload: { ...detail, kind, source_event_id: eventId, text: `${who}${labels[kind]}\uFF1A${name}${room}\u3002` }
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
for (const fact of input.facts) {
|
|
113
|
+
const kind = kinds[fact.type];
|
|
114
|
+
if (kind) emit(kind, `fact:${fact.eventId}`, { ...fact.payload }, fact.eventId);
|
|
115
|
+
}
|
|
116
|
+
return { events };
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
REMINDER_EVENT_TYPES,
|
|
120
|
+
REMINDER_EVENT_TYPE_BY_TOPIC,
|
|
121
|
+
REMINDER_FACT_TYPES,
|
|
122
|
+
REMINDER_FACT_TYPES_BY_TOPIC,
|
|
123
|
+
REMINDER_TOPICS,
|
|
124
|
+
TASK_LIFECYCLE_FACT_TYPES,
|
|
125
|
+
TASK_REMINDER_FACT_TYPES,
|
|
126
|
+
defaultConfig,
|
|
127
|
+
defaultReminder,
|
|
128
|
+
isReminderMode,
|
|
129
|
+
speechReminder,
|
|
130
|
+
validateDefaultConfig
|
|
131
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ReminderInput, ReminderMode, ReminderResult, ReminderTopic, ReminderEvent } from './reminder.js';
|
|
2
|
+
|
|
3
|
+
export const TASK_LIFECYCLE_FACT_TYPES = [
|
|
4
|
+
'task_started', 'task_progress', 'task_assigned', 'task_completed', 'task_interrupted', 'task_sabotaged',
|
|
5
|
+
] as const;
|
|
6
|
+
export const TASK_REMINDER_FACT_TYPES = [
|
|
7
|
+
...TASK_LIFECYCLE_FACT_TYPES,
|
|
8
|
+
'role_assigned', 'emergency_started', 'emergency_resolved', 'emergency_interrupted', 'meeting_briefing',
|
|
9
|
+
] as const;
|
|
10
|
+
export const REMINDER_FACT_TYPES_BY_TOPIC = {
|
|
11
|
+
tasks: TASK_REMINDER_FACT_TYPES,
|
|
12
|
+
speech: ['wandering_speech'],
|
|
13
|
+
} as const;
|
|
14
|
+
export const REMINDER_EVENT_TYPE_BY_TOPIC = { tasks: 'reminder.task', speech: 'reminder.speech' } as const;
|
|
15
|
+
export const REMINDER_FACT_TYPES = [...TASK_REMINDER_FACT_TYPES, 'wandering_speech'] as const;
|
|
16
|
+
export const REMINDER_EVENT_TYPES = ['reminder.task', 'reminder.speech'] as const;
|
|
17
|
+
export const REMINDER_TOPICS: readonly ReminderTopic[] = ['tasks', 'speech'];
|
|
18
|
+
export function isReminderMode(value: unknown): value is ReminderMode {
|
|
19
|
+
return value === 'wake' || value === 'silent' || value === 'state_only';
|
|
20
|
+
}
|
|
21
|
+
export function defaultConfig(topic: ReminderTopic): Record<string, ReminderMode> {
|
|
22
|
+
if (topic !== 'tasks') throw new Error('Unsupported reminder topic; countdown and ability notifications are owned by CCL.');
|
|
23
|
+
// removed/updated remain accepted for existing installed v2 configs; this helper does not emit them.
|
|
24
|
+
return { started: 'state_only', progress: 'state_only', added: 'silent', completed: 'silent',
|
|
25
|
+
interrupted: 'wake', sabotaged: 'wake', removed: 'silent', updated: 'silent' };
|
|
26
|
+
}
|
|
27
|
+
export function validateDefaultConfig(topic: ReminderTopic, input: unknown): Record<string, ReminderMode> {
|
|
28
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) throw new Error('Reminder config must be an object.');
|
|
29
|
+
const defaults = defaultConfig(topic);
|
|
30
|
+
for (const key of Object.keys(input)) if (!Object.hasOwn(defaults, key)) throw new Error('Unknown reminder option: ' + key);
|
|
31
|
+
const value = { ...defaults, ...input };
|
|
32
|
+
if (!Object.values(value).every(isReminderMode)) throw new Error('Reminder mode must be wake, silent, or state_only.');
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
const kinds: Record<string, string> = { task_started: 'started', task_progress: 'progress', task_assigned: 'added',
|
|
36
|
+
task_completed: 'completed', task_interrupted: 'interrupted', task_sabotaged: 'sabotaged' };
|
|
37
|
+
const labels: Record<string, string> = { started: '开始任务', progress: '任务进度变化', added: '新增任务',
|
|
38
|
+
completed: '任务完成', interrupted: '任务中断', sabotaged: '破坏任务完成', removed: '任务不再出现在列表', updated: '任务信息变化' };
|
|
39
|
+
function record(value: unknown): Record<string, unknown> {
|
|
40
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {};
|
|
41
|
+
}
|
|
42
|
+
/** Nearby speech is a backend fact; only its Agent notification is optional. */
|
|
43
|
+
export function speechReminder(input: ReminderInput): ReminderResult {
|
|
44
|
+
if (Object.keys(input.config).some(key => key !== 'receive')
|
|
45
|
+
|| (input.config.receive !== undefined && typeof input.config.receive !== 'boolean')) {
|
|
46
|
+
throw new Error('Speech reminder config must contain only a boolean receive.');
|
|
47
|
+
}
|
|
48
|
+
if (input.config.receive === false) return { events: [] };
|
|
49
|
+
const self = input.gameState?.you?.player;
|
|
50
|
+
return { events: input.facts.flatMap(fact => {
|
|
51
|
+
if (fact.type !== 'wandering_speech' || fact.replayed) return [];
|
|
52
|
+
const actor = record(fact.payload.actor);
|
|
53
|
+
const seat = actor.seat ?? fact.payload.actor_seat;
|
|
54
|
+
const name = actor.name ?? fact.payload.actor_name;
|
|
55
|
+
// GameSync includes the speaker among the frozen nearby recipients.
|
|
56
|
+
const own = seat !== undefined && self?.seat !== undefined ? seat === self.seat
|
|
57
|
+
: typeof name === 'string' && self?.name !== undefined && name === self.name;
|
|
58
|
+
if (own || typeof fact.payload.text !== 'string' || !fact.payload.text.trim()) return [];
|
|
59
|
+
return [{ type: 'reminder.speech' as const, key: `fact:${fact.eventId}`, wakeAgent: true,
|
|
60
|
+
payload: { ...fact.payload, text: fact.payload.text, source_event_id: fact.eventId } }];
|
|
61
|
+
}) };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Optional reminder policy; raw facts always remain available to computation plugins. */
|
|
65
|
+
export function defaultReminder(topic: ReminderTopic, input: ReminderInput): ReminderResult {
|
|
66
|
+
if (topic === 'speech') return speechReminder(input);
|
|
67
|
+
const config = validateDefaultConfig(topic, input.config);
|
|
68
|
+
const events: ReminderEvent[] = [];
|
|
69
|
+
if (input.boundary) return { events };
|
|
70
|
+
const emit = (kind: string, key: string, data: Record<string, unknown>, eventId: string) => {
|
|
71
|
+
const mode = config[kind];
|
|
72
|
+
if (mode === 'state_only') return;
|
|
73
|
+
const { tasks: _tasks, delta: _delta, newly_assigned_task: _assigned, ...detail } = data;
|
|
74
|
+
const name = String(detail.task_name ?? detail.name ?? '');
|
|
75
|
+
const actor = record(detail.actor);
|
|
76
|
+
const seat = actor.seat ?? detail.actor_seat;
|
|
77
|
+
const who = seat !== undefined && seat !== input.gameState?.you?.player?.seat ? `${seat}号玩家:` : '';
|
|
78
|
+
const room = detail.room ? `(${String(detail.room)})` : '';
|
|
79
|
+
events.push({ type: 'reminder.task', key, wakeAgent: mode === 'wake',
|
|
80
|
+
payload: { ...detail, kind, source_event_id: eventId, text: `${who}${labels[kind]}:${name}${room}。` } });
|
|
81
|
+
};
|
|
82
|
+
for (const fact of input.facts) {
|
|
83
|
+
const kind = kinds[fact.type];
|
|
84
|
+
if (kind) emit(kind, `fact:${fact.eventId}`, { ...fact.payload }, fact.eventId);
|
|
85
|
+
}
|
|
86
|
+
// Task lifecycle facts belong to this helper. State-only list changes stay
|
|
87
|
+
// available as input; emergency lifecycle notifications belong to emergency perception.
|
|
88
|
+
return { events };
|
|
89
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { GameEvent, GameState, ObservationFrame } from '../module-input/index.js';
|
|
2
|
+
import type { BehaviorInputFieldSpec } from '../behavior-plugin/index.js';
|
|
3
|
+
|
|
4
|
+
/** Reminder classes use the same public Perception API version and resource lifecycle. */
|
|
5
|
+
export const REMINDER_PLUGIN_API_VERSION = 2 as const;
|
|
6
|
+
export type ReminderTopic = 'tasks' | 'speech';
|
|
7
|
+
export type ReminderMode = 'wake' | 'silent' | 'state_only';
|
|
8
|
+
export interface ReminderFact extends GameEvent {
|
|
9
|
+
readonly producer: 'backend_push' | 'local_synth';
|
|
10
|
+
readonly replayed?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Structural task changes, not Agent notifications or inferred completion facts. */
|
|
13
|
+
export interface ReminderTaskChange {
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly eventId: string;
|
|
16
|
+
readonly epochId?: number;
|
|
17
|
+
readonly change: 'added' | 'removed' | 'status_changed' | 'updated';
|
|
18
|
+
readonly task: Readonly<Record<string, unknown>>;
|
|
19
|
+
readonly before?: Readonly<Record<string, unknown>>;
|
|
20
|
+
readonly from_status?: string;
|
|
21
|
+
readonly to_status?: string;
|
|
22
|
+
readonly baseline: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ReminderInput {
|
|
25
|
+
readonly cycle?: import('../module-input/index.js').ProcessingCycleInfo;
|
|
26
|
+
readonly scope: Readonly<{ sessionId: string; segmentId: string }>;
|
|
27
|
+
readonly frame: Readonly<ObservationFrame> | null;
|
|
28
|
+
readonly gameState: Readonly<GameState> | null;
|
|
29
|
+
readonly facts: readonly Readonly<ReminderFact>[];
|
|
30
|
+
/** Module-local comparison of consecutive task snapshots; no cross-perception dependency. */
|
|
31
|
+
readonly taskChanges: readonly ReminderTaskChange[];
|
|
32
|
+
/** Establish private baselines without replaying notifications. */
|
|
33
|
+
readonly boundary: 'initial' | 'recovery' | null;
|
|
34
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
35
|
+
/** Host-persisted state from the previous completed update; never use instance fields for recovery. */
|
|
36
|
+
readonly state: unknown;
|
|
37
|
+
readonly nowMs: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ReminderResult {
|
|
40
|
+
readonly state?: unknown;
|
|
41
|
+
readonly events?: readonly ReminderEvent[];
|
|
42
|
+
}
|
|
43
|
+
export interface ReminderEvent {
|
|
44
|
+
readonly type: 'reminder.task' | 'reminder.speech';
|
|
45
|
+
/** Stable per occurrence, retained across retry/recovery. */
|
|
46
|
+
readonly key: string;
|
|
47
|
+
readonly wakeAgent: boolean;
|
|
48
|
+
readonly payload: Readonly<Record<string, unknown>> & { readonly text: string };
|
|
49
|
+
}
|
|
50
|
+
export interface ClawclawReminderManifest {
|
|
51
|
+
readonly apiVersion: typeof REMINDER_PLUGIN_API_VERSION;
|
|
52
|
+
readonly kind: 'reminder';
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly description: string;
|
|
55
|
+
readonly name?: string;
|
|
56
|
+
readonly localizations?: import('../resource-metadata.js').ClawclawResourceLocalizations;
|
|
57
|
+
readonly topic: ReminderTopic;
|
|
58
|
+
readonly consumes: readonly string[];
|
|
59
|
+
/** Optional validation schema for parameters carried in this module's own manifest. */
|
|
60
|
+
readonly inputs?: readonly BehaviorInputFieldSpec[];
|
|
61
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
62
|
+
}
|
|
63
|
+
/** Non-visual perception rule. Runtime supplies durable state and bounds the Worker. */
|
|
64
|
+
/** @deprecated API v2 compatibility; future support may end. New scripts use ClawclawPerception API v3. */
|
|
65
|
+
export abstract class ClawclawReminder {
|
|
66
|
+
static readonly manifest?: ClawclawReminderManifest;
|
|
67
|
+
abstract update(input: Readonly<ReminderInput>): ReminderResult | Promise<ReminderResult>;
|
|
68
|
+
}
|