@promptbook/browser 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
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.110.0-7';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-8';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -11516,6 +11516,40 @@ function isAssistantPreparationToolCall(toolCall) {
11516
11516
  return toolCall.name === ASSISTANT_PREPARATION_TOOL_CALL_NAME;
11517
11517
  }
11518
11518
 
11519
+ /**
11520
+ * Builds a stable identity string for tool calls across partial updates.
11521
+ *
11522
+ * @param toolCall - Tool call entry to identify.
11523
+ * @returns Stable identity string for deduplication.
11524
+ *
11525
+ * @private function of <Chat/>
11526
+ */
11527
+ function getToolCallIdentity(toolCall) {
11528
+ const rawToolCall = toolCall.rawToolCall;
11529
+ 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);
11530
+ if (rawId) {
11531
+ return `id:${rawId}`;
11532
+ }
11533
+ if (toolCall.createdAt) {
11534
+ return `time:${toolCall.createdAt}:${toolCall.name}`;
11535
+ }
11536
+ const argsKey = (() => {
11537
+ if (typeof toolCall.arguments === 'string') {
11538
+ return toolCall.arguments;
11539
+ }
11540
+ if (!toolCall.arguments) {
11541
+ return '';
11542
+ }
11543
+ try {
11544
+ return JSON.stringify(toolCall.arguments);
11545
+ }
11546
+ catch (_a) {
11547
+ return '';
11548
+ }
11549
+ })();
11550
+ return `fallback:${toolCall.name}:${argsKey}`;
11551
+ }
11552
+
11519
11553
  /*! *****************************************************************************
11520
11554
  Copyright (c) Microsoft Corporation.
11521
11555
 
@@ -20774,26 +20808,7 @@ class RemoteAgent extends Agent {
20774
20808
  };
20775
20809
  };
20776
20810
  const getToolCallKey = (toolCall) => {
20777
- var _a;
20778
- const rawId = (_a = toolCall.rawToolCall) === null || _a === void 0 ? void 0 : _a.id;
20779
- if (rawId) {
20780
- return `id:${rawId}`;
20781
- }
20782
- const argsKey = (() => {
20783
- if (typeof toolCall.arguments === 'string') {
20784
- return toolCall.arguments;
20785
- }
20786
- if (!toolCall.arguments) {
20787
- return '';
20788
- }
20789
- try {
20790
- return JSON.stringify(toolCall.arguments);
20791
- }
20792
- catch (_a) {
20793
- return '';
20794
- }
20795
- })();
20796
- return `${toolCall.name}:${toolCall.createdAt || ''}:${argsKey}`;
20811
+ return getToolCallIdentity(toolCall);
20797
20812
  };
20798
20813
  const mergeToolCall = (existing, incoming) => {
20799
20814
  const incomingResult = incoming.result;