@principal-ai/subsystems-react 0.55.2 → 0.56.0

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 (107) hide show
  1. package/dist/index.d.ts +12 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/pierre/PierreFileView.js +3 -3
  6. package/dist/pierre/PierreFileView.js.map +1 -1
  7. package/dist/pierre/PierreTrailCodeView.d.ts +1 -6
  8. package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
  9. package/dist/pierre/PierreTrailCodeView.js +21 -18
  10. package/dist/pierre/PierreTrailCodeView.js.map +1 -1
  11. package/dist/pierre/fileAvailability.d.ts +4 -7
  12. package/dist/pierre/fileAvailability.d.ts.map +1 -1
  13. package/dist/pierre/fileAvailability.js +5 -10
  14. package/dist/pierre/fileAvailability.js.map +1 -1
  15. package/dist/subsystem/C4Graph.d.ts.map +1 -1
  16. package/dist/subsystem/C4Graph.js +1 -1
  17. package/dist/subsystem/C4Graph.js.map +1 -1
  18. package/dist/subsystem/DecorationPanel.d.ts +37 -0
  19. package/dist/subsystem/DecorationPanel.d.ts.map +1 -0
  20. package/dist/subsystem/DecorationPanel.js +147 -0
  21. package/dist/subsystem/DecorationPanel.js.map +1 -0
  22. package/dist/subsystem/FileDrawer.d.ts +3 -1
  23. package/dist/subsystem/FileDrawer.d.ts.map +1 -1
  24. package/dist/subsystem/FileDrawer.js +2 -2
  25. package/dist/subsystem/FileDrawer.js.map +1 -1
  26. package/dist/subsystem/IssueList.d.ts.map +1 -1
  27. package/dist/subsystem/IssueList.js +26 -0
  28. package/dist/subsystem/IssueList.js.map +1 -1
  29. package/dist/subsystem/SubsystemComponentGraph.d.ts +9 -5
  30. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  31. package/dist/subsystem/SubsystemComponentGraph.js +37 -47
  32. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  33. package/dist/subsystem/TrailStackBreadcrumb.d.ts +21 -0
  34. package/dist/subsystem/TrailStackBreadcrumb.d.ts.map +1 -0
  35. package/dist/subsystem/TrailStackBreadcrumb.js +77 -0
  36. package/dist/subsystem/TrailStackBreadcrumb.js.map +1 -0
  37. package/dist/subsystem/TrailStepsNav.d.ts +4 -3
  38. package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
  39. package/dist/subsystem/TrailStepsNav.js +13 -16
  40. package/dist/subsystem/TrailStepsNav.js.map +1 -1
  41. package/dist/subsystem/TrailsPanel.d.ts +9 -7
  42. package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
  43. package/dist/subsystem/TrailsPanel.js +126 -76
  44. package/dist/subsystem/TrailsPanel.js.map +1 -1
  45. package/dist/subsystem/decoration.d.ts +112 -0
  46. package/dist/subsystem/decoration.d.ts.map +1 -0
  47. package/dist/subsystem/decoration.js +54 -0
  48. package/dist/subsystem/decoration.js.map +1 -0
  49. package/dist/subsystem/model.d.ts +5 -18
  50. package/dist/subsystem/model.d.ts.map +1 -1
  51. package/dist/subsystem/model.js +3 -11
  52. package/dist/subsystem/model.js.map +1 -1
  53. package/dist/subsystem/nodes.d.ts.map +1 -1
  54. package/dist/subsystem/nodes.js +17 -24
  55. package/dist/subsystem/nodes.js.map +1 -1
  56. package/dist/subsystem/stepEmphasis.d.ts +78 -0
  57. package/dist/subsystem/stepEmphasis.d.ts.map +1 -0
  58. package/dist/subsystem/stepEmphasis.js +89 -0
  59. package/dist/subsystem/stepEmphasis.js.map +1 -0
  60. package/dist/subsystem/trailBrief.d.ts.map +1 -1
  61. package/dist/subsystem/trailBrief.js +20 -0
  62. package/dist/subsystem/trailBrief.js.map +1 -1
  63. package/dist/subsystem/trailStack.d.ts +53 -0
  64. package/dist/subsystem/trailStack.d.ts.map +1 -0
  65. package/dist/subsystem/trailStack.js +154 -0
  66. package/dist/subsystem/trailStack.js.map +1 -0
  67. package/dist/subsystem/trailStepDisplay.d.ts +38 -0
  68. package/dist/subsystem/trailStepDisplay.d.ts.map +1 -0
  69. package/dist/subsystem/trailStepDisplay.js +41 -0
  70. package/dist/subsystem/trailStepDisplay.js.map +1 -0
  71. package/package.json +3 -3
  72. package/src/index.ts +47 -1
  73. package/src/pierre/PierreFileView.tsx +3 -3
  74. package/src/pierre/PierreTrailCodeView.tsx +25 -28
  75. package/src/pierre/fileAvailability.test.ts +0 -6
  76. package/src/pierre/fileAvailability.ts +5 -13
  77. package/src/stories/Canvases/Subsystem/Deprecated.stories.tsx +3 -17
  78. package/src/stories/Canvases/Subsystem/NodeAnatomy.stories.tsx +3 -31
  79. package/src/stories/Canvases/Subsystem/StepEmphasis.stories.tsx +528 -0
  80. package/src/stories/Canvases/Subsystem/Trails.stories.tsx +0 -187
  81. package/src/stories/Components/DecorationPanel.stories.tsx +160 -0
  82. package/src/subsystem/C4Graph.tsx +0 -1
  83. package/src/subsystem/DecorationPanel.test.tsx +128 -0
  84. package/src/subsystem/DecorationPanel.tsx +334 -0
  85. package/src/subsystem/FileDrawer.tsx +6 -0
  86. package/src/subsystem/IssueList.tsx +26 -0
  87. package/src/subsystem/SubsystemComponentGraph.tsx +68 -65
  88. package/src/subsystem/TrailStackBreadcrumb.test.tsx +109 -0
  89. package/src/subsystem/TrailStackBreadcrumb.tsx +172 -0
  90. package/src/subsystem/TrailStepsNav.test.tsx +35 -0
  91. package/src/subsystem/TrailStepsNav.tsx +18 -19
  92. package/src/subsystem/TrailsPanel.test.tsx +149 -0
  93. package/src/subsystem/TrailsPanel.tsx +165 -39
  94. package/src/subsystem/decoration.test.ts +72 -0
  95. package/src/subsystem/decoration.ts +151 -0
  96. package/src/subsystem/model.test.ts +7 -22
  97. package/src/subsystem/model.ts +6 -20
  98. package/src/subsystem/nodes.tsx +19 -28
  99. package/src/subsystem/stepEmphasis.test.ts +110 -0
  100. package/src/subsystem/stepEmphasis.ts +151 -0
  101. package/src/subsystem/trailBrief.test.ts +29 -0
  102. package/src/subsystem/trailBrief.ts +20 -0
  103. package/src/subsystem/trailStack.test.ts +133 -0
  104. package/src/subsystem/trailStack.ts +229 -0
  105. package/src/subsystem/trailStepDisplay.ts +68 -0
  106. package/src/stories/Canvases/Subsystem/Proposed.stories.tsx +0 -256
  107. package/src/stories/Canvases/Subsystem/ProposedTrails.stories.tsx +0 -184
@@ -1,256 +0,0 @@
1
- import React, { useState } from 'react';
2
- import '@xyflow/react/dist/style.css';
3
- import type { Meta, StoryObj } from '@storybook/react';
4
- import { ReactFlowProvider, type NodeProps } from '@xyflow/react';
5
- import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
- import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGraph';
7
- import { SubsystemComponentNode } from '../../../subsystem/nodes';
8
- import type {
9
- SubsystemComponent,
10
- SubsystemGraphNode,
11
- } from '../../../subsystem/model';
12
- import { trailFromSteps } from './fixtures';
13
-
14
- const meta = {
15
- title: 'Canvases/Subsystem/Proposed',
16
- parameters: { layout: 'fullscreen' },
17
- tags: ['autodocs'],
18
- decorators: [
19
- (Story) => (
20
- <ThemeProvider theme={defaultEditorTheme}>
21
- <ReactFlowProvider>
22
- <Story />
23
- </ReactFlowProvider>
24
- </ThemeProvider>
25
- ),
26
- ],
27
- } satisfies Meta;
28
-
29
- export default meta;
30
- type Story = StoryObj<typeof meta>;
31
-
32
- const PURL = 'pkg:github/principal-ai/subsystem-modeling';
33
-
34
- function nodeProps(c: SubsystemComponent): NodeProps<SubsystemGraphNode> {
35
- return {
36
- data: { component: c },
37
- selected: false,
38
- width: 230,
39
- height: 84,
40
- } as unknown as NodeProps<SubsystemGraphNode>;
41
- }
42
-
43
- /** Side-by-side single-node spotlights — proposed vs normal vs role combos. */
44
- function NodeSpotlight({
45
- label,
46
- component,
47
- }: {
48
- label: string;
49
- component: SubsystemComponent;
50
- }) {
51
- return (
52
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8, width: 260 }}>
53
- <div
54
- style={{
55
- fontFamily: 'ui-monospace, monospace',
56
- fontSize: 11,
57
- color: '#888',
58
- minHeight: 32,
59
- }}
60
- >
61
- {label}
62
- </div>
63
- <div style={{ position: 'relative', height: 110, width: 240 }}>
64
- <SubsystemComponentNode {...nodeProps(component)} />
65
- </div>
66
- <pre
67
- style={{
68
- margin: 0,
69
- fontSize: 10,
70
- fontFamily: 'ui-monospace, monospace',
71
- background: '#1a1a1a',
72
- color: '#ccc',
73
- padding: 8,
74
- borderRadius: 4,
75
- overflow: 'auto',
76
- }}
77
- >
78
- {JSON.stringify(
79
- {
80
- construct: component.construct,
81
- proposed: component.proposed || undefined,
82
- role: component.role,
83
- symbol: component.symbol || undefined,
84
- file: component.file || undefined,
85
- },
86
- null,
87
- 2,
88
- )}
89
- </pre>
90
- </div>
91
- );
92
- }
93
-
94
- const spotlightRows: Array<{ label: string; component: SubsystemComponent }> = [
95
- {
96
- label: 'normal function (baseline)',
97
- component: {
98
- alias: 'live-fn',
99
- name: 'ensureOpencode',
100
- construct: 'function',
101
- file: 'src/bun/opencode-v2.ts',
102
- purl: PURL,
103
- symbol: 'ensureOpencode',
104
- purpose: 'Detect / install / update the OpenCode CLI',
105
- },
106
- },
107
- {
108
- label: 'proposed function — dashed border + right badge',
109
- component: {
110
- alias: 'prop-fn',
111
- name: 'OpenCodeV2Lifecycle',
112
- construct: 'function',
113
- file: '',
114
- purl: PURL,
115
- symbol: 'OpenCodeV2Lifecycle',
116
- purpose: 'Studio-managed OpenCode V2 detect / install / update',
117
- proposed: true,
118
- },
119
- },
120
- {
121
- label: 'proposed class',
122
- component: {
123
- alias: 'prop-class',
124
- name: 'MaintainModelAgent',
125
- construct: 'class',
126
- file: 'src/bun/maintain-model-agent.ts',
127
- purl: PURL,
128
- symbol: 'MaintainModelAgent',
129
- purpose: 'Planned host agent that drives model maintenance',
130
- proposed: true,
131
- },
132
- },
133
- {
134
- label: 'proposed + role: entry (badge shows proposed only)',
135
- component: {
136
- alias: 'prop-entry',
137
- name: 'startMaintainFlow',
138
- construct: 'function',
139
- file: '',
140
- purl: PURL,
141
- symbol: 'startMaintainFlow',
142
- purpose: 'Planned RPC entry for maintain',
143
- proposed: true,
144
- role: 'entry',
145
- },
146
- },
147
- {
148
- label: 'external (contrast — real outside system)',
149
- component: {
150
- alias: 'ext',
151
- name: 'OpenCode CLI',
152
- construct: 'external',
153
- file: '',
154
- purl: 'pkg:npm/@opencode-ai/cli',
155
- symbol: '',
156
- purpose: 'External OpenCode product',
157
- role: 'service',
158
- },
159
- },
160
- ];
161
-
162
- /** Spotlights: proposed badge + dashed border vs normal and external. */
163
- export const Spotlights: Story = {
164
- render: () => (
165
- <div
166
- style={{
167
- padding: 24,
168
- display: 'flex',
169
- flexWrap: 'wrap',
170
- gap: 28,
171
- alignItems: 'flex-start',
172
- minHeight: '100vh',
173
- boxSizing: 'border-box',
174
- }}
175
- >
176
- {spotlightRows.map((row) => (
177
- <NodeSpotlight key={row.component.alias} {...row} />
178
- ))}
179
- </div>
180
- ),
181
- };
182
-
183
- // ---------------------------------------------------------------------------
184
- // Full graph: live seam calling a proposed host lifecycle + real external
185
- // ---------------------------------------------------------------------------
186
- const migrationComponents: SubsystemComponent[] = [
187
- {
188
- alias: 'audit',
189
- name: 'auditSubsystemModel',
190
- construct: 'function',
191
- file: 'src/bun/verify-subsystem-component.ts',
192
- purl: PURL,
193
- symbol: 'auditSubsystemModel',
194
- purpose: 'Deterministic dry-run audit of a stored model',
195
- role: 'entry',
196
- },
197
- {
198
- alias: 'lifecycle',
199
- name: 'OpenCodeV2Lifecycle',
200
- construct: 'function',
201
- file: '',
202
- purl: PURL,
203
- symbol: 'OpenCodeV2Lifecycle',
204
- purpose: 'Proposed Studio host: detect / install / update / Service.ensure',
205
- proposed: true,
206
- },
207
- {
208
- alias: 'maintain',
209
- name: 'runMaintainModel',
210
- construct: 'function',
211
- file: 'src/bun/maintain-model.ts',
212
- purl: PURL,
213
- symbol: 'runMaintainModel',
214
- purpose: 'Existing maintain agent runner',
215
- },
216
- {
217
- alias: 'cli',
218
- name: '@opencode-ai/cli',
219
- construct: 'external',
220
- file: '',
221
- purl: 'pkg:npm/@opencode-ai/cli@beta',
222
- symbol: '',
223
- purpose: 'Real external OpenCode CLI',
224
- role: 'service',
225
- },
226
- ];
227
-
228
- const migrationTrails = [
229
- trailFromSteps('migration-steps', 'Migration steps', [
230
- ['audit', 'maintain', 'calls', 'src/bun/verify-subsystem-component.ts', 1],
231
- ['maintain', 'lifecycle', 'uses', 'src/bun/maintain-model.ts', 1],
232
- ['lifecycle', 'cli', 'calls', 'src/bun/opencode-v2.ts', 1],
233
- ]),
234
- ];
235
-
236
- function MigrationDemo() {
237
- const [selected, setSelected] = useState<string | null>(null);
238
- return (
239
- <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
240
- <SubsystemComponentGraph
241
- components={migrationComponents}
242
- trails={migrationTrails}
243
- onSelect={(id) => setSelected(id)}
244
- />
245
- <div style={{ marginTop: 8, padding: '0 12px', fontFamily: 'monospace', fontSize: 12, color: '#aaa' }}>
246
- proposed OpenCodeV2Lifecycle between live maintain code and real external CLI
247
- {selected ? ` · selected: ${selected}` : ''}
248
- </div>
249
- </div>
250
- );
251
- }
252
-
253
- /** Full graph: proposed node between live code and a true external. */
254
- export const MigrationPlaceholder: Story = {
255
- render: () => <MigrationDemo />,
256
- };
@@ -1,184 +0,0 @@
1
- import React 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, SubsystemTrail } from '../../../subsystem/model';
7
-
8
- const meta = {
9
- title: 'Canvases/Subsystem/ProposedTrails',
10
- component: SubsystemComponentGraph,
11
- parameters: {
12
- layout: 'fullscreen',
13
- },
14
- tags: ['autodocs'],
15
- decorators: [
16
- (Story) => (
17
- <ThemeProvider theme={defaultEditorTheme}>
18
- <Story />
19
- </ThemeProvider>
20
- ),
21
- ],
22
- } satisfies Meta<typeof SubsystemComponentGraph>;
23
-
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
-
27
- const PURL = 'pkg:github/principal-ai/subsystem-modeling';
28
-
29
- const components: SubsystemComponent[] = [
30
- {
31
- alias: 'audit',
32
- name: 'auditSubsystemModel',
33
- construct: 'function',
34
- file: 'src/bun/verify-subsystem-component.ts',
35
- purl: PURL,
36
- symbol: 'auditSubsystemModel',
37
- purpose: 'Deterministic dry-run audit of a stored model',
38
- role: 'entry',
39
- process: 'studio/host',
40
- },
41
- {
42
- alias: 'maintain',
43
- name: 'runMaintainModel',
44
- construct: 'function',
45
- file: 'src/bun/maintain-model.ts',
46
- purl: PURL,
47
- symbol: 'runMaintainModel',
48
- purpose: 'Existing maintain agent runner',
49
- process: 'studio/host',
50
- },
51
- {
52
- alias: 'lifecycle',
53
- name: 'OpenCodeV2Lifecycle',
54
- construct: 'function',
55
- file: '',
56
- purl: PURL,
57
- symbol: 'OpenCodeV2Lifecycle',
58
- purpose: 'Proposed Studio host: detect / install / update / ensure',
59
- proposed: true,
60
- process: 'studio/host',
61
- },
62
- {
63
- alias: 'cache',
64
- name: 'LifecycleProbeCache',
65
- construct: 'store',
66
- file: '',
67
- purl: PURL,
68
- symbol: 'LifecycleProbeCache',
69
- purpose: 'Proposed cache of probe results',
70
- proposed: true,
71
- process: 'studio/host',
72
- },
73
- {
74
- alias: 'cli',
75
- name: '@opencode-ai/cli',
76
- construct: 'external',
77
- file: '',
78
- purl: 'pkg:npm/@opencode-ai/cli@beta',
79
- symbol: '',
80
- purpose: 'Real external OpenCode CLI',
81
- role: 'service',
82
- },
83
- ];
84
-
85
- const trails: SubsystemTrail[] = [
86
- {
87
- id: 'wt-audit',
88
- title: 'Audit a model',
89
- steps: [
90
- {
91
- from: 'audit',
92
- to: 'maintain',
93
- mechanism: 'calls',
94
- file: 'src/bun/verify-subsystem-component.ts',
95
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
96
- symbol: 'auditSubsystemModel',
97
- annotation: 'Live-only trail — no proposed badge.',
98
- },
99
- ],
100
- },
101
- {
102
- id: 'wt-install',
103
- title: 'Install OpenCode V2',
104
- steps: [
105
- {
106
- from: 'audit',
107
- to: 'maintain',
108
- mechanism: 'calls',
109
- file: 'src/bun/verify-subsystem-component.ts',
110
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
111
- symbol: 'auditSubsystemModel',
112
- },
113
- {
114
- from: 'maintain',
115
- to: 'lifecycle',
116
- mechanism: 'uses',
117
- file: 'src/bun/maintain-model.ts',
118
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
119
- symbol: 'runMaintainModel',
120
- annotation: 'Step onto the proposed lifecycle — step index is tinted.',
121
- },
122
- {
123
- from: 'lifecycle',
124
- to: 'cli',
125
- mechanism: 'calls',
126
- file: 'src/bun/maintain-model.ts',
127
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
128
- symbol: 'OpenCodeV2Lifecycle.ensure',
129
- },
130
- ],
131
- },
132
- {
133
- id: 'wt-warm',
134
- title: 'Warm the probe cache',
135
- steps: [
136
- {
137
- from: 'lifecycle',
138
- to: 'cache',
139
- mechanism: 'writes',
140
- file: 'src/bun/maintain-model.ts',
141
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
142
- symbol: 'LifecycleProbeCache.set',
143
- annotation: 'Both endpoints are proposed.',
144
- },
145
- ],
146
- },
147
- {
148
- id: 'wt-planned-seam',
149
- title: 'Planned seam (step-proposed)',
150
- steps: [
151
- {
152
- from: 'audit',
153
- to: 'cli',
154
- mechanism: 'uses',
155
- file: 'src/bun/verify-subsystem-component.ts',
156
- span: { startLine: 1, endLine: 1, contentHash: 'fixture' },
157
- symbol: 'probeCliVersion',
158
- // Step-level proposed: BOTH endpoints are real components — the
159
- // seam itself is what is planned. The edge label draws dashed on
160
- // the canvas; distinct from a proposed endpoint, which dashes the
161
- // node instead. Verification skips the step until promoted.
162
- proposed: true,
163
- annotation: 'The step itself is proposed — edge label is dashed.',
164
- },
165
- ],
166
- },
167
- ];
168
-
169
- function ProposedTrailsDemo() {
170
- return (
171
- <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
172
- <SubsystemComponentGraph
173
- components={components}
174
- trails={trails}
175
- title="proposed-work marker"
176
- description="Trails that touch a **proposed** component get their title tinted darkgoldenrod in the flows panel; expand a row and each step onto a proposed component is tinted too (index and title). Nodes for proposed components draw dashed darkgoldenrod on the canvas. A step that is itself `proposed` — a planned seam between real components — dashes its **edge label** instead."
177
- />
178
- </div>
179
- );
180
- }
181
-
182
- export const ProposedWorkflows: Story = {
183
- render: () => <ProposedTrailsDemo />,
184
- };