@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
@@ -0,0 +1,106 @@
1
+ /**
2
+ * `editor.sourceLocation.lookup` (B3, §8 B3 "source-location lookup for
3
+ * inspected React output ... READ-ONLY, must NOT rewrite JSX").
4
+ *
5
+ * Genuinely wired, real, and structurally read-only: it only ever GETs
6
+ * `/__ui-source/index` (the OID -> {file,line,col,component,tag} map built
7
+ * by `vite-plugin-ui-oid.ts`'s `OidStore`) and looks up one entry. It never
8
+ * calls any of that plugin's write endpoints (`/__ui-source/write|css|text|
9
+ * prop|struct|struct-many|restore`) — there is no code path in this file
10
+ * that could send one, which is what "must NOT rewrite JSX" means in
11
+ * practice here (not a runtime permission check, a STRUCTURAL guarantee:
12
+ * the transport interface this op is given, `EditorTransport.getSourceIndex`,
13
+ * has no write method to call).
14
+ */
15
+
16
+ import { z } from 'zod';
17
+ import { OperationError } from '../errors.js';
18
+ import { defineOperation, type OperationRegistry } from '../registry.js';
19
+ import {
20
+ EDITOR_NOT_RUNNING_ERROR,
21
+ EDITOR_READ_TIMEOUT_MS,
22
+ getTransport,
23
+ resolveEditorSession,
24
+ withTimeout,
25
+ } from './transport.js';
26
+
27
+ const SOURCE_INDEX_UNAVAILABLE_ERROR = {
28
+ code: 'SOURCE_INDEX_UNAVAILABLE',
29
+ summary: 'A session is connected but did not answer the source-location index read in time.',
30
+ data: z.object({}),
31
+ } as const;
32
+
33
+ const SOURCE_LOCATION_NOT_FOUND_ERROR = {
34
+ code: 'SOURCE_LOCATION_NOT_FOUND',
35
+ summary: 'No source-location entry is registered for the given oid.',
36
+ data: z.object({ oid: z.string() }),
37
+ } as const;
38
+
39
+ const EditorSourceLocationLookupInput = z
40
+ .object({ oid: z.string().describe('The data-oid identifier of an inspected React element.') })
41
+ .describe("Map an inspected React element's oid to its source location. Read-only.");
42
+
43
+ const EditorSourceLocationLookupResult = z
44
+ .object({
45
+ file: z.string().describe('Absolute source file path.'),
46
+ line: z.number().describe('1-based line number.'),
47
+ col: z.number().describe('0-based column.'),
48
+ component: z.string().nullable().describe('Enclosing component name, or null.'),
49
+ tag: z.string().describe('JSX tag name at this location.'),
50
+ })
51
+ .describe('Source location for the given oid. Never mutates anything.');
52
+
53
+ export const editorSourceLocationLookup = defineOperation({
54
+ name: 'editor.sourceLocation.lookup',
55
+ summary: "Map an inspected React element's oid to its exact component/source location.",
56
+ description:
57
+ 'Reads GET /__ui-source/index (the live OID -> source-location map) and looks up one entry. ' +
58
+ 'Read-only by construction: this op only ever calls a GET-index transport method, never any ' +
59
+ 'of the write endpoints that same plugin also serves.',
60
+ input: EditorSourceLocationLookupInput,
61
+ result: EditorSourceLocationLookupResult,
62
+ errors: [
63
+ EDITOR_NOT_RUNNING_ERROR,
64
+ SOURCE_INDEX_UNAVAILABLE_ERROR,
65
+ SOURCE_LOCATION_NOT_FOUND_ERROR,
66
+ ],
67
+ requires: { editor: true },
68
+ host: 'editor-browser',
69
+ mutates: false,
70
+ supportsDryRun: false,
71
+ permission: {
72
+ risk: 'read',
73
+ summary: 'Reads the live OID -> source-location index only; never writes source.',
74
+ },
75
+ async impl(input, ctx) {
76
+ const transport = getTransport(ctx);
77
+ const session = await resolveEditorSession(ctx, transport);
78
+ const index = await withTimeout(
79
+ transport.getSourceIndex(session, EDITOR_READ_TIMEOUT_MS),
80
+ EDITOR_READ_TIMEOUT_MS,
81
+ 'editor.sourceLocation.lookup',
82
+ ).catch(() => undefined);
83
+ if (!index) {
84
+ throw new OperationError(
85
+ 'SOURCE_INDEX_UNAVAILABLE',
86
+ 'The connected editor session did not answer the source-location index read in time.',
87
+ {},
88
+ );
89
+ }
90
+ const entry = index[input.oid];
91
+ if (!entry) {
92
+ throw new OperationError(
93
+ 'SOURCE_LOCATION_NOT_FOUND',
94
+ `No source location for oid "${input.oid}".`,
95
+ {
96
+ oid: input.oid,
97
+ },
98
+ );
99
+ }
100
+ return entry;
101
+ },
102
+ });
103
+
104
+ export function registerSourceLocationOperations(registry: OperationRegistry): void {
105
+ registry.register(editorSourceLocationLookup);
106
+ }