@band-ai/sdk 0.3.3 → 0.3.4

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/dist/adapters.cjs CHANGED
@@ -1991,13 +1991,21 @@ var BandACPClient = class {
1991
1991
  };
1992
1992
  function coalesceChunks(chunks) {
1993
1993
  const result = [];
1994
+ const openRuns = /* @__PURE__ */ new Map();
1994
1995
  for (const chunk of chunks) {
1995
- const last = result[result.length - 1];
1996
- if (chunk.streamed && last?.streamed && last.chunkType === chunk.chunkType) {
1997
- last.content += chunk.content;
1996
+ if (!chunk.streamed) {
1997
+ openRuns.clear();
1998
+ result.push({ ...chunk });
1998
1999
  continue;
1999
2000
  }
2000
- result.push({ ...chunk });
2001
+ const openRun = openRuns.get(chunk.chunkType);
2002
+ if (openRun) {
2003
+ openRun.content += chunk.content;
2004
+ continue;
2005
+ }
2006
+ const clone = { ...chunk };
2007
+ openRuns.set(chunk.chunkType, clone);
2008
+ result.push(clone);
2001
2009
  }
2002
2010
  return result;
2003
2011
  }
package/dist/adapters.js CHANGED
@@ -258,13 +258,21 @@ var BandACPClient = class {
258
258
  };
259
259
  function coalesceChunks(chunks) {
260
260
  const result = [];
261
+ const openRuns = /* @__PURE__ */ new Map();
261
262
  for (const chunk of chunks) {
262
- const last = result[result.length - 1];
263
- if (chunk.streamed && last?.streamed && last.chunkType === chunk.chunkType) {
264
- last.content += chunk.content;
263
+ if (!chunk.streamed) {
264
+ openRuns.clear();
265
+ result.push({ ...chunk });
265
266
  continue;
266
267
  }
267
- result.push({ ...chunk });
268
+ const openRun = openRuns.get(chunk.chunkType);
269
+ if (openRun) {
270
+ openRun.content += chunk.content;
271
+ continue;
272
+ }
273
+ const clone = { ...chunk };
274
+ openRuns.set(chunk.chunkType, clone);
275
+ result.push(clone);
268
276
  }
269
277
  return result;
270
278
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Band TypeScript SDK core runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -88,7 +88,7 @@
88
88
  "node": ">=22.12"
89
89
  },
90
90
  "dependencies": {
91
- "@band-ai/band-sdk-core": "2.0.0",
91
+ "@band-ai/band-sdk-core": "2.4.0",
92
92
  "@band-ai/rest-client": "0.0.118",
93
93
  "js-yaml": "^4.1.1",
94
94
  "phoenix": "^1.8.4",