@ai-sdk/harness-acp 1.0.9 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/harness-acp",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -78,7 +78,6 @@ export function createACPStreamTranslator({
78
78
  | undefined;
79
79
  let blockCounter = 0;
80
80
  let stepOpen = false;
81
- let completedToolStepEligible = false;
82
81
  let finished = false;
83
82
  const blockIdCounts = new Map<string, number>();
84
83
  const toolStates = new Map<string, ToolState>();
@@ -154,15 +153,10 @@ export function createACPStreamTranslator({
154
153
  harnessMetadata: { acp: { inferredStep: true } },
155
154
  });
156
155
  stepOpen = false;
157
- completedToolStepEligible = false;
158
156
  };
159
157
 
160
- const flushCompletedToolStep = () => {
161
- if (
162
- !stepOpen ||
163
- !completedToolStepEligible ||
164
- pendingToolCallIds.size > 0
165
- ) {
158
+ const finishCompletedToolStep = () => {
159
+ if (!stepOpen || pendingToolCallIds.size > 0) {
166
160
  return;
167
161
  }
168
162
  emitInferredStep({
@@ -252,7 +246,6 @@ export function createACPStreamTranslator({
252
246
  state.emittedCall = true;
253
247
  stepOpen = true;
254
248
  pendingToolCallIds.add(state.toolCallId);
255
- completedToolStepEligible = false;
256
249
  }
257
250
 
258
251
  emitFileChanges({ state, emit });
@@ -270,7 +263,7 @@ export function createACPStreamTranslator({
270
263
  });
271
264
  state.emittedResult = true;
272
265
  pendingToolCallIds.delete(state.toolCallId);
273
- completedToolStepEligible = pendingToolCallIds.size === 0;
266
+ finishCompletedToolStep();
274
267
  }
275
268
  };
276
269
 
@@ -293,7 +286,6 @@ export function createACPStreamTranslator({
293
286
  });
294
287
  stepOpen = true;
295
288
  pendingToolCallIds.add(toolCallId);
296
- completedToolStepEligible = false;
297
289
  };
298
290
 
299
291
  const hostToolResult = ({
@@ -316,7 +308,7 @@ export function createACPStreamTranslator({
316
308
  ...(isError ? { isError: true } : {}),
317
309
  });
318
310
  pendingToolCallIds.delete(toolCallId);
319
- completedToolStepEligible = pendingToolCallIds.size === 0;
311
+ finishCompletedToolStep();
320
312
  };
321
313
 
322
314
  return {
@@ -338,7 +330,6 @@ export function createACPStreamTranslator({
338
330
  update.content?.type === 'text' &&
339
331
  typeof update.content.text === 'string'
340
332
  ) {
341
- flushCompletedToolStep();
342
333
  emitContent({
343
334
  type: 'text',
344
335
  text: update.content.text,
@@ -351,7 +342,6 @@ export function createACPStreamTranslator({
351
342
  update.content?.type === 'text' &&
352
343
  typeof update.content.text === 'string'
353
344
  ) {
354
- flushCompletedToolStep();
355
345
  emitContent({
356
346
  type: 'reasoning',
357
347
  text: update.content.text,