@promptbook/node 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 +20 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
- package/esm/typings/src/commitments/index.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +7 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/esm/typings/src/utils/misc/linguisticHash.d.ts +6 -0
- package/esm/typings/src/utils/misc/linguisticHash.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +20 -1
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -11830,6 +11830,16 @@ function unwrapResult(text, options) {
|
|
|
11830
11830
|
trimmedText = spaceTrim$1(trimmedText);
|
|
11831
11831
|
}
|
|
11832
11832
|
let processedText = trimmedText;
|
|
11833
|
+
// Check for markdown code block
|
|
11834
|
+
const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
|
|
11835
|
+
const codeBlockMatch = processedText.match(codeBlockRegex);
|
|
11836
|
+
if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
|
|
11837
|
+
// Check if there's only one code block
|
|
11838
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
11839
|
+
if (codeBlockCount === 1) {
|
|
11840
|
+
return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
11841
|
+
}
|
|
11842
|
+
}
|
|
11833
11843
|
if (isIntroduceSentenceRemoved) {
|
|
11834
11844
|
const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
|
|
11835
11845
|
if (introduceSentenceRegex.test(text)) {
|
|
@@ -11837,6 +11847,14 @@ function unwrapResult(text, options) {
|
|
|
11837
11847
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
11838
11848
|
}
|
|
11839
11849
|
processedText = spaceTrim$1(processedText);
|
|
11850
|
+
// Check again for code block after removing introduce sentence
|
|
11851
|
+
const codeBlockMatch2 = processedText.match(codeBlockRegex);
|
|
11852
|
+
if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
|
|
11853
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
11854
|
+
if (codeBlockCount === 1) {
|
|
11855
|
+
return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
11856
|
+
}
|
|
11857
|
+
}
|
|
11840
11858
|
}
|
|
11841
11859
|
if (processedText.length < 3) {
|
|
11842
11860
|
return trimmedText;
|
|
@@ -15590,6 +15608,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
15590
15608
|
new NoteCommitmentDefinition('NOTES'),
|
|
15591
15609
|
new NoteCommitmentDefinition('COMMENT'),
|
|
15592
15610
|
new NoteCommitmentDefinition('NONCE'),
|
|
15611
|
+
new NoteCommitmentDefinition('TODO'),
|
|
15593
15612
|
new GoalCommitmentDefinition('GOAL'),
|
|
15594
15613
|
new GoalCommitmentDefinition('GOALS'),
|
|
15595
15614
|
new InitialMessageCommitmentDefinition(),
|