@promptbook/documents 0.103.0-56 → 0.103.0-67

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 (29) hide show
  1. package/esm/index.es.js +22 -4
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +2 -2
  4. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  5. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  6. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
  7. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
  8. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
  9. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
  10. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
  11. package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
  12. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
  13. package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
  14. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +4 -0
  15. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
  16. package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
  17. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  18. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  19. package/esm/typings/src/utils/color/Color.d.ts +1 -1
  20. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
  21. package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
  22. package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
  23. package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
  24. package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
  25. package/esm/typings/src/version.d.ts +1 -1
  26. package/package.json +3 -3
  27. package/umd/index.umd.js +22 -4
  28. package/umd/index.umd.js.map +1 -1
  29. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-67';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -309,15 +309,33 @@ class Color {
309
309
  * @param color
310
310
  * @returns Color object
311
311
  */
312
- static from(color) {
313
- if (color instanceof Color) {
312
+ static from(color, _isSingleValue = false) {
313
+ if (color === '') {
314
+ throw new Error(`Can not create color from empty string`);
315
+ }
316
+ else if (color instanceof Color) {
314
317
  return take(color);
315
318
  }
316
319
  else if (Color.isColor(color)) {
317
320
  return take(color);
318
321
  }
319
322
  else if (typeof color === 'string') {
320
- return Color.fromString(color);
323
+ try {
324
+ return Color.fromString(color);
325
+ }
326
+ catch (error) {
327
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
328
+ if (_isSingleValue) {
329
+ throw error;
330
+ }
331
+ const parts = color.split(/[\s+,;|]/);
332
+ if (parts.length > 0) {
333
+ return Color.from(parts[0].trim(), true);
334
+ }
335
+ else {
336
+ throw new Error(`Can not create color from given string "${color}"`);
337
+ }
338
+ }
321
339
  }
322
340
  else {
323
341
  console.error({ color });