@promptbook/remote-client 0.82.0 → 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/esm/index.es.js +36 -33
- 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 +36 -33
- 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/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.82.0
|
|
22
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.82.0';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1086,15 +1086,15 @@ function normalizeToKebabCase(text) {
|
|
|
1086
1086
|
/**
|
|
1087
1087
|
* Creates unique name for the source
|
|
1088
1088
|
*
|
|
1089
|
-
* @
|
|
1089
|
+
* @public exported from `@promptbook/editable`
|
|
1090
1090
|
*/
|
|
1091
|
-
function
|
|
1092
|
-
var hash = SHA256(hexEncoder.parse(JSON.stringify(
|
|
1091
|
+
function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
1092
|
+
var hash = SHA256(hexEncoder.parse(JSON.stringify(knowledgeSourceContent)))
|
|
1093
1093
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
1094
1094
|
.toString( /* hex */)
|
|
1095
1095
|
.substring(0, 20);
|
|
1096
1096
|
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
1097
|
-
var semanticName = normalizeToKebabCase(
|
|
1097
|
+
var semanticName = normalizeToKebabCase(knowledgeSourceContent.substring(0, 20));
|
|
1098
1098
|
var pieces = ['source', semanticName, hash].filter(function (piece) { return piece !== ''; });
|
|
1099
1099
|
var name = pieces.join('-').split('--').join('-');
|
|
1100
1100
|
// <- TODO: Use MAX_FILENAME_LENGTH
|
|
@@ -1108,7 +1108,7 @@ function sourceContentToName(sourceContent) {
|
|
|
1108
1108
|
* Parses the knowledge command
|
|
1109
1109
|
*
|
|
1110
1110
|
* @see `documentationUrl` for more details
|
|
1111
|
-
* @
|
|
1111
|
+
* @public exported from `@promptbook/editable`
|
|
1112
1112
|
*/
|
|
1113
1113
|
var knowledgeCommandParser = {
|
|
1114
1114
|
/**
|
|
@@ -1144,23 +1144,25 @@ var knowledgeCommandParser = {
|
|
|
1144
1144
|
*/
|
|
1145
1145
|
parse: function (input) {
|
|
1146
1146
|
var args = input.args;
|
|
1147
|
-
var
|
|
1148
|
-
if (
|
|
1147
|
+
var knowledgeSourceContent = spaceTrim$1(args[0] || '');
|
|
1148
|
+
if (knowledgeSourceContent === '') {
|
|
1149
1149
|
throw new ParseError("Source is not defined");
|
|
1150
1150
|
}
|
|
1151
1151
|
// TODO: [main] !!4 Following checks should be applied every link in the `sourceContent`
|
|
1152
|
-
if (
|
|
1152
|
+
if (knowledgeSourceContent.startsWith('http://')) {
|
|
1153
1153
|
throw new ParseError("Source is not secure");
|
|
1154
1154
|
}
|
|
1155
|
-
if (!(isValidFilePath(
|
|
1155
|
+
if (!(isValidFilePath(knowledgeSourceContent) || isValidUrl(knowledgeSourceContent))) {
|
|
1156
1156
|
throw new ParseError("Source not valid");
|
|
1157
1157
|
}
|
|
1158
|
-
if (
|
|
1158
|
+
if (knowledgeSourceContent.startsWith('../') ||
|
|
1159
|
+
knowledgeSourceContent.startsWith('/') ||
|
|
1160
|
+
/^[A-Z]:[\\/]+/i.test(knowledgeSourceContent)) {
|
|
1159
1161
|
throw new ParseError("Source cannot be outside of the .book.md folder");
|
|
1160
1162
|
}
|
|
1161
1163
|
return {
|
|
1162
1164
|
type: 'KNOWLEDGE',
|
|
1163
|
-
|
|
1165
|
+
knowledgeSourceContent: knowledgeSourceContent,
|
|
1164
1166
|
};
|
|
1165
1167
|
},
|
|
1166
1168
|
/**
|
|
@@ -1169,10 +1171,10 @@ var knowledgeCommandParser = {
|
|
|
1169
1171
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
1170
1172
|
*/
|
|
1171
1173
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
1172
|
-
var
|
|
1174
|
+
var knowledgeSourceContent = command.knowledgeSourceContent;
|
|
1173
1175
|
$pipelineJson.knowledgeSources.push({
|
|
1174
|
-
name:
|
|
1175
|
-
|
|
1176
|
+
name: knowledgeSourceContentToName(knowledgeSourceContent),
|
|
1177
|
+
knowledgeSourceContent: knowledgeSourceContent,
|
|
1176
1178
|
});
|
|
1177
1179
|
},
|
|
1178
1180
|
/**
|
|
@@ -1200,7 +1202,7 @@ var knowledgeCommandParser = {
|
|
|
1200
1202
|
* Parses the section command
|
|
1201
1203
|
*
|
|
1202
1204
|
* @see `documentationUrl` for more details
|
|
1203
|
-
* @
|
|
1205
|
+
* @public exported from `@promptbook/editable`
|
|
1204
1206
|
*/
|
|
1205
1207
|
var sectionCommandParser = {
|
|
1206
1208
|
/**
|
|
@@ -1331,7 +1333,7 @@ var sectionCommandParser = {
|
|
|
1331
1333
|
if (command.taskType === 'KNOWLEDGE') {
|
|
1332
1334
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
1333
1335
|
type: 'KNOWLEDGE',
|
|
1334
|
-
|
|
1336
|
+
knowledgeSourceContent: $taskJson.content, // <- TODO: [🐝][main] !!3 Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
1335
1337
|
}, $pipelineJson);
|
|
1336
1338
|
$taskJson.isTask = false;
|
|
1337
1339
|
return;
|
|
@@ -1518,7 +1520,7 @@ function isValidPromptbookVersion(version) {
|
|
|
1518
1520
|
* Parses the BOOK_VERSION command
|
|
1519
1521
|
*
|
|
1520
1522
|
* @see `documentationUrl` for more details
|
|
1521
|
-
* @
|
|
1523
|
+
* @public exported from `@promptbook/editable`
|
|
1522
1524
|
*/
|
|
1523
1525
|
var bookVersionCommandParser = {
|
|
1524
1526
|
/**
|
|
@@ -1673,7 +1675,7 @@ function parseNumber(value) {
|
|
|
1673
1675
|
* Parses the expect command
|
|
1674
1676
|
*
|
|
1675
1677
|
* @see `documentationUrl` for more details
|
|
1676
|
-
* @
|
|
1678
|
+
* @public exported from `@promptbook/editable`
|
|
1677
1679
|
*/
|
|
1678
1680
|
var expectCommandParser = {
|
|
1679
1681
|
/**
|
|
@@ -2614,7 +2616,7 @@ function validateParameterName(parameterName) {
|
|
|
2614
2616
|
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
|
|
2615
2617
|
*
|
|
2616
2618
|
* @see `documentationUrl` for more details
|
|
2617
|
-
* @
|
|
2619
|
+
* @public exported from `@promptbook/editable`
|
|
2618
2620
|
*/
|
|
2619
2621
|
var foreachCommandParser = {
|
|
2620
2622
|
/**
|
|
@@ -2768,7 +2770,7 @@ var foreachCommandParser = {
|
|
|
2768
2770
|
* Parses the format command
|
|
2769
2771
|
*
|
|
2770
2772
|
* @see `documentationUrl` for more details
|
|
2771
|
-
* @
|
|
2773
|
+
* @public exported from `@promptbook/editable`
|
|
2772
2774
|
*/
|
|
2773
2775
|
var formatCommandParser = {
|
|
2774
2776
|
/**
|
|
@@ -3065,7 +3067,7 @@ var FORMFACTOR_DEFINITIONS = [
|
|
|
3065
3067
|
* Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book.md` file
|
|
3066
3068
|
*
|
|
3067
3069
|
* @see `documentationUrl` for more details
|
|
3068
|
-
* @
|
|
3070
|
+
* @public exported from `@promptbook/editable`
|
|
3069
3071
|
*/
|
|
3070
3072
|
var formfactorCommandParser = {
|
|
3071
3073
|
/**
|
|
@@ -3154,7 +3156,7 @@ var formfactorCommandParser = {
|
|
|
3154
3156
|
* Parses the joker command
|
|
3155
3157
|
*
|
|
3156
3158
|
* @see `documentationUrl` for more details
|
|
3157
|
-
* @
|
|
3159
|
+
* @public exported from `@promptbook/editable`
|
|
3158
3160
|
*/
|
|
3159
3161
|
var jokerCommandParser = {
|
|
3160
3162
|
/**
|
|
@@ -3231,7 +3233,8 @@ var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /*
|
|
|
3231
3233
|
* Parses the model command
|
|
3232
3234
|
*
|
|
3233
3235
|
* @see `documentationUrl` for more details
|
|
3234
|
-
* @
|
|
3236
|
+
* @deprecated Option to manually set the model requirements is not recommended to use, use `PERSONA` instead
|
|
3237
|
+
* @public exported from `@promptbook/editable`
|
|
3235
3238
|
*/
|
|
3236
3239
|
var modelCommandParser = {
|
|
3237
3240
|
/**
|
|
@@ -3375,7 +3378,7 @@ var modelCommandParser = {
|
|
|
3375
3378
|
* Parses the parameter command
|
|
3376
3379
|
*
|
|
3377
3380
|
* @see `documentationUrl` for more details
|
|
3378
|
-
* @
|
|
3381
|
+
* @public exported from `@promptbook/editable`
|
|
3379
3382
|
*/
|
|
3380
3383
|
var parameterCommandParser = {
|
|
3381
3384
|
/**
|
|
@@ -3480,7 +3483,7 @@ var parameterCommandParser = {
|
|
|
3480
3483
|
* Parses the persona command
|
|
3481
3484
|
*
|
|
3482
3485
|
* @see `documentationUrl` for more details
|
|
3483
|
-
* @
|
|
3486
|
+
* @public exported from `@promptbook/editable`
|
|
3484
3487
|
*/
|
|
3485
3488
|
var personaCommandParser = {
|
|
3486
3489
|
/**
|
|
@@ -3615,7 +3618,7 @@ function isValidJavascriptName(javascriptName) {
|
|
|
3615
3618
|
* Parses the postprocess command
|
|
3616
3619
|
*
|
|
3617
3620
|
* @see `documentationUrl` for more details
|
|
3618
|
-
* @
|
|
3621
|
+
* @public exported from `@promptbook/editable`
|
|
3619
3622
|
*/
|
|
3620
3623
|
var postprocessCommandParser = {
|
|
3621
3624
|
/**
|
|
@@ -3773,7 +3776,7 @@ function isValidPipelineUrl(url) {
|
|
|
3773
3776
|
* Parses the url command
|
|
3774
3777
|
*
|
|
3775
3778
|
* @see `documentationUrl` for more details
|
|
3776
|
-
* @
|
|
3779
|
+
* @public exported from `@promptbook/editable`
|
|
3777
3780
|
*/
|
|
3778
3781
|
var urlCommandParser = {
|
|
3779
3782
|
/**
|
|
@@ -3874,7 +3877,7 @@ var urlCommandParser = {
|
|
|
3874
3877
|
* Parses the action command
|
|
3875
3878
|
*
|
|
3876
3879
|
* @see `documentationUrl` for more details
|
|
3877
|
-
* @
|
|
3880
|
+
* @public exported from `@promptbook/editable`
|
|
3878
3881
|
*/
|
|
3879
3882
|
var actionCommandParser = {
|
|
3880
3883
|
/**
|
|
@@ -3940,7 +3943,7 @@ var actionCommandParser = {
|
|
|
3940
3943
|
* Parses the instrument command
|
|
3941
3944
|
*
|
|
3942
3945
|
* @see `documentationUrl` for more details
|
|
3943
|
-
* @
|
|
3946
|
+
* @public exported from `@promptbook/editable`
|
|
3944
3947
|
*/
|
|
3945
3948
|
var instrumentCommandParser = {
|
|
3946
3949
|
/**
|
|
@@ -4005,7 +4008,7 @@ var instrumentCommandParser = {
|
|
|
4005
4008
|
/**
|
|
4006
4009
|
* All available command parsers
|
|
4007
4010
|
*
|
|
4008
|
-
* @
|
|
4011
|
+
* @public exported from `@promptbook/editable`
|
|
4009
4012
|
*/
|
|
4010
4013
|
var COMMANDS = [
|
|
4011
4014
|
sectionCommandParser,
|
|
@@ -4036,7 +4039,7 @@ var COMMANDS = [
|
|
|
4036
4039
|
* @returns the parser for the command
|
|
4037
4040
|
* @throws {UnexpectedError} if the parser is not found
|
|
4038
4041
|
*
|
|
4039
|
-
* @
|
|
4042
|
+
* @public exported from `@promptbook/editable`
|
|
4040
4043
|
*/
|
|
4041
4044
|
function getParserForCommand(command) {
|
|
4042
4045
|
var commandParser = COMMANDS.find(function (commandParser) { return commandParser.name === command.type; });
|
|
@@ -4072,7 +4075,7 @@ function removeMarkdownFormatting(str) {
|
|
|
4072
4075
|
* @returns parsed command object
|
|
4073
4076
|
* @throws {ParseError} if the command is invalid
|
|
4074
4077
|
*
|
|
4075
|
-
* @
|
|
4078
|
+
* @public exported from `@promptbook/editable`
|
|
4076
4079
|
*/
|
|
4077
4080
|
function parseCommand(raw, usagePlace) {
|
|
4078
4081
|
if (raw.includes('\n') || raw.includes('\r')) {
|