@promptbook/core 0.110.0-8 → 0.110.0
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/README.md +0 -4
- package/esm/index.es.js +488 -98
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +6 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +22 -21
- package/esm/typings/src/book-2.0/agent-source/AgentReferenceResolver.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +8 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.agentReferenceResolver.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +4 -5
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +42 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatActionsBar.d.ts +0 -2
- package/esm/typings/src/book-components/Chat/Chat/ChatInputArea.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +26 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatSoundToggle.d.ts +31 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatRatings.d.ts +24 -2
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +2 -10
- package/esm/typings/src/book-components/Chat/utils/parseCitationMarker.d.ts +75 -0
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +3 -1
- package/esm/typings/src/book-components/Chat/utils/parseCitationsFromContent.test.d.ts +1 -0
- package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +17 -4
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +39 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +1 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +9 -0
- package/esm/typings/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +8 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.d.ts +38 -0
- package/esm/typings/src/utils/knowledge/inlineKnowledgeSource.test.d.ts +1 -0
- package/esm/typings/src/utils/language/getBrowserPreferredSpeechRecognitionLanguage.d.ts +35 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +487 -98
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.110.0
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.110.0';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -7657,11 +7657,14 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
7657
7657
|
function createEmptyAgentModelRequirements() {
|
|
7658
7658
|
return {
|
|
7659
7659
|
systemMessage: '',
|
|
7660
|
+
promptSuffix: '',
|
|
7660
7661
|
// modelName: 'gpt-5',
|
|
7661
7662
|
modelName: 'gemini-2.5-flash-lite',
|
|
7662
7663
|
temperature: 0.7,
|
|
7663
7664
|
topP: 0.9,
|
|
7664
7665
|
topK: 50,
|
|
7666
|
+
parentAgentUrl: null,
|
|
7667
|
+
isClosed: false,
|
|
7665
7668
|
};
|
|
7666
7669
|
}
|
|
7667
7670
|
/**
|
|
@@ -7778,6 +7781,28 @@ class BaseCommitmentDefinition {
|
|
|
7778
7781
|
return currentMessage + separator + content;
|
|
7779
7782
|
});
|
|
7780
7783
|
}
|
|
7784
|
+
/**
|
|
7785
|
+
* Helper method to create a new requirements object with updated prompt suffix
|
|
7786
|
+
*/
|
|
7787
|
+
updatePromptSuffix(requirements, contentUpdate) {
|
|
7788
|
+
const newSuffix = typeof contentUpdate === 'string' ? contentUpdate : contentUpdate(requirements.promptSuffix);
|
|
7789
|
+
return {
|
|
7790
|
+
...requirements,
|
|
7791
|
+
promptSuffix: newSuffix,
|
|
7792
|
+
};
|
|
7793
|
+
}
|
|
7794
|
+
/**
|
|
7795
|
+
* Helper method to append content to the prompt suffix
|
|
7796
|
+
* Default separator is a single newline for bullet lists.
|
|
7797
|
+
*/
|
|
7798
|
+
appendToPromptSuffix(requirements, content, separator = '\n') {
|
|
7799
|
+
return this.updatePromptSuffix(requirements, (currentSuffix) => {
|
|
7800
|
+
if (!currentSuffix.trim()) {
|
|
7801
|
+
return content;
|
|
7802
|
+
}
|
|
7803
|
+
return `${currentSuffix}${separator}${content}`;
|
|
7804
|
+
});
|
|
7805
|
+
}
|
|
7781
7806
|
/**
|
|
7782
7807
|
* Helper method to add a comment section to the system message
|
|
7783
7808
|
* Comments are lines starting with # that will be removed from the final system message
|
|
@@ -7955,13 +7980,9 @@ class ClosedCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
7955
7980
|
`);
|
|
7956
7981
|
}
|
|
7957
7982
|
applyToAgentModelRequirements(requirements, _content) {
|
|
7958
|
-
const updatedMetadata = {
|
|
7959
|
-
...requirements.metadata,
|
|
7960
|
-
isClosed: true,
|
|
7961
|
-
};
|
|
7962
7983
|
return {
|
|
7963
7984
|
...requirements,
|
|
7964
|
-
|
|
7985
|
+
isClosed: true,
|
|
7965
7986
|
};
|
|
7966
7987
|
}
|
|
7967
7988
|
}
|
|
@@ -8239,12 +8260,12 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
8239
8260
|
return requirements;
|
|
8240
8261
|
}
|
|
8241
8262
|
// Get existing dictionary entries from metadata
|
|
8242
|
-
const existingDictionary = ((_a = requirements.
|
|
8263
|
+
const existingDictionary = ((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
|
|
8243
8264
|
// Merge the new dictionary entry with existing entries
|
|
8244
8265
|
const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
|
|
8245
8266
|
// Store the merged dictionary in metadata for debugging and inspection
|
|
8246
8267
|
const updatedMetadata = {
|
|
8247
|
-
...requirements.
|
|
8268
|
+
...requirements._metadata,
|
|
8248
8269
|
DICTIONARY: mergedDictionary,
|
|
8249
8270
|
};
|
|
8250
8271
|
// Create the dictionary section for the system message
|
|
@@ -8252,7 +8273,7 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
8252
8273
|
const dictionarySection = `# DICTIONARY\n${mergedDictionary}`;
|
|
8253
8274
|
return {
|
|
8254
8275
|
...this.appendToSystemMessage(requirements, dictionarySection),
|
|
8255
|
-
|
|
8276
|
+
_metadata: updatedMetadata,
|
|
8256
8277
|
};
|
|
8257
8278
|
}
|
|
8258
8279
|
}
|
|
@@ -10697,10 +10718,7 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10697
10718
|
applyToAgentModelRequirements(requirements, content) {
|
|
10698
10719
|
const trimmedContent = content.trim();
|
|
10699
10720
|
if (!trimmedContent) {
|
|
10700
|
-
return
|
|
10701
|
-
...requirements,
|
|
10702
|
-
parentAgentUrl: undefined,
|
|
10703
|
-
};
|
|
10721
|
+
return requirements;
|
|
10704
10722
|
}
|
|
10705
10723
|
if (trimmedContent.toUpperCase() === 'VOID' ||
|
|
10706
10724
|
trimmedContent.toUpperCase() === 'NULL' ||
|
|
@@ -10914,6 +10932,136 @@ class ImportCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10914
10932
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10915
10933
|
*/
|
|
10916
10934
|
|
|
10935
|
+
/**
|
|
10936
|
+
* @@@
|
|
10937
|
+
*
|
|
10938
|
+
* @private thing of inline knowledge
|
|
10939
|
+
*/
|
|
10940
|
+
const INLINE_KNOWLEDGE_BASE_NAME = 'inline-knowledge';
|
|
10941
|
+
/**
|
|
10942
|
+
* @@@
|
|
10943
|
+
*
|
|
10944
|
+
* @private thing of inline knowledge
|
|
10945
|
+
*/
|
|
10946
|
+
const INLINE_KNOWLEDGE_EXTENSION = '.txt';
|
|
10947
|
+
/**
|
|
10948
|
+
* @@@
|
|
10949
|
+
*
|
|
10950
|
+
* @private thing of inline knowledge
|
|
10951
|
+
*/
|
|
10952
|
+
const DATA_URL_PREFIX = 'data:';
|
|
10953
|
+
/**
|
|
10954
|
+
* @@@
|
|
10955
|
+
*
|
|
10956
|
+
* @private thing of inline knowledge
|
|
10957
|
+
*/
|
|
10958
|
+
function getFirstNonEmptyLine(content) {
|
|
10959
|
+
const lines = content.split(/\r?\n/);
|
|
10960
|
+
for (const line of lines) {
|
|
10961
|
+
const trimmed = line.trim();
|
|
10962
|
+
if (trimmed) {
|
|
10963
|
+
return trimmed;
|
|
10964
|
+
}
|
|
10965
|
+
}
|
|
10966
|
+
return null;
|
|
10967
|
+
}
|
|
10968
|
+
/**
|
|
10969
|
+
* @@@
|
|
10970
|
+
*
|
|
10971
|
+
* @private thing of inline knowledge
|
|
10972
|
+
*/
|
|
10973
|
+
function deriveBaseFilename(content) {
|
|
10974
|
+
const firstLine = getFirstNonEmptyLine(content);
|
|
10975
|
+
if (!firstLine) {
|
|
10976
|
+
return INLINE_KNOWLEDGE_BASE_NAME;
|
|
10977
|
+
}
|
|
10978
|
+
const normalized = normalizeToKebabCase(firstLine);
|
|
10979
|
+
return normalized || INLINE_KNOWLEDGE_BASE_NAME;
|
|
10980
|
+
}
|
|
10981
|
+
/**
|
|
10982
|
+
* Creates a data URL that represents the inline knowledge content as a text file.
|
|
10983
|
+
*
|
|
10984
|
+
* @private thing of inline knowledge
|
|
10985
|
+
*/
|
|
10986
|
+
function createInlineKnowledgeSourceFile(content) {
|
|
10987
|
+
const trimmedContent = content.trim();
|
|
10988
|
+
const baseName = deriveBaseFilename(trimmedContent);
|
|
10989
|
+
const filename = `${baseName}${INLINE_KNOWLEDGE_EXTENSION}`;
|
|
10990
|
+
const mimeType = 'text/plain';
|
|
10991
|
+
const base64 = Buffer.from(trimmedContent, 'utf-8').toString('base64');
|
|
10992
|
+
const encodedFilename = encodeURIComponent(filename);
|
|
10993
|
+
const url = `${DATA_URL_PREFIX}${mimeType};name=${encodedFilename};charset=utf-8;base64,${base64}`;
|
|
10994
|
+
return {
|
|
10995
|
+
filename,
|
|
10996
|
+
mimeType,
|
|
10997
|
+
url,
|
|
10998
|
+
};
|
|
10999
|
+
}
|
|
11000
|
+
/**
|
|
11001
|
+
* Checks whether the provided source string is a data URL that can be decoded.
|
|
11002
|
+
*
|
|
11003
|
+
* @private thing of inline knowledge
|
|
11004
|
+
*/
|
|
11005
|
+
function isDataUrlKnowledgeSource(source) {
|
|
11006
|
+
return typeof source === 'string' && source.startsWith(DATA_URL_PREFIX);
|
|
11007
|
+
}
|
|
11008
|
+
/**
|
|
11009
|
+
* Parses a data URL-based knowledge source into its raw buffer, filename, and MIME type.
|
|
11010
|
+
*
|
|
11011
|
+
* @private thing of inline knowledge
|
|
11012
|
+
*/
|
|
11013
|
+
function parseDataUrlKnowledgeSource(source) {
|
|
11014
|
+
if (!isDataUrlKnowledgeSource(source)) {
|
|
11015
|
+
return null;
|
|
11016
|
+
}
|
|
11017
|
+
const commaIndex = source.indexOf(',');
|
|
11018
|
+
if (commaIndex === -1) {
|
|
11019
|
+
return null;
|
|
11020
|
+
}
|
|
11021
|
+
const header = source.slice(DATA_URL_PREFIX.length, commaIndex);
|
|
11022
|
+
const payload = source.slice(commaIndex + 1);
|
|
11023
|
+
const tokens = header.split(';');
|
|
11024
|
+
const mediaType = tokens[0] || 'text/plain';
|
|
11025
|
+
let filename = `${INLINE_KNOWLEDGE_BASE_NAME}${INLINE_KNOWLEDGE_EXTENSION}`;
|
|
11026
|
+
let isBase64 = false;
|
|
11027
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
11028
|
+
const token = tokens[i];
|
|
11029
|
+
if (!token) {
|
|
11030
|
+
continue;
|
|
11031
|
+
}
|
|
11032
|
+
if (token.toLowerCase() === 'base64') {
|
|
11033
|
+
isBase64 = true;
|
|
11034
|
+
continue;
|
|
11035
|
+
}
|
|
11036
|
+
const [key, value] = token.split('=');
|
|
11037
|
+
if (key === 'name' && value !== undefined) {
|
|
11038
|
+
try {
|
|
11039
|
+
filename = decodeURIComponent(value);
|
|
11040
|
+
}
|
|
11041
|
+
catch (_a) {
|
|
11042
|
+
filename = value;
|
|
11043
|
+
}
|
|
11044
|
+
}
|
|
11045
|
+
}
|
|
11046
|
+
if (!isBase64) {
|
|
11047
|
+
return null;
|
|
11048
|
+
}
|
|
11049
|
+
try {
|
|
11050
|
+
const buffer = Buffer.from(payload, 'base64');
|
|
11051
|
+
return {
|
|
11052
|
+
buffer,
|
|
11053
|
+
filename,
|
|
11054
|
+
mimeType: mediaType,
|
|
11055
|
+
};
|
|
11056
|
+
}
|
|
11057
|
+
catch (_b) {
|
|
11058
|
+
return null;
|
|
11059
|
+
}
|
|
11060
|
+
}
|
|
11061
|
+
/**
|
|
11062
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11063
|
+
*/
|
|
11064
|
+
|
|
10917
11065
|
/**
|
|
10918
11066
|
* KNOWLEDGE commitment definition
|
|
10919
11067
|
*
|
|
@@ -11012,9 +11160,13 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11012
11160
|
return this.appendToSystemMessage(updatedRequirements, knowledgeInfo, '\n\n');
|
|
11013
11161
|
}
|
|
11014
11162
|
else {
|
|
11015
|
-
|
|
11016
|
-
const
|
|
11017
|
-
|
|
11163
|
+
const inlineSource = createInlineKnowledgeSourceFile(trimmedContent);
|
|
11164
|
+
const updatedRequirements = {
|
|
11165
|
+
...requirements,
|
|
11166
|
+
knowledgeSources: [...(requirements.knowledgeSources || []), inlineSource.url],
|
|
11167
|
+
};
|
|
11168
|
+
const knowledgeInfo = `Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`;
|
|
11169
|
+
return this.appendToSystemMessage(updatedRequirements, knowledgeInfo, '\n\n');
|
|
11018
11170
|
}
|
|
11019
11171
|
}
|
|
11020
11172
|
}
|
|
@@ -11261,16 +11413,16 @@ class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11261
11413
|
// and typically doesn't need to be added to the system prompt or model requirements directly.
|
|
11262
11414
|
// It is extracted separately for the chat interface.
|
|
11263
11415
|
var _a;
|
|
11264
|
-
const pendingUserMessage = (_a = requirements.
|
|
11416
|
+
const pendingUserMessage = (_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
|
|
11265
11417
|
if (pendingUserMessage) {
|
|
11266
11418
|
const newSample = { question: pendingUserMessage, answer: content };
|
|
11267
11419
|
const newSamples = [...(requirements.samples || []), newSample];
|
|
11268
|
-
const newMetadata = { ...requirements.
|
|
11420
|
+
const newMetadata = { ...requirements._metadata };
|
|
11269
11421
|
delete newMetadata.pendingUserMessage;
|
|
11270
11422
|
return {
|
|
11271
11423
|
...requirements,
|
|
11272
11424
|
samples: newSamples,
|
|
11273
|
-
|
|
11425
|
+
_metadata: newMetadata,
|
|
11274
11426
|
};
|
|
11275
11427
|
}
|
|
11276
11428
|
return requirements;
|
|
@@ -11518,8 +11670,8 @@ class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11518
11670
|
applyToAgentModelRequirements(requirements, content) {
|
|
11519
11671
|
return {
|
|
11520
11672
|
...requirements,
|
|
11521
|
-
|
|
11522
|
-
...requirements.
|
|
11673
|
+
_metadata: {
|
|
11674
|
+
...requirements._metadata,
|
|
11523
11675
|
pendingUserMessage: content,
|
|
11524
11676
|
},
|
|
11525
11677
|
};
|
|
@@ -12377,11 +12529,7 @@ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12377
12529
|
if (trimmedContent === '') {
|
|
12378
12530
|
return requirements;
|
|
12379
12531
|
}
|
|
12380
|
-
|
|
12381
|
-
return {
|
|
12382
|
-
...requirements,
|
|
12383
|
-
notes: [...(requirements.notes || []), trimmedContent],
|
|
12384
|
-
};
|
|
12532
|
+
return requirements;
|
|
12385
12533
|
}
|
|
12386
12534
|
}
|
|
12387
12535
|
/**
|
|
@@ -12443,12 +12591,12 @@ class OpenCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12443
12591
|
// Since OPEN is default, we can just ensure isClosed is false
|
|
12444
12592
|
// But to be explicit we can set it
|
|
12445
12593
|
const updatedMetadata = {
|
|
12446
|
-
...requirements.
|
|
12594
|
+
...requirements._metadata,
|
|
12447
12595
|
isClosed: false,
|
|
12448
12596
|
};
|
|
12449
12597
|
return {
|
|
12450
12598
|
...requirements,
|
|
12451
|
-
|
|
12599
|
+
_metadata: updatedMetadata,
|
|
12452
12600
|
};
|
|
12453
12601
|
}
|
|
12454
12602
|
}
|
|
@@ -12529,7 +12677,7 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12529
12677
|
return requirements;
|
|
12530
12678
|
}
|
|
12531
12679
|
// Get existing persona content from metadata
|
|
12532
|
-
const existingPersonaContent = ((_a = requirements.
|
|
12680
|
+
const existingPersonaContent = ((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.PERSONA) || '';
|
|
12533
12681
|
// Merge the new content with existing persona content
|
|
12534
12682
|
// When multiple PERSONA commitments exist, they are merged into one
|
|
12535
12683
|
const mergedPersonaContent = existingPersonaContent
|
|
@@ -12537,12 +12685,12 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12537
12685
|
: trimmedContent;
|
|
12538
12686
|
// Store the merged persona content in metadata for debugging and inspection
|
|
12539
12687
|
const updatedMetadata = {
|
|
12540
|
-
...requirements.
|
|
12688
|
+
...requirements._metadata,
|
|
12541
12689
|
PERSONA: mergedPersonaContent,
|
|
12542
12690
|
};
|
|
12543
12691
|
// Get the agent name from metadata (which should contain the first line of agent source)
|
|
12544
12692
|
// If not available, extract from current system message as fallback
|
|
12545
|
-
let agentName = (_b = requirements.
|
|
12693
|
+
let agentName = (_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.agentName;
|
|
12546
12694
|
if (!agentName) {
|
|
12547
12695
|
// Fallback: extract from current system message
|
|
12548
12696
|
const currentMessage = requirements.systemMessage.trim();
|
|
@@ -12589,7 +12737,7 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12589
12737
|
return {
|
|
12590
12738
|
...requirements,
|
|
12591
12739
|
systemMessage: newSystemMessage,
|
|
12592
|
-
|
|
12740
|
+
_metadata: updatedMetadata,
|
|
12593
12741
|
};
|
|
12594
12742
|
}
|
|
12595
12743
|
}
|
|
@@ -12672,7 +12820,16 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12672
12820
|
}
|
|
12673
12821
|
// Add rule to the system message
|
|
12674
12822
|
const ruleSection = `Rule: ${trimmedContent}`;
|
|
12675
|
-
|
|
12823
|
+
const requirementsWithRule = this.appendToSystemMessage(requirements, ruleSection, '\n\n');
|
|
12824
|
+
const ruleLines = trimmedContent
|
|
12825
|
+
.split(/\r?\n/)
|
|
12826
|
+
.map((line) => line.trim())
|
|
12827
|
+
.filter(Boolean)
|
|
12828
|
+
.map((line) => `- ${line}`);
|
|
12829
|
+
if (ruleLines.length === 0) {
|
|
12830
|
+
return requirementsWithRule;
|
|
12831
|
+
}
|
|
12832
|
+
return this.appendToPromptSuffix(requirementsWithRule, ruleLines.join('\n'));
|
|
12676
12833
|
}
|
|
12677
12834
|
}
|
|
12678
12835
|
/**
|
|
@@ -13174,11 +13331,12 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13174
13331
|
if (!trimmedContent) {
|
|
13175
13332
|
return requirements;
|
|
13176
13333
|
}
|
|
13177
|
-
|
|
13334
|
+
// Keep TEAM resilient: unresolved/malformed teammate entries are skipped, valid ones are still registered.
|
|
13335
|
+
const teammates = parseTeamCommitmentContent(trimmedContent, { strict: false });
|
|
13178
13336
|
if (teammates.length === 0) {
|
|
13179
13337
|
return requirements;
|
|
13180
13338
|
}
|
|
13181
|
-
const agentName = ((_a = requirements.
|
|
13339
|
+
const agentName = ((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.agentName) || 'Agent';
|
|
13182
13340
|
const teamEntries = teammates.map((teammate) => ({
|
|
13183
13341
|
toolName: createTeamToolName(teammate.url),
|
|
13184
13342
|
teammate,
|
|
@@ -13218,7 +13376,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13218
13376
|
},
|
|
13219
13377
|
});
|
|
13220
13378
|
}
|
|
13221
|
-
const existingTeammates = ((_b = requirements.
|
|
13379
|
+
const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
|
|
13222
13380
|
const updatedTeammates = [...existingTeammates];
|
|
13223
13381
|
for (const entry of teamEntries) {
|
|
13224
13382
|
if (updatedTeammates.some((existing) => existing.url === entry.teammate.url)) {
|
|
@@ -13247,8 +13405,8 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13247
13405
|
return this.appendToSystemMessage({
|
|
13248
13406
|
...requirements,
|
|
13249
13407
|
tools: updatedTools,
|
|
13250
|
-
|
|
13251
|
-
...requirements.
|
|
13408
|
+
_metadata: {
|
|
13409
|
+
...requirements._metadata,
|
|
13252
13410
|
teammates: updatedTeammates,
|
|
13253
13411
|
},
|
|
13254
13412
|
}, teamSystemMessage);
|
|
@@ -13480,7 +13638,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13480
13638
|
if (!trimmedContent) {
|
|
13481
13639
|
// Store template mode flag in metadata
|
|
13482
13640
|
const updatedMetadata = {
|
|
13483
|
-
...requirements.
|
|
13641
|
+
...requirements._metadata,
|
|
13484
13642
|
templateMode: true,
|
|
13485
13643
|
};
|
|
13486
13644
|
// Add a general instruction about using structured templates
|
|
@@ -13490,21 +13648,21 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13490
13648
|
`);
|
|
13491
13649
|
return {
|
|
13492
13650
|
...this.appendToSystemMessage(requirements, templateModeInstruction, '\n\n'),
|
|
13493
|
-
|
|
13651
|
+
_metadata: updatedMetadata,
|
|
13494
13652
|
};
|
|
13495
13653
|
}
|
|
13496
13654
|
// If content is provided, add the specific template instructions
|
|
13497
13655
|
const templateSection = `Response Template: ${trimmedContent}`;
|
|
13498
13656
|
// Store the template in metadata for potential programmatic access
|
|
13499
|
-
const existingTemplates = ((_a = requirements.
|
|
13657
|
+
const existingTemplates = ((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.templates) || [];
|
|
13500
13658
|
const updatedMetadata = {
|
|
13501
|
-
...requirements.
|
|
13659
|
+
...requirements._metadata,
|
|
13502
13660
|
templates: [...existingTemplates, trimmedContent],
|
|
13503
13661
|
templateMode: true,
|
|
13504
13662
|
};
|
|
13505
13663
|
return {
|
|
13506
13664
|
...this.appendToSystemMessage(requirements, templateSection, '\n\n'),
|
|
13507
|
-
|
|
13665
|
+
_metadata: updatedMetadata,
|
|
13508
13666
|
};
|
|
13509
13667
|
}
|
|
13510
13668
|
}
|
|
@@ -13841,8 +13999,8 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
13841
13999
|
return this.appendToSystemMessage({
|
|
13842
14000
|
...requirements,
|
|
13843
14001
|
tools: updatedTools,
|
|
13844
|
-
|
|
13845
|
-
...requirements.
|
|
14002
|
+
_metadata: {
|
|
14003
|
+
...requirements._metadata,
|
|
13846
14004
|
useBrowser: true,
|
|
13847
14005
|
},
|
|
13848
14006
|
}, spaceTrim$1(`
|
|
@@ -14071,8 +14229,8 @@ class UseEmailCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14071
14229
|
return this.appendToSystemMessage({
|
|
14072
14230
|
...requirements,
|
|
14073
14231
|
tools: updatedTools,
|
|
14074
|
-
|
|
14075
|
-
...requirements.
|
|
14232
|
+
_metadata: {
|
|
14233
|
+
...requirements._metadata,
|
|
14076
14234
|
useEmail: content || true,
|
|
14077
14235
|
},
|
|
14078
14236
|
}, spaceTrim$1((block) => `
|
|
@@ -14207,8 +14365,8 @@ class UseImageGeneratorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14207
14365
|
return this.appendToSystemMessage({
|
|
14208
14366
|
...requirements,
|
|
14209
14367
|
tools: updatedTools,
|
|
14210
|
-
|
|
14211
|
-
...requirements.
|
|
14368
|
+
_metadata: {
|
|
14369
|
+
...requirements._metadata,
|
|
14212
14370
|
useImageGenerator: content || true,
|
|
14213
14371
|
},
|
|
14214
14372
|
}, spaceTrim$1(`
|
|
@@ -14499,8 +14657,8 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14499
14657
|
return this.appendToSystemMessage({
|
|
14500
14658
|
...requirements,
|
|
14501
14659
|
tools: updatedTools,
|
|
14502
|
-
|
|
14503
|
-
...requirements.
|
|
14660
|
+
_metadata: {
|
|
14661
|
+
...requirements._metadata,
|
|
14504
14662
|
useSearchEngine: content || true,
|
|
14505
14663
|
},
|
|
14506
14664
|
}, spaceTrim$1((block) => `
|
|
@@ -14648,8 +14806,8 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14648
14806
|
return this.appendToSystemMessage({
|
|
14649
14807
|
...requirements,
|
|
14650
14808
|
tools: updatedTools,
|
|
14651
|
-
|
|
14652
|
-
...requirements.
|
|
14809
|
+
_metadata: {
|
|
14810
|
+
...requirements._metadata,
|
|
14653
14811
|
},
|
|
14654
14812
|
}, spaceTrim$1((block) => `
|
|
14655
14813
|
Time and date context:
|
|
@@ -15233,14 +15391,42 @@ function removeCommentsFromSystemMessage(systemMessage) {
|
|
|
15233
15391
|
}
|
|
15234
15392
|
|
|
15235
15393
|
/**
|
|
15236
|
-
* Creates agent model requirements using the new commitment system
|
|
15394
|
+
* Creates agent model requirements using the new commitment system.
|
|
15395
|
+
*
|
|
15237
15396
|
* This function uses a reduce-like pattern where each commitment applies its changes
|
|
15238
|
-
* to build the final requirements starting from a basic empty model
|
|
15397
|
+
* to build the final requirements starting from a basic empty model.
|
|
15239
15398
|
*
|
|
15240
|
-
* @
|
|
15399
|
+
* @param agentSource - Agent source book to parse.
|
|
15400
|
+
* @param modelName - Optional override for the agent model name.
|
|
15401
|
+
* @param options - Additional options such as the agent reference resolver.
|
|
15402
|
+
*
|
|
15403
|
+
* @private @@@
|
|
15404
|
+
*/
|
|
15405
|
+
const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS', 'TEAM']);
|
|
15406
|
+
/**
|
|
15407
|
+
* Returns a safe fallback content when a resolver fails to transform a reference commitment.
|
|
15408
|
+
*
|
|
15409
|
+
* @param commitmentType - Commitment being resolved.
|
|
15410
|
+
* @param originalContent - Original unresolved commitment content.
|
|
15411
|
+
* @returns Fallback content that keeps requirement creation resilient.
|
|
15412
|
+
*/
|
|
15413
|
+
function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
|
|
15414
|
+
if (commitmentType === 'FROM') {
|
|
15415
|
+
return 'VOID';
|
|
15416
|
+
}
|
|
15417
|
+
if (commitmentType === 'IMPORT' || commitmentType === 'IMPORTS' || commitmentType === 'TEAM') {
|
|
15418
|
+
return '';
|
|
15419
|
+
}
|
|
15420
|
+
return originalContent;
|
|
15421
|
+
}
|
|
15422
|
+
/**
|
|
15423
|
+
* @@@
|
|
15424
|
+
*
|
|
15425
|
+
* @private @@@
|
|
15241
15426
|
*/
|
|
15242
|
-
async function createAgentModelRequirementsWithCommitments(agentSource, modelName) {
|
|
15427
|
+
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
15243
15428
|
var _a;
|
|
15429
|
+
const agentReferenceResolver = options === null || options === void 0 ? void 0 : options.agentReferenceResolver;
|
|
15244
15430
|
// Parse the agent source to extract commitments
|
|
15245
15431
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
15246
15432
|
// Apply DELETE filtering: remove prior commitments tagged by parameters targeted by DELETE/CANCEL/DISCARD/REMOVE
|
|
@@ -15277,8 +15463,8 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
15277
15463
|
// Store the agent name in metadata so commitments can access it
|
|
15278
15464
|
requirements = {
|
|
15279
15465
|
...requirements,
|
|
15280
|
-
|
|
15281
|
-
...requirements.
|
|
15466
|
+
_metadata: {
|
|
15467
|
+
...requirements._metadata,
|
|
15282
15468
|
agentName: parseResult.agentName,
|
|
15283
15469
|
},
|
|
15284
15470
|
};
|
|
@@ -15292,6 +15478,17 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
15292
15478
|
// Apply each commitment in order using reduce-like pattern
|
|
15293
15479
|
for (let i = 0; i < filteredCommitments.length; i++) {
|
|
15294
15480
|
const commitment = filteredCommitments[i];
|
|
15481
|
+
const isReferenceCommitment = Boolean(agentReferenceResolver && COMMITMENTS_WITH_AGENT_REFERENCES.has(commitment.type));
|
|
15482
|
+
let commitmentContent = commitment.content;
|
|
15483
|
+
if (isReferenceCommitment && agentReferenceResolver) {
|
|
15484
|
+
try {
|
|
15485
|
+
commitmentContent = await agentReferenceResolver.resolveCommitmentContent(commitment.type, commitment.content);
|
|
15486
|
+
}
|
|
15487
|
+
catch (error) {
|
|
15488
|
+
console.warn(`Failed to resolve commitment references for ${commitment.type}, falling back to safe defaults:`, error);
|
|
15489
|
+
commitmentContent = getSafeReferenceCommitmentFallback(commitment.type, commitment.content);
|
|
15490
|
+
}
|
|
15491
|
+
}
|
|
15295
15492
|
// CLOSED commitment should work only if its the last commitment in the book
|
|
15296
15493
|
if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
|
|
15297
15494
|
continue;
|
|
@@ -15299,7 +15496,7 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
15299
15496
|
const definition = getCommitmentDefinition(commitment.type);
|
|
15300
15497
|
if (definition) {
|
|
15301
15498
|
try {
|
|
15302
|
-
requirements = definition.applyToAgentModelRequirements(requirements,
|
|
15499
|
+
requirements = definition.applyToAgentModelRequirements(requirements, commitmentContent);
|
|
15303
15500
|
}
|
|
15304
15501
|
catch (error) {
|
|
15305
15502
|
console.warn(`Failed to apply commitment ${commitment.type}:`, error);
|
|
@@ -15749,23 +15946,28 @@ function normalizeSeparator(content) {
|
|
|
15749
15946
|
*/
|
|
15750
15947
|
|
|
15751
15948
|
/**
|
|
15752
|
-
* Creates model requirements for an agent based on its source
|
|
15949
|
+
* Creates model requirements for an agent based on its source.
|
|
15753
15950
|
*
|
|
15754
15951
|
* There are 2 similar functions:
|
|
15755
15952
|
* - `parseAgentSource` which is a lightweight parser for agent source, it parses basic information and its purpose is to be quick and synchronous. The commitments there are hardcoded.
|
|
15756
15953
|
* - `createAgentModelRequirements` which is an asynchronous function that creates model requirements it applies each commitment one by one and works asynchronous.
|
|
15757
15954
|
*
|
|
15955
|
+
* @param agentSource - Book describing the agent.
|
|
15956
|
+
* @param modelName - Optional override for the agent's model.
|
|
15957
|
+
* @param availableModels - Models that could fulfill the agent.
|
|
15958
|
+
* @param llmTools - Execution tools used when selecting a best model.
|
|
15959
|
+
* @param options - Optional hooks such as the agent reference resolver.
|
|
15758
15960
|
* @public exported from `@promptbook/core`
|
|
15759
15961
|
*/
|
|
15760
|
-
async function createAgentModelRequirements(agentSource, modelName, availableModels, llmTools) {
|
|
15962
|
+
async function createAgentModelRequirements(agentSource, modelName, availableModels, llmTools, options) {
|
|
15761
15963
|
// If availableModels are provided and no specific modelName is given,
|
|
15762
15964
|
// use preparePersona to select the best model
|
|
15763
15965
|
if (availableModels && !modelName && llmTools) {
|
|
15764
15966
|
const selectedModelName = await selectBestModelUsingPersona(agentSource, llmTools);
|
|
15765
|
-
return createAgentModelRequirementsWithCommitments(agentSource, selectedModelName);
|
|
15967
|
+
return createAgentModelRequirementsWithCommitments(agentSource, selectedModelName, options);
|
|
15766
15968
|
}
|
|
15767
15969
|
// Use the new commitment-based system with provided or default model
|
|
15768
|
-
return createAgentModelRequirementsWithCommitments(agentSource, modelName);
|
|
15970
|
+
return createAgentModelRequirementsWithCommitments(agentSource, modelName, options);
|
|
15769
15971
|
}
|
|
15770
15972
|
/**
|
|
15771
15973
|
* Selects the best model using the preparePersona function
|
|
@@ -21307,6 +21509,66 @@ const OPENAI_MODELS = exportJson({
|
|
|
21307
21509
|
},
|
|
21308
21510
|
/**/
|
|
21309
21511
|
/**/
|
|
21512
|
+
{
|
|
21513
|
+
modelVariant: 'CHAT',
|
|
21514
|
+
modelTitle: 'gpt-5.2-codex',
|
|
21515
|
+
modelName: 'gpt-5.2-codex',
|
|
21516
|
+
modelDescription: 'High-capability Codex variant tuned for agentic code generation with large contexts and reasoning effort controls. Ideal for long-horizon coding workflows and multi-step reasoning.',
|
|
21517
|
+
pricing: {
|
|
21518
|
+
prompt: pricing(`$1.75 / 1M tokens`),
|
|
21519
|
+
output: pricing(`$14.00 / 1M tokens`),
|
|
21520
|
+
},
|
|
21521
|
+
},
|
|
21522
|
+
/**/
|
|
21523
|
+
/**/
|
|
21524
|
+
{
|
|
21525
|
+
modelVariant: 'CHAT',
|
|
21526
|
+
modelTitle: 'gpt-5.1-codex-max',
|
|
21527
|
+
modelName: 'gpt-5.1-codex-max',
|
|
21528
|
+
modelDescription: 'Premium GPT-5.1 Codex flavor that mirrors gpt-5.1 in capability and pricing while adding Codex tooling optimizations.',
|
|
21529
|
+
pricing: {
|
|
21530
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
21531
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
21532
|
+
},
|
|
21533
|
+
},
|
|
21534
|
+
/**/
|
|
21535
|
+
/**/
|
|
21536
|
+
{
|
|
21537
|
+
modelVariant: 'CHAT',
|
|
21538
|
+
modelTitle: 'gpt-5.1-codex',
|
|
21539
|
+
modelName: 'gpt-5.1-codex',
|
|
21540
|
+
modelDescription: 'Core GPT-5.1 Codex model focused on agentic coding tasks with a balanced trade-off between reasoning and cost.',
|
|
21541
|
+
pricing: {
|
|
21542
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
21543
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
21544
|
+
},
|
|
21545
|
+
},
|
|
21546
|
+
/**/
|
|
21547
|
+
/**/
|
|
21548
|
+
{
|
|
21549
|
+
modelVariant: 'CHAT',
|
|
21550
|
+
modelTitle: 'gpt-5.1-codex-mini',
|
|
21551
|
+
modelName: 'gpt-5.1-codex-mini',
|
|
21552
|
+
modelDescription: 'Compact, cost-effective GPT-5.1 Codex variant with a smaller context window ideal for cheap assistant iterations that still require coding awareness.',
|
|
21553
|
+
pricing: {
|
|
21554
|
+
prompt: pricing(`$0.25 / 1M tokens`),
|
|
21555
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
21556
|
+
},
|
|
21557
|
+
},
|
|
21558
|
+
/**/
|
|
21559
|
+
/**/
|
|
21560
|
+
{
|
|
21561
|
+
modelVariant: 'CHAT',
|
|
21562
|
+
modelTitle: 'gpt-5-codex',
|
|
21563
|
+
modelName: 'gpt-5-codex',
|
|
21564
|
+
modelDescription: 'Legacy GPT-5 Codex model built for agentic coding workloads with the same pricing as GPT-5 and a focus on stability.',
|
|
21565
|
+
pricing: {
|
|
21566
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
21567
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
21568
|
+
},
|
|
21569
|
+
},
|
|
21570
|
+
/**/
|
|
21571
|
+
/**/
|
|
21310
21572
|
{
|
|
21311
21573
|
modelVariant: 'CHAT',
|
|
21312
21574
|
modelTitle: 'gpt-5-mini',
|
|
@@ -22011,6 +22273,32 @@ function isUnsupportedParameterError(error) {
|
|
|
22011
22273
|
errorMessage.includes('does not support'));
|
|
22012
22274
|
}
|
|
22013
22275
|
|
|
22276
|
+
/**
|
|
22277
|
+
* Provides access to the structured clone implementation when available.
|
|
22278
|
+
*/
|
|
22279
|
+
function getStructuredCloneFunction() {
|
|
22280
|
+
return globalThis.structuredClone;
|
|
22281
|
+
}
|
|
22282
|
+
/**
|
|
22283
|
+
* Checks whether the prompt is a chat prompt that carries file attachments.
|
|
22284
|
+
*/
|
|
22285
|
+
function hasChatPromptFiles(prompt) {
|
|
22286
|
+
return 'files' in prompt && Array.isArray(prompt.files);
|
|
22287
|
+
}
|
|
22288
|
+
/**
|
|
22289
|
+
* Creates a deep copy of the prompt while keeping attached files intact when structured clone is not available.
|
|
22290
|
+
*/
|
|
22291
|
+
function clonePromptPreservingFiles(prompt) {
|
|
22292
|
+
const structuredCloneFn = getStructuredCloneFunction();
|
|
22293
|
+
if (typeof structuredCloneFn === 'function') {
|
|
22294
|
+
return structuredCloneFn(prompt);
|
|
22295
|
+
}
|
|
22296
|
+
const clonedPrompt = JSON.parse(JSON.stringify(prompt));
|
|
22297
|
+
if (hasChatPromptFiles(prompt)) {
|
|
22298
|
+
clonedPrompt.files = prompt.files;
|
|
22299
|
+
}
|
|
22300
|
+
return clonedPrompt;
|
|
22301
|
+
}
|
|
22014
22302
|
/**
|
|
22015
22303
|
* Execution Tools for calling OpenAI API or other OpenAI compatible provider
|
|
22016
22304
|
*
|
|
@@ -22095,7 +22383,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
22095
22383
|
*/
|
|
22096
22384
|
async callChatModelStream(prompt, onProgress) {
|
|
22097
22385
|
// Deep clone prompt and modelRequirements to avoid mutation across calls
|
|
22098
|
-
const clonedPrompt =
|
|
22386
|
+
const clonedPrompt = clonePromptPreservingFiles(prompt);
|
|
22099
22387
|
// Use local Set for retried parameters to ensure independence and thread safety
|
|
22100
22388
|
const retriedUnsupportedParameters = new Set();
|
|
22101
22389
|
return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters, onProgress);
|
|
@@ -22122,7 +22410,10 @@ class OpenAiCompatibleExecutionTools {
|
|
|
22122
22410
|
// <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
22123
22411
|
// <- Note: [🧆]
|
|
22124
22412
|
}; // <- TODO: [💩] Guard here types better
|
|
22125
|
-
if (
|
|
22413
|
+
if (currentModelRequirements.responseFormat !== undefined) {
|
|
22414
|
+
modelSettings.response_format = currentModelRequirements.responseFormat;
|
|
22415
|
+
}
|
|
22416
|
+
else if (format === 'JSON') {
|
|
22126
22417
|
modelSettings.response_format = {
|
|
22127
22418
|
type: 'json_object',
|
|
22128
22419
|
};
|
|
@@ -23603,7 +23894,9 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
23603
23894
|
const processingStartedAtMs = Date.now();
|
|
23604
23895
|
for (const [index, source] of knowledgeSources.entries()) {
|
|
23605
23896
|
try {
|
|
23606
|
-
const
|
|
23897
|
+
const isDataUrl = isDataUrlKnowledgeSource(source);
|
|
23898
|
+
const isHttp = source.startsWith('http://') || source.startsWith('https://');
|
|
23899
|
+
const sourceType = isDataUrl ? 'data_url' : isHttp ? 'url' : 'file';
|
|
23607
23900
|
if (this.options.isVerbose) {
|
|
23608
23901
|
console.info('[🤰]', 'Processing knowledge source', {
|
|
23609
23902
|
index: index + 1,
|
|
@@ -23613,8 +23906,27 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
23613
23906
|
logLabel,
|
|
23614
23907
|
});
|
|
23615
23908
|
}
|
|
23616
|
-
|
|
23617
|
-
|
|
23909
|
+
if (isDataUrl) {
|
|
23910
|
+
const parsed = parseDataUrlKnowledgeSource(source);
|
|
23911
|
+
if (!parsed) {
|
|
23912
|
+
skippedSources.push({ source, reason: 'invalid_data_url' });
|
|
23913
|
+
if (this.options.isVerbose) {
|
|
23914
|
+
console.info('[🤰]', 'Skipping knowledge source (invalid data URL)', {
|
|
23915
|
+
source,
|
|
23916
|
+
sourceType,
|
|
23917
|
+
logLabel,
|
|
23918
|
+
});
|
|
23919
|
+
}
|
|
23920
|
+
continue;
|
|
23921
|
+
}
|
|
23922
|
+
const dataUrlFile = new File([parsed.buffer], parsed.filename, {
|
|
23923
|
+
type: parsed.mimeType,
|
|
23924
|
+
});
|
|
23925
|
+
fileStreams.push(dataUrlFile);
|
|
23926
|
+
totalBytes += parsed.buffer.length;
|
|
23927
|
+
continue;
|
|
23928
|
+
}
|
|
23929
|
+
if (isHttp) {
|
|
23618
23930
|
const downloadResult = await this.downloadKnowledgeSourceFile({
|
|
23619
23931
|
source,
|
|
23620
23932
|
timeoutMs: downloadTimeoutMs,
|
|
@@ -23716,6 +24028,64 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
23716
24028
|
}
|
|
23717
24029
|
|
|
23718
24030
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.2';
|
|
24031
|
+
const DEFAULT_JSON_SCHEMA_NAME = 'StructuredOutput';
|
|
24032
|
+
/*
|
|
24033
|
+
TODO: Use or remove
|
|
24034
|
+
const EMPTY_JSON_SCHEMA: JsonSchemaDefinition['schema'] = {
|
|
24035
|
+
type: 'object',
|
|
24036
|
+
properties: {},
|
|
24037
|
+
required: [],
|
|
24038
|
+
additionalProperties: true,
|
|
24039
|
+
};
|
|
24040
|
+
*/
|
|
24041
|
+
function buildJsonSchemaDefinition(jsonSchema) {
|
|
24042
|
+
var _a, _b, _c;
|
|
24043
|
+
const schema = (_a = jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.schema) !== null && _a !== void 0 ? _a : {};
|
|
24044
|
+
return {
|
|
24045
|
+
type: 'json_schema',
|
|
24046
|
+
name: (_b = jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.name) !== null && _b !== void 0 ? _b : DEFAULT_JSON_SCHEMA_NAME,
|
|
24047
|
+
strict: Boolean(jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.strict),
|
|
24048
|
+
schema: {
|
|
24049
|
+
type: 'object',
|
|
24050
|
+
properties: ((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
|
|
24051
|
+
required: Array.isArray(schema.required) ? schema.required : [],
|
|
24052
|
+
additionalProperties: schema.additionalProperties === undefined ? true : Boolean(schema.additionalProperties),
|
|
24053
|
+
description: schema.description,
|
|
24054
|
+
},
|
|
24055
|
+
};
|
|
24056
|
+
}
|
|
24057
|
+
/**
|
|
24058
|
+
* Maps OpenAI `response_format` payloads to AgentKit output types so the runner can forward
|
|
24059
|
+
* structured-output preferences to OpenAI while still reusing the same AgentKit agent instance.
|
|
24060
|
+
*
|
|
24061
|
+
* @param responseFormat - The OpenAI `response_format` payload from the user request.
|
|
24062
|
+
* @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
|
|
24063
|
+
* @private utility of Open AI
|
|
24064
|
+
*/
|
|
24065
|
+
function mapResponseFormatToAgentOutputType(responseFormat) {
|
|
24066
|
+
if (!responseFormat) {
|
|
24067
|
+
return undefined;
|
|
24068
|
+
}
|
|
24069
|
+
if (typeof responseFormat === 'string') {
|
|
24070
|
+
if (responseFormat === 'text') {
|
|
24071
|
+
return 'text';
|
|
24072
|
+
}
|
|
24073
|
+
if (responseFormat === 'json_schema' || responseFormat === 'json_object') {
|
|
24074
|
+
return buildJsonSchemaDefinition();
|
|
24075
|
+
}
|
|
24076
|
+
return 'text';
|
|
24077
|
+
}
|
|
24078
|
+
switch (responseFormat.type) {
|
|
24079
|
+
case 'text':
|
|
24080
|
+
return 'text';
|
|
24081
|
+
case 'json_schema':
|
|
24082
|
+
return buildJsonSchemaDefinition(responseFormat.json_schema);
|
|
24083
|
+
case 'json_object':
|
|
24084
|
+
return buildJsonSchemaDefinition();
|
|
24085
|
+
default:
|
|
24086
|
+
return undefined;
|
|
24087
|
+
}
|
|
24088
|
+
}
|
|
23719
24089
|
/**
|
|
23720
24090
|
* Execution tools for OpenAI AgentKit (Agents SDK).
|
|
23721
24091
|
*
|
|
@@ -23763,6 +24133,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
23763
24133
|
...parameters,
|
|
23764
24134
|
modelName: this.agentKitModelName,
|
|
23765
24135
|
});
|
|
24136
|
+
const responseFormatOutputType = mapResponseFormatToAgentOutputType(modelRequirements.responseFormat);
|
|
23766
24137
|
const preparedAgentKitAgent = await this.prepareAgentKitAgent({
|
|
23767
24138
|
name: (prompt.title || 'Agent'),
|
|
23768
24139
|
instructions: modelRequirements.systemMessage || '',
|
|
@@ -23774,6 +24145,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
23774
24145
|
prompt,
|
|
23775
24146
|
rawPromptContent,
|
|
23776
24147
|
onProgress,
|
|
24148
|
+
responseFormatOutputType,
|
|
23777
24149
|
});
|
|
23778
24150
|
}
|
|
23779
24151
|
/**
|
|
@@ -23955,16 +24327,21 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
23955
24327
|
...prompt.parameters,
|
|
23956
24328
|
modelName: this.agentKitModelName,
|
|
23957
24329
|
});
|
|
24330
|
+
const agentForRun = options.responseFormatOutputType !== undefined
|
|
24331
|
+
? openAiAgentKitAgent.clone({
|
|
24332
|
+
outputType: options.responseFormatOutputType,
|
|
24333
|
+
})
|
|
24334
|
+
: openAiAgentKitAgent;
|
|
23958
24335
|
const start = $getCurrentDate();
|
|
23959
24336
|
let latestContent = '';
|
|
23960
24337
|
const toolCalls = [];
|
|
23961
24338
|
const toolCallIndexById = new Map();
|
|
23962
24339
|
const inputItems = await this.buildAgentKitInputItems(prompt, rawPromptContent);
|
|
23963
24340
|
const rawRequest = {
|
|
23964
|
-
agentName:
|
|
24341
|
+
agentName: agentForRun.name,
|
|
23965
24342
|
input: inputItems,
|
|
23966
24343
|
};
|
|
23967
|
-
const streamResult = await run(
|
|
24344
|
+
const streamResult = await run(agentForRun, inputItems, {
|
|
23968
24345
|
stream: true,
|
|
23969
24346
|
context: { parameters: prompt.parameters },
|
|
23970
24347
|
});
|
|
@@ -24953,22 +25330,28 @@ class AgentLlmExecutionTools {
|
|
|
24953
25330
|
throw new Error('AgentLlmExecutionTools only supports chat prompts');
|
|
24954
25331
|
}
|
|
24955
25332
|
const modelRequirements = await this.getModelRequirements();
|
|
25333
|
+
const { _metadata, promptSuffix, ...sanitizedRequirements } = modelRequirements;
|
|
24956
25334
|
const chatPrompt = prompt;
|
|
24957
25335
|
let underlyingLlmResult;
|
|
24958
|
-
|
|
25336
|
+
const chatPromptContentWithSuffix = promptSuffix
|
|
25337
|
+
? `${chatPrompt.content}\n\n${promptSuffix}`
|
|
25338
|
+
: chatPrompt.content;
|
|
24959
25339
|
const promptWithAgentModelRequirements = {
|
|
24960
25340
|
...chatPrompt,
|
|
25341
|
+
content: chatPromptContentWithSuffix,
|
|
24961
25342
|
modelRequirements: {
|
|
24962
25343
|
...chatPrompt.modelRequirements,
|
|
24963
|
-
...
|
|
25344
|
+
...sanitizedRequirements,
|
|
24964
25345
|
// Spread tools to convert readonly array to mutable
|
|
24965
|
-
tools:
|
|
25346
|
+
tools: sanitizedRequirements.tools
|
|
25347
|
+
? [...sanitizedRequirements.tools]
|
|
25348
|
+
: chatPrompt.modelRequirements.tools,
|
|
24966
25349
|
// Spread knowledgeSources to convert readonly array to mutable
|
|
24967
|
-
knowledgeSources:
|
|
24968
|
-
? [...
|
|
25350
|
+
knowledgeSources: sanitizedRequirements.knowledgeSources
|
|
25351
|
+
? [...sanitizedRequirements.knowledgeSources]
|
|
24969
25352
|
: undefined,
|
|
24970
25353
|
// Prepend agent system message to existing system message
|
|
24971
|
-
systemMessage:
|
|
25354
|
+
systemMessage: sanitizedRequirements.systemMessage +
|
|
24972
25355
|
(chatPrompt.modelRequirements.systemMessage
|
|
24973
25356
|
? `\n\n${chatPrompt.modelRequirements.systemMessage}`
|
|
24974
25357
|
: ''),
|
|
@@ -24976,8 +25359,8 @@ class AgentLlmExecutionTools {
|
|
|
24976
25359
|
};
|
|
24977
25360
|
console.log('!!!! promptWithAgentModelRequirements:', promptWithAgentModelRequirements);
|
|
24978
25361
|
if (OpenAiAgentKitExecutionTools.isOpenAiAgentKitExecutionTools(this.options.llmTools)) {
|
|
24979
|
-
const requirementsHash = SHA256(JSON.stringify(
|
|
24980
|
-
const vectorStoreHash = SHA256(JSON.stringify((_a =
|
|
25362
|
+
const requirementsHash = SHA256(JSON.stringify(sanitizedRequirements)).toString();
|
|
25363
|
+
const vectorStoreHash = SHA256(JSON.stringify((_a = sanitizedRequirements.knowledgeSources) !== null && _a !== void 0 ? _a : [])).toString();
|
|
24981
25364
|
const cachedVectorStore = AgentLlmExecutionTools.vectorStoreCache.get(this.title);
|
|
24982
25365
|
const cachedAgentKit = AgentLlmExecutionTools.agentKitAgentCache.get(this.title);
|
|
24983
25366
|
let preparedAgentKit = this.options.assistantPreparationMode === 'external'
|
|
@@ -25004,7 +25387,7 @@ class AgentLlmExecutionTools {
|
|
|
25004
25387
|
agent: this.title,
|
|
25005
25388
|
});
|
|
25006
25389
|
}
|
|
25007
|
-
if (!vectorStoreId && ((_b =
|
|
25390
|
+
if (!vectorStoreId && ((_b = sanitizedRequirements.knowledgeSources) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
25008
25391
|
emitAssistantPreparationProgress({
|
|
25009
25392
|
onProgress,
|
|
25010
25393
|
prompt,
|
|
@@ -25020,9 +25403,9 @@ class AgentLlmExecutionTools {
|
|
|
25020
25403
|
});
|
|
25021
25404
|
preparedAgentKit = await this.options.llmTools.prepareAgentKitAgent({
|
|
25022
25405
|
name: this.title,
|
|
25023
|
-
instructions:
|
|
25024
|
-
knowledgeSources:
|
|
25025
|
-
tools:
|
|
25406
|
+
instructions: sanitizedRequirements.systemMessage || '',
|
|
25407
|
+
knowledgeSources: sanitizedRequirements.knowledgeSources,
|
|
25408
|
+
tools: sanitizedRequirements.tools ? [...sanitizedRequirements.tools] : undefined,
|
|
25026
25409
|
vectorStoreId,
|
|
25027
25410
|
});
|
|
25028
25411
|
}
|
|
@@ -25037,15 +25420,17 @@ class AgentLlmExecutionTools {
|
|
|
25037
25420
|
requirementsHash,
|
|
25038
25421
|
vectorStoreId: preparedAgentKit.vectorStoreId,
|
|
25039
25422
|
});
|
|
25423
|
+
const responseFormatOutputType = mapResponseFormatToAgentOutputType(promptWithAgentModelRequirements.modelRequirements.responseFormat);
|
|
25040
25424
|
underlyingLlmResult = await this.options.llmTools.callChatModelStreamWithPreparedAgent({
|
|
25041
25425
|
openAiAgentKitAgent: preparedAgentKit.agent,
|
|
25042
25426
|
prompt: promptWithAgentModelRequirements,
|
|
25043
25427
|
onProgress,
|
|
25428
|
+
responseFormatOutputType,
|
|
25044
25429
|
});
|
|
25045
25430
|
}
|
|
25046
25431
|
else if (OpenAiAssistantExecutionTools.isOpenAiAssistantExecutionTools(this.options.llmTools)) {
|
|
25047
25432
|
// ... deprecated path ...
|
|
25048
|
-
const requirementsHash = SHA256(JSON.stringify(
|
|
25433
|
+
const requirementsHash = SHA256(JSON.stringify(sanitizedRequirements)).toString();
|
|
25049
25434
|
const cached = AgentLlmExecutionTools.assistantCache.get(this.title);
|
|
25050
25435
|
let assistant;
|
|
25051
25436
|
if (this.options.assistantPreparationMode === 'external') {
|
|
@@ -25087,9 +25472,9 @@ class AgentLlmExecutionTools {
|
|
|
25087
25472
|
assistant = await this.options.llmTools.updateAssistant({
|
|
25088
25473
|
assistantId: cached.assistantId,
|
|
25089
25474
|
name: this.title,
|
|
25090
|
-
instructions:
|
|
25091
|
-
knowledgeSources:
|
|
25092
|
-
tools:
|
|
25475
|
+
instructions: sanitizedRequirements.systemMessage,
|
|
25476
|
+
knowledgeSources: sanitizedRequirements.knowledgeSources,
|
|
25477
|
+
tools: sanitizedRequirements.tools ? [...sanitizedRequirements.tools] : undefined,
|
|
25093
25478
|
});
|
|
25094
25479
|
AgentLlmExecutionTools.assistantCache.set(this.title, {
|
|
25095
25480
|
assistantId: assistant.assistantId,
|
|
@@ -25112,9 +25497,9 @@ class AgentLlmExecutionTools {
|
|
|
25112
25497
|
});
|
|
25113
25498
|
assistant = await this.options.llmTools.createNewAssistant({
|
|
25114
25499
|
name: this.title,
|
|
25115
|
-
instructions:
|
|
25116
|
-
knowledgeSources:
|
|
25117
|
-
tools:
|
|
25500
|
+
instructions: sanitizedRequirements.systemMessage,
|
|
25501
|
+
knowledgeSources: sanitizedRequirements.knowledgeSources,
|
|
25502
|
+
tools: sanitizedRequirements.tools ? [...sanitizedRequirements.tools] : undefined,
|
|
25118
25503
|
/*
|
|
25119
25504
|
!!!
|
|
25120
25505
|
metadata: {
|
|
@@ -25156,13 +25541,19 @@ class AgentLlmExecutionTools {
|
|
|
25156
25541
|
}
|
|
25157
25542
|
}
|
|
25158
25543
|
let content = underlyingLlmResult.content;
|
|
25159
|
-
|
|
25160
|
-
|
|
25161
|
-
|
|
25162
|
-
|
|
25544
|
+
if (typeof content === 'string') {
|
|
25545
|
+
// Note: Cleanup the AI artifacts from the content
|
|
25546
|
+
content = humanizeAiText(content);
|
|
25547
|
+
// Note: Make sure the content is Promptbook-like
|
|
25548
|
+
content = promptbookifyAiText(content);
|
|
25549
|
+
}
|
|
25550
|
+
else {
|
|
25551
|
+
// TODO: Maybe deep `humanizeAiText` + `promptbookifyAiText` inside of the object
|
|
25552
|
+
content = JSON.stringify(content);
|
|
25553
|
+
}
|
|
25163
25554
|
const agentResult = {
|
|
25164
25555
|
...underlyingLlmResult,
|
|
25165
|
-
content,
|
|
25556
|
+
content: content,
|
|
25166
25557
|
modelName: this.modelName,
|
|
25167
25558
|
};
|
|
25168
25559
|
return agentResult;
|
|
@@ -25351,7 +25742,6 @@ class Agent extends AgentLlmExecutionTools {
|
|
|
25351
25742
|
* Note: This method also implements the learning mechanism
|
|
25352
25743
|
*/
|
|
25353
25744
|
async callChatModelStream(prompt, onProgress) {
|
|
25354
|
-
var _a;
|
|
25355
25745
|
// [1] Check if the user is asking the same thing as in the samples
|
|
25356
25746
|
const modelRequirements = await this.getModelRequirements();
|
|
25357
25747
|
if (modelRequirements.samples) {
|
|
@@ -25399,7 +25789,7 @@ class Agent extends AgentLlmExecutionTools {
|
|
|
25399
25789
|
if (result.rawResponse && 'sample' in result.rawResponse) {
|
|
25400
25790
|
return result;
|
|
25401
25791
|
}
|
|
25402
|
-
if (
|
|
25792
|
+
if (modelRequirements.isClosed) {
|
|
25403
25793
|
return result;
|
|
25404
25794
|
}
|
|
25405
25795
|
// Note: [0] Notify start of self-learning
|
|
@@ -27787,5 +28177,5 @@ function $generateBookBoilerplate(options) {
|
|
|
27787
28177
|
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
27788
28178
|
*/
|
|
27789
28179
|
|
|
27790
|
-
export { $bookTranspilersRegister, $generateBookBoilerplate, $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, API_REQUEST_TIMEOUT, AbstractFormatError, Agent, AgentCollectionInSupabase, AgentLlmExecutionTools, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, COLOR_CONSTANTS, CORE_AGENTS_SERVER, CORE_AGENTS_SERVER_WELL_KNOWN_AGENT_NAMES, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_AGENTS_DIRNAME, DEFAULT_BOOK, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_CONCURRENT_UPLOADS, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_MAX_RECURSION, DEFAULT_MAX_REQUESTS_PER_MINUTE, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_SIMULATED_DURATION_MS, DEFAULT_TASK_TITLE, DatabaseError, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, FormattedBookInMarkdownTranspiler, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, HTTP_STATUS_CODES, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LIMITS, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NETWORK_LIMITS, NonTaskSectionTypes, NotAllowed, NotFoundError, NotYetImplementedCommitmentDefinition, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, OpenAiSdkTranspiler, PADDING_LINES, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_CHAT_COLOR, PROMPTBOOK_COLOR, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, PROMPTBOOK_LEGAL_ENTITY, PROMPTBOOK_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, PUBLIC_AGENTS_SERVERS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, RESERVED_PARAMETER_NAMES, RemoteAgent, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TIME_INTERVALS, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, USER_CHAT_COLOR, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AgentMetadata, _AgentRegistration, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OllamaMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiCompatibleMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, aboutPromptbookInformation, addUsage, book, cacheLlmTools, compilePipeline, computeAgentHash, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements,
|
|
28180
|
+
export { $bookTranspilersRegister, $generateBookBoilerplate, $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, API_REQUEST_TIMEOUT, AbstractFormatError, Agent, AgentCollectionInSupabase, AgentLlmExecutionTools, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, COLOR_CONSTANTS, CORE_AGENTS_SERVER, CORE_AGENTS_SERVER_WELL_KNOWN_AGENT_NAMES, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_AGENTS_DIRNAME, DEFAULT_BOOK, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_CONCURRENT_UPLOADS, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_MAX_RECURSION, DEFAULT_MAX_REQUESTS_PER_MINUTE, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_SIMULATED_DURATION_MS, DEFAULT_TASK_TITLE, DatabaseError, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, FormattedBookInMarkdownTranspiler, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, HTTP_STATUS_CODES, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LIMITS, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NETWORK_LIMITS, NonTaskSectionTypes, NotAllowed, NotFoundError, NotYetImplementedCommitmentDefinition, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, OpenAiSdkTranspiler, PADDING_LINES, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_CHAT_COLOR, PROMPTBOOK_COLOR, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, PROMPTBOOK_LEGAL_ENTITY, PROMPTBOOK_LOGO_URL, PROMPTBOOK_SYNTAX_COLORS, PUBLIC_AGENTS_SERVERS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, RESERVED_PARAMETER_NAMES, RemoteAgent, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TIME_INTERVALS, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, USER_CHAT_COLOR, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AgentMetadata, _AgentRegistration, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OllamaMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiCompatibleMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, aboutPromptbookInformation, addUsage, book, cacheLlmTools, compilePipeline, computeAgentHash, computeCosineSimilarity, countUsage, createAgentLlmExecutionTools, createAgentModelRequirements, createBasicAgentModelRequirements, createDefaultAgentName, createEmptyAgentModelRequirements, createLlmToolsFromConfiguration, createPipelineCollectionFromJson, createPipelineCollectionFromPromise, createPipelineCollectionFromUrl, createPipelineExecutor, createPipelineSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, generatePlaceholderAgentProfileImageUrl, getAllCommitmentDefinitions, getAllCommitmentTypes, getAllCommitmentsToolTitles, getCommitmentDefinition, getGroupedCommitmentDefinitions, getPipelineInterface, getSingleLlmExecutionTools, identificationToPromptbookToken, isCommitmentSupported, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidBook, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, normalizeAgentName, padBook, parseAgentSource, parseParameters, parsePipeline, pipelineCollectionToJson, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validateBook, validatePipeline, validatePipelineString };
|
|
27791
28181
|
//# sourceMappingURL=index.es.js.map
|