@principal-ai/principal-view-react 0.16.56 → 0.16.57

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.
Files changed (102) hide show
  1. package/dist/graphify/consolidated.d.ts +16 -1
  2. package/dist/graphify/consolidated.d.ts.map +1 -1
  3. package/dist/graphify/index.d.ts +1 -1
  4. package/dist/graphify/index.d.ts.map +1 -1
  5. package/dist/graphify/index.js.map +1 -1
  6. package/dist/graphify/kind.d.ts +1 -1
  7. package/dist/graphify/kind.d.ts.map +1 -1
  8. package/dist/graphify/kind.js +7 -1
  9. package/dist/graphify/kind.js.map +1 -1
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/pierre/constructColors.d.ts +24 -0
  15. package/dist/pierre/constructColors.d.ts.map +1 -0
  16. package/dist/pierre/constructColors.js +91 -0
  17. package/dist/pierre/constructColors.js.map +1 -0
  18. package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts +8 -0
  19. package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts.map +1 -0
  20. package/dist/stories/Subsystem/ComponentGraph/fixtures.js +116 -0
  21. package/dist/stories/Subsystem/ComponentGraph/fixtures.js.map +1 -0
  22. package/dist/subsystem/ComponentDeclaration.d.ts +2 -2
  23. package/dist/subsystem/ComponentDeclaration.d.ts.map +1 -1
  24. package/dist/subsystem/ComponentDeclaration.js +12 -11
  25. package/dist/subsystem/ComponentDeclaration.js.map +1 -1
  26. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  27. package/dist/subsystem/SubsystemComponentGraph.js +22 -1
  28. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  29. package/dist/subsystem/formatDeclaration.d.ts.map +1 -1
  30. package/dist/subsystem/formatDeclaration.js +49 -10
  31. package/dist/subsystem/formatDeclaration.js.map +1 -1
  32. package/dist/subsystem/model.d.ts +55 -12
  33. package/dist/subsystem/model.d.ts.map +1 -1
  34. package/dist/subsystem/model.js +54 -24
  35. package/dist/subsystem/model.js.map +1 -1
  36. package/dist/subsystem/nodes.d.ts +4 -1
  37. package/dist/subsystem/nodes.d.ts.map +1 -1
  38. package/dist/subsystem/nodes.js +70 -21
  39. package/dist/subsystem/nodes.js.map +1 -1
  40. package/dist/subsystem/tokenizeComponent.js +1 -1
  41. package/dist/subsystem/tokenizeComponent.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/graphify/consolidated.ts +18 -1
  44. package/src/graphify/index.ts +1 -0
  45. package/src/graphify/kind.ts +7 -1
  46. package/src/index.ts +3 -2
  47. package/src/pierre/constructColors.test.ts +52 -0
  48. package/src/pierre/constructColors.ts +112 -0
  49. package/src/stories/{BoundaryNodes.stories.tsx → Audit/BoundaryNodes.stories.tsx} +1 -1
  50. package/src/stories/{CanvasEdgeTypes.stories.tsx → Audit/CanvasEdgeTypes.stories.tsx} +1 -1
  51. package/src/stories/{CanvasNodeTypes.stories.tsx → Audit/CanvasNodeTypes.stories.tsx} +1 -1
  52. package/src/stories/{ColorPriority.stories.tsx → Audit/ColorPriority.stories.tsx} +1 -1
  53. package/src/stories/{DiamondBadges.stories.tsx → Audit/DiamondBadges.stories.tsx} +1 -1
  54. package/src/stories/{NodeDimensionsTesting.stories.tsx → Audit/NodeDimensionsTesting.stories.tsx} +2 -2
  55. package/src/stories/{NodeFieldsAudit.stories.tsx → Audit/NodeFieldsAudit.stories.tsx} +1 -1
  56. package/src/stories/{NodeFontSizeTesting.stories.tsx → Audit/NodeFontSizeTesting.stories.tsx} +2 -2
  57. package/src/stories/{NodeShapes.stories.tsx → Audit/NodeShapes.stories.tsx} +1 -1
  58. package/src/stories/{WideNodesTesting.stories.tsx → Audit/WideNodesTesting.stories.tsx} +2 -2
  59. package/src/stories/{dashboard → Components}/DashboardRenderer.stories.tsx +2 -2
  60. package/src/stories/{GraphRenderer.stories.tsx → Components/GraphRenderer.stories.tsx} +2 -2
  61. package/src/stories/{MultiCanvasRenderer.stories.tsx → Components/MultiCanvasRenderer.stories.tsx} +2 -2
  62. package/src/stories/{SequenceDiagram.stories.tsx → Components/SequenceDiagram.stories.tsx} +2 -2
  63. package/src/stories/{StateView.stories.tsx → Components/StateView.stories.tsx} +2 -2
  64. package/src/stories/{TraceViewer.stories.tsx → Components/TraceViewer.stories.tsx} +3 -3
  65. package/src/stories/{WorkflowSequenceDiagram.stories.tsx → Components/WorkflowSequenceDiagram.stories.tsx} +1 -1
  66. package/src/stories/{AnimationWorkshop.stories.tsx → Features/AnimationWorkshop.stories.tsx} +5 -5
  67. package/src/stories/{ChangeTypeVisual.stories.tsx → Features/ChangeTypeVisual.stories.tsx} +2 -2
  68. package/src/stories/{EventDrivenAnimations.stories.tsx → Features/EventDrivenAnimations.stories.tsx} +2 -2
  69. package/src/stories/{MultiConfig.stories.tsx → Features/MultiConfig.stories.tsx} +2 -2
  70. package/src/stories/{ElkEdgeRouting.stories.tsx → Layout/ElkEdgeRouting.stories.tsx} +2 -2
  71. package/src/stories/{GraphOrientation.stories.tsx → Layout/GraphOrientation.stories.tsx} +3 -3
  72. package/src/stories/{MultiDirectionalConnections.stories.tsx → Layout/MultiDirectionalConnections.stories.tsx} +2 -2
  73. package/src/stories/{NodeDefinitionComparison.stories.tsx → Nodes/NodeDefinitionComparison.stories.tsx} +2 -2
  74. package/src/stories/{NodeNameFallbacks.stories.tsx → Nodes/NodeNameFallbacks.stories.tsx} +2 -2
  75. package/src/stories/{NumericColors.stories.tsx → Nodes/NumericColors.stories.tsx} +2 -2
  76. package/src/stories/{EventNameDisplay.stories.tsx → OTEL/EventNameDisplay.stories.tsx} +2 -2
  77. package/src/stories/{EventNameFallback.stories.tsx → OTEL/EventNameFallback.stories.tsx} +2 -2
  78. package/src/stories/{OtelComponents.stories.tsx → OTEL/OtelComponents.stories.tsx} +3 -3
  79. package/src/stories/{OtelNodeTypesPrototype.stories.tsx → OTEL/OtelNodeTypesPrototype.stories.tsx} +2 -2
  80. package/src/stories/{RawEventCards.stories.tsx → OTEL/RawEventCards.stories.tsx} +3 -3
  81. package/src/stories/{SpanBadges.stories.tsx → OTEL/SpanBadges.stories.tsx} +1 -1
  82. package/src/stories/{ValidationEventsCanvas.stories.tsx → OTEL/ValidationEventsCanvas.stories.tsx} +3 -3
  83. package/src/stories/{BacklogMdCanvases.stories.tsx → RealWorld/BacklogMdCanvases.stories.tsx} +2 -2
  84. package/src/stories/{FileCitySequence.stories.tsx → RealWorld/FileCitySequence.stories.tsx} +4 -4
  85. package/src/stories/{RealCanvasFiles.stories.tsx → RealWorld/RealCanvasFiles.stories.tsx} +7 -7
  86. package/src/stories/{ComponentDeclarationAudit.stories.tsx → Subsystem/ComponentDeclarationAudit.stories.tsx} +19 -20
  87. package/src/stories/Subsystem/ComponentGraph/Appearance.stories.tsx +365 -0
  88. package/src/stories/Subsystem/ComponentGraph/Basics.stories.tsx +137 -0
  89. package/src/stories/Subsystem/ComponentGraph/Captures.stories.tsx +238 -0
  90. package/src/stories/Subsystem/ComponentGraph/DetailPanel.stories.tsx +315 -0
  91. package/src/stories/Subsystem/ComponentGraph/Scenarios.stories.tsx +959 -0
  92. package/src/stories/Subsystem/ComponentGraph/Spotlights.stories.tsx +646 -0
  93. package/src/stories/Subsystem/ComponentGraph/fixtures.ts +129 -0
  94. package/src/subsystem/ComponentDeclaration.tsx +13 -13
  95. package/src/subsystem/SubsystemComponentGraph.tsx +25 -5
  96. package/src/subsystem/formatDeclaration.ts +57 -11
  97. package/src/subsystem/model.test.ts +38 -6
  98. package/src/subsystem/model.ts +108 -31
  99. package/src/subsystem/nodes.tsx +103 -27
  100. package/src/subsystem/tokenizeComponent.ts +1 -1
  101. package/src/stories/SubsystemComponentGraph.stories.tsx +0 -1225
  102. /package/src/stories/{dashboard/sample-dashboards → data}/activity-feed-analytics.dashboard.json +0 -0
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { SequenceDiagramRenderer } from '../components/SequenceDiagramRenderer';
4
- import { WorkflowSequenceDiagram } from '../components/WorkflowSequenceDiagram';
3
+ import { SequenceDiagramRenderer } from '../../components/SequenceDiagramRenderer';
4
+ import { WorkflowSequenceDiagram } from '../../components/WorkflowSequenceDiagram';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
- import workflowData from './data/file-city-workflows.json';
6
+ import workflowData from '../data/file-city-workflows.json';
7
7
  import type { WorkflowScenario } from '@principal-ai/principal-view-core';
8
8
 
9
9
  const meta = {
10
- title: 'Workflows/File City Image Generation',
10
+ title: 'RealWorld/FileCitySequence',
11
11
  component: SequenceDiagramRenderer,
12
12
  parameters: {
13
13
  layout: 'fullscreen',
@@ -1,16 +1,16 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import '@xyflow/react/dist/style.css';
4
- import { GraphRenderer } from '../components/GraphRenderer';
4
+ import { GraphRenderer } from '../../components/GraphRenderer';
5
5
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
6
6
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
7
7
 
8
8
  // Import canvas files as URLs
9
- import scopesCanvasUrl from '../../../../.principal-views/architecture.scopes.canvas?url';
10
- import spansCanvasUrl from '../../../../.principal-views/architecture.spans.canvas?url';
11
- import resourcesCanvasUrl from '../../../../.principal-views/resources.canvas?url';
12
- import matchingLogicCanvasUrl from '../../../../.principal-views/matching-logic-current-state.canvas?url';
13
- import validationCanvasUrl from '../../../../.principal-views/validation/validation.otel.canvas?url';
9
+ import scopesCanvasUrl from '../../../../../.principal-views/architecture.scopes.canvas?url';
10
+ import spansCanvasUrl from '../../../../../.principal-views/architecture.spans.canvas?url';
11
+ import resourcesCanvasUrl from '../../../../../.principal-views/resources.canvas?url';
12
+ import matchingLogicCanvasUrl from '../../../../../.principal-views/matching-logic-current-state.canvas?url';
13
+ import validationCanvasUrl from '../../../../../.principal-views/validation/validation.otel.canvas?url';
14
14
 
15
15
  // Helper to load canvas from URL
16
16
  async function loadCanvas(url: string): Promise<ExtendedCanvas> {
@@ -45,7 +45,7 @@ function CanvasLoader({ url, children }: { url: string; children: (canvas: Exten
45
45
  }
46
46
 
47
47
  const meta = {
48
- title: 'Real Canvas Files',
48
+ title: 'RealWorld/RealCanvasFiles',
49
49
  component: GraphRenderer,
50
50
  parameters: {
51
51
  layout: 'fullscreen',
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import '@xyflow/react/dist/style.css';
3
3
  import type { Meta, StoryObj } from '@storybook/react';
4
4
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
5
- import { ComponentDeclaration } from '../subsystem/ComponentDeclaration';
6
- import type { SubsystemComponent } from '../subsystem/model';
7
- import type { GraphifyComponentDetail } from '../graphify';
5
+ import { ComponentDeclaration } from '../../subsystem/ComponentDeclaration';
6
+ import type { SubsystemComponent } from '../../subsystem/model';
7
+ import type { GraphifyComponentDetail } from '../../graphify';
8
8
 
9
9
  const meta = {
10
- title: 'Subsystem/Component Declaration Audit',
10
+ title: 'Subsystem/ComponentDeclarationAudit',
11
11
  component: ComponentDeclaration,
12
12
  parameters: { layout: 'padded' },
13
13
  tags: ['autodocs'],
@@ -28,7 +28,6 @@ const meta = {
28
28
  ],
29
29
  } satisfies Meta<typeof ComponentDeclaration>;
30
30
  export default meta;
31
- type Story = StoryObj<typeof ComponentDeclaration>;
32
31
 
33
32
  // ---------------------------------------------------------------------------
34
33
  // All cases — one SubsystemComponent per shape, rendered stacked
@@ -40,7 +39,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
40
39
  component: {
41
40
  id: 'fn-void',
42
41
  name: 'flush',
43
- kind: 'function',
42
+ construct: 'function',
44
43
  file: 'src/event-processing/sink.ts',
45
44
  purl: 'pkg:github/principal-ai/agent-monitoring',
46
45
  symbol: 'flush',
@@ -55,7 +54,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
55
54
  component: {
56
55
  id: 'fn-one',
57
56
  name: 'normalize',
58
- kind: 'function',
57
+ construct: 'function',
59
58
  file: 'src/session/SessionReader.ts',
60
59
  purl: 'pkg:github/principal-ai/agent-monitoring',
61
60
  symbol: 'SessionReader.normalize',
@@ -71,7 +70,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
71
70
  component: {
72
71
  id: 'fn-two',
73
72
  name: 'normalizeSession',
74
- kind: 'function',
73
+ construct: 'function',
75
74
  file: 'src/event-processing/normalize.ts',
76
75
  purl: 'pkg:github/principal-ai/agent-monitoring',
77
76
  symbol: 'normalizeSession',
@@ -90,7 +89,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
90
89
  component: {
91
90
  id: 'fn-rich',
92
91
  name: 'mergeSessions',
93
- kind: 'function',
92
+ construct: 'function',
94
93
  file: 'src/session/merge.ts',
95
94
  purl: 'pkg:github/principal-ai/agent-monitoring',
96
95
  symbol: 'mergeSessions',
@@ -111,7 +110,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
111
110
  component: {
112
111
  id: 'class-empty',
113
112
  name: 'EmptyClass',
114
- kind: 'class',
113
+ construct: 'class',
115
114
  file: 'src/empty.ts',
116
115
  purl: 'pkg:github/principal-ai/agent-monitoring',
117
116
  symbol: 'EmptyClass',
@@ -125,7 +124,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
125
124
  component: {
126
125
  id: 'class-props',
127
126
  name: 'Config',
128
- kind: 'class',
127
+ construct: 'class',
129
128
  file: 'src/config.ts',
130
129
  purl: 'pkg:github/principal-ai/agent-monitoring',
131
130
  symbol: 'Config',
@@ -144,7 +143,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
144
143
  component: {
145
144
  id: 'class-rich',
146
145
  name: 'EventProcessor',
147
- kind: 'class',
146
+ construct: 'class',
148
147
  file: 'src/event-processing/EventProcessor.ts',
149
148
  purl: 'pkg:github/principal-ai/agent-monitoring',
150
149
  symbol: 'EventProcessor',
@@ -171,7 +170,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
171
170
  component: {
172
171
  id: 'type-props',
173
172
  name: 'SessionRecord',
174
- kind: 'type',
173
+ construct: 'interface',
175
174
  file: 'src/session/transcript.ts',
176
175
  purl: 'pkg:github/principal-ai/agent-monitoring',
177
176
  symbol: 'SessionRecord',
@@ -189,7 +188,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
189
188
  component: {
190
189
  id: 'type-empty',
191
190
  name: 'BrandedId',
192
- kind: 'type',
191
+ construct: 'interface',
193
192
  file: 'src/types.ts',
194
193
  purl: 'pkg:github/principal-ai/agent-monitoring',
195
194
  symbol: 'BrandedId',
@@ -203,7 +202,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
203
202
  component: {
204
203
  id: 'mod-full',
205
204
  name: 'index',
206
- kind: 'module',
205
+ construct: 'module',
207
206
  file: 'src/index.ts',
208
207
  purl: 'pkg:github/principal-ai/agent-monitoring',
209
208
  symbol: 'index',
@@ -223,7 +222,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
223
222
  component: {
224
223
  id: 'mod-plain',
225
224
  name: 'utils',
226
- kind: 'module',
225
+ construct: 'module',
227
226
  file: 'src/utils.ts',
228
227
  purl: 'pkg:github/principal-ai/agent-monitoring',
229
228
  symbol: 'utils',
@@ -234,7 +233,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
234
233
  component: {
235
234
  id: 'ext',
236
235
  name: 'trail-viewer',
237
- kind: 'external',
236
+ construct: 'external',
238
237
  file: '',
239
238
  purl: 'pkg:npm/@principal-ai/trail-viewer',
240
239
  symbol: '',
@@ -249,7 +248,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
249
248
  component: {
250
249
  id: 'fn-no-symbol',
251
250
  name: 'anonymousHelper',
252
- kind: 'function',
251
+ construct: 'function',
253
252
  file: 'src/helpers.ts',
254
253
  purl: 'pkg:github/principal-ai/agent-monitoring',
255
254
  detail: {
@@ -264,7 +263,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
264
263
  component: {
265
264
  id: 'method-normalize',
266
265
  name: 'normalize',
267
- kind: 'method',
266
+ construct: 'method',
268
267
  file: 'src/session/SessionReader.ts',
269
268
  purl: 'pkg:github/principal-ai/agent-monitoring',
270
269
  symbol: 'SessionReader.normalize',
@@ -281,7 +280,7 @@ const cases: { label: string; component: SubsystemComponent }[] = [
281
280
  component: {
282
281
  id: 'method-dispose',
283
282
  name: 'dispose',
284
- kind: 'method',
283
+ construct: 'method',
285
284
  file: 'src/event-processing/EventProcessor.ts',
286
285
  purl: 'pkg:github/principal-ai/agent-monitoring',
287
286
  symbol: 'EventProcessor.dispose',
@@ -0,0 +1,365 @@
1
+ import React, { useState } from 'react';
2
+ import '@xyflow/react/dist/style.css';
3
+ import type { Meta, StoryObj } from '@storybook/react';
4
+ import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
5
+ import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGraph';
6
+ import type { SubsystemComponent, SubsystemComponentEdge } from '../../../subsystem/model';
7
+ import type { GraphifyComponentDetail } from '../../../graphify';
8
+ import { investigateOnlyComponents, investigateOnlyEdges } from './fixtures';
9
+
10
+ const meta = {
11
+ title: 'Subsystem/ComponentGraph/Appearance',
12
+ component: SubsystemComponentGraph,
13
+ parameters: {
14
+ layout: 'fullscreen',
15
+ },
16
+ tags: ['autodocs'],
17
+ decorators: [
18
+ (Story) => (
19
+ <ThemeProvider theme={defaultEditorTheme}>
20
+ <Story />
21
+ </ThemeProvider>
22
+ ),
23
+ ],
24
+ } satisfies Meta<typeof SubsystemComponentGraph>;
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ /** Same pipeline as Captures/InvestigateOnly with a narrower `maxNodeWidth` (140) — long names wrap. */
30
+ export const NarrowMaxWidth: Story = {
31
+ render: () => (
32
+ <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
33
+ <SubsystemComponentGraph
34
+ components={investigateOnlyComponents}
35
+ edges={investigateOnlyEdges}
36
+ maxNodeWidth={140}
37
+ />
38
+ </div>
39
+ ),
40
+ };
41
+
42
+ // ---------------------------------------------------------------------------
43
+ // Naming-convention wrap check — one node per common symbol convention.
44
+ // ---------------------------------------------------------------------------
45
+ const namingConventionComponents: SubsystemComponent[] = [
46
+ {
47
+ id: 'camel',
48
+ name: 'accumulateToAgentSessionEvents',
49
+ construct: 'function',
50
+ file: 'src/event-processing/accumulator.ts',
51
+ purl: 'pkg:github/principal-ai/agent-monitoring',
52
+ symbol: 'accumulateToAgentSessionEvents',
53
+ },
54
+ {
55
+ id: 'snake',
56
+ name: 'repo_normalized_universal_event',
57
+ construct: 'interface',
58
+ file: 'src/event-processing/repo_normalized.ts',
59
+ purl: 'pkg:github/principal-ai/agent-monitoring',
60
+ symbol: 'repo_normalized_universal_event',
61
+ },
62
+ {
63
+ id: 'pascal',
64
+ name: 'RepoNormalizedUniversalAgentSessionEvent',
65
+ construct: 'class',
66
+ file: 'src/event-processing/RepoNormalized.ts',
67
+ purl: 'pkg:github/principal-ai/agent-monitoring',
68
+ symbol: 'RepoNormalizedUniversalAgentSessionEvent',
69
+ },
70
+ {
71
+ id: 'acronym',
72
+ name: 'ProcessSSEStreamForEventToken',
73
+ construct: 'function',
74
+ file: 'src/event-processing/sse.ts',
75
+ purl: 'pkg:github/principal-ai/agent-monitoring',
76
+ symbol: 'ProcessSSEStreamForEventToken',
77
+ },
78
+ {
79
+ id: 'method',
80
+ name: 'normalize',
81
+ construct: 'function',
82
+ file: 'src/session/SessionReader.ts',
83
+ purl: 'pkg:github/principal-ai/agent-monitoring',
84
+ symbol: 'SessionReader.normalize',
85
+ },
86
+ {
87
+ id: 'pkg',
88
+ name: 'trail-viewer',
89
+ construct: 'external',
90
+ file: '',
91
+ purl: 'pkg:npm/@principal-ai/trail-viewer',
92
+ symbol: '',
93
+ },
94
+ ];
95
+
96
+ const namingConventionEdges: SubsystemComponentEdge[] = [];
97
+
98
+ /** Nodes with compact `maxNodeWidth` so the different conventions visibly wrap
99
+ * at their word boundaries (camelCase, snake_case, PascalCase, acronyms). */
100
+ export const NamingConventions: Story = {
101
+ render: () => (
102
+ <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
103
+ <SubsystemComponentGraph
104
+ components={namingConventionComponents}
105
+ edges={namingConventionEdges}
106
+ maxNodeWidth={180}
107
+ />
108
+ </div>
109
+ ),
110
+ };
111
+
112
+ // ---------------------------------------------------------------------------
113
+ // Kind variations — one column per kind (class / function / type / module /
114
+ // external), rows going bare → detailed. Click a node to see its declaration
115
+ // panel; type names inside it are clickable when they match another node here.
116
+ // ---------------------------------------------------------------------------
117
+ const variationPurl = 'pkg:github/principal-ai/agent-monitoring';
118
+
119
+ const kindVariationComponents: SubsystemComponent[] = [
120
+ // --- class: bare → members only → relationships only
121
+ {
122
+ id: 'cls-bare',
123
+ name: 'SessionStore',
124
+ construct: 'class',
125
+ file: 'src/session/SessionStore.ts',
126
+ purl: variationPurl,
127
+ purpose: 'no drill-down — renders a plain `class SessionStore`',
128
+ symbol: 'SessionStore',
129
+ layer: 1,
130
+ },
131
+ {
132
+ id: 'cls-members',
133
+ name: 'Transcoder',
134
+ construct: 'class',
135
+ file: 'src/session/Transcoder.ts',
136
+ purl: variationPurl,
137
+ purpose: 'members only — methods with typed params + returns, a typed field',
138
+ symbol: 'Transcoder',
139
+ layer: 1,
140
+ detail: {
141
+ kind: 'class',
142
+ methods: [
143
+ { nodeId: 'tm1', name: 'encode', parameters: [{ type: 'RawFrame' }], returnType: 'Uint8Array' },
144
+ { nodeId: 'tm2', name: 'decode', parameters: [{ type: 'Uint8Array' }], returnType: 'RawFrame' },
145
+ { nodeId: 'tm3', name: 'reset' },
146
+ ],
147
+ properties: [{ name: 'bufferSize', type: 'number' }],
148
+ extends: [],
149
+ implements: [],
150
+ instantiations: [],
151
+ references: [],
152
+ } satisfies GraphifyComponentDetail,
153
+ },
154
+ {
155
+ id: 'cls-relations',
156
+ name: 'HttpTransport',
157
+ construct: 'class',
158
+ file: 'src/transport/HttpTransport.ts',
159
+ purl: variationPurl,
160
+ purpose: 'relationships only — extends + implements, constructed-by comment; empty body elides the braces',
161
+ symbol: 'HttpTransport',
162
+ layer: 1,
163
+ detail: {
164
+ kind: 'class',
165
+ methods: [],
166
+ properties: [],
167
+ extends: ['BaseTransport'],
168
+ implements: ['Transport'],
169
+ instantiations: [{ nodeId: 'x1', name: 'main' }],
170
+ references: [],
171
+ } satisfies GraphifyComponentDetail,
172
+ },
173
+
174
+ // --- function: bare → signature only → signature + call relationships
175
+ {
176
+ id: 'fn-bare',
177
+ name: 'bootstrap',
178
+ construct: 'function',
179
+ file: 'src/bootstrap.ts',
180
+ purl: variationPurl,
181
+ purpose: 'no drill-down — renders a plain `function bootstrap()`',
182
+ symbol: 'bootstrap',
183
+ layer: 2,
184
+ },
185
+ {
186
+ id: 'fn-signature',
187
+ name: 'normalizeSession',
188
+ construct: 'function',
189
+ file: 'src/event-processing/normalize.ts',
190
+ purl: variationPurl,
191
+ purpose: 'signature only — named + positional (type-only) params, array return; no callers/callees comments',
192
+ symbol: 'normalizeSession',
193
+ layer: 2,
194
+ detail: {
195
+ kind: 'function',
196
+ parameters: [
197
+ { name: 'session', type: 'SessionRecord' },
198
+ { type: 'NormalizeOptions' },
199
+ ],
200
+ returnType: 'SessionEvent[]',
201
+ callers: [],
202
+ callees: [],
203
+ } satisfies GraphifyComponentDetail,
204
+ },
205
+ {
206
+ id: 'fn-calls',
207
+ name: 'mergeSessions',
208
+ construct: 'function',
209
+ file: 'src/session/merge.ts',
210
+ purl: variationPurl,
211
+ purpose: 'signature + call relationships — union-typed param, generic return, called-by / calls trailing comments',
212
+ symbol: 'mergeSessions',
213
+ layer: 2,
214
+ detail: {
215
+ kind: 'function',
216
+ parameters: [
217
+ { name: 'sessions', type: 'SessionRecord[]' },
218
+ { name: 'strategy', type: `'append' | 'replace'` },
219
+ ],
220
+ returnType: 'Promise<SessionEvent[]>',
221
+ callers: [{ nodeId: 'c1', name: 'capture-session', source_location: 'L88' }],
222
+ callees: [{ nodeId: 'c2', name: 'toUniversalEvents', source_location: 'L64' }],
223
+ } satisfies GraphifyComponentDetail,
224
+ },
225
+
226
+ // --- type: bare → fields only → fields + implementors + used-by
227
+ {
228
+ id: 'ty-bare',
229
+ name: 'RawFrame',
230
+ construct: 'interface',
231
+ file: 'src/session/RawFrame.ts',
232
+ purl: variationPurl,
233
+ purpose: 'no drill-down — renders a plain `interface RawFrame`',
234
+ symbol: 'RawFrame',
235
+ layer: 3,
236
+ },
237
+ {
238
+ id: 'ty-fields',
239
+ name: 'SessionRecord',
240
+ construct: 'interface',
241
+ file: 'src/session/transcript.ts',
242
+ purl: variationPurl,
243
+ purpose: 'fields only — typed interface body, nothing else',
244
+ symbol: 'SessionRecord',
245
+ layer: 3,
246
+ detail: {
247
+ kind: 'type',
248
+ properties: [
249
+ { name: 'id', type: 'string' },
250
+ { name: 'admittedSeq', type: 'number' },
251
+ ],
252
+ usedBy: [],
253
+ implementors: [],
254
+ } satisfies GraphifyComponentDetail,
255
+ },
256
+ {
257
+ id: 'ty-full',
258
+ name: 'Transport',
259
+ construct: 'interface',
260
+ file: 'src/transport/Transport.ts',
261
+ purl: variationPurl,
262
+ purpose: 'full — fields + implemented-by (clicks through to HttpTransport) + used-by comments',
263
+ symbol: 'Transport',
264
+ layer: 3,
265
+ detail: {
266
+ kind: 'type',
267
+ properties: [{ name: 'name', type: 'string' }],
268
+ usedBy: [{ nodeId: 'u1', name: 'main', context: 'parameter_type' }],
269
+ implementors: ['HttpTransport'],
270
+ } satisfies GraphifyComponentDetail,
271
+ },
272
+
273
+ // --- module: bare → exports only → exports + imports
274
+ {
275
+ id: 'mod-bare',
276
+ name: 'transcript',
277
+ construct: 'module',
278
+ file: 'src/session/transcript.ts',
279
+ purl: variationPurl,
280
+ purpose: 'no drill-down — symbol-less module named from its file basename',
281
+ symbol: '',
282
+ layer: 4,
283
+ },
284
+ {
285
+ id: 'mod-exports',
286
+ name: 'paths',
287
+ construct: 'module',
288
+ file: 'src/session/paths.ts',
289
+ purl: variationPurl,
290
+ purpose: 'exports only — export statement + defines comment',
291
+ symbol: '',
292
+ layer: 4,
293
+ detail: {
294
+ kind: 'module',
295
+ exports: ['extractToolName', 'extractFilePath'],
296
+ imports: [],
297
+ symbols: ['extractToolName', 'extractFilePath'],
298
+ } satisfies GraphifyComponentDetail,
299
+ },
300
+ {
301
+ id: 'mod-full',
302
+ name: 'index',
303
+ construct: 'module',
304
+ file: 'src/index.ts',
305
+ purl: variationPurl,
306
+ purpose: 'full — import statements + re-export statement + defines comment',
307
+ symbol: '',
308
+ layer: 4,
309
+ detail: {
310
+ kind: 'module',
311
+ exports: ['SessionReader', 'SessionStore'],
312
+ imports: [{ nodeId: 'i1', name: 'transcript', relation: 'imports_from' }],
313
+ symbols: ['SessionReader', 'SessionStore'],
314
+ } satisfies GraphifyComponentDetail,
315
+ },
316
+
317
+ // --- external: bare → labeled
318
+ {
319
+ id: 'ext-bare',
320
+ name: 'left-pad',
321
+ construct: 'external',
322
+ file: '',
323
+ purl: 'pkg:npm/left-pad',
324
+ purpose: 'no drill-down — renders a plain `external left-pad`',
325
+ symbol: '',
326
+ layer: 5,
327
+ },
328
+ {
329
+ id: 'ext-label',
330
+ name: 'trail-viewer',
331
+ construct: 'external',
332
+ file: '',
333
+ purl: 'pkg:npm/@principal-ai/trail-viewer',
334
+ purpose: 'labeled — the full purl as a quoted string literal',
335
+ symbol: '',
336
+ layer: 5,
337
+ detail: {
338
+ kind: 'external',
339
+ label: 'pkg:npm/@principal-ai/trail-viewer',
340
+ } satisfies GraphifyComponentDetail,
341
+ },
342
+ ];
343
+
344
+ const kindVariationEdges: SubsystemComponentEdge[] = [];
345
+
346
+ function KindVariationsDemo() {
347
+ const [selected, setSelected] = useState<string | null>(null);
348
+ return (
349
+ <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
350
+ <SubsystemComponentGraph
351
+ components={kindVariationComponents}
352
+ edges={kindVariationEdges}
353
+ onSelect={(id) => setSelected(id)}
354
+ />
355
+ <div style={{ marginTop: 8, fontFamily: 'monospace', fontSize: 12, color: '#aaa' }}>
356
+ columns: class · function · type · module · external — each goes bare → detailed
357
+ {selected ? ` · selected: ${selected}` : ''}
358
+ </div>
359
+ </div>
360
+ );
361
+ }
362
+
363
+ export const KindVariations: Story = {
364
+ render: () => <KindVariationsDemo />,
365
+ };