@promptbook/pdf 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 +91 -39
- 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('fs/promises'), require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.spaceTrim, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, promises, spaceTrim, cryptoJs, hexEncoder, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.spaceTrim$1, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spaceTrim$1, cryptoJs, hexEncoder, path, crypto, rxjs, waitasecond, 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 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
|
|
@@ -47,6 +47,17 @@
|
|
|
47
47
|
function keepUnused(...valuesToKeep) {
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Trims string from all 4 sides
|
|
52
|
+
*
|
|
53
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
54
|
+
* Developed by same author @hejny as this package
|
|
55
|
+
*
|
|
56
|
+
* @public exported from `@promptbook/utils`
|
|
57
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
58
|
+
*/
|
|
59
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
62
|
* Just marks a place of place where should be something implemented
|
|
52
63
|
* No side effects.
|
|
@@ -108,6 +119,7 @@
|
|
|
108
119
|
* @public exported from `@promptbook/color`
|
|
109
120
|
*/
|
|
110
121
|
const CSS_COLORS = {
|
|
122
|
+
promptbook: '#79EAFD',
|
|
111
123
|
transparent: 'rgba(0,0,0,0)',
|
|
112
124
|
aliceblue: '#f0f8ff',
|
|
113
125
|
antiquewhite: '#faebd7',
|
|
@@ -308,21 +320,61 @@
|
|
|
308
320
|
* @param color
|
|
309
321
|
* @returns Color object
|
|
310
322
|
*/
|
|
311
|
-
static from(color) {
|
|
312
|
-
if (color
|
|
323
|
+
static from(color, _isSingleValue = false) {
|
|
324
|
+
if (color === '') {
|
|
325
|
+
throw new Error(`Can not create color from empty string`);
|
|
326
|
+
}
|
|
327
|
+
else if (color instanceof Color) {
|
|
313
328
|
return take(color);
|
|
314
329
|
}
|
|
315
330
|
else if (Color.isColor(color)) {
|
|
316
331
|
return take(color);
|
|
317
332
|
}
|
|
318
333
|
else if (typeof color === 'string') {
|
|
319
|
-
|
|
334
|
+
try {
|
|
335
|
+
return Color.fromString(color);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
339
|
+
if (_isSingleValue) {
|
|
340
|
+
throw error;
|
|
341
|
+
}
|
|
342
|
+
const parts = color.split(/[\s+,;|]/);
|
|
343
|
+
if (parts.length > 0) {
|
|
344
|
+
return Color.from(parts[0].trim(), true);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
320
350
|
}
|
|
321
351
|
else {
|
|
322
352
|
console.error({ color });
|
|
323
353
|
throw new Error(`Can not create color from given object`);
|
|
324
354
|
}
|
|
325
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Creates a new Color instance from miscellaneous formats
|
|
358
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
359
|
+
*
|
|
360
|
+
* @param color
|
|
361
|
+
* @returns Color object
|
|
362
|
+
*/
|
|
363
|
+
static fromSafe(color) {
|
|
364
|
+
try {
|
|
365
|
+
return Color.from(color);
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
369
|
+
console.warn(spaceTrim((block) => `
|
|
370
|
+
Color.fromSafe error:
|
|
371
|
+
${block(error.message)}
|
|
372
|
+
|
|
373
|
+
Returning default PROMPTBOOK_COLOR.
|
|
374
|
+
`));
|
|
375
|
+
return Color.fromString('promptbook');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
326
378
|
/**
|
|
327
379
|
* Creates a new Color instance from miscellaneous string formats
|
|
328
380
|
*
|
|
@@ -932,7 +984,7 @@
|
|
|
932
984
|
*
|
|
933
985
|
* @public exported from `@promptbook/core`
|
|
934
986
|
*/
|
|
935
|
-
const PROMPTBOOK_COLOR = Color.
|
|
987
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
936
988
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
937
989
|
/**
|
|
938
990
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1199,7 +1251,7 @@
|
|
|
1199
1251
|
*/
|
|
1200
1252
|
class UnexpectedError extends Error {
|
|
1201
1253
|
constructor(message) {
|
|
1202
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1254
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1203
1255
|
${block(message)}
|
|
1204
1256
|
|
|
1205
1257
|
Note: This error should not happen.
|
|
@@ -1827,7 +1879,7 @@
|
|
|
1827
1879
|
constructor(whatWasThrown) {
|
|
1828
1880
|
const tag = `[🤮]`;
|
|
1829
1881
|
console.error(tag, whatWasThrown);
|
|
1830
|
-
super(spaceTrim.spaceTrim(`
|
|
1882
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1831
1883
|
Non-Error object was thrown
|
|
1832
1884
|
|
|
1833
1885
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2502,7 +2554,7 @@
|
|
|
2502
2554
|
if (!(error instanceof PipelineLogicError)) {
|
|
2503
2555
|
throw error;
|
|
2504
2556
|
}
|
|
2505
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2557
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2506
2558
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2507
2559
|
|
|
2508
2560
|
${block(error.message)}
|
|
@@ -2529,7 +2581,7 @@
|
|
|
2529
2581
|
})();
|
|
2530
2582
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2531
2583
|
// <- Note: [🚲]
|
|
2532
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2584
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2533
2585
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2534
2586
|
|
|
2535
2587
|
${block(pipelineIdentification)}
|
|
@@ -2537,7 +2589,7 @@
|
|
|
2537
2589
|
}
|
|
2538
2590
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2539
2591
|
// <- Note: [🚲]
|
|
2540
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2592
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2541
2593
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2542
2594
|
|
|
2543
2595
|
${block(pipelineIdentification)}
|
|
@@ -2546,7 +2598,7 @@
|
|
|
2546
2598
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2547
2599
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2548
2600
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2549
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2601
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2550
2602
|
Pipeline is valid JSON but with wrong structure
|
|
2551
2603
|
|
|
2552
2604
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2557,7 +2609,7 @@
|
|
|
2557
2609
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2558
2610
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2559
2611
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2560
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2612
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2561
2613
|
Pipeline is valid JSON but with wrong structure
|
|
2562
2614
|
|
|
2563
2615
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2583,7 +2635,7 @@
|
|
|
2583
2635
|
// Note: Check each parameter individually
|
|
2584
2636
|
for (const parameter of pipeline.parameters) {
|
|
2585
2637
|
if (parameter.isInput && parameter.isOutput) {
|
|
2586
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2638
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2587
2639
|
|
|
2588
2640
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2589
2641
|
|
|
@@ -2594,7 +2646,7 @@
|
|
|
2594
2646
|
if (!parameter.isInput &&
|
|
2595
2647
|
!parameter.isOutput &&
|
|
2596
2648
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2597
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2649
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2598
2650
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2599
2651
|
|
|
2600
2652
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2606,7 +2658,7 @@
|
|
|
2606
2658
|
}
|
|
2607
2659
|
// Note: Testing that parameter is either input or result of some task
|
|
2608
2660
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2609
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2661
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2610
2662
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2611
2663
|
|
|
2612
2664
|
You can do one of these:
|
|
@@ -2622,14 +2674,14 @@
|
|
|
2622
2674
|
// Note: Checking each task individually
|
|
2623
2675
|
for (const task of pipeline.tasks) {
|
|
2624
2676
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2625
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2677
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2626
2678
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2627
2679
|
|
|
2628
2680
|
${block(pipelineIdentification)}
|
|
2629
2681
|
`));
|
|
2630
2682
|
}
|
|
2631
2683
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2632
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2684
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2633
2685
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2634
2686
|
|
|
2635
2687
|
${block(pipelineIdentification)}
|
|
@@ -2639,7 +2691,7 @@
|
|
|
2639
2691
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2640
2692
|
if (!task.format &&
|
|
2641
2693
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2642
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2694
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2643
2695
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2644
2696
|
|
|
2645
2697
|
${block(pipelineIdentification)}
|
|
@@ -2647,7 +2699,7 @@
|
|
|
2647
2699
|
}
|
|
2648
2700
|
for (const joker of task.jokerParameterNames) {
|
|
2649
2701
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2650
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2702
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2651
2703
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2652
2704
|
|
|
2653
2705
|
${block(pipelineIdentification)}
|
|
@@ -2658,21 +2710,21 @@
|
|
|
2658
2710
|
if (task.expectations) {
|
|
2659
2711
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2660
2712
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2661
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2713
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2662
2714
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2663
2715
|
|
|
2664
2716
|
${block(pipelineIdentification)}
|
|
2665
2717
|
`));
|
|
2666
2718
|
}
|
|
2667
2719
|
if (min !== undefined && min < 0) {
|
|
2668
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2720
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2669
2721
|
Min expectation of ${unit} must be zero or positive
|
|
2670
2722
|
|
|
2671
2723
|
${block(pipelineIdentification)}
|
|
2672
2724
|
`));
|
|
2673
2725
|
}
|
|
2674
2726
|
if (max !== undefined && max <= 0) {
|
|
2675
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2727
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2676
2728
|
Max expectation of ${unit} must be positive
|
|
2677
2729
|
|
|
2678
2730
|
${block(pipelineIdentification)}
|
|
@@ -2694,7 +2746,7 @@
|
|
|
2694
2746
|
while (unresovedTasks.length > 0) {
|
|
2695
2747
|
if (loopLimit-- < 0) {
|
|
2696
2748
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2697
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2749
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2698
2750
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2699
2751
|
|
|
2700
2752
|
${block(pipelineIdentification)}
|
|
@@ -2704,7 +2756,7 @@
|
|
|
2704
2756
|
if (currentlyResovedTasks.length === 0) {
|
|
2705
2757
|
throw new PipelineLogicError(
|
|
2706
2758
|
// TODO: [🐎] DRY
|
|
2707
|
-
spaceTrim.spaceTrim((block) => `
|
|
2759
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2708
2760
|
|
|
2709
2761
|
Can not resolve some parameters:
|
|
2710
2762
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2868,7 +2920,7 @@
|
|
|
2868
2920
|
for (const pipeline of pipelines) {
|
|
2869
2921
|
// TODO: [👠] DRY
|
|
2870
2922
|
if (pipeline.pipelineUrl === undefined) {
|
|
2871
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2923
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2872
2924
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2873
2925
|
|
|
2874
2926
|
File:
|
|
@@ -2890,7 +2942,7 @@
|
|
|
2890
2942
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2891
2943
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2892
2944
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2893
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2945
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2894
2946
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2895
2947
|
|
|
2896
2948
|
Conflicting files:
|
|
@@ -2922,13 +2974,13 @@
|
|
|
2922
2974
|
const pipeline = this.collection.get(url);
|
|
2923
2975
|
if (!pipeline) {
|
|
2924
2976
|
if (this.listPipelines().length === 0) {
|
|
2925
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
2977
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
2926
2978
|
Pipeline with url "${url}" not found
|
|
2927
2979
|
|
|
2928
2980
|
No pipelines available
|
|
2929
2981
|
`));
|
|
2930
2982
|
}
|
|
2931
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
2983
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
2932
2984
|
Pipeline with url "${url}" not found
|
|
2933
2985
|
|
|
2934
2986
|
Available pipelines:
|
|
@@ -2969,7 +3021,7 @@
|
|
|
2969
3021
|
*/
|
|
2970
3022
|
class MissingToolsError extends Error {
|
|
2971
3023
|
constructor(message) {
|
|
2972
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3024
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2973
3025
|
${block(message)}
|
|
2974
3026
|
|
|
2975
3027
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -3177,7 +3229,7 @@
|
|
|
3177
3229
|
*/
|
|
3178
3230
|
class NotYetImplementedError extends Error {
|
|
3179
3231
|
constructor(message) {
|
|
3180
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3232
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3181
3233
|
${block(message)}
|
|
3182
3234
|
|
|
3183
3235
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3416,11 +3468,11 @@
|
|
|
3416
3468
|
throw deserializeError(errors[0]);
|
|
3417
3469
|
}
|
|
3418
3470
|
else {
|
|
3419
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3471
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3420
3472
|
Multiple errors occurred during Promptbook execution
|
|
3421
3473
|
|
|
3422
3474
|
${block(errors
|
|
3423
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3475
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3424
3476
|
${name} ${index + 1}:
|
|
3425
3477
|
${block(stack || message)}
|
|
3426
3478
|
`))
|
|
@@ -4819,7 +4871,7 @@
|
|
|
4819
4871
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4820
4872
|
knowledgePiecesCount > 0 &&
|
|
4821
4873
|
!dependentParameterNames.includes('knowledge')) {
|
|
4822
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
4874
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4823
4875
|
{content}
|
|
4824
4876
|
|
|
4825
4877
|
## Knowledge
|
|
@@ -5132,7 +5184,7 @@
|
|
|
5132
5184
|
}
|
|
5133
5185
|
catch (error) {
|
|
5134
5186
|
assertsError(error);
|
|
5135
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5187
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5136
5188
|
Can not extract variables from the script
|
|
5137
5189
|
${block(error.stack || error.message)}
|
|
5138
5190
|
|
|
@@ -5969,7 +6021,7 @@
|
|
|
5969
6021
|
}
|
|
5970
6022
|
catch (error) {
|
|
5971
6023
|
keepUnused(error);
|
|
5972
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6024
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
5973
6025
|
Expected valid JSON string
|
|
5974
6026
|
|
|
5975
6027
|
The expected JSON text:
|
|
@@ -6032,7 +6084,7 @@
|
|
|
6032
6084
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6033
6085
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6034
6086
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6035
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6087
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6036
6088
|
Joker not found in attempt ${attemptIndex}
|
|
6037
6089
|
|
|
6038
6090
|
${block(pipelineIdentification)}
|
|
@@ -6043,7 +6095,7 @@
|
|
|
6043
6095
|
$ongoingTaskResult.$expectError = null;
|
|
6044
6096
|
if (isJokerAttempt) {
|
|
6045
6097
|
if (parameters[jokerParameterName] === undefined) {
|
|
6046
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6098
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6047
6099
|
Joker parameter {${jokerParameterName}} not defined
|
|
6048
6100
|
|
|
6049
6101
|
${block(pipelineIdentification)}
|
|
@@ -6101,7 +6153,7 @@
|
|
|
6101
6153
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6102
6154
|
break variant;
|
|
6103
6155
|
case 'EMBEDDING':
|
|
6104
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6156
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6105
6157
|
Embedding model can not be used in pipeline
|
|
6106
6158
|
|
|
6107
6159
|
This should be catched during parsing
|
|
@@ -6112,7 +6164,7 @@
|
|
|
6112
6164
|
break variant;
|
|
6113
6165
|
// <- case [🤖]:
|
|
6114
6166
|
default:
|
|
6115
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6167
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6116
6168
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6117
6169
|
|
|
6118
6170
|
${block(pipelineIdentification)}
|
|
@@ -6123,14 +6175,14 @@
|
|
|
6123
6175
|
break;
|
|
6124
6176
|
case 'SCRIPT_TASK':
|
|
6125
6177
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6126
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6178
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6127
6179
|
No script execution tools are available
|
|
6128
6180
|
|
|
6129
6181
|
${block(pipelineIdentification)}
|
|
6130
6182
|
`));
|
|
6131
6183
|
}
|
|
6132
6184
|
if (!task.contentLanguage) {
|
|
6133
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6185
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6134
6186
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6135
6187
|
|
|
6136
6188
|
${block(pipelineIdentification)}
|
|
@@ -6161,7 +6213,7 @@
|
|
|
6161
6213
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6162
6214
|
}
|
|
6163
6215
|
else {
|
|
6164
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6216
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6165
6217
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6166
6218
|
|
|
6167
6219
|
${block(pipelineIdentification)}
|
|
@@ -6175,7 +6227,7 @@
|
|
|
6175
6227
|
break taskType;
|
|
6176
6228
|
case 'DIALOG_TASK':
|
|
6177
6229
|
if (tools.userInterface === undefined) {
|
|
6178
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6230
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6179
6231
|
User interface tools are not available
|
|
6180
6232
|
|
|
6181
6233
|
${block(pipelineIdentification)}
|
|
@@ -6193,7 +6245,7 @@
|
|
|
6193
6245
|
break taskType;
|
|
6194
6246
|
// <- case: [🅱]
|
|
6195
6247
|
default:
|
|
6196
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6248
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6197
6249
|
Unknown execution type "${task.taskType}"
|
|
6198
6250
|
|
|
6199
6251
|
${block(pipelineIdentification)}
|
|
@@ -6291,7 +6343,7 @@
|
|
|
6291
6343
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6292
6344
|
// Note: Create a summary of all failures
|
|
6293
6345
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6294
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6346
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6295
6347
|
var _a, _b;
|
|
6296
6348
|
return `
|
|
6297
6349
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6301,14 +6353,14 @@
|
|
|
6301
6353
|
Result:
|
|
6302
6354
|
${block(failure.result === null
|
|
6303
6355
|
? 'null'
|
|
6304
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6356
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6305
6357
|
.split('\n')
|
|
6306
6358
|
.map((line) => `> ${line}`)
|
|
6307
6359
|
.join('\n'))}
|
|
6308
6360
|
`;
|
|
6309
6361
|
}))
|
|
6310
6362
|
.join('\n\n---\n\n');
|
|
6311
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6363
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6312
6364
|
var _a;
|
|
6313
6365
|
return `
|
|
6314
6366
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6328,7 +6380,7 @@
|
|
|
6328
6380
|
}
|
|
6329
6381
|
}
|
|
6330
6382
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6331
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6383
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6332
6384
|
Something went wrong and prompt result is null
|
|
6333
6385
|
|
|
6334
6386
|
${block(pipelineIdentification)}
|
|
@@ -6634,7 +6686,7 @@
|
|
|
6634
6686
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6635
6687
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6636
6688
|
if (reservedParameters[parameterName] === undefined) {
|
|
6637
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6689
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6638
6690
|
Reserved parameter {${parameterName}} is not defined
|
|
6639
6691
|
|
|
6640
6692
|
${block(pipelineIdentification)}
|
|
@@ -6660,7 +6712,7 @@
|
|
|
6660
6712
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6661
6713
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6662
6714
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6663
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6715
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6664
6716
|
Dependent parameters are not consistent with used parameters:
|
|
6665
6717
|
|
|
6666
6718
|
Dependent parameters:
|
|
@@ -6704,7 +6756,7 @@
|
|
|
6704
6756
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6705
6757
|
// Houston, we have a problem
|
|
6706
6758
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6707
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6759
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6708
6760
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6709
6761
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6710
6762
|
|
|
@@ -6773,7 +6825,7 @@
|
|
|
6773
6825
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6774
6826
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6775
6827
|
// [4]
|
|
6776
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6828
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6777
6829
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6778
6830
|
|
|
6779
6831
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -6881,7 +6933,7 @@
|
|
|
6881
6933
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6882
6934
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6883
6935
|
if (parameter === undefined) {
|
|
6884
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6936
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6885
6937
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
6886
6938
|
|
|
6887
6939
|
${block(pipelineIdentification)}
|
|
@@ -6896,7 +6948,7 @@
|
|
|
6896
6948
|
// TODO: [🧠] This should be also non-critical error
|
|
6897
6949
|
return exportJson({
|
|
6898
6950
|
name: 'pipelineExecutorResult',
|
|
6899
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
6951
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
6900
6952
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
6901
6953
|
|
|
6902
6954
|
${block(pipelineIdentification)}
|
|
@@ -6905,7 +6957,7 @@
|
|
|
6905
6957
|
value: {
|
|
6906
6958
|
isSuccessful: false,
|
|
6907
6959
|
errors: [
|
|
6908
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6960
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6909
6961
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
6910
6962
|
|
|
6911
6963
|
${block(pipelineIdentification)}
|
|
@@ -6932,7 +6984,7 @@
|
|
|
6932
6984
|
while (unresovedTasks.length > 0) {
|
|
6933
6985
|
if (loopLimit-- < 0) {
|
|
6934
6986
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
6935
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6987
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6936
6988
|
Loop limit reached during resolving parameters pipeline execution
|
|
6937
6989
|
|
|
6938
6990
|
${block(pipelineIdentification)}
|
|
@@ -6942,7 +6994,7 @@
|
|
|
6942
6994
|
if (!currentTask && resolving.length === 0) {
|
|
6943
6995
|
throw new UnexpectedError(
|
|
6944
6996
|
// TODO: [🐎] DRY
|
|
6945
|
-
spaceTrim.spaceTrim((block) => `
|
|
6997
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
6946
6998
|
Can not resolve some parameters:
|
|
6947
6999
|
|
|
6948
7000
|
${block(pipelineIdentification)}
|
|
@@ -6982,7 +7034,7 @@
|
|
|
6982
7034
|
tools,
|
|
6983
7035
|
onProgress(newOngoingResult) {
|
|
6984
7036
|
if (isReturned) {
|
|
6985
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7037
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6986
7038
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
6987
7039
|
|
|
6988
7040
|
${block(pipelineIdentification)}
|
|
@@ -6999,7 +7051,7 @@
|
|
|
6999
7051
|
},
|
|
7000
7052
|
logLlmCall,
|
|
7001
7053
|
$executionReport: executionReport,
|
|
7002
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7054
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7003
7055
|
${block(pipelineIdentification)}
|
|
7004
7056
|
Task name: ${currentTask.name}
|
|
7005
7057
|
Task title: ${currentTask.title}
|
|
@@ -7108,7 +7160,7 @@
|
|
|
7108
7160
|
preparedPipeline = pipeline;
|
|
7109
7161
|
}
|
|
7110
7162
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7111
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7163
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7112
7164
|
Pipeline is not prepared
|
|
7113
7165
|
|
|
7114
7166
|
${block(pipelineIdentification)}
|
|
@@ -7133,7 +7185,7 @@
|
|
|
7133
7185
|
tools,
|
|
7134
7186
|
onProgress,
|
|
7135
7187
|
logLlmCall,
|
|
7136
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7188
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7137
7189
|
${block(pipelineIdentification)}
|
|
7138
7190
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7139
7191
|
`),
|