@kortyx/react 0.4.1 → 0.5.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/CHANGELOG.md +37 -0
- package/LICENSE +51 -43
- package/dist/index.d.ts +166 -1
- package/dist/index.js +732 -39
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @kortyx/react
|
|
2
2
|
|
|
3
|
+
## [0.5.0](https://github.com/kortyx-io/kortyx/compare/react-v0.4.3...react-v0.5.0) (2026-09-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **errors:** public failure messages and default HTTP statuses change; malformed streams fail explicitly, provider error classes are shared, and retry helpers exclude control flow. Existing calls and legacy records remain supported. See the error-contract migration and release notes.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **errors:** harden failure contracts across execution and recovery ([#175](https://github.com/kortyx-io/kortyx/issues/175)) ([d231e36](https://github.com/kortyx-io/kortyx/commit/d231e364259a4f23fc3675d8783fde5ba338416e))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
|
|
17
|
+
* The following workspace dependencies were updated
|
|
18
|
+
* dependencies
|
|
19
|
+
* @kortyx/stream bumped to 0.12.0
|
|
20
|
+
* @kortyx/core bumped to 0.9.0
|
|
21
|
+
|
|
22
|
+
## [0.4.3](https://github.com/kortyx-io/kortyx/compare/react-v0.4.2...react-v0.4.3) (2026-09-10)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @kortyx/stream bumped to 0.11.0
|
|
30
|
+
|
|
31
|
+
## [0.4.2](https://github.com/kortyx-io/kortyx/compare/react-v0.4.1...react-v0.4.2) (2026-09-10)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Dependencies
|
|
35
|
+
|
|
36
|
+
* The following workspace dependencies were updated
|
|
37
|
+
* dependencies
|
|
38
|
+
* @kortyx/stream bumped to 0.10.0
|
|
39
|
+
|
|
3
40
|
## [0.4.1](https://github.com/kortyx-io/kortyx/compare/react-v0.4.0...react-v0.4.1) (2026-06-03)
|
|
4
41
|
|
|
5
42
|
|
package/LICENSE
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
Copyright 2026 Kortyx contributors
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
- All content that resides under the `apps/studio/` directory of this repository is licensed under the license defined in `apps/studio/LICENSE.md`.
|
|
6
|
+
- All content that resides under a `plugins/*/` directory of this repository is licensed under the license defined in that plugin's `LICENSE.md`.
|
|
7
|
+
- All third party components incorporated into the Kortyx software are licensed under the original license provided by the owner of the applicable component.
|
|
8
|
+
- Content outside of the above mentioned directories or restrictions is available under the Apache License, Version 2.0, as defined below.
|
|
9
|
+
|
|
1
10
|
Apache License
|
|
2
11
|
Version 2.0, January 2004
|
|
3
12
|
http://www.apache.org/licenses/
|
|
4
13
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
14
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
15
|
+
1. Definitions.
|
|
8
16
|
|
|
9
17
|
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
18
|
and distribution as defined by Sections 1 through 9 of this document.
|
|
@@ -63,14 +71,14 @@
|
|
|
63
71
|
on behalf of whom a Contribution has been received by Licensor and
|
|
64
72
|
subsequently incorporated within the Work.
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
75
|
this License, each Contributor hereby grants to You a perpetual,
|
|
68
76
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
77
|
copyright license to reproduce, prepare Derivative Works of,
|
|
70
78
|
publicly display, publicly perform, sublicense, and distribute the
|
|
71
79
|
Work and such Derivative Works in Source or Object form.
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
82
|
this License, each Contributor hereby grants to You a perpetual,
|
|
75
83
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
84
|
(except as stated in this section) patent license to make, have made,
|
|
@@ -86,39 +94,39 @@
|
|
|
86
94
|
granted to You under this License for that Work shall terminate
|
|
87
95
|
as of the date such litigation is filed.
|
|
88
96
|
|
|
89
|
-
|
|
97
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
98
|
Work or Derivative Works thereof in any medium, with or without
|
|
91
99
|
modifications, and in Source or Object form, provided that You
|
|
92
100
|
meet the following conditions:
|
|
93
101
|
|
|
94
102
|
(a) You must give any other recipients of the Work or
|
|
95
|
-
|
|
103
|
+
Derivative Works a copy of this License; and
|
|
96
104
|
|
|
97
105
|
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
|
|
106
|
+
stating that You changed the files; and
|
|
99
107
|
|
|
100
108
|
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
that You distribute, all copyright, patent, trademark, and
|
|
110
|
+
attribution notices from the Source form of the Work,
|
|
111
|
+
excluding those notices that do not pertain to any part of
|
|
112
|
+
the Derivative Works; and
|
|
105
113
|
|
|
106
114
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
distribution, then any Derivative Works that You distribute must
|
|
116
|
+
include a readable copy of the attribution notices contained
|
|
117
|
+
within such NOTICE file, excluding those notices that do not
|
|
118
|
+
pertain to any part of the Derivative Works, in at least one
|
|
119
|
+
of the following places: within a NOTICE text file distributed
|
|
120
|
+
as part of the Derivative Works; within the Source form or
|
|
121
|
+
documentation, if provided along with the Derivative Works; or,
|
|
122
|
+
within a display generated by the Derivative Works, if and
|
|
123
|
+
wherever such third-party notices normally appear. The contents
|
|
124
|
+
of the NOTICE file are for informational purposes only and
|
|
125
|
+
do not modify the License. You may add Your own attribution
|
|
126
|
+
notices within Derivative Works that You distribute, alongside
|
|
127
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
128
|
+
that such additional attribution notices cannot be construed
|
|
129
|
+
as modifying the License.
|
|
122
130
|
|
|
123
131
|
You may add Your own copyright statement to Your modifications and
|
|
124
132
|
may provide additional or different license terms and conditions
|
|
@@ -127,7 +135,7 @@
|
|
|
127
135
|
reproduction, and distribution of the Work otherwise complies with
|
|
128
136
|
the conditions stated in this License.
|
|
129
137
|
|
|
130
|
-
|
|
138
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
139
|
any Contribution intentionally submitted for inclusion in the Work
|
|
132
140
|
by You to the Licensor shall be under the terms and conditions of
|
|
133
141
|
this License, without any additional terms or conditions.
|
|
@@ -135,12 +143,12 @@
|
|
|
135
143
|
the terms of any separate license agreement you may have executed
|
|
136
144
|
with Licensor regarding such Contributions.
|
|
137
145
|
|
|
138
|
-
|
|
146
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
147
|
names, trademarks, service marks, or product names of the Licensor,
|
|
140
148
|
except as required for reasonable and customary use in describing the
|
|
141
149
|
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
150
|
|
|
143
|
-
|
|
151
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
152
|
agreed to in writing, Licensor provides the Work (and each
|
|
145
153
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
154
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
@@ -150,7 +158,7 @@
|
|
|
150
158
|
appropriateness of using or redistributing the Work and assume any
|
|
151
159
|
risks associated with Your exercise of permissions under this License.
|
|
152
160
|
|
|
153
|
-
|
|
161
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
162
|
whether in tort (including negligence), contract, or otherwise,
|
|
155
163
|
unless required by applicable law (such as deliberate and grossly
|
|
156
164
|
negligent acts) or agreed to in writing, shall any Contributor be
|
|
@@ -162,7 +170,7 @@
|
|
|
162
170
|
other commercial damages or losses), even if such Contributor
|
|
163
171
|
has been advised of the possibility of such damages.
|
|
164
172
|
|
|
165
|
-
|
|
173
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
174
|
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
175
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
176
|
or other liability obligations and/or rights consistent with this
|
|
@@ -173,9 +181,9 @@
|
|
|
173
181
|
incurred by, or claims asserted against, such Contributor by reason
|
|
174
182
|
of your accepting any such warranty or additional liability.
|
|
175
183
|
|
|
176
|
-
|
|
184
|
+
END OF TERMS AND CONDITIONS
|
|
177
185
|
|
|
178
|
-
|
|
186
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
187
|
|
|
180
188
|
To apply the Apache License to your work, attach the following
|
|
181
189
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
@@ -186,16 +194,16 @@
|
|
|
186
194
|
same "printed page" as the copyright notice for easier
|
|
187
195
|
identification within third-party archives.
|
|
188
196
|
|
|
189
|
-
|
|
197
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
198
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
200
|
+
you may not use this file except in compliance with the License.
|
|
201
|
+
You may obtain a copy of the License at
|
|
194
202
|
|
|
195
203
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
204
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
Unless required by applicable law or agreed to in writing, software
|
|
206
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
207
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
208
|
+
See the License for the specific language governing permissions and
|
|
209
|
+
limitations under the License.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { StructuredStreamState, StreamChunk, StreamFromRouteArgs, StructuredDataChunk } from '@kortyx/stream/browser';
|
|
2
|
+
import * as _kortyx_core_errors from '@kortyx/core/errors';
|
|
3
|
+
import { FailureDescriptor } from '@kortyx/core/errors';
|
|
2
4
|
|
|
3
5
|
type StructuredData = StructuredStreamState<Record<string, unknown>>;
|
|
4
6
|
type HumanInputPiece = {
|
|
@@ -31,6 +33,7 @@ type ContentPiece = {
|
|
|
31
33
|
id: string;
|
|
32
34
|
type: "error";
|
|
33
35
|
content: string;
|
|
36
|
+
failure?: FailureDescriptor;
|
|
34
37
|
} | HumanInputPiece;
|
|
35
38
|
type ChatMsg = {
|
|
36
39
|
id: string;
|
|
@@ -41,6 +44,17 @@ type ChatMsg = {
|
|
|
41
44
|
traceId?: string;
|
|
42
45
|
spanId?: string;
|
|
43
46
|
runId?: string;
|
|
47
|
+
checkpointId?: string;
|
|
48
|
+
checkpointTurnIndex?: number;
|
|
49
|
+
source?: {
|
|
50
|
+
type: "prompt";
|
|
51
|
+
} | {
|
|
52
|
+
type: "interrupt-response";
|
|
53
|
+
resumeToken: string;
|
|
54
|
+
requestId: string;
|
|
55
|
+
selected: string[];
|
|
56
|
+
text?: string;
|
|
57
|
+
};
|
|
44
58
|
};
|
|
45
59
|
|
|
46
60
|
declare function buildAssistantMessage(args: {
|
|
@@ -52,6 +66,10 @@ declare function buildAssistantMessage(args: {
|
|
|
52
66
|
spanId: string;
|
|
53
67
|
runId: string;
|
|
54
68
|
} | undefined;
|
|
69
|
+
checkpoint?: {
|
|
70
|
+
id: string;
|
|
71
|
+
turnIndex: number;
|
|
72
|
+
} | undefined;
|
|
55
73
|
}): ChatMsg;
|
|
56
74
|
|
|
57
75
|
type MaybePromise$1<T> = T | Promise<T>;
|
|
@@ -60,6 +78,14 @@ type PersistedChatState<TMessage> = {
|
|
|
60
78
|
workflowId: string;
|
|
61
79
|
includeHistory: boolean;
|
|
62
80
|
messages: TMessage[];
|
|
81
|
+
branches?: Record<string, {
|
|
82
|
+
sessionId: string;
|
|
83
|
+
parentSessionId?: string;
|
|
84
|
+
forkedFrom?: string;
|
|
85
|
+
messages: TMessage[];
|
|
86
|
+
checkpoints?: unknown[];
|
|
87
|
+
}>;
|
|
88
|
+
responseVariants?: unknown[];
|
|
63
89
|
};
|
|
64
90
|
type ChatStorage<TMessage> = {
|
|
65
91
|
load: () => MaybePromise$1<Partial<PersistedChatState<TMessage>>>;
|
|
@@ -71,6 +97,8 @@ type BrowserChatStorageKeys = {
|
|
|
71
97
|
includeHistory: string;
|
|
72
98
|
sessionId: string;
|
|
73
99
|
workflowId: string;
|
|
100
|
+
branches: string;
|
|
101
|
+
responseVariants: string;
|
|
74
102
|
};
|
|
75
103
|
type BrowserChatStorageOptions<TMessage> = {
|
|
76
104
|
parseMessage?: ((value: unknown) => TMessage | null) | undefined;
|
|
@@ -95,10 +123,59 @@ type ChatTransportContext<TContext = DefaultChatContext$1> = {
|
|
|
95
123
|
signal?: AbortSignal | undefined;
|
|
96
124
|
};
|
|
97
125
|
type ChatTransportChunkHandler = (chunk: StreamChunk) => undefined | boolean | Promise<boolean | undefined>;
|
|
126
|
+
type CheckpointSummary = {
|
|
127
|
+
id: string;
|
|
128
|
+
sessionId: string;
|
|
129
|
+
turnIndex: number;
|
|
130
|
+
createdAt: number;
|
|
131
|
+
nodes: string[];
|
|
132
|
+
workflow: string;
|
|
133
|
+
label?: string;
|
|
134
|
+
};
|
|
135
|
+
type RollbackCheckpointResult = {
|
|
136
|
+
sessionId: string;
|
|
137
|
+
head: string;
|
|
138
|
+
invalidatedStructuredStreamIds: string[];
|
|
139
|
+
invalidatedInterruptTokens: string[];
|
|
140
|
+
};
|
|
141
|
+
type ForkPendingRequest = {
|
|
142
|
+
token: string;
|
|
143
|
+
requestId: string;
|
|
144
|
+
schema?: {
|
|
145
|
+
kind?: "choice" | "multi-choice" | "text";
|
|
146
|
+
multiple?: boolean;
|
|
147
|
+
question?: string;
|
|
148
|
+
id?: string;
|
|
149
|
+
schemaId?: string;
|
|
150
|
+
schemaVersion?: string;
|
|
151
|
+
meta?: Record<string, unknown>;
|
|
152
|
+
};
|
|
153
|
+
options?: Array<{
|
|
154
|
+
id: string;
|
|
155
|
+
label: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
}>;
|
|
158
|
+
};
|
|
159
|
+
type ForkCheckpointResult = {
|
|
160
|
+
sessionId: string;
|
|
161
|
+
parentSessionId: string;
|
|
162
|
+
forkedFrom: string;
|
|
163
|
+
checkpoint?: {
|
|
164
|
+
id: string;
|
|
165
|
+
sessionId: string;
|
|
166
|
+
turnIndex: number;
|
|
167
|
+
activePendingRequests?: ForkPendingRequest[];
|
|
168
|
+
};
|
|
169
|
+
};
|
|
98
170
|
type ChatTransport<TContext = DefaultChatContext$1> = {
|
|
99
171
|
stream(args: ChatTransportContext<TContext> & {
|
|
100
172
|
onChunk: ChatTransportChunkHandler;
|
|
101
173
|
}): Promise<void>;
|
|
174
|
+
listCheckpoints?: (sessionId: string) => Promise<CheckpointSummary[]>;
|
|
175
|
+
rollbackTo?: (checkpointId: string) => Promise<RollbackCheckpointResult>;
|
|
176
|
+
fork?: (checkpointId: string, options?: {
|
|
177
|
+
newSessionId?: string;
|
|
178
|
+
}) => Promise<ForkCheckpointResult>;
|
|
102
179
|
};
|
|
103
180
|
type ChatTransportChunkSource = Iterable<StreamChunk> | AsyncIterable<StreamChunk>;
|
|
104
181
|
declare function createChatTransport<TContext = DefaultChatContext$1>(args: {
|
|
@@ -112,6 +189,7 @@ type RouteChatRequestBody<TContext = DefaultChatContext$1> = {
|
|
|
112
189
|
};
|
|
113
190
|
type CreateRouteChatTransportArgs<TBody, TContext> = Omit<StreamFromRouteArgs<TBody>, "body"> & {
|
|
114
191
|
createBody?: ((context: ChatTransportContext<TContext>) => TBody) | undefined;
|
|
192
|
+
checkpointEndpoint?: string | undefined;
|
|
115
193
|
};
|
|
116
194
|
declare function createRouteChatTransport<TContext = DefaultChatContext$1, TBody = RouteChatRequestBody<TContext>>(args: CreateRouteChatTransportArgs<TBody, TContext>): ChatTransport<TContext>;
|
|
117
195
|
|
|
@@ -130,6 +208,7 @@ type UseStructuredStreamsResult<TData = unknown> = {
|
|
|
130
208
|
applyStreamChunk: (chunk: StreamChunk) => StructuredStreamItem<TData> | undefined;
|
|
131
209
|
clear: () => void;
|
|
132
210
|
get: (streamId: string) => StructuredStreamItem<TData> | undefined;
|
|
211
|
+
delete: (streamId: string) => boolean;
|
|
133
212
|
};
|
|
134
213
|
declare function useStructuredStreams<TData = unknown>(options?: UseStructuredStreamsOptions<TData> | undefined): UseStructuredStreamsResult<TData>;
|
|
135
214
|
|
|
@@ -146,6 +225,7 @@ type LiveChatStructuredPiece<TStructuredData = unknown> = {
|
|
|
146
225
|
type LiveChatErrorPiece = {
|
|
147
226
|
id: string;
|
|
148
227
|
type: "error";
|
|
228
|
+
failure?: FailureDescriptor;
|
|
149
229
|
content: string;
|
|
150
230
|
};
|
|
151
231
|
type LiveChatCustomPiece = {
|
|
@@ -194,6 +274,10 @@ type UseChatValue = {
|
|
|
194
274
|
streamContentPieces: ContentPiece[];
|
|
195
275
|
streamDebug: StreamChunk[];
|
|
196
276
|
lastAssistantId: string | null;
|
|
277
|
+
checkpoints: CheckpointSummary[];
|
|
278
|
+
activeSessionId: string | null;
|
|
279
|
+
branches: Record<string, ChatBranch>;
|
|
280
|
+
responseVariants: ChatResponseVariantGroup[];
|
|
197
281
|
workflowId: string;
|
|
198
282
|
setWorkflowId: React.Dispatch<React.SetStateAction<string>>;
|
|
199
283
|
send: (text: string) => Promise<void> | void;
|
|
@@ -208,6 +292,17 @@ type UseChatValue = {
|
|
|
208
292
|
text?: string | undefined;
|
|
209
293
|
}) => Promise<void> | void;
|
|
210
294
|
setMessages: React.Dispatch<React.SetStateAction<ChatMsg[]>>;
|
|
295
|
+
checkpointForMessage: (messageId: string) => string | null;
|
|
296
|
+
rollbackTo: (id: string) => Promise<RollbackCheckpointResult>;
|
|
297
|
+
fork: (id: string, options?: {
|
|
298
|
+
newSessionId?: string;
|
|
299
|
+
}) => Promise<ForkCheckpointResult>;
|
|
300
|
+
regenerate: (assistantMessageId: string) => Promise<void>;
|
|
301
|
+
regenerateVariant: (assistantMessageId: string) => Promise<ChatResponseVariantGroup>;
|
|
302
|
+
selectVariant: (assistantMessageId: string, variantId: string) => Promise<void>;
|
|
303
|
+
variantForMessage: (messageId: string) => ChatResponseVariantGroup | null;
|
|
304
|
+
regenerateFromCheckpoint: (checkpointId: string) => Promise<void>;
|
|
305
|
+
retryWithEdit: (assistantMessageId: string, newUserContent: string) => Promise<void>;
|
|
211
306
|
clearMessages: () => void;
|
|
212
307
|
resetSession: () => void;
|
|
213
308
|
resetChat: () => void;
|
|
@@ -217,6 +312,32 @@ type UseChatValue = {
|
|
|
217
312
|
includeHistory: boolean;
|
|
218
313
|
setIncludeHistory: React.Dispatch<React.SetStateAction<boolean>>;
|
|
219
314
|
};
|
|
315
|
+
type ChatBranch<TMessage = ChatMsg> = {
|
|
316
|
+
sessionId: string;
|
|
317
|
+
parentSessionId?: string;
|
|
318
|
+
forkedFrom?: string;
|
|
319
|
+
messages: TMessage[];
|
|
320
|
+
checkpoints: CheckpointSummary[];
|
|
321
|
+
};
|
|
322
|
+
type ChatResponseVariant = {
|
|
323
|
+
id: string;
|
|
324
|
+
sessionId: string;
|
|
325
|
+
assistantMessageId: string;
|
|
326
|
+
createdAt: number;
|
|
327
|
+
messages: ChatMsg[];
|
|
328
|
+
checkpoints: CheckpointSummary[];
|
|
329
|
+
checkpointId?: string;
|
|
330
|
+
checkpointTurnIndex?: number;
|
|
331
|
+
label?: string;
|
|
332
|
+
};
|
|
333
|
+
type ChatResponseVariantGroup = {
|
|
334
|
+
id: string;
|
|
335
|
+
sourceAssistantMessageId: string;
|
|
336
|
+
checkpointId: string;
|
|
337
|
+
checkpointTurnIndex: number;
|
|
338
|
+
selectedVariantId: string;
|
|
339
|
+
variants: ChatResponseVariant[];
|
|
340
|
+
};
|
|
220
341
|
type UseChatOptions<TContext = DefaultChatContext> = {
|
|
221
342
|
transport: ChatTransport<TContext>;
|
|
222
343
|
storage?: ChatStorage<ChatMsg> | undefined;
|
|
@@ -231,6 +352,16 @@ declare function useChatStreamDebug(): {
|
|
|
231
352
|
streamDebug: ({
|
|
232
353
|
type: "session";
|
|
233
354
|
sessionId: string;
|
|
355
|
+
} | {
|
|
356
|
+
type: "checkpoint";
|
|
357
|
+
id: string;
|
|
358
|
+
sessionId: string;
|
|
359
|
+
turnIndex: number;
|
|
360
|
+
label?: string;
|
|
361
|
+
} | {
|
|
362
|
+
type: "structured-data-invalidated";
|
|
363
|
+
streamId: string;
|
|
364
|
+
checkpointId: string;
|
|
234
365
|
} | {
|
|
235
366
|
type: "trace";
|
|
236
367
|
traceId: string;
|
|
@@ -292,6 +423,7 @@ declare function useChatStreamDebug(): {
|
|
|
292
423
|
tool: string;
|
|
293
424
|
toolCallId: string;
|
|
294
425
|
message: string;
|
|
426
|
+
failure?: _kortyx_core_errors.FailureDescriptor;
|
|
295
427
|
node?: string;
|
|
296
428
|
id?: string;
|
|
297
429
|
opId?: string;
|
|
@@ -376,12 +508,23 @@ declare function useChatStreamDebug(): {
|
|
|
376
508
|
type: "transition";
|
|
377
509
|
transitionTo: string;
|
|
378
510
|
payload?: any;
|
|
511
|
+
} | {
|
|
512
|
+
type: "limit-reached";
|
|
513
|
+
runId: string;
|
|
514
|
+
limit: "maxNodeExecutions" | "maxModelPasses" | "maxToolCalls" | "maxChildInvocations";
|
|
515
|
+
maximum: number;
|
|
516
|
+
consumed: number;
|
|
517
|
+
} | {
|
|
518
|
+
type: "cancelled";
|
|
519
|
+
runId: string;
|
|
520
|
+
reason: string;
|
|
379
521
|
} | {
|
|
380
522
|
type: "done";
|
|
381
523
|
data?: any;
|
|
382
524
|
} | {
|
|
383
525
|
type: "error";
|
|
384
526
|
message: string;
|
|
527
|
+
failure?: _kortyx_core_errors.FailureDescriptor;
|
|
385
528
|
})[];
|
|
386
529
|
clearStreamDebug: () => void;
|
|
387
530
|
createRecorder: (initialMessage: string) => {
|
|
@@ -389,6 +532,16 @@ declare function useChatStreamDebug(): {
|
|
|
389
532
|
getAll: () => ({
|
|
390
533
|
type: "session";
|
|
391
534
|
sessionId: string;
|
|
535
|
+
} | {
|
|
536
|
+
type: "checkpoint";
|
|
537
|
+
id: string;
|
|
538
|
+
sessionId: string;
|
|
539
|
+
turnIndex: number;
|
|
540
|
+
label?: string;
|
|
541
|
+
} | {
|
|
542
|
+
type: "structured-data-invalidated";
|
|
543
|
+
streamId: string;
|
|
544
|
+
checkpointId: string;
|
|
392
545
|
} | {
|
|
393
546
|
type: "trace";
|
|
394
547
|
traceId: string;
|
|
@@ -450,6 +603,7 @@ declare function useChatStreamDebug(): {
|
|
|
450
603
|
tool: string;
|
|
451
604
|
toolCallId: string;
|
|
452
605
|
message: string;
|
|
606
|
+
failure?: _kortyx_core_errors.FailureDescriptor;
|
|
453
607
|
node?: string;
|
|
454
608
|
id?: string;
|
|
455
609
|
opId?: string;
|
|
@@ -534,14 +688,25 @@ declare function useChatStreamDebug(): {
|
|
|
534
688
|
type: "transition";
|
|
535
689
|
transitionTo: string;
|
|
536
690
|
payload?: any;
|
|
691
|
+
} | {
|
|
692
|
+
type: "limit-reached";
|
|
693
|
+
runId: string;
|
|
694
|
+
limit: "maxNodeExecutions" | "maxModelPasses" | "maxToolCalls" | "maxChildInvocations";
|
|
695
|
+
maximum: number;
|
|
696
|
+
consumed: number;
|
|
697
|
+
} | {
|
|
698
|
+
type: "cancelled";
|
|
699
|
+
runId: string;
|
|
700
|
+
reason: string;
|
|
537
701
|
} | {
|
|
538
702
|
type: "done";
|
|
539
703
|
data?: any;
|
|
540
704
|
} | {
|
|
541
705
|
type: "error";
|
|
542
706
|
message: string;
|
|
707
|
+
failure?: _kortyx_core_errors.FailureDescriptor;
|
|
543
708
|
})[];
|
|
544
709
|
};
|
|
545
710
|
};
|
|
546
711
|
|
|
547
|
-
export { type BrowserChatStorageKeys, type BrowserChatStorageOptions, type ChatMsg, type ChatStorage, type ChatTransport, type ChatTransportChunkHandler, type ChatTransportChunkSource, type ChatTransportContext, type ContentPiece, type CreateRouteChatTransportArgs, type HumanInputPiece, type LiveChatErrorPiece, type LiveChatPiece, type LiveChatStructuredPiece, type LiveChatTextPiece, type OutgoingChatMessage, type PersistedChatState, type PrepareContextMessages, type PrepareContextMessagesArgs, type RouteChatRequestBody, type StructuredData, type StructuredStreamItem, type ToHumanInputPiece, type UseChatOptions, type UseChatValue, type UseStructuredStreamsOptions, type UseStructuredStreamsResult, buildAssistantMessage, createBrowserChatStorage, createChatTransport, createLiveChatPieces, createRouteChatTransport, toHumanInputPiece, useChat, useChatStreamDebug, useStructuredStreams };
|
|
712
|
+
export { type BrowserChatStorageKeys, type BrowserChatStorageOptions, type ChatBranch, type ChatMsg, type ChatResponseVariant, type ChatResponseVariantGroup, type ChatStorage, type ChatTransport, type ChatTransportChunkHandler, type ChatTransportChunkSource, type ChatTransportContext, type CheckpointSummary, type ContentPiece, type CreateRouteChatTransportArgs, type ForkCheckpointResult, type ForkPendingRequest, type HumanInputPiece, type LiveChatErrorPiece, type LiveChatPiece, type LiveChatStructuredPiece, type LiveChatTextPiece, type OutgoingChatMessage, type PersistedChatState, type PrepareContextMessages, type PrepareContextMessagesArgs, type RollbackCheckpointResult, type RouteChatRequestBody, type StructuredData, type StructuredStreamItem, type ToHumanInputPiece, type UseChatOptions, type UseChatValue, type UseStructuredStreamsOptions, type UseStructuredStreamsResult, buildAssistantMessage, createBrowserChatStorage, createChatTransport, createLiveChatPieces, createRouteChatTransport, toHumanInputPiece, useChat, useChatStreamDebug, useStructuredStreams };
|