@vcp-dev/site-edit-engine 0.4.9 → 0.6.1

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.
@@ -1,5 +1,5 @@
1
- import type { SiteEditOperationCommandResult, SiteEditResolveSourceLocationInput } from "@vcp-dev/contracts";
2
- import type { PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions } from "./types.js";
1
+ import type { SiteEditCommandSuccess, SiteEditMutationContext, SiteEditOperationCommandResult, SiteEditResolveSourceLocationInput } from "@vcp-dev/contracts";
2
+ import type { SiteEditEngineHistoryStatus, PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions } from "./types.js";
3
3
  export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSiteEditEngineRuntime {
4
4
  private readonly options;
5
5
  private readonly engine;
@@ -16,65 +16,65 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
16
16
  snapshotId: string;
17
17
  routeId: string;
18
18
  version: number;
19
- rootKeys: string[];
20
19
  entries: {
21
20
  key: string;
22
- tag: string;
23
- label: string;
24
- parentKey: string | null;
25
- childKeys: string[];
26
21
  operationSummary: {
27
22
  canUpdateText: boolean;
28
23
  canInsertChild: boolean;
29
24
  canMove: boolean;
30
25
  canRemove: boolean;
31
26
  };
27
+ pageCompositionUnitKey?: string | undefined;
32
28
  }[];
29
+ pageComposition: {
30
+ status: "supported";
31
+ containerKey: string;
32
+ hasBusinessMembers: boolean;
33
+ placementUnitKeys: string[];
34
+ placements: {
35
+ placementKey: string;
36
+ placementUnitKey: string;
37
+ relation: "before" | "after" | "prepend" | "append";
38
+ }[];
39
+ } | {
40
+ status: "unsupported";
41
+ reason: "VERSION_STALE" | "RECOVERY_REQUIRED" | "MULTIPLE_PAGE_RETURNS" | "INDIRECT_RETURN_ONLY" | "PAGE_CONTAINER_AMBIGUOUS" | "NO_SAFE_PAGE_PLACEMENT" | "MEMBER_NOT_INDEPENDENT" | "UNSUPPORTED_ROUTE_STRUCTURE" | "RUNTIME_ANCHOR_UNRESOLVED" | "ROUTE_RETURN_NOT_FOUND";
42
+ diagnostics: {
43
+ code: string;
44
+ message: string;
45
+ }[];
46
+ };
33
47
  };
34
48
  };
35
- getObjectSummary(key: string, routeId?: string): {
49
+ getStyleContext(routeId: string): {
50
+ ok: true;
51
+ data: {
52
+ revision: string;
53
+ entryCss: {
54
+ path: string;
55
+ content: string;
56
+ hash?: string | undefined;
57
+ };
58
+ stylesheets: {
59
+ path: string;
60
+ content: string;
61
+ hash?: string | undefined;
62
+ }[];
63
+ } | null;
64
+ };
65
+ getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
66
+ getObjectEditContext(key: string, routeId?: string): {
36
67
  readonly ok: true;
37
68
  readonly data: {
38
69
  key: string;
39
70
  tag: string;
40
71
  label: string;
41
- capabilities: {
42
- constraints: {
43
- kind: "component-boundary" | "repeat-region" | "conditional-region" | "opaque-region" | "void-element" | "read-only" | "cross-file-required" | "import-required";
44
- message: string;
45
- }[];
46
- };
47
72
  isOpaque: boolean;
48
73
  ancestors: {
49
74
  key: string;
50
75
  label: string;
51
76
  tag: string;
52
77
  }[];
53
- sourceLocator?: {
54
- sourceFile: string;
55
- componentName: string;
56
- openingElementRange: {
57
- startLine: number;
58
- startColumn: number;
59
- endLine: number;
60
- endColumn: number;
61
- };
62
- structuralPath: string;
63
- textPreview?: string | undefined;
64
- } | undefined;
65
- provenanceChain?: {
66
- editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
67
- diagnostics: {
68
- code: string;
69
- message: string;
70
- }[];
71
- } | undefined;
72
- };
73
- };
74
- getObjectEditContext(key: string, routeId?: string): {
75
- readonly ok: true;
76
- readonly data: {
77
- key: string;
78
78
  componentName: string;
79
79
  sourceFile: string;
80
80
  capabilities: {
@@ -106,68 +106,31 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
106
106
  } | undefined;
107
107
  } | undefined;
108
108
  };
109
- writeTarget: {
110
- kind: "jsx-node" | "component-proxy" | "value-binding" | "route-export";
111
- file: string;
112
- componentName: string;
113
- isProxy: boolean;
114
- };
115
109
  textSegments: {
116
110
  index: number;
117
- value: string;
118
111
  editable: boolean;
119
- source: {
120
- kind: "literal" | "binding" | "imported-binding" | "repeat-template";
121
- file: string;
122
- expression: string;
123
- bindingName?: string | undefined;
124
- path?: (string | number)[] | undefined;
125
- } | null;
112
+ sourceKind: "literal" | "binding" | "imported-binding" | "repeat-template" | null;
126
113
  }[];
127
114
  boundaryKind: "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region" | null;
128
- children: {
129
- key: string;
130
- label: string;
131
- tag: string;
132
- }[];
133
- siblings: {
134
- key: string;
135
- label: string;
136
- tag: string;
137
- }[];
138
- effectiveWriteTarget?: {
139
- kind: "jsx-node" | "route-export" | "value-path" | "external-entry";
140
- isProxy: boolean;
141
- file?: string | undefined;
142
- displayPath?: string | undefined;
143
- sourceType?: "api-field" | "cms-field" | "i18n-message" | "config-entry" | undefined;
144
- sourceId?: string | undefined;
115
+ sourceLocator?: {
116
+ sourceFile: string;
117
+ componentName: string;
118
+ openingElementRange: {
119
+ startLine: number;
120
+ startColumn: number;
121
+ endLine: number;
122
+ endColumn: number;
123
+ };
124
+ structuralPath: string;
125
+ textPreview?: string | undefined;
145
126
  } | undefined;
146
127
  provenanceChain?: {
147
- finalSource: {
148
- kind: "api-field" | "cms-field" | "i18n-message" | "config-entry" | "binding" | "imported-binding" | "repeat-template" | "jsx-literal" | "component-prop" | "object-field" | "array-item" | "conditional-branch";
149
- file: string;
150
- displayPath: string;
151
- externalSource?: {
152
- sourceType: "api-field" | "cms-field" | "i18n-message" | "config-entry";
153
- sourceId: string;
154
- adapterId?: string | undefined;
155
- } | undefined;
156
- } | null;
157
- chain: {
158
- kind: "api-field" | "cms-field" | "i18n-message" | "config-entry" | "binding" | "imported-binding" | "repeat-template" | "jsx-literal" | "component-prop" | "object-field" | "array-item" | "conditional-branch";
159
- file: string;
160
- displayName: string;
161
- canEditHere: boolean;
162
- }[];
163
- confidence: "exact" | "safe-derived" | "partial" | "unknown";
164
128
  editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
165
129
  diagnostics: {
166
130
  code: string;
167
131
  message: string;
168
132
  }[];
169
133
  } | undefined;
170
- componentSemantic?: Record<string, unknown> | undefined;
171
134
  };
172
135
  };
173
136
  getClassNameSource(key: string, routeId?: string): {
@@ -183,50 +146,20 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
183
146
  attrRange: {
184
147
  start: number;
185
148
  end: number;
186
- startLine?: number | undefined;
187
- startColumn?: number | undefined;
188
- endLine?: number | undefined;
189
- endColumn?: number | undefined;
190
- } | null;
191
- valueRange: {
192
- start: number;
193
- end: number;
194
- startLine?: number | undefined;
195
- startColumn?: number | undefined;
196
- endLine?: number | undefined;
197
- endColumn?: number | undefined;
198
149
  } | null;
199
150
  openingElementRange: {
200
151
  start: number;
201
152
  end: number;
202
- startLine?: number | undefined;
203
- startColumn?: number | undefined;
204
- endLine?: number | undefined;
205
- endColumn?: number | undefined;
206
153
  };
207
154
  version: {
208
155
  documentVersion: number;
209
156
  contentHash: string;
210
- parserVersion: string;
211
157
  };
212
158
  diagnostics: {
213
159
  code: "missing-class-name" | "unsupported-attribute-name" | "source-locator-warning" | "invalid-new-attr" | "version-conflict" | "write-failed";
214
160
  message: string;
215
161
  }[];
216
- styleContext?: {
217
- revision: string;
218
- entryCss: {
219
- path: string;
220
- content: string;
221
- hash?: string | undefined;
222
- };
223
- stylesheets: {
224
- path: string;
225
- content: string;
226
- hash?: string | undefined;
227
- }[];
228
- computedStyle?: Record<string, string> | undefined;
229
- } | undefined;
162
+ computedStyle?: Record<string, string> | undefined;
230
163
  };
231
164
  };
232
165
  getSourceTree(): Promise<{
@@ -285,19 +218,23 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
285
218
  };
286
219
  };
287
220
  refreshSourceForKey(key: string, routeId?: string): Promise<void>;
288
- executeOperation(request: Parameters<PreviewSiteEditEngineRuntime["executeOperation"]>[0]): Promise<SiteEditOperationCommandResult>;
289
- undo(): Promise<{
221
+ executeOperation(request: Parameters<PreviewSiteEditEngineRuntime["executeOperation"]>[0], mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
222
+ undo(_mutationContext?: SiteEditMutationContext): Promise<{
290
223
  ok: false;
291
224
  error: {
292
- code: "NODE_NOT_FOUND" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "VERSION_STALE" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "INTERNAL_ERROR";
225
+ code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR";
293
226
  message: string;
294
227
  };
295
228
  data: {
296
229
  requestId: string;
297
- kind: "update-text" | "update-array-item" | "remove-node" | "insert-child" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
230
+ kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
298
231
  target: {
299
232
  kind: "node";
300
233
  key: string;
234
+ } | {
235
+ kind: "page-unit";
236
+ routeId: string;
237
+ placementUnitKey: string;
301
238
  } | {
302
239
  kind: "route";
303
240
  routeId: string;
@@ -314,10 +251,14 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
314
251
  ok: true;
315
252
  data: {
316
253
  requestId: string;
317
- kind: "update-text" | "update-array-item" | "remove-node" | "insert-child" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
254
+ kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
318
255
  target: {
319
256
  kind: "node";
320
257
  key: string;
258
+ } | {
259
+ kind: "page-unit";
260
+ routeId: string;
261
+ placementUnitKey: string;
321
262
  } | {
322
263
  kind: "route";
323
264
  routeId: string;
@@ -338,18 +279,22 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
338
279
  };
339
280
  error?: undefined;
340
281
  }>;
341
- redo(): Promise<{
282
+ redo(_mutationContext?: SiteEditMutationContext): Promise<{
342
283
  ok: false;
343
284
  error: {
344
- code: "NODE_NOT_FOUND" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "VERSION_STALE" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "INTERNAL_ERROR";
285
+ code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR";
345
286
  message: string;
346
287
  };
347
288
  data: {
348
289
  requestId: string;
349
- kind: "update-text" | "update-array-item" | "remove-node" | "insert-child" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
290
+ kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
350
291
  target: {
351
292
  kind: "node";
352
293
  key: string;
294
+ } | {
295
+ kind: "page-unit";
296
+ routeId: string;
297
+ placementUnitKey: string;
353
298
  } | {
354
299
  kind: "route";
355
300
  routeId: string;
@@ -366,10 +311,14 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
366
311
  ok: true;
367
312
  data: {
368
313
  requestId: string;
369
- kind: "update-text" | "update-array-item" | "remove-node" | "insert-child" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
314
+ kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit";
370
315
  target: {
371
316
  kind: "node";
372
317
  key: string;
318
+ } | {
319
+ kind: "page-unit";
320
+ routeId: string;
321
+ placementUnitKey: string;
373
322
  } | {
374
323
  kind: "route";
375
324
  routeId: string;
@@ -14,6 +14,8 @@ export interface SiteEditProjectFileSystem {
14
14
  readFileBytes?(file: string): Promise<Uint8Array>;
15
15
  getFileInfo?(file: string): Promise<SiteEditProjectFileInfo | null>;
16
16
  writeFile(file: string, content: string): Promise<void>;
17
+ /** Atomically creates a new file and fails when the target already exists. */
18
+ createExclusive?(file: string, content: string): Promise<void>;
17
19
  deleteFile(file: string): Promise<void>;
18
20
  exists(file: string): Promise<boolean>;
19
21
  listFiles?(input?: {
@@ -1,4 +1,6 @@
1
- import type { SiteEditOperationRequest, SiteEditOperationResult, SiteEditOperationType, SiteEditRenderDocument } from "@vcp-dev/contracts";
1
+ import type { SiteEditOperationRequest, SiteEditOperationResult, SiteEditOperationType } from "@vcp-dev/contracts";
2
+ import type { RenderDocument as SiteEditRenderDocument, RenderEntry as SiteEditRenderEntry } from "./internal/protocol.js";
3
+ export type { SiteEditRenderDocument, SiteEditRenderEntry };
2
4
  export declare const DEFAULT_SITE_EDIT_RUNTIME_READY_TIMEOUT_MS = 1500;
3
5
  export declare const SITE_EDIT_RUNTIME_READY_POLL_INTERVAL_MS = 16;
4
6
  export declare const SITE_EDIT_RUNTIME_ATTRIBUTES: {
package/dist/runtime.d.ts CHANGED
@@ -12,59 +12,58 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
12
12
  snapshotId: string;
13
13
  routeId: string;
14
14
  version: number;
15
- rootKeys: string[];
16
15
  entries: {
17
16
  key: string;
18
- tag: string;
19
- label: string;
20
- parentKey: string | null;
21
- childKeys: string[];
22
17
  operationSummary: {
23
18
  canUpdateText: boolean;
24
19
  canInsertChild: boolean;
25
20
  canMove: boolean;
26
21
  canRemove: boolean;
27
22
  };
23
+ pageCompositionUnitKey?: string | undefined;
28
24
  }[];
25
+ pageComposition: {
26
+ status: "supported";
27
+ containerKey: string;
28
+ hasBusinessMembers: boolean;
29
+ placementUnitKeys: string[];
30
+ placements: {
31
+ placementKey: string;
32
+ placementUnitKey: string;
33
+ relation: "before" | "after" | "prepend" | "append";
34
+ }[];
35
+ } | {
36
+ status: "unsupported";
37
+ reason: "VERSION_STALE" | "RECOVERY_REQUIRED" | "MULTIPLE_PAGE_RETURNS" | "INDIRECT_RETURN_ONLY" | "PAGE_CONTAINER_AMBIGUOUS" | "NO_SAFE_PAGE_PLACEMENT" | "MEMBER_NOT_INDEPENDENT" | "UNSUPPORTED_ROUTE_STRUCTURE" | "RUNTIME_ANCHOR_UNRESOLVED" | "ROUTE_RETURN_NOT_FOUND";
38
+ diagnostics: {
39
+ code: string;
40
+ message: string;
41
+ }[];
42
+ };
29
43
  };
30
- getObjectSummary(key: string, routeId?: string): {
44
+ getStyleContext(routeId: string): {
45
+ revision: string;
46
+ entryCss: {
47
+ path: string;
48
+ content: string;
49
+ hash?: string | undefined;
50
+ };
51
+ stylesheets: {
52
+ path: string;
53
+ content: string;
54
+ hash?: string | undefined;
55
+ }[];
56
+ } | null;
57
+ getObjectEditContext(key: string, routeId?: string): {
31
58
  key: string;
32
59
  tag: string;
33
60
  label: string;
34
- capabilities: {
35
- constraints: {
36
- kind: "component-boundary" | "repeat-region" | "conditional-region" | "opaque-region" | "void-element" | "read-only" | "cross-file-required" | "import-required";
37
- message: string;
38
- }[];
39
- };
40
61
  isOpaque: boolean;
41
62
  ancestors: {
42
63
  key: string;
43
64
  label: string;
44
65
  tag: string;
45
66
  }[];
46
- sourceLocator?: {
47
- sourceFile: string;
48
- componentName: string;
49
- openingElementRange: {
50
- startLine: number;
51
- startColumn: number;
52
- endLine: number;
53
- endColumn: number;
54
- };
55
- structuralPath: string;
56
- textPreview?: string | undefined;
57
- } | undefined;
58
- provenanceChain?: {
59
- editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
60
- diagnostics: {
61
- code: string;
62
- message: string;
63
- }[];
64
- } | undefined;
65
- };
66
- getObjectEditContext(key: string, routeId?: string): {
67
- key: string;
68
67
  componentName: string;
69
68
  sourceFile: string;
70
69
  capabilities: {
@@ -96,68 +95,31 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
96
95
  } | undefined;
97
96
  } | undefined;
98
97
  };
99
- writeTarget: {
100
- kind: "jsx-node" | "component-proxy" | "value-binding" | "route-export";
101
- file: string;
102
- componentName: string;
103
- isProxy: boolean;
104
- };
105
98
  textSegments: {
106
99
  index: number;
107
- value: string;
108
100
  editable: boolean;
109
- source: {
110
- kind: "literal" | "binding" | "imported-binding" | "repeat-template";
111
- file: string;
112
- expression: string;
113
- bindingName?: string | undefined;
114
- path?: (string | number)[] | undefined;
115
- } | null;
101
+ sourceKind: "literal" | "binding" | "imported-binding" | "repeat-template" | null;
116
102
  }[];
117
103
  boundaryKind: "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region" | null;
118
- children: {
119
- key: string;
120
- label: string;
121
- tag: string;
122
- }[];
123
- siblings: {
124
- key: string;
125
- label: string;
126
- tag: string;
127
- }[];
128
- effectiveWriteTarget?: {
129
- kind: "jsx-node" | "route-export" | "value-path" | "external-entry";
130
- isProxy: boolean;
131
- file?: string | undefined;
132
- displayPath?: string | undefined;
133
- sourceType?: "api-field" | "cms-field" | "i18n-message" | "config-entry" | undefined;
134
- sourceId?: string | undefined;
104
+ sourceLocator?: {
105
+ sourceFile: string;
106
+ componentName: string;
107
+ openingElementRange: {
108
+ startLine: number;
109
+ startColumn: number;
110
+ endLine: number;
111
+ endColumn: number;
112
+ };
113
+ structuralPath: string;
114
+ textPreview?: string | undefined;
135
115
  } | undefined;
136
116
  provenanceChain?: {
137
- finalSource: {
138
- kind: "api-field" | "cms-field" | "i18n-message" | "config-entry" | "binding" | "imported-binding" | "repeat-template" | "jsx-literal" | "component-prop" | "object-field" | "array-item" | "conditional-branch";
139
- file: string;
140
- displayPath: string;
141
- externalSource?: {
142
- sourceType: "api-field" | "cms-field" | "i18n-message" | "config-entry";
143
- sourceId: string;
144
- adapterId?: string | undefined;
145
- } | undefined;
146
- } | null;
147
- chain: {
148
- kind: "api-field" | "cms-field" | "i18n-message" | "config-entry" | "binding" | "imported-binding" | "repeat-template" | "jsx-literal" | "component-prop" | "object-field" | "array-item" | "conditional-branch";
149
- file: string;
150
- displayName: string;
151
- canEditHere: boolean;
152
- }[];
153
- confidence: "exact" | "safe-derived" | "partial" | "unknown";
154
117
  editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
155
118
  diagnostics: {
156
119
  code: string;
157
120
  message: string;
158
121
  }[];
159
122
  } | undefined;
160
- componentSemantic?: Record<string, unknown> | undefined;
161
123
  };
162
124
  getClassNameSource(key: string, routeId?: string): {
163
125
  key: string;
@@ -170,50 +132,20 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
170
132
  attrRange: {
171
133
  start: number;
172
134
  end: number;
173
- startLine?: number | undefined;
174
- startColumn?: number | undefined;
175
- endLine?: number | undefined;
176
- endColumn?: number | undefined;
177
- } | null;
178
- valueRange: {
179
- start: number;
180
- end: number;
181
- startLine?: number | undefined;
182
- startColumn?: number | undefined;
183
- endLine?: number | undefined;
184
- endColumn?: number | undefined;
185
135
  } | null;
186
136
  openingElementRange: {
187
137
  start: number;
188
138
  end: number;
189
- startLine?: number | undefined;
190
- startColumn?: number | undefined;
191
- endLine?: number | undefined;
192
- endColumn?: number | undefined;
193
139
  };
194
140
  version: {
195
141
  documentVersion: number;
196
142
  contentHash: string;
197
- parserVersion: string;
198
143
  };
199
144
  diagnostics: {
200
145
  code: "missing-class-name" | "unsupported-attribute-name" | "source-locator-warning" | "invalid-new-attr" | "version-conflict" | "write-failed";
201
146
  message: string;
202
147
  }[];
203
- styleContext?: {
204
- revision: string;
205
- entryCss: {
206
- path: string;
207
- content: string;
208
- hash?: string | undefined;
209
- };
210
- stylesheets: {
211
- path: string;
212
- content: string;
213
- hash?: string | undefined;
214
- }[];
215
- computedStyle?: Record<string, string> | undefined;
216
- } | undefined;
148
+ computedStyle?: Record<string, string> | undefined;
217
149
  };
218
150
  getSourceTree(): Promise<{
219
151
  nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { SiteEditCommandSuccess, SiteEditEvent, SiteEditGetClassNameSourceCommandResult, SiteEditGetClassNameSourceResult, SiteEditObjectEditContext, SiteEditObjectSummary, SiteEditOperationCommandResult, SiteEditOperationRequest, SiteEditPatchPlan, SiteEditRenderDocument, SiteEditResolveSourceLocationInput, SiteEditSourceFileResponse, SiteEditSourceLocation, SiteEditSourceTreeResponse } from "@vcp-dev/contracts";
1
+ import type { SiteEditCommandSuccess, SiteEditEvent, SiteEditGetClassNameSourceCommandResult, SiteEditGetClassNameSourceResult, SiteEditClassNameSourceStyleContext, SiteEditObjectEditContext, SiteEditOperationCommandResult, SiteEditMutationContext, SiteEditOperationRequest, SiteEditPatchPlan, SiteEditRenderDocument, SiteEditResolveSourceLocationInput, SiteEditSourceFileResponse, SiteEditSourceLocation, SiteEditSourceTreeResponse } from "@vcp-dev/contracts";
2
2
  import type { SiteEditProjectFileSystem } from "./public-file-system.js";
3
+ import type { FileHistoryStore } from "./history/file-history-store.js";
3
4
  export type { SiteEditProjectFileSystem } from "./public-file-system.js";
4
5
  export interface SiteEditSnapshotFile {
5
6
  path: string;
@@ -11,22 +12,31 @@ export interface SiteEditEngineRoute {
11
12
  entryFile: string;
12
13
  }
13
14
  export interface SiteEditEngineRuntimeOptions {
15
+ tenantId?: string;
14
16
  siteId: string;
15
17
  snapshotId: string;
16
18
  files: SiteEditSnapshotFile[];
17
19
  routes: SiteEditEngineRoute[];
18
20
  onEvent?: (event: SiteEditEvent) => void;
19
21
  dev?: boolean;
22
+ historyStore?: FileHistoryStore;
20
23
  }
21
24
  export interface SiteEditPlanOperationResult {
22
25
  result: SiteEditOperationCommandResult;
23
26
  patchPlan?: SiteEditPatchPlan;
24
27
  }
28
+ export interface SiteEditEngineHistoryStatus {
29
+ readonly canUndo: boolean;
30
+ readonly canRedo: boolean;
31
+ readonly undoDepth: number;
32
+ readonly redoDepth: number;
33
+ readonly recoveryRequired: boolean;
34
+ }
25
35
  export interface SiteEditEngineRuntime {
26
36
  readonly status: "idle" | "building" | "ready" | "disposed";
27
37
  setActiveRoute(routeId: string): Promise<void>;
28
38
  getDocument(routeId: string): SiteEditRenderDocument;
29
- getObjectSummary(key: string, routeId?: string): SiteEditObjectSummary;
39
+ getStyleContext(routeId: string): SiteEditClassNameSourceStyleContext | null;
30
40
  getObjectEditContext(key: string, routeId?: string): SiteEditObjectEditContext;
31
41
  getClassNameSource(key: string, routeId?: string): SiteEditGetClassNameSourceResult;
32
42
  getSourceTree(): Promise<SiteEditSourceTreeResponse>;
@@ -38,6 +48,7 @@ export interface SiteEditEngineRuntime {
38
48
  dispose(): void;
39
49
  }
40
50
  export interface PreviewSiteEditEngineRuntimeOptions {
51
+ tenantId?: string;
41
52
  siteId: string;
42
53
  snapshotId: string;
43
54
  projectRoot: string;
@@ -45,6 +56,9 @@ export interface PreviewSiteEditEngineRuntimeOptions {
45
56
  onEvent?: (event: SiteEditEvent) => void;
46
57
  dev?: boolean;
47
58
  fileSystem?: SiteEditProjectFileSystem;
59
+ historyStore?: FileHistoryStore;
60
+ /** Preserves monotonic document versions when a Bridge swaps runtimes. */
61
+ initialDocumentVersion?: number;
48
62
  }
49
63
  export interface PreviewSiteEditEngineRuntime {
50
64
  readonly status: "idle" | "building" | "ready" | "error" | "disposed";
@@ -52,7 +66,8 @@ export interface PreviewSiteEditEngineRuntime {
52
66
  unregisterRoute(routeId: string): void;
53
67
  setActiveRoute(routeId: string): Promise<void>;
54
68
  getDocument(routeId: string): SiteEditCommandSuccess<SiteEditRenderDocument>;
55
- getObjectSummary(key: string, routeId?: string): SiteEditCommandSuccess<SiteEditObjectSummary>;
69
+ getStyleContext(routeId: string): SiteEditCommandSuccess<SiteEditClassNameSourceStyleContext | null>;
70
+ getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
56
71
  getObjectEditContext(key: string, routeId?: string): SiteEditCommandSuccess<SiteEditObjectEditContext>;
57
72
  getClassNameSource(key: string, routeId?: string): SiteEditGetClassNameSourceCommandResult;
58
73
  getSourceTree(): Promise<SiteEditCommandSuccess<SiteEditSourceTreeResponse>>;
@@ -61,9 +76,9 @@ export interface PreviewSiteEditEngineRuntime {
61
76
  }): Promise<SiteEditCommandSuccess<SiteEditSourceFileResponse>>;
62
77
  resolveSourceLocation(input: SiteEditResolveSourceLocationInput): SiteEditCommandSuccess<SiteEditSourceLocation>;
63
78
  refreshSourceForKey(key: string, routeId?: string): Promise<void>;
64
- executeOperation(request: SiteEditOperationRequest): Promise<SiteEditOperationCommandResult>;
65
- undo(): Promise<SiteEditOperationCommandResult>;
66
- redo(): Promise<SiteEditOperationCommandResult>;
79
+ executeOperation(request: SiteEditOperationRequest, mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
80
+ undo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
81
+ redo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
67
82
  notifyFileChanged(file: string): void;
68
83
  subscribe(listener: (event: SiteEditEvent) => void): () => void;
69
84
  dispose(): void;