@runtypelabs/react-flow 1.0.8 → 1.0.11

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.
@@ -7,7 +7,7 @@ $ tsup
7
7
  CLI Cleaning output folder
8
8
  CJS Build start
9
9
  ESM Build start
10
- ESM dist/index.mjs 101.48 KB
11
- ESM ⚡️ Build success in 313ms
12
10
  CJS dist/index.js 105.53 KB
13
- CJS ⚡️ Build success in 313ms
11
+ CJS ⚡️ Build success in 400ms
12
+ ESM dist/index.mjs 101.48 KB
13
+ ESM ⚡️ Build success in 588ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @runtypelabs/react-flow
2
2
 
3
+ ## 1.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d547ab3]
8
+ - Updated dependencies [c065bb9]
9
+ - @runtypelabs/sdk@6.3.1
10
+
11
+ ## 1.0.10
12
+
13
+ ### Patch Changes
14
+
15
+ - 20737ee: Make the 33-event `ExecutionStreamEvent` vocabulary the platform's only public
16
+ execution stream. Remove request-, Persona-version-, and Flagship-based wire
17
+ format negotiation; translate API-owned engine frames unconditionally; expose
18
+ unified events in non-streaming JSON responses; and remove the public
19
+ `FlowSSEEvent` OpenAPI component.
20
+
21
+ Update the TypeScript and Python SDKs, dashboard, examples, smoke tests, and
22
+ internal tools to consume unified streams. The TypeScript SDK keeps its stable
23
+ flow and agent callback presentation shapes by translating the unified wire
24
+ client-side, while obsolete stream-format helper calls are source-compatible
25
+ no-ops. Preserve external-agent resume handles and flow completion counts on
26
+ the unified contract.
27
+
28
+ - Updated dependencies [401acbd]
29
+ - Updated dependencies [cb8cb9e]
30
+ - Updated dependencies [7f77e9f]
31
+ - Updated dependencies [20737ee]
32
+ - @runtypelabs/sdk@6.3.0
33
+
34
+ ## 1.0.9
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [68a503e]
39
+ - @runtypelabs/sdk@6.2.1
40
+
3
41
  ## 1.0.8
4
42
 
5
43
  ### Patch Changes
@@ -1,5 +1,33 @@
1
1
  # @runtypelabs/react-flow-example
2
2
 
3
+ ## 0.0.137
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d547ab3]
8
+ - Updated dependencies [c065bb9]
9
+ - @runtypelabs/sdk@6.3.1
10
+ - @runtypelabs/react-flow@1.0.11
11
+
12
+ ## 0.0.136
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [401acbd]
17
+ - Updated dependencies [cb8cb9e]
18
+ - Updated dependencies [7f77e9f]
19
+ - Updated dependencies [20737ee]
20
+ - @runtypelabs/sdk@6.3.0
21
+ - @runtypelabs/react-flow@1.0.10
22
+
23
+ ## 0.0.135
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [68a503e]
28
+ - @runtypelabs/sdk@6.2.1
29
+ - @runtypelabs/react-flow@1.0.9
30
+
3
31
  ## 0.0.134
4
32
 
5
33
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/react-flow-example",
3
- "version": "0.0.134",
3
+ "version": "0.0.137",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -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 FlowSSEEvent {
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
- executionTime?: number
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: FlowSSEEvent) => {
1070
+ const handleSSEEvent = useCallback((data: ExecutionSSEEvent) => {
1065
1071
  switch (data.type) {
1066
- case 'flow_start':
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 'step_delta':
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 stepIndex = prev.steps.findIndex((s) => s.id === data.id)
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: data.id,
1123
- name: data.name || '',
1124
- index: chunkStepIndex,
1139
+ id: stepId,
1140
+ name: '',
1141
+ index: prev.steps.length,
1125
1142
  status: 'running',
1126
- streamingText: data.text || data.content || '',
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.text || data.content || ''),
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 || data.output,
1159
- streamingText: finalText,
1160
- executionTime: data.executionTime,
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 'step_error':
1173
- setFlowProgress((prev) => {
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.executionTime || data.duration,
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.8",
3
+ "version": "1.0.11",
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.2.0"
19
+ "@runtypelabs/sdk": "6.3.1"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@xyflow/react": "^12.0.0",