@myclaw163/clawclaw-cli 0.7.7 → 0.7.9

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 (33) hide show
  1. package/docs/desktop-event-push.md +14 -2
  2. package/docs//350/207/252/345/256/232/344/271/211/346/204/237/347/237/245.md +15 -1
  3. package/package.json +1 -1
  4. package/src/pipeline/event-format.test.ts +13 -0
  5. package/src/pipeline/event-format.ts +11 -1
  6. package/src/pipeline/game-sync-event-normalization.test.ts +87 -1
  7. package/src/pipeline/game-sync-event-normalization.ts +91 -15
  8. package/src/pipeline/player-projection.test.ts +19 -2
  9. package/src/pipeline/player-projection.ts +17 -2
  10. package/src/runtime/clawclaw/owner.ts +8 -0
  11. package/src/runtime/clawclaw/plugins/assembly.test.ts +13 -0
  12. package/src/runtime/clawclaw/plugins/assembly.ts +10 -0
  13. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-push.integration.test.ts +17 -5
  14. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.test.ts +37 -3
  15. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.ts +49 -14
  16. package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.test.ts +71 -0
  17. package/src/runtime/clawclaw/plugins/perception/contracts.ts +1 -0
  18. package/src/runtime/clawclaw/plugins/perception/modules/co-movement-module.ts +16 -0
  19. package/src/runtime/clawclaw/plugins/perception/modules/follow-module.ts +16 -0
  20. package/src/runtime/clawclaw/plugins/perception/modules/motion-module.ts +16 -0
  21. package/src/runtime/clawclaw/plugins/perception/modules/route-module.ts +23 -0
  22. package/src/runtime/clawclaw/plugins/perception/modules/spatial-module.ts +16 -0
  23. package/src/runtime/clawclaw/plugins/perception/modules/stop-module.ts +16 -0
  24. package/src/runtime/clawclaw/plugins/perception/modules/visibility-module.ts +23 -0
  25. package/src/runtime/clawclaw/plugins/perception/perception-plugin.test.ts +19 -0
  26. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +41 -0
  27. package/src/runtime/clawclaw/plugins/perception/perception-source.test.ts +49 -0
  28. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +105 -5
  29. package/src/runtime/clawclaw/plugins/source/source-plugin.test.ts +239 -0
  30. package/src/runtime/clawclaw/plugins/source/source-plugin.ts +146 -66
  31. package/src/runtime/framework/plugins/runtime-plugin-scheduler.test.ts +36 -0
  32. package/src/runtime/framework/plugins/runtime-plugin-scheduler.ts +0 -5
  33. package/src/sdk/perception-plugin/index.ts +8 -0
@@ -1929,6 +1929,42 @@ describe('RuntimePluginScheduler', () => {
1929
1929
  expect(stopped).toEqual(['shutdown']);
1930
1930
  });
1931
1931
 
1932
+ it('logs a plugin flush failure without failing shutdown or skipping peer plugins', async () => {
1933
+ const flushed: string[] = [];
1934
+ const test = harness([{
1935
+ kind: 'epoch',
1936
+ id: 'flush-failure',
1937
+ version: '1',
1938
+ update: () => ({ outcome: 'noop' }),
1939
+ flush() {
1940
+ flushed.push('flush-failure');
1941
+ throw new Error('broken plugin flush');
1942
+ },
1943
+ }, {
1944
+ kind: 'epoch',
1945
+ id: 'flush-peer',
1946
+ version: '1',
1947
+ update: () => ({ outcome: 'noop' }),
1948
+ flush() {
1949
+ flushed.push('flush-peer');
1950
+ },
1951
+ }]);
1952
+
1953
+ await test.scheduler.enqueue(test.work(1));
1954
+ await expect(test.scheduler.close()).resolves.toBeUndefined();
1955
+
1956
+ expect(flushed).toEqual(['flush-failure', 'flush-peer']);
1957
+ expect(test.diagnostics).toContainEqual(expect.objectContaining({
1958
+ name: 'runtime.plugin.flush_failed',
1959
+ severity: 'error',
1960
+ attributes: expect.objectContaining({
1961
+ plugin_id: 'flush-failure',
1962
+ reason: 'shutdown',
1963
+ error_code: 'RUNTIME_PLUGIN_FLUSH_FAILED',
1964
+ }),
1965
+ }));
1966
+ });
1967
+
1932
1968
  it('drains buffered parallel work in order when a failure pauses the plugin', async () => {
1933
1969
  let releaseFirst!: () => void;
1934
1970
  const firstGate = new Promise<void>((resolve) => { releaseFirst = resolve; });
@@ -563,7 +563,6 @@ export class RuntimePluginScheduler<
563
563
  await this.waitForIdle();
564
564
  const scope = this.activeScope;
565
565
  if (!scope) return;
566
- const failures: unknown[] = [];
567
566
  for (const layer of this.layers) {
568
567
  await Promise.all(layer.map(async (plugin) => {
569
568
  if (!plugin.flush) return;
@@ -586,7 +585,6 @@ export class RuntimePluginScheduler<
586
585
  reason,
587
586
  }, scope);
588
587
  } catch (error) {
589
- failures.push(error);
590
588
  this.onDiagnostic?.('runtime.plugin.flush_failed', {
591
589
  plugin_id: plugin.id,
592
590
  reason,
@@ -595,9 +593,6 @@ export class RuntimePluginScheduler<
595
593
  }
596
594
  }));
597
595
  }
598
- if (failures.length > 0) {
599
- throw new AggregateError(failures, `${failures.length} Runtime Epoch Plugin flush operation(s) failed.`);
600
- }
601
596
  }
602
597
 
603
598
  waitForIdle(): Promise<void> {
@@ -160,6 +160,12 @@ export interface PerceptionApi {
160
160
  readonly spatial: PerceptionSpatialApi;
161
161
  }
162
162
 
163
+ export interface ClawclawPerceptionEventMetadata {
164
+ readonly name: string;
165
+ readonly description: string;
166
+ readonly localizations?: ClawclawResourceLocalizations;
167
+ }
168
+
163
169
  /**
164
170
  * Immutable, epoch-bound input for one fresh parallel analyzer instance.
165
171
  * Frames may be skipped and different inputs may be analyzed concurrently.
@@ -205,6 +211,8 @@ export interface ClawclawPerceptionManifest {
205
211
  /** Describes Event subjects; every module still receives self as a spatial reference. */
206
212
  readonly subjectScope: PerceptionSubjectScope;
207
213
  readonly produces: readonly string[];
214
+ /** Optional display metadata for every Event in `produces`. */
215
+ readonly eventMetadata?: Readonly<Record<string, ClawclawPerceptionEventMetadata>>;
208
216
  /**
209
217
  * Omit for the main-thread, persistent, ordered `update()` contract.
210
218
  * `parallel_analysis` batches every enabled parallel module for one frame on