@promptbook/remote-client 0.84.0-13 β 0.84.0-15
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/LICENSE.md +1 -0
- package/README.md +3 -3
- 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 +3 -15
- package/umd/index.umd.js +32 -6
- package/umd/index.umd.js.map +1 -1
|
@@ -12,6 +12,8 @@ import { LOGO_LIGHT_SRC } from '../config';
|
|
|
12
12
|
import { LOGO_DARK_SRC } from '../config';
|
|
13
13
|
import { DEFAULT_BOOK_TITLE } from '../config';
|
|
14
14
|
import { DEFAULT_TASK_TITLE } from '../config';
|
|
15
|
+
import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
|
|
16
|
+
import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
|
|
15
17
|
import { MAX_FILENAME_LENGTH } from '../config';
|
|
16
18
|
import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
|
|
17
19
|
import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
|
|
@@ -139,6 +141,8 @@ export { LOGO_LIGHT_SRC };
|
|
|
139
141
|
export { LOGO_DARK_SRC };
|
|
140
142
|
export { DEFAULT_BOOK_TITLE };
|
|
141
143
|
export { DEFAULT_TASK_TITLE };
|
|
144
|
+
export { DEFAULT_PROMPT_TASK_TITLE };
|
|
145
|
+
export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
|
|
142
146
|
export { MAX_FILENAME_LENGTH };
|
|
143
147
|
export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
|
|
144
148
|
export { DEFAULT_MAX_PARALLEL_COUNT };
|
|
@@ -65,6 +65,18 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
|
65
65
|
* @public exported from `@promptbook/core`
|
|
66
66
|
*/
|
|
67
67
|
export declare const DEFAULT_TASK_TITLE = "Task";
|
|
68
|
+
/**
|
|
69
|
+
* When the title of the prompt task is not provided, the default title is used
|
|
70
|
+
*
|
|
71
|
+
* @public exported from `@promptbook/core`
|
|
72
|
+
*/
|
|
73
|
+
export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
|
|
74
|
+
/**
|
|
75
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
76
|
+
*
|
|
77
|
+
* @public exported from `@promptbook/core`
|
|
78
|
+
*/
|
|
79
|
+
export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
|
|
68
80
|
/**
|
|
69
81
|
* Warning message for the generated sections and files files
|
|
70
82
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { string_file_extension } from '../../types/typeAliases';
|
|
2
|
+
import type { string_mime_type } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Convert mime type to file extension
|
|
5
|
+
*
|
|
6
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
7
|
+
*
|
|
8
|
+
* @private within the repository
|
|
9
|
+
*/
|
|
10
|
+
export declare function mimeTypeToExtension(value: string_mime_type): string_file_extension | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.84.0-
|
|
3
|
+
"version": "0.84.0-15",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
|
-
"--note-0": " <- [π]",
|
|
6
5
|
"private": false,
|
|
7
6
|
"sideEffects": false,
|
|
8
7
|
"repository": {
|
|
@@ -12,7 +11,6 @@
|
|
|
12
11
|
"contributors": [
|
|
13
12
|
"Pavol HejnΓ½ <pavol@ptbk.io> (https://www.pavolhejny.com/)"
|
|
14
13
|
],
|
|
15
|
-
"--todo-0": "TODO: [βοΈ] Make better list of keywords",
|
|
16
14
|
"keywords": [
|
|
17
15
|
"ai",
|
|
18
16
|
"llm",
|
|
@@ -35,26 +33,16 @@
|
|
|
35
33
|
"anthropic",
|
|
36
34
|
"LLMOps"
|
|
37
35
|
],
|
|
38
|
-
"license": "
|
|
36
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
39
37
|
"bugs": {
|
|
40
38
|
"url": "https://github.com/webgptorg/promptbook/issues"
|
|
41
39
|
},
|
|
42
40
|
"homepage": "https://www.npmjs.com/package/@promptbook/core",
|
|
43
|
-
"funding": [
|
|
44
|
-
{
|
|
45
|
-
"type": "individual",
|
|
46
|
-
"url": "https://buymeacoffee.com/hejny"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"type": "github",
|
|
50
|
-
"url": "https://github.com/webgptorg/promptbook/blob/main/README.md#%EF%B8%8F-contributing"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
41
|
"main": "./umd/index.umd.js",
|
|
54
42
|
"module": "./esm/index.es.js",
|
|
55
43
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
56
44
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.84.0-
|
|
45
|
+
"@promptbook/core": "0.84.0-15"
|
|
58
46
|
},
|
|
59
47
|
"dependencies": {
|
|
60
48
|
"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-14';
|
|
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
|
|
@@ -434,6 +434,12 @@
|
|
|
434
434
|
* @public exported from `@promptbook/core`
|
|
435
435
|
*/
|
|
436
436
|
var DEFAULT_TASK_TITLE = "Task";
|
|
437
|
+
/**
|
|
438
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
439
|
+
*
|
|
440
|
+
* @public exported from `@promptbook/core`
|
|
441
|
+
*/
|
|
442
|
+
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
437
443
|
/**
|
|
438
444
|
* Timeout for the connections in milliseconds
|
|
439
445
|
*
|
|
@@ -4584,12 +4590,15 @@
|
|
|
4584
4590
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
4585
4591
|
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
4586
4592
|
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4587
|
-
|
|
4588
|
-
|
|
4593
|
+
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
4594
|
+
var isBacktickBlockUsed = pipelineString.includes('```');
|
|
4595
|
+
var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
|
|
4596
|
+
var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
|
|
4597
|
+
// TODO: [π§] Also (double)check
|
|
4589
4598
|
// > const usedCommands
|
|
4590
4599
|
// > const isBlocksUsed
|
|
4591
4600
|
// > const returnStatementCount
|
|
4592
|
-
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement
|
|
4601
|
+
var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
|
|
4593
4602
|
return isFlat;
|
|
4594
4603
|
}
|
|
4595
4604
|
|
|
@@ -4603,9 +4612,26 @@
|
|
|
4603
4612
|
return pipelineString;
|
|
4604
4613
|
}
|
|
4605
4614
|
var pipelineStringLines = pipelineString.split('\n');
|
|
4606
|
-
var
|
|
4615
|
+
var potentialReturnStatement = pipelineStringLines.pop();
|
|
4616
|
+
var returnStatement;
|
|
4617
|
+
if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
|
|
4618
|
+
// Note: Last line is return statement
|
|
4619
|
+
returnStatement = potentialReturnStatement;
|
|
4620
|
+
}
|
|
4621
|
+
else {
|
|
4622
|
+
// Note: Last line is not a return statement
|
|
4623
|
+
returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
|
|
4624
|
+
pipelineStringLines.push(potentialReturnStatement);
|
|
4625
|
+
}
|
|
4607
4626
|
var prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
|
|
4608
|
-
|
|
4627
|
+
var quotedPrompt;
|
|
4628
|
+
if (prompt.split('\n').length <= 1) {
|
|
4629
|
+
quotedPrompt = "> ".concat(prompt);
|
|
4630
|
+
}
|
|
4631
|
+
else {
|
|
4632
|
+
quotedPrompt = spaceTrim__default["default"](function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
|
|
4633
|
+
}
|
|
4634
|
+
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 "); }));
|
|
4609
4635
|
// <- TODO: Maybe use book` notation
|
|
4610
4636
|
return pipelineString;
|
|
4611
4637
|
}
|