@promptbook/wizard 0.101.0-0 → 0.101.0-10

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.
Files changed (60) hide show
  1. package/esm/index.es.js +32 -6
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +18 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
  7. package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
  8. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +8 -2
  9. package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +59 -0
  10. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +8 -2
  11. package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +45 -0
  12. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  13. package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +46 -0
  14. package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +47 -0
  15. package/esm/typings/src/book-2.0/commitments/META/META.d.ts +62 -0
  16. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +8 -2
  17. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +8 -2
  18. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +8 -2
  19. package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +46 -0
  20. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +8 -2
  21. package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
  22. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +46 -0
  23. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
  24. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +10 -0
  25. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +3 -0
  26. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
  27. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +28 -2
  28. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
  29. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  30. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  31. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  32. package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
  33. package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
  34. package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
  35. package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
  36. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  37. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +2 -0
  38. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
  39. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
  40. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
  41. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
  42. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  43. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
  44. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  45. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  46. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  47. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  48. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  49. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  50. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  51. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  52. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  53. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  54. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  55. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  56. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  57. package/esm/typings/src/version.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/umd/index.umd.js +37 -10
  60. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('jszip')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'jszip'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.parserHtml, global.parserMarkdown, global.standalone, global.rxjs, global.sha256, global.mimeTypes, global.papaparse, global.readability, global.jsdom, global.showdown, global.dotenv, global.JSZip));
5
- })(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, parserHtml, parserMarkdown, standalone, rxjs, sha256, mimeTypes, papaparse, readability, jsdom, showdown, dotenv, JSZip) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('jszip')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'jszip'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.rxjs, global.sha256, global.mimeTypes, global.papaparse, global.readability, global.jsdom, global.showdown, global.dotenv, global.JSZip));
5
+ })(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, rxjs, sha256, mimeTypes, papaparse, readability, jsdom, showdown, dotenv, JSZip) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -30,8 +30,6 @@
30
30
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
31
31
  var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
32
32
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
33
- var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
34
- var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
35
33
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
36
34
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
37
35
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
@@ -50,7 +48,7 @@
50
48
  * @generated
51
49
  * @see https://github.com/webgptorg/promptbook
52
50
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-0';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-10';
54
52
  /**
55
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -658,6 +656,7 @@
658
656
  /**
659
657
  * Creates a deep clone of the given object
660
658
  *
659
+ * Note: [🔂] This function is idempotent.
661
660
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
662
661
  *
663
662
  * @param objectValue The object to clone.
@@ -842,6 +841,8 @@
842
841
  /**
843
842
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
844
843
  *
844
+ * Note: [🔂] This function is idempotent.
845
+ *
845
846
  * @param text The text string to be converted to SCREAMING_CASE format.
846
847
  * @returns The normalized text in SCREAMING_CASE format.
847
848
  * @example 'HELLO_WORLD'
@@ -897,6 +898,8 @@
897
898
  /**
898
899
  * Normalizes a text string to snake_case format.
899
900
  *
901
+ * Note: [🔂] This function is idempotent.
902
+ *
900
903
  * @param text The text string to be converted to snake_case format.
901
904
  * @returns The normalized text in snake_case format.
902
905
  * @example 'hello_world'
@@ -1419,6 +1422,7 @@
1419
1422
  /**
1420
1423
  * Tests if given string is valid URL.
1421
1424
  *
1425
+ * Note: [🔂] This function is idempotent.
1422
1426
  * Note: Dataurl are considered perfectly valid.
1423
1427
  * Note: There are two similar functions:
1424
1428
  * - `isValidUrl` which tests any URL
@@ -2320,6 +2324,8 @@
2320
2324
  /**
2321
2325
  * Removes diacritic marks (accents) from characters in a string.
2322
2326
  *
2327
+ * Note: [🔂] This function is idempotent.
2328
+ *
2323
2329
  * @param input The string containing diacritics to be normalized.
2324
2330
  * @returns The string with diacritics removed or normalized.
2325
2331
  * @public exported from `@promptbook/utils`
@@ -6221,6 +6227,8 @@
6221
6227
  /**
6222
6228
  * Removes emojis from a string and fix whitespaces
6223
6229
  *
6230
+ * Note: [🔂] This function is idempotent.
6231
+ *
6224
6232
  * @param text with emojis
6225
6233
  * @returns text without emojis
6226
6234
  * @public exported from `@promptbook/utils`
@@ -6472,10 +6480,20 @@
6472
6480
  * @private withing the package because of HUGE size of prettier dependency
6473
6481
  */
6474
6482
  function prettifyMarkdown(content) {
6483
+ // In browser/Next.js environments, just return the original content
6484
+ // since prettier parsers are not available and would cause bundling issues
6485
+ if (typeof window !== 'undefined') {
6486
+ return content;
6487
+ }
6475
6488
  try {
6476
- return standalone.format(content, {
6489
+ // Use dynamic require to avoid static imports that cause bundling issues
6490
+ // This will only work in Node.js environments
6491
+ const prettierStandalone = eval('require')('prettier/standalone');
6492
+ const parserMarkdown = eval('require')('prettier/parser-markdown');
6493
+ const parserHtml = eval('require')('prettier/parser-html');
6494
+ return prettierStandalone.format(content, {
6477
6495
  parser: 'markdown',
6478
- plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
6496
+ plugins: [parserMarkdown, parserHtml],
6479
6497
  // TODO: DRY - make some import or auto-copy of .prettierrc
6480
6498
  endOfLine: 'lf',
6481
6499
  tabWidth: 4,
@@ -6501,6 +6519,8 @@
6501
6519
  /**
6502
6520
  * Makes first letter of a string uppercase
6503
6521
  *
6522
+ * Note: [🔂] This function is idempotent.
6523
+ *
6504
6524
  * @public exported from `@promptbook/utils`
6505
6525
  */
6506
6526
  function capitalize(word) {
@@ -13052,7 +13072,9 @@
13052
13072
  */
13053
13073
 
13054
13074
  /**
13055
- * Makes first letter of a string uppercase
13075
+ * Makes first letter of a string lowercase
13076
+ *
13077
+ * Note: [🔂] This function is idempotent.
13056
13078
  *
13057
13079
  * @public exported from `@promptbook/utils`
13058
13080
  */
@@ -13122,6 +13144,8 @@
13122
13144
  /**
13123
13145
  * Take every whitespace (space, new line, tab) and replace it with a single space
13124
13146
  *
13147
+ * Note: [🔂] This function is idempotent.
13148
+ *
13125
13149
  * @public exported from `@promptbook/utils`
13126
13150
  */
13127
13151
  function normalizeWhitespaces(sentence) {
@@ -13131,6 +13155,7 @@
13131
13155
  /**
13132
13156
  * Function parseNumber will parse number from string
13133
13157
  *
13158
+ * Note: [🔂] This function is idempotent.
13134
13159
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
13135
13160
  * Note: it also works only with decimal numbers
13136
13161
  *
@@ -13199,6 +13224,7 @@
13199
13224
  /**
13200
13225
  * Removes quotes from a string
13201
13226
  *
13227
+ * Note: [🔂] This function is idempotent.
13202
13228
  * Tip: This is very useful for post-processing of the result of the LLM model
13203
13229
  * Note: This function removes only the same quotes from the beginning and the end of the string
13204
13230
  * Note: There are two similar functions:
@@ -13222,6 +13248,7 @@
13222
13248
  /**
13223
13249
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
13224
13250
  *
13251
+ * Note: [🔂] This function is idempotent.
13225
13252
  * Note: This is useful for post-processing of the result of the chat LLM model
13226
13253
  * when the model wraps the result in the (markdown) code block.
13227
13254
  *