@promptbook/wizard 0.105.0-5 → 0.105.0-7

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
@@ -36,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
36
36
  * @generated
37
37
  * @see https://github.com/webgptorg/promptbook
38
38
  */
39
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
39
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
40
40
  /**
41
41
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
42
42
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -7493,6 +7493,17 @@ function computeHash(value) {
7493
7493
  * TODO: [🥬][🥬] Use this ACRY
7494
7494
  */
7495
7495
 
7496
+ /**
7497
+ * Makes first letter of a string uppercase
7498
+ *
7499
+ * Note: [🔂] This function is idempotent.
7500
+ *
7501
+ * @public exported from `@promptbook/utils`
7502
+ */
7503
+ function capitalize(word) {
7504
+ return word.substring(0, 1).toUpperCase() + word.substring(1);
7505
+ }
7506
+
7496
7507
  /**
7497
7508
  * Function parseNumber will parse number from string
7498
7509
  *
@@ -7565,17 +7576,6 @@ function parseNumber(value) {
7565
7576
  * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
7566
7577
  */
7567
7578
 
7568
- /**
7569
- * Makes first letter of a string uppercase
7570
- *
7571
- * Note: [🔂] This function is idempotent.
7572
- *
7573
- * @public exported from `@promptbook/utils`
7574
- */
7575
- function capitalize(word) {
7576
- return word.substring(0, 1).toUpperCase() + word.substring(1);
7577
- }
7578
-
7579
7579
  /**
7580
7580
  * Makes first letter of a string lowercase
7581
7581
  *
@@ -7705,6 +7705,16 @@ function unwrapResult(text, options) {
7705
7705
  trimmedText = spaceTrim$1(trimmedText);
7706
7706
  }
7707
7707
  let processedText = trimmedText;
7708
+ // Check for markdown code block
7709
+ const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
7710
+ const codeBlockMatch = processedText.match(codeBlockRegex);
7711
+ if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
7712
+ // Check if there's only one code block
7713
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
7714
+ if (codeBlockCount === 1) {
7715
+ return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
7716
+ }
7717
+ }
7708
7718
  if (isIntroduceSentenceRemoved) {
7709
7719
  const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
7710
7720
  if (introduceSentenceRegex.test(text)) {
@@ -7712,6 +7722,14 @@ function unwrapResult(text, options) {
7712
7722
  processedText = processedText.replace(introduceSentenceRegex, '');
7713
7723
  }
7714
7724
  processedText = spaceTrim$1(processedText);
7725
+ // Check again for code block after removing introduce sentence
7726
+ const codeBlockMatch2 = processedText.match(codeBlockRegex);
7727
+ if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
7728
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
7729
+ if (codeBlockCount === 1) {
7730
+ return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
7731
+ }
7732
+ }
7715
7733
  }
7716
7734
  if (processedText.length < 3) {
7717
7735
  return trimmedText;
@@ -18049,6 +18067,7 @@ const COMMITMENT_REGISTRY = [
18049
18067
  new NoteCommitmentDefinition('NOTES'),
18050
18068
  new NoteCommitmentDefinition('COMMENT'),
18051
18069
  new NoteCommitmentDefinition('NONCE'),
18070
+ new NoteCommitmentDefinition('TODO'),
18052
18071
  new GoalCommitmentDefinition('GOAL'),
18053
18072
  new GoalCommitmentDefinition('GOALS'),
18054
18073
  new InitialMessageCommitmentDefinition(),