@vcp-dev/site-edit-engine 0.10.69 → 0.11.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.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,2897 @@
1
- export { parseSourceModule, resolveImportBase } from "./source-module.js";
2
- export { checkComponentI18nHostCompatibility } from "./component-i18n-host-compatibility.js";
3
- export { instrumentSiteEditRuntimeAttributes } from "./site-edit-instrumentation.js";
4
- export { createSiteEditEngineRuntime, SnapshotSiteEditEngineRuntime, } from "./runtime.js";
5
- export { createPreviewSiteEditEngineRuntime, PreviewFileSystemSiteEditEngineRuntime, } from "./preview-runtime.js";
6
- export { scanSiteEditThemeStyleViolations, SITE_EDIT_RAW_COLOR_LITERAL_RE, } from "./materialization-style-policy.js";
7
- export type { SiteEditColorMixPolicy, SiteEditThemeStyleScanOptions, SiteEditThemeStyleViolations, SiteEditThemeSurfaceOccurrence, } from "./materialization-style-policy.js";
8
- export type { PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions, SiteEditProjectFileSystem, SiteEditEngineRoute, SiteEditEngineHistoryStatus, SiteEditEngineRuntime, SiteEditEngineRuntimeOptions, SiteEditPlanOperationResult, SiteEditSnapshotFile, } from "./types.js";
9
- export { FileHistoryStoreError, openFileHistoryStore, } from "./history/index.js";
10
- export { computeManagedPageTemplatePaths, encodePageTemplateId, decodePageTemplateKey, isManagedPageTemplateSourcePath, scanManagedPageTemplateCandidates, resolveManagedPageTemplateComposition, scanSiteEditCompositionsFromFiles, PageTemplateManagedSourceError, } from "./page-template-managed-source.js";
11
- export type { ManagedPageTemplateCompositionResolution, ManagedPageTemplatePaths, ManagedPageTemplateCandidate, PageTemplateAppRoot, PageTemplateCompositionSelector, PageTemplateManagedSourceErrorCode, PageTemplateManagedSourceErrorDetails, SiteEditEngineComposition, SiteEditFileSystem, SiteEditManagedSourceFiles, } from "./page-template-managed-source.js";
12
- export type { FileHistoryAppendInput, FileHistoryBlobInput, FileHistoryBlobRef, FileHistoryEntryRecord, FileHistoryIndexSnapshot, FileHistoryIndexTransition, FileHistoryStageResult, FileHistoryStore, FileHistoryStoreErrorCode, FileHistoryStoreLimits, FileHistoryStoreOptions, FileHistoryTransactionJournal, FileHistoryTransactionJournalFile, FileHistoryUndoRedoResult, JsonValue, Sha256Digest, } from "./history/index.js";
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { File as File$1 } from '@babel/types';
4
+ import { BlockDirectory, BlockRenderRef, GeneratedSiteCapabilities, PortableCollectionRecipeFacts, PortableCollectionViewReference, PortableInvocationBinding, PortableJsonValue, ResolvedField, SiteEditClassNameSourceStyleContext, SiteEditCommandSuccess, SiteEditCompositionContext, SiteEditCompositionSelector, SiteEditEvent, SiteEditGetClassNameSourceCommandResult, SiteEditGetClassNameSourceResult, SiteEditMaterialization, SiteEditMaterializationExport, SiteEditMutationContext, SiteEditObjectEditContext, SiteEditOperationCommandResult, SiteEditOperationRequest, SiteEditOperationSelectionRef, SiteEditPageBlockDescriptor, SiteEditPageBlockPosition, SiteEditPageBlockTarget, SiteEditPageCompositionErrorCode, SiteEditPatchPlan, SiteEditRenderDocument, SiteEditResolveSourceLocationInput, SiteEditSourceFileResponse, SiteEditSourceLocation, SiteEditSourceTreeResponse } from '@vcp-dev/contracts';
5
+
6
+ type SiteEditSourceModuleResult = {
7
+ ok: true;
8
+ module: {
9
+ readonly file: string;
10
+ readonly source: string;
11
+ readonly sourceHash: string;
12
+ readonly ast: File$1;
13
+ readonly imports: readonly {
14
+ readonly specifier: string;
15
+ }[];
16
+ };
17
+ } | {
18
+ ok: false;
19
+ diagnostic: {
20
+ path: string;
21
+ code: "parse-failed" | "import-resolve-failed" | "import-not-found" | "import-read-failed";
22
+ message: string;
23
+ details?: Record<string, unknown>;
24
+ };
25
+ };
26
+ export declare function parseSourceModule(file: string, source: string): SiteEditSourceModuleResult;
27
+ export declare function resolveImportBase(fromFile: string, specifier: string): string;
28
+ type ComponentI18nHostCompatibilityResult = {
29
+ ok: true;
30
+ } | {
31
+ ok: false;
32
+ message: string;
33
+ };
34
+ export declare function checkComponentI18nHostCompatibility(input: {
35
+ files: readonly {
36
+ path: string;
37
+ content: string;
38
+ }[];
39
+ exists: (path: string) => Promise<boolean>;
40
+ readFile: (path: string) => Promise<string>;
41
+ /** Working Set preparation only; schema/dependency/provider guards stay on. */
42
+ deferTargetLocale?: boolean;
43
+ /** When supplied, the host must agree with the authoritative site language. */
44
+ targetLocale?: string;
45
+ }): Promise<ComponentI18nHostCompatibilityResult>;
46
+ interface SourceIdentity {
47
+ /** 源文件相对路径,如 "src/app/page.tsx" */
48
+ file: string;
49
+ /** 所属组件名,如 "HomePage" */
50
+ component: string;
51
+ /** 结构化路径,如 "div#0/span#1" */
52
+ structuralPath: string;
53
+ /** 唯一 key = "{file}::{component}::{structuralPath}" */
54
+ key: string;
55
+ }
56
+ type BoundaryKind = "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region";
57
+ declare const SITE_EDIT_RUNTIME_ATTRIBUTES: {
58
+ readonly key: "data-vcp-edit-key";
59
+ readonly parentKey: "data-vcp-edit-parent-key";
60
+ readonly movable: "data-vcp-movable";
61
+ readonly removable: "data-vcp-removable";
62
+ readonly flags: "data-vcp-flags";
63
+ readonly publicUiComponent: "data-vcp-ui-component";
64
+ };
65
+ type SiteEditRuntimeAttributes = {
66
+ readonly [key in keyof typeof SITE_EDIT_RUNTIME_ATTRIBUTES]: string;
67
+ };
68
+ type SiteEditInstrumentationOptions = {
69
+ source: string;
70
+ file: string;
71
+ projectRoot?: string;
72
+ attributes?: SiteEditRuntimeAttributes;
73
+ };
74
+ type SiteEditInstrumentedElement = {
75
+ key: string;
76
+ tag: string;
77
+ componentName: string;
78
+ sourceFile: string;
79
+ sourceKind: "jsx" | "component-call";
80
+ };
81
+ type SiteEditInstrumentationResult = {
82
+ code: string;
83
+ elements: SiteEditInstrumentedElement[];
84
+ };
85
+ export declare function instrumentSiteEditRuntimeAttributes(options: SiteEditInstrumentationOptions): SiteEditInstrumentationResult;
86
+ type SiteEditProjectFileInfo = {
87
+ path: string;
88
+ sizeBytes: number;
89
+ };
90
+ type SiteEditProjectFileListTruncationReason = "max-files" | "max-depth" | "max-total-bytes";
91
+ type SiteEditProjectFileListResult = {
92
+ files: SiteEditProjectFileInfo[];
93
+ truncated?: {
94
+ reasons: SiteEditProjectFileListTruncationReason[];
95
+ };
96
+ };
97
+ export interface SiteEditProjectFileSystem {
98
+ readFile(file: string): Promise<string>;
99
+ readFileBytes?(file: string): Promise<Uint8Array>;
100
+ getFileInfo?(file: string): Promise<SiteEditProjectFileInfo | null>;
101
+ writeFile(file: string, content: string): Promise<void>;
102
+ /** Atomically creates a new file and fails when the target already exists. */
103
+ createExclusive?(file: string, content: string): Promise<void>;
104
+ deleteFile(file: string): Promise<void>;
105
+ exists(file: string): Promise<boolean>;
106
+ listFiles?(input?: {
107
+ roots?: string[];
108
+ maxFiles?: number;
109
+ maxDepth?: number;
110
+ maxTotalBytes?: number;
111
+ }): Promise<SiteEditProjectFileInfo[] | SiteEditProjectFileListResult>;
112
+ getVersion(file: string): number;
113
+ bumpVersion(file: string): number;
114
+ }
115
+ export type Sha256Digest = `sha256:${string}`;
116
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
117
+ [key: string]: JsonValue;
118
+ };
119
+ export interface FileHistoryBlobInput {
120
+ readonly name: string;
121
+ readonly data: string | Uint8Array;
122
+ }
123
+ export interface FileHistoryAppendInput {
124
+ readonly kind: string;
125
+ readonly manifest: JsonValue;
126
+ readonly blobs?: ReadonlyArray<FileHistoryBlobInput>;
127
+ }
128
+ export interface FileHistoryBlobRef {
129
+ readonly name: string;
130
+ readonly digest: Sha256Digest;
131
+ readonly sizeBytes: number;
132
+ }
133
+ export interface FileHistoryEntryRecord {
134
+ readonly id: Sha256Digest;
135
+ readonly schemaVersion: 1;
136
+ readonly kind: string;
137
+ readonly manifest: JsonValue;
138
+ readonly blobs: ReadonlyArray<FileHistoryBlobRef>;
139
+ }
140
+ export interface FileHistoryIndexSnapshot {
141
+ readonly schemaVersion: 1;
142
+ readonly digest: Sha256Digest;
143
+ readonly entryIds: ReadonlyArray<Sha256Digest>;
144
+ readonly cursor: number;
145
+ readonly currentId: Sha256Digest | null;
146
+ readonly undoIds: ReadonlyArray<Sha256Digest>;
147
+ readonly redoIds: ReadonlyArray<Sha256Digest>;
148
+ readonly totalBytes: number;
149
+ }
150
+ export interface FileHistoryStageResult {
151
+ readonly stageId: string;
152
+ readonly entryId: Sha256Digest;
153
+ readonly blobIds: ReadonlyArray<Sha256Digest>;
154
+ }
155
+ export interface FileHistoryIndexTransition {
156
+ readonly expectedIndexDigest: Sha256Digest;
157
+ readonly publishedIndexDigest: Sha256Digest;
158
+ readonly publishedCursor: number;
159
+ readonly publishedCurrentId: Sha256Digest | null;
160
+ }
161
+ export interface FileHistoryStoreLimits {
162
+ readonly maxEntries: number;
163
+ readonly maxSessionBytes: number;
164
+ readonly maxEntryBytes: number;
165
+ }
166
+ export interface FileHistoryStoreOptions {
167
+ readonly limits?: Partial<FileHistoryStoreLimits>;
168
+ }
169
+ interface FileHistoryStageOptions {
170
+ readonly durableManifest?: boolean;
171
+ }
172
+ interface FileHistoryStatus {
173
+ readonly canUndo: boolean;
174
+ readonly canRedo: boolean;
175
+ readonly undoDepth: number;
176
+ readonly redoDepth: number;
177
+ readonly cursor: number;
178
+ readonly recoveryRequired: boolean;
179
+ }
180
+ export interface FileHistoryUndoRedoResult {
181
+ readonly undoIds: ReadonlyArray<Sha256Digest>;
182
+ readonly redoIds: ReadonlyArray<Sha256Digest>;
183
+ readonly currentId: Sha256Digest | null;
184
+ }
185
+ export interface FileHistoryTransactionJournalFile {
186
+ readonly path: string;
187
+ readonly preDigest: Sha256Digest | null;
188
+ readonly postDigest: Sha256Digest | null;
189
+ }
190
+ export interface FileHistoryTransactionJournal {
191
+ readonly schemaVersion: 2;
192
+ readonly transactionId: string;
193
+ readonly operationId: string;
194
+ readonly phase: "prepared" | "files-written" | "history-published";
195
+ readonly historyTransition: FileHistoryIndexTransition;
196
+ readonly files: ReadonlyArray<FileHistoryTransactionJournalFile>;
197
+ }
198
+ export interface FileHistoryStore {
199
+ readonly rootDir: string;
200
+ readonly recoveryRequired: boolean;
201
+ stageAppend(input: FileHistoryAppendInput, options?: FileHistoryStageOptions): Promise<FileHistoryStageResult>;
202
+ discardStage(stageId: string): Promise<void>;
203
+ previewStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
204
+ previewCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
205
+ publishStagedAppend(entryId: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
206
+ publishStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest, stageId?: string): Promise<FileHistoryIndexSnapshot>;
207
+ append(input: FileHistoryAppendInput): Promise<FileHistoryIndexSnapshot>;
208
+ readEntry(entryId: Sha256Digest): Promise<FileHistoryEntryRecord>;
209
+ readBlob(blobId: Sha256Digest): Promise<Uint8Array>;
210
+ readIndex(): Promise<FileHistoryIndexSnapshot>;
211
+ readStatus(): Promise<FileHistoryStatus>;
212
+ readUndoRedoIds(): Promise<FileHistoryUndoRedoResult>;
213
+ setCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
214
+ markRecoveryRequired(reason: string): Promise<void>;
215
+ clearRecoveryRequired(): Promise<void>;
216
+ readTransactionJournal(): Promise<FileHistoryTransactionJournal | null>;
217
+ writeTransactionJournal(journal: FileHistoryTransactionJournal): Promise<void>;
218
+ clearTransactionJournal(transactionId: string): Promise<void>;
219
+ cleanupTmp(): Promise<void>;
220
+ readDocumentVersion?(): Promise<number>;
221
+ writeDocumentVersion?(version: number): Promise<void>;
222
+ }
223
+ declare const HISTORY_ERROR_CODES: {
224
+ readonly INVALID_ROOT: "INVALID_ROOT";
225
+ readonly INVALID_PATH: "INVALID_PATH";
226
+ readonly INVALID_SCHEMA: "INVALID_SCHEMA";
227
+ readonly INVALID_JSON: "INVALID_JSON";
228
+ readonly INDEX_CORRUPT: "INDEX_CORRUPT";
229
+ readonly ENTRY_CORRUPT: "ENTRY_CORRUPT";
230
+ readonly BLOB_CORRUPT: "BLOB_CORRUPT";
231
+ readonly RECOVERY_PENDING: "RECOVERY_PENDING";
232
+ readonly CAPACITY_EXCEEDED: "CAPACITY_EXCEEDED";
233
+ readonly NOT_FOUND: "NOT_FOUND";
234
+ };
235
+ export type FileHistoryStoreErrorCode = (typeof HISTORY_ERROR_CODES)[keyof typeof HISTORY_ERROR_CODES];
236
+ export declare class FileHistoryStoreError extends Error {
237
+ readonly code: FileHistoryStoreErrorCode;
238
+ constructor(code: FileHistoryStoreErrorCode, message: string, options?: {
239
+ cause?: unknown;
240
+ });
241
+ }
242
+ export declare function openFileHistoryStore(rootDir: string, options?: FileHistoryStoreOptions): Promise<FileHistoryStore>;
243
+ export interface SiteEditSnapshotFile {
244
+ path: string;
245
+ content: string;
246
+ version?: number;
247
+ }
248
+ export interface SiteEditEngineRoute {
249
+ routeId: string;
250
+ entryFile: string;
251
+ }
252
+ interface SiteEditEngineComposition {
253
+ context: SiteEditCompositionContext;
254
+ entryFile: string;
255
+ }
256
+ export interface SiteEditEngineRuntimeOptions {
257
+ tenantId?: string;
258
+ siteId: string;
259
+ snapshotId: string;
260
+ files: SiteEditSnapshotFile[];
261
+ compositions: readonly SiteEditEngineComposition[];
262
+ onEvent?: (event: SiteEditEvent) => void;
263
+ dev?: boolean;
264
+ historyStore?: FileHistoryStore;
265
+ initialDocumentVersions?: readonly {
266
+ composition: SiteEditCompositionContext;
267
+ version: number;
268
+ }[];
269
+ /** Server resource Working Set only: defer missing translations until Agent validation. */
270
+ resourceTranslationLocale?: string;
271
+ }
272
+ export interface SiteEditPlanOperationResult {
273
+ result: SiteEditOperationCommandResult;
274
+ patchPlan?: SiteEditPatchPlan;
275
+ }
276
+ export interface SiteEditEngineHistoryStatus {
277
+ readonly canUndo: boolean;
278
+ readonly canRedo: boolean;
279
+ readonly undoDepth: number;
280
+ readonly redoDepth: number;
281
+ readonly recoveryRequired: boolean;
282
+ }
283
+ export interface SiteEditEngineRuntime {
284
+ readonly status: "idle" | "building" | "ready" | "disposed";
285
+ initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
286
+ getDocument(composition: SiteEditCompositionSelector): SiteEditRenderDocument;
287
+ getStyleContext(composition: SiteEditCompositionSelector): SiteEditClassNameSourceStyleContext | null;
288
+ getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): SiteEditObjectEditContext;
289
+ getClassNameSource(key: string, composition: SiteEditCompositionSelector): SiteEditGetClassNameSourceResult;
290
+ getSourceTree(composition: SiteEditCompositionSelector): Promise<SiteEditSourceTreeResponse>;
291
+ getSourceFile(input: {
292
+ path: string;
293
+ composition: SiteEditCompositionSelector;
294
+ }): Promise<SiteEditSourceFileResponse>;
295
+ resolveSourceLocation(input: SiteEditResolveSourceLocationInput): SiteEditSourceLocation;
296
+ planOperation(request: SiteEditOperationRequest): Promise<SiteEditPlanOperationResult>;
297
+ dispose(): void;
298
+ }
299
+ export interface PreviewSiteEditEngineRuntimeOptions {
300
+ tenantId?: string;
301
+ siteId: string;
302
+ snapshotId: string;
303
+ projectRoot: string;
304
+ compositions: readonly SiteEditEngineComposition[];
305
+ onEvent?: (event: SiteEditEvent) => void;
306
+ dev?: boolean;
307
+ fileSystem?: SiteEditProjectFileSystem;
308
+ historyStore?: FileHistoryStore;
309
+ initialDocumentVersions?: readonly {
310
+ composition: SiteEditCompositionContext;
311
+ version: number;
312
+ }[];
313
+ }
314
+ export interface PreviewSiteEditEngineRuntime {
315
+ readonly status: "idle" | "building" | "ready" | "error" | "disposed";
316
+ initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
317
+ registerComposition(composition: SiteEditCompositionContext, entryFile: string): void;
318
+ unregisterComposition(composition: SiteEditCompositionSelector): void;
319
+ getDocument(composition: SiteEditCompositionSelector): SiteEditCommandSuccess<SiteEditRenderDocument>;
320
+ getStyleContext(composition: SiteEditCompositionSelector): SiteEditCommandSuccess<SiteEditClassNameSourceStyleContext | null>;
321
+ getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
322
+ getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): SiteEditCommandSuccess<SiteEditObjectEditContext>;
323
+ getClassNameSource(key: string, composition: SiteEditCompositionSelector): SiteEditGetClassNameSourceCommandResult;
324
+ getSourceTree(composition: SiteEditCompositionSelector): Promise<SiteEditCommandSuccess<SiteEditSourceTreeResponse>>;
325
+ getSourceFile(input: {
326
+ path: string;
327
+ composition: SiteEditCompositionSelector;
328
+ }): Promise<SiteEditCommandSuccess<SiteEditSourceFileResponse>>;
329
+ resolveSourceLocation(input: SiteEditResolveSourceLocationInput): SiteEditCommandSuccess<SiteEditSourceLocation>;
330
+ refreshSourceForKey(key: string, composition: SiteEditCompositionSelector): Promise<void>;
331
+ executeOperation(request: SiteEditOperationRequest, mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
332
+ undo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
333
+ redo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
334
+ notifyFileChanged(file: string): void;
335
+ subscribe(listener: (event: SiteEditEvent) => void): () => void;
336
+ dispose(): void;
337
+ }
338
+ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRuntime {
339
+ private readonly options;
340
+ private readonly engine;
341
+ private readonly fileSystem;
342
+ constructor(options: SiteEditEngineRuntimeOptions);
343
+ get status(): SiteEditEngineRuntime["status"];
344
+ initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
345
+ getDocument(composition: SiteEditCompositionSelector): {
346
+ siteId: string;
347
+ snapshotId: string;
348
+ composition: {
349
+ routeId: string;
350
+ effectiveTemplateId?: string | undefined;
351
+ };
352
+ version: number;
353
+ entries: {
354
+ key: string;
355
+ operationSummary: {
356
+ canUpdateText: boolean;
357
+ canInsertChild: boolean;
358
+ canMove: boolean;
359
+ canRemove: boolean;
360
+ };
361
+ parentKey?: string | null | undefined;
362
+ pageCompositionUnitKey?: string | undefined;
363
+ pageCompositionActionScope?: {
364
+ kind: "route-unit";
365
+ } | {
366
+ kind: "source-siblings";
367
+ siblingKeys: string[];
368
+ } | {
369
+ kind: "unavailable";
370
+ } | undefined;
371
+ dynamicDataSummary?: {
372
+ hasDynamicData: boolean;
373
+ sourceKinds: ("vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api")[];
374
+ collections?: string[] | undefined;
375
+ primaryEndpoint?: string | undefined;
376
+ primaryCollection?: string | undefined;
377
+ primaryFieldPath?: string | undefined;
378
+ } | undefined;
379
+ }[];
380
+ pageComposition: {
381
+ status: "supported";
382
+ containerKey: string;
383
+ hasBusinessMembers: boolean;
384
+ placementUnitKeys: string[];
385
+ placements: {
386
+ placementKey: string;
387
+ placementUnitKey: string;
388
+ relation: "before" | "after" | "prepend" | "append";
389
+ }[];
390
+ } | {
391
+ status: "unsupported";
392
+ 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";
393
+ diagnostics: {
394
+ code: string;
395
+ message: string;
396
+ }[];
397
+ };
398
+ pageBlocks?: readonly {
399
+ blockKey: string;
400
+ rootRef: {
401
+ key: string;
402
+ instanceIndex?: number | undefined;
403
+ instanceCount?: number | undefined;
404
+ };
405
+ definitionKey: string;
406
+ source: {
407
+ file: string;
408
+ structuralPath: string;
409
+ contentHash: string;
410
+ };
411
+ owner: {
412
+ kind: "route-member";
413
+ key: string;
414
+ } | {
415
+ kind: "component-definition";
416
+ key: string;
417
+ };
418
+ siblingBlockKeys: readonly string[];
419
+ capabilities: {
420
+ insert: boolean;
421
+ replace: boolean;
422
+ move: boolean;
423
+ remove: boolean;
424
+ save: boolean;
425
+ };
426
+ placementUnitKey?: string | undefined;
427
+ unavailableReasons?: Readonly<Record<string, {
428
+ code: string;
429
+ reason: string;
430
+ }>> | undefined;
431
+ }[] | undefined;
432
+ };
433
+ getStyleContext(composition: SiteEditCompositionSelector): {
434
+ composition: {
435
+ routeId: string;
436
+ effectiveTemplateId?: string | undefined;
437
+ };
438
+ revision: string;
439
+ entryCss: {
440
+ path: string;
441
+ content: string;
442
+ hash?: string | undefined;
443
+ };
444
+ stylesheets: {
445
+ path: string;
446
+ content: string;
447
+ hash?: string | undefined;
448
+ }[];
449
+ } | null;
450
+ getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): {
451
+ composition: {
452
+ routeId: string;
453
+ effectiveTemplateId?: string | undefined;
454
+ };
455
+ key: string;
456
+ tag: string;
457
+ label: string;
458
+ isOpaque: boolean;
459
+ ancestors: {
460
+ key: string;
461
+ label: string;
462
+ tag: string;
463
+ }[];
464
+ componentName: string;
465
+ sourceFile: string;
466
+ capabilities: {
467
+ composition: {
468
+ routeId: string;
469
+ effectiveTemplateId?: string | undefined;
470
+ };
471
+ key: string;
472
+ canUpdateText: boolean;
473
+ canInsertChild: boolean;
474
+ canMove: boolean;
475
+ canRemove: boolean;
476
+ constraints: {
477
+ kind: "component-boundary" | "repeat-region" | "conditional-region" | "opaque-region" | "void-element" | "read-only" | "cross-file-required" | "import-required";
478
+ message: string;
479
+ }[];
480
+ editModes?: {
481
+ updateText?: {
482
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
483
+ reasonCode?: string | undefined;
484
+ } | undefined;
485
+ insertChild?: {
486
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
487
+ reasonCode?: string | undefined;
488
+ } | undefined;
489
+ move?: {
490
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
491
+ reasonCode?: string | undefined;
492
+ } | undefined;
493
+ remove?: {
494
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
495
+ reasonCode?: string | undefined;
496
+ } | undefined;
497
+ } | undefined;
498
+ };
499
+ textSegments: {
500
+ index: number;
501
+ editable: boolean;
502
+ sourceKind: "literal" | "binding" | "imported-binding" | "repeat-template" | null;
503
+ }[];
504
+ boundaryKind: "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region" | null;
505
+ linkSourceKind?: "unsupported" | "native-anchor" | "next-link" | undefined;
506
+ sourceLocator?: {
507
+ sourceFile: string;
508
+ componentName: string;
509
+ openingElementRange: {
510
+ startLine: number;
511
+ startColumn: number;
512
+ endLine: number;
513
+ endColumn: number;
514
+ };
515
+ structuralPath: string;
516
+ textPreview?: string | undefined;
517
+ } | undefined;
518
+ provenanceChain?: {
519
+ editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
520
+ diagnostics: {
521
+ code: string;
522
+ message: string;
523
+ }[];
524
+ } | undefined;
525
+ dynamicData?: {
526
+ hasDynamicData: boolean;
527
+ bindings: {
528
+ sourceKind: "vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api";
529
+ sourceType: "api-field" | "cms-field";
530
+ targetKind: "repeat-region" | "conditional-region" | "text" | "attribute" | "richtext" | "component-prop";
531
+ targetName: string;
532
+ confidence: "exact" | "safe-derived" | "partial" | "unknown";
533
+ readonly: true;
534
+ evidence: {
535
+ file: string;
536
+ reason: string;
537
+ symbol?: string | undefined;
538
+ }[];
539
+ endpointPattern?: string | undefined;
540
+ operation?: string | undefined;
541
+ collection?: string | undefined;
542
+ fieldPath?: string | undefined;
543
+ valuePath?: string | undefined;
544
+ }[];
545
+ } | undefined;
546
+ properties?: {
547
+ documentVersion: number;
548
+ items: {
549
+ name: string;
550
+ source: {
551
+ kind: "expression" | "literal" | "binding" | "repeat-template" | "boolean-shorthand";
552
+ raw?: string | undefined;
553
+ };
554
+ resolution: {
555
+ status: "resolved";
556
+ value: import("@vcp-dev/contracts").SiteEditOperationValue;
557
+ } | {
558
+ status: "undefined";
559
+ } | {
560
+ status: "unresolved";
561
+ };
562
+ editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
563
+ sourceScope: "node" | "repeat-template" | "repeat-item";
564
+ allowedWriteScopes: ("template" | "selection")[];
565
+ diagnostics: {
566
+ code: string;
567
+ message: string;
568
+ }[];
569
+ effectiveWriteTarget?: {
570
+ kind: "jsx-node" | "route-export" | "value-path" | "external-entry";
571
+ isProxy: boolean;
572
+ file?: string | undefined;
573
+ displayPath?: string | undefined;
574
+ sourceType?: "api-field" | "cms-field" | "i18n-message" | "config-entry" | undefined;
575
+ sourceId?: string | undefined;
576
+ } | undefined;
577
+ }[];
578
+ spreads: {
579
+ raw: string;
580
+ sourceRange: {
581
+ start: number;
582
+ end: number;
583
+ };
584
+ order: number;
585
+ diagnostics: {
586
+ code: string;
587
+ message: string;
588
+ }[];
589
+ }[];
590
+ creation: {
591
+ selection: "direct" | "unsupported" | "materialize";
592
+ template: "direct" | "unsupported";
593
+ };
594
+ selectionRef?: {
595
+ key: string;
596
+ instanceIndex?: number | undefined;
597
+ instanceCount?: number | undefined;
598
+ } | undefined;
599
+ } | undefined;
600
+ };
601
+ getClassNameSource(key: string, composition: SiteEditCompositionSelector): {
602
+ key: string;
603
+ composition: {
604
+ routeId: string;
605
+ effectiveTemplateId?: string | undefined;
606
+ };
607
+ filePath: string;
608
+ componentName: string;
609
+ sourceKind: "expression" | "missing" | "stringLiteral";
610
+ attrRaw: string | null;
611
+ valueRaw: string | null;
612
+ attrRange: {
613
+ start: number;
614
+ end: number;
615
+ } | null;
616
+ openingElementRange: {
617
+ start: number;
618
+ end: number;
619
+ };
620
+ version: {
621
+ documentVersion: number;
622
+ contentHash: string;
623
+ };
624
+ diagnostics: {
625
+ code: "missing-class-name" | "unsupported-attribute-name" | "source-locator-warning" | "invalid-new-attr" | "version-conflict" | "write-failed";
626
+ message: string;
627
+ }[];
628
+ computedStyle?: Record<string, string> | undefined;
629
+ };
630
+ getSourceTree(composition: SiteEditCompositionSelector): Promise<{
631
+ composition: {
632
+ routeId: string;
633
+ effectiveTemplateId?: string | undefined;
634
+ };
635
+ nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
636
+ totalFiles: number;
637
+ defaultPath?: string | undefined;
638
+ truncated?: {
639
+ reasons: ("max-files" | "max-depth" | "max-total-bytes")[];
640
+ maxFiles: number;
641
+ maxDepth: number;
642
+ maxTotalBytes: number;
643
+ } | undefined;
644
+ }>;
645
+ getSourceFile(input: {
646
+ path: string;
647
+ composition: SiteEditCompositionSelector;
648
+ }): Promise<{
649
+ composition: {
650
+ routeId: string;
651
+ effectiveTemplateId?: string | undefined;
652
+ };
653
+ path: string;
654
+ sizeBytes: number;
655
+ kind: "text";
656
+ language: string;
657
+ readonly: boolean;
658
+ content: string;
659
+ contentHash?: string | undefined;
660
+ } | {
661
+ composition: {
662
+ routeId: string;
663
+ effectiveTemplateId?: string | undefined;
664
+ };
665
+ path: string;
666
+ sizeBytes: number;
667
+ kind: "binary";
668
+ language: null;
669
+ readonly: true;
670
+ mimeType: string;
671
+ contentHash?: string | undefined;
672
+ contentBase64?: string | undefined;
673
+ previewUnavailableReason?: "too-large" | "unsupported-mime" | "bytes-unavailable" | undefined;
674
+ }>;
675
+ resolveSourceLocation(input: SiteEditResolveSourceLocationInput): {
676
+ key: string;
677
+ composition: {
678
+ routeId: string;
679
+ effectiveTemplateId?: string | undefined;
680
+ };
681
+ sourceFile: string;
682
+ componentName: string;
683
+ openingElementRange: {
684
+ startLine: number;
685
+ startColumn: number;
686
+ endLine: number;
687
+ endColumn: number;
688
+ };
689
+ structuralPath: string;
690
+ textPreview?: string | undefined;
691
+ };
692
+ planOperation(request: Parameters<SiteEditEngineRuntime["planOperation"]>[0]): Promise<SiteEditPlanOperationResult>;
693
+ dispose(): void;
694
+ private createEngine;
695
+ }
696
+ export declare function createSiteEditEngineRuntime(options: SiteEditEngineRuntimeOptions): SiteEditEngineRuntime;
697
+ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSiteEditEngineRuntime {
698
+ private readonly options;
699
+ private readonly engine;
700
+ private readonly listeners;
701
+ constructor(options: PreviewSiteEditEngineRuntimeOptions);
702
+ get status(): PreviewSiteEditEngineRuntime["status"];
703
+ initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
704
+ registerComposition(composition: SiteEditCompositionContext, entryFile: string): void;
705
+ unregisterComposition(composition: SiteEditCompositionSelector): void;
706
+ getDocument(composition: SiteEditCompositionSelector): {
707
+ ok: true;
708
+ composition: {
709
+ routeId: string;
710
+ effectiveTemplateId?: string | undefined;
711
+ };
712
+ data: {
713
+ siteId: string;
714
+ snapshotId: string;
715
+ composition: {
716
+ routeId: string;
717
+ effectiveTemplateId?: string | undefined;
718
+ };
719
+ version: number;
720
+ entries: {
721
+ key: string;
722
+ operationSummary: {
723
+ canUpdateText: boolean;
724
+ canInsertChild: boolean;
725
+ canMove: boolean;
726
+ canRemove: boolean;
727
+ };
728
+ parentKey?: string | null | undefined;
729
+ pageCompositionUnitKey?: string | undefined;
730
+ pageCompositionActionScope?: {
731
+ kind: "route-unit";
732
+ } | {
733
+ kind: "source-siblings";
734
+ siblingKeys: string[];
735
+ } | {
736
+ kind: "unavailable";
737
+ } | undefined;
738
+ dynamicDataSummary?: {
739
+ hasDynamicData: boolean;
740
+ sourceKinds: ("vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api")[];
741
+ collections?: string[] | undefined;
742
+ primaryEndpoint?: string | undefined;
743
+ primaryCollection?: string | undefined;
744
+ primaryFieldPath?: string | undefined;
745
+ } | undefined;
746
+ }[];
747
+ pageComposition: {
748
+ status: "supported";
749
+ containerKey: string;
750
+ hasBusinessMembers: boolean;
751
+ placementUnitKeys: string[];
752
+ placements: {
753
+ placementKey: string;
754
+ placementUnitKey: string;
755
+ relation: "before" | "after" | "prepend" | "append";
756
+ }[];
757
+ } | {
758
+ status: "unsupported";
759
+ 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";
760
+ diagnostics: {
761
+ code: string;
762
+ message: string;
763
+ }[];
764
+ };
765
+ pageBlocks?: readonly {
766
+ blockKey: string;
767
+ rootRef: {
768
+ key: string;
769
+ instanceIndex?: number | undefined;
770
+ instanceCount?: number | undefined;
771
+ };
772
+ definitionKey: string;
773
+ source: {
774
+ file: string;
775
+ structuralPath: string;
776
+ contentHash: string;
777
+ };
778
+ owner: {
779
+ kind: "route-member";
780
+ key: string;
781
+ } | {
782
+ kind: "component-definition";
783
+ key: string;
784
+ };
785
+ siblingBlockKeys: readonly string[];
786
+ capabilities: {
787
+ insert: boolean;
788
+ replace: boolean;
789
+ move: boolean;
790
+ remove: boolean;
791
+ save: boolean;
792
+ };
793
+ placementUnitKey?: string | undefined;
794
+ unavailableReasons?: Readonly<Record<string, {
795
+ code: string;
796
+ reason: string;
797
+ }>> | undefined;
798
+ }[] | undefined;
799
+ };
800
+ };
801
+ getStyleContext(composition: SiteEditCompositionSelector): {
802
+ ok: true;
803
+ composition: {
804
+ routeId: string;
805
+ effectiveTemplateId?: string | undefined;
806
+ };
807
+ data: {
808
+ composition: {
809
+ routeId: string;
810
+ effectiveTemplateId?: string | undefined;
811
+ };
812
+ revision: string;
813
+ entryCss: {
814
+ path: string;
815
+ content: string;
816
+ hash?: string | undefined;
817
+ };
818
+ stylesheets: {
819
+ path: string;
820
+ content: string;
821
+ hash?: string | undefined;
822
+ }[];
823
+ } | null;
824
+ };
825
+ getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
826
+ getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): {
827
+ readonly ok: true;
828
+ readonly composition: {
829
+ routeId: string;
830
+ effectiveTemplateId?: string | undefined;
831
+ };
832
+ readonly data: {
833
+ composition: {
834
+ routeId: string;
835
+ effectiveTemplateId?: string | undefined;
836
+ };
837
+ key: string;
838
+ tag: string;
839
+ label: string;
840
+ isOpaque: boolean;
841
+ ancestors: {
842
+ key: string;
843
+ label: string;
844
+ tag: string;
845
+ }[];
846
+ componentName: string;
847
+ sourceFile: string;
848
+ capabilities: {
849
+ composition: {
850
+ routeId: string;
851
+ effectiveTemplateId?: string | undefined;
852
+ };
853
+ key: string;
854
+ canUpdateText: boolean;
855
+ canInsertChild: boolean;
856
+ canMove: boolean;
857
+ canRemove: boolean;
858
+ constraints: {
859
+ kind: "component-boundary" | "repeat-region" | "conditional-region" | "opaque-region" | "void-element" | "read-only" | "cross-file-required" | "import-required";
860
+ message: string;
861
+ }[];
862
+ editModes?: {
863
+ updateText?: {
864
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
865
+ reasonCode?: string | undefined;
866
+ } | undefined;
867
+ insertChild?: {
868
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
869
+ reasonCode?: string | undefined;
870
+ } | undefined;
871
+ move?: {
872
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
873
+ reasonCode?: string | undefined;
874
+ } | undefined;
875
+ remove?: {
876
+ mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
877
+ reasonCode?: string | undefined;
878
+ } | undefined;
879
+ } | undefined;
880
+ };
881
+ textSegments: {
882
+ index: number;
883
+ editable: boolean;
884
+ sourceKind: "literal" | "binding" | "imported-binding" | "repeat-template" | null;
885
+ }[];
886
+ boundaryKind: "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region" | null;
887
+ linkSourceKind?: "unsupported" | "native-anchor" | "next-link" | undefined;
888
+ sourceLocator?: {
889
+ sourceFile: string;
890
+ componentName: string;
891
+ openingElementRange: {
892
+ startLine: number;
893
+ startColumn: number;
894
+ endLine: number;
895
+ endColumn: number;
896
+ };
897
+ structuralPath: string;
898
+ textPreview?: string | undefined;
899
+ } | undefined;
900
+ provenanceChain?: {
901
+ editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
902
+ diagnostics: {
903
+ code: string;
904
+ message: string;
905
+ }[];
906
+ } | undefined;
907
+ dynamicData?: {
908
+ hasDynamicData: boolean;
909
+ bindings: {
910
+ sourceKind: "vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api";
911
+ sourceType: "api-field" | "cms-field";
912
+ targetKind: "repeat-region" | "conditional-region" | "text" | "attribute" | "richtext" | "component-prop";
913
+ targetName: string;
914
+ confidence: "exact" | "safe-derived" | "partial" | "unknown";
915
+ readonly: true;
916
+ evidence: {
917
+ file: string;
918
+ reason: string;
919
+ symbol?: string | undefined;
920
+ }[];
921
+ endpointPattern?: string | undefined;
922
+ operation?: string | undefined;
923
+ collection?: string | undefined;
924
+ fieldPath?: string | undefined;
925
+ valuePath?: string | undefined;
926
+ }[];
927
+ } | undefined;
928
+ properties?: {
929
+ documentVersion: number;
930
+ items: {
931
+ name: string;
932
+ source: {
933
+ kind: "expression" | "literal" | "binding" | "repeat-template" | "boolean-shorthand";
934
+ raw?: string | undefined;
935
+ };
936
+ resolution: {
937
+ status: "resolved";
938
+ value: import("@vcp-dev/contracts").SiteEditOperationValue;
939
+ } | {
940
+ status: "undefined";
941
+ } | {
942
+ status: "unresolved";
943
+ };
944
+ editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
945
+ sourceScope: "node" | "repeat-template" | "repeat-item";
946
+ allowedWriteScopes: ("template" | "selection")[];
947
+ diagnostics: {
948
+ code: string;
949
+ message: string;
950
+ }[];
951
+ effectiveWriteTarget?: {
952
+ kind: "jsx-node" | "route-export" | "value-path" | "external-entry";
953
+ isProxy: boolean;
954
+ file?: string | undefined;
955
+ displayPath?: string | undefined;
956
+ sourceType?: "api-field" | "cms-field" | "i18n-message" | "config-entry" | undefined;
957
+ sourceId?: string | undefined;
958
+ } | undefined;
959
+ }[];
960
+ spreads: {
961
+ raw: string;
962
+ sourceRange: {
963
+ start: number;
964
+ end: number;
965
+ };
966
+ order: number;
967
+ diagnostics: {
968
+ code: string;
969
+ message: string;
970
+ }[];
971
+ }[];
972
+ creation: {
973
+ selection: "direct" | "unsupported" | "materialize";
974
+ template: "direct" | "unsupported";
975
+ };
976
+ selectionRef?: {
977
+ key: string;
978
+ instanceIndex?: number | undefined;
979
+ instanceCount?: number | undefined;
980
+ } | undefined;
981
+ } | undefined;
982
+ };
983
+ };
984
+ getClassNameSource(key: string, composition: SiteEditCompositionSelector): {
985
+ readonly ok: true;
986
+ readonly composition: {
987
+ routeId: string;
988
+ effectiveTemplateId?: string | undefined;
989
+ };
990
+ readonly data: {
991
+ key: string;
992
+ composition: {
993
+ routeId: string;
994
+ effectiveTemplateId?: string | undefined;
995
+ };
996
+ filePath: string;
997
+ componentName: string;
998
+ sourceKind: "expression" | "missing" | "stringLiteral";
999
+ attrRaw: string | null;
1000
+ valueRaw: string | null;
1001
+ attrRange: {
1002
+ start: number;
1003
+ end: number;
1004
+ } | null;
1005
+ openingElementRange: {
1006
+ start: number;
1007
+ end: number;
1008
+ };
1009
+ version: {
1010
+ documentVersion: number;
1011
+ contentHash: string;
1012
+ };
1013
+ diagnostics: {
1014
+ code: "missing-class-name" | "unsupported-attribute-name" | "source-locator-warning" | "invalid-new-attr" | "version-conflict" | "write-failed";
1015
+ message: string;
1016
+ }[];
1017
+ computedStyle?: Record<string, string> | undefined;
1018
+ };
1019
+ };
1020
+ getSourceTree(composition: SiteEditCompositionSelector): Promise<{
1021
+ ok: true;
1022
+ composition: {
1023
+ routeId: string;
1024
+ effectiveTemplateId?: string | undefined;
1025
+ };
1026
+ data: {
1027
+ composition: {
1028
+ routeId: string;
1029
+ effectiveTemplateId?: string | undefined;
1030
+ };
1031
+ nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
1032
+ totalFiles: number;
1033
+ defaultPath?: string | undefined;
1034
+ truncated?: {
1035
+ reasons: ("max-files" | "max-depth" | "max-total-bytes")[];
1036
+ maxFiles: number;
1037
+ maxDepth: number;
1038
+ maxTotalBytes: number;
1039
+ } | undefined;
1040
+ };
1041
+ }>;
1042
+ getSourceFile(input: {
1043
+ path: string;
1044
+ composition: SiteEditCompositionSelector;
1045
+ }): Promise<{
1046
+ ok: true;
1047
+ composition: {
1048
+ routeId: string;
1049
+ effectiveTemplateId?: string | undefined;
1050
+ };
1051
+ data: {
1052
+ composition: {
1053
+ routeId: string;
1054
+ effectiveTemplateId?: string | undefined;
1055
+ };
1056
+ path: string;
1057
+ sizeBytes: number;
1058
+ kind: "text";
1059
+ language: string;
1060
+ readonly: boolean;
1061
+ content: string;
1062
+ contentHash?: string | undefined;
1063
+ } | {
1064
+ composition: {
1065
+ routeId: string;
1066
+ effectiveTemplateId?: string | undefined;
1067
+ };
1068
+ path: string;
1069
+ sizeBytes: number;
1070
+ kind: "binary";
1071
+ language: null;
1072
+ readonly: true;
1073
+ mimeType: string;
1074
+ contentHash?: string | undefined;
1075
+ contentBase64?: string | undefined;
1076
+ previewUnavailableReason?: "too-large" | "unsupported-mime" | "bytes-unavailable" | undefined;
1077
+ };
1078
+ }>;
1079
+ resolveSourceLocation(input: SiteEditResolveSourceLocationInput): {
1080
+ ok: true;
1081
+ composition: {
1082
+ routeId: string;
1083
+ effectiveTemplateId?: string | undefined;
1084
+ };
1085
+ data: {
1086
+ key: string;
1087
+ composition: {
1088
+ routeId: string;
1089
+ effectiveTemplateId?: string | undefined;
1090
+ };
1091
+ sourceFile: string;
1092
+ componentName: string;
1093
+ openingElementRange: {
1094
+ startLine: number;
1095
+ startColumn: number;
1096
+ endLine: number;
1097
+ endColumn: number;
1098
+ };
1099
+ structuralPath: string;
1100
+ textPreview?: string | undefined;
1101
+ };
1102
+ };
1103
+ refreshSourceForKey(key: string, composition: SiteEditCompositionSelector): Promise<void>;
1104
+ executeOperation(request: Parameters<PreviewSiteEditEngineRuntime["executeOperation"]>[0], mutationContext?: SiteEditMutationContext): Promise<SiteEditCommandSuccess<{
1105
+ requestId: string;
1106
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1107
+ composition: {
1108
+ routeId: string;
1109
+ effectiveTemplateId?: string | undefined;
1110
+ };
1111
+ target: {
1112
+ kind: "node";
1113
+ key: string;
1114
+ } | {
1115
+ kind: "page-unit";
1116
+ composition: {
1117
+ routeId: string;
1118
+ effectiveTemplateId?: string | undefined;
1119
+ };
1120
+ placementUnitKey: string;
1121
+ } | {
1122
+ kind: "page-block";
1123
+ composition: {
1124
+ routeId: string;
1125
+ templateId?: string | undefined;
1126
+ };
1127
+ blockKey: string;
1128
+ } | {
1129
+ kind: "route";
1130
+ composition: {
1131
+ routeId: string;
1132
+ effectiveTemplateId?: string | undefined;
1133
+ };
1134
+ } | {
1135
+ kind: "source-file";
1136
+ path: string;
1137
+ } | {
1138
+ kind: "source-batch";
1139
+ paths: string[];
1140
+ } | {
1141
+ kind: "project";
1142
+ };
1143
+ resultVersion: number;
1144
+ affectedFiles?: string[] | undefined;
1145
+ fileChanges?: {
1146
+ path: string;
1147
+ operation: "delete" | "upsert";
1148
+ }[] | undefined;
1149
+ selectionRef?: {
1150
+ key: string;
1151
+ instanceIndex?: number | undefined;
1152
+ instanceCount?: number | undefined;
1153
+ } | undefined;
1154
+ output?: {
1155
+ kind: "insert-page-resource";
1156
+ package_instance_id: string;
1157
+ pages: {
1158
+ template_page_id: string;
1159
+ title: string;
1160
+ final_route: string;
1161
+ route_file_path: string;
1162
+ }[];
1163
+ } | {
1164
+ kind: "delete-page-source";
1165
+ deleted_files: string[];
1166
+ updated_files: string[];
1167
+ preserved_shared_files: string[];
1168
+ warnings: string[];
1169
+ } | undefined;
1170
+ }> | import("@vcp-dev/contracts").SiteEditCommandFailure<"VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "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", unknown, never, Partial<{
1171
+ requestId: string;
1172
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1173
+ composition: {
1174
+ routeId: string;
1175
+ effectiveTemplateId?: string | undefined;
1176
+ };
1177
+ target: {
1178
+ kind: "node";
1179
+ key: string;
1180
+ } | {
1181
+ kind: "page-unit";
1182
+ composition: {
1183
+ routeId: string;
1184
+ effectiveTemplateId?: string | undefined;
1185
+ };
1186
+ placementUnitKey: string;
1187
+ } | {
1188
+ kind: "page-block";
1189
+ composition: {
1190
+ routeId: string;
1191
+ templateId?: string | undefined;
1192
+ };
1193
+ blockKey: string;
1194
+ } | {
1195
+ kind: "route";
1196
+ composition: {
1197
+ routeId: string;
1198
+ effectiveTemplateId?: string | undefined;
1199
+ };
1200
+ } | {
1201
+ kind: "source-file";
1202
+ path: string;
1203
+ } | {
1204
+ kind: "source-batch";
1205
+ paths: string[];
1206
+ } | {
1207
+ kind: "project";
1208
+ };
1209
+ resultVersion: number;
1210
+ affectedFiles?: string[] | undefined;
1211
+ fileChanges?: {
1212
+ path: string;
1213
+ operation: "delete" | "upsert";
1214
+ }[] | undefined;
1215
+ selectionRef?: {
1216
+ key: string;
1217
+ instanceIndex?: number | undefined;
1218
+ instanceCount?: number | undefined;
1219
+ } | undefined;
1220
+ output?: {
1221
+ kind: "insert-page-resource";
1222
+ package_instance_id: string;
1223
+ pages: {
1224
+ template_page_id: string;
1225
+ title: string;
1226
+ final_route: string;
1227
+ route_file_path: string;
1228
+ }[];
1229
+ } | {
1230
+ kind: "delete-page-source";
1231
+ deleted_files: string[];
1232
+ updated_files: string[];
1233
+ preserved_shared_files: string[];
1234
+ warnings: string[];
1235
+ } | undefined;
1236
+ }>> | {
1237
+ ok: false;
1238
+ composition: {
1239
+ routeId: string;
1240
+ effectiveTemplateId?: string | undefined;
1241
+ };
1242
+ error: {
1243
+ details?: Record<string, unknown> | undefined;
1244
+ code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "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";
1245
+ message: string;
1246
+ };
1247
+ data: {
1248
+ affectedFiles?: string[] | undefined;
1249
+ requestId: string;
1250
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1251
+ composition: {
1252
+ routeId: string;
1253
+ effectiveTemplateId?: string | undefined;
1254
+ };
1255
+ target: {
1256
+ kind: "node";
1257
+ key: string;
1258
+ } | {
1259
+ kind: "page-unit";
1260
+ composition: {
1261
+ routeId: string;
1262
+ templateId?: string | undefined;
1263
+ };
1264
+ placementUnitKey: string;
1265
+ } | {
1266
+ kind: "page-block";
1267
+ composition: {
1268
+ routeId: string;
1269
+ templateId?: string | undefined;
1270
+ };
1271
+ blockKey: string;
1272
+ } | {
1273
+ kind: "route";
1274
+ composition: {
1275
+ routeId: string;
1276
+ templateId?: string | undefined;
1277
+ };
1278
+ } | {
1279
+ kind: "source-file";
1280
+ path: string;
1281
+ } | {
1282
+ kind: "source-batch";
1283
+ paths: string[];
1284
+ } | {
1285
+ kind: "project";
1286
+ };
1287
+ resultVersion: number;
1288
+ };
1289
+ }>;
1290
+ undo(_mutationContext?: SiteEditMutationContext): Promise<{
1291
+ ok: false;
1292
+ composition: {
1293
+ routeId: string;
1294
+ effectiveTemplateId?: string | undefined;
1295
+ };
1296
+ error: {
1297
+ code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "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";
1298
+ message: string;
1299
+ };
1300
+ data: {
1301
+ requestId: string;
1302
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1303
+ composition: {
1304
+ routeId: string;
1305
+ effectiveTemplateId?: string | undefined;
1306
+ };
1307
+ target: {
1308
+ kind: "node";
1309
+ key: string;
1310
+ } | {
1311
+ kind: "page-unit";
1312
+ composition: {
1313
+ routeId: string;
1314
+ templateId?: string | undefined;
1315
+ };
1316
+ placementUnitKey: string;
1317
+ } | {
1318
+ kind: "page-block";
1319
+ composition: {
1320
+ routeId: string;
1321
+ templateId?: string | undefined;
1322
+ };
1323
+ blockKey: string;
1324
+ } | {
1325
+ kind: "route";
1326
+ composition: {
1327
+ routeId: string;
1328
+ templateId?: string | undefined;
1329
+ };
1330
+ } | {
1331
+ kind: "source-file";
1332
+ path: string;
1333
+ } | {
1334
+ kind: "source-batch";
1335
+ paths: string[];
1336
+ } | {
1337
+ kind: "project";
1338
+ };
1339
+ resultVersion: number;
1340
+ };
1341
+ } | {
1342
+ ok: true;
1343
+ composition: {
1344
+ routeId: string;
1345
+ effectiveTemplateId?: string | undefined;
1346
+ };
1347
+ data: {
1348
+ requestId: string;
1349
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1350
+ composition: {
1351
+ routeId: string;
1352
+ effectiveTemplateId?: string | undefined;
1353
+ };
1354
+ target: {
1355
+ kind: "node";
1356
+ key: string;
1357
+ } | {
1358
+ kind: "page-unit";
1359
+ composition: {
1360
+ routeId: string;
1361
+ effectiveTemplateId?: string | undefined;
1362
+ };
1363
+ placementUnitKey: string;
1364
+ } | {
1365
+ kind: "page-block";
1366
+ composition: {
1367
+ routeId: string;
1368
+ templateId?: string | undefined;
1369
+ };
1370
+ blockKey: string;
1371
+ } | {
1372
+ kind: "route";
1373
+ composition: {
1374
+ routeId: string;
1375
+ effectiveTemplateId?: string | undefined;
1376
+ };
1377
+ } | {
1378
+ kind: "source-file";
1379
+ path: string;
1380
+ } | {
1381
+ kind: "source-batch";
1382
+ paths: string[];
1383
+ } | {
1384
+ kind: "project";
1385
+ };
1386
+ resultVersion: number;
1387
+ affectedFiles?: string[] | undefined;
1388
+ fileChanges?: {
1389
+ path: string;
1390
+ operation: "delete" | "upsert";
1391
+ }[] | undefined;
1392
+ selectionRef?: {
1393
+ key: string;
1394
+ instanceIndex?: number | undefined;
1395
+ instanceCount?: number | undefined;
1396
+ } | undefined;
1397
+ output?: {
1398
+ kind: "insert-page-resource";
1399
+ package_instance_id: string;
1400
+ pages: {
1401
+ template_page_id: string;
1402
+ title: string;
1403
+ final_route: string;
1404
+ route_file_path: string;
1405
+ }[];
1406
+ } | {
1407
+ kind: "delete-page-source";
1408
+ deleted_files: string[];
1409
+ updated_files: string[];
1410
+ preserved_shared_files: string[];
1411
+ warnings: string[];
1412
+ } | undefined;
1413
+ };
1414
+ error?: undefined;
1415
+ }>;
1416
+ redo(_mutationContext?: SiteEditMutationContext): Promise<{
1417
+ ok: false;
1418
+ composition: {
1419
+ routeId: string;
1420
+ effectiveTemplateId?: string | undefined;
1421
+ };
1422
+ error: {
1423
+ code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "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";
1424
+ message: string;
1425
+ };
1426
+ data: {
1427
+ requestId: string;
1428
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1429
+ composition: {
1430
+ routeId: string;
1431
+ effectiveTemplateId?: string | undefined;
1432
+ };
1433
+ target: {
1434
+ kind: "node";
1435
+ key: string;
1436
+ } | {
1437
+ kind: "page-unit";
1438
+ composition: {
1439
+ routeId: string;
1440
+ templateId?: string | undefined;
1441
+ };
1442
+ placementUnitKey: string;
1443
+ } | {
1444
+ kind: "page-block";
1445
+ composition: {
1446
+ routeId: string;
1447
+ templateId?: string | undefined;
1448
+ };
1449
+ blockKey: string;
1450
+ } | {
1451
+ kind: "route";
1452
+ composition: {
1453
+ routeId: string;
1454
+ templateId?: string | undefined;
1455
+ };
1456
+ } | {
1457
+ kind: "source-file";
1458
+ path: string;
1459
+ } | {
1460
+ kind: "source-batch";
1461
+ paths: string[];
1462
+ } | {
1463
+ kind: "project";
1464
+ };
1465
+ resultVersion: number;
1466
+ };
1467
+ } | {
1468
+ ok: true;
1469
+ composition: {
1470
+ routeId: string;
1471
+ effectiveTemplateId?: string | undefined;
1472
+ };
1473
+ data: {
1474
+ requestId: string;
1475
+ kind: "set-props" | "insert-child" | "update-text" | "update-array-item" | "remove-node" | "replace-node" | "move-node" | "set-class-name-source" | "set-link-target" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
1476
+ composition: {
1477
+ routeId: string;
1478
+ effectiveTemplateId?: string | undefined;
1479
+ };
1480
+ target: {
1481
+ kind: "node";
1482
+ key: string;
1483
+ } | {
1484
+ kind: "page-unit";
1485
+ composition: {
1486
+ routeId: string;
1487
+ effectiveTemplateId?: string | undefined;
1488
+ };
1489
+ placementUnitKey: string;
1490
+ } | {
1491
+ kind: "page-block";
1492
+ composition: {
1493
+ routeId: string;
1494
+ templateId?: string | undefined;
1495
+ };
1496
+ blockKey: string;
1497
+ } | {
1498
+ kind: "route";
1499
+ composition: {
1500
+ routeId: string;
1501
+ effectiveTemplateId?: string | undefined;
1502
+ };
1503
+ } | {
1504
+ kind: "source-file";
1505
+ path: string;
1506
+ } | {
1507
+ kind: "source-batch";
1508
+ paths: string[];
1509
+ } | {
1510
+ kind: "project";
1511
+ };
1512
+ resultVersion: number;
1513
+ affectedFiles?: string[] | undefined;
1514
+ fileChanges?: {
1515
+ path: string;
1516
+ operation: "delete" | "upsert";
1517
+ }[] | undefined;
1518
+ selectionRef?: {
1519
+ key: string;
1520
+ instanceIndex?: number | undefined;
1521
+ instanceCount?: number | undefined;
1522
+ } | undefined;
1523
+ output?: {
1524
+ kind: "insert-page-resource";
1525
+ package_instance_id: string;
1526
+ pages: {
1527
+ template_page_id: string;
1528
+ title: string;
1529
+ final_route: string;
1530
+ route_file_path: string;
1531
+ }[];
1532
+ } | {
1533
+ kind: "delete-page-source";
1534
+ deleted_files: string[];
1535
+ updated_files: string[];
1536
+ preserved_shared_files: string[];
1537
+ warnings: string[];
1538
+ } | undefined;
1539
+ };
1540
+ error?: undefined;
1541
+ }>;
1542
+ notifyFileChanged(file: string): void;
1543
+ subscribe(listener: Parameters<PreviewSiteEditEngineRuntime["subscribe"]>[0]): () => void;
1544
+ dispose(): void;
1545
+ }
1546
+ export declare function createPreviewSiteEditEngineRuntime(options: PreviewSiteEditEngineRuntimeOptions): PreviewSiteEditEngineRuntime;
1547
+ export type SiteEditColorMixPolicy = "always" | "raw-literal-only";
1548
+ export interface SiteEditThemeStyleScanOptions {
1549
+ colorMixPolicy: SiteEditColorMixPolicy;
1550
+ includeExtendedColorFunctions?: boolean;
1551
+ includeRgbBackgroundImage?: boolean;
1552
+ rejectAnyRawColorLiteral?: boolean;
1553
+ rejectPrivateTokens?: boolean;
1554
+ rejectTailwindPalette?: boolean;
1555
+ }
1556
+ /**
1557
+ * 一处硬编码主题色命中的完整坐标。
1558
+ *
1559
+ * `hardCodedSurfaceHits` 只给去重后的类名,修复方拿到「你用了 bg-white」却不知道
1560
+ * 在哪一行——真实事故里模型因此三轮都在改文件里没有违规的那一段,命中原地未动、
1561
+ * 三次诊断字字相同,最终 chrome 落确定性回退。这里保留每一处的行号与整行片段,
1562
+ * 让诊断能点名到元素。
1563
+ */
1564
+ export interface SiteEditThemeSurfaceOccurrence {
1565
+ /** 命中的基础类名,例如 `bg-white`(不含变体前缀与透明度后缀)。 */
1566
+ token: string;
1567
+ /** 变体前缀,例如 `hover:` / `md:hover:`;无前缀时为空串。 */
1568
+ variant: string;
1569
+ /** 透明度后缀数值(`bg-white/10` ⇒ 10);无后缀时为 null。 */
1570
+ alpha: number | null;
1571
+ /** 1-based 行号。 */
1572
+ line: number;
1573
+ /** 该行去掉首尾空白后的片段,过长时截断。 */
1574
+ snippet: string;
1575
+ }
1576
+ export interface SiteEditThemeStyleViolations {
1577
+ hardCodedSurfaceHits: string[];
1578
+ /**
1579
+ * 与 `hardCodedSurfaceHits` 同源、逐处展开的坐标。前者保持去重字符串数组不变,
1580
+ * 因为 `workspace-validation` 与 static-prefab 物化都在消费它。
1581
+ */
1582
+ hardCodedSurfaceOccurrences: SiteEditThemeSurfaceOccurrence[];
1583
+ rawColorHits: string[];
1584
+ privateTokenHits: string[];
1585
+ }
1586
+ export declare const SITE_EDIT_RAW_COLOR_LITERAL_RE: RegExp;
1587
+ export declare function scanSiteEditThemeStyleViolations(content: string, options: SiteEditThemeStyleScanOptions): SiteEditThemeStyleViolations;
1588
+ export type GeneratedCodePolicyViolationCode = "host-capabilities-unavailable" | "host-capabilities-invalid" | "import-forbidden" | "protected-import-forbidden" | "dynamic-import-forbidden" | "commonjs-forbidden" | "dynamic-code-forbidden" | "browser-global-forbidden" | "import-meta-forbidden" | "inline-style-forbidden" | "style-forbidden" | "parse-failed";
1589
+ export interface GeneratedCodePolicyViolation {
1590
+ code: GeneratedCodePolicyViolationCode;
1591
+ message: string;
1592
+ name?: string;
1593
+ source?: string;
1594
+ }
1595
+ export interface GeneratedCodePolicyOptions {
1596
+ /** Trusted, generated host capability evidence; never resource-owned. */
1597
+ hostCapabilities?: GeneratedSiteCapabilities | null;
1598
+ /** Allow target-site generated/server source roots. */
1599
+ allowSiteOwnedImports?: boolean;
1600
+ /** Static prefabs use this to keep generated paths private to their instance. */
1601
+ protectedImportPrefixes?: readonly string[];
1602
+ /** Exact server-proven managed imports; resource content cannot grant this exception. */
1603
+ trustedManagedImports?: readonly string[];
1604
+ /** Static prefabs reject inline style constructs. */
1605
+ rejectInlineStyles?: boolean;
1606
+ /** Static prefabs reject <style>; Workspace retains its existing semantics. */
1607
+ rejectStyleElements?: boolean;
1608
+ /** Report style findings while preserving caller advisory/blocking semantics. */
1609
+ themeStyleMode?: "ignore" | "report" | "reject";
1610
+ style?: SiteEditThemeStyleScanOptions;
1611
+ }
1612
+ export interface GeneratedCodePolicyResult {
1613
+ ok: boolean;
1614
+ violations: GeneratedCodePolicyViolation[];
1615
+ styleViolations: SiteEditThemeStyleViolations;
1616
+ }
1617
+ /**
1618
+ * Audits generated source against trusted host evidence and the common code
1619
+ * safety baseline. The function is intentionally pure with respect to the
1620
+ * host contract: callers must load and schema-validate capabilities at their
1621
+ * application boundary. Missing evidence rejects any external import.
1622
+ */
1623
+ export declare function auditGeneratedCode(content: string, options?: GeneratedCodePolicyOptions): GeneratedCodePolicyResult;
1624
+ export type PageTemplateAppRoot = "app" | "src/app";
1625
+ export type SiteEditFileSystem = ReadonlyMap<string, string>;
1626
+ export type SiteEditManagedSourceFiles = SiteEditFileSystem | readonly SiteEditSnapshotFile[];
1627
+ export interface ManagedPageTemplatePaths {
1628
+ appRoot: PageTemplateAppRoot;
1629
+ routeRoot: string;
1630
+ templateKey: string;
1631
+ templateEntryFile: string;
1632
+ }
1633
+ type SiteEditEngineComposition$1 = {
1634
+ context: SiteEditCompositionContext;
1635
+ entryFile: string;
1636
+ };
1637
+ export type PageTemplateCompositionSelector = SiteEditCompositionSelector;
1638
+ export type ManagedPageTemplateCompositionResolution = SiteEditEngineComposition$1 & {
1639
+ mode: "direct" | "candidate";
1640
+ effectiveEntryFile: string;
1641
+ };
1642
+ export type PageTemplateManagedSourceErrorCode = "PAGE_TEMPLATE_MANAGED_SOURCE_INVALID" | "PAGE_TEMPLATE_ROUTE_AMBIGUOUS";
1643
+ export interface PageTemplateManagedSourceErrorDetails {
1644
+ reason: string;
1645
+ routeId?: string;
1646
+ path?: string;
1647
+ templateId?: string;
1648
+ candidates?: readonly string[];
1649
+ issues?: readonly string[];
1650
+ }
1651
+ export declare class PageTemplateManagedSourceError extends Error {
1652
+ readonly code: PageTemplateManagedSourceErrorCode;
1653
+ readonly details: PageTemplateManagedSourceErrorDetails;
1654
+ constructor(code: PageTemplateManagedSourceErrorCode, message: string, details: PageTemplateManagedSourceErrorDetails);
1655
+ }
1656
+ export declare function encodePageTemplateId(templateId: string): string;
1657
+ export declare function decodePageTemplateKey(key: string): string;
1658
+ export declare function computeManagedPageTemplatePaths(routeId: string, rawTemplateId: string, appRoot?: PageTemplateAppRoot): ManagedPageTemplatePaths;
1659
+ export declare function isManagedPageTemplateSourcePath(path: string): boolean;
1660
+ export interface ManagedPageTemplateCandidate {
1661
+ routeId: string;
1662
+ templateId: string;
1663
+ entryFile: string;
1664
+ canonicalEntryFile: string;
1665
+ appRoot: PageTemplateAppRoot;
1666
+ }
1667
+ export declare function scanManagedPageTemplateCandidates(input: {
1668
+ files: SiteEditManagedSourceFiles;
1669
+ }): ManagedPageTemplateCandidate[];
1670
+ export declare function scanSiteEditCompositionsFromFiles(input: {
1671
+ files: SiteEditManagedSourceFiles;
1672
+ }): SiteEditEngineComposition$1[];
1673
+ export declare function resolveManagedPageTemplateComposition(input: {
1674
+ selector: PageTemplateCompositionSelector;
1675
+ files: SiteEditManagedSourceFiles;
1676
+ canonicalEntryFile: string;
1677
+ }): ManagedPageTemplateCompositionResolution;
1678
+ export type PortableSourceFileContent = string | Uint8Array;
1679
+ export type PortableSourceFileMap = ReadonlyMap<string, PortableSourceFileContent> | Readonly<Record<string, PortableSourceFileContent>>;
1680
+ export interface PortableSourceClosureInput {
1681
+ entry_files: readonly string[];
1682
+ files: PortableSourceFileMap;
1683
+ max_depth?: number;
1684
+ max_nodes?: number;
1685
+ }
1686
+ type PortableSourceNodeKind = "source" | "asset" | "external";
1687
+ type PortableSourceNodeStatus = "complete" | "unresolved" | "parse-failed" | "depth-exhausted" | "budget-exhausted";
1688
+ export interface PortableSourceClosureNode {
1689
+ readonly path: string;
1690
+ readonly kind: PortableSourceNodeKind;
1691
+ readonly depth: number | null;
1692
+ readonly status: PortableSourceNodeStatus;
1693
+ }
1694
+ type PortableSourceEdgeKind = "import" | "export" | "dynamic" | "type";
1695
+ type PortableSourceEdgeResolution = "resolved" | "external" | "unresolved" | "non-literal" | "budget-exhausted";
1696
+ export interface PortableSourceClosureEdge {
1697
+ readonly from: string;
1698
+ readonly specifier: string | null;
1699
+ readonly kind: PortableSourceEdgeKind;
1700
+ readonly target: string | null;
1701
+ readonly resolution: PortableSourceEdgeResolution;
1702
+ }
1703
+ export type PortableSourceClosureErrorCode = "SOURCE_ENTRY_UNRESOLVED" | "SOURCE_FILE_UNRESOLVED" | "SOURCE_FILE_INVALID" | "SOURCE_PARSE_FAILED" | "SOURCE_ASSET_UNRESOLVED" | "SOURCE_ASSET_INVALID" | "SOURCE_DYNAMIC_IMPORT_UNRESOLVED" | "SOURCE_UNSAFE_IMPORT" | "SOURCE_DEPTH_EXHAUSTED" | "SOURCE_NODE_BUDGET_EXHAUSTED";
1704
+ export interface PortableSourceClosureError {
1705
+ readonly code: PortableSourceClosureErrorCode;
1706
+ readonly path: string;
1707
+ readonly message: string;
1708
+ readonly specifier?: string;
1709
+ }
1710
+ export interface PortableSourceClosure {
1711
+ readonly entry_files: readonly string[];
1712
+ readonly nodes: readonly PortableSourceClosureNode[];
1713
+ readonly edges: readonly PortableSourceClosureEdge[];
1714
+ readonly errors: readonly PortableSourceClosureError[];
1715
+ readonly complete: boolean;
1716
+ readonly budget: {
1717
+ readonly max_depth: number;
1718
+ readonly max_nodes: number;
1719
+ };
1720
+ }
1721
+ export declare function buildPortableSourceClosure(input: PortableSourceClosureInput): PortableSourceClosure;
1722
+ export declare function resolvePortableSourcePath(from: string, specifier: string, files: ReadonlyMap<string, PortableSourceFileContent>): string | null;
1723
+ export type PortableDependencyOwnership = "private" | "host-public" | "platform-managed" | "unsupported-external-private" | "unknown";
1724
+ export interface PortableDependencyOwnershipInput {
1725
+ readonly node: PortableSourceClosureNode;
1726
+ readonly host_capabilities: unknown;
1727
+ readonly platform_managed_paths?: readonly string[];
1728
+ readonly platform_managed_packages?: readonly string[];
1729
+ }
1730
+ export interface PortableDependencyOwnershipResult {
1731
+ readonly path: string;
1732
+ readonly kind: PortableSourceClosureNode["kind"];
1733
+ readonly ownership: PortableDependencyOwnership;
1734
+ readonly reason: string;
1735
+ }
1736
+ export declare function classifyPortableDependencyOwnership(input: PortableDependencyOwnershipInput): PortableDependencyOwnershipResult;
1737
+ export declare function resolvePortableDependencyOwnership(input: Omit<PortableDependencyOwnershipInput, "node"> & {
1738
+ readonly nodes: readonly PortableSourceClosureNode[];
1739
+ }): readonly PortableDependencyOwnershipResult[];
1740
+ export type PortableDependencyAuditErrorCode = PortableSourceClosureErrorCode | "HOST_CAPABILITIES_INVALID" | "UNKNOWN_DEPENDENCY_OWNERSHIP" | "UNSUPPORTED_EXTERNAL_DEPENDENCY" | "INCOMPLETE_SOURCE_NODE";
1741
+ export interface PortableDependencyAuditError {
1742
+ readonly code: PortableDependencyAuditErrorCode;
1743
+ readonly path: string;
1744
+ readonly message: string;
1745
+ readonly specifier?: string;
1746
+ }
1747
+ export interface PortableDependencyAuditNode extends PortableSourceClosureNode {
1748
+ readonly ownership: PortableDependencyOwnership;
1749
+ readonly ownership_reason: string;
1750
+ }
1751
+ export interface PortableDependencyAuditInput {
1752
+ readonly closure: PortableSourceClosure;
1753
+ readonly host_capabilities: unknown;
1754
+ readonly platform_managed_paths?: readonly string[];
1755
+ readonly platform_managed_packages?: readonly string[];
1756
+ }
1757
+ export interface PortableDependencyAuditResult {
1758
+ readonly complete: boolean;
1759
+ readonly nodes: readonly PortableDependencyAuditNode[];
1760
+ readonly edges: PortableSourceClosure["edges"];
1761
+ readonly errors: readonly PortableDependencyAuditError[];
1762
+ }
1763
+ export declare function auditPortableDependencies(input: PortableDependencyAuditInput): PortableDependencyAuditResult;
1764
+ export type PortableRelatedEntryPurpose = "collection-detail-view" | "i18n-companion" | "client-importer";
1765
+ export interface PortableRelatedEntry {
1766
+ readonly key: string;
1767
+ readonly pathTemplate: string;
1768
+ readonly export: {
1769
+ readonly kind: "default";
1770
+ } | {
1771
+ readonly kind: "named";
1772
+ readonly name: string;
1773
+ };
1774
+ readonly purpose: PortableRelatedEntryPurpose;
1775
+ readonly requirementKey: string;
1776
+ }
1777
+ export type PortableManagedRequirementKind = "route" | "adapter";
1778
+ export interface PortableManagedRequirement {
1779
+ readonly path: string;
1780
+ readonly kind: PortableManagedRequirementKind;
1781
+ readonly requirementKey: string;
1782
+ }
1783
+ export interface PortableCollectionSourceRelation {
1784
+ readonly slug: string;
1785
+ readonly requirement_key: string;
1786
+ readonly list_entry_file: string;
1787
+ readonly detail_entry_file: string;
1788
+ readonly detail_view_file: string;
1789
+ readonly detail_view_export: "default" | string;
1790
+ }
1791
+ export interface PortableCollectionSourceDiscoveryInput {
1792
+ readonly files: PortableSourceFileMap;
1793
+ readonly list_entry_file: string;
1794
+ readonly selected_component_source: string;
1795
+ }
1796
+ export interface PortableCollectionSourceDiscoveryResult {
1797
+ readonly complete: boolean;
1798
+ readonly relation: PortableCollectionSourceRelation | null;
1799
+ readonly errors: readonly PortableRelatedEntriesError[];
1800
+ }
1801
+ export interface PortablePageTemplateRoot {
1802
+ readonly entry_file: string;
1803
+ readonly component_source?: string;
1804
+ readonly component_export?: string;
1805
+ }
1806
+ export interface PortableRelatedEntriesInput {
1807
+ readonly files: PortableSourceFileMap;
1808
+ readonly source_closure: PortableSourceClosure;
1809
+ readonly collection: PortableCollectionSourceRelation;
1810
+ readonly page_template?: PortablePageTemplateRoot;
1811
+ /** Schema read from the trusted CMS application projection, never inferred from TS. */
1812
+ readonly trusted_schema?: PortableTrustedCollectionSchema;
1813
+ readonly required_fields?: readonly string[];
1814
+ readonly force_multi_media?: readonly string[];
1815
+ }
1816
+ export interface PortableTrustedCollectionSchema {
1817
+ readonly source_slug: string;
1818
+ readonly evidence_path: string;
1819
+ readonly fields: readonly ResolvedField[];
1820
+ }
1821
+ export type PortableRelatedEntriesErrorCode = "RELATED_SOURCE_CLOSURE_INCOMPLETE" | "RELATED_LIST_ENTRY_MISSING" | "RELATED_DETAIL_ENTRY_MISSING" | "RELATED_DETAIL_VIEW_MISSING" | "RELATED_DETAIL_VIEW_NOT_REACHED" | "RELATED_DETAIL_SOURCE_INCOMPLETE" | "RELATED_COLLECTION_SCHEMA_UNPROVEN" | "RELATED_COLLECTION_LIST_CONTAINER_UNPROVEN" | "RELATED_COLLECTION_LIST_VIEW_UNPROVEN" | "RELATED_COLLECTION_DETAIL_CONSUMER_UNPROVEN" | "RELATED_COLLECTION_ADAPTER_UNPROVEN" | "RELATED_COLLECTION_FIELD_UNPROVEN" | "RELATED_COLLECTION_BREADCRUMB_UNPROVEN" | "RELATED_PAGE_TEMPLATE_PARSE_FAILED" | "RELATED_PAGE_TEMPLATE_NOT_SEPARABLE";
1822
+ export interface PortableRelatedEntriesError {
1823
+ readonly code: PortableRelatedEntriesErrorCode;
1824
+ readonly path: string;
1825
+ readonly message: string;
1826
+ }
1827
+ export interface PortableThinEntryPlan {
1828
+ readonly kind: "managed-root-thin-entry";
1829
+ readonly source_file: string;
1830
+ readonly component_source: string;
1831
+ readonly component_export: string;
1832
+ readonly adds_dom: false;
1833
+ }
1834
+ export interface PortableRelatedEntriesResult {
1835
+ readonly complete: boolean;
1836
+ readonly entries: readonly PortableRelatedEntry[];
1837
+ readonly managed_requirements: readonly PortableManagedRequirement[];
1838
+ readonly thin_entry_plan: PortableThinEntryPlan | null;
1839
+ readonly collection_wiring: PortableCollectionWiringFacts | null;
1840
+ readonly errors: readonly PortableRelatedEntriesError[];
1841
+ }
1842
+ export interface PortableCollectionWiringFacts {
1843
+ readonly source_slug: string;
1844
+ readonly detail_prefix: string;
1845
+ readonly schema: readonly ResolvedField[];
1846
+ readonly schema_evidence_path: string;
1847
+ readonly list_container_file: string;
1848
+ readonly list_view: PortableCollectionViewReference;
1849
+ readonly detail_view: PortableCollectionViewReference;
1850
+ readonly title?: string;
1851
+ readonly breadcrumb?: {
1852
+ readonly homeLabel: string;
1853
+ readonly collectionLabel: string;
1854
+ };
1855
+ readonly required_fields?: readonly string[];
1856
+ readonly force_multi_media?: readonly string[];
1857
+ }
1858
+ /** Discover collection identity only from the selected list call and matching route wiring. */
1859
+ export declare function discoverPortableCollectionSourceRelation(input: PortableCollectionSourceDiscoveryInput): PortableCollectionSourceDiscoveryResult;
1860
+ export declare function analyzePortableRelatedEntries(input: PortableRelatedEntriesInput): PortableRelatedEntriesResult;
1861
+ export interface PortableInvocationAnalyzerInput {
1862
+ readonly file_path: string;
1863
+ readonly source: string;
1864
+ readonly export_name?: string;
1865
+ readonly target: {
1866
+ readonly source: string;
1867
+ readonly export_name: string;
1868
+ readonly local_name?: string;
1869
+ readonly original_block_id?: string;
1870
+ };
1871
+ /** Exact Page Unit opening selected from the current composition projection. */
1872
+ readonly call_source_range?: {
1873
+ readonly start_line: number;
1874
+ readonly start_column: number;
1875
+ };
1876
+ }
1877
+ export interface PortableInvocationSourceRange {
1878
+ readonly start_offset: number;
1879
+ readonly end_offset: number;
1880
+ readonly start_line: number;
1881
+ readonly start_column: number;
1882
+ readonly end_line: number;
1883
+ readonly end_column: number;
1884
+ }
1885
+ export interface PortableInvocationCall {
1886
+ readonly source_file: string;
1887
+ readonly component_source: string;
1888
+ readonly export_name: string;
1889
+ readonly local_name: string;
1890
+ readonly ordinal: number;
1891
+ readonly source_range: PortableInvocationSourceRange;
1892
+ }
1893
+ export type PortableInvocationAnalyzerErrorCode = "INVOCATION_PARSE_FAILED" | "INVOCATION_RENDER_GRAPH_INCOMPLETE" | "INVOCATION_TARGET_NOT_RENDERED" | "INVOCATION_TARGET_AMBIGUOUS" | "INVOCATION_PAGE_UNIT_NOT_FOUND" | "INVOCATION_PAGE_UNIT_UNSUPPORTED" | "INVOCATION_SPREAD_UNRESOLVED" | "INVOCATION_VALUE_UNRESOLVED" | "INVOCATION_DUPLICATE_PROP" | "INVOCATION_BLOCK_ID_UNRESOLVED" | "INVOCATION_ORDER_UNRESOLVED" | "INVOCATION_CHILDREN_UNRESOLVED" | "COLLECTION_SOURCE_CLOSURE_INCOMPLETE" | "COLLECTION_LIST_CONTAINER_UNPROVEN" | "COLLECTION_PAGINATION_UNPROVEN" | "COLLECTION_SEARCH_PARAMS_MISMATCH" | "COLLECTION_VIEW_UNPROVEN" | "COLLECTION_DETAIL_CONSUMER_UNPROVEN" | "COLLECTION_SCHEMA_UNPROVEN" | "COLLECTION_RECIPE_INVALID";
1894
+ export interface PortableInvocationAnalyzerError {
1895
+ readonly code: PortableInvocationAnalyzerErrorCode;
1896
+ readonly path: string;
1897
+ readonly message: string;
1898
+ readonly source_range?: PortableInvocationSourceRange;
1899
+ }
1900
+ export interface PortableInvocationAnalyzerResult {
1901
+ readonly complete: boolean;
1902
+ readonly entry_file: string;
1903
+ readonly target: PortableInvocationAnalyzerInput["target"];
1904
+ readonly call: PortableInvocationCall | null;
1905
+ readonly bindings: readonly PortableInvocationBinding[];
1906
+ readonly original_block_id: string | null;
1907
+ readonly original_order: number | null;
1908
+ readonly semantic_props: Readonly<Record<string, PortableJsonValue>>;
1909
+ readonly errors: readonly PortableInvocationAnalyzerError[];
1910
+ }
1911
+ export interface PortablePageUnitInvocationSelectionInput {
1912
+ readonly route: string;
1913
+ readonly composition: SiteEditCompositionSelector;
1914
+ readonly file_path: string;
1915
+ readonly source: string;
1916
+ readonly document_version: number;
1917
+ readonly placement_unit_key: string;
1918
+ }
1919
+ export interface PortablePageUnitInvocationSelectionResult {
1920
+ readonly invocation: PortableInvocationAnalyzerResult | null;
1921
+ readonly errors: readonly PortableInvocationAnalyzerError[];
1922
+ }
1923
+ export interface PortableCollectionInvocationAnalyzerInput extends PortableInvocationAnalyzerInput {
1924
+ readonly files: PortableSourceFileMap;
1925
+ readonly source_closure: PortableSourceClosure;
1926
+ readonly collection: PortableCollectionSourceRelation;
1927
+ /** Immutable CMS application schema captured beside the pinned Snapshot. */
1928
+ readonly trusted_schema: PortableTrustedCollectionSchema;
1929
+ readonly required_fields?: readonly string[];
1930
+ readonly force_multi_media?: readonly string[];
1931
+ }
1932
+ export type PortableCollectionEvidenceFact = "invocation" | "pagination" | "detail-route" | "list-view" | "detail-view" | "schema";
1933
+ export interface PortableCollectionRecipeEvidence {
1934
+ readonly fact: PortableCollectionEvidenceFact;
1935
+ readonly path: string;
1936
+ readonly reason: string;
1937
+ readonly source_range?: PortableInvocationSourceRange;
1938
+ }
1939
+ export interface PortableCollectionInvocationAnalyzerResult extends PortableInvocationAnalyzerResult {
1940
+ readonly collection_recipe: PortableCollectionRecipeFacts | null;
1941
+ readonly collection_evidence: readonly PortableCollectionRecipeEvidence[];
1942
+ readonly related_entries: PortableRelatedEntriesResult;
1943
+ }
1944
+ export declare function analyzePortableInvocation(input: PortableInvocationAnalyzerInput): PortableInvocationAnalyzerResult;
1945
+ /** Resolve one opaque Page Unit key to its exact rendered invocation. */
1946
+ export declare function selectPortablePageUnitInvocation(input: PortablePageUnitInvocationSelectionInput): PortablePageUnitInvocationSelectionResult;
1947
+ /**
1948
+ * Close a selected collection invocation over its generated list/detail wiring.
1949
+ * No field, page-size, route, or view default is synthesized: every recipe fact
1950
+ * is either observed in the pinned sources or supplied by the trusted CMS schema.
1951
+ */
1952
+ export declare function analyzePortableCollectionInvocation(input: PortableCollectionInvocationAnalyzerInput): PortableCollectionInvocationAnalyzerResult;
1953
+ export type PortableSourceOwnership = "private" | "host-public" | "platform-managed" | "unsupported-external-private" | "unknown";
1954
+ export interface PortableSourceNormalizerSourceFile {
1955
+ readonly path: string;
1956
+ readonly content: string;
1957
+ readonly role?: string;
1958
+ }
1959
+ export interface PortableSourceNormalizerOwnership {
1960
+ readonly path: string;
1961
+ readonly ownership: PortableSourceOwnership;
1962
+ readonly requirement_key?: string;
1963
+ }
1964
+ export interface PortableSourceNormalizerThinEntryPlan {
1965
+ readonly kind: "managed-root-thin-entry";
1966
+ readonly source_file: string;
1967
+ readonly component_source: string;
1968
+ readonly component_export: string;
1969
+ readonly adds_dom: false;
1970
+ }
1971
+ export interface PortableSourceNormalizerInput {
1972
+ readonly entry_file: string;
1973
+ readonly instance_base_name: string;
1974
+ readonly source_files: readonly PortableSourceNormalizerSourceFile[];
1975
+ readonly ownership: readonly PortableSourceNormalizerOwnership[];
1976
+ readonly thin_entry_plan?: PortableSourceNormalizerThinEntryPlan | null;
1977
+ readonly required_source_paths?: readonly PortableRequiredSourcePath[];
1978
+ readonly source_mapping?: readonly PortableSourceMapping[];
1979
+ }
1980
+ export interface PortableRequiredSourcePath {
1981
+ readonly key: string;
1982
+ readonly source_path: string;
1983
+ }
1984
+ export interface PortableSourceMapping {
1985
+ readonly generated_path: string;
1986
+ readonly source_file: string;
1987
+ readonly structural_path: string;
1988
+ }
1989
+ export interface PortableNormalizedSourceMapping extends PortableSourceMapping {
1990
+ readonly path_template: string;
1991
+ }
1992
+ export type PortableSourceNormalizerErrorCode = "SOURCE_INPUT_INVALID" | "SOURCE_ENTRY_NOT_FOUND" | "SOURCE_ENTRY_NOT_PRIVATE" | "SOURCE_OWNERSHIP_MISSING" | "SOURCE_NOT_PORTABLE" | "SOURCE_PARSE_FAILED" | "SOURCE_IMPORT_UNRESOLVED" | "SOURCE_IMPORT_AMBIGUOUS" | "SOURCE_IMPORT_TARGET_UNOWNED" | "SOURCE_MANAGED_REBIND_INVALID" | "SOURCE_REQUIRED_PATH_INVALID" | "SOURCE_REQUIRED_PATH_UNMAPPED" | "SOURCE_THIN_ENTRY_INVALID" | "SOURCE_THIN_ENTRY_TARGET_MISSING";
1993
+ export interface PortableSourceNormalizerError {
1994
+ readonly code: PortableSourceNormalizerErrorCode;
1995
+ readonly path: string;
1996
+ readonly message: string;
1997
+ readonly specifier?: string;
1998
+ }
1999
+ export interface PortableSourcePathMapping {
2000
+ readonly source_path: string;
2001
+ readonly path_template: string;
2002
+ readonly original_byte_size: number;
2003
+ readonly output_byte_size: number;
2004
+ readonly original_line_count: number;
2005
+ readonly output_line_count: number;
2006
+ }
2007
+ export interface PortableManagedImportRebinding {
2008
+ readonly source_path: string;
2009
+ readonly original_specifier: string;
2010
+ readonly target_path: string;
2011
+ readonly rebound_specifier: string;
2012
+ readonly requirement_key: string;
2013
+ }
2014
+ export interface PortableNormalizedBlockMetadata {
2015
+ readonly source_path: string;
2016
+ readonly original_block_attribute: "data-site-block-id" | "data-vcp-block-id" | "data-vcp-edit-key" | null;
2017
+ readonly original_block_id: string | null;
2018
+ readonly original_order: number | null;
2019
+ readonly normalized: true;
2020
+ }
2021
+ export interface PortableNormalizedSourceFile {
2022
+ readonly path_template: string;
2023
+ readonly content: string;
2024
+ readonly role?: string;
2025
+ }
2026
+ export interface PortableRequiredPathMapping {
2027
+ readonly key: string;
2028
+ readonly source_path: string;
2029
+ readonly path_template: string;
2030
+ }
2031
+ export interface PortableSourceNormalizerResult {
2032
+ readonly complete: boolean;
2033
+ readonly entry_path_template: string | null;
2034
+ readonly files: readonly PortableNormalizedSourceFile[];
2035
+ readonly source_path_mappings: readonly PortableSourcePathMapping[];
2036
+ readonly required_path_mappings: readonly PortableRequiredPathMapping[];
2037
+ readonly source_mapping: readonly PortableNormalizedSourceMapping[];
2038
+ readonly managed_rebindings: readonly PortableManagedImportRebinding[];
2039
+ readonly block_metadata: readonly PortableNormalizedBlockMetadata[];
2040
+ readonly errors: readonly PortableSourceNormalizerError[];
2041
+ }
2042
+ export declare function normalizePortableSource(input: PortableSourceNormalizerInput): PortableSourceNormalizerResult;
2043
+ interface SourceRange {
2044
+ startLine: number;
2045
+ startColumn: number;
2046
+ endLine: number;
2047
+ endColumn: number;
2048
+ }
2049
+ interface ElementNode {
2050
+ identity: SourceIdentity;
2051
+ tag: string;
2052
+ componentName: string;
2053
+ sourceFile: string;
2054
+ sourceRange: SourceRange;
2055
+ parentKey: string | null;
2056
+ childKeys: string[];
2057
+ textSegments: TextSegment[];
2058
+ attributes?: AttributeSource[];
2059
+ attributeSpreads?: AttributeSpread[];
2060
+ boundaryKind: BoundaryKind | null;
2061
+ isOpaque: boolean;
2062
+ /**
2063
+ * 公共 UI 组件调用边界(components/ui/*)。
2064
+ * 设计器只允许编辑调用处,不暴露公共实现或把该节点当作插入容器。
2065
+ */
2066
+ isPublicUiComponent?: boolean;
2067
+ /**
2068
+ * 组件来源文件(已解析路径,相对 projectRoot 或绝对路径)。
2069
+ * 仅 isOpaque=true 的组件节点才会有值;
2070
+ * graph-builder 阶段写入原始 specifier,
2071
+ * project-graph-builder 解析后替换为真实文件路径。
2072
+ */
2073
+ importedFrom?: string;
2074
+ /**
2075
+ * 组件在来源文件中的导出名。
2076
+ * 默认导出为 'default',具名导出为实际导出标识符名称。
2077
+ */
2078
+ exportName?: string;
2079
+ }
2080
+ interface RegionNode {
2081
+ kind: BoundaryKind;
2082
+ ownerKey: string;
2083
+ childKeys: string[];
2084
+ sourceRange: SourceRange;
2085
+ sourceCandidates?: SourceCandidate[];
2086
+ }
2087
+ interface TextExpressionSource {
2088
+ kind: "identifier" | "member-expression" | "index-expression";
2089
+ expression: string;
2090
+ base: string;
2091
+ path: Array<{
2092
+ kind: "property";
2093
+ name: string;
2094
+ } | {
2095
+ kind: "index";
2096
+ index: number;
2097
+ }>;
2098
+ }
2099
+ type StaticAttributeValue = string | number | boolean | null | StaticAttributeValue[] | {
2100
+ [key: string]: StaticAttributeValue;
2101
+ };
2102
+ interface AttributeSource {
2103
+ name: string;
2104
+ value: string;
2105
+ sourceRange: SourceRange;
2106
+ source: TextExpressionSource | null;
2107
+ resolvedValue?: StaticAttributeValue;
2108
+ syntaxKind?: "literal" | "boolean-shorthand" | "expression";
2109
+ raw?: string;
2110
+ order?: number;
2111
+ resolution?: AttributeValueResolution;
2112
+ }
2113
+ type AttributeValueResolution = {
2114
+ status: "resolved";
2115
+ value: StaticAttributeValue;
2116
+ } | {
2117
+ status: "undefined";
2118
+ } | {
2119
+ status: "unresolved";
2120
+ };
2121
+ interface AttributeSpread {
2122
+ raw: string;
2123
+ sourceRange: SourceRange;
2124
+ order: number;
2125
+ source: TextExpressionSource | null;
2126
+ }
2127
+ interface RepeatSourceCandidate {
2128
+ kind: "repeat-template";
2129
+ collectionExpression: string;
2130
+ collectionSource: TextExpressionSource | null;
2131
+ itemParamName?: string;
2132
+ indexParamName?: string;
2133
+ }
2134
+ interface ConditionalSourceCandidate {
2135
+ kind: "conditional-branch";
2136
+ conditionExpression: string;
2137
+ conditionSource: TextExpressionSource | null;
2138
+ }
2139
+ type SourceCandidate = RepeatSourceCandidate | ConditionalSourceCandidate;
2140
+ interface TextSegment {
2141
+ index: number;
2142
+ value: string;
2143
+ sourceRange: SourceRange;
2144
+ editable: boolean;
2145
+ source: TextExpressionSource | null;
2146
+ }
2147
+ interface RenderSourceGraph {
2148
+ /**
2149
+ * Engine-owned graph identity. Parser builders do not own this identity, so
2150
+ * low-level parser fixtures may omit it; lifecycle consumers must require it
2151
+ * before projecting protocol-facing data.
2152
+ */
2153
+ composition?: SiteEditCompositionContext;
2154
+ routeId: string;
2155
+ rootKeys: string[];
2156
+ elements: Map<string, ElementNode>;
2157
+ regions: RegionNode[];
2158
+ /** 文件 → keys 的反向索引 */
2159
+ fileIndex: Map<string, string[]>;
2160
+ version: number;
2161
+ /** 构图过程中可观测到的诊断信息。 */
2162
+ diagnostics?: GraphDiagnostic[];
2163
+ }
2164
+ type GraphDiagnosticCode = "parse-failed" | "import-resolve-failed" | "import-not-found" | "import-read-failed";
2165
+ interface GraphDiagnostic {
2166
+ path: string;
2167
+ code: GraphDiagnosticCode;
2168
+ message: string;
2169
+ details?: Record<string, unknown>;
2170
+ }
2171
+ interface LocalImportEdge {
2172
+ readonly specifier: string;
2173
+ }
2174
+ interface ParsedSourceModule {
2175
+ readonly file: string;
2176
+ readonly source: string;
2177
+ readonly sourceHash: string;
2178
+ readonly ast: File$1;
2179
+ readonly imports: readonly LocalImportEdge[];
2180
+ }
2181
+ interface PageCompositionPlacementUnitIndex {
2182
+ readonly placementUnitKey: string;
2183
+ readonly placementKeys: readonly string[];
2184
+ readonly sourcePlacementKey: string;
2185
+ }
2186
+ interface SourceRange$1 {
2187
+ startLine: number;
2188
+ startColumn: number;
2189
+ endLine: number;
2190
+ endColumn: number;
2191
+ }
2192
+ type Placement = "prepend" | "append" | "before" | "after";
2193
+ type ValuePathSegment = {
2194
+ kind: "property";
2195
+ name: string;
2196
+ } | {
2197
+ kind: "index";
2198
+ index: number;
2199
+ };
2200
+ type ValueRootSelector = {
2201
+ kind: "binding";
2202
+ name: string;
2203
+ } | {
2204
+ kind: "hook-state";
2205
+ name: string;
2206
+ hook: "useState" | "useReducer";
2207
+ } | {
2208
+ kind: "named-export";
2209
+ name: string;
2210
+ } | {
2211
+ kind: "default-export";
2212
+ } | {
2213
+ kind: "expression";
2214
+ sourceRange: SourceRange$1;
2215
+ };
2216
+ type JsxNodeLocator = {
2217
+ kind: "jsx-node";
2218
+ strategy: "source-range";
2219
+ sourceRange: SourceRange$1;
2220
+ expectedIdentity?: {
2221
+ file: string;
2222
+ component: string;
2223
+ structuralPath: string;
2224
+ };
2225
+ } | {
2226
+ kind: "jsx-node";
2227
+ strategy: "structural-path";
2228
+ file: string;
2229
+ component: string;
2230
+ structuralPath: string;
2231
+ expectedRange?: SourceRange$1;
2232
+ };
2233
+ interface ValueLocator {
2234
+ kind: "value";
2235
+ root: ValueRootSelector;
2236
+ path?: ValuePathSegment[];
2237
+ expectedRange?: SourceRange$1;
2238
+ }
2239
+ export interface PortableInvocationInput {
2240
+ /** A safe local JSX component name, or a member expression such as Generated.Card. */
2241
+ readonly component?: string | {
2242
+ readonly localName: string;
2243
+ };
2244
+ /** Alias kept for callers that already name the route local explicitly. */
2245
+ readonly componentName?: string;
2246
+ readonly bindings: readonly PortableInvocationBinding[];
2247
+ readonly targetBlockId: string;
2248
+ readonly targetOrder?: number | null;
2249
+ /** Used only after a supported route signature has selected an aliased local. */
2250
+ readonly searchParamsIdentifier?: string;
2251
+ }
2252
+ export interface PortableInvocationPlan {
2253
+ readonly kind: "portable-invocation";
2254
+ readonly component: string;
2255
+ readonly jsx: string;
2256
+ readonly bindings: readonly PortableInvocationBinding[];
2257
+ readonly targetBlockId: string;
2258
+ readonly targetOrder: number | null;
2259
+ readonly requiresRouteSearchParams: boolean;
2260
+ readonly searchParamsIdentifier: string | null;
2261
+ }
2262
+ export type PortableInvocationErrorCode = "INVOCATION_INPUT_INVALID" | "INVOCATION_COMPONENT_INVALID" | "INVOCATION_TARGET_BLOCK_INVALID" | "INVOCATION_TARGET_ORDER_INVALID" | "INVOCATION_DUPLICATE_PROP" | "INVOCATION_VALUE_UNRESOLVED" | "INVOCATION_SOURCE_METADATA";
2263
+ export interface PortableInvocationError {
2264
+ readonly code: PortableInvocationErrorCode;
2265
+ readonly path: string;
2266
+ readonly message: string;
2267
+ }
2268
+ export type PortableInvocationResult = {
2269
+ readonly ok: true;
2270
+ readonly plan: PortableInvocationPlan;
2271
+ } | {
2272
+ readonly ok: false;
2273
+ readonly error: PortableInvocationError;
2274
+ };
2275
+ /**
2276
+ * Build a JSX call from the closed T02 invocation value language.
2277
+ *
2278
+ * No caller-provided source text is parsed into the result. Every expression is
2279
+ * built from a validated JSON value or one of the two fixed server/identity
2280
+ * bindings, so this function cannot become an arbitrary JavaScript escape hatch.
2281
+ */
2282
+ export declare function buildPortableInvocation(input: PortableInvocationInput): PortableInvocationResult;
2283
+ export interface PortableBlockMetadataInput {
2284
+ /** A single JSX expression, when the caller is normalizing an entry root. */
2285
+ readonly jsx?: string;
2286
+ /** A full TS/TSX source module, when the caller is normalizing a materialized file. */
2287
+ readonly source?: string;
2288
+ readonly targetBlockId: string;
2289
+ readonly targetOrder: number;
2290
+ }
2291
+ export interface PortableBlockMetadataPlan {
2292
+ readonly kind: "portable-block-metadata";
2293
+ readonly source: string;
2294
+ /** Alias for callers that supplied a JSX expression. */
2295
+ readonly jsx: string;
2296
+ readonly targetBlockId: string;
2297
+ readonly targetOrder: number;
2298
+ readonly removedSourceBlockIdCount: number;
2299
+ readonly removedSourceOrderCount: number;
2300
+ }
2301
+ export type PortableBlockMetadataErrorCode = "BLOCK_METADATA_INPUT_INVALID" | "BLOCK_METADATA_TARGET_INVALID" | "BLOCK_METADATA_PARSE_FAILED" | "BLOCK_METADATA_ROOT_AMBIGUOUS";
2302
+ export interface PortableBlockMetadataError {
2303
+ readonly code: PortableBlockMetadataErrorCode;
2304
+ readonly path: string;
2305
+ readonly message: string;
2306
+ }
2307
+ export type PortableBlockMetadataResult = {
2308
+ readonly ok: true;
2309
+ readonly plan: PortableBlockMetadataPlan;
2310
+ } | {
2311
+ readonly ok: false;
2312
+ readonly error: PortableBlockMetadataError;
2313
+ };
2314
+ /**
2315
+ * Strip source-authored block id/order metadata and stamp the target identity
2316
+ * and composition order on the one portable block root. Type/variant and all
2317
+ * other business attributes remain in the AST untouched.
2318
+ */
2319
+ export declare function normalizePortableBlockMetadata(input: PortableBlockMetadataInput): PortableBlockMetadataResult;
2320
+ export interface RouteCompositionRewriteInput {
2321
+ routeId: string;
2322
+ entryFile: string;
2323
+ currentDocumentVersion: number;
2324
+ expectedDocumentVersion: number;
2325
+ source: string;
2326
+ projection: PageCompositionProjection;
2327
+ placementKey: string;
2328
+ component: {
2329
+ source: string;
2330
+ exportName: string;
2331
+ localName: string;
2332
+ };
2333
+ /** Optional closed invocation contract used by Portable Component installs. */
2334
+ invocation?: RouteCompositionInvocationInput;
2335
+ }
2336
+ export interface RouteCompositionInvocationInput {
2337
+ readonly bindings: readonly PortableInvocationBinding[];
2338
+ readonly targetBlockId: string;
2339
+ readonly targetOrder?: number | null;
2340
+ }
2341
+ export interface RouteCompositionSearchParamsStep {
2342
+ readonly kind: "ensure-search-params";
2343
+ readonly action: "reuse" | "add";
2344
+ readonly identifier: string;
2345
+ readonly typescript: boolean;
2346
+ }
2347
+ type RouteCompositionRewriteStep = {
2348
+ kind: "insert-child";
2349
+ parentLocator: JsxNodeLocator;
2350
+ node: {
2351
+ jsx: string;
2352
+ };
2353
+ placement: Placement;
2354
+ anchorLocator?: JsxNodeLocator;
2355
+ } | {
2356
+ kind: "insert-root-expression";
2357
+ locator: ValueLocator;
2358
+ sourceHash: string;
2359
+ node: {
2360
+ jsx: string;
2361
+ };
2362
+ placement: Placement;
2363
+ replaceOriginal: boolean;
2364
+ };
2365
+ export interface RouteCompositionRewritePlan {
2366
+ kind: "route-composition-rewrite";
2367
+ routeId: string;
2368
+ entryFile: string;
2369
+ documentVersion: number;
2370
+ placementKey: string;
2371
+ placementUnitKey: string;
2372
+ importStep: {
2373
+ kind: "add-import";
2374
+ moduleSpecifier: string;
2375
+ imports: Array<{
2376
+ kind: "named";
2377
+ imported: string;
2378
+ local?: string;
2379
+ } | {
2380
+ kind: "default";
2381
+ local: string;
2382
+ }>;
2383
+ };
2384
+ rewriteStep: RouteCompositionRewriteStep;
2385
+ /** Portable route invocation and server argument wiring. */
2386
+ invocation?: PortableInvocationPlan;
2387
+ serverParamsStep?: RouteCompositionSearchParamsStep;
2388
+ /** Compatibility mirrors for the legacy Portable API surface. */
2389
+ insertStep?: Extract<RouteCompositionRewriteStep, {
2390
+ kind: "insert-child";
2391
+ }>;
2392
+ returnStep?: {
2393
+ kind: "insert-return";
2394
+ node: {
2395
+ jsx: string;
2396
+ };
2397
+ placement: Placement;
2398
+ replaceOriginal: boolean;
2399
+ };
2400
+ }
2401
+ export interface RouteCompositionRewriteError {
2402
+ code: SiteEditPageCompositionErrorCode | "NO_SAFE_PAGE_PLACEMENT" | "UNRESOLVED_ROUTE_ANCHOR" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "PORTABLE_INVOCATION_INVALID" | "UNSUPPORTED_ROUTE_PARAMS";
2403
+ message: string;
2404
+ diagnostics: PageCompositionDiagnostic[];
2405
+ }
2406
+ export type RouteCompositionRewriteResult = {
2407
+ ok: true;
2408
+ plan: RouteCompositionRewritePlan;
2409
+ } | {
2410
+ ok: false;
2411
+ error: RouteCompositionRewriteError;
2412
+ };
2413
+ export interface PortableRouteCompositionPatchInput {
2414
+ readonly routeId: string;
2415
+ readonly composition?: SiteEditCompositionContext;
2416
+ readonly entryFile: string;
2417
+ readonly documentVersion: number;
2418
+ readonly source: string;
2419
+ readonly anchor: {
2420
+ /** Trusted route-local JSX component name resolved from the target block. */
2421
+ readonly componentName: string;
2422
+ readonly relation: "before" | "after";
2423
+ /** Exact resolver evidence; when present names are not used for selection. */
2424
+ readonly sourceRange?: PageCompositionSourceRange;
2425
+ };
2426
+ readonly component: RouteCompositionRewriteInput["component"];
2427
+ readonly invocation: RouteCompositionInvocationInput;
2428
+ }
2429
+ export interface PortableRouteCompositionPatchPlan {
2430
+ readonly kind: "portable-route-composition-patch";
2431
+ readonly path: string;
2432
+ readonly expectedSourceHash: string;
2433
+ readonly source: string;
2434
+ }
2435
+ export type PortableRouteCompositionPatchErrorCode = RouteCompositionRewriteError["code"] | "PORTABLE_ROUTE_SOURCE_INVALID" | "PORTABLE_ROUTE_UNSUPPORTED" | "PORTABLE_ROUTE_ANCHOR_MISSING" | "PORTABLE_ROUTE_ANCHOR_AMBIGUOUS" | "PORTABLE_ROUTE_PATCH_FAILED";
2436
+ export interface PortableRouteCompositionPatchError {
2437
+ readonly code: PortableRouteCompositionPatchErrorCode;
2438
+ readonly message: string;
2439
+ readonly diagnostics: readonly PageCompositionDiagnostic[];
2440
+ }
2441
+ export type PortableRouteCompositionPatchResult = {
2442
+ readonly ok: true;
2443
+ readonly plan: RouteCompositionRewritePlan;
2444
+ readonly patch: PortableRouteCompositionPatchPlan;
2445
+ } | {
2446
+ readonly ok: false;
2447
+ readonly error: PortableRouteCompositionPatchError;
2448
+ };
2449
+ export declare function planRouteCompositionRewrite(input: RouteCompositionRewriteInput): RouteCompositionRewriteResult;
2450
+ /**
2451
+ * Resolve, plan and apply one Portable route insertion through the canonical
2452
+ * page-composition planner. This is the package-boundary adapter used by the
2453
+ * production installer: callers choose only a proven route-local anchor and
2454
+ * closed invocation values, never arbitrary patches or replacement source.
2455
+ */
2456
+ export declare function planPortableRouteCompositionPatch(input: PortableRouteCompositionPatchInput): PortableRouteCompositionPatchResult;
2457
+ export interface ResolvePageCompositionInput {
2458
+ route: string;
2459
+ /** Concrete runtime identity; route is only the canonical display label. */
2460
+ composition: SiteEditCompositionContext;
2461
+ entryFile: string;
2462
+ version: number;
2463
+ source: string;
2464
+ /** Reuse the entry AST produced by SourceGraph; this resolver never parses source. */
2465
+ ast?: File$1;
2466
+ }
2467
+ export type PageCompositionResult = {
2468
+ ok: true;
2469
+ projection: PageCompositionProjection;
2470
+ } | {
2471
+ ok: false;
2472
+ projection: PageCompositionUnsupportedProjection;
2473
+ };
2474
+ export interface PageCompositionProjectionBase {
2475
+ composition: SiteEditCompositionContext;
2476
+ route: string;
2477
+ entryFile: string;
2478
+ version: number;
2479
+ documentVersion: number;
2480
+ }
2481
+ interface PageCompositionMutationTargetProjection {
2482
+ kind: "expression";
2483
+ documentVersion: number;
2484
+ sourceRange: PageCompositionSourceRange;
2485
+ sourceHash: string;
2486
+ }
2487
+ export interface PageCompositionProjection extends PageCompositionProjectionBase {
2488
+ status: "supported";
2489
+ defaultExportName: string | null;
2490
+ container: PageCompositionContainerProjection;
2491
+ placements: PageCompositionPlacementProjection[];
2492
+ placementByKey: ReadonlyMap<string, PageCompositionPlacementProjection>;
2493
+ unitByKey: ReadonlyMap<string, PageCompositionPlacementUnitIndex>;
2494
+ placementsByUnitKey: ReadonlyMap<string, readonly PageCompositionPlacementProjection[]>;
2495
+ /** Canonical source-bearing placement for compatibility with page-unit rewrites. */
2496
+ placementUnitByKey: ReadonlyMap<string, PageCompositionPlacementProjection>;
2497
+ mutationTarget: PageCompositionMutationTargetProjection;
2498
+ diagnostics: PageCompositionDiagnostic[];
2499
+ }
2500
+ export interface PageCompositionUnsupportedProjection extends PageCompositionProjectionBase {
2501
+ status: "unsupported";
2502
+ diagnostics: PageCompositionDiagnostic[];
2503
+ }
2504
+ export type PageCompositionDiagnosticCode = "ROUTE_RETURN_NOT_FOUND" | "MULTIPLE_PAGE_RETURNS" | "INDIRECT_RETURN_ONLY" | "UNSUPPORTED_PAGE_SHAPE" | "PLACEMENT_KEY_NOT_FOUND" | "DOCUMENT_VERSION_STALE";
2505
+ export interface PageCompositionDiagnostic {
2506
+ code: PageCompositionDiagnosticCode;
2507
+ message: string;
2508
+ details?: Record<string, unknown>;
2509
+ }
2510
+ type PageCompositionContainerKind = "virtual-route-root" | "jsx-container" | "starter-placeholder";
2511
+ type PageCompositionContainerSourceKind = "jsx-fragment" | "jsx-element" | "atomic-expression" | "starter-placeholder";
2512
+ export interface PageCompositionContainerProjection {
2513
+ kind: PageCompositionContainerKind;
2514
+ placementKey: string;
2515
+ placementUnitKey: string;
2516
+ version: number;
2517
+ isEmptyPage: boolean;
2518
+ sourceKind: PageCompositionContainerSourceKind;
2519
+ sourceRange: PageCompositionSourceRange | null;
2520
+ sourceHash: string | null;
2521
+ }
2522
+ export type PageCompositionMemberKind = "jsx-element" | "atomic-expression" | "text";
2523
+ export interface PageCompositionMemberProjection {
2524
+ memberKey: string;
2525
+ kind: PageCompositionMemberKind;
2526
+ nodeType: string;
2527
+ sourceRange: PageCompositionSourceRange | null;
2528
+ /** Number of mutually-exclusive business branches represented by this source member. */
2529
+ businessMemberCount: number;
2530
+ /** JSX child container used for the safe page-level insertion boundary. */
2531
+ parentSourceRange: PageCompositionSourceRange | null;
2532
+ /** Full ordered source subtree. Native JSX remains present; only fragments flatten. */
2533
+ children: PageCompositionMemberProjection[];
2534
+ /** Whether this source item is an addressable business projection. */
2535
+ isBusinessMember: boolean;
2536
+ label: string;
2537
+ }
2538
+ export interface PageCompositionPlacementProjection {
2539
+ placementKey: string;
2540
+ placementUnitKey: string;
2541
+ version: number;
2542
+ containerKey: string;
2543
+ independent: boolean;
2544
+ memberCount: number;
2545
+ sourceRange: PageCompositionSourceRange | null;
2546
+ sourceHash: string | null;
2547
+ relation: "before" | "after" | "prepend" | "append";
2548
+ containerSourceRange: PageCompositionSourceRange | null;
2549
+ /** Hash of the exact JSX container used as the mutation parent. */
2550
+ containerSourceHash?: string | null;
2551
+ anchorSourceRange: PageCompositionSourceRange | null;
2552
+ /** Hash of the before/after anchor, when the relation requires one. */
2553
+ anchorSourceHash?: string | null;
2554
+ members: PageCompositionMemberProjection[];
2555
+ }
2556
+ export interface PageCompositionSourceRange {
2557
+ startLine: number;
2558
+ startColumn: number;
2559
+ endLine: number;
2560
+ endColumn: number;
2561
+ }
2562
+ export type PageCompositionPlacementLookup = {
2563
+ ok: true;
2564
+ placement: PageCompositionPlacementProjection;
2565
+ } | {
2566
+ ok: false;
2567
+ diagnostic: PageCompositionDiagnostic;
2568
+ };
2569
+ export declare function resolvePageCompositionProjection(input: ResolvePageCompositionInput): PageCompositionResult;
2570
+ interface ProvenBlockCall {
2571
+ sourceFile: string;
2572
+ component: string;
2573
+ exportName: string;
2574
+ callLocator: {
2575
+ key: string;
2576
+ structuralPath: string;
2577
+ sourceRange: SourceRange;
2578
+ };
2579
+ }
2580
+ interface ProvenBlockOwner {
2581
+ kind: "route-member" | "component-definition";
2582
+ key: string;
2583
+ }
2584
+ interface BlockDiagnostic {
2585
+ code: string;
2586
+ message: string;
2587
+ file?: string;
2588
+ structuralPath?: string;
2589
+ }
2590
+ interface BlockGraphInput {
2591
+ composition: SiteEditCompositionContext;
2592
+ entryFile: string;
2593
+ graph: RenderSourceGraph;
2594
+ parsedModules: ReadonlyMap<string, ParsedSourceModule>;
2595
+ projection: PageCompositionProjection;
2596
+ }
2597
+ interface ProvenBlockRoot {
2598
+ rootKey: string;
2599
+ rootRef: BlockRenderRef;
2600
+ sourceFile: string;
2601
+ structuralPath: string;
2602
+ sourceRange: SourceRange;
2603
+ callChain: readonly ProvenBlockCall[];
2604
+ ownerNode: ProvenBlockOwner;
2605
+ ownerMemberKey: string;
2606
+ ownerCallKeys: readonly string[];
2607
+ parentStructuralPath: string | null;
2608
+ siblingRootKeys: readonly string[];
2609
+ siblingIndex: number;
2610
+ }
2611
+ export interface PageBlockSourceLocator {
2612
+ kind: "jsx-element";
2613
+ file: string;
2614
+ sourceRange: SourceRange;
2615
+ structuralPath: string;
2616
+ componentName: string;
2617
+ }
2618
+ export interface ResolvedPageBlock {
2619
+ blockKey: string;
2620
+ composition: SiteEditCompositionContext;
2621
+ documentVersion: number;
2622
+ descriptor: SiteEditPageBlockDescriptor;
2623
+ root: ProvenBlockRoot;
2624
+ ownerFile: string;
2625
+ ownerSourceHash: `sha256:${string}`;
2626
+ ownerSourceContent: string;
2627
+ sourceHash: `sha256:${string}`;
2628
+ sourceContent: string;
2629
+ rootLocator: PageBlockSourceLocator;
2630
+ ownerLocator: PageBlockSourceLocator;
2631
+ }
2632
+ export interface PageBlockIndex {
2633
+ composition: SiteEditCompositionContext;
2634
+ documentVersion: number;
2635
+ descriptors: BlockDirectory;
2636
+ bindings: ReadonlyMap<string, ResolvedPageBlock>;
2637
+ diagnostics: readonly BlockDiagnostic[];
2638
+ }
2639
+ export type BuildPageBlockIndexInput = BlockGraphInput & {
2640
+ documentVersion: number;
2641
+ roots: readonly ProvenBlockRoot[];
2642
+ };
2643
+ /** Build strict descriptors and server-side bindings from source-proven roots. */
2644
+ export declare function buildPageBlockIndex(input: BuildPageBlockIndexInput): PageBlockIndex;
2645
+ export interface PortableBlockSelection {
2646
+ readonly target: SiteEditPageBlockTarget;
2647
+ readonly root_ref: BlockRenderRef;
2648
+ readonly source_file: string;
2649
+ readonly structural_path: string;
2650
+ readonly content_hash: string;
2651
+ readonly source_range: PortableInvocationSourceRange;
2652
+ readonly owner: ResolvedPageBlock["descriptor"]["owner"];
2653
+ readonly call_chain: readonly PortableInvocationCall[];
2654
+ readonly strategy: "reuse-entry" | "extract-jsx" | "managed-thin-entry";
2655
+ readonly entry_file: string;
2656
+ readonly entry_export: {
2657
+ readonly kind: "default";
2658
+ } | {
2659
+ readonly kind: "named";
2660
+ readonly name: string;
2661
+ };
2662
+ readonly invocation: PortableInvocationAnalyzerResult | null;
2663
+ }
2664
+ export interface ResolvePortableBlockSelectionInput {
2665
+ readonly binding: ResolvedPageBlock;
2666
+ readonly files: ReadonlyMap<string, PortableSourceFileContent>;
2667
+ readonly hostCapabilities: GeneratedSiteCapabilities | null;
2668
+ }
2669
+ export type ResolvePortableBlockSelectionResult = {
2670
+ readonly complete: true;
2671
+ readonly selection: PortableBlockSelection;
2672
+ } | {
2673
+ readonly complete: false;
2674
+ readonly errors: readonly PortableInvocationAnalyzerError[];
2675
+ };
2676
+ /** Resolve one server-verified block to a precise, read-only Portable selection. */
2677
+ export declare function resolvePortableBlockSelection(input: ResolvePortableBlockSelectionInput): ResolvePortableBlockSelectionResult;
2678
+ export interface ExtractPortableBlockEntryInput {
2679
+ readonly selection: PortableBlockSelection;
2680
+ readonly files: ReadonlyMap<string, PortableSourceFileContent>;
2681
+ }
2682
+ export interface PortableBlockEntrySourceMapping extends PortableSourceMapping {
2683
+ }
2684
+ export type ExtractPortableBlockEntryResult = {
2685
+ readonly complete: true;
2686
+ readonly entry_file: string;
2687
+ readonly source_files: readonly PortableSourceNormalizerSourceFile[];
2688
+ readonly source_mapping: readonly PortableBlockEntrySourceMapping[];
2689
+ readonly invocation_bindings: readonly PortableInvocationBinding[];
2690
+ readonly selected_root_ref: BlockRenderRef;
2691
+ } | {
2692
+ readonly complete: false;
2693
+ readonly errors: readonly PortableSourceNormalizerError[];
2694
+ };
2695
+ /** Build an isolated, read-only entry for one T25-proven root. */
2696
+ export declare function extractPortableBlockEntry(input: ExtractPortableBlockEntryInput): ExtractPortableBlockEntryResult;
2697
+ interface StaticPrefabCreateOnlyFilePlan {
2698
+ kind: "create-only";
2699
+ path: string;
2700
+ content: string;
2701
+ role?: string;
2702
+ sourcePathTemplate: string;
2703
+ }
2704
+ interface StaticPrefabMaterializationError {
2705
+ code: "MATERIALIZATION_DATA_UNSUPPORTED" | "MATERIALIZATION_PATH_INVALID" | "MATERIALIZATION_ENTRY_INVALID" | "MATERIALIZATION_EXPORT_MISSING" | "MATERIALIZATION_IMPORT_FORBIDDEN" | "MATERIALIZATION_STYLE_FORBIDDEN" | "MATERIALIZATION_LIMIT_EXCEEDED" | "MATERIALIZATION_INSTANCE_CONFLICT" | "MATERIALIZATION_INSTANCE_INVALID";
2706
+ message: string;
2707
+ file?: string;
2708
+ path?: string;
2709
+ }
2710
+ export type PortableMaterializationRelatedEntry = PortableRelatedEntry;
2711
+ export interface PortableMaterializationResolved {
2712
+ readonly materialization: SiteEditMaterialization;
2713
+ /** Direct form used by Engine callers that already separated the entries. */
2714
+ readonly relatedEntries?: readonly PortableMaterializationRelatedEntry[];
2715
+ /** Adapted Component descriptor form returned by the API adapter. */
2716
+ readonly portable?: {
2717
+ readonly relatedEntries: readonly PortableMaterializationRelatedEntry[];
2718
+ };
2719
+ }
2720
+ export type PortableMaterializationExistingSources = ReadonlyMap<string, unknown> | Readonly<Record<string, unknown>> | readonly string[];
2721
+ export type PortableMaterializationEntryConsumerKind = "route" | "capability";
2722
+ export interface PortableMaterializationEntryConsumer {
2723
+ readonly entry_key: string;
2724
+ readonly requirement_key: string;
2725
+ readonly kind: PortableMaterializationEntryConsumerKind;
2726
+ readonly consumer_path: string;
2727
+ }
2728
+ export interface PortableMaterializationInput {
2729
+ readonly resolved: PortableMaterializationResolved;
2730
+ readonly trustedHostPolicy: GeneratedSiteCapabilities;
2731
+ readonly existingSources: PortableMaterializationExistingSources;
2732
+ /** Exact imports proven by server-owned form recipes; never read from the resource payload. */
2733
+ readonly trustedManagedImports?: readonly string[];
2734
+ readonly entryConsumers: readonly PortableMaterializationEntryConsumer[];
2735
+ readonly instanceId: string;
2736
+ }
2737
+ export interface PortableMaterializationPlan {
2738
+ readonly kind: "portable-materialization";
2739
+ readonly instanceId: string;
2740
+ readonly generatedRoot: string;
2741
+ readonly instanceRoot: string;
2742
+ readonly entry: {
2743
+ readonly path: string;
2744
+ readonly export: SiteEditMaterializationExport;
2745
+ };
2746
+ readonly relatedEntries: readonly (PortableMaterializationRelatedEntry & {
2747
+ readonly path: string;
2748
+ })[];
2749
+ readonly entryConsumers: readonly PortableMaterializationEntryConsumer[];
2750
+ readonly files: readonly StaticPrefabCreateOnlyFilePlan[];
2751
+ }
2752
+ export type PortableMaterializationErrorCode = StaticPrefabMaterializationError["code"] | "PORTABLE_INPUT_INVALID" | "PORTABLE_REQUIREMENT_UNRESOLVED" | "PORTABLE_ENTRY_UNCONSUMED" | "PORTABLE_INSTANCE_INVALID" | "PORTABLE_INSTANCE_CONFLICT";
2753
+ export interface PortableMaterializationError {
2754
+ readonly code: PortableMaterializationErrorCode;
2755
+ readonly message: string;
2756
+ readonly path?: string;
2757
+ }
2758
+ export type PortableMaterializationResult = {
2759
+ readonly ok: true;
2760
+ readonly data: PortableMaterializationPlan;
2761
+ } | {
2762
+ readonly ok: false;
2763
+ readonly error: PortableMaterializationError;
2764
+ };
2765
+ /**
2766
+ * Build a create-only plan for a resolved Portable component.
2767
+ *
2768
+ * This function is deliberately synchronous and side-effect free. It consumes
2769
+ * trusted host evidence and a read-only source index, but never installs
2770
+ * dependencies, writes a Snapshot, calls CMS, or invokes a model.
2771
+ */
2772
+ export declare function buildPortableMaterializationPlan(input: PortableMaterializationInput): PortableMaterializationResult;
2773
+ type BlockResolutionError = {
2774
+ ok: false;
2775
+ code: "INVALID_TARGET" | "VERSION_STALE" | "INVALID_PARAMS";
2776
+ message: string;
2777
+ };
2778
+ export type BlockResolution = {
2779
+ ok: true;
2780
+ binding: ResolvedPageBlock;
2781
+ } | BlockResolutionError;
2782
+ export interface BoundarySourceLocator {
2783
+ kind: "jsx-element" | "jsx-fragment";
2784
+ file: string;
2785
+ sourceRange: SourceRange;
2786
+ structuralPath?: string;
2787
+ componentName?: string;
2788
+ }
2789
+ export interface ResolvedBlockBoundary {
2790
+ ownerFile: string;
2791
+ parentLocator: BoundarySourceLocator | null;
2792
+ anchorLocator: BoundarySourceLocator;
2793
+ sourceHash: `sha256:${string}`;
2794
+ placement: "before" | "after";
2795
+ beforeBlockKey: string | null;
2796
+ afterBlockKey: string | null;
2797
+ }
2798
+ export type BlockBoundaryResolution = {
2799
+ ok: true;
2800
+ boundary: ResolvedBlockBoundary;
2801
+ } | BlockResolutionError;
2802
+ export declare function resolvePageBlockTarget(index: PageBlockIndex, target: SiteEditPageBlockTarget, documentVersion: number, selectionRef?: BlockRenderRef): BlockResolution;
2803
+ export declare function resolvePageBlockBoundary(index: PageBlockIndex, position: SiteEditPageBlockPosition): BlockBoundaryResolution;
2804
+ export interface PortableBlockCompositionPatchInput {
2805
+ readonly routeId: string;
2806
+ readonly entryFile: string;
2807
+ readonly documentVersion: number;
2808
+ /** The same resolver-produced binding used to obtain resolvedBoundary. */
2809
+ readonly binding: ResolvedPageBlock;
2810
+ readonly resolvedBoundary: ResolvedBlockBoundary;
2811
+ readonly component: RouteCompositionRewriteInput["component"];
2812
+ readonly invocation: RouteCompositionInvocationInput;
2813
+ readonly files: ReadonlyMap<string, string>;
2814
+ }
2815
+ export interface PortableBlockCompositionPatch {
2816
+ readonly path: string;
2817
+ readonly source: string;
2818
+ readonly baseContentHash: `sha256:${string}`;
2819
+ }
2820
+ export interface PortableBlockCompositionPatchError {
2821
+ readonly code: string;
2822
+ readonly message: string;
2823
+ readonly path?: string;
2824
+ }
2825
+ export type PortableBlockCompositionPatchResult = {
2826
+ readonly ok: true;
2827
+ readonly patches: readonly PortableBlockCompositionPatch[];
2828
+ } | {
2829
+ readonly ok: false;
2830
+ readonly error: PortableBlockCompositionPatchError;
2831
+ };
2832
+ /**
2833
+ * Plan one Portable invocation at a resolver-proven block boundary. Direct
2834
+ * route members reuse the existing route-composition planner; shared component
2835
+ * owners receive one exact AST child insertion in their own source file.
2836
+ */
2837
+ export declare function planPortableBlockPatch(input: PortableBlockCompositionPatchInput): PortableBlockCompositionPatchResult;
2838
+ export interface BlockSnapshotInput {
2839
+ site_id: string;
2840
+ base_snapshot_id: string;
2841
+ composition: SiteEditCompositionSelector;
2842
+ document_version: number;
2843
+ target: SiteEditPageBlockTarget;
2844
+ selection_ref?: BlockRenderRef;
2845
+ files: ReadonlyMap<string, string | Uint8Array>;
2846
+ }
2847
+ export type PageBlockSnapshotResolution = BlockResolution & {
2848
+ index?: PageBlockIndex;
2849
+ };
2850
+ export declare function resolvePageBlockFromSnapshot(input: BlockSnapshotInput): Promise<PageBlockSnapshotResolution>;
2851
+ export type PortableMediaReferenceKind = "src" | "srcset" | "poster" | "thumbnail" | "object" | "array-item" | "import" | "manifest";
2852
+ export type PortableMediaReferenceSource = "jsx-attribute" | "object-property" | "array-item" | "import" | "media-manifest";
2853
+ export interface PortableMediaSourceRange {
2854
+ readonly start_offset: number;
2855
+ readonly end_offset: number;
2856
+ readonly start_line: number;
2857
+ readonly start_column: number;
2858
+ readonly end_line: number;
2859
+ readonly end_column: number;
2860
+ }
2861
+ export interface PortableMediaReference {
2862
+ readonly file_path: string;
2863
+ readonly occurrence: number;
2864
+ readonly kind: PortableMediaReferenceKind;
2865
+ readonly source: PortableMediaReferenceSource;
2866
+ readonly value: string | null;
2867
+ readonly expression: string;
2868
+ readonly asset_key: string | null;
2869
+ readonly source_range: PortableMediaSourceRange;
2870
+ /** Digest of the original AST/source occurrence, not downloaded bytes. */
2871
+ readonly content_digest: string;
2872
+ readonly complete: boolean;
2873
+ }
2874
+ export type PortableMediaReferenceScanErrorCode = "MEDIA_SOURCE_PARSE_FAILED" | "MEDIA_VALUE_UNKNOWN" | "MEDIA_MANIFEST_KEY_UNKNOWN";
2875
+ export interface PortableMediaReferenceScanError {
2876
+ readonly code: PortableMediaReferenceScanErrorCode;
2877
+ readonly file_path: string;
2878
+ readonly message: string;
2879
+ readonly source_range?: PortableMediaSourceRange;
2880
+ }
2881
+ export interface PortableMediaReferenceScanInput {
2882
+ readonly file_path: string;
2883
+ readonly source: string;
2884
+ readonly media_manifest?: Readonly<Record<string, string>>;
2885
+ }
2886
+ export interface PortableMediaReferenceScanResult {
2887
+ readonly complete: boolean;
2888
+ readonly references: readonly PortableMediaReference[];
2889
+ readonly errors: readonly PortableMediaReferenceScanError[];
2890
+ }
2891
+ export declare function scanPortableMediaReferences(input: PortableMediaReferenceScanInput): PortableMediaReferenceScanResult;
2892
+
2893
+ export {
2894
+ SiteEditEngineComposition$1 as SiteEditEngineComposition,
2895
+ };
2896
+
2897
+ export {};