@promptbook/browser 0.112.0-114 → 0.112.0-117

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
@@ -1,15 +1,14 @@
1
1
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { Registration } from 'destroyable';
3
3
  import { BehaviorSubject, Subject } from 'rxjs';
4
- import { randomBytes } from 'crypto';
5
- import { SHA256 } from 'crypto-js';
4
+ import CryptoJS from 'crypto-js';
6
5
  import hexEncoder from 'crypto-js/enc-hex';
7
6
  import { basename, join, dirname, isAbsolute } from 'path';
8
7
  import moment from 'moment';
9
8
  import { lookup, extension } from 'mime-types';
10
9
  import { forTime } from 'waitasecond';
11
10
  import sha256 from 'crypto-js/sha256';
12
- import { parse, unparse } from 'papaparse';
11
+ import papaparse from 'papaparse';
13
12
  import { fileSearchTool, tool, Agent as Agent$1, webSearchTool, run, setDefaultOpenAIClient, setDefaultOpenAIKey } from '@openai/agents';
14
13
  import colors from 'colors';
15
14
  import Bottleneck from 'bottleneck';
@@ -29,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
29
28
  * @generated
30
29
  * @see https://github.com/webgptorg/promptbook
31
30
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-117';
33
32
  /**
34
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2332,7 +2331,7 @@ function valueToString(value) {
2332
2331
  * @public exported from `@promptbook/utils`
2333
2332
  */
2334
2333
  function computeHash(value) {
2335
- return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
2334
+ return CryptoJS.SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
2336
2335
  }
2337
2336
  // TODO: [🥬][🥬] Use this ACRY
2338
2337
 
@@ -17462,7 +17461,7 @@ function getTimeoutToolRuntimeAdapterOrDisabledResult(action, runtimeContext) {
17462
17461
  * @private internal helper function
17463
17462
  */
17464
17463
  function $randomToken(randomness) {
17465
- return randomBytes(randomness).toString('hex');
17464
+ return CryptoJS.lib.WordArray.random(randomness).toString(CryptoJS.enc.Hex);
17466
17465
  }
17467
17466
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
17468
17467
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -25356,7 +25355,7 @@ function $registeredScrapersMessage(availableScrapers) {
25356
25355
  * @public exported from `@promptbook/editable`
25357
25356
  */
25358
25357
  function knowledgeSourceContentToName(knowledgeSourceContent) {
25359
- const hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
25358
+ const hash = CryptoJS.SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
25360
25359
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
25361
25360
  .toString( /* hex */)
25362
25361
  .substring(0, 20);
@@ -26204,7 +26203,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
26204
26203
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
26205
26204
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
26206
26205
  }
26207
- const csv = parse(value, settings);
26206
+ const csv = papaparse.parse(value, settings);
26208
26207
  return csv;
26209
26208
  }
26210
26209
 
@@ -26289,10 +26288,10 @@ const CsvFormatParser = {
26289
26288
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
26290
26289
  );
26291
26290
  */
26292
- await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
26291
+ await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
26293
26292
  }
26294
26293
  }
26295
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
26294
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
26296
26295
  },
26297
26296
  },
26298
26297
  {
@@ -26320,7 +26319,7 @@ const CsvFormatParser = {
26320
26319
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
26321
26320
  }));
26322
26321
  }));
26323
- return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
26322
+ return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
26324
26323
  },
26325
26324
  },
26326
26325
  ],
@@ -35025,7 +35024,7 @@ function emitAgentLlmExecutionToolsAssistantPreparationProgress(options) {
35025
35024
  * Computes one stable hash from a JSON-serializable value.
35026
35025
  */
35027
35026
  function computeJsonHash$1(value) {
35028
- return SHA256(JSON.stringify(value)).toString();
35027
+ return CryptoJS.SHA256(JSON.stringify(value)).toString();
35029
35028
  }
35030
35029
  /**
35031
35030
  * Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
@@ -35183,7 +35182,7 @@ AgentLlmExecutionToolsAgentKitRunner.vectorStoreCache = new Map();
35183
35182
  * Computes one stable hash from a JSON-serializable value.
35184
35183
  */
35185
35184
  function computeJsonHash(value) {
35186
- return SHA256(JSON.stringify(value)).toString();
35185
+ return CryptoJS.SHA256(JSON.stringify(value)).toString();
35187
35186
  }
35188
35187
  /**
35189
35188
  * Removes assistant-managed requirements before the prompt is executed via OpenAI Assistants.
@@ -36039,7 +36038,7 @@ class AgentLlmExecutionTools {
36039
36038
  * Returns a virtual model name representing the agent behavior.
36040
36039
  */
36041
36040
  get modelName() {
36042
- const hash = SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
36041
+ const hash = CryptoJS.SHA256(hexEncoder.parse(this.options.agentSource)).toString( /* hex */);
36043
36042
  const agentId = hash.substring(0, 10);
36044
36043
  return (normalizeToKebabCase(this.title) + '-' + agentId);
36045
36044
  }