@promptbook/remote-server 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
|
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
33
33
|
* @generated
|
|
34
34
|
* @see https://github.com/webgptorg/promptbook
|
|
35
35
|
*/
|
|
36
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
36
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
|
|
37
37
|
/**
|
|
38
38
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
39
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -8161,6 +8161,16 @@ function unwrapResult(text, options) {
|
|
|
8161
8161
|
trimmedText = spaceTrim$1(trimmedText);
|
|
8162
8162
|
}
|
|
8163
8163
|
let processedText = trimmedText;
|
|
8164
|
+
// Check for markdown code block
|
|
8165
|
+
const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
|
|
8166
|
+
const codeBlockMatch = processedText.match(codeBlockRegex);
|
|
8167
|
+
if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
|
|
8168
|
+
// Check if there's only one code block
|
|
8169
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
8170
|
+
if (codeBlockCount === 1) {
|
|
8171
|
+
return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
8172
|
+
}
|
|
8173
|
+
}
|
|
8164
8174
|
if (isIntroduceSentenceRemoved) {
|
|
8165
8175
|
const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
|
|
8166
8176
|
if (introduceSentenceRegex.test(text)) {
|
|
@@ -8168,6 +8178,14 @@ function unwrapResult(text, options) {
|
|
|
8168
8178
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
8169
8179
|
}
|
|
8170
8180
|
processedText = spaceTrim$1(processedText);
|
|
8181
|
+
// Check again for code block after removing introduce sentence
|
|
8182
|
+
const codeBlockMatch2 = processedText.match(codeBlockRegex);
|
|
8183
|
+
if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
|
|
8184
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
8185
|
+
if (codeBlockCount === 1) {
|
|
8186
|
+
return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
8187
|
+
}
|
|
8188
|
+
}
|
|
8171
8189
|
}
|
|
8172
8190
|
if (processedText.length < 3) {
|
|
8173
8191
|
return trimmedText;
|
|
@@ -11887,6 +11905,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
11887
11905
|
new NoteCommitmentDefinition('NOTES'),
|
|
11888
11906
|
new NoteCommitmentDefinition('COMMENT'),
|
|
11889
11907
|
new NoteCommitmentDefinition('NONCE'),
|
|
11908
|
+
new NoteCommitmentDefinition('TODO'),
|
|
11890
11909
|
new GoalCommitmentDefinition('GOAL'),
|
|
11891
11910
|
new GoalCommitmentDefinition('GOALS'),
|
|
11892
11911
|
new InitialMessageCommitmentDefinition(),
|