causal-inspector 0.1.6 → 0.2.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 (37) hide show
  1. package/dist/CausalInspector.css +20 -447
  2. package/dist/CausalInspector.d.ts +8 -1
  3. package/dist/CausalInspector.js +32 -9
  4. package/dist/components/CopyablePayload.js +8 -8
  5. package/dist/components/EffectList.d.ts +4 -0
  6. package/dist/components/EffectList.js +15 -0
  7. package/dist/components/FilterBar.js +7 -10
  8. package/dist/components/GlobalScrubber.js +6 -6
  9. package/dist/components/JsonSyntax.js +8 -8
  10. package/dist/engines/query.js +131 -52
  11. package/dist/engines/scrubber.js +1 -1
  12. package/dist/engines/url.d.ts +5 -2
  13. package/dist/engines/url.js +50 -22
  14. package/dist/events.d.ts +38 -13
  15. package/dist/index.d.ts +5 -3
  16. package/dist/index.js +4 -2
  17. package/dist/panes/AggregateTimelinePane.js +4 -4
  18. package/dist/panes/CausalFlowPane.js +19 -19
  19. package/dist/panes/CausalTreePane.js +43 -34
  20. package/dist/panes/CorrelationExplorerPane.d.ts +2 -2
  21. package/dist/panes/CorrelationExplorerPane.js +10 -15
  22. package/dist/panes/LogsPane.js +8 -17
  23. package/dist/panes/SubjectChainPane.d.ts +1 -0
  24. package/dist/panes/SubjectChainPane.js +50 -0
  25. package/dist/panes/TimelinePane.js +33 -19
  26. package/dist/panes/WaterfallPane.js +5 -5
  27. package/dist/panes/WorkflowExplorerPane.d.ts +2 -0
  28. package/dist/panes/WorkflowExplorerPane.js +46 -0
  29. package/dist/queries.d.ts +16 -12
  30. package/dist/queries.js +103 -27
  31. package/dist/reducer.js +99 -38
  32. package/dist/state.d.ts +15 -5
  33. package/dist/state.js +16 -8
  34. package/dist/theme.js +4 -4
  35. package/dist/types.d.ts +52 -12
  36. package/dist/utils.js +1 -1
  37. package/package.json +1 -1
package/dist/queries.js CHANGED
@@ -5,12 +5,12 @@ const EVENT_FIELDS = `
5
5
  type
6
6
  name
7
7
  id
8
- parentId
9
- correlationId
8
+ causationId
9
+ workflowId
10
10
  reactorId
11
11
  aggregateType
12
12
  aggregateId
13
- streamVersion
13
+ streamRevision
14
14
  summary
15
15
  payload
16
16
  `;
@@ -26,14 +26,14 @@ export const INSPECTOR_EVENTS = `
26
26
  $limit: Int!
27
27
  $cursor: Int
28
28
  $search: String
29
- $correlationId: String
29
+ $workflowId: String
30
30
  $aggregateKey: String
31
31
  ) {
32
32
  inspectorEvents(
33
33
  limit: $limit
34
34
  cursor: $cursor
35
35
  search: $search
36
- correlationId: $correlationId
36
+ workflowId: $workflowId
37
37
  aggregateKey: $aggregateKey
38
38
  ) {
39
39
  events {
@@ -54,8 +54,8 @@ export const INSPECTOR_CAUSAL_TREE = `
54
54
  }
55
55
  `;
56
56
  export const INSPECTOR_CAUSAL_FLOW = `
57
- query InspectorCausalFlow($correlationId: String!) {
58
- inspectorCausalFlow(correlationId: $correlationId) {
57
+ query InspectorCausalFlow($workflowId: String!) {
58
+ inspectorCausalFlow(workflowId: $workflowId) {
59
59
  events {
60
60
  ${EVENT_FIELDS}
61
61
  }
@@ -74,9 +74,9 @@ export const INSPECTOR_REACTOR_LOGS = `
74
74
  }
75
75
  }
76
76
  `;
77
- export const INSPECTOR_REACTOR_LOGS_BY_CORRELATION = `
78
- query InspectorReactorLogsByCorrelation($correlationId: String!) {
79
- inspectorReactorLogsByCorrelation(correlationId: $correlationId) {
77
+ export const INSPECTOR_REACTOR_LOGS_BY_WORKFLOW = `
78
+ query InspectorReactorLogsByWorkflow($workflowId: String!) {
79
+ inspectorReactorLogsByWorkflow(workflowId: $workflowId) {
80
80
  eventId
81
81
  reactorId
82
82
  level
@@ -87,16 +87,16 @@ export const INSPECTOR_REACTOR_LOGS_BY_CORRELATION = `
87
87
  }
88
88
  `;
89
89
  export const INSPECTOR_REACTOR_DESCRIPTIONS = `
90
- query InspectorReactorDescriptions($correlationId: String!) {
91
- inspectorReactorDescriptions(correlationId: $correlationId) {
90
+ query InspectorReactorDescriptions($workflowId: String!) {
91
+ inspectorReactorDescriptions(workflowId: $workflowId) {
92
92
  reactorId
93
93
  blocks
94
94
  }
95
95
  }
96
96
  `;
97
97
  export const INSPECTOR_REACTOR_DESCRIPTION_SNAPSHOTS = `
98
- query InspectorReactorDescriptionSnapshots($correlationId: String!) {
99
- inspectorReactorDescriptionSnapshots(correlationId: $correlationId) {
98
+ query InspectorReactorDescriptionSnapshots($workflowId: String!) {
99
+ inspectorReactorDescriptionSnapshots(workflowId: $workflowId) {
100
100
  seq
101
101
  eventId
102
102
  reactorId
@@ -105,8 +105,8 @@ export const INSPECTOR_REACTOR_DESCRIPTION_SNAPSHOTS = `
105
105
  }
106
106
  `;
107
107
  export const INSPECTOR_AGGREGATE_TIMELINE = `
108
- query InspectorAggregateTimeline($correlationId: String!) {
109
- inspectorAggregateTimeline(correlationId: $correlationId) {
108
+ query InspectorAggregateTimeline($workflowId: String!) {
109
+ inspectorAggregateTimeline(workflowId: $workflowId) {
110
110
  seq
111
111
  eventId
112
112
  eventType
@@ -138,17 +138,17 @@ export const INSPECTOR_AGGREGATE_LIFECYCLE = `
138
138
  eventId
139
139
  eventType
140
140
  ts
141
- correlationId
141
+ workflowId
142
142
  aggregateKey
143
143
  state
144
144
  }
145
145
  }
146
146
  `;
147
- export const INSPECTOR_CORRELATIONS = `
148
- query InspectorCorrelations($search: String, $limit: Int, $cursor: String) {
149
- inspectorCorrelations(search: $search, limit: $limit, cursor: $cursor) {
150
- correlations {
151
- correlationId
147
+ export const INSPECTOR_WORKFLOWS = `
148
+ query InspectorWorkflows($search: String, $limit: Int, $cursor: String) {
149
+ inspectorWorkflows(search: $search, limit: $limit, cursor: $cursor) {
150
+ workflows {
151
+ workflowId
152
152
  eventCount
153
153
  firstTs
154
154
  lastTs
@@ -160,8 +160,8 @@ export const INSPECTOR_CORRELATIONS = `
160
160
  }
161
161
  `;
162
162
  export const INSPECTOR_REACTOR_OUTCOMES = `
163
- query InspectorReactorOutcomes($correlationId: String!) {
164
- inspectorReactorOutcomes(correlationId: $correlationId) {
163
+ query InspectorReactorOutcomes($workflowId: String!) {
164
+ inspectorReactorOutcomes(workflowId: $workflowId) {
165
165
  reactorId
166
166
  status
167
167
  error
@@ -173,11 +173,11 @@ export const INSPECTOR_REACTOR_OUTCOMES = `
173
173
  }
174
174
  `;
175
175
  export const INSPECTOR_REACTOR_ATTEMPTS = `
176
- query InspectorReactorAttempts($correlationId: String!) {
177
- inspectorReactorAttempts(correlationId: $correlationId) {
176
+ query InspectorReactorAttempts($workflowId: String!) {
177
+ inspectorReactorAttempts(workflowId: $workflowId) {
178
178
  eventId
179
179
  reactorId
180
- correlationId
180
+ workflowId
181
181
  attempt
182
182
  status
183
183
  error
@@ -186,3 +186,79 @@ export const INSPECTOR_REACTOR_ATTEMPTS = `
186
186
  }
187
187
  }
188
188
  `;
189
+ // ── Entity-scoped inspection queries ─────────────────────────────────────
190
+ const SUBJECT_CHAIN_EVENT_FIELDS = `
191
+ seq
192
+ ts
193
+ type
194
+ name
195
+ id
196
+ causationId
197
+ workflowId
198
+ reactorId
199
+ aggregateType
200
+ aggregateId
201
+ streamRevision
202
+ summary
203
+ payload
204
+ sourceMode
205
+ `;
206
+ export const INSPECTOR_SUBJECT_CHAIN = `
207
+ query InspectorSubjectChain(
208
+ $aggregateType: String!
209
+ $aggregateId: String!
210
+ $mode: SubjectChainMode!
211
+ $limit: Int
212
+ $cursor: Int
213
+ ) {
214
+ inspectorSubjectChain(
215
+ aggregateType: $aggregateType
216
+ aggregateId: $aggregateId
217
+ mode: $mode
218
+ limit: $limit
219
+ cursor: $cursor
220
+ ) {
221
+ events {
222
+ ${SUBJECT_CHAIN_EVENT_FIELDS}
223
+ }
224
+ nextCursor
225
+ depthCapReached
226
+ }
227
+ }
228
+ `;
229
+ export const INSPECTOR_EFFECTS_FOR_EVENT = `
230
+ query InspectorEffectsForEvent($eventId: String!) {
231
+ inspectorEffectsForEvent(eventId: $eventId) {
232
+ consumer
233
+ label
234
+ value
235
+ createdAt
236
+ }
237
+ }
238
+ `;
239
+ export const INSPECTOR_AGGREGATE_TYPES = `
240
+ query InspectorAggregateTypes($search: String, $limit: Int) {
241
+ inspectorAggregateTypes(search: $search, limit: $limit)
242
+ }
243
+ `;
244
+ export const INSPECTOR_AGGREGATE_KEYS_BY_TYPE = `
245
+ query InspectorAggregateKeysByType(
246
+ $aggregateType: String!
247
+ $search: String
248
+ $limit: Int
249
+ $cursor: String
250
+ ) {
251
+ inspectorAggregateKeysByType(
252
+ aggregateType: $aggregateType
253
+ search: $search
254
+ limit: $limit
255
+ cursor: $cursor
256
+ ) {
257
+ entries {
258
+ aggregateId
259
+ displayLabel
260
+ }
261
+ nextCursor
262
+ }
263
+ }
264
+ `;
package/dist/reducer.js CHANGED
@@ -3,24 +3,24 @@
3
3
  * (ui/flow_opened, ui/handler_selected) and browser-initiated
4
4
  * navigation (location/changed from popstate).
5
5
  */
6
- function applyNavigation(draft, correlationId, handler) {
7
- // Correlation changed → reset flow state
8
- if (correlationId !== draft.flowCorrelationId) {
9
- if (correlationId) {
10
- draft.flowCorrelationId = correlationId;
6
+ function applyNavigation(draft, workflowId, handler) {
7
+ // Workflow changed → reset flow state
8
+ if (workflowId !== draft.flowWorkflowId) {
9
+ if (workflowId) {
10
+ draft.flowWorkflowId = workflowId;
11
11
  draft.flowData = [];
12
12
  draft.flowSelection = null;
13
13
  draft.scrubberStart = null;
14
14
  draft.scrubberEnd = null;
15
15
  draft.scrubberPlaying = false;
16
16
  draft.logsFilter = {
17
- scope: "correlation",
17
+ scope: "workflow",
18
18
  reactorId: null,
19
- correlationId,
19
+ workflowId,
20
20
  };
21
21
  }
22
22
  else {
23
- draft.flowCorrelationId = null;
23
+ draft.flowWorkflowId = null;
24
24
  draft.flowData = [];
25
25
  draft.flowSelection = null;
26
26
  draft.scrubberStart = null;
@@ -29,7 +29,7 @@ function applyNavigation(draft, correlationId, handler) {
29
29
  draft.logsFilter = {
30
30
  scope: "reactor",
31
31
  reactorId: null,
32
- correlationId: null,
32
+ workflowId: null,
33
33
  };
34
34
  }
35
35
  }
@@ -38,24 +38,39 @@ function applyNavigation(draft, correlationId, handler) {
38
38
  draft.logsFilter = {
39
39
  scope: "reactor",
40
40
  reactorId: handler,
41
- correlationId: draft.flowCorrelationId,
41
+ workflowId: draft.flowWorkflowId,
42
42
  };
43
43
  }
44
44
  }
45
+ function applySubjectSelected(draft, aggregateType, aggregateId, mode) {
46
+ draft.subjectType = aggregateType;
47
+ draft.subjectId = aggregateId;
48
+ draft.subjectMode = mode;
49
+ draft.subjectChain = [];
50
+ draft.subjectChainCursor = null;
51
+ draft.subjectDepthCapped = false;
52
+ draft.subjectChainLoading = true;
53
+ // Mutual exclusion: clear workflow state
54
+ draft.flowWorkflowId = null;
55
+ draft.flowData = [];
56
+ draft.flowSelection = null;
57
+ draft.causalTree = null;
58
+ draft.logsFilter = { scope: "reactor", reactorId: null, workflowId: null };
59
+ }
45
60
  export const reducer = (draft, event) => {
46
61
  switch (event.type) {
47
62
  // ── Subscription ──
48
63
  case "events/received": {
49
64
  const newEvents = event.payload;
50
65
  const filtered = newEvents.filter((e) => {
51
- if (draft.filters.correlationId && e.correlationId !== draft.filters.correlationId) {
66
+ if (draft.filters.workflowId && e.workflowId !== draft.filters.workflowId) {
52
67
  return false;
53
68
  }
54
69
  if (draft.filters.search) {
55
70
  const s = draft.filters.search.toLowerCase();
56
71
  const matches = e.name.toLowerCase().includes(s) ||
57
72
  e.payload.toLowerCase().includes(s) ||
58
- (e.correlationId ?? "").toLowerCase().includes(s);
73
+ (e.workflowId ?? "").toLowerCase().includes(s);
59
74
  if (!matches)
60
75
  return false;
61
76
  }
@@ -90,40 +105,40 @@ export const reducer = (draft, event) => {
90
105
  draft.logs = event.payload;
91
106
  break;
92
107
  case "events/descriptions_loaded": {
93
- const { correlationId, descriptions } = event.payload;
94
- draft.descriptions[correlationId] = descriptions;
108
+ const { workflowId, descriptions } = event.payload;
109
+ draft.descriptions[workflowId] = descriptions;
95
110
  break;
96
111
  }
97
112
  case "events/description_snapshots_loaded": {
98
- const { correlationId, snapshots } = event.payload;
99
- draft.descriptionSnapshots[correlationId] = snapshots;
113
+ const { workflowId, snapshots } = event.payload;
114
+ draft.descriptionSnapshots[workflowId] = snapshots;
100
115
  break;
101
116
  }
102
117
  case "events/aggregate_timeline_loaded": {
103
- const { correlationId, entries } = event.payload;
104
- draft.aggregateTimeline[correlationId] = entries;
118
+ const { workflowId, entries } = event.payload;
119
+ draft.aggregateTimeline[workflowId] = entries;
105
120
  break;
106
121
  }
107
122
  case "events/outcomes_loaded": {
108
- const { correlationId, outcomes } = event.payload;
109
- draft.outcomes[correlationId] = outcomes;
123
+ const { workflowId, outcomes } = event.payload;
124
+ draft.outcomes[workflowId] = outcomes;
110
125
  break;
111
126
  }
112
127
  case "events/attempts_loaded": {
113
- const { correlationId, attempts } = event.payload;
114
- draft.attempts[correlationId] = attempts;
128
+ const { workflowId, attempts } = event.payload;
129
+ draft.attempts[workflowId] = attempts;
115
130
  break;
116
131
  }
117
- case "events/correlations_loaded": {
118
- const { correlations, hasMore, append } = event.payload;
132
+ case "events/workflows_loaded": {
133
+ const { workflows, hasMore, append } = event.payload;
119
134
  if (append) {
120
- draft.correlations.push(...correlations);
135
+ draft.workflows.push(...workflows);
121
136
  }
122
137
  else {
123
- draft.correlations = correlations;
138
+ draft.workflows = workflows;
124
139
  }
125
- draft.correlationsHasMore = hasMore;
126
- draft.correlationsLoading = false;
140
+ draft.workflowsHasMore = hasMore;
141
+ draft.workflowsLoading = false;
127
142
  break;
128
143
  }
129
144
  case "events/reactor_dependencies_loaded":
@@ -138,17 +153,23 @@ export const reducer = (draft, event) => {
138
153
  break;
139
154
  // ── Navigation (user facts + browser popstate) ──
140
155
  case "ui/flow_opened":
141
- applyNavigation(draft, event.payload.correlationId, null);
156
+ applyNavigation(draft, event.payload.workflowId, null);
142
157
  break;
143
158
  case "ui/flow_closed":
144
159
  applyNavigation(draft, null, null);
145
160
  break;
146
161
  case "ui/handler_selected":
147
- applyNavigation(draft, draft.flowCorrelationId, event.payload.reactorId);
162
+ applyNavigation(draft, draft.flowWorkflowId, event.payload.reactorId);
148
163
  break;
149
164
  case "location/changed":
150
- applyNavigation(draft, event.payload.correlationId, event.payload.handler);
151
- draft.filters.correlationId = event.payload.correlationId;
165
+ if (event.payload.subject) {
166
+ const [subjectType, subjectId] = event.payload.subject.split(/:(.+)/);
167
+ applySubjectSelected(draft, subjectType, subjectId, event.payload.subjectMode ?? "both");
168
+ }
169
+ else {
170
+ applyNavigation(draft, event.payload.workflowId, event.payload.handler);
171
+ draft.filters.workflowId = event.payload.workflowId;
172
+ }
152
173
  break;
153
174
  // ── UI ──
154
175
  case "ui/event_selected":
@@ -163,9 +184,9 @@ export const reducer = (draft, event) => {
163
184
  // Clear reactor filter when deselecting a node
164
185
  if (event.payload == null && draft.logsFilter.reactorId != null) {
165
186
  draft.logsFilter = {
166
- scope: "correlation",
187
+ scope: "workflow",
167
188
  reactorId: null,
168
- correlationId: draft.flowCorrelationId,
189
+ workflowId: draft.flowWorkflowId,
169
190
  };
170
191
  }
171
192
  break;
@@ -190,11 +211,51 @@ export const reducer = (draft, event) => {
190
211
  case "ui/scrubber_speed_changed":
191
212
  draft.scrubberSpeed = event.payload.speed;
192
213
  break;
193
- case "ui/correlations_requested":
194
- draft.correlationsLoading = true;
214
+ case "ui/workflows_requested":
215
+ draft.workflowsLoading = true;
216
+ break;
217
+ case "ui/load_more_workflows_requested":
218
+ draft.workflowsLoading = true;
219
+ break;
220
+ // ── Entity-scoped inspection ──
221
+ case "ui/subject_selected":
222
+ applySubjectSelected(draft, event.payload.aggregateType, event.payload.aggregateId, event.payload.mode ?? "both");
223
+ break;
224
+ case "ui/subject_mode_changed":
225
+ draft.subjectMode = event.payload.mode;
226
+ draft.subjectChain = [];
227
+ draft.subjectChainCursor = null;
228
+ draft.subjectChainLoading = true;
229
+ break;
230
+ case "ui/subject_chain_load_more":
231
+ draft.subjectChainLoading = true;
232
+ break;
233
+ case "ui/event_effects_requested": {
234
+ const { eventId } = event.payload;
235
+ if (!draft.loadingEffects.includes(eventId) && !(eventId in draft.expandedEffects)) {
236
+ draft.loadingEffects.push(eventId);
237
+ }
195
238
  break;
196
- case "ui/load_more_correlations_requested":
197
- draft.correlationsLoading = true;
239
+ }
240
+ case "events/subject_chain_loaded": {
241
+ const { events, hasMore, cursor, depthCapped, append } = event.payload;
242
+ if (append) {
243
+ draft.subjectChain.push(...events);
244
+ }
245
+ else {
246
+ draft.subjectChain = events;
247
+ }
248
+ draft.subjectChainHasMore = hasMore;
249
+ draft.subjectChainCursor = cursor;
250
+ draft.subjectDepthCapped = depthCapped;
251
+ draft.subjectChainLoading = false;
252
+ break;
253
+ }
254
+ case "events/event_effects_loaded": {
255
+ const { eventId, effects } = event.payload;
256
+ draft.expandedEffects[eventId] = effects;
257
+ draft.loadingEffects = draft.loadingEffects.filter(id => id !== eventId);
198
258
  break;
259
+ }
199
260
  }
200
261
  };
package/dist/state.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import type { InspectorEvent, CorrelationSummary, ReactorDependency, AggregateLifecycleEntry, FilterState, FlowSelection, ReactorDescription, ReactorDescriptionSnapshot, AggregateTimelineEntry, ReactorLog, ReactorOutcome, ReactorAttempt, LogsFilter, PaneLayout } from "./types";
1
+ import type { InspectorEvent, WorkflowSummary, ReactorDependency, AggregateLifecycleEntry, FilterState, FlowSelection, ReactorDescription, ReactorDescriptionSnapshot, AggregateTimelineEntry, ReactorLog, ReactorOutcome, ReactorAttempt, LogsFilter, PaneLayout, SubjectChainEvent, SubjectChainMode, InspectorEffect } from "./types";
2
2
  export type InspectorState = {
3
3
  events: InspectorEvent[];
4
4
  hasMore: boolean;
5
5
  loading: boolean;
6
6
  selectedSeq: number | null;
7
- flowCorrelationId: string | null;
7
+ flowWorkflowId: string | null;
8
8
  flowData: InspectorEvent[];
9
9
  flowSelection: FlowSelection;
10
10
  scrubberStart: number | null;
@@ -23,14 +23,24 @@ export type InspectorState = {
23
23
  aggregateTimeline: Record<string, AggregateTimelineEntry[]>;
24
24
  outcomes: Record<string, ReactorOutcome[]>;
25
25
  attempts: Record<string, ReactorAttempt[]>;
26
- correlations: CorrelationSummary[];
27
- correlationsLoading: boolean;
28
- correlationsHasMore: boolean;
26
+ workflows: WorkflowSummary[];
27
+ workflowsLoading: boolean;
28
+ workflowsHasMore: boolean;
29
29
  reactorDependencies: ReactorDependency[];
30
30
  aggregateKeys: string[];
31
31
  aggregateLifecycle: AggregateLifecycleEntry[];
32
32
  aggregateLifecycleKey: string | null;
33
33
  subscription: "connected" | "disconnected" | "error";
34
34
  paneLayout: PaneLayout | null;
35
+ subjectType: string | null;
36
+ subjectId: string | null;
37
+ subjectMode: SubjectChainMode;
38
+ subjectChain: SubjectChainEvent[];
39
+ subjectChainLoading: boolean;
40
+ subjectChainHasMore: boolean;
41
+ subjectChainCursor: number | null;
42
+ subjectDepthCapped: boolean;
43
+ expandedEffects: Record<string, InspectorEffect[]>;
44
+ loadingEffects: string[];
35
45
  };
36
46
  export declare const initialState: InspectorState;
package/dist/state.js CHANGED
@@ -3,7 +3,7 @@ export const initialState = {
3
3
  hasMore: true,
4
4
  loading: false,
5
5
  selectedSeq: null,
6
- flowCorrelationId: null,
6
+ flowWorkflowId: null,
7
7
  flowData: [],
8
8
  flowSelection: null,
9
9
  scrubberStart: null,
@@ -13,29 +13,37 @@ export const initialState = {
13
13
  causalTree: null,
14
14
  filters: {
15
15
  search: "",
16
- correlationId: null,
16
+ workflowId: null,
17
17
  aggregateKey: null,
18
- from: null,
19
- to: null,
20
18
  },
21
19
  logs: [],
22
20
  logsFilter: {
23
21
  scope: "reactor",
24
22
  reactorId: null,
25
- correlationId: null,
23
+ workflowId: null,
26
24
  },
27
25
  descriptions: {},
28
26
  descriptionSnapshots: {},
29
27
  aggregateTimeline: {},
30
28
  outcomes: {},
31
29
  attempts: {},
32
- correlations: [],
33
- correlationsLoading: false,
34
- correlationsHasMore: true,
30
+ workflows: [],
31
+ workflowsLoading: false,
32
+ workflowsHasMore: true,
35
33
  reactorDependencies: [],
36
34
  aggregateKeys: [],
37
35
  aggregateLifecycle: [],
38
36
  aggregateLifecycleKey: null,
39
37
  subscription: "disconnected",
40
38
  paneLayout: null,
39
+ subjectType: null,
40
+ subjectId: null,
41
+ subjectMode: "both",
42
+ subjectChain: [],
43
+ subjectChainLoading: false,
44
+ subjectChainHasMore: false,
45
+ subjectChainCursor: null,
46
+ subjectDepthCapped: false,
47
+ expandedEffects: {},
48
+ loadingEffects: [],
41
49
  };
package/dist/theme.js CHANGED
@@ -28,8 +28,8 @@ function hslToRgb(h, s, l) {
28
28
  return [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
29
29
  }
30
30
  export const LOG_LEVEL_COLORS = {
31
- debug: "ci-log-debug",
32
- info: "ci-log-info",
33
- warn: "ci-log-warn",
34
- error: "ci-log-error",
31
+ debug: "bg-zinc-600/20 text-zinc-400",
32
+ info: "bg-indigo-500/15 text-indigo-400",
33
+ warn: "bg-amber-500/15 text-amber-400",
34
+ error: "bg-red-500/15 text-red-400",
35
35
  };
package/dist/types.d.ts CHANGED
@@ -5,12 +5,12 @@ export type InspectorEvent = {
5
5
  type: string;
6
6
  name: string;
7
7
  id: string | null;
8
- parentId: string | null;
9
- correlationId: string | null;
8
+ causationId: string | null;
9
+ workflowId: string | null;
10
10
  reactorId: string | null;
11
11
  aggregateType: string | null;
12
12
  aggregateId: string | null;
13
- streamVersion: number | null;
13
+ streamRevision: number | null;
14
14
  summary: string | null;
15
15
  payload: string;
16
16
  };
@@ -78,7 +78,7 @@ export type ReactorOutcome = {
78
78
  export type ReactorAttempt = {
79
79
  eventId: string;
80
80
  reactorId: string;
81
- correlationId: string;
81
+ workflowId: string;
82
82
  attempt: number;
83
83
  status: string;
84
84
  error: string | null;
@@ -111,29 +111,31 @@ export type AggregateLifecycleEntry = {
111
111
  eventId: string;
112
112
  eventType: string;
113
113
  ts: string;
114
- correlationId: string;
114
+ workflowId: string;
115
115
  aggregateKey: string;
116
116
  state: unknown;
117
117
  };
118
- export type CorrelationSummary = {
119
- correlationId: string;
118
+ export type WorkflowSummary = {
119
+ workflowId: string;
120
120
  eventCount: number;
121
121
  firstTs: string;
122
122
  lastTs: string;
123
123
  rootEventType: string;
124
124
  hasErrors: boolean;
125
125
  };
126
+ export type WorkflowSummaryPage = {
127
+ workflows: WorkflowSummary[];
128
+ nextCursor: string | null;
129
+ };
126
130
  export type FilterState = {
127
131
  search: string;
128
- correlationId: string | null;
132
+ workflowId: string | null;
129
133
  aggregateKey: string | null;
130
- from: string | null;
131
- to: string | null;
132
134
  };
133
135
  export type LogsFilter = {
134
- scope: "reactor" | "correlation";
136
+ scope: "reactor" | "workflow";
135
137
  reactorId: string | null;
136
- correlationId: string | null;
138
+ workflowId: string | null;
137
139
  };
138
140
  export type FlowSelection = {
139
141
  kind: "event-type";
@@ -148,3 +150,41 @@ export type FlowSelection = {
148
150
  * just stores and round-trips it.
149
151
  */
150
152
  export type PaneLayout = Record<string, unknown>;
153
+ /** Whether a subject-chain event came from the entity's own stream or a downstream descendant. */
154
+ export type SubjectChainSourceMode = "stream" | "descendant";
155
+ /** Query mode for subject_chain — which events to include. */
156
+ export type SubjectChainMode = "stream" | "descendants" | "both";
157
+ /** One event in a subject chain response, with display names applied. */
158
+ export type SubjectChainEvent = {
159
+ seq: number;
160
+ ts: string;
161
+ type: string;
162
+ name: string;
163
+ id: string | null;
164
+ causationId: string | null;
165
+ workflowId: string | null;
166
+ reactorId: string | null;
167
+ aggregateType: string | null;
168
+ aggregateId: string | null;
169
+ streamRevision: number | null;
170
+ summary: string | null;
171
+ payload: string;
172
+ sourceMode: SubjectChainSourceMode;
173
+ };
174
+ /** One `ctx.effect()` result for the effects inspector panel. */
175
+ export type InspectorEffect = {
176
+ consumer: string;
177
+ label: string;
178
+ value: unknown;
179
+ createdAt: string;
180
+ };
181
+ /** One entity entry from the aggregate keys listing. */
182
+ export type AggregateKeyEntry = {
183
+ aggregateId: string;
184
+ displayLabel: string | null;
185
+ };
186
+ /** Paginated entity listing response. */
187
+ export type AggregateKeysPage = {
188
+ entries: AggregateKeyEntry[];
189
+ nextCursor: string | null;
190
+ };
package/dist/utils.js CHANGED
@@ -9,7 +9,7 @@ export function inScrubberRange(seq, start, end) {
9
9
  /** Derive the walkable seq list based on current context (flow, selection, or global). */
10
10
  export function getScrubberSequence(state) {
11
11
  let events;
12
- if (state.flowCorrelationId) {
12
+ if (state.flowWorkflowId) {
13
13
  events = state.flowData;
14
14
  const sel = state.flowSelection;
15
15
  if (sel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "causal-inspector",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",