@promptbook/browser 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 +135 -135
- package/esm/index.es.js.map +1 -1
- package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/esm/src/cli/cli-commands/coder.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +304 -305
- package/umd/index.umd.js.map +1 -1
- package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/umd/src/cli/cli-commands/coder.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/umd/src/llm-providers/google/google-models.d.ts +1 -1
- package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import { Registration } from 'destroyable';
|
|
3
3
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
4
4
|
import { randomBytes } from 'crypto';
|
|
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1180,7 +1180,7 @@ true);
|
|
|
1180
1180
|
function getErrorReportUrl(error) {
|
|
1181
1181
|
const report = {
|
|
1182
1182
|
title: `🐜 Error report from ${NAME}`,
|
|
1183
|
-
body: spaceTrim$
|
|
1183
|
+
body: spaceTrim$1((block) => `
|
|
1184
1184
|
|
|
1185
1185
|
|
|
1186
1186
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -2093,7 +2093,7 @@ function checkSerializableAsJson(options) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
else if (typeof value === 'object') {
|
|
2095
2095
|
if (value instanceof Date) {
|
|
2096
|
-
throw new UnexpectedError(spaceTrim$
|
|
2096
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2097
2097
|
\`${name}\` is Date
|
|
2098
2098
|
|
|
2099
2099
|
Use \`string_date_iso8601\` instead
|
|
@@ -2112,7 +2112,7 @@ function checkSerializableAsJson(options) {
|
|
|
2112
2112
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
2113
2113
|
}
|
|
2114
2114
|
else if (value instanceof Error) {
|
|
2115
|
-
throw new UnexpectedError(spaceTrim$
|
|
2115
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2116
2116
|
\`${name}\` is unserialized Error
|
|
2117
2117
|
|
|
2118
2118
|
Use function \`serializeError\`
|
|
@@ -2135,7 +2135,7 @@ function checkSerializableAsJson(options) {
|
|
|
2135
2135
|
}
|
|
2136
2136
|
catch (error) {
|
|
2137
2137
|
assertsError(error);
|
|
2138
|
-
throw new UnexpectedError(spaceTrim$
|
|
2138
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2139
2139
|
\`${name}\` is not serializable
|
|
2140
2140
|
|
|
2141
2141
|
${block(error.stack || error.message)}
|
|
@@ -2167,7 +2167,7 @@ function checkSerializableAsJson(options) {
|
|
|
2167
2167
|
}
|
|
2168
2168
|
}
|
|
2169
2169
|
else {
|
|
2170
|
-
throw new UnexpectedError(spaceTrim$
|
|
2170
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
2171
2171
|
\`${name}\` is unknown type
|
|
2172
2172
|
|
|
2173
2173
|
Additional message for \`${name}\`:
|
|
@@ -3234,7 +3234,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
|
|
|
3234
3234
|
message = `${name}: ${message}`;
|
|
3235
3235
|
}
|
|
3236
3236
|
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
3237
|
-
message = spaceTrim$
|
|
3237
|
+
message = spaceTrim$1((block) => `
|
|
3238
3238
|
${block(message)}
|
|
3239
3239
|
|
|
3240
3240
|
Original stack trace:
|
|
@@ -3255,7 +3255,7 @@ function serializeError(error) {
|
|
|
3255
3255
|
const { name, message, stack } = error;
|
|
3256
3256
|
const { id } = error;
|
|
3257
3257
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
3258
|
-
console.error(spaceTrim$
|
|
3258
|
+
console.error(spaceTrim$1((block) => `
|
|
3259
3259
|
|
|
3260
3260
|
Cannot serialize error with name "${name}"
|
|
3261
3261
|
|
|
@@ -3361,7 +3361,7 @@ function jsonParse(value) {
|
|
|
3361
3361
|
}
|
|
3362
3362
|
else if (typeof value !== 'string') {
|
|
3363
3363
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
3364
|
-
throw new Error(spaceTrim$
|
|
3364
|
+
throw new Error(spaceTrim$1(`
|
|
3365
3365
|
Can not parse JSON from non-string value.
|
|
3366
3366
|
|
|
3367
3367
|
The value type: ${typeof value}
|
|
@@ -3375,7 +3375,7 @@ function jsonParse(value) {
|
|
|
3375
3375
|
if (!(error instanceof Error)) {
|
|
3376
3376
|
throw error;
|
|
3377
3377
|
}
|
|
3378
|
-
throw new Error(spaceTrim$
|
|
3378
|
+
throw new Error(spaceTrim$1((block) => `
|
|
3379
3379
|
${block(error.message)}
|
|
3380
3380
|
|
|
3381
3381
|
The expected JSON text:
|
|
@@ -3816,7 +3816,7 @@ function buildParametersSection(items) {
|
|
|
3816
3816
|
const entries = items
|
|
3817
3817
|
.flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
|
|
3818
3818
|
.filter((line) => line !== '');
|
|
3819
|
-
return spaceTrim$
|
|
3819
|
+
return spaceTrim$1((block) => `
|
|
3820
3820
|
**Parameters:**
|
|
3821
3821
|
${block(entries.join('\n'))}
|
|
3822
3822
|
|
|
@@ -3889,7 +3889,7 @@ function isPromptString(value) {
|
|
|
3889
3889
|
*/
|
|
3890
3890
|
function prompt(strings, ...values) {
|
|
3891
3891
|
if (values.length === 0) {
|
|
3892
|
-
return new PromptString(spaceTrim$
|
|
3892
|
+
return new PromptString(spaceTrim$1(strings.join('')));
|
|
3893
3893
|
}
|
|
3894
3894
|
const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
|
|
3895
3895
|
const parameterMetadata = values.map((value) => {
|
|
@@ -3930,7 +3930,7 @@ function prompt(strings, ...values) {
|
|
|
3930
3930
|
? `${result}${stringsItem}`
|
|
3931
3931
|
: `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
|
|
3932
3932
|
}, '');
|
|
3933
|
-
pipelineString = spaceTrim$
|
|
3933
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
3934
3934
|
try {
|
|
3935
3935
|
pipelineString = templateParameters(pipelineString, parameters);
|
|
3936
3936
|
}
|
|
@@ -3939,7 +3939,7 @@ function prompt(strings, ...values) {
|
|
|
3939
3939
|
throw error;
|
|
3940
3940
|
}
|
|
3941
3941
|
console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
|
|
3942
|
-
throw new UnexpectedError(spaceTrim$
|
|
3942
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
3943
3943
|
Internal error in prompt template literal
|
|
3944
3944
|
|
|
3945
3945
|
${block(JSON.stringify({ strings, values }, null, 4))}}
|
|
@@ -4203,7 +4203,7 @@ const CountUtils = {
|
|
|
4203
4203
|
* @public exported from `@promptbook/utils`
|
|
4204
4204
|
*/
|
|
4205
4205
|
function computeHash(value) {
|
|
4206
|
-
return SHA256(hexEncoder.parse(spaceTrim$
|
|
4206
|
+
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
4207
4207
|
}
|
|
4208
4208
|
/**
|
|
4209
4209
|
* TODO: [🥬][🥬] Use this ACRY
|
|
@@ -16594,7 +16594,7 @@ function getIndexedDbStorage(options) {
|
|
|
16594
16594
|
*/
|
|
16595
16595
|
function stringifyPipelineJson(pipeline) {
|
|
16596
16596
|
if (!isSerializableAsJson(pipeline)) {
|
|
16597
|
-
throw new UnexpectedError(spaceTrim$
|
|
16597
|
+
throw new UnexpectedError(spaceTrim$1(`
|
|
16598
16598
|
Cannot stringify the pipeline, because it is not serializable as JSON
|
|
16599
16599
|
|
|
16600
16600
|
There can be multiple reasons:
|
|
@@ -16754,7 +16754,7 @@ function computeAgentHash(agentSource) {
|
|
|
16754
16754
|
* @public exported from `@promptbook/core`
|
|
16755
16755
|
*/
|
|
16756
16756
|
function normalizeAgentName(rawAgentName) {
|
|
16757
|
-
return titleToName(spaceTrim$
|
|
16757
|
+
return titleToName(spaceTrim$1(rawAgentName));
|
|
16758
16758
|
}
|
|
16759
16759
|
|
|
16760
16760
|
/**
|
|
@@ -17162,7 +17162,7 @@ function parseAgentSource(agentSource) {
|
|
|
17162
17162
|
continue;
|
|
17163
17163
|
}
|
|
17164
17164
|
if (commitment.type === 'FROM') {
|
|
17165
|
-
const content = spaceTrim$
|
|
17165
|
+
const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
|
|
17166
17166
|
if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
|
|
17167
17167
|
continue;
|
|
17168
17168
|
}
|
|
@@ -17185,7 +17185,7 @@ function parseAgentSource(agentSource) {
|
|
|
17185
17185
|
continue;
|
|
17186
17186
|
}
|
|
17187
17187
|
if (commitment.type === 'IMPORT') {
|
|
17188
|
-
const content = spaceTrim$
|
|
17188
|
+
const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
|
|
17189
17189
|
let label = content;
|
|
17190
17190
|
let iconName = 'ExternalLink'; // Import remote
|
|
17191
17191
|
try {
|
|
@@ -17223,7 +17223,7 @@ function parseAgentSource(agentSource) {
|
|
|
17223
17223
|
continue;
|
|
17224
17224
|
}
|
|
17225
17225
|
if (commitment.type === 'KNOWLEDGE') {
|
|
17226
|
-
const content = spaceTrim$
|
|
17226
|
+
const content = spaceTrim$1(commitment.content);
|
|
17227
17227
|
const extractedUrls = extractUrlsFromText(content);
|
|
17228
17228
|
let label = content;
|
|
17229
17229
|
let iconName = 'Book';
|
|
@@ -17282,7 +17282,7 @@ function parseAgentSource(agentSource) {
|
|
|
17282
17282
|
continue;
|
|
17283
17283
|
}
|
|
17284
17284
|
if (commitment.type === 'META LINK') {
|
|
17285
|
-
const linkValue = spaceTrim$
|
|
17285
|
+
const linkValue = spaceTrim$1(commitment.content);
|
|
17286
17286
|
links.push(linkValue);
|
|
17287
17287
|
meta.link = linkValue;
|
|
17288
17288
|
continue;
|
|
@@ -17292,11 +17292,11 @@ function parseAgentSource(agentSource) {
|
|
|
17292
17292
|
continue;
|
|
17293
17293
|
}
|
|
17294
17294
|
if (commitment.type === 'META IMAGE') {
|
|
17295
|
-
meta.image = spaceTrim$
|
|
17295
|
+
meta.image = spaceTrim$1(commitment.content);
|
|
17296
17296
|
continue;
|
|
17297
17297
|
}
|
|
17298
17298
|
if (commitment.type === 'META DESCRIPTION') {
|
|
17299
|
-
meta.description = spaceTrim$
|
|
17299
|
+
meta.description = spaceTrim$1(commitment.content);
|
|
17300
17300
|
continue;
|
|
17301
17301
|
}
|
|
17302
17302
|
if (commitment.type === 'META DISCLAIMER') {
|
|
@@ -17304,7 +17304,7 @@ function parseAgentSource(agentSource) {
|
|
|
17304
17304
|
continue;
|
|
17305
17305
|
}
|
|
17306
17306
|
if (commitment.type === 'META INPUT PLACEHOLDER') {
|
|
17307
|
-
meta.inputPlaceholder = spaceTrim$
|
|
17307
|
+
meta.inputPlaceholder = spaceTrim$1(commitment.content);
|
|
17308
17308
|
continue;
|
|
17309
17309
|
}
|
|
17310
17310
|
if (commitment.type === 'MESSAGE SUFFIX') {
|
|
@@ -17320,7 +17320,7 @@ function parseAgentSource(agentSource) {
|
|
|
17320
17320
|
continue;
|
|
17321
17321
|
}
|
|
17322
17322
|
if (commitment.type === 'META VOICE') {
|
|
17323
|
-
meta.voice = spaceTrim$
|
|
17323
|
+
meta.voice = spaceTrim$1(commitment.content);
|
|
17324
17324
|
continue;
|
|
17325
17325
|
}
|
|
17326
17326
|
if (commitment.type !== 'META') {
|
|
@@ -17329,10 +17329,10 @@ function parseAgentSource(agentSource) {
|
|
|
17329
17329
|
// Parse META commitments - format is "META TYPE content"
|
|
17330
17330
|
const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
|
|
17331
17331
|
if (metaTypeRaw === 'LINK') {
|
|
17332
|
-
links.push(spaceTrim$
|
|
17332
|
+
links.push(spaceTrim$1(commitment.content.substring(metaTypeRaw.length)));
|
|
17333
17333
|
}
|
|
17334
17334
|
const metaType = normalizeTo_camelCase(metaTypeRaw);
|
|
17335
|
-
meta[metaType] = spaceTrim$
|
|
17335
|
+
meta[metaType] = spaceTrim$1(commitment.content.substring(metaTypeRaw.length));
|
|
17336
17336
|
}
|
|
17337
17337
|
// Generate fullname fallback if no meta fullname specified
|
|
17338
17338
|
if (!meta.fullname) {
|
|
@@ -17363,7 +17363,7 @@ function parseAgentSource(agentSource) {
|
|
|
17363
17363
|
* @returns The content with normalized separators
|
|
17364
17364
|
*/
|
|
17365
17365
|
function normalizeSeparator(content) {
|
|
17366
|
-
const trimmed = spaceTrim$
|
|
17366
|
+
const trimmed = spaceTrim$1(content);
|
|
17367
17367
|
if (trimmed.includes(',')) {
|
|
17368
17368
|
return trimmed;
|
|
17369
17369
|
}
|
|
@@ -17376,7 +17376,7 @@ function normalizeSeparator(content) {
|
|
|
17376
17376
|
* @returns Normalized domain or a trimmed fallback.
|
|
17377
17377
|
*/
|
|
17378
17378
|
function normalizeMetaDomain(content) {
|
|
17379
|
-
const trimmed = spaceTrim$
|
|
17379
|
+
const trimmed = spaceTrim$1(content);
|
|
17380
17380
|
return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
|
|
17381
17381
|
}
|
|
17382
17382
|
/**
|
|
@@ -17587,7 +17587,7 @@ function validateBook(source) {
|
|
|
17587
17587
|
* @deprecated Use `$generateBookBoilerplate` instead
|
|
17588
17588
|
* @public exported from `@promptbook/core`
|
|
17589
17589
|
*/
|
|
17590
|
-
padBook(validateBook(spaceTrim$
|
|
17590
|
+
padBook(validateBook(spaceTrim$1(`
|
|
17591
17591
|
AI Avatar
|
|
17592
17592
|
|
|
17593
17593
|
PERSONA A friendly AI assistant that helps you with your tasks
|
|
@@ -17667,7 +17667,7 @@ function book(strings, ...values) {
|
|
|
17667
17667
|
const bookString = prompt(strings, ...values).toString();
|
|
17668
17668
|
if (!isValidPipelineString(bookString)) {
|
|
17669
17669
|
// TODO: Make the CustomError for this
|
|
17670
|
-
throw new Error(spaceTrim$
|
|
17670
|
+
throw new Error(spaceTrim$1(`
|
|
17671
17671
|
The string is not a valid pipeline string
|
|
17672
17672
|
|
|
17673
17673
|
book\`
|
|
@@ -17677,7 +17677,7 @@ function book(strings, ...values) {
|
|
|
17677
17677
|
}
|
|
17678
17678
|
if (!isValidBook(bookString)) {
|
|
17679
17679
|
// TODO: Make the CustomError for this
|
|
17680
|
-
throw new Error(spaceTrim$
|
|
17680
|
+
throw new Error(spaceTrim$1(`
|
|
17681
17681
|
The string is not a valid book
|
|
17682
17682
|
|
|
17683
17683
|
book\`
|
|
@@ -18044,14 +18044,14 @@ class MultipleLlmExecutionTools {
|
|
|
18044
18044
|
if (description === undefined) {
|
|
18045
18045
|
return headLine;
|
|
18046
18046
|
}
|
|
18047
|
-
return spaceTrim$
|
|
18047
|
+
return spaceTrim$1((block) => `
|
|
18048
18048
|
${headLine}
|
|
18049
18049
|
|
|
18050
18050
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
18051
18051
|
`);
|
|
18052
18052
|
})
|
|
18053
18053
|
.join('\n\n');
|
|
18054
|
-
return spaceTrim$
|
|
18054
|
+
return spaceTrim$1((block) => `
|
|
18055
18055
|
Multiple LLM Providers:
|
|
18056
18056
|
|
|
18057
18057
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -18153,7 +18153,7 @@ class MultipleLlmExecutionTools {
|
|
|
18153
18153
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
18154
18154
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
18155
18155
|
// 3) ...
|
|
18156
|
-
spaceTrim$
|
|
18156
|
+
spaceTrim$1((block) => `
|
|
18157
18157
|
All execution tools of ${this.title} failed:
|
|
18158
18158
|
|
|
18159
18159
|
${block(errors
|
|
@@ -18166,7 +18166,7 @@ class MultipleLlmExecutionTools {
|
|
|
18166
18166
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
18167
18167
|
}
|
|
18168
18168
|
else {
|
|
18169
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
18169
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
18170
18170
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
18171
18171
|
|
|
18172
18172
|
Available \`LlmExecutionTools\`:
|
|
@@ -18203,7 +18203,7 @@ class MultipleLlmExecutionTools {
|
|
|
18203
18203
|
*/
|
|
18204
18204
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
18205
18205
|
if (llmExecutionTools.length === 0) {
|
|
18206
|
-
const warningMessage = spaceTrim$
|
|
18206
|
+
const warningMessage = spaceTrim$1(`
|
|
18207
18207
|
You have not provided any \`LlmExecutionTools\`
|
|
18208
18208
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
18209
18209
|
|
|
@@ -18382,7 +18382,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
18382
18382
|
pipelineString += '\n\n';
|
|
18383
18383
|
pipelineString += '```' + contentLanguage;
|
|
18384
18384
|
pipelineString += '\n';
|
|
18385
|
-
pipelineString += spaceTrim$
|
|
18385
|
+
pipelineString += spaceTrim$1(content);
|
|
18386
18386
|
// <- TODO: [main] !!3 Escape
|
|
18387
18387
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
18388
18388
|
pipelineString += '\n';
|
|
@@ -19408,14 +19408,14 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
19408
19408
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
19409
19409
|
});
|
|
19410
19410
|
if (metadata.length === 0) {
|
|
19411
|
-
return spaceTrim$
|
|
19411
|
+
return spaceTrim$1(`
|
|
19412
19412
|
**No scrapers are available**
|
|
19413
19413
|
|
|
19414
19414
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
19415
19415
|
At least there should be available the metadata of the scrapers
|
|
19416
19416
|
`);
|
|
19417
19417
|
}
|
|
19418
|
-
return spaceTrim$
|
|
19418
|
+
return spaceTrim$1((block) => `
|
|
19419
19419
|
Available scrapers are:
|
|
19420
19420
|
${block(metadata
|
|
19421
19421
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -19542,7 +19542,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
19542
19542
|
else if (urlOrRequest instanceof Request) {
|
|
19543
19543
|
url = urlOrRequest.url;
|
|
19544
19544
|
}
|
|
19545
|
-
throw new PromptbookFetchError(spaceTrim$
|
|
19545
|
+
throw new PromptbookFetchError(spaceTrim$1((block) => `
|
|
19546
19546
|
Can not fetch "${url}"
|
|
19547
19547
|
|
|
19548
19548
|
Fetch error:
|
|
@@ -19702,7 +19702,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
19702
19702
|
const fileExtension = getFileExtension(filename);
|
|
19703
19703
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
19704
19704
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
19705
|
-
throw new NotFoundError(spaceTrim$
|
|
19705
|
+
throw new NotFoundError(spaceTrim$1((block) => `
|
|
19706
19706
|
Can not make source handler for file which does not exist:
|
|
19707
19707
|
|
|
19708
19708
|
File:
|
|
@@ -19795,7 +19795,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
19795
19795
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
19796
19796
|
break;
|
|
19797
19797
|
}
|
|
19798
|
-
console.warn(spaceTrim$
|
|
19798
|
+
console.warn(spaceTrim$1((block) => `
|
|
19799
19799
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
19800
19800
|
|
|
19801
19801
|
The source:
|
|
@@ -19811,7 +19811,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
19811
19811
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
19812
19812
|
}
|
|
19813
19813
|
if (partialPieces === null) {
|
|
19814
|
-
throw new KnowledgeScrapeError(spaceTrim$
|
|
19814
|
+
throw new KnowledgeScrapeError(spaceTrim$1((block) => `
|
|
19815
19815
|
Cannot scrape knowledge
|
|
19816
19816
|
|
|
19817
19817
|
The source:
|
|
@@ -20248,7 +20248,7 @@ const CsvFormatParser = {
|
|
|
20248
20248
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
20249
20249
|
const csv = csvParse(value, settings);
|
|
20250
20250
|
if (csv.errors.length !== 0) {
|
|
20251
|
-
throw new CsvFormatError(spaceTrim$
|
|
20251
|
+
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
20252
20252
|
CSV parsing error
|
|
20253
20253
|
|
|
20254
20254
|
Error(s) from CSV parsing:
|
|
@@ -20293,7 +20293,7 @@ const CsvFormatParser = {
|
|
|
20293
20293
|
const { value, settings, mapCallback, onProgress } = options;
|
|
20294
20294
|
const csv = csvParse(value, settings);
|
|
20295
20295
|
if (csv.errors.length !== 0) {
|
|
20296
|
-
throw new CsvFormatError(spaceTrim$
|
|
20296
|
+
throw new CsvFormatError(spaceTrim$1((block) => `
|
|
20297
20297
|
CSV parsing error
|
|
20298
20298
|
|
|
20299
20299
|
Error(s) from CSV parsing:
|
|
@@ -20479,7 +20479,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
20479
20479
|
}
|
|
20480
20480
|
// Phase 2️⃣: Non-matching mapping
|
|
20481
20481
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
20482
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
20482
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
20483
20483
|
Can not map available parameters to expected parameters
|
|
20484
20484
|
|
|
20485
20485
|
Mapped parameters:
|
|
@@ -21052,7 +21052,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21052
21052
|
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
21053
21053
|
}
|
|
21054
21054
|
if (jokerParameterNames.length !== 0) {
|
|
21055
|
-
throw new UnexpectedError(spaceTrim$
|
|
21055
|
+
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
21056
21056
|
JOKER parameters are not supported together with FOREACH command
|
|
21057
21057
|
|
|
21058
21058
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -21065,7 +21065,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21065
21065
|
if (formatDefinition === undefined) {
|
|
21066
21066
|
throw new UnexpectedError(
|
|
21067
21067
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
21068
|
-
spaceTrim$
|
|
21068
|
+
spaceTrim$1((block) => `
|
|
21069
21069
|
Unsupported format "${task.foreach.formatName}"
|
|
21070
21070
|
|
|
21071
21071
|
Available formats:
|
|
@@ -21082,7 +21082,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21082
21082
|
if (subvalueParser === undefined) {
|
|
21083
21083
|
throw new UnexpectedError(
|
|
21084
21084
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
21085
|
-
spaceTrim$
|
|
21085
|
+
spaceTrim$1((block) => `
|
|
21086
21086
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
21087
21087
|
|
|
21088
21088
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -21122,7 +21122,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21122
21122
|
if (!(error instanceof PipelineExecutionError)) {
|
|
21123
21123
|
throw error;
|
|
21124
21124
|
}
|
|
21125
|
-
const highLevelError = new PipelineExecutionError(spaceTrim$
|
|
21125
|
+
const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
|
|
21126
21126
|
${error.message}
|
|
21127
21127
|
|
|
21128
21128
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -21146,7 +21146,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21146
21146
|
...options,
|
|
21147
21147
|
priority: priority + index,
|
|
21148
21148
|
parameters: allSubparameters,
|
|
21149
|
-
pipelineIdentification: spaceTrim$
|
|
21149
|
+
pipelineIdentification: spaceTrim$1((block) => `
|
|
21150
21150
|
${block(pipelineIdentification)}
|
|
21151
21151
|
Subparameter index: ${index}
|
|
21152
21152
|
`),
|
|
@@ -21155,7 +21155,7 @@ async function executeFormatSubvalues(options) {
|
|
|
21155
21155
|
}
|
|
21156
21156
|
catch (error) {
|
|
21157
21157
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
21158
|
-
console.error(spaceTrim$
|
|
21158
|
+
console.error(spaceTrim$1((block) => `
|
|
21159
21159
|
${error.message}
|
|
21160
21160
|
|
|
21161
21161
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -23202,7 +23202,7 @@ function pricing(value) {
|
|
|
23202
23202
|
/**
|
|
23203
23203
|
* List of available OpenAI models with pricing
|
|
23204
23204
|
*
|
|
23205
|
-
* Note: Synced with official API docs at
|
|
23205
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
23206
23206
|
*
|
|
23207
23207
|
* @see https://platform.openai.com/docs/models/
|
|
23208
23208
|
* @see https://openai.com/api/pricing/
|
|
@@ -23324,8 +23324,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23324
23324
|
modelName: 'gpt-4.1',
|
|
23325
23325
|
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.',
|
|
23326
23326
|
pricing: {
|
|
23327
|
-
prompt: pricing(`$
|
|
23328
|
-
output: pricing(`$
|
|
23327
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
23328
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
23329
23329
|
},
|
|
23330
23330
|
},
|
|
23331
23331
|
/**/
|
|
@@ -23336,8 +23336,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23336
23336
|
modelName: 'gpt-4.1-mini',
|
|
23337
23337
|
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.',
|
|
23338
23338
|
pricing: {
|
|
23339
|
-
prompt: pricing(`$0.
|
|
23340
|
-
output: pricing(`$
|
|
23339
|
+
prompt: pricing(`$0.40 / 1M tokens`),
|
|
23340
|
+
output: pricing(`$1.60 / 1M tokens`),
|
|
23341
23341
|
},
|
|
23342
23342
|
},
|
|
23343
23343
|
/**/
|
|
@@ -23348,8 +23348,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23348
23348
|
modelName: 'gpt-4.1-nano',
|
|
23349
23349
|
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.',
|
|
23350
23350
|
pricing: {
|
|
23351
|
-
prompt: pricing(`$0.
|
|
23352
|
-
output: pricing(`$0.
|
|
23351
|
+
prompt: pricing(`$0.10 / 1M tokens`),
|
|
23352
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
23353
23353
|
},
|
|
23354
23354
|
},
|
|
23355
23355
|
/**/
|
|
@@ -23360,8 +23360,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23360
23360
|
modelName: 'o3',
|
|
23361
23361
|
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.',
|
|
23362
23362
|
pricing: {
|
|
23363
|
-
prompt: pricing(`$
|
|
23364
|
-
output: pricing(`$
|
|
23363
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
23364
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
23365
23365
|
},
|
|
23366
23366
|
},
|
|
23367
23367
|
/**/
|
|
@@ -23372,8 +23372,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23372
23372
|
modelName: 'o3-pro',
|
|
23373
23373
|
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.',
|
|
23374
23374
|
pricing: {
|
|
23375
|
-
prompt: pricing(`$
|
|
23376
|
-
output: pricing(`$
|
|
23375
|
+
prompt: pricing(`$20.00 / 1M tokens`),
|
|
23376
|
+
output: pricing(`$80.00 / 1M tokens`),
|
|
23377
23377
|
},
|
|
23378
23378
|
},
|
|
23379
23379
|
/**/
|
|
@@ -23384,8 +23384,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23384
23384
|
modelName: 'o4-mini',
|
|
23385
23385
|
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.',
|
|
23386
23386
|
pricing: {
|
|
23387
|
-
prompt: pricing(`$
|
|
23388
|
-
output: pricing(`$
|
|
23387
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
23388
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
23389
23389
|
},
|
|
23390
23390
|
},
|
|
23391
23391
|
/**/
|
|
@@ -23743,8 +23743,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23743
23743
|
modelName: 'gpt-4o-2024-05-13',
|
|
23744
23744
|
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.',
|
|
23745
23745
|
pricing: {
|
|
23746
|
-
prompt: pricing(`$
|
|
23747
|
-
output: pricing(`$
|
|
23746
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
23747
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
23748
23748
|
},
|
|
23749
23749
|
},
|
|
23750
23750
|
/**/
|
|
@@ -23755,8 +23755,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23755
23755
|
modelName: 'gpt-4o',
|
|
23756
23756
|
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.",
|
|
23757
23757
|
pricing: {
|
|
23758
|
-
prompt: pricing(`$
|
|
23759
|
-
output: pricing(`$
|
|
23758
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
23759
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
23760
23760
|
},
|
|
23761
23761
|
},
|
|
23762
23762
|
/**/
|
|
@@ -23827,8 +23827,8 @@ const OPENAI_MODELS = exportJson({
|
|
|
23827
23827
|
modelName: 'o3-mini',
|
|
23828
23828
|
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.',
|
|
23829
23829
|
pricing: {
|
|
23830
|
-
prompt: pricing(`$
|
|
23831
|
-
output: pricing(`$
|
|
23830
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
23831
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
23832
23832
|
},
|
|
23833
23833
|
},
|
|
23834
23834
|
/**/
|
|
@@ -23928,53 +23928,6 @@ resultContent, rawResponse, duration = ZERO_VALUE) {
|
|
|
23928
23928
|
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
23929
23929
|
*/
|
|
23930
23930
|
|
|
23931
|
-
/**
|
|
23932
|
-
* Maps Promptbook tools to OpenAI tools.
|
|
23933
|
-
*
|
|
23934
|
-
* @private
|
|
23935
|
-
*/
|
|
23936
|
-
function mapToolsToOpenAi(tools) {
|
|
23937
|
-
return tools.map((tool) => ({
|
|
23938
|
-
type: 'function',
|
|
23939
|
-
function: {
|
|
23940
|
-
name: tool.name,
|
|
23941
|
-
description: tool.description,
|
|
23942
|
-
parameters: tool.parameters,
|
|
23943
|
-
},
|
|
23944
|
-
}));
|
|
23945
|
-
}
|
|
23946
|
-
|
|
23947
|
-
/**
|
|
23948
|
-
* Builds a tool invocation script that injects hidden runtime context into tool args.
|
|
23949
|
-
*
|
|
23950
|
-
* @private utility of OpenAI tool execution wrappers
|
|
23951
|
-
*/
|
|
23952
|
-
function buildToolInvocationScript(options) {
|
|
23953
|
-
const { functionName, functionArgsExpression } = options;
|
|
23954
|
-
return `
|
|
23955
|
-
const args = ${functionArgsExpression};
|
|
23956
|
-
const runtimeContextRaw =
|
|
23957
|
-
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
23958
|
-
? undefined
|
|
23959
|
-
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
23960
|
-
|
|
23961
|
-
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
23962
|
-
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
23963
|
-
}
|
|
23964
|
-
|
|
23965
|
-
const toolProgressTokenRaw =
|
|
23966
|
-
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
23967
|
-
? undefined
|
|
23968
|
-
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
23969
|
-
|
|
23970
|
-
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
23971
|
-
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
23972
|
-
}
|
|
23973
|
-
|
|
23974
|
-
return await ${functionName}(args);
|
|
23975
|
-
`;
|
|
23976
|
-
}
|
|
23977
|
-
|
|
23978
23931
|
/**
|
|
23979
23932
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
23980
23933
|
*
|
|
@@ -24031,6 +23984,53 @@ function isUnsupportedParameterError(error) {
|
|
|
24031
23984
|
errorMessage.includes('does not support'));
|
|
24032
23985
|
}
|
|
24033
23986
|
|
|
23987
|
+
/**
|
|
23988
|
+
* Builds a tool invocation script that injects hidden runtime context into tool args.
|
|
23989
|
+
*
|
|
23990
|
+
* @private utility of OpenAI tool execution wrappers
|
|
23991
|
+
*/
|
|
23992
|
+
function buildToolInvocationScript(options) {
|
|
23993
|
+
const { functionName, functionArgsExpression } = options;
|
|
23994
|
+
return `
|
|
23995
|
+
const args = ${functionArgsExpression};
|
|
23996
|
+
const runtimeContextRaw =
|
|
23997
|
+
typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
|
|
23998
|
+
? undefined
|
|
23999
|
+
: ${TOOL_RUNTIME_CONTEXT_PARAMETER};
|
|
24000
|
+
|
|
24001
|
+
if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
24002
|
+
args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
|
|
24003
|
+
}
|
|
24004
|
+
|
|
24005
|
+
const toolProgressTokenRaw =
|
|
24006
|
+
typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
|
|
24007
|
+
? undefined
|
|
24008
|
+
: ${TOOL_PROGRESS_TOKEN_PARAMETER};
|
|
24009
|
+
|
|
24010
|
+
if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
|
|
24011
|
+
args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
|
|
24012
|
+
}
|
|
24013
|
+
|
|
24014
|
+
return await ${functionName}(args);
|
|
24015
|
+
`;
|
|
24016
|
+
}
|
|
24017
|
+
|
|
24018
|
+
/**
|
|
24019
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
24020
|
+
*
|
|
24021
|
+
* @private
|
|
24022
|
+
*/
|
|
24023
|
+
function mapToolsToOpenAi(tools) {
|
|
24024
|
+
return tools.map((tool) => ({
|
|
24025
|
+
type: 'function',
|
|
24026
|
+
function: {
|
|
24027
|
+
name: tool.name,
|
|
24028
|
+
description: tool.description,
|
|
24029
|
+
parameters: tool.parameters,
|
|
24030
|
+
},
|
|
24031
|
+
}));
|
|
24032
|
+
}
|
|
24033
|
+
|
|
24034
24034
|
/**
|
|
24035
24035
|
* Provides access to the structured clone implementation when available.
|
|
24036
24036
|
*/
|
|
@@ -24997,7 +24997,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
24997
24997
|
// Note: Match exact or prefix for model families
|
|
24998
24998
|
const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
|
|
24999
24999
|
if (model === undefined) {
|
|
25000
|
-
throw new PipelineExecutionError(spaceTrim$
|
|
25000
|
+
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
25001
25001
|
Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
|
|
25002
25002
|
|
|
25003
25003
|
Available models:
|
|
@@ -25923,7 +25923,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
25923
25923
|
}
|
|
25924
25924
|
}
|
|
25925
25925
|
|
|
25926
|
-
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-
|
|
25926
|
+
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
|
|
25927
25927
|
/**
|
|
25928
25928
|
* Creates one structured log entry for streamed tool-call updates.
|
|
25929
25929
|
*
|
|
@@ -26418,7 +26418,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
26418
26418
|
}),
|
|
26419
26419
|
],
|
|
26420
26420
|
};
|
|
26421
|
-
const errorMessage = spaceTrim$
|
|
26421
|
+
const errorMessage = spaceTrim$1((block) => `
|
|
26422
26422
|
|
|
26423
26423
|
The invoked tool \`${functionName}\` failed with error:
|
|
26424
26424
|
|
|
@@ -27136,7 +27136,7 @@ class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
27136
27136
|
assertsError(error);
|
|
27137
27137
|
const serializedError = serializeError(error);
|
|
27138
27138
|
errors = [serializedError];
|
|
27139
|
-
functionResponse = spaceTrim$
|
|
27139
|
+
functionResponse = spaceTrim$1((block) => `
|
|
27140
27140
|
|
|
27141
27141
|
The invoked tool \`${functionName}\` failed with error:
|
|
27142
27142
|
|
|
@@ -28144,7 +28144,7 @@ class SelfLearningManager {
|
|
|
28144
28144
|
if (isJsonSchemaResponseFormat(responseFormat)) {
|
|
28145
28145
|
const jsonSchema = responseFormat.json_schema;
|
|
28146
28146
|
const schemaJson = JSON.stringify(jsonSchema, null, 4);
|
|
28147
|
-
userMessageContent = spaceTrim$
|
|
28147
|
+
userMessageContent = spaceTrim$1((block) => `
|
|
28148
28148
|
${block(prompt.content)}
|
|
28149
28149
|
|
|
28150
28150
|
NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
|
|
@@ -28175,12 +28175,12 @@ class SelfLearningManager {
|
|
|
28175
28175
|
const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
|
|
28176
28176
|
const teacherInstructions = extractOpenTeacherInstructions(agentSource);
|
|
28177
28177
|
const teacherInstructionsSection = teacherInstructions
|
|
28178
|
-
? spaceTrim$
|
|
28178
|
+
? spaceTrim$1((block) => `
|
|
28179
28179
|
**Teacher instructions:**
|
|
28180
28180
|
${block(teacherInstructions)}
|
|
28181
28181
|
`)
|
|
28182
28182
|
: '';
|
|
28183
|
-
const teacherPromptContent = spaceTrim$
|
|
28183
|
+
const teacherPromptContent = spaceTrim$1((block) => `
|
|
28184
28184
|
|
|
28185
28185
|
You are a teacher agent helping another agent to learn from its interactions.
|
|
28186
28186
|
|
|
@@ -28213,7 +28213,7 @@ class SelfLearningManager {
|
|
|
28213
28213
|
? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
|
|
28214
28214
|
: ''}
|
|
28215
28215
|
${block(isInitialMessageMissing
|
|
28216
|
-
? spaceTrim$
|
|
28216
|
+
? spaceTrim$1(`
|
|
28217
28217
|
- The agent source does not have an INITIAL MESSAGE defined, generate one.
|
|
28218
28218
|
- 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.
|
|
28219
28219
|
- The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
|
|
@@ -28256,7 +28256,7 @@ class SelfLearningManager {
|
|
|
28256
28256
|
*/
|
|
28257
28257
|
appendToAgentSource(section) {
|
|
28258
28258
|
const currentSource = this.options.getAgentSource();
|
|
28259
|
-
const newSource = padBook(validateBook(spaceTrim$
|
|
28259
|
+
const newSource = padBook(validateBook(spaceTrim$1(currentSource) + section));
|
|
28260
28260
|
this.options.updateAgentSource(newSource);
|
|
28261
28261
|
}
|
|
28262
28262
|
}
|
|
@@ -28284,13 +28284,13 @@ function formatAgentMessageForJsonMode(content, isJsonMode) {
|
|
|
28284
28284
|
}
|
|
28285
28285
|
const parsedJson = tryParseJson(content);
|
|
28286
28286
|
if (parsedJson === null) {
|
|
28287
|
-
return spaceTrim$
|
|
28287
|
+
return spaceTrim$1((block) => `
|
|
28288
28288
|
\`\`\`json
|
|
28289
28289
|
${block(content)}
|
|
28290
28290
|
\`\`\`
|
|
28291
28291
|
`);
|
|
28292
28292
|
}
|
|
28293
|
-
return spaceTrim$
|
|
28293
|
+
return spaceTrim$1((block) => `
|
|
28294
28294
|
\`\`\`json
|
|
28295
28295
|
${block(JSON.stringify(parsedJson, null, 4))}
|
|
28296
28296
|
\`\`\`
|
|
@@ -28322,7 +28322,7 @@ function formatSelfLearningSample(options) {
|
|
|
28322
28322
|
const internalMessagesSection = options.internalMessages
|
|
28323
28323
|
.map((internalMessage) => formatInternalLearningMessage(internalMessage))
|
|
28324
28324
|
.join('\n\n');
|
|
28325
|
-
return spaceTrim$
|
|
28325
|
+
return spaceTrim$1((block) => `
|
|
28326
28326
|
|
|
28327
28327
|
USER MESSAGE
|
|
28328
28328
|
${block(options.userMessageContent)}
|
|
@@ -28340,7 +28340,7 @@ function formatSelfLearningSample(options) {
|
|
|
28340
28340
|
* @private function of Agent
|
|
28341
28341
|
*/
|
|
28342
28342
|
function formatInternalLearningMessage(internalMessage) {
|
|
28343
|
-
return spaceTrim$
|
|
28343
|
+
return spaceTrim$1((block) => `
|
|
28344
28344
|
INTERNAL MESSAGE
|
|
28345
28345
|
${block(stringifyInternalLearningPayload(internalMessage))}
|
|
28346
28346
|
`);
|
|
@@ -28806,7 +28806,7 @@ function buildRemoteAgentSource(profile, meta) {
|
|
|
28806
28806
|
.filter((line) => Boolean(line))
|
|
28807
28807
|
.join('\n');
|
|
28808
28808
|
const personaBlock = profile.personaDescription
|
|
28809
|
-
? spaceTrim$
|
|
28809
|
+
? spaceTrim$1((block) => `
|
|
28810
28810
|
PERSONA
|
|
28811
28811
|
${block(profile.personaDescription || '')}
|
|
28812
28812
|
`)
|
|
@@ -28842,7 +28842,7 @@ class RemoteAgent extends Agent {
|
|
|
28842
28842
|
// <- TODO: [🐱🚀] What about closed-source agents?
|
|
28843
28843
|
// <- TODO: [🐱🚀] Maybe use promptbookFetch
|
|
28844
28844
|
if (!profileResponse.ok) {
|
|
28845
|
-
throw new Error(spaceTrim$
|
|
28845
|
+
throw new Error(spaceTrim$1((block) => `
|
|
28846
28846
|
Failed to fetch remote agent profile:
|
|
28847
28847
|
|
|
28848
28848
|
Agent URL:
|