@pygmalionjs/pygmalion 0.6.29 → 0.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,8 @@
1
+ import type { DesignCodegenProjectManifest } from './editor/designCompiler';
1
2
  export interface AppProps {
2
3
  /** The route identity is stable enough to read or produce preview artifacts. */
3
4
  previewIdentityReady?: boolean;
5
+ /** Checked-in host contract used by repository-aware codegen adapters. */
6
+ codegenProject?: DesignCodegenProjectManifest;
4
7
  }
5
8
  export declare const App: import("react").FunctionComponent<AppProps>;
@@ -2,6 +2,8 @@ import { type CodegenFrameOptions, type CodegenNode } from './codegen';
2
2
  import { type NodeJSON } from './store';
3
3
  export declare const DESIGN_IR_SCHEMA: "pygmalion.design-ir";
4
4
  export declare const DESIGN_IR_VERSION: 1;
5
+ export declare const DESIGN_CODEGEN_PROJECT_SCHEMA: "pygmalion.codegen-project";
6
+ export declare const DESIGN_CODEGEN_PROJECT_VERSION: 1;
5
7
  export type DesignCompilePurpose = 'interactive' | 'export';
6
8
  export type DesignCompileSeverity = 'info' | 'warning' | 'error';
7
9
  export type DesignCompileStage = 'normalize' | 'analyze' | 'generate' | 'resource';
@@ -43,6 +45,70 @@ export interface DesignIRMetrics {
43
45
  componentCount: number;
44
46
  assetCount: number;
45
47
  }
48
+ /** JSON-shaped host data produced from a repository-owned codegen contract. */
49
+ export type DesignCodegenData = null | string | number | boolean | readonly DesignCodegenData[] | {
50
+ readonly [key: string]: DesignCodegenData;
51
+ };
52
+ export interface DesignCodegenPromptReference {
53
+ /** Repository-relative agent instruction file used to author this manifest. */
54
+ sourcePath: string;
55
+ /** Host-owned revision bumped when the instructions or output contract change. */
56
+ revision: string;
57
+ }
58
+ export interface DesignCodegenFrameContract {
59
+ /** Canonical source anchors chosen by the host, in addition to observed files. */
60
+ sourcePaths?: readonly string[];
61
+ /** Adapter-specific, deterministic metadata. It is never interpreted by core. */
62
+ metadata?: Readonly<Record<string, DesignCodegenData>>;
63
+ }
64
+ /**
65
+ * Checked-in output of a repository's codegen instructions.
66
+ *
67
+ * The prompt is provenance, not a runtime dependency: adapters consume this
68
+ * manifest synchronously and never call a model while the editor is open.
69
+ */
70
+ export interface DesignCodegenProjectManifest {
71
+ schema: typeof DESIGN_CODEGEN_PROJECT_SCHEMA;
72
+ version: typeof DESIGN_CODEGEN_PROJECT_VERSION;
73
+ defaultTarget?: string;
74
+ prompt?: DesignCodegenPromptReference;
75
+ frames?: Readonly<Record<string, DesignCodegenFrameContract>>;
76
+ }
77
+ export interface DesignCodegenPageContext {
78
+ /** Canonical import id when available, otherwise the editor-local page id. */
79
+ id: string;
80
+ name: string;
81
+ route?: string;
82
+ previewRoute?: string;
83
+ sourcePaths: readonly string[];
84
+ flow?: string;
85
+ scenario?: string;
86
+ state?: string;
87
+ stateKind?: string;
88
+ scenarioId?: string;
89
+ scenarioIds: readonly string[];
90
+ desiredState?: Readonly<Record<string, DesignCodegenData>>;
91
+ /** Current reproducible recipe; direct state stays separate for easy adapters. */
92
+ capture: {
93
+ environment?: DesignCodegenData;
94
+ preset?: DesignCodegenData;
95
+ interactions: readonly DesignCodegenData[];
96
+ assertions: readonly DesignCodegenData[];
97
+ };
98
+ interactiveStateId?: string;
99
+ interactiveOptionId?: string;
100
+ interactiveOptionIds?: readonly string[];
101
+ viewport: {
102
+ width: number;
103
+ height: number;
104
+ };
105
+ /** Frame-specific checked-in contract selected by id. */
106
+ contract?: DesignCodegenFrameContract;
107
+ }
108
+ export interface DesignCodegenRuntimeContext {
109
+ page?: DesignCodegenPageContext;
110
+ project?: DesignCodegenProjectManifest;
111
+ }
46
112
  export interface DesignIntermediateDocumentV1 {
47
113
  schema: typeof DESIGN_IR_SCHEMA;
48
114
  version: typeof DESIGN_IR_VERSION;
@@ -61,7 +127,7 @@ export interface DesignCompileLimits {
61
127
  maxOutputBytes: number;
62
128
  }
63
129
  export declare const DEFAULT_DESIGN_COMPILE_LIMITS: Readonly<DesignCompileLimits>;
64
- export interface DesignCodegenAdapterContext {
130
+ export interface DesignCodegenAdapterContext extends DesignCodegenRuntimeContext {
65
131
  document: DesignIntermediateDocumentV1;
66
132
  }
67
133
  export interface DesignCodegenAdapterOutput {
@@ -73,6 +139,13 @@ export interface DesignCodegenAdapter {
73
139
  label: string;
74
140
  language: string;
75
141
  extension: string;
142
+ /**
143
+ * Repository adapters generate from checked-in source contracts rather than
144
+ * approximating the captured design tree. They still receive the document
145
+ * for source-map context, but design-IR warnings and preview size deferral do
146
+ * not describe their output.
147
+ */
148
+ basis?: 'design-ir' | 'repository';
76
149
  generate(context: DesignCodegenAdapterContext): string | DesignCodegenAdapterOutput;
77
150
  }
78
151
  export interface DesignCompileOptions {
@@ -81,6 +154,8 @@ export interface DesignCompileOptions {
81
154
  force?: boolean;
82
155
  frame?: CodegenFrameOptions;
83
156
  limits?: Partial<DesignCompileLimits>;
157
+ /** Current repository frame and checked-in codegen contract for host adapters. */
158
+ context?: DesignCodegenRuntimeContext;
84
159
  }
85
160
  export interface DesignCompileResult {
86
161
  target: string;
@@ -18,6 +18,7 @@ import type { StoryboardDefinition } from './editor/storyboardGraph';
18
18
  import { type TokenDef } from './editor/tokens';
19
19
  import { type ViewportPresetDef } from './editor/viewportPresets';
20
20
  import { type PreviewEnvironmentControlDef } from './editor/previewEnvironmentControls';
21
+ import type { DesignCodegenProjectManifest } from './editor/designCompiler';
21
22
 
22
23
  export { setComponentRegistry } from './editor/registry';
23
24
  export { PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX, previewCaptureProgressEndpoint, usePygmalionPreviewCaptureProgress, } from './editor/previewCaptureProgress';
@@ -27,8 +28,8 @@ export type { FrameInteractionPhase, FrameInteractionScrollState, FrameInteracti
27
28
  export type { ComponentRegistry, RegistryEntry, RegistryPropValue, } from './editor/registry';
28
29
  export { enumerateDesignComponentConnectionCases, getDesignComponentConnection, getDesignComponentConnectionForComponent, getDesignComponentConnections, setDesignComponentConnections, validateDesignComponentConnections, } from './editor/componentConnections';
29
30
  export type { DesignComponentConnectionCase, DesignComponentConnectionCases, DesignComponentConnectionDef, DesignComponentReference, DesignConnectionDiagnostic, DesignConnectionPropertyDef, DesignConnectionPropertyKind, } from './editor/componentConnections';
30
- export { compileDesignDocument, createDesignIntermediateDocument, DEFAULT_DESIGN_COMPILE_LIMITS, DESIGN_IR_SCHEMA, DESIGN_IR_VERSION, getDesignCodegenAdapters, registerDesignCodegenAdapter, } from './editor/designCompiler';
31
- export type { DesignCodegenAdapter, DesignCodegenAdapterContext, DesignCodegenAdapterOutput, DesignCompileDiagnostic, DesignCompileLimits, DesignCompileOptions, DesignCompilePurpose, DesignCompileResult, DesignCompileSeverity, DesignCompileStage, DesignCompileStatus, DesignIntermediateDocumentV1, DesignIRAsset, DesignIRComponent, DesignIRMetrics, } from './editor/designCompiler';
31
+ export { compileDesignDocument, createDesignIntermediateDocument, DEFAULT_DESIGN_COMPILE_LIMITS, DESIGN_CODEGEN_PROJECT_SCHEMA, DESIGN_CODEGEN_PROJECT_VERSION, DESIGN_IR_SCHEMA, DESIGN_IR_VERSION, getDesignCodegenAdapters, registerDesignCodegenAdapter, } from './editor/designCompiler';
32
+ export type { DesignCodegenAdapter, DesignCodegenAdapterContext, DesignCodegenAdapterOutput, DesignCodegenData, DesignCodegenFrameContract, DesignCodegenPageContext, DesignCodegenProjectManifest, DesignCodegenPromptReference, DesignCodegenRuntimeContext, DesignCompileDiagnostic, DesignCompileLimits, DesignCompileOptions, DesignCompilePurpose, DesignCompileResult, DesignCompileSeverity, DesignCompileStage, DesignCompileStatus, DesignIntermediateDocumentV1, DesignIRAsset, DesignIRComponent, DesignIRMetrics, } from './editor/designCompiler';
32
33
  export type { CodegenFrameOptions } from './editor/codegen';
33
34
  export { createDesignComponentCatalog, createDesignComponentVariantMatrix, createDesignGalleryCatalog, designCatalogKey, designCatalogRegistryName, PygmalionCatalogDocument, PygmalionCatalogMatrix, PygmalionCatalogSection, } from './editor/catalog';
34
35
  export type { DesignCatalogBuild, DesignCatalogFrame, DesignCatalogItem, DesignCatalogKind, DesignCatalogPageDescriptor, DesignComponentCatalogOptions, DesignComponentVariantMatrix, DesignGalleryCatalogOptions, PygmalionCatalogDocumentProps, PygmalionCatalogMatrixProps, PygmalionCatalogSectionProps, } from './editor/catalog';
@@ -281,7 +282,7 @@ export declare function pygmalionOpenPreview(): void;
281
282
  export declare function pygmalionResetCurrentEdits(): boolean;
282
283
  export interface InitialPageDef extends DesignImportInitialPage {
283
284
  }
284
- export declare function PygmalionEditor({ registry, tokens, initialPages, initialCanvas, initialEditMode, componentConnections, viewportPresets, sessionPresets, previewEnvironmentControls, designImport, onTokensChange, appOrigin, previewRevision, previewCacheNamespace, previewArtifacts, previewArtifactEndpoint, previewConcurrency, previewOpen, onPreviewOpenChange, flowCanvas, frameSurface, captureSupply, screenFlows, screenFlowConcurrency, scenarioCoverage, screenDimensions, screenLists, sectionHeaders, sectionHeaderLabels, screenLanes, frameBranchKinds, frameLabelLabels, screenCards, liveScreenBudget, screenStateAxes, interactiveStates, surfaceClassifications, onApply, onDesignChange, onInspectApply, onInspectPreview, onInspectImpact, storyboard, storyboardScenarios, sessionStoryboards, storyboardDiscovery, storyboardDiscoveryEndpoint, }: {
285
+ export declare function PygmalionEditor({ registry, tokens, initialPages, initialCanvas, initialEditMode, componentConnections, codegenProject, viewportPresets, sessionPresets, previewEnvironmentControls, designImport, onTokensChange, appOrigin, previewRevision, previewCacheNamespace, previewArtifacts, previewArtifactEndpoint, previewConcurrency, previewOpen, onPreviewOpenChange, flowCanvas, frameSurface, captureSupply, screenFlows, screenFlowConcurrency, scenarioCoverage, screenDimensions, screenLists, sectionHeaders, sectionHeaderLabels, screenLanes, frameBranchKinds, frameLabelLabels, screenCards, liveScreenBudget, screenStateAxes, interactiveStates, surfaceClassifications, onApply, onDesignChange, onInspectApply, onInspectPreview, onInspectImpact, storyboard, storyboardScenarios, sessionStoryboards, storyboardDiscovery, storyboardDiscoveryEndpoint, }: {
285
286
  registry?: ComponentRegistry;
286
287
  tokens?: TokenDef[];
287
288
  initialPages?: InitialPageDef[];
@@ -296,6 +297,11 @@ export declare function PygmalionEditor({ registry, tokens, initialPages, initia
296
297
  initialEditMode?: 'edit' | 'view-only';
297
298
  /** Explicit external-design to registered-code component mappings. */
298
299
  componentConnections?: readonly DesignComponentConnectionDef[];
300
+ /**
301
+ * Checked-in repository contract for deterministic, state-aware codegen.
302
+ * Its prompt reference is provenance only; no model runs in the editor.
303
+ */
304
+ codegenProject?: DesignCodegenProjectManifest;
299
305
  /** Named frame widths the application supports — rendered as one-click buttons beside the W/H boxes. */
300
306
  viewportPresets?: readonly ViewportPresetDef[];
301
307
  /**
@@ -1 +1,4 @@
1
- export declare const CodePanel: import("react").FunctionComponent<object>;
1
+ import { type DesignCodegenProjectManifest } from '../editor/designCompiler';
2
+ export declare const CodePanel: import("react").FunctionComponent<{
3
+ codegenProject?: DesignCodegenProjectManifest;
4
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.6.29",
3
+ "version": "0.6.30",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {