@promptbook/remote-client 0.82.0-3 → 0.83.0
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/README.md +0 -4
- package/esm/index.es.js +38 -36
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/editable.index.d.ts +74 -0
- package/esm/typings/src/_packages/types.index.d.ts +26 -0
- package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/FormfactorCommand.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/JOKER/JokerCommand.d.ts +1 -1
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -2
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/utils/{sourceContentToName.d.ts → knowledgeSourceContentToName.d.ts} +2 -2
- package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +2 -1
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +2 -1
- package/esm/typings/src/commands/PARAMETER/ParameterCommand.d.ts +1 -1
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +1 -1
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -1
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
- package/esm/typings/src/commands/SECTION/sectionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/URL/UrlCommand.d.ts +1 -1
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_ACTION/ActionCommand.d.ts +1 -1
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +1 -1
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/getParserForCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/stringifyCommand.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +8 -0
- package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +2 -0
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +38 -36
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/commands/KNOWLEDGE/utils/{sourceContentToName.test.d.ts → knowledgeSourceContentToName.test.d.ts} +0 -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.82.0
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.82.0';
|
|
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
|
|
@@ -622,8 +622,7 @@
|
|
|
622
622
|
var socket, preparedPipeline;
|
|
623
623
|
return __generator(this, function (_a) {
|
|
624
624
|
switch (_a.label) {
|
|
625
|
-
case 0:
|
|
626
|
-
return [4 /*yield*/, createRemoteClient(options)];
|
|
625
|
+
case 0: return [4 /*yield*/, createRemoteClient(options)];
|
|
627
626
|
case 1:
|
|
628
627
|
socket = _a.sent();
|
|
629
628
|
socket.emit('preparePipeline-request', {
|
|
@@ -643,7 +642,7 @@
|
|
|
643
642
|
case 2:
|
|
644
643
|
preparedPipeline = _a.sent();
|
|
645
644
|
socket.disconnect();
|
|
646
|
-
// TODO:
|
|
645
|
+
// TODO: [🧠] Maybe do $exportJson
|
|
647
646
|
return [2 /*return*/, preparedPipeline];
|
|
648
647
|
}
|
|
649
648
|
});
|
|
@@ -1091,15 +1090,15 @@
|
|
|
1091
1090
|
/**
|
|
1092
1091
|
* Creates unique name for the source
|
|
1093
1092
|
*
|
|
1094
|
-
* @
|
|
1093
|
+
* @public exported from `@promptbook/editable`
|
|
1095
1094
|
*/
|
|
1096
|
-
function
|
|
1097
|
-
var hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(
|
|
1095
|
+
function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
1096
|
+
var hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
|
|
1098
1097
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
1099
1098
|
.toString( /* hex */)
|
|
1100
1099
|
.substring(0, 20);
|
|
1101
1100
|
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
1102
|
-
var semanticName = normalizeToKebabCase(
|
|
1101
|
+
var semanticName = normalizeToKebabCase(knowledgeSourceContent.substring(0, 20));
|
|
1103
1102
|
var pieces = ['source', semanticName, hash].filter(function (piece) { return piece !== ''; });
|
|
1104
1103
|
var name = pieces.join('-').split('--').join('-');
|
|
1105
1104
|
// <- TODO: Use MAX_FILENAME_LENGTH
|
|
@@ -1113,7 +1112,7 @@
|
|
|
1113
1112
|
* Parses the knowledge command
|
|
1114
1113
|
*
|
|
1115
1114
|
* @see `documentationUrl` for more details
|
|
1116
|
-
* @
|
|
1115
|
+
* @public exported from `@promptbook/editable`
|
|
1117
1116
|
*/
|
|
1118
1117
|
var knowledgeCommandParser = {
|
|
1119
1118
|
/**
|
|
@@ -1149,23 +1148,25 @@
|
|
|
1149
1148
|
*/
|
|
1150
1149
|
parse: function (input) {
|
|
1151
1150
|
var args = input.args;
|
|
1152
|
-
var
|
|
1153
|
-
if (
|
|
1151
|
+
var knowledgeSourceContent = spaceTrim__default["default"](args[0] || '');
|
|
1152
|
+
if (knowledgeSourceContent === '') {
|
|
1154
1153
|
throw new ParseError("Source is not defined");
|
|
1155
1154
|
}
|
|
1156
1155
|
// TODO: [main] !!4 Following checks should be applied every link in the `sourceContent`
|
|
1157
|
-
if (
|
|
1156
|
+
if (knowledgeSourceContent.startsWith('http://')) {
|
|
1158
1157
|
throw new ParseError("Source is not secure");
|
|
1159
1158
|
}
|
|
1160
|
-
if (!(isValidFilePath(
|
|
1159
|
+
if (!(isValidFilePath(knowledgeSourceContent) || isValidUrl(knowledgeSourceContent))) {
|
|
1161
1160
|
throw new ParseError("Source not valid");
|
|
1162
1161
|
}
|
|
1163
|
-
if (
|
|
1162
|
+
if (knowledgeSourceContent.startsWith('../') ||
|
|
1163
|
+
knowledgeSourceContent.startsWith('/') ||
|
|
1164
|
+
/^[A-Z]:[\\/]+/i.test(knowledgeSourceContent)) {
|
|
1164
1165
|
throw new ParseError("Source cannot be outside of the .book.md folder");
|
|
1165
1166
|
}
|
|
1166
1167
|
return {
|
|
1167
1168
|
type: 'KNOWLEDGE',
|
|
1168
|
-
|
|
1169
|
+
knowledgeSourceContent: knowledgeSourceContent,
|
|
1169
1170
|
};
|
|
1170
1171
|
},
|
|
1171
1172
|
/**
|
|
@@ -1174,10 +1175,10 @@
|
|
|
1174
1175
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
1175
1176
|
*/
|
|
1176
1177
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
1177
|
-
var
|
|
1178
|
+
var knowledgeSourceContent = command.knowledgeSourceContent;
|
|
1178
1179
|
$pipelineJson.knowledgeSources.push({
|
|
1179
|
-
name:
|
|
1180
|
-
|
|
1180
|
+
name: knowledgeSourceContentToName(knowledgeSourceContent),
|
|
1181
|
+
knowledgeSourceContent: knowledgeSourceContent,
|
|
1181
1182
|
});
|
|
1182
1183
|
},
|
|
1183
1184
|
/**
|
|
@@ -1205,7 +1206,7 @@
|
|
|
1205
1206
|
* Parses the section command
|
|
1206
1207
|
*
|
|
1207
1208
|
* @see `documentationUrl` for more details
|
|
1208
|
-
* @
|
|
1209
|
+
* @public exported from `@promptbook/editable`
|
|
1209
1210
|
*/
|
|
1210
1211
|
var sectionCommandParser = {
|
|
1211
1212
|
/**
|
|
@@ -1336,7 +1337,7 @@
|
|
|
1336
1337
|
if (command.taskType === 'KNOWLEDGE') {
|
|
1337
1338
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
1338
1339
|
type: 'KNOWLEDGE',
|
|
1339
|
-
|
|
1340
|
+
knowledgeSourceContent: $taskJson.content, // <- TODO: [🐝][main] !!3 Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
1340
1341
|
}, $pipelineJson);
|
|
1341
1342
|
$taskJson.isTask = false;
|
|
1342
1343
|
return;
|
|
@@ -1523,7 +1524,7 @@
|
|
|
1523
1524
|
* Parses the BOOK_VERSION command
|
|
1524
1525
|
*
|
|
1525
1526
|
* @see `documentationUrl` for more details
|
|
1526
|
-
* @
|
|
1527
|
+
* @public exported from `@promptbook/editable`
|
|
1527
1528
|
*/
|
|
1528
1529
|
var bookVersionCommandParser = {
|
|
1529
1530
|
/**
|
|
@@ -1678,7 +1679,7 @@
|
|
|
1678
1679
|
* Parses the expect command
|
|
1679
1680
|
*
|
|
1680
1681
|
* @see `documentationUrl` for more details
|
|
1681
|
-
* @
|
|
1682
|
+
* @public exported from `@promptbook/editable`
|
|
1682
1683
|
*/
|
|
1683
1684
|
var expectCommandParser = {
|
|
1684
1685
|
/**
|
|
@@ -2619,7 +2620,7 @@
|
|
|
2619
2620
|
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
|
|
2620
2621
|
*
|
|
2621
2622
|
* @see `documentationUrl` for more details
|
|
2622
|
-
* @
|
|
2623
|
+
* @public exported from `@promptbook/editable`
|
|
2623
2624
|
*/
|
|
2624
2625
|
var foreachCommandParser = {
|
|
2625
2626
|
/**
|
|
@@ -2773,7 +2774,7 @@
|
|
|
2773
2774
|
* Parses the format command
|
|
2774
2775
|
*
|
|
2775
2776
|
* @see `documentationUrl` for more details
|
|
2776
|
-
* @
|
|
2777
|
+
* @public exported from `@promptbook/editable`
|
|
2777
2778
|
*/
|
|
2778
2779
|
var formatCommandParser = {
|
|
2779
2780
|
/**
|
|
@@ -3070,7 +3071,7 @@
|
|
|
3070
3071
|
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book.md` file
|
|
3071
3072
|
*
|
|
3072
3073
|
* @see `documentationUrl` for more details
|
|
3073
|
-
* @
|
|
3074
|
+
* @public exported from `@promptbook/editable`
|
|
3074
3075
|
*/
|
|
3075
3076
|
var formfactorCommandParser = {
|
|
3076
3077
|
/**
|
|
@@ -3159,7 +3160,7 @@
|
|
|
3159
3160
|
* Parses the joker command
|
|
3160
3161
|
*
|
|
3161
3162
|
* @see `documentationUrl` for more details
|
|
3162
|
-
* @
|
|
3163
|
+
* @public exported from `@promptbook/editable`
|
|
3163
3164
|
*/
|
|
3164
3165
|
var jokerCommandParser = {
|
|
3165
3166
|
/**
|
|
@@ -3236,7 +3237,8 @@
|
|
|
3236
3237
|
* Parses the model command
|
|
3237
3238
|
*
|
|
3238
3239
|
* @see `documentationUrl` for more details
|
|
3239
|
-
* @
|
|
3240
|
+
* @deprecated Option to manually set the model requirements is not recommended to use, use `PERSONA` instead
|
|
3241
|
+
* @public exported from `@promptbook/editable`
|
|
3240
3242
|
*/
|
|
3241
3243
|
var modelCommandParser = {
|
|
3242
3244
|
/**
|
|
@@ -3380,7 +3382,7 @@
|
|
|
3380
3382
|
* Parses the parameter command
|
|
3381
3383
|
*
|
|
3382
3384
|
* @see `documentationUrl` for more details
|
|
3383
|
-
* @
|
|
3385
|
+
* @public exported from `@promptbook/editable`
|
|
3384
3386
|
*/
|
|
3385
3387
|
var parameterCommandParser = {
|
|
3386
3388
|
/**
|
|
@@ -3485,7 +3487,7 @@
|
|
|
3485
3487
|
* Parses the persona command
|
|
3486
3488
|
*
|
|
3487
3489
|
* @see `documentationUrl` for more details
|
|
3488
|
-
* @
|
|
3490
|
+
* @public exported from `@promptbook/editable`
|
|
3489
3491
|
*/
|
|
3490
3492
|
var personaCommandParser = {
|
|
3491
3493
|
/**
|
|
@@ -3620,7 +3622,7 @@
|
|
|
3620
3622
|
* Parses the postprocess command
|
|
3621
3623
|
*
|
|
3622
3624
|
* @see `documentationUrl` for more details
|
|
3623
|
-
* @
|
|
3625
|
+
* @public exported from `@promptbook/editable`
|
|
3624
3626
|
*/
|
|
3625
3627
|
var postprocessCommandParser = {
|
|
3626
3628
|
/**
|
|
@@ -3778,7 +3780,7 @@
|
|
|
3778
3780
|
* Parses the url command
|
|
3779
3781
|
*
|
|
3780
3782
|
* @see `documentationUrl` for more details
|
|
3781
|
-
* @
|
|
3783
|
+
* @public exported from `@promptbook/editable`
|
|
3782
3784
|
*/
|
|
3783
3785
|
var urlCommandParser = {
|
|
3784
3786
|
/**
|
|
@@ -3879,7 +3881,7 @@
|
|
|
3879
3881
|
* Parses the action command
|
|
3880
3882
|
*
|
|
3881
3883
|
* @see `documentationUrl` for more details
|
|
3882
|
-
* @
|
|
3884
|
+
* @public exported from `@promptbook/editable`
|
|
3883
3885
|
*/
|
|
3884
3886
|
var actionCommandParser = {
|
|
3885
3887
|
/**
|
|
@@ -3945,7 +3947,7 @@
|
|
|
3945
3947
|
* Parses the instrument command
|
|
3946
3948
|
*
|
|
3947
3949
|
* @see `documentationUrl` for more details
|
|
3948
|
-
* @
|
|
3950
|
+
* @public exported from `@promptbook/editable`
|
|
3949
3951
|
*/
|
|
3950
3952
|
var instrumentCommandParser = {
|
|
3951
3953
|
/**
|
|
@@ -4010,7 +4012,7 @@
|
|
|
4010
4012
|
/**
|
|
4011
4013
|
* All available command parsers
|
|
4012
4014
|
*
|
|
4013
|
-
* @
|
|
4015
|
+
* @public exported from `@promptbook/editable`
|
|
4014
4016
|
*/
|
|
4015
4017
|
var COMMANDS = [
|
|
4016
4018
|
sectionCommandParser,
|
|
@@ -4041,7 +4043,7 @@
|
|
|
4041
4043
|
* @returns the parser for the command
|
|
4042
4044
|
* @throws {UnexpectedError} if the parser is not found
|
|
4043
4045
|
*
|
|
4044
|
-
* @
|
|
4046
|
+
* @public exported from `@promptbook/editable`
|
|
4045
4047
|
*/
|
|
4046
4048
|
function getParserForCommand(command) {
|
|
4047
4049
|
var commandParser = COMMANDS.find(function (commandParser) { return commandParser.name === command.type; });
|
|
@@ -4077,7 +4079,7 @@
|
|
|
4077
4079
|
* @returns parsed command object
|
|
4078
4080
|
* @throws {ParseError} if the command is invalid
|
|
4079
4081
|
*
|
|
4080
|
-
* @
|
|
4082
|
+
* @public exported from `@promptbook/editable`
|
|
4081
4083
|
*/
|
|
4082
4084
|
function parseCommand(raw, usagePlace) {
|
|
4083
4085
|
if (raw.includes('\n') || raw.includes('\r')) {
|