@promptbook/website-crawler 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 +147 -95
- 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 +116 -64
- 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('spacetrim'), require('@mozilla/readability'), require('jsdom'), require('crypto-js'), require('crypto-js/enc-hex'), require('fs/promises'), require('path'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('showdown')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', '@mozilla/readability', 'jsdom', 'crypto-js', 'crypto-js/enc-hex', 'fs/promises', 'path', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse', 'showdown'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spaceTrim, global.readability, global.jsdom, global.cryptoJs, global.hexEncoder, global.promises, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse, global.showdown));
|
|
5
|
-
})(this, (function (exports, spaceTrim, readability, jsdom, cryptoJs, hexEncoder, promises, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse, showdown) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spaceTrim$1, global.readability, global.jsdom, global.cryptoJs, global.hexEncoder, global.promises, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse, global.showdown));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, readability, jsdom, cryptoJs, hexEncoder, promises, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse, showdown) { '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
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -74,6 +74,17 @@
|
|
|
74
74
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Trims string from all 4 sides
|
|
79
|
+
*
|
|
80
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
81
|
+
* Developed by same author @hejny as this package
|
|
82
|
+
*
|
|
83
|
+
* @public exported from `@promptbook/utils`
|
|
84
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
85
|
+
*/
|
|
86
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
87
|
+
|
|
77
88
|
/**
|
|
78
89
|
* @private util of `@promptbook/color`
|
|
79
90
|
* @de
|
|
@@ -122,6 +133,7 @@
|
|
|
122
133
|
* @public exported from `@promptbook/color`
|
|
123
134
|
*/
|
|
124
135
|
const CSS_COLORS = {
|
|
136
|
+
promptbook: '#79EAFD',
|
|
125
137
|
transparent: 'rgba(0,0,0,0)',
|
|
126
138
|
aliceblue: '#f0f8ff',
|
|
127
139
|
antiquewhite: '#faebd7',
|
|
@@ -322,21 +334,61 @@
|
|
|
322
334
|
* @param color
|
|
323
335
|
* @returns Color object
|
|
324
336
|
*/
|
|
325
|
-
static from(color) {
|
|
326
|
-
if (color
|
|
337
|
+
static from(color, _isSingleValue = false) {
|
|
338
|
+
if (color === '') {
|
|
339
|
+
throw new Error(`Can not create color from empty string`);
|
|
340
|
+
}
|
|
341
|
+
else if (color instanceof Color) {
|
|
327
342
|
return take(color);
|
|
328
343
|
}
|
|
329
344
|
else if (Color.isColor(color)) {
|
|
330
345
|
return take(color);
|
|
331
346
|
}
|
|
332
347
|
else if (typeof color === 'string') {
|
|
333
|
-
|
|
348
|
+
try {
|
|
349
|
+
return Color.fromString(color);
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
353
|
+
if (_isSingleValue) {
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
const parts = color.split(/[\s+,;|]/);
|
|
357
|
+
if (parts.length > 0) {
|
|
358
|
+
return Color.from(parts[0].trim(), true);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
334
364
|
}
|
|
335
365
|
else {
|
|
336
366
|
console.error({ color });
|
|
337
367
|
throw new Error(`Can not create color from given object`);
|
|
338
368
|
}
|
|
339
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Creates a new Color instance from miscellaneous formats
|
|
372
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
373
|
+
*
|
|
374
|
+
* @param color
|
|
375
|
+
* @returns Color object
|
|
376
|
+
*/
|
|
377
|
+
static fromSafe(color) {
|
|
378
|
+
try {
|
|
379
|
+
return Color.from(color);
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
383
|
+
console.warn(spaceTrim((block) => `
|
|
384
|
+
Color.fromSafe error:
|
|
385
|
+
${block(error.message)}
|
|
386
|
+
|
|
387
|
+
Returning default PROMPTBOOK_COLOR.
|
|
388
|
+
`));
|
|
389
|
+
return Color.fromString('promptbook');
|
|
390
|
+
}
|
|
391
|
+
}
|
|
340
392
|
/**
|
|
341
393
|
* Creates a new Color instance from miscellaneous string formats
|
|
342
394
|
*
|
|
@@ -946,7 +998,7 @@
|
|
|
946
998
|
*
|
|
947
999
|
* @public exported from `@promptbook/core`
|
|
948
1000
|
*/
|
|
949
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1001
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
950
1002
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
951
1003
|
/**
|
|
952
1004
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1143,7 +1195,7 @@
|
|
|
1143
1195
|
*/
|
|
1144
1196
|
class NotYetImplementedError 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: This feature is not implemented yet but it will be soon.
|
|
@@ -1210,7 +1262,7 @@
|
|
|
1210
1262
|
*/
|
|
1211
1263
|
class UnexpectedError extends Error {
|
|
1212
1264
|
constructor(message) {
|
|
1213
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1265
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1214
1266
|
${block(message)}
|
|
1215
1267
|
|
|
1216
1268
|
Note: This error should not happen.
|
|
@@ -1994,7 +2046,7 @@
|
|
|
1994
2046
|
constructor(whatWasThrown) {
|
|
1995
2047
|
const tag = `[🤮]`;
|
|
1996
2048
|
console.error(tag, whatWasThrown);
|
|
1997
|
-
super(spaceTrim.spaceTrim(`
|
|
2049
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1998
2050
|
Non-Error object was thrown
|
|
1999
2051
|
|
|
2000
2052
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2642,7 +2694,7 @@
|
|
|
2642
2694
|
if (!(error instanceof PipelineLogicError)) {
|
|
2643
2695
|
throw error;
|
|
2644
2696
|
}
|
|
2645
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2697
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2646
2698
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2647
2699
|
|
|
2648
2700
|
${block(error.message)}
|
|
@@ -2669,7 +2721,7 @@
|
|
|
2669
2721
|
})();
|
|
2670
2722
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2671
2723
|
// <- Note: [🚲]
|
|
2672
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2724
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2673
2725
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2674
2726
|
|
|
2675
2727
|
${block(pipelineIdentification)}
|
|
@@ -2677,7 +2729,7 @@
|
|
|
2677
2729
|
}
|
|
2678
2730
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2679
2731
|
// <- Note: [🚲]
|
|
2680
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2732
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2681
2733
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2682
2734
|
|
|
2683
2735
|
${block(pipelineIdentification)}
|
|
@@ -2686,7 +2738,7 @@
|
|
|
2686
2738
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2687
2739
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2688
2740
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2689
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2741
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2690
2742
|
Pipeline is valid JSON but with wrong structure
|
|
2691
2743
|
|
|
2692
2744
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2697,7 +2749,7 @@
|
|
|
2697
2749
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2698
2750
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2699
2751
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2700
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2752
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2701
2753
|
Pipeline is valid JSON but with wrong structure
|
|
2702
2754
|
|
|
2703
2755
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2723,7 +2775,7 @@
|
|
|
2723
2775
|
// Note: Check each parameter individually
|
|
2724
2776
|
for (const parameter of pipeline.parameters) {
|
|
2725
2777
|
if (parameter.isInput && parameter.isOutput) {
|
|
2726
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2778
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2727
2779
|
|
|
2728
2780
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2729
2781
|
|
|
@@ -2734,7 +2786,7 @@
|
|
|
2734
2786
|
if (!parameter.isInput &&
|
|
2735
2787
|
!parameter.isOutput &&
|
|
2736
2788
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2737
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2789
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2738
2790
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2739
2791
|
|
|
2740
2792
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2746,7 +2798,7 @@
|
|
|
2746
2798
|
}
|
|
2747
2799
|
// Note: Testing that parameter is either input or result of some task
|
|
2748
2800
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2749
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2801
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2750
2802
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2751
2803
|
|
|
2752
2804
|
You can do one of these:
|
|
@@ -2762,14 +2814,14 @@
|
|
|
2762
2814
|
// Note: Checking each task individually
|
|
2763
2815
|
for (const task of pipeline.tasks) {
|
|
2764
2816
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2765
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2817
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2766
2818
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2767
2819
|
|
|
2768
2820
|
${block(pipelineIdentification)}
|
|
2769
2821
|
`));
|
|
2770
2822
|
}
|
|
2771
2823
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2772
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2824
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2773
2825
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2774
2826
|
|
|
2775
2827
|
${block(pipelineIdentification)}
|
|
@@ -2779,7 +2831,7 @@
|
|
|
2779
2831
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2780
2832
|
if (!task.format &&
|
|
2781
2833
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2782
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2834
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2783
2835
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2784
2836
|
|
|
2785
2837
|
${block(pipelineIdentification)}
|
|
@@ -2787,7 +2839,7 @@
|
|
|
2787
2839
|
}
|
|
2788
2840
|
for (const joker of task.jokerParameterNames) {
|
|
2789
2841
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2790
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2842
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2791
2843
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2792
2844
|
|
|
2793
2845
|
${block(pipelineIdentification)}
|
|
@@ -2798,21 +2850,21 @@
|
|
|
2798
2850
|
if (task.expectations) {
|
|
2799
2851
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2800
2852
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2801
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2853
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2802
2854
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2803
2855
|
|
|
2804
2856
|
${block(pipelineIdentification)}
|
|
2805
2857
|
`));
|
|
2806
2858
|
}
|
|
2807
2859
|
if (min !== undefined && min < 0) {
|
|
2808
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2860
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2809
2861
|
Min expectation of ${unit} must be zero or positive
|
|
2810
2862
|
|
|
2811
2863
|
${block(pipelineIdentification)}
|
|
2812
2864
|
`));
|
|
2813
2865
|
}
|
|
2814
2866
|
if (max !== undefined && max <= 0) {
|
|
2815
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2867
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2816
2868
|
Max expectation of ${unit} must be positive
|
|
2817
2869
|
|
|
2818
2870
|
${block(pipelineIdentification)}
|
|
@@ -2834,7 +2886,7 @@
|
|
|
2834
2886
|
while (unresovedTasks.length > 0) {
|
|
2835
2887
|
if (loopLimit-- < 0) {
|
|
2836
2888
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2837
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2889
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2838
2890
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2839
2891
|
|
|
2840
2892
|
${block(pipelineIdentification)}
|
|
@@ -2844,7 +2896,7 @@
|
|
|
2844
2896
|
if (currentlyResovedTasks.length === 0) {
|
|
2845
2897
|
throw new PipelineLogicError(
|
|
2846
2898
|
// TODO: [🐎] DRY
|
|
2847
|
-
spaceTrim.spaceTrim((block) => `
|
|
2899
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2848
2900
|
|
|
2849
2901
|
Can not resolve some parameters:
|
|
2850
2902
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -3008,7 +3060,7 @@
|
|
|
3008
3060
|
for (const pipeline of pipelines) {
|
|
3009
3061
|
// TODO: [👠] DRY
|
|
3010
3062
|
if (pipeline.pipelineUrl === undefined) {
|
|
3011
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3063
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3012
3064
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
3013
3065
|
|
|
3014
3066
|
File:
|
|
@@ -3030,7 +3082,7 @@
|
|
|
3030
3082
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
3031
3083
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
3032
3084
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
3033
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3085
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3034
3086
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
3035
3087
|
|
|
3036
3088
|
Conflicting files:
|
|
@@ -3062,13 +3114,13 @@
|
|
|
3062
3114
|
const pipeline = this.collection.get(url);
|
|
3063
3115
|
if (!pipeline) {
|
|
3064
3116
|
if (this.listPipelines().length === 0) {
|
|
3065
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
3117
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
3066
3118
|
Pipeline with url "${url}" not found
|
|
3067
3119
|
|
|
3068
3120
|
No pipelines available
|
|
3069
3121
|
`));
|
|
3070
3122
|
}
|
|
3071
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
3123
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
3072
3124
|
Pipeline with url "${url}" not found
|
|
3073
3125
|
|
|
3074
3126
|
Available pipelines:
|
|
@@ -3109,7 +3161,7 @@
|
|
|
3109
3161
|
*/
|
|
3110
3162
|
class MissingToolsError extends Error {
|
|
3111
3163
|
constructor(message) {
|
|
3112
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3164
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3113
3165
|
${block(message)}
|
|
3114
3166
|
|
|
3115
3167
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -3533,11 +3585,11 @@
|
|
|
3533
3585
|
throw deserializeError(errors[0]);
|
|
3534
3586
|
}
|
|
3535
3587
|
else {
|
|
3536
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3588
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3537
3589
|
Multiple errors occurred during Promptbook execution
|
|
3538
3590
|
|
|
3539
3591
|
${block(errors
|
|
3540
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3592
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3541
3593
|
${name} ${index + 1}:
|
|
3542
3594
|
${block(stack || message)}
|
|
3543
3595
|
`))
|
|
@@ -4817,7 +4869,7 @@
|
|
|
4817
4869
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4818
4870
|
knowledgePiecesCount > 0 &&
|
|
4819
4871
|
!dependentParameterNames.includes('knowledge')) {
|
|
4820
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
4872
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4821
4873
|
{content}
|
|
4822
4874
|
|
|
4823
4875
|
## Knowledge
|
|
@@ -5130,7 +5182,7 @@
|
|
|
5130
5182
|
}
|
|
5131
5183
|
catch (error) {
|
|
5132
5184
|
assertsError(error);
|
|
5133
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5185
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5134
5186
|
Can not extract variables from the script
|
|
5135
5187
|
${block(error.stack || error.message)}
|
|
5136
5188
|
|
|
@@ -5967,7 +6019,7 @@
|
|
|
5967
6019
|
}
|
|
5968
6020
|
catch (error) {
|
|
5969
6021
|
keepUnused(error);
|
|
5970
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6022
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
5971
6023
|
Expected valid JSON string
|
|
5972
6024
|
|
|
5973
6025
|
The expected JSON text:
|
|
@@ -6030,7 +6082,7 @@
|
|
|
6030
6082
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6031
6083
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6032
6084
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6033
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6085
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6034
6086
|
Joker not found in attempt ${attemptIndex}
|
|
6035
6087
|
|
|
6036
6088
|
${block(pipelineIdentification)}
|
|
@@ -6041,7 +6093,7 @@
|
|
|
6041
6093
|
$ongoingTaskResult.$expectError = null;
|
|
6042
6094
|
if (isJokerAttempt) {
|
|
6043
6095
|
if (parameters[jokerParameterName] === undefined) {
|
|
6044
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6096
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6045
6097
|
Joker parameter {${jokerParameterName}} not defined
|
|
6046
6098
|
|
|
6047
6099
|
${block(pipelineIdentification)}
|
|
@@ -6099,7 +6151,7 @@
|
|
|
6099
6151
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6100
6152
|
break variant;
|
|
6101
6153
|
case 'EMBEDDING':
|
|
6102
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6154
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6103
6155
|
Embedding model can not be used in pipeline
|
|
6104
6156
|
|
|
6105
6157
|
This should be catched during parsing
|
|
@@ -6110,7 +6162,7 @@
|
|
|
6110
6162
|
break variant;
|
|
6111
6163
|
// <- case [🤖]:
|
|
6112
6164
|
default:
|
|
6113
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6165
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6114
6166
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6115
6167
|
|
|
6116
6168
|
${block(pipelineIdentification)}
|
|
@@ -6121,14 +6173,14 @@
|
|
|
6121
6173
|
break;
|
|
6122
6174
|
case 'SCRIPT_TASK':
|
|
6123
6175
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6124
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6176
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6125
6177
|
No script execution tools are available
|
|
6126
6178
|
|
|
6127
6179
|
${block(pipelineIdentification)}
|
|
6128
6180
|
`));
|
|
6129
6181
|
}
|
|
6130
6182
|
if (!task.contentLanguage) {
|
|
6131
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6183
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6132
6184
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6133
6185
|
|
|
6134
6186
|
${block(pipelineIdentification)}
|
|
@@ -6159,7 +6211,7 @@
|
|
|
6159
6211
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6160
6212
|
}
|
|
6161
6213
|
else {
|
|
6162
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6214
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6163
6215
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6164
6216
|
|
|
6165
6217
|
${block(pipelineIdentification)}
|
|
@@ -6173,7 +6225,7 @@
|
|
|
6173
6225
|
break taskType;
|
|
6174
6226
|
case 'DIALOG_TASK':
|
|
6175
6227
|
if (tools.userInterface === undefined) {
|
|
6176
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6228
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6177
6229
|
User interface tools are not available
|
|
6178
6230
|
|
|
6179
6231
|
${block(pipelineIdentification)}
|
|
@@ -6191,7 +6243,7 @@
|
|
|
6191
6243
|
break taskType;
|
|
6192
6244
|
// <- case: [🅱]
|
|
6193
6245
|
default:
|
|
6194
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6246
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6195
6247
|
Unknown execution type "${task.taskType}"
|
|
6196
6248
|
|
|
6197
6249
|
${block(pipelineIdentification)}
|
|
@@ -6289,7 +6341,7 @@
|
|
|
6289
6341
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6290
6342
|
// Note: Create a summary of all failures
|
|
6291
6343
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6292
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6344
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6293
6345
|
var _a, _b;
|
|
6294
6346
|
return `
|
|
6295
6347
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6299,14 +6351,14 @@
|
|
|
6299
6351
|
Result:
|
|
6300
6352
|
${block(failure.result === null
|
|
6301
6353
|
? 'null'
|
|
6302
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6354
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6303
6355
|
.split('\n')
|
|
6304
6356
|
.map((line) => `> ${line}`)
|
|
6305
6357
|
.join('\n'))}
|
|
6306
6358
|
`;
|
|
6307
6359
|
}))
|
|
6308
6360
|
.join('\n\n---\n\n');
|
|
6309
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6361
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6310
6362
|
var _a;
|
|
6311
6363
|
return `
|
|
6312
6364
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6326,7 +6378,7 @@
|
|
|
6326
6378
|
}
|
|
6327
6379
|
}
|
|
6328
6380
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6329
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6381
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6330
6382
|
Something went wrong and prompt result is null
|
|
6331
6383
|
|
|
6332
6384
|
${block(pipelineIdentification)}
|
|
@@ -6632,7 +6684,7 @@
|
|
|
6632
6684
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6633
6685
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6634
6686
|
if (reservedParameters[parameterName] === undefined) {
|
|
6635
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6687
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6636
6688
|
Reserved parameter {${parameterName}} is not defined
|
|
6637
6689
|
|
|
6638
6690
|
${block(pipelineIdentification)}
|
|
@@ -6658,7 +6710,7 @@
|
|
|
6658
6710
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6659
6711
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6660
6712
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6661
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6713
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6662
6714
|
Dependent parameters are not consistent with used parameters:
|
|
6663
6715
|
|
|
6664
6716
|
Dependent parameters:
|
|
@@ -6702,7 +6754,7 @@
|
|
|
6702
6754
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6703
6755
|
// Houston, we have a problem
|
|
6704
6756
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6705
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6757
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6706
6758
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6707
6759
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6708
6760
|
|
|
@@ -6771,7 +6823,7 @@
|
|
|
6771
6823
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6772
6824
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6773
6825
|
// [4]
|
|
6774
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6826
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6775
6827
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6776
6828
|
|
|
6777
6829
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -6879,7 +6931,7 @@
|
|
|
6879
6931
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6880
6932
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6881
6933
|
if (parameter === undefined) {
|
|
6882
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6934
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6883
6935
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
6884
6936
|
|
|
6885
6937
|
${block(pipelineIdentification)}
|
|
@@ -6894,7 +6946,7 @@
|
|
|
6894
6946
|
// TODO: [🧠] This should be also non-critical error
|
|
6895
6947
|
return exportJson({
|
|
6896
6948
|
name: 'pipelineExecutorResult',
|
|
6897
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
6949
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
6898
6950
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
6899
6951
|
|
|
6900
6952
|
${block(pipelineIdentification)}
|
|
@@ -6903,7 +6955,7 @@
|
|
|
6903
6955
|
value: {
|
|
6904
6956
|
isSuccessful: false,
|
|
6905
6957
|
errors: [
|
|
6906
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6958
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6907
6959
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
6908
6960
|
|
|
6909
6961
|
${block(pipelineIdentification)}
|
|
@@ -6930,7 +6982,7 @@
|
|
|
6930
6982
|
while (unresovedTasks.length > 0) {
|
|
6931
6983
|
if (loopLimit-- < 0) {
|
|
6932
6984
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
6933
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6985
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6934
6986
|
Loop limit reached during resolving parameters pipeline execution
|
|
6935
6987
|
|
|
6936
6988
|
${block(pipelineIdentification)}
|
|
@@ -6940,7 +6992,7 @@
|
|
|
6940
6992
|
if (!currentTask && resolving.length === 0) {
|
|
6941
6993
|
throw new UnexpectedError(
|
|
6942
6994
|
// TODO: [🐎] DRY
|
|
6943
|
-
spaceTrim.spaceTrim((block) => `
|
|
6995
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
6944
6996
|
Can not resolve some parameters:
|
|
6945
6997
|
|
|
6946
6998
|
${block(pipelineIdentification)}
|
|
@@ -6980,7 +7032,7 @@
|
|
|
6980
7032
|
tools,
|
|
6981
7033
|
onProgress(newOngoingResult) {
|
|
6982
7034
|
if (isReturned) {
|
|
6983
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7035
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6984
7036
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
6985
7037
|
|
|
6986
7038
|
${block(pipelineIdentification)}
|
|
@@ -6997,7 +7049,7 @@
|
|
|
6997
7049
|
},
|
|
6998
7050
|
logLlmCall,
|
|
6999
7051
|
$executionReport: executionReport,
|
|
7000
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7052
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7001
7053
|
${block(pipelineIdentification)}
|
|
7002
7054
|
Task name: ${currentTask.name}
|
|
7003
7055
|
Task title: ${currentTask.title}
|
|
@@ -7106,7 +7158,7 @@
|
|
|
7106
7158
|
preparedPipeline = pipeline;
|
|
7107
7159
|
}
|
|
7108
7160
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7109
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7161
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7110
7162
|
Pipeline is not prepared
|
|
7111
7163
|
|
|
7112
7164
|
${block(pipelineIdentification)}
|
|
@@ -7131,7 +7183,7 @@
|
|
|
7131
7183
|
tools,
|
|
7132
7184
|
onProgress,
|
|
7133
7185
|
logLlmCall,
|
|
7134
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7186
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7135
7187
|
${block(pipelineIdentification)}
|
|
7136
7188
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7137
7189
|
`),
|