@promptbook/documents 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 +151 -99
- 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 +119 -67
- 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,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('child_process'), require('colors'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'child_process', 'colors', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, promises, spaceTrim, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim$1, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spaceTrim$1, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { '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 colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
11
11
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
12
12
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -48,6 +48,17 @@
|
|
|
48
48
|
function keepUnused(...valuesToKeep) {
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Trims string from all 4 sides
|
|
53
|
+
*
|
|
54
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
55
|
+
* Developed by same author @hejny as this package
|
|
56
|
+
*
|
|
57
|
+
* @public exported from `@promptbook/utils`
|
|
58
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
59
|
+
*/
|
|
60
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
61
|
+
|
|
51
62
|
/**
|
|
52
63
|
* @private util of `@promptbook/color`
|
|
53
64
|
* @de
|
|
@@ -96,6 +107,7 @@
|
|
|
96
107
|
* @public exported from `@promptbook/color`
|
|
97
108
|
*/
|
|
98
109
|
const CSS_COLORS = {
|
|
110
|
+
promptbook: '#79EAFD',
|
|
99
111
|
transparent: 'rgba(0,0,0,0)',
|
|
100
112
|
aliceblue: '#f0f8ff',
|
|
101
113
|
antiquewhite: '#faebd7',
|
|
@@ -296,21 +308,61 @@
|
|
|
296
308
|
* @param color
|
|
297
309
|
* @returns Color object
|
|
298
310
|
*/
|
|
299
|
-
static from(color) {
|
|
300
|
-
if (color
|
|
311
|
+
static from(color, _isSingleValue = false) {
|
|
312
|
+
if (color === '') {
|
|
313
|
+
throw new Error(`Can not create color from empty string`);
|
|
314
|
+
}
|
|
315
|
+
else if (color instanceof Color) {
|
|
301
316
|
return take(color);
|
|
302
317
|
}
|
|
303
318
|
else if (Color.isColor(color)) {
|
|
304
319
|
return take(color);
|
|
305
320
|
}
|
|
306
321
|
else if (typeof color === 'string') {
|
|
307
|
-
|
|
322
|
+
try {
|
|
323
|
+
return Color.fromString(color);
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
327
|
+
if (_isSingleValue) {
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
const parts = color.split(/[\s+,;|]/);
|
|
331
|
+
if (parts.length > 0) {
|
|
332
|
+
return Color.from(parts[0].trim(), true);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
308
338
|
}
|
|
309
339
|
else {
|
|
310
340
|
console.error({ color });
|
|
311
341
|
throw new Error(`Can not create color from given object`);
|
|
312
342
|
}
|
|
313
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Creates a new Color instance from miscellaneous formats
|
|
346
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
347
|
+
*
|
|
348
|
+
* @param color
|
|
349
|
+
* @returns Color object
|
|
350
|
+
*/
|
|
351
|
+
static fromSafe(color) {
|
|
352
|
+
try {
|
|
353
|
+
return Color.from(color);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
357
|
+
console.warn(spaceTrim((block) => `
|
|
358
|
+
Color.fromSafe error:
|
|
359
|
+
${block(error.message)}
|
|
360
|
+
|
|
361
|
+
Returning default PROMPTBOOK_COLOR.
|
|
362
|
+
`));
|
|
363
|
+
return Color.fromString('promptbook');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
314
366
|
/**
|
|
315
367
|
* Creates a new Color instance from miscellaneous string formats
|
|
316
368
|
*
|
|
@@ -920,7 +972,7 @@
|
|
|
920
972
|
*
|
|
921
973
|
* @public exported from `@promptbook/core`
|
|
922
974
|
*/
|
|
923
|
-
const PROMPTBOOK_COLOR = Color.
|
|
975
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
924
976
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
925
977
|
/**
|
|
926
978
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1143,7 +1195,7 @@
|
|
|
1143
1195
|
*/
|
|
1144
1196
|
class MissingToolsError extends Error {
|
|
1145
1197
|
constructor(message) {
|
|
1146
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1198
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1147
1199
|
${block(message)}
|
|
1148
1200
|
|
|
1149
1201
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -1205,7 +1257,7 @@
|
|
|
1205
1257
|
*/
|
|
1206
1258
|
class UnexpectedError extends Error {
|
|
1207
1259
|
constructor(message) {
|
|
1208
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1260
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1209
1261
|
${block(message)}
|
|
1210
1262
|
|
|
1211
1263
|
Note: This error should not happen.
|
|
@@ -1366,11 +1418,11 @@
|
|
|
1366
1418
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
1367
1419
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1368
1420
|
}
|
|
1369
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1421
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1370
1422
|
}
|
|
1371
1423
|
}
|
|
1372
1424
|
else {
|
|
1373
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1425
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1374
1426
|
}
|
|
1375
1427
|
};
|
|
1376
1428
|
commandProcess.on('close', finishWithCode);
|
|
@@ -1388,7 +1440,7 @@
|
|
|
1388
1440
|
console.warn(error);
|
|
1389
1441
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1390
1442
|
}
|
|
1391
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1443
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1392
1444
|
}
|
|
1393
1445
|
});
|
|
1394
1446
|
}
|
|
@@ -2005,7 +2057,7 @@
|
|
|
2005
2057
|
constructor(whatWasThrown) {
|
|
2006
2058
|
const tag = `[🤮]`;
|
|
2007
2059
|
console.error(tag, whatWasThrown);
|
|
2008
|
-
super(spaceTrim.spaceTrim(`
|
|
2060
|
+
super(spaceTrim$1.spaceTrim(`
|
|
2009
2061
|
Non-Error object was thrown
|
|
2010
2062
|
|
|
2011
2063
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2680,7 +2732,7 @@
|
|
|
2680
2732
|
if (!(error instanceof PipelineLogicError)) {
|
|
2681
2733
|
throw error;
|
|
2682
2734
|
}
|
|
2683
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2735
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2684
2736
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2685
2737
|
|
|
2686
2738
|
${block(error.message)}
|
|
@@ -2707,7 +2759,7 @@
|
|
|
2707
2759
|
})();
|
|
2708
2760
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2709
2761
|
// <- Note: [🚲]
|
|
2710
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2762
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2711
2763
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2712
2764
|
|
|
2713
2765
|
${block(pipelineIdentification)}
|
|
@@ -2715,7 +2767,7 @@
|
|
|
2715
2767
|
}
|
|
2716
2768
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2717
2769
|
// <- Note: [🚲]
|
|
2718
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2770
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2719
2771
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2720
2772
|
|
|
2721
2773
|
${block(pipelineIdentification)}
|
|
@@ -2724,7 +2776,7 @@
|
|
|
2724
2776
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2725
2777
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2726
2778
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2727
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2779
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2728
2780
|
Pipeline is valid JSON but with wrong structure
|
|
2729
2781
|
|
|
2730
2782
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2735,7 +2787,7 @@
|
|
|
2735
2787
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2736
2788
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2737
2789
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2738
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2790
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2739
2791
|
Pipeline is valid JSON but with wrong structure
|
|
2740
2792
|
|
|
2741
2793
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2761,7 +2813,7 @@
|
|
|
2761
2813
|
// Note: Check each parameter individually
|
|
2762
2814
|
for (const parameter of pipeline.parameters) {
|
|
2763
2815
|
if (parameter.isInput && parameter.isOutput) {
|
|
2764
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2816
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2765
2817
|
|
|
2766
2818
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2767
2819
|
|
|
@@ -2772,7 +2824,7 @@
|
|
|
2772
2824
|
if (!parameter.isInput &&
|
|
2773
2825
|
!parameter.isOutput &&
|
|
2774
2826
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2775
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2827
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2776
2828
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2777
2829
|
|
|
2778
2830
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2784,7 +2836,7 @@
|
|
|
2784
2836
|
}
|
|
2785
2837
|
// Note: Testing that parameter is either input or result of some task
|
|
2786
2838
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2787
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2839
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2788
2840
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2789
2841
|
|
|
2790
2842
|
You can do one of these:
|
|
@@ -2800,14 +2852,14 @@
|
|
|
2800
2852
|
// Note: Checking each task individually
|
|
2801
2853
|
for (const task of pipeline.tasks) {
|
|
2802
2854
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2803
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2855
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2804
2856
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2805
2857
|
|
|
2806
2858
|
${block(pipelineIdentification)}
|
|
2807
2859
|
`));
|
|
2808
2860
|
}
|
|
2809
2861
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2810
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2862
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2811
2863
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2812
2864
|
|
|
2813
2865
|
${block(pipelineIdentification)}
|
|
@@ -2817,7 +2869,7 @@
|
|
|
2817
2869
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2818
2870
|
if (!task.format &&
|
|
2819
2871
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2820
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2872
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2821
2873
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2822
2874
|
|
|
2823
2875
|
${block(pipelineIdentification)}
|
|
@@ -2825,7 +2877,7 @@
|
|
|
2825
2877
|
}
|
|
2826
2878
|
for (const joker of task.jokerParameterNames) {
|
|
2827
2879
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2828
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2880
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2829
2881
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2830
2882
|
|
|
2831
2883
|
${block(pipelineIdentification)}
|
|
@@ -2836,21 +2888,21 @@
|
|
|
2836
2888
|
if (task.expectations) {
|
|
2837
2889
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2838
2890
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2839
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2891
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2840
2892
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2841
2893
|
|
|
2842
2894
|
${block(pipelineIdentification)}
|
|
2843
2895
|
`));
|
|
2844
2896
|
}
|
|
2845
2897
|
if (min !== undefined && min < 0) {
|
|
2846
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2898
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2847
2899
|
Min expectation of ${unit} must be zero or positive
|
|
2848
2900
|
|
|
2849
2901
|
${block(pipelineIdentification)}
|
|
2850
2902
|
`));
|
|
2851
2903
|
}
|
|
2852
2904
|
if (max !== undefined && max <= 0) {
|
|
2853
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2905
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2854
2906
|
Max expectation of ${unit} must be positive
|
|
2855
2907
|
|
|
2856
2908
|
${block(pipelineIdentification)}
|
|
@@ -2872,7 +2924,7 @@
|
|
|
2872
2924
|
while (unresovedTasks.length > 0) {
|
|
2873
2925
|
if (loopLimit-- < 0) {
|
|
2874
2926
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2875
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2927
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2876
2928
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2877
2929
|
|
|
2878
2930
|
${block(pipelineIdentification)}
|
|
@@ -2882,7 +2934,7 @@
|
|
|
2882
2934
|
if (currentlyResovedTasks.length === 0) {
|
|
2883
2935
|
throw new PipelineLogicError(
|
|
2884
2936
|
// TODO: [🐎] DRY
|
|
2885
|
-
spaceTrim.spaceTrim((block) => `
|
|
2937
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2886
2938
|
|
|
2887
2939
|
Can not resolve some parameters:
|
|
2888
2940
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -3046,7 +3098,7 @@
|
|
|
3046
3098
|
for (const pipeline of pipelines) {
|
|
3047
3099
|
// TODO: [👠] DRY
|
|
3048
3100
|
if (pipeline.pipelineUrl === undefined) {
|
|
3049
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3101
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3050
3102
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
3051
3103
|
|
|
3052
3104
|
File:
|
|
@@ -3068,7 +3120,7 @@
|
|
|
3068
3120
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
3069
3121
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
3070
3122
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
3071
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3123
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3072
3124
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
3073
3125
|
|
|
3074
3126
|
Conflicting files:
|
|
@@ -3100,13 +3152,13 @@
|
|
|
3100
3152
|
const pipeline = this.collection.get(url);
|
|
3101
3153
|
if (!pipeline) {
|
|
3102
3154
|
if (this.listPipelines().length === 0) {
|
|
3103
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
3155
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
3104
3156
|
Pipeline with url "${url}" not found
|
|
3105
3157
|
|
|
3106
3158
|
No pipelines available
|
|
3107
3159
|
`));
|
|
3108
3160
|
}
|
|
3109
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
3161
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
3110
3162
|
Pipeline with url "${url}" not found
|
|
3111
3163
|
|
|
3112
3164
|
Available pipelines:
|
|
@@ -3337,7 +3389,7 @@
|
|
|
3337
3389
|
*/
|
|
3338
3390
|
class NotYetImplementedError extends Error {
|
|
3339
3391
|
constructor(message) {
|
|
3340
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3392
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3341
3393
|
${block(message)}
|
|
3342
3394
|
|
|
3343
3395
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3576,11 +3628,11 @@
|
|
|
3576
3628
|
throw deserializeError(errors[0]);
|
|
3577
3629
|
}
|
|
3578
3630
|
else {
|
|
3579
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3631
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3580
3632
|
Multiple errors occurred during Promptbook execution
|
|
3581
3633
|
|
|
3582
3634
|
${block(errors
|
|
3583
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3635
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3584
3636
|
${name} ${index + 1}:
|
|
3585
3637
|
${block(stack || message)}
|
|
3586
3638
|
`))
|
|
@@ -4969,7 +5021,7 @@
|
|
|
4969
5021
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4970
5022
|
knowledgePiecesCount > 0 &&
|
|
4971
5023
|
!dependentParameterNames.includes('knowledge')) {
|
|
4972
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
5024
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4973
5025
|
{content}
|
|
4974
5026
|
|
|
4975
5027
|
## Knowledge
|
|
@@ -5282,7 +5334,7 @@
|
|
|
5282
5334
|
}
|
|
5283
5335
|
catch (error) {
|
|
5284
5336
|
assertsError(error);
|
|
5285
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5337
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5286
5338
|
Can not extract variables from the script
|
|
5287
5339
|
${block(error.stack || error.message)}
|
|
5288
5340
|
|
|
@@ -6119,7 +6171,7 @@
|
|
|
6119
6171
|
}
|
|
6120
6172
|
catch (error) {
|
|
6121
6173
|
keepUnused(error);
|
|
6122
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6174
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
6123
6175
|
Expected valid JSON string
|
|
6124
6176
|
|
|
6125
6177
|
The expected JSON text:
|
|
@@ -6182,7 +6234,7 @@
|
|
|
6182
6234
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6183
6235
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6184
6236
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6185
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6237
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6186
6238
|
Joker not found in attempt ${attemptIndex}
|
|
6187
6239
|
|
|
6188
6240
|
${block(pipelineIdentification)}
|
|
@@ -6193,7 +6245,7 @@
|
|
|
6193
6245
|
$ongoingTaskResult.$expectError = null;
|
|
6194
6246
|
if (isJokerAttempt) {
|
|
6195
6247
|
if (parameters[jokerParameterName] === undefined) {
|
|
6196
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6248
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6197
6249
|
Joker parameter {${jokerParameterName}} not defined
|
|
6198
6250
|
|
|
6199
6251
|
${block(pipelineIdentification)}
|
|
@@ -6251,7 +6303,7 @@
|
|
|
6251
6303
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6252
6304
|
break variant;
|
|
6253
6305
|
case 'EMBEDDING':
|
|
6254
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6306
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6255
6307
|
Embedding model can not be used in pipeline
|
|
6256
6308
|
|
|
6257
6309
|
This should be catched during parsing
|
|
@@ -6262,7 +6314,7 @@
|
|
|
6262
6314
|
break variant;
|
|
6263
6315
|
// <- case [🤖]:
|
|
6264
6316
|
default:
|
|
6265
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6317
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6266
6318
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6267
6319
|
|
|
6268
6320
|
${block(pipelineIdentification)}
|
|
@@ -6273,14 +6325,14 @@
|
|
|
6273
6325
|
break;
|
|
6274
6326
|
case 'SCRIPT_TASK':
|
|
6275
6327
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6276
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6328
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6277
6329
|
No script execution tools are available
|
|
6278
6330
|
|
|
6279
6331
|
${block(pipelineIdentification)}
|
|
6280
6332
|
`));
|
|
6281
6333
|
}
|
|
6282
6334
|
if (!task.contentLanguage) {
|
|
6283
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6335
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6284
6336
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6285
6337
|
|
|
6286
6338
|
${block(pipelineIdentification)}
|
|
@@ -6311,7 +6363,7 @@
|
|
|
6311
6363
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6312
6364
|
}
|
|
6313
6365
|
else {
|
|
6314
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6366
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6315
6367
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6316
6368
|
|
|
6317
6369
|
${block(pipelineIdentification)}
|
|
@@ -6325,7 +6377,7 @@
|
|
|
6325
6377
|
break taskType;
|
|
6326
6378
|
case 'DIALOG_TASK':
|
|
6327
6379
|
if (tools.userInterface === undefined) {
|
|
6328
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6380
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6329
6381
|
User interface tools are not available
|
|
6330
6382
|
|
|
6331
6383
|
${block(pipelineIdentification)}
|
|
@@ -6343,7 +6395,7 @@
|
|
|
6343
6395
|
break taskType;
|
|
6344
6396
|
// <- case: [🅱]
|
|
6345
6397
|
default:
|
|
6346
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6398
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6347
6399
|
Unknown execution type "${task.taskType}"
|
|
6348
6400
|
|
|
6349
6401
|
${block(pipelineIdentification)}
|
|
@@ -6441,7 +6493,7 @@
|
|
|
6441
6493
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6442
6494
|
// Note: Create a summary of all failures
|
|
6443
6495
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6444
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6496
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6445
6497
|
var _a, _b;
|
|
6446
6498
|
return `
|
|
6447
6499
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6451,14 +6503,14 @@
|
|
|
6451
6503
|
Result:
|
|
6452
6504
|
${block(failure.result === null
|
|
6453
6505
|
? 'null'
|
|
6454
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6506
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6455
6507
|
.split('\n')
|
|
6456
6508
|
.map((line) => `> ${line}`)
|
|
6457
6509
|
.join('\n'))}
|
|
6458
6510
|
`;
|
|
6459
6511
|
}))
|
|
6460
6512
|
.join('\n\n---\n\n');
|
|
6461
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6513
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6462
6514
|
var _a;
|
|
6463
6515
|
return `
|
|
6464
6516
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6478,7 +6530,7 @@
|
|
|
6478
6530
|
}
|
|
6479
6531
|
}
|
|
6480
6532
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6481
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6533
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6482
6534
|
Something went wrong and prompt result is null
|
|
6483
6535
|
|
|
6484
6536
|
${block(pipelineIdentification)}
|
|
@@ -6784,7 +6836,7 @@
|
|
|
6784
6836
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6785
6837
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6786
6838
|
if (reservedParameters[parameterName] === undefined) {
|
|
6787
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6839
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6788
6840
|
Reserved parameter {${parameterName}} is not defined
|
|
6789
6841
|
|
|
6790
6842
|
${block(pipelineIdentification)}
|
|
@@ -6810,7 +6862,7 @@
|
|
|
6810
6862
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6811
6863
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6812
6864
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6813
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6865
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6814
6866
|
Dependent parameters are not consistent with used parameters:
|
|
6815
6867
|
|
|
6816
6868
|
Dependent parameters:
|
|
@@ -6854,7 +6906,7 @@
|
|
|
6854
6906
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6855
6907
|
// Houston, we have a problem
|
|
6856
6908
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6857
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6909
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6858
6910
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6859
6911
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6860
6912
|
|
|
@@ -6923,7 +6975,7 @@
|
|
|
6923
6975
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6924
6976
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6925
6977
|
// [4]
|
|
6926
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6978
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6927
6979
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6928
6980
|
|
|
6929
6981
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -7031,7 +7083,7 @@
|
|
|
7031
7083
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
7032
7084
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
7033
7085
|
if (parameter === undefined) {
|
|
7034
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7086
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7035
7087
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
7036
7088
|
|
|
7037
7089
|
${block(pipelineIdentification)}
|
|
@@ -7046,7 +7098,7 @@
|
|
|
7046
7098
|
// TODO: [🧠] This should be also non-critical error
|
|
7047
7099
|
return exportJson({
|
|
7048
7100
|
name: 'pipelineExecutorResult',
|
|
7049
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
7101
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
7050
7102
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7051
7103
|
|
|
7052
7104
|
${block(pipelineIdentification)}
|
|
@@ -7055,7 +7107,7 @@
|
|
|
7055
7107
|
value: {
|
|
7056
7108
|
isSuccessful: false,
|
|
7057
7109
|
errors: [
|
|
7058
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7110
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7059
7111
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
7060
7112
|
|
|
7061
7113
|
${block(pipelineIdentification)}
|
|
@@ -7082,7 +7134,7 @@
|
|
|
7082
7134
|
while (unresovedTasks.length > 0) {
|
|
7083
7135
|
if (loopLimit-- < 0) {
|
|
7084
7136
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
7085
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7137
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7086
7138
|
Loop limit reached during resolving parameters pipeline execution
|
|
7087
7139
|
|
|
7088
7140
|
${block(pipelineIdentification)}
|
|
@@ -7092,7 +7144,7 @@
|
|
|
7092
7144
|
if (!currentTask && resolving.length === 0) {
|
|
7093
7145
|
throw new UnexpectedError(
|
|
7094
7146
|
// TODO: [🐎] DRY
|
|
7095
|
-
spaceTrim.spaceTrim((block) => `
|
|
7147
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
7096
7148
|
Can not resolve some parameters:
|
|
7097
7149
|
|
|
7098
7150
|
${block(pipelineIdentification)}
|
|
@@ -7132,7 +7184,7 @@
|
|
|
7132
7184
|
tools,
|
|
7133
7185
|
onProgress(newOngoingResult) {
|
|
7134
7186
|
if (isReturned) {
|
|
7135
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7187
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7136
7188
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
7137
7189
|
|
|
7138
7190
|
${block(pipelineIdentification)}
|
|
@@ -7149,7 +7201,7 @@
|
|
|
7149
7201
|
},
|
|
7150
7202
|
logLlmCall,
|
|
7151
7203
|
$executionReport: executionReport,
|
|
7152
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7204
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7153
7205
|
${block(pipelineIdentification)}
|
|
7154
7206
|
Task name: ${currentTask.name}
|
|
7155
7207
|
Task title: ${currentTask.title}
|
|
@@ -7258,7 +7310,7 @@
|
|
|
7258
7310
|
preparedPipeline = pipeline;
|
|
7259
7311
|
}
|
|
7260
7312
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7261
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7313
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7262
7314
|
Pipeline is not prepared
|
|
7263
7315
|
|
|
7264
7316
|
${block(pipelineIdentification)}
|
|
@@ -7283,7 +7335,7 @@
|
|
|
7283
7335
|
tools,
|
|
7284
7336
|
onProgress,
|
|
7285
7337
|
logLlmCall,
|
|
7286
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7338
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7287
7339
|
${block(pipelineIdentification)}
|
|
7288
7340
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7289
7341
|
`),
|