causal-inspector 0.1.5 → 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.
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
@@ -172,3 +172,93 @@ export const INSPECTOR_REACTOR_OUTCOMES = `
172
172
  }
173
173
  }
174
174
  `;
175
+ export const INSPECTOR_REACTOR_ATTEMPTS = `
176
+ query InspectorReactorAttempts($workflowId: String!) {
177
+ inspectorReactorAttempts(workflowId: $workflowId) {
178
+ eventId
179
+ reactorId
180
+ workflowId
181
+ attempt
182
+ status
183
+ error
184
+ startedAt
185
+ completedAt
186
+ }
187
+ }
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,35 +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;
125
+ break;
126
+ }
127
+ case "events/attempts_loaded": {
128
+ const { workflowId, attempts } = event.payload;
129
+ draft.attempts[workflowId] = attempts;
110
130
  break;
111
131
  }
112
- case "events/correlations_loaded": {
113
- const { correlations, hasMore, append } = event.payload;
132
+ case "events/workflows_loaded": {
133
+ const { workflows, hasMore, append } = event.payload;
114
134
  if (append) {
115
- draft.correlations.push(...correlations);
135
+ draft.workflows.push(...workflows);
116
136
  }
117
137
  else {
118
- draft.correlations = correlations;
138
+ draft.workflows = workflows;
119
139
  }
120
- draft.correlationsHasMore = hasMore;
121
- draft.correlationsLoading = false;
140
+ draft.workflowsHasMore = hasMore;
141
+ draft.workflowsLoading = false;
122
142
  break;
123
143
  }
124
144
  case "events/reactor_dependencies_loaded":
@@ -133,17 +153,23 @@ export const reducer = (draft, event) => {
133
153
  break;
134
154
  // ── Navigation (user facts + browser popstate) ──
135
155
  case "ui/flow_opened":
136
- applyNavigation(draft, event.payload.correlationId, null);
156
+ applyNavigation(draft, event.payload.workflowId, null);
137
157
  break;
138
158
  case "ui/flow_closed":
139
159
  applyNavigation(draft, null, null);
140
160
  break;
141
161
  case "ui/handler_selected":
142
- applyNavigation(draft, draft.flowCorrelationId, event.payload.reactorId);
162
+ applyNavigation(draft, draft.flowWorkflowId, event.payload.reactorId);
143
163
  break;
144
164
  case "location/changed":
145
- applyNavigation(draft, event.payload.correlationId, event.payload.handler);
146
- 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
+ }
147
173
  break;
148
174
  // ── UI ──
149
175
  case "ui/event_selected":
@@ -158,9 +184,9 @@ export const reducer = (draft, event) => {
158
184
  // Clear reactor filter when deselecting a node
159
185
  if (event.payload == null && draft.logsFilter.reactorId != null) {
160
186
  draft.logsFilter = {
161
- scope: "correlation",
187
+ scope: "workflow",
162
188
  reactorId: null,
163
- correlationId: draft.flowCorrelationId,
189
+ workflowId: draft.flowWorkflowId,
164
190
  };
165
191
  }
166
192
  break;
@@ -185,11 +211,51 @@ export const reducer = (draft, event) => {
185
211
  case "ui/scrubber_speed_changed":
186
212
  draft.scrubberSpeed = event.payload.speed;
187
213
  break;
188
- case "ui/correlations_requested":
189
- 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;
190
232
  break;
191
- case "ui/load_more_correlations_requested":
192
- draft.correlationsLoading = true;
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
+ }
238
+ break;
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;
193
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);
258
+ break;
259
+ }
194
260
  }
195
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, 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;
@@ -22,14 +22,25 @@ export type InspectorState = {
22
22
  descriptionSnapshots: Record<string, ReactorDescriptionSnapshot[]>;
23
23
  aggregateTimeline: Record<string, AggregateTimelineEntry[]>;
24
24
  outcomes: Record<string, ReactorOutcome[]>;
25
- correlations: CorrelationSummary[];
26
- correlationsLoading: boolean;
27
- correlationsHasMore: boolean;
25
+ attempts: Record<string, ReactorAttempt[]>;
26
+ workflows: WorkflowSummary[];
27
+ workflowsLoading: boolean;
28
+ workflowsHasMore: boolean;
28
29
  reactorDependencies: ReactorDependency[];
29
30
  aggregateKeys: string[];
30
31
  aggregateLifecycle: AggregateLifecycleEntry[];
31
32
  aggregateLifecycleKey: string | null;
32
33
  subscription: "connected" | "disconnected" | "error";
33
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[];
34
45
  };
35
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,26 +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
18
  },
19
19
  logs: [],
20
20
  logsFilter: {
21
21
  scope: "reactor",
22
22
  reactorId: null,
23
- correlationId: null,
23
+ workflowId: null,
24
24
  },
25
25
  descriptions: {},
26
26
  descriptionSnapshots: {},
27
27
  aggregateTimeline: {},
28
28
  outcomes: {},
29
- correlations: [],
30
- correlationsLoading: false,
31
- correlationsHasMore: true,
29
+ attempts: {},
30
+ workflows: [],
31
+ workflowsLoading: false,
32
+ workflowsHasMore: true,
32
33
  reactorDependencies: [],
33
34
  aggregateKeys: [],
34
35
  aggregateLifecycle: [],
35
36
  aggregateLifecycleKey: null,
36
37
  subscription: "disconnected",
37
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: [],
38
49
  };
package/dist/theme.js CHANGED
@@ -31,4 +31,5 @@ export const LOG_LEVEL_COLORS = {
31
31
  debug: "bg-zinc-600/20 text-zinc-400",
32
32
  info: "bg-indigo-500/15 text-indigo-400",
33
33
  warn: "bg-amber-500/15 text-amber-400",
34
+ error: "bg-red-500/15 text-red-400",
34
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
  };
@@ -75,6 +75,16 @@ export type ReactorOutcome = {
75
75
  completedAt: string | null;
76
76
  triggeringEventIds: string[];
77
77
  };
78
+ export type ReactorAttempt = {
79
+ eventId: string;
80
+ reactorId: string;
81
+ workflowId: string;
82
+ attempt: number;
83
+ status: string;
84
+ error: string | null;
85
+ startedAt: string;
86
+ completedAt: string;
87
+ };
78
88
  export type ReactorDescriptionSnapshot = {
79
89
  seq: number;
80
90
  eventId: string;
@@ -101,31 +111,31 @@ export type AggregateLifecycleEntry = {
101
111
  eventId: string;
102
112
  eventType: string;
103
113
  ts: string;
104
- correlationId: string;
114
+ workflowId: string;
105
115
  aggregateKey: string;
106
116
  state: unknown;
107
117
  };
108
- export type CorrelationSummary = {
109
- correlationId: string;
118
+ export type WorkflowSummary = {
119
+ workflowId: string;
110
120
  eventCount: number;
111
121
  firstTs: string;
112
122
  lastTs: string;
113
123
  rootEventType: string;
114
124
  hasErrors: boolean;
115
125
  };
116
- export type CorrelationSummaryPage = {
117
- correlations: CorrelationSummary[];
126
+ export type WorkflowSummaryPage = {
127
+ workflows: WorkflowSummary[];
118
128
  nextCursor: string | null;
119
129
  };
120
130
  export type FilterState = {
121
131
  search: string;
122
- correlationId: string | null;
132
+ workflowId: string | null;
123
133
  aggregateKey: string | null;
124
134
  };
125
135
  export type LogsFilter = {
126
- scope: "reactor" | "correlation";
136
+ scope: "reactor" | "workflow";
127
137
  reactorId: string | null;
128
- correlationId: string | null;
138
+ workflowId: string | null;
129
139
  };
130
140
  export type FlowSelection = {
131
141
  kind: "event-type";
@@ -140,3 +150,41 @@ export type FlowSelection = {
140
150
  * just stores and round-trips it.
141
151
  */
142
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.5",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",