@promptbook/node 0.111.0-1 → 0.111.0-2

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/esm/index.es.js CHANGED
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
35
35
  * @generated
36
36
  * @see https://github.com/webgptorg/promptbook
37
37
  */
38
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-1';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.0-2';
39
39
  /**
40
40
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
41
41
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -27092,7 +27092,6 @@ class RemoteAgent extends Agent {
27092
27092
  doneReading = !!done;
27093
27093
  if (value) {
27094
27094
  const textChunk = decoder.decode(value, { stream: true });
27095
- let sawToolCalls = false;
27096
27095
  let hasNonEmptyText = false;
27097
27096
  const textLines = [];
27098
27097
  const lines = textChunk.split(/\r?\n/);
@@ -27118,7 +27117,6 @@ class RemoteAgent extends Agent {
27118
27117
  rawResponse: {},
27119
27118
  toolCalls: getActiveToolCalls(),
27120
27119
  });
27121
- sawToolCalls = true;
27122
27120
  isToolCallLine = true;
27123
27121
  }
27124
27122
  }
@@ -27128,22 +27126,16 @@ class RemoteAgent extends Agent {
27128
27126
  }
27129
27127
  if (!isToolCallLine) {
27130
27128
  textLines.push(line);
27131
- if (line.length > 0) {
27129
+ if (trimmedLine.length > 0) {
27132
27130
  hasNonEmptyText = true;
27133
27131
  }
27134
27132
  }
27135
27133
  }
27136
- if (sawToolCalls) {
27137
- if (!hasNonEmptyText) {
27138
- continue;
27139
- }
27140
- const textChunkWithoutToolCalls = textLines.join('\n');
27141
- content += textChunkWithoutToolCalls;
27142
- }
27143
- else {
27144
- // console.debug('RemoteAgent chunk:', textChunk);
27145
- content += textChunk;
27134
+ if (!hasNonEmptyText) {
27135
+ continue;
27146
27136
  }
27137
+ const textChunkWithoutToolCalls = textLines.join('\n');
27138
+ content += textChunkWithoutToolCalls;
27147
27139
  if (!hasReceivedModelOutput && content.trim().length > 0) {
27148
27140
  hasReceivedModelOutput = true;
27149
27141
  preparationToolCalls.length = 0;