@promptbook/node 0.110.0-7 → 0.110.0-8

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.110.0-7';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-8';
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
@@ -20310,6 +20310,40 @@ function isAssistantPreparationToolCall(toolCall) {
20310
20310
  return toolCall.name === ASSISTANT_PREPARATION_TOOL_CALL_NAME;
20311
20311
  }
20312
20312
 
20313
+ /**
20314
+ * Builds a stable identity string for tool calls across partial updates.
20315
+ *
20316
+ * @param toolCall - Tool call entry to identify.
20317
+ * @returns Stable identity string for deduplication.
20318
+ *
20319
+ * @private function of <Chat/>
20320
+ */
20321
+ function getToolCallIdentity(toolCall) {
20322
+ const rawToolCall = toolCall.rawToolCall;
20323
+ const rawId = (rawToolCall === null || rawToolCall === void 0 ? void 0 : rawToolCall.id) || (rawToolCall === null || rawToolCall === void 0 ? void 0 : rawToolCall.callId) || (rawToolCall === null || rawToolCall === void 0 ? void 0 : rawToolCall.call_id);
20324
+ if (rawId) {
20325
+ return `id:${rawId}`;
20326
+ }
20327
+ if (toolCall.createdAt) {
20328
+ return `time:${toolCall.createdAt}:${toolCall.name}`;
20329
+ }
20330
+ const argsKey = (() => {
20331
+ if (typeof toolCall.arguments === 'string') {
20332
+ return toolCall.arguments;
20333
+ }
20334
+ if (!toolCall.arguments) {
20335
+ return '';
20336
+ }
20337
+ try {
20338
+ return JSON.stringify(toolCall.arguments);
20339
+ }
20340
+ catch (_a) {
20341
+ return '';
20342
+ }
20343
+ })();
20344
+ return `fallback:${toolCall.name}:${argsKey}`;
20345
+ }
20346
+
20313
20347
  /*! *****************************************************************************
20314
20348
  Copyright (c) Microsoft Corporation.
20315
20349
 
@@ -26108,26 +26142,7 @@ class RemoteAgent extends Agent {
26108
26142
  };
26109
26143
  };
26110
26144
  const getToolCallKey = (toolCall) => {
26111
- var _a;
26112
- const rawId = (_a = toolCall.rawToolCall) === null || _a === void 0 ? void 0 : _a.id;
26113
- if (rawId) {
26114
- return `id:${rawId}`;
26115
- }
26116
- const argsKey = (() => {
26117
- if (typeof toolCall.arguments === 'string') {
26118
- return toolCall.arguments;
26119
- }
26120
- if (!toolCall.arguments) {
26121
- return '';
26122
- }
26123
- try {
26124
- return JSON.stringify(toolCall.arguments);
26125
- }
26126
- catch (_a) {
26127
- return '';
26128
- }
26129
- })();
26130
- return `${toolCall.name}:${toolCall.createdAt || ''}:${argsKey}`;
26145
+ return getToolCallIdentity(toolCall);
26131
26146
  };
26132
26147
  const mergeToolCall = (existing, incoming) => {
26133
26148
  const incomingResult = incoming.result;