@principal-ai/principal-view-react 0.15.9 → 0.16.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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Session event diagnostic feed — raw → repo-normalized → accumulated pipeline
3
+ * per event, rendered as a three-column feed.
4
+ */
5
+ export {
6
+ SessionEventFeed,
7
+ SessionEventFeedGrouped,
8
+ } from './SessionEventFeed';
9
+ export type {
10
+ SessionEventFeedProps,
11
+ SessionEventFeedGroupedProps,
12
+ SessionEventFeedRow,
13
+ } from './SessionEventFeed';
package/src/index.ts CHANGED
@@ -200,3 +200,14 @@ export type {
200
200
  // Component props
201
201
  PipelineViewProps,
202
202
  } from './components/state-view';
203
+
204
+ // Session event diagnostic feed (raw → repo-normalized → accumulated)
205
+ export {
206
+ SessionEventFeed,
207
+ SessionEventFeedGrouped,
208
+ } from './components/session-events';
209
+ export type {
210
+ SessionEventFeedProps,
211
+ SessionEventFeedGroupedProps,
212
+ SessionEventFeedRow,
213
+ } from './components/session-events';
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { ThemeProvider, slateTheme } from '@principal-ade/industry-theme';
4
+ import { ChangeTypeVisual } from '../../../trail-viewer/src/mainview/components/ChangeTypeVisual';
5
+
6
+ const meta = {
7
+ title: 'Concepts/ChangeTypeVisual',
8
+ component: ChangeTypeVisual,
9
+ decorators: [
10
+ (Story) => (
11
+ <ThemeProvider theme={slateTheme}>
12
+ <div
13
+ style={{
14
+ height: '100vh',
15
+ width: '100vw',
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ justifyContent: 'center',
19
+ background: slateTheme.colors.background,
20
+ }}
21
+ >
22
+ <Story />
23
+ </div>
24
+ </ThemeProvider>
25
+ ),
26
+ ],
27
+ parameters: { layout: 'fullscreen' },
28
+ tags: ['autodocs'],
29
+ } satisfies Meta<typeof ChangeTypeVisual>;
30
+
31
+ export default meta;
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ function frame(content: React.ReactNode) {
35
+ return (
36
+ <div
37
+ style={{
38
+ border: `1px solid ${slateTheme.colors.border}`,
39
+ borderRadius: 16,
40
+ padding: 48,
41
+ background: slateTheme.colors.backgroundSecondary,
42
+ }}
43
+ >
44
+ {content}
45
+ </div>
46
+ );
47
+ }
48
+
49
+ export const Sequence: Story = {
50
+ args: { changeType: 'execution', theme: slateTheme, height: 320 },
51
+ render: (args) => frame(<ChangeTypeVisual {...args} />),
52
+ };
53
+
54
+ export const Derive: Story = {
55
+ args: { changeType: 'derive', theme: slateTheme, height: 320 },
56
+ render: (args) => frame(<ChangeTypeVisual {...args} />),
57
+ };
58
+
59
+ export const Integration: Story = {
60
+ args: { changeType: 'integration', theme: slateTheme, height: 320 },
61
+ render: (args) => frame(<ChangeTypeVisual {...args} />),
62
+ };
63
+
64
+ export const UI: Story = {
65
+ args: { changeType: 'ui', theme: slateTheme, height: 320 },
66
+ render: (args) => frame(<ChangeTypeVisual {...args} />),
67
+ };
@@ -0,0 +1,49 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
3
+ import type { AgentSessionEvent, V1RawEvent } from '@principal-ai/agent-monitoring';
4
+ import {
5
+ SessionEventFeed,
6
+ SessionEventFeedGrouped,
7
+ type SessionEventFeedRow,
8
+ } from '../components/session-events';
9
+ import rawSession from './data/opencode-session-raw-events.json';
10
+
11
+ const meta = {
12
+ title: 'Agent Raw Events/Cards',
13
+ parameters: {
14
+ layout: 'fullscreen',
15
+ },
16
+ tags: ['autodocs'],
17
+ } satisfies Meta;
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ // =============================================================================
23
+ // Fixture → rows
24
+ // =============================================================================
25
+
26
+ const fixture = rawSession as {
27
+ session: { id: string; title: string; slug: string; timeCreated: number };
28
+ events: V1RawEvent[];
29
+ normalized: Array<Record<string, unknown>>;
30
+ accumulated: Array<AgentSessionEvent | null>;
31
+ };
32
+
33
+ const rows: SessionEventFeedRow[] = fixture.events
34
+ .map((raw, i) => ({
35
+ seq: raw.seq,
36
+ type: raw.type,
37
+ raw,
38
+ normalized: fixture.normalized[i],
39
+ accumulated: fixture.accumulated[i],
40
+ }))
41
+ .sort((a, b) => a.seq - b.seq);
42
+
43
+ export const Feed: Story = {
44
+ render: () => <SessionEventFeed title={fixture.session.title} rows={rows} />,
45
+ };
46
+
47
+ export const Grouped: Story = {
48
+ render: () => <SessionEventFeedGrouped title={fixture.session.title} rows={rows} />,
49
+ };