@promptbook/documents 0.89.0-1 → 0.89.0-11
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/README.md +3 -1
- package/esm/index.es.js +154 -85
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +16 -4
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -8
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +18 -20
- package/esm/typings/src/cli/cli-commands/login.d.ts +15 -0
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +15 -0
- package/esm/typings/src/config.d.ts +15 -8
- package/esm/typings/src/errors/0-index.d.ts +6 -0
- package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/PromptResult.d.ts +2 -2
- package/esm/typings/src/execution/{PromptResultUsage.d.ts → Usage.d.ts} +5 -5
- package/esm/typings/src/execution/utils/addUsage.d.ts +2 -2
- package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +3 -3
- package/esm/typings/src/execution/utils/usage-constants.d.ts +77 -60
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +5 -5
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +5 -5
- package/esm/typings/src/llm-providers/_common/register/$provideEnvFilename.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +36 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -9
- package/esm/typings/src/llm-providers/openai/computeOpenAiUsage.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/PreparationJson.d.ts +2 -2
- package/esm/typings/src/remote-server/RemoteServer.d.ts +23 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +4 -12
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +73 -3
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +37 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/organization/TODO_narrow.d.ts +6 -0
- package/package.json +2 -2
- package/umd/index.umd.js +154 -85
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +0 -64
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
package/README.md
CHANGED
|
@@ -203,7 +203,7 @@ Each part of the book defines one of 3 circles:
|
|
|
203
203
|
|
|
204
204
|
### **What:** Workflows, Tasks and Parameters
|
|
205
205
|
|
|
206
|
-
What work needs to be done. Each book defines a workflow, which is one or more tasks. Each workflow has a fixed input and output. For example, you have a book that generates an article from a topic. Once it generates an article about AI, once about marketing, once about cooking. The workflow (= your AI program) is the same, only the input and output change.
|
|
206
|
+
What work needs to be done. Each book defines a [workflow *(scenario or pipeline)*](https://github.com/webgptorg/promptbook/discussions/88), which is one or more tasks. Each workflow has a fixed input and output. For example, you have a book that generates an article from a topic. Once it generates an article about AI, once about marketing, once about cooking. The workflow (= your AI program) is the same, only the input and output change.
|
|
207
207
|
|
|
208
208
|
**Related commands:**
|
|
209
209
|
|
|
@@ -313,6 +313,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
313
313
|
|
|
314
314
|
|
|
315
315
|
|
|
316
|
+
|
|
317
|
+
|
|
316
318
|
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
317
319
|
|
|
318
320
|
|
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-11';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -162,6 +162,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
|
162
162
|
*/
|
|
163
163
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [🤹♂️]
|
|
164
164
|
// <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
165
|
+
// TODO: !!!!!! Just .promptbook dir, hardocode others
|
|
165
166
|
/**
|
|
166
167
|
* Where to store the temporary downloads
|
|
167
168
|
*
|
|
@@ -213,7 +214,7 @@ const IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
213
214
|
true);
|
|
214
215
|
/**
|
|
215
216
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
216
|
-
* TODO: [🧠][🧜♂️] Maybe join
|
|
217
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteServerUrl and path into single value
|
|
217
218
|
*/
|
|
218
219
|
|
|
219
220
|
/**
|
|
@@ -432,6 +433,7 @@ function $execCommand(options) {
|
|
|
432
433
|
}
|
|
433
434
|
else {
|
|
434
435
|
console.warn(`Command "${humanReadableCommand}" exceeded time limit of ${timeout}ms but continues running`);
|
|
436
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
435
437
|
resolve('Command exceeded time limit');
|
|
436
438
|
}
|
|
437
439
|
});
|
|
@@ -457,6 +459,7 @@ function $execCommand(options) {
|
|
|
457
459
|
output.push(stderr.toString());
|
|
458
460
|
if (isVerbose && stderr.toString().trim()) {
|
|
459
461
|
console.warn(stderr.toString());
|
|
462
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
460
463
|
}
|
|
461
464
|
});
|
|
462
465
|
const finishWithCode = (code) => {
|
|
@@ -468,6 +471,7 @@ function $execCommand(options) {
|
|
|
468
471
|
else {
|
|
469
472
|
if (isVerbose) {
|
|
470
473
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
474
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
471
475
|
}
|
|
472
476
|
resolve(spaceTrim(output.join('\n')));
|
|
473
477
|
}
|
|
@@ -489,6 +493,7 @@ function $execCommand(options) {
|
|
|
489
493
|
else {
|
|
490
494
|
if (isVerbose) {
|
|
491
495
|
console.warn(error);
|
|
496
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
492
497
|
}
|
|
493
498
|
resolve(spaceTrim(output.join('\n')));
|
|
494
499
|
}
|
|
@@ -2304,6 +2309,19 @@ class CsvFormatError extends AbstractFormatError {
|
|
|
2304
2309
|
}
|
|
2305
2310
|
}
|
|
2306
2311
|
|
|
2312
|
+
/**
|
|
2313
|
+
* AuthenticationError is thrown from login function which is dependency of remote server
|
|
2314
|
+
*
|
|
2315
|
+
* @public exported from `@promptbook/core`
|
|
2316
|
+
*/
|
|
2317
|
+
class AuthenticationError extends Error {
|
|
2318
|
+
constructor(message) {
|
|
2319
|
+
super(message);
|
|
2320
|
+
this.name = 'AuthenticationError';
|
|
2321
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2307
2325
|
/**
|
|
2308
2326
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2309
2327
|
*
|
|
@@ -2369,6 +2387,19 @@ class NotYetImplementedError extends Error {
|
|
|
2369
2387
|
}
|
|
2370
2388
|
}
|
|
2371
2389
|
|
|
2390
|
+
/**
|
|
2391
|
+
* Error thrown when a fetch request fails
|
|
2392
|
+
*
|
|
2393
|
+
* @public exported from `@promptbook/core`
|
|
2394
|
+
*/
|
|
2395
|
+
class PromptbookFetchError extends Error {
|
|
2396
|
+
constructor(message) {
|
|
2397
|
+
super(message);
|
|
2398
|
+
this.name = 'PromptbookFetchError';
|
|
2399
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2372
2403
|
/**
|
|
2373
2404
|
* Index of all custom errors
|
|
2374
2405
|
*
|
|
@@ -2406,6 +2437,8 @@ const COMMON_JAVASCRIPT_ERRORS = {
|
|
|
2406
2437
|
TypeError,
|
|
2407
2438
|
URIError,
|
|
2408
2439
|
AggregateError,
|
|
2440
|
+
AuthenticationError,
|
|
2441
|
+
PromptbookFetchError,
|
|
2409
2442
|
/*
|
|
2410
2443
|
Note: Not widely supported
|
|
2411
2444
|
> InternalError,
|
|
@@ -2467,6 +2500,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2467
2500
|
const { isSuccessful, errors, warnings } = executionResult;
|
|
2468
2501
|
for (const warning of warnings) {
|
|
2469
2502
|
console.warn(warning.message);
|
|
2503
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2470
2504
|
}
|
|
2471
2505
|
if (isSuccessful === true) {
|
|
2472
2506
|
return;
|
|
@@ -2604,6 +2638,10 @@ function serializeError(error) {
|
|
|
2604
2638
|
|
|
2605
2639
|
Cannot serialize error with name "${name}"
|
|
2606
2640
|
|
|
2641
|
+
Authors of Promptbook probably forgot to add this error into the list of errors:
|
|
2642
|
+
https://github.com/webgptorg/promptbook/blob/main/src/errors/0-index.ts
|
|
2643
|
+
|
|
2644
|
+
|
|
2607
2645
|
${block(stack || message)}
|
|
2608
2646
|
|
|
2609
2647
|
`));
|
|
@@ -2645,30 +2683,42 @@ async function forEachAsync(array, options, callbackfunction) {
|
|
|
2645
2683
|
await Promise.all(tasks);
|
|
2646
2684
|
}
|
|
2647
2685
|
|
|
2686
|
+
/**
|
|
2687
|
+
* Represents the uncertain value
|
|
2688
|
+
*
|
|
2689
|
+
* @public exported from `@promptbook/core`
|
|
2690
|
+
*/
|
|
2691
|
+
const ZERO_VALUE = $deepFreeze({ value: 0 });
|
|
2692
|
+
/**
|
|
2693
|
+
* Represents the uncertain value
|
|
2694
|
+
*
|
|
2695
|
+
* @public exported from `@promptbook/core`
|
|
2696
|
+
*/
|
|
2697
|
+
const UNCERTAIN_ZERO_VALUE = $deepFreeze({ value: 0, isUncertain: true });
|
|
2648
2698
|
/**
|
|
2649
2699
|
* Represents the usage with no resources consumed
|
|
2650
2700
|
*
|
|
2651
2701
|
* @public exported from `@promptbook/core`
|
|
2652
2702
|
*/
|
|
2653
2703
|
const ZERO_USAGE = $deepFreeze({
|
|
2654
|
-
price:
|
|
2704
|
+
price: ZERO_VALUE,
|
|
2655
2705
|
input: {
|
|
2656
|
-
tokensCount:
|
|
2657
|
-
charactersCount:
|
|
2658
|
-
wordsCount:
|
|
2659
|
-
sentencesCount:
|
|
2660
|
-
linesCount:
|
|
2661
|
-
paragraphsCount:
|
|
2662
|
-
pagesCount:
|
|
2706
|
+
tokensCount: ZERO_VALUE,
|
|
2707
|
+
charactersCount: ZERO_VALUE,
|
|
2708
|
+
wordsCount: ZERO_VALUE,
|
|
2709
|
+
sentencesCount: ZERO_VALUE,
|
|
2710
|
+
linesCount: ZERO_VALUE,
|
|
2711
|
+
paragraphsCount: ZERO_VALUE,
|
|
2712
|
+
pagesCount: ZERO_VALUE,
|
|
2663
2713
|
},
|
|
2664
2714
|
output: {
|
|
2665
|
-
tokensCount:
|
|
2666
|
-
charactersCount:
|
|
2667
|
-
wordsCount:
|
|
2668
|
-
sentencesCount:
|
|
2669
|
-
linesCount:
|
|
2670
|
-
paragraphsCount:
|
|
2671
|
-
pagesCount:
|
|
2715
|
+
tokensCount: ZERO_VALUE,
|
|
2716
|
+
charactersCount: ZERO_VALUE,
|
|
2717
|
+
wordsCount: ZERO_VALUE,
|
|
2718
|
+
sentencesCount: ZERO_VALUE,
|
|
2719
|
+
linesCount: ZERO_VALUE,
|
|
2720
|
+
paragraphsCount: ZERO_VALUE,
|
|
2721
|
+
pagesCount: ZERO_VALUE,
|
|
2672
2722
|
},
|
|
2673
2723
|
});
|
|
2674
2724
|
/**
|
|
@@ -2677,24 +2727,24 @@ const ZERO_USAGE = $deepFreeze({
|
|
|
2677
2727
|
* @public exported from `@promptbook/core`
|
|
2678
2728
|
*/
|
|
2679
2729
|
$deepFreeze({
|
|
2680
|
-
price:
|
|
2730
|
+
price: UNCERTAIN_ZERO_VALUE,
|
|
2681
2731
|
input: {
|
|
2682
|
-
tokensCount:
|
|
2683
|
-
charactersCount:
|
|
2684
|
-
wordsCount:
|
|
2685
|
-
sentencesCount:
|
|
2686
|
-
linesCount:
|
|
2687
|
-
paragraphsCount:
|
|
2688
|
-
pagesCount:
|
|
2732
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2733
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2734
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2735
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2736
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2737
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2738
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2689
2739
|
},
|
|
2690
2740
|
output: {
|
|
2691
|
-
tokensCount:
|
|
2692
|
-
charactersCount:
|
|
2693
|
-
wordsCount:
|
|
2694
|
-
sentencesCount:
|
|
2695
|
-
linesCount:
|
|
2696
|
-
paragraphsCount:
|
|
2697
|
-
pagesCount:
|
|
2741
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2742
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2743
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2744
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2745
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2746
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2747
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2698
2748
|
},
|
|
2699
2749
|
});
|
|
2700
2750
|
/**
|
|
@@ -2982,6 +3032,7 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
2982
3032
|
`);
|
|
2983
3033
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
2984
3034
|
console.warn(warningMessage);
|
|
3035
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2985
3036
|
/*
|
|
2986
3037
|
return {
|
|
2987
3038
|
async listModels() {
|
|
@@ -3357,17 +3408,24 @@ function mimeTypeToExtension(value) {
|
|
|
3357
3408
|
/**
|
|
3358
3409
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3359
3410
|
*
|
|
3360
|
-
* @
|
|
3411
|
+
* @public exported from `@promptbook/core`
|
|
3361
3412
|
*/
|
|
3362
|
-
const
|
|
3413
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3363
3414
|
try {
|
|
3364
|
-
return await fetch(
|
|
3415
|
+
return await fetch(urlOrRequest, init);
|
|
3365
3416
|
}
|
|
3366
3417
|
catch (error) {
|
|
3367
3418
|
if (!(error instanceof Error)) {
|
|
3368
3419
|
throw error;
|
|
3369
3420
|
}
|
|
3370
|
-
|
|
3421
|
+
let url;
|
|
3422
|
+
if (typeof urlOrRequest === 'string') {
|
|
3423
|
+
url = urlOrRequest;
|
|
3424
|
+
}
|
|
3425
|
+
else if (urlOrRequest instanceof Request) {
|
|
3426
|
+
url = urlOrRequest.url;
|
|
3427
|
+
}
|
|
3428
|
+
throw new PromptbookFetchError(spaceTrim$1((block) => `
|
|
3371
3429
|
Can not fetch "${url}"
|
|
3372
3430
|
|
|
3373
3431
|
Fetch error:
|
|
@@ -3388,7 +3446,7 @@ const scraperFetch = async (url, init) => {
|
|
|
3388
3446
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3389
3447
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3390
3448
|
var _a;
|
|
3391
|
-
const { fetch =
|
|
3449
|
+
const { fetch = promptbookFetch } = tools;
|
|
3392
3450
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3393
3451
|
let { name } = knowledgeSource;
|
|
3394
3452
|
const { rootDirname = null,
|
|
@@ -3529,63 +3587,73 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
3529
3587
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, rootDirname, isVerbose = DEFAULT_IS_VERBOSE } = options;
|
|
3530
3588
|
const knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
3531
3589
|
await forEachAsync(knowledgeSources, { maxParallelCount }, async (knowledgeSource, index) => {
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3590
|
+
try {
|
|
3591
|
+
let partialPieces = null;
|
|
3592
|
+
const sourceHandler = await makeKnowledgeSourceHandler(knowledgeSource, tools, { rootDirname, isVerbose });
|
|
3593
|
+
const scrapers = arrayableToArray(tools.scrapers);
|
|
3594
|
+
for (const scraper of scrapers) {
|
|
3595
|
+
if (!scraper.metadata.mimeTypes.includes(sourceHandler.mimeType)
|
|
3596
|
+
// <- TODO: [🦔] Implement mime-type wildcards
|
|
3597
|
+
) {
|
|
3598
|
+
continue;
|
|
3599
|
+
}
|
|
3600
|
+
const partialPiecesUnchecked = await scraper.scrape(sourceHandler);
|
|
3601
|
+
if (partialPiecesUnchecked !== null) {
|
|
3602
|
+
partialPieces = [...partialPiecesUnchecked];
|
|
3603
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
3604
|
+
break;
|
|
3605
|
+
}
|
|
3606
|
+
console.warn(spaceTrim$1((block) => `
|
|
3607
|
+
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
3549
3608
|
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3609
|
+
The source:
|
|
3610
|
+
${block(knowledgeSource.knowledgeSourceContent
|
|
3611
|
+
.split('\n')
|
|
3612
|
+
.map((line) => `> ${line}`)
|
|
3613
|
+
.join('\n'))}
|
|
3555
3614
|
|
|
3556
|
-
|
|
3615
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
3557
3616
|
|
|
3558
3617
|
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3618
|
+
`));
|
|
3619
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3620
|
+
}
|
|
3621
|
+
if (partialPieces === null) {
|
|
3622
|
+
throw new KnowledgeScrapeError(spaceTrim$1((block) => `
|
|
3623
|
+
Cannot scrape knowledge
|
|
3564
3624
|
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3625
|
+
The source:
|
|
3626
|
+
> ${block(knowledgeSource.knowledgeSourceContent
|
|
3627
|
+
.split('\n')
|
|
3628
|
+
.map((line) => `> ${line}`)
|
|
3629
|
+
.join('\n'))}
|
|
3570
3630
|
|
|
3571
|
-
|
|
3631
|
+
No scraper found for the mime type "${sourceHandler.mimeType}"
|
|
3572
3632
|
|
|
3573
|
-
|
|
3633
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
3574
3634
|
|
|
3575
3635
|
|
|
3576
|
-
|
|
3636
|
+
`));
|
|
3637
|
+
}
|
|
3638
|
+
const pieces = partialPieces.map((partialPiece) => ({
|
|
3639
|
+
...partialPiece,
|
|
3640
|
+
sources: [
|
|
3641
|
+
{
|
|
3642
|
+
name: knowledgeSource.name,
|
|
3643
|
+
// line, column <- TODO: [☀]
|
|
3644
|
+
// <- TODO: [❎]
|
|
3645
|
+
},
|
|
3646
|
+
],
|
|
3647
|
+
}));
|
|
3648
|
+
knowledgePreparedUnflatten[index] = pieces;
|
|
3649
|
+
}
|
|
3650
|
+
catch (error) {
|
|
3651
|
+
if (!(error instanceof Error)) {
|
|
3652
|
+
throw error;
|
|
3653
|
+
}
|
|
3654
|
+
console.warn(error);
|
|
3655
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3577
3656
|
}
|
|
3578
|
-
const pieces = partialPieces.map((partialPiece) => ({
|
|
3579
|
-
...partialPiece,
|
|
3580
|
-
sources: [
|
|
3581
|
-
{
|
|
3582
|
-
name: knowledgeSource.name,
|
|
3583
|
-
// line, column <- TODO: [☀]
|
|
3584
|
-
// <- TODO: [❎]
|
|
3585
|
-
},
|
|
3586
|
-
],
|
|
3587
|
-
}));
|
|
3588
|
-
knowledgePreparedUnflatten[index] = pieces;
|
|
3589
3657
|
});
|
|
3590
3658
|
const knowledgePrepared = knowledgePreparedUnflatten.flat();
|
|
3591
3659
|
return knowledgePrepared;
|
|
@@ -4003,7 +4071,7 @@ function extractParameterNamesFromTask(task) {
|
|
|
4003
4071
|
if (parameterNames.has(subparameterName)) {
|
|
4004
4072
|
parameterNames.delete(subparameterName);
|
|
4005
4073
|
parameterNames.add(foreach.parameterName);
|
|
4006
|
-
// <- TODO: [
|
|
4074
|
+
// <- TODO: [🏮] Warn/logic error when `subparameterName` not used
|
|
4007
4075
|
}
|
|
4008
4076
|
}
|
|
4009
4077
|
}
|
|
@@ -5599,6 +5667,7 @@ function createPipelineExecutor(options) {
|
|
|
5599
5667
|
|
|
5600
5668
|
@see more at https://ptbk.io/prepare-pipeline
|
|
5601
5669
|
`));
|
|
5670
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5602
5671
|
}
|
|
5603
5672
|
let runCount = 0;
|
|
5604
5673
|
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|