@promptbook/utils 0.112.0-13 → 0.112.0-16
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 +18 -18
- package/esm/index.es.js.map +1 -1
- package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/esm/src/cli/cli-commands/coder.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +28 -29
- package/umd/index.umd.js.map +1 -1
- package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/umd/src/cli/cli-commands/coder.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/umd/src/llm-providers/google/google-models.d.ts +1 -1
- package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import { basename } from 'path';
|
|
3
3
|
import { randomBytes } from 'crypto';
|
|
4
4
|
import { SHA256 } from 'crypto-js';
|
|
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1072,7 +1072,7 @@ function $deepFreeze(objectValue) {
|
|
|
1072
1072
|
function getErrorReportUrl(error) {
|
|
1073
1073
|
const report = {
|
|
1074
1074
|
title: `🐜 Error report from ${NAME}`,
|
|
1075
|
-
body: spaceTrim$
|
|
1075
|
+
body: spaceTrim$1((block) => `
|
|
1076
1076
|
|
|
1077
1077
|
|
|
1078
1078
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1230,7 +1230,7 @@ function checkSerializableAsJson(options) {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
else if (typeof value === 'object') {
|
|
1232
1232
|
if (value instanceof Date) {
|
|
1233
|
-
throw new UnexpectedError(spaceTrim$
|
|
1233
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
1234
1234
|
\`${name}\` is Date
|
|
1235
1235
|
|
|
1236
1236
|
Use \`string_date_iso8601\` instead
|
|
@@ -1249,7 +1249,7 @@ function checkSerializableAsJson(options) {
|
|
|
1249
1249
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
1250
1250
|
}
|
|
1251
1251
|
else if (value instanceof Error) {
|
|
1252
|
-
throw new UnexpectedError(spaceTrim$
|
|
1252
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
1253
1253
|
\`${name}\` is unserialized Error
|
|
1254
1254
|
|
|
1255
1255
|
Use function \`serializeError\`
|
|
@@ -1272,7 +1272,7 @@ function checkSerializableAsJson(options) {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
catch (error) {
|
|
1274
1274
|
assertsError(error);
|
|
1275
|
-
throw new UnexpectedError(spaceTrim$
|
|
1275
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
1276
1276
|
\`${name}\` is not serializable
|
|
1277
1277
|
|
|
1278
1278
|
${block(error.stack || error.message)}
|
|
@@ -1304,7 +1304,7 @@ function checkSerializableAsJson(options) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
1306
|
else {
|
|
1307
|
-
throw new UnexpectedError(spaceTrim$
|
|
1307
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
1308
1308
|
\`${name}\` is unknown type
|
|
1309
1309
|
|
|
1310
1310
|
Additional message for \`${name}\`:
|
|
@@ -2408,7 +2408,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
|
|
|
2408
2408
|
message = `${name}: ${message}`;
|
|
2409
2409
|
}
|
|
2410
2410
|
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
2411
|
-
message = spaceTrim$
|
|
2411
|
+
message = spaceTrim$1((block) => `
|
|
2412
2412
|
${block(message)}
|
|
2413
2413
|
|
|
2414
2414
|
Original stack trace:
|
|
@@ -2429,7 +2429,7 @@ function serializeError(error) {
|
|
|
2429
2429
|
const { name, message, stack } = error;
|
|
2430
2430
|
const { id } = error;
|
|
2431
2431
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
2432
|
-
console.error(spaceTrim$
|
|
2432
|
+
console.error(spaceTrim$1((block) => `
|
|
2433
2433
|
|
|
2434
2434
|
Cannot serialize error with name "${name}"
|
|
2435
2435
|
|
|
@@ -2535,7 +2535,7 @@ function jsonParse(value) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
else if (typeof value !== 'string') {
|
|
2537
2537
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
2538
|
-
throw new Error(spaceTrim$
|
|
2538
|
+
throw new Error(spaceTrim$1(`
|
|
2539
2539
|
Can not parse JSON from non-string value.
|
|
2540
2540
|
|
|
2541
2541
|
The value type: ${typeof value}
|
|
@@ -2549,7 +2549,7 @@ function jsonParse(value) {
|
|
|
2549
2549
|
if (!(error instanceof Error)) {
|
|
2550
2550
|
throw error;
|
|
2551
2551
|
}
|
|
2552
|
-
throw new Error(spaceTrim$
|
|
2552
|
+
throw new Error(spaceTrim$1((block) => `
|
|
2553
2553
|
${block(error.message)}
|
|
2554
2554
|
|
|
2555
2555
|
The expected JSON text:
|
|
@@ -2990,7 +2990,7 @@ function buildParametersSection(items) {
|
|
|
2990
2990
|
const entries = items
|
|
2991
2991
|
.flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
|
|
2992
2992
|
.filter((line) => line !== '');
|
|
2993
|
-
return spaceTrim$
|
|
2993
|
+
return spaceTrim$1((block) => `
|
|
2994
2994
|
**Parameters:**
|
|
2995
2995
|
${block(entries.join('\n'))}
|
|
2996
2996
|
|
|
@@ -3063,7 +3063,7 @@ function isPromptString(value) {
|
|
|
3063
3063
|
*/
|
|
3064
3064
|
function prompt(strings, ...values) {
|
|
3065
3065
|
if (values.length === 0) {
|
|
3066
|
-
return new PromptString(spaceTrim$
|
|
3066
|
+
return new PromptString(spaceTrim$1(strings.join('')));
|
|
3067
3067
|
}
|
|
3068
3068
|
const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
|
|
3069
3069
|
const parameterMetadata = values.map((value) => {
|
|
@@ -3104,7 +3104,7 @@ function prompt(strings, ...values) {
|
|
|
3104
3104
|
? `${result}${stringsItem}`
|
|
3105
3105
|
: `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
|
|
3106
3106
|
}, '');
|
|
3107
|
-
pipelineString = spaceTrim$
|
|
3107
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
3108
3108
|
try {
|
|
3109
3109
|
pipelineString = templateParameters(pipelineString, parameters);
|
|
3110
3110
|
}
|
|
@@ -3113,7 +3113,7 @@ function prompt(strings, ...values) {
|
|
|
3113
3113
|
throw error;
|
|
3114
3114
|
}
|
|
3115
3115
|
console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
|
|
3116
|
-
throw new UnexpectedError(spaceTrim$
|
|
3116
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
3117
3117
|
Internal error in prompt template literal
|
|
3118
3118
|
|
|
3119
3119
|
${block(JSON.stringify({ strings, values }, null, 4))}}
|
|
@@ -3203,7 +3203,7 @@ function isClientVersionCompatible(version) {
|
|
|
3203
3203
|
*/
|
|
3204
3204
|
function formatClientVersionMismatchMessage(clientVersion) {
|
|
3205
3205
|
const reportedVersion = clientVersion !== null && clientVersion !== void 0 ? clientVersion : 'unknown';
|
|
3206
|
-
return spaceTrim$
|
|
3206
|
+
return spaceTrim$1(`
|
|
3207
3207
|
A new version of Promptbook is available.
|
|
3208
3208
|
Please refresh the page to keep using the latest experience (currently using v${reportedVersion}).
|
|
3209
3209
|
`);
|
|
@@ -3506,7 +3506,7 @@ const CountUtils = {
|
|
|
3506
3506
|
* @public exported from `@promptbook/utils`
|
|
3507
3507
|
*/
|
|
3508
3508
|
function computeHash(value) {
|
|
3509
|
-
return SHA256(hexEncoder.parse(spaceTrim$
|
|
3509
|
+
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
3510
3510
|
}
|
|
3511
3511
|
/**
|
|
3512
3512
|
* TODO: [🥬][🥬] Use this ACRY
|
|
@@ -5551,7 +5551,7 @@ function serializeToPromptbookJavascript(value) {
|
|
|
5551
5551
|
imports.push(`import { Color } from '@promptbook/color';`);
|
|
5552
5552
|
}
|
|
5553
5553
|
else if (typeof value === 'string') {
|
|
5554
|
-
const trimmed = spaceTrim$
|
|
5554
|
+
const trimmed = spaceTrim$1(value);
|
|
5555
5555
|
if (trimmed.includes('\n')) {
|
|
5556
5556
|
// Multiline string -> use `spaceTrim`
|
|
5557
5557
|
serializedValue = `spaceTrim(\`\n${value.replace(/`/g, '\\`')}\n\`)`;
|