@promptbook/fake-llm 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
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
20
20
  * @generated
21
21
  * @see https://github.com/webgptorg/promptbook
22
22
  */
23
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
23
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
26
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2775,6 +2775,16 @@ function unwrapResult(text, options) {
2775
2775
  trimmedText = spaceTrim$1(trimmedText);
2776
2776
  }
2777
2777
  let processedText = trimmedText;
2778
+ // Check for markdown code block
2779
+ const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
2780
+ const codeBlockMatch = processedText.match(codeBlockRegex);
2781
+ if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
2782
+ // Check if there's only one code block
2783
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
2784
+ if (codeBlockCount === 1) {
2785
+ return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
2786
+ }
2787
+ }
2778
2788
  if (isIntroduceSentenceRemoved) {
2779
2789
  const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
2780
2790
  if (introduceSentenceRegex.test(text)) {
@@ -2782,6 +2792,14 @@ function unwrapResult(text, options) {
2782
2792
  processedText = processedText.replace(introduceSentenceRegex, '');
2783
2793
  }
2784
2794
  processedText = spaceTrim$1(processedText);
2795
+ // Check again for code block after removing introduce sentence
2796
+ const codeBlockMatch2 = processedText.match(codeBlockRegex);
2797
+ if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
2798
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
2799
+ if (codeBlockCount === 1) {
2800
+ return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
2801
+ }
2802
+ }
2785
2803
  }
2786
2804
  if (processedText.length < 3) {
2787
2805
  return trimmedText;
@@ -6501,6 +6519,7 @@ const COMMITMENT_REGISTRY = [
6501
6519
  new NoteCommitmentDefinition('NOTES'),
6502
6520
  new NoteCommitmentDefinition('COMMENT'),
6503
6521
  new NoteCommitmentDefinition('NONCE'),
6522
+ new NoteCommitmentDefinition('TODO'),
6504
6523
  new GoalCommitmentDefinition('GOAL'),
6505
6524
  new GoalCommitmentDefinition('GOALS'),
6506
6525
  new InitialMessageCommitmentDefinition(),