@promptbook/wizard 0.103.0-45 → 0.103.0-47

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.
Files changed (59) hide show
  1. package/esm/index.es.js +161 -160
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/servers.d.ts +1 -7
  4. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +16 -14
  6. package/esm/typings/src/_packages/types.index.d.ts +12 -6
  7. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +6 -1
  8. package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +2 -0
  11. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +2 -0
  12. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
  13. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.test.d.ts +1 -0
  14. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
  15. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +5 -60
  16. package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +1 -1
  17. package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +1 -1
  18. package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +1 -1
  19. package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +1 -1
  20. package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +1 -5
  21. package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +1 -1
  22. package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +1 -1
  23. package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +1 -1
  24. package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +1 -1
  25. package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +1 -1
  26. package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +1 -1
  27. package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +1 -1
  28. package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +1 -1
  29. package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +1 -1
  30. package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +1 -1
  31. package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +1 -1
  32. package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +1 -1
  33. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +1 -1
  34. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +1 -1
  35. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
  36. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  37. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  38. package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  40. package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -7
  41. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +32 -0
  44. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
  45. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +5 -1
  46. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  47. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  48. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  49. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
  50. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +2 -2
  51. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +1 -1
  52. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  53. package/esm/typings/src/version.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/umd/index.umd.js +161 -160
  56. package/umd/index.umd.js.map +1 -1
  57. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  58. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
  59. /package/esm/typings/src/{book-2.0/commitments → commitments}/index.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -36,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
36
36
  * @generated
37
37
  * @see https://github.com/webgptorg/promptbook
38
38
  */
39
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
39
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-47';
40
40
  /**
41
41
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
42
42
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -49,15 +49,20 @@ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
49
49
  */
50
50
  const REMOTE_SERVER_URLS = [
51
51
  {
52
- title: 'Promptbook',
53
- description: `Servers of Promptbook.studio`,
52
+ title: 'Promptbook.Studio',
53
+ description: `Server of Promptbook.studio`,
54
54
  owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
55
- isAnonymousModeAllowed: true,
56
55
  urls: [
57
56
  'https://promptbook.s5.ptbk.io/',
58
57
  // Note: Servers 1-4 are not running
59
58
  ],
60
59
  },
60
+ {
61
+ title: 'Testing Agents',
62
+ description: `Testing Agents server on Vercel`,
63
+ owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
64
+ urls: ['https://s6.ptbk.io/'],
65
+ },
61
66
  /*
62
67
  Note: Working on older version of Promptbook and not supported anymore
63
68
  {
@@ -315,9 +320,6 @@ function checkChannelValue(channelName, value) {
315
320
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
316
321
  }
317
322
  }
318
- /**
319
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
320
- */
321
323
 
322
324
  /**
323
325
  * Color object represents an RGB color with alpha channel
@@ -5205,26 +5207,6 @@ const GOOGLE_MODELS = exportJson({
5205
5207
  output: pricing(`$0.45 / 1M tokens`),
5206
5208
  },
5207
5209
  },
5208
- {
5209
- modelVariant: 'CHAT',
5210
- modelTitle: 'Gemini 2.0 Flash',
5211
- modelName: 'gemini-2.0-flash',
5212
- modelDescription: 'Fast, efficient model with 128K context window optimized for rapid response times. Balances performance and cost with 2x lower latency than Pro models while maintaining strong capabilities in text generation, code completion, and logical reasoning. Excellent for interactive applications, chatbots, and services requiring quick responses with good quality.',
5213
- pricing: {
5214
- prompt: pricing(`$0.35 / 1M tokens`),
5215
- output: pricing(`$1.05 / 1M tokens`),
5216
- },
5217
- },
5218
- {
5219
- modelVariant: 'CHAT',
5220
- modelTitle: 'Gemini 2.0 Flash Lite',
5221
- modelName: 'gemini-2.0-flash-lite',
5222
- modelDescription: 'Streamlined version of Gemini 2.0 Flash with 64K context window, designed for extremely low-latency applications. Features 40% smaller model size and 3x faster inference while retaining core capabilities for text and simple reasoning tasks. Perfect for mobile applications, edge deployments, and high-volume services with strict latency requirements.',
5223
- pricing: {
5224
- prompt: pricing(`$0.20 / 1M tokens`),
5225
- output: pricing(`$0.60 / 1M tokens`),
5226
- },
5227
- },
5228
5210
  {
5229
5211
  modelVariant: 'CHAT',
5230
5212
  modelTitle: 'Gemini 2.0 Flash Thinking',
@@ -6801,7 +6783,7 @@ class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
6801
6783
  *
6802
6784
  * This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
6803
6785
  *
6804
- * Note: [🦖] There are several different things in Promptbook:
6786
+ * !!! Note: [🦖] There are several different things in Promptbook:
6805
6787
  * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
6806
6788
  * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
6807
6789
  * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
@@ -6907,17 +6889,21 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
6907
6889
  console.info('connect', stream.currentEvent);
6908
6890
  }
6909
6891
  });
6892
+ /*
6910
6893
  stream.on('messageDelta', (messageDelta) => {
6911
- var _a;
6912
- if (this.options.isVerbose &&
6894
+ if (
6895
+ this.options.isVerbose &&
6913
6896
  messageDelta &&
6914
6897
  messageDelta.content &&
6915
6898
  messageDelta.content[0] &&
6916
- messageDelta.content[0].type === 'text') {
6917
- console.info('messageDelta', (_a = messageDelta.content[0].text) === null || _a === void 0 ? void 0 : _a.value);
6899
+ messageDelta.content[0].type === 'text'
6900
+ ) {
6901
+ console.info('messageDelta', messageDelta.content[0].text?.value);
6918
6902
  }
6903
+
6919
6904
  // <- TODO: [🐚] Make streaming and running tasks working
6920
6905
  });
6906
+ */
6921
6907
  stream.on('messageCreated', (message) => {
6922
6908
  if (this.options.isVerbose) {
6923
6909
  console.info('messageCreated', message);
@@ -6997,64 +6983,85 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
6997
6983
  throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
6998
6984
  }
6999
6985
  // await this.playground();
7000
- const { name, instructions } = options;
6986
+ const { name, instructions, knowledgeSources } = options;
7001
6987
  const client = await this.getClient();
7002
- /*/
7003
- //TODO: !!!
7004
- async function downloadFile(url: string, folder = './tmp'): Promise<string> {
7005
- const filename = path.basename(url.split('?')[0]);
7006
- const filepath = path.join(folder, filename);
7007
-
7008
- if (!fs.existsSync(folder)) fs.mkdirSync(folder);
7009
-
7010
- const res = await fetch(url);
7011
- if (!res.ok) throw new Error(`Download error: ${url}`);
7012
- const buffer = await res.arrayBuffer();
7013
- fs.writeFileSync(filepath, Buffer.from(buffer));
7014
- console.log(`📥 File downloaded: ${filename}`);
7015
-
7016
- return filepath;
7017
- }
7018
-
7019
- async function uploadFileToOpenAI(filepath: string) {
7020
- const file = await client.files.create({
7021
- file: fs.createReadStream(filepath),
7022
- purpose: 'assistants',
6988
+ let vectorStoreId;
6989
+ // If knowledge sources are provided, create a vector store with them
6990
+ if (knowledgeSources && knowledgeSources.length > 0) {
6991
+ if (this.options.isVerbose) {
6992
+ console.info(`📚 Creating vector store with ${knowledgeSources.length} knowledge sources...`);
6993
+ }
6994
+ // Create a vector store
6995
+ const vectorStore = await client.beta.vectorStores.create({
6996
+ name: `${name} Knowledge Base`,
7023
6997
  });
7024
- console.log(`⬆️ File uploaded to OpenAI: ${file.filename} (${file.id})`);
7025
- return file;
7026
- }
7027
-
7028
- // 🌐 URL addresses of files to upload
7029
- const fileUrls = [
7030
- 'https://raw.githubusercontent.com/vercel/next.js/canary/packages/next/README.md',
7031
- 'https://raw.githubusercontent.com/openai/openai-cookbook/main/examples/How_to_call_the_Assistants_API_with_Node.js.ipynb',
7032
- ];
7033
-
7034
- // 1️⃣ Download files from URL
7035
- const localFiles = [];
7036
- for (const url of fileUrls) {
7037
- const filepath = await downloadFile(url);
7038
- localFiles.push(filepath);
7039
- }
7040
-
7041
- // 2️⃣ Upload files to OpenAI
7042
- const uploadedFiles = [];
7043
- for (const filepath of localFiles) {
7044
- const file = await uploadFileToOpenAI(filepath);
7045
- uploadedFiles.push(file.id);
6998
+ vectorStoreId = vectorStore.id;
6999
+ if (this.options.isVerbose) {
7000
+ console.info(`✅ Vector store created: ${vectorStoreId}`);
7001
+ }
7002
+ // Upload files from knowledge sources to the vector store
7003
+ const fileStreams = [];
7004
+ for (const source of knowledgeSources) {
7005
+ try {
7006
+ // Check if it's a URL
7007
+ if (source.startsWith('http://') || source.startsWith('https://')) {
7008
+ // Download the file
7009
+ const response = await fetch(source);
7010
+ if (!response.ok) {
7011
+ console.error(`Failed to download ${source}: ${response.statusText}`);
7012
+ continue;
7013
+ }
7014
+ const buffer = await response.arrayBuffer();
7015
+ const filename = source.split('/').pop() || 'downloaded-file';
7016
+ const blob = new Blob([buffer]);
7017
+ const file = new File([blob], filename);
7018
+ fileStreams.push(file);
7019
+ }
7020
+ else {
7021
+ // Assume it's a local file path
7022
+ // Note: This will work in Node.js environment
7023
+ // For browser environments, this would need different handling
7024
+ const fs = await import('fs');
7025
+ const fileStream = fs.createReadStream(source);
7026
+ fileStreams.push(fileStream);
7027
+ }
7028
+ }
7029
+ catch (error) {
7030
+ console.error(`Error processing knowledge source ${source}:`, error);
7031
+ }
7032
+ }
7033
+ // Batch upload files to the vector store
7034
+ if (fileStreams.length > 0) {
7035
+ try {
7036
+ await client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, {
7037
+ files: fileStreams,
7038
+ });
7039
+ if (this.options.isVerbose) {
7040
+ console.info(`✅ Uploaded ${fileStreams.length} files to vector store`);
7041
+ }
7042
+ }
7043
+ catch (error) {
7044
+ console.error('Error uploading files to vector store:', error);
7045
+ }
7046
+ }
7046
7047
  }
7047
- /**/
7048
- // alert('!!!! Creating new OpenAI assistant');
7049
- // 3️⃣ Create assistant with uploaded files
7050
- const assistant = await client.beta.assistants.create({
7048
+ // Create assistant with vector store attached
7049
+ const assistantConfig = {
7051
7050
  name,
7052
7051
  description: 'Assistant created via Promptbook',
7053
7052
  model: 'gpt-4o',
7054
7053
  instructions,
7055
7054
  tools: [/* TODO: [🧠] Maybe add { type: 'code_interpreter' }, */ { type: 'file_search' }],
7056
- // !!!! file_ids: uploadedFiles,
7057
- });
7055
+ };
7056
+ // Attach vector store if created
7057
+ if (vectorStoreId) {
7058
+ assistantConfig.tool_resources = {
7059
+ file_search: {
7060
+ vector_store_ids: [vectorStoreId],
7061
+ },
7062
+ };
7063
+ }
7064
+ const assistant = await client.beta.assistants.create(assistantConfig);
7058
7065
  console.log(`✅ Assistant created: ${assistant.id}`);
7059
7066
  // TODO: !!!! Try listing existing assistants
7060
7067
  // TODO: !!!! Try marking existing assistants by DISCRIMINANT
@@ -7781,6 +7788,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
7781
7788
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
7782
7789
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
7783
7790
  *
7791
+ * Note: [🔂] This function is idempotent.
7792
+ *
7784
7793
  * @param {string} pipelineString the candidate for a pipeline string
7785
7794
  * @returns {PipelineString} the same string as input, but validated as valid
7786
7795
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -8053,6 +8062,8 @@ function isValidPipelineUrl(url) {
8053
8062
  * - if it is valid json
8054
8063
  * - if it is meaningful
8055
8064
  *
8065
+ * Note: [🔂] This function is idempotent.
8066
+ *
8056
8067
  * @param pipeline valid or invalid PipelineJson
8057
8068
  * @returns the same pipeline if it is logically valid
8058
8069
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -10697,6 +10708,8 @@ function checkExpectations(expectations, value) {
10697
10708
  * This function provides a common abstraction for result validation that can be used
10698
10709
  * by both execution logic and caching logic to ensure consistency.
10699
10710
  *
10711
+ * Note: [🔂] This function is idempotent.
10712
+ *
10700
10713
  * @param options - The validation options including result string, expectations, and format
10701
10714
  * @returns Validation result with processed string and validity status
10702
10715
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -13260,40 +13273,6 @@ const _FormattedBookInMarkdownTranspilerRegistration = $bookTranspilersRegister.
13260
13273
  * Note: [💞] Ignore a discrepancy between file name and entity name
13261
13274
  */
13262
13275
 
13263
- /**
13264
- * Creates an empty/basic agent model requirements object
13265
- * This serves as the starting point for the reduce-like pattern
13266
- * where each commitment applies its changes to build the final requirements
13267
- *
13268
- * @public exported from `@promptbook/core`
13269
- */
13270
- function createEmptyAgentModelRequirements() {
13271
- return {
13272
- systemMessage: '',
13273
- // modelName: 'gpt-5',
13274
- modelName: 'gemini-2.5-flash-lite',
13275
- temperature: 0.7,
13276
- topP: 0.9,
13277
- topK: 50,
13278
- };
13279
- }
13280
- /**
13281
- * Creates a basic agent model requirements with just the agent name
13282
- * This is used when we have an agent name but no commitments
13283
- *
13284
- * @public exported from `@promptbook/core`
13285
- */
13286
- function createBasicAgentModelRequirements(agentName) {
13287
- const empty = createEmptyAgentModelRequirements();
13288
- return {
13289
- ...empty,
13290
- systemMessage: `You are ${agentName || 'AI Agent'}`,
13291
- };
13292
- }
13293
- /**
13294
- * TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
13295
- */
13296
-
13297
13276
  /**
13298
13277
  * Generates a regex pattern to match a specific commitment
13299
13278
  *
@@ -13827,23 +13806,19 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
13827
13806
  `);
13828
13807
  }
13829
13808
  applyToAgentModelRequirements(requirements, content) {
13830
- var _a;
13831
13809
  const trimmedContent = content.trim();
13832
13810
  if (!trimmedContent) {
13833
13811
  return requirements;
13834
13812
  }
13835
13813
  // Check if content is a URL (external knowledge source)
13836
- if (this.isUrl(trimmedContent)) {
13814
+ if (isValidUrl(trimmedContent)) {
13837
13815
  // Store the URL for later async processing
13838
13816
  const updatedRequirements = {
13839
13817
  ...requirements,
13840
- metadata: {
13841
- ...requirements.metadata,
13842
- knowledgeSources: [
13843
- ...(((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.knowledgeSources) || []),
13844
- trimmedContent,
13845
- ],
13846
- },
13818
+ knowledgeSources: [
13819
+ ...(requirements.knowledgeSources || []),
13820
+ trimmedContent,
13821
+ ],
13847
13822
  };
13848
13823
  // Add placeholder information about knowledge sources to system message
13849
13824
  const knowledgeInfo = `Knowledge Source URL: ${trimmedContent} (will be processed for retrieval during chat)`;
@@ -13855,18 +13830,6 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
13855
13830
  return this.appendToSystemMessage(requirements, knowledgeSection, '\n\n');
13856
13831
  }
13857
13832
  }
13858
- /**
13859
- * Check if content is a URL
13860
- */
13861
- isUrl(content) {
13862
- try {
13863
- new URL(content);
13864
- return true;
13865
- }
13866
- catch (_a) {
13867
- return false;
13868
- }
13869
- }
13870
13833
  }
13871
13834
  /**
13872
13835
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -15164,6 +15127,40 @@ function getCommitmentDefinition(type) {
15164
15127
  * Note: [💞] Ignore a discrepancy between file name and entity name
15165
15128
  */
15166
15129
 
15130
+ /**
15131
+ * Creates an empty/basic agent model requirements object
15132
+ * This serves as the starting point for the reduce-like pattern
15133
+ * where each commitment applies its changes to build the final requirements
15134
+ *
15135
+ * @public exported from `@promptbook/core`
15136
+ */
15137
+ function createEmptyAgentModelRequirements() {
15138
+ return {
15139
+ systemMessage: '',
15140
+ // modelName: 'gpt-5',
15141
+ modelName: 'gemini-2.5-flash-lite',
15142
+ temperature: 0.7,
15143
+ topP: 0.9,
15144
+ topK: 50,
15145
+ };
15146
+ }
15147
+ /**
15148
+ * Creates a basic agent model requirements with just the agent name
15149
+ * This is used when we have an agent name but no commitments
15150
+ *
15151
+ * @public exported from `@promptbook/core`
15152
+ */
15153
+ function createBasicAgentModelRequirements(agentName) {
15154
+ const empty = createEmptyAgentModelRequirements();
15155
+ return {
15156
+ ...empty,
15157
+ systemMessage: `You are ${agentName || 'AI Agent'}`,
15158
+ };
15159
+ }
15160
+ /**
15161
+ * TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
15162
+ */
15163
+
15167
15164
  /**
15168
15165
  * Parses agent source using the new commitment system with multiline support
15169
15166
  * This function replaces the hardcoded commitment parsing in the original parseAgentSource
@@ -15254,29 +15251,6 @@ function parseAgentSourceWithCommitments(agentSource) {
15254
15251
  };
15255
15252
  }
15256
15253
 
15257
- /**
15258
- * Removes comment lines (lines starting with #) from a system message
15259
- * This is used to clean up the final system message before sending it to the AI model
15260
- * while preserving the original content with comments in metadata
15261
- *
15262
- * @param systemMessage The system message that may contain comment lines
15263
- * @returns The system message with comment lines removed
15264
- *
15265
- * @private - TODO: [🧠] Maybe should be public?
15266
- */
15267
- function removeCommentsFromSystemMessage(systemMessage) {
15268
- if (!systemMessage) {
15269
- return systemMessage;
15270
- }
15271
- const lines = systemMessage.split('\n');
15272
- const filteredLines = lines.filter((line) => {
15273
- const trimmedLine = line.trim();
15274
- // Remove lines that start with # (comments)
15275
- return !trimmedLine.startsWith('#');
15276
- });
15277
- return filteredLines.join('\n').trim();
15278
- }
15279
-
15280
15254
  /**
15281
15255
  * Parses parameters from text using both supported notations:
15282
15256
  * 1. @Parameter - single word parameter starting with @
@@ -15335,6 +15309,29 @@ function parseParameters(text) {
15335
15309
  return uniqueParameters;
15336
15310
  }
15337
15311
 
15312
+ /**
15313
+ * Removes comment lines (lines starting with #) from a system message
15314
+ * This is used to clean up the final system message before sending it to the AI model
15315
+ * while preserving the original content with comments in metadata
15316
+ *
15317
+ * @param systemMessage The system message that may contain comment lines
15318
+ * @returns The system message with comment lines removed
15319
+ *
15320
+ * @private - TODO: [🧠] Maybe should be public?
15321
+ */
15322
+ function removeCommentsFromSystemMessage(systemMessage) {
15323
+ if (!systemMessage) {
15324
+ return systemMessage;
15325
+ }
15326
+ const lines = systemMessage.split('\n');
15327
+ const filteredLines = lines.filter((line) => {
15328
+ const trimmedLine = line.trim();
15329
+ // Remove lines that start with # (comments)
15330
+ return !trimmedLine.startsWith('#');
15331
+ });
15332
+ return filteredLines.join('\n').trim();
15333
+ }
15334
+
15338
15335
  /**
15339
15336
  * Creates agent model requirements using the new commitment system
15340
15337
  * This function uses a reduce-like pattern where each commitment applies its changes
@@ -18317,6 +18314,8 @@ const expectCommandParser = {
18317
18314
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
18318
18315
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
18319
18316
  *
18317
+ * Note: [🔂] This function is idempotent.
18318
+ *
18320
18319
  * @param parameterName The parameter name to validate and normalize.
18321
18320
  * @returns The validated and normalized parameter name.
18322
18321
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
@@ -20283,6 +20282,8 @@ const PADDING_LINES = 11;
20283
20282
  /**
20284
20283
  * A function that adds padding to the book content
20285
20284
  *
20285
+ * Note: [🔂] This function is idempotent.
20286
+ *
20286
20287
  * @public exported from `@promptbook/core`
20287
20288
  */
20288
20289
  function padBook(content) {