@industry-theme/principal-view-panels 0.1.46 → 0.1.48

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
@@ -2,6 +2,7 @@ import type { PanelDefinition } from './types';
2
2
  export { EventControllerPanel } from './panels/EventControllerPanel';
3
3
  export type { EventControllerPanelProps, PlaybackState, PlaybackStatus } from './panels/EventControllerPanel';
4
4
  export { TraceViewerPanel } from './panels/TraceViewerPanel';
5
+ export { ExecutionViewerPanel } from './panels/ExecutionViewerPanel';
5
6
  export { PanelFileSystemAdapter } from './adapters/PanelFileSystemAdapter';
6
7
  export type { FileTreeEntry, PanelFileSystemAdapterOptions } from './adapters/PanelFileSystemAdapter';
7
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAIlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,YAAY,EAAE,yBAAyB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEtG;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,EAiEnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAG3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAIlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,YAAY,EAAE,yBAAyB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEtG;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,EA+FnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAG3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { PanelComponentProps } from '@principal-ade/panel-framework-core';
3
+ /**
4
+ * Execution Viewer Panel
5
+ *
6
+ * Displays execution artifacts (test runs, traces) overlaid on their corresponding canvas diagrams.
7
+ * Reads execution files from __executions__/ directories and automatically links them to canvas files.
8
+ */
9
+ export declare const ExecutionViewerPanel: React.FC<PanelComponentProps>;
10
+ //# sourceMappingURL=ExecutionViewerPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionViewerPanel.d.ts","sourceRoot":"","sources":["../../src/panels/ExecutionViewerPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AA8B/E;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkpB9D,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ /**
4
+ * ExecutionViewerPanel Component
5
+ *
6
+ * Visualizes execution artifacts (test runs) overlaid on canvas diagrams.
7
+ * It discovers execution artifact files from __executions__/ directories.
8
+ *
9
+ * Features:
10
+ * - Auto-discovery of execution artifacts from __executions__/ directories
11
+ * - Automatic linking to matching canvas files
12
+ * - Event playback with timeline controls
13
+ * - Side-by-side canvas and event visualization
14
+ * - Package badges for monorepo support
15
+ * - Metadata display (spans, events, framework, status)
16
+ */
17
+ declare const meta: {
18
+ title: string;
19
+ component: React.FC<import("@principal-ade/panel-framework-core").PanelComponentProps>;
20
+ parameters: {
21
+ layout: string;
22
+ docs: {
23
+ description: {
24
+ component: string;
25
+ };
26
+ };
27
+ };
28
+ tags: string[];
29
+ decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
30
+ context: import("@principal-ade/panel-framework-core").PanelContextValue;
31
+ actions: import("@principal-ade/panel-framework-core").PanelActions;
32
+ events: import("@principal-ade/panel-framework-core").PanelEventEmitter;
33
+ }>) => import("react/jsx-runtime").JSX.Element)[];
34
+ };
35
+ export default meta;
36
+ type Story = StoryObj<typeof meta>;
37
+ /**
38
+ * Basic execution viewer with single execution artifact
39
+ */
40
+ export declare const SingleExecution: Story;
41
+ /**
42
+ * Multiple execution artifacts from different packages
43
+ */
44
+ export declare const MultipleExecutions: Story;
45
+ /**
46
+ * Execution with error status
47
+ */
48
+ export declare const ExecutionWithError: Story;
49
+ /**
50
+ * No execution artifacts found
51
+ */
52
+ export declare const NoExecutions: Story;
53
+ /**
54
+ * Execution without matching canvas
55
+ */
56
+ export declare const ExecutionWithoutCanvas: Story;
57
+ /**
58
+ * Legacy format (direct array without metadata)
59
+ */
60
+ export declare const LegacyFormat: Story;
61
+ //# sourceMappingURL=ExecutionViewerPanel.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionViewerPanel.stories.d.ts","sourceRoot":"","sources":["../../src/panels/ExecutionViewerPanel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;CAsBmC,CAAC;AAE9C,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA2LnC;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAoChC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KA2ChC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAkB1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAkBpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAwB1B,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Event Node Mapper
3
+ *
4
+ * Maps execution events to canvas nodes based on OTEL metadata.
5
+ * Uses event schemas defined in canvas nodes to determine which node
6
+ * should be highlighted when an event is played back.
7
+ */
8
+ import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
9
+ /**
10
+ * Event from execution artifact
11
+ */
12
+ export interface ExecutionEvent {
13
+ name: string;
14
+ time: number;
15
+ attributes?: Record<string, string | number | boolean>;
16
+ }
17
+ /**
18
+ * Maps an execution event to a canvas node ID.
19
+ *
20
+ * Strategy:
21
+ * 1. Primary: Match event name to node's pv.events keys
22
+ * 2. Fallback: Match event attributes to node's pv.otel.resourceMatch
23
+ * 3. Default: Return null (no highlight)
24
+ *
25
+ * @param event - The execution event to map
26
+ * @param canvas - The canvas containing nodes with OTEL metadata
27
+ * @returns Node ID to highlight, or null if no match
28
+ */
29
+ export declare function mapEventToNodeId(event: ExecutionEvent, canvas: ExtendedCanvas | null): string | null;
30
+ /**
31
+ * Pre-builds a mapping of event names to node IDs for faster lookups.
32
+ * Useful when processing many events sequentially.
33
+ *
34
+ * @param canvas - The canvas to build the mapping from
35
+ * @returns Map of event name to node ID
36
+ */
37
+ export declare function buildEventToNodeMap(canvas: ExtendedCanvas | null): Map<string, string>;
38
+ /**
39
+ * Debug helper to show which events map to which nodes.
40
+ *
41
+ * @param canvas - The canvas to analyze
42
+ * @returns Human-readable mapping information
43
+ */
44
+ export declare function debugEventMapping(canvas: ExtendedCanvas | null): string;
45
+ //# sourceMappingURL=EventNodeMapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventNodeMapper.d.ts","sourceRoot":"","sources":["../../../src/panels/execution-viewer/EventNodeMapper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,GAAG,IAAI,GAC5B,MAAM,GAAG,IAAI,CA4Cf;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,GAAG,IAAI,GAC5B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAqBrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,CA2BvE"}
@@ -0,0 +1,97 @@
1
+ export interface ExecutionFile {
2
+ /** Unique identifier for this execution (derived from filename) */
3
+ id: string;
4
+ /** Display name for this execution */
5
+ name: string;
6
+ /** Full file path */
7
+ path: string;
8
+ /** Canvas basename (without extension) that this execution is linked to */
9
+ canvasBasename: string;
10
+ /** Package name for monorepos (e.g., 'core' from 'packages/core/__executions__/') */
11
+ packageName?: string;
12
+ }
13
+ export interface ExecutionMetadata {
14
+ /** Execution name */
15
+ name: string;
16
+ /** Canvas name this execution is associated with */
17
+ canvasName?: string;
18
+ /** Export timestamp */
19
+ exportedAt?: string;
20
+ /** Source of execution (e.g., "test:event-validation") */
21
+ source?: string;
22
+ /** Test framework used */
23
+ framework?: string;
24
+ /** Execution status */
25
+ status?: 'success' | 'error' | 'OK';
26
+ /** Number of spans */
27
+ spanCount: number;
28
+ /** Number of events across all spans */
29
+ eventCount: number;
30
+ }
31
+ export interface ExecutionSpan {
32
+ id: string;
33
+ name: string;
34
+ startTime: number;
35
+ endTime?: number;
36
+ duration?: number;
37
+ status?: string;
38
+ attributes?: Record<string, any>;
39
+ events: Array<{
40
+ time: number;
41
+ name: string;
42
+ attributes?: Record<string, any>;
43
+ }>;
44
+ }
45
+ export interface ExecutionArtifact {
46
+ metadata?: {
47
+ canvasName?: string;
48
+ exportedAt?: string;
49
+ source?: string;
50
+ framework?: string;
51
+ status?: 'success' | 'error';
52
+ };
53
+ spans?: ExecutionSpan[];
54
+ [key: number]: ExecutionSpan;
55
+ }
56
+ /**
57
+ * Utility for loading and parsing execution artifact files from __executions__/ folders
58
+ */
59
+ export declare class ExecutionLoader {
60
+ /**
61
+ * Parse JSON execution artifact content
62
+ */
63
+ static parseExecutionArtifact(content: string): ExecutionArtifact;
64
+ /**
65
+ * Get spans array from artifact (handles both formats)
66
+ */
67
+ static getSpans(artifact: ExecutionArtifact): ExecutionSpan[];
68
+ /**
69
+ * Extract metadata from an execution artifact
70
+ */
71
+ static getExecutionMetadata(artifact: ExecutionArtifact): ExecutionMetadata;
72
+ /**
73
+ * Find all execution artifact files in the file tree
74
+ */
75
+ static findExecutionFiles(files: Array<{
76
+ path?: string;
77
+ relativePath?: string;
78
+ name?: string;
79
+ }>): ExecutionFile[];
80
+ /**
81
+ * Find execution artifact for a given canvas file path
82
+ */
83
+ static findExecutionForCanvas(canvasPath: string, files: Array<{
84
+ path?: string;
85
+ relativePath?: string;
86
+ name?: string;
87
+ }>): ExecutionFile | null;
88
+ /**
89
+ * Find canvas file for a given execution artifact path
90
+ */
91
+ static findCanvasForExecution(executionPath: string, files: Array<{
92
+ path?: string;
93
+ relativePath?: string;
94
+ name?: string;
95
+ }>): string | null;
96
+ }
97
+ //# sourceMappingURL=ExecutionLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionLoader.d.ts","sourceRoot":"","sources":["../../../src/panels/execution-viewer/ExecutionLoader.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC;IACpC,sBAAsB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AAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACpE,aAAa,EAAE;IAyDlB;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAC3B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACpE,aAAa,GAAG,IAAI;IAYvB;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAC3B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACpE,MAAM,GAAG,IAAI;CAgBjB"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { ExecutionMetadata } from './ExecutionLoader';
3
+ interface ExecutionStatsProps {
4
+ metadata: ExecutionMetadata;
5
+ }
6
+ /**
7
+ * Footer component displaying execution artifact metadata and statistics
8
+ */
9
+ export declare const ExecutionStats: React.FC<ExecutionStatsProps>;
10
+ export {};
11
+ //# sourceMappingURL=ExecutionStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionStats.d.ts","sourceRoot":"","sources":["../../../src/panels/execution-viewer/ExecutionStats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAmHxD,CAAC"}