@promptbook/cli 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 +300 -268
- package/esm/index.es.js.map +1 -1
- package/{umd/src/cli/cli-commands/coder/find-fresh-emoji-tag.d.ts → esm/src/cli/cli-commands/coder/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 +516 -484
- package/umd/index.umd.js.map +1 -1
- package/{esm/src/cli/cli-commands/coder/find-fresh-emoji-tag.d.ts → umd/src/cli/cli-commands/coder/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/scripts/{find-fresh-emoji-tag/find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts} +0 -0
- /package/esm/scripts/{find-fresh-emoji-tag → find-fresh-emoji-tags}/utils/$shuffleItems.d.ts +0 -0
- /package/esm/scripts/{find-fresh-emoji-tag → find-fresh-emoji-tags}/utils/emojis.d.ts +0 -0
- /package/umd/scripts/{find-fresh-emoji-tag/find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts} +0 -0
- /package/umd/scripts/{find-fresh-emoji-tag → find-fresh-emoji-tags}/utils/$shuffleItems.d.ts +0 -0
- /package/umd/scripts/{find-fresh-emoji-tag → find-fresh-emoji-tags}/utils/emojis.d.ts +0 -0
package/esm/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
2
|
import commander from 'commander';
|
|
3
|
-
import
|
|
3
|
+
import _spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import { writeFileSync, readFileSync, existsSync } from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
@@ -57,7 +57,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
57
57
|
* @generated
|
|
58
58
|
* @see https://github.com/webgptorg/promptbook
|
|
59
59
|
*/
|
|
60
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
60
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
|
|
61
61
|
/**
|
|
62
62
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
63
63
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1425,7 +1425,7 @@ function $isRunningInWebWorker() {
|
|
|
1425
1425
|
function getErrorReportUrl(error) {
|
|
1426
1426
|
const report = {
|
|
1427
1427
|
title: `🐜 Error report from ${NAME}`,
|
|
1428
|
-
body: spaceTrim$
|
|
1428
|
+
body: spaceTrim$1((block) => `
|
|
1429
1429
|
|
|
1430
1430
|
|
|
1431
1431
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1564,7 +1564,7 @@ function handleActionErrors(action) {
|
|
|
1564
1564
|
*/
|
|
1565
1565
|
function $initializeAboutCommand(program) {
|
|
1566
1566
|
const makeCommand = program.command('about');
|
|
1567
|
-
makeCommand.description(spaceTrim$
|
|
1567
|
+
makeCommand.description(spaceTrim$1(`
|
|
1568
1568
|
Tells about Promptbook CLI and its abilities
|
|
1569
1569
|
`));
|
|
1570
1570
|
makeCommand.action(handleActionErrors(async () => {
|
|
@@ -1604,15 +1604,15 @@ function $initializeAboutCommand(program) {
|
|
|
1604
1604
|
*/
|
|
1605
1605
|
|
|
1606
1606
|
/**
|
|
1607
|
-
* Initializes `coder find-fresh-emoji-
|
|
1607
|
+
* Initializes `coder find-fresh-emoji-tags` command for Promptbook CLI utilities
|
|
1608
1608
|
*
|
|
1609
1609
|
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
1610
1610
|
*
|
|
1611
1611
|
* @private internal function of `promptbookCli`
|
|
1612
1612
|
*/
|
|
1613
1613
|
function $initializeCoderFindFreshEmojiTagCommand(program) {
|
|
1614
|
-
const command = program.command('find-fresh-emoji-
|
|
1615
|
-
command.description(
|
|
1614
|
+
const command = program.command('find-fresh-emoji-tags');
|
|
1615
|
+
command.description(_spaceTrim(`
|
|
1616
1616
|
Find unused emoji tags in the codebase
|
|
1617
1617
|
|
|
1618
1618
|
Scans entire codebase for emoji tags already in use (format: [emoji])
|
|
@@ -1621,7 +1621,7 @@ function $initializeCoderFindFreshEmojiTagCommand(program) {
|
|
|
1621
1621
|
`));
|
|
1622
1622
|
command.action(handleActionErrors(async () => {
|
|
1623
1623
|
// Note: Import the function dynamically to avoid loading heavy dependencies until needed
|
|
1624
|
-
const { findFreshEmojiTag } = await Promise.resolve().then(function () { return
|
|
1624
|
+
const { findFreshEmojiTag } = await Promise.resolve().then(function () { return findFreshEmojiTags; });
|
|
1625
1625
|
try {
|
|
1626
1626
|
await findFreshEmojiTag();
|
|
1627
1627
|
}
|
|
@@ -1646,7 +1646,7 @@ function $initializeCoderFindFreshEmojiTagCommand(program) {
|
|
|
1646
1646
|
*/
|
|
1647
1647
|
function $initializeCoderFindRefactorCandidatesCommand(program) {
|
|
1648
1648
|
const command = program.command('find-refactor-candidates');
|
|
1649
|
-
command.description(spaceTrim$
|
|
1649
|
+
command.description(spaceTrim$1(`
|
|
1650
1650
|
Scan source files to identify refactoring candidates
|
|
1651
1651
|
|
|
1652
1652
|
Flags files that exceed:
|
|
@@ -1836,7 +1836,7 @@ function buildPromptSlug$1(template, title) {
|
|
|
1836
1836
|
*/
|
|
1837
1837
|
function $initializeCoderRunCommand(program) {
|
|
1838
1838
|
const command = program.command('run');
|
|
1839
|
-
command.description(spaceTrim$
|
|
1839
|
+
command.description(spaceTrim$1(`
|
|
1840
1840
|
Execute coding prompts through selected AI agent
|
|
1841
1841
|
|
|
1842
1842
|
Runners:
|
|
@@ -1854,7 +1854,7 @@ function $initializeCoderRunCommand(program) {
|
|
|
1854
1854
|
`));
|
|
1855
1855
|
command.option('--dry-run', 'Print unwritten prompts without executing', false);
|
|
1856
1856
|
command.option('--agent <agent-name>', 'Select runner: openai-codex, cline, claude-code, opencode, gemini (required for non-dry-run)');
|
|
1857
|
-
command.option('--model <model>', spaceTrim$
|
|
1857
|
+
command.option('--model <model>', spaceTrim$1(`
|
|
1858
1858
|
Model to use (required for openai-codex and gemini)
|
|
1859
1859
|
|
|
1860
1860
|
OpenAI examples: gpt-5.2-codex, default
|
|
@@ -1942,7 +1942,7 @@ function parseIntOption(value) {
|
|
|
1942
1942
|
*/
|
|
1943
1943
|
function $initializeCoderVerifyCommand(program) {
|
|
1944
1944
|
const command = program.command('verify');
|
|
1945
|
-
command.description(spaceTrim$
|
|
1945
|
+
command.description(spaceTrim$1(`
|
|
1946
1946
|
Interactive verification helper for completed prompts
|
|
1947
1947
|
|
|
1948
1948
|
Features:
|
|
@@ -1980,7 +1980,7 @@ function $initializeCoderVerifyCommand(program) {
|
|
|
1980
1980
|
* - find-refactor-candidates: Find files that need refactoring
|
|
1981
1981
|
* - run: Run coding prompts with AI agents
|
|
1982
1982
|
* - verify: Verify completed prompts
|
|
1983
|
-
* - find-fresh-emoji-
|
|
1983
|
+
* - find-fresh-emoji-tags: Find unused emoji tags
|
|
1984
1984
|
*
|
|
1985
1985
|
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
1986
1986
|
*
|
|
@@ -1988,7 +1988,7 @@ function $initializeCoderVerifyCommand(program) {
|
|
|
1988
1988
|
*/
|
|
1989
1989
|
function $initializeCoderCommand(program) {
|
|
1990
1990
|
const coderCommand = program.command('coder');
|
|
1991
|
-
coderCommand.description(spaceTrim$
|
|
1991
|
+
coderCommand.description(spaceTrim$1(`
|
|
1992
1992
|
Coding utilities for automated development workflows
|
|
1993
1993
|
|
|
1994
1994
|
Subcommands:
|
|
@@ -1996,7 +1996,7 @@ function $initializeCoderCommand(program) {
|
|
|
1996
1996
|
- find-refactor-candidates: Find files that need refactoring
|
|
1997
1997
|
- run: Run coding prompts with AI agents
|
|
1998
1998
|
- verify: Verify completed prompts
|
|
1999
|
-
- find-fresh-emoji-
|
|
1999
|
+
- find-fresh-emoji-tags: Find unused emoji tags
|
|
2000
2000
|
`));
|
|
2001
2001
|
// Register all subcommands
|
|
2002
2002
|
$initializeCoderGenerateBoilerplatesCommand(coderCommand);
|
|
@@ -2025,7 +2025,7 @@ function $initializeCoderCommand(program) {
|
|
|
2025
2025
|
*/
|
|
2026
2026
|
function $initializeHelloCommand(program) {
|
|
2027
2027
|
const helloCommand = program.command('hello');
|
|
2028
|
-
helloCommand.description(spaceTrim$
|
|
2028
|
+
helloCommand.description(spaceTrim$1(`
|
|
2029
2029
|
Just command for testing
|
|
2030
2030
|
`));
|
|
2031
2031
|
helloCommand.alias('hi');
|
|
@@ -2287,13 +2287,13 @@ function $registeredLlmToolsMessage() {
|
|
|
2287
2287
|
});
|
|
2288
2288
|
const usedEnvMessage = $usedEnvFilename === null ? `Unknown \`.env\` file` : `Used \`.env\` file:\n${$usedEnvFilename}`;
|
|
2289
2289
|
if (metadata.length === 0) {
|
|
2290
|
-
return spaceTrim$
|
|
2290
|
+
return spaceTrim$1((block) => `
|
|
2291
2291
|
No LLM providers are available.
|
|
2292
2292
|
|
|
2293
2293
|
${block(usedEnvMessage)}
|
|
2294
2294
|
`);
|
|
2295
2295
|
}
|
|
2296
|
-
return spaceTrim$
|
|
2296
|
+
return spaceTrim$1((block) => `
|
|
2297
2297
|
|
|
2298
2298
|
${block(usedEnvMessage)}
|
|
2299
2299
|
|
|
@@ -2339,7 +2339,7 @@ function $registeredLlmToolsMessage() {
|
|
|
2339
2339
|
morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
let providerMessage = spaceTrim$
|
|
2342
|
+
let providerMessage = spaceTrim$1(`
|
|
2343
2343
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
2344
2344
|
${morePieces.join('; ')}
|
|
2345
2345
|
`);
|
|
@@ -2405,7 +2405,7 @@ function jsonParse(value) {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
else if (typeof value !== 'string') {
|
|
2407
2407
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
2408
|
-
throw new Error(spaceTrim$
|
|
2408
|
+
throw new Error(spaceTrim$1(`
|
|
2409
2409
|
Can not parse JSON from non-string value.
|
|
2410
2410
|
|
|
2411
2411
|
The value type: ${typeof value}
|
|
@@ -2419,7 +2419,7 @@ function jsonParse(value) {
|
|
|
2419
2419
|
if (!(error instanceof Error)) {
|
|
2420
2420
|
throw error;
|
|
2421
2421
|
}
|
|
2422
|
-
throw new Error(spaceTrim$
|
|
2422
|
+
throw new Error(spaceTrim$1((block) => `
|
|
2423
2423
|
${block(error.message)}
|
|
2424
2424
|
|
|
2425
2425
|
The expected JSON text:
|
|
@@ -2641,7 +2641,7 @@ class $EnvStorage {
|
|
|
2641
2641
|
.filter((line) => !line.startsWith(`# ${GENERATOR_WARNING_IN_ENV}`)) // Remove GENERATOR_WARNING_IN_ENV
|
|
2642
2642
|
.filter((line) => !line.startsWith(`${transformedKey}=`)) // Remove existing key if present
|
|
2643
2643
|
.join('\n');
|
|
2644
|
-
const newEnvContent = spaceTrim$
|
|
2644
|
+
const newEnvContent = spaceTrim$1((block) => `
|
|
2645
2645
|
${block(updatedEnvContent)}
|
|
2646
2646
|
|
|
2647
2647
|
# ${GENERATOR_WARNING_IN_ENV}
|
|
@@ -2752,7 +2752,7 @@ function checkSerializableAsJson(options) {
|
|
|
2752
2752
|
}
|
|
2753
2753
|
else if (typeof value === 'object') {
|
|
2754
2754
|
if (value instanceof Date) {
|
|
2755
|
-
throw new UnexpectedError(spaceTrim$
|
|
2755
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2756
2756
|
\`${name}\` is Date
|
|
2757
2757
|
|
|
2758
2758
|
Use \`string_date_iso8601\` instead
|
|
@@ -2771,7 +2771,7 @@ function checkSerializableAsJson(options) {
|
|
|
2771
2771
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
2772
2772
|
}
|
|
2773
2773
|
else if (value instanceof Error) {
|
|
2774
|
-
throw new UnexpectedError(spaceTrim$
|
|
2774
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2775
2775
|
\`${name}\` is unserialized Error
|
|
2776
2776
|
|
|
2777
2777
|
Use function \`serializeError\`
|
|
@@ -2794,7 +2794,7 @@ function checkSerializableAsJson(options) {
|
|
|
2794
2794
|
}
|
|
2795
2795
|
catch (error) {
|
|
2796
2796
|
assertsError(error);
|
|
2797
|
-
throw new UnexpectedError(spaceTrim$
|
|
2797
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2798
2798
|
\`${name}\` is not serializable
|
|
2799
2799
|
|
|
2800
2800
|
${block(error.stack || error.message)}
|
|
@@ -2826,7 +2826,7 @@ function checkSerializableAsJson(options) {
|
|
|
2826
2826
|
}
|
|
2827
2827
|
}
|
|
2828
2828
|
else {
|
|
2829
|
-
throw new UnexpectedError(spaceTrim$
|
|
2829
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2830
2830
|
\`${name}\` is unknown type
|
|
2831
2831
|
|
|
2832
2832
|
Additional message for \`${name}\`:
|
|
@@ -3090,7 +3090,7 @@ function isSerializableAsJson(value) {
|
|
|
3090
3090
|
*/
|
|
3091
3091
|
function stringifyPipelineJson(pipeline) {
|
|
3092
3092
|
if (!isSerializableAsJson(pipeline)) {
|
|
3093
|
-
throw new UnexpectedError(spaceTrim$
|
|
3093
|
+
throw new UnexpectedError(spaceTrim$1(`
|
|
3094
3094
|
Cannot stringify the pipeline, because it is not serializable as JSON
|
|
3095
3095
|
|
|
3096
3096
|
There can be multiple reasons:
|
|
@@ -4004,7 +4004,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
|
|
|
4004
4004
|
message = `${name}: ${message}`;
|
|
4005
4005
|
}
|
|
4006
4006
|
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
4007
|
-
message = spaceTrim$
|
|
4007
|
+
message = spaceTrim$1((block) => `
|
|
4008
4008
|
${block(message)}
|
|
4009
4009
|
|
|
4010
4010
|
Original stack trace:
|
|
@@ -4031,7 +4031,7 @@ async function createRemoteClient(options) {
|
|
|
4031
4031
|
const remoteServerUrlParsed = new URL(remoteServerUrl);
|
|
4032
4032
|
if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
|
|
4033
4033
|
remoteServerUrlParsed.pathname = '/';
|
|
4034
|
-
throw new Error(spaceTrim$
|
|
4034
|
+
throw new Error(spaceTrim$1((block) => `
|
|
4035
4035
|
Remote server requires root url \`/\`
|
|
4036
4036
|
|
|
4037
4037
|
You have provided \`remoteServerUrl\`:
|
|
@@ -4357,7 +4357,7 @@ function serializeError(error) {
|
|
|
4357
4357
|
const { name, message, stack } = error;
|
|
4358
4358
|
const { id } = error;
|
|
4359
4359
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
4360
|
-
console.error(spaceTrim$
|
|
4360
|
+
console.error(spaceTrim$1((block) => `
|
|
4361
4361
|
|
|
4362
4362
|
Cannot serialize error with name "${name}"
|
|
4363
4363
|
|
|
@@ -4882,7 +4882,7 @@ function buildParametersSection(items) {
|
|
|
4882
4882
|
const entries = items
|
|
4883
4883
|
.flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
|
|
4884
4884
|
.filter((line) => line !== '');
|
|
4885
|
-
return spaceTrim$
|
|
4885
|
+
return spaceTrim$1((block) => `
|
|
4886
4886
|
**Parameters:**
|
|
4887
4887
|
${block(entries.join('\n'))}
|
|
4888
4888
|
|
|
@@ -4955,7 +4955,7 @@ function isPromptString(value) {
|
|
|
4955
4955
|
*/
|
|
4956
4956
|
function prompt(strings, ...values) {
|
|
4957
4957
|
if (values.length === 0) {
|
|
4958
|
-
return new PromptString(spaceTrim$
|
|
4958
|
+
return new PromptString(spaceTrim$1(strings.join('')));
|
|
4959
4959
|
}
|
|
4960
4960
|
const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
|
|
4961
4961
|
const parameterMetadata = values.map((value) => {
|
|
@@ -4996,7 +4996,7 @@ function prompt(strings, ...values) {
|
|
|
4996
4996
|
? `${result}${stringsItem}`
|
|
4997
4997
|
: `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
|
|
4998
4998
|
}, '');
|
|
4999
|
-
pipelineString = spaceTrim$
|
|
4999
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
5000
5000
|
try {
|
|
5001
5001
|
pipelineString = templateParameters(pipelineString, parameters);
|
|
5002
5002
|
}
|
|
@@ -5005,7 +5005,7 @@ function prompt(strings, ...values) {
|
|
|
5005
5005
|
throw error;
|
|
5006
5006
|
}
|
|
5007
5007
|
console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
|
|
5008
|
-
throw new UnexpectedError(spaceTrim$
|
|
5008
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
5009
5009
|
Internal error in prompt template literal
|
|
5010
5010
|
|
|
5011
5011
|
${block(JSON.stringify({ strings, values }, null, 4))}}
|
|
@@ -5228,7 +5228,7 @@ const CountUtils = {
|
|
|
5228
5228
|
* @public exported from `@promptbook/utils`
|
|
5229
5229
|
*/
|
|
5230
5230
|
function computeHash(value) {
|
|
5231
|
-
return SHA256(hexEncoder.parse(spaceTrim$
|
|
5231
|
+
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
5232
5232
|
}
|
|
5233
5233
|
/**
|
|
5234
5234
|
* TODO: [🥬][🥬] Use this ACRY
|
|
@@ -7514,7 +7514,7 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
7514
7514
|
let normalizedContent = content;
|
|
7515
7515
|
normalizedContent = normalizedContent.replace(/\s+/g, ' ');
|
|
7516
7516
|
normalizedContent = normalizedContent.split('\r\n').join('\n');
|
|
7517
|
-
normalizedContent = spaceTrim$
|
|
7517
|
+
normalizedContent = spaceTrim$1(normalizedContent);
|
|
7518
7518
|
// Note: Do not need to save everything in the cache, just the relevant parameters
|
|
7519
7519
|
const relevantParameterNames = extractParameterNames(content);
|
|
7520
7520
|
const relevantParameters = Object.fromEntries(Object.entries(parameters).filter(([key]) => relevantParameterNames.has(key)));
|
|
@@ -7984,14 +7984,14 @@ class MultipleLlmExecutionTools {
|
|
|
7984
7984
|
if (description === undefined) {
|
|
7985
7985
|
return headLine;
|
|
7986
7986
|
}
|
|
7987
|
-
return spaceTrim$
|
|
7987
|
+
return spaceTrim$1((block) => `
|
|
7988
7988
|
${headLine}
|
|
7989
7989
|
|
|
7990
7990
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
7991
7991
|
`);
|
|
7992
7992
|
})
|
|
7993
7993
|
.join('\n\n');
|
|
7994
|
-
return spaceTrim$
|
|
7994
|
+
return spaceTrim$1((block) => `
|
|
7995
7995
|
Multiple LLM Providers:
|
|
7996
7996
|
|
|
7997
7997
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -8093,7 +8093,7 @@ class MultipleLlmExecutionTools {
|
|
|
8093
8093
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
8094
8094
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
8095
8095
|
// 3) ...
|
|
8096
|
-
spaceTrim$
|
|
8096
|
+
spaceTrim$1((block) => `
|
|
8097
8097
|
All execution tools of ${this.title} failed:
|
|
8098
8098
|
|
|
8099
8099
|
${block(errors
|
|
@@ -8106,7 +8106,7 @@ class MultipleLlmExecutionTools {
|
|
|
8106
8106
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
8107
8107
|
}
|
|
8108
8108
|
else {
|
|
8109
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
8109
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
8110
8110
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
8111
8111
|
|
|
8112
8112
|
Available \`LlmExecutionTools\`:
|
|
@@ -8143,7 +8143,7 @@ class MultipleLlmExecutionTools {
|
|
|
8143
8143
|
*/
|
|
8144
8144
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
8145
8145
|
if (llmExecutionTools.length === 0) {
|
|
8146
|
-
const warningMessage = spaceTrim$
|
|
8146
|
+
const warningMessage = spaceTrim$1(`
|
|
8147
8147
|
You have not provided any \`LlmExecutionTools\`
|
|
8148
8148
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
8149
8149
|
|
|
@@ -8201,7 +8201,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
8201
8201
|
.find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
|
|
8202
8202
|
if (registeredItem === undefined) {
|
|
8203
8203
|
// console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
|
|
8204
|
-
throw new Error(spaceTrim$
|
|
8204
|
+
throw new Error(spaceTrim$1((block) => `
|
|
8205
8205
|
There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
|
|
8206
8206
|
Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
|
|
8207
8207
|
|
|
@@ -8269,14 +8269,14 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
8269
8269
|
const configuration = await $provideLlmToolsConfigurationFromEnv();
|
|
8270
8270
|
if (configuration.length === 0) {
|
|
8271
8271
|
if ($llmToolsMetadataRegister.list().length === 0) {
|
|
8272
|
-
throw new UnexpectedError(spaceTrim$
|
|
8272
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
8273
8273
|
No LLM tools registered, this is probably a bug in the Promptbook library
|
|
8274
8274
|
|
|
8275
8275
|
${block($registeredLlmToolsMessage())}}
|
|
8276
8276
|
`));
|
|
8277
8277
|
}
|
|
8278
8278
|
// TODO: [🥃]
|
|
8279
|
-
throw new Error(spaceTrim$
|
|
8279
|
+
throw new Error(spaceTrim$1((block) => `
|
|
8280
8280
|
No LLM tools found in the environment
|
|
8281
8281
|
|
|
8282
8282
|
${block($registeredLlmToolsMessage())}}
|
|
@@ -8386,7 +8386,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
8386
8386
|
else if (urlOrRequest instanceof Request) {
|
|
8387
8387
|
url = urlOrRequest.url;
|
|
8388
8388
|
}
|
|
8389
|
-
throw new PromptbookFetchError(spaceTrim$
|
|
8389
|
+
throw new PromptbookFetchError(spaceTrim$1((block) => `
|
|
8390
8390
|
Can not fetch "${url}"
|
|
8391
8391
|
|
|
8392
8392
|
Fetch error:
|
|
@@ -8440,7 +8440,7 @@ async function $provideLlmToolsForCli(options) {
|
|
|
8440
8440
|
console.log(colors.red(`You can not login to remote server in non-interactive mode`));
|
|
8441
8441
|
process.exit(1);
|
|
8442
8442
|
}
|
|
8443
|
-
console.info(colors.cyan(spaceTrim$
|
|
8443
|
+
console.info(colors.cyan(spaceTrim$1(`
|
|
8444
8444
|
You will be logged in to ${remoteServerUrl}
|
|
8445
8445
|
If you don't have an account, it will be created automatically.
|
|
8446
8446
|
`)));
|
|
@@ -8514,7 +8514,7 @@ async function $provideLlmToolsForCli(options) {
|
|
|
8514
8514
|
*/
|
|
8515
8515
|
function $initializeListModelsCommand(program) {
|
|
8516
8516
|
const listModelsCommand = program.command('list-models');
|
|
8517
|
-
listModelsCommand.description(spaceTrim$
|
|
8517
|
+
listModelsCommand.description(spaceTrim$1(`
|
|
8518
8518
|
List all available and configured LLM models
|
|
8519
8519
|
`));
|
|
8520
8520
|
listModelsCommand.alias('models');
|
|
@@ -9003,14 +9003,14 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
9003
9003
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
9004
9004
|
});
|
|
9005
9005
|
if (metadata.length === 0) {
|
|
9006
|
-
return spaceTrim$
|
|
9006
|
+
return spaceTrim$1(`
|
|
9007
9007
|
**No scrapers are available**
|
|
9008
9008
|
|
|
9009
9009
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
9010
9010
|
At least there should be available the metadata of the scrapers
|
|
9011
9011
|
`);
|
|
9012
9012
|
}
|
|
9013
|
-
return spaceTrim$
|
|
9013
|
+
return spaceTrim$1((block) => `
|
|
9014
9014
|
Available scrapers are:
|
|
9015
9015
|
${block(metadata
|
|
9016
9016
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -9061,7 +9061,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
9061
9061
|
*/
|
|
9062
9062
|
function $initializeListScrapersCommand(program) {
|
|
9063
9063
|
const listModelsCommand = program.command('list-scrapers');
|
|
9064
|
-
listModelsCommand.description(spaceTrim$
|
|
9064
|
+
listModelsCommand.description(spaceTrim$1(`
|
|
9065
9065
|
List all available and configured scrapers and executables
|
|
9066
9066
|
`));
|
|
9067
9067
|
listModelsCommand.alias('scrapers');
|
|
@@ -9069,7 +9069,7 @@ function $initializeListScrapersCommand(program) {
|
|
|
9069
9069
|
// TODO: [🌞] Do not allow on REMOTE_SERVER strategy
|
|
9070
9070
|
const scrapers = await $provideScrapersForNode({});
|
|
9071
9071
|
const executables = await $provideExecutablesForNode();
|
|
9072
|
-
console.info(spaceTrim$
|
|
9072
|
+
console.info(spaceTrim$1((block) => `
|
|
9073
9073
|
${block($registeredScrapersMessage(scrapers))}
|
|
9074
9074
|
|
|
9075
9075
|
All mime-types which can be scraped:
|
|
@@ -9099,7 +9099,7 @@ function $initializeListScrapersCommand(program) {
|
|
|
9099
9099
|
*/
|
|
9100
9100
|
function $initializeLoginCommand(program) {
|
|
9101
9101
|
const loginCommand = program.command('login');
|
|
9102
|
-
loginCommand.description(spaceTrim$
|
|
9102
|
+
loginCommand.description(spaceTrim$1(`
|
|
9103
9103
|
Login to the remote Promptbook server
|
|
9104
9104
|
`));
|
|
9105
9105
|
loginCommand.action(handleActionErrors(async (cliOptions) => {
|
|
@@ -9599,7 +9599,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
9599
9599
|
pipelineString += '\n\n';
|
|
9600
9600
|
pipelineString += '```' + contentLanguage;
|
|
9601
9601
|
pipelineString += '\n';
|
|
9602
|
-
pipelineString += spaceTrim$
|
|
9602
|
+
pipelineString += spaceTrim$1(content);
|
|
9603
9603
|
// <- TODO: [main] !!3 Escape
|
|
9604
9604
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
9605
9605
|
pipelineString += '\n';
|
|
@@ -10234,7 +10234,7 @@ const CsvFormatParser = {
|
|
|
10234
10234
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
10235
10235
|
const csv = csvParse(value, settings);
|
|
10236
10236
|
if (csv.errors.length !== 0) {
|
|
10237
|
-
throw new CsvFormatError(spaceTrim$
|
|
10237
|
+
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
10238
10238
|
CSV parsing error
|
|
10239
10239
|
|
|
10240
10240
|
Error(s) from CSV parsing:
|
|
@@ -10279,7 +10279,7 @@ const CsvFormatParser = {
|
|
|
10279
10279
|
const { value, settings, mapCallback, onProgress } = options;
|
|
10280
10280
|
const csv = csvParse(value, settings);
|
|
10281
10281
|
if (csv.errors.length !== 0) {
|
|
10282
|
-
throw new CsvFormatError(spaceTrim$
|
|
10282
|
+
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
10283
10283
|
CSV parsing error
|
|
10284
10284
|
|
|
10285
10285
|
Error(s) from CSV parsing:
|
|
@@ -10465,7 +10465,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
10465
10465
|
}
|
|
10466
10466
|
// Phase 2️⃣: Non-matching mapping
|
|
10467
10467
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
10468
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
10468
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
10469
10469
|
Can not map available parameters to expected parameters
|
|
10470
10470
|
|
|
10471
10471
|
Mapped parameters:
|
|
@@ -10880,7 +10880,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10880
10880
|
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
10881
10881
|
}
|
|
10882
10882
|
if (jokerParameterNames.length !== 0) {
|
|
10883
|
-
throw new UnexpectedError(spaceTrim$
|
|
10883
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
10884
10884
|
JOKER parameters are not supported together with FOREACH command
|
|
10885
10885
|
|
|
10886
10886
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -10893,7 +10893,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10893
10893
|
if (formatDefinition === undefined) {
|
|
10894
10894
|
throw new UnexpectedError(
|
|
10895
10895
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
10896
|
-
spaceTrim$
|
|
10896
|
+
spaceTrim$1((block) => `
|
|
10897
10897
|
Unsupported format "${task.foreach.formatName}"
|
|
10898
10898
|
|
|
10899
10899
|
Available formats:
|
|
@@ -10910,7 +10910,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10910
10910
|
if (subvalueParser === undefined) {
|
|
10911
10911
|
throw new UnexpectedError(
|
|
10912
10912
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
10913
|
-
spaceTrim$
|
|
10913
|
+
spaceTrim$1((block) => `
|
|
10914
10914
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
10915
10915
|
|
|
10916
10916
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -10950,7 +10950,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10950
10950
|
if (!(error instanceof PipelineExecutionError)) {
|
|
10951
10951
|
throw error;
|
|
10952
10952
|
}
|
|
10953
|
-
const highLevelError = new PipelineExecutionError(spaceTrim$
|
|
10953
|
+
const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
|
|
10954
10954
|
${error.message}
|
|
10955
10955
|
|
|
10956
10956
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -10974,7 +10974,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10974
10974
|
...options,
|
|
10975
10975
|
priority: priority + index,
|
|
10976
10976
|
parameters: allSubparameters,
|
|
10977
|
-
pipelineIdentification: spaceTrim$
|
|
10977
|
+
pipelineIdentification: spaceTrim$1((block) => `
|
|
10978
10978
|
${block(pipelineIdentification)}
|
|
10979
10979
|
Subparameter index: ${index}
|
|
10980
10980
|
`),
|
|
@@ -10983,7 +10983,7 @@ async function executeFormatSubvalues(options) {
|
|
|
10983
10983
|
}
|
|
10984
10984
|
catch (error) {
|
|
10985
10985
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
10986
|
-
console.error(spaceTrim$
|
|
10986
|
+
console.error(spaceTrim$1((block) => `
|
|
10987
10987
|
${error.message}
|
|
10988
10988
|
|
|
10989
10989
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -12027,7 +12027,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
12027
12027
|
const fileExtension = getFileExtension(filename);
|
|
12028
12028
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
12029
12029
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
12030
|
-
throw new NotFoundError(spaceTrim$
|
|
12030
|
+
throw new NotFoundError(spaceTrim$1((block) => `
|
|
12031
12031
|
Can not make source handler for file which does not exist:
|
|
12032
12032
|
|
|
12033
12033
|
File:
|
|
@@ -12120,7 +12120,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
12120
12120
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
12121
12121
|
break;
|
|
12122
12122
|
}
|
|
12123
|
-
console.warn(spaceTrim$
|
|
12123
|
+
console.warn(spaceTrim$1((block) => `
|
|
12124
12124
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
12125
12125
|
|
|
12126
12126
|
The source:
|
|
@@ -12136,7 +12136,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
12136
12136
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
12137
12137
|
}
|
|
12138
12138
|
if (partialPieces === null) {
|
|
12139
|
-
throw new KnowledgeScrapeError(spaceTrim$
|
|
12139
|
+
throw new KnowledgeScrapeError(spaceTrim$1((block) => `
|
|
12140
12140
|
Cannot scrape knowledge
|
|
12141
12141
|
|
|
12142
12142
|
The source:
|
|
@@ -12472,7 +12472,7 @@ const knowledgeCommandParser = {
|
|
|
12472
12472
|
*/
|
|
12473
12473
|
parse(input) {
|
|
12474
12474
|
const { args } = input;
|
|
12475
|
-
const knowledgeSourceContent = spaceTrim$
|
|
12475
|
+
const knowledgeSourceContent = spaceTrim$1(args[0] || '');
|
|
12476
12476
|
if (knowledgeSourceContent === '') {
|
|
12477
12477
|
throw new ParseError(`Source is not defined`);
|
|
12478
12478
|
}
|
|
@@ -12616,7 +12616,7 @@ const sectionCommandParser = {
|
|
|
12616
12616
|
normalized = normalized.split('DIALOGUE').join('DIALOG');
|
|
12617
12617
|
const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
|
|
12618
12618
|
if (taskTypes.length !== 1) {
|
|
12619
|
-
throw new ParseError(spaceTrim$
|
|
12619
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
12620
12620
|
Unknown section type "${normalized}"
|
|
12621
12621
|
|
|
12622
12622
|
Supported section types are:
|
|
@@ -12636,7 +12636,7 @@ const sectionCommandParser = {
|
|
|
12636
12636
|
*/
|
|
12637
12637
|
$applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
12638
12638
|
if ($taskJson.isSectionTypeSet === true) {
|
|
12639
|
-
throw new ParseError(spaceTrim$
|
|
12639
|
+
throw new ParseError(spaceTrim$1(`
|
|
12640
12640
|
Section type is already defined in the section.
|
|
12641
12641
|
It can be defined only once.
|
|
12642
12642
|
`));
|
|
@@ -12916,7 +12916,7 @@ const expectCommandParser = {
|
|
|
12916
12916
|
/**
|
|
12917
12917
|
* Description of the FORMAT command
|
|
12918
12918
|
*/
|
|
12919
|
-
description: spaceTrim$
|
|
12919
|
+
description: spaceTrim$1(`
|
|
12920
12920
|
Expect command describes the desired output of the task *(after post-processing)*
|
|
12921
12921
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
12922
12922
|
`),
|
|
@@ -12990,7 +12990,7 @@ const expectCommandParser = {
|
|
|
12990
12990
|
}
|
|
12991
12991
|
catch (error) {
|
|
12992
12992
|
assertsError(error);
|
|
12993
|
-
throw new ParseError(spaceTrim$
|
|
12993
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
12994
12994
|
Invalid FORMAT command
|
|
12995
12995
|
${block(error.message)}:
|
|
12996
12996
|
`));
|
|
@@ -13102,7 +13102,7 @@ function validateParameterName(parameterName) {
|
|
|
13102
13102
|
if (!(error instanceof ParseError)) {
|
|
13103
13103
|
throw error;
|
|
13104
13104
|
}
|
|
13105
|
-
throw new ParseError(spaceTrim$
|
|
13105
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13106
13106
|
${block(error.message)}
|
|
13107
13107
|
|
|
13108
13108
|
Tried to validate parameter name:
|
|
@@ -13161,7 +13161,7 @@ const foreachCommandParser = {
|
|
|
13161
13161
|
const assignSign = args[3];
|
|
13162
13162
|
const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
|
|
13163
13163
|
if (formatDefinition === undefined) {
|
|
13164
|
-
throw new ParseError(spaceTrim$
|
|
13164
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13165
13165
|
Unsupported format "${formatName}"
|
|
13166
13166
|
|
|
13167
13167
|
Available formats:
|
|
@@ -13173,7 +13173,7 @@ const foreachCommandParser = {
|
|
|
13173
13173
|
}
|
|
13174
13174
|
const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
|
|
13175
13175
|
if (subvalueParser === undefined) {
|
|
13176
|
-
throw new ParseError(spaceTrim$
|
|
13176
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13177
13177
|
Unsupported subformat name "${subformatName}" for format "${formatName}"
|
|
13178
13178
|
|
|
13179
13179
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -13221,7 +13221,7 @@ const foreachCommandParser = {
|
|
|
13221
13221
|
outputSubparameterName = 'newLine';
|
|
13222
13222
|
}
|
|
13223
13223
|
else {
|
|
13224
|
-
throw new ParseError(spaceTrim$
|
|
13224
|
+
throw new ParseError(spaceTrim$1(`
|
|
13225
13225
|
FOREACH ${formatName} ${subformatName} must specify output subparameter
|
|
13226
13226
|
|
|
13227
13227
|
Correct example:
|
|
@@ -13297,7 +13297,7 @@ const formatCommandParser = {
|
|
|
13297
13297
|
/**
|
|
13298
13298
|
* Description of the FORMAT command
|
|
13299
13299
|
*/
|
|
13300
|
-
description: spaceTrim$
|
|
13300
|
+
description: spaceTrim$1(`
|
|
13301
13301
|
Format command describes the desired output of the task (after post-processing)
|
|
13302
13302
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
13303
13303
|
`),
|
|
@@ -13669,7 +13669,7 @@ const formfactorCommandParser = {
|
|
|
13669
13669
|
const formfactorNameCandidate = args[0].toUpperCase();
|
|
13670
13670
|
const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
|
|
13671
13671
|
if (formfactor === undefined) {
|
|
13672
|
-
throw new ParseError(spaceTrim$
|
|
13672
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13673
13673
|
Unknown formfactor name "${formfactorNameCandidate}"
|
|
13674
13674
|
|
|
13675
13675
|
Available formfactors:
|
|
@@ -13688,7 +13688,7 @@ const formfactorCommandParser = {
|
|
|
13688
13688
|
*/
|
|
13689
13689
|
$applyToPipelineJson(command, $pipelineJson) {
|
|
13690
13690
|
if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
|
|
13691
|
-
throw new ParseError(spaceTrim$
|
|
13691
|
+
throw new ParseError(spaceTrim$1(`
|
|
13692
13692
|
Redefinition of \`FORMFACTOR\` in the pipeline head
|
|
13693
13693
|
|
|
13694
13694
|
You have used:
|
|
@@ -13836,7 +13836,7 @@ const modelCommandParser = {
|
|
|
13836
13836
|
*/
|
|
13837
13837
|
parse(input) {
|
|
13838
13838
|
const { args, normalized } = input;
|
|
13839
|
-
const availableVariantsMessage = spaceTrim$
|
|
13839
|
+
const availableVariantsMessage = spaceTrim$1((block) => `
|
|
13840
13840
|
Available variants are:
|
|
13841
13841
|
${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
|
|
13842
13842
|
`);
|
|
@@ -13858,14 +13858,14 @@ const modelCommandParser = {
|
|
|
13858
13858
|
// <- Note: [🤖]
|
|
13859
13859
|
}
|
|
13860
13860
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
13861
|
-
spaceTrim$
|
|
13861
|
+
spaceTrim$1((block) => `
|
|
13862
13862
|
Embedding model can not be used in pipeline
|
|
13863
13863
|
|
|
13864
13864
|
${block(availableVariantsMessage)}
|
|
13865
13865
|
`);
|
|
13866
13866
|
}
|
|
13867
13867
|
else {
|
|
13868
|
-
throw new ParseError(spaceTrim$
|
|
13868
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13869
13869
|
Unknown model variant in command:
|
|
13870
13870
|
|
|
13871
13871
|
${block(availableVariantsMessage)}
|
|
@@ -13880,7 +13880,7 @@ const modelCommandParser = {
|
|
|
13880
13880
|
};
|
|
13881
13881
|
}
|
|
13882
13882
|
else {
|
|
13883
|
-
throw new ParseError(spaceTrim$
|
|
13883
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
13884
13884
|
Unknown model key in command.
|
|
13885
13885
|
|
|
13886
13886
|
Supported model keys are:
|
|
@@ -13907,7 +13907,7 @@ const modelCommandParser = {
|
|
|
13907
13907
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
13908
13908
|
}
|
|
13909
13909
|
else {
|
|
13910
|
-
throw new ParseError(spaceTrim$
|
|
13910
|
+
throw new ParseError(spaceTrim$1(`
|
|
13911
13911
|
Redefinition of \`MODEL ${command.key}\` in the pipeline head
|
|
13912
13912
|
|
|
13913
13913
|
You have used:
|
|
@@ -13935,7 +13935,7 @@ const modelCommandParser = {
|
|
|
13935
13935
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
13936
13936
|
}
|
|
13937
13937
|
else {
|
|
13938
|
-
throw new ParseError(spaceTrim$
|
|
13938
|
+
throw new ParseError(spaceTrim$1(`
|
|
13939
13939
|
Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
|
|
13940
13940
|
|
|
13941
13941
|
You have used:
|
|
@@ -13945,7 +13945,7 @@ const modelCommandParser = {
|
|
|
13945
13945
|
}
|
|
13946
13946
|
}
|
|
13947
13947
|
if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
|
|
13948
|
-
console.log(spaceTrim$
|
|
13948
|
+
console.log(spaceTrim$1(`
|
|
13949
13949
|
Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
|
|
13950
13950
|
|
|
13951
13951
|
In pipeline head:
|
|
@@ -14028,7 +14028,7 @@ const parameterCommandParser = {
|
|
|
14028
14028
|
// <- TODO: When [🥶] fixed, change to:
|
|
14029
14029
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
14030
14030
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
14031
|
-
throw new ParseError(spaceTrim$
|
|
14031
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
14032
14032
|
Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
|
|
14033
14033
|
|
|
14034
14034
|
The description:
|
|
@@ -14210,7 +14210,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
14210
14210
|
persona.description = personaDescription;
|
|
14211
14211
|
return;
|
|
14212
14212
|
}
|
|
14213
|
-
console.warn(spaceTrim$
|
|
14213
|
+
console.warn(spaceTrim$1(`
|
|
14214
14214
|
|
|
14215
14215
|
Persona "${personaName}" is defined multiple times with different description:
|
|
14216
14216
|
|
|
@@ -14221,7 +14221,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
14221
14221
|
${personaDescription}
|
|
14222
14222
|
|
|
14223
14223
|
`));
|
|
14224
|
-
persona.description += spaceTrim$
|
|
14224
|
+
persona.description += spaceTrim$1('\n\n' + personaDescription);
|
|
14225
14225
|
}
|
|
14226
14226
|
|
|
14227
14227
|
/**
|
|
@@ -15062,7 +15062,7 @@ function removeMarkdownComments(content) {
|
|
|
15062
15062
|
*/
|
|
15063
15063
|
function isFlatPipeline(pipelineString) {
|
|
15064
15064
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
15065
|
-
pipelineString = spaceTrim$
|
|
15065
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
15066
15066
|
const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
15067
15067
|
//const isLastLineReturnStatement = pipelineString.split(/\r?\n/).pop()!.split('`').join('').startsWith('->');
|
|
15068
15068
|
const isBacktickBlockUsed = pipelineString.includes('```');
|
|
@@ -15088,7 +15088,7 @@ function deflatePipeline(pipelineString) {
|
|
|
15088
15088
|
if (!isFlatPipeline(pipelineString)) {
|
|
15089
15089
|
return pipelineString;
|
|
15090
15090
|
}
|
|
15091
|
-
pipelineString = spaceTrim$
|
|
15091
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
15092
15092
|
const pipelineStringLines = pipelineString.split(/\r?\n/);
|
|
15093
15093
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
15094
15094
|
let returnStatement;
|
|
@@ -15101,19 +15101,19 @@ function deflatePipeline(pipelineString) {
|
|
|
15101
15101
|
returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
|
|
15102
15102
|
pipelineStringLines.push(potentialReturnStatement);
|
|
15103
15103
|
}
|
|
15104
|
-
const prompt = spaceTrim$
|
|
15104
|
+
const prompt = spaceTrim$1(pipelineStringLines.join('\n'));
|
|
15105
15105
|
let quotedPrompt;
|
|
15106
15106
|
if (prompt.split(/\r?\n/).length <= 1) {
|
|
15107
15107
|
quotedPrompt = `> ${prompt}`;
|
|
15108
15108
|
}
|
|
15109
15109
|
else {
|
|
15110
|
-
quotedPrompt = spaceTrim$
|
|
15110
|
+
quotedPrompt = spaceTrim$1((block) => `
|
|
15111
15111
|
\`\`\`
|
|
15112
15112
|
${block(prompt.split('`').join('\\`'))}
|
|
15113
15113
|
\`\`\`
|
|
15114
15114
|
`);
|
|
15115
15115
|
}
|
|
15116
|
-
pipelineString = validatePipelineString(spaceTrim$
|
|
15116
|
+
pipelineString = validatePipelineString(spaceTrim$1((block) => `
|
|
15117
15117
|
# ${DEFAULT_BOOK_TITLE}
|
|
15118
15118
|
|
|
15119
15119
|
## Prompt
|
|
@@ -15177,7 +15177,7 @@ function extractAllListItemsFromMarkdown(markdown) {
|
|
|
15177
15177
|
function extractOneBlockFromMarkdown(markdown) {
|
|
15178
15178
|
const codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
15179
15179
|
if (codeBlocks.length !== 1) {
|
|
15180
|
-
throw new ParseError(spaceTrim$
|
|
15180
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
15181
15181
|
There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
|
|
15182
15182
|
|
|
15183
15183
|
${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
|
|
@@ -15202,7 +15202,7 @@ function parseMarkdownSection(value) {
|
|
|
15202
15202
|
}
|
|
15203
15203
|
const title = lines[0].replace(/^#+\s*/, '');
|
|
15204
15204
|
const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
15205
|
-
const content = spaceTrim$
|
|
15205
|
+
const content = spaceTrim$1(lines.slice(1).join('\n'));
|
|
15206
15206
|
if (level < 1 || level > 6) {
|
|
15207
15207
|
throw new ParseError('Markdown section must have heading level between 1 and 6');
|
|
15208
15208
|
}
|
|
@@ -15230,7 +15230,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
15230
15230
|
if (buffer.length === 0) {
|
|
15231
15231
|
return;
|
|
15232
15232
|
}
|
|
15233
|
-
let section = spaceTrim$
|
|
15233
|
+
let section = spaceTrim$1(buffer.join('\n'));
|
|
15234
15234
|
if (section === '') {
|
|
15235
15235
|
return;
|
|
15236
15236
|
}
|
|
@@ -15305,7 +15305,7 @@ function flattenMarkdown(markdown) {
|
|
|
15305
15305
|
flattenedMarkdown += `## ${title}` + `\n\n`;
|
|
15306
15306
|
flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
|
|
15307
15307
|
}
|
|
15308
|
-
return spaceTrim$
|
|
15308
|
+
return spaceTrim$1(flattenedMarkdown);
|
|
15309
15309
|
}
|
|
15310
15310
|
/**
|
|
15311
15311
|
* TODO: [🏛] This can be part of markdown builder
|
|
@@ -15956,8 +15956,8 @@ class MarkdownScraper {
|
|
|
15956
15956
|
knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
|
|
15957
15957
|
// Note: These are just default values, they will be overwritten by the actual values:
|
|
15958
15958
|
let name = `piece-${i}`;
|
|
15959
|
-
let title = spaceTrim$
|
|
15960
|
-
const knowledgePieceContent = spaceTrim$
|
|
15959
|
+
let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
|
|
15960
|
+
const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
|
|
15961
15961
|
let keywords = [];
|
|
15962
15962
|
const index = [];
|
|
15963
15963
|
/*
|
|
@@ -15970,7 +15970,7 @@ class MarkdownScraper {
|
|
|
15970
15970
|
isCrashedOnError: true,
|
|
15971
15971
|
});
|
|
15972
15972
|
const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
|
|
15973
|
-
title = spaceTrim$
|
|
15973
|
+
title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
|
|
15974
15974
|
name = titleToName(title);
|
|
15975
15975
|
// --- Keywords
|
|
15976
15976
|
const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
|
|
@@ -27402,7 +27402,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27402
27402
|
}
|
|
27403
27403
|
// Note: [💎]
|
|
27404
27404
|
// Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
|
|
27405
|
-
const spaceTrim = (_) =>
|
|
27405
|
+
const spaceTrim = (_) => _spaceTrim(_);
|
|
27406
27406
|
$preserve(spaceTrim);
|
|
27407
27407
|
const removeQuotes$1 = removeQuotes;
|
|
27408
27408
|
$preserve(removeQuotes$1);
|
|
@@ -27493,7 +27493,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27493
27493
|
.join('\n');
|
|
27494
27494
|
// script = templateParameters(script, parameters);
|
|
27495
27495
|
// <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
|
|
27496
|
-
const statementToEvaluate =
|
|
27496
|
+
const statementToEvaluate = _spaceTrim((block) => `
|
|
27497
27497
|
|
|
27498
27498
|
// Build-in functions:
|
|
27499
27499
|
${block(buildinFunctionsStatement)}
|
|
@@ -27508,7 +27508,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27508
27508
|
(async ()=>{ ${script} })()
|
|
27509
27509
|
`);
|
|
27510
27510
|
if (this.options.isVerbose) {
|
|
27511
|
-
console.info(
|
|
27511
|
+
console.info(_spaceTrim((block) => `
|
|
27512
27512
|
🚀 Evaluating ${scriptLanguage} script:
|
|
27513
27513
|
|
|
27514
27514
|
${block(statementToEvaluate)}`));
|
|
@@ -27517,7 +27517,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27517
27517
|
try {
|
|
27518
27518
|
result = await eval(statementToEvaluate);
|
|
27519
27519
|
if (this.options.isVerbose) {
|
|
27520
|
-
console.info(
|
|
27520
|
+
console.info(_spaceTrim((block) => `
|
|
27521
27521
|
🚀 Script evaluated successfully, result:
|
|
27522
27522
|
${block(valueToString(result))}
|
|
27523
27523
|
`));
|
|
@@ -27536,7 +27536,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27536
27536
|
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
27537
27537
|
*/
|
|
27538
27538
|
if (!statementToEvaluate.includes(undefinedName + '(')) {
|
|
27539
|
-
throw new PipelineExecutionError(
|
|
27539
|
+
throw new PipelineExecutionError(_spaceTrim((block) => `
|
|
27540
27540
|
|
|
27541
27541
|
Parameter \`{${undefinedName}}\` is not defined
|
|
27542
27542
|
|
|
@@ -27558,7 +27558,7 @@ class JavascriptEvalExecutionTools {
|
|
|
27558
27558
|
`));
|
|
27559
27559
|
}
|
|
27560
27560
|
else {
|
|
27561
|
-
throw new PipelineExecutionError(
|
|
27561
|
+
throw new PipelineExecutionError(_spaceTrim((block) => `
|
|
27562
27562
|
Function ${undefinedName}() is not defined
|
|
27563
27563
|
|
|
27564
27564
|
- Make sure that the function is one of built-in functions
|
|
@@ -27811,7 +27811,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
27811
27811
|
catch (error) {
|
|
27812
27812
|
assertsError(error);
|
|
27813
27813
|
// TODO: [7] DRY
|
|
27814
|
-
const wrappedErrorMessage = spaceTrim$
|
|
27814
|
+
const wrappedErrorMessage = spaceTrim$1((block) => `
|
|
27815
27815
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
27816
27816
|
|
|
27817
27817
|
Original error message:
|
|
@@ -27846,7 +27846,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
27846
27846
|
pipeline = { ...pipeline, pipelineUrl };
|
|
27847
27847
|
}
|
|
27848
27848
|
else if (!pipeline.pipelineUrl.startsWith(rootUrl)) {
|
|
27849
|
-
throw new PipelineUrlError(spaceTrim$
|
|
27849
|
+
throw new PipelineUrlError(spaceTrim$1(`
|
|
27850
27850
|
Pipeline with URL ${pipeline.pipelineUrl} is not a child of the root URL ${rootUrl} 🍏
|
|
27851
27851
|
|
|
27852
27852
|
File:
|
|
@@ -27884,7 +27884,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
27884
27884
|
}
|
|
27885
27885
|
else {
|
|
27886
27886
|
const existing = collection.get(pipeline.pipelineUrl);
|
|
27887
|
-
throw new PipelineUrlError(spaceTrim$
|
|
27887
|
+
throw new PipelineUrlError(spaceTrim$1(`
|
|
27888
27888
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍏
|
|
27889
27889
|
|
|
27890
27890
|
Conflicting files:
|
|
@@ -27902,7 +27902,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
27902
27902
|
catch (error) {
|
|
27903
27903
|
assertsError(error);
|
|
27904
27904
|
// TODO: [7] DRY
|
|
27905
|
-
const wrappedErrorMessage = spaceTrim$
|
|
27905
|
+
const wrappedErrorMessage = spaceTrim$1((block) => `
|
|
27906
27906
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
27907
27907
|
|
|
27908
27908
|
Original error message:
|
|
@@ -28037,7 +28037,7 @@ function usageToHuman(usage) {
|
|
|
28037
28037
|
// Note: For negligible usage, we report at least something
|
|
28038
28038
|
reportItems.push('Negligible');
|
|
28039
28039
|
}
|
|
28040
|
-
return spaceTrim$
|
|
28040
|
+
return spaceTrim$1((block) => `
|
|
28041
28041
|
Usage:
|
|
28042
28042
|
${block(reportItems.map((item) => `- ${item}`).join('\n'))}
|
|
28043
28043
|
`);
|
|
@@ -28077,7 +28077,7 @@ async function $provideScriptingForNode(options) {
|
|
|
28077
28077
|
*/
|
|
28078
28078
|
function $initializeMakeCommand(program) {
|
|
28079
28079
|
const makeCommand = program.command('make');
|
|
28080
|
-
makeCommand.description(spaceTrim$
|
|
28080
|
+
makeCommand.description(spaceTrim$1(`
|
|
28081
28081
|
Makes a new pipeline collection in given folder
|
|
28082
28082
|
`));
|
|
28083
28083
|
makeCommand.alias('compile');
|
|
@@ -28089,7 +28089,7 @@ function $initializeMakeCommand(program) {
|
|
|
28089
28089
|
'Path to promptbook collection directory', DEFAULT_BOOKS_DIRNAME);
|
|
28090
28090
|
makeCommand.option('--project-name', `Name of the project for whom collection is`, 'Untitled Promptbook project');
|
|
28091
28091
|
makeCommand.option('--root-url <url>', `Root URL of all pipelines to make`, undefined);
|
|
28092
|
-
makeCommand.option('-f, --format <format>', spaceTrim$
|
|
28092
|
+
makeCommand.option('-f, --format <format>', spaceTrim$1(`
|
|
28093
28093
|
Output format of builded collection "bookc", "javascript", "typescript" or "json"
|
|
28094
28094
|
|
|
28095
28095
|
Note: You can use multiple formats separated by comma
|
|
@@ -28097,14 +28097,14 @@ function $initializeMakeCommand(program) {
|
|
|
28097
28097
|
makeCommand.option('--no-validation', `Do not validate logic of pipelines in collection`, true);
|
|
28098
28098
|
makeCommand.option('--validation', `Types of validations separated by comma (options "logic","imports")`, 'logic,imports');
|
|
28099
28099
|
makeCommand.option('-r, --reload', `Call LLM models even if same prompt with result is in the cache`, false);
|
|
28100
|
-
makeCommand.option('-o, --output <path>', spaceTrim$
|
|
28100
|
+
makeCommand.option('-o, --output <path>', spaceTrim$1(`
|
|
28101
28101
|
Where to save the builded collection
|
|
28102
28102
|
|
|
28103
28103
|
Note: If you keep it "${DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME}" it will be saved in the root of the promptbook directory
|
|
28104
28104
|
If you set it to a path, it will be saved in that path
|
|
28105
28105
|
BUT you can use only one format and set correct extension
|
|
28106
28106
|
`), DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME);
|
|
28107
|
-
makeCommand.option('-fn, --function-name <functionName>', spaceTrim$
|
|
28107
|
+
makeCommand.option('-fn, --function-name <functionName>', spaceTrim$1(`
|
|
28108
28108
|
Name of the function to get pipeline collection
|
|
28109
28109
|
|
|
28110
28110
|
Note: This can be used only with "javascript" or "typescript" format
|
|
@@ -28187,7 +28187,7 @@ function $initializeMakeCommand(program) {
|
|
|
28187
28187
|
if (lastChar !== ']') {
|
|
28188
28188
|
throw new UnexpectedError(`Last character of serialized collection should be "]" not "${lastChar}"`);
|
|
28189
28189
|
}
|
|
28190
|
-
return spaceTrim$
|
|
28190
|
+
return spaceTrim$1(collectionJsonString.substring(1, collectionJsonString.length - 1));
|
|
28191
28191
|
})();
|
|
28192
28192
|
const saveFile = async (extension, content) => {
|
|
28193
28193
|
const filename = output !== DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
@@ -28218,7 +28218,7 @@ function $initializeMakeCommand(program) {
|
|
|
28218
28218
|
}
|
|
28219
28219
|
if (formats.includes('javascript') || formats.includes('js')) {
|
|
28220
28220
|
formats = formats.filter((format) => format !== 'javascript' && format !== 'js');
|
|
28221
|
-
(await saveFile('js', spaceTrim$
|
|
28221
|
+
(await saveFile('js', spaceTrim$1((block) => `
|
|
28222
28222
|
// ${block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI)}
|
|
28223
28223
|
|
|
28224
28224
|
import { createPipelineCollectionFromJson } from '@promptbook/core';
|
|
@@ -28255,7 +28255,7 @@ function $initializeMakeCommand(program) {
|
|
|
28255
28255
|
}
|
|
28256
28256
|
if (formats.includes('typescript') || formats.includes('ts')) {
|
|
28257
28257
|
formats = formats.filter((format) => format !== 'typescript' && format !== 'ts');
|
|
28258
|
-
await saveFile('ts', spaceTrim$
|
|
28258
|
+
await saveFile('ts', spaceTrim$1((block) => `
|
|
28259
28259
|
// ${block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI)}
|
|
28260
28260
|
|
|
28261
28261
|
import { createPipelineCollectionFromJson } from '@promptbook/core';
|
|
@@ -28400,7 +28400,7 @@ async function prettifyPipelineString(pipelineString, options) {
|
|
|
28400
28400
|
*/
|
|
28401
28401
|
function $initializePrettifyCommand(program) {
|
|
28402
28402
|
const prettifyCommand = program.command('prettify');
|
|
28403
|
-
prettifyCommand.description(spaceTrim$
|
|
28403
|
+
prettifyCommand.description(spaceTrim$1(`
|
|
28404
28404
|
Iterates over \`.book.md\` files and does multiple enhancing operations on them:
|
|
28405
28405
|
|
|
28406
28406
|
1) Adds Mermaid graph
|
|
@@ -28856,7 +28856,7 @@ async function $getCompiledBook(tools, pipelineSource, options) {
|
|
|
28856
28856
|
// console.log(`Strategy 3️⃣`);
|
|
28857
28857
|
const response = await fetch(pipelineSource);
|
|
28858
28858
|
if (response.status >= 300) {
|
|
28859
|
-
throw new NotFoundError(spaceTrim$
|
|
28859
|
+
throw new NotFoundError(spaceTrim$1((block) => `
|
|
28860
28860
|
Book not found on URL:
|
|
28861
28861
|
${block(pipelineSource)}
|
|
28862
28862
|
|
|
@@ -28866,7 +28866,7 @@ async function $getCompiledBook(tools, pipelineSource, options) {
|
|
|
28866
28866
|
const pipelineString = await response.text();
|
|
28867
28867
|
// console.log({ pipelineString });
|
|
28868
28868
|
if (!isValidPipelineString(pipelineString)) {
|
|
28869
|
-
throw new NotFoundError(spaceTrim$
|
|
28869
|
+
throw new NotFoundError(spaceTrim$1((block) => `
|
|
28870
28870
|
Book not found on URL:
|
|
28871
28871
|
${block(pipelineSource)}
|
|
28872
28872
|
|
|
@@ -28888,7 +28888,7 @@ async function $getCompiledBook(tools, pipelineSource, options) {
|
|
|
28888
28888
|
});
|
|
28889
28889
|
return pipelineJson;
|
|
28890
28890
|
} /* not else */
|
|
28891
|
-
throw new NotFoundError(spaceTrim$
|
|
28891
|
+
throw new NotFoundError(spaceTrim$1((block) => `
|
|
28892
28892
|
Book not found:
|
|
28893
28893
|
${block(pipelineSource)}
|
|
28894
28894
|
|
|
@@ -28935,7 +28935,7 @@ async function runInteractiveChatbot(options) {
|
|
|
28935
28935
|
const initialMessage = (((_a = pipeline.parameters.find(({ name }) => name === 'chatbotResponse')) === null || _a === void 0 ? void 0 : _a.exampleValues) || [])[0];
|
|
28936
28936
|
if (initialMessage) {
|
|
28937
28937
|
console.info(`\n`);
|
|
28938
|
-
console.info(spaceTrim$
|
|
28938
|
+
console.info(spaceTrim$1((block) => `
|
|
28939
28939
|
|
|
28940
28940
|
${colors.bold(colors.green('Chatbot:'))}
|
|
28941
28941
|
${block(colors.green(initialMessage))}
|
|
@@ -28958,7 +28958,7 @@ async function runInteractiveChatbot(options) {
|
|
|
28958
28958
|
type: 'text',
|
|
28959
28959
|
name: 'userMessage',
|
|
28960
28960
|
message: 'User message',
|
|
28961
|
-
hint: spaceTrim$
|
|
28961
|
+
hint: spaceTrim$1((block) => `
|
|
28962
28962
|
Type "exit" to exit,
|
|
28963
28963
|
|
|
28964
28964
|
previousTitle
|
|
@@ -28974,7 +28974,7 @@ async function runInteractiveChatbot(options) {
|
|
|
28974
28974
|
return process.exit(0);
|
|
28975
28975
|
}
|
|
28976
28976
|
console.info(`\n`);
|
|
28977
|
-
console.info(spaceTrim$
|
|
28977
|
+
console.info(spaceTrim$1((block) => `
|
|
28978
28978
|
|
|
28979
28979
|
${colors.bold(colors.blue('User:'))}
|
|
28980
28980
|
${block(colors.blue(userMessage))}
|
|
@@ -28987,7 +28987,7 @@ async function runInteractiveChatbot(options) {
|
|
|
28987
28987
|
};
|
|
28988
28988
|
const result = await pipelineExecutor(inputParameters).asPromise({ isCrashedOnError: true });
|
|
28989
28989
|
console.info(`\n`);
|
|
28990
|
-
console.info(spaceTrim$
|
|
28990
|
+
console.info(spaceTrim$1((block) => `
|
|
28991
28991
|
|
|
28992
28992
|
${colors.bold(colors.green('Chatbot:'))}
|
|
28993
28993
|
${block(colors.green(result.outputParameters.chatbotResponse))}
|
|
@@ -29018,7 +29018,7 @@ async function runInteractiveChatbot(options) {
|
|
|
29018
29018
|
*/
|
|
29019
29019
|
function $initializeRunCommand(program) {
|
|
29020
29020
|
const runCommand = program.command('run', { isDefault: true });
|
|
29021
|
-
runCommand.description(spaceTrim$
|
|
29021
|
+
runCommand.description(spaceTrim$1(`
|
|
29022
29022
|
Runs a pipeline
|
|
29023
29023
|
`));
|
|
29024
29024
|
runCommand.alias('execute');
|
|
@@ -29061,7 +29061,7 @@ function $initializeRunCommand(program) {
|
|
|
29061
29061
|
if (!error.message.includes('No LLM tools')) {
|
|
29062
29062
|
throw error;
|
|
29063
29063
|
}
|
|
29064
|
-
console.error(colors.red(spaceTrim$
|
|
29064
|
+
console.error(colors.red(spaceTrim$1((block) => `
|
|
29065
29065
|
You need to configure LLM tools first
|
|
29066
29066
|
|
|
29067
29067
|
1) Create .env file at the root of your project
|
|
@@ -29129,7 +29129,7 @@ function $initializeRunCommand(program) {
|
|
|
29129
29129
|
if (!(error instanceof ParseError)) {
|
|
29130
29130
|
throw error;
|
|
29131
29131
|
}
|
|
29132
|
-
console.error(colors.red(spaceTrim$
|
|
29132
|
+
console.error(colors.red(spaceTrim$1((block) => `
|
|
29133
29133
|
${block(error.message)}
|
|
29134
29134
|
|
|
29135
29135
|
in ${pipelineSource}
|
|
@@ -29181,7 +29181,7 @@ function $initializeRunCommand(program) {
|
|
|
29181
29181
|
};
|
|
29182
29182
|
});
|
|
29183
29183
|
if (isInteractive === false && questions.length !== 0) {
|
|
29184
|
-
console.error(colors.red(spaceTrim$
|
|
29184
|
+
console.error(colors.red(spaceTrim$1((block) => `
|
|
29185
29185
|
When using --no-interactive you need to pass all the input parameters through --json
|
|
29186
29186
|
|
|
29187
29187
|
You are missing:
|
|
@@ -29313,7 +29313,7 @@ function $initializeStartAgentsServerCommand(program) {
|
|
|
29313
29313
|
'Path to agents directory', DEFAULT_AGENTS_DIRNAME);
|
|
29314
29314
|
startServerCommand.option('--port <port>', `Port to start the server on`, '4440');
|
|
29315
29315
|
startServerCommand.option('-r, --reload', `Call LLM models even if same prompt with result is in the cache`, false);
|
|
29316
|
-
startServerCommand.description(spaceTrim$
|
|
29316
|
+
startServerCommand.description(spaceTrim$1(`
|
|
29317
29317
|
Starts a Promptbook agents server
|
|
29318
29318
|
`));
|
|
29319
29319
|
startServerCommand.alias('start');
|
|
@@ -30620,7 +30620,7 @@ function $initializeStartPipelinesServerCommand(program) {
|
|
|
30620
30620
|
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
30621
30621
|
'Path to promptbook collection directory', DEFAULT_BOOKS_DIRNAME);
|
|
30622
30622
|
startServerCommand.option('--port <port>', `Port to start the server on`, '4460');
|
|
30623
|
-
startServerCommand.option('-u, --url <url>', spaceTrim$
|
|
30623
|
+
startServerCommand.option('-u, --url <url>', spaceTrim$1(`
|
|
30624
30624
|
Public root url of the server
|
|
30625
30625
|
It is used for following purposes:
|
|
30626
30626
|
|
|
@@ -30630,7 +30630,7 @@ function $initializeStartPipelinesServerCommand(program) {
|
|
|
30630
30630
|
startServerCommand.option('--allow-anonymous', `Is anonymous mode allowed`, false);
|
|
30631
30631
|
startServerCommand.option('-r, --reload', `Call LLM models even if same prompt with result is in the cache`, false);
|
|
30632
30632
|
startServerCommand.option('--no-rich-ui', `Disable rich UI`, true);
|
|
30633
|
-
startServerCommand.description(spaceTrim$
|
|
30633
|
+
startServerCommand.description(spaceTrim$1(`
|
|
30634
30634
|
Starts a remote server to execute books
|
|
30635
30635
|
|
|
30636
30636
|
Note: You want probably to use "ptbk start-agents-server" to start agents server instead of pipelines server
|
|
@@ -30721,7 +30721,7 @@ function $initializeStartPipelinesServerCommand(program) {
|
|
|
30721
30721
|
*/
|
|
30722
30722
|
function $initializeTestCommand(program) {
|
|
30723
30723
|
const testCommand = program.command('test');
|
|
30724
|
-
testCommand.description(spaceTrim$
|
|
30724
|
+
testCommand.description(spaceTrim$1(`
|
|
30725
30725
|
Iterates over \`.book.md\` and \`.bookc\` and checks if they are parsable and logically valid
|
|
30726
30726
|
`));
|
|
30727
30727
|
testCommand.argument('<filesGlob>',
|
|
@@ -30961,7 +30961,7 @@ function pricing(value) {
|
|
|
30961
30961
|
/**
|
|
30962
30962
|
* List of available Anthropic Claude models with pricing
|
|
30963
30963
|
*
|
|
30964
|
-
* Note: Synced with official API docs at
|
|
30964
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
30965
30965
|
*
|
|
30966
30966
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
30967
30967
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -30969,6 +30969,26 @@ function pricing(value) {
|
|
|
30969
30969
|
const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
30970
30970
|
name: 'ANTHROPIC_CLAUDE_MODELS',
|
|
30971
30971
|
value: [
|
|
30972
|
+
{
|
|
30973
|
+
modelVariant: 'CHAT',
|
|
30974
|
+
modelTitle: 'Claude Opus 4.6',
|
|
30975
|
+
modelName: 'claude-opus-4-6',
|
|
30976
|
+
modelDescription: "Anthropic's most capable model for advanced coding, complex reasoning, and agentic workflows with 1M token context window.",
|
|
30977
|
+
pricing: {
|
|
30978
|
+
prompt: pricing(`$5.00 / 1M tokens`),
|
|
30979
|
+
output: pricing(`$25.00 / 1M tokens`),
|
|
30980
|
+
},
|
|
30981
|
+
},
|
|
30982
|
+
{
|
|
30983
|
+
modelVariant: 'CHAT',
|
|
30984
|
+
modelTitle: 'Claude Sonnet 4.6',
|
|
30985
|
+
modelName: 'claude-sonnet-4-6',
|
|
30986
|
+
modelDescription: 'Best speed and intelligence balance for production-ready workloads with 1M token context window. Ideal for high-performance, lower-latency applications.',
|
|
30987
|
+
pricing: {
|
|
30988
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
30989
|
+
output: pricing(`$15.00 / 1M tokens`),
|
|
30990
|
+
},
|
|
30991
|
+
},
|
|
30972
30992
|
{
|
|
30973
30993
|
modelVariant: 'CHAT',
|
|
30974
30994
|
modelTitle: 'Claude Sonnet 4.5',
|
|
@@ -31370,7 +31390,7 @@ class AnthropicClaudeExecutionTools {
|
|
|
31370
31390
|
getDefaultModel(defaultModelName) {
|
|
31371
31391
|
const model = ANTHROPIC_CLAUDE_MODELS.find(({ modelName }) => modelName.startsWith(defaultModelName));
|
|
31372
31392
|
if (model === undefined) {
|
|
31373
|
-
throw new UnexpectedError(spaceTrim$
|
|
31393
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
31374
31394
|
Cannot find model in Anthropic Claude models with name "${defaultModelName}" which should be used as default.
|
|
31375
31395
|
|
|
31376
31396
|
Available models:
|
|
@@ -31527,7 +31547,7 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
31527
31547
|
/**
|
|
31528
31548
|
* List of available OpenAI models with pricing
|
|
31529
31549
|
*
|
|
31530
|
-
* Note: Synced with official API docs at
|
|
31550
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
31531
31551
|
*
|
|
31532
31552
|
* @see https://platform.openai.com/docs/models/
|
|
31533
31553
|
* @see https://openai.com/api/pricing/
|
|
@@ -31649,8 +31669,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31649
31669
|
modelName: 'gpt-4.1',
|
|
31650
31670
|
modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
|
|
31651
31671
|
pricing: {
|
|
31652
|
-
prompt: pricing(`$
|
|
31653
|
-
output: pricing(`$
|
|
31672
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
31673
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
31654
31674
|
},
|
|
31655
31675
|
},
|
|
31656
31676
|
/**/
|
|
@@ -31661,8 +31681,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31661
31681
|
modelName: 'gpt-4.1-mini',
|
|
31662
31682
|
modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
|
|
31663
31683
|
pricing: {
|
|
31664
|
-
prompt: pricing(`$0.
|
|
31665
|
-
output: pricing(`$
|
|
31684
|
+
prompt: pricing(`$0.40 / 1M tokens`),
|
|
31685
|
+
output: pricing(`$1.60 / 1M tokens`),
|
|
31666
31686
|
},
|
|
31667
31687
|
},
|
|
31668
31688
|
/**/
|
|
@@ -31673,8 +31693,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31673
31693
|
modelName: 'gpt-4.1-nano',
|
|
31674
31694
|
modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
|
|
31675
31695
|
pricing: {
|
|
31676
|
-
prompt: pricing(`$0.
|
|
31677
|
-
output: pricing(`$0.
|
|
31696
|
+
prompt: pricing(`$0.10 / 1M tokens`),
|
|
31697
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
31678
31698
|
},
|
|
31679
31699
|
},
|
|
31680
31700
|
/**/
|
|
@@ -31685,8 +31705,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31685
31705
|
modelName: 'o3',
|
|
31686
31706
|
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
|
|
31687
31707
|
pricing: {
|
|
31688
|
-
prompt: pricing(`$
|
|
31689
|
-
output: pricing(`$
|
|
31708
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
31709
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
31690
31710
|
},
|
|
31691
31711
|
},
|
|
31692
31712
|
/**/
|
|
@@ -31697,8 +31717,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31697
31717
|
modelName: 'o3-pro',
|
|
31698
31718
|
modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
|
|
31699
31719
|
pricing: {
|
|
31700
|
-
prompt: pricing(`$
|
|
31701
|
-
output: pricing(`$
|
|
31720
|
+
prompt: pricing(`$20.00 / 1M tokens`),
|
|
31721
|
+
output: pricing(`$80.00 / 1M tokens`),
|
|
31702
31722
|
},
|
|
31703
31723
|
},
|
|
31704
31724
|
/**/
|
|
@@ -31709,8 +31729,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
31709
31729
|
modelName: 'o4-mini',
|
|
31710
31730
|
modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
|
|
31711
31731
|
pricing: {
|
|
31712
|
-
prompt: pricing(`$
|
|
31713
|
-
output: pricing(`$
|
|
31732
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
31733
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
31714
31734
|
},
|
|
31715
31735
|
},
|
|
31716
31736
|
/**/
|
|
@@ -32068,8 +32088,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
32068
32088
|
modelName: 'gpt-4o-2024-05-13',
|
|
32069
32089
|
modelDescription: 'May 2024 version of GPT-4o with 128K context window. Features enhanced multimodal capabilities including superior image understanding (up to 20MP), audio processing, and improved reasoning. Optimized for 2x lower latency than GPT-4 Turbo while maintaining high performance. Includes knowledge up to October 2023. Ideal for production applications requiring reliable multimodal capabilities.',
|
|
32070
32090
|
pricing: {
|
|
32071
|
-
prompt: pricing(`$
|
|
32072
|
-
output: pricing(`$
|
|
32091
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
32092
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
32073
32093
|
},
|
|
32074
32094
|
},
|
|
32075
32095
|
/**/
|
|
@@ -32080,8 +32100,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
32080
32100
|
modelName: 'gpt-4o',
|
|
32081
32101
|
modelDescription: "OpenAI's most advanced general-purpose multimodal model with 128K context window. Optimized for balanced performance, speed, and cost with 2x faster responses than GPT-4 Turbo. Features excellent vision processing, audio understanding, reasoning, and text generation quality. Represents optimal balance of capability and efficiency for most advanced applications.",
|
|
32082
32102
|
pricing: {
|
|
32083
|
-
prompt: pricing(`$
|
|
32084
|
-
output: pricing(`$
|
|
32103
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
32104
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
32085
32105
|
},
|
|
32086
32106
|
},
|
|
32087
32107
|
/**/
|
|
@@ -32152,8 +32172,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
32152
32172
|
modelName: 'o3-mini',
|
|
32153
32173
|
modelDescription: 'Cost-effective reasoning model with 128K context window optimized for academic and scientific problem-solving. Features efficient performance on STEM tasks with specialized capabilities in mathematics, physics, chemistry, and computer science. Offers 80% of O1 performance on technical domains at significantly lower cost. Ideal for educational applications and research support.',
|
|
32154
32174
|
pricing: {
|
|
32155
|
-
prompt: pricing(`$
|
|
32156
|
-
output: pricing(`$
|
|
32175
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
32176
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
32157
32177
|
},
|
|
32158
32178
|
},
|
|
32159
32179
|
/**/
|
|
@@ -32668,7 +32688,7 @@ function createExecutionToolsFromVercelProvider(options) {
|
|
|
32668
32688
|
const modelName = modelRequirements.modelName ||
|
|
32669
32689
|
((_a = availableModels.find(({ modelVariant }) => modelVariant === 'CHAT')) === null || _a === void 0 ? void 0 : _a.modelName);
|
|
32670
32690
|
if (!modelName) {
|
|
32671
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
32691
|
+
throw new PipelineExecutionError(spaceTrim$1(`
|
|
32672
32692
|
Can not determine which model to use.
|
|
32673
32693
|
|
|
32674
32694
|
You need to provide at least one of:
|
|
@@ -32783,7 +32803,7 @@ function createExecutionToolsFromVercelProvider(options) {
|
|
|
32783
32803
|
/**
|
|
32784
32804
|
* List of available Deepseek models with descriptions
|
|
32785
32805
|
*
|
|
32786
|
-
* Note: Synced with official API docs at
|
|
32806
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
32787
32807
|
*
|
|
32788
32808
|
* @see https://www.deepseek.com/models
|
|
32789
32809
|
* @public exported from `@promptbook/deepseek`
|
|
@@ -32797,8 +32817,8 @@ const DEEPSEEK_MODELS = exportJson({
|
|
|
32797
32817
|
modelName: 'deepseek-chat',
|
|
32798
32818
|
modelDescription: 'Latest flagship general-purpose model with 128K context window. Features exceptional reasoning capabilities, advanced code generation, and strong performance across diverse domains. Offers competitive performance with leading models while maintaining cost efficiency. Ideal for complex reasoning, coding, and knowledge-intensive tasks.',
|
|
32799
32819
|
pricing: {
|
|
32800
|
-
prompt: pricing(`$0.
|
|
32801
|
-
output: pricing(`$0.
|
|
32820
|
+
prompt: pricing(`$0.28 / 1M tokens`),
|
|
32821
|
+
output: pricing(`$0.42 / 1M tokens`),
|
|
32802
32822
|
},
|
|
32803
32823
|
},
|
|
32804
32824
|
{
|
|
@@ -33064,7 +33084,7 @@ const _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
33064
33084
|
/**
|
|
33065
33085
|
* List of available Google models with descriptions
|
|
33066
33086
|
*
|
|
33067
|
-
* Note: Synced with official API docs at
|
|
33087
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
33068
33088
|
*
|
|
33069
33089
|
* @see https://ai.google.dev/models/gemini
|
|
33070
33090
|
* @public exported from `@promptbook/google`
|
|
@@ -33085,8 +33105,8 @@ const GOOGLE_MODELS = exportJson({
|
|
|
33085
33105
|
modelName: 'gemini-2.5-pro',
|
|
33086
33106
|
modelDescription: 'State-of-the-art thinking model with 1M token context window capable of reasoning over complex problems in code, math, and STEM. Features enhanced thinking capabilities, advanced multimodal understanding, and superior performance on analytical tasks. Ideal for complex enterprise applications requiring maximum intelligence and reasoning.',
|
|
33087
33107
|
pricing: {
|
|
33088
|
-
prompt: pricing(`$
|
|
33089
|
-
output: pricing(`$
|
|
33108
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
33109
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
33090
33110
|
},
|
|
33091
33111
|
},
|
|
33092
33112
|
{
|
|
@@ -33095,8 +33115,8 @@ const GOOGLE_MODELS = exportJson({
|
|
|
33095
33115
|
modelName: 'gemini-2.5-flash',
|
|
33096
33116
|
modelDescription: 'Best model in terms of price-performance with 1M token context window offering well-rounded capabilities. Features adaptive thinking, cost efficiency, and enhanced reasoning for large-scale processing. Ideal for low-latency, high-volume tasks that require thinking and agentic use cases.',
|
|
33097
33117
|
pricing: {
|
|
33098
|
-
prompt: pricing(`$0.
|
|
33099
|
-
output: pricing(`$
|
|
33118
|
+
prompt: pricing(`$0.30 / 1M tokens`),
|
|
33119
|
+
output: pricing(`$2.50 / 1M tokens`),
|
|
33100
33120
|
},
|
|
33101
33121
|
},
|
|
33102
33122
|
{
|
|
@@ -33105,8 +33125,8 @@ const GOOGLE_MODELS = exportJson({
|
|
|
33105
33125
|
modelName: 'gemini-2.5-flash-lite',
|
|
33106
33126
|
modelDescription: 'Cost-efficient Gemini 2.5 Flash model optimized for high throughput with 1M token context window. Features thinking capabilities while maintaining the most cost-efficient pricing. Perfect for real-time, low-latency use cases requiring good quality at scale.',
|
|
33107
33127
|
pricing: {
|
|
33108
|
-
prompt: pricing(`$0.
|
|
33109
|
-
output: pricing(`$0.
|
|
33128
|
+
prompt: pricing(`$0.10 / 1M tokens`),
|
|
33129
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
33110
33130
|
},
|
|
33111
33131
|
},
|
|
33112
33132
|
{
|
|
@@ -33585,53 +33605,6 @@ resultContent, rawResponse, duration = ZERO_VALUE) {
|
|
|
33585
33605
|
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
33586
33606
|
*/
|
|
33587
33607
|
|
|
33588
|
-
/**
|
|
33589
|
-
* Maps Promptbook tools to OpenAI tools.
|
|
33590
|
-
*
|
|
33591
|
-
* @private
|
|
33592
|
-
*/
|
|
33593
|
-
function mapToolsToOpenAi(tools) {
|
|
33594
|
-
return tools.map((tool) => ({
|
|
33595
|
-
type: 'function',
|
|
33596
|
-
function: {
|
|
33597
|
-
name: tool.name,
|
|
33598
|
-
description: tool.description,
|
|
33599
|
-
parameters: tool.parameters,
|
|
33600
|
-
},
|
|
33601
|
-
}));
|
|
33602
|
-
}
|
|
33603
|
-
|
|
33604
|
-
/**
|
|
33605
|
-
* Builds a tool invocation script that injects hidden runtime context into tool args.
|
|
33606
|
-
*
|
|
33607
|
-
* @private utility of OpenAI tool execution wrappers
|
|
33608
|
-
*/
|
|
33609
|
-
function buildToolInvocationScript(options) {
|
|
33610
|
-
const { functionName, functionArgsExpression } = options;
|
|
33611
|
-
return `
|
|
33612
|
-
const args = ${functionArgsExpression};
|
|
33613
|
-
const runtimeContextRaw =
|
|
33614
|
-
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
33615
|
-
? undefined
|
|
33616
|
-
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
33617
|
-
|
|
33618
|
-
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
33619
|
-
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
33620
|
-
}
|
|
33621
|
-
|
|
33622
|
-
const toolProgressTokenRaw =
|
|
33623
|
-
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
33624
|
-
? undefined
|
|
33625
|
-
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
33626
|
-
|
|
33627
|
-
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
33628
|
-
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
33629
|
-
}
|
|
33630
|
-
|
|
33631
|
-
return await ${functionName}(args);
|
|
33632
|
-
`;
|
|
33633
|
-
}
|
|
33634
|
-
|
|
33635
33608
|
/**
|
|
33636
33609
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
33637
33610
|
*
|
|
@@ -33688,6 +33661,53 @@ function isUnsupportedParameterError(error) {
|
|
|
33688
33661
|
errorMessage.includes('does not support'));
|
|
33689
33662
|
}
|
|
33690
33663
|
|
|
33664
|
+
/**
|
|
33665
|
+
* Builds a tool invocation script that injects hidden runtime context into tool args.
|
|
33666
|
+
*
|
|
33667
|
+
* @private utility of OpenAI tool execution wrappers
|
|
33668
|
+
*/
|
|
33669
|
+
function buildToolInvocationScript(options) {
|
|
33670
|
+
const { functionName, functionArgsExpression } = options;
|
|
33671
|
+
return `
|
|
33672
|
+
const args = ${functionArgsExpression};
|
|
33673
|
+
const runtimeContextRaw =
|
|
33674
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
33675
|
+
? undefined
|
|
33676
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
33677
|
+
|
|
33678
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
33679
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
33680
|
+
}
|
|
33681
|
+
|
|
33682
|
+
const toolProgressTokenRaw =
|
|
33683
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
33684
|
+
? undefined
|
|
33685
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
33686
|
+
|
|
33687
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
33688
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
33689
|
+
}
|
|
33690
|
+
|
|
33691
|
+
return await ${functionName}(args);
|
|
33692
|
+
`;
|
|
33693
|
+
}
|
|
33694
|
+
|
|
33695
|
+
/**
|
|
33696
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
33697
|
+
*
|
|
33698
|
+
* @private
|
|
33699
|
+
*/
|
|
33700
|
+
function mapToolsToOpenAi(tools) {
|
|
33701
|
+
return tools.map((tool) => ({
|
|
33702
|
+
type: 'function',
|
|
33703
|
+
function: {
|
|
33704
|
+
name: tool.name,
|
|
33705
|
+
description: tool.description,
|
|
33706
|
+
parameters: tool.parameters,
|
|
33707
|
+
},
|
|
33708
|
+
}));
|
|
33709
|
+
}
|
|
33710
|
+
|
|
33691
33711
|
/**
|
|
33692
33712
|
* Provides access to the structured clone implementation when available.
|
|
33693
33713
|
*/
|
|
@@ -34654,7 +34674,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
34654
34674
|
// Note: Match exact or prefix for model families
|
|
34655
34675
|
const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
|
|
34656
34676
|
if (model === undefined) {
|
|
34657
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
34677
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
34658
34678
|
Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
|
|
34659
34679
|
|
|
34660
34680
|
Available models:
|
|
@@ -36411,7 +36431,7 @@ class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
36411
36431
|
assertsError(error);
|
|
36412
36432
|
const serializedError = serializeError(error);
|
|
36413
36433
|
errors = [serializedError];
|
|
36414
|
-
functionResponse = spaceTrim$
|
|
36434
|
+
functionResponse = spaceTrim$1((block) => `
|
|
36415
36435
|
|
|
36416
36436
|
The invoked tool \`${functionName}\` failed with error:
|
|
36417
36437
|
|
|
@@ -37140,7 +37160,7 @@ class BoilerplateScraper {
|
|
|
37140
37160
|
await $execCommand(command);
|
|
37141
37161
|
// Note: [0]
|
|
37142
37162
|
if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
|
|
37143
|
-
throw new UnexpectedError(spaceTrim$
|
|
37163
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
37144
37164
|
File that was supposed to be created by Pandoc does not exist for unknown reason
|
|
37145
37165
|
|
|
37146
37166
|
Expected file:
|
|
@@ -37304,7 +37324,7 @@ class DocumentScraper {
|
|
|
37304
37324
|
await $execCommand(command);
|
|
37305
37325
|
// Note: [0]
|
|
37306
37326
|
if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
|
|
37307
|
-
throw new UnexpectedError(spaceTrim$
|
|
37327
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
37308
37328
|
File that was supposed to be created by Pandoc does not exist for unknown reason
|
|
37309
37329
|
|
|
37310
37330
|
Expected file:
|
|
@@ -37455,7 +37475,7 @@ class LegacyDocumentScraper {
|
|
|
37455
37475
|
await $execCommand(command);
|
|
37456
37476
|
const files = await readdir(documentSourceOutdirPathForLibreOffice);
|
|
37457
37477
|
if (files.length !== 1) {
|
|
37458
|
-
throw new UnexpectedError(spaceTrim$
|
|
37478
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
37459
37479
|
Expected exactly 1 file in the LibreOffice output directory, got ${files.length}
|
|
37460
37480
|
|
|
37461
37481
|
The temporary folder:
|
|
@@ -37469,7 +37489,7 @@ class LegacyDocumentScraper {
|
|
|
37469
37489
|
await rename(join(documentSourceOutdirPathForLibreOffice, file), cacheFilehandler.filename);
|
|
37470
37490
|
await rmdir(documentSourceOutdirPathForLibreOffice);
|
|
37471
37491
|
if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
|
|
37472
|
-
throw new UnexpectedError(spaceTrim$
|
|
37492
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
37473
37493
|
File that was supposed to be created by LibreOffice does not exist for unknown reason
|
|
37474
37494
|
|
|
37475
37495
|
Expected file:
|
|
@@ -38736,7 +38756,7 @@ function computeAgentHash(agentSource) {
|
|
|
38736
38756
|
* @public exported from `@promptbook/core`
|
|
38737
38757
|
*/
|
|
38738
38758
|
function normalizeAgentName(rawAgentName) {
|
|
38739
|
-
return titleToName(spaceTrim$
|
|
38759
|
+
return titleToName(spaceTrim$1(rawAgentName));
|
|
38740
38760
|
}
|
|
38741
38761
|
|
|
38742
38762
|
/**
|
|
@@ -38911,7 +38931,7 @@ function parseAgentSource(agentSource) {
|
|
|
38911
38931
|
continue;
|
|
38912
38932
|
}
|
|
38913
38933
|
if (commitment.type === 'FROM') {
|
|
38914
|
-
const content = spaceTrim$
|
|
38934
|
+
const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
|
|
38915
38935
|
if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
|
|
38916
38936
|
continue;
|
|
38917
38937
|
}
|
|
@@ -38934,7 +38954,7 @@ function parseAgentSource(agentSource) {
|
|
|
38934
38954
|
continue;
|
|
38935
38955
|
}
|
|
38936
38956
|
if (commitment.type === 'IMPORT') {
|
|
38937
|
-
const content = spaceTrim$
|
|
38957
|
+
const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
|
|
38938
38958
|
let label = content;
|
|
38939
38959
|
let iconName = 'ExternalLink'; // Import remote
|
|
38940
38960
|
try {
|
|
@@ -38972,7 +38992,7 @@ function parseAgentSource(agentSource) {
|
|
|
38972
38992
|
continue;
|
|
38973
38993
|
}
|
|
38974
38994
|
if (commitment.type === 'KNOWLEDGE') {
|
|
38975
|
-
const content = spaceTrim$
|
|
38995
|
+
const content = spaceTrim$1(commitment.content);
|
|
38976
38996
|
const extractedUrls = extractUrlsFromText(content);
|
|
38977
38997
|
let label = content;
|
|
38978
38998
|
let iconName = 'Book';
|
|
@@ -39031,7 +39051,7 @@ function parseAgentSource(agentSource) {
|
|
|
39031
39051
|
continue;
|
|
39032
39052
|
}
|
|
39033
39053
|
if (commitment.type === 'META LINK') {
|
|
39034
|
-
const linkValue = spaceTrim$
|
|
39054
|
+
const linkValue = spaceTrim$1(commitment.content);
|
|
39035
39055
|
links.push(linkValue);
|
|
39036
39056
|
meta.link = linkValue;
|
|
39037
39057
|
continue;
|
|
@@ -39041,11 +39061,11 @@ function parseAgentSource(agentSource) {
|
|
|
39041
39061
|
continue;
|
|
39042
39062
|
}
|
|
39043
39063
|
if (commitment.type === 'META IMAGE') {
|
|
39044
|
-
meta.image = spaceTrim$
|
|
39064
|
+
meta.image = spaceTrim$1(commitment.content);
|
|
39045
39065
|
continue;
|
|
39046
39066
|
}
|
|
39047
39067
|
if (commitment.type === 'META DESCRIPTION') {
|
|
39048
|
-
meta.description = spaceTrim$
|
|
39068
|
+
meta.description = spaceTrim$1(commitment.content);
|
|
39049
39069
|
continue;
|
|
39050
39070
|
}
|
|
39051
39071
|
if (commitment.type === 'META DISCLAIMER') {
|
|
@@ -39053,7 +39073,7 @@ function parseAgentSource(agentSource) {
|
|
|
39053
39073
|
continue;
|
|
39054
39074
|
}
|
|
39055
39075
|
if (commitment.type === 'META INPUT PLACEHOLDER') {
|
|
39056
|
-
meta.inputPlaceholder = spaceTrim$
|
|
39076
|
+
meta.inputPlaceholder = spaceTrim$1(commitment.content);
|
|
39057
39077
|
continue;
|
|
39058
39078
|
}
|
|
39059
39079
|
if (commitment.type === 'MESSAGE SUFFIX') {
|
|
@@ -39069,7 +39089,7 @@ function parseAgentSource(agentSource) {
|
|
|
39069
39089
|
continue;
|
|
39070
39090
|
}
|
|
39071
39091
|
if (commitment.type === 'META VOICE') {
|
|
39072
|
-
meta.voice = spaceTrim$
|
|
39092
|
+
meta.voice = spaceTrim$1(commitment.content);
|
|
39073
39093
|
continue;
|
|
39074
39094
|
}
|
|
39075
39095
|
if (commitment.type !== 'META') {
|
|
@@ -39078,10 +39098,10 @@ function parseAgentSource(agentSource) {
|
|
|
39078
39098
|
// Parse META commitments - format is "META TYPE content"
|
|
39079
39099
|
const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
|
|
39080
39100
|
if (metaTypeRaw === 'LINK') {
|
|
39081
|
-
links.push(spaceTrim$
|
|
39101
|
+
links.push(spaceTrim$1(commitment.content.substring(metaTypeRaw.length)));
|
|
39082
39102
|
}
|
|
39083
39103
|
const metaType = normalizeTo_camelCase(metaTypeRaw);
|
|
39084
|
-
meta[metaType] = spaceTrim$
|
|
39104
|
+
meta[metaType] = spaceTrim$1(commitment.content.substring(metaTypeRaw.length));
|
|
39085
39105
|
}
|
|
39086
39106
|
// Generate fullname fallback if no meta fullname specified
|
|
39087
39107
|
if (!meta.fullname) {
|
|
@@ -39112,7 +39132,7 @@ function parseAgentSource(agentSource) {
|
|
|
39112
39132
|
* @returns The content with normalized separators
|
|
39113
39133
|
*/
|
|
39114
39134
|
function normalizeSeparator(content) {
|
|
39115
|
-
const trimmed = spaceTrim$
|
|
39135
|
+
const trimmed = spaceTrim$1(content);
|
|
39116
39136
|
if (trimmed.includes(',')) {
|
|
39117
39137
|
return trimmed;
|
|
39118
39138
|
}
|
|
@@ -39125,7 +39145,7 @@ function normalizeSeparator(content) {
|
|
|
39125
39145
|
* @returns Normalized domain or a trimmed fallback.
|
|
39126
39146
|
*/
|
|
39127
39147
|
function normalizeMetaDomain(content) {
|
|
39128
|
-
const trimmed = spaceTrim$
|
|
39148
|
+
const trimmed = spaceTrim$1(content);
|
|
39129
39149
|
return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
|
|
39130
39150
|
}
|
|
39131
39151
|
/**
|
|
@@ -39263,7 +39283,7 @@ const OpenAiSdkTranspiler = {
|
|
|
39263
39283
|
}
|
|
39264
39284
|
const KNOWLEDGE_THRESHOLD = 1000;
|
|
39265
39285
|
if (directKnowledge.join('\n').length > KNOWLEDGE_THRESHOLD || knowledgeSources.length > 0) {
|
|
39266
|
-
return spaceTrim$
|
|
39286
|
+
return spaceTrim$1((block) => `
|
|
39267
39287
|
#!/usr/bin/env node
|
|
39268
39288
|
|
|
39269
39289
|
import * as dotenv from 'dotenv';
|
|
@@ -39338,7 +39358,7 @@ const OpenAiSdkTranspiler = {
|
|
|
39338
39358
|
|
|
39339
39359
|
if (context) {
|
|
39340
39360
|
question = spaceTrim(\`
|
|
39341
|
-
${block(spaceTrim$
|
|
39361
|
+
${block(spaceTrim$1(`
|
|
39342
39362
|
Here is some additional context to help you answer the question:
|
|
39343
39363
|
\${context}
|
|
39344
39364
|
|
|
@@ -39419,7 +39439,7 @@ const OpenAiSdkTranspiler = {
|
|
|
39419
39439
|
})();
|
|
39420
39440
|
`);
|
|
39421
39441
|
}
|
|
39422
|
-
const source = spaceTrim$
|
|
39442
|
+
const source = spaceTrim$1((block) => `
|
|
39423
39443
|
|
|
39424
39444
|
#!/usr/bin/env node
|
|
39425
39445
|
|
|
@@ -39609,7 +39629,7 @@ const EMOJIS_OF_SINGLE_PICTOGRAM = new Set(Array.from(EMOJIS).filter((emoji) =>
|
|
|
39609
39629
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
39610
39630
|
*/
|
|
39611
39631
|
|
|
39612
|
-
// find-fresh-emoji-
|
|
39632
|
+
// find-fresh-emoji-tags.ts
|
|
39613
39633
|
// Note: When run as a standalone script, call the exported function
|
|
39614
39634
|
if (require.main === module) {
|
|
39615
39635
|
findFreshEmojiTag()
|
|
@@ -39630,7 +39650,13 @@ if (require.main === module) {
|
|
|
39630
39650
|
function initializeFindFreshEmojiTagRun() {
|
|
39631
39651
|
dotenv.config({ path: '.env' });
|
|
39632
39652
|
if (process.cwd() !== join(__dirname, '../..')) {
|
|
39633
|
-
console.error(colors.red(`
|
|
39653
|
+
console.error(colors.red(spaceTrim$1(`
|
|
39654
|
+
CWD must be root of the project
|
|
39655
|
+
|
|
39656
|
+
Script: find-fresh-emoji-tag.ts
|
|
39657
|
+
Current CWD: ${process.cwd()}
|
|
39658
|
+
Expected CWD: ${join(__dirname, '../..')}
|
|
39659
|
+
`)));
|
|
39634
39660
|
process.exit(1);
|
|
39635
39661
|
}
|
|
39636
39662
|
}
|
|
@@ -39680,7 +39706,7 @@ async function findFreshEmojiTag() {
|
|
|
39680
39706
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
39681
39707
|
*/
|
|
39682
39708
|
|
|
39683
|
-
var
|
|
39709
|
+
var findFreshEmojiTags = /*#__PURE__*/Object.freeze({
|
|
39684
39710
|
__proto__: null,
|
|
39685
39711
|
findFreshEmojiTag: findFreshEmojiTag
|
|
39686
39712
|
});
|
|
@@ -39929,7 +39955,13 @@ if (require.main === module) {
|
|
|
39929
39955
|
function initializeFindRefactorCandidatesRun() {
|
|
39930
39956
|
dotenv.config({ path: '.env' });
|
|
39931
39957
|
if (process.cwd() !== join(__dirname, '../..')) {
|
|
39932
|
-
console.error(colors.red(`
|
|
39958
|
+
console.error(colors.red(spaceTrim$1(`
|
|
39959
|
+
CWD must be root of the project
|
|
39960
|
+
|
|
39961
|
+
Script: find-refactor-candidates.ts
|
|
39962
|
+
Current CWD: ${process.cwd()}
|
|
39963
|
+
Expected CWD: ${join(__dirname, '../..')}
|
|
39964
|
+
`)));
|
|
39933
39965
|
process.exit(1);
|
|
39934
39966
|
}
|
|
39935
39967
|
}
|
|
@@ -40029,7 +40061,7 @@ async function findRefactorCandidates() {
|
|
|
40029
40061
|
function buildPromptContent(candidate, emojiTag) {
|
|
40030
40062
|
const fileName = basename(candidate.relativePath);
|
|
40031
40063
|
const guidanceLines = buildPromptGuidance(candidate);
|
|
40032
|
-
return spaceTrim$
|
|
40064
|
+
return spaceTrim$1((block) => `
|
|
40033
40065
|
|
|
40034
40066
|
[ ]
|
|
40035
40067
|
|
|
@@ -40919,7 +40951,7 @@ async function pushCommittedChanges(agentEnv) {
|
|
|
40919
40951
|
}
|
|
40920
40952
|
const currentBranch = await readCurrentBranchName(agentEnv);
|
|
40921
40953
|
if (currentBranch === 'HEAD') {
|
|
40922
|
-
throw new GitPushFailedError(spaceTrim$
|
|
40954
|
+
throw new GitPushFailedError(spaceTrim$1(`
|
|
40923
40955
|
Failed to push coding-agent commit because Git is in detached HEAD mode.
|
|
40924
40956
|
|
|
40925
40957
|
Actionable hint:
|
|
@@ -40999,7 +41031,7 @@ async function resolveDefaultRemoteName(currentBranch, agentEnv) {
|
|
|
40999
41031
|
return remotes[0];
|
|
41000
41032
|
}
|
|
41001
41033
|
if (remotes.length > 1) {
|
|
41002
|
-
throw new GitPushFailedError(spaceTrim$
|
|
41034
|
+
throw new GitPushFailedError(spaceTrim$1(`
|
|
41003
41035
|
Failed to push coding-agent commit because no default remote is configured.
|
|
41004
41036
|
|
|
41005
41037
|
Available remotes: ${remotes.join(', ')}
|
|
@@ -41008,7 +41040,7 @@ async function resolveDefaultRemoteName(currentBranch, agentEnv) {
|
|
|
41008
41040
|
- Configure \`remote.pushDefault\` or \`branch.${currentBranch}.remote\`, then rerun the coding script.
|
|
41009
41041
|
`));
|
|
41010
41042
|
}
|
|
41011
|
-
throw new GitPushFailedError(spaceTrim$
|
|
41043
|
+
throw new GitPushFailedError(spaceTrim$1(`
|
|
41012
41044
|
Failed to push coding-agent commit because no Git remote is configured.
|
|
41013
41045
|
|
|
41014
41046
|
Actionable hint:
|
|
@@ -41053,7 +41085,7 @@ function buildPushFailureMessage(command, error) {
|
|
|
41053
41085
|
const details = stringifyUnknownError(error).trim() || '(No Git output)';
|
|
41054
41086
|
const hints = buildPushFailureHints(details);
|
|
41055
41087
|
const hintsMarkdown = hints.map((hint) => `- ${hint}`).join('\n');
|
|
41056
|
-
return spaceTrim$
|
|
41088
|
+
return spaceTrim$1(`
|
|
41057
41089
|
Failed to push coding-agent commit to the remote repository.
|
|
41058
41090
|
|
|
41059
41091
|
Command:
|
|
@@ -41151,7 +41183,7 @@ async function isWorkingTreeClean(path) {
|
|
|
41151
41183
|
async function ensureWorkingTreeClean() {
|
|
41152
41184
|
const isClean = await isWorkingTreeClean(process.cwd());
|
|
41153
41185
|
if (!isClean) {
|
|
41154
|
-
throw new Error(spaceTrim$
|
|
41186
|
+
throw new Error(spaceTrim$1(`
|
|
41155
41187
|
Git working tree is not clean.
|
|
41156
41188
|
|
|
41157
41189
|
Please commit or stash your changes before running this script
|
|
@@ -41269,7 +41301,7 @@ const SERVER_REGISTRY_TABLE_NAME = '_Server';
|
|
|
41269
41301
|
function parseServerRecord(rawRow, label = 'row') {
|
|
41270
41302
|
const rawEnvironment = typeof rawRow.environment === 'string' ? rawRow.environment.trim().toUpperCase() : '';
|
|
41271
41303
|
if (!isServerEnvironment(rawEnvironment)) {
|
|
41272
|
-
throw new DatabaseError(spaceTrim$
|
|
41304
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
41273
41305
|
Invalid \`${SERVER_REGISTRY_TABLE_NAME}\` ${label}.
|
|
41274
41306
|
|
|
41275
41307
|
Field \`environment\` must be one of \`${SERVER_ENVIRONMENT.PRODUCTION}\`, \`${SERVER_ENVIRONMENT.PREVIEW}\`, \`${SERVER_ENVIRONMENT.LTS}\` or \`${SERVER_ENVIRONMENT.LIVE}\`.
|
|
@@ -41278,7 +41310,7 @@ function parseServerRecord(rawRow, label = 'row') {
|
|
|
41278
41310
|
const domain = typeof rawRow.domain === 'string' ? rawRow.domain.trim().toLowerCase() : '';
|
|
41279
41311
|
const normalizedDomain = normalizeServerDomain(domain);
|
|
41280
41312
|
if (!normalizedDomain) {
|
|
41281
|
-
throw new DatabaseError(spaceTrim$
|
|
41313
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
41282
41314
|
Invalid \`${SERVER_REGISTRY_TABLE_NAME}\` ${label}.
|
|
41283
41315
|
|
|
41284
41316
|
Field \`domain\` must contain a valid host or URL-like domain string.
|
|
@@ -41292,7 +41324,7 @@ function parseServerRecord(rawRow, label = 'row') {
|
|
|
41292
41324
|
const updatedAt = typeof rawRow.updatedAt === 'string' ? rawRow.updatedAt : '';
|
|
41293
41325
|
const id = typeof rawRow.id === 'number' ? rawRow.id : Number(rawRow.id);
|
|
41294
41326
|
if (!name || !hasTablePrefix /*|| !createdAt || !updatedAt ||*/ || !Number.isFinite(id)) {
|
|
41295
|
-
throw new DatabaseError(spaceTrim$
|
|
41327
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
41296
41328
|
Invalid \`${SERVER_REGISTRY_TABLE_NAME}\` ${label}.
|
|
41297
41329
|
|
|
41298
41330
|
Fields \`id\`, \`name\`, \`tablePrefix\`, \`createdAt\`, and \`updatedAt\` are required.
|
|
@@ -41412,7 +41444,7 @@ async function listRegisteredServersFromDatabase(client) {
|
|
|
41412
41444
|
if (isMissingServerRegistryError(error)) {
|
|
41413
41445
|
return [];
|
|
41414
41446
|
}
|
|
41415
|
-
throw new DatabaseError(spaceTrim$
|
|
41447
|
+
throw new DatabaseError(spaceTrim$1((block) => `
|
|
41416
41448
|
Failed to query global server registry table \`_Server\`.
|
|
41417
41449
|
|
|
41418
41450
|
${block(error instanceof Error ? error.message : String(error))}
|
|
@@ -41597,7 +41629,7 @@ function selectPrefixesForMigration(configuredPrefixes, registeredServers, onlyT
|
|
|
41597
41629
|
invalidTargets.push(onlyTarget);
|
|
41598
41630
|
}
|
|
41599
41631
|
if (invalidTargets.length > 0) {
|
|
41600
|
-
throw new DatabaseError(spaceTrim$
|
|
41632
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
41601
41633
|
Invalid migration targets specified in \`--only\`: ${invalidTargets
|
|
41602
41634
|
.map((target) => `\`${target}\``)
|
|
41603
41635
|
.join(', ')}.
|
|
@@ -41705,7 +41737,7 @@ const DATABASE_CONNECTION_ENV_NAMES = ['POSTGRES_URL', 'DATABASE_URL'];
|
|
|
41705
41737
|
async function resolveDatabaseMigrationRuntimeConfiguration(logger = console) {
|
|
41706
41738
|
const connectionString = resolveDatabaseMigrationConnectionStringFromEnvironment();
|
|
41707
41739
|
if (!connectionString) {
|
|
41708
|
-
throw new DatabaseError(spaceTrim$
|
|
41740
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
41709
41741
|
${DATABASE_CONNECTION_ENV_NAMES.join(' or ')} is not defined.
|
|
41710
41742
|
`));
|
|
41711
41743
|
}
|
|
@@ -42067,7 +42099,7 @@ function createDestructiveAutoMigrationBlockedError(findings) {
|
|
|
42067
42099
|
.map((match) => `${getReadableRuleName(match.rule)}: ${createSqlStatementPreview(match.statement)}`)
|
|
42068
42100
|
.join(' | ')})`)
|
|
42069
42101
|
.join('\n');
|
|
42070
|
-
return new DatabaseError(spaceTrim$
|
|
42102
|
+
return new DatabaseError(spaceTrim$1((block) => `
|
|
42071
42103
|
Auto-migration blocked because pending testing-server migrations contain potentially destructive SQL.
|
|
42072
42104
|
|
|
42073
42105
|
Review these migration statements:
|
|
@@ -43831,7 +43863,7 @@ function getRunnerMetadata(options, actualModel) {
|
|
|
43831
43863
|
async function runCodexPrompts(providedOptions) {
|
|
43832
43864
|
const options = providedOptions !== null && providedOptions !== void 0 ? providedOptions : parseRunOptions(process.argv.slice(2));
|
|
43833
43865
|
if (options.allowDestructiveAutoMigrate && !options.autoMigrate) {
|
|
43834
|
-
throw new DatabaseError(spaceTrim$
|
|
43866
|
+
throw new DatabaseError(spaceTrim$1(`
|
|
43835
43867
|
Flag \`--allow-destructive-auto-migrate\` requires \`--auto-migrate\`.
|
|
43836
43868
|
`));
|
|
43837
43869
|
}
|
|
@@ -44485,7 +44517,7 @@ function validateBook(source) {
|
|
|
44485
44517
|
* @deprecated Use `$generateBookBoilerplate` instead
|
|
44486
44518
|
* @public exported from `@promptbook/core`
|
|
44487
44519
|
*/
|
|
44488
|
-
padBook(validateBook(spaceTrim$
|
|
44520
|
+
padBook(validateBook(spaceTrim$1(`
|
|
44489
44521
|
AI Avatar
|
|
44490
44522
|
|
|
44491
44523
|
PERSONA A friendly AI assistant that helps you with your tasks
|
|
@@ -44512,7 +44544,7 @@ function book(strings, ...values) {
|
|
|
44512
44544
|
const bookString = prompt(strings, ...values).toString();
|
|
44513
44545
|
if (!isValidPipelineString(bookString)) {
|
|
44514
44546
|
// TODO: Make the CustomError for this
|
|
44515
|
-
throw new Error(spaceTrim$
|
|
44547
|
+
throw new Error(spaceTrim$1(`
|
|
44516
44548
|
The string is not a valid pipeline string
|
|
44517
44549
|
|
|
44518
44550
|
book\`
|
|
@@ -44522,7 +44554,7 @@ function book(strings, ...values) {
|
|
|
44522
44554
|
}
|
|
44523
44555
|
if (!isValidBook(bookString)) {
|
|
44524
44556
|
// TODO: Make the CustomError for this
|
|
44525
|
-
throw new Error(spaceTrim$
|
|
44557
|
+
throw new Error(spaceTrim$1(`
|
|
44526
44558
|
The string is not a valid book
|
|
44527
44559
|
|
|
44528
44560
|
book\`
|
|
@@ -45448,7 +45480,7 @@ function promptbookifyAiText(text) {
|
|
|
45448
45480
|
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
45449
45481
|
*/
|
|
45450
45482
|
|
|
45451
|
-
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-
|
|
45483
|
+
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
|
|
45452
45484
|
/**
|
|
45453
45485
|
* Creates one structured log entry for streamed tool-call updates.
|
|
45454
45486
|
*
|
|
@@ -45943,7 +45975,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
45943
45975
|
}),
|
|
45944
45976
|
],
|
|
45945
45977
|
};
|
|
45946
|
-
const errorMessage = spaceTrim$
|
|
45978
|
+
const errorMessage = spaceTrim$1((block) => `
|
|
45947
45979
|
|
|
45948
45980
|
The invoked tool \`${functionName}\` failed with error:
|
|
45949
45981
|
|
|
@@ -46893,7 +46925,7 @@ class SelfLearningManager {
|
|
|
46893
46925
|
if (isJsonSchemaResponseFormat(responseFormat)) {
|
|
46894
46926
|
const jsonSchema = responseFormat.json_schema;
|
|
46895
46927
|
const schemaJson = JSON.stringify(jsonSchema, null, 4);
|
|
46896
|
-
userMessageContent = spaceTrim$
|
|
46928
|
+
userMessageContent = spaceTrim$1((block) => `
|
|
46897
46929
|
${block(prompt.content)}
|
|
46898
46930
|
|
|
46899
46931
|
NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
|
|
@@ -46924,12 +46956,12 @@ class SelfLearningManager {
|
|
|
46924
46956
|
const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
|
|
46925
46957
|
const teacherInstructions = extractOpenTeacherInstructions(agentSource);
|
|
46926
46958
|
const teacherInstructionsSection = teacherInstructions
|
|
46927
|
-
? spaceTrim$
|
|
46959
|
+
? spaceTrim$1((block) => `
|
|
46928
46960
|
**Teacher instructions:**
|
|
46929
46961
|
${block(teacherInstructions)}
|
|
46930
46962
|
`)
|
|
46931
46963
|
: '';
|
|
46932
|
-
const teacherPromptContent = spaceTrim$
|
|
46964
|
+
const teacherPromptContent = spaceTrim$1((block) => `
|
|
46933
46965
|
|
|
46934
46966
|
You are a teacher agent helping another agent to learn from its interactions.
|
|
46935
46967
|
|
|
@@ -46962,7 +46994,7 @@ class SelfLearningManager {
|
|
|
46962
46994
|
? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
|
|
46963
46995
|
: ''}
|
|
46964
46996
|
${block(isInitialMessageMissing
|
|
46965
|
-
? spaceTrim$
|
|
46997
|
+
? spaceTrim$1(`
|
|
46966
46998
|
- The agent source does not have an INITIAL MESSAGE defined, generate one.
|
|
46967
46999
|
- The INITIAL MESSAGE should be welcoming, informative about the agent capabilities and also should give some quick options to start the conversation with the agent.
|
|
46968
47000
|
- The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
|
|
@@ -47005,7 +47037,7 @@ class SelfLearningManager {
|
|
|
47005
47037
|
*/
|
|
47006
47038
|
appendToAgentSource(section) {
|
|
47007
47039
|
const currentSource = this.options.getAgentSource();
|
|
47008
|
-
const newSource = padBook(validateBook(spaceTrim$
|
|
47040
|
+
const newSource = padBook(validateBook(spaceTrim$1(currentSource) + section));
|
|
47009
47041
|
this.options.updateAgentSource(newSource);
|
|
47010
47042
|
}
|
|
47011
47043
|
}
|
|
@@ -47033,13 +47065,13 @@ function formatAgentMessageForJsonMode(content, isJsonMode) {
|
|
|
47033
47065
|
}
|
|
47034
47066
|
const parsedJson = tryParseJson(content);
|
|
47035
47067
|
if (parsedJson === null) {
|
|
47036
|
-
return spaceTrim$
|
|
47068
|
+
return spaceTrim$1((block) => `
|
|
47037
47069
|
\`\`\`json
|
|
47038
47070
|
${block(content)}
|
|
47039
47071
|
\`\`\`
|
|
47040
47072
|
`);
|
|
47041
47073
|
}
|
|
47042
|
-
return spaceTrim$
|
|
47074
|
+
return spaceTrim$1((block) => `
|
|
47043
47075
|
\`\`\`json
|
|
47044
47076
|
${block(JSON.stringify(parsedJson, null, 4))}
|
|
47045
47077
|
\`\`\`
|
|
@@ -47071,7 +47103,7 @@ function formatSelfLearningSample(options) {
|
|
|
47071
47103
|
const internalMessagesSection = options.internalMessages
|
|
47072
47104
|
.map((internalMessage) => formatInternalLearningMessage(internalMessage))
|
|
47073
47105
|
.join('\n\n');
|
|
47074
|
-
return spaceTrim$
|
|
47106
|
+
return spaceTrim$1((block) => `
|
|
47075
47107
|
|
|
47076
47108
|
USER MESSAGE
|
|
47077
47109
|
${block(options.userMessageContent)}
|
|
@@ -47089,7 +47121,7 @@ function formatSelfLearningSample(options) {
|
|
|
47089
47121
|
* @private function of Agent
|
|
47090
47122
|
*/
|
|
47091
47123
|
function formatInternalLearningMessage(internalMessage) {
|
|
47092
|
-
return spaceTrim$
|
|
47124
|
+
return spaceTrim$1((block) => `
|
|
47093
47125
|
INTERNAL MESSAGE
|
|
47094
47126
|
${block(stringifyInternalLearningPayload(internalMessage))}
|
|
47095
47127
|
`);
|
|
@@ -47555,7 +47587,7 @@ function buildRemoteAgentSource(profile, meta) {
|
|
|
47555
47587
|
.filter((line) => Boolean(line))
|
|
47556
47588
|
.join('\n');
|
|
47557
47589
|
const personaBlock = profile.personaDescription
|
|
47558
|
-
? spaceTrim$
|
|
47590
|
+
? spaceTrim$1((block) => `
|
|
47559
47591
|
PERSONA
|
|
47560
47592
|
${block(profile.personaDescription || '')}
|
|
47561
47593
|
`)
|
|
@@ -47591,7 +47623,7 @@ class RemoteAgent extends Agent {
|
|
|
47591
47623
|
// <- TODO: [🐱🚀] What about closed-source agents?
|
|
47592
47624
|
// <- TODO: [🐱🚀] Maybe use promptbookFetch
|
|
47593
47625
|
if (!profileResponse.ok) {
|
|
47594
|
-
throw new Error(spaceTrim$
|
|
47626
|
+
throw new Error(spaceTrim$1((block) => `
|
|
47595
47627
|
Failed to fetch remote agent profile:
|
|
47596
47628
|
|
|
47597
47629
|
Agent URL:
|