@vgai/sdk 0.4.0-canary.20260715.0

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 (51) hide show
  1. package/package.json +27 -0
  2. package/src/cinematic/capabilities-operations.ts +128 -0
  3. package/src/cinematic/cue-operations.ts +198 -0
  4. package/src/cinematic/gsap-operations.ts +126 -0
  5. package/src/cinematic/index.ts +59 -0
  6. package/src/cinematic/preview-operations.ts +279 -0
  7. package/src/cinematic/preview-transport.ts +244 -0
  8. package/src/cinematic/render-operations.ts +409 -0
  9. package/src/cinematic/render-transport.ts +238 -0
  10. package/src/cinematic/theatre-operations.ts +306 -0
  11. package/src/editor/camera-operations.ts +169 -0
  12. package/src/editor/console-operations.ts +87 -0
  13. package/src/editor/hierarchy-operations.ts +95 -0
  14. package/src/editor/index.ts +62 -0
  15. package/src/editor/open-operations.ts +209 -0
  16. package/src/editor/screenshot-operations.ts +99 -0
  17. package/src/editor/selection-operations.ts +144 -0
  18. package/src/editor/session-operations.ts +73 -0
  19. package/src/editor/source-location-operations.ts +106 -0
  20. package/src/editor/transport.ts +647 -0
  21. package/src/errors.ts +72 -0
  22. package/src/http/http-projection.ts +349 -0
  23. package/src/http/index.ts +11 -0
  24. package/src/index.ts +67 -0
  25. package/src/mcp/index.ts +16 -0
  26. package/src/mcp/mcp-projection.ts +288 -0
  27. package/src/operations.ts +83 -0
  28. package/src/play/control-operations.ts +205 -0
  29. package/src/play/debug-command-operations.ts +245 -0
  30. package/src/play/index.ts +66 -0
  31. package/src/play/input-operations.ts +316 -0
  32. package/src/play/lifecycle-operations.ts +271 -0
  33. package/src/play/log-operations.ts +279 -0
  34. package/src/play/run-ticks-operations.ts +141 -0
  35. package/src/play/state-operations.ts +210 -0
  36. package/src/play/status-operations.ts +160 -0
  37. package/src/play/transport.ts +728 -0
  38. package/src/project/asset-operations.ts +243 -0
  39. package/src/project/component-operations.ts +337 -0
  40. package/src/project/discovery-operations.ts +269 -0
  41. package/src/project/entity-operations.ts +366 -0
  42. package/src/project/index.ts +55 -0
  43. package/src/project/input-map-operations.ts +233 -0
  44. package/src/project/manifest-operations.ts +355 -0
  45. package/src/project/scene-operations.ts +426 -0
  46. package/src/project/shared.ts +299 -0
  47. package/src/registry.ts +285 -0
  48. package/src/render/capabilities/ffmpeg.ts +141 -0
  49. package/src/render/index.ts +15 -0
  50. package/src/render/render-cinematic.ts +1847 -0
  51. package/src/types.ts +101 -0
package/src/types.ts ADDED
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Shared vocabulary for the operation registry (B1,
3
+ * docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §8 B1 / §5.7 / §3.4).
4
+ */
5
+
6
+ /** The four namespaces every operation name must live under (§5.7). */
7
+ export const OPERATION_NAMESPACES = ['project', 'editor', 'play', 'cinematic'] as const;
8
+ export type OperationNamespace = (typeof OPERATION_NAMESPACES)[number];
9
+
10
+ /**
11
+ * Which of the three hosts an operation executes on (§8 B1, the
12
+ * review-hardened addition):
13
+ * - `node` — runs in the SDK's own Node process against files (or, for
14
+ * long-running jobs like `cinematic.render`, launches its own browser).
15
+ * - `editor-browser` — invoked through the existing
16
+ * `POST /__editor/command` SSE relay in
17
+ * `packages/editor/server/editor-server.ts`, which broadcasts to the
18
+ * connected browser editor and awaits its callback under a short timeout
19
+ * (~5s; 120s for `play`). The projection generates the relay stub.
20
+ * - `runtime-page` — invoked through the play/render harness in a launched
21
+ * runtime page.
22
+ *
23
+ * `cinematic.render` is pinned `node` and MUST NOT ride the editor relay's
24
+ * short timeout — it is a long-running job (see `longRunning` on
25
+ * `OperationDefinition`).
26
+ */
27
+ export type ExecutionHost = 'node' | 'editor-browser' | 'runtime-page';
28
+
29
+ /** Which live contexts an operation needs before it can run. */
30
+ export interface ExecutionRequirements {
31
+ /** Needs a project directory on disk (no editor process required). */
32
+ project?: boolean;
33
+ /** Needs an existing, connected editor session. */
34
+ editor?: boolean;
35
+ /** Needs a playable runtime (starts or targets one). */
36
+ play?: boolean;
37
+ /** Needs a controlled render runtime. */
38
+ render?: boolean;
39
+ }
40
+
41
+ /** Coarse risk classification surfaced to permission-gated callers (agents, HTTP/MCP auth). */
42
+ export type PermissionRisk = 'read' | 'write' | 'destructive';
43
+
44
+ export interface PermissionMetadata {
45
+ risk: PermissionRisk;
46
+ /** Human summary of what this operation is permitted to touch or do. */
47
+ summary: string;
48
+ }
49
+
50
+ /** One completed file handed to the host-managed generated-output boundary. */
51
+ export interface ProjectOutputFile {
52
+ /** Project-relative destination. Slice 1 deliberately permits only public/**. */
53
+ path: string;
54
+ content: string | Uint8Array;
55
+ mediaType?: string;
56
+ role?: 'asset' | 'prefab' | 'provenance' | 'other';
57
+ }
58
+
59
+ /** JSON-safe summary returned after an atomic generated-output transaction. */
60
+ export interface ProjectGeneratedOutputFile {
61
+ path: string;
62
+ bytes: number;
63
+ mediaType?: string;
64
+ role?: ProjectOutputFile['role'];
65
+ }
66
+
67
+ export interface ProjectGeneratedOutput {
68
+ files: ProjectGeneratedOutputFile[];
69
+ totalBytes: number;
70
+ dryRun: boolean;
71
+ }
72
+
73
+ /**
74
+ * Host capability supplied only to Node-hosted project operations. Generator
75
+ * implementations may stay ordinary native JS; their thin operation wrapper
76
+ * calls this once it has a complete batch ready to commit.
77
+ */
78
+ export interface ProjectOutputWriter {
79
+ write(
80
+ files: readonly ProjectOutputFile[],
81
+ options?: { dryRun?: boolean },
82
+ ): Promise<ProjectGeneratedOutput>;
83
+ }
84
+
85
+ /**
86
+ * Runtime context passed to every operation's `impl`. Intentionally an open
87
+ * record (`[key: string]: unknown`) — later units (B2-B8) will grow this with
88
+ * concrete fields (editor session ids, play session handles, render job
89
+ * state); B1 only needs the two seams its sample operations touch.
90
+ */
91
+ export interface OperationContext {
92
+ /** Absolute path to the target project's root, for `project`-context ops. */
93
+ projectRoot?: string;
94
+ /** Base URL of a connected editor session, for `editor`-context ops. */
95
+ editorUrl?: string;
96
+ /** Cooperative cancellation for long-running (`node`, `longRunning`) ops. */
97
+ signal?: AbortSignal;
98
+ /** Atomic writer for generated project assets (Node project operations). */
99
+ projectOutputs?: ProjectOutputWriter;
100
+ [key: string]: unknown;
101
+ }