@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.
@@ -1,5 +1,5 @@
1
1
  $ bun build ./src/index.ts --outdir dist --target bun --format esm
2
- Bundled 270 modules in 269ms
2
+ Bundled 270 modules in 276ms
3
3
 
4
4
  index.js 1.31 MB (entry point)
5
5
 
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: previous?._tag === "ToolEntry" ? previous.outcome : Pending(),
39289
- progress: previous?._tag === "ToolEntry" ? previous.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.0",
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.0"
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: call.params,
332
- outcome: previous?._tag === "ToolEntry" ? previous.outcome : Pending(),
333
- progress: previous?._tag === "ToolEntry" ? previous.progress : [],
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))