@vgai/editor-sdk 0.5.38 → 0.5.39

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/README.md CHANGED
@@ -79,7 +79,7 @@ export default function MapBuilder({ tool, client, account }: ToolContributionPr
79
79
  }
80
80
  ```
81
81
 
82
- The package registration chooses `workspace.document`, `workspace.utility`,
82
+ The package registration chooses `workspace.document`, `workspace.utility`, `workspace.analytics`,
83
83
  `selection.inspector`, `asset.inspector`, or `generation.result`. Selection
84
84
  Inspector contributions receive `node`/`nodeId` and export
85
85
  `match(node, adapter)`; asset Inspector contributions receive `asset` and
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/editor-sdk",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.38",
5
+ "version": "0.5.39",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@types/three": "^0.180.0",
27
- "@vgai/sdk": "0.5.38"
27
+ "@vgai/sdk": "0.5.39"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@vgai/engine": "*",
package/src/client.ts CHANGED
@@ -297,9 +297,9 @@ export class EditorClient {
297
297
  * query engine. Omitted, the filename keeps its exact unnamed shape. */
298
298
  /* `opts.record` (`vgai play --record <name>`) — NAMES this run's recording
299
299
  * file. It does not ENABLE recording: every relayed play records, with no
300
- * flag (see `editor/src/play-recording.ts`). Omitted, the clip lands in the
301
- * rotating `.vgai/recordings/play-latest.webm`; named, in
302
- * `.vgai/recordings/<name>.webm`, which nothing ever rotates. */
300
+ * flag (see `editor/src/play-recording.ts`). Omitted, the clip is named for
301
+ * the durable Gameplay Session; named, it becomes an explicit keepsake in
302
+ * `.vgai/recordings/<name>.webm`. */
303
303
  async play(opts?: {
304
304
  seed?: number;
305
305
  name?: string | null;
@@ -362,6 +362,63 @@ export interface ToolContributionRecording {
362
362
  readonly subscribe: (listener: () => void) => () => void;
363
363
  }
364
364
 
365
+ /** One structured row from a Gameplay Session's durable JSONL record. */
366
+ export interface ToolGameplaySessionEntry {
367
+ readonly t?: number;
368
+ readonly level?: string;
369
+ readonly source?: string;
370
+ readonly sub?: string;
371
+ readonly msg?: string;
372
+ readonly meta?: Readonly<Record<string, unknown>>;
373
+ readonly tick?: number;
374
+ readonly simT?: number;
375
+ readonly world?: string;
376
+ readonly simSpeed?: number;
377
+ readonly [field: string]: unknown;
378
+ }
379
+
380
+ export interface ToolGameplaySessionRecording {
381
+ readonly file: string;
382
+ readonly url: string;
383
+ readonly startedAt: number | null;
384
+ readonly finalized: boolean;
385
+ readonly bytes: number | null;
386
+ }
387
+
388
+ /** One Play interval, durable after Stop and editor reload. */
389
+ export interface ToolGameplaySession {
390
+ readonly id: string;
391
+ readonly run: string | null;
392
+ readonly status: 'live' | 'completed';
393
+ readonly startedAt: number;
394
+ readonly endedAt: number | null;
395
+ /** Real elapsed wall time. Simulation time remains an entry field. */
396
+ readonly durationMs: number;
397
+ readonly logFile: string;
398
+ readonly entries: readonly ToolGameplaySessionEntry[];
399
+ readonly recording: ToolGameplaySessionRecording | null;
400
+ }
401
+
402
+ export interface ToolGameplaySessionsSnapshot {
403
+ readonly sessions: readonly ToolGameplaySession[];
404
+ readonly selectedSessionId: string | null;
405
+ readonly selectedSession: ToolGameplaySession | null;
406
+ /** Shared analytics cursor, measured in real milliseconds from Play start. */
407
+ readonly cursorMs: number;
408
+ readonly liveEdgeMs: number;
409
+ readonly loading: boolean;
410
+ readonly error: string | null;
411
+ }
412
+
413
+ /** Stable external store supplied to the built-in Analytics contribution. */
414
+ export interface ToolGameplaySessions {
415
+ readonly getSnapshot: () => ToolGameplaySessionsSnapshot;
416
+ readonly subscribe: (listener: () => void) => () => void;
417
+ readonly select: (sessionId: string) => void;
418
+ readonly seek: (realTimeMs: number) => void;
419
+ readonly refresh: () => Promise<void>;
420
+ }
421
+
365
422
  /**
366
423
  * The live game a contribution is looking at, or `null` when nothing is
367
424
  * playing.
@@ -423,6 +480,21 @@ export interface ToolUtilityContributionProps extends Omit<ToolContributionProps
423
480
  readonly tool?: ProjectToolCatalogEntry;
424
481
  }
425
482
 
483
+ /**
484
+ * A game's analytics body. The editor owns session selection, real-time
485
+ * transport, and optional video preview; this component owns only the charts
486
+ * and readouts that give the selected session meaning for this game.
487
+ *
488
+ * `play` is intentionally absent. Historical analysis consumes the durable
489
+ * Gameplay Session record, so the type itself prevents an Analytics surface
490
+ * from accidentally depending on a live module graph.
491
+ */
492
+ export interface ToolAnalyticsContributionProps
493
+ extends Omit<ToolContributionProps, 'tool' | 'play'> {
494
+ readonly tool?: ProjectToolCatalogEntry;
495
+ readonly gameplaySessions: ToolGameplaySessions;
496
+ }
497
+
426
498
  /**
427
499
  * A `selection.inspector`'s props. `tool` is OPTIONAL here for the same reason
428
500
  * it is on a utility: a section may present state the editor already has —
package/src/extension.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * (a) **Editor panels** — registered into the Dockview workspace as documents
8
8
  * or utilities via a tool contribution (`package.json#vgai.tools` →
9
- * `contributes: [{ point: 'workspace.document' | 'workspace.utility' }]`).
9
+ * `contributes: [{ point: 'workspace.document' | 'workspace.utility' | 'workspace.analytics' }]`).
10
10
  * Types: `ToolContributionProps` in `@vgai/editor-sdk/contributions`.
11
11
  * Panels are never a parallel rail — Dockview owns all layout.
12
12
  * (b) **Inspector sections** — `point: 'selection.inspector'` /
package/src/types.ts CHANGED
@@ -104,8 +104,8 @@ export interface GameCapture {
104
104
  export interface GameplayRecordingOptions {
105
105
  /** Requested real-time capture cadence. Defaults to 30; range 1–60. */
106
106
  fps?: number;
107
- /** Names the file under `.vgai/recordings/`. Absent takes the rotating
108
- * `play-latest.webm`, which the next play overwrites. */
107
+ /** Names the file under `.vgai/recordings/`. During Play, absence names the
108
+ * clip after its durable Gameplay Session. */
109
109
  name?: string | null;
110
110
  }
111
111
 
@@ -121,7 +121,7 @@ export interface GameplayRecordingStarted {
121
121
  /** Where the bytes are landing — known at START, so a caller can say where
122
122
  * the evidence for a run still in progress will be. */
123
123
  path: string;
124
- /** True for the rotating unnamed clip; false for a `--record <name>` keepsake. */
124
+ /** True only for the out-of-session rotating fallback. */
125
125
  rotates: boolean;
126
126
  /** This run's `logs/play-*.jsonl`, whose event timestamps map to clip offsets. */
127
127
  logFile: string | null;