@promptbook/cli 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
@@ -48,7 +48,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.110.0-7';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.110.0-8';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -32418,6 +32418,40 @@ function isAssistantPreparationToolCall(toolCall) {
32418
32418
  return toolCall.name === ASSISTANT_PREPARATION_TOOL_CALL_NAME;
32419
32419
  }
32420
32420
 
32421
+ /**
32422
+ * Builds a stable identity string for tool calls across partial updates.
32423
+ *
32424
+ * @param toolCall - Tool call entry to identify.
32425
+ * @returns Stable identity string for deduplication.
32426
+ *
32427
+ * @private function of <Chat/>
32428
+ */
32429
+ function getToolCallIdentity(toolCall) {
32430
+ const rawToolCall = toolCall.rawToolCall;
32431
+ 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);
32432
+ if (rawId) {
32433
+ return `id:${rawId}`;
32434
+ }
32435
+ if (toolCall.createdAt) {
32436
+ return `time:${toolCall.createdAt}:${toolCall.name}`;
32437
+ }
32438
+ const argsKey = (() => {
32439
+ if (typeof toolCall.arguments === 'string') {
32440
+ return toolCall.arguments;
32441
+ }
32442
+ if (!toolCall.arguments) {
32443
+ return '';
32444
+ }
32445
+ try {
32446
+ return JSON.stringify(toolCall.arguments);
32447
+ }
32448
+ catch (_a) {
32449
+ return '';
32450
+ }
32451
+ })();
32452
+ return `fallback:${toolCall.name}:${argsKey}`;
32453
+ }
32454
+
32421
32455
  /*! *****************************************************************************
32422
32456
  Copyright (c) Microsoft Corporation.
32423
32457
 
@@ -34072,26 +34106,7 @@ class RemoteAgent extends Agent {
34072
34106
  };
34073
34107
  };
34074
34108
  const getToolCallKey = (toolCall) => {
34075
- var _a;
34076
- const rawId = (_a = toolCall.rawToolCall) === null || _a === void 0 ? void 0 : _a.id;
34077
- if (rawId) {
34078
- return `id:${rawId}`;
34079
- }
34080
- const argsKey = (() => {
34081
- if (typeof toolCall.arguments === 'string') {
34082
- return toolCall.arguments;
34083
- }
34084
- if (!toolCall.arguments) {
34085
- return '';
34086
- }
34087
- try {
34088
- return JSON.stringify(toolCall.arguments);
34089
- }
34090
- catch (_a) {
34091
- return '';
34092
- }
34093
- })();
34094
- return `${toolCall.name}:${toolCall.createdAt || ''}:${argsKey}`;
34109
+ return getToolCallIdentity(toolCall);
34095
34110
  };
34096
34111
  const mergeToolCall = (existing, incoming) => {
34097
34112
  const incomingResult = incoming.result;