@pygmalionjs/pygmalion 0.6.35 → 0.7.2
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/LICENSE +190 -0
- package/README.ko.md +309 -28
- package/README.md +37 -16
- package/dist-lib/CameraLayer-D2wrEPwG.js +415 -0
- package/dist-lib/frameLodRuntime-CU0IYaSu.js +272 -0
- package/dist-lib/pygmalion.js +11615 -15973
- package/dist-lib/routePreviewStatus-DTr-UJhV.js +64 -0
- package/dist-lib/{FrozenRoutePreview-BbF5Ov5K.js → runtime-DRkTU9eq.js} +9515 -5306
- package/dist-lib/testing.js +46 -6
- package/dist-lib/types/{App.d.ts → EditorShell.d.ts} +1 -1
- package/dist-lib/types/canvas/CameraLayer.d.ts +2 -1
- package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
- package/dist-lib/types/canvas/FrameView.d.ts +1 -1
- package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
- package/dist-lib/types/canvas/SectionBoxes.d.ts +2 -1
- package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +1 -1
- package/dist-lib/types/contract/errors.d.ts +30 -0
- package/dist-lib/types/contract/index.d.ts +5 -0
- package/dist-lib/types/contract/memoryTransport.d.ts +19 -0
- package/dist-lib/types/contract/paths.d.ts +57 -0
- package/dist-lib/types/contract/transport.d.ts +69 -0
- package/dist-lib/types/contract/types.d.ts +150 -0
- package/dist-lib/types/contract/validate.d.ts +15 -0
- package/dist-lib/types/contract/viteTransport.d.ts +10 -0
- package/dist-lib/types/core/context.d.ts +12 -0
- package/dist-lib/types/core/debug.d.ts +187 -0
- package/dist-lib/types/core/defaultRuntime.d.ts +3 -0
- package/dist-lib/types/core/hostBindings.d.ts +90 -0
- package/dist-lib/types/core/runtime.d.ts +36 -0
- package/dist-lib/types/core/runtimeContext.d.ts +13 -0
- package/dist-lib/types/editor/flowSessionScheduler.d.ts +21 -7
- package/dist-lib/types/editor/framePreviewKeys.d.ts +10 -10
- package/dist-lib/types/editor/host.d.ts +31 -26
- package/dist-lib/types/editor/previewBootstrap.d.ts +5 -15
- package/dist-lib/types/editor/previewCaptureProgress.d.ts +7 -2
- package/dist-lib/types/editor/projectRuntime.d.ts +11 -98
- package/dist-lib/types/editor/revisionCatalog.d.ts +8 -9
- package/dist-lib/types/editor/scenarioCoverage.d.ts +2 -1
- package/dist-lib/types/editor/store.d.ts +17 -2
- package/dist-lib/types/editor/storyboardComposition.d.ts +1 -5
- package/dist-lib/types/editor/storyboardDiscovery.d.ts +6 -16
- package/dist-lib/types/editor/storyboardEnvironment.d.ts +2 -2
- package/dist-lib/types/editor/variantPrefetch.d.ts +3 -2
- package/dist-lib/types/editor/visualQa.d.ts +7 -2
- package/dist-lib/types/lib.d.ts +25 -204
- package/dist-lib/types/shell/ComponentStateControls.d.ts +1 -1
- package/dist-lib/types/testing.d.ts +5 -1
- package/node/component-branches.mjs +3 -3
- package/node/contract.d.mts +63 -0
- package/node/contract.mjs +175 -0
- package/node/design-session.mjs +4 -2
- package/node/dev-mirror.mjs +6 -3
- package/node/inspect-plugin.mjs +3 -2
- package/node/preview-artifact-plugin.mjs +13 -16
- package/node/preview-artifact-store.mjs +4 -2
- package/node/qa-capture-plugin.mjs +3 -2
- package/node/storyboard-canonical.mjs +2 -2
- package/node/storyboard-capture-runtime.mjs +2 -2
- package/node/storyboard-environment.mjs +9 -6
- package/node/vite.mjs +2 -13
- package/package.json +24 -4
- package/storyboard.d.ts +11 -0
package/dist-lib/testing.js
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cu as l, bK as u } from "./runtime-DRkTU9eq.js";
|
|
2
|
+
import { cd as w, cD as E, cE as b, cF as P, aH as R, b3 as $, bU as q } from "./runtime-DRkTU9eq.js";
|
|
3
|
+
const v = {
|
|
4
|
+
mirror: ["status", "refresh", "refs"],
|
|
5
|
+
session: ["open", "check", "previewVisual", "applyVisual", "revertVisual"],
|
|
6
|
+
inspect: ["impact"],
|
|
7
|
+
qa: ["capture"],
|
|
8
|
+
preview: ["artifact", "progress", "catalog"],
|
|
9
|
+
storyboard: ["environment", "sourceUsage", "componentBranches"]
|
|
10
|
+
};
|
|
11
|
+
function g(m = {}, t = {}) {
|
|
12
|
+
const n = [], d = t.origin ?? "", e = (r) => {
|
|
13
|
+
var a;
|
|
14
|
+
const i = {};
|
|
15
|
+
for (const o of v[r]) {
|
|
16
|
+
const s = `${r}.${String(o)}`, c = (a = m[r]) == null ? void 0 : a[o];
|
|
17
|
+
i[String(o)] = (...p) => (n.push({ operation: s, request: p[0] }), c ? Promise.resolve(c(...p)) : Promise.reject(
|
|
18
|
+
new u({
|
|
19
|
+
operation: s,
|
|
20
|
+
code: "not_implemented",
|
|
21
|
+
message: `The memory transport has no handler for ${s}.`
|
|
22
|
+
})
|
|
23
|
+
));
|
|
24
|
+
}
|
|
25
|
+
return i;
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
calls: n,
|
|
29
|
+
endpoints: l(t.endpoints),
|
|
30
|
+
resolveUrl: (r) => `${d}${r}`,
|
|
31
|
+
mirror: e("mirror"),
|
|
32
|
+
session: e("session"),
|
|
33
|
+
inspect: e("inspect"),
|
|
34
|
+
qa: e("qa"),
|
|
35
|
+
preview: e("preview"),
|
|
36
|
+
storyboard: e("storyboard")
|
|
37
|
+
};
|
|
38
|
+
}
|
|
2
39
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
40
|
+
w as EditorRuntimeProvider,
|
|
41
|
+
E as EditorStore,
|
|
42
|
+
b as FrozenRoutePreviewView,
|
|
43
|
+
P as NodeModel,
|
|
44
|
+
R as createEditorRuntime,
|
|
45
|
+
g as createMemoryTransport,
|
|
46
|
+
$ as serializeNode,
|
|
47
|
+
q as setComponentRegistry
|
|
8
48
|
};
|
|
@@ -9,4 +9,4 @@ export interface AppProps {
|
|
|
9
9
|
/** Host source/revision identity included in the validation lifecycle. */
|
|
10
10
|
codegenValidationScope?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const EditorShell: import("react").FunctionComponent<AppProps>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type FrameLodFrame } from '../editor/frameLod';
|
|
3
|
+
import type { EditorRuntime } from '../core/runtime';
|
|
3
4
|
export declare function resolveCameraPointerEvents(editMode: boolean, tool: string, interactionActive: boolean): 'none' | undefined;
|
|
4
5
|
/** Diagnostic passthrough for headless debugging of the LOD frame inputs. */
|
|
5
|
-
export declare function __debugReadEditorFrames(): (FrameLodFrame & {
|
|
6
|
+
export declare function __debugReadEditorFrames(runtime: EditorRuntime): (FrameLodFrame & {
|
|
6
7
|
memoKey?: string;
|
|
7
8
|
})[];
|
|
8
9
|
export declare function CameraLayer({ children, interactionFrameId, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FrameInteractionPhase } from '../editor/frameInteraction';
|
|
2
|
-
import {
|
|
2
|
+
import type { PageModel } from '../editor/store';
|
|
3
3
|
export declare const FrameView: import("react").FunctionComponent<{
|
|
4
4
|
page: PageModel;
|
|
5
5
|
active: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PageModel } from '../editor/store';
|
|
2
2
|
export declare function FrozenRoutePreviewView({ page, snapshot, height, onDocumentReady, onDocumentHeightChange, onReplayIssuesChange, }: {
|
|
3
3
|
page: PageModel;
|
|
4
4
|
snapshot: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EditorStore } from '../editor/store';
|
|
1
2
|
export declare const SECTION_PAD = 28;
|
|
2
3
|
/**
|
|
3
4
|
* Section bounds on the active canvas — the union of explicit section
|
|
@@ -13,7 +14,7 @@ export declare const SECTION_PAD = 28;
|
|
|
13
14
|
* section. Understating is the safe direction, and nothing is drawn from
|
|
14
15
|
* these bounds any more that a designer could see the shortfall in.
|
|
15
16
|
*/
|
|
16
|
-
export declare function sectionBounds(): Map<string, {
|
|
17
|
+
export declare function sectionBounds(editor: EditorStore): Map<string, {
|
|
17
18
|
x0: number;
|
|
18
19
|
y0: number;
|
|
19
20
|
x1: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RoutePreviewShadowArtifact } from '../editor/routePreview';
|
|
2
|
-
import {
|
|
2
|
+
import type { PageModel } from '../editor/store';
|
|
3
3
|
export declare const ShadowRoutePreview: import("react").FunctionComponent<{
|
|
4
4
|
page: PageModel;
|
|
5
5
|
snapshot?: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface TransportErrorInit {
|
|
2
|
+
/** The operation that failed, e.g. `preview.artifact`. */
|
|
3
|
+
operation: string;
|
|
4
|
+
/**
|
|
5
|
+
* A machine code: the server's own when its `error` field is one,
|
|
6
|
+
* otherwise `request_failed`, `invalid_json`, `invalid_response`,
|
|
7
|
+
* `network`, `service_not_configured`, or `not_implemented`.
|
|
8
|
+
*/
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
status?: number;
|
|
12
|
+
retryable?: boolean;
|
|
13
|
+
preparing?: boolean;
|
|
14
|
+
details?: readonly string[];
|
|
15
|
+
/** The parsed body, for a caller that needs more than the code. */
|
|
16
|
+
payload?: unknown;
|
|
17
|
+
cause?: unknown;
|
|
18
|
+
}
|
|
19
|
+
export declare class TransportError extends Error {
|
|
20
|
+
readonly operation: string;
|
|
21
|
+
readonly code: string;
|
|
22
|
+
readonly status: number | undefined;
|
|
23
|
+
readonly retryable: boolean;
|
|
24
|
+
readonly preparing: boolean;
|
|
25
|
+
readonly details: readonly string[];
|
|
26
|
+
readonly payload: unknown;
|
|
27
|
+
constructor(init: TransportErrorInit);
|
|
28
|
+
/** Structural, so an error from another module instance of this class still counts. */
|
|
29
|
+
static is(value: unknown): value is TransportError;
|
|
30
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PREVIEW_CAPTURE_PRIORITY, PYGMALION_ENDPOINTS, PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX, PYGMALION_REVISION_CATALOG_SUFFIX, PYGMALION_SOURCE_USAGE_MAX_FILES, PYGMALION_STORYBOARD_ENVIRONMENT_QUERY, normalizePygmalionEndpoint, resolvePygmalionEndpoints, type PreviewCapturePriority, type PygmalionEndpointOverrides, type PygmalionEndpoints, } from './paths.js';
|
|
2
|
+
export { TransportError, type TransportErrorInit } from './errors.js';
|
|
3
|
+
export type { EditorTransport, TransportCallOptions, TransportFetch, TransportRequestInit, TransportResponse, } from './transport.js';
|
|
4
|
+
export { createViteTransport, type ViteTransportOptions } from './viteTransport.js';
|
|
5
|
+
export type { ComponentBranchesRequest, InspectImpactRequest, MirrorRefreshRequest, PreviewCatalogRequest, PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionIntegrationState, PygmalionRevertResult, PygmalionSessionOperation, PygmalionSourceRef, PygmalionSourceRefs, PygmalionVisualOperation, PygmalionVisualRevertOperation, QaCaptureEnvelope, SessionApplyVisualRequest, SessionApplyVisualResponse, SessionCheckRequest, SessionMutationRequest, SessionOpenRequest, SessionPreviewVisualRequest, SessionPreviewVisualResponse, SessionRevertVisualRequest, SessionRevertVisualResponse, SourceUsageRequest, } from './types.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PygmalionEndpointOverrides } from './paths.js';
|
|
2
|
+
import type { EditorTransport } from './transport.js';
|
|
3
|
+
type Group = keyof Omit<EditorTransport, 'endpoints' | 'resolveUrl'>;
|
|
4
|
+
/** Handlers per group, each optional; the request is the first argument as on the transport. */
|
|
5
|
+
export type MemoryTransportHandlers = {
|
|
6
|
+
[G in Group]?: Partial<EditorTransport[G]>;
|
|
7
|
+
};
|
|
8
|
+
export interface MemoryTransportCall {
|
|
9
|
+
operation: string;
|
|
10
|
+
request: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface MemoryTransport extends EditorTransport {
|
|
13
|
+
readonly calls: readonly MemoryTransportCall[];
|
|
14
|
+
}
|
|
15
|
+
export declare function createMemoryTransport(handlers?: MemoryTransportHandlers, options?: {
|
|
16
|
+
endpoints?: PygmalionEndpointOverrides;
|
|
17
|
+
origin?: string;
|
|
18
|
+
}): MemoryTransport;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Every path one side talks on, after overrides. Opt-in services are `null` until configured. */
|
|
2
|
+
export interface PygmalionEndpoints {
|
|
3
|
+
readonly devControl: string;
|
|
4
|
+
readonly sessionControl: string;
|
|
5
|
+
readonly inspectControl: string;
|
|
6
|
+
readonly qaCapture: string;
|
|
7
|
+
/** Ends with a slash; QA results link PNGs under it. */
|
|
8
|
+
readonly qaArtifactPrefix: string;
|
|
9
|
+
readonly previewArtifact: string | null;
|
|
10
|
+
readonly previewCatalog: string | null;
|
|
11
|
+
readonly previewCaptureProgress: string | null;
|
|
12
|
+
readonly storyboardEnvironment: string;
|
|
13
|
+
readonly sourceUsage: string;
|
|
14
|
+
readonly componentBranches: string;
|
|
15
|
+
}
|
|
16
|
+
/** Overrides a host passes to both the Vite plugins and the browser transport. */
|
|
17
|
+
export interface PygmalionEndpointOverrides {
|
|
18
|
+
devControl?: string;
|
|
19
|
+
sessionControl?: string;
|
|
20
|
+
inspectControl?: string;
|
|
21
|
+
qaCapture?: string;
|
|
22
|
+
qaArtifactPrefix?: string;
|
|
23
|
+
/** A path, `true` for the default, or omitted to leave the service unconfigured. */
|
|
24
|
+
previewArtifact?: string | true | null;
|
|
25
|
+
/** A path, `true` for the default derived from the artifact path, or omitted to derive it. */
|
|
26
|
+
previewCatalog?: string | true | null;
|
|
27
|
+
storyboardEnvironment?: string;
|
|
28
|
+
sourceUsage?: string;
|
|
29
|
+
componentBranches?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const PYGMALION_ENDPOINTS: {
|
|
32
|
+
readonly devPrefix: "/__pygmalion-dev";
|
|
33
|
+
readonly devControl: "/__pygmalion-dev-control";
|
|
34
|
+
readonly sessionPrefix: "/__pygmalion-session";
|
|
35
|
+
readonly sessionControl: "/__pygmalion-design-session";
|
|
36
|
+
readonly inspectControl: "/__pygmalion-inspect";
|
|
37
|
+
readonly qaControl: "/__pygmalion-qa";
|
|
38
|
+
readonly qaCapture: "/__pygmalion-qa/capture";
|
|
39
|
+
readonly qaArtifactPrefix: "/__pygmalion-qa/artifacts/";
|
|
40
|
+
readonly previewArtifact: "/__pygmalion-route-preview/artifact";
|
|
41
|
+
readonly storyboardEnvironment: "/__pygmalion-storyboard/environment";
|
|
42
|
+
readonly storyboardCanonical: "/__pygmalion-storyboard/canonicalize";
|
|
43
|
+
readonly sourceUsage: "/__pygmalion-storyboard/source-usage";
|
|
44
|
+
readonly componentBranches: "/__pygmalion-storyboard/component-branches";
|
|
45
|
+
};
|
|
46
|
+
export declare const PYGMALION_PREVIEW_CAPTURE_PROGRESS_SUFFIX: "/progress";
|
|
47
|
+
export declare const PYGMALION_REVISION_CATALOG_SUFFIX: "/catalog";
|
|
48
|
+
export declare const PYGMALION_STORYBOARD_ENVIRONMENT_QUERY: "__pygmalion_environment";
|
|
49
|
+
export declare const PYGMALION_SOURCE_USAGE_MAX_FILES: 100;
|
|
50
|
+
export declare const PREVIEW_CAPTURE_PRIORITY: {
|
|
51
|
+
readonly selected: 0;
|
|
52
|
+
readonly canvas: 10;
|
|
53
|
+
readonly background: 20;
|
|
54
|
+
};
|
|
55
|
+
export type PreviewCapturePriority = (typeof PREVIEW_CAPTURE_PRIORITY)[keyof typeof PREVIEW_CAPTURE_PRIORITY];
|
|
56
|
+
export declare function normalizePygmalionEndpoint(value: string | undefined, fallback: string, name: string): string;
|
|
57
|
+
export declare function resolvePygmalionEndpoints(overrides?: PygmalionEndpointOverrides): PygmalionEndpoints;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PygmalionEndpoints } from './paths.js';
|
|
2
|
+
import type { ComponentBranchesRequest, InspectImpactRequest, MirrorRefreshRequest, PreviewCatalogRequest, PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionSourceRefs, QaCaptureEnvelope, SessionApplyVisualRequest, SessionApplyVisualResponse, SessionCheckRequest, SessionOpenRequest, SessionPreviewVisualRequest, SessionPreviewVisualResponse, SessionRevertVisualRequest, SessionRevertVisualResponse, SourceUsageRequest } from './types.js';
|
|
3
|
+
import type { InspectImpactResult } from '../editor/host';
|
|
4
|
+
import type { InspectQaCaptureRequest } from '../editor/visualQa';
|
|
5
|
+
import type { PreviewArtifactTransportRequest } from '../editor/previewBootstrap';
|
|
6
|
+
import type { ComponentBranch } from '../editor/screenDimensions';
|
|
7
|
+
import type { CompositionSourceUsage } from '../editor/storyboardComposition';
|
|
8
|
+
export interface TransportCallOptions {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/** The subset of RequestInit a transport sends; a real `fetch` accepts it as is. */
|
|
12
|
+
export interface TransportRequestInit {
|
|
13
|
+
method: 'GET' | 'POST';
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
body?: string;
|
|
16
|
+
cache?: 'no-store';
|
|
17
|
+
credentials?: 'same-origin';
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/** The subset of Response a transport reads; a real Response satisfies it, and so does a test fake. */
|
|
21
|
+
export interface TransportResponse {
|
|
22
|
+
readonly ok: boolean;
|
|
23
|
+
readonly status?: number;
|
|
24
|
+
readonly statusText?: string;
|
|
25
|
+
json(): Promise<unknown>;
|
|
26
|
+
}
|
|
27
|
+
export type TransportFetch = (input: string, init: TransportRequestInit) => Promise<TransportResponse>;
|
|
28
|
+
export interface EditorTransport {
|
|
29
|
+
/** The paths this transport talks on, after overrides. */
|
|
30
|
+
readonly endpoints: PygmalionEndpoints;
|
|
31
|
+
/** Turns a server-relative path (a QA PNG, an artifact asset) into a URL the document can load. */
|
|
32
|
+
resolveUrl(path: string): string;
|
|
33
|
+
readonly mirror: {
|
|
34
|
+
status(options?: TransportCallOptions): Promise<PygmalionDevMirrorStatus>;
|
|
35
|
+
refresh(request?: MirrorRefreshRequest, options?: TransportCallOptions): Promise<PygmalionDevMirrorStatus>;
|
|
36
|
+
refs(options?: TransportCallOptions): Promise<PygmalionSourceRefs>;
|
|
37
|
+
};
|
|
38
|
+
readonly session: {
|
|
39
|
+
open(request: SessionOpenRequest, options?: TransportCallOptions): Promise<PygmalionDesignSessionStatus>;
|
|
40
|
+
check(request: SessionCheckRequest, options?: TransportCallOptions): Promise<PygmalionDesignSessionStatus>;
|
|
41
|
+
previewVisual(request: SessionPreviewVisualRequest, options?: TransportCallOptions): Promise<SessionPreviewVisualResponse>;
|
|
42
|
+
applyVisual(request: SessionApplyVisualRequest, options?: TransportCallOptions): Promise<SessionApplyVisualResponse>;
|
|
43
|
+
revertVisual(request: SessionRevertVisualRequest, options?: TransportCallOptions): Promise<SessionRevertVisualResponse>;
|
|
44
|
+
};
|
|
45
|
+
readonly inspect: {
|
|
46
|
+
impact(request: InspectImpactRequest, options?: TransportCallOptions): Promise<InspectImpactResult>;
|
|
47
|
+
};
|
|
48
|
+
readonly qa: {
|
|
49
|
+
capture(request: InspectQaCaptureRequest, options?: TransportCallOptions): Promise<QaCaptureEnvelope>;
|
|
50
|
+
};
|
|
51
|
+
readonly preview: {
|
|
52
|
+
/**
|
|
53
|
+
* Probes or captures preview artifacts. Answers with the bundle, the
|
|
54
|
+
* unwrapped `{ok, artifact}` bundle, or a frame resolution envelope, as
|
|
55
|
+
* the server does; previewBootstrap.ts validates whichever arrives.
|
|
56
|
+
*/
|
|
57
|
+
artifact(request: PreviewArtifactTransportRequest): Promise<unknown>;
|
|
58
|
+
/** The raw `progress` value; previewCaptureProgress.ts normalizes it. */
|
|
59
|
+
progress(options?: TransportCallOptions): Promise<unknown>;
|
|
60
|
+
/** The unvalidated catalog (unwrapped from `{catalog}`); revisionCatalog.ts validates it. */
|
|
61
|
+
catalog(request: PreviewCatalogRequest, options?: TransportCallOptions): Promise<unknown>;
|
|
62
|
+
};
|
|
63
|
+
readonly storyboard: {
|
|
64
|
+
/** The raw manifest; storyboardDiscovery.ts validates it. */
|
|
65
|
+
environment(options?: TransportCallOptions): Promise<unknown>;
|
|
66
|
+
sourceUsage(request: SourceUsageRequest, options?: TransportCallOptions): Promise<Record<string, CompositionSourceUsage>>;
|
|
67
|
+
componentBranches(request: ComponentBranchesRequest, options?: TransportCallOptions): Promise<readonly ComponentBranch[]>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { InspectApplyPayload } from '../editor/inspect';
|
|
2
|
+
export type PygmalionIntegrationState = 'up_to_date' | 'auto_merged' | 'review_required' | 'conflict' | 'offline';
|
|
3
|
+
export interface PygmalionDevMirrorStatus {
|
|
4
|
+
/** 'drifted' means another server moved the shared mirror checkout; a refresh resyncs it. */
|
|
5
|
+
state: 'idle' | 'syncing' | 'ready' | 'error' | 'drifted';
|
|
6
|
+
commit: string | null;
|
|
7
|
+
shortCommit: string | null;
|
|
8
|
+
/** Git ref the mirror is tracking, or null when it follows the source branch. */
|
|
9
|
+
sourceRef: string | null;
|
|
10
|
+
syncedAt: string | null;
|
|
11
|
+
updated: boolean;
|
|
12
|
+
warning: string | null;
|
|
13
|
+
error: string | null;
|
|
14
|
+
appOrigin: string | null;
|
|
15
|
+
/** Present when the proxy child is absent or serves another ref's checkout. */
|
|
16
|
+
runtimeDrift?: {
|
|
17
|
+
expectedAppRoot: string;
|
|
18
|
+
actualAppRoot: string | null;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** One revision the mirror can be repointed at. */
|
|
22
|
+
export interface PygmalionSourceRef {
|
|
23
|
+
name: string;
|
|
24
|
+
/** Abbreviated commit used for compact branch-tip labels. */
|
|
25
|
+
commit: string;
|
|
26
|
+
/** Full immutable object id used for preview and artifact identity. */
|
|
27
|
+
sourceRevision?: string;
|
|
28
|
+
fullName: string;
|
|
29
|
+
kind: 'local' | 'remote';
|
|
30
|
+
}
|
|
31
|
+
/** Revisions available to `switchSource`, listed from the mirror repository. */
|
|
32
|
+
export interface PygmalionSourceRefs {
|
|
33
|
+
refs: readonly PygmalionSourceRef[];
|
|
34
|
+
/** Revision followed when none is pinned. */
|
|
35
|
+
defaultRef: string | null;
|
|
36
|
+
/** Ref that renders uncommitted work. */
|
|
37
|
+
worktreeRef: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface PygmalionVisualOperation {
|
|
40
|
+
id: string;
|
|
41
|
+
revision: number;
|
|
42
|
+
kind: 'visual';
|
|
43
|
+
createdAt: string;
|
|
44
|
+
commitSha: string;
|
|
45
|
+
files: string[];
|
|
46
|
+
integrationState: PygmalionIntegrationState;
|
|
47
|
+
}
|
|
48
|
+
export interface PygmalionVisualRevertOperation {
|
|
49
|
+
id: string;
|
|
50
|
+
revision: number;
|
|
51
|
+
kind: 'visual-revert';
|
|
52
|
+
createdAt: string;
|
|
53
|
+
commitSha: string;
|
|
54
|
+
revertsOperationId: string;
|
|
55
|
+
revertsRevision: number;
|
|
56
|
+
revertsCommitSha: string;
|
|
57
|
+
recordedCommitSha: string;
|
|
58
|
+
files: string[];
|
|
59
|
+
integrationState: PygmalionIntegrationState;
|
|
60
|
+
}
|
|
61
|
+
export type PygmalionSessionOperation = PygmalionVisualOperation | PygmalionVisualRevertOperation;
|
|
62
|
+
export interface PygmalionDesignSessionStatus {
|
|
63
|
+
id: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
createdFromSha: string;
|
|
67
|
+
baseDevSha: string;
|
|
68
|
+
branchName: string | null;
|
|
69
|
+
headSha: string | null;
|
|
70
|
+
revision: number;
|
|
71
|
+
integration: {
|
|
72
|
+
state: PygmalionIntegrationState;
|
|
73
|
+
latestDevSha: string;
|
|
74
|
+
checkedAt: string;
|
|
75
|
+
affectedFiles: string[];
|
|
76
|
+
conflictFiles: string[];
|
|
77
|
+
error?: string;
|
|
78
|
+
};
|
|
79
|
+
lastOperation: PygmalionSessionOperation | null;
|
|
80
|
+
canRevert: boolean;
|
|
81
|
+
lastRevertableOperation: PygmalionVisualOperation | null;
|
|
82
|
+
lastRevert: PygmalionVisualRevertOperation | null;
|
|
83
|
+
appOrigin: string | null;
|
|
84
|
+
previewError: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface PygmalionRevertResult {
|
|
87
|
+
reverted: true;
|
|
88
|
+
operation: PygmalionVisualRevertOperation;
|
|
89
|
+
session: PygmalionDesignSessionStatus;
|
|
90
|
+
}
|
|
91
|
+
export interface MirrorRefreshRequest {
|
|
92
|
+
/** The ref to repoint the mirror at; omitted resyncs the current one. */
|
|
93
|
+
ref?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface SessionOpenRequest {
|
|
96
|
+
sessionId: string;
|
|
97
|
+
baseDevSha: string;
|
|
98
|
+
}
|
|
99
|
+
export interface SessionCheckRequest {
|
|
100
|
+
sessionId: string;
|
|
101
|
+
}
|
|
102
|
+
export interface SessionMutationRequest {
|
|
103
|
+
sessionId: string;
|
|
104
|
+
baseDevSha: string;
|
|
105
|
+
expectedRevision: number;
|
|
106
|
+
}
|
|
107
|
+
export interface SessionPreviewVisualRequest extends SessionMutationRequest {
|
|
108
|
+
changes: InspectApplyPayload;
|
|
109
|
+
}
|
|
110
|
+
export interface SessionPreviewVisualResponse {
|
|
111
|
+
revision: number;
|
|
112
|
+
files: {
|
|
113
|
+
file: string;
|
|
114
|
+
diff: string;
|
|
115
|
+
}[];
|
|
116
|
+
affectedFiles: string[];
|
|
117
|
+
}
|
|
118
|
+
export interface SessionApplyVisualRequest extends SessionMutationRequest {
|
|
119
|
+
/** The revision the reviewed diff was produced against, when one was. */
|
|
120
|
+
previewRevision?: number;
|
|
121
|
+
changes: InspectApplyPayload;
|
|
122
|
+
}
|
|
123
|
+
export interface SessionApplyVisualResponse {
|
|
124
|
+
applied?: number;
|
|
125
|
+
session: PygmalionDesignSessionStatus;
|
|
126
|
+
}
|
|
127
|
+
export interface SessionRevertVisualRequest extends SessionMutationRequest {
|
|
128
|
+
expectedHeadSha: string;
|
|
129
|
+
}
|
|
130
|
+
export type SessionRevertVisualResponse = PygmalionRevertResult;
|
|
131
|
+
export interface InspectImpactRequest {
|
|
132
|
+
componentFiles: string[];
|
|
133
|
+
}
|
|
134
|
+
/** The raw QA capture envelope; visualQa.ts turns it into an InspectQaResult. */
|
|
135
|
+
export interface QaCaptureEnvelope {
|
|
136
|
+
baselineId: string;
|
|
137
|
+
frames?: unknown;
|
|
138
|
+
failures?: unknown;
|
|
139
|
+
complete?: unknown;
|
|
140
|
+
}
|
|
141
|
+
export interface PreviewCatalogRequest {
|
|
142
|
+
namespace: string;
|
|
143
|
+
sourceRevision: string;
|
|
144
|
+
}
|
|
145
|
+
export interface SourceUsageRequest {
|
|
146
|
+
files: readonly string[];
|
|
147
|
+
}
|
|
148
|
+
export interface ComponentBranchesRequest {
|
|
149
|
+
source: string;
|
|
150
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionSourceRefs, QaCaptureEnvelope, SessionApplyVisualResponse, SessionPreviewVisualResponse, SessionRevertVisualResponse } from './types.js';
|
|
2
|
+
import type { InspectImpactResult } from '../editor/host';
|
|
3
|
+
import type { ComponentBranch } from '../editor/screenDimensions';
|
|
4
|
+
import type { CompositionSourceUsage } from '../editor/storyboardComposition';
|
|
5
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
6
|
+
export declare function readMirrorStatus(operation: string, body: unknown): PygmalionDevMirrorStatus;
|
|
7
|
+
export declare function readSourceRefs(operation: string, body: unknown): PygmalionSourceRefs;
|
|
8
|
+
export declare function readSessionStatus(operation: string, body: unknown, fallback: string): PygmalionDesignSessionStatus;
|
|
9
|
+
export declare function readPreviewVisual(operation: string, body: unknown): SessionPreviewVisualResponse;
|
|
10
|
+
export declare function readApplyVisual(operation: string, body: unknown): SessionApplyVisualResponse;
|
|
11
|
+
export declare function readRevertVisual(operation: string, body: unknown): SessionRevertVisualResponse;
|
|
12
|
+
export declare function readImpact(operation: string, body: unknown): InspectImpactResult;
|
|
13
|
+
export declare function readQaEnvelope(operation: string, body: unknown): QaCaptureEnvelope;
|
|
14
|
+
export declare function readSourceUsage(operation: string, body: unknown): Record<string, CompositionSourceUsage>;
|
|
15
|
+
export declare function readComponentBranches(body: unknown): readonly ComponentBranch[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PygmalionEndpointOverrides } from './paths.js';
|
|
2
|
+
import type { EditorTransport, TransportFetch } from './transport.js';
|
|
3
|
+
export interface ViteTransportOptions {
|
|
4
|
+
/** Defaults to the global `fetch`, looked up per call. */
|
|
5
|
+
fetch?: TransportFetch;
|
|
6
|
+
endpoints?: PygmalionEndpointOverrides;
|
|
7
|
+
/** Prefix for every request and for `resolveUrl`; empty (same origin) by default. */
|
|
8
|
+
origin?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function createViteTransport(options?: ViteTransportOptions): EditorTransport;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { EditorRuntime } from './runtime';
|
|
3
|
+
export { useEditorRuntime, useEditorStore, useHostBindings, useHostCallbacks, } from './runtimeContext';
|
|
4
|
+
/**
|
|
5
|
+
* Makes one runtime available to the editor tree below it. `<PygmalionEditor>`
|
|
6
|
+
* renders this itself; a host renders it only around package components it
|
|
7
|
+
* mounts on its own, such as the testing surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare function EditorRuntimeProvider({ runtime, children, }: {
|
|
10
|
+
runtime: EditorRuntime;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|