@promptbook/remote-server 0.103.0-55 → 0.103.0-66
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 +164 -112
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +7 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -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 +42 -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/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +9 -1
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +126 -74
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
- 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,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('child_process'), require('colors'), require('spacetrim'), require('waitasecond'), require('express'), require('express-openapi-validator'), require('http'), require('socket.io'), require('swagger-ui-express'), require('crypto'), require('fs/promises'), require('rxjs'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('papaparse'), require('react'), require('react-dom/server')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'path', 'child_process', 'colors', 'spacetrim', 'waitasecond', 'express', 'express-openapi-validator', 'http', 'socket.io', 'swagger-ui-express', 'crypto', 'fs/promises', 'rxjs', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'papaparse', 'react', 'react-dom/server'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.path, global.child_process, global.colors, global.spaceTrim, global.waitasecond, global.express, global.OpenApiValidator, global.http, global.socket_io, global.swaggerUi, global.crypto, global.promises, global.rxjs, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse, global.react, global.server));
|
|
5
|
-
})(this, (function (exports, path, child_process, colors, spaceTrim, waitasecond, express, OpenApiValidator, http, socket_io, swaggerUi, crypto, promises, rxjs, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse, react, server) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.path, global.child_process, global.colors, global.spaceTrim$1, global.waitasecond, global.express, global.OpenApiValidator, global.http, global.socket_io, global.swaggerUi, global.crypto, global.promises, global.rxjs, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.papaparse, global.react, global.server));
|
|
5
|
+
})(this, (function (exports, path, child_process, colors, spaceTrim$1, waitasecond, express, OpenApiValidator, http, socket_io, swaggerUi, crypto, promises, rxjs, hexEncoder, sha256, cryptoJs, mimeTypes, papaparse, react, server) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
28
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
28
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
29
29
|
var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
|
|
30
30
|
var OpenApiValidator__namespace = /*#__PURE__*/_interopNamespace(OpenApiValidator);
|
|
31
31
|
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
@@ -47,12 +47,23 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Trims string from all 4 sides
|
|
58
|
+
*
|
|
59
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
60
|
+
* Developed by same author @hejny as this package
|
|
61
|
+
*
|
|
62
|
+
* @public exported from `@promptbook/utils`
|
|
63
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
64
|
+
*/
|
|
65
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
66
|
+
|
|
56
67
|
/**
|
|
57
68
|
* @private util of `@promptbook/color`
|
|
58
69
|
* @de
|
|
@@ -101,6 +112,7 @@
|
|
|
101
112
|
* @public exported from `@promptbook/color`
|
|
102
113
|
*/
|
|
103
114
|
const CSS_COLORS = {
|
|
115
|
+
promptbook: '#79EAFD',
|
|
104
116
|
transparent: 'rgba(0,0,0,0)',
|
|
105
117
|
aliceblue: '#f0f8ff',
|
|
106
118
|
antiquewhite: '#faebd7',
|
|
@@ -301,21 +313,61 @@
|
|
|
301
313
|
* @param color
|
|
302
314
|
* @returns Color object
|
|
303
315
|
*/
|
|
304
|
-
static from(color) {
|
|
305
|
-
if (color
|
|
316
|
+
static from(color, _isSingleValue = false) {
|
|
317
|
+
if (color === '') {
|
|
318
|
+
throw new Error(`Can not create color from empty string`);
|
|
319
|
+
}
|
|
320
|
+
else if (color instanceof Color) {
|
|
306
321
|
return take(color);
|
|
307
322
|
}
|
|
308
323
|
else if (Color.isColor(color)) {
|
|
309
324
|
return take(color);
|
|
310
325
|
}
|
|
311
326
|
else if (typeof color === 'string') {
|
|
312
|
-
|
|
327
|
+
try {
|
|
328
|
+
return Color.fromString(color);
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
332
|
+
if (_isSingleValue) {
|
|
333
|
+
throw error;
|
|
334
|
+
}
|
|
335
|
+
const parts = color.split(/[\s+,;|]/);
|
|
336
|
+
if (parts.length > 0) {
|
|
337
|
+
return Color.from(parts[0].trim(), true);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
313
343
|
}
|
|
314
344
|
else {
|
|
315
345
|
console.error({ color });
|
|
316
346
|
throw new Error(`Can not create color from given object`);
|
|
317
347
|
}
|
|
318
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Creates a new Color instance from miscellaneous formats
|
|
351
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
352
|
+
*
|
|
353
|
+
* @param color
|
|
354
|
+
* @returns Color object
|
|
355
|
+
*/
|
|
356
|
+
static fromSafe(color) {
|
|
357
|
+
try {
|
|
358
|
+
return Color.from(color);
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
362
|
+
console.warn(spaceTrim((block) => `
|
|
363
|
+
Color.fromSafe error:
|
|
364
|
+
${block(error.message)}
|
|
365
|
+
|
|
366
|
+
Returning default PROMPTBOOK_COLOR.
|
|
367
|
+
`));
|
|
368
|
+
return Color.fromString('promptbook');
|
|
369
|
+
}
|
|
370
|
+
}
|
|
319
371
|
/**
|
|
320
372
|
* Creates a new Color instance from miscellaneous string formats
|
|
321
373
|
*
|
|
@@ -933,7 +985,7 @@
|
|
|
933
985
|
*
|
|
934
986
|
* @public exported from `@promptbook/core`
|
|
935
987
|
*/
|
|
936
|
-
const PROMPTBOOK_COLOR = Color.
|
|
988
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
937
989
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
938
990
|
/**
|
|
939
991
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1280,11 +1332,11 @@
|
|
|
1280
1332
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
1281
1333
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1282
1334
|
}
|
|
1283
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1335
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1284
1336
|
}
|
|
1285
1337
|
}
|
|
1286
1338
|
else {
|
|
1287
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1339
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1288
1340
|
}
|
|
1289
1341
|
};
|
|
1290
1342
|
commandProcess.on('close', finishWithCode);
|
|
@@ -1302,7 +1354,7 @@
|
|
|
1302
1354
|
console.warn(error);
|
|
1303
1355
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1304
1356
|
}
|
|
1305
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1357
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1306
1358
|
}
|
|
1307
1359
|
});
|
|
1308
1360
|
}
|
|
@@ -1396,7 +1448,7 @@
|
|
|
1396
1448
|
*/
|
|
1397
1449
|
class UnexpectedError extends Error {
|
|
1398
1450
|
constructor(message) {
|
|
1399
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1451
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1400
1452
|
${block(message)}
|
|
1401
1453
|
|
|
1402
1454
|
Note: This error should not happen.
|
|
@@ -1422,7 +1474,7 @@
|
|
|
1422
1474
|
constructor(whatWasThrown) {
|
|
1423
1475
|
const tag = `[🤮]`;
|
|
1424
1476
|
console.error(tag, whatWasThrown);
|
|
1425
|
-
super(spaceTrim.spaceTrim(`
|
|
1477
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1426
1478
|
Non-Error object was thrown
|
|
1427
1479
|
|
|
1428
1480
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1618,7 +1670,7 @@
|
|
|
1618
1670
|
*/
|
|
1619
1671
|
class MissingToolsError extends Error {
|
|
1620
1672
|
constructor(message) {
|
|
1621
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1673
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1622
1674
|
${block(message)}
|
|
1623
1675
|
|
|
1624
1676
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -1662,7 +1714,7 @@
|
|
|
1662
1714
|
*/
|
|
1663
1715
|
class NotYetImplementedError extends Error {
|
|
1664
1716
|
constructor(message) {
|
|
1665
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1717
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1666
1718
|
${block(message)}
|
|
1667
1719
|
|
|
1668
1720
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -2495,7 +2547,7 @@
|
|
|
2495
2547
|
if (!(error instanceof PipelineLogicError)) {
|
|
2496
2548
|
throw error;
|
|
2497
2549
|
}
|
|
2498
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2550
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2499
2551
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2500
2552
|
|
|
2501
2553
|
${block(error.message)}
|
|
@@ -2522,7 +2574,7 @@
|
|
|
2522
2574
|
})();
|
|
2523
2575
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2524
2576
|
// <- Note: [🚲]
|
|
2525
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2577
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2526
2578
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2527
2579
|
|
|
2528
2580
|
${block(pipelineIdentification)}
|
|
@@ -2530,7 +2582,7 @@
|
|
|
2530
2582
|
}
|
|
2531
2583
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2532
2584
|
// <- Note: [🚲]
|
|
2533
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2585
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2534
2586
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2535
2587
|
|
|
2536
2588
|
${block(pipelineIdentification)}
|
|
@@ -2539,7 +2591,7 @@
|
|
|
2539
2591
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2540
2592
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2541
2593
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2542
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2594
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2543
2595
|
Pipeline is valid JSON but with wrong structure
|
|
2544
2596
|
|
|
2545
2597
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2550,7 +2602,7 @@
|
|
|
2550
2602
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2551
2603
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2552
2604
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2553
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2605
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2554
2606
|
Pipeline is valid JSON but with wrong structure
|
|
2555
2607
|
|
|
2556
2608
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2576,7 +2628,7 @@
|
|
|
2576
2628
|
// Note: Check each parameter individually
|
|
2577
2629
|
for (const parameter of pipeline.parameters) {
|
|
2578
2630
|
if (parameter.isInput && parameter.isOutput) {
|
|
2579
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2631
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2580
2632
|
|
|
2581
2633
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2582
2634
|
|
|
@@ -2587,7 +2639,7 @@
|
|
|
2587
2639
|
if (!parameter.isInput &&
|
|
2588
2640
|
!parameter.isOutput &&
|
|
2589
2641
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2590
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2642
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2591
2643
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2592
2644
|
|
|
2593
2645
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2599,7 +2651,7 @@
|
|
|
2599
2651
|
}
|
|
2600
2652
|
// Note: Testing that parameter is either input or result of some task
|
|
2601
2653
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2602
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2654
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2603
2655
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2604
2656
|
|
|
2605
2657
|
You can do one of these:
|
|
@@ -2615,14 +2667,14 @@
|
|
|
2615
2667
|
// Note: Checking each task individually
|
|
2616
2668
|
for (const task of pipeline.tasks) {
|
|
2617
2669
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2618
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2670
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2619
2671
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2620
2672
|
|
|
2621
2673
|
${block(pipelineIdentification)}
|
|
2622
2674
|
`));
|
|
2623
2675
|
}
|
|
2624
2676
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2625
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2677
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2626
2678
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2627
2679
|
|
|
2628
2680
|
${block(pipelineIdentification)}
|
|
@@ -2632,7 +2684,7 @@
|
|
|
2632
2684
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2633
2685
|
if (!task.format &&
|
|
2634
2686
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2635
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2687
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2636
2688
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2637
2689
|
|
|
2638
2690
|
${block(pipelineIdentification)}
|
|
@@ -2640,7 +2692,7 @@
|
|
|
2640
2692
|
}
|
|
2641
2693
|
for (const joker of task.jokerParameterNames) {
|
|
2642
2694
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2643
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2695
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2644
2696
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2645
2697
|
|
|
2646
2698
|
${block(pipelineIdentification)}
|
|
@@ -2651,21 +2703,21 @@
|
|
|
2651
2703
|
if (task.expectations) {
|
|
2652
2704
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2653
2705
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2654
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2706
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2655
2707
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2656
2708
|
|
|
2657
2709
|
${block(pipelineIdentification)}
|
|
2658
2710
|
`));
|
|
2659
2711
|
}
|
|
2660
2712
|
if (min !== undefined && min < 0) {
|
|
2661
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2713
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2662
2714
|
Min expectation of ${unit} must be zero or positive
|
|
2663
2715
|
|
|
2664
2716
|
${block(pipelineIdentification)}
|
|
2665
2717
|
`));
|
|
2666
2718
|
}
|
|
2667
2719
|
if (max !== undefined && max <= 0) {
|
|
2668
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2720
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2669
2721
|
Max expectation of ${unit} must be positive
|
|
2670
2722
|
|
|
2671
2723
|
${block(pipelineIdentification)}
|
|
@@ -2687,7 +2739,7 @@
|
|
|
2687
2739
|
while (unresovedTasks.length > 0) {
|
|
2688
2740
|
if (loopLimit-- < 0) {
|
|
2689
2741
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2690
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2742
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2691
2743
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2692
2744
|
|
|
2693
2745
|
${block(pipelineIdentification)}
|
|
@@ -2697,7 +2749,7 @@
|
|
|
2697
2749
|
if (currentlyResovedTasks.length === 0) {
|
|
2698
2750
|
throw new PipelineLogicError(
|
|
2699
2751
|
// TODO: [🐎] DRY
|
|
2700
|
-
spaceTrim.spaceTrim((block) => `
|
|
2752
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2701
2753
|
|
|
2702
2754
|
Can not resolve some parameters:
|
|
2703
2755
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2938,11 +2990,11 @@
|
|
|
2938
2990
|
throw deserializeError(errors[0]);
|
|
2939
2991
|
}
|
|
2940
2992
|
else {
|
|
2941
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
2993
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
2942
2994
|
Multiple errors occurred during Promptbook execution
|
|
2943
2995
|
|
|
2944
2996
|
${block(errors
|
|
2945
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
2997
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
2946
2998
|
${name} ${index + 1}:
|
|
2947
2999
|
${block(stack || message)}
|
|
2948
3000
|
`))
|
|
@@ -3559,7 +3611,7 @@
|
|
|
3559
3611
|
for (const pipeline of pipelines) {
|
|
3560
3612
|
// TODO: [👠] DRY
|
|
3561
3613
|
if (pipeline.pipelineUrl === undefined) {
|
|
3562
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3614
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3563
3615
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
3564
3616
|
|
|
3565
3617
|
File:
|
|
@@ -3581,7 +3633,7 @@
|
|
|
3581
3633
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
3582
3634
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
3583
3635
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
3584
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3636
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3585
3637
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
3586
3638
|
|
|
3587
3639
|
Conflicting files:
|
|
@@ -3613,13 +3665,13 @@
|
|
|
3613
3665
|
const pipeline = this.collection.get(url);
|
|
3614
3666
|
if (!pipeline) {
|
|
3615
3667
|
if (this.listPipelines().length === 0) {
|
|
3616
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
3668
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
3617
3669
|
Pipeline with url "${url}" not found
|
|
3618
3670
|
|
|
3619
3671
|
No pipelines available
|
|
3620
3672
|
`));
|
|
3621
3673
|
}
|
|
3622
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
3674
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
3623
3675
|
Pipeline with url "${url}" not found
|
|
3624
3676
|
|
|
3625
3677
|
Available pipelines:
|
|
@@ -5173,7 +5225,7 @@
|
|
|
5173
5225
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
5174
5226
|
knowledgePiecesCount > 0 &&
|
|
5175
5227
|
!dependentParameterNames.includes('knowledge')) {
|
|
5176
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
5228
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
5177
5229
|
{content}
|
|
5178
5230
|
|
|
5179
5231
|
## Knowledge
|
|
@@ -5486,7 +5538,7 @@
|
|
|
5486
5538
|
}
|
|
5487
5539
|
catch (error) {
|
|
5488
5540
|
assertsError(error);
|
|
5489
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5541
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5490
5542
|
Can not extract variables from the script
|
|
5491
5543
|
${block(error.stack || error.message)}
|
|
5492
5544
|
|
|
@@ -6340,7 +6392,7 @@
|
|
|
6340
6392
|
}
|
|
6341
6393
|
catch (error) {
|
|
6342
6394
|
keepUnused(error);
|
|
6343
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6395
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
6344
6396
|
Expected valid JSON string
|
|
6345
6397
|
|
|
6346
6398
|
The expected JSON text:
|
|
@@ -6403,7 +6455,7 @@
|
|
|
6403
6455
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6404
6456
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6405
6457
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6406
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6458
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6407
6459
|
Joker not found in attempt ${attemptIndex}
|
|
6408
6460
|
|
|
6409
6461
|
${block(pipelineIdentification)}
|
|
@@ -6414,7 +6466,7 @@
|
|
|
6414
6466
|
$ongoingTaskResult.$expectError = null;
|
|
6415
6467
|
if (isJokerAttempt) {
|
|
6416
6468
|
if (parameters[jokerParameterName] === undefined) {
|
|
6417
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6469
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6418
6470
|
Joker parameter {${jokerParameterName}} not defined
|
|
6419
6471
|
|
|
6420
6472
|
${block(pipelineIdentification)}
|
|
@@ -6472,7 +6524,7 @@
|
|
|
6472
6524
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6473
6525
|
break variant;
|
|
6474
6526
|
case 'EMBEDDING':
|
|
6475
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6527
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6476
6528
|
Embedding model can not be used in pipeline
|
|
6477
6529
|
|
|
6478
6530
|
This should be catched during parsing
|
|
@@ -6483,7 +6535,7 @@
|
|
|
6483
6535
|
break variant;
|
|
6484
6536
|
// <- case [🤖]:
|
|
6485
6537
|
default:
|
|
6486
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6538
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6487
6539
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6488
6540
|
|
|
6489
6541
|
${block(pipelineIdentification)}
|
|
@@ -6494,14 +6546,14 @@
|
|
|
6494
6546
|
break;
|
|
6495
6547
|
case 'SCRIPT_TASK':
|
|
6496
6548
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6497
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6549
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6498
6550
|
No script execution tools are available
|
|
6499
6551
|
|
|
6500
6552
|
${block(pipelineIdentification)}
|
|
6501
6553
|
`));
|
|
6502
6554
|
}
|
|
6503
6555
|
if (!task.contentLanguage) {
|
|
6504
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6556
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6505
6557
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6506
6558
|
|
|
6507
6559
|
${block(pipelineIdentification)}
|
|
@@ -6532,7 +6584,7 @@
|
|
|
6532
6584
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6533
6585
|
}
|
|
6534
6586
|
else {
|
|
6535
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6587
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6536
6588
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6537
6589
|
|
|
6538
6590
|
${block(pipelineIdentification)}
|
|
@@ -6546,7 +6598,7 @@
|
|
|
6546
6598
|
break taskType;
|
|
6547
6599
|
case 'DIALOG_TASK':
|
|
6548
6600
|
if (tools.userInterface === undefined) {
|
|
6549
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6601
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6550
6602
|
User interface tools are not available
|
|
6551
6603
|
|
|
6552
6604
|
${block(pipelineIdentification)}
|
|
@@ -6564,7 +6616,7 @@
|
|
|
6564
6616
|
break taskType;
|
|
6565
6617
|
// <- case: [🅱]
|
|
6566
6618
|
default:
|
|
6567
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6619
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6568
6620
|
Unknown execution type "${task.taskType}"
|
|
6569
6621
|
|
|
6570
6622
|
${block(pipelineIdentification)}
|
|
@@ -6662,7 +6714,7 @@
|
|
|
6662
6714
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6663
6715
|
// Note: Create a summary of all failures
|
|
6664
6716
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6665
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6717
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6666
6718
|
var _a, _b;
|
|
6667
6719
|
return `
|
|
6668
6720
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6672,14 +6724,14 @@
|
|
|
6672
6724
|
Result:
|
|
6673
6725
|
${block(failure.result === null
|
|
6674
6726
|
? 'null'
|
|
6675
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6727
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6676
6728
|
.split('\n')
|
|
6677
6729
|
.map((line) => `> ${line}`)
|
|
6678
6730
|
.join('\n'))}
|
|
6679
6731
|
`;
|
|
6680
6732
|
}))
|
|
6681
6733
|
.join('\n\n---\n\n');
|
|
6682
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6734
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6683
6735
|
var _a;
|
|
6684
6736
|
return `
|
|
6685
6737
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6699,7 +6751,7 @@
|
|
|
6699
6751
|
}
|
|
6700
6752
|
}
|
|
6701
6753
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6702
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6754
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6703
6755
|
Something went wrong and prompt result is null
|
|
6704
6756
|
|
|
6705
6757
|
${block(pipelineIdentification)}
|
|
@@ -7005,7 +7057,7 @@
|
|
|
7005
7057
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
7006
7058
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
7007
7059
|
if (reservedParameters[parameterName] === undefined) {
|
|
7008
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7060
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7009
7061
|
Reserved parameter {${parameterName}} is not defined
|
|
7010
7062
|
|
|
7011
7063
|
${block(pipelineIdentification)}
|
|
@@ -7031,7 +7083,7 @@
|
|
|
7031
7083
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
7032
7084
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
7033
7085
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
7034
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7086
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7035
7087
|
Dependent parameters are not consistent with used parameters:
|
|
7036
7088
|
|
|
7037
7089
|
Dependent parameters:
|
|
@@ -7075,7 +7127,7 @@
|
|
|
7075
7127
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
7076
7128
|
// Houston, we have a problem
|
|
7077
7129
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
7078
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7130
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7079
7131
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
7080
7132
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
7081
7133
|
|
|
@@ -7144,7 +7196,7 @@
|
|
|
7144
7196
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
7145
7197
|
if (parametersToPass[parameter.name] === undefined) {
|
|
7146
7198
|
// [4]
|
|
7147
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7199
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7148
7200
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
7149
7201
|
|
|
7150
7202
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -7252,7 +7304,7 @@
|
|
|
7252
7304
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
7253
7305
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
7254
7306
|
if (parameter === undefined) {
|
|
7255
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7307
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7256
7308
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
7257
7309
|
|
|
7258
7310
|
${block(pipelineIdentification)}
|
|
@@ -7267,7 +7319,7 @@
|
|
|
7267
7319
|
// TODO: [🧠] This should be also non-critical error
|
|
7268
7320
|
return exportJson({
|
|
7269
7321
|
name: 'pipelineExecutorResult',
|
|
7270
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
7322
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
7271
7323
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7272
7324
|
|
|
7273
7325
|
${block(pipelineIdentification)}
|
|
@@ -7276,7 +7328,7 @@
|
|
|
7276
7328
|
value: {
|
|
7277
7329
|
isSuccessful: false,
|
|
7278
7330
|
errors: [
|
|
7279
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7331
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7280
7332
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
7281
7333
|
|
|
7282
7334
|
${block(pipelineIdentification)}
|
|
@@ -7303,7 +7355,7 @@
|
|
|
7303
7355
|
while (unresovedTasks.length > 0) {
|
|
7304
7356
|
if (loopLimit-- < 0) {
|
|
7305
7357
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
7306
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7358
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7307
7359
|
Loop limit reached during resolving parameters pipeline execution
|
|
7308
7360
|
|
|
7309
7361
|
${block(pipelineIdentification)}
|
|
@@ -7313,7 +7365,7 @@
|
|
|
7313
7365
|
if (!currentTask && resolving.length === 0) {
|
|
7314
7366
|
throw new UnexpectedError(
|
|
7315
7367
|
// TODO: [🐎] DRY
|
|
7316
|
-
spaceTrim.spaceTrim((block) => `
|
|
7368
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
7317
7369
|
Can not resolve some parameters:
|
|
7318
7370
|
|
|
7319
7371
|
${block(pipelineIdentification)}
|
|
@@ -7353,7 +7405,7 @@
|
|
|
7353
7405
|
tools,
|
|
7354
7406
|
onProgress(newOngoingResult) {
|
|
7355
7407
|
if (isReturned) {
|
|
7356
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7408
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7357
7409
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
7358
7410
|
|
|
7359
7411
|
${block(pipelineIdentification)}
|
|
@@ -7370,7 +7422,7 @@
|
|
|
7370
7422
|
},
|
|
7371
7423
|
logLlmCall,
|
|
7372
7424
|
$executionReport: executionReport,
|
|
7373
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7425
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7374
7426
|
${block(pipelineIdentification)}
|
|
7375
7427
|
Task name: ${currentTask.name}
|
|
7376
7428
|
Task title: ${currentTask.title}
|
|
@@ -7479,7 +7531,7 @@
|
|
|
7479
7531
|
preparedPipeline = pipeline;
|
|
7480
7532
|
}
|
|
7481
7533
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7482
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7534
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7483
7535
|
Pipeline is not prepared
|
|
7484
7536
|
|
|
7485
7537
|
${block(pipelineIdentification)}
|
|
@@ -7504,7 +7556,7 @@
|
|
|
7504
7556
|
tools,
|
|
7505
7557
|
onProgress,
|
|
7506
7558
|
logLlmCall,
|
|
7507
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7559
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7508
7560
|
${block(pipelineIdentification)}
|
|
7509
7561
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7510
7562
|
`),
|
|
@@ -8082,7 +8134,7 @@
|
|
|
8082
8134
|
let trimmedText = text;
|
|
8083
8135
|
// Remove leading and trailing spaces and newlines
|
|
8084
8136
|
if (isTrimmed) {
|
|
8085
|
-
trimmedText = spaceTrim.spaceTrim(trimmedText);
|
|
8137
|
+
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
8086
8138
|
}
|
|
8087
8139
|
let processedText = trimmedText;
|
|
8088
8140
|
if (isIntroduceSentenceRemoved) {
|
|
@@ -8091,7 +8143,7 @@
|
|
|
8091
8143
|
// Remove the introduce sentence and quotes by replacing it with an empty string
|
|
8092
8144
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
8093
8145
|
}
|
|
8094
|
-
processedText = spaceTrim.spaceTrim(processedText);
|
|
8146
|
+
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
8095
8147
|
}
|
|
8096
8148
|
if (processedText.length < 3) {
|
|
8097
8149
|
return trimmedText;
|
|
@@ -8195,13 +8247,13 @@
|
|
|
8195
8247
|
* @public exported from `@promptbook/markdown-utils`
|
|
8196
8248
|
*/
|
|
8197
8249
|
function trimCodeBlock(value) {
|
|
8198
|
-
value = spaceTrim.spaceTrim(value);
|
|
8250
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
8199
8251
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
8200
8252
|
return value;
|
|
8201
8253
|
}
|
|
8202
8254
|
value = value.replace(/^```[a-z]*/i, '');
|
|
8203
8255
|
value = value.replace(/```$/i, '');
|
|
8204
|
-
value = spaceTrim.spaceTrim(value);
|
|
8256
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
8205
8257
|
return value;
|
|
8206
8258
|
}
|
|
8207
8259
|
|
|
@@ -8214,9 +8266,9 @@
|
|
|
8214
8266
|
* @public exported from `@promptbook/markdown-utils`
|
|
8215
8267
|
*/
|
|
8216
8268
|
function trimEndOfCodeBlock(value) {
|
|
8217
|
-
value = spaceTrim.spaceTrim(value);
|
|
8269
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
8218
8270
|
value = value.replace(/```$/g, '');
|
|
8219
|
-
value = spaceTrim.spaceTrim(value);
|
|
8271
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
8220
8272
|
return value;
|
|
8221
8273
|
}
|
|
8222
8274
|
|
|
@@ -9280,7 +9332,7 @@
|
|
|
9280
9332
|
response.type('text/html').send(renderServerIndexHtml(serverInfo));
|
|
9281
9333
|
}
|
|
9282
9334
|
else {
|
|
9283
|
-
response.type('text/markdown').send(await spaceTrim.spaceTrim(async (block) => `
|
|
9335
|
+
response.type('text/markdown').send(await spaceTrim$1.spaceTrim(async (block) => `
|
|
9284
9336
|
# Promptbook
|
|
9285
9337
|
|
|
9286
9338
|
> ${block(CLAIM)}
|