@promptbook/wizard 0.100.0-45 → 0.100.0-47
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 +204 -107
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -6
- package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +4 -10
- package/esm/typings/src/book-components/Chat/interfaces/ChatMessage.d.ts +12 -26
- package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +30 -0
- package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +2 -4
- package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +2 -4
- package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +2 -4
- package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +2 -4
- package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +2 -4
- package/esm/typings/src/config.d.ts +7 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +8 -0
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
- package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
- package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/umd/index.umd.js +208 -111
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
package/umd/index.umd.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier'), require('prettier/parser-
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier', 'prettier/parser-
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.
|
5
|
-
})(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path,
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('jszip')) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'jszip'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.parserHtml, global.parserMarkdown, global.standalone, global.rxjs, global.sha256, global.mimeTypes, global.papaparse, global.readability, global.jsdom, global.showdown, global.dotenv, global.JSZip));
|
5
|
+
})(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, parserHtml, parserMarkdown, standalone, rxjs, sha256, mimeTypes, papaparse, readability, jsdom, showdown, dotenv, JSZip) { 'use strict';
|
6
6
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8
8
|
|
@@ -31,6 +31,7 @@
|
|
31
31
|
var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
|
32
32
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
33
33
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
34
|
+
var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
|
34
35
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
35
36
|
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
36
37
|
var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
|
@@ -49,7 +50,7 @@
|
|
49
50
|
* @generated
|
50
51
|
* @see https://github.com/webgptorg/promptbook
|
51
52
|
*/
|
52
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-47';
|
53
54
|
/**
|
54
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
55
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -337,6 +338,13 @@
|
|
337
338
|
* @public exported from `@promptbook/core`
|
338
339
|
*/
|
339
340
|
const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
341
|
+
/**
|
342
|
+
* API request timeout in milliseconds
|
343
|
+
* Can be overridden via API_REQUEST_TIMEOUT environment variable
|
344
|
+
*
|
345
|
+
* @public exported from `@promptbook/core`
|
346
|
+
*/
|
347
|
+
const API_REQUEST_TIMEOUT = parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
340
348
|
/**
|
341
349
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
342
350
|
*
|
@@ -4565,7 +4573,18 @@
|
|
4565
4573
|
const openAiOptions = { ...this.options };
|
4566
4574
|
delete openAiOptions.isVerbose;
|
4567
4575
|
delete openAiOptions.userId;
|
4568
|
-
|
4576
|
+
// Enhanced configuration for better ECONNRESET handling
|
4577
|
+
const enhancedOptions = {
|
4578
|
+
...openAiOptions,
|
4579
|
+
timeout: API_REQUEST_TIMEOUT,
|
4580
|
+
maxRetries: CONNECTION_RETRIES_LIMIT,
|
4581
|
+
defaultHeaders: {
|
4582
|
+
Connection: 'keep-alive',
|
4583
|
+
'Keep-Alive': 'timeout=30, max=100',
|
4584
|
+
...openAiOptions.defaultHeaders,
|
4585
|
+
},
|
4586
|
+
};
|
4587
|
+
this.client = new OpenAI__default["default"](enhancedOptions);
|
4569
4588
|
}
|
4570
4589
|
return this.client;
|
4571
4590
|
}
|
@@ -4653,7 +4672,7 @@
|
|
4653
4672
|
console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
4654
4673
|
}
|
4655
4674
|
const rawResponse = await this.limiter
|
4656
|
-
.schedule(() => client.chat.completions.create(rawRequest))
|
4675
|
+
.schedule(() => this.makeRequestWithRetry(() => client.chat.completions.create(rawRequest)))
|
4657
4676
|
.catch((error) => {
|
4658
4677
|
assertsError(error);
|
4659
4678
|
if (this.options.isVerbose) {
|
@@ -4729,7 +4748,7 @@
|
|
4729
4748
|
console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
4730
4749
|
}
|
4731
4750
|
const rawResponse = await this.limiter
|
4732
|
-
.schedule(() => client.completions.create(rawRequest))
|
4751
|
+
.schedule(() => this.makeRequestWithRetry(() => client.completions.create(rawRequest)))
|
4733
4752
|
.catch((error) => {
|
4734
4753
|
assertsError(error);
|
4735
4754
|
if (this.options.isVerbose) {
|
@@ -4793,7 +4812,7 @@
|
|
4793
4812
|
console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
4794
4813
|
}
|
4795
4814
|
const rawResponse = await this.limiter
|
4796
|
-
.schedule(() => client.embeddings.create(rawRequest))
|
4815
|
+
.schedule(() => this.makeRequestWithRetry(() => client.embeddings.create(rawRequest)))
|
4797
4816
|
.catch((error) => {
|
4798
4817
|
assertsError(error);
|
4799
4818
|
if (this.options.isVerbose) {
|
@@ -4851,6 +4870,76 @@
|
|
4851
4870
|
}
|
4852
4871
|
return model;
|
4853
4872
|
}
|
4873
|
+
// <- Note: [🤖] getDefaultXxxModel
|
4874
|
+
/**
|
4875
|
+
* Makes a request with retry logic for network errors like ECONNRESET
|
4876
|
+
*/
|
4877
|
+
async makeRequestWithRetry(requestFn) {
|
4878
|
+
let lastError;
|
4879
|
+
for (let attempt = 1; attempt <= CONNECTION_RETRIES_LIMIT; attempt++) {
|
4880
|
+
try {
|
4881
|
+
return await requestFn();
|
4882
|
+
}
|
4883
|
+
catch (error) {
|
4884
|
+
assertsError(error);
|
4885
|
+
lastError = error;
|
4886
|
+
// Check if this is a retryable network error
|
4887
|
+
const isRetryableError = this.isRetryableNetworkError(error);
|
4888
|
+
if (!isRetryableError || attempt === CONNECTION_RETRIES_LIMIT) {
|
4889
|
+
if (this.options.isVerbose) {
|
4890
|
+
console.info(colors__default["default"].bgRed('Final error after retries'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}:`, error);
|
4891
|
+
}
|
4892
|
+
throw error;
|
4893
|
+
}
|
4894
|
+
// Calculate exponential backoff delay
|
4895
|
+
const baseDelay = 1000; // 1 second
|
4896
|
+
const backoffDelay = baseDelay * Math.pow(2, attempt - 1);
|
4897
|
+
const jitterDelay = Math.random() * 500; // Add some randomness
|
4898
|
+
const totalDelay = backoffDelay + jitterDelay;
|
4899
|
+
if (this.options.isVerbose) {
|
4900
|
+
console.info(colors__default["default"].bgYellow('Retrying request'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}, waiting ${Math.round(totalDelay)}ms:`, error.message);
|
4901
|
+
}
|
4902
|
+
// Wait before retrying
|
4903
|
+
await new Promise((resolve) => setTimeout(resolve, totalDelay));
|
4904
|
+
}
|
4905
|
+
}
|
4906
|
+
throw lastError;
|
4907
|
+
}
|
4908
|
+
/**
|
4909
|
+
* Determines if an error is retryable (network-related errors)
|
4910
|
+
*/
|
4911
|
+
isRetryableNetworkError(error) {
|
4912
|
+
const errorMessage = error.message.toLowerCase();
|
4913
|
+
const errorCode = error.code;
|
4914
|
+
// Network connection errors that should be retried
|
4915
|
+
const retryableErrors = [
|
4916
|
+
'econnreset',
|
4917
|
+
'enotfound',
|
4918
|
+
'econnrefused',
|
4919
|
+
'etimedout',
|
4920
|
+
'socket hang up',
|
4921
|
+
'network error',
|
4922
|
+
'fetch failed',
|
4923
|
+
'connection reset',
|
4924
|
+
'connection refused',
|
4925
|
+
'timeout',
|
4926
|
+
];
|
4927
|
+
// Check error message
|
4928
|
+
if (retryableErrors.some((retryableError) => errorMessage.includes(retryableError))) {
|
4929
|
+
return true;
|
4930
|
+
}
|
4931
|
+
// Check error code
|
4932
|
+
if (errorCode && retryableErrors.includes(errorCode.toLowerCase())) {
|
4933
|
+
return true;
|
4934
|
+
}
|
4935
|
+
// Check for specific HTTP status codes that are retryable
|
4936
|
+
const errorWithStatus = error;
|
4937
|
+
const httpStatus = errorWithStatus.status || errorWithStatus.statusCode;
|
4938
|
+
if (httpStatus && [429, 500, 502, 503, 504].includes(httpStatus)) {
|
4939
|
+
return true;
|
4940
|
+
}
|
4941
|
+
return false;
|
4942
|
+
}
|
4854
4943
|
}
|
4855
4944
|
/**
|
4856
4945
|
* TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
|
@@ -6291,9 +6380,9 @@
|
|
6291
6380
|
*/
|
6292
6381
|
function prettifyMarkdown(content) {
|
6293
6382
|
try {
|
6294
|
-
return
|
6383
|
+
return standalone.format(content, {
|
6295
6384
|
parser: 'markdown',
|
6296
|
-
plugins: [parserHtml__default["default"]],
|
6385
|
+
plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
|
6297
6386
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
6298
6387
|
endOfLine: 'lf',
|
6299
6388
|
tabWidth: 4,
|
@@ -7762,7 +7851,7 @@
|
|
7762
7851
|
const result = await preparePersonaExecutor({
|
7763
7852
|
availableModels /* <- Note: Passing as JSON */,
|
7764
7853
|
personaDescription,
|
7765
|
-
}).asPromise();
|
7854
|
+
}).asPromise({ isCrashedOnError: true });
|
7766
7855
|
const { outputParameters } = result;
|
7767
7856
|
const { modelsRequirements: modelsRequirementsJson } = outputParameters;
|
7768
7857
|
let modelsRequirementsUnchecked = jsonParse(modelsRequirementsJson);
|
@@ -8375,7 +8464,7 @@
|
|
8375
8464
|
});
|
8376
8465
|
const result = await prepareTitleExecutor({
|
8377
8466
|
book: sources.map(({ content }) => content).join('\n\n'),
|
8378
|
-
}).asPromise();
|
8467
|
+
}).asPromise({ isCrashedOnError: true });
|
8379
8468
|
const { outputParameters } = result;
|
8380
8469
|
const { title: titleRaw } = outputParameters;
|
8381
8470
|
if (isVerbose) {
|
@@ -10324,64 +10413,74 @@
|
|
10324
10413
|
});
|
10325
10414
|
});
|
10326
10415
|
};
|
10327
|
-
const pipelineExecutor = (inputParameters) =>
|
10328
|
-
|
10329
|
-
|
10330
|
-
|
10331
|
-
|
10332
|
-
|
10333
|
-
|
10334
|
-
|
10335
|
-
|
10336
|
-
|
10337
|
-
|
10338
|
-
|
10339
|
-
|
10340
|
-
|
10341
|
-
|
10342
|
-
|
10343
|
-
|
10344
|
-
|
10345
|
-
|
10346
|
-
// Find current task being executed (first task not yet completed)
|
10347
|
-
const remainingTasks = pipeline.tasks.filter((task) => !executedTaskTitles.has(task.title));
|
10348
|
-
if (remainingTasks.length > 0) {
|
10349
|
-
currentTaskName = remainingTasks[0].name;
|
10416
|
+
const pipelineExecutor = (inputParameters) => {
|
10417
|
+
const startTime = new Date().getTime();
|
10418
|
+
return createTask({
|
10419
|
+
taskType: 'EXECUTION',
|
10420
|
+
title: pipeline.title,
|
10421
|
+
taskProcessCallback(updateOngoingResult, updateTldr) {
|
10422
|
+
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
10423
|
+
var _a, _b;
|
10424
|
+
updateOngoingResult(newOngoingResult);
|
10425
|
+
// Calculate and update tldr based on pipeline progress
|
10426
|
+
const cv = newOngoingResult;
|
10427
|
+
// Calculate progress based on parameters resolved vs total parameters
|
10428
|
+
const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
|
10429
|
+
let resolvedParameters = 0;
|
10430
|
+
let currentTaskTitle = '';
|
10431
|
+
// Get the resolved parameters from output parameters
|
10432
|
+
if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
|
10433
|
+
// Count how many output parameters have non-empty values
|
10434
|
+
resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
|
10350
10435
|
}
|
10351
|
-
|
10352
|
-
|
10353
|
-
|
10354
|
-
|
10355
|
-
|
10356
|
-
|
10357
|
-
|
10358
|
-
|
10359
|
-
|
10360
|
-
|
10361
|
-
|
10362
|
-
|
10363
|
-
|
10364
|
-
|
10365
|
-
|
10366
|
-
|
10367
|
-
|
10368
|
-
|
10369
|
-
|
10370
|
-
|
10371
|
-
|
10372
|
-
|
10373
|
-
|
10374
|
-
|
10375
|
-
|
10376
|
-
|
10377
|
-
|
10378
|
-
|
10379
|
-
|
10380
|
-
|
10436
|
+
// Try to determine current task from execution report
|
10437
|
+
if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
|
10438
|
+
const lastExecution = cv.executionReport.promptExecutions[cv.executionReport.promptExecutions.length - 1];
|
10439
|
+
if ((_b = lastExecution === null || lastExecution === void 0 ? void 0 : lastExecution.prompt) === null || _b === void 0 ? void 0 : _b.title) {
|
10440
|
+
currentTaskTitle = lastExecution.prompt.title;
|
10441
|
+
}
|
10442
|
+
}
|
10443
|
+
// Calculate base progress percentage
|
10444
|
+
let percent = totalParameters > 0 ? resolvedParameters / totalParameters : 0;
|
10445
|
+
// Add time-based progress for current task if we haven't completed all parameters
|
10446
|
+
if (resolvedParameters < totalParameters) {
|
10447
|
+
const elapsedMs = new Date().getTime() - startTime;
|
10448
|
+
const estimatedTotalMs = totalParameters * 30 * 1000; // Estimate 30 seconds per parameter
|
10449
|
+
const timeProgress = Math.min(elapsedMs / estimatedTotalMs, 0.9); // Cap at 90% for time-based progress
|
10450
|
+
// If we have time progress but no parameter progress, show time progress
|
10451
|
+
if (percent === 0 && timeProgress > 0) {
|
10452
|
+
percent = Math.min(timeProgress, 0.1); // Show some progress but not more than 10%
|
10453
|
+
}
|
10454
|
+
else if (percent < 1) {
|
10455
|
+
// Add partial progress for current task
|
10456
|
+
const taskProgress = totalParameters > 0 ? (1 / totalParameters) * 0.5 : 0; // 50% of task progress
|
10457
|
+
percent = Math.min(percent + taskProgress, 0.95); // Cap at 95% until fully complete
|
10458
|
+
}
|
10459
|
+
}
|
10460
|
+
// Clamp to [0,1]
|
10461
|
+
percent = Math.min(Math.max(percent, 0), 1);
|
10462
|
+
// Generate message
|
10463
|
+
let message = '';
|
10464
|
+
if (currentTaskTitle) {
|
10465
|
+
message = `Executing: ${currentTaskTitle}`;
|
10466
|
+
}
|
10467
|
+
else if (resolvedParameters === 0) {
|
10468
|
+
message = 'Starting pipeline execution';
|
10469
|
+
}
|
10470
|
+
else if (resolvedParameters < totalParameters) {
|
10471
|
+
message = `Processing pipeline (${resolvedParameters}/${totalParameters} parameters resolved)`;
|
10472
|
+
}
|
10473
|
+
else {
|
10474
|
+
message = 'Completing pipeline execution';
|
10475
|
+
}
|
10476
|
+
updateTldr({
|
10477
|
+
percent: percent,
|
10478
|
+
message,
|
10479
|
+
});
|
10381
10480
|
});
|
10382
|
-
}
|
10383
|
-
}
|
10384
|
-
}
|
10481
|
+
},
|
10482
|
+
});
|
10483
|
+
};
|
10385
10484
|
// <- TODO: Make types such as there is no need to do `as` for `createTask`
|
10386
10485
|
return pipelineExecutor;
|
10387
10486
|
}
|
@@ -10466,7 +10565,9 @@
|
|
10466
10565
|
},
|
10467
10566
|
});
|
10468
10567
|
const knowledgeContent = await source.asText();
|
10469
|
-
const result = await prepareKnowledgeFromMarkdownExecutor({ knowledgeContent }).asPromise(
|
10568
|
+
const result = await prepareKnowledgeFromMarkdownExecutor({ knowledgeContent }).asPromise({
|
10569
|
+
isCrashedOnError: true,
|
10570
|
+
});
|
10470
10571
|
const { outputParameters } = result;
|
10471
10572
|
const { knowledgePieces: knowledgePiecesRaw } = outputParameters;
|
10472
10573
|
const knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
|
@@ -10490,12 +10591,16 @@
|
|
10490
10591
|
];
|
10491
10592
|
*/
|
10492
10593
|
try {
|
10493
|
-
const titleResult = await prepareTitleExecutor({ knowledgePieceContent }).asPromise(
|
10594
|
+
const titleResult = await prepareTitleExecutor({ knowledgePieceContent }).asPromise({
|
10595
|
+
isCrashedOnError: true,
|
10596
|
+
});
|
10494
10597
|
const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
|
10495
10598
|
title = spaceTrim__default["default"](titleRaw) /* <- TODO: Maybe do in pipeline */;
|
10496
10599
|
name = titleToName(title);
|
10497
10600
|
// --- Keywords
|
10498
|
-
const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise(
|
10601
|
+
const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
|
10602
|
+
isCrashedOnError: true,
|
10603
|
+
});
|
10499
10604
|
const { keywords: keywordsRaw = '' } = keywordsResult.outputParameters;
|
10500
10605
|
keywords = (keywordsRaw || '')
|
10501
10606
|
.split(',')
|
@@ -13162,31 +13267,23 @@
|
|
13162
13267
|
return content;
|
13163
13268
|
}
|
13164
13269
|
|
13270
|
+
/**
|
13271
|
+
* @private internal for `preserve`
|
13272
|
+
*/
|
13273
|
+
const _preserved = [];
|
13165
13274
|
/**
|
13166
13275
|
* Does nothing, but preserves the function in the bundle
|
13167
13276
|
* Compiler is tricked into thinking the function is used
|
13168
13277
|
*
|
13169
13278
|
* @param value any function to preserve
|
13170
13279
|
* @returns nothing
|
13171
|
-
* @private
|
13172
|
-
*/
|
13173
|
-
function preserve(
|
13174
|
-
|
13175
|
-
(async () => {
|
13176
|
-
// TODO: [💩] Change to `await forEver` or `forTime(Infinity)`
|
13177
|
-
await waitasecond.forTime(100000000);
|
13178
|
-
// [1]
|
13179
|
-
try {
|
13180
|
-
await func();
|
13181
|
-
}
|
13182
|
-
finally {
|
13183
|
-
// do nothing
|
13184
|
-
}
|
13185
|
-
})();
|
13280
|
+
* @private within the repository
|
13281
|
+
*/
|
13282
|
+
function $preserve(...value) {
|
13283
|
+
_preserved.push(...value);
|
13186
13284
|
}
|
13187
13285
|
/**
|
13188
|
-
*
|
13189
|
-
* TODO: [1] This maybe does memory leak
|
13286
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
13190
13287
|
*/
|
13191
13288
|
|
13192
13289
|
// Note: [💎]
|
@@ -13214,25 +13311,25 @@
|
|
13214
13311
|
// Note: [💎]
|
13215
13312
|
// Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
|
13216
13313
|
const spaceTrim = (_) => spaceTrim__default["default"](_);
|
13217
|
-
preserve(spaceTrim);
|
13314
|
+
$preserve(spaceTrim);
|
13218
13315
|
const removeQuotes$1 = removeQuotes;
|
13219
|
-
preserve(removeQuotes$1);
|
13316
|
+
$preserve(removeQuotes$1);
|
13220
13317
|
const unwrapResult$1 = unwrapResult;
|
13221
|
-
preserve(unwrapResult$1);
|
13318
|
+
$preserve(unwrapResult$1);
|
13222
13319
|
const trimEndOfCodeBlock$1 = trimEndOfCodeBlock;
|
13223
|
-
preserve(trimEndOfCodeBlock$1);
|
13320
|
+
$preserve(trimEndOfCodeBlock$1);
|
13224
13321
|
const trimCodeBlock$1 = trimCodeBlock;
|
13225
|
-
preserve(trimCodeBlock$1);
|
13322
|
+
$preserve(trimCodeBlock$1);
|
13226
13323
|
// TODO: DRY [🍯]
|
13227
13324
|
const trim = (str) => str.trim();
|
13228
|
-
preserve(trim);
|
13325
|
+
$preserve(trim);
|
13229
13326
|
// TODO: DRY [🍯]
|
13230
13327
|
const reverse = (str) => str.split('').reverse().join('');
|
13231
|
-
preserve(reverse);
|
13328
|
+
$preserve(reverse);
|
13232
13329
|
const removeEmojis$1 = removeEmojis;
|
13233
|
-
preserve(removeEmojis$1);
|
13330
|
+
$preserve(removeEmojis$1);
|
13234
13331
|
const prettifyMarkdown$1 = prettifyMarkdown;
|
13235
|
-
preserve(prettifyMarkdown$1);
|
13332
|
+
$preserve(prettifyMarkdown$1);
|
13236
13333
|
//-------[n12:]---
|
13237
13334
|
const capitalize$1 = capitalize;
|
13238
13335
|
const decapitalize$1 = decapitalize;
|
@@ -13248,18 +13345,18 @@
|
|
13248
13345
|
// TODO: DRY [🍯]
|
13249
13346
|
Array.from(parseKeywordsFromString(input)).join(', '); /* <- TODO: [🧠] What is the best format comma list, bullet list,...? */
|
13250
13347
|
const normalizeTo_SCREAMING_CASE$1 = normalizeTo_SCREAMING_CASE;
|
13251
|
-
preserve(capitalize$1);
|
13252
|
-
preserve(decapitalize$1);
|
13253
|
-
preserve(nameToUriPart$1);
|
13254
|
-
preserve(nameToUriParts$1);
|
13255
|
-
preserve(removeDiacritics$1);
|
13256
|
-
preserve(normalizeWhitespaces$1);
|
13257
|
-
preserve(normalizeToKebabCase$1);
|
13258
|
-
preserve(normalizeTo_camelCase$1);
|
13259
|
-
preserve(normalizeTo_snake_case$1);
|
13260
|
-
preserve(normalizeTo_PascalCase$1);
|
13261
|
-
preserve(parseKeywords);
|
13262
|
-
preserve(normalizeTo_SCREAMING_CASE$1);
|
13348
|
+
$preserve(capitalize$1);
|
13349
|
+
$preserve(decapitalize$1);
|
13350
|
+
$preserve(nameToUriPart$1);
|
13351
|
+
$preserve(nameToUriParts$1);
|
13352
|
+
$preserve(removeDiacritics$1);
|
13353
|
+
$preserve(normalizeWhitespaces$1);
|
13354
|
+
$preserve(normalizeToKebabCase$1);
|
13355
|
+
$preserve(normalizeTo_camelCase$1);
|
13356
|
+
$preserve(normalizeTo_snake_case$1);
|
13357
|
+
$preserve(normalizeTo_PascalCase$1);
|
13358
|
+
$preserve(parseKeywords);
|
13359
|
+
$preserve(normalizeTo_SCREAMING_CASE$1);
|
13263
13360
|
//-------[/n12]---
|
13264
13361
|
if (!script.includes('return')) {
|
13265
13362
|
script = `return ${script}`;
|
@@ -17308,7 +17405,7 @@
|
|
17308
17405
|
// ▶ Create executor - the function that will execute the Pipeline
|
17309
17406
|
const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
|
17310
17407
|
// 🚀▶ Execute the Pipeline
|
17311
|
-
const result = await pipelineExecutor(inputParameters).asPromise();
|
17408
|
+
const result = await pipelineExecutor(inputParameters).asPromise({ isCrashedOnError: true });
|
17312
17409
|
const { outputParameters } = result;
|
17313
17410
|
const outputParametersLength = Object.keys(outputParameters).length;
|
17314
17411
|
let resultString;
|