@promptbook/markdown-utils 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 +159 -107
- 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 +2 -2
- package/umd/index.umd.js +124 -72
- 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('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markdown-utils"] = {}, global.spaceTrim, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, spaceTrim, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markdown-utils"] = {}, global.spaceTrim$1, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, 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
|
|
@@ -173,6 +173,17 @@
|
|
|
173
173
|
return content;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Trims string from all 4 sides
|
|
178
|
+
*
|
|
179
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
180
|
+
* Developed by same author @hejny as this package
|
|
181
|
+
*
|
|
182
|
+
* @public exported from `@promptbook/utils`
|
|
183
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
184
|
+
*/
|
|
185
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
186
|
+
|
|
176
187
|
/**
|
|
177
188
|
* @private util of `@promptbook/color`
|
|
178
189
|
* @de
|
|
@@ -221,6 +232,7 @@
|
|
|
221
232
|
* @public exported from `@promptbook/color`
|
|
222
233
|
*/
|
|
223
234
|
const CSS_COLORS = {
|
|
235
|
+
promptbook: '#79EAFD',
|
|
224
236
|
transparent: 'rgba(0,0,0,0)',
|
|
225
237
|
aliceblue: '#f0f8ff',
|
|
226
238
|
antiquewhite: '#faebd7',
|
|
@@ -421,21 +433,61 @@
|
|
|
421
433
|
* @param color
|
|
422
434
|
* @returns Color object
|
|
423
435
|
*/
|
|
424
|
-
static from(color) {
|
|
425
|
-
if (color
|
|
436
|
+
static from(color, _isSingleValue = false) {
|
|
437
|
+
if (color === '') {
|
|
438
|
+
throw new Error(`Can not create color from empty string`);
|
|
439
|
+
}
|
|
440
|
+
else if (color instanceof Color) {
|
|
426
441
|
return take(color);
|
|
427
442
|
}
|
|
428
443
|
else if (Color.isColor(color)) {
|
|
429
444
|
return take(color);
|
|
430
445
|
}
|
|
431
446
|
else if (typeof color === 'string') {
|
|
432
|
-
|
|
447
|
+
try {
|
|
448
|
+
return Color.fromString(color);
|
|
449
|
+
}
|
|
450
|
+
catch (error) {
|
|
451
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
452
|
+
if (_isSingleValue) {
|
|
453
|
+
throw error;
|
|
454
|
+
}
|
|
455
|
+
const parts = color.split(/[\s+,;|]/);
|
|
456
|
+
if (parts.length > 0) {
|
|
457
|
+
return Color.from(parts[0].trim(), true);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
433
463
|
}
|
|
434
464
|
else {
|
|
435
465
|
console.error({ color });
|
|
436
466
|
throw new Error(`Can not create color from given object`);
|
|
437
467
|
}
|
|
438
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Creates a new Color instance from miscellaneous formats
|
|
471
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
472
|
+
*
|
|
473
|
+
* @param color
|
|
474
|
+
* @returns Color object
|
|
475
|
+
*/
|
|
476
|
+
static fromSafe(color) {
|
|
477
|
+
try {
|
|
478
|
+
return Color.from(color);
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
482
|
+
console.warn(spaceTrim((block) => `
|
|
483
|
+
Color.fromSafe error:
|
|
484
|
+
${block(error.message)}
|
|
485
|
+
|
|
486
|
+
Returning default PROMPTBOOK_COLOR.
|
|
487
|
+
`));
|
|
488
|
+
return Color.fromString('promptbook');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
439
491
|
/**
|
|
440
492
|
* Creates a new Color instance from miscellaneous string formats
|
|
441
493
|
*
|
|
@@ -1051,7 +1103,7 @@
|
|
|
1051
1103
|
*
|
|
1052
1104
|
* @public exported from `@promptbook/core`
|
|
1053
1105
|
*/
|
|
1054
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1106
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
1055
1107
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1056
1108
|
/**
|
|
1057
1109
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1292,7 +1344,7 @@
|
|
|
1292
1344
|
*/
|
|
1293
1345
|
class UnexpectedError extends Error {
|
|
1294
1346
|
constructor(message) {
|
|
1295
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1347
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1296
1348
|
${block(message)}
|
|
1297
1349
|
|
|
1298
1350
|
Note: This error should not happen.
|
|
@@ -1318,7 +1370,7 @@
|
|
|
1318
1370
|
constructor(whatWasThrown) {
|
|
1319
1371
|
const tag = `[🤮]`;
|
|
1320
1372
|
console.error(tag, whatWasThrown);
|
|
1321
|
-
super(spaceTrim.spaceTrim(`
|
|
1373
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1322
1374
|
Non-Error object was thrown
|
|
1323
1375
|
|
|
1324
1376
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2138,7 +2190,7 @@
|
|
|
2138
2190
|
if (!(error instanceof PipelineLogicError)) {
|
|
2139
2191
|
throw error;
|
|
2140
2192
|
}
|
|
2141
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2193
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2142
2194
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2143
2195
|
|
|
2144
2196
|
${block(error.message)}
|
|
@@ -2165,7 +2217,7 @@
|
|
|
2165
2217
|
})();
|
|
2166
2218
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2167
2219
|
// <- Note: [🚲]
|
|
2168
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2220
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2169
2221
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2170
2222
|
|
|
2171
2223
|
${block(pipelineIdentification)}
|
|
@@ -2173,7 +2225,7 @@
|
|
|
2173
2225
|
}
|
|
2174
2226
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2175
2227
|
// <- Note: [🚲]
|
|
2176
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2228
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2177
2229
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2178
2230
|
|
|
2179
2231
|
${block(pipelineIdentification)}
|
|
@@ -2182,7 +2234,7 @@
|
|
|
2182
2234
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2183
2235
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2184
2236
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2185
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2237
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2186
2238
|
Pipeline is valid JSON but with wrong structure
|
|
2187
2239
|
|
|
2188
2240
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2193,7 +2245,7 @@
|
|
|
2193
2245
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2194
2246
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2195
2247
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2196
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2248
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2197
2249
|
Pipeline is valid JSON but with wrong structure
|
|
2198
2250
|
|
|
2199
2251
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2219,7 +2271,7 @@
|
|
|
2219
2271
|
// Note: Check each parameter individually
|
|
2220
2272
|
for (const parameter of pipeline.parameters) {
|
|
2221
2273
|
if (parameter.isInput && parameter.isOutput) {
|
|
2222
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2274
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2223
2275
|
|
|
2224
2276
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2225
2277
|
|
|
@@ -2230,7 +2282,7 @@
|
|
|
2230
2282
|
if (!parameter.isInput &&
|
|
2231
2283
|
!parameter.isOutput &&
|
|
2232
2284
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2233
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2285
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2234
2286
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2235
2287
|
|
|
2236
2288
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2242,7 +2294,7 @@
|
|
|
2242
2294
|
}
|
|
2243
2295
|
// Note: Testing that parameter is either input or result of some task
|
|
2244
2296
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2245
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2297
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2246
2298
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2247
2299
|
|
|
2248
2300
|
You can do one of these:
|
|
@@ -2258,14 +2310,14 @@
|
|
|
2258
2310
|
// Note: Checking each task individually
|
|
2259
2311
|
for (const task of pipeline.tasks) {
|
|
2260
2312
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2261
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2313
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2262
2314
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2263
2315
|
|
|
2264
2316
|
${block(pipelineIdentification)}
|
|
2265
2317
|
`));
|
|
2266
2318
|
}
|
|
2267
2319
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2268
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2320
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2269
2321
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2270
2322
|
|
|
2271
2323
|
${block(pipelineIdentification)}
|
|
@@ -2275,7 +2327,7 @@
|
|
|
2275
2327
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2276
2328
|
if (!task.format &&
|
|
2277
2329
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2278
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2330
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2279
2331
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2280
2332
|
|
|
2281
2333
|
${block(pipelineIdentification)}
|
|
@@ -2283,7 +2335,7 @@
|
|
|
2283
2335
|
}
|
|
2284
2336
|
for (const joker of task.jokerParameterNames) {
|
|
2285
2337
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2286
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2338
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2287
2339
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2288
2340
|
|
|
2289
2341
|
${block(pipelineIdentification)}
|
|
@@ -2294,21 +2346,21 @@
|
|
|
2294
2346
|
if (task.expectations) {
|
|
2295
2347
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2296
2348
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2297
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2349
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2298
2350
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2299
2351
|
|
|
2300
2352
|
${block(pipelineIdentification)}
|
|
2301
2353
|
`));
|
|
2302
2354
|
}
|
|
2303
2355
|
if (min !== undefined && min < 0) {
|
|
2304
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2356
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2305
2357
|
Min expectation of ${unit} must be zero or positive
|
|
2306
2358
|
|
|
2307
2359
|
${block(pipelineIdentification)}
|
|
2308
2360
|
`));
|
|
2309
2361
|
}
|
|
2310
2362
|
if (max !== undefined && max <= 0) {
|
|
2311
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2363
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2312
2364
|
Max expectation of ${unit} must be positive
|
|
2313
2365
|
|
|
2314
2366
|
${block(pipelineIdentification)}
|
|
@@ -2330,7 +2382,7 @@
|
|
|
2330
2382
|
while (unresovedTasks.length > 0) {
|
|
2331
2383
|
if (loopLimit-- < 0) {
|
|
2332
2384
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2333
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2385
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2334
2386
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2335
2387
|
|
|
2336
2388
|
${block(pipelineIdentification)}
|
|
@@ -2340,7 +2392,7 @@
|
|
|
2340
2392
|
if (currentlyResovedTasks.length === 0) {
|
|
2341
2393
|
throw new PipelineLogicError(
|
|
2342
2394
|
// TODO: [🐎] DRY
|
|
2343
|
-
spaceTrim.spaceTrim((block) => `
|
|
2395
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2344
2396
|
|
|
2345
2397
|
Can not resolve some parameters:
|
|
2346
2398
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2504,7 +2556,7 @@
|
|
|
2504
2556
|
for (const pipeline of pipelines) {
|
|
2505
2557
|
// TODO: [👠] DRY
|
|
2506
2558
|
if (pipeline.pipelineUrl === undefined) {
|
|
2507
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2559
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2508
2560
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2509
2561
|
|
|
2510
2562
|
File:
|
|
@@ -2526,7 +2578,7 @@
|
|
|
2526
2578
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2527
2579
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2528
2580
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2529
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2581
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2530
2582
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2531
2583
|
|
|
2532
2584
|
Conflicting files:
|
|
@@ -2558,13 +2610,13 @@
|
|
|
2558
2610
|
const pipeline = this.collection.get(url);
|
|
2559
2611
|
if (!pipeline) {
|
|
2560
2612
|
if (this.listPipelines().length === 0) {
|
|
2561
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
2613
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
2562
2614
|
Pipeline with url "${url}" not found
|
|
2563
2615
|
|
|
2564
2616
|
No pipelines available
|
|
2565
2617
|
`));
|
|
2566
2618
|
}
|
|
2567
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
2619
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
2568
2620
|
Pipeline with url "${url}" not found
|
|
2569
2621
|
|
|
2570
2622
|
Available pipelines:
|
|
@@ -2605,7 +2657,7 @@
|
|
|
2605
2657
|
*/
|
|
2606
2658
|
class MissingToolsError extends Error {
|
|
2607
2659
|
constructor(message) {
|
|
2608
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
2660
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2609
2661
|
${block(message)}
|
|
2610
2662
|
|
|
2611
2663
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -2839,7 +2891,7 @@
|
|
|
2839
2891
|
*/
|
|
2840
2892
|
class NotYetImplementedError extends Error {
|
|
2841
2893
|
constructor(message) {
|
|
2842
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
2894
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2843
2895
|
${block(message)}
|
|
2844
2896
|
|
|
2845
2897
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3078,11 +3130,11 @@
|
|
|
3078
3130
|
throw deserializeError(errors[0]);
|
|
3079
3131
|
}
|
|
3080
3132
|
else {
|
|
3081
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3133
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3082
3134
|
Multiple errors occurred during Promptbook execution
|
|
3083
3135
|
|
|
3084
3136
|
${block(errors
|
|
3085
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3137
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3086
3138
|
${name} ${index + 1}:
|
|
3087
3139
|
${block(stack || message)}
|
|
3088
3140
|
`))
|
|
@@ -4876,7 +4928,7 @@
|
|
|
4876
4928
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4877
4929
|
knowledgePiecesCount > 0 &&
|
|
4878
4930
|
!dependentParameterNames.includes('knowledge')) {
|
|
4879
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
4931
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4880
4932
|
{content}
|
|
4881
4933
|
|
|
4882
4934
|
## Knowledge
|
|
@@ -5189,7 +5241,7 @@
|
|
|
5189
5241
|
}
|
|
5190
5242
|
catch (error) {
|
|
5191
5243
|
assertsError(error);
|
|
5192
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5244
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5193
5245
|
Can not extract variables from the script
|
|
5194
5246
|
${block(error.stack || error.message)}
|
|
5195
5247
|
|
|
@@ -5924,7 +5976,7 @@
|
|
|
5924
5976
|
}
|
|
5925
5977
|
catch (error) {
|
|
5926
5978
|
keepUnused(error);
|
|
5927
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
5979
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
5928
5980
|
Expected valid JSON string
|
|
5929
5981
|
|
|
5930
5982
|
The expected JSON text:
|
|
@@ -5987,7 +6039,7 @@
|
|
|
5987
6039
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
5988
6040
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
5989
6041
|
if (isJokerAttempt && !jokerParameterName) {
|
|
5990
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6042
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5991
6043
|
Joker not found in attempt ${attemptIndex}
|
|
5992
6044
|
|
|
5993
6045
|
${block(pipelineIdentification)}
|
|
@@ -5998,7 +6050,7 @@
|
|
|
5998
6050
|
$ongoingTaskResult.$expectError = null;
|
|
5999
6051
|
if (isJokerAttempt) {
|
|
6000
6052
|
if (parameters[jokerParameterName] === undefined) {
|
|
6001
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6053
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6002
6054
|
Joker parameter {${jokerParameterName}} not defined
|
|
6003
6055
|
|
|
6004
6056
|
${block(pipelineIdentification)}
|
|
@@ -6056,7 +6108,7 @@
|
|
|
6056
6108
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6057
6109
|
break variant;
|
|
6058
6110
|
case 'EMBEDDING':
|
|
6059
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6111
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6060
6112
|
Embedding model can not be used in pipeline
|
|
6061
6113
|
|
|
6062
6114
|
This should be catched during parsing
|
|
@@ -6067,7 +6119,7 @@
|
|
|
6067
6119
|
break variant;
|
|
6068
6120
|
// <- case [🤖]:
|
|
6069
6121
|
default:
|
|
6070
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6122
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6071
6123
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6072
6124
|
|
|
6073
6125
|
${block(pipelineIdentification)}
|
|
@@ -6078,14 +6130,14 @@
|
|
|
6078
6130
|
break;
|
|
6079
6131
|
case 'SCRIPT_TASK':
|
|
6080
6132
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6081
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6133
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6082
6134
|
No script execution tools are available
|
|
6083
6135
|
|
|
6084
6136
|
${block(pipelineIdentification)}
|
|
6085
6137
|
`));
|
|
6086
6138
|
}
|
|
6087
6139
|
if (!task.contentLanguage) {
|
|
6088
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6140
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6089
6141
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6090
6142
|
|
|
6091
6143
|
${block(pipelineIdentification)}
|
|
@@ -6116,7 +6168,7 @@
|
|
|
6116
6168
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6117
6169
|
}
|
|
6118
6170
|
else {
|
|
6119
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6171
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6120
6172
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6121
6173
|
|
|
6122
6174
|
${block(pipelineIdentification)}
|
|
@@ -6130,7 +6182,7 @@
|
|
|
6130
6182
|
break taskType;
|
|
6131
6183
|
case 'DIALOG_TASK':
|
|
6132
6184
|
if (tools.userInterface === undefined) {
|
|
6133
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6185
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6134
6186
|
User interface tools are not available
|
|
6135
6187
|
|
|
6136
6188
|
${block(pipelineIdentification)}
|
|
@@ -6148,7 +6200,7 @@
|
|
|
6148
6200
|
break taskType;
|
|
6149
6201
|
// <- case: [🅱]
|
|
6150
6202
|
default:
|
|
6151
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6203
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6152
6204
|
Unknown execution type "${task.taskType}"
|
|
6153
6205
|
|
|
6154
6206
|
${block(pipelineIdentification)}
|
|
@@ -6246,7 +6298,7 @@
|
|
|
6246
6298
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6247
6299
|
// Note: Create a summary of all failures
|
|
6248
6300
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6249
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6301
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6250
6302
|
var _a, _b;
|
|
6251
6303
|
return `
|
|
6252
6304
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6256,14 +6308,14 @@
|
|
|
6256
6308
|
Result:
|
|
6257
6309
|
${block(failure.result === null
|
|
6258
6310
|
? 'null'
|
|
6259
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6311
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6260
6312
|
.split('\n')
|
|
6261
6313
|
.map((line) => `> ${line}`)
|
|
6262
6314
|
.join('\n'))}
|
|
6263
6315
|
`;
|
|
6264
6316
|
}))
|
|
6265
6317
|
.join('\n\n---\n\n');
|
|
6266
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6318
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6267
6319
|
var _a;
|
|
6268
6320
|
return `
|
|
6269
6321
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6283,7 +6335,7 @@
|
|
|
6283
6335
|
}
|
|
6284
6336
|
}
|
|
6285
6337
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6286
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6338
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6287
6339
|
Something went wrong and prompt result is null
|
|
6288
6340
|
|
|
6289
6341
|
${block(pipelineIdentification)}
|
|
@@ -6589,7 +6641,7 @@
|
|
|
6589
6641
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6590
6642
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6591
6643
|
if (reservedParameters[parameterName] === undefined) {
|
|
6592
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6644
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6593
6645
|
Reserved parameter {${parameterName}} is not defined
|
|
6594
6646
|
|
|
6595
6647
|
${block(pipelineIdentification)}
|
|
@@ -6615,7 +6667,7 @@
|
|
|
6615
6667
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6616
6668
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6617
6669
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6618
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6670
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6619
6671
|
Dependent parameters are not consistent with used parameters:
|
|
6620
6672
|
|
|
6621
6673
|
Dependent parameters:
|
|
@@ -6659,7 +6711,7 @@
|
|
|
6659
6711
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6660
6712
|
// Houston, we have a problem
|
|
6661
6713
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6662
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6714
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6663
6715
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6664
6716
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6665
6717
|
|
|
@@ -6728,7 +6780,7 @@
|
|
|
6728
6780
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6729
6781
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6730
6782
|
// [4]
|
|
6731
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6783
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6732
6784
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6733
6785
|
|
|
6734
6786
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -6836,7 +6888,7 @@
|
|
|
6836
6888
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6837
6889
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6838
6890
|
if (parameter === undefined) {
|
|
6839
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6891
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6840
6892
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
6841
6893
|
|
|
6842
6894
|
${block(pipelineIdentification)}
|
|
@@ -6851,7 +6903,7 @@
|
|
|
6851
6903
|
// TODO: [🧠] This should be also non-critical error
|
|
6852
6904
|
return exportJson({
|
|
6853
6905
|
name: 'pipelineExecutorResult',
|
|
6854
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
6906
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
6855
6907
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
6856
6908
|
|
|
6857
6909
|
${block(pipelineIdentification)}
|
|
@@ -6860,7 +6912,7 @@
|
|
|
6860
6912
|
value: {
|
|
6861
6913
|
isSuccessful: false,
|
|
6862
6914
|
errors: [
|
|
6863
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6915
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6864
6916
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
6865
6917
|
|
|
6866
6918
|
${block(pipelineIdentification)}
|
|
@@ -6887,7 +6939,7 @@
|
|
|
6887
6939
|
while (unresovedTasks.length > 0) {
|
|
6888
6940
|
if (loopLimit-- < 0) {
|
|
6889
6941
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
6890
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6942
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6891
6943
|
Loop limit reached during resolving parameters pipeline execution
|
|
6892
6944
|
|
|
6893
6945
|
${block(pipelineIdentification)}
|
|
@@ -6897,7 +6949,7 @@
|
|
|
6897
6949
|
if (!currentTask && resolving.length === 0) {
|
|
6898
6950
|
throw new UnexpectedError(
|
|
6899
6951
|
// TODO: [🐎] DRY
|
|
6900
|
-
spaceTrim.spaceTrim((block) => `
|
|
6952
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
6901
6953
|
Can not resolve some parameters:
|
|
6902
6954
|
|
|
6903
6955
|
${block(pipelineIdentification)}
|
|
@@ -6937,7 +6989,7 @@
|
|
|
6937
6989
|
tools,
|
|
6938
6990
|
onProgress(newOngoingResult) {
|
|
6939
6991
|
if (isReturned) {
|
|
6940
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6992
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6941
6993
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
6942
6994
|
|
|
6943
6995
|
${block(pipelineIdentification)}
|
|
@@ -6954,7 +7006,7 @@
|
|
|
6954
7006
|
},
|
|
6955
7007
|
logLlmCall,
|
|
6956
7008
|
$executionReport: executionReport,
|
|
6957
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7009
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
6958
7010
|
${block(pipelineIdentification)}
|
|
6959
7011
|
Task name: ${currentTask.name}
|
|
6960
7012
|
Task title: ${currentTask.title}
|
|
@@ -7063,7 +7115,7 @@
|
|
|
7063
7115
|
preparedPipeline = pipeline;
|
|
7064
7116
|
}
|
|
7065
7117
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7066
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7118
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7067
7119
|
Pipeline is not prepared
|
|
7068
7120
|
|
|
7069
7121
|
${block(pipelineIdentification)}
|
|
@@ -7088,7 +7140,7 @@
|
|
|
7088
7140
|
tools,
|
|
7089
7141
|
onProgress,
|
|
7090
7142
|
logLlmCall,
|
|
7091
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7143
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7092
7144
|
${block(pipelineIdentification)}
|
|
7093
7145
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7094
7146
|
`),
|
|
@@ -7396,7 +7448,7 @@
|
|
|
7396
7448
|
* @public exported from `@promptbook/markdown-utils`
|
|
7397
7449
|
*/
|
|
7398
7450
|
function removeMarkdownComments(content) {
|
|
7399
|
-
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
7451
|
+
return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
7400
7452
|
}
|
|
7401
7453
|
|
|
7402
7454
|
/**
|
|
@@ -7409,7 +7461,7 @@
|
|
|
7409
7461
|
const warningLine = `<!-- ${GENERATOR_WARNING} -->`;
|
|
7410
7462
|
const sectionRegex = new RegExp(`<!--${sectionName}-->([\\s\\S]*?)<!--/${sectionName}-->`, 'g');
|
|
7411
7463
|
const sectionMatch = content.match(sectionRegex);
|
|
7412
|
-
const contentToInsert = spaceTrim.spaceTrim((block) => `
|
|
7464
|
+
const contentToInsert = spaceTrim$1.spaceTrim((block) => `
|
|
7413
7465
|
<!--${sectionName}-->
|
|
7414
7466
|
${block(warningLine)}
|
|
7415
7467
|
${block(sectionContent)}
|
|
@@ -7422,7 +7474,7 @@
|
|
|
7422
7474
|
const placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
|
|
7423
7475
|
if (placeForSection !== null) {
|
|
7424
7476
|
const [heading] = placeForSection;
|
|
7425
|
-
return content.replace(heading, spaceTrim.spaceTrim((block) => `
|
|
7477
|
+
return content.replace(heading, spaceTrim$1.spaceTrim((block) => `
|
|
7426
7478
|
${block(contentToInsert)}
|
|
7427
7479
|
|
|
7428
7480
|
${block(heading)}
|
|
@@ -7431,7 +7483,7 @@
|
|
|
7431
7483
|
console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
|
|
7432
7484
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
7433
7485
|
// <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
|
|
7434
|
-
return spaceTrim.spaceTrim((block) => `
|
|
7486
|
+
return spaceTrim$1.spaceTrim((block) => `
|
|
7435
7487
|
${block(content)}
|
|
7436
7488
|
|
|
7437
7489
|
${block(contentToInsert)}
|
|
@@ -7846,13 +7898,13 @@
|
|
|
7846
7898
|
* @public exported from `@promptbook/markdown-utils`
|
|
7847
7899
|
*/
|
|
7848
7900
|
function trimCodeBlock(value) {
|
|
7849
|
-
value = spaceTrim.spaceTrim(value);
|
|
7901
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
7850
7902
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
7851
7903
|
return value;
|
|
7852
7904
|
}
|
|
7853
7905
|
value = value.replace(/^```[a-z]*/i, '');
|
|
7854
7906
|
value = value.replace(/```$/i, '');
|
|
7855
|
-
value = spaceTrim.spaceTrim(value);
|
|
7907
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
7856
7908
|
return value;
|
|
7857
7909
|
}
|
|
7858
7910
|
|
|
@@ -7865,9 +7917,9 @@
|
|
|
7865
7917
|
* @public exported from `@promptbook/markdown-utils`
|
|
7866
7918
|
*/
|
|
7867
7919
|
function trimEndOfCodeBlock(value) {
|
|
7868
|
-
value = spaceTrim.spaceTrim(value);
|
|
7920
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
7869
7921
|
value = value.replace(/```$/g, '');
|
|
7870
|
-
value = spaceTrim.spaceTrim(value);
|
|
7922
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
7871
7923
|
return value;
|
|
7872
7924
|
}
|
|
7873
7925
|
|