@promptbook/cli 0.105.0-6 → 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
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
47
47
  * @generated
48
48
  * @see https://github.com/webgptorg/promptbook
49
49
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-6';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
51
51
  /**
52
52
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
53
53
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4514,6 +4514,16 @@ function unwrapResult(text, options) {
4514
4514
  trimmedText = spaceTrim$1(trimmedText);
4515
4515
  }
4516
4516
  let processedText = trimmedText;
4517
+ // Check for markdown code block
4518
+ const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
4519
+ const codeBlockMatch = processedText.match(codeBlockRegex);
4520
+ if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
4521
+ // Check if there's only one code block
4522
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
4523
+ if (codeBlockCount === 1) {
4524
+ return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
4525
+ }
4526
+ }
4517
4527
  if (isIntroduceSentenceRemoved) {
4518
4528
  const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
4519
4529
  if (introduceSentenceRegex.test(text)) {
@@ -4521,6 +4531,14 @@ function unwrapResult(text, options) {
4521
4531
  processedText = processedText.replace(introduceSentenceRegex, '');
4522
4532
  }
4523
4533
  processedText = spaceTrim$1(processedText);
4534
+ // Check again for code block after removing introduce sentence
4535
+ const codeBlockMatch2 = processedText.match(codeBlockRegex);
4536
+ if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
4537
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
4538
+ if (codeBlockCount === 1) {
4539
+ return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
4540
+ }
4541
+ }
4524
4542
  }
4525
4543
  if (processedText.length < 3) {
4526
4544
  return trimmedText;
@@ -16944,6 +16962,7 @@ const COMMITMENT_REGISTRY = [
16944
16962
  new NoteCommitmentDefinition('NOTES'),
16945
16963
  new NoteCommitmentDefinition('COMMENT'),
16946
16964
  new NoteCommitmentDefinition('NONCE'),
16965
+ new NoteCommitmentDefinition('TODO'),
16947
16966
  new GoalCommitmentDefinition('GOAL'),
16948
16967
  new GoalCommitmentDefinition('GOALS'),
16949
16968
  new InitialMessageCommitmentDefinition(),