@promptbook/remote-client 0.103.0-55 → 0.103.0-56
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 +102 -68
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +6 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/{IMPORTANT/IMPORTANT.d.ts → USE_MCP/USE_MCP.d.ts} +16 -5
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/utils/color/Color.d.ts +8 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +64 -30
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commitments/registry.d.ts +0 -68
- package/esm/typings/src/playground/playground1.d.ts +0 -2
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
-
})(this, (function (exports, spaceTrim, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim$1, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
11
11
|
|
|
12
12
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
|
|
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
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
*/
|
|
164
164
|
class MissingToolsError extends Error {
|
|
165
165
|
constructor(message) {
|
|
166
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
166
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
167
167
|
${block(message)}
|
|
168
168
|
|
|
169
169
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
*/
|
|
208
208
|
class NotYetImplementedError extends Error {
|
|
209
209
|
constructor(message) {
|
|
210
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
210
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
211
211
|
${block(message)}
|
|
212
212
|
|
|
213
213
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -314,6 +314,17 @@
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Trims string from all 4 sides
|
|
319
|
+
*
|
|
320
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
321
|
+
* Developed by same author @hejny as this package
|
|
322
|
+
*
|
|
323
|
+
* @public exported from `@promptbook/utils`
|
|
324
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
325
|
+
*/
|
|
326
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
327
|
+
|
|
317
328
|
/**
|
|
318
329
|
* @private util of `@promptbook/color`
|
|
319
330
|
* @de
|
|
@@ -362,6 +373,7 @@
|
|
|
362
373
|
* @public exported from `@promptbook/color`
|
|
363
374
|
*/
|
|
364
375
|
const CSS_COLORS = {
|
|
376
|
+
promptbook: '#79EAFD',
|
|
365
377
|
transparent: 'rgba(0,0,0,0)',
|
|
366
378
|
aliceblue: '#f0f8ff',
|
|
367
379
|
antiquewhite: '#faebd7',
|
|
@@ -577,6 +589,28 @@
|
|
|
577
589
|
throw new Error(`Can not create color from given object`);
|
|
578
590
|
}
|
|
579
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Creates a new Color instance from miscellaneous formats
|
|
594
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
595
|
+
*
|
|
596
|
+
* @param color
|
|
597
|
+
* @returns Color object
|
|
598
|
+
*/
|
|
599
|
+
static fromSafe(color) {
|
|
600
|
+
try {
|
|
601
|
+
return Color.from(color);
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
605
|
+
console.warn(spaceTrim((block) => `
|
|
606
|
+
Color.fromSafe error:
|
|
607
|
+
${block(error.message)}
|
|
608
|
+
|
|
609
|
+
Returning default PROMPTBOOK_COLOR.
|
|
610
|
+
`));
|
|
611
|
+
return Color.fromString('promptbook');
|
|
612
|
+
}
|
|
613
|
+
}
|
|
580
614
|
/**
|
|
581
615
|
* Creates a new Color instance from miscellaneous string formats
|
|
582
616
|
*
|
|
@@ -1186,7 +1220,7 @@
|
|
|
1186
1220
|
*
|
|
1187
1221
|
* @public exported from `@promptbook/core`
|
|
1188
1222
|
*/
|
|
1189
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1223
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
1190
1224
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1191
1225
|
/**
|
|
1192
1226
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1334,7 +1368,7 @@
|
|
|
1334
1368
|
*/
|
|
1335
1369
|
class UnexpectedError extends Error {
|
|
1336
1370
|
constructor(message) {
|
|
1337
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1371
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1338
1372
|
${block(message)}
|
|
1339
1373
|
|
|
1340
1374
|
Note: This error should not happen.
|
|
@@ -1360,7 +1394,7 @@
|
|
|
1360
1394
|
constructor(whatWasThrown) {
|
|
1361
1395
|
const tag = `[🤮]`;
|
|
1362
1396
|
console.error(tag, whatWasThrown);
|
|
1363
|
-
super(spaceTrim.spaceTrim(`
|
|
1397
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1364
1398
|
Non-Error object was thrown
|
|
1365
1399
|
|
|
1366
1400
|
Note: Look for ${tag} in the console for more details
|
|
@@ -5081,7 +5115,7 @@
|
|
|
5081
5115
|
function getParserForCommand(command) {
|
|
5082
5116
|
const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
|
|
5083
5117
|
if (commandParser === undefined) {
|
|
5084
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5118
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5085
5119
|
Command ${command.type} parser is not found
|
|
5086
5120
|
|
|
5087
5121
|
${block(JSON.stringify(command, null, 4)
|
|
@@ -5157,7 +5191,7 @@
|
|
|
5157
5191
|
.map(removeMarkdownFormatting)
|
|
5158
5192
|
.map((item) => item.trim());
|
|
5159
5193
|
if (items.length === 0 || items[0] === '') {
|
|
5160
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5194
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5161
5195
|
Malformed command:
|
|
5162
5196
|
- ${raw}
|
|
5163
5197
|
|
|
@@ -5193,7 +5227,7 @@
|
|
|
5193
5227
|
return command;
|
|
5194
5228
|
}
|
|
5195
5229
|
}
|
|
5196
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5230
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5197
5231
|
Malformed or unknown command:
|
|
5198
5232
|
- ${raw}
|
|
5199
5233
|
|
|
@@ -5244,7 +5278,7 @@
|
|
|
5244
5278
|
if (!(error instanceof ParseError)) {
|
|
5245
5279
|
throw error;
|
|
5246
5280
|
}
|
|
5247
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5281
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5248
5282
|
Invalid ${commandName} command:
|
|
5249
5283
|
|
|
5250
5284
|
Your command:
|
|
@@ -5606,7 +5640,7 @@
|
|
|
5606
5640
|
* @public exported from `@promptbook/markdown-utils`
|
|
5607
5641
|
*/
|
|
5608
5642
|
function removeMarkdownComments(content) {
|
|
5609
|
-
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
5643
|
+
return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
5610
5644
|
}
|
|
5611
5645
|
|
|
5612
5646
|
/**
|
|
@@ -6025,7 +6059,7 @@
|
|
|
6025
6059
|
}
|
|
6026
6060
|
catch (error) {
|
|
6027
6061
|
assertsError(error);
|
|
6028
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6062
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6029
6063
|
Can not extract variables from the script
|
|
6030
6064
|
${block(error.stack || error.message)}
|
|
6031
6065
|
|
|
@@ -6167,7 +6201,7 @@
|
|
|
6167
6201
|
if (pipelineString.startsWith('#!')) {
|
|
6168
6202
|
const [shebangLine, ...restLines] = pipelineString.split('\n');
|
|
6169
6203
|
if (!(shebangLine || '').includes('ptbk')) {
|
|
6170
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6204
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6171
6205
|
It seems that you try to parse a book file which has non-standard shebang line for book files:
|
|
6172
6206
|
Shebang line must contain 'ptbk'
|
|
6173
6207
|
|
|
@@ -6183,7 +6217,7 @@
|
|
|
6183
6217
|
pipelineString = validatePipelineString(restLines.join('\n'));
|
|
6184
6218
|
}
|
|
6185
6219
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
6186
|
-
pipelineString = spaceTrim.spaceTrim(pipelineString);
|
|
6220
|
+
pipelineString = spaceTrim$1.spaceTrim(pipelineString);
|
|
6187
6221
|
// <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
|
|
6188
6222
|
pipelineString = deflatePipeline(pipelineString);
|
|
6189
6223
|
// ==============
|
|
@@ -6195,7 +6229,7 @@
|
|
|
6195
6229
|
// ==============
|
|
6196
6230
|
// Note: 1️⃣◽4️⃣ Check markdown structure
|
|
6197
6231
|
if (pipelineHead === undefined) {
|
|
6198
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6232
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6199
6233
|
Pipeline head is not defined
|
|
6200
6234
|
|
|
6201
6235
|
${block(getPipelineIdentification())}
|
|
@@ -6204,7 +6238,7 @@
|
|
|
6204
6238
|
`));
|
|
6205
6239
|
}
|
|
6206
6240
|
if (pipelineHead.level !== 1) {
|
|
6207
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6241
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6208
6242
|
Pipeline head is not h1
|
|
6209
6243
|
|
|
6210
6244
|
${block(getPipelineIdentification())}
|
|
@@ -6213,7 +6247,7 @@
|
|
|
6213
6247
|
`));
|
|
6214
6248
|
}
|
|
6215
6249
|
if (!pipelineSections.every((section) => section.level === 2)) {
|
|
6216
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6250
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6217
6251
|
Not every pipeline section is h2
|
|
6218
6252
|
|
|
6219
6253
|
${block(getPipelineIdentification())}
|
|
@@ -6226,7 +6260,7 @@
|
|
|
6226
6260
|
const defineParam = (parameterCommand) => {
|
|
6227
6261
|
const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
|
|
6228
6262
|
if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
|
|
6229
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6263
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6230
6264
|
Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
|
|
6231
6265
|
|
|
6232
6266
|
${block(getPipelineIdentification())}
|
|
@@ -6237,7 +6271,7 @@
|
|
|
6237
6271
|
existingParameter.description &&
|
|
6238
6272
|
existingParameter.description !== parameterDescription &&
|
|
6239
6273
|
parameterDescription) {
|
|
6240
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6274
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6241
6275
|
Parameter \`{${parameterName}}\` is defined multiple times with different description:
|
|
6242
6276
|
|
|
6243
6277
|
${block(getPipelineIdentification())}
|
|
@@ -6275,7 +6309,7 @@
|
|
|
6275
6309
|
description = description.split(/^>.*$/gm).join('');
|
|
6276
6310
|
//Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
|
|
6277
6311
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
6278
|
-
description = spaceTrim.spaceTrim(description);
|
|
6312
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
6279
6313
|
if (description === '') {
|
|
6280
6314
|
description = undefined;
|
|
6281
6315
|
}
|
|
@@ -6286,7 +6320,7 @@
|
|
|
6286
6320
|
const command = parseCommand(listItem, 'PIPELINE_HEAD');
|
|
6287
6321
|
const commandParser = getParserForCommand(command);
|
|
6288
6322
|
if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
|
|
6289
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6323
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6290
6324
|
Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
|
|
6291
6325
|
|
|
6292
6326
|
${block(getPipelineIdentification())}
|
|
@@ -6300,7 +6334,7 @@
|
|
|
6300
6334
|
if (!(error instanceof ParseError)) {
|
|
6301
6335
|
throw error;
|
|
6302
6336
|
}
|
|
6303
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6337
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6304
6338
|
Command ${command.type} failed to apply to the pipeline
|
|
6305
6339
|
|
|
6306
6340
|
The error:
|
|
@@ -6353,7 +6387,7 @@
|
|
|
6353
6387
|
description = description.split(/^>.*$/gm).join('');
|
|
6354
6388
|
//Note: Remove lists and return statement - TODO: [🎾]
|
|
6355
6389
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
6356
|
-
description = spaceTrim.spaceTrim(description);
|
|
6390
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
6357
6391
|
if (description === '') {
|
|
6358
6392
|
description = undefined;
|
|
6359
6393
|
}
|
|
@@ -6387,7 +6421,7 @@
|
|
|
6387
6421
|
for (const { listItem, command } of commands) {
|
|
6388
6422
|
const commandParser = getParserForCommand(command);
|
|
6389
6423
|
if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
|
|
6390
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6424
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6391
6425
|
Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
|
|
6392
6426
|
|
|
6393
6427
|
${block(getPipelineIdentification())}
|
|
@@ -6402,7 +6436,7 @@
|
|
|
6402
6436
|
if (!(error instanceof ParseError)) {
|
|
6403
6437
|
throw error;
|
|
6404
6438
|
}
|
|
6405
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6439
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6406
6440
|
Command \`${command.type}\` failed to apply to the task
|
|
6407
6441
|
|
|
6408
6442
|
The error:
|
|
@@ -6433,14 +6467,14 @@
|
|
|
6433
6467
|
// TODO: [🍧] Should be done in SECTION command
|
|
6434
6468
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
6435
6469
|
if (!language) {
|
|
6436
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6470
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6437
6471
|
You must specify the language of the script in the \`SCRIPT\` task
|
|
6438
6472
|
|
|
6439
6473
|
${block(getPipelineIdentification())}
|
|
6440
6474
|
`));
|
|
6441
6475
|
}
|
|
6442
6476
|
if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
6443
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6477
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6444
6478
|
Script language ${language} is not supported.
|
|
6445
6479
|
|
|
6446
6480
|
Supported languages are:
|