@promptbook/wizard 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
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- const PROMPTBOOK_ENGINE_VERSION = '0.110.0-7';
41
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-8';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -29284,6 +29284,40 @@ function isAssistantPreparationToolCall(toolCall) {
29284
29284
  return toolCall.name === ASSISTANT_PREPARATION_TOOL_CALL_NAME;
29285
29285
  }
29286
29286
 
29287
+ /**
29288
+ * Builds a stable identity string for tool calls across partial updates.
29289
+ *
29290
+ * @param toolCall - Tool call entry to identify.
29291
+ * @returns Stable identity string for deduplication.
29292
+ *
29293
+ * @private function of <Chat/>
29294
+ */
29295
+ function getToolCallIdentity(toolCall) {
29296
+ const rawToolCall = toolCall.rawToolCall;
29297
+ 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);
29298
+ if (rawId) {
29299
+ return `id:${rawId}`;
29300
+ }
29301
+ if (toolCall.createdAt) {
29302
+ return `time:${toolCall.createdAt}:${toolCall.name}`;
29303
+ }
29304
+ const argsKey = (() => {
29305
+ if (typeof toolCall.arguments === 'string') {
29306
+ return toolCall.arguments;
29307
+ }
29308
+ if (!toolCall.arguments) {
29309
+ return '';
29310
+ }
29311
+ try {
29312
+ return JSON.stringify(toolCall.arguments);
29313
+ }
29314
+ catch (_a) {
29315
+ return '';
29316
+ }
29317
+ })();
29318
+ return `fallback:${toolCall.name}:${argsKey}`;
29319
+ }
29320
+
29287
29321
  /*! *****************************************************************************
29288
29322
  Copyright (c) Microsoft Corporation.
29289
29323
 
@@ -30938,26 +30972,7 @@ class RemoteAgent extends Agent {
30938
30972
  };
30939
30973
  };
30940
30974
  const getToolCallKey = (toolCall) => {
30941
- var _a;
30942
- const rawId = (_a = toolCall.rawToolCall) === null || _a === void 0 ? void 0 : _a.id;
30943
- if (rawId) {
30944
- return `id:${rawId}`;
30945
- }
30946
- const argsKey = (() => {
30947
- if (typeof toolCall.arguments === 'string') {
30948
- return toolCall.arguments;
30949
- }
30950
- if (!toolCall.arguments) {
30951
- return '';
30952
- }
30953
- try {
30954
- return JSON.stringify(toolCall.arguments);
30955
- }
30956
- catch (_a) {
30957
- return '';
30958
- }
30959
- })();
30960
- return `${toolCall.name}:${toolCall.createdAt || ''}:${argsKey}`;
30975
+ return getToolCallIdentity(toolCall);
30961
30976
  };
30962
30977
  const mergeToolCall = (existing, incoming) => {
30963
30978
  const incomingResult = incoming.result;