@promptbook/editable 0.84.0-12 → 0.84.0-14
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 +32 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +12 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +32 -6
- package/umd/index.umd.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/editable",
|
|
3
|
-
"version": "0.84.0-
|
|
3
|
+
"version": "0.84.0-14",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/editable.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.84.0-
|
|
57
|
+
"@promptbook/core": "0.84.0-14"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"crypto-js": "4.2.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-13';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -194,6 +194,12 @@
|
|
|
194
194
|
* @public exported from `@promptbook/core`
|
|
195
195
|
*/
|
|
196
196
|
var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
197
|
+
/**
|
|
198
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
199
|
+
*
|
|
200
|
+
* @public exported from `@promptbook/core`
|
|
201
|
+
*/
|
|
202
|
+
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
197
203
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
198
204
|
/**
|
|
199
205
|
* The maximum number of iterations for a loops
|
|
@@ -3938,12 +3944,15 @@
|
|
|
3938
3944
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
3939
3945
|
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
3940
3946
|
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
3941
|
-
|
|
3942
|
-
|
|
3947
|
+
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
3948
|
+
var isBacktickBlockUsed = pipelineString.includes('```');
|
|
3949
|
+
var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
|
|
3950
|
+
var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
|
|
3951
|
+
// TODO: [🧉] Also (double)check
|
|
3943
3952
|
// > const usedCommands
|
|
3944
3953
|
// > const isBlocksUsed
|
|
3945
3954
|
// > const returnStatementCount
|
|
3946
|
-
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement
|
|
3955
|
+
var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
|
|
3947
3956
|
return isFlat;
|
|
3948
3957
|
}
|
|
3949
3958
|
|
|
@@ -3957,9 +3966,26 @@
|
|
|
3957
3966
|
return pipelineString;
|
|
3958
3967
|
}
|
|
3959
3968
|
var pipelineStringLines = pipelineString.split('\n');
|
|
3960
|
-
var
|
|
3969
|
+
var potentialReturnStatement = pipelineStringLines.pop();
|
|
3970
|
+
var returnStatement;
|
|
3971
|
+
if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
|
|
3972
|
+
// Note: Last line is return statement
|
|
3973
|
+
returnStatement = potentialReturnStatement;
|
|
3974
|
+
}
|
|
3975
|
+
else {
|
|
3976
|
+
// Note: Last line is not a return statement
|
|
3977
|
+
returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
|
|
3978
|
+
pipelineStringLines.push(potentialReturnStatement);
|
|
3979
|
+
}
|
|
3961
3980
|
var prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
|
|
3962
|
-
|
|
3981
|
+
var quotedPrompt;
|
|
3982
|
+
if (prompt.split('\n').length <= 1) {
|
|
3983
|
+
quotedPrompt = "> ".concat(prompt);
|
|
3984
|
+
}
|
|
3985
|
+
else {
|
|
3986
|
+
quotedPrompt = spaceTrim__default["default"](function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
|
|
3987
|
+
}
|
|
3988
|
+
pipelineString = validatePipelineString(spaceTrim__default["default"](function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
|
|
3963
3989
|
// <- TODO: Maybe use book` notation
|
|
3964
3990
|
return pipelineString;
|
|
3965
3991
|
}
|