@batonfx/foldkit 0.1.0 → 0.1.1
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 +1 -1
- package/dist/index.js +4 -3
- package/package.json +2 -2
- package/src/chat.ts +8 -3
package/.turbo/turbo-build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -39281,12 +39281,13 @@ var flushStreaming = (model) => {
|
|
|
39281
39281
|
var upsertToolCall = (entries3, call) => {
|
|
39282
39282
|
const index2 = entries3.findIndex((entry) => entry._tag === "ToolEntry" && entry.callId === call.id);
|
|
39283
39283
|
const previous = index2 >= 0 ? entries3[index2] : undefined;
|
|
39284
|
+
const previousToolEntry = previous?._tag === "ToolEntry" ? previous : undefined;
|
|
39284
39285
|
const next2 = ToolEntry({
|
|
39285
39286
|
callId: call.id,
|
|
39286
39287
|
name: call.name,
|
|
39287
|
-
params: call.params,
|
|
39288
|
-
outcome:
|
|
39289
|
-
progress:
|
|
39288
|
+
params: call.params === undefined ? previousToolEntry?.params : call.params,
|
|
39289
|
+
outcome: previousToolEntry?.outcome ?? Pending(),
|
|
39290
|
+
progress: previousToolEntry?.progress ?? []
|
|
39290
39291
|
});
|
|
39291
39292
|
if (index2 < 0)
|
|
39292
39293
|
return [...entries3, next2];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@batonfx/foldkit",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"typecheck": "bun tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@batonfx/transport": "0.1.
|
|
17
|
+
"@batonfx/transport": "0.1.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"effect": ">=4.0.0-beta.88 <4.0.1",
|
package/src/chat.ts
CHANGED
|
@@ -325,12 +325,17 @@ const flushStreaming = (model: Model): Model => {
|
|
|
325
325
|
const upsertToolCall = (entries: ReadonlyArray<ChatEntry>, call: ToolCallLike): ReadonlyArray<ChatEntry> => {
|
|
326
326
|
const index = entries.findIndex((entry) => entry._tag === "ToolEntry" && entry.callId === call.id)
|
|
327
327
|
const previous = index >= 0 ? entries[index] : undefined
|
|
328
|
+
const previousToolEntry = previous?._tag === "ToolEntry" ? previous : undefined
|
|
328
329
|
const next = ToolEntry({
|
|
329
330
|
callId: call.id,
|
|
330
331
|
name: call.name,
|
|
331
|
-
params:
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
// `resolveTool` re-upserts with `params: undefined` defensively (a tool
|
|
333
|
+
// result may arrive without this view ever having seen the matching
|
|
334
|
+
// tool-call part). Falling back to the previously tracked params keeps a
|
|
335
|
+
// real tool call's params from being wiped out when its result resolves.
|
|
336
|
+
params: call.params === undefined ? previousToolEntry?.params : call.params,
|
|
337
|
+
outcome: previousToolEntry?.outcome ?? Pending(),
|
|
338
|
+
progress: previousToolEntry?.progress ?? [],
|
|
334
339
|
})
|
|
335
340
|
if (index < 0) return [...entries, next]
|
|
336
341
|
return entries.map((entry, entryIndex) => (entryIndex === index ? next : entry))
|