Skip to content

Commit 7d741be

Browse files
committed
feat(workflow): add workflow history inspector integration
1 parent a84a7c8 commit 7d741be

File tree

25 files changed

+1272
-481
lines changed

25 files changed

+1272
-481
lines changed

pnpm-lock.yaml

Lines changed: 146 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rivetkit-typescript/packages/rivetkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
],
174174
"scripts": {
175175
"build": "tsup src/mod.ts src/client/mod.ts src/common/log.ts src/common/websocket.ts src/actor/errors.ts src/topologies/coordinate/mod.ts src/topologies/partition/mod.ts src/utils.ts src/driver-helpers/mod.ts src/driver-test-suite/mod.ts src/serve-test-suite/mod.ts src/test/mod.ts src/inspector/mod.ts src/workflow/mod.ts",
176-
"build:schema": "./scripts/compile-bare.ts compile schemas/client-protocol/v1.bare -o dist/schemas/client-protocol/v1.ts && ./scripts/compile-bare.ts compile schemas/client-protocol/v2.bare -o dist/schemas/client-protocol/v2.ts && ./scripts/compile-bare.ts compile schemas/client-protocol/v3.bare -o dist/schemas/client-protocol/v3.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v1.bare -o dist/schemas/file-system-driver/v1.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v2.bare -o dist/schemas/file-system-driver/v2.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v3.bare -o dist/schemas/file-system-driver/v3.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v1.bare -o dist/schemas/actor-persist/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v2.bare -o dist/schemas/actor-persist/v2.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v3.bare -o dist/schemas/actor-persist/v3.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v4.bare -o dist/schemas/actor-persist/v4.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v1.bare -o dist/schemas/actor-inspector/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v2.bare -o dist/schemas/actor-inspector/v2.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v3.bare -o dist/schemas/actor-inspector/v3.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v4.bare -o dist/schemas/actor-inspector/v4.ts"
176+
"build:schema": "./scripts/compile-bare.ts compile schemas/client-protocol/v1.bare -o dist/schemas/client-protocol/v1.ts && ./scripts/compile-bare.ts compile schemas/client-protocol/v2.bare -o dist/schemas/client-protocol/v2.ts && ./scripts/compile-bare.ts compile schemas/client-protocol/v3.bare -o dist/schemas/client-protocol/v3.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v1.bare -o dist/schemas/file-system-driver/v1.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v2.bare -o dist/schemas/file-system-driver/v2.ts && ./scripts/compile-bare.ts compile schemas/file-system-driver/v3.bare -o dist/schemas/file-system-driver/v3.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v1.bare -o dist/schemas/actor-persist/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v2.bare -o dist/schemas/actor-persist/v2.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v3.bare -o dist/schemas/actor-persist/v3.ts && ./scripts/compile-bare.ts compile schemas/actor-persist/v4.bare -o dist/schemas/actor-persist/v4.ts && ./scripts/compile-bare.ts compile schemas/persist/v1.bare -o dist/schemas/persist/v1.ts && ./scripts/compile-bare.ts compile schemas/transport/v1.bare -o dist/schemas/transport/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v1.bare -o dist/schemas/actor-inspector/v1.ts && ./scripts/compile-bare.ts compile schemas/actor-inspector/v2.bare -o dist/schemas/actor-inspector/v2.ts",
177177
"check-types": "tsc --noEmit",
178178
"lint": "biome check .",
179179
"lint:fix": "biome check --write .",

rivetkit-typescript/packages/rivetkit/schemas/actor-inspector/v2.bare

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MARK: Message To Server
22

33
type PatchStateRequest struct {
4-
state: data
4+
state: data
55
}
66

77
type ActionRequest struct {
@@ -18,15 +18,23 @@ type ConnectionsRequest struct {
1818
id: uint
1919
}
2020

21-
type EventsRequest struct {
21+
type RpcsListRequest struct {
2222
id: uint
2323
}
2424

25-
type ClearEventsRequest struct {
25+
type TraceQueryRequest struct {
2626
id: uint
27+
startMs: uint
28+
endMs: uint
29+
limit: uint
2730
}
2831

29-
type RpcsListRequest struct {
32+
type QueueRequest struct {
33+
id: uint
34+
limit: uint
35+
}
36+
37+
type WorkflowHistoryRequest struct {
3038
id: uint
3139
}
3240

@@ -35,9 +43,10 @@ type ToServerBody union {
3543
StateRequest |
3644
ConnectionsRequest |
3745
ActionRequest |
38-
EventsRequest |
39-
ClearEventsRequest |
40-
RpcsListRequest
46+
RpcsListRequest |
47+
TraceQueryRequest |
48+
QueueRequest |
49+
WorkflowHistoryRequest
4150
}
4251

4352
type ToServer struct {
@@ -53,55 +62,18 @@ type Connection struct {
5362
details: data
5463
}
5564

56-
type ActionEvent struct {
57-
name: str
58-
args: data
59-
connId: str
60-
}
61-
62-
type BroadcastEvent struct {
63-
eventName: str
64-
args: data
65-
}
66-
67-
type SubscribeEvent struct {
68-
eventName: str
69-
connId: str
70-
}
71-
72-
type UnSubscribeEvent struct {
73-
eventName: str
74-
connId: str
75-
}
76-
77-
type FiredEvent struct {
78-
eventName: str
79-
args: data
80-
connId: str
81-
}
82-
83-
type EventBody union {
84-
ActionEvent |
85-
BroadcastEvent |
86-
SubscribeEvent |
87-
UnSubscribeEvent |
88-
FiredEvent
89-
}
90-
91-
type Event struct {
92-
id: str
93-
timestamp: uint
94-
body: EventBody
95-
}
65+
# Workflow history is encoded using schemas/transport.
66+
type WorkflowHistory data
9667

9768
type Init struct {
9869
connections: list<Connection>
99-
events: list<Event>
10070
state: optional<State>
10171
isStateEnabled: bool
10272
rpcs: list<str>
10373
isDatabaseEnabled: bool
10474
queueSize: uint
75+
workflowHistory: optional<WorkflowHistory>
76+
isWorkflowEnabled: bool
10577
}
10678

10779
type ConnectionsResponse struct {
@@ -115,28 +87,52 @@ type StateResponse struct {
11587
isStateEnabled: bool
11688
}
11789

118-
type EventsResponse struct {
90+
type ActionResponse struct {
11991
rid: uint
120-
events: list<Event>
92+
output: data
12193
}
12294

123-
type ActionResponse struct {
95+
type TraceQueryResponse struct {
12496
rid: uint
125-
output: data
97+
payload: data
12698
}
12799

128-
type StateUpdated struct {
129-
state: State
100+
type QueueMessageSummary struct {
101+
id: uint
102+
name: str
103+
createdAtMs: uint
104+
}
105+
106+
type QueueStatus struct {
107+
size: uint
108+
maxSize: uint
109+
messages: list<QueueMessageSummary>
110+
truncated: bool
130111
}
131112

132-
type EventsUpdated struct {
133-
events: list<Event>
113+
type QueueResponse struct {
114+
rid: uint
115+
status: QueueStatus
116+
}
117+
118+
type WorkflowHistoryResponse struct {
119+
rid: uint
120+
history: optional<WorkflowHistory>
121+
isWorkflowEnabled: bool
122+
}
123+
124+
type StateUpdated struct {
125+
state: State
134126
}
135127

136128
type QueueUpdated struct {
137129
queueSize: uint
138130
}
139131

132+
type WorkflowHistoryUpdated struct {
133+
history: WorkflowHistory
134+
}
135+
140136
type RpcsListResponse struct {
141137
rid: uint
142138
rpcs: list<str>
@@ -145,20 +141,23 @@ type RpcsListResponse struct {
145141
type ConnectionsUpdated struct {
146142
connections: list<Connection>
147143
}
144+
148145
type Error struct {
149146
message: str
150147
}
151148

152149
type ToClientBody union {
153150
StateResponse |
154151
ConnectionsResponse |
155-
EventsResponse |
156152
ActionResponse |
157153
ConnectionsUpdated |
158-
EventsUpdated |
159154
QueueUpdated |
160155
StateUpdated |
156+
WorkflowHistoryUpdated |
161157
RpcsListResponse |
158+
TraceQueryResponse |
159+
QueueResponse |
160+
WorkflowHistoryResponse |
162161
Error |
163162
Init
164163
}

0 commit comments

Comments
 (0)