@runtypelabs/react-flow 1.0.7 → 1.0.10
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +39 -0
- package/example/CHANGELOG.md +29 -0
- package/example/package.json +1 -1
- package/example/src/App.tsx +59 -49
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,7 +7,7 @@ $ tsup
|
|
|
7
7
|
[34mCLI[39m Cleaning output folder
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m101.48 KB[39m
|
|
11
|
-
[32mESM[39m ⚡️ Build success in 285ms
|
|
12
10
|
[32mCJS[39m [1mdist/index.js [22m[32m105.53 KB[39m
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m ⚡️ Build success in 351ms
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m101.48 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 350ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @runtypelabs/react-flow
|
|
2
2
|
|
|
3
|
+
## 1.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 20737ee: Make the 33-event `ExecutionStreamEvent` vocabulary the platform's only public
|
|
8
|
+
execution stream. Remove request-, Persona-version-, and Flagship-based wire
|
|
9
|
+
format negotiation; translate API-owned engine frames unconditionally; expose
|
|
10
|
+
unified events in non-streaming JSON responses; and remove the public
|
|
11
|
+
`FlowSSEEvent` OpenAPI component.
|
|
12
|
+
|
|
13
|
+
Update the TypeScript and Python SDKs, dashboard, examples, smoke tests, and
|
|
14
|
+
internal tools to consume unified streams. The TypeScript SDK keeps its stable
|
|
15
|
+
flow and agent callback presentation shapes by translating the unified wire
|
|
16
|
+
client-side, while obsolete stream-format helper calls are source-compatible
|
|
17
|
+
no-ops. Preserve external-agent resume handles and flow completion counts on
|
|
18
|
+
the unified contract.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [401acbd]
|
|
21
|
+
- Updated dependencies [cb8cb9e]
|
|
22
|
+
- Updated dependencies [7f77e9f]
|
|
23
|
+
- Updated dependencies [20737ee]
|
|
24
|
+
- @runtypelabs/sdk@6.3.0
|
|
25
|
+
|
|
26
|
+
## 1.0.9
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [68a503e]
|
|
31
|
+
- @runtypelabs/sdk@6.2.1
|
|
32
|
+
|
|
33
|
+
## 1.0.8
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [b967727]
|
|
38
|
+
- Updated dependencies [2c8cf42]
|
|
39
|
+
- Updated dependencies [2c8cf42]
|
|
40
|
+
- @runtypelabs/sdk@6.2.0
|
|
41
|
+
|
|
3
42
|
## 1.0.7
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
package/example/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @runtypelabs/react-flow-example
|
|
2
2
|
|
|
3
|
+
## 0.0.136
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [401acbd]
|
|
8
|
+
- Updated dependencies [cb8cb9e]
|
|
9
|
+
- Updated dependencies [7f77e9f]
|
|
10
|
+
- Updated dependencies [20737ee]
|
|
11
|
+
- @runtypelabs/sdk@6.3.0
|
|
12
|
+
- @runtypelabs/react-flow@1.0.10
|
|
13
|
+
|
|
14
|
+
## 0.0.135
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [68a503e]
|
|
19
|
+
- @runtypelabs/sdk@6.2.1
|
|
20
|
+
- @runtypelabs/react-flow@1.0.9
|
|
21
|
+
|
|
22
|
+
## 0.0.134
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [b967727]
|
|
27
|
+
- Updated dependencies [2c8cf42]
|
|
28
|
+
- Updated dependencies [2c8cf42]
|
|
29
|
+
- @runtypelabs/sdk@6.2.0
|
|
30
|
+
- @runtypelabs/react-flow@1.0.8
|
|
31
|
+
|
|
3
32
|
## 0.0.133
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/example/package.json
CHANGED
package/example/src/App.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useCallback, useMemo } from 'react'
|
|
1
|
+
import React, { useState, useCallback, useMemo, useRef } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
ReactFlow,
|
|
4
4
|
Controls,
|
|
@@ -73,21 +73,23 @@ interface StepProgress {
|
|
|
73
73
|
executionTime?: number
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
interface
|
|
76
|
+
interface ExecutionSSEEvent {
|
|
77
77
|
type: string
|
|
78
|
+
kind?: 'agent' | 'flow'
|
|
78
79
|
flowId?: string
|
|
80
|
+
flowName?: string
|
|
79
81
|
totalSteps?: number
|
|
80
82
|
index?: number
|
|
81
83
|
id?: string
|
|
84
|
+
stepId?: string
|
|
82
85
|
name?: string
|
|
86
|
+
delta?: string
|
|
83
87
|
text?: string
|
|
84
88
|
content?: string
|
|
85
|
-
output?: { message?: string; [key: string]: unknown }
|
|
86
89
|
result?: unknown
|
|
87
|
-
|
|
88
|
-
error?: string
|
|
90
|
+
durationMs?: number
|
|
91
|
+
error?: string | { message?: string }
|
|
89
92
|
success?: boolean
|
|
90
|
-
duration?: number
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
interface FlowProgress {
|
|
@@ -801,6 +803,8 @@ export default function App() {
|
|
|
801
803
|
const [flowProgress, setFlowProgress] = useState<FlowProgress | null>(null)
|
|
802
804
|
const [flowName, setFlowName] = useState('User Analysis Flow')
|
|
803
805
|
const [loadedFlowId, setLoadedFlowId] = useState<string | null>(null)
|
|
806
|
+
const textBlockStepIds = useRef(new Map<string, string>())
|
|
807
|
+
const currentStepId = useRef<string | null>(null)
|
|
804
808
|
|
|
805
809
|
// Create stable references for handlers that will update nodes
|
|
806
810
|
const [nodes, setNodes, onNodesChange] = useNodesState<RuntypeNode>([])
|
|
@@ -945,6 +949,8 @@ export default function App() {
|
|
|
945
949
|
// Execute flow via Runtype API
|
|
946
950
|
const executeFlow = useCallback(async () => {
|
|
947
951
|
setIsRunning(true)
|
|
952
|
+
textBlockStepIds.current.clear()
|
|
953
|
+
currentStepId.current = null
|
|
948
954
|
setFlowProgress({
|
|
949
955
|
flowId: '',
|
|
950
956
|
flowName: flowName,
|
|
@@ -1061,17 +1067,20 @@ export default function App() {
|
|
|
1061
1067
|
}, [currentSteps, flowName])
|
|
1062
1068
|
|
|
1063
1069
|
// Handle SSE events from the streaming response
|
|
1064
|
-
const handleSSEEvent = useCallback((data:
|
|
1070
|
+
const handleSSEEvent = useCallback((data: ExecutionSSEEvent) => {
|
|
1065
1071
|
switch (data.type) {
|
|
1066
|
-
case '
|
|
1072
|
+
case 'execution_start':
|
|
1073
|
+
if (data.kind !== 'flow') break
|
|
1067
1074
|
setFlowProgress((prev) => ({
|
|
1068
1075
|
...prev!,
|
|
1069
1076
|
flowId: data.flowId || '',
|
|
1077
|
+
flowName: data.flowName || prev?.flowName || '',
|
|
1070
1078
|
totalSteps: data.totalSteps || prev?.totalSteps || 0,
|
|
1071
1079
|
}))
|
|
1072
1080
|
break
|
|
1073
1081
|
|
|
1074
1082
|
case 'step_start':
|
|
1083
|
+
currentStepId.current = data.id || null
|
|
1075
1084
|
setFlowProgress((prev) => {
|
|
1076
1085
|
if (!prev) return null
|
|
1077
1086
|
const stepIndex = data.index !== undefined ? data.index : prev.steps.length
|
|
@@ -1107,23 +1116,31 @@ export default function App() {
|
|
|
1107
1116
|
})
|
|
1108
1117
|
break
|
|
1109
1118
|
|
|
1110
|
-
case '
|
|
1119
|
+
case 'text_start':
|
|
1120
|
+
if (data.id) {
|
|
1121
|
+
const stepId = data.stepId || currentStepId.current
|
|
1122
|
+
if (stepId) textBlockStepIds.current.set(data.id, stepId)
|
|
1123
|
+
}
|
|
1124
|
+
break
|
|
1125
|
+
|
|
1126
|
+
case 'text_delta':
|
|
1111
1127
|
setFlowProgress((prev) => {
|
|
1112
1128
|
if (!prev) return null
|
|
1113
|
-
const
|
|
1129
|
+
const stepId = data.id ? textBlockStepIds.current.get(data.id) : undefined
|
|
1130
|
+
if (!stepId) return prev
|
|
1131
|
+
const stepIndex = prev.steps.findIndex((s) => s.id === stepId)
|
|
1114
1132
|
|
|
1115
1133
|
if (stepIndex < 0) {
|
|
1116
|
-
const chunkStepIndex = data.index !== undefined ? data.index : prev.steps.length
|
|
1117
1134
|
return {
|
|
1118
1135
|
...prev,
|
|
1119
1136
|
steps: [
|
|
1120
1137
|
...prev.steps,
|
|
1121
1138
|
{
|
|
1122
|
-
id:
|
|
1123
|
-
name:
|
|
1124
|
-
index:
|
|
1139
|
+
id: stepId,
|
|
1140
|
+
name: '',
|
|
1141
|
+
index: prev.steps.length,
|
|
1125
1142
|
status: 'running',
|
|
1126
|
-
streamingText: data.
|
|
1143
|
+
streamingText: data.delta || '',
|
|
1127
1144
|
},
|
|
1128
1145
|
].sort((a, b) => a.index - b.index),
|
|
1129
1146
|
}
|
|
@@ -1133,13 +1150,14 @@ export default function App() {
|
|
|
1133
1150
|
newSteps[stepIndex] = {
|
|
1134
1151
|
...newSteps[stepIndex],
|
|
1135
1152
|
streamingText:
|
|
1136
|
-
(newSteps[stepIndex].streamingText || '') + (data.
|
|
1153
|
+
(newSteps[stepIndex].streamingText || '') + (data.delta || ''),
|
|
1137
1154
|
}
|
|
1138
1155
|
return { ...prev, steps: newSteps }
|
|
1139
1156
|
})
|
|
1140
1157
|
break
|
|
1141
1158
|
|
|
1142
1159
|
case 'step_complete':
|
|
1160
|
+
if (currentStepId.current === data.id) currentStepId.current = null
|
|
1143
1161
|
setFlowProgress((prev) => {
|
|
1144
1162
|
if (!prev) return null
|
|
1145
1163
|
const stepIndex = prev.steps.findIndex((s) => s.id === data.id)
|
|
@@ -1147,63 +1165,55 @@ export default function App() {
|
|
|
1147
1165
|
const newSteps = [...prev.steps]
|
|
1148
1166
|
const step = newSteps[stepIndex]
|
|
1149
1167
|
|
|
1150
|
-
let finalText = step.streamingText
|
|
1151
|
-
if (!finalText && data.output?.message) {
|
|
1152
|
-
finalText = data.output.message
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
1168
|
newSteps[stepIndex] = {
|
|
1156
1169
|
...step,
|
|
1157
|
-
status: 'completed',
|
|
1158
|
-
result: data.result
|
|
1159
|
-
|
|
1160
|
-
|
|
1170
|
+
status: data.success === false ? 'failed' : 'completed',
|
|
1171
|
+
result: data.result,
|
|
1172
|
+
error:
|
|
1173
|
+
typeof data.error === 'string'
|
|
1174
|
+
? data.error
|
|
1175
|
+
: data.error?.message,
|
|
1176
|
+
executionTime: data.durationMs,
|
|
1161
1177
|
}
|
|
1162
1178
|
|
|
1163
1179
|
return {
|
|
1164
1180
|
...prev,
|
|
1165
1181
|
steps: newSteps.sort((a, b) => a.index - b.index),
|
|
1182
|
+
isError: prev.isError || data.success === false,
|
|
1166
1183
|
}
|
|
1167
1184
|
}
|
|
1168
1185
|
return prev
|
|
1169
1186
|
})
|
|
1170
1187
|
break
|
|
1171
1188
|
|
|
1172
|
-
case '
|
|
1173
|
-
|
|
1174
|
-
if (!prev) return null
|
|
1175
|
-
const stepIndex = prev.steps.findIndex((s) => s.id === data.id)
|
|
1176
|
-
if (stepIndex >= 0) {
|
|
1177
|
-
const newSteps = [...prev.steps]
|
|
1178
|
-
newSteps[stepIndex] = {
|
|
1179
|
-
...newSteps[stepIndex],
|
|
1180
|
-
status: 'failed',
|
|
1181
|
-
error: data.error,
|
|
1182
|
-
executionTime: data.executionTime,
|
|
1183
|
-
}
|
|
1184
|
-
return {
|
|
1185
|
-
...prev,
|
|
1186
|
-
steps: newSteps.sort((a, b) => a.index - b.index),
|
|
1187
|
-
isError: true,
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
return prev
|
|
1191
|
-
})
|
|
1192
|
-
break
|
|
1193
|
-
|
|
1194
|
-
case 'flow_complete':
|
|
1189
|
+
case 'execution_complete':
|
|
1190
|
+
if (data.kind !== 'flow') break
|
|
1195
1191
|
setFlowProgress((prev) => {
|
|
1196
1192
|
if (!prev) return null
|
|
1197
1193
|
return {
|
|
1198
1194
|
...prev,
|
|
1199
1195
|
isComplete: true,
|
|
1200
1196
|
isError: !data.success,
|
|
1201
|
-
executionTime: data.
|
|
1197
|
+
executionTime: data.durationMs,
|
|
1202
1198
|
}
|
|
1203
1199
|
})
|
|
1204
1200
|
setIsRunning(false)
|
|
1205
1201
|
break
|
|
1206
1202
|
|
|
1203
|
+
case 'execution_error':
|
|
1204
|
+
if (data.kind !== 'flow') break
|
|
1205
|
+
setFlowProgress((prev) =>
|
|
1206
|
+
prev
|
|
1207
|
+
? {
|
|
1208
|
+
...prev,
|
|
1209
|
+
isComplete: true,
|
|
1210
|
+
isError: true,
|
|
1211
|
+
}
|
|
1212
|
+
: null
|
|
1213
|
+
)
|
|
1214
|
+
setIsRunning(false)
|
|
1215
|
+
break
|
|
1216
|
+
|
|
1207
1217
|
default:
|
|
1208
1218
|
break
|
|
1209
1219
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/react-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "React Flow adapter for building visual flow editors with Runtype",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"*.css"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@runtypelabs/sdk": "6.
|
|
19
|
+
"@runtypelabs/sdk": "6.3.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@xyflow/react": "^12.0.0",
|